From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 00:35:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C05E106564A; Sun, 31 Oct 2010 00:35:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 399C28FC13; Sun, 31 Oct 2010 00:35: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 o9V0ZJLL033862; Sun, 31 Oct 2010 00:35:19 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V0ZJJL033860; Sun, 31 Oct 2010 00:35:19 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010310035.o9V0ZJJL033860@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 31 Oct 2010 00:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214577 - stable/7/usr.sbin/rtadvd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 00:35:19 -0000 Author: bz Date: Sun Oct 31 00:35:18 2010 New Revision: 214577 URL: http://svn.freebsd.org/changeset/base/214577 Log: MFC r214447: Correct a typo. Modified: stable/7/usr.sbin/rtadvd/rtadvd.conf.5 Directory Properties: stable/7/usr.sbin/rtadvd/ (props changed) Modified: stable/7/usr.sbin/rtadvd/rtadvd.conf.5 ============================================================================== --- stable/7/usr.sbin/rtadvd/rtadvd.conf.5 Sat Oct 30 23:49:37 2010 (r214576) +++ stable/7/usr.sbin/rtadvd/rtadvd.conf.5 Sun Oct 31 00:35:18 2010 (r214577) @@ -109,7 +109,7 @@ The default value is 64. (str or num) A 8-bit flags field in router advertisement message header. This field can be specified either as a case-sensitive string or as an integer. -A sting consists of characters each of which corresponds to a +A string consists of characters each of which corresponds to a particular flag bit(s). An integer should be the logical OR of all enabled bits. Bit 7 From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 00:37:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FE421065670; Sun, 31 Oct 2010 00:37:00 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DBD88FC0A; Sun, 31 Oct 2010 00:37: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 o9V0b01J033999; Sun, 31 Oct 2010 00:37:00 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V0b0N9033997; Sun, 31 Oct 2010 00:37:00 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010310037.o9V0b0N9033997@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 31 Oct 2010 00:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214578 - stable/8/usr.sbin/rtadvd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 00:37:00 -0000 Author: bz Date: Sun Oct 31 00:37:00 2010 New Revision: 214578 URL: http://svn.freebsd.org/changeset/base/214578 Log: MFC r214447: Correct a typo. Modified: stable/8/usr.sbin/rtadvd/rtadvd.conf.5 Directory Properties: stable/8/usr.sbin/rtadvd/ (props changed) Modified: stable/8/usr.sbin/rtadvd/rtadvd.conf.5 ============================================================================== --- stable/8/usr.sbin/rtadvd/rtadvd.conf.5 Sun Oct 31 00:35:18 2010 (r214577) +++ stable/8/usr.sbin/rtadvd/rtadvd.conf.5 Sun Oct 31 00:37:00 2010 (r214578) @@ -109,7 +109,7 @@ The default value is 64. (str or num) A 8-bit flags field in router advertisement message header. This field can be specified either as a case-sensitive string or as an integer. -A sting consists of characters each of which corresponds to a +A string consists of characters each of which corresponds to a particular flag bit(s). An integer should be the logical OR of all enabled bits. Bit 7 From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 00:51:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 139BB106566B; Sun, 31 Oct 2010 00:51:23 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F39C18FC17; Sun, 31 Oct 2010 00:51: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 o9V0pMQh034611; Sun, 31 Oct 2010 00:51:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V0pM7n034607; Sun, 31 Oct 2010 00:51:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010310051.o9V0pM7n034607@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 31 Oct 2010 00:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214579 - in stable/8/sys: conf net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 00:51:23 -0000 Author: bz Date: Sun Oct 31 00:51:22 2010 New Revision: 214579 URL: http://svn.freebsd.org/changeset/base/214579 Log: MFC r214333: Factor out DDB commands from r204145, r204279 into if_debug.c for further enhancements (1). Switch to a standard 2-clause BSD license for this (2). Unfortunately we have to un-static the ifindex_table for this but do not publicly export it. Suggested by: rwatson (1) a while back. Approved by: thompsa (2) for the change from r204279. Added: stable/8/sys/net/if_debug.c - copied unchanged from r214333, head/sys/net/if_debug.c Modified: stable/8/sys/conf/files stable/8/sys/net/if.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Sun Oct 31 00:37:00 2010 (r214578) +++ stable/8/sys/conf/files Sun Oct 31 00:51:22 2010 (r214579) @@ -2326,6 +2326,7 @@ net/if_atmsubr.c optional atm net/if_bridge.c optional bridge inet | if_bridge inet net/if_clone.c standard net/if_dead.c standard +net/if_debug.c optional ddb net/if_disc.c optional disc net/if_edsc.c optional edsc net/if_ef.c optional ef Modified: stable/8/sys/net/if.c ============================================================================== --- stable/8/sys/net/if.c Sun Oct 31 00:37:00 2010 (r214578) +++ stable/8/sys/net/if.c Sun Oct 31 00:51:22 2010 (r214579) @@ -33,7 +33,6 @@ #include "opt_compat.h" #include "opt_inet6.h" #include "opt_inet.h" -#include "opt_ddb.h" #include #include @@ -62,10 +61,6 @@ #include #include -#ifdef DDB -#include -#endif - #include #include #include @@ -186,7 +181,7 @@ VNET_DEFINE(struct ifgrouphead, ifg_head static VNET_DEFINE(int, if_indexlim) = 8; /* Table of ifnet by index. */ -static VNET_DEFINE(struct ifindex_entry *, ifindex_table); +VNET_DEFINE(struct ifindex_entry *, ifindex_table); #define V_if_indexlim VNET(if_indexlim) #define V_ifindex_table VNET(ifindex_table) @@ -3416,78 +3411,3 @@ if_deregister_com_alloc(u_char type) if_com_alloc[type] = NULL; if_com_free[type] = NULL; } - -#ifdef DDB -static void -if_show_ifnet(struct ifnet *ifp) -{ - - if (ifp == NULL) - return; - db_printf("%s:\n", ifp->if_xname); -#define IF_DB_PRINTF(f, e) db_printf(" %s = " f "\n", #e, ifp->e); - IF_DB_PRINTF("%s", if_dname); - IF_DB_PRINTF("%d", if_dunit); - IF_DB_PRINTF("%s", if_description); - IF_DB_PRINTF("%u", if_index); - IF_DB_PRINTF("%u", if_refcount); - IF_DB_PRINTF("%p", if_softc); - IF_DB_PRINTF("%p", if_l2com); - IF_DB_PRINTF("%p", if_vnet); - IF_DB_PRINTF("%p", if_home_vnet); - IF_DB_PRINTF("%p", if_addr); - IF_DB_PRINTF("%p", if_llsoftc); - IF_DB_PRINTF("%p", if_label); - IF_DB_PRINTF("%u", if_pcount); - IF_DB_PRINTF("0x%08x", if_flags); - IF_DB_PRINTF("0x%08x", if_drv_flags); - IF_DB_PRINTF("0x%08x", if_capabilities); - IF_DB_PRINTF("0x%08x", if_capenable); - IF_DB_PRINTF("%p", if_snd.ifq_head); - IF_DB_PRINTF("%p", if_snd.ifq_tail); - IF_DB_PRINTF("%d", if_snd.ifq_len); - IF_DB_PRINTF("%d", if_snd.ifq_maxlen); - IF_DB_PRINTF("%d", if_snd.ifq_drops); - IF_DB_PRINTF("%p", if_snd.ifq_drv_head); - IF_DB_PRINTF("%p", if_snd.ifq_drv_tail); - IF_DB_PRINTF("%d", if_snd.ifq_drv_len); - IF_DB_PRINTF("%d", if_snd.ifq_drv_maxlen); - IF_DB_PRINTF("%d", if_snd.altq_type); - IF_DB_PRINTF("%x", if_snd.altq_flags); -#undef IF_DB_PRINTF -} - -DB_SHOW_COMMAND(ifnet, db_show_ifnet) -{ - - if (!have_addr) { - db_printf("usage: show ifnet \n"); - return; - } - - if_show_ifnet((struct ifnet *)addr); -} - -DB_SHOW_ALL_COMMAND(ifnets, db_show_all_ifnets) -{ - VNET_ITERATOR_DECL(vnet_iter); - struct ifnet *ifp; - u_short idx; - - VNET_FOREACH(vnet_iter) { - CURVNET_SET_QUIET(vnet_iter); -#ifdef VIMAGE - db_printf("vnet=%p\n", curvnet); -#endif - for (idx = 1; idx <= V_if_index; idx++) { - ifp = V_ifindex_table[idx].ife_ifnet; - if (ifp == NULL) - continue; - db_printf( "%20s ifp=%p\n", ifp->if_xname, ifp); - if (db_pager_quit) - break; - } - CURVNET_RESTORE(); - } -} -#endif Copied: stable/8/sys/net/if_debug.c (from r214333, head/sys/net/if_debug.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/net/if_debug.c Sun Oct 31 00:51:22 2010 (r214579, copy of r214333, head/sys/net/if_debug.c) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2010 Bjoern A. Zeeb + * 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 "opt_ddb.h" + +#include +#include +#include + +#ifdef DDB +#include +#endif + +#include +#include +#include +#include + +#ifdef DDB +struct ifindex_entry { + struct ifnet *ife_ifnet; +}; +VNET_DECLARE(struct ifindex_entry *, ifindex_table); +#define V_ifindex_table VNET(ifindex_table) + +static void +if_show_ifnet(struct ifnet *ifp) +{ + + if (ifp == NULL) + return; + db_printf("%s:\n", ifp->if_xname); +#define IF_DB_PRINTF(f, e) db_printf(" %s = " f "\n", #e, ifp->e); + IF_DB_PRINTF("%s", if_dname); + IF_DB_PRINTF("%d", if_dunit); + IF_DB_PRINTF("%s", if_description); + IF_DB_PRINTF("%u", if_index); + IF_DB_PRINTF("%u", if_refcount); + IF_DB_PRINTF("%d", if_index_reserved); + IF_DB_PRINTF("%p", if_softc); + IF_DB_PRINTF("%p", if_l2com); + IF_DB_PRINTF("%p", if_vnet); + IF_DB_PRINTF("%p", if_home_vnet); + IF_DB_PRINTF("%p", if_addr); + IF_DB_PRINTF("%p", if_llsoftc); + IF_DB_PRINTF("%p", if_label); + IF_DB_PRINTF("%u", if_pcount); + IF_DB_PRINTF("0x%08x", if_flags); + IF_DB_PRINTF("0x%08x", if_drv_flags); + IF_DB_PRINTF("0x%08x", if_capabilities); + IF_DB_PRINTF("0x%08x", if_capenable); + IF_DB_PRINTF("%p", if_snd.ifq_head); + IF_DB_PRINTF("%p", if_snd.ifq_tail); + IF_DB_PRINTF("%d", if_snd.ifq_len); + IF_DB_PRINTF("%d", if_snd.ifq_maxlen); + IF_DB_PRINTF("%d", if_snd.ifq_drops); + IF_DB_PRINTF("%p", if_snd.ifq_drv_head); + IF_DB_PRINTF("%p", if_snd.ifq_drv_tail); + IF_DB_PRINTF("%d", if_snd.ifq_drv_len); + IF_DB_PRINTF("%d", if_snd.ifq_drv_maxlen); + IF_DB_PRINTF("%d", if_snd.altq_type); + IF_DB_PRINTF("%x", if_snd.altq_flags); +#undef IF_DB_PRINTF +} + +DB_SHOW_COMMAND(ifnet, db_show_ifnet) +{ + + if (!have_addr) { + db_printf("usage: show ifnet \n"); + return; + } + + if_show_ifnet((struct ifnet *)addr); +} + +DB_SHOW_ALL_COMMAND(ifnets, db_show_all_ifnets) +{ + VNET_ITERATOR_DECL(vnet_iter); + struct ifnet *ifp; + u_short idx; + + VNET_FOREACH(vnet_iter) { + CURVNET_SET_QUIET(vnet_iter); +#ifdef VIMAGE + db_printf("vnet=%p\n", curvnet); +#endif + for (idx = 1; idx <= V_if_index; idx++) { + ifp = V_ifindex_table[idx].ife_ifnet; + if (ifp == NULL) + continue; + db_printf( "%20s ifp=%p\n", ifp->if_xname, ifp); + if (db_pager_quit) + break; + } + CURVNET_RESTORE(); + } +} +#endif From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 02:36:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 436CB106566B; Sun, 31 Oct 2010 02:36:06 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16BEF8FC17; Sun, 31 Oct 2010 02:36: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 o9V2a53k039729; Sun, 31 Oct 2010 02:36:05 GMT (envelope-from wollman@svn.freebsd.org) Received: (from wollman@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V2a5hO039726; Sun, 31 Oct 2010 02:36:05 GMT (envelope-from wollman@svn.freebsd.org) Message-Id: <201010310236.o9V2a5hO039726@svn.freebsd.org> From: Garrett Wollman Date: Sun, 31 Oct 2010 02:36: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: r214583 - head/usr.bin/locate/locate X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 02:36:06 -0000 Author: wollman Date: Sun Oct 31 02:36:05 2010 New Revision: 214583 URL: http://svn.freebsd.org/changeset/base/214583 Log: Make it possible to exclude directories by name no matter where they are in the filesystem from the locate database. By default, exclude ".zfs" directories, as users who who have set snapdir=visible and are taking frequent snapshots most likely do not want the snapshots included in the locate database. Modified: head/usr.bin/locate/locate/locate.rc head/usr.bin/locate/locate/updatedb.sh Modified: head/usr.bin/locate/locate/locate.rc ============================================================================== --- head/usr.bin/locate/locate/locate.rc Sun Oct 31 02:15:23 2010 (r214582) +++ head/usr.bin/locate/locate/locate.rc Sun Oct 31 02:36:05 2010 (r214583) @@ -15,9 +15,12 @@ # directories to be put in the database #SEARCHPATHS="/" -# directories unwanted in output +# paths unwanted in output #PRUNEPATHS="/tmp /usr/tmp /var/tmp /var/db/portsnap" +# directories unwanted in output +#PRUNEDIRS=".zfs" + # filesystems allowed. Beware: a non-listed filesystem will be pruned # and if the SEARCHPATHS starts in such a filesystem locate will build # an empty database. Modified: head/usr.bin/locate/locate/updatedb.sh ============================================================================== --- head/usr.bin/locate/locate/updatedb.sh Sun Oct 31 02:15:23 2010 (r214582) +++ head/usr.bin/locate/locate/updatedb.sh Sun Oct 31 02:36:05 2010 (r214583) @@ -52,6 +52,7 @@ PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; ex : ${FCODES:=/var/db/locate.database} # the database : ${SEARCHPATHS:="/"} # directories to be put in the database : ${PRUNEPATHS:="/tmp /usr/tmp /var/tmp /var/db/portsnap"} # unwanted directories +: ${PRUNEDIRS:=".zfs"} # unwanted directories, in any parent : ${FILESYSTEMS:="$(lsvfs | tail -n +3 | \ egrep -vw "loopback|network|synthetic|read-only|0" | \ cut -d " " -f1)"} # allowed filesystems @@ -79,6 +80,14 @@ case X"$PRUNEPATHS" in done;; esac +case X"$PRUNEDIRS" in + X) ;; + *) for dir in $PRUNEDIRS + do + excludes="$excludes -or -name $dir -type d -prune" + done;; +esac + tmp=$TMPDIR/_updatedb$$ trap 'rm -f $tmp; rmdir $TMPDIR' 0 1 2 3 5 10 15 From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 03:03:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52BB2106566C; Sun, 31 Oct 2010 03:03:21 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2602D8FC08; Sun, 31 Oct 2010 03:03: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 o9V33LGP040997; Sun, 31 Oct 2010 03:03:21 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V33LTm040994; Sun, 31 Oct 2010 03:03:21 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010310303.o9V33LTm040994@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 31 Oct 2010 03:03: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: r214584 - in head/sys/pc98: include pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 03:03:21 -0000 Author: nyan Date: Sun Oct 31 03:03:20 2010 New Revision: 214584 URL: http://svn.freebsd.org/changeset/base/214584 Log: Rename BUS_SPACE_IO and BUS_SPACE_MEM defines to BUS_SPACE_TAG_IO and BUS_SPACE_TAG_MEM respectively to avoid conflict with nexus.c. Modified: head/sys/pc98/include/bus.h head/sys/pc98/pc98/busiosubr.c Modified: head/sys/pc98/include/bus.h ============================================================================== --- head/sys/pc98/include/bus.h Sun Oct 31 02:36:05 2010 (r214583) +++ head/sys/pc98/include/bus.h Sun Oct 31 03:03:20 2010 (r214584) @@ -158,8 +158,8 @@ struct bus_space_access_methods { * Access methods for bus resources and address space. */ struct bus_space_tag { -#define BUS_SPACE_IO 0 -#define BUS_SPACE_MEM 1 +#define BUS_SPACE_TAG_IO 0 +#define BUS_SPACE_TAG_MEM 1 u_int bs_tag; /* bus space flags */ struct bus_space_access_methods bs_da; /* direct access */ Modified: head/sys/pc98/pc98/busiosubr.c ============================================================================== --- head/sys/pc98/pc98/busiosubr.c Sun Oct 31 02:36:05 2010 (r214583) +++ head/sys/pc98/pc98/busiosubr.c Sun Oct 31 03:03:20 2010 (r214584) @@ -63,7 +63,7 @@ _BUS_SPACE_CALL_FUNCS_PROTO(SBUS_RA_mem, _BUS_SPACE_CALL_FUNCS_PROTO(SBUS_RA_mem,u_int32_t,4) struct bus_space_tag SBUS_io_space_tag = { - BUS_SPACE_IO, + BUS_SPACE_TAG_IO, /* direct bus access methods */ { @@ -81,7 +81,7 @@ struct bus_space_tag SBUS_io_space_tag = }; struct bus_space_tag SBUS_mem_space_tag = { - BUS_SPACE_MEM, + BUS_SPACE_TAG_MEM, /* direct bus access methods */ { @@ -109,7 +109,7 @@ _BUS_SPACE_CALL_FUNCS_PROTO(NEPC_RA_io,u _BUS_SPACE_CALL_FUNCS_PROTO(NEPC_RA_io,u_int32_t,4) struct bus_space_tag NEPC_io_space_tag = { - BUS_SPACE_IO, + BUS_SPACE_TAG_IO, /* direct bus access methods */ { @@ -127,7 +127,7 @@ struct bus_space_tag NEPC_io_space_tag = }; struct bus_space_tag NEPC_mem_space_tag = { - BUS_SPACE_MEM, + BUS_SPACE_TAG_MEM, /* direct bus access methods */ { @@ -256,7 +256,7 @@ i386_memio_subregion(bus_space_tag_t t, pbase = pbsh->bsh_base + offset; switch (t->bs_tag) { - case BUS_SPACE_IO: + case BUS_SPACE_TAG_IO: if (pbsh->bsh_iatsz > 0) { if (offset >= pbsh->bsh_iatsz || offset + size > pbsh->bsh_iatsz) @@ -265,7 +265,7 @@ i386_memio_subregion(bus_space_tag_t t, } break; - case BUS_SPACE_MEM: + case BUS_SPACE_TAG_MEM: if (pbsh->bsh_iatsz > 0) return EINVAL; if (offset > pbsh->bsh_sz || offset + size > pbsh->bsh_sz) @@ -282,7 +282,7 @@ i386_memio_subregion(bus_space_tag_t t, return error; switch (t->bs_tag) { - case BUS_SPACE_IO: + case BUS_SPACE_TAG_IO: if (pbsh->bsh_iatsz > 0) { for (i = 0; i < size; i ++) bsh->bsh_iat[i] = pbsh->bsh_iat[i + offset]; @@ -295,7 +295,7 @@ i386_memio_subregion(bus_space_tag_t t, } break; - case BUS_SPACE_MEM: + case BUS_SPACE_TAG_MEM: break; } From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 04:45:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B65FD10656AA; Sun, 31 Oct 2010 04:45:25 +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 8A64B8FC14; Sun, 31 Oct 2010 04:45:25 +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 o9V4jPeV046284; Sun, 31 Oct 2010 04:45:25 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V4jPZQ046281; Sun, 31 Oct 2010 04:45:25 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201010310445.o9V4jPZQ046281@svn.freebsd.org> From: Doug Barton Date: Sun, 31 Oct 2010 04:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214585 - in head/lib/bind: . isc/isc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 04:45:25 -0000 Author: dougb Date: Sun Oct 31 04:45:25 2010 New Revision: 214585 URL: http://svn.freebsd.org/changeset/base/214585 Log: Prep for the 9.6-ESV-R2 update Modified: head/lib/bind/config.h head/lib/bind/isc/isc/platform.h Modified: head/lib/bind/config.h ============================================================================== --- head/lib/bind/config.h Sun Oct 31 03:03:20 2010 (r214584) +++ head/lib/bind/config.h Sun Oct 31 04:45:25 2010 (r214585) @@ -147,6 +147,9 @@ int sigwait(const unsigned int *set, int /* Define if threads need PTHREAD_SCOPE_SYSTEM */ /* #undef NEED_PTHREAD_SCOPE_SYSTEM */ +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + /* Define if recvmsg() does not meet all of the BSD socket API specifications. */ /* #undef BROKEN_RECVMSG */ @@ -306,6 +309,9 @@ int sigwait(const unsigned int *set, int /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + /* Define to the version of this package. */ #define PACKAGE_VERSION "" @@ -327,11 +333,15 @@ int sigwait(const unsigned int *set, int /* #undef WITH_IDN */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -#elif ! defined __LITTLE_ENDIAN__ -/* # undef WORDS_BIGENDIAN */ + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif #endif /* Define to empty if `const' does not conform to ANSI C. */ Modified: head/lib/bind/isc/isc/platform.h ============================================================================== --- head/lib/bind/isc/isc/platform.h Sun Oct 31 03:03:20 2010 (r214584) +++ head/lib/bind/isc/isc/platform.h Sun Oct 31 04:45:25 2010 (r214585) @@ -252,7 +252,14 @@ * If the "xaddq" operation (64bit xadd) is available on this architecture, * ISC_PLATFORM_HAVEXADDQ will be defined. */ +/* + * FreeBSD local modification, preserve this over upgrades + */ +#ifdef __amd64__ +#define ISC_PLATFORM_HAVEXADDQ 1 +#else #undef ISC_PLATFORM_HAVEXADDQ +#endif /* * If the "atomic swap" operation is available on this architecture, From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 04:45:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 736DB10656A9; Sun, 31 Oct 2010 04:45:54 +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 5E2678FC15; Sun, 31 Oct 2010 04:45: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 o9V4jsZK046362; Sun, 31 Oct 2010 04:45:54 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V4jrBW046326; Sun, 31 Oct 2010 04:45:53 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201010310445.o9V4jrBW046326@svn.freebsd.org> From: Doug Barton Date: Sun, 31 Oct 2010 04:45: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: r214586 - in head/contrib/bind9: . bin/dnssec bin/named bin/named/include/named bin/nsupdate doc/arm lib/dns lib/dns/include/dns lib/isc lib/isc/include/isc lib/lwres/man X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 04:45:54 -0000 Author: dougb Date: Sun Oct 31 04:45:53 2010 New Revision: 214586 URL: http://svn.freebsd.org/changeset/base/214586 Log: Update to 9.6-ESV-R2, the latest from ISC. This version contains bug fixes that are relevant to any caching/resolving name server; as well as DNSSEC-related fixes. Modified: head/contrib/bind9/CHANGES head/contrib/bind9/README head/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html head/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.html head/contrib/bind9/bin/dnssec/dnssec-keygen.html head/contrib/bind9/bin/dnssec/dnssec-signzone.html head/contrib/bind9/bin/named/include/named/globals.h head/contrib/bind9/bin/named/main.c head/contrib/bind9/bin/named/query.c head/contrib/bind9/bin/named/server.c head/contrib/bind9/bin/nsupdate/nsupdate.html head/contrib/bind9/doc/arm/Bv9ARM-book.xml head/contrib/bind9/doc/arm/Bv9ARM.ch06.html head/contrib/bind9/doc/arm/Bv9ARM.ch07.html head/contrib/bind9/doc/arm/Bv9ARM.ch08.html head/contrib/bind9/doc/arm/Bv9ARM.ch09.html head/contrib/bind9/doc/arm/Bv9ARM.html head/contrib/bind9/doc/arm/Bv9ARM.pdf head/contrib/bind9/doc/arm/isc-logo.eps head/contrib/bind9/doc/arm/isc-logo.pdf head/contrib/bind9/doc/arm/man.dig.html head/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html head/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html head/contrib/bind9/doc/arm/man.dnssec-keygen.html head/contrib/bind9/doc/arm/man.dnssec-signzone.html head/contrib/bind9/doc/arm/man.host.html head/contrib/bind9/doc/arm/man.named-checkconf.html head/contrib/bind9/doc/arm/man.named-checkzone.html head/contrib/bind9/doc/arm/man.named.html head/contrib/bind9/doc/arm/man.nsupdate.html head/contrib/bind9/doc/arm/man.rndc-confgen.html head/contrib/bind9/doc/arm/man.rndc.conf.html head/contrib/bind9/doc/arm/man.rndc.html head/contrib/bind9/lib/dns/adb.c head/contrib/bind9/lib/dns/api head/contrib/bind9/lib/dns/include/dns/diff.h head/contrib/bind9/lib/dns/include/dns/ncache.h head/contrib/bind9/lib/dns/include/dns/rdataset.h head/contrib/bind9/lib/dns/include/dns/resolver.h head/contrib/bind9/lib/dns/include/dns/result.h head/contrib/bind9/lib/dns/include/dns/types.h head/contrib/bind9/lib/dns/include/dns/validator.h head/contrib/bind9/lib/dns/ncache.c head/contrib/bind9/lib/dns/rbtdb.c head/contrib/bind9/lib/dns/rdatalist.c head/contrib/bind9/lib/dns/rdataset.c head/contrib/bind9/lib/dns/rdataslab.c head/contrib/bind9/lib/dns/resolver.c head/contrib/bind9/lib/dns/result.c head/contrib/bind9/lib/dns/sdb.c head/contrib/bind9/lib/dns/sdlz.c head/contrib/bind9/lib/dns/validator.c head/contrib/bind9/lib/dns/view.c head/contrib/bind9/lib/isc/api head/contrib/bind9/lib/isc/include/isc/mem.h head/contrib/bind9/lib/isc/mem.c head/contrib/bind9/lib/lwres/man/lwres.html head/contrib/bind9/lib/lwres/man/lwres_buffer.html head/contrib/bind9/lib/lwres/man/lwres_config.html head/contrib/bind9/lib/lwres/man/lwres_context.html head/contrib/bind9/lib/lwres/man/lwres_gabn.html head/contrib/bind9/lib/lwres/man/lwres_gai_strerror.html head/contrib/bind9/lib/lwres/man/lwres_getaddrinfo.html head/contrib/bind9/lib/lwres/man/lwres_gethostent.html head/contrib/bind9/lib/lwres/man/lwres_getipnode.html head/contrib/bind9/lib/lwres/man/lwres_getnameinfo.html head/contrib/bind9/lib/lwres/man/lwres_getrrsetbyname.html head/contrib/bind9/lib/lwres/man/lwres_gnba.html head/contrib/bind9/lib/lwres/man/lwres_hstrerror.html head/contrib/bind9/lib/lwres/man/lwres_inetntop.html head/contrib/bind9/lib/lwres/man/lwres_noop.html head/contrib/bind9/lib/lwres/man/lwres_packet.html head/contrib/bind9/lib/lwres/man/lwres_resutil.html head/contrib/bind9/version Directory Properties: head/contrib/bind9/ (props changed) Modified: head/contrib/bind9/CHANGES ============================================================================== --- head/contrib/bind9/CHANGES Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/CHANGES Sun Oct 31 04:45:53 2010 (r214586) @@ -1,9 +1,48 @@ - --- 9.6.2-P2 released --- + --- 9.6-ESV-R2 released --- + +2939. [func] Check that named successfully skips NSEC3 records + that fail to match the NSEC3PARAM record currently + in use. [RT# 21868] + +2937. [bug] Worked around an apparent race condition in over + memory conditions. Without this fix a DNS cache DB or + ADB could incorrectly stay in an over memory state, + effectively refusing further caching, which + subsequently made a BIND 9 caching server unworkable. + This fix prevents this problem from happening by + polling the state of the memory context, rather than + making a copy of the state, which appeared to cause + a race. This is a "workaround" in that it doesn't + solve the possible race per se, but several experiments + proved this change solves the symptom. Also, the + polling overhead hasn't been reported to be an issue. + This bug should only affect a caching server that + specifies a finite max-cache-size. It's also quite + likely that the bug happens only when enabling threads, + but it's not confirmed yet. [RT #21818] + +2925. [bug] Named failed to accept uncachable negative responses + from insecure zones. [RT# 21555] + +2921. [bug] The resolver could attempt to destroy a fetch context + too soon. [RT #19878] + +2900. [bug] The placeholder negative caching element was not + properly constructed triggering a INSIST in + dns_ncache_towire(). [RT #21346] + +2890. [bug] Handle the introduction of new trusted-keys and + DS, DLV RRsets better. [RT #21097] + +2869. [bug] Fix arguments to dns_keytable_findnextkeynode() call. + [RT #20877] + + --- 9.6-ESV-R1 released --- 2876. [bug] Named could return SERVFAIL for negative responses from unsigned zones. [RT #21131] - --- 9.6.2-P1 released --- + --- 9.6-ESV released --- 2852. [bug] Handle broken DNSSEC trust chains better. [RT #15619] Modified: head/contrib/bind9/README ============================================================================== --- head/contrib/bind9/README Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/README Sun Oct 31 04:45:53 2010 (r214586) @@ -42,6 +42,12 @@ BIND 9 Stichting NLnet - NLnet Foundation Nominum, Inc. +BIND 9.6-ESV (Extended Support Version) + + BIND 9.6-ESV will be supported until March 31, 2013, at + which time you will need to upgrade to the current release + of BIND. + BIND 9.6.2 BIND 9.6.2 is a maintenance release, fixing bugs in 9.6.1. Modified: head/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html ============================================================================== --- head/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html Sun Oct 31 04:45:53 2010 (r214586) @@ -1,5 +1,5 @@ - + @@ -33,14 +33,14 @@

dnssec-dsfromkey {-s} [-v level] [-1] [-2] [-a alg] [-c class] [-d dir] {dnsname}

-

DESCRIPTION

+

DESCRIPTION

dnssec-dsfromkey outputs the Delegation Signer (DS) resource record (RR), as defined in RFC 3658 and RFC 4509, for the given key(s).

-

OPTIONS

+

OPTIONS

-1

@@ -81,7 +81,7 @@

-

EXAMPLE

+

EXAMPLE

To build the SHA-256 DS RR from the Kexample.com.+003+26160 @@ -96,7 +96,7 @@

-

FILES

+

FILES

The keyfile can be designed by the key identification Knnnn.+aaa+iiiii or the full file name @@ -110,13 +110,13 @@

-

CAVEAT

+

CAVEAT

A keyfile error can give a "file not found" even if the file exists.

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -125,7 +125,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

Modified: head/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.html ============================================================================== --- head/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.html Sun Oct 31 04:45:53 2010 (r214586) @@ -13,7 +13,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -31,7 +31,7 @@

dnssec-keyfromlabel {-a algorithm} {-l label} [-c class] [-f flag] [-k] [-n nametype] [-p protocol] [-t type] [-v level] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keyfromlabel gets keys with the given label from a crypto hardware and builds key files for DNSSEC (Secure DNS), as defined in RFC 2535 @@ -39,7 +39,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm
@@ -120,7 +120,7 @@
-

GENERATED KEY FILES

+

GENERATED KEY FILES

When dnssec-keyfromlabel completes successfully, @@ -161,7 +161,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -169,7 +169,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

Modified: head/contrib/bind9/bin/dnssec/dnssec-keygen.html ============================================================================== --- head/contrib/bind9/bin/dnssec/dnssec-keygen.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/bin/dnssec/dnssec-keygen.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -32,7 +32,7 @@

dnssec-keygen {-a algorithm} {-b keysize} {-n nametype} [-c class] [-e] [-f flag] [-g generator] [-h] [-k] [-p protocol] [-r randomdev] [-s strength] [-t type] [-v level] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keygen generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 and RFC 4034. It can also generate keys for use with @@ -45,7 +45,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm
@@ -155,7 +155,7 @@
-

GENERATED KEYS

+

GENERATED KEYS

When dnssec-keygen completes successfully, @@ -201,7 +201,7 @@

-

EXAMPLE

+

EXAMPLE

To generate a 768-bit DSA key for the domain example.com, the following command would be @@ -222,7 +222,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-signzone(8), BIND 9 Administrator Reference Manual, RFC 2539, @@ -231,7 +231,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

Modified: head/contrib/bind9/bin/dnssec/dnssec-signzone.html ============================================================================== --- head/contrib/bind9/bin/dnssec/dnssec-signzone.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/bin/dnssec/dnssec-signzone.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -32,7 +32,7 @@

dnssec-signzone [-a] [-c class] [-d directory] [-e end-time] [-f output-file] [-g] [-h] [-k key] [-l domain] [-i interval] [-I input-format] [-j jitter] [-N soa-seria l-format] [-o origin] [-O output-format] [-p] [-P] [-r randomdev] [-s start-time] [-t] [-v level] [-z] [-3 salt] [-H iterations] [-A] {zonefile} [key...]

-

DESCRIPTION

+

DESCRIPTION

dnssec-signzone signs a zone. It generates NSEC and RRSIG records and produces a signed version of the @@ -43,7 +43,7 @@

-

OPTIONS

+

OPTIONS

-a

@@ -273,7 +273,7 @@

-

EXAMPLE

+

EXAMPLE

The following command signs the example.com zone with the DSA key generated by dnssec-keygen @@ -302,7 +302,7 @@ db.example.com.signed %

-

KNOWN BUGS

+

KNOWN BUGS

dnssec-signzone was designed so that it could sign a zone partially, using only a subset of the DNSSEC keys @@ -327,14 +327,14 @@ db.example.com.signed

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), BIND 9 Administrator Reference Manual, RFC 4033.

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

Modified: head/contrib/bind9/bin/named/include/named/globals.h ============================================================================== --- head/contrib/bind9/bin/named/include/named/globals.h Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/bin/named/include/named/globals.h Sun Oct 31 04:45:53 2010 (r214586) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008, 2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: globals.h,v 1.80 2008/11/16 22:49:18 marka Exp $ */ +/* $Id: globals.h,v 1.80.84.2 2010/06/26 23:46:15 tbox Exp $ */ #ifndef NAMED_GLOBALS_H #define NAMED_GLOBALS_H 1 @@ -132,6 +132,7 @@ EXTERN int ns_g_listen INIT(3); EXTERN isc_time_t ns_g_boottime; EXTERN isc_boolean_t ns_g_memstatistics INIT(ISC_FALSE); EXTERN isc_boolean_t ns_g_clienttest INIT(ISC_FALSE); +EXTERN isc_boolean_t ns_g_nosoa INIT(ISC_FALSE); #undef EXTERN #undef INIT Modified: head/contrib/bind9/bin/named/main.c ============================================================================== --- head/contrib/bind9/bin/named/main.c Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/bin/named/main.c Sun Oct 31 04:45:53 2010 (r214586) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: main.c,v 1.166.34.3 2009/04/03 20:18:59 marka Exp $ */ +/* $Id: main.c,v 1.166.34.3.24.3 2010/09/06 03:58:32 marka Exp $ */ /*! \file */ @@ -446,13 +446,15 @@ parse_command_line(int argc, char *argv[ /* XXXJAB should we make a copy? */ ns_g_chrootdir = isc_commandline_argument; break; - case 'T': + case 'T': /* NOT DOCUMENTED */ /* * clienttest: make clients single shot with their * own memory context. */ if (strcmp(isc_commandline_argument, "clienttest") == 0) ns_g_clienttest = ISC_TRUE; + else if (!strcmp(isc_commandline_argument, "nosoa")) + ns_g_nosoa = ISC_TRUE; else fprintf(stderr, "unknown -T flag '%s\n", isc_commandline_argument); Modified: head/contrib/bind9/bin/named/query.c ============================================================================== --- head/contrib/bind9/bin/named/query.c Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/bin/named/query.c Sun Oct 31 04:45:53 2010 (r214586) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.313.20.16 2009/12/30 08:34:29 jinmei Exp $ */ +/* $Id: query.c,v 1.313.20.16.10.2 2010/06/26 23:46:14 tbox Exp $ */ /*! \file */ @@ -56,6 +56,7 @@ #include #include +#include #include #include #include @@ -2038,7 +2039,7 @@ query_addrrset(ns_client_t *client, dns_ static inline isc_result_t query_addsoa(ns_client_t *client, dns_db_t *db, dns_dbversion_t *version, - isc_boolean_t zero_ttl) + isc_boolean_t zero_ttl, isc_boolean_t isassociated) { dns_name_t *name; dns_dbnode_t *node; @@ -2056,6 +2057,12 @@ query_addsoa(ns_client_t *client, dns_db node = NULL; /* + * Don't add the SOA record for test which set "-T nosoa". + */ + if (ns_g_nosoa && (!WANTDNSSEC(client) || !isassociated)) + return (ISC_R_SUCCESS); + + /* * Get resources and make 'name' be the database origin. */ result = dns_message_gettempname(client->message, &name); @@ -4324,7 +4331,8 @@ query_find(ns_client_t *client, dns_fetc /* * Add SOA. */ - result = query_addsoa(client, db, version, ISC_FALSE); + result = query_addsoa(client, db, version, ISC_FALSE, + dns_rdataset_isassociated(rdataset)); if (result != ISC_R_SUCCESS) { QUERY_ERROR(result); goto cleanup; @@ -4372,9 +4380,11 @@ query_find(ns_client_t *client, dns_fetc zone != NULL && #endif dns_zone_getzeronosoattl(zone)) - result = query_addsoa(client, db, version, ISC_TRUE); + result = query_addsoa(client, db, version, ISC_TRUE, + dns_rdataset_isassociated(rdataset)); else - result = query_addsoa(client, db, version, ISC_FALSE); + result = query_addsoa(client, db, version, ISC_FALSE, + dns_rdataset_isassociated(rdataset)); if (result != ISC_R_SUCCESS) { QUERY_ERROR(result); goto cleanup; @@ -4742,7 +4752,7 @@ query_find(ns_client_t *client, dns_fetc * Add SOA. */ result = query_addsoa(client, db, version, - ISC_FALSE); + ISC_FALSE, ISC_FALSE); if (result == ISC_R_SUCCESS) result = ISC_R_NOMORE; } else { Modified: head/contrib/bind9/bin/named/server.c ============================================================================== --- head/contrib/bind9/bin/named/server.c Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/bin/named/server.c Sun Oct 31 04:45:53 2010 (r214586) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.520.12.11.8.2 2010/02/25 10:57:11 tbox Exp $ */ +/* $Id: server.c,v 1.520.12.11.10.1 2010/03/03 22:06:36 marka Exp $ */ /*! \file */ Modified: head/contrib/bind9/bin/nsupdate/nsupdate.html ============================================================================== --- head/contrib/bind9/bin/nsupdate/nsupdate.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/bin/nsupdate/nsupdate.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -32,7 +32,7 @@

nsupdate [-d] [-D] [[-g] | [-o] | [-y [hmac:]keyname:secret] | [-k keyfile]] [-t timeout] [-u udptimeout] [-r udpretries] [-R randomdev] [-v] [filename]

-

DESCRIPTION

+

DESCRIPTION

nsupdate is used to submit Dynamic DNS Update requests as defined in RFC2136 to a name server. @@ -169,7 +169,7 @@

-

INPUT FORMAT

+

INPUT FORMAT

nsupdate reads input from filename @@ -433,7 +433,7 @@

-

EXAMPLES

+

EXAMPLES

The examples below show how nsupdate @@ -487,7 +487,7 @@

-

FILES

+

FILES

/etc/resolv.conf

@@ -506,7 +506,7 @@

-

SEE ALSO

+

SEE ALSO

RFC2136, RFC3007, RFC2104, @@ -519,7 +519,7 @@

-

BUGS

+

BUGS

The TSIG key is redundantly stored in two separate files. This is a consequence of nsupdate using the DST library Modified: head/contrib/bind9/doc/arm/Bv9ARM-book.xml ============================================================================== --- head/contrib/bind9/doc/arm/Bv9ARM-book.xml Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/Bv9ARM-book.xml Sun Oct 31 04:45:53 2010 (r214586) @@ -18,7 +18,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + BIND 9 Administrator Reference Manual Modified: head/contrib/bind9/doc/arm/Bv9ARM.ch06.html ============================================================================== --- head/contrib/bind9/doc/arm/Bv9ARM.ch06.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/Bv9ARM.ch06.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/Bv9ARM.ch07.html ============================================================================== --- head/contrib/bind9/doc/arm/Bv9ARM.ch07.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/Bv9ARM.ch07.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/Bv9ARM.ch08.html ============================================================================== --- head/contrib/bind9/doc/arm/Bv9ARM.ch08.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/Bv9ARM.ch08.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/Bv9ARM.ch09.html ============================================================================== --- head/contrib/bind9/doc/arm/Bv9ARM.ch09.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/Bv9ARM.ch09.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/Bv9ARM.html ============================================================================== --- head/contrib/bind9/doc/arm/Bv9ARM.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/Bv9ARM.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/Bv9ARM.pdf ============================================================================== Binary file (source and/or target). No diff available. Modified: head/contrib/bind9/doc/arm/isc-logo.eps ============================================================================== Binary file (source and/or target). No diff available. Modified: head/contrib/bind9/doc/arm/isc-logo.pdf ============================================================================== Binary file (source and/or target). No diff available. Modified: head/contrib/bind9/doc/arm/man.dig.html ============================================================================== --- head/contrib/bind9/doc/arm/man.dig.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.dig.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html ============================================================================== --- head/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html ============================================================================== --- head/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.dnssec-keygen.html ============================================================================== --- head/contrib/bind9/doc/arm/man.dnssec-keygen.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.dnssec-keygen.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.dnssec-signzone.html ============================================================================== --- head/contrib/bind9/doc/arm/man.dnssec-signzone.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.dnssec-signzone.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.host.html ============================================================================== --- head/contrib/bind9/doc/arm/man.host.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.host.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.named-checkconf.html ============================================================================== --- head/contrib/bind9/doc/arm/man.named-checkconf.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.named-checkconf.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.named-checkzone.html ============================================================================== --- head/contrib/bind9/doc/arm/man.named-checkzone.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.named-checkzone.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.named.html ============================================================================== --- head/contrib/bind9/doc/arm/man.named.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.named.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.nsupdate.html ============================================================================== --- head/contrib/bind9/doc/arm/man.nsupdate.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.nsupdate.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.rndc-confgen.html ============================================================================== --- head/contrib/bind9/doc/arm/man.rndc-confgen.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.rndc-confgen.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.rndc.conf.html ============================================================================== --- head/contrib/bind9/doc/arm/man.rndc.conf.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.rndc.conf.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/doc/arm/man.rndc.html ============================================================================== --- head/contrib/bind9/doc/arm/man.rndc.html Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/doc/arm/man.rndc.html Sun Oct 31 04:45:53 2010 (r214586) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: head/contrib/bind9/lib/dns/adb.c ============================================================================== --- head/contrib/bind9/lib/dns/adb.c Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/lib/dns/adb.c Sun Oct 31 04:45:53 2010 (r214586) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: adb.c,v 1.243.42.4 2009/02/03 22:34:28 jinmei Exp $ */ +/* $Id: adb.c,v 1.243.42.4.24.2 2010/08/12 23:46:24 tbox Exp $ */ /*! \file * @@ -118,7 +118,6 @@ struct dns_adb { isc_taskmgr_t *taskmgr; isc_task_t *task; - isc_boolean_t overmem; isc_interval_t tick_interval; int next_cleanbucket; @@ -294,8 +293,8 @@ static inline void inc_adb_irefcnt(dns_a static inline void inc_adb_erefcnt(dns_adb_t *); static inline void inc_entry_refcnt(dns_adb_t *, dns_adbentry_t *, isc_boolean_t); -static inline isc_boolean_t dec_entry_refcnt(dns_adb_t *, dns_adbentry_t *, - isc_boolean_t); +static inline isc_boolean_t dec_entry_refcnt(dns_adb_t *, isc_boolean_t, + dns_adbentry_t *, isc_boolean_t); static inline void violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *); static isc_boolean_t clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static void clean_target(dns_adb_t *, dns_name_t *); @@ -777,7 +776,7 @@ link_entry(dns_adb_t *adb, int bucket, d int i; dns_adbentry_t *e; - if (adb->overmem) { + if (isc_mem_isovermem(adb->mctx)) { for (i = 0; i < 2; i++) { e = ISC_LIST_TAIL(adb->entries[bucket]); if (e == NULL) @@ -943,6 +942,7 @@ clean_namehooks(dns_adb_t *adb, dns_adbn dns_adbnamehook_t *namehook; int addr_bucket; isc_boolean_t result = ISC_FALSE; + isc_boolean_t overmem = isc_mem_isovermem(adb->mctx); addr_bucket = DNS_ADB_INVALIDBUCKET; namehook = ISC_LIST_HEAD(*namehooks); @@ -963,7 +963,8 @@ clean_namehooks(dns_adb_t *adb, dns_adbn LOCK(&adb->entrylocks[addr_bucket]); } - result = dec_entry_refcnt(adb, entry, ISC_FALSE); + result = dec_entry_refcnt(adb, overmem, entry, + ISC_FALSE); } /* @@ -1235,7 +1236,9 @@ inc_entry_refcnt(dns_adb_t *adb, dns_adb } static inline isc_boolean_t -dec_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) { +dec_entry_refcnt(dns_adb_t *adb, isc_boolean_t overmem, dns_adbentry_t *entry, + isc_boolean_t lock) +{ int bucket; isc_boolean_t destroy_entry; isc_boolean_t result = ISC_FALSE; @@ -1250,7 +1253,7 @@ dec_entry_refcnt(dns_adb_t *adb, dns_adb destroy_entry = ISC_FALSE; if (entry->refcnt == 0 && - (adb->entry_sd[bucket] || entry->expires == 0 || adb->overmem || + (adb->entry_sd[bucket] || entry->expires == 0 || overmem || (entry->flags & ENTRY_IS_DEAD) != 0)) { destroy_entry = ISC_TRUE; result = unlink_entry(adb, entry); @@ -1852,7 +1855,7 @@ check_stale_name(dns_adb_t *adb, int buc int victims, max_victims; isc_boolean_t result; dns_adbname_t *victim, *next_victim; - isc_boolean_t overmem = adb->overmem; + isc_boolean_t overmem = isc_mem_isovermem(adb->mctx); int scans = 0; INSIST(bucket != DNS_ADB_INVALIDBUCKET); @@ -2049,7 +2052,6 @@ dns_adb_create(isc_mem_t *mem, dns_view_ adb, NULL, NULL); adb->cevent_sent = ISC_FALSE; adb->shutting_down = ISC_FALSE; - adb->overmem = ISC_FALSE; ISC_LIST_INIT(adb->whenshutdown); isc_mem_attach(mem, &adb->mctx); @@ -2616,6 +2618,7 @@ dns_adb_destroyfind(dns_adbfind_t **find dns_adbaddrinfo_t *ai; int bucket; dns_adb_t *adb; + isc_boolean_t overmem; REQUIRE(findp != NULL && DNS_ADBFIND_VALID(*findp)); find = *findp; @@ -2640,13 +2643,14 @@ dns_adb_destroyfind(dns_adbfind_t **find * Return the find to the memory pool, and decrement the adb's * reference count. */ + overmem = isc_mem_isovermem(adb->mctx); ai = ISC_LIST_HEAD(find->list); while (ai != NULL) { ISC_LIST_UNLINK(find->list, ai, publink); entry = ai->entry; ai->entry = NULL; INSIST(DNS_ADBENTRY_VALID(entry)); - RUNTIME_CHECK(dec_entry_refcnt(adb, entry, ISC_TRUE) == + RUNTIME_CHECK(dec_entry_refcnt(adb, overmem, entry, ISC_TRUE) == ISC_FALSE); free_adbaddrinfo(adb, &ai); ai = ISC_LIST_HEAD(find->list); @@ -3509,6 +3513,7 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns int bucket; isc_stdtime_t now; isc_boolean_t want_check_exit = ISC_FALSE; + isc_boolean_t overmem; REQUIRE(DNS_ADB_VALID(adb)); REQUIRE(addrp != NULL); @@ -3520,13 +3525,14 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns isc_stdtime_get(&now); *addrp = NULL; + overmem = isc_mem_isovermem(adb->mctx); bucket = addr->entry->lock_bucket; LOCK(&adb->entrylocks[bucket]); entry->expires = now + ADB_ENTRY_WINDOW; - want_check_exit = dec_entry_refcnt(adb, entry, ISC_FALSE); + want_check_exit = dec_entry_refcnt(adb, overmem, entry, ISC_FALSE); UNLOCK(&adb->entrylocks[bucket]); @@ -3591,6 +3597,14 @@ dns_adb_flushname(dns_adb_t *adb, dns_na static void water(void *arg, int mark) { + /* + * We're going to change the way to handle overmem condition: use + * isc_mem_isovermem() instead of storing the state via this callback, + * since the latter way tends to cause race conditions. + * To minimize the change, and in case we re-enable the callback + * approach, however, keep this function at the moment. + */ + dns_adb_t *adb = arg; isc_boolean_t overmem = ISC_TF(mark == ISC_MEM_HIWATER); @@ -3598,17 +3612,6 @@ water(void *arg, int mark) { DP(ISC_LOG_DEBUG(1), "adb reached %s water mark", overmem ? "high" : "low"); - - /* - * We can't use adb->lock as there is potential for water - * to be called when adb->lock is held. - */ - LOCK(&adb->overmemlock); - if (adb->overmem != overmem) { - adb->overmem = overmem; - isc_mem_waterack(adb->mctx, mark); - } - UNLOCK(&adb->overmemlock); } void Modified: head/contrib/bind9/lib/dns/api ============================================================================== --- head/contrib/bind9/lib/dns/api Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/lib/dns/api Sun Oct 31 04:45:53 2010 (r214586) @@ -1,3 +1,3 @@ -LIBINTERFACE = 56 -LIBREVISION = 1 -LIBAGE = 1 +LIBINTERFACE = 57 +LIBREVISION = 0 +LIBAGE = 2 Modified: head/contrib/bind9/lib/dns/include/dns/diff.h ============================================================================== --- head/contrib/bind9/lib/dns/include/dns/diff.h Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/lib/dns/include/dns/diff.h Sun Oct 31 04:45:53 2010 (r214586) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: diff.h,v 1.15.120.2 2009/01/18 23:47:41 tbox Exp $ */ +/* $Id: diff.h,v 1.15.120.2.24.2 2010/06/04 23:49:23 tbox Exp $ */ #ifndef DNS_DIFF_H #define DNS_DIFF_H 1 @@ -70,7 +70,7 @@ typedef enum { DNS_DIFFOP_DEL = 1, /*%< Delete an RR. */ DNS_DIFFOP_EXISTS = 2, /*%< Assert RR existence. */ DNS_DIFFOP_ADDRESIGN = 4, /*%< ADD + RESIGN. */ - DNS_DIFFOP_DELRESIGN = 5, /*%< DEL + RESIGN. */ + DNS_DIFFOP_DELRESIGN = 5 /*%< DEL + RESIGN. */ } dns_diffop_t; typedef struct dns_difftuple dns_difftuple_t; Modified: head/contrib/bind9/lib/dns/include/dns/ncache.h ============================================================================== --- head/contrib/bind9/lib/dns/include/dns/ncache.h Sun Oct 31 04:45:25 2010 (r214585) +++ head/contrib/bind9/lib/dns/include/dns/ncache.h Sun Oct 31 04:45:53 2010 (r214586) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ncache.h,v 1.25.48.2 2009/12/30 23:47:31 tbox Exp $ */ +/* $Id: ncache.h,v 1.25.48.2.10.2 2010/05/14 23:48:44 tbox Exp $ */ #ifndef DNS_NCACHE_H #define DNS_NCACHE_H 1 @@ -161,6 +161,13 @@ dns_ncache_getrdataset(dns_rdataset_t *n * */ +isc_result_t +dns_ncache_getsigrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 07:57:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32CE5106564A; Sun, 31 Oct 2010 07:57:06 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20C298FC0C; Sun, 31 Oct 2010 07:57: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 o9V7v67J057270; Sun, 31 Oct 2010 07:57:06 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V7v6Z0057268; Sun, 31 Oct 2010 07:57:06 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010310757.o9V7v6Z0057268@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 31 Oct 2010 07:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214588 - stable/8/sys/pc98/cbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 07:57:06 -0000 Author: nyan Date: Sun Oct 31 07:57:05 2010 New Revision: 214588 URL: http://svn.freebsd.org/changeset/base/214588 Log: MFC: revision 208563 Reduce diffs against syscons_isa.c. No functional changes. Modified: stable/8/sys/pc98/cbus/syscons_cbus.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/pc98/cbus/syscons_cbus.c ============================================================================== --- stable/8/sys/pc98/cbus/syscons_cbus.c Sun Oct 31 07:09:58 2010 (r214587) +++ stable/8/sys/pc98/cbus/syscons_cbus.c Sun Oct 31 07:57:05 2010 (r214588) @@ -22,10 +22,11 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include "opt_syscons.h" #include @@ -47,7 +48,7 @@ static devclass_t sc_devclass; -static sc_softc_t main_softc; +static sc_softc_t main_softc; #ifdef SC_NO_SUSPEND_VTYSWITCH static int sc_no_suspend_vtswitch = 1; #else @@ -55,31 +56,34 @@ static int sc_no_suspend_vtswitch = 0; #endif static int sc_cur_scr; -TUNABLE_INT("hw.syscons.sc_no_suspend_vtswitch", (int *)&sc_no_suspend_vtswitch); +TUNABLE_INT("hw.syscons.sc_no_suspend_vtswitch", &sc_no_suspend_vtswitch); SYSCTL_DECL(_hw_syscons); SYSCTL_INT(_hw_syscons, OID_AUTO, sc_no_suspend_vtswitch, CTLFLAG_RW, - &sc_no_suspend_vtswitch, 0, "Disable VT switch before suspend."); + &sc_no_suspend_vtswitch, 0, "Disable VT switch before suspend."); static void -scidentify (driver_t *driver, device_t parent) +scidentify(driver_t *driver, device_t parent) { + BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "sc", 0); } static int scprobe(device_t dev) { + /* No pnp support */ if (isa_get_vendorid(dev)) return (ENXIO); device_set_desc(dev, "System console"); - return sc_probe_unit(device_get_unit(dev), device_get_flags(dev)); + return (sc_probe_unit(device_get_unit(dev), device_get_flags(dev))); } static int scattach(device_t dev) { + return sc_attach_unit(device_get_unit(dev), device_get_flags(dev)); } @@ -127,7 +131,8 @@ scresume(device_t dev) int sc_max_unit(void) { - return devclass_get_maxunit(sc_devclass); + + return (devclass_get_maxunit(sc_devclass)); } sc_softc_t @@ -136,52 +141,52 @@ sc_softc_t sc_softc_t *sc; if (unit < 0) - return NULL; - if (flags & SC_KERNEL_CONSOLE) { + return (NULL); + if ((flags & SC_KERNEL_CONSOLE) != 0) { /* FIXME: clear if it is wired to another unit! */ sc = &main_softc; } else { - sc = (sc_softc_t *)device_get_softc(devclass_get_device(sc_devclass, unit)); + sc = device_get_softc(devclass_get_device(sc_devclass, unit)); if (sc == NULL) - return NULL; + return (NULL); } sc->unit = unit; - if (!(sc->flags & SC_INIT_DONE)) { + if ((sc->flags & SC_INIT_DONE) == 0) { sc->keyboard = -1; sc->adapter = -1; sc->mouse_char = SC_MOUSE_CHAR; } - return sc; + return (sc); } sc_softc_t *sc_find_softc(struct video_adapter *adp, struct keyboard *kbd) { sc_softc_t *sc; - int units; int i; + int units; sc = &main_softc; - if (((adp == NULL) || (adp == sc->adp)) - && ((kbd == NULL) || (kbd == sc->kbd))) - return sc; + if ((adp == NULL || adp == sc->adp) && + (kbd == NULL || kbd == sc->kbd)) + return (sc); units = devclass_get_maxunit(sc_devclass); for (i = 0; i < units; ++i) { - sc = (sc_softc_t *)device_get_softc(devclass_get_device(sc_devclass, i)); + sc = device_get_softc(devclass_get_device(sc_devclass, i)); if (sc == NULL) continue; - if (((adp == NULL) || (adp == sc->adp)) - && ((kbd == NULL) || (kbd == sc->kbd))) - return sc; + if ((adp == NULL || adp == sc->adp) && + (kbd == NULL || kbd == sc->kbd)) + return (sc); } - return NULL; + return (NULL); } int sc_get_cons_priority(int *unit, int *flags) { const char *at; - int u, f; + int f, u; *unit = -1; for (u = 0; u < 16; u++) { @@ -207,7 +212,7 @@ sc_get_cons_priority(int *unit, int *fla *unit = 0; *flags = 0; } - return CN_INTERNAL; + return (CN_INTERNAL); } void @@ -225,12 +230,12 @@ sc_tone(int herz) if (herz) { if (timer_spkr_acquire()) - return EBUSY; + return (EBUSY); timer_spkr_setfreq(herz); - } else { + } else timer_spkr_release(); - } - return 0; + + return (0); } static device_method_t sc_methods[] = { From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 08:02:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 159231065698; Sun, 31 Oct 2010 08:02:48 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03DC48FC08; Sun, 31 Oct 2010 08:02: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 o9V82lhK058544; Sun, 31 Oct 2010 08:02:47 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V82lBO058542; Sun, 31 Oct 2010 08:02:47 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010310802.o9V82lBO058542@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 31 Oct 2010 08:02:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214589 - stable/8/sys/pc98/pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 08:02:48 -0000 Author: nyan Date: Sun Oct 31 08:02:47 2010 New Revision: 214589 URL: http://svn.freebsd.org/changeset/base/214589 Log: MFC: revision 208632 Clarify a potential issue in get_fpcontext() use. Modified: stable/8/sys/pc98/pc98/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 07:57:05 2010 (r214588) +++ stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:02:47 2010 (r214589) @@ -561,6 +561,13 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sf.sf_uc.uc_mcontext.mc_gs = rgs(); bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs)); sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ + + /* + * The get_fpcontext() call must be placed before assignments + * to mc_fsbase and mc_gsbase due to the alignment-override + * code in get_fpcontext() that possibly clobbers 12 bytes of + * mcontext after mc_fpstate. + */ get_fpcontext(td, &sf.sf_uc.uc_mcontext); fpstate_drop(td); /* @@ -2453,6 +2460,13 @@ get_mcontext(struct thread *td, mcontext mcp->mc_esp = tp->tf_esp; mcp->mc_ss = tp->tf_ss; mcp->mc_len = sizeof(*mcp); + + /* + * The get_fpcontext() call must be placed before assignments + * to mc_fsbase and mc_gsbase due to the alignment-override + * code in get_fpcontext() that possibly clobbers 12 bytes of + * mcontext after mc_fpstate. + */ get_fpcontext(td, mcp); sdp = &td->td_pcb->pcb_fsd; mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 08:08:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F04461065670; Sun, 31 Oct 2010 08:08:18 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE7558FC08; Sun, 31 Oct 2010 08:08: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 o9V88IFp059743; Sun, 31 Oct 2010 08:08:18 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V88Ich059741; Sun, 31 Oct 2010 08:08:18 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010310808.o9V88Ich059741@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 31 Oct 2010 08:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214590 - stable/8/sys/pc98/pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 08:08:19 -0000 Author: nyan Date: Sun Oct 31 08:08:18 2010 New Revision: 214590 URL: http://svn.freebsd.org/changeset/base/214590 Log: MFC: revision 208634 Reduce diffs against i386. Modified: stable/8/sys/pc98/pc98/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:02:47 2010 (r214589) +++ stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:08:18 2010 (r214590) @@ -213,6 +213,8 @@ static void cpu_startup(dummy) void *dummy; { + uintmax_t memsize; + /* * Good {morning,afternoon,evening,night}. */ @@ -222,9 +224,14 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif - printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem), - ptoa((uintmax_t)Maxmem) / 1048576); realmem = Maxmem; + + /* + * Display physical memory. + */ + memsize = ptoa((uintmax_t)Maxmem); + printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); + /* * Display any holes after the first chunk of extended memory. */ @@ -255,7 +262,6 @@ cpu_startup(dummy) */ bufinit(); vm_pager_bufferinit(); - cpu_setregs(); } @@ -1024,8 +1030,8 @@ sigreturn(td, uap) else td->td_sigstk.ss_flags &= ~SS_ONSTACK; #endif - kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); return (EJUSTRETURN); } @@ -1296,10 +1302,11 @@ SYSCTL_ULONG(_machdep, OID_AUTO, guessed */ int _default_ldt; + union descriptor gdt[NGDT * MAXCPU]; /* global descriptor table */ +union descriptor ldt[NLDT]; /* local descriptor table */ static struct gate_descriptor idt0[NIDT]; struct gate_descriptor *idt = &idt0[0]; /* interrupt descriptor table */ -union descriptor ldt[NLDT]; /* local descriptor table */ struct region_descriptor r_gdt, r_idt; /* table descriptors */ struct mtx dt_lock; /* lock for GDT and LDT */ @@ -1655,7 +1662,8 @@ getmemsize(int first) int i, off, physmap_idx, pa_indx, da_indx; int pg_n; u_long physmem_tunable; - u_int extmem, under16; + u_int extmem; + u_int under16; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; pt_entry_t *pte; quad_t dcons_addr, dcons_size; @@ -1680,7 +1688,7 @@ getmemsize(int first) /* * Perform "base memory" related probes & setup */ - under16 = pc98_getmemsize(&basemem, &extmem); + under16 = pc98_getmemsize(&basemem, &extmem); if (basemem > 640) { printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", basemem); @@ -1912,7 +1920,7 @@ do_next: } *pte = 0; invltlb(); - + /* * XXX * The last chunk must contain at least one page plus the message @@ -1942,9 +1950,8 @@ init386(first) int first; { struct gate_descriptor *gdp; - int gsel_tss, metadata_missing, x; + int gsel_tss, metadata_missing, x, pa; struct pcpu *pc; - int pa; thread0.td_kstack = proc0kstack; thread0.td_pcb = (struct pcb *) @@ -2005,7 +2012,6 @@ init386(first) pmap_kenter(pa + KERNBASE, pa); dpcpu_init((void *)(first + KERNBASE), 0); first += DPCPU_SIZE; - PCPU_SET(prvspace, pc); PCPU_SET(curthread, &thread0); PCPU_SET(curpcb, thread0.td_pcb); From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 08:14:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D909F106564A; Sun, 31 Oct 2010 08:14:52 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6C958FC08; Sun, 31 Oct 2010 08:14: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 o9V8EqGG061155; Sun, 31 Oct 2010 08:14:52 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V8Eqs6061152; Sun, 31 Oct 2010 08:14:52 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010310814.o9V8Eqs6061152@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 31 Oct 2010 08:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214591 - stable/8/sys/pc98/pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 08:14:53 -0000 Author: nyan Date: Sun Oct 31 08:14:52 2010 New Revision: 214591 URL: http://svn.freebsd.org/changeset/base/214591 Log: MFC: revision 208638 - Add an integer argument to idle to indicate how likely we are to wake from idle over the next tick. - Add a new MD routine, cpu_wake_idle() to wakeup idle threads who are suspended in cpu specific states. This function can fail and cause the scheduler to fall back to another mechanism (ipi). - Implement support for mwait in cpu_idle() on i386/amd64 machines that support it. mwait is a higher performance way to synchronize cpus as compared to hlt & ipis. - Allow selecting the idle routine by name via sysctl machdep.idle. This replaces machdep.cpu_idle_hlt. Only idle routines supported by the current machine are permitted. Modified: stable/8/sys/pc98/pc98/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:08:18 2010 (r214590) +++ stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:14:52 2010 (r214591) @@ -1104,6 +1104,7 @@ cpu_est_clockrate(int cpu_id, uint64_t * return (0); } + /* * Shutdown the CPU as much as possible */ @@ -1114,70 +1115,177 @@ cpu_halt(void) __asm__ ("hlt"); } -/* - * Hook to idle the CPU when possible. In the SMP case we default to - * off because a halted cpu will not currently pick up a new thread in the - * run queue until the next timer tick. If turned on this will result in - * approximately a 4.2% loss in real time performance in buildworld tests - * (but improves user and sys times oddly enough), and saves approximately - * 5% in power consumption on an idle machine (tests w/2xCPU 1.1GHz P3). - * - * XXX we need to have a cpu mask of idle cpus and generate an IPI or - * otherwise generate some sort of interrupt to wake up cpus sitting in HLT. - * Then we can have our cake and eat it too. - * - * XXX I'm turning it on for SMP as well by default for now. It seems to - * help lock contention somewhat, and this is critical for HTT. -Peter - */ -static int cpu_idle_hlt = 1; -TUNABLE_INT("machdep.cpu_idle_hlt", &cpu_idle_hlt); -SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW, - &cpu_idle_hlt, 0, "Idle loop HLT enable"); - static void -cpu_idle_default(void) +cpu_idle_hlt(int busy) { /* - * we must absolutely guarentee that hlt is the - * absolute next instruction after sti or we - * introduce a timing window. + * we must absolutely guarentee that hlt is the next instruction + * after sti or we introduce a timing window. */ - __asm __volatile("sti; hlt"); + disable_intr(); + if (sched_runnable()) + enable_intr(); + else + __asm __volatile("sti; hlt"); } -/* - * Note that we have to be careful here to avoid a race between checking - * sched_runnable() and actually halting. If we don't do this, we may waste - * the time between calling hlt and the next interrupt even though there - * is a runnable process. - */ +static void +cpu_idle_spin(int busy) +{ + return; +} + +void (*cpu_idle_fn)(int) = cpu_idle_hlt; + void cpu_idle(int busy) { - -#ifdef SMP +#if defined(SMP) if (mp_grab_cpu_hlt()) return; #endif + cpu_idle_fn(busy); +} + +/* + * mwait cpu power states. Lower 4 bits are sub-states. + */ +#define MWAIT_C0 0xf0 +#define MWAIT_C1 0x00 +#define MWAIT_C2 0x10 +#define MWAIT_C3 0x20 +#define MWAIT_C4 0x30 + +#define MWAIT_DISABLED 0x0 +#define MWAIT_WOKEN 0x1 +#define MWAIT_WAITING 0x2 + +static void +cpu_idle_mwait(int busy) +{ + int *mwait; - if (cpu_idle_hlt) { - disable_intr(); - if (sched_runnable()) - enable_intr(); - else - (*cpu_idle_hook)(); + mwait = (int *)PCPU_PTR(monitorbuf); + *mwait = MWAIT_WAITING; + if (sched_runnable()) + return; + cpu_monitor(mwait, 0, 0); + if (*mwait == MWAIT_WAITING) + cpu_mwait(0, MWAIT_C1); +} + +static void +cpu_idle_mwait_hlt(int busy) +{ + int *mwait; + + mwait = (int *)PCPU_PTR(monitorbuf); + if (busy == 0) { + *mwait = MWAIT_DISABLED; + cpu_idle_hlt(busy); + return; } + *mwait = MWAIT_WAITING; + if (sched_runnable()) + return; + cpu_monitor(mwait, 0, 0); + if (*mwait == MWAIT_WAITING) + cpu_mwait(0, MWAIT_C1); } int cpu_idle_wakeup(int cpu) { + struct pcpu *pcpu; + int *mwait; - return (0); + if (cpu_idle_fn == cpu_idle_spin) + return (1); + if (cpu_idle_fn != cpu_idle_mwait && cpu_idle_fn != cpu_idle_mwait_hlt) + return (0); + pcpu = pcpu_find(cpu); + mwait = (int *)pcpu->pc_monitorbuf; + /* + * This doesn't need to be atomic since missing the race will + * simply result in unnecessary IPIs. + */ + if (cpu_idle_fn == cpu_idle_mwait_hlt && *mwait == MWAIT_DISABLED) + return (0); + *mwait = MWAIT_WOKEN; + + return (1); +} + +/* + * Ordered by speed/power consumption. + */ +struct { + void *id_fn; + char *id_name; +} idle_tbl[] = { + { cpu_idle_spin, "spin" }, + { cpu_idle_mwait, "mwait" }, + { cpu_idle_mwait_hlt, "mwait_hlt" }, + { cpu_idle_hlt, "hlt" }, + { NULL, NULL } +}; + +static int +idle_sysctl_available(SYSCTL_HANDLER_ARGS) +{ + char *avail, *p; + int error; + int i; + + avail = malloc(256, M_TEMP, M_WAITOK); + p = avail; + for (i = 0; idle_tbl[i].id_name != NULL; i++) { + if (strstr(idle_tbl[i].id_name, "mwait") && + (cpu_feature2 & CPUID2_MON) == 0) + continue; + p += sprintf(p, "%s, ", idle_tbl[i].id_name); + } + error = sysctl_handle_string(oidp, avail, 0, req); + free(avail, M_TEMP); + return (error); } -/* Other subsystems (e.g., ACPI) can hook this later. */ -void (*cpu_idle_hook)(void) = cpu_idle_default; +static int +idle_sysctl(SYSCTL_HANDLER_ARGS) +{ + char buf[16]; + int error; + char *p; + int i; + + p = "unknown"; + for (i = 0; idle_tbl[i].id_name != NULL; i++) { + if (idle_tbl[i].id_fn == cpu_idle_fn) { + p = idle_tbl[i].id_name; + break; + } + } + strncpy(buf, p, sizeof(buf)); + error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + if (error != 0 || req->newptr == NULL) + return (error); + for (i = 0; idle_tbl[i].id_name != NULL; i++) { + if (strstr(idle_tbl[i].id_name, "mwait") && + (cpu_feature2 & CPUID2_MON) == 0) + continue; + if (strcmp(idle_tbl[i].id_name, buf)) + continue; + cpu_idle_fn = idle_tbl[i].id_fn; + return (0); + } + return (EINVAL); +} + +SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD, + 0, 0, idle_sysctl_available, "A", "list of available idle functions"); + +SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, + idle_sysctl, "A", "currently selected idle function"); /* * Reset registers to default values on exec. From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 08:18:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DF77106564A; Sun, 31 Oct 2010 08:18:24 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C8258FC0A; Sun, 31 Oct 2010 08:18: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 o9V8IN1E061956; Sun, 31 Oct 2010 08:18:23 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V8INmD061954; Sun, 31 Oct 2010 08:18:23 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010310818.o9V8INmD061954@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 31 Oct 2010 08:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214592 - stable/8/sys/pc98/pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 08:18:24 -0000 Author: nyan Date: Sun Oct 31 08:18:23 2010 New Revision: 214592 URL: http://svn.freebsd.org/changeset/base/214592 Log: MFC: revision 208639 Use SEL_KPL macro. Modified: stable/8/sys/pc98/pc98/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:14:52 2010 (r214591) +++ stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:18:23 2010 (r214592) @@ -1439,7 +1439,7 @@ struct soft_segment_descriptor gdt_segs[ { .ssd_base = 0x0, .ssd_limit = 0x0, .ssd_type = 0, - .ssd_dpl = 0, + .ssd_dpl = SEL_KPL, .ssd_p = 0, .ssd_xx = 0, .ssd_xx1 = 0, .ssd_def32 = 0, @@ -1448,7 +1448,7 @@ struct soft_segment_descriptor gdt_segs[ { .ssd_base = 0x0, .ssd_limit = 0xfffff, .ssd_type = SDT_MEMRWA, - .ssd_dpl = 0, + .ssd_dpl = SEL_KPL, .ssd_p = 1, .ssd_xx = 0, .ssd_xx1 = 0, .ssd_def32 = 1, @@ -1475,7 +1475,7 @@ struct soft_segment_descriptor gdt_segs[ { .ssd_base = 0x0, .ssd_limit = 0xfffff, .ssd_type = SDT_MEMERA, - .ssd_dpl = 0, + .ssd_dpl = SEL_KPL, .ssd_p = 1, .ssd_xx = 0, .ssd_xx1 = 0, .ssd_def32 = 1, @@ -1484,7 +1484,7 @@ struct soft_segment_descriptor gdt_segs[ { .ssd_base = 0x0, .ssd_limit = 0xfffff, .ssd_type = SDT_MEMRWA, - .ssd_dpl = 0, + .ssd_dpl = SEL_KPL, .ssd_p = 1, .ssd_xx = 0, .ssd_xx1 = 0, .ssd_def32 = 1, @@ -1511,7 +1511,7 @@ struct soft_segment_descriptor gdt_segs[ { .ssd_base = 0x400, .ssd_limit = 0xfffff, .ssd_type = SDT_MEMRWA, - .ssd_dpl = 0, + .ssd_dpl = SEL_KPL, .ssd_p = 1, .ssd_xx = 0, .ssd_xx1 = 0, .ssd_def32 = 1, From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 08:39:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5055106564A; Sun, 31 Oct 2010 08:39:42 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 931AC8FC16; Sun, 31 Oct 2010 08:39: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 o9V8dgo6066501; Sun, 31 Oct 2010 08:39:42 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V8dg4C066499; Sun, 31 Oct 2010 08:39:42 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010310839.o9V8dg4C066499@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 31 Oct 2010 08:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214593 - stable/8/sys/pc98/pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 08:39:42 -0000 Author: nyan Date: Sun Oct 31 08:39:42 2010 New Revision: 214593 URL: http://svn.freebsd.org/changeset/base/214593 Log: MFC: revision 214258 Rewrite the i386 memory probe: - Move the base memory setup into a new basemem_setup() routine. The mergeinfo is already recorded accidentally in the previous commit. Modified: stable/8/sys/pc98/pc98/machdep.c Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:18:23 2010 (r214592) +++ stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:39:42 2010 (r214593) @@ -1751,52 +1751,13 @@ sdtossd(sd, ssd) ssd->ssd_gran = sd->sd_gran; } -/* - * Populate the (physmap) array with base/bound pairs describing the - * available physical memory in the system, then test this memory and - * build the phys_avail array describing the actually-available memory. - * - * If we cannot accurately determine the physical memory map, then use - * value from the 0xE801 call, and failing that, the RTC. - * - * Total memory size may be set by the kernel environment variable - * hw.physmem or the compile-time define MAXMEM. - * - * XXX first should be vm_paddr_t. - */ static void -getmemsize(int first) +basemem_setup(void) { - int i, off, physmap_idx, pa_indx, da_indx; - int pg_n; - u_long physmem_tunable; - u_int extmem; - u_int under16; - vm_paddr_t pa, physmap[PHYSMAP_SIZE]; + vm_paddr_t pa; pt_entry_t *pte; - quad_t dcons_addr, dcons_size; - - bzero(physmap, sizeof(physmap)); - - /* XXX - some of EPSON machines can't use PG_N */ - pg_n = PG_N; - if (pc98_machine_type & M_EPSON_PC98) { - switch (epson_machine_id) { -#ifdef WB_CACHE - default: -#endif - case EPSON_PC486_HX: - case EPSON_PC486_HG: - case EPSON_PC486_HA: - pg_n = 0; - break; - } - } + int i; - /* - * Perform "base memory" related probes & setup - */ - under16 = pc98_getmemsize(&basemem, &extmem); if (basemem > 640) { printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", basemem); @@ -1828,12 +1789,62 @@ getmemsize(int first) pmap_kenter(KERNBASE + pa, pa); /* - * if basemem != 640, map pages r/w into vm86 page table so - * that the bios can scribble on it. + * Map pages between basemem and ISA_HOLE_START, if any, r/w into + * the vm86 page table so that vm86 can scribble on them using + * the vm86 map too. XXX: why 2 ways for this and only 1 way for + * page 0, at least as initialized here? */ pte = (pt_entry_t *)vm86paddr; for (i = basemem / 4; i < 160; i++) pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; +} + +/* + * Populate the (physmap) array with base/bound pairs describing the + * available physical memory in the system, then test this memory and + * build the phys_avail array describing the actually-available memory. + * + * If we cannot accurately determine the physical memory map, then use + * value from the 0xE801 call, and failing that, the RTC. + * + * Total memory size may be set by the kernel environment variable + * hw.physmem or the compile-time define MAXMEM. + * + * XXX first should be vm_paddr_t. + */ +static void +getmemsize(int first) +{ + int off, physmap_idx, pa_indx, da_indx; + u_long physmem_tunable; + vm_paddr_t physmap[PHYSMAP_SIZE]; + pt_entry_t *pte; + quad_t dcons_addr, dcons_size; + int i; + int pg_n; + u_int extmem; + u_int under16; + vm_paddr_t pa; + + bzero(physmap, sizeof(physmap)); + + /* XXX - some of EPSON machines can't use PG_N */ + pg_n = PG_N; + if (pc98_machine_type & M_EPSON_PC98) { + switch (epson_machine_id) { +#ifdef WB_CACHE + default: +#endif + case EPSON_PC486_HX: + case EPSON_PC486_HG: + case EPSON_PC486_HA: + pg_n = 0; + break; + } + } + + under16 = pc98_getmemsize(&basemem, &extmem); + basemem_setup(); physmap[0] = 0; physmap[1] = basemem * 1024; From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 08:50:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E285106566B; Sun, 31 Oct 2010 08:50:31 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C5CA8FC14; Sun, 31 Oct 2010 08:50: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 o9V8oV9L068868; Sun, 31 Oct 2010 08:50:31 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V8oVKR068866; Sun, 31 Oct 2010 08:50:31 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010310850.o9V8oVKR068866@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 31 Oct 2010 08:50:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214594 - stable/7/sys/pc98/pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 08:50:31 -0000 Author: nyan Date: Sun Oct 31 08:50:31 2010 New Revision: 214594 URL: http://svn.freebsd.org/changeset/base/214594 Log: MFC: revision 214258 Rewrite the i386 memory probe: - Move the base memory setup into a new basemem_setup() routine. Modified: stable/7/sys/pc98/pc98/machdep.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pc98/pc98/machdep.c ============================================================================== --- stable/7/sys/pc98/pc98/machdep.c Sun Oct 31 08:39:42 2010 (r214593) +++ stable/7/sys/pc98/pc98/machdep.c Sun Oct 31 08:50:31 2010 (r214594) @@ -1618,51 +1618,13 @@ sdtossd(sd, ssd) ssd->ssd_gran = sd->sd_gran; } -/* - * Populate the (physmap) array with base/bound pairs describing the - * available physical memory in the system, then test this memory and - * build the phys_avail array describing the actually-available memory. - * - * If we cannot accurately determine the physical memory map, then use - * value from the 0xE801 call, and failing that, the RTC. - * - * Total memory size may be set by the kernel environment variable - * hw.physmem or the compile-time define MAXMEM. - * - * XXX first should be vm_paddr_t. - */ static void -getmemsize(int first) +basemem_setup(void) { - int i, off, physmap_idx, pa_indx, da_indx; - int pg_n; - u_long physmem_tunable; - u_int extmem, under16; - vm_paddr_t pa, physmap[PHYSMAP_SIZE]; + vm_paddr_t pa; pt_entry_t *pte; - quad_t dcons_addr, dcons_size; - - bzero(physmap, sizeof(physmap)); - - /* XXX - some of EPSON machines can't use PG_N */ - pg_n = PG_N; - if (pc98_machine_type & M_EPSON_PC98) { - switch (epson_machine_id) { -#ifdef WB_CACHE - default: -#endif - case EPSON_PC486_HX: - case EPSON_PC486_HG: - case EPSON_PC486_HA: - pg_n = 0; - break; - } - } + int i; - /* - * Perform "base memory" related probes & setup - */ - under16 = pc98_getmemsize(&basemem, &extmem); if (basemem > 640) { printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", basemem); @@ -1694,12 +1656,62 @@ getmemsize(int first) pmap_kenter(KERNBASE + pa, pa); /* - * if basemem != 640, map pages r/w into vm86 page table so - * that the bios can scribble on it. + * Map pages between basemem and ISA_HOLE_START, if any, r/w into + * the vm86 page table so that vm86 can scribble on them using + * the vm86 map too. XXX: why 2 ways for this and only 1 way for + * page 0, at least as initialized here? */ pte = (pt_entry_t *)vm86paddr; for (i = basemem / 4; i < 160; i++) pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; +} + +/* + * Populate the (physmap) array with base/bound pairs describing the + * available physical memory in the system, then test this memory and + * build the phys_avail array describing the actually-available memory. + * + * If we cannot accurately determine the physical memory map, then use + * value from the 0xE801 call, and failing that, the RTC. + * + * Total memory size may be set by the kernel environment variable + * hw.physmem or the compile-time define MAXMEM. + * + * XXX first should be vm_paddr_t. + */ +static void +getmemsize(int first) +{ + int off, physmap_idx, pa_indx, da_indx; + u_long physmem_tunable; + vm_paddr_t physmap[PHYSMAP_SIZE]; + pt_entry_t *pte; + quad_t dcons_addr, dcons_size; + int i; + int pg_n; + u_int extmem; + u_int under16; + vm_paddr_t pa; + + bzero(physmap, sizeof(physmap)); + + /* XXX - some of EPSON machines can't use PG_N */ + pg_n = PG_N; + if (pc98_machine_type & M_EPSON_PC98) { + switch (epson_machine_id) { +#ifdef WB_CACHE + default: +#endif + case EPSON_PC486_HX: + case EPSON_PC486_HG: + case EPSON_PC486_HA: + pg_n = 0; + break; + } + } + + under16 = pc98_getmemsize(&basemem, &extmem); + basemem_setup(); physmap[0] = 0; physmap[1] = basemem * 1024; From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 09:05:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D1C0106564A; Sun, 31 Oct 2010 09:05:05 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B9E18FC14; Sun, 31 Oct 2010 09:05: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 o9V954mF072022; Sun, 31 Oct 2010 09:05:04 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V954Ok072019; Sun, 31 Oct 2010 09:05:04 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010310905.o9V954Ok072019@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 31 Oct 2010 09:05:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214595 - stable/8/sys/pc98/pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 09:05:05 -0000 Author: nyan Date: Sun Oct 31 09:05:04 2010 New Revision: 214595 URL: http://svn.freebsd.org/changeset/base/214595 Log: MFC: revision 207355 - Change printf() calls to uprintf() for sigreturn(). - Normalize the messages to include both pid and thread name. Modified: stable/8/sys/pc98/pc98/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 08:50:31 2010 (r214594) +++ stable/8/sys/pc98/pc98/machdep.c Sun Oct 31 09:05:04 2010 (r214595) @@ -885,7 +885,8 @@ freebsd4_sigreturn(td, uap) * one less debugger trap, so allowing it is fairly harmless. */ if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_eflags & ~PSL_RF)) { - printf("freebsd4_sigreturn: eflags = 0x%x\n", eflags); + uprintf("pid %d (%s): freebsd4_sigreturn eflags = 0x%x\n", + td->td_proc->p_pid, td->td_name, eflags); return (EINVAL); } @@ -896,7 +897,8 @@ freebsd4_sigreturn(td, uap) */ cs = ucp->uc_mcontext.mc_cs; if (!CS_SECURE(cs)) { - printf("freebsd4_sigreturn: cs = 0x%x\n", cs); + uprintf("pid %d (%s): freebsd4_sigreturn cs = 0x%x\n", + td->td_proc->p_pid, td->td_name, cs); ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_OBJERR; @@ -997,7 +999,8 @@ sigreturn(td, uap) * one less debugger trap, so allowing it is fairly harmless. */ if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_eflags & ~PSL_RF)) { - printf("sigreturn: eflags = 0x%x\n", eflags); + uprintf("pid %d (%s): sigreturn eflags = 0x%x\n", + td->td_proc->p_pid, td->td_name, eflags); return (EINVAL); } @@ -1008,7 +1011,8 @@ sigreturn(td, uap) */ cs = ucp->uc_mcontext.mc_cs; if (!CS_SECURE(cs)) { - printf("sigreturn: cs = 0x%x\n", cs); + uprintf("pid %d (%s): sigreturn cs = 0x%x\n", + td->td_proc->p_pid, td->td_name, cs); ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_OBJERR; From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 09:21:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52337106566C; Sun, 31 Oct 2010 09:21:28 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4160E8FC16; Sun, 31 Oct 2010 09:21:28 +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 o9V9LSLT075410; Sun, 31 Oct 2010 09:21:28 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9V9LSo4075408; Sun, 31 Oct 2010 09:21:28 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201010310921.o9V9LSo4075408@svn.freebsd.org> From: Ulrich Spoerlein Date: Sun, 31 Oct 2010 09:21:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 09:21:28 -0000 Author: uqs Date: Sun Oct 31 09:21:27 2010 New Revision: 214596 URL: http://svn.freebsd.org/changeset/base/214596 Log: Elaborate some more on the non-security implications of using -P Submitted by: delphij Discussion at: svn-src-all Modified: head/bin/rm/rm.1 Modified: head/bin/rm/rm.1 ============================================================================== --- head/bin/rm/rm.1 Sun Oct 31 09:05:04 2010 (r214595) +++ head/bin/rm/rm.1 Sun Oct 31 09:21:27 2010 (r214596) @@ -32,7 +32,7 @@ .\" @(#)rm.1 8.5 (Berkeley) 12/5/94 .\" $FreeBSD$ .\" -.Dd October 8, 2010 +.Dd October 31, 2010 .Dt RM 1 .Os .Sh NAME @@ -100,6 +100,11 @@ Specifying this flag for a read only fil .Nm to generate an error message and exit. The file will not be removed or overwritten. +.Pp +N.B.: The +.Fl P +flag is not considered a security feature +.Pq see Sx BUGS . .It Fl R Attempt to remove the file hierarchy rooted in each .Ar file @@ -229,8 +234,12 @@ command appeared in .Sh BUGS The .Fl P -option assumes that the underlying file system updates existing blocks -in-place and does not store new data in a new location. -This is true for UFS, but not for ZFS or other file systems which use -copy-on-write semantics. -In addition, only regular files are overwritten. +option assumes that the underlying storage overwrites file block +when data is written to an existing offset. +Several factors including the file system and its backing store could defeat +this assumption. +This includes, but is not limited to file systems that use a +Copy-On-Write strategy (e.g. ZFS or UFS when snapshots are being used), Flash +media that is using a wear leveling algorithm, or when the backing datastore +does journaling, etc. +In addition, only regular files are overwritten, other types of files are not. From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 10:55:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 3CC811065673; Sun, 31 Oct 2010 10:55:31 +0000 (UTC) Date: Sun, 31 Oct 2010 10:55:31 +0000 From: Alexander Best To: Ulrich Spoerlein Message-ID: <20101031105531.GA68591@freebsd.org> References: <201010310921.o9V9LSo4075408@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="y0ulUmNC+osPPQO6" Content-Disposition: inline In-Reply-To: <201010310921.o9V9LSo4075408@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 10:55:31 -0000 --y0ulUmNC+osPPQO6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun Oct 31 10, Ulrich Spoerlein wrote: > Author: uqs > Date: Sun Oct 31 09:21:27 2010 > New Revision: 214596 > URL: http://svn.freebsd.org/changeset/base/214596 > > Log: > Elaborate some more on the non-security implications of using -P thanks a lot. i think there are a few typos though (see attached patch). cheers. alex > > Submitted by: delphij > Discussion at: svn-src-all > > Modified: > head/bin/rm/rm.1 > > Modified: head/bin/rm/rm.1 > ============================================================================== > --- head/bin/rm/rm.1 Sun Oct 31 09:05:04 2010 (r214595) > +++ head/bin/rm/rm.1 Sun Oct 31 09:21:27 2010 (r214596) > @@ -32,7 +32,7 @@ > .\" @(#)rm.1 8.5 (Berkeley) 12/5/94 > .\" $FreeBSD$ > .\" > -.Dd October 8, 2010 > +.Dd October 31, 2010 > .Dt RM 1 > .Os > .Sh NAME > @@ -100,6 +100,11 @@ Specifying this flag for a read only fil > .Nm > to generate an error message and exit. > The file will not be removed or overwritten. > +.Pp > +N.B.: The > +.Fl P > +flag is not considered a security feature > +.Pq see Sx BUGS . > .It Fl R > Attempt to remove the file hierarchy rooted in each > .Ar file > @@ -229,8 +234,12 @@ command appeared in > .Sh BUGS > The > .Fl P > -option assumes that the underlying file system updates existing blocks > -in-place and does not store new data in a new location. > -This is true for UFS, but not for ZFS or other file systems which use > -copy-on-write semantics. > -In addition, only regular files are overwritten. > +option assumes that the underlying storage overwrites file block > +when data is written to an existing offset. > +Several factors including the file system and its backing store could defeat > +this assumption. > +This includes, but is not limited to file systems that use a > +Copy-On-Write strategy (e.g. ZFS or UFS when snapshots are being used), Flash > +media that is using a wear leveling algorithm, or when the backing datastore > +does journaling, etc. > +In addition, only regular files are overwritten, other types of files are not. -- a13x --y0ulUmNC+osPPQO6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rm.1.diff" diff --git a/bin/rm/rm.1 b/bin/rm/rm.1 index 4e4f240..ad81066 100644 --- a/bin/rm/rm.1 +++ b/bin/rm/rm.1 @@ -234,12 +234,12 @@ command appeared in .Sh BUGS The .Fl P -option assumes that the underlying storage overwrites file block +option assumes that the underlying storage overwrites file blocks when data is written to an existing offset. Several factors including the file system and its backing store could defeat this assumption. This includes, but is not limited to file systems that use a Copy-On-Write strategy (e.g. ZFS or UFS when snapshots are being used), Flash -media that is using a wear leveling algorithm, or when the backing datastore +media that are using a wear leveling algorithm, or when the backing datastore does journaling, etc. In addition, only regular files are overwritten, other types of files are not. --y0ulUmNC+osPPQO6-- From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 11:44:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28FC7106566B; Sun, 31 Oct 2010 11:44:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 183E58FC1A; Sun, 31 Oct 2010 11:44: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 o9VBifR3085972; Sun, 31 Oct 2010 11:44:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VBifsO085970; Sun, 31 Oct 2010 11:44:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010311144.o9VBifsO085970@svn.freebsd.org> From: Alexander Motin Date: Sun, 31 Oct 2010 11:44: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: r214597 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 11:44:42 -0000 Author: mav Date: Sun Oct 31 11:44:41 2010 New Revision: 214597 URL: http://svn.freebsd.org/changeset/base/214597 Log: Fix callout_tickstofirst() behavior after signed integer ticks overflow. This should fix callout precision drop to 1/4s after 25 days of uptime with HZ = 1000. Submitted by: Taku YAMAMOTO Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Sun Oct 31 09:21:27 2010 (r214596) +++ head/sys/kern/kern_timeout.c Sun Oct 31 11:44:41 2010 (r214597) @@ -295,8 +295,7 @@ callout_tickstofirst(int limit) sc = &cc->cc_callwheel[ (curticks+skip) & callwheelmask ]; /* search scanning ticks */ TAILQ_FOREACH( c, sc, c_links.tqe ){ - if (c && (c->c_time <= curticks + ncallout) - && (c->c_time > 0)) + if (c->c_time - curticks <= ncallout) goto out; } skip++; From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 11:54:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C623B106566B; Sun, 31 Oct 2010 11:54:01 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 8C58B8FC08; Sun, 31 Oct 2010 11:54:01 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id F211E359A04; Sun, 31 Oct 2010 12:54:00 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 1677) id E7A48174A9; Sun, 31 Oct 2010 12:54:00 +0100 (CET) Date: Sun, 31 Oct 2010 12:54:00 +0100 From: Jilles Tjoelker To: Garrett Wollman Message-ID: <20101031115400.GA72674@stack.nl> References: <201010310236.o9V2a5hO039726@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010310236.o9V2a5hO039726@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: r214583 - head/usr.bin/locate/locate X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 11:54:01 -0000 On Sun, Oct 31, 2010 at 02:36:05AM +0000, Garrett Wollman wrote: > Author: wollman > Date: Sun Oct 31 02:36:05 2010 > New Revision: 214583 > URL: http://svn.freebsd.org/changeset/base/214583 > Log: > Make it possible to exclude directories by name no matter where they > are in the filesystem from the locate database. By default, exclude > ".zfs" directories, as users who who have set snapdir=visible and are > taking frequent snapshots most likely do not want the snapshots > included in the locate database. > Modified: head/usr.bin/locate/locate/updatedb.sh > ============================================================================== > --- head/usr.bin/locate/locate/updatedb.sh Sun Oct 31 02:15:23 2010 (r214582) > +++ head/usr.bin/locate/locate/updatedb.sh Sun Oct 31 02:36:05 2010 (r214583) > @@ -52,6 +52,7 @@ PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; ex > : ${FCODES:=/var/db/locate.database} # the database > : ${SEARCHPATHS:="/"} # directories to be put in the database > : ${PRUNEPATHS:="/tmp /usr/tmp /var/tmp /var/db/portsnap"} # unwanted directories > +: ${PRUNEDIRS:=".zfs"} # unwanted directories, in any parent This makes it impossible to use empty PRUNEDIRS as it will be changed to ".zfs". I suppose it should be changed to : ${PRUNEDIRS=".zfs"} There are also checks for empty SEARCHPATHS and FILESYSTEMS below which will never trigger for the same reason. > : ${FILESYSTEMS:="$(lsvfs | tail -n +3 | \ > egrep -vw "loopback|network|synthetic|read-only|0" | \ > cut -d " " -f1)"} # allowed filesystems > @@ -79,6 +80,14 @@ case X"$PRUNEPATHS" in > done;; > esac > > +case X"$PRUNEDIRS" in > + X) ;; > + *) for dir in $PRUNEDIRS > + do > + excludes="$excludes -or -name $dir -type d -prune" > + done;; > +esac > + > tmp=$TMPDIR/_updatedb$$ > trap 'rm -f $tmp; rmdir $TMPDIR' 0 1 2 3 5 10 15 The X stuff seems to be here for consistency with the rest of the script, but is unnecessary. Even in old shells, things like case $PRUNEDIRS in '') ;; esac work fine. On the other hand, for optimal portability one should indeed still write [ "X$FOO" = "X$BAR" ] since [ "$FOO" = "$BAR" ] will not work properly for some values of $FOO and $BAR on some only slightly old shells (e.g. FreeBSD 6.4, 7.0 sh treat [ \( = \) ] incorrectly). -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 12:05:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FC3910656A3; Sun, 31 Oct 2010 12:05:38 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13FF28FC14; Sun, 31 Oct 2010 12:05: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 o9VC5be4086869; Sun, 31 Oct 2010 12:05:37 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VC5bvi086867; Sun, 31 Oct 2010 12:05:37 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201010311205.o9VC5bvi086867@svn.freebsd.org> From: Benedict Reuschling Date: Sun, 31 Oct 2010 12:05:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214598 - stable/8/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 12:05:38 -0000 Author: bcr (doc committer) Date: Sun Oct 31 12:05:37 2010 New Revision: 214598 URL: http://svn.freebsd.org/changeset/base/214598 Log: MFC r214387: Add some missing documentation to the man page: - FILES section ref: ~/nsmb.conf - use of password in examples section - use of simple encryption for password in examples section PR: docs/132311 Submitted by: David Horn (dhorn2000 at gmail dot com) Patch corrected by: trhodes Approved by: trhodes Modified: stable/8/share/man/man5/nsmb.conf.5 Directory Properties: stable/8/share/man/man5/ (props changed) Modified: stable/8/share/man/man5/nsmb.conf.5 ============================================================================== --- stable/8/share/man/man5/nsmb.conf.5 Sun Oct 31 11:44:41 2010 (r214597) +++ stable/8/share/man/man5/nsmb.conf.5 Sun Oct 31 12:05:37 2010 (r214598) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 30, 2003 +.Dd October 19, 2010 .Dt NSMB.CONF 5 .Os .Sh NAME @@ -87,7 +87,7 @@ Possible keywords may include: .It Va nbns Ta "+ + - -" Ta "address of NetBIOS name server (WINS)" .It Va nbscope Ta "+ + - -" Ta "NetBIOS scope" .It Va nbtimeout Ta "+ + - -" Ta "timeout for NetBIOS name servers" -.It Va password Ta "- - + +" Ta "plain text password used to access the given share" +.It Va password Ta "- - + +" Ta "plain text or simple encrypted password used to access the given share" .It Va retry_count Ta "+ + - -" Ta "number of retries before connection is marked as broken" .It Va timeout Ta "+ + - -" Ta "SMB request timeout" .It Va workgroup Ta "+ + + +" Ta "workgroup name" @@ -96,6 +96,9 @@ Possible keywords may include: .Bl -tag -width ".Pa /etc/nsmb.conf" .It Pa /etc/nsmb.conf The default remote mount-point configuration file. +.Pa "~/nsmb.conf" +.It Pa ~/nsmb.conf +The user specific remote mount-point configuration file. .El .Sh EXAMPLES What follows is a sample configuration file which may, @@ -108,6 +111,9 @@ workgroup=SALES [FSERVER] charsets=koi8-r:cp866 addr=fserv.example.com +# User specific data for FSERVER +[FSERVER:MYUSER] +password=$$16144562c293a0314e6e1 .Ed .Pp All lines which begin with the @@ -124,6 +130,18 @@ required when Cyrillic characters are no The hostname value, .Dq Li fserv.example.com , is also assigned in this section. +.Dq Li FSERVER:USER , +defines the user settings and is useful for saving the password used +during a specific connection. +The password may be plaintext or obfuscated using simple encryption. +The simple encrypted password starts with the `$$1' symbols. +Warning: the encryption function is very weak and intended only to hide +clear text passwords. +If the use of simple encryption is desired, the following command may be +used on a password: +.Bd -literal -offset indent +smbutil crypt +.Ed .Sh COMPATIBILITY At the time of this writing, the .Tn IPX From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 12:06:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B5161065697; Sun, 31 Oct 2010 12:06:03 +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 1A01F8FC1B; Sun, 31 Oct 2010 12:06: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 o9VC62eo086930; Sun, 31 Oct 2010 12:06:03 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VC62qv086927; Sun, 31 Oct 2010 12:06:02 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010311206.o9VC62qv086927@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 31 Oct 2010 12:06: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: r214599 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 12:06:03 -0000 Author: jilles Date: Sun Oct 31 12:06:02 2010 New Revision: 214599 URL: http://svn.freebsd.org/changeset/base/214599 Log: sh: Use iteration instead of recursion to evaluate semicolon lists. This reduces CPU and memory usage when executing long lists (such as long functions). Modified: head/bin/sh/eval.c head/bin/sh/parser.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Oct 31 12:05:37 2010 (r214598) +++ head/bin/sh/eval.c Sun Oct 31 12:06:02 2010 (r214599) @@ -196,6 +196,7 @@ void evaltree(union node *n, int flags) { int do_etest; + union node *next; do_etest = 0; if (n == NULL) { @@ -203,6 +204,8 @@ evaltree(union node *n, int flags) exitstatus = 0; goto out; } + do { + next = NULL; #ifndef NO_HISTORY displayhist = 1; /* show history substitutions done with fc */ #endif @@ -212,20 +215,20 @@ evaltree(union node *n, int flags) evaltree(n->nbinary.ch1, flags & ~EV_EXIT); if (evalskip) goto out; - evaltree(n->nbinary.ch2, flags); + next = n->nbinary.ch2; break; case NAND: evaltree(n->nbinary.ch1, EV_TESTED); if (evalskip || exitstatus != 0) { goto out; } - evaltree(n->nbinary.ch2, flags); + next = n->nbinary.ch2; break; case NOR: evaltree(n->nbinary.ch1, EV_TESTED); if (evalskip || exitstatus == 0) goto out; - evaltree(n->nbinary.ch2, flags); + next = n->nbinary.ch2; break; case NREDIR: evalredir(n, flags); @@ -242,9 +245,9 @@ evaltree(union node *n, int flags) if (evalskip) goto out; if (exitstatus == 0) - evaltree(n->nif.ifpart, flags); + next = n->nif.ifpart; else if (n->nif.elsepart) - evaltree(n->nif.elsepart, flags); + next = n->nif.elsepart; else exitstatus = 0; break; @@ -281,6 +284,8 @@ evaltree(union node *n, int flags) flushout(&output); break; } + n = next; + } while (n != NULL); out: if (pendingsigs) dotrap(); Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sun Oct 31 12:05:37 2010 (r214598) +++ head/bin/sh/parser.c Sun Oct 31 12:06:02 2010 (r214599) @@ -227,13 +227,13 @@ parsecmd(int interact) static union node * list(int nlflag, int erflag) { - union node *n1, *n2, *n3; + union node *ntop, *n1, *n2, *n3; int tok; checkkwd = 2; if (!nlflag && !erflag && tokendlist[peektoken()]) return NULL; - n1 = NULL; + ntop = n1 = NULL; for (;;) { n2 = andor(); tok = readtoken(); @@ -250,14 +250,21 @@ list(int nlflag, int erflag) n2 = n3; } } - if (n1 == NULL) { - n1 = n2; + if (ntop == NULL) + ntop = n2; + else if (n1 == NULL) { + n1 = (union node *)stalloc(sizeof (struct nbinary)); + n1->type = NSEMI; + n1->nbinary.ch1 = ntop; + n1->nbinary.ch2 = n2; + ntop = n1; } else { n3 = (union node *)stalloc(sizeof (struct nbinary)); n3->type = NSEMI; - n3->nbinary.ch1 = n1; + n3->nbinary.ch1 = n1->nbinary.ch2; n3->nbinary.ch2 = n2; + n1->nbinary.ch2 = n3; n1 = n3; } switch (tok) { @@ -269,28 +276,28 @@ list(int nlflag, int erflag) if (tok == TNL) { parseheredoc(); if (nlflag) - return n1; + return ntop; } else if (tok == TEOF && nlflag) { parseheredoc(); - return n1; + return ntop; } else { tokpushback++; } checkkwd = 2; if (!nlflag && !erflag && tokendlist[peektoken()]) - return n1; + return ntop; break; case TEOF: if (heredoclist) parseheredoc(); else pungetc(); /* push back EOF on input */ - return n1; + return ntop; default: if (nlflag || erflag) synexpect(-1); tokpushback++; - return n1; + return ntop; } } } From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 12:08:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B6A0106567A; Sun, 31 Oct 2010 12:08:17 +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 1A1658FC1A; Sun, 31 Oct 2010 12:08: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 o9VC8Gj4087069; Sun, 31 Oct 2010 12:08:17 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VC8G6P087067; Sun, 31 Oct 2010 12:08:16 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010311208.o9VC8G6P087067@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 31 Oct 2010 12:08: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: r214600 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 12:08:17 -0000 Author: jilles Date: Sun Oct 31 12:08:16 2010 New Revision: 214600 URL: http://svn.freebsd.org/changeset/base/214600 Log: sh: Reindent evaltree(). Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Oct 31 12:06:02 2010 (r214599) +++ head/bin/sh/eval.c Sun Oct 31 12:08:16 2010 (r214600) @@ -205,86 +205,86 @@ evaltree(union node *n, int flags) goto out; } do { - next = NULL; + next = NULL; #ifndef NO_HISTORY - displayhist = 1; /* show history substitutions done with fc */ + displayhist = 1; /* show history substitutions done with fc */ #endif - TRACE(("evaltree(%p: %d) called\n", (void *)n, n->type)); - switch (n->type) { - case NSEMI: - evaltree(n->nbinary.ch1, flags & ~EV_EXIT); - if (evalskip) - goto out; - next = n->nbinary.ch2; - break; - case NAND: - evaltree(n->nbinary.ch1, EV_TESTED); - if (evalskip || exitstatus != 0) { - goto out; + TRACE(("evaltree(%p: %d) called\n", (void *)n, n->type)); + switch (n->type) { + case NSEMI: + evaltree(n->nbinary.ch1, flags & ~EV_EXIT); + if (evalskip) + goto out; + next = n->nbinary.ch2; + break; + case NAND: + evaltree(n->nbinary.ch1, EV_TESTED); + if (evalskip || exitstatus != 0) { + goto out; + } + next = n->nbinary.ch2; + break; + case NOR: + evaltree(n->nbinary.ch1, EV_TESTED); + if (evalskip || exitstatus == 0) + goto out; + next = n->nbinary.ch2; + break; + case NREDIR: + evalredir(n, flags); + break; + case NSUBSHELL: + evalsubshell(n, flags); + do_etest = !(flags & EV_TESTED); + break; + case NBACKGND: + evalsubshell(n, flags); + break; + case NIF: { + evaltree(n->nif.test, EV_TESTED); + if (evalskip) + goto out; + if (exitstatus == 0) + next = n->nif.ifpart; + else if (n->nif.elsepart) + next = n->nif.elsepart; + else + exitstatus = 0; + break; } - next = n->nbinary.ch2; - break; - case NOR: - evaltree(n->nbinary.ch1, EV_TESTED); - if (evalskip || exitstatus == 0) - goto out; - next = n->nbinary.ch2; - break; - case NREDIR: - evalredir(n, flags); - break; - case NSUBSHELL: - evalsubshell(n, flags); - do_etest = !(flags & EV_TESTED); - break; - case NBACKGND: - evalsubshell(n, flags); - break; - case NIF: { - evaltree(n->nif.test, EV_TESTED); - if (evalskip) - goto out; - if (exitstatus == 0) - next = n->nif.ifpart; - else if (n->nif.elsepart) - next = n->nif.elsepart; - else + case NWHILE: + case NUNTIL: + evalloop(n, flags & ~EV_EXIT); + break; + case NFOR: + evalfor(n, flags & ~EV_EXIT); + break; + case NCASE: + evalcase(n, flags); + break; + case NDEFUN: + defun(n->narg.text, n->narg.next); exitstatus = 0; - break; - } - case NWHILE: - case NUNTIL: - evalloop(n, flags & ~EV_EXIT); - break; - case NFOR: - evalfor(n, flags & ~EV_EXIT); - break; - case NCASE: - evalcase(n, flags); - break; - case NDEFUN: - defun(n->narg.text, n->narg.next); - exitstatus = 0; - break; - case NNOT: - evaltree(n->nnot.com, EV_TESTED); - exitstatus = !exitstatus; - break; - - case NPIPE: - evalpipe(n); - do_etest = !(flags & EV_TESTED); - break; - case NCMD: - evalcommand(n, flags, (struct backcmd *)NULL); - do_etest = !(flags & EV_TESTED); - break; - default: - out1fmt("Node type = %d\n", n->type); - flushout(&output); - break; - } - n = next; + break; + case NNOT: + evaltree(n->nnot.com, EV_TESTED); + exitstatus = !exitstatus; + break; + + case NPIPE: + evalpipe(n); + do_etest = !(flags & EV_TESTED); + break; + case NCMD: + evalcommand(n, flags, (struct backcmd *)NULL); + do_etest = !(flags & EV_TESTED); + break; + default: + out1fmt("Node type = %d\n", n->type); + flushout(&output); + break; + } + n = next; } while (n != NULL); out: if (pendingsigs) From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 15:07:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F31E106566B; Sun, 31 Oct 2010 15:07:10 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D9D88FC18; Sun, 31 Oct 2010 15:07: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 o9VF7Adi093124; Sun, 31 Oct 2010 15:07:10 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VF7AxF093122; Sun, 31 Oct 2010 15:07:10 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010311507.o9VF7AxF093122@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 31 Oct 2010 15:07: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: r214601 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 15:07:10 -0000 Author: nwhitehorn Date: Sun Oct 31 15:07:09 2010 New Revision: 214601 URL: http://svn.freebsd.org/changeset/base/214601 Log: Add some missing parentheses so that moea_bat_mapped() actually works. Submitted by: alc MFC after: 3 days Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Sun Oct 31 12:08:16 2010 (r214600) +++ head/sys/powerpc/aim/mmu_oea.c Sun Oct 31 15:07:09 2010 (r214601) @@ -2430,7 +2430,7 @@ moea_bat_mapped(int idx, vm_offset_t pa, /* * Return immediately if not a valid mapping */ - if (!battable[idx].batu & BAT_Vs) + if (!(battable[idx].batu & BAT_Vs)) return (EINVAL); /* From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 16:06:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50B0E1065672; Sun, 31 Oct 2010 16:06:50 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id AE7898FC19; Sun, 31 Oct 2010 16:06:49 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 548AB45E5C; Sun, 31 Oct 2010 17:06:47 +0100 (CET) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id A64E145CD9; Sun, 31 Oct 2010 17:06:41 +0100 (CET) Date: Sun, 31 Oct 2010 17:06:03 +0100 From: Pawel Jakub Dawidek To: Ulrich Spoerlein Message-ID: <20101031160603.GD2160@garage.freebsd.pl> References: <201010310921.o9V9LSo4075408@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="q9KOos5vDmpwPx9o" Content-Disposition: inline In-Reply-To: <201010310921.o9V9LSo4075408@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 16:06:50 -0000 --q9KOos5vDmpwPx9o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 31, 2010 at 09:21:28AM +0000, Ulrich Spoerlein wrote: > Author: uqs > Date: Sun Oct 31 09:21:27 2010 > New Revision: 214596 > URL: http://svn.freebsd.org/changeset/base/214596 >=20 > Log: > Elaborate some more on the non-security implications of using -P [...] > +.Pp > +N.B.: The > +.Fl P > +flag is not considered a security feature > +.Pq see Sx BUGS . I'm sorry for jumping so late into the subject, but if it is not a security feature than what other purpose has left? Really guys, this option is useless. There is no reliable way to verify if the blocks are really overwritten. Period. If it is not used for security, then I see no other use for it (except for [1]). If it is used for security then we better have a way to give the user the right answer to the question "is my data really gone?" and don't make false assumptions or giving answers "we hope so". Why there is no reliable way to verify this? 1. Check file system type (UFS, ZFS). 2. Check file system configuration (UFS with snapshots?). 3. Be sure sync(2) the file system and send BIO_FLUSH to all the media involved (some cheap flash disks lie about BIO_FLUSH support). 4. Check underlying media (GLABEL provider - no modification to the data). 5. Check underlying media (ZVOL - data won't be overwritten, but...). 6. Check ZFS vdevs (on which providers ZVOL's pool is based on). 7. Check vdevs (GELI - cool, we have encryption). 8. Check GELI configuration (maybe NULL encryption algorithm?). 9. Check underlying media (HDD, SSD, swap-backed md(4) device? goto 3). 10. Check if the sectors weren't remapped while we were overwriting. In other words this is soooo complicated that it would simply be too hard to explain to regular user or implement in rm(1). IMHO this option should be removed and rm(1) should fail when a user is trying to use it. [1] When we have UFS file system on top of ZVOL with compression enabled, overwriting file content with zero bytes should convert blocks into holes, which will free some space - a usage definitely not worth keeping -P around. :) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --q9KOos5vDmpwPx9o Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEUEARECAAYFAkzNk+sACgkQForvXbEpPzRhDgCYhFyFcevDUrN4msCrn8c0rADf UwCeKa5aw17CNdnoVcXfXXXJdr6m+AI= =9aU6 -----END PGP SIGNATURE----- --q9KOos5vDmpwPx9o-- From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 16:54:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C61D21065693; Sun, 31 Oct 2010 16:54:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4B558FC17; Sun, 31 Oct 2010 16:54: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 o9VGso9q097009; Sun, 31 Oct 2010 16:54:50 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VGsoCQ097007; Sun, 31 Oct 2010 16:54:50 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010311654.o9VGsoCQ097007@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 31 Oct 2010 16:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214602 - stable/8/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 16:54:50 -0000 Author: bz Date: Sun Oct 31 16:54:50 2010 New Revision: 214602 URL: http://svn.freebsd.org/changeset/base/214602 Log: Correct a merge issue from r214554, where the field had been deprecated and reserved in HEAD but is still there in 8. Reported by: dhw Modified: stable/8/sys/net/if_debug.c Modified: stable/8/sys/net/if_debug.c ============================================================================== --- stable/8/sys/net/if_debug.c Sun Oct 31 15:07:09 2010 (r214601) +++ stable/8/sys/net/if_debug.c Sun Oct 31 16:54:50 2010 (r214602) @@ -62,7 +62,7 @@ if_show_ifnet(struct ifnet *ifp) IF_DB_PRINTF("%s", if_description); IF_DB_PRINTF("%u", if_index); IF_DB_PRINTF("%u", if_refcount); - IF_DB_PRINTF("%d", if_index_reserved); + IF_DB_PRINTF("%u", if_timer); IF_DB_PRINTF("%p", if_softc); IF_DB_PRINTF("%p", if_l2com); IF_DB_PRINTF("%p", if_vnet); From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 17:31:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 354D91065674; Sun, 31 Oct 2010 17:31:19 +0000 (UTC) Date: Sun, 31 Oct 2010 17:31:19 +0000 From: Alexander Best To: Pawel Jakub Dawidek Message-ID: <20101031173119.GA12918@freebsd.org> References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101031160603.GD2160@garage.freebsd.pl> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ulrich Spoerlein Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 17:31:19 -0000 On Sun Oct 31 10, Pawel Jakub Dawidek wrote: > On Sun, Oct 31, 2010 at 09:21:28AM +0000, Ulrich Spoerlein wrote: > > Author: uqs > > Date: Sun Oct 31 09:21:27 2010 > > New Revision: 214596 > > URL: http://svn.freebsd.org/changeset/base/214596 > > > > Log: > > Elaborate some more on the non-security implications of using -P > [...] > > +.Pp > > +N.B.: The > > +.Fl P > > +flag is not considered a security feature > > +.Pq see Sx BUGS . > > I'm sorry for jumping so late into the subject, but if it is not a > security feature than what other purpose has left? > > Really guys, this option is useless. i suggested to remove it and also came up with a patch [1], but quite a lot of developers decided the -P option should be kept rather than removed. although there was quite an elaborate discussion about it that followed after des@ commited r214431, i still haven't got the slightest idea just WHY it should stay. ;) [1] http://www.mail-archive.com/svn-src-head@freebsd.org/msg07404.html cheers. alex > > There is no reliable way to verify if the blocks are really overwritten. > Period. > > If it is not used for security, then I see no other use for it (except > for [1]). > > If it is used for security then we better have a way to give the user > the right answer to the question "is my data really gone?" and don't > make false assumptions or giving answers "we hope so". > > Why there is no reliable way to verify this? > 1. Check file system type (UFS, ZFS). > 2. Check file system configuration (UFS with snapshots?). > 3. Be sure sync(2) the file system and send BIO_FLUSH to all the media > involved (some cheap flash disks lie about BIO_FLUSH support). > 4. Check underlying media (GLABEL provider - no modification to the data). > 5. Check underlying media (ZVOL - data won't be overwritten, but...). > 6. Check ZFS vdevs (on which providers ZVOL's pool is based on). > 7. Check vdevs (GELI - cool, we have encryption). > 8. Check GELI configuration (maybe NULL encryption algorithm?). > 9. Check underlying media (HDD, SSD, swap-backed md(4) device? goto 3). > 10. Check if the sectors weren't remapped while we were overwriting. > > In other words this is soooo complicated that it would simply be too > hard to explain to regular user or implement in rm(1). > > IMHO this option should be removed and rm(1) should fail when a user is > trying to use it. > > [1] When we have UFS file system on top of ZVOL with compression > enabled, overwriting file content with zero bytes should convert blocks > into holes, which will free some space - a usage definitely not worth > keeping -P around. :) > > -- > Pawel Jakub Dawidek http://www.wheelsystems.com > pjd@FreeBSD.org http://www.FreeBSD.org > FreeBSD committer Am I Evil? Yes, I Am! -- a13x From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 18:19:13 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 341D2106566B; Sun, 31 Oct 2010 18:19:13 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 118A98FC12; Sun, 31 Oct 2010 18:19:12 +0000 (UTC) Received: from [10.123.2.178] (DIR-655 [192.168.1.65]) by monday.kientzle.com (8.14.3/8.14.3) with ESMTP id o9VHmhX5030159; Sun, 31 Oct 2010 17:48:43 GMT (envelope-from tim@kientzle.com) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Tim Kientzle In-Reply-To: <20101031160603.GD2160@garage.freebsd.pl> Date: Sun, 31 Oct 2010 10:48:45 -0700 Content-Transfer-Encoding: 7bit Message-Id: References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Ulrich Spoerlein Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 18:19:13 -0000 On Oct 31, 2010, at 9:06 AM, Pawel Jakub Dawidek wrote: > On Sun, Oct 31, 2010 at 09:21:28AM +0000, Ulrich Spoerlein wrote: >> Author: uqs >> Date: Sun Oct 31 09:21:27 2010 >> New Revision: 214596 >> URL: http://svn.freebsd.org/changeset/base/214596 >> >> Log: >> Elaborate some more on the non-security implications of using -P > [...] >> +.Pp >> +N.B.: The >> +.Fl P >> +flag is not considered a security feature >> +.Pq see Sx BUGS . > > I'm sorry for jumping so late into the subject, but if it is not a > security feature than what other purpose has left? > > Really guys, this option is useless. I completely agree. > There is no reliable way to verify if the blocks are really overwritten. > Period. Not from userspace, no. I think the only reasonable approach is to add a new syscall (unlink_with_overwrite(2)?) and chase the implications down through the filesystem, GEOM, and driver interfaces. Tim From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 18:27:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0860E106564A; Sun, 31 Oct 2010 18:27:06 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD6288FC08; Sun, 31 Oct 2010 18:27: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 o9VIR5Nj099567; Sun, 31 Oct 2010 18:27:05 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VIR5PF099556; Sun, 31 Oct 2010 18:27:05 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010311827.o9VIR5PF099556@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 31 Oct 2010 18:27: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: r214603 - in head/sys: conf dev/agp modules modules/agp powerpc/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 18:27:06 -0000 Author: nwhitehorn Date: Sun Oct 31 18:27:05 2010 New Revision: 214603 URL: http://svn.freebsd.org/changeset/base/214603 Log: Add a driver for the Apple Uninorth AGP host bridge found in all PowerPC Macintoshes with an AGP bus. Added: head/sys/dev/agp/agp_apple.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/conf/options.powerpc head/sys/dev/agp/agp.c head/sys/modules/Makefile head/sys/modules/agp/Makefile head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/powerpc/conf/NOTES Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sun Oct 31 16:54:50 2010 (r214602) +++ head/sys/conf/files.powerpc Sun Oct 31 18:27:05 2010 (r214603) @@ -22,6 +22,7 @@ dev/adb/adb_kbd.c optional adb dev/adb/adb_mouse.c optional adb dev/adb/adb_hb_if.m optional adb dev/adb/adb_if.m optional adb +dev/agp/agp_apple.c optional agp powermac dev/cfi/cfi_bus_fdt.c optional cfi fdt dev/fb/fb.c optional sc dev/fdt/fdt_powerpc.c optional fdt Modified: head/sys/conf/options.powerpc ============================================================================== --- head/sys/conf/options.powerpc Sun Oct 31 16:54:50 2010 (r214602) +++ head/sys/conf/options.powerpc Sun Oct 31 18:27:05 2010 (r214603) @@ -23,3 +23,7 @@ PSIM SC_OFWFB opt_ofwfb.h OFWCONS_POLL_HZ opt_ofw.h + +# AGP debugging support +AGP_DEBUG opt_agp.h + Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Sun Oct 31 16:54:50 2010 (r214602) +++ head/sys/dev/agp/agp.c Sun Oct 31 18:27:05 2010 (r214603) @@ -219,13 +219,16 @@ agp_generic_attach(device_t dev) * Find and map the aperture, RF_SHAREABLE for DRM but not RF_ACTIVE * because the kernel doesn't need to map it. */ - if (sc->as_aperture_rid == 0) - sc->as_aperture_rid = AGP_APBASE; - sc->as_aperture = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->as_aperture_rid, RF_SHAREABLE); - if (!sc->as_aperture) - return ENOMEM; + if (sc->as_aperture_rid != -1) { + if (sc->as_aperture_rid == 0) + sc->as_aperture_rid = AGP_APBASE; + + sc->as_aperture = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->as_aperture_rid, RF_SHAREABLE); + if (!sc->as_aperture) + return ENOMEM; + } /* * Work out an upper bound for agp memory allocation. This @@ -272,8 +275,9 @@ agp_free_res(device_t dev) { struct agp_softc *sc = device_get_softc(dev); - bus_release_resource(dev, SYS_RES_MEMORY, sc->as_aperture_rid, - sc->as_aperture); + if (sc->as_aperture != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, sc->as_aperture_rid, + sc->as_aperture); mtx_destroy(&sc->as_lock); agp_flush_cache(); } @@ -729,7 +733,10 @@ agp_info_user(device_t dev, agp_info *in info->bridge_id = pci_get_devid(dev); info->agp_mode = pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4); - info->aper_base = rman_get_start(sc->as_aperture); + if (sc->as_aperture) + info->aper_base = rman_get_start(sc->as_aperture); + else + info->aper_base = 0; info->aper_size = AGP_GET_APERTURE(dev) >> 20; info->pg_total = info->pg_system = sc->as_maxmem >> AGP_PAGE_SHIFT; info->pg_used = sc->as_allocated >> AGP_PAGE_SHIFT; @@ -876,6 +883,8 @@ agp_mmap(struct cdev *kdev, vm_ooffset_t if (offset > AGP_GET_APERTURE(dev)) return -1; + if (sc->as_aperture == NULL) + return -1; *paddr = rman_get_start(sc->as_aperture) + offset; return 0; } @@ -917,8 +926,11 @@ agp_get_info(device_t dev, struct agp_in info->ai_mode = pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4); - info->ai_aperture_base = rman_get_start(sc->as_aperture); - info->ai_aperture_size = rman_get_size(sc->as_aperture); + if (sc->as_aperture != NULL) + info->ai_aperture_base = rman_get_start(sc->as_aperture); + else + info->ai_aperture_base = 0; + info->ai_aperture_size = AGP_GET_APERTURE(dev); info->ai_memory_allowed = sc->as_maxmem; info->ai_memory_used = sc->as_allocated; } Added: head/sys/dev/agp/agp_apple.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/agp/agp_apple.c Sun Oct 31 18:27:05 2010 (r214603) @@ -0,0 +1,302 @@ +/*- + * Copyright (c) 2010 Nathan Whitehorn + * 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 "opt_bus.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#define UNIN_AGP_GART_BASE 0x8c +#define UNIN_AGP_BASE_ADDR 0x90 +#define UNIN_AGP_GART_CONTROL 0x94 + +#define UNIN_AGP_GART_INVAL 0x00000001 +#define UNIN_AGP_GART_ENABLE 0x00000100 +#define UNIN_AGP_GART_2XRESET 0x00010000 +#define UNIN_AGP_U3_GART_PERFRD 0x00080000 + +struct agp_apple_softc { + struct agp_softc agp; + uint32_t aperture; + struct agp_gatt *gatt; + int u3; + int needs_2x_reset; +}; + +static int +agp_apple_probe(device_t dev) +{ + + if (resource_disabled("agp", device_get_unit(dev))) + return (ENXIO); + + if (pci_get_class(dev) != PCIC_BRIDGE + || pci_get_subclass(dev) != PCIS_BRIDGE_HOST) + return (ENXIO); + + if (agp_find_caps(dev) == 0) + return (ENXIO); + + if (pci_get_class(dev) != PCIC_BRIDGE + || pci_get_subclass(dev) != PCIS_BRIDGE_HOST) + return (ENXIO); + + switch (pci_get_devid(dev)) { + case 0x0020106b: + case 0x0027106b: + device_set_desc(dev, "Apple UniNorth AGP Bridge"); + return (BUS_PROBE_DEFAULT); + case 0x002d106b: + device_set_desc(dev, "Apple UniNorth 1.5 AGP Bridge"); + return (BUS_PROBE_DEFAULT); + case 0x0034106b: + device_set_desc(dev, "Apple UniNorth 2 AGP Bridge"); + return (BUS_PROBE_DEFAULT); + case 0x004b106b: + case 0x0058106b: + case 0x0059106b: + device_set_desc(dev, "Apple U3 AGP Bridge"); + return (BUS_PROBE_DEFAULT); + case 0x0066106b: + device_set_desc(dev, "Apple Intrepid AGP Bridge"); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +agp_apple_attach(device_t dev) +{ + struct agp_apple_softc *sc = device_get_softc(dev); + int error; + + /* Record quirks */ + sc->needs_2x_reset = 0; + sc->u3 = 0; + switch (pci_get_devid(dev)) { + case 0x0020106b: + case 0x0027106b: + sc->needs_2x_reset = 1; + break; + case 0x004b106b: + case 0x0058106b: + case 0x0059106b: + sc->u3 = 1; + break; + } + + /* Set the aperture bus address base (must be 0) */ + pci_write_config(dev, UNIN_AGP_BASE_ADDR, 0, 4); + agp_set_aperture_resource(dev, -1); + + error = agp_generic_attach(dev); + if (error) + return (error); + + sc->aperture = 256*1024*1024; + + for (sc->aperture = 256*1024*1024; sc->aperture >= 4*1024*1024; + sc->aperture /= 2) { + sc->gatt = agp_alloc_gatt(dev); + if (sc->gatt) + break; + } + if (sc->aperture < 4*1024*1024) { + agp_generic_detach(dev); + return ENOMEM; + } + + /* Install the gatt. */ + AGP_SET_APERTURE(dev, sc->aperture); + + /* XXX: U3 scratch page? */ + + /* Enable the aperture and TLB. */ + AGP_FLUSH_TLB(dev); + + return (0); +} + +static int +agp_apple_detach(device_t dev) +{ + struct agp_apple_softc *sc = device_get_softc(dev); + + agp_free_cdev(dev); + + /* Disable the aperture and TLB */ + pci_write_config(dev, UNIN_AGP_GART_CONTROL, UNIN_AGP_GART_INVAL, 4); + pci_write_config(dev, UNIN_AGP_GART_CONTROL, 0, 4); + + if (sc->needs_2x_reset) { + pci_write_config(dev, UNIN_AGP_GART_CONTROL, + UNIN_AGP_GART_2XRESET, 4); + pci_write_config(dev, UNIN_AGP_GART_CONTROL, 0, 4); + } + + AGP_SET_APERTURE(dev, 0); + + agp_free_gatt(sc->gatt); + agp_free_res(dev); + return 0; +} + +static uint32_t +agp_apple_get_aperture(device_t dev) +{ + struct agp_apple_softc *sc = device_get_softc(dev); + + return (sc->aperture); +} + +static int +agp_apple_set_aperture(device_t dev, uint32_t aperture) +{ + struct agp_apple_softc *sc = device_get_softc(dev); + + /* + * Check for a multiple of 4 MB and make sure it is within the + * programmable range. + */ + if (aperture % (4*1024*1024) + || aperture < 4*1024*1024 + || aperture > ((sc->u3) ? 512 : 256)*1024*1024) + return EINVAL; + + /* The aperture value is a multiple of 4 MB */ + aperture /= (4*1024*1024); + + pci_write_config(dev, UNIN_AGP_GART_BASE, + (sc->gatt->ag_physical & 0xfffff000) | aperture, 4); + + return (0); +} + +static int +agp_apple_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical) +{ + struct agp_apple_softc *sc = device_get_softc(dev); + + if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) + return EINVAL; + + sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical; + __asm __volatile("dcbst 0,%0; sync" :: + "r"(&sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT]) : "memory"); + return (0); +} + +static int +agp_apple_unbind_page(device_t dev, vm_offset_t offset) +{ + struct agp_apple_softc *sc = device_get_softc(dev); + + if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) + return EINVAL; + + sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0; + __asm __volatile("dcbst 0,%0; sync" :: + "r"(&sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT]) : "memory"); + return (0); +} + +static void +agp_apple_flush_tlb(device_t dev) +{ + struct agp_apple_softc *sc = device_get_softc(dev); + uint32_t cntrl = UNIN_AGP_GART_ENABLE; + + if (sc->u3) + cntrl |= UNIN_AGP_U3_GART_PERFRD; + + pci_write_config(dev, UNIN_AGP_GART_CONTROL, + cntrl | UNIN_AGP_GART_INVAL, 4); + pci_write_config(dev, UNIN_AGP_GART_CONTROL, cntrl, 4); + + if (sc->needs_2x_reset) { + pci_write_config(dev, UNIN_AGP_GART_CONTROL, + cntrl | UNIN_AGP_GART_2XRESET, 4); + pci_write_config(dev, UNIN_AGP_GART_CONTROL, cntrl, 4); + } +} + +static device_method_t agp_apple_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, agp_apple_probe), + DEVMETHOD(device_attach, agp_apple_attach), + DEVMETHOD(device_detach, agp_apple_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* AGP interface */ + DEVMETHOD(agp_get_aperture, agp_apple_get_aperture), + DEVMETHOD(agp_set_aperture, agp_apple_set_aperture), + DEVMETHOD(agp_bind_page, agp_apple_bind_page), + DEVMETHOD(agp_unbind_page, agp_apple_unbind_page), + DEVMETHOD(agp_flush_tlb, agp_apple_flush_tlb), + DEVMETHOD(agp_enable, agp_generic_enable), + DEVMETHOD(agp_alloc_memory, agp_generic_alloc_memory), + DEVMETHOD(agp_free_memory, agp_generic_free_memory), + DEVMETHOD(agp_bind_memory, agp_generic_bind_memory), + DEVMETHOD(agp_unbind_memory, agp_generic_unbind_memory), + + { 0, 0 } +}; + +static driver_t agp_apple_driver = { + "agp", + agp_apple_methods, + sizeof(struct agp_apple_softc), +}; + +static devclass_t agp_devclass; + +DRIVER_MODULE(agp_apple, hostb, agp_apple_driver, agp_devclass, 0, 0); +MODULE_DEPEND(agp_apple, agp, 1, 1, 1); +MODULE_DEPEND(agp_apple, pci, 1, 1, 1); Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Oct 31 16:54:50 2010 (r214602) +++ head/sys/modules/Makefile Sun Oct 31 18:27:05 2010 (r214603) @@ -631,6 +631,7 @@ _xe= xe .endif .if ${MACHINE_CPUARCH} == "powerpc" +_agp= agp _an= an _bm= bm _cpufreq= cpufreq Modified: head/sys/modules/agp/Makefile ============================================================================== --- head/sys/modules/agp/Makefile Sun Oct 31 16:54:50 2010 (r214602) +++ head/sys/modules/agp/Makefile Sun Oct 31 18:27:05 2010 (r214603) @@ -11,9 +11,12 @@ SRCS+= agp_i810.c agp_intel.c agp_via.c .if ${MACHINE} == "i386" SRCS+= agp_amd64.c .endif -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" SRCS+= agp_amd64.c agp_i810.c agp_via.c .endif +.if ${MACHINE_CPUARCH} == "powerpc" +SRCS+= agp_apple.c +.endif SRCS+= device_if.h bus_if.h agp_if.h pci_if.h SRCS+= opt_agp.h opt_bus.h MFILES= kern/device_if.m kern/bus_if.m dev/agp/agp_if.m dev/pci/pci_if.m Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Sun Oct 31 16:54:50 2010 (r214602) +++ head/sys/powerpc/conf/GENERIC Sun Oct 31 18:27:05 2010 (r214603) @@ -84,6 +84,7 @@ device cpufreq # Standard busses device pci +device agp # ATA and ATAPI devices device ata Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Sun Oct 31 16:54:50 2010 (r214602) +++ head/sys/powerpc/conf/GENERIC64 Sun Oct 31 18:27:05 2010 (r214603) @@ -83,6 +83,7 @@ device cpufreq # Standard busses device pci +device agp # ATA and ATAPI devices device ata Modified: head/sys/powerpc/conf/NOTES ============================================================================== --- head/sys/powerpc/conf/NOTES Sun Oct 31 16:54:50 2010 (r214602) +++ head/sys/powerpc/conf/NOTES Sun Oct 31 18:27:05 2010 (r214603) @@ -30,6 +30,7 @@ device cpufreq # Standard busses device pci +device agp device bm # Apple BMAC (Big Mac Ethernet) device kiic # Apple Keywest I2C Controller From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 19:11:22 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FDC11065670; Sun, 31 Oct 2010 19:11:22 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2001:470:9a47::1]) by mx1.freebsd.org (Postfix) with ESMTP id 3DEDC8FC12; Sun, 31 Oct 2010 19:11:22 +0000 (UTC) Received: from acme.spoerlein.net (localhost.spoerlein.net [IPv6:::1]) by acme.spoerlein.net (8.14.4/8.14.4) with ESMTP id o9VJBKQm021512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 31 Oct 2010 20:11:20 +0100 (CET) (envelope-from uqs@FreeBSD.org) Received: (from uqs@localhost) by acme.spoerlein.net (8.14.4/8.14.4/Submit) id o9VJBKGX021511; Sun, 31 Oct 2010 20:11:20 +0100 (CET) (envelope-from uqs@FreeBSD.org) Date: Sun, 31 Oct 2010 20:11:19 +0100 From: Ulrich Spoerlein To: Pawel Jakub Dawidek Message-ID: <20101031191119.GM46314@acme.spoerlein.net> Mail-Followup-To: Ulrich Spoerlein , Pawel Jakub Dawidek , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101031160603.GD2160@garage.freebsd.pl> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 19:11:22 -0000 On Sun, 31.10.2010 at 17:06:03 +0100, Pawel Jakub Dawidek wrote: > On Sun, Oct 31, 2010 at 09:21:28AM +0000, Ulrich Spoerlein wrote: > > Author: uqs > > Date: Sun Oct 31 09:21:27 2010 > > New Revision: 214596 > > URL: http://svn.freebsd.org/changeset/base/214596 > > > > Log: > > Elaborate some more on the non-security implications of using -P > [...] > > +.Pp > > +N.B.: The > > +.Fl P > > +flag is not considered a security feature > > +.Pq see Sx BUGS . > > I'm sorry for jumping so late into the subject, but if it is not a > security feature than what other purpose has left? > > Really guys, this option is useless. > > There is no reliable way to verify if the blocks are really overwritten. > Period. > > If it is not used for security, then I see no other use for it (except > for [1]). > > If it is used for security then we better have a way to give the user > the right answer to the question "is my data really gone?" and don't > make false assumptions or giving answers "we hope so". > > Why there is no reliable way to verify this? > 1. Check file system type (UFS, ZFS). > 2. Check file system configuration (UFS with snapshots?). > 3. Be sure sync(2) the file system and send BIO_FLUSH to all the media > involved (some cheap flash disks lie about BIO_FLUSH support). > 4. Check underlying media (GLABEL provider - no modification to the data). > 5. Check underlying media (ZVOL - data won't be overwritten, but...). > 6. Check ZFS vdevs (on which providers ZVOL's pool is based on). > 7. Check vdevs (GELI - cool, we have encryption). > 8. Check GELI configuration (maybe NULL encryption algorithm?). > 9. Check underlying media (HDD, SSD, swap-backed md(4) device? goto 3). > 10. Check if the sectors weren't remapped while we were overwriting. > > In other words this is soooo complicated that it would simply be too > hard to explain to regular user or implement in rm(1). > > IMHO this option should be removed and rm(1) should fail when a user is > trying to use it. No, this is a POLA violation for no apparent gain. The flag has been in FreeBSD since at least '94. Remember, that we are in the rope-selling business. We empower the users to shoot themselves in the foot. I, for one, am using the -P option in a certain case where I can be sure that ~99% of the data will be obliterated and I'm fine with that. For all other cases I'm using geli or gbde (where I can make sure, that data is lost). So we can either fix -P for all cases (impossible), or at least document its shortcomings. Documenting them clearly is better than what we had a couple of days before. Uli From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 19:16:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8549A1065673; Sun, 31 Oct 2010 19:16:54 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 745488FC15; Sun, 31 Oct 2010 19:16: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 o9VJGsif001151; Sun, 31 Oct 2010 19:16:54 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VJGsmC001149; Sun, 31 Oct 2010 19:16:54 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201010311916.o9VJGsmC001149@svn.freebsd.org> From: Ulrich Spoerlein Date: Sun, 31 Oct 2010 19:16: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: r214604 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 19:16:54 -0000 Author: uqs Date: Sun Oct 31 19:16:54 2010 New Revision: 214604 URL: http://svn.freebsd.org/changeset/base/214604 Log: Fix typo and grammar nit Submitted by: arundel MFC after: 7 days (or when the bikeshed has abated) Modified: head/bin/rm/rm.1 Modified: head/bin/rm/rm.1 ============================================================================== --- head/bin/rm/rm.1 Sun Oct 31 18:27:05 2010 (r214603) +++ head/bin/rm/rm.1 Sun Oct 31 19:16:54 2010 (r214604) @@ -234,12 +234,12 @@ command appeared in .Sh BUGS The .Fl P -option assumes that the underlying storage overwrites file block +option assumes that the underlying storage overwrites file blocks when data is written to an existing offset. Several factors including the file system and its backing store could defeat this assumption. This includes, but is not limited to file systems that use a Copy-On-Write strategy (e.g. ZFS or UFS when snapshots are being used), Flash -media that is using a wear leveling algorithm, or when the backing datastore +media that are using a wear leveling algorithm, or when the backing datastore does journaling, etc. In addition, only regular files are overwritten, other types of files are not. From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 19:50:55 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16E25106566C; Sun, 31 Oct 2010 19:50:55 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id ADBF18FC13; Sun, 31 Oct 2010 19:50:49 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 91FE745CAC; Sun, 31 Oct 2010 20:50:47 +0100 (CET) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id E33B245C8A; Sun, 31 Oct 2010 20:50:41 +0100 (CET) Date: Sun, 31 Oct 2010 20:50:03 +0100 From: Pawel Jakub Dawidek To: Ulrich Spoerlein , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Message-ID: <20101031195003.GE2160@garage.freebsd.pl> References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> <20101031191119.GM46314@acme.spoerlein.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5oH/S/bF6lOfqCQb" Content-Disposition: inline In-Reply-To: <20101031191119.GM46314@acme.spoerlein.net> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 19:50:55 -0000 --5oH/S/bF6lOfqCQb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 31, 2010 at 08:11:19PM +0100, Ulrich Spoerlein wrote: > On Sun, 31.10.2010 at 17:06:03 +0100, Pawel Jakub Dawidek wrote: > > IMHO this option should be removed and rm(1) should fail when a user is > > trying to use it. >=20 > No, this is a POLA violation for no apparent gain. The flag has been in > FreeBSD since at least '94. Remember, that we are in the rope-selling > business. We empower the users to shoot themselves in the foot. >=20 > I, for one, am using the -P option in a certain case where I can be sure > that ~99% of the data will be obliterated and I'm fine with that. For > all other cases I'm using geli or gbde (where I can make sure, that data > is lost). The question remains unanswered: If it is not a security feature then what's the purpose? IMHO this is a security feature, just a really lame one. Too many requirements have to be meet to make it work.=20 I don't think you would want to read in GELI or GBDE manual page that it encrypts the data sometimes, or if all the given requirements are meet. Of course requirements are fine, but they have to be really clear to the user and the list should be as short as possible, which is not the case here. > So we can either fix -P for all cases (impossible), or at least document > its shortcomings. Documenting them clearly is better than what we had a > couple of days before. I don't argue that the previous version of manual page was better I just pick your commit to discuss it mentioned functionality further. Maybe we could implement few simple checks which when satisfied don't emit a warning, ie. if this is UFS, on top of partition, on top of a slice and on top of a regular SCSI or SATA disk don't emit a warning, but if there is a doubt, do emit a warning. This might not be trivial, but might be doable. Alternatively we could always emit a warning. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --5oH/S/bF6lOfqCQb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzNyGsACgkQForvXbEpPzT4yACg7TwsX93Bsgp2iIzgDbjbQLw8 prUAoIKipWPTiD3irUKPavBvNus31g2Q =ALQ7 -----END PGP SIGNATURE----- --5oH/S/bF6lOfqCQb-- From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 19:57:59 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AAC41065673; Sun, 31 Oct 2010 19:57:59 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2001:470:9a47::1]) by mx1.freebsd.org (Postfix) with ESMTP id D4D3B8FC1A; Sun, 31 Oct 2010 19:57:58 +0000 (UTC) Received: from acme.spoerlein.net (localhost.spoerlein.net [IPv6:::1]) by acme.spoerlein.net (8.14.4/8.14.4) with ESMTP id o9VJvvN9046220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 31 Oct 2010 20:57:58 +0100 (CET) (envelope-from uqs@FreeBSD.org) Received: (from uqs@localhost) by acme.spoerlein.net (8.14.4/8.14.4/Submit) id o9VJvvmf046219; Sun, 31 Oct 2010 20:57:57 +0100 (CET) (envelope-from uqs@FreeBSD.org) Date: Sun, 31 Oct 2010 20:57:57 +0100 From: Ulrich Spoerlein To: Pawel Jakub Dawidek Message-ID: <20101031195757.GO46314@acme.spoerlein.net> Mail-Followup-To: Ulrich Spoerlein , Pawel Jakub Dawidek , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> <20101031191119.GM46314@acme.spoerlein.net> <20101031195003.GE2160@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101031195003.GE2160@garage.freebsd.pl> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 19:57:59 -0000 On Sun, 31.10.2010 at 20:50:03 +0100, Pawel Jakub Dawidek wrote: > On Sun, Oct 31, 2010 at 08:11:19PM +0100, Ulrich Spoerlein wrote: > > On Sun, 31.10.2010 at 17:06:03 +0100, Pawel Jakub Dawidek wrote: > > > IMHO this option should be removed and rm(1) should fail when a user is > > > trying to use it. > > > > No, this is a POLA violation for no apparent gain. The flag has been in > > FreeBSD since at least '94. Remember, that we are in the rope-selling > > business. We empower the users to shoot themselves in the foot. > > > > I, for one, am using the -P option in a certain case where I can be sure > > that ~99% of the data will be obliterated and I'm fine with that. For > > all other cases I'm using geli or gbde (where I can make sure, that data > > is lost). > > The question remains unanswered: If it is not a security feature then > what's the purpose? > > IMHO this is a security feature, just a really lame one. Too many > requirements have to be meet to make it work. > > I don't think you would want to read in GELI or GBDE manual page that it > encrypts the data sometimes, or if all the given requirements are meet. > Of course requirements are fine, but they have to be really clear to the > user and the list should be as short as possible, which is not the case > here. True, this was obviously the case when the feature was introduced, a couple of years ago. As things change constantly, it may never be possible to have it work (and not break silently in the future). > > So we can either fix -P for all cases (impossible), or at least document > > its shortcomings. Documenting them clearly is better than what we had a > > couple of days before. > > I don't argue that the previous version of manual page was better I just > pick your commit to discuss it mentioned functionality further. Sorry, if my post came across a bit harsh. I only tried to document the current behaviour a bit more clearly, and perhaps give the user a warning that this feature might not do what it did 16 years ago. > Maybe we could implement few simple checks which when satisfied don't > emit a warning, ie. if this is UFS, on top of partition, on top of a > slice and on top of a regular SCSI or SATA disk don't emit a warning, > but if there is a doubt, do emit a warning. This might not be trivial, > but might be doable. Alternatively we could always emit a warning. Knock yourself out, code speaks louder than words ... Uli From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 22:41:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AA12106566B; Sun, 31 Oct 2010 22:41:54 +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 196568FC1B; Sun, 31 Oct 2010 22:41: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 o9VMfrVD009987; Sun, 31 Oct 2010 22:41:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VMfrYo009985; Sun, 31 Oct 2010 22:41:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010312241.o9VMfrYo009985@svn.freebsd.org> From: Marius Strobl Date: Sun, 31 Oct 2010 22:41: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: r214605 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 22:41:54 -0000 Author: marius Date: Sun Oct 31 22:41:53 2010 New Revision: 214605 URL: http://svn.freebsd.org/changeset/base/214605 Log: Make a comment reflect reality. Modified: head/sys/dev/mii/miivar.h Modified: head/sys/dev/mii/miivar.h ============================================================================== --- head/sys/dev/mii/miivar.h Sun Oct 31 19:16:54 2010 (r214604) +++ head/sys/dev/mii/miivar.h Sun Oct 31 22:41:53 2010 (r214605) @@ -148,7 +148,7 @@ typedef struct mii_softc mii_softc_t; /* * Special `locators' passed to mii_attach(). If one of these is not * an `any' value, we look for *that* PHY and configure it. If both - * are not `any', that is an error, and mii_attach() will panic. + * are not `any', that is an error, and mii_attach() will fail. */ #define MII_OFFSET_ANY -1 #define MII_PHY_ANY -1 From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 22:46:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 691E91065674; Sun, 31 Oct 2010 22:46:39 +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 5745B8FC14; Sun, 31 Oct 2010 22:46: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 o9VMkdP5010259; Sun, 31 Oct 2010 22:46:39 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VMkdVp010256; Sun, 31 Oct 2010 22:46:39 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010312246.o9VMkdVp010256@svn.freebsd.org> From: Marius Strobl Date: Sun, 31 Oct 2010 22:46: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: r214606 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 22:46:39 -0000 Author: marius Date: Sun Oct 31 22:46:39 2010 New Revision: 214606 URL: http://svn.freebsd.org/changeset/base/214606 Log: Try to make the style consistent (including regarding NetBSD bits not yet merged) and adhere style(9). Modified: head/sys/dev/mii/mii_physubr.c Modified: head/sys/dev/mii/mii_physubr.c ============================================================================== --- head/sys/dev/mii/mii_physubr.c Sun Oct 31 22:41:53 2010 (r214605) +++ head/sys/dev/mii/mii_physubr.c Sun Oct 31 22:46:39 2010 (r214606) @@ -107,8 +107,8 @@ mii_phy_setmedia(struct mii_softc *sc) if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0 || - (sc->mii_flags & MIIF_FORCEANEG)) - (void) mii_phy_auto(sc); + (sc->mii_flags & MIIF_FORCEANEG) != 0) + (void)mii_phy_auto(sc); return; } @@ -124,10 +124,10 @@ mii_phy_setmedia(struct mii_softc *sc) bmcr = mii_media_table[ife->ifm_data].mm_bmcr; gtcr = mii_media_table[ife->ifm_data].mm_gtcr; - if (mii->mii_media.ifm_media & IFM_ETH_MASTER) { + if ((mii->mii_media.ifm_media & IFM_ETH_MASTER) != 0) { switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_1000_T: - gtcr |= GTCR_MAN_MS|GTCR_ADV_MS; + gtcr |= GTCR_MAN_MS | GTCR_ADV_MS; break; default: @@ -135,53 +135,48 @@ mii_phy_setmedia(struct mii_softc *sc) } } - if (ife->ifm_media & IFM_LOOP) + if ((ife->ifm_media & IFM_LOOP) != 0) bmcr |= BMCR_LOOP; PHY_WRITE(sc, MII_ANAR, anar); PHY_WRITE(sc, MII_BMCR, bmcr); - if (sc->mii_flags & MIIF_HAVE_GTCR) + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) PHY_WRITE(sc, MII_100T2CR, gtcr); } int mii_phy_auto(struct mii_softc *sc) { + int anar, gtcr; /* * Check for 1000BASE-X. Autonegotiation is a bit * different on such devices. */ - if (sc->mii_flags & MIIF_IS_1000X) { - uint16_t anar = 0; - - if (sc->mii_extcapabilities & EXTSR_1000XFDX) + if ((sc->mii_flags & MIIF_IS_1000X) != 0) { + anar = 0; + if ((sc->mii_extcapabilities & EXTSR_1000XFDX) != 0) anar |= ANAR_X_FD; - if (sc->mii_extcapabilities & EXTSR_1000XHDX) + if ((sc->mii_extcapabilities & EXTSR_1000XHDX) != 0) anar |= ANAR_X_HD; - if (sc->mii_flags & MIIF_DOPAUSE) { + if ((sc->mii_flags & MIIF_DOPAUSE) != 0) { /* XXX Asymmetric vs. symmetric? */ anar |= ANLPAR_X_PAUSE_TOWARDS; } - PHY_WRITE(sc, MII_ANAR, anar); } else { - uint16_t anar; - anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA; - if (sc->mii_flags & MIIF_DOPAUSE) + if ((sc->mii_flags & MIIF_DOPAUSE) != 0) anar |= ANAR_FC; PHY_WRITE(sc, MII_ANAR, anar); - if (sc->mii_flags & MIIF_HAVE_GTCR) { - uint16_t gtcr = 0; - - if (sc->mii_extcapabilities & EXTSR_1000TFDX) + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { + gtcr = 0; + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) gtcr |= GTCR_ADV_1000TFDX; - if (sc->mii_extcapabilities & EXTSR_1000THDX) + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) gtcr |= GTCR_ADV_1000THDX; - PHY_WRITE(sc, MII_100T2CR, gtcr); } } @@ -213,7 +208,7 @@ mii_phy_tick(struct mii_softc *sc) /* Read the status register twice; BMSR_LINK is latch-low. */ reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); - if (reg & BMSR_LINK) { + if ((reg & BMSR_LINK) != 0) { sc->mii_ticks = 0; /* reset autonegotiation timer. */ /* See above. */ return (0); @@ -243,7 +238,7 @@ mii_phy_reset(struct mii_softc *sc) struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur; int reg, i; - if (sc->mii_flags & MIIF_NOISOLATE) + if ((sc->mii_flags & MIIF_NOISOLATE) != 0) reg = BMCR_RESET; else reg = BMCR_RESET | BMCR_ISO; @@ -303,7 +298,10 @@ mii_phy_add_media(struct mii_softc *sc) return; } - /* Set aneg timer for 10/100 media. Gigabit media handled below. */ + /* + * Set the autonegotiation timer for 10/100 media. Gigabit media is + * handled below. + */ sc->mii_anegticks = MII_ANEGTICKS; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -318,55 +316,54 @@ mii_phy_add_media(struct mii_softc *sc) * HomePNA PHYs. And there is really only one media type * that is supported. */ - if (sc->mii_flags & MIIF_IS_HPNA) { - if (sc->mii_capabilities & BMSR_10THDX) { + if ((sc->mii_flags & MIIF_IS_HPNA) != 0) { + if ((sc->mii_capabilities & BMSR_10THDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, - sc->mii_inst), - MII_MEDIA_10_T); + sc->mii_inst), MII_MEDIA_10_T); PRINT("HomePNA1"); } return; } - if (sc->mii_capabilities & BMSR_10THDX) { + if ((sc->mii_capabilities & BMSR_10THDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), MII_MEDIA_10_T); PRINT("10baseT"); } - if (sc->mii_capabilities & BMSR_10TFDX) { + if ((sc->mii_capabilities & BMSR_10TFDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), MII_MEDIA_10_T_FDX); PRINT("10baseT-FDX"); } - if (sc->mii_capabilities & BMSR_100TXHDX) { + if ((sc->mii_capabilities & BMSR_100TXHDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), MII_MEDIA_100_TX); PRINT("100baseTX"); } - if (sc->mii_capabilities & BMSR_100TXFDX) { + if ((sc->mii_capabilities & BMSR_100TXFDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), MII_MEDIA_100_TX_FDX); PRINT("100baseTX-FDX"); } - if (sc->mii_capabilities & BMSR_100T4) { + if ((sc->mii_capabilities & BMSR_100T4) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_T4, 0, sc->mii_inst), MII_MEDIA_100_T4); PRINT("100baseT4"); } - if (sc->mii_extcapabilities & EXTSR_MEDIAMASK) { + if ((sc->mii_extcapabilities & EXTSR_MEDIAMASK) != 0) { /* * XXX Right now only handle 1000SX and 1000TX. Need - * XXX to handle 1000LX and 1000CX some how. + * XXX to handle 1000LX and 1000CX somehow. */ - if (sc->mii_extcapabilities & EXTSR_1000XHDX) { + if ((sc->mii_extcapabilities & EXTSR_1000XHDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_IS_1000X; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, sc->mii_inst), MII_MEDIA_1000_X); PRINT("1000baseSX"); } - if (sc->mii_extcapabilities & EXTSR_1000XFDX) { + if ((sc->mii_extcapabilities & EXTSR_1000XFDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_IS_1000X; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, @@ -382,7 +379,7 @@ mii_phy_add_media(struct mii_softc *sc) * * All 1000baseT PHYs have a 1000baseT control register. */ - if (sc->mii_extcapabilities & EXTSR_1000THDX) { + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_HAVE_GTCR; mii->mii_media.ifm_mask |= IFM_ETH_MASTER; @@ -390,7 +387,7 @@ mii_phy_add_media(struct mii_softc *sc) sc->mii_inst), MII_MEDIA_1000_T); PRINT("1000baseT"); } - if (sc->mii_extcapabilities & EXTSR_1000TFDX) { + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_HAVE_GTCR; mii->mii_media.ifm_mask |= IFM_ETH_MASTER; @@ -400,7 +397,7 @@ mii_phy_add_media(struct mii_softc *sc) } } - if (sc->mii_capabilities & BMSR_ANEG) { + if ((sc->mii_capabilities & BMSR_ANEG) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), MII_NMEDIA); /* intentionally invalid index */ PRINT("auto"); @@ -418,8 +415,7 @@ mii_phy_detach(device_t dev) mii_phy_down(sc); sc->mii_dev = NULL; LIST_REMOVE(sc, mii_list); - - return(0); + return (0); } const struct mii_phydesc * @@ -452,6 +448,5 @@ mii_phy_dev_probe(device_t dev, const st device_set_desc(dev, mpd->mpd_name); return (mrv); } - return (ENXIO); } From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 22:55:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A93C106564A; Sun, 31 Oct 2010 22:55:51 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E8168FC17; Sun, 31 Oct 2010 22:55: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 o9VMtpvG011018; Sun, 31 Oct 2010 22:55:51 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VMtpJY011014; Sun, 31 Oct 2010 22:55:51 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010312255.o9VMtpJY011014@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 31 Oct 2010 22:55: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: r214607 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 22:55:51 -0000 Author: nwhitehorn Date: Sun Oct 31 22:55:51 2010 New Revision: 214607 URL: http://svn.freebsd.org/changeset/base/214607 Log: Next-to-leading-order perturbation of synchronization operations for switching the user segment register. All races should now be closed and a minimum of pipelines flushes be required to close them. Modified: head/sys/powerpc/aim/copyinout.c head/sys/powerpc/aim/swtch32.S head/sys/powerpc/aim/swtch64.S Modified: head/sys/powerpc/aim/copyinout.c ============================================================================== --- head/sys/powerpc/aim/copyinout.c Sun Oct 31 22:46:39 2010 (r214606) +++ head/sys/powerpc/aim/copyinout.c Sun Oct 31 22:55:51 2010 (r214607) @@ -117,9 +117,9 @@ set_user_sr(pmap_t pm, const void *addr) if (curthread->td_pcb->pcb_cpu.aim.usr_vsid == vsid) return; - __asm __volatile ("sync; mtsr %0,%1; sync; isync" :: "n"(USER_SR), - "r"(vsid)); + __asm __volatile("isync"); curthread->td_pcb->pcb_cpu.aim.usr_vsid = vsid; + __asm __volatile("mtsr %0,%1; isync" :: "n"(USER_SR), "r"(vsid)); } #endif Modified: head/sys/powerpc/aim/swtch32.S ============================================================================== --- head/sys/powerpc/aim/swtch32.S Sun Oct 31 22:46:39 2010 (r214606) +++ head/sys/powerpc/aim/swtch32.S Sun Oct 31 22:55:51 2010 (r214607) @@ -89,7 +89,6 @@ ENTRY(cpu_switch) mflr %r16 /* Save the link register */ stw %r16,PCB_LR(%r6) mfsr %r16,USER_SR /* Save USER_SR for copyin/out */ - isync stw %r16,PCB_AIM_USR_VSID(%r6) stw %r1,PCB_SP(%r6) /* Save the stack pointer */ stw %r2,PCB_TOC(%r6) /* Save the TOC pointer */ @@ -162,6 +161,7 @@ blocked_loop: lwz %r5,PCB_LR(%r3) /* Load the link register */ mtlr %r5 lwz %r5,PCB_AIM_USR_VSID(%r3) /* Load the USER_SR segment reg */ + isync mtsr USER_SR,%r5 isync lwz %r1,PCB_SP(%r3) /* Load the stack pointer */ Modified: head/sys/powerpc/aim/swtch64.S ============================================================================== --- head/sys/powerpc/aim/swtch64.S Sun Oct 31 22:46:39 2010 (r214606) +++ head/sys/powerpc/aim/swtch64.S Sun Oct 31 22:55:51 2010 (r214607) @@ -113,7 +113,6 @@ ENTRY(cpu_switch) li %r15,0 /* Save user segment for copyin/out */ li %r16,USER_SLB_SLOT slbmfev %r15, %r16 - isync std %r15,PCB_AIM_USR_VSID(%r6) mr %r14,%r3 /* Copy the old thread ptr... */ @@ -222,6 +221,7 @@ blocked_loop: ori %r5,%r5,USER_ADDR@highera sldi %r5,%r5,32 oris %r5,%r5,USER_ADDR@ha + isync slbie %r5 lis %r6,USER_SLB_SLBE@highesta ori %r6,%r6,USER_SLB_SLBE@highera @@ -230,8 +230,8 @@ blocked_loop: ori %r6,%r6,USER_SLB_SLBE@l ld %r5,PCB_AIM_USR_VSID(%r3) slbmte %r5,%r6 - isync + /* * Perform a dummy stdcx. to clear any reservations we may have * inherited from the previous thread. It doesn't matter if the From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 22:59:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 826B5106566C; Sun, 31 Oct 2010 22:59:49 +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 713EE8FC0C; Sun, 31 Oct 2010 22:59:49 +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 o9VMxnh5011245; Sun, 31 Oct 2010 22:59:49 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VMxnxi011243; Sun, 31 Oct 2010 22:59:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010312259.o9VMxnxi011243@svn.freebsd.org> From: Marius Strobl Date: Sun, 31 Oct 2010 22:59: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: r214608 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 22:59:49 -0000 Author: marius Date: Sun Oct 31 22:59:49 2010 New Revision: 214608 URL: http://svn.freebsd.org/changeset/base/214608 Log: Turn a panic into a printf so IFM_ETH_MASTER on !IFM_1000_T is complained about but otherwise ignored. When allowing the master to be set manually via ifconfig(8) by adding the former to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS (as it should be) it seems to be unfavorable that a machine can be made to panic with a simple ifconfig(8) invocation. Modified: head/sys/dev/mii/mii_physubr.c Modified: head/sys/dev/mii/mii_physubr.c ============================================================================== --- head/sys/dev/mii/mii_physubr.c Sun Oct 31 22:55:51 2010 (r214607) +++ head/sys/dev/mii/mii_physubr.c Sun Oct 31 22:59:49 2010 (r214608) @@ -131,7 +131,7 @@ mii_phy_setmedia(struct mii_softc *sc) break; default: - panic("mii_phy_setmedia: MASTER on wrong media"); + printf("mii_phy_setmedia: MASTER on wrong media\n"); } } From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 23:03:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 817AB1065679; Sun, 31 Oct 2010 23:03:12 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 702FD8FC18; Sun, 31 Oct 2010 23:03: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 o9VN3CmW011421; Sun, 31 Oct 2010 23:03:12 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VN3Ch1011419; Sun, 31 Oct 2010 23:03:12 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010312303.o9VN3Ch1011419@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 31 Oct 2010 23:03: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: r214609 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 23:03:12 -0000 Author: jilles Date: Sun Oct 31 23:03:11 2010 New Revision: 214609 URL: http://svn.freebsd.org/changeset/base/214609 Log: sh(1): Correct synopsis and make precise how $0 is set. In particular, the extra argument to set $0 with -c was not documented. MFC after: 1 week Modified: head/bin/sh/sh.1 Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Sun Oct 31 22:59:49 2010 (r214608) +++ head/bin/sh/sh.1 Sun Oct 31 23:03:11 2010 (r214609) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd October 16, 2010 +.Dd October 31, 2010 .Dt SH 1 .Os .Sh NAME @@ -40,9 +40,24 @@ .Nd command interpreter (shell) .Sh SYNOPSIS .Nm -.Op Fl /+abCEefIimnPpsTuVvx +.Op Fl /+abCEefIimnPpTuVvx .Op Fl /+o Ar longname -.Op Fl c Ar string +.Oo +.Ar script +.Op Ar arg ... +.Oc +.Nm +.Op Fl /+abCEefIimnPpTuVvx +.Op Fl /+o Ar longname +.Fl c Ar string +.Oo +.Ar name +.Op Ar arg ... +.Oc +.Nm +.Op Fl /+abCEefIimnPpTuVvx +.Op Fl /+o Ar longname +.Fl s .Op Ar arg ... .Sh DESCRIPTION The @@ -1109,7 +1124,12 @@ the process ID and its exit status until .Ic wait built-in command reports completion of the process. .It Li $0 -(zero) Expands to the name of the shell or shell script. +(zero) Expands to the name of the shell script if passed on the command line, +the +.Ar name +operand if given (with +.Fl c ) +or otherwise argument 0 passed to the shell. .El .Ss Special Variables The following variables are set by the shell or From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 23:04:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 649C6106566C; Sun, 31 Oct 2010 23:04:15 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 533B28FC19; Sun, 31 Oct 2010 23:04: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 o9VN4Fai011481; Sun, 31 Oct 2010 23:04:15 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9VN4Fxg011479; Sun, 31 Oct 2010 23:04:15 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010312304.o9VN4Fxg011479@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 31 Oct 2010 23:04: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: r214610 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 23:04:15 -0000 Author: nwhitehorn Date: Sun Oct 31 23:04:15 2010 New Revision: 214610 URL: http://svn.freebsd.org/changeset/base/214610 Log: Add a security nit to recent copyin/out changes: map the user segment no-execute in case of exploitable kernel bugs. MFC after: 1 week Modified: head/sys/powerpc/aim/copyinout.c Modified: head/sys/powerpc/aim/copyinout.c ============================================================================== --- head/sys/powerpc/aim/copyinout.c Sun Oct 31 23:03:11 2010 (r214609) +++ head/sys/powerpc/aim/copyinout.c Sun Oct 31 23:04:15 2010 (r214610) @@ -95,6 +95,9 @@ set_user_sr(pmap_t pm, const void *addr) slbv = slb->slbv; } + /* Mark segment no-execute */ + slbv |= SLBV_N; + /* If we have already set this VSID, we can just return */ if (curthread->td_pcb->pcb_cpu.aim.usr_vsid == slbv) return; @@ -117,6 +120,9 @@ set_user_sr(pmap_t pm, const void *addr) if (curthread->td_pcb->pcb_cpu.aim.usr_vsid == vsid) return; + /* Mark segment no-execute */ + vsid |= SR_N; + __asm __volatile("isync"); curthread->td_pcb->pcb_cpu.aim.usr_vsid = vsid; __asm __volatile("mtsr %0,%1; isync" :: "n"(USER_SR), "r"(vsid)); From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 00:42:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8724106566B; Mon, 1 Nov 2010 00:42:25 +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 B6FF08FC0C; Mon, 1 Nov 2010 00:42:25 +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 oA10gPWi016329; Mon, 1 Nov 2010 00:42:25 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA10gPeg016326; Mon, 1 Nov 2010 00:42:25 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201011010042.oA10gPeg016326@svn.freebsd.org> From: David Xu Date: Mon, 1 Nov 2010 00:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214611 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 00:42:25 -0000 Author: davidxu Date: Mon Nov 1 00:42:25 2010 New Revision: 214611 URL: http://svn.freebsd.org/changeset/base/214611 Log: Use integer for size of cpuset, as it won't be bigger than INT_MAX, This is requested by bge. Also move the sysctl into file kern_cpuset.c, because it should always be there, it is independent of thread scheduler. Modified: head/sys/kern/kern_cpuset.c head/sys/kern/sched_ule.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Sun Oct 31 23:04:15 2010 (r214610) +++ head/sys/kern/kern_cpuset.c Mon Nov 1 00:42:25 2010 (r214611) @@ -107,6 +107,10 @@ static struct setlist cpuset_ids; static struct unrhdr *cpuset_unr; static struct cpuset *cpuset_zero; +/* Return the size of cpuset_t at the kernel level */ +SYSCTL_INT(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, + 0, sizeof(cpuset_t), "sizeof(cpuset_t)"); + cpuset_t *cpuset_root; /* Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Sun Oct 31 23:04:15 2010 (r214610) +++ head/sys/kern/sched_ule.c Mon Nov 1 00:42:25 2010 (r214611) @@ -2713,7 +2713,6 @@ sysctl_kern_sched_topology_spec(SYSCTL_H return (err); } -static size_t _kern_cpuset_size = sizeof(cpuset_t); #endif SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RW, 0, "Scheduler"); @@ -2751,14 +2750,6 @@ SYSCTL_PROC(_kern_sched, OID_AUTO, topol CTLFLAG_RD, NULL, 0, sysctl_kern_sched_topology_spec, "A", "XML dump of detected CPU topology"); -/* - * Return the size of cpuset_t at the kernel level - * - * XXX (gcooper): replace ULONG with SIZE once CTLTYPE_SIZE is implemented. - */ -SYSCTL_ULONG(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, - &_kern_cpuset_size, 0, "Kernel-level cpuset_t struct size"); - #endif /* ps compat. All cpu percentages from ULE are weighted. */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 01:03:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81717106564A; Mon, 1 Nov 2010 01:03:05 +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 6D5A88FC08; Mon, 1 Nov 2010 01:03: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 oA11354v017072; Mon, 1 Nov 2010 01:03:05 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1135Ga017056; Mon, 1 Nov 2010 01:03:05 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201011010103.oA1135Ga017056@svn.freebsd.org> From: Rick Macklem Date: Mon, 1 Nov 2010 01:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214612 - in stable/8/sys: fs/nfsclient nfs nfsclient nlm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 01:03:05 -0000 Author: rmacklem Date: Mon Nov 1 01:03:05 2010 New Revision: 214612 URL: http://svn.freebsd.org/changeset/base/214612 Log: MFC: r214048, r214053 Modify the NFS clients and the NLM so that the NLM can be used by both clients. Since the NLM uses various fields of the nfsmount structure, those fields were extracted and put in a separate nfs_mountcommon structure stored in sys/nfs/nfs_mountcommon.h. This structure also has a function pointer for a function that extracts the required information from the mount point and nfs vnode for that particular client. Also, fix the type of the 3rd argument for this function. Added: stable/8/sys/nfs/nfs_mountcommon.h - copied, changed from r214048, head/sys/nfs/nfs_mountcommon.h Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsclient/nfsmount.h stable/8/sys/nfs/nfs_lock.c stable/8/sys/nfs/nfs_lock.h stable/8/sys/nfsclient/nfs_node.c stable/8/sys/nfsclient/nfs_vfsops.c stable/8/sys/nfsclient/nfs_vnops.c stable/8/sys/nfsclient/nfsmount.h stable/8/sys/nfsclient/nfsnode.h stable/8/sys/nlm/nlm_advlock.c stable/8/sys/nlm/nlm_prot_impl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clnode.c Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/fs/nfsclient/nfs_clnode.c Mon Nov 1 01:03:05 2010 (r214612) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -53,12 +54,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include + extern struct vop_vector newnfs_vnodeops; extern struct buf_ops buf_ops_newnfs; MALLOC_DECLARE(M_NEWNFSREQ); uma_zone_t newnfsnode_zone; -vop_reclaim_t *ncl_reclaim_p = NULL; void ncl_nhinit(void) @@ -238,8 +240,8 @@ ncl_reclaim(struct vop_reclaim_args *ap) * If the NLM is running, give it a chance to abort pending * locks. */ - if (ncl_reclaim_p) - ncl_reclaim_p(ap); + if (nfs_reclaim_p != NULL) + nfs_reclaim_p(ap); /* * Destroy the vm object and flush associated pages. Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Mon Nov 1 01:03:05 2010 (r214612) @@ -96,10 +96,13 @@ SYSCTL_INT(_vfs_newnfs, NFS_TPRINTF_DELA static void nfs_sec_name(char *, int *); static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, - struct nfs_args *argp, struct ucred *, struct thread *); + struct nfs_args *argp, const char *, struct ucred *, + struct thread *); static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, u_char *, u_char *, struct vnode **, struct ucred *, struct thread *, int); +static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, + struct sockaddr_storage *, int *, off_t *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; static vfs_unmount_t nfs_unmount; @@ -518,10 +521,11 @@ nfs_sec_name(char *sec, int *flagsp) static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, - struct ucred *cred, struct thread *td) + const char *hostname, struct ucred *cred, struct thread *td) { int s; int adjsock; + char *p; s = splnet(); @@ -659,6 +663,14 @@ nfs_decode_args(struct mount *mp, struct nmp->nm_sotype = argp->sotype; nmp->nm_soproto = argp->proto; } + + if (hostname != NULL) { + strlcpy(nmp->nm_hostname, hostname, + sizeof(nmp->nm_hostname)); + p = strchr(nmp->nm_hostname, ':'); + if (p != NULL) + *p = '\0'; + } } static const char *nfs_opts[] = { "from", @@ -933,7 +945,7 @@ nfs_mount(struct mount *mp) NFSMNT_INTEGRITY | NFSMNT_PRIVACY | NFSMNT_NOLOCKD /*|NFSMNT_XLATECOOKIE*/)); - nfs_decode_args(mp, nmp, &args, td->td_ucred, td); + nfs_decode_args(mp, nmp, &args, NULL, td->td_ucred, td); goto out; } @@ -1110,13 +1122,14 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_sockreq.nr_cred = crhold(cred); mtx_init(&nmp->nm_sockreq.nr_mtx, "nfssock", NULL, MTX_DEF); mp->mnt_data = nmp; + nmp->nm_getinfo = nfs_getnlminfo; } vfs_getnewfsid(mp); nmp->nm_mountp = mp; mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); nmp->nm_negnametimeo = negnametimeo; - nfs_decode_args(mp, nmp, argp, cred, td); + nfs_decode_args(mp, nmp, argp, hst, cred, td); /* * V2 can only handle 32 bit filesizes. A 4GB-1 limit may be too @@ -1447,3 +1460,26 @@ nfs_sysctl(struct mount *mp, fsctlop_t o return (0); } +/* + * Extract the information needed by the nlm from the nfs vnode. + */ +static void +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, + struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) +{ + struct nfsmount *nmp; + struct nfsnode *np = VTONFS(vp); + + nmp = VFSTONFS(vp->v_mount); + if (fhlenp != NULL) + *fhlenp = (size_t)np->n_fhp->nfh_len; + if (fhp != NULL) + bcopy(np->n_fhp->nfh_fh, fhp, np->n_fhp->nfh_len); + if (sp != NULL) + bcopy(nmp->nm_nam, sp, min(nmp->nm_nam->sa_len, sizeof(*sp))); + if (is_v3p != NULL) + *is_v3p = NFS_ISV3(vp); + if (sizep != NULL) + *sizep = np->n_size; +} + Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Mon Nov 1 01:03:05 2010 (r214612) @@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$"); extern struct nfsstats newnfsstats; MALLOC_DECLARE(M_NEWNFSREQ); -vop_advlock_t *ncl_advlock_p = NULL; /* * Ifdef for FreeBSD-current merged buffer cache. It is unfortunate that these @@ -2937,8 +2936,8 @@ nfs_advlock(struct vop_advlock_args *ap) VOP_UNLOCK(vp, 0); error = lf_advlock(ap, &(vp->v_lockf), size); } else { - if (ncl_advlock_p) - error = ncl_advlock_p(ap); + if (nfs_advlock_p != NULL) + error = nfs_advlock_p(ap); else { VOP_UNLOCK(vp, 0); error = ENOLCK; Modified: stable/8/sys/fs/nfsclient/nfsmount.h ============================================================================== --- stable/8/sys/fs/nfsclient/nfsmount.h Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/fs/nfsclient/nfsmount.h Mon Nov 1 01:03:05 2010 (r214612) @@ -35,22 +35,19 @@ #ifndef _NFSCLIENT_NFSMOUNT_H_ #define _NFSCLIENT_NFSMOUNT_H_ +#include + /* * Mount structure. * One allocated on every NFS mount. * Holds NFS specific information for mount. */ struct nfsmount { - struct mtx nm_mtx; - int nm_flag; /* Flags for soft/hard... */ - int nm_state; /* Internal state flags */ - struct mount *nm_mountp; /* Vfs structure for this filesystem */ + struct nfsmount_common nm_com; /* Common fields for nlm */ int nm_numgrps; /* Max. size of groupslist */ u_char nm_fh[NFSX_FHMAX]; /* File handle of root dir */ int nm_fhsize; /* Size of root file handle */ struct nfssockreq nm_sockreq; /* Socket Info */ - int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */ - int nm_retry; /* Max retries */ int nm_timeouts; /* Request timeouts */ int nm_rsize; /* Max size of read rpc */ int nm_wsize; /* Max size of write rpc */ @@ -89,6 +86,14 @@ struct nfsmount { #define nm_soproto nm_sockreq.nr_soproto #define nm_client nm_sockreq.nr_client #define nm_krbname nm_name +#define nm_mtx nm_com.nmcom_mtx +#define nm_flag nm_com.nmcom_flag +#define nm_state nm_com.nmcom_state +#define nm_mountp nm_com.nmcom_mountp +#define nm_timeo nm_com.nmcom_timeo +#define nm_retry nm_com.nmcom_retry +#define nm_hostname nm_com.nmcom_hostname +#define nm_getinfo nm_com.nmcom_getinfo #define NFSMNT_DIRPATH(m) (&((m)->nm_name[(m)->nm_krbnamelen + 1])) #define NFSMNT_SRVKRBNAME(m) \ Modified: stable/8/sys/nfs/nfs_lock.c ============================================================================== --- stable/8/sys/nfs/nfs_lock.c Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/nfs/nfs_lock.c Mon Nov 1 01:03:05 2010 (r214612) @@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$"); extern void (*nlminfo_release_p)(struct proc *p); +vop_advlock_t *nfs_advlock_p = nfs_dolock; +vop_reclaim_t *nfs_reclaim_p = NULL; + MALLOC_DEFINE(M_NFSLOCK, "nfsclient_lock", "NFS lock request"); MALLOC_DEFINE(M_NLMINFO, "nfsclient_nlminfo", "NFS lock process structure"); @@ -236,20 +239,19 @@ nfs_dolock(struct vop_advlock_args *ap) int error; struct flock *fl; struct proc *p; + struct nfsmount *nmp; td = curthread; p = td->td_proc; vp = ap->a_vp; fl = ap->a_fl; + nmp = VFSTONFS(vp->v_mount); ASSERT_VOP_LOCKED(vp, "nfs_dolock"); - bcopy(VFSTONFS(vp->v_mount)->nm_nam, &msg.lm_addr, - min(sizeof msg.lm_addr, VFSTONFS(vp->v_mount)->nm_nam->sa_len)); - msg.lm_fh_len = NFS_ISV3(vp) ? VTONFS(vp)->n_fhsize : NFSX_V2FH; - bcopy(VTONFS(vp)->n_fhp, msg.lm_fh, msg.lm_fh_len); - msg.lm_nfsv3 = NFS_ISV3(vp); + nmp->nm_getinfo(vp, msg.lm_fh, &msg.lm_fh_len, &msg.lm_addr, + &msg.lm_nfsv3, NULL); VOP_UNLOCK(vp, 0); /* Modified: stable/8/sys/nfs/nfs_lock.h ============================================================================== --- stable/8/sys/nfs/nfs_lock.h Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/nfs/nfs_lock.h Mon Nov 1 01:03:05 2010 (r214612) @@ -87,4 +87,6 @@ struct lockd_ans { #ifdef _KERNEL int nfs_dolock(struct vop_advlock_args *ap); +extern vop_advlock_t *nfs_advlock_p; +extern vop_reclaim_t *nfs_reclaim_p; #endif Copied and modified: stable/8/sys/nfs/nfs_mountcommon.h (from r214048, head/sys/nfs/nfs_mountcommon.h) ============================================================================== --- head/sys/nfs/nfs_mountcommon.h Tue Oct 19 00:20:00 2010 (r214048, copy source) +++ stable/8/sys/nfs/nfs_mountcommon.h Mon Nov 1 01:03:05 2010 (r214612) @@ -34,7 +34,7 @@ * used by the nlm. It includes a function pointer that provides * a mechanism for getting the client specific info for an nfs vnode. */ -typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, int *, +typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *); struct nfsmount_common { Modified: stable/8/sys/nfsclient/nfs_node.c ============================================================================== --- stable/8/sys/nfsclient/nfs_node.c Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/nfsclient/nfs_node.c Mon Nov 1 01:03:05 2010 (r214612) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -51,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/nfsclient/nfs_vfsops.c Mon Nov 1 01:03:05 2010 (r214612) @@ -115,6 +115,8 @@ static void nfs_decode_args(struct mount static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, struct vnode **, struct ucred *cred, int); +static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, + struct sockaddr_storage *, int *, off_t *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; static vfs_unmount_t nfs_unmount; @@ -1202,6 +1204,7 @@ mountnfs(struct nfs_args *argp, struct m bzero((caddr_t)nmp, sizeof (struct nfsmount)); TAILQ_INIT(&nmp->nm_bufq); mp->mnt_data = nmp; + nmp->nm_getinfo = nfs_getnlminfo; } vfs_getnewfsid(mp); nmp->nm_mountp = mp; @@ -1490,3 +1493,27 @@ nfs_sysctl(struct mount *mp, fsctlop_t o } return (0); } + +/* + * Extract the information needed by the nlm from the nfs vnode. + */ +static void +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, + struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) +{ + struct nfsmount *nmp; + struct nfsnode *np = VTONFS(vp); + + nmp = VFSTONFS(vp->v_mount); + if (fhlenp != NULL) + *fhlenp = (size_t)np->n_fhsize; + if (fhp != NULL) + bcopy(np->n_fhp, fhp, np->n_fhsize); + if (sp != NULL) + bcopy(nmp->nm_nam, sp, min(nmp->nm_nam->sa_len, sizeof(*sp))); + if (is_v3p != NULL) + *is_v3p = NFS_ISV3(vp); + if (sizep != NULL) + *sizep = np->n_size; +} + Modified: stable/8/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vnops.c Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/nfsclient/nfs_vnops.c Mon Nov 1 01:03:05 2010 (r214612) @@ -215,8 +215,6 @@ struct mtx nfs_iod_mtx; enum nfsiod_state nfs_iodwant[NFS_MAXASYNCDAEMON]; struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON]; int nfs_numasync = 0; -vop_advlock_t *nfs_advlock_p = nfs_dolock; -vop_reclaim_t *nfs_reclaim_p = NULL; #define DIRHDSIZ (sizeof (struct dirent) - (MAXNAMLEN + 1)) SYSCTL_DECL(_vfs_nfs); Modified: stable/8/sys/nfsclient/nfsmount.h ============================================================================== --- stable/8/sys/nfsclient/nfsmount.h Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/nfsclient/nfsmount.h Mon Nov 1 01:03:05 2010 (r214612) @@ -36,6 +36,10 @@ #ifndef _NFSCLIENT_NFSMOUNT_H_ #define _NFSCLIENT_NFSMOUNT_H_ +#include + +#include + #include #include #include @@ -47,10 +51,7 @@ * Holds NFS specific information for mount. */ struct nfsmount { - struct mtx nm_mtx; - int nm_flag; /* Flags for soft/hard... */ - int nm_state; /* Internal state flags */ - struct mount *nm_mountp; /* Vfs structure for this filesystem */ + struct nfsmount_common nm_com; /* Common fields for nlm */ int nm_numgrps; /* Max. size of groupslist */ u_char nm_fh[NFSX_V4FH]; /* File handle of root dir */ int nm_fhsize; /* Size of root file handle */ @@ -58,8 +59,6 @@ struct nfsmount { int nm_soproto; /* and protocol */ int nm_soflags; /* pr_flags for socket protocol */ struct sockaddr *nm_nam; /* Addr of server */ - int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */ - int nm_retry; /* Max retries */ int nm_deadthresh; /* Threshold of timeouts-->dead server*/ int nm_rsize; /* Max size of read rpc */ int nm_wsize; /* Max size of write rpc */ @@ -79,7 +78,6 @@ struct nfsmount { struct nfs_rpcops *nm_rpcops; int nm_tprintf_initial_delay; /* initial delay */ int nm_tprintf_delay; /* interval for messages */ - char nm_hostname[MNAMELEN]; /* server's name */ int nm_secflavor; /* auth flavor to use for rpc */ struct __rpc_client *nm_client; struct rpc_timers nm_timers[NFS_MAX_TIMER]; /* RTT Timers for rpcs */ @@ -94,6 +92,15 @@ struct nfsmount { time_t nm_last_renewal; }; +#define nm_mtx nm_com.nmcom_mtx +#define nm_flag nm_com.nmcom_flag +#define nm_state nm_com.nmcom_state +#define nm_mountp nm_com.nmcom_mountp +#define nm_timeo nm_com.nmcom_timeo +#define nm_retry nm_com.nmcom_retry +#define nm_hostname nm_com.nmcom_hostname +#define nm_getinfo nm_com.nmcom_getinfo + #if defined(_KERNEL) /* * Convert mount ptr to nfsmount ptr. Modified: stable/8/sys/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/nfsclient/nfsnode.h Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/nfsclient/nfsnode.h Mon Nov 1 01:03:05 2010 (r214612) @@ -200,9 +200,6 @@ extern struct vop_vector nfs_fifoops; extern struct vop_vector nfs_vnodeops; extern struct buf_ops buf_ops_nfs; -extern vop_advlock_t *nfs_advlock_p; -extern vop_reclaim_t *nfs_reclaim_p; - /* * Prototypes for NFS vnode operations */ Modified: stable/8/sys/nlm/nlm_advlock.c ============================================================================== --- stable/8/sys/nlm/nlm_advlock.c Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/nlm/nlm_advlock.c Mon Nov 1 01:03:05 2010 (r214612) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -47,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -196,7 +196,6 @@ nlm_advlock_internal(struct vnode *vp, v { struct thread *td = curthread; struct nfsmount *nmp; - struct nfsnode *np; off_t size; size_t fhlen; union nfsfh fh; @@ -214,6 +213,7 @@ nlm_advlock_internal(struct vnode *vp, v struct nlm_file_svid *ns; int svid; int error; + int is_v3; ASSERT_VOP_LOCKED(vp, "nlm_advlock_1"); @@ -225,18 +225,13 @@ nlm_advlock_internal(struct vnode *vp, v if (op == F_SETLK || op == F_UNLCK) nfs_vinvalbuf(vp, V_SAVE, td, 1); - np = VTONFS(vp); nmp = VFSTONFS(vp->v_mount); - size = np->n_size; - sa = nmp->nm_nam; - memcpy(&ss, sa, sa->sa_len); - sa = (struct sockaddr *) &ss; strcpy(servername, nmp->nm_hostname); - fhlen = np->n_fhsize; - memcpy(&fh.fh_bytes, np->n_fhp, fhlen); + nmp->nm_getinfo(vp, fh.fh_bytes, &fhlen, &ss, &is_v3, &size); + sa = (struct sockaddr *) &ss; timo.tv_sec = nmp->nm_timeo / NFS_HZ; timo.tv_usec = (nmp->nm_timeo % NFS_HZ) * (1000000 / NFS_HZ); - if (NFS_ISV3(vp)) + if (is_v3 != 0) vers = NLM_VERS4; else vers = NLM_VERS; Modified: stable/8/sys/nlm/nlm_prot_impl.c ============================================================================== --- stable/8/sys/nlm/nlm_prot_impl.c Mon Nov 1 00:42:25 2010 (r214611) +++ stable/8/sys/nlm/nlm_prot_impl.c Mon Nov 1 01:03:05 2010 (r214612) @@ -54,8 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include #include #include @@ -2311,4 +2310,5 @@ DECLARE_MODULE(nfslockd, nfslockd_mod, S /* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_DEPEND(nfslockd, krpc, 1, 1, 1); MODULE_DEPEND(nfslockd, nfs, 1, 1, 1); +MODULE_DEPEND(nfslockd, nfslock, 1, 1, 1); MODULE_VERSION(nfslockd, 1); From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 01:51:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6282A106566C; Mon, 1 Nov 2010 01:51:48 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 189328FC18; Mon, 1 Nov 2010 01:51: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 oA11plQX019762; Mon, 1 Nov 2010 01:51:47 GMT (envelope-from wollman@svn.freebsd.org) Received: (from wollman@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA11plGq019760; Mon, 1 Nov 2010 01:51:47 GMT (envelope-from wollman@svn.freebsd.org) Message-Id: <201011010151.oA11plGq019760@svn.freebsd.org> From: Garrett Wollman Date: Mon, 1 Nov 2010 01:51: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: r214613 - head/usr.bin/locate/locate X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 01:51:48 -0000 Author: wollman Date: Mon Nov 1 01:51:47 2010 New Revision: 214613 URL: http://svn.freebsd.org/changeset/base/214613 Log: jilles@ pointed out that using ${PRUNEDIRS:=".zfs"} in updatedb.sh made it impossible to override PRUNEDIRS to make it empty. Use the non-colon form to only set PRUNEDIRS if it is completely unset. (For parallelism, the other configuration defaults here could be done the same way, but that could be more obviously accomplished by disabling updatedb in periodic.conf, so leave them alone for now.) Modified: head/usr.bin/locate/locate/updatedb.sh Modified: head/usr.bin/locate/locate/updatedb.sh ============================================================================== --- head/usr.bin/locate/locate/updatedb.sh Mon Nov 1 01:03:05 2010 (r214612) +++ head/usr.bin/locate/locate/updatedb.sh Mon Nov 1 01:51:47 2010 (r214613) @@ -52,7 +52,7 @@ PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; ex : ${FCODES:=/var/db/locate.database} # the database : ${SEARCHPATHS:="/"} # directories to be put in the database : ${PRUNEPATHS:="/tmp /usr/tmp /var/tmp /var/db/portsnap"} # unwanted directories -: ${PRUNEDIRS:=".zfs"} # unwanted directories, in any parent +: ${PRUNEDIRS=".zfs"} # unwanted directories, in any parent : ${FILESYSTEMS:="$(lsvfs | tail -n +3 | \ egrep -vw "loopback|network|synthetic|read-only|0" | \ cut -d " " -f1)"} # allowed filesystems From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 01:55:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92D57106564A; Mon, 1 Nov 2010 01:55:15 +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 806EC8FC17; Mon, 1 Nov 2010 01:55: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 oA11tF4P019950; Mon, 1 Nov 2010 01:55:15 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA11tF4G019948; Mon, 1 Nov 2010 01:55:15 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201011010155.oA11tF4G019948@svn.freebsd.org> From: Rick Macklem Date: Mon, 1 Nov 2010 01:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214614 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 01:55:15 -0000 Author: rmacklem Date: Mon Nov 1 01:55:15 2010 New Revision: 214614 URL: http://svn.freebsd.org/changeset/base/214614 Log: MFC: r214149 Modify the experimental NFS server in a manner analagous to r214049 for the regular NFS server, so that it will not do a VOP_LOOKUP() of ".." when at the root of a file system when performing a ReaddirPlus RPC. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Mon Nov 1 01:51:47 2010 (r214613) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Mon Nov 1 01:55:15 2010 (r214614) @@ -1933,7 +1933,15 @@ again: vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - r = VOP_LOOKUP(vp, &nvp, &cn); + if ((vp->v_vflag & VV_ROOT) != 0 + && (cn.cn_flags & ISDOTDOT) + != 0) { + vref(vp); + nvp = vp; + r = 0; + } else + r = VOP_LOOKUP(vp, &nvp, + &cn); } } if (!r) { From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 02:15:30 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F22481065673; Mon, 1 Nov 2010 02:15:30 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (hergotha.csail.mit.edu [66.92.79.170]) by mx1.freebsd.org (Postfix) with ESMTP id A44B48FC12; Mon, 1 Nov 2010 02:15:30 +0000 (UTC) Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.14.4/8.14.4) with ESMTP id oA11sAEd050116; Sun, 31 Oct 2010 21:54:10 -0400 (EDT) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.14.4/8.14.4/Submit) id oA11sA3H050113; Sun, 31 Oct 2010 21:54:10 -0400 (EDT) (envelope-from wollman) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19662.7618.600259.973098@hergotha.csail.mit.edu> Date: Sun, 31 Oct 2010 21:54:10 -0400 From: Garrett Wollman To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org In-Reply-To: <201011010151.oA11plGq019760@svn.freebsd.org> References: <201011010151.oA11plGq019760@svn.freebsd.org> X-Mailer: VM 7.17 under 21.4 (patch 22) "Instant Classic" XEmacs Lucid X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6 (hergotha.csail.mit.edu [127.0.0.1]); Sun, 31 Oct 2010 21:54:10 -0400 (EDT) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hergotha.csail.mit.edu Cc: Subject: Re: svn commit: r214613 - head/usr.bin/locate/locate X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 02:15:31 -0000 < said: > jilles@ pointed out that using ${PRUNEDIRS:=".zfs"} in updatedb.sh > made it impossible to override PRUNEDIRS to make it empty. Use the > non-colon form to only set PRUNEDIRS if it is completely unset. (For > parallelism, the other configuration defaults here could be done the > same way, but that could be more obviously accomplished by disabling > updatedb in periodic.conf, so leave them alone for now.) With this change, you can now make the locate database once again include all of your mounted ZFS snapshots by setting PRUNEDIRS="" in your /etc/locate.rc. -GAWollman From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 02:20:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F29E41065672; Mon, 1 Nov 2010 02:20:18 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C68348FC14; Mon, 1 Nov 2010 02:20: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 oA12KIVK021005; Mon, 1 Nov 2010 02:20:18 GMT (envelope-from wollman@svn.freebsd.org) Received: (from wollman@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA12KIEc021003; Mon, 1 Nov 2010 02:20:18 GMT (envelope-from wollman@svn.freebsd.org) Message-Id: <201011010220.oA12KIEc021003@svn.freebsd.org> From: Garrett Wollman Date: Mon, 1 Nov 2010 02:20: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: r214615 - head/usr.bin/locate/locate X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 02:20:19 -0000 Author: wollman Date: Mon Nov 1 02:20:18 2010 New Revision: 214615 URL: http://svn.freebsd.org/changeset/base/214615 Log: Style cleanup: make this look more like a 21st-century shell script and not something out of the early 1980s. Make sure all error messages go to stderr, not stdout. Since there's error-handling code to handle empty SEARCHPATHS and FILESYSTEMS, use the initialization form that allows this error to be diagnosed. (hat tip: jilles@) Modified: head/usr.bin/locate/locate/updatedb.sh Modified: head/usr.bin/locate/locate/updatedb.sh ============================================================================== --- head/usr.bin/locate/locate/updatedb.sh Mon Nov 1 01:55:15 2010 (r214614) +++ head/usr.bin/locate/locate/updatedb.sh Mon Nov 1 02:20:18 2010 (r214615) @@ -50,18 +50,20 @@ PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; ex : ${mklocatedb:=locate.mklocatedb} # make locate database program : ${FCODES:=/var/db/locate.database} # the database -: ${SEARCHPATHS:="/"} # directories to be put in the database -: ${PRUNEPATHS:="/tmp /usr/tmp /var/tmp /var/db/portsnap"} # unwanted directories +: ${SEARCHPATHS="/"} # directories to be put in the database +: ${PRUNEPATHS="/tmp /usr/tmp /var/tmp /var/db/portsnap"} # unwanted directories : ${PRUNEDIRS=".zfs"} # unwanted directories, in any parent -: ${FILESYSTEMS:="$(lsvfs | tail -n +3 | \ +: ${FILESYSTEMS="$(lsvfs | tail -n +3 | \ egrep -vw "loopback|network|synthetic|read-only|0" | \ cut -d " " -f1)"} # allowed filesystems : ${find:=find} -case X"$SEARCHPATHS" in - X) echo "$0: empty variable SEARCHPATHS"; exit 1;; esac -case X"$FILESYSTEMS" in - X) echo "$0: empty variable FILESYSTEMS"; exit 1;; esac +if [ -z "$SEARCHPATHS" ]; then + echo "$0: empty variable SEARCHPATHS" >&2; exit 1 +fi +if [ -z "$FILESYSTEMS" ]; then + echo "$0: empty variable FILESYSTEMS" >&2; exit 1 +fi # Make a list a paths to exclude in the locate run excludes="! (" or="" @@ -72,33 +74,29 @@ do done excludes="$excludes ) -prune" -case X"$PRUNEPATHS" in - X) ;; - *) for path in $PRUNEPATHS - do +if [ -n "$PRUNEPATHS" ]; then + for path in $PRUNEPATHS; do excludes="$excludes -or -path $path -prune" - done;; -esac + done +fi -case X"$PRUNEDIRS" in - X) ;; - *) for dir in $PRUNEDIRS - do +if [ -n "$PRUNEDIRS" ]; then + for dir in $PRUNEDIRS; do excludes="$excludes -or -name $dir -type d -prune" - done;; -esac + done +fi tmp=$TMPDIR/_updatedb$$ trap 'rm -f $tmp; rmdir $TMPDIR' 0 1 2 3 5 10 15 # search locally -# echo $find $SEARCHPATHS $excludes -or -print && exit if $find -s $SEARCHPATHS $excludes -or -print 2>/dev/null | $mklocatedb -presort > $tmp then - case X"`$find $tmp -size -257c -print`" in - X) cat $tmp > $FCODES;; - *) echo "updatedb: locate database $tmp is empty" - exit 1 - esac + if [ -n "$($find $tmp -size -257c -print)" ]; then + echo "updatedb: locate database $tmp is empty" >&2 + exit 1 + else + cat $tmp > $FCODES # should be cp? + fi fi From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 02:21:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B4F1106566B; Mon, 1 Nov 2010 02:21:36 +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 2E5DA8FC08; Mon, 1 Nov 2010 02:21: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 oA12Lalj021092; Mon, 1 Nov 2010 02:21:36 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA12Laot021088; Mon, 1 Nov 2010 02:21:36 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201011010221.oA12Laot021088@svn.freebsd.org> From: Rick Macklem Date: Mon, 1 Nov 2010 02:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214616 - in stable/8/sys/fs: nfs nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 02:21:36 -0000 Author: rmacklem Date: Mon Nov 1 02:21:35 2010 New Revision: 214616 URL: http://svn.freebsd.org/changeset/base/214616 Log: MFC: r214224 Modify the file handle hash function in the experimental NFS server so that it will work better for non-UFS file systems. The new function simply sums the bytes of the fh_fid field of fhandle_t. Modified: stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfs/nfsdport.h stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Mon Nov 1 02:20:18 2010 (r214615) +++ stable/8/sys/fs/nfs/nfs_var.h Mon Nov 1 02:21:35 2010 (r214616) @@ -578,6 +578,7 @@ void nfsvno_unlockvfs(mount_t); int nfsvno_lockvfs(mount_t); int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *); int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *); +int nfsrv_hashfh(fhandle_t *); /* nfs_commonkrpc.c */ int newnfs_nmcancelreqs(struct nfsmount *); Modified: stable/8/sys/fs/nfs/nfsdport.h ============================================================================== --- stable/8/sys/fs/nfs/nfsdport.h Mon Nov 1 02:20:18 2010 (r214615) +++ stable/8/sys/fs/nfs/nfsdport.h Mon Nov 1 02:21:35 2010 (r214616) @@ -73,7 +73,7 @@ struct nfsexstuff { bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0) #define NFSLOCKHASH(f) \ - (&nfslockhash[(*((u_int32_t *)((f)->fh_fid.fid_data))) % NFSLOCKHASHSIZE]) + (&nfslockhash[nfsrv_hashfh(f) % NFSLOCKHASHSIZE]) #define NFSFPVNODE(f) ((struct vnode *)((f)->f_data)) #define NFSFPCRED(f) ((f)->f_cred) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Mon Nov 1 02:20:18 2010 (r214615) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Mon Nov 1 02:21:35 2010 (r214616) @@ -3087,6 +3087,21 @@ nfsvno_testexp(struct nfsrv_descript *nd return (1); } +/* + * Calculate a hash value for the fid in a file handle. + */ +int +nfsrv_hashfh(fhandle_t *fhp) +{ + int hashval = 0, i; + uint8_t *cp; + + cp = (uint8_t *)&fhp->fh_fid; + for (i = 0; i < sizeof(struct fid); i++) + hashval += *cp++; + return (hashval); +} + extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *); /* From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 02:22:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9706C106564A; Mon, 1 Nov 2010 02:22:48 +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 7B2D28FC1A; Mon, 1 Nov 2010 02:22: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 oA12Mm17021202; Mon, 1 Nov 2010 02:22:48 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA12Mm74021199; Mon, 1 Nov 2010 02:22:48 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201011010222.oA12Mm74021199@svn.freebsd.org> From: Alan Cox Date: Mon, 1 Nov 2010 02:22: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: r214617 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 02:22:48 -0000 Author: alc Date: Mon Nov 1 02:22:48 2010 New Revision: 214617 URL: http://svn.freebsd.org/changeset/base/214617 Log: Implement pmap_is_prefaultable(). Reviewed by: nwhitehorn Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Mon Nov 1 02:21:35 2010 (r214616) +++ head/sys/powerpc/aim/mmu_oea.c Mon Nov 1 02:22:48 2010 (r214617) @@ -304,6 +304,7 @@ vm_paddr_t moea_extract(mmu_t, pmap_t, v vm_page_t moea_extract_and_hold(mmu_t, pmap_t, vm_offset_t, vm_prot_t); void moea_init(mmu_t); boolean_t moea_is_modified(mmu_t, vm_page_t); +boolean_t moea_is_prefaultable(mmu_t, pmap_t, vm_offset_t); boolean_t moea_is_referenced(mmu_t, vm_page_t); boolean_t moea_ts_referenced(mmu_t, vm_page_t); vm_offset_t moea_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t, int); @@ -347,6 +348,7 @@ static mmu_method_t moea_methods[] = { MMUMETHOD(mmu_extract_and_hold, moea_extract_and_hold), MMUMETHOD(mmu_init, moea_init), MMUMETHOD(mmu_is_modified, moea_is_modified), + MMUMETHOD(mmu_is_prefaultable, moea_is_prefaultable), MMUMETHOD(mmu_is_referenced, moea_is_referenced), MMUMETHOD(mmu_ts_referenced, moea_ts_referenced), MMUMETHOD(mmu_map, moea_map), @@ -1324,6 +1326,19 @@ moea_is_modified(mmu_t mmu, vm_page_t m) return (moea_query_bit(m, PTE_CHG)); } +boolean_t +moea_is_prefaultable(mmu_t mmu, pmap_t pmap, vm_offset_t va) +{ + struct pvo_entry *pvo; + boolean_t rv; + + PMAP_LOCK(pmap); + pvo = moea_pvo_find_va(pmap, va & ~ADDR_POFF, NULL); + rv = pvo == NULL || (pvo->pvo_pte.pte.pte_hi & PTE_VALID) == 0; + PMAP_UNLOCK(pmap); + return (rv); +} + void moea_clear_reference(mmu_t mmu, vm_page_t m) { Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Mon Nov 1 02:21:35 2010 (r214616) +++ head/sys/powerpc/aim/mmu_oea64.c Mon Nov 1 02:22:48 2010 (r214617) @@ -400,6 +400,7 @@ vm_paddr_t moea64_extract(mmu_t, pmap_t, vm_page_t moea64_extract_and_hold(mmu_t, pmap_t, vm_offset_t, vm_prot_t); void moea64_init(mmu_t); boolean_t moea64_is_modified(mmu_t, vm_page_t); +boolean_t moea64_is_prefaultable(mmu_t, pmap_t, vm_offset_t); boolean_t moea64_is_referenced(mmu_t, vm_page_t); boolean_t moea64_ts_referenced(mmu_t, vm_page_t); vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t, int); @@ -441,6 +442,7 @@ static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_extract_and_hold, moea64_extract_and_hold), MMUMETHOD(mmu_init, moea64_init), MMUMETHOD(mmu_is_modified, moea64_is_modified), + MMUMETHOD(mmu_is_prefaultable, moea64_is_prefaultable), MMUMETHOD(mmu_is_referenced, moea64_is_referenced), MMUMETHOD(mmu_ts_referenced, moea64_ts_referenced), MMUMETHOD(mmu_map, moea64_map), @@ -1786,6 +1788,19 @@ moea64_is_modified(mmu_t mmu, vm_page_t return (moea64_query_bit(m, LPTE_CHG)); } +boolean_t +moea64_is_prefaultable(mmu_t mmu, pmap_t pmap, vm_offset_t va) +{ + struct pvo_entry *pvo; + boolean_t rv; + + PMAP_LOCK(pmap); + pvo = moea64_pvo_find_va(pmap, va & ~ADDR_POFF); + rv = pvo == NULL || (pvo->pvo_pte.lpte.pte_hi & LPTE_VALID) == 0; + PMAP_UNLOCK(pmap); + return (rv); +} + void moea64_clear_reference(mmu_t mmu, vm_page_t m) { From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 06:17:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DBBA106566C; Mon, 1 Nov 2010 06:17:03 +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 4B9D78FC16; Mon, 1 Nov 2010 06:17: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 oA16H3em035200; Mon, 1 Nov 2010 06:17:03 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA16H3ko035198; Mon, 1 Nov 2010 06:17:03 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201011010617.oA16H3ko035198@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 1 Nov 2010 06:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214618 - stable/8/sbin/mksnap_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 06:17:03 -0000 Author: jh Date: Mon Nov 1 06:17:02 2010 New Revision: 214618 URL: http://svn.freebsd.org/changeset/base/214618 Log: MFC r213668: - Print the nmount(2) provided error message only when it is set. - Ensure that the error message is NUL-terminated before printing it. PR: bin/147482 Modified: stable/8/sbin/mksnap_ffs/mksnap_ffs.c Directory Properties: stable/8/sbin/mksnap_ffs/ (props changed) Modified: stable/8/sbin/mksnap_ffs/mksnap_ffs.c ============================================================================== --- stable/8/sbin/mksnap_ffs/mksnap_ffs.c Mon Nov 1 02:22:48 2010 (r214617) +++ stable/8/sbin/mksnap_ffs/mksnap_ffs.c Mon Nov 1 06:17:02 2010 (r214618) @@ -121,8 +121,12 @@ main(int argc, char **argv) build_iovec(&iov, &iovlen, "update", NULL, 0); build_iovec(&iov, &iovlen, "snapshot", NULL, 0); - if (nmount(iov, iovlen, stfsbuf.f_flags) < 0) - err(1, "Cannot create snapshot %s: %s", snapname, errmsg); + *errmsg = '\0'; + if (nmount(iov, iovlen, stfsbuf.f_flags) < 0) { + errmsg[sizeof(errmsg) - 1] = '\0'; + err(1, "Cannot create snapshot %s%s%s", snapname, + *errmsg != '\0' ? ": " : "", errmsg); + } if ((fd = open(snapname, O_RDONLY)) < 0) err(1, "Cannot open %s", snapname); if (fstat(fd, &stbuf) != 0) From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 06:19:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7D37106564A; Mon, 1 Nov 2010 06:19:44 +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 93D768FC15; Mon, 1 Nov 2010 06:19: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 oA16JiIB035525; Mon, 1 Nov 2010 06:19:44 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA16Ji7x035523; Mon, 1 Nov 2010 06:19:44 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201011010619.oA16Ji7x035523@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 1 Nov 2010 06:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214619 - stable/8/sbin/mount_nfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 06:19:44 -0000 Author: jh Date: Mon Nov 1 06:19:44 2010 New Revision: 214619 URL: http://svn.freebsd.org/changeset/base/214619 Log: MFC r214419: Correct a typo. PR: 151321 Modified: stable/8/sbin/mount_nfs/mount_nfs.c Directory Properties: stable/8/sbin/mount_nfs/ (props changed) Modified: stable/8/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.c Mon Nov 1 06:17:02 2010 (r214618) +++ stable/8/sbin/mount_nfs/mount_nfs.c Mon Nov 1 06:19:44 2010 (r214619) @@ -177,7 +177,7 @@ main(int argc, char *argv[]) mountmode = V3; break; case 'a': - printf("-a deprecated, use -o readhead=\n"); + printf("-a deprecated, use -o readahead=\n"); build_iovec(&iov, &iovlen, "readahead", optarg, (size_t)-1); break; case 'b': From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 08:12:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C628E106567A; Mon, 1 Nov 2010 08:12:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B44148FC12; Mon, 1 Nov 2010 08:12:28 +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 oA18CSqu049958; Mon, 1 Nov 2010 08:12:28 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA18CS3J049956; Mon, 1 Nov 2010 08:12:28 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011010812.oA18CS3J049956@svn.freebsd.org> From: Andriy Gapon Date: Mon, 1 Nov 2010 08:12:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214620 - stable/8/sys/amd64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 08:12:28 -0000 Author: avg Date: Mon Nov 1 08:12:28 2010 New Revision: 214620 URL: http://svn.freebsd.org/changeset/base/214620 Log: MFC r212784: amd64: reduce VM_KMEM_SIZE_SCALE to 1 allowing kernel to use more memory Modified: stable/8/sys/amd64/include/vmparam.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/include/vmparam.h ============================================================================== --- stable/8/sys/amd64/include/vmparam.h Mon Nov 1 06:19:44 2010 (r214619) +++ stable/8/sys/amd64/include/vmparam.h Mon Nov 1 08:12:28 2010 (r214620) @@ -194,7 +194,7 @@ * is the total KVA space allocated for kmem_map. */ #ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (3) +#define VM_KMEM_SIZE_SCALE (1) #endif /* From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 08:20:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9387106566B; Mon, 1 Nov 2010 08:20:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D67A98FC0A; Mon, 1 Nov 2010 08:20: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 oA18KEo9050502; Mon, 1 Nov 2010 08:20:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA18KEas050499; Mon, 1 Nov 2010 08:20:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011010820.oA18KEas050499@svn.freebsd.org> From: Andriy Gapon Date: Mon, 1 Nov 2010 08:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214621 - in stable/8/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 08:20:15 -0000 Author: avg Date: Mon Nov 1 08:20:14 2010 New Revision: 214621 URL: http://svn.freebsd.org/changeset/base/214621 Log: MFC r213323: i386 and amd64 mp_machdep: improve topology detection for Intel CPUs Modified: stable/8/sys/amd64/amd64/mp_machdep.c stable/8/sys/i386/i386/mp_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/mp_machdep.c Mon Nov 1 08:12:28 2010 (r214620) +++ stable/8/sys/amd64/amd64/mp_machdep.c Mon Nov 1 08:20:14 2010 (r214621) @@ -118,7 +118,6 @@ extern inthand_t IDTVEC(fast_syscall), I * Local data and functions. */ -static u_int logical_cpus; static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ @@ -144,8 +143,8 @@ int apic_cpuids[MAX_APIC_ID + 1]; static volatile u_int cpu_ipi_pending[MAXCPU]; static u_int boot_address; -static int cpu_logical; -static int cpu_cores; +static int cpu_logical; /* logical cpus per core */ +static int cpu_cores; /* cores per package */ static void assign_cpu_ids(void); static void set_interrupt_apic_ids(void); @@ -154,7 +153,7 @@ static int start_ap(int apic_id); static void release_aps(void *dummy); static int hlt_logical_cpus; -static u_int hyperthreading_cpus; +static u_int hyperthreading_cpus; /* logical cpus sharing L1 cache */ static cpumask_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; static struct sysctl_ctx_list logical_cpu_clist; @@ -168,24 +167,105 @@ mem_range_AP_init(void) } static void +topo_probe_amd(void) +{ + + /* AMD processors do not support HTT. */ + cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ? + (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1; + cpu_logical = 1; +} + +/* + * Round up to the next power of two, if necessary, and then + * take log2. + * Returns -1 if argument is zero. + */ +static __inline int +mask_width(u_int x) +{ + + return (fls(x << (1 - powerof2(x))) - 1); +} + +static void +topo_probe_0x4(void) +{ + u_int p[4]; + int pkg_id_bits; + int core_id_bits; + int max_cores; + int max_logical; + int id; + + /* Both zero and one here mean one logical processor per package. */ + max_logical = (cpu_feature & CPUID_HTT) != 0 ? + (cpu_procinfo & CPUID_HTT_CORES) >> 16 : 1; + if (max_logical <= 1) + return; + + /* + * Because of uniformity assumption we examine only + * those logical processors that belong to the same + * package as BSP. Further, we count number of + * logical processors that belong to the same core + * as BSP thus deducing number of threads per core. + */ + cpuid_count(0x04, 0, p); + max_cores = ((p[0] >> 26) & 0x3f) + 1; + core_id_bits = mask_width(max_logical/max_cores); + if (core_id_bits < 0) + return; + pkg_id_bits = core_id_bits + mask_width(max_cores); + + for (id = 0; id <= MAX_APIC_ID; id++) { + /* Check logical CPU availability. */ + if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled) + continue; + /* Check if logical CPU has the same package ID. */ + if ((id >> pkg_id_bits) != (boot_cpu_id >> pkg_id_bits)) + continue; + cpu_cores++; + /* Check if logical CPU has the same package and core IDs. */ + if ((id >> core_id_bits) == (boot_cpu_id >> core_id_bits)) + cpu_logical++; + } + + cpu_cores /= cpu_logical; + hyperthreading_cpus = cpu_logical; +} + +static void topo_probe_0xb(void) { - int logical; - int p[4]; + u_int p[4]; int bits; - int type; int cnt; int i; + int logical; + int type; int x; - /* We only support two levels for now. */ + /* We only support three levels for now. */ for (i = 0; i < 3; i++) { - cpuid_count(0x0B, i, p); + cpuid_count(0x0b, i, p); + + /* Fall back if CPU leaf 11 doesn't really exist. */ + if (i == 0 && p[1] == 0) { + topo_probe_0x4(); + return; + } + bits = p[0] & 0x1f; logical = p[1] &= 0xffff; type = (p[2] >> 8) & 0xff; if (type == 0 || logical == 0) break; + /* + * Because of uniformity assumption we examine only + * those logical processors that belong to the same + * package as BSP. + */ for (cnt = 0, x = 0; x <= MAX_APIC_ID; x++) { if (!cpu_info[x].cpu_present || cpu_info[x].cpu_disabled) @@ -203,76 +283,16 @@ topo_probe_0xb(void) cpu_cores /= cpu_logical; } -static void -topo_probe_0x4(void) -{ - u_int threads_per_cache, p[4]; - u_int htt, cmp; - int i; - - htt = cmp = 1; - /* - * If this CPU supports HTT or CMP then mention the - * number of physical/logical cores it contains. - */ - if (cpu_feature & CPUID_HTT) - htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16; - if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP)) - cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; - else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) { - cpuid_count(4, 0, p); - if ((p[0] & 0x1f) != 0) - cmp = ((p[0] >> 26) & 0x3f) + 1; - } - cpu_cores = cmp; - cpu_logical = htt / cmp; - - /* Setup the initial logical CPUs info. */ - if (cpu_feature & CPUID_HTT) - logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16; - - /* - * Work out if hyperthreading is *really* enabled. This - * is made really ugly by the fact that processors lie: Dual - * core processors claim to be hyperthreaded even when they're - * not, presumably because they want to be treated the same - * way as HTT with respect to per-cpu software licensing. - * At the time of writing (May 12, 2005) the only hyperthreaded - * cpus are from Intel, and Intel's dual-core processors can be - * identified via the "deterministic cache parameters" cpuid - * calls. - */ - /* - * First determine if this is an Intel processor which claims - * to have hyperthreading support. - */ - if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) { - /* - * If the "deterministic cache parameters" cpuid calls - * are available, use them. - */ - if (cpu_high >= 4) { - /* Ask the processor about the L1 cache. */ - for (i = 0; i < 1; i++) { - cpuid_count(4, i, p); - threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1; - if (hyperthreading_cpus < threads_per_cache) - hyperthreading_cpus = threads_per_cache; - if ((p[0] & 0x1f) == 0) - break; - } - } - - /* - * If the deterministic cache parameters are not - * available, or if no caches were reported to exist, - * just accept what the HTT flag indicated. - */ - if (hyperthreading_cpus == 0) - hyperthreading_cpus = logical_cpus; - } -} - +/* + * Both topology discovery code and code that consumes topology + * information assume top-down uniformity of the topology. + * That is, all physical packages must be identical and each + * core in a package must have the same number of threads. + * Topology information is queried only on BSP, on which this + * code runs and for which it can query CPUID information. + * Then topology is extrapolated on all packages using the + * uniformity assumption. + */ static void topo_probe(void) { @@ -281,13 +301,31 @@ topo_probe(void) if (cpu_topo_probed) return; - logical_cpus = logical_cpus_mask = 0; - if (cpu_high >= 0xb) - topo_probe_0xb(); - else if (cpu_high) - topo_probe_0x4(); + logical_cpus_mask = 0; + if (cpu_vendor_id == CPU_VENDOR_AMD) + topo_probe_amd(); + else if (cpu_vendor_id == CPU_VENDOR_INTEL) { + /* + * See Intel(R) 64 Architecture Processor + * Topology Enumeration article for details. + * + * Note that 0x1 <= cpu_high < 4 case should be + * compatible with topo_probe_0x4() logic when + * CPUID.1:EBX[23:16] > 0 (cpu_cores will be 1) + * or it should trigger the fallback otherwise. + */ + if (cpu_high >= 0xb) + topo_probe_0xb(); + else if (cpu_high >= 0x1) + topo_probe_0x4(); + } + + /* + * Fallback: assume each logical CPU is in separate + * physical package. That is, no multi-core, no SMT. + */ if (cpu_cores == 0) - cpu_cores = mp_ncpus > 0 ? mp_ncpus : 1; + cpu_cores = 1; if (cpu_logical == 0) cpu_logical = 1; cpu_topo_probed = 1; @@ -667,7 +705,8 @@ init_secondary(void) printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid)); /* Determine if we are a logical CPU. */ - if (logical_cpus > 1 && PCPU_GET(apic_id) % logical_cpus != 0) + /* XXX Calculation depends on cpu_logical being a power of 2, e.g. 2 */ + if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0) logical_cpus_mask |= PCPU_GET(cpumask); /* Determine if we are a hyperthread. */ Modified: stable/8/sys/i386/i386/mp_machdep.c ============================================================================== --- stable/8/sys/i386/i386/mp_machdep.c Mon Nov 1 08:12:28 2010 (r214620) +++ stable/8/sys/i386/i386/mp_machdep.c Mon Nov 1 08:20:14 2010 (r214621) @@ -172,7 +172,6 @@ u_long *ipi_lazypmap_counts[MAXCPU]; * Local data and functions. */ -static u_int logical_cpus; static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ @@ -198,8 +197,8 @@ int apic_cpuids[MAX_APIC_ID + 1]; static volatile u_int cpu_ipi_pending[MAXCPU]; static u_int boot_address; -static int cpu_logical; -static int cpu_cores; +static int cpu_logical; /* logical cpus per core */ +static int cpu_cores; /* cores per package */ static void assign_cpu_ids(void); static void install_ap_tramp(void); @@ -209,7 +208,7 @@ static int start_ap(int apic_id); static void release_aps(void *dummy); static int hlt_logical_cpus; -static u_int hyperthreading_cpus; +static u_int hyperthreading_cpus; /* logical cpus sharing L1 cache */ static cpumask_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; static struct sysctl_ctx_list logical_cpu_clist; @@ -222,24 +221,105 @@ mem_range_AP_init(void) } static void +topo_probe_amd(void) +{ + + /* AMD processors do not support HTT. */ + cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ? + (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1; + cpu_logical = 1; +} + +/* + * Round up to the next power of two, if necessary, and then + * take log2. + * Returns -1 if argument is zero. + */ +static __inline int +mask_width(u_int x) +{ + + return (fls(x << (1 - powerof2(x))) - 1); +} + +static void +topo_probe_0x4(void) +{ + u_int p[4]; + int pkg_id_bits; + int core_id_bits; + int max_cores; + int max_logical; + int id; + + /* Both zero and one here mean one logical processor per package. */ + max_logical = (cpu_feature & CPUID_HTT) != 0 ? + (cpu_procinfo & CPUID_HTT_CORES) >> 16 : 1; + if (max_logical <= 1) + return; + + /* + * Because of uniformity assumption we examine only + * those logical processors that belong to the same + * package as BSP. Further, we count number of + * logical processors that belong to the same core + * as BSP thus deducing number of threads per core. + */ + cpuid_count(0x04, 0, p); + max_cores = ((p[0] >> 26) & 0x3f) + 1; + core_id_bits = mask_width(max_logical/max_cores); + if (core_id_bits < 0) + return; + pkg_id_bits = core_id_bits + mask_width(max_cores); + + for (id = 0; id <= MAX_APIC_ID; id++) { + /* Check logical CPU availability. */ + if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled) + continue; + /* Check if logical CPU has the same package ID. */ + if ((id >> pkg_id_bits) != (boot_cpu_id >> pkg_id_bits)) + continue; + cpu_cores++; + /* Check if logical CPU has the same package and core IDs. */ + if ((id >> core_id_bits) == (boot_cpu_id >> core_id_bits)) + cpu_logical++; + } + + cpu_cores /= cpu_logical; + hyperthreading_cpus = cpu_logical; +} + +static void topo_probe_0xb(void) { - int logical; - int p[4]; + u_int p[4]; int bits; - int type; int cnt; int i; + int logical; + int type; int x; - /* We only support two levels for now. */ + /* We only support three levels for now. */ for (i = 0; i < 3; i++) { - cpuid_count(0x0B, i, p); + cpuid_count(0x0b, i, p); + + /* Fall back if CPU leaf 11 doesn't really exist. */ + if (i == 0 && p[1] == 0) { + topo_probe_0x4(); + return; + } + bits = p[0] & 0x1f; logical = p[1] &= 0xffff; type = (p[2] >> 8) & 0xff; if (type == 0 || logical == 0) break; + /* + * Because of uniformity assumption we examine only + * those logical processors that belong to the same + * package as BSP. + */ for (cnt = 0, x = 0; x <= MAX_APIC_ID; x++) { if (!cpu_info[x].cpu_present || cpu_info[x].cpu_disabled) @@ -257,76 +337,16 @@ topo_probe_0xb(void) cpu_cores /= cpu_logical; } -static void -topo_probe_0x4(void) -{ - u_int threads_per_cache, p[4]; - u_int htt, cmp; - int i; - - htt = cmp = 1; - /* - * If this CPU supports HTT or CMP then mention the - * number of physical/logical cores it contains. - */ - if (cpu_feature & CPUID_HTT) - htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16; - if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP)) - cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; - else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) { - cpuid_count(4, 0, p); - if ((p[0] & 0x1f) != 0) - cmp = ((p[0] >> 26) & 0x3f) + 1; - } - cpu_cores = cmp; - cpu_logical = htt / cmp; - - /* Setup the initial logical CPUs info. */ - if (cpu_feature & CPUID_HTT) - logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16; - - /* - * Work out if hyperthreading is *really* enabled. This - * is made really ugly by the fact that processors lie: Dual - * core processors claim to be hyperthreaded even when they're - * not, presumably because they want to be treated the same - * way as HTT with respect to per-cpu software licensing. - * At the time of writing (May 12, 2005) the only hyperthreaded - * cpus are from Intel, and Intel's dual-core processors can be - * identified via the "deterministic cache parameters" cpuid - * calls. - */ - /* - * First determine if this is an Intel processor which claims - * to have hyperthreading support. - */ - if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) { - /* - * If the "deterministic cache parameters" cpuid calls - * are available, use them. - */ - if (cpu_high >= 4) { - /* Ask the processor about the L1 cache. */ - for (i = 0; i < 1; i++) { - cpuid_count(4, i, p); - threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1; - if (hyperthreading_cpus < threads_per_cache) - hyperthreading_cpus = threads_per_cache; - if ((p[0] & 0x1f) == 0) - break; - } - } - - /* - * If the deterministic cache parameters are not - * available, or if no caches were reported to exist, - * just accept what the HTT flag indicated. - */ - if (hyperthreading_cpus == 0) - hyperthreading_cpus = logical_cpus; - } -} - +/* + * Both topology discovery code and code that consumes topology + * information assume top-down uniformity of the topology. + * That is, all physical packages must be identical and each + * core in a package must have the same number of threads. + * Topology information is queried only on BSP, on which this + * code runs and for which it can query CPUID information. + * Then topology is extrapolated on all packages using the + * uniformity assumption. + */ static void topo_probe(void) { @@ -335,13 +355,31 @@ topo_probe(void) if (cpu_topo_probed) return; - logical_cpus = logical_cpus_mask = 0; - if (cpu_high >= 0xb) - topo_probe_0xb(); - else if (cpu_high) - topo_probe_0x4(); + logical_cpus_mask = 0; + if (cpu_vendor_id == CPU_VENDOR_AMD) + topo_probe_amd(); + else if (cpu_vendor_id == CPU_VENDOR_INTEL) { + /* + * See Intel(R) 64 Architecture Processor + * Topology Enumeration article for details. + * + * Note that 0x1 <= cpu_high < 4 case should be + * compatible with topo_probe_0x4() logic when + * CPUID.1:EBX[23:16] > 0 (cpu_cores will be 1) + * or it should trigger the fallback otherwise. + */ + if (cpu_high >= 0xb) + topo_probe_0xb(); + else if (cpu_high >= 0x1) + topo_probe_0x4(); + } + + /* + * Fallback: assume each logical CPU is in separate + * physical package. That is, no multi-core, no SMT. + */ if (cpu_cores == 0) - cpu_cores = mp_ncpus > 0 ? mp_ncpus : 1; + cpu_cores = 1; if (cpu_logical == 0) cpu_logical = 1; cpu_topo_probed = 1; @@ -705,7 +743,8 @@ init_secondary(void) printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid)); /* Determine if we are a logical CPU. */ - if (logical_cpus > 1 && PCPU_GET(apic_id) % logical_cpus != 0) + /* XXX Calculation depends on cpu_logical being a power of 2, e.g. 2 */ + if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0) logical_cpus_mask |= PCPU_GET(cpumask); /* Determine if we are a hyperthread. */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 10:41:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE19D106567A; Mon, 1 Nov 2010 10:41:05 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC2568FC17; Mon, 1 Nov 2010 10:41: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 oA1Af56R058078; Mon, 1 Nov 2010 10:41:05 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1Af58A058076; Mon, 1 Nov 2010 10:41:05 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201011011041.oA1Af58A058076@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 1 Nov 2010 10:41: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: r214622 - head/cddl/contrib/opensolaris/lib/libzpool/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 10:41:05 -0000 Author: pjd Date: Mon Nov 1 10:41:05 2010 New Revision: 214622 URL: http://svn.freebsd.org/changeset/base/214622 Log: 1. Remove invalid assertion. 2. Properly recalculate delta in case pthread_cond_timedwait() is interrupted. 3. Style fix. Reported by: [1] App Deb Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Mon Nov 1 08:20:14 2010 (r214621) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Mon Nov 1 10:41:05 2010 (r214622) @@ -308,9 +308,9 @@ cv_timedwait(kcondvar_t *cv, kmutex_t *m struct timeval tv; clock_t delta; - ASSERT(abstime > 0); + abstime += lbolt; top: - delta = abstime; + delta = abstime - lbolt; if (delta <= 0) return (-1); @@ -321,7 +321,7 @@ top: ts.tv_nsec = tv.tv_usec * 1000 + (delta % hz) * (NANOSEC / hz); ASSERT(ts.tv_nsec >= 0); - if(ts.tv_nsec >= NANOSEC) { + if (ts.tv_nsec >= NANOSEC) { ts.tv_sec++; ts.tv_nsec -= NANOSEC; } From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 10:42:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE2421065674; Mon, 1 Nov 2010 10:42:14 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC5AE8FC1D; Mon, 1 Nov 2010 10:42: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 oA1AgE0H058140; Mon, 1 Nov 2010 10:42:14 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1AgEot058138; Mon, 1 Nov 2010 10:42:14 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201011011042.oA1AgEot058138@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 1 Nov 2010 10:42: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: r214623 - head/cddl/contrib/opensolaris/cmd/ztest X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 10:42:14 -0000 Author: pjd Date: Mon Nov 1 10:42:14 2010 New Revision: 214623 URL: http://svn.freebsd.org/changeset/base/214623 Log: Fix ztest when it is executed by just 'ztest' and not by full path '/usr/bin/ztest'. Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Nov 1 10:41:05 2010 (r214622) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Nov 1 10:42:14 2010 (r214623) @@ -3362,8 +3362,7 @@ ztest_verify_blocks(char *pool) int isalen; FILE *fp; - if (realpath(progname, zdb) == NULL) - assert(!"realpath() failed"); + strlcpy(zdb, "/usr/bin/ztest", sizeof(zdb)); /* zdb lives in /usr/sbin, while ztest lives in /usr/bin */ bin = strstr(zdb, "/usr/bin/"); From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 11:38:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 783ED1065670; Mon, 1 Nov 2010 11:38:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65B598FC0C; Mon, 1 Nov 2010 11:38: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 oA1Bc4XU061103; Mon, 1 Nov 2010 11:38:04 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1Bc4rR061101; Mon, 1 Nov 2010 11:38:04 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201011011138.oA1Bc4rR061101@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 1 Nov 2010 11:38:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214624 - stable/8/lib/libc/posix1e X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 11:38:04 -0000 Author: trasz Date: Mon Nov 1 11:38:04 2010 New Revision: 214624 URL: http://svn.freebsd.org/changeset/base/214624 Log: MFC r212376: Add minor optimization. It's less strict than its kernel counterpart due to upcoming ACL changes required by the new ZFS. MFC r212379: Fix previous commit. Modified: stable/8/lib/libc/posix1e/acl_strip.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/posix1e/acl_strip.c ============================================================================== --- stable/8/lib/libc/posix1e/acl_strip.c Mon Nov 1 10:42:14 2010 (r214623) +++ stable/8/lib/libc/posix1e/acl_strip.c Mon Nov 1 11:38:04 2010 (r214624) @@ -176,6 +176,15 @@ acl_is_trivial_np(const acl_t aclp, int case ACL_BRAND_NFS4: /* + * If the ACL has more than canonical six entries, + * it's non trivial by definition. + */ + if (aclp->ats_acl.acl_cnt > 6) { + *trivialp = 0; + return (0); + } + + /* * Calculate trivial ACL - using acl_strip_np - and compare * with the original. */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 14:22:47 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEDAF106566B; Mon, 1 Nov 2010 14:22:47 +0000 (UTC) (envelope-from kensmith@buffalo.edu) Received: from localmailA.acsu.buffalo.edu (localmail.buffalo.edu [128.205.5.196]) by mx1.freebsd.org (Postfix) with ESMTP id B7E178FC17; Mon, 1 Nov 2010 14:22:47 +0000 (UTC) Received: from localmailA.acsu.buffalo.edu (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 6E5C1B51C; Mon, 1 Nov 2010 10:16:05 -0400 (EDT) Received: from localmailA.acsu.buffalo.edu (localhost [127.0.0.1]) by localmailA.acsu.buffalo.edu (Postfix) with ESMTP id 138D4B56E; Mon, 1 Nov 2010 10:16:03 -0400 (EDT) Received: from mweb1.acsu.buffalo.edu (mweb1.acsu.buffalo.edu [128.205.5.238]) by localmailA.acsu.buffalo.edu (Prefixe) with ESMTP id F3829B54C; Mon, 1 Nov 2010 10:16:02 -0400 (EDT) Received: from [128.205.32.76] (bauer.cse.buffalo.edu [128.205.32.76]) by mweb1.acsu.buffalo.edu (Postfix) with ESMTP id 359D25B0043; Mon, 1 Nov 2010 10:15:52 -0400 (EDT) From: Ken Smith To: Ulrich Spoerlein In-Reply-To: <20101031191119.GM46314@acme.spoerlein.net> References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> <20101031191119.GM46314@acme.spoerlein.net> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-bS9egv1BU3VSzXx7UbUT" Date: Mon, 01 Nov 2010 10:15:51 -0400 Message-ID: <1288620951.3596.32.camel@bauer.cse.buffalo.edu> Mime-Version: 1.0 X-Mailer: Evolution 2.28.2 FreeBSD GNOME Team Port X-PM-EL-Spam-Prob: : 8% Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 14:22:48 -0000 --=-bS9egv1BU3VSzXx7UbUT Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Sun, 2010-10-31 at 20:11 +0100, Ulrich Spoerlein wrote: > On Sun, 31.10.2010 at 17:06:03 +0100, Pawel Jakub Dawidek wrote: > > On Sun, Oct 31, 2010 at 09:21:28AM +0000, Ulrich Spoerlein wrote: > > > Author: uqs > > > Date: Sun Oct 31 09:21:27 2010 > > > New Revision: 214596 > > > URL: http://svn.freebsd.org/changeset/base/214596 > > >=20 > > > Log: > > > Elaborate some more on the non-security implications of using -P > > [...] > > > +.Pp > > > +N.B.: The > > > +.Fl P > > > +flag is not considered a security feature > > > +.Pq see Sx BUGS . > >=20 > > I'm sorry for jumping so late into the subject, but if it is not a > > security feature than what other purpose has left? > >=20 > > Really guys, this option is useless. > >=20 > > There is no reliable way to verify if the blocks are really overwritten= . > > Period. > >=20 > > If it is not used for security, then I see no other use for it (except > > for [1]). > >=20 > > If it is used for security then we better have a way to give the user > > the right answer to the question "is my data really gone?" and don't > > make false assumptions or giving answers "we hope so". > >=20 > > Why there is no reliable way to verify this? > > 1. Check file system type (UFS, ZFS). > > 2. Check file system configuration (UFS with snapshots?). > > 3. Be sure sync(2) the file system and send BIO_FLUSH to all the media > > involved (some cheap flash disks lie about BIO_FLUSH support). > > 4. Check underlying media (GLABEL provider - no modification to the dat= a). > > 5. Check underlying media (ZVOL - data won't be overwritten, but...). > > 6. Check ZFS vdevs (on which providers ZVOL's pool is based on). > > 7. Check vdevs (GELI - cool, we have encryption). > > 8. Check GELI configuration (maybe NULL encryption algorithm?). > > 9. Check underlying media (HDD, SSD, swap-backed md(4) device? goto 3). > > 10. Check if the sectors weren't remapped while we were overwriting. > >=20 > > In other words this is soooo complicated that it would simply be too > > hard to explain to regular user or implement in rm(1). > >=20 > > IMHO this option should be removed and rm(1) should fail when a user is > > trying to use it. >=20 > No, this is a POLA violation for no apparent gain. The flag has been in > FreeBSD since at least '94. Remember, that we are in the rope-selling > business. We empower the users to shoot themselves in the foot. Just playing Devils' Advocate... If the removal of -P were done as part of a new branch the POLA argument is moot if it's judged you are a bit off on the "no apparent gain" aspect. And the rope selling argument also only applies so far. One could argue having our installer by default leave a machine set up so SSH was enabled, remote root logins were allowed, and no initial password set up for root is fine because we're in the rope-selling business and for some portion of the user base that's just fine. I know that's extreme but that's the point, I'm saying it's hard to figure out exactly where the line is between activities that are ill-advised versus those that are just plain stupid sometimes. So, please, given all the attention being given to the security aspects of users properly erasing data they should erase I'd prefer we focus on whether providing -P at all is flat out lying and base the decision about whether it should go based on that. Lots of things we thought were OK back in 1994 we've changed our minds about since then. > I, for one, am using the -P option in a certain case where I can be sure > that ~99% of the data will be obliterated and I'm fine with that. For > all other cases I'm using geli or gbde (where I can make sure, that data > is lost). This strongly backs up Pawel's argument that the existence of -P is a lie. > So we can either fix -P for all cases (impossible), or at least document > its shortcomings. Documenting them clearly is better than what we had a > couple of days before. As I said above, with re@ hat on since the claim of POLA above is slightly based on branch/release guidelines, I think removal of -P is also still an option if it's decided -P is a lie. --=20 Ken Smith - From there to here, from here to | kensmith@buffalo.edu there, funny things are everywhere. | - Theodor Geisel | --=-bS9egv1BU3VSzXx7UbUT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEABECAAYFAkzOy44ACgkQ/G14VSmup/Z+oQCgjSGR8CI1gDTxsudzEsszAICr 9/AAoJU+/HB2kCgXNKtfOavMg8C6sO7A =tOcT -----END PGP SIGNATURE----- --=-bS9egv1BU3VSzXx7UbUT-- From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 15:18:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 469321065673; Mon, 1 Nov 2010 15:18:58 +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 34EB48FC2A; Mon, 1 Nov 2010 15:18: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 oA1FIweL068525; Mon, 1 Nov 2010 15:18:58 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1FIw4r068523; Mon, 1 Nov 2010 15:18:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011011518.oA1FIw4r068523@svn.freebsd.org> From: John Baldwin Date: Mon, 1 Nov 2010 15:18: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: r214625 - head/usr.bin/kdump X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 15:18:58 -0000 Author: jhb Date: Mon Nov 1 15:18:57 2010 New Revision: 214625 URL: http://svn.freebsd.org/changeset/base/214625 Log: Correct the abbreviations for general I/O and signal traces. PR: docs/151854 Submitted by: Stephen Veiss stephen of brokenbottle net MFC after: 3 days Modified: head/usr.bin/kdump/kdump.1 Modified: head/usr.bin/kdump/kdump.1 ============================================================================== --- head/usr.bin/kdump/kdump.1 Mon Nov 1 11:38:04 2010 (r214624) +++ head/usr.bin/kdump/kdump.1 Mon Nov 1 15:18:57 2010 (r214625) @@ -162,13 +162,13 @@ Seven bytes were written by the system call, so 7 is the return value. .Pp The possible operations are: -.Bl -column -offset indent ".Li GENIO" ".No data from user process" +.Bl -column -offset indent ".Li CALL" ".No data from user process" .It Sy Name Ta Sy Operation Ta Sy Fourth field .It Li CALL Ta enter syscall Ta syscall name and arguments .It Li RET Ta return from syscall Ta syscall name and return value .It Li NAMI Ta file name lookup Ta path to file -.It Li GENIO Ta general I/O Ta fd, read/write, number of bytes -.It Li SIG Ta signal Ta signal name, handler, mask, code +.It Li GIO Ta general I/O Ta fd, read/write, number of bytes +.It Li PSIG Ta signal Ta signal name, handler, mask, code .It Li CSW Ta context switch Ta stop/resume user/kernel .It Li USER Ta data from user process Ta the data .It Li STRU Ta various syscalls Ta structure From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 15:36:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50718106566C; Mon, 1 Nov 2010 15:36:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C8468FC14; Mon, 1 Nov 2010 15:36: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 oA1Famwk069805; Mon, 1 Nov 2010 15:36:48 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1FamsX069801; Mon, 1 Nov 2010 15:36:48 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201011011536.oA1FamsX069801@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 1 Nov 2010 15:36:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214626 - in stable/8: lib/libc/posix1e sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 15:36:48 -0000 Author: trasz Date: Mon Nov 1 15:36:47 2010 New Revision: 214626 URL: http://svn.freebsd.org/changeset/base/214626 Log: MFC r212906: First step at adopting FreeBSD to support PSARC/2010/029. This makes acl_is_trivial_np(3) properly recognize the new trivial ACLs. From the user point of view, that means "ls -l" no longer shows plus signs for all the files when running ZFS v28. Modified: stable/8/lib/libc/posix1e/acl_strip.c stable/8/sys/kern/subr_acl_nfs4.c stable/8/sys/sys/acl.h Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/lib/libc/posix1e/acl_strip.c ============================================================================== --- stable/8/lib/libc/posix1e/acl_strip.c Mon Nov 1 15:18:57 2010 (r214625) +++ stable/8/lib/libc/posix1e/acl_strip.c Mon Nov 1 15:36:47 2010 (r214626) @@ -31,19 +31,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "acl_support.h" /* - * These two routines from sys/kern/subr_acl_nfs4.c are used by both kernel + * These three routines from sys/kern/subr_acl_nfs4.c are used by both kernel * and libc. */ +void acl_nfs4_trivial_from_mode(struct acl *aclp, mode_t mode); void acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode, int file_owner_id); void acl_nfs4_sync_mode_from_acl(mode_t *_mode, const struct acl *aclp); static acl_t -_nfs4_acl_strip_np(const acl_t aclp, int recalculate_mask) +_nfs4_acl_strip_np(const acl_t aclp, int canonical_six) { acl_t newacl; mode_t mode = 0; @@ -57,7 +59,10 @@ _nfs4_acl_strip_np(const acl_t aclp, int _acl_brand_as(newacl, ACL_BRAND_NFS4); acl_nfs4_sync_mode_from_acl(&mode, &(aclp->ats_acl)); - acl_nfs4_sync_acl_from_mode(&(newacl->ats_acl), mode, -1); + if (canonical_six) + acl_nfs4_sync_acl_from_mode(&(newacl->ats_acl), mode, -1); + else + acl_nfs4_trivial_from_mode(&(newacl->ats_acl), mode); return (newacl); } @@ -136,7 +141,7 @@ acl_strip_np(const acl_t aclp, int recal { switch (_acl_brand(aclp)) { case ACL_BRAND_NFS4: - return (_nfs4_acl_strip_np(aclp, recalculate_mask)); + return (_nfs4_acl_strip_np(aclp, 1)); case ACL_BRAND_POSIX: return (_posix1e_acl_strip_np(aclp, recalculate_mask)); @@ -185,10 +190,25 @@ acl_is_trivial_np(const acl_t aclp, int } /* - * Calculate trivial ACL - using acl_strip_np - and compare + * Calculate trivial ACL - using acl_strip_np(3) - and compare * with the original. */ - tmpacl = acl_strip_np(aclp, 0); + tmpacl = _nfs4_acl_strip_np(aclp, 0); + if (tmpacl == NULL) + return (-1); + + differs = _acl_differs(aclp, tmpacl); + acl_free(tmpacl); + + if (differs == 0) { + *trivialp = 1; + return (0); + } + + /* + * Try again with an old-style, "canonical six" trivial ACL. + */ + tmpacl = _nfs4_acl_strip_np(aclp, 1); if (tmpacl == NULL) return (-1); Modified: stable/8/sys/kern/subr_acl_nfs4.c ============================================================================== --- stable/8/sys/kern/subr_acl_nfs4.c Mon Nov 1 15:18:57 2010 (r214625) +++ stable/8/sys/kern/subr_acl_nfs4.c Mon Nov 1 15:36:47 2010 (r214626) @@ -323,6 +323,83 @@ _acl_duplicate_entry(struct acl *aclp, i return (&(aclp->acl_entry[entry_index + 1])); } +/* + * Calculate trivial ACL in a manner compatible with PSARC/2010/029. + * Note that this results in an ACL different from (but semantically + * equal to) the "canonical six" trivial ACL computed using algorithm + * described in draft-ietf-nfsv4-minorversion1-03.txt, 3.16.6.2. + */ +void +acl_nfs4_trivial_from_mode(struct acl *aclp, mode_t mode) +{ + acl_perm_t user_allow_first = 0, user_deny = 0, group_deny = 0; + acl_perm_t user_allow, group_allow, everyone_allow; + + KASSERT(aclp->acl_cnt == 0, ("aclp->acl_cnt == 0")); + + user_allow = group_allow = everyone_allow = ACL_READ_ACL | + ACL_READ_ATTRIBUTES | ACL_READ_NAMED_ATTRS | ACL_SYNCHRONIZE; + user_allow |= ACL_WRITE_ACL | ACL_WRITE_OWNER | ACL_WRITE_ATTRIBUTES | + ACL_WRITE_NAMED_ATTRS; + + if (mode & S_IRUSR) + user_allow |= ACL_READ_DATA; + if (mode & S_IWUSR) + user_allow |= (ACL_WRITE_DATA | ACL_APPEND_DATA); + if (mode & S_IXUSR) + user_allow |= ACL_EXECUTE; + + if (mode & S_IRGRP) + group_allow |= ACL_READ_DATA; + if (mode & S_IWGRP) + group_allow |= (ACL_WRITE_DATA | ACL_APPEND_DATA); + if (mode & S_IXGRP) + group_allow |= ACL_EXECUTE; + + if (mode & S_IROTH) + everyone_allow |= ACL_READ_DATA; + if (mode & S_IWOTH) + everyone_allow |= (ACL_WRITE_DATA | ACL_APPEND_DATA); + if (mode & S_IXOTH) + everyone_allow |= ACL_EXECUTE; + + user_deny = ((group_allow | everyone_allow) & ~user_allow); + group_deny = everyone_allow & ~group_allow; + user_allow_first = group_deny & ~user_deny; + +#if 1 + /* + * This is a workaround for what looks like a bug in ZFS - trivial + * ACL for mode 0077 should look like this: + * + * owner@:rwxp----------:------:deny + * owner@:------aARWcCos:------:allow + * group@:rwxp--a-R-c--s:------:allow + * everyone@:rwxp--a-R-c--s:------:allow + * + * Instead, ZFS makes it like this: + * + * owner@:rwx-----------:------:deny + * owner@:------aARWcCos:------:allow + * group@:rwxp--a-R-c--s:------:allow + * everyone@:rwxp--a-R-c--s:------:allow + */ + user_allow_first &= ~ACL_APPEND_DATA; + user_deny &= ~ACL_APPEND_DATA; + group_deny &= ~ACL_APPEND_DATA; +#endif + + if (user_allow_first != 0) + _acl_append(aclp, ACL_USER_OBJ, user_allow_first, ACL_ENTRY_TYPE_ALLOW); + if (user_deny != 0) + _acl_append(aclp, ACL_USER_OBJ, user_deny, ACL_ENTRY_TYPE_DENY); + if (group_deny != 0) + _acl_append(aclp, ACL_GROUP_OBJ, group_deny, ACL_ENTRY_TYPE_DENY); + _acl_append(aclp, ACL_USER_OBJ, user_allow, ACL_ENTRY_TYPE_ALLOW); + _acl_append(aclp, ACL_GROUP_OBJ, group_allow, ACL_ENTRY_TYPE_ALLOW); + _acl_append(aclp, ACL_EVERYONE, everyone_allow, ACL_ENTRY_TYPE_ALLOW); +} + void acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode, int file_owner_id) { Modified: stable/8/sys/sys/acl.h ============================================================================== --- stable/8/sys/sys/acl.h Mon Nov 1 15:18:57 2010 (r214625) +++ stable/8/sys/sys/acl.h Mon Nov 1 15:36:47 2010 (r214626) @@ -285,6 +285,8 @@ mode_t acl_posix1e_newfilemode(mode_t struct acl *acl_alloc(int flags); void acl_free(struct acl *aclp); +void acl_nfs4_trivial_from_mode(struct acl *aclp, + mode_t mode); void acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode, int file_owner_id); void acl_nfs4_sync_mode_from_acl(mode_t *mode, From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 15:43:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28C22106566B; Mon, 1 Nov 2010 15:43:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 162478FC23; Mon, 1 Nov 2010 15:43: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 oA1Fhg4R070236; Mon, 1 Nov 2010 15:43:42 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1FhgHV070234; Mon, 1 Nov 2010 15:43:42 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201011011543.oA1FhgHV070234@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 1 Nov 2010 15:43:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214627 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 15:43:43 -0000 Author: trasz Date: Mon Nov 1 15:43:42 2010 New Revision: 214627 URL: http://svn.freebsd.org/changeset/base/214627 Log: MFC r214245: Remove workaround for ZFS bug; fix was committed to the //depot/user/pjd/zfs/... branch some time ago. Modified: stable/8/sys/kern/subr_acl_nfs4.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/subr_acl_nfs4.c ============================================================================== --- stable/8/sys/kern/subr_acl_nfs4.c Mon Nov 1 15:36:47 2010 (r214626) +++ stable/8/sys/kern/subr_acl_nfs4.c Mon Nov 1 15:43:42 2010 (r214627) @@ -367,28 +367,6 @@ acl_nfs4_trivial_from_mode(struct acl *a group_deny = everyone_allow & ~group_allow; user_allow_first = group_deny & ~user_deny; -#if 1 - /* - * This is a workaround for what looks like a bug in ZFS - trivial - * ACL for mode 0077 should look like this: - * - * owner@:rwxp----------:------:deny - * owner@:------aARWcCos:------:allow - * group@:rwxp--a-R-c--s:------:allow - * everyone@:rwxp--a-R-c--s:------:allow - * - * Instead, ZFS makes it like this: - * - * owner@:rwx-----------:------:deny - * owner@:------aARWcCos:------:allow - * group@:rwxp--a-R-c--s:------:allow - * everyone@:rwxp--a-R-c--s:------:allow - */ - user_allow_first &= ~ACL_APPEND_DATA; - user_deny &= ~ACL_APPEND_DATA; - group_deny &= ~ACL_APPEND_DATA; -#endif - if (user_allow_first != 0) _acl_append(aclp, ACL_USER_OBJ, user_allow_first, ACL_ENTRY_TYPE_ALLOW); if (user_deny != 0) From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 17:19:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E886106564A; Mon, 1 Nov 2010 17:19:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id B99A18FC13; Mon, 1 Nov 2010 17:19:08 +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 oA1HJ5gM092707 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Nov 2010 19:19:05 +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.4/8.14.4) with ESMTP id oA1HJ5Ap092795; Mon, 1 Nov 2010 19:19:05 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id oA1HJ4S0092794; Mon, 1 Nov 2010 19:19:04 +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: Mon, 1 Nov 2010 19:19:04 +0200 From: Kostik Belousov To: Pawel Jakub Dawidek Message-ID: <20101101171904.GA92782@deviant.kiev.zoral.com.ua> References: <201008262341.o7QNfeR2057181@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xHFwDpU9dbj6ez1V" Content-Disposition: inline In-Reply-To: <201008262341.o7QNfeR2057181@svn.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=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211854 - head/sys/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 17:19:09 -0000 --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 26, 2010 at 11:41:40PM +0000, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Thu Aug 26 23:41:40 2010 > New Revision: 211854 > URL: http://svn.freebsd.org/changeset/base/211854 >=20 > Log: > - When VFS_VGET() is not supported, switch to VOP_LOOKUP(). > - We are fine by only share-locking the vnode. > - Remove assertion that doesn't hold for ZFS where we cross mount points > boundaries by going into .zfs/snapshot//. > =20 > Reviewed by: rmacklem > MFC after: 1 month Do you still plan to merge this commit to stable/8 ? --xHFwDpU9dbj6ez1V Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkzO9ogACgkQC3+MBN1Mb4hw5QCg7bxbvUqxJ6IIoGv/tha61/jp 88QAoK1H9GpGKRg3piYI5N74igMMmLxo =PDeZ -----END PGP SIGNATURE----- --xHFwDpU9dbj6ez1V-- From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 17:27:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3309106566C; Mon, 1 Nov 2010 17:27:09 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 76E0E8FC0C; Mon, 1 Nov 2010 17:27: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 oA1HR95w076572; Mon, 1 Nov 2010 17:27:09 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1HR9Ur076570; Mon, 1 Nov 2010 17:27:09 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011011727.oA1HR9Ur076570@svn.freebsd.org> From: Ulrich Spoerlein Date: Mon, 1 Nov 2010 17:27: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: r214628 - head/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 17:27:09 -0000 Author: uqs Date: Mon Nov 1 17:27:09 2010 New Revision: 214628 URL: http://svn.freebsd.org/changeset/base/214628 Log: Add DragonflyBSD 2.8 and OpenBSD 4.8 releases Also expand a stray tab in the family tree MFC after: 1 week Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Mon Nov 1 15:43:42 2010 (r214627) +++ head/share/misc/bsd-family-tree Mon Nov 1 17:27:09 2010 (r214628) @@ -151,7 +151,7 @@ FreeBSD 4.0 | | | | | NetBSD 1. | FreeBSD 4.5 | | | | | | | | \ | | | | BSD/OS 4.3 | FreeBSD 4.6 \ | | | OpenBSD 3.1 | - | | \ | | NetBSD 1.5.3 | | + | | \ | | NetBSD 1.5.3 | | | FreeBSD 4.6.2 Mac OS X | | | | | 10.2 | | | | FreeBSD 4.7 | | | | @@ -239,7 +239,8 @@ FreeBSD 5.2 | | | | | | OpenBSD 4.7 | | FreeBSD | | | | | 8.1 | | | | - | | | | | | + | | | | | DragonFly 2.8.0 + | | | | OpenBSD 4.8 | | V | | | | | | | | | FreeBSD 9 -current | NetBSD -current OpenBSD -current | @@ -520,6 +521,8 @@ FreeBSD 7.3 2010-03-23 [FBD] DragonFly 2.6.0 2010-03-28 [DFB] OpenBSD 4.7 2010-05-19 [OBD] FreeBSD 8.1 2010-07-24 [FBD] +DragonFly 2.8.0 2010-10-30 [DFB] +OpenBSD 4.8 2010-11-01 [OBD] Bibliography ------------------------ From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 17:34:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EEFA1065755; Mon, 1 Nov 2010 17:34:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C5328FC0A; Mon, 1 Nov 2010 17:34: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 oA1HY48c076953; Mon, 1 Nov 2010 17:34:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1HY4fp076949; Mon, 1 Nov 2010 17:34:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011011734.oA1HY4fp076949@svn.freebsd.org> From: John Baldwin Date: Mon, 1 Nov 2010 17:34: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: r214629 - in head: include sys/conf sys/x86/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 17:34:04 -0000 Author: jhb Date: Mon Nov 1 17:34:04 2010 New Revision: 214629 URL: http://svn.freebsd.org/changeset/base/214629 Log: Add an x86/include directory to the kernel to hold headers that are common to amd64, i386, and pc98. The headers are installed to /usr/include/x86 during an installworld, and an 'x86' symlink is created for kernel builds similar to 'machine' so that the headers can be included as . Reviewed by: imp Added: head/sys/x86/include/ Modified: head/include/Makefile head/sys/conf/kern.post.mk head/sys/conf/kmod.mk Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Mon Nov 1 17:27:09 2010 (r214628) +++ head/include/Makefile Mon Nov 1 17:34:04 2010 (r214629) @@ -116,7 +116,10 @@ INCSLINKS+= sys/$i ${INCLUDEDIR}/$i .endfor .if ${MACHINE} != ${MACHINE_CPUARCH} -_MARCH=${MACHINE_CPUARCH} +_MARCHS= ${MACHINE_CPUARCH} +.endif +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_MARCHS+= x86 .endif .include @@ -126,7 +129,7 @@ ${SHARED}: compat # Take care of stale directory-level symlinks. compat: -.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto +.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \ rm -f ${DESTDIR}${INCLUDEDIR}/$i; \ fi @@ -142,7 +145,7 @@ compat: copies: .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \ - ${_MARCH} + ${_MARCHS} .if exists(${DESTDIR}${INCLUDEDIR}/$i) cd ${DESTDIR}${INCLUDEDIR}/$i; \ for h in *.h; do \ @@ -189,7 +192,8 @@ copies: ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${DESTDIR}${INCLUDEDIR}/machine/pc .endif -.if defined(_MARCH) && exists(${.CURDIR}/../sys/${_MARCH}/include) +.for _MARCH in ${_MARCHS} +.if exists(${.CURDIR}/../sys/${_MARCH}/include) ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${.CURDIR}/../sys/${_MARCH}/include; \ @@ -203,6 +207,7 @@ copies: ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc .endif .endif +.endfor cd ${.CURDIR}/../sys/rpc; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ ${DESTDIR}${INCLUDEDIR}/rpc @@ -276,7 +281,8 @@ symlinks: ${DESTDIR}${INCLUDEDIR}/machine/pc; \ done .endif -.if defined(_MARCH) && exists(${.CURDIR}/../sys/${_MARCH}/include) +.for _MARCH in ${_MARCHS} +.if exists(${.CURDIR}/../sys/${_MARCH}/include) ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${.CURDIR}/../sys/${_MARCH}/include; \ @@ -294,6 +300,7 @@ symlinks: done .endif .endif +.endfor cd ${.CURDIR}/../sys/fs/cd9660; \ for h in *.h; do \ ln -fs ../../../../sys/fs/cd9660/$$h \ Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Mon Nov 1 17:27:09 2010 (r214628) +++ head/sys/conf/kern.post.mk Mon Nov 1 17:34:04 2010 (r214629) @@ -169,6 +169,9 @@ _ILINKS= machine .if ${MACHINE} != ${MACHINE_CPUARCH} _ILINKS+= ${MACHINE_CPUARCH} .endif +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_ILINKS+= x86 +.endif # Ensure that the link exists without depending on it when it exists. .for _link in ${_ILINKS} @@ -181,8 +184,8 @@ ${_ILINKS}: @case ${.TARGET} in \ machine) \ path=${S}/${MACHINE}/include ;; \ - ${MACHINE_CPUARCH}) \ - path=${S}/${MACHINE_CPUARCH}/include ;; \ + *) \ + path=${S}/${.TARGET}/include ;; \ esac ; \ ${ECHO} ${.TARGET} "->" $$path ; \ ln -s $$path ${.TARGET} Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Mon Nov 1 17:27:09 2010 (r214628) +++ head/sys/conf/kmod.mk Mon Nov 1 17:34:04 2010 (r214629) @@ -238,6 +238,9 @@ _ILINKS=@ machine .if ${MACHINE} != ${MACHINE_CPUARCH} _ILINKS+=${MACHINE_CPUARCH} .endif +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_ILINKS+=x86 +.endif all: objwarn ${PROG} @@ -263,12 +266,12 @@ SYSDIR= ${_dir} ${_ILINKS}: @case ${.TARGET} in \ - ${MACHINE_CPUARCH}) \ - path=${SYSDIR}/${MACHINE_CPUARCH}/include ;; \ machine) \ path=${SYSDIR}/${MACHINE}/include ;; \ @) \ path=${SYSDIR} ;; \ + *) \ + path=${SYSDIR}/${.TARGET}/include ;; \ esac ; \ path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET} "->" $$path ; \ From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 17:40:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F30610656C6; Mon, 1 Nov 2010 17:40: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 539158FC0A; Mon, 1 Nov 2010 17:40: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 oA1HeaSC077339; Mon, 1 Nov 2010 17:40:36 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1Heatl077326; Mon, 1 Nov 2010 17:40:36 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011011740.oA1Heatl077326@svn.freebsd.org> From: John Baldwin Date: Mon, 1 Nov 2010 17:40: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: r214630 - in head/sys: amd64/acpica amd64/amd64 amd64/include i386/acpica i386/i386 i386/include pc98/include pc98/pc98 x86/include x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 17:40:36 -0000 Author: jhb Date: Mon Nov 1 17:40:35 2010 New Revision: 214630 URL: http://svn.freebsd.org/changeset/base/214630 Log: Move the header to . Added: head/sys/x86/include/mca.h - copied, changed from r214624, head/sys/amd64/include/mca.h Deleted: head/sys/amd64/include/mca.h head/sys/i386/include/mca.h head/sys/pc98/include/mca.h Modified: head/sys/amd64/acpica/acpi_wakeup.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/trap.c head/sys/i386/acpica/acpi_wakeup.c head/sys/i386/i386/machdep.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/trap.c head/sys/pc98/pc98/machdep.c head/sys/x86/x86/local_apic.c head/sys/x86/x86/mca.c Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/amd64/acpica/acpi_wakeup.c Mon Nov 1 17:40:35 2010 (r214630) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/amd64/amd64/machdep.c Mon Nov 1 17:40:35 2010 (r214630) @@ -112,7 +112,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/amd64/amd64/mp_machdep.c Mon Nov 1 17:40:35 2010 (r214630) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/amd64/amd64/trap.c Mon Nov 1 17:40:35 2010 (r214630) @@ -83,7 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #ifdef SMP Modified: head/sys/i386/acpica/acpi_wakeup.c ============================================================================== --- head/sys/i386/acpica/acpi_wakeup.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/i386/acpica/acpi_wakeup.c Mon Nov 1 17:40:35 2010 (r214630) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/i386/i386/machdep.c Mon Nov 1 17:40:35 2010 (r214630) @@ -115,7 +115,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/i386/i386/mp_machdep.c Mon Nov 1 17:40:35 2010 (r214630) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/i386/i386/trap.c Mon Nov 1 17:40:35 2010 (r214630) @@ -86,7 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #ifdef SMP Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/pc98/pc98/machdep.c Mon Nov 1 17:40:35 2010 (r214630) @@ -112,7 +112,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Copied and modified: head/sys/x86/include/mca.h (from r214624, head/sys/amd64/include/mca.h) ============================================================================== --- head/sys/amd64/include/mca.h Mon Nov 1 11:38:04 2010 (r214624, copy source) +++ head/sys/x86/include/mca.h Mon Nov 1 17:40:35 2010 (r214630) @@ -27,8 +27,8 @@ * $FreeBSD$ */ -#ifndef __MACHINE_MCA_H__ -#define __MACHINE_MCA_H__ +#ifndef __X86_MCA_H__ +#define __X86_MCA_H__ struct mca_record { uint64_t mr_status; @@ -53,4 +53,4 @@ void mca_resume(void); #endif -#endif /* !__MACHINE_MCA_H__ */ +#endif /* !__X86_MCA_H__ */ Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/x86/x86/local_apic.c Mon Nov 1 17:40:35 2010 (r214630) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/x86/x86/mca.c ============================================================================== --- head/sys/x86/x86/mca.c Mon Nov 1 17:34:04 2010 (r214629) +++ head/sys/x86/x86/mca.c Mon Nov 1 17:40:35 2010 (r214630) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 18:18:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7ABF6106566B; Mon, 1 Nov 2010 18:18:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65E938FC13; Mon, 1 Nov 2010 18:18: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 oA1IIlaV079708; Mon, 1 Nov 2010 18:18:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1IIkQt079688; Mon, 1 Nov 2010 18:18:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011011818.oA1IIkQt079688@svn.freebsd.org> From: John Baldwin Date: Mon, 1 Nov 2010 18:18: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: r214631 - in head/sys: amd64/acpica amd64/amd64 amd64/include i386/acpica i386/i386 i386/include i386/xen pc98/include x86/include x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 18:18:47 -0000 Author: jhb Date: Mon Nov 1 18:18:46 2010 New Revision: 214631 URL: http://svn.freebsd.org/changeset/base/214631 Log: Move to . Added: head/sys/x86/include/apicreg.h - copied, changed from r214624, head/sys/i386/include/apicreg.h Deleted: head/sys/amd64/include/apicreg.h head/sys/i386/include/apicreg.h head/sys/pc98/include/apicreg.h Modified: head/sys/amd64/acpica/acpi_wakeup.c head/sys/amd64/acpica/madt.c head/sys/amd64/amd64/apic_vector.S head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/mp_watchdog.c head/sys/i386/acpica/madt.c head/sys/i386/i386/apic_vector.s head/sys/i386/i386/genassym.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/mp_watchdog.c head/sys/i386/i386/mpboot.s head/sys/i386/xen/mp_machdep.c head/sys/i386/xen/mptable.c head/sys/x86/x86/io_apic.c head/sys/x86/x86/local_apic.c head/sys/x86/x86/mptable.c head/sys/x86/x86/msi.c Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/amd64/acpica/acpi_wakeup.c Mon Nov 1 18:18:46 2010 (r214631) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef SMP -#include +#include #include #include #endif Modified: head/sys/amd64/acpica/madt.c ============================================================================== --- head/sys/amd64/acpica/madt.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/amd64/acpica/madt.c Mon Nov 1 18:18:46 2010 (r214631) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Modified: head/sys/amd64/amd64/apic_vector.S ============================================================================== --- head/sys/amd64/amd64/apic_vector.S Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/amd64/amd64/apic_vector.S Mon Nov 1 18:18:46 2010 (r214631) @@ -39,7 +39,7 @@ #include "opt_smp.h" #include -#include +#include #include "assym.s" Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/amd64/amd64/genassym.c Mon Nov 1 18:18:46 2010 (r214631) @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/amd64/amd64/mp_machdep.c Mon Nov 1 18:18:46 2010 (r214631) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/amd64/amd64/mp_watchdog.c ============================================================================== --- head/sys/amd64/amd64/mp_watchdog.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/amd64/amd64/mp_watchdog.c Mon Nov 1 18:18:46 2010 (r214631) @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include Modified: head/sys/i386/acpica/madt.c ============================================================================== --- head/sys/i386/acpica/madt.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/i386/acpica/madt.c Mon Nov 1 18:18:46 2010 (r214631) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Modified: head/sys/i386/i386/apic_vector.s ============================================================================== --- head/sys/i386/i386/apic_vector.s Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/i386/i386/apic_vector.s Mon Nov 1 18:18:46 2010 (r214631) @@ -39,7 +39,7 @@ #include "opt_smp.h" #include -#include +#include #include "assym.s" Modified: head/sys/i386/i386/genassym.c ============================================================================== --- head/sys/i386/i386/genassym.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/i386/i386/genassym.c Mon Nov 1 18:18:46 2010 (r214631) @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #ifdef DEV_APIC -#include +#include #endif #include #include Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/i386/i386/mp_machdep.c Mon Nov 1 18:18:46 2010 (r214631) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/i386/i386/mp_watchdog.c ============================================================================== --- head/sys/i386/i386/mp_watchdog.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/i386/i386/mp_watchdog.c Mon Nov 1 18:18:46 2010 (r214631) @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include Modified: head/sys/i386/i386/mpboot.s ============================================================================== --- head/sys/i386/i386/mpboot.s Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/i386/i386/mpboot.s Mon Nov 1 18:18:46 2010 (r214631) @@ -32,7 +32,7 @@ #include "opt_pmap.h" #include /* miscellaneous asm macros */ -#include +#include #include #include "assym.s" Modified: head/sys/i386/xen/mp_machdep.c ============================================================================== --- head/sys/i386/xen/mp_machdep.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/i386/xen/mp_machdep.c Mon Nov 1 18:18:46 2010 (r214631) @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/i386/xen/mptable.c ============================================================================== --- head/sys/i386/xen/mptable.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/i386/xen/mptable.c Mon Nov 1 18:18:46 2010 (r214631) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Copied and modified: head/sys/x86/include/apicreg.h (from r214624, head/sys/i386/include/apicreg.h) ============================================================================== --- head/sys/i386/include/apicreg.h Mon Nov 1 11:38:04 2010 (r214624, copy source) +++ head/sys/x86/include/apicreg.h Mon Nov 1 18:18:46 2010 (r214631) @@ -25,8 +25,8 @@ * $FreeBSD$ */ -#ifndef _MACHINE_APICREG_H_ -#define _MACHINE_APICREG_H_ +#ifndef _X86_APICREG_H_ +#define _X86_APICREG_H_ /* * Local && I/O APIC definitions. @@ -442,4 +442,4 @@ typedef struct IOAPIC ioapic_t; #define IOART_INTVEC 0x000000ff /* R/W: INTerrupt vector field */ -#endif /* _MACHINE_APICREG_H_ */ +#endif /* _X86_APICREG_H_ */ Modified: head/sys/x86/x86/io_apic.c ============================================================================== --- head/sys/x86/x86/io_apic.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/x86/x86/io_apic.c Mon Nov 1 18:18:46 2010 (r214631) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/x86/x86/local_apic.c Mon Nov 1 18:18:46 2010 (r214631) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/x86/x86/mptable.c ============================================================================== --- head/sys/x86/x86/mptable.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/x86/x86/mptable.c Mon Nov 1 18:18:46 2010 (r214631) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/x86/x86/msi.c ============================================================================== --- head/sys/x86/x86/msi.c Mon Nov 1 17:40:35 2010 (r214630) +++ head/sys/x86/x86/msi.c Mon Nov 1 18:18:46 2010 (r214631) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 19:04:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97777106564A; Mon, 1 Nov 2010 19:04:16 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84DF28FC13; Mon, 1 Nov 2010 19:04: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 oA1J4GPi083121; Mon, 1 Nov 2010 19:04:16 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1J4G2J083119; Mon, 1 Nov 2010 19:04:16 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201011011904.oA1J4G2J083119@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 1 Nov 2010 19:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214632 - stable/7/sys/dev/iwi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 19:04:16 -0000 Author: bschmidt Date: Mon Nov 1 19:04:16 2010 New Revision: 214632 URL: http://svn.freebsd.org/changeset/base/214632 Log: MFC r214160,214162,214236 r214236 & r214160: The firmware does pad notifications to an even number of bytes (at least the association notification), the included information though always contains an elem block with an odd number of bytes. We handle the last byte as if it might contain a whole elem block, this of course is not true as one byte is not enough to hold a block, we therefore discard the complete frame. The solution here is to subtract one from the actual notification length, this is also what the Linux driver does. With this change the frame ends exactly where the last elem block ends. r214262: The firmware always sets bit 14 and 15, to get the real associd we need to clear those bits. Modified: stable/7/sys/dev/iwi/if_iwi.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/iwi/if_iwi.c ============================================================================== --- stable/7/sys/dev/iwi/if_iwi.c Mon Nov 1 18:18:46 2010 (r214631) +++ stable/7/sys/dev/iwi/if_iwi.c Mon Nov 1 19:04:16 2010 (r214632) @@ -1377,7 +1377,7 @@ iwi_checkforqos(struct iwi_softc *sc, co ni = sc->sc_ic.ic_bss; ni->ni_capinfo = capinfo; - ni->ni_associd = associd; + ni->ni_associd = associd & 0x3fff; if (wme != NULL) ni->ni_flags |= IEEE80211_NODE_QOS; else @@ -1480,7 +1480,7 @@ iwi_notification_intr(struct iwi_softc * IWI_STATE_END(sc, IWI_FW_ASSOCIATING); iwi_checkforqos(sc, (const struct ieee80211_frame *)(assoc+1), - le16toh(notif->len) - sizeof(*assoc)); + le16toh(notif->len) - sizeof(*assoc) - 1); ieee80211_new_state(ic, IEEE80211_S_RUN, -1); break; From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 19:05:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A78AA106564A; Mon, 1 Nov 2010 19:05:38 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A81E8FC08; Mon, 1 Nov 2010 19:05: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 oA1J5cd9083203; Mon, 1 Nov 2010 19:05:38 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1J5ccU083201; Mon, 1 Nov 2010 19:05:38 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201011011905.oA1J5ccU083201@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 1 Nov 2010 19:05:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214633 - stable/8/sys/dev/iwi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 19:05:38 -0000 Author: bschmidt Date: Mon Nov 1 19:05:38 2010 New Revision: 214633 URL: http://svn.freebsd.org/changeset/base/214633 Log: MFC r214160,214162,214236 r214236 & r214160: The firmware does pad notifications to an even number of bytes (at least the association notification), the included information though always contains an elem block with an odd number of bytes. We handle the last byte as if it might contain a whole elem block, this of course is not true as one byte is not enough to hold a block, we therefore discard the complete frame. The solution here is to subtract one from the actual notification length, this is also what the Linux driver does. With this change the frame ends exactly where the last elem block ends. r214262: The firmware always sets bit 14 and 15, to get the real associd we need to clear those bits. Modified: stable/8/sys/dev/iwi/if_iwi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/iwi/if_iwi.c ============================================================================== --- stable/8/sys/dev/iwi/if_iwi.c Mon Nov 1 19:04:16 2010 (r214632) +++ stable/8/sys/dev/iwi/if_iwi.c Mon Nov 1 19:05:38 2010 (r214633) @@ -1368,7 +1368,7 @@ iwi_checkforqos(struct ieee80211vap *vap ni = vap->iv_bss; ni->ni_capinfo = capinfo; - ni->ni_associd = associd; + ni->ni_associd = associd & 0x3fff; if (wme != NULL) ni->ni_flags |= IEEE80211_NODE_QOS; else @@ -1483,7 +1483,7 @@ iwi_notification_intr(struct iwi_softc * IWI_STATE_END(sc, IWI_FW_ASSOCIATING); iwi_checkforqos(vap, (const struct ieee80211_frame *)(assoc+1), - le16toh(notif->len) - sizeof(*assoc)); + le16toh(notif->len) - sizeof(*assoc) - 1); ieee80211_new_state(vap, IEEE80211_S_RUN, -1); break; case IWI_ASSOC_INIT: From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 20:19:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB4B6106564A; Mon, 1 Nov 2010 20:19:25 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8BD38FC12; Mon, 1 Nov 2010 20:19:25 +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 oA1KJPRe087052; Mon, 1 Nov 2010 20:19:25 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1KJPRY087047; Mon, 1 Nov 2010 20:19:25 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201011012019.oA1KJPRY087047@svn.freebsd.org> From: Jack F Vogel Date: Mon, 1 Nov 2010 20:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214646 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 20:19:25 -0000 Author: jfv Date: Mon Nov 1 20:19:25 2010 New Revision: 214646 URL: http://svn.freebsd.org/changeset/base/214646 Log: Sync the lem code up with the vlan and other fixes in em. Delete a unneeded test from the beginning of em_xmit. CRITICAL: shared code fix for 82574, a mutex might not be released, this can cause hangs. Modified: head/sys/dev/e1000/e1000_82571.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_lem.c head/sys/dev/e1000/if_lem.h Modified: head/sys/dev/e1000/e1000_82571.c ============================================================================== --- head/sys/dev/e1000/e1000_82571.c Mon Nov 1 20:17:15 2010 (r214645) +++ head/sys/dev/e1000/e1000_82571.c Mon Nov 1 20:19:25 2010 (r214646) @@ -666,10 +666,15 @@ static void e1000_put_hw_semaphore_82573 **/ static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw) { + s32 ret_val; + DEBUGFUNC("e1000_get_hw_semaphore_82574"); E1000_MUTEX_LOCK(&hw->dev_spec._82571.swflag_mutex); - return e1000_get_hw_semaphore_82573(hw); + ret_val = e1000_get_hw_semaphore_82573(hw); + if (ret_val) + E1000_MUTEX_UNLOCK(&hw->dev_spec._82571.swflag_mutex); + return ret_val; } /** Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Nov 1 20:17:15 2010 (r214645) +++ head/sys/dev/e1000/if_em.c Mon Nov 1 20:19:25 2010 (r214646) @@ -1766,19 +1766,6 @@ em_xmit(struct tx_ring *txr, struct mbuf ip_off = poff = 0; /* - ** When doing checksum offload, it is critical to - ** make sure the first mbuf has more than header, - ** because that routine expects data to be present. - */ - if ((m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) && - (m_head->m_len < ETHER_HDR_LEN + sizeof(struct ip))) { - m_head = m_pullup(m_head, ETHER_HDR_LEN + sizeof(struct ip)); - *m_headp = m_head; - if (m_head == NULL) - return (ENOBUFS); - } - - /* * Intel recommends entire IP/TCP header length reside in a single * buffer. If multiple descriptors are used to describe the IP and * TCP header, each descriptor should describe one or more Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Mon Nov 1 20:17:15 2010 (r214645) +++ head/sys/dev/e1000/if_lem.c Mon Nov 1 20:19:25 2010 (r214646) @@ -51,9 +51,7 @@ #include #include #include -#if __FreeBSD_version >= 700029 #include -#endif #include #include @@ -86,8 +84,7 @@ /********************************************************************* * Legacy Em Driver version: *********************************************************************/ -char lem_driver_version[] = "1.0.2"; - +char lem_driver_version[] = "1.0.3"; /********************************************************************* * PCI Device ID Table @@ -209,11 +206,9 @@ static void lem_disable_promisc(struct a static void lem_set_multi(struct adapter *); static void lem_update_link_status(struct adapter *); static int lem_get_buf(struct adapter *, int); -#if __FreeBSD_version >= 700029 static void lem_register_vlan(void *, struct ifnet *, u16); static void lem_unregister_vlan(void *, struct ifnet *, u16); static void lem_setup_vlan_hw_support(struct adapter *); -#endif static int lem_xmit(struct adapter *, struct mbuf **); static void lem_smartspeed(struct adapter *); static int lem_82547_fifo_workaround(struct adapter *, int); @@ -231,6 +226,8 @@ static u32 lem_fill_descriptors (bus_add static int lem_sysctl_int_delay(SYSCTL_HANDLER_ARGS); static void lem_add_int_delay_sysctl(struct adapter *, const char *, const char *, struct em_int_delay_info *, int, int); +static void lem_set_flow_cntrl(struct adapter *, const char *, + const char *, int *, int); /* Management and WOL Support */ static void lem_init_manageability(struct adapter *); static void lem_release_manageability(struct adapter *); @@ -244,11 +241,7 @@ static void lem_led_func(void *, int); #ifdef EM_LEGACY_IRQ static void lem_intr(void *); #else /* FAST IRQ */ -#if __FreeBSD_version < 700000 -static void lem_irq_fast(void *); -#else static int lem_irq_fast(void *); -#endif static void lem_handle_rxtx(void *context, int pending); static void lem_handle_link(void *context, int pending); static void lem_add_rx_process_limit(struct adapter *, const char *, @@ -320,14 +313,6 @@ TUNABLE_INT("hw.em.rx_process_limit", &l static int lem_fc_setting = e1000_fc_full; TUNABLE_INT("hw.em.fc_setting", &lem_fc_setting); -/* -** Shadow VFTA table, this is needed because -** the real vlan filter table gets cleared during -** a soft reset and the driver needs to be able -** to repopulate it. -*/ -static u32 lem_shadow_vfta[EM_VFTA_SIZE]; - /* Global used in WOL setup with multiport cards */ static int global_quad_port_a = 0; @@ -462,6 +447,11 @@ lem_attach(device_t dev) lem_rx_process_limit); #endif + /* Sysctl for setting the interface flow control */ + lem_set_flow_cntrl(adapter, "flow_control", + "max number of rx packets to process", + &adapter->fc_setting, lem_fc_setting); + /* * Validate number of transmit and receive descriptors. It * must not exceed hardware maximum, and must be multiple @@ -638,13 +628,11 @@ lem_attach(device_t dev) else adapter->pcix_82544 = FALSE; -#if __FreeBSD_version >= 700029 /* Register for VLAN events */ adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, lem_register_vlan, adapter, EVENTHANDLER_PRI_FIRST); adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, lem_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); -#endif lem_add_hw_stats(adapter); @@ -702,11 +690,7 @@ lem_detach(device_t dev) INIT_DEBUGOUT("em_detach: begin"); /* Make sure VLANS are not using driver */ -#if __FreeBSD_version >= 700000 if (adapter->ifp->if_vlantrunk != NULL) { -#else - if (adapter->ifp->if_nvlans != 0) { -#endif device_printf(dev,"Vlan in use, detach first\n"); return (EBUSY); } @@ -730,13 +714,11 @@ lem_detach(device_t dev) EM_TX_UNLOCK(adapter); EM_CORE_UNLOCK(adapter); -#if __FreeBSD_version >= 700029 /* Unregister VLAN events */ if (adapter->vlan_attach != NULL) EVENTHANDLER_DEREGISTER(vlan_config, adapter->vlan_attach); if (adapter->vlan_detach != NULL) EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach); -#endif ether_ifdetach(adapter->ifp); callout_drain(&adapter->timer); @@ -831,6 +813,19 @@ lem_start_locked(struct ifnet *ifp) if (!adapter->link_active) return; + /* + * Force a cleanup if number of TX descriptors + * available hits the threshold + */ + if (adapter->num_tx_desc_avail <= EM_TX_CLEANUP_THRESHOLD) { + lem_txeof(adapter); + /* Now do we at least have a minimal? */ + if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD) { + adapter->no_tx_desc_avail1++; + return; + } + } + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); @@ -1043,9 +1038,7 @@ lem_ioctl(struct ifnet *ifp, u_long comm } if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) lem_init(adapter); -#if __FreeBSD_version >= 700000 VLAN_CAPABILITIES(ifp); -#endif break; } @@ -1135,17 +1128,8 @@ lem_init_locked(struct adapter *adapter) /* Setup VLAN support, basic and offload if available */ E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); -#if __FreeBSD_version < 700029 - if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } -#else /* Use real VLAN Filter support */ lem_setup_vlan_hw_support(adapter); -#endif /* Set hardware offload abilities */ ifp->if_hwassist = 0; @@ -1174,6 +1158,19 @@ lem_init_locked(struct adapter *adapter) } lem_initialize_receive_unit(adapter); + /* Use real VLAN Filter support? */ + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + /* Use real VLAN Filter support */ + lem_setup_vlan_hw_support(adapter); + else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + } + } + /* Don't lose promiscuous settings */ lem_set_promisc(adapter); @@ -1276,7 +1273,6 @@ lem_poll(struct ifnet *ifp, enum poll_cm * Legacy Interrupt Service routine * *********************************************************************/ - static void lem_intr(void *arg) { @@ -1311,7 +1307,6 @@ lem_intr(void *arg) } EM_TX_LOCK(adapter); - lem_txeof(adapter); lem_rxeof(adapter, -1, NULL); lem_txeof(adapter); if (ifp->if_drv_flags & IFF_DRV_RUNNING && @@ -1354,8 +1349,7 @@ lem_handle_rxtx(void *context, int pendi if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (lem_rxeof(adapter, adapter->rx_process_limit, NULL) != 0) - taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); + lem_rxeof(adapter, adapter->rx_process_limit, NULL); EM_TX_LOCK(adapter); lem_txeof(adapter); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -1363,7 +1357,8 @@ lem_handle_rxtx(void *context, int pendi EM_TX_UNLOCK(adapter); } - lem_enable_intr(adapter); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + lem_enable_intr(adapter); } /********************************************************************* @@ -1371,13 +1366,7 @@ lem_handle_rxtx(void *context, int pendi * Fast Legacy/MSI Combined Interrupt Service routine * *********************************************************************/ -#if __FreeBSD_version < 700000 -#define FILTER_STRAY -#define FILTER_HANDLED -static void -#else static int -#endif lem_irq_fast(void *arg) { struct adapter *adapter = arg; @@ -1550,25 +1539,10 @@ lem_xmit(struct adapter *adapter, struct struct mbuf *m_head; u32 txd_upper, txd_lower, txd_used, txd_saved; int error, nsegs, i, j, first, last = 0; -#if __FreeBSD_version < 700000 - struct m_tag *mtag; -#endif + m_head = *m_headp; txd_upper = txd_lower = txd_used = txd_saved = 0; - /* - * Force a cleanup if number of TX descriptors - * available hits the threshold - */ - if (adapter->num_tx_desc_avail <= EM_TX_CLEANUP_THRESHOLD) { - lem_txeof(adapter); - /* Now do we at least have a minimal? */ - if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD) { - adapter->no_tx_desc_avail1++; - return (ENOBUFS); - } - } - /* ** When doing checksum offload, it is critical to ** make sure the first mbuf has more than header, @@ -1712,20 +1686,6 @@ lem_xmit(struct adapter *adapter, struct else adapter->num_tx_desc_avail -= nsegs; - /* - ** Handle VLAN tag, this is the - ** biggest difference between - ** 6.x and 7 - */ -#if __FreeBSD_version < 700000 - /* Find out if we are in vlan mode. */ - mtag = VLAN_OUTPUT_TAG(ifp, m_head); - if (mtag != NULL) { - ctxd->upper.fields.special = - htole16(VLAN_TAG_VALUE(mtag)); - ctxd->lower.data |= htole32(E1000_TXD_CMD_VLE); - } -#else /* FreeBSD 7 */ if (m_head->m_flags & M_VLANTAG) { /* Set the vlan id. */ ctxd->upper.fields.special = @@ -1733,7 +1693,6 @@ lem_xmit(struct adapter *adapter, struct /* Tell hardware to add tag */ ctxd->lower.data |= htole32(E1000_TXD_CMD_VLE); } -#endif tx_buffer->m_head = m_head; tx_buffer_mapped->map = tx_buffer->map; @@ -2249,11 +2208,7 @@ lem_allocate_irq(struct adapter *adapter #ifdef EM_LEGACY_IRQ /* We do Legacy setup */ if ((error = bus_setup_intr(dev, adapter->res[0], -#if __FreeBSD_version > 700000 INTR_TYPE_NET | INTR_MPSAFE, NULL, lem_intr, adapter, -#else /* 6.X */ - INTR_TYPE_NET | INTR_MPSAFE, lem_intr, adapter, -#endif &adapter->tag[0])) != 0) { device_printf(dev, "Failed to register interrupt handler"); return (error); @@ -2270,13 +2225,8 @@ lem_allocate_irq(struct adapter *adapter taskqueue_thread_enqueue, &adapter->tq); taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", device_get_nameunit(adapter->dev)); -#if __FreeBSD_version < 700000 - if ((error = bus_setup_intr(dev, adapter->res[0], - INTR_TYPE_NET | INTR_FAST, lem_irq_fast, adapter, -#else if ((error = bus_setup_intr(dev, adapter->res[0], INTR_TYPE_NET, lem_irq_fast, NULL, adapter, -#endif &adapter->tag[0])) != 0) { device_printf(dev, "Failed to register fast interrupt " "handler: %d\n", error); @@ -2362,7 +2312,7 @@ lem_hardware_init(struct adapter *adapte adapter->hw.fc.send_xon = TRUE; /* Set Flow control, use the tunable location if sane */ - if ((lem_fc_setting >= 0) || (lem_fc_setting < 4)) + if ((lem_fc_setting >= 0) && (lem_fc_setting < 4)) adapter->hw.fc.requested_mode = lem_fc_setting; else adapter->hw.fc.requested_mode = e1000_fc_none; @@ -2410,14 +2360,8 @@ lem_setup_interface(device_t dev, struct ifp->if_capabilities = ifp->if_capenable = 0; if (adapter->hw.mac.type >= e1000_82543) { - int version_cap; -#if __FreeBSD_version < 700000 - version_cap = IFCAP_HWCSUM; -#else - version_cap = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; -#endif - ifp->if_capabilities |= version_cap; - ifp->if_capenable |= version_cap; + ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; + ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; } /* @@ -2427,6 +2371,16 @@ lem_setup_interface(device_t dev, struct ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + /* + ** Dont turn this on by default, if vlans are + ** created on another pseudo device (eg. lagg) + ** then vlan events are not passed thru, breaking + ** operation, but with HW FILTER off it works. If + ** using vlans directly on the em driver you can + ** enable this and get full hardware tag filtering. + */ + ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; + #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; #endif @@ -2551,11 +2505,7 @@ lem_dma_malloc(struct adapter *adapter, { int error; -#if __FreeBSD_version >= 700000 error = bus_dma_tag_create(bus_get_dma_tag(adapter->dev), /* parent */ -#else - error = bus_dma_tag_create(NULL, /* parent */ -#endif EM_DBA_ALIGN, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ @@ -2640,21 +2590,17 @@ lem_allocate_transmit_structures(struct /* * Create DMA tags for tx descriptors */ -#if __FreeBSD_version >= 700000 if ((error = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ -#else - if ((error = bus_dma_tag_create(NULL, /* parent */ -#endif 1, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - EM_TSO_SIZE, /* maxsize */ + MCLBYTES * EM_MAX_SCATTER, /* maxsize */ EM_MAX_SCATTER, /* nsegments */ - EM_TSO_SEG_SIZE, /* maxsegsize */ + MCLBYTES, /* maxsegsize */ 0, /* flags */ - NULL, /* lockfunc */ - NULL, /* lockarg */ + NULL, /* lockfunc */ + NULL, /* lockarg */ &adapter->txtag)) != 0) { device_printf(dev, "Unable to allocate TX DMA tag\n"); goto fail; @@ -3072,23 +3018,20 @@ lem_txeof(struct adapter *adapter) BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); adapter->next_tx_to_clean = first; + adapter->num_tx_desc_avail = num_avail; /* * If we have enough room, clear IFF_DRV_OACTIVE to * tell the stack that it is OK to send packets. * If there are no pending descriptors, clear the watchdog. */ - if (num_avail > EM_TX_CLEANUP_THRESHOLD) { + if (adapter->num_tx_desc_avail > EM_TX_CLEANUP_THRESHOLD) { ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - if (num_avail == adapter->num_tx_desc) { + if (adapter->num_tx_desc_avail == adapter->num_tx_desc) { adapter->watchdog_check = FALSE; - adapter->num_tx_desc_avail = num_avail; return; } } - - adapter->num_tx_desc_avail = num_avail; - return; } /********************************************************************* @@ -3185,11 +3128,7 @@ lem_allocate_receive_structures(struct a return (ENOMEM); } -#if __FreeBSD_version >= 700000 error = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ -#else - error = bus_dma_tag_create(NULL, /* parent */ -#endif 1, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ @@ -3459,7 +3398,7 @@ lem_rxeof(struct adapter *adapter, int c { struct ifnet *ifp = adapter->ifp;; struct mbuf *mp; - u8 status, accept_frame = 0, eop = 0; + u8 status = 0, accept_frame = 0, eop = 0; u16 len, desc_len, prev_len_adj; int i, rx_sent = 0; struct e1000_rx_desc *current_desc; @@ -3477,11 +3416,13 @@ lem_rxeof(struct adapter *adapter, int c return (FALSE); } - while ((current_desc->status & E1000_RXD_STAT_DD) && - (count != 0) && - (ifp->if_drv_flags & IFF_DRV_RUNNING)) { + while (count != 0 && ifp->if_drv_flags & IFF_DRV_RUNNING) { struct mbuf *m = NULL; + status = current_desc->status; + if ((status & E1000_RXD_STAT_DD) == 0) + break; + mp = adapter->rx_buffer_area[i].m_head; /* * Can't defer bus_dmamap_sync(9) because TBI_ACCEPT @@ -3493,7 +3434,6 @@ lem_rxeof(struct adapter *adapter, int c accept_frame = 1; prev_len_adj = 0; desc_len = le16toh(current_desc->length); - status = current_desc->status; if (status & E1000_RXD_STAT_EOP) { count--; eop = 1; @@ -3571,16 +3511,10 @@ lem_rxeof(struct adapter *adapter, int c goto skip; #endif if (status & E1000_RXD_STAT_VP) { -#if __FreeBSD_version < 700000 - VLAN_INPUT_TAG_NEW(ifp, adapter->fmp, - (le16toh(current_desc->special) & - E1000_RXD_SPC_VLAN_MASK)); -#else adapter->fmp->m_pkthdr.ether_vtag = (le16toh(current_desc->special) & E1000_RXD_SPC_VLAN_MASK); adapter->fmp->m_flags |= M_VLANTAG; -#endif } #ifndef __NO_STRICT_ALIGNMENT skip: @@ -3636,7 +3570,7 @@ discard: if (done != NULL) *done = rx_sent; EM_RX_UNLOCK(adapter); - return (current_desc->status & E1000_RXD_STAT_DD); + return ((status & E1000_RXD_STAT_DD) ? TRUE : FALSE); } #ifndef __NO_STRICT_ALIGNMENT @@ -3728,7 +3662,6 @@ lem_receive_checksum(struct adapter *ada } } -#if __FreeBSD_version >= 700029 /* * This routine is run via an vlan * config EVENT @@ -3745,12 +3678,15 @@ lem_register_vlan(void *arg, struct ifne if ((vtag == 0) || (vtag > 4095)) /* Invalid ID */ return; + EM_CORE_LOCK(adapter); index = (vtag >> 5) & 0x7F; bit = vtag & 0x1F; - lem_shadow_vfta[index] |= (1 << bit); + adapter->shadow_vfta[index] |= (1 << bit); ++adapter->num_vlans; /* Re-init to load the changes */ - lem_init(adapter); + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + lem_init_locked(adapter); + EM_CORE_UNLOCK(adapter); } /* @@ -3769,12 +3705,15 @@ lem_unregister_vlan(void *arg, struct if if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; + EM_CORE_LOCK(adapter); index = (vtag >> 5) & 0x7F; bit = vtag & 0x1F; - lem_shadow_vfta[index] &= ~(1 << bit); + adapter->shadow_vfta[index] &= ~(1 << bit); --adapter->num_vlans; /* Re-init to load the changes */ - lem_init(adapter); + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + lem_init_locked(adapter); + EM_CORE_UNLOCK(adapter); } static void @@ -3797,9 +3736,9 @@ lem_setup_vlan_hw_support(struct adapter ** we need to repopulate it now. */ for (int i = 0; i < EM_VFTA_SIZE; i++) - if (lem_shadow_vfta[i] != 0) + if (adapter->shadow_vfta[i] != 0) E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, - i, lem_shadow_vfta[i]); + i, adapter->shadow_vfta[i]); reg = E1000_READ_REG(hw, E1000_CTRL); reg |= E1000_CTRL_VME; @@ -3815,7 +3754,6 @@ lem_setup_vlan_hw_support(struct adapter E1000_WRITE_REG(&adapter->hw, E1000_RLPML, adapter->max_frame_size + VLAN_TAG_SIZE); } -#endif static void lem_enable_intr(struct adapter *adapter) @@ -4661,6 +4599,16 @@ lem_add_int_delay_sysctl(struct adapter info, 0, lem_sysctl_int_delay, "I", description); } +static void +lem_set_flow_cntrl(struct adapter *adapter, const char *name, + const char *description, int *limit, int value) +{ + *limit = value; + SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), + OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); +} + #ifndef EM_LEGACY_IRQ static void lem_add_rx_process_limit(struct adapter *adapter, const char *name, @@ -4672,5 +4620,3 @@ lem_add_rx_process_limit(struct adapter OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } #endif - - Modified: head/sys/dev/e1000/if_lem.h ============================================================================== --- head/sys/dev/e1000/if_lem.h Mon Nov 1 20:17:15 2010 (r214645) +++ head/sys/dev/e1000/if_lem.h Mon Nov 1 20:19:25 2010 (r214646) @@ -328,11 +328,9 @@ struct adapter { struct task tx_task; struct taskqueue *tq; /* private task queue */ -#if __FreeBSD_version >= 700029 eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; u32 num_vlans; -#endif /* Management and WOL features */ u32 wol; @@ -341,11 +339,22 @@ struct adapter { /* Multicast array memory */ u8 *mta; - /* Info about the board itself */ + + /* + ** Shadow VFTA table, this is needed because + ** the real vlan filter table gets cleared during + ** a soft reset and the driver needs to be able + ** to repopulate it. + */ + u32 shadow_vfta[EM_VFTA_SIZE]; + + /* Info about the interface */ uint8_t link_active; uint16_t link_speed; uint16_t link_duplex; uint32_t smartspeed; + uint32_t fc_setting; + struct em_int_delay_info tx_int_delay; struct em_int_delay_info tx_abs_int_delay; struct em_int_delay_info rx_int_delay; @@ -407,6 +416,9 @@ struct adapter { unsigned long no_tx_dma_setup; unsigned long watchdog_events; unsigned long rx_overruns; + unsigned long rx_irq; + unsigned long tx_irq; + unsigned long link_irq; /* 82547 workaround */ uint32_t tx_fifo_size; From owner-svn-src-all@FreeBSD.ORG Mon Nov 1 21:04:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD2381065675; Mon, 1 Nov 2010 21:04:23 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B201B8FC29; Mon, 1 Nov 2010 21:04: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 oA1L4NtB089090; Mon, 1 Nov 2010 21:04:23 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA1L4NfX089088; Mon, 1 Nov 2010 21:04:23 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201011012104.oA1L4NfX089088@svn.freebsd.org> From: Olivier Houchard Date: Mon, 1 Nov 2010 21:04: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: r214648 - head/sys/arm/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2010 21:04:24 -0000 Author: cognet Date: Mon Nov 1 21:04:23 2010 New Revision: 214648 URL: http://svn.freebsd.org/changeset/base/214648 Log: Try to be a little smart at guessing where _start is located in flash, instead of relying on a binutils bug. Reported by: dim Modified: head/sys/arm/arm/elf_trampoline.c Modified: head/sys/arm/arm/elf_trampoline.c ============================================================================== --- head/sys/arm/arm/elf_trampoline.c Mon Nov 1 20:20:31 2010 (r214647) +++ head/sys/arm/arm/elf_trampoline.c Mon Nov 1 21:04:23 2010 (r214648) @@ -159,7 +159,7 @@ _startC(void) #if defined(FLASHADDR) && defined(LOADERRAMADDR) unsigned int pc; - __asm __volatile("adr %0, _start\n" + __asm __volatile("mov %0, pc\n" : "=r" (pc)); if ((FLASHADDR > LOADERRAMADDR && pc >= FLASHADDR) || (FLASHADDR < LOADERRAMADDR && pc < LOADERRAMADDR)) { @@ -173,11 +173,13 @@ _startC(void) */ unsigned int target_addr; unsigned int tmp_sp; + uint32_t src_addr = (uint32_t)&_start - PHYSADDR + FLASHADDR + + (pc - FLASHADDR - ((uint32_t)&_startC - PHYSADDR)) & 0xfffff000; target_addr = (unsigned int)&_start - PHYSADDR + LOADERRAMADDR; tmp_sp = target_addr + 0x100000 + (unsigned int)&_end - (unsigned int)&_start; - memcpy((char *)target_addr, (char *)pc, + memcpy((char *)target_addr, (char *)src_addr, (unsigned int)&_end - (unsigned int)&_start); /* Temporary set the sp and jump to the new location. */ __asm __volatile( From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 01:24:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54F5E1065672; Tue, 2 Nov 2010 01:24:50 +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 4315C8FC16; Tue, 2 Nov 2010 01:24: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 oA21OoVD003614; Tue, 2 Nov 2010 01:24:50 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA21OoXf003612; Tue, 2 Nov 2010 01:24:50 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011020124.oA21OoXf003612@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 2 Nov 2010 01:24: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: r214651 - head/contrib/gdb/gdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 01:24:50 -0000 Author: gonzo Date: Tue Nov 2 01:24:49 2010 New Revision: 214651 URL: http://svn.freebsd.org/changeset/base/214651 Log: Fix reading of .debug_line on MIPS64, big-endian: read_initial_length detects pointer size by checking first 4 bytes of .debug_line and stores it in struct comp_unit_head * passed to it as second argument. By passing NULL to a read_initial_length we ignore actual pointer size (8 bytes) and use default (4 bytes) which results in wrong offsets of header fields. Modified: head/contrib/gdb/gdb/dwarf2read.c Modified: head/contrib/gdb/gdb/dwarf2read.c ============================================================================== --- head/contrib/gdb/gdb/dwarf2read.c Mon Nov 1 22:11:18 2010 (r214650) +++ head/contrib/gdb/gdb/dwarf2read.c Tue Nov 2 01:24:49 2010 (r214651) @@ -5178,7 +5178,7 @@ dwarf_decode_line_header (unsigned int o line_ptr = dwarf_line_buffer + offset; /* read in the header */ - lh->total_length = read_initial_length (abfd, line_ptr, NULL, &bytes_read); + lh->total_length = read_initial_length (abfd, line_ptr, &cu->header, &bytes_read); line_ptr += bytes_read; if (line_ptr + lh->total_length > dwarf_line_buffer + dwarf_line_size) { From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 01:26:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD5381065673; Tue, 2 Nov 2010 01:26:21 +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 9B8188FC17; Tue, 2 Nov 2010 01:26: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 oA21QLcA003789; Tue, 2 Nov 2010 01:26:21 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA21QLDD003788; Tue, 2 Nov 2010 01:26:21 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011020126.oA21QLDD003788@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 2 Nov 2010 01:26: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: r214652 - head/contrib/gdb/gdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 01:26:21 -0000 Author: gonzo Date: Tue Nov 2 01:26:21 2010 New Revision: 214652 URL: http://svn.freebsd.org/changeset/base/214652 Log: - Add ELF core for FreeBSD/mips - Register all known cores in init function Modified: head/contrib/gdb/gdb/mipsfbsd-tdep.c Modified: head/contrib/gdb/gdb/mipsfbsd-tdep.c ============================================================================== --- head/contrib/gdb/gdb/mipsfbsd-tdep.c Tue Nov 2 01:24:49 2010 (r214651) +++ head/contrib/gdb/gdb/mipsfbsd-tdep.c Tue Nov 2 01:26:21 2010 (r214652) @@ -187,6 +187,14 @@ static struct core_fns mipsfbsd_core_fns NULL /* next */ }; +static struct core_fns mipsfbsd_elfcore_fns = +{ + bfd_target_elf_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_elfcore_registers, /* core_read_registers */ + NULL /* next */ +}; /* * MIPSFBSD Offsets @@ -576,4 +584,6 @@ _initialize_mipsfbsd_tdep (void) { gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_FREEBSD_ELF, mipsfbsd_init_abi); + add_core_fns (&mipsfbsd_core_fns); + add_core_fns (&mipsfbsd_elfcore_fns); } From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 01:40:59 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1233) id F28F21065670; Tue, 2 Nov 2010 01:40:59 +0000 (UTC) Date: Tue, 2 Nov 2010 01:40:59 +0000 From: Alexander Best To: Ken Smith Message-ID: <20101102014059.GA91353@freebsd.org> References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> <20101031191119.GM46314@acme.spoerlein.net> <1288620951.3596.32.camel@bauer.cse.buffalo.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1288620951.3596.32.camel@bauer.cse.buffalo.edu> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek , Ulrich Spoerlein Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 01:41:00 -0000 On Mon Nov 1 10, Ken Smith wrote: > On Sun, 2010-10-31 at 20:11 +0100, Ulrich Spoerlein wrote: > > On Sun, 31.10.2010 at 17:06:03 +0100, Pawel Jakub Dawidek wrote: > > > On Sun, Oct 31, 2010 at 09:21:28AM +0000, Ulrich Spoerlein wrote: > > > > Author: uqs > > > > Date: Sun Oct 31 09:21:27 2010 > > > > New Revision: 214596 > > > > URL: http://svn.freebsd.org/changeset/base/214596 > > > > > > > > Log: > > > > Elaborate some more on the non-security implications of using -P > > > [...] > > > > +.Pp > > > > +N.B.: The > > > > +.Fl P > > > > +flag is not considered a security feature > > > > +.Pq see Sx BUGS . > > > > > > I'm sorry for jumping so late into the subject, but if it is not a > > > security feature than what other purpose has left? > > > > > > Really guys, this option is useless. > > > > > > There is no reliable way to verify if the blocks are really overwritten. > > > Period. > > > > > > If it is not used for security, then I see no other use for it (except > > > for [1]). > > > > > > If it is used for security then we better have a way to give the user > > > the right answer to the question "is my data really gone?" and don't > > > make false assumptions or giving answers "we hope so". > > > > > > Why there is no reliable way to verify this? > > > 1. Check file system type (UFS, ZFS). > > > 2. Check file system configuration (UFS with snapshots?). > > > 3. Be sure sync(2) the file system and send BIO_FLUSH to all the media > > > involved (some cheap flash disks lie about BIO_FLUSH support). > > > 4. Check underlying media (GLABEL provider - no modification to the data). > > > 5. Check underlying media (ZVOL - data won't be overwritten, but...). > > > 6. Check ZFS vdevs (on which providers ZVOL's pool is based on). > > > 7. Check vdevs (GELI - cool, we have encryption). > > > 8. Check GELI configuration (maybe NULL encryption algorithm?). > > > 9. Check underlying media (HDD, SSD, swap-backed md(4) device? goto 3). > > > 10. Check if the sectors weren't remapped while we were overwriting. > > > > > > In other words this is soooo complicated that it would simply be too > > > hard to explain to regular user or implement in rm(1). > > > > > > IMHO this option should be removed and rm(1) should fail when a user is > > > trying to use it. > > > > No, this is a POLA violation for no apparent gain. The flag has been in > > FreeBSD since at least '94. Remember, that we are in the rope-selling > > business. We empower the users to shoot themselves in the foot. > > Just playing Devils' Advocate... If the removal of -P were done as > part of a new branch the POLA argument is moot if it's judged you > are a bit off on the "no apparent gain" aspect. And the rope selling > argument also only applies so far. One could argue having our installer > by default leave a machine set up so SSH was enabled, remote root logins > were allowed, and no initial password set up for root is fine because > we're in the rope-selling business and for some portion of the user > base that's just fine. I know that's extreme but that's the point, > I'm saying it's hard to figure out exactly where the line is between > activities that are ill-advised versus those that are just plain > stupid sometimes. > > So, please, given all the attention being given to the security aspects > of users properly erasing data they should erase I'd prefer we focus on > whether providing -P at all is flat out lying and base the decision > about whether it should go based on that. Lots of things we thought > were OK back in 1994 we've changed our minds about since then. > > > I, for one, am using the -P option in a certain case where I can be sure > > that ~99% of the data will be obliterated and I'm fine with that. For > > all other cases I'm using geli or gbde (where I can make sure, that data > > is lost). > > This strongly backs up Pawel's argument that the existence of -P is a > lie. > > > So we can either fix -P for all cases (impossible), or at least document > > its shortcomings. Documenting them clearly is better than what we had a > > couple of days before. > > As I said above, with re@ hat on since the claim of POLA above is > slightly based on branch/release guidelines, I think removal of -P > is also still an option if it's decided -P is a lie. how about a compromise then? let's leave the -P switch in rm, but make it a no op! in addition to that add a new rm(1) entry explaining what the -P switch did and why exactly it was turned into a no op. let's be really eloborate on this issue and tell the user exactly every tiny detail that lead to the conclusion that currently the -P switch serves no purpose and thus it was turned into a no op. also a statement should be added to rm(1) that makes clear that the -P flag *will* come back to rm, once the low level work has been finished in order to decide (from userland) whether a specific disk supports overwriting blocks or not. thoughts? cheers. alex > > -- > Ken Smith > - From there to here, from here to | kensmith@buffalo.edu > there, funny things are everywhere. | > - Theodor Geisel | -- a13x From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 02:03:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A71C1065670; Tue, 2 Nov 2010 02:03:11 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 16AB58FC13; Tue, 2 Nov 2010 02:03:09 +0000 (UTC) Received: by wwb17 with SMTP id 17so768379wwb.31 for ; Mon, 01 Nov 2010 19:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=ABPm3U6i6cGxF0o4jGEMuqVGKfC7WCIiE1K0Jqmsp14=; b=VV6RW7eg2slVozkIeKoyI4vIcv6jKkdybzDS5dPbhsjqFj53B1wYC//snpZwpAaGhA hO4V+CaM7iugMNDmcZqZsv34tPAtYuoZsnetLZRMON6h7oET6u9cU0uq1dfZnc7W1OxZ kCWhvAyUdDYso7w4E4hG/n3RNIUHr0xUPCHkk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=VmelnFdPjzjAqmDoyxHFMrDb73brcNztiEyM80VwbQtlBzrM6mz6ehPJi1vBvGgtWB M5WQM8EfstMf+10JOugaN0gm3cf/Tb8tfhOM2VMsIBc7qRqI/f9nuKtHLV8igId4ygp7 mM+2XMXNX9ZWDVFU9bFBTRKuPnIH30QembnO4= MIME-Version: 1.0 Received: by 10.216.82.197 with SMTP id o47mr16417052wee.45.1288663388220; Mon, 01 Nov 2010 19:03:08 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.198.27 with HTTP; Mon, 1 Nov 2010 19:03:07 -0700 (PDT) In-Reply-To: <20101102014059.GA91353@freebsd.org> References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> <20101031191119.GM46314@acme.spoerlein.net> <1288620951.3596.32.camel@bauer.cse.buffalo.edu> <20101102014059.GA91353@freebsd.org> Date: Mon, 1 Nov 2010 19:03:07 -0700 X-Google-Sender-Auth: x_S5RXo13EjqD_cNjdMAj_XdXa0 Message-ID: From: Garrett Cooper To: Alexander Best Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , Ken Smith , svn-src-all@freebsd.org, Ulrich Spoerlein , svn-src-head@freebsd.org Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 02:03:11 -0000 On Mon, Nov 1, 2010 at 6:40 PM, Alexander Best wrote: > On Mon Nov =A01 10, Ken Smith wrote: >> On Sun, 2010-10-31 at 20:11 +0100, Ulrich Spoerlein wrote: >> > On Sun, 31.10.2010 at 17:06:03 +0100, Pawel Jakub Dawidek wrote: >> > > On Sun, Oct 31, 2010 at 09:21:28AM +0000, Ulrich Spoerlein wrote: >> > > > Author: uqs >> > > > Date: Sun Oct 31 09:21:27 2010 >> > > > New Revision: 214596 >> > > > URL: http://svn.freebsd.org/changeset/base/214596 >> > > > >> > > > Log: >> > > > =A0 Elaborate some more on the non-security implications of using = -P >> > > [...] >> > > > +.Pp >> > > > +N.B.: The >> > > > +.Fl P >> > > > +flag is not considered a security feature >> > > > +.Pq see Sx BUGS . >> > > >> > > I'm sorry for jumping so late into the subject, but if it is not a >> > > security feature than what other purpose has left? >> > > >> > > Really guys, this option is useless. >> > > >> > > There is no reliable way to verify if the blocks are really overwrit= ten. >> > > Period. >> > > >> > > If it is not used for security, then I see no other use for it (exce= pt >> > > for [1]). >> > > >> > > If it is used for security then we better have a way to give the use= r >> > > the right answer to the question "is my data really gone?" and don't >> > > make false assumptions or giving answers "we hope so". >> > > >> > > Why there is no reliable way to verify this? >> > > 1. Check file system type (UFS, ZFS). >> > > 2. Check file system configuration (UFS with snapshots?). >> > > 3. Be sure sync(2) the file system and send BIO_FLUSH to all the med= ia >> > > =A0 =A0involved (some cheap flash disks lie about BIO_FLUSH support)= . >> > > 4. Check underlying media (GLABEL provider - no modification to the = data). >> > > 5. Check underlying media (ZVOL - data won't be overwritten, but...)= . >> > > 6. Check ZFS vdevs (on which providers ZVOL's pool is based on). >> > > 7. Check vdevs (GELI - cool, we have encryption). >> > > 8. Check GELI configuration (maybe NULL encryption algorithm?). >> > > 9. Check underlying media (HDD, SSD, swap-backed md(4) device? goto = 3). >> > > 10. Check if the sectors weren't remapped while we were overwriting. >> > > >> > > In other words this is soooo complicated that it would simply be too >> > > hard to explain to regular user or implement in rm(1). >> > > >> > > IMHO this option should be removed and rm(1) should fail when a user= is >> > > trying to use it. >> > >> > No, this is a POLA violation for no apparent gain. The flag has been i= n >> > FreeBSD since at least '94. Remember, that we are in the rope-selling >> > business. We empower the users to shoot themselves in the foot. >> >> Just playing Devils' Advocate... =A0If the removal of -P were done as >> part of a new branch the POLA argument is moot if it's judged you >> are a bit off on the "no apparent gain" aspect. =A0And the rope selling >> argument also only applies so far. =A0One could argue having our install= er >> by default leave a machine set up so SSH was enabled, remote root logins >> were allowed, and no initial password set up for root is fine because >> we're in the rope-selling business and for some portion of the user >> base that's just fine. =A0I know that's extreme but that's the point, >> I'm saying it's hard to figure out exactly where the line is between >> activities that are ill-advised versus those that are just plain >> stupid sometimes. >> >> So, please, given all the attention being given to the security aspects >> of users properly erasing data they should erase I'd prefer we focus on >> whether providing -P at all is flat out lying and base the decision >> about whether it should go based on that. =A0Lots of things we thought >> were OK back in 1994 we've changed our minds about since then. >> >> > I, for one, am using the -P option in a certain case where I can be su= re >> > that ~99% of the data will be obliterated and I'm fine with that. For >> > all other cases I'm using geli or gbde (where I can make sure, that da= ta >> > is lost). >> >> This strongly backs up Pawel's argument that the existence of -P is a >> lie. >> >> > So we can either fix -P for all cases (impossible), or at least docume= nt >> > its shortcomings. Documenting them clearly is better than what we had = a >> > couple of days before. >> >> As I said above, with re@ hat on since the claim of POLA above is >> slightly based on branch/release guidelines, I think removal of -P >> is also still an option if it's decided -P is a lie. > > how about a compromise then? let's leave the -P switch in rm, but make it= a no > op! in addition to that add a new rm(1) entry explaining what the -P swit= ch did > and why exactly it was turned into a no op. let's be really eloborate on = this > issue and tell the user exactly every tiny detail that lead to the conclu= sion > that currently the -P switch serves no purpose and thus it was turned int= o a no > op. also a statement should be added to rm(1) that makes clear that the -= P flag > *will* come back to rm, once the low level work has been finished in orde= r to > decide (from userland) whether a specific disk supports overwriting block= s or > not. I agree with all you said but the "*will* come back to rm" part. I wouldn't open up that particular door unless you were absolutely certain that you could fulfill that commitment. It sounds like with some filesystems that's virtually impossible (like ZFS) because of the way that they're designed (COW snapshots). I could be completely wrong though. Thanks! -Garrett From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 02:13:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F693106564A; Tue, 2 Nov 2010 02:13:13 +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 8D9D68FC0C; Tue, 2 Nov 2010 02:13: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 oA22DDEs007932; Tue, 2 Nov 2010 02:13:13 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA22DDuS007930; Tue, 2 Nov 2010 02:13:13 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201011020213.oA22DDuS007930@svn.freebsd.org> From: David Xu Date: Tue, 2 Nov 2010 02:13: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: r214653 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 02:13:13 -0000 Author: davidxu Date: Tue Nov 2 02:13:13 2010 New Revision: 214653 URL: http://svn.freebsd.org/changeset/base/214653 Log: Use sysctl kern.sched.cpusetsize to retrieve size of kernel cpuset. Modified: head/lib/libthr/thread/thr_attr.c Modified: head/lib/libthr/thread/thr_attr.c ============================================================================== --- head/lib/libthr/thread/thr_attr.c Tue Nov 2 01:26:21 2010 (r214652) +++ head/lib/libthr/thread/thr_attr.c Tue Nov 2 02:13:13 2010 (r214653) @@ -569,14 +569,11 @@ _get_kern_cpuset_size(void) if (kern_cpuset_size == 0) { size_t len; - int maxcpus; - len = sizeof(maxcpus); - if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0)) - PANIC("failed to get sysctl kern.smp.maxcpus"); - int nbits_long = sizeof(long) * NBBY; - int num_long = (maxcpus + nbits_long - 1) / nbits_long; - kern_cpuset_size = num_long * sizeof(long); + len = sizeof(kern_cpuset_size); + if (sysctlbyname("kern.sched.cpusetsize", &kern_cpuset_size, + &len, NULL, 0)) + PANIC("failed to get sysctl kern.sched.cpusetsize"); } return (kern_cpuset_size); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 05:27:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E11D71065674; Tue, 2 Nov 2010 05:27:05 +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 CF8CA8FC12; Tue, 2 Nov 2010 05:27: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 oA25R5f8021629; Tue, 2 Nov 2010 05:27:05 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA25R5mA021627; Tue, 2 Nov 2010 05:27:05 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201011020527.oA25R5mA021627@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 2 Nov 2010 05:27: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: r214654 - head/usr.sbin/config X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 05:27:06 -0000 Author: obrien Date: Tue Nov 2 05:27:05 2010 New Revision: 214654 URL: http://svn.freebsd.org/changeset/base/214654 Log: Give the user a hint as to what config(8) is unhappy with. Modified: head/usr.sbin/config/mkmakefile.c Modified: head/usr.sbin/config/mkmakefile.c ============================================================================== --- head/usr.sbin/config/mkmakefile.c Tue Nov 2 02:13:13 2010 (r214653) +++ head/usr.sbin/config/mkmakefile.c Tue Nov 2 05:27:05 2010 (r214654) @@ -382,8 +382,8 @@ next: mandatory = 1; } else if (!eq(wd, "optional")) { fprintf(stderr, - "%s: %s must be optional, mandatory or standard\n", - fname, this); + "%s: \"%s\" %s must be optional, mandatory or standard\n", + fname, wd, this); exit(1); } nextparam: From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 05:39:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CF7F106564A; Tue, 2 Nov 2010 05:39:58 +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 E4EEA8FC12; Tue, 2 Nov 2010 05:39: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 oA25dvlt022076; Tue, 2 Nov 2010 05:39:57 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA25dvkL022074; Tue, 2 Nov 2010 05:39:57 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201011020539.oA25dvkL022074@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 2 Nov 2010 05:39: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: r214655 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 05:39:58 -0000 Author: obrien Date: Tue Nov 2 05:39:57 2010 New Revision: 214655 URL: http://svn.freebsd.org/changeset/base/214655 Log: Shorten long lines. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Nov 2 05:27:05 2010 (r214654) +++ head/sys/conf/files Tue Nov 2 05:39:57 2010 (r214655) @@ -67,12 +67,12 @@ fdt_static_dtb.h optional fdt fdt_dtb_s compile-with "sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ." \ no-obj no-implicit-rule before-depend \ clean "fdt_static_dtb.h" -p16v-alsa%diked.h optional snd_emu10kx pci \ +p16v-alsa%diked.h optional snd_emu10kx pci \ dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h" \ compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h p16v-alsa%diked.h" \ no-obj no-implicit-rule before-depend \ clean "p16v-alsa%diked.h" -p17v-alsa%diked.h optional snd_emu10kx pci \ +p17v-alsa%diked.h optional snd_emu10kx pci \ dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h" \ compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h p17v-alsa%diked.h" \ no-obj no-implicit-rule before-depend \ @@ -83,12 +83,12 @@ feeder_eq_gen.h optional sound \ no-obj no-implicit-rule before-depend \ clean "feeder_eq_gen.h" feeder_rate_gen.h optional sound \ - dependency "$S/tools/sound/feeder_rate_mkfilter.awk" \ + dependency "$S/tools/sound/feeder_rate_mkfilter.awk" \ compile-with "${AWK} -f $S/tools/sound/feeder_rate_mkfilter.awk -- ${FEEDER_RATE_PRESETS} > feeder_rate_gen.h" \ no-obj no-implicit-rule before-depend \ clean "feeder_rate_gen.h" snd_fxdiv_gen.h optional sound \ - dependency "$S/tools/sound/snd_fxdiv_gen.awk" \ + dependency "$S/tools/sound/snd_fxdiv_gen.awk" \ compile-with "${AWK} -f $S/tools/sound/snd_fxdiv_gen.awk -- > snd_fxdiv_gen.h" \ no-obj no-implicit-rule before-depend \ clean "snd_fxdiv_gen.h" From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 07:56:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0A0D106566B; Tue, 2 Nov 2010 07:56:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD30F8FC0C; Tue, 2 Nov 2010 07:56: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 oA27uK9M027308; Tue, 2 Nov 2010 07:56:20 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA27uKgk027306; Tue, 2 Nov 2010 07:56:20 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011020756.oA27uKgk027306@svn.freebsd.org> From: Andriy Gapon Date: Tue, 2 Nov 2010 07:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214662 - stable/8/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 07:56:20 -0000 Author: avg Date: Tue Nov 2 07:56:20 2010 New Revision: 214662 URL: http://svn.freebsd.org/changeset/base/214662 Log: MFC r213737: acpi_ec: changes in communication with hardware Modified: stable/8/sys/dev/acpica/acpi_ec.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_ec.c Tue Nov 2 07:49:21 2010 (r214661) +++ stable/8/sys/dev/acpica/acpi_ec.c Tue Nov 2 07:56:20 2010 (r214662) @@ -153,7 +153,7 @@ struct acpi_ec_softc { int ec_glkhandle; int ec_burstactive; int ec_sci_pend; - u_int ec_gencount; + volatile u_int ec_gencount; int ec_suspending; }; @@ -165,7 +165,7 @@ struct acpi_ec_softc { #define EC_LOCK_TIMEOUT 1000 /* Default delay in microseconds between each run of the status polling loop. */ -#define EC_POLL_DELAY 5 +#define EC_POLL_DELAY 50 /* Total time in ms spent waiting for a response from EC. */ #define EC_TIMEOUT 750 @@ -600,12 +600,32 @@ acpi_ec_write_method(device_t dev, u_int return (0); } +static ACPI_STATUS +EcCheckStatus(struct acpi_ec_softc *sc, const char *msg, EC_EVENT event) +{ + ACPI_STATUS status; + EC_STATUS ec_status; + + status = AE_NO_HARDWARE_RESPONSE; + ec_status = EC_GET_CSR(sc); + if (sc->ec_burstactive && !(ec_status & EC_FLAG_BURST_MODE)) { + CTR1(KTR_ACPI, "ec burst disabled in waitevent (%s)", msg); + sc->ec_burstactive = FALSE; + } + if (EVENT_READY(event, ec_status)) { + CTR2(KTR_ACPI, "ec %s wait ready, status %#x", msg, ec_status); + status = AE_OK; + } + return (status); +} + static void EcGpeQueryHandler(void *Context) { struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; UINT8 Data; ACPI_STATUS Status; + int retry; char qxx[5]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -626,7 +646,16 @@ EcGpeQueryHandler(void *Context) * that may arise from running the query from causing another query * to be queued, we clear the pending flag only after running it. */ - Status = EcCommand(sc, EC_COMMAND_QUERY); + for (retry = 0; retry < 2; retry++) { + Status = EcCommand(sc, EC_COMMAND_QUERY); + if (ACPI_SUCCESS(Status)) + break; + if (EcCheckStatus(sc, "retr_check", + EC_EVENT_INPUT_BUFFER_EMPTY) == AE_OK) + continue; + else + break; + } sc->ec_sci_pend = FALSE; if (ACPI_FAILURE(Status)) { EcUnlock(sc); @@ -679,7 +708,7 @@ EcGpeHandler(void *Context) * address and then data values.) */ atomic_add_int(&sc->ec_gencount, 1); - wakeup(&sc->ec_gencount); + wakeup(&sc); /* * If the EC_SCI bit of the status register is set, queue a query handler. @@ -790,68 +819,27 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY } static ACPI_STATUS -EcCheckStatus(struct acpi_ec_softc *sc, const char *msg, EC_EVENT event) -{ - ACPI_STATUS status; - EC_STATUS ec_status; - - status = AE_NO_HARDWARE_RESPONSE; - ec_status = EC_GET_CSR(sc); - if (sc->ec_burstactive && !(ec_status & EC_FLAG_BURST_MODE)) { - CTR1(KTR_ACPI, "ec burst disabled in waitevent (%s)", msg); - sc->ec_burstactive = FALSE; - } - if (EVENT_READY(event, ec_status)) { - CTR2(KTR_ACPI, "ec %s wait ready, status %#x", msg, ec_status); - status = AE_OK; - } - return (status); -} - -static ACPI_STATUS EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count) { + static int no_intr = 0; ACPI_STATUS Status; - int count, i, slp_ival; + int count, i, need_poll, slp_ival; ACPI_SERIAL_ASSERT(ec); Status = AE_NO_HARDWARE_RESPONSE; - int need_poll = cold || rebooting || ec_polled_mode || sc->ec_suspending; - /* - * The main CPU should be much faster than the EC. So the status should - * be "not ready" when we start waiting. But if the main CPU is really - * slow, it's possible we see the current "ready" response. Since that - * can't be distinguished from the previous response in polled mode, - * this is a potential issue. We really should have interrupts enabled - * during boot so there is no ambiguity in polled mode. - * - * If this occurs, we add an additional delay before actually entering - * the status checking loop, hopefully to allow the EC to go to work - * and produce a non-stale status. - */ - if (need_poll) { - static int once; - - if (EcCheckStatus(sc, "pre-check", Event) == AE_OK) { - if (!once) { - device_printf(sc->ec_dev, - "warning: EC done before starting event wait\n"); - once = 1; - } - AcpiOsStall(10); - } - } + need_poll = cold || rebooting || ec_polled_mode || sc->ec_suspending; /* Wait for event by polling or GPE (interrupt). */ if (need_poll) { count = (ec_timeout * 1000) / EC_POLL_DELAY; if (count == 0) count = 1; + DELAY(10); for (i = 0; i < count; i++) { Status = EcCheckStatus(sc, "poll", Event); if (Status == AE_OK) break; - AcpiOsStall(EC_POLL_DELAY); + DELAY(EC_POLL_DELAY); } } else { slp_ival = hz / 1000; @@ -870,34 +858,37 @@ EcWaitEvent(struct acpi_ec_softc *sc, EC * EC query). */ for (i = 0; i < count; i++) { - if (gen_count != sc->ec_gencount) { - /* - * Record new generation count. It's possible the GPE was - * just to notify us that a query is needed and we need to - * wait for a second GPE to signal the completion of the - * event we are actually waiting for. - */ - gen_count = sc->ec_gencount; - Status = EcCheckStatus(sc, "sleep", Event); - if (Status == AE_OK) - break; + if (gen_count == sc->ec_gencount) + tsleep(&sc, 0, "ecgpe", slp_ival); + /* + * Record new generation count. It's possible the GPE was + * just to notify us that a query is needed and we need to + * wait for a second GPE to signal the completion of the + * event we are actually waiting for. + */ + Status = EcCheckStatus(sc, "sleep", Event); + if (Status == AE_OK) { + if (gen_count == sc->ec_gencount) + no_intr++; + else + no_intr = 0; + break; } - tsleep(&sc->ec_gencount, PZERO, "ecgpe", slp_ival); + gen_count = sc->ec_gencount; } /* * We finished waiting for the GPE and it never arrived. Try to * read the register once and trust whatever value we got. This is - * the best we can do at this point. Then, force polled mode on - * since this system doesn't appear to generate GPEs. + * the best we can do at this point. */ - if (Status != AE_OK) { + if (Status != AE_OK) Status = EcCheckStatus(sc, "sleep_end", Event); - device_printf(sc->ec_dev, - "wait timed out (%sresponse), forcing polled mode\n", - Status == AE_OK ? "" : "no "); - ec_polled_mode = TRUE; - } + } + if (!need_poll && no_intr > 10) { + device_printf(sc->ec_dev, + "not getting interrupts, switched to polled mode\n"); + ec_polled_mode = 1; } if (Status != AE_OK) CTR0(KTR_ACPI, "error: ec wait timed out"); @@ -934,6 +925,14 @@ EcCommand(struct acpi_ec_softc *sc, EC_C return (AE_BAD_PARAMETER); } + /* + * Ensure empty input buffer before issuing command. + * Use generation count of zero to force a quick check. + */ + status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, 0); + if (ACPI_FAILURE(status)) + return (status); + /* Run the command and wait for the chosen event. */ CTR1(KTR_ACPI, "ec running command %#x", cmd); gen_count = sc->ec_gencount; @@ -956,24 +955,31 @@ EcRead(struct acpi_ec_softc *sc, UINT8 A { ACPI_STATUS status; u_int gen_count; + int retry; ACPI_SERIAL_ASSERT(ec); CTR1(KTR_ACPI, "ec read from %#x", Address); - status = EcCommand(sc, EC_COMMAND_READ); - if (ACPI_FAILURE(status)) - return (status); + for (retry = 0; retry < 2; retry++) { + status = EcCommand(sc, EC_COMMAND_READ); + if (ACPI_FAILURE(status)) + return (status); - gen_count = sc->ec_gencount; - EC_SET_DATA(sc, Address); - status = EcWaitEvent(sc, EC_EVENT_OUTPUT_BUFFER_FULL, gen_count); - if (ACPI_FAILURE(status)) { - device_printf(sc->ec_dev, "EcRead: failed waiting to get data\n"); - return (status); + gen_count = sc->ec_gencount; + EC_SET_DATA(sc, Address); + status = EcWaitEvent(sc, EC_EVENT_OUTPUT_BUFFER_FULL, gen_count); + if (ACPI_FAILURE(status)) { + if (EcCheckStatus(sc, "retr_check", + EC_EVENT_INPUT_BUFFER_EMPTY) == AE_OK) + continue; + else + break; + } + *Data = EC_GET_DATA(sc); + return (AE_OK); } - *Data = EC_GET_DATA(sc); - - return (AE_OK); + device_printf(sc->ec_dev, "EcRead: failed waiting to get data\n"); + return (status); } static ACPI_STATUS @@ -993,7 +999,7 @@ EcWrite(struct acpi_ec_softc *sc, UINT8 EC_SET_DATA(sc, Address); status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, gen_count); if (ACPI_FAILURE(status)) { - device_printf(sc->ec_dev, "EcRead: failed waiting for sent address\n"); + device_printf(sc->ec_dev, "EcWrite: failed waiting for sent address\n"); return (status); } From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 09:01:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCC2F1065670; Tue, 2 Nov 2010 09:01:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA13E8FC08; Tue, 2 Nov 2010 09:01:08 +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 oA29182p031010; Tue, 2 Nov 2010 09:01:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2918g9031007; Tue, 2 Nov 2010 09:01:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011020901.oA2918g9031007@svn.freebsd.org> From: Alexander Motin Date: Tue, 2 Nov 2010 09:01:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214664 - in stable/8/sys/dev: ahci siis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 09:01:08 -0000 Author: mav Date: Tue Nov 2 09:01:08 2010 New Revision: 214664 URL: http://svn.freebsd.org/changeset/base/214664 Log: MFC r214325: Add missing mtx_destroy() on channel attach failure. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/siis/siis.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Nov 2 08:08:37 2010 (r214663) +++ stable/8/sys/dev/ahci/ahci.c Tue Nov 2 09:01:08 2010 (r214664) @@ -963,6 +963,7 @@ err1: err0: bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); mtx_unlock(&ch->mtx); + mtx_destroy(&ch->mtx); return (error); } Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Nov 2 08:08:37 2010 (r214663) +++ stable/8/sys/dev/siis/siis.c Tue Nov 2 09:01:08 2010 (r214664) @@ -527,6 +527,7 @@ err1: err0: bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); mtx_unlock(&ch->mtx); + mtx_destroy(&ch->mtx); return (error); } From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 09:04:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FC7E106566C; Tue, 2 Nov 2010 09:04:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B9F08FC16; Tue, 2 Nov 2010 09:04: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 oA294Jb4031328; Tue, 2 Nov 2010 09:04:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA294JWh031324; Tue, 2 Nov 2010 09:04:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011020904.oA294JWh031324@svn.freebsd.org> From: Alexander Motin Date: Tue, 2 Nov 2010 09:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214665 - stable/8/sys/dev/mvs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 09:04:19 -0000 Author: mav Date: Tue Nov 2 09:04:18 2010 New Revision: 214665 URL: http://svn.freebsd.org/changeset/base/214665 Log: MFC r214099: Some mvs(4) style cleanup: - remove commented debugging code; - wrap long lines. Modified: stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/mvs/mvs_pci.c stable/8/sys/dev/mvs/mvs_soc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Tue Nov 2 09:01:08 2010 (r214664) +++ stable/8/sys/dev/mvs/mvs.c Tue Nov 2 09:04:18 2010 (r214665) @@ -56,7 +56,8 @@ static int mvs_ch_deinit(device_t dev); static int mvs_ch_suspend(device_t dev); static int mvs_ch_resume(device_t dev); static void mvs_dmainit(device_t dev); -static void mvs_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); +static void mvs_dmasetupc_cb(void *xsc, + bus_dma_segment_t *segs, int nsegs, int error); static void mvs_dmafini(device_t dev); static void mvs_slotsalloc(device_t dev); static void mvs_slotsfree(device_t dev); @@ -78,7 +79,8 @@ static void mvs_crbq_intr(device_t dev); static void mvs_begin_transaction(device_t dev, union ccb *ccb); static void mvs_legacy_execute_transaction(struct mvs_slot *slot); static void mvs_timeout(struct mvs_slot *slot); -static void mvs_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int error); +static void mvs_dmasetprd(void *arg, + bus_dma_segment_t *segs, int nsegs, int error); static void mvs_requeue_frozen(device_t dev); static void mvs_execute_transaction(struct mvs_slot *slot); static void mvs_end_transaction(struct mvs_slot *slot, enum mvs_err_type et); @@ -313,9 +315,11 @@ mvs_dmainit(device_t dev) if (bus_dmamem_alloc(ch->dma.workrq_tag, (void **)&ch->dma.workrq, 0, &ch->dma.workrq_map)) goto error; - if (bus_dmamap_load(ch->dma.workrq_tag, ch->dma.workrq_map, ch->dma.workrq, - MVS_WORKRQ_SIZE, mvs_dmasetupc_cb, &dcba, 0) || dcba.error) { - bus_dmamem_free(ch->dma.workrq_tag, ch->dma.workrq, ch->dma.workrq_map); + if (bus_dmamap_load(ch->dma.workrq_tag, ch->dma.workrq_map, + ch->dma.workrq, MVS_WORKRQ_SIZE, mvs_dmasetupc_cb, &dcba, 0) || + dcba.error) { + bus_dmamem_free(ch->dma.workrq_tag, + ch->dma.workrq, ch->dma.workrq_map); goto error; } ch->dma.workrq_bus = dcba.maddr; @@ -328,9 +332,11 @@ mvs_dmainit(device_t dev) if (bus_dmamem_alloc(ch->dma.workrp_tag, (void **)&ch->dma.workrp, 0, &ch->dma.workrp_map)) goto error; - if (bus_dmamap_load(ch->dma.workrp_tag, ch->dma.workrp_map, ch->dma.workrp, - MVS_WORKRP_SIZE, mvs_dmasetupc_cb, &dcba, 0) || dcba.error) { - bus_dmamem_free(ch->dma.workrp_tag, ch->dma.workrp, ch->dma.workrp_map); + if (bus_dmamap_load(ch->dma.workrp_tag, ch->dma.workrp_map, + ch->dma.workrp, MVS_WORKRP_SIZE, mvs_dmasetupc_cb, &dcba, 0) || + dcba.error) { + bus_dmamem_free(ch->dma.workrp_tag, + ch->dma.workrp, ch->dma.workrp_map); goto error; } ch->dma.workrp_bus = dcba.maddr; @@ -370,7 +376,8 @@ mvs_dmafini(device_t dev) } if (ch->dma.workrp_bus) { bus_dmamap_unload(ch->dma.workrp_tag, ch->dma.workrp_map); - bus_dmamem_free(ch->dma.workrp_tag, ch->dma.workrp, ch->dma.workrp_map); + bus_dmamem_free(ch->dma.workrp_tag, + ch->dma.workrp, ch->dma.workrp_map); ch->dma.workrp_bus = 0; ch->dma.workrp_map = NULL; ch->dma.workrp = NULL; @@ -381,7 +388,8 @@ mvs_dmafini(device_t dev) } if (ch->dma.workrq_bus) { bus_dmamap_unload(ch->dma.workrq_tag, ch->dma.workrq_map); - bus_dmamem_free(ch->dma.workrq_tag, ch->dma.workrq, ch->dma.workrq_map); + bus_dmamem_free(ch->dma.workrq_tag, + ch->dma.workrq, ch->dma.workrq_map); ch->dma.workrq_bus = 0; ch->dma.workrq_map = NULL; ch->dma.workrq = NULL; @@ -443,14 +451,16 @@ mvs_setup_edma_queues(device_t dev) ATA_OUTL(ch->r_mem, EDMA_REQQBAH, work >> 32); ATA_OUTL(ch->r_mem, EDMA_REQQIP, work & 0xffffffff); ATA_OUTL(ch->r_mem, EDMA_REQQOP, work & 0xffffffff); - bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, + BUS_DMASYNC_PREWRITE); /* Reponses queue. */ bzero(ch->dma.workrp, 256); work = ch->dma.workrp_bus; ATA_OUTL(ch->r_mem, EDMA_RESQBAH, work >> 32); ATA_OUTL(ch->r_mem, EDMA_RESQIP, work & 0xffffffff); ATA_OUTL(ch->r_mem, EDMA_RESQOP, work & 0xffffffff); - bus_dmamap_sync(ch->dma.workrp_tag, ch->dma.workrp_map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(ch->dma.workrp_tag, ch->dma.workrp_map, + BUS_DMASYNC_PREREAD); ch->out_idx = 0; ch->in_idx = 0; } @@ -677,20 +687,15 @@ mvs_ch_intr(void *data) int i, ccs, port = -1, selfdis = 0; int edma = (ch->numtslots != 0 || ch->numdslots != 0); -//device_printf(dev, "irq cause %02x EDMA %d IEC %08x\n", -// arg->cause, edma, ATA_INL(ch->r_mem, EDMA_IEC)); /* New item in response queue. */ if ((arg->cause & 2) && edma) mvs_crbq_intr(dev); /* Some error or special event. */ if (arg->cause & 1) { iec = ATA_INL(ch->r_mem, EDMA_IEC); -//device_printf(dev, "irq cause %02x EDMA %d IEC %08x\n", -// arg->cause, edma, iec); if (iec & EDMA_IE_SERRINT) { serr = ATA_INL(ch->r_mem, SATA_SE); ATA_OUTL(ch->r_mem, SATA_SE, serr); -//device_printf(dev, "SERR %08x\n", serr); } /* EDMA self-disabled due to error. */ if (iec & EDMA_IE_ESELFDIS) @@ -705,7 +710,6 @@ mvs_ch_intr(void *data) fisic = SATA_FISC_FISWAIT4HOSTRDYEN_B1; else /* For Gen-IIe - read FIS interrupt cause. */ fisic = ATA_INL(ch->r_mem, SATA_FISIC); -//device_printf(dev, "FISIC %08x\n", fisic); } if (selfdis) ch->curr_mode = MVS_EDMA_UNKNOWN; @@ -744,7 +748,6 @@ mvs_ch_intr(void *data) } } } -//device_printf(dev, "err slot %d port %d\n", ccs, port); mvs_requeue_frozen(dev); for (i = 0; i < MVS_MAX_SLOTS; i++) { /* XXX: reqests in loading state. */ @@ -770,7 +773,8 @@ mvs_ch_intr(void *data) ch->fatalerr = 1; } } else if (iec & 0xfc1e9000) { - if (ch->numtslots == 0 && i != ccs && port != -2) + if (ch->numtslots == 0 && + i != ccs && port != -2) et = MVS_ERR_INNOCENT; else et = MVS_ERR_SATA; @@ -822,8 +826,6 @@ mvs_legacy_intr(device_t dev) /* Clear interrupt and get status. */ status = mvs_getstatus(dev, 1); -// device_printf(dev, "Legacy intr status %02x\n", -// status); if (slot->state < MVS_SLOT_RUNNING) return; port = ccb->ccb_h.target_id & 0x0f; @@ -866,7 +868,8 @@ mvs_legacy_intr(device_t dev) /* If data write command - put them */ if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { if (mvs_wait(dev, ATA_S_DRQ, ATA_S_BUSY, 1000) < 0) { - device_printf(dev, "timeout waiting for write DRQ\n"); + device_printf(dev, + "timeout waiting for write DRQ\n"); et = MVS_ERR_TIMEOUT; goto end_finished; } @@ -889,19 +892,18 @@ mvs_legacy_intr(device_t dev) ATA_OUTL(ch->r_mem, DMA_C, 0); goto end_finished; } else { /* ATAPI PIO */ - length = ATA_INB(ch->r_mem,ATA_CYL_LSB) | (ATA_INB(ch->r_mem,ATA_CYL_MSB) << 8); + length = ATA_INB(ch->r_mem,ATA_CYL_LSB) | + (ATA_INB(ch->r_mem,ATA_CYL_MSB) << 8); ireason = ATA_INB(ch->r_mem,ATA_IREASON); -//device_printf(dev, "status %02x, ireason %02x, length %d\n", status, ireason, length); switch ((ireason & (ATA_I_CMD | ATA_I_IN)) | (status & ATA_S_DRQ)) { case ATAPI_P_CMDOUT: -device_printf(dev, "ATAPI CMDOUT\n"); + device_printf(dev, "ATAPI CMDOUT\n"); /* Return wait for interrupt */ return; case ATAPI_P_WRITE: -//device_printf(dev, "ATAPI WRITE\n"); if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { device_printf(dev, "trying to write on read buffer\n"); et = MVS_ERR_TFE; @@ -919,7 +921,6 @@ device_printf(dev, "ATAPI CMDOUT\n"); return; case ATAPI_P_READ: -//device_printf(dev, "ATAPI READ\n"); if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { device_printf(dev, "trying to read on write buffer\n"); et = MVS_ERR_TFE; @@ -936,7 +937,6 @@ device_printf(dev, "ATAPI CMDOUT\n"); return; case ATAPI_P_DONEDRQ: -device_printf(dev, "ATAPI DONEDRQ\n"); device_printf(dev, "WARNING - DONEDRQ non conformant device\n"); if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { @@ -957,13 +957,13 @@ device_printf(dev, "ATAPI DONEDRQ\n"); case ATAPI_P_ABORT: case ATAPI_P_DONE: -//device_printf(dev, "ATAPI ABORT/DONE\n"); if (status & (ATA_S_ERROR | ATA_S_DWF)) et = MVS_ERR_TFE; goto end_finished; default: - device_printf(dev, "unknown transfer phase (status %02x, ireason %02x)\n", + device_printf(dev, "unknown transfer phase" + " (status %02x, ireason %02x)\n", status, ireason); et = MVS_ERR_TFE; } @@ -1265,8 +1265,6 @@ mvs_legacy_execute_transaction(struct mv ch->rslots |= (1 << slot->slot); ATA_OUTB(ch->r_mem, SATA_SATAICTL, port << SATA_SATAICTL_PMPTX_SHIFT); if (ccb->ccb_h.func_code == XPT_ATA_IO) { -// device_printf(dev, "%d Legacy command %02x size %d\n", -// port, ccb->ataio.cmd.command, ccb->ataio.dxfer_len); mvs_tfd_write(dev, ccb); /* Device reset doesn't interrupt. */ if (ccb->ataio.cmd.command == ATA_DEVICE_RESET) { @@ -1286,7 +1284,8 @@ mvs_legacy_execute_transaction(struct mv /* If data write command - output the data */ if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { if (mvs_wait(dev, ATA_S_DRQ, ATA_S_BUSY, 1000) < 0) { - device_printf(dev, "timeout waiting for write DRQ\n"); + device_printf(dev, + "timeout waiting for write DRQ\n"); mvs_end_transaction(slot, MVS_ERR_TIMEOUT); return; } @@ -1295,9 +1294,6 @@ mvs_legacy_execute_transaction(struct mv ch->transfersize / 2); } } else { -// device_printf(dev, "%d ATAPI command %02x size %d dma %d\n", -// port, ccb->csio.cdb_io.cdb_bytes[0], ccb->csio.dxfer_len, -// ch->basic_dma); ch->donecount = 0; ch->transfersize = min(ccb->csio.dxfer_len, ch->curr[port].bytecount); @@ -1330,7 +1326,8 @@ mvs_legacy_execute_transaction(struct mv DELAY(20); } if (timeout <= 0) { - device_printf(dev, "timeout waiting for ATAPI command ready\n"); + device_printf(dev, + "timeout waiting for ATAPI command ready\n"); mvs_end_transaction(slot, MVS_ERR_TIMEOUT); return; } @@ -1370,8 +1367,6 @@ mvs_execute_transaction(struct mvs_slot int port = ccb->ccb_h.target_id & 0x0f; int i; -// device_printf(dev, "%d EDMA command %02x size %d slot %d tag %d\n", -// port, ccb->ataio.cmd.command, ccb->ataio.dxfer_len, slot->slot, slot->tag); /* Get address of the prepared EPRD */ eprd = ch->dma.workrq_bus + MVS_EPRD_OFFSET + (MVS_EPRD_SIZE * slot->slot); /* Prepare CRQB. Gen IIe uses different CRQB format. */ @@ -1553,7 +1548,6 @@ mvs_end_transaction(struct mvs_slot *slo union ccb *ccb = slot->ccb; int lastto; -//device_printf(dev, "cmd done status %d\n", et); bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, BUS_DMASYNC_POSTWRITE); /* Read result registers to the result struct @@ -1791,7 +1785,8 @@ mvs_process_read_log(device_t dev, union if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) device_printf(dev, "Error while READ LOG EXT\n"); else if ((data[0] & 0x80) == 0) { - device_printf(dev, "Non-queued command error in READ LOG EXT\n"); + device_printf(dev, + "Non-queued command error in READ LOG EXT\n"); } for (i = 0; i < MVS_MAX_SLOTS; i++) { if (!ch->hold[i]) Modified: stable/8/sys/dev/mvs/mvs_pci.c ============================================================================== --- stable/8/sys/dev/mvs/mvs_pci.c Tue Nov 2 09:01:08 2010 (r214664) +++ stable/8/sys/dev/mvs/mvs_pci.c Tue Nov 2 09:04:18 2010 (r214665) @@ -339,7 +339,6 @@ mvs_intr(void *data) u_int32_t ic, aic; ic = ATA_INL(ctlr->r_mem, CHIP_MIC); -//device_printf(ctlr->dev, "irq MIC:%08x\n", ic); if (ctlr->msi) { /* We have to to mask MSI during processing. */ mtx_lock(&ctlr->mtx); Modified: stable/8/sys/dev/mvs/mvs_soc.c ============================================================================== --- stable/8/sys/dev/mvs/mvs_soc.c Tue Nov 2 09:01:08 2010 (r214664) +++ stable/8/sys/dev/mvs/mvs_soc.c Tue Nov 2 09:04:18 2010 (r214665) @@ -295,7 +295,6 @@ mvs_intr(void *data) u_int32_t ic, aic; ic = ATA_INL(ctlr->r_mem, CHIP_SOC_MIC); -//device_printf(ctlr->dev, "irq MIC:%08x\n", ic); if ((ic & IC_HC0) == 0) return; /* Acknowledge interrupts of this HC. */ From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 09:05:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4584106566B; Tue, 2 Nov 2010 09:05:40 +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 A19828FC12; Tue, 2 Nov 2010 09:05: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 oA295ePW031505; Tue, 2 Nov 2010 09:05:40 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA295ear031503; Tue, 2 Nov 2010 09:05:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011020905.oA295ear031503@svn.freebsd.org> From: Alexander Motin Date: Tue, 2 Nov 2010 09:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214666 - stable/8/sys/dev/mvs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 09:05:40 -0000 Author: mav Date: Tue Nov 2 09:05:40 2010 New Revision: 214666 URL: http://svn.freebsd.org/changeset/base/214666 Log: MFC r214102: Workaround strange situation when EDMA_RESQIP register returns zero instead of proper value. It caused bunch of "EMPTY CRPB" messages and potentially may cause premature requests completion, which could cause data corruption. For most cases it seems enough to just reread register to get proper value. To protect against worse cases - erase processed queue entries with impossible values and ignore them if problem still happen. Modified: stable/8/sys/dev/mvs/mvs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Tue Nov 2 09:04:18 2010 (r214665) +++ stable/8/sys/dev/mvs/mvs.c Tue Nov 2 09:05:40 2010 (r214666) @@ -454,7 +454,7 @@ mvs_setup_edma_queues(device_t dev) bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, BUS_DMASYNC_PREWRITE); /* Reponses queue. */ - bzero(ch->dma.workrp, 256); + memset(ch->dma.workrp, 0xff, MVS_WORKRP_SIZE); work = ch->dma.workrp_bus; ATA_OUTL(ch->r_mem, EDMA_RESQBAH, work >> 32); ATA_OUTL(ch->r_mem, EDMA_RESQIP, work & 0xffffffff); @@ -979,38 +979,54 @@ mvs_crbq_intr(device_t dev) struct mvs_channel *ch = device_get_softc(dev); struct mvs_crpb *crpb; union ccb *ccb; - int in_idx, cin_idx, slot; + int in_idx, fin_idx, cin_idx, slot; + uint32_t val; uint16_t flags; - in_idx = (ATA_INL(ch->r_mem, EDMA_RESQIP) & EDMA_RESQP_ERPQP_MASK) >> + val = ATA_INL(ch->r_mem, EDMA_RESQIP); + if (val == 0) + val = ATA_INL(ch->r_mem, EDMA_RESQIP); + in_idx = (val & EDMA_RESQP_ERPQP_MASK) >> EDMA_RESQP_ERPQP_SHIFT; bus_dmamap_sync(ch->dma.workrp_tag, ch->dma.workrp_map, BUS_DMASYNC_POSTREAD); - cin_idx = ch->in_idx; + fin_idx = cin_idx = ch->in_idx; ch->in_idx = in_idx; while (in_idx != cin_idx) { crpb = (struct mvs_crpb *) - (ch->dma.workrp + MVS_CRPB_OFFSET + (MVS_CRPB_SIZE * cin_idx)); + (ch->dma.workrp + MVS_CRPB_OFFSET + + (MVS_CRPB_SIZE * cin_idx)); slot = le16toh(crpb->id) & MVS_CRPB_TAG_MASK; flags = le16toh(crpb->rspflg); -//device_printf(dev, "CRPB %d %d %04x\n", cin_idx, slot, flags); /* * Handle only successfull completions here. * Errors will be handled by main intr handler. */ - if (ch->numtslots != 0 || (flags & EDMA_IE_EDEVERR) == 0) { -if ((flags >> 8) & ATA_S_ERROR) -device_printf(dev, "ERROR STATUS CRPB %d %d %04x\n", cin_idx, slot, flags); + if (crpb->id == 0xffff && crpb->rspflg == 0xffff) { + device_printf(dev, "Unfilled CRPB " + "%d (%d->%d) tag %d flags %04x rs %08x\n", + cin_idx, fin_idx, in_idx, slot, flags, ch->rslots); + } else if (ch->numtslots != 0 || + (flags & EDMA_IE_EDEVERR) == 0) { + crpb->id = 0xffff; + crpb->rspflg = 0xffff; if (ch->slot[slot].state >= MVS_SLOT_RUNNING) { ccb = ch->slot[slot].ccb; - ccb->ataio.res.status = (flags & MVS_CRPB_ATASTS_MASK) >> + ccb->ataio.res.status = + (flags & MVS_CRPB_ATASTS_MASK) >> MVS_CRPB_ATASTS_SHIFT; mvs_end_transaction(&ch->slot[slot], MVS_ERR_NONE); - } else -device_printf(dev, "EMPTY CRPB %d (->%d) %d %04x\n", cin_idx, in_idx, slot, flags); - } else -device_printf(dev, "ERROR FLAGS CRPB %d %d %04x\n", cin_idx, slot, flags); - + } else { + device_printf(dev, "Unused tag in CRPB " + "%d (%d->%d) tag %d flags %04x rs %08x\n", + cin_idx, fin_idx, in_idx, slot, flags, + ch->rslots); + } + } else { + device_printf(dev, + "CRPB with error %d tag %d flags %04x\n", + cin_idx, slot, flags); + } cin_idx = (cin_idx + 1) & (MVS_MAX_SLOTS - 1); } bus_dmamap_sync(ch->dma.workrp_tag, ch->dma.workrp_map, From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 09:13:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 482371065714; Tue, 2 Nov 2010 09:13:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 354D18FC08; Tue, 2 Nov 2010 09:13: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 oA29DEiO032154; Tue, 2 Nov 2010 09:13:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA29DE5H032152; Tue, 2 Nov 2010 09:13:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011020913.oA29DE5H032152@svn.freebsd.org> From: Alexander Motin Date: Tue, 2 Nov 2010 09:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214667 - stable/8/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 09:13:14 -0000 Author: mav Date: Tue Nov 2 09:13:13 2010 New Revision: 214667 URL: http://svn.freebsd.org/changeset/base/214667 Log: MFC r213047 by jchandra: Add missing byteswap, works on big endian systems now (tested on Netlogic XLS MIPS processor). Modified: stable/8/sys/dev/ata/chipsets/ata-siliconimage.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-siliconimage.c Tue Nov 2 09:05:40 2010 (r214666) +++ stable/8/sys/dev/ata/chipsets/ata-siliconimage.c Tue Nov 2 09:13:13 2010 (r214667) @@ -649,7 +649,7 @@ ata_siiprb_end_transaction(struct ata_re /* update progress */ if (!(request->status & ATA_S_ERROR) && !(request->flags & ATA_R_TIMEOUT)) { if (request->flags & ATA_R_READ) - request->donecount = prb->transfer_count; + request->donecount = le32toh(prb->transfer_count); else request->donecount = request->bytecount; } From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 09:14:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F2001065672; Tue, 2 Nov 2010 09:14:04 +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 8CC298FC20; Tue, 2 Nov 2010 09:14: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 oA29E4fR032264; Tue, 2 Nov 2010 09:14:04 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA29E4O6032262; Tue, 2 Nov 2010 09:14:04 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011020914.oA29E4O6032262@svn.freebsd.org> From: Alexander Motin Date: Tue, 2 Nov 2010 09:14:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214668 - stable/8/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 09:14:04 -0000 Author: mav Date: Tue Nov 2 09:14:04 2010 New Revision: 214668 URL: http://svn.freebsd.org/changeset/base/214668 Log: MFC r213092: Add missing le32toh(), same as recently done in ata-siliconimage.c. Modified: stable/8/sys/dev/ata/chipsets/ata-ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-ahci.c Tue Nov 2 09:13:13 2010 (r214667) +++ stable/8/sys/dev/ata/chipsets/ata-ahci.c Tue Nov 2 09:14:04 2010 (r214668) @@ -563,7 +563,7 @@ ata_ahci_end_transaction(struct ata_requ /* record how much data we actually moved */ clp = (struct ata_ahci_cmd_list *) (ch->dma.work + ATA_AHCI_CL_OFFSET); - request->donecount = clp->bytecount; + request->donecount = le32toh(clp->bytecount); /* release SG list etc */ ch->dma.unload(request); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 09:15:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28FDC106564A; Tue, 2 Nov 2010 09:15:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 165E28FC17; Tue, 2 Nov 2010 09:15:28 +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 oA29FRYL032384; Tue, 2 Nov 2010 09:15:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA29FR4g032382; Tue, 2 Nov 2010 09:15:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011020915.oA29FR4g032382@svn.freebsd.org> From: Alexander Motin Date: Tue, 2 Nov 2010 09:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214669 - stable/8/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 09:15:28 -0000 Author: mav Date: Tue Nov 2 09:15:27 2010 New Revision: 214669 URL: http://svn.freebsd.org/changeset/base/214669 Log: MFC r213301: Revert r132291. Restore setting PIO/WDMA timings for VIA UDMA133 controllers. Linux disables only AST register writing there, but no all timings. Modified: stable/8/sys/dev/ata/chipsets/ata-via.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ata/chipsets/ata-via.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-via.c Tue Nov 2 09:14:04 2010 (r214668) +++ stable/8/sys/dev/ata/chipsets/ata-via.c Tue Nov 2 09:15:27 2010 (r214669) @@ -352,8 +352,7 @@ ata_via_old_setmode(device_t dev, int ta piomode = mode; } /* Set WDMA/PIO timings */ - if (ctlr->chip->cfg1 != VIA133) - pci_write_config(parent, reg - 0x08,timings[ata_mode2idx(piomode)], 1); + pci_write_config(parent, reg - 0x08,timings[ata_mode2idx(piomode)], 1); return (mode); } From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 09:26:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89082106566B; Tue, 2 Nov 2010 09:26:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 748388FC14; Tue, 2 Nov 2010 09:26: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 oA29QCVJ032819; Tue, 2 Nov 2010 09:26:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA29QCGh032806; Tue, 2 Nov 2010 09:26:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011020926.oA29QCGh032806@svn.freebsd.org> From: Alexander Motin Date: Tue, 2 Nov 2010 09:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214671 - in stable/8/sys: arm/mv dev/ata dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 09:26:12 -0000 Author: mav Date: Tue Nov 2 09:26:12 2010 New Revision: 214671 URL: http://svn.freebsd.org/changeset/base/214671 Log: MFC r214016: Set of legacy mode SATA enchancements: - Implement proper combined mode decoding for Intel controllers to properly identify SATA and PATA channels and associate ATA channels with SATA ports. This fixes wrong reporting and in some cases hard resets to wrong SATA ports. - Improve SATA registers support to handle hot-plug events and potentially interface errors. For ICH5/6300ESB chipsets these registers accessible via PCI config space. For later ones they may be accessible via PCI BAR(5). - For controllers not generating interrupts on hot-plug events, implement periodic status polling. Use it to detect hot-plug on Intel and VIA controllers. Same probably could also be used for Serverworks and SIS. Modified: stable/8/sys/arm/mv/mv_sata.c stable/8/sys/dev/ata/ata-all.c stable/8/sys/dev/ata/ata-all.h stable/8/sys/dev/ata/ata-pci.c stable/8/sys/dev/ata/ata-sata.c stable/8/sys/dev/ata/chipsets/ata-ahci.c stable/8/sys/dev/ata/chipsets/ata-intel.c stable/8/sys/dev/ata/chipsets/ata-marvell.c stable/8/sys/dev/ata/chipsets/ata-nvidia.c stable/8/sys/dev/ata/chipsets/ata-promise.c stable/8/sys/dev/ata/chipsets/ata-siliconimage.c stable/8/sys/dev/ata/chipsets/ata-via.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/arm/mv/mv_sata.c ============================================================================== --- stable/8/sys/arm/mv/mv_sata.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/arm/mv/mv_sata.c Tue Nov 2 09:26:12 2010 (r214671) @@ -709,7 +709,7 @@ sata_channel_status(device_t dev) if ((icr & SATA_ICR_DEV(ch->unit)) || iecr) { /* Disable EDMA before accessing SATA registers */ sata_edma_ctrl(dev, 0); - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* Ack device and error interrupt */ SATA_OUTL(sc, SATA_ICR, ~SATA_ICR_DEV(ch->unit)); Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/ata-all.c Tue Nov 2 09:26:12 2010 (r214671) @@ -82,6 +82,7 @@ static void bswap(int8_t *, int); static void btrim(int8_t *, int); static void bpack(int8_t *, int8_t *, int); static void ata_interrupt_locked(void *data); +static void ata_periodic_poll(void *data); /* global vars */ MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer"); @@ -172,6 +173,7 @@ ata_attach(device_t dev) ch->curr[i] = ch->user[i]; } #endif + callout_init(&ch->poll_callout, 1); /* reset the controller HW, the channel and device(s) */ while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit) @@ -199,6 +201,8 @@ ata_attach(device_t dev) device_printf(dev, "unable to setup interrupt\n"); return error; } + if (ch->flags & ATA_PERIODIC_POLL) + callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); #ifndef ATA_CAM /* probe and attach devices on this channel unless we are in early boot */ @@ -245,6 +249,8 @@ err2: err1: bus_release_resource(dev, SYS_RES_IRQ, rid, ch->r_irq); mtx_unlock(&ch->state_mtx); + if (ch->flags & ATA_PERIODIC_POLL) + callout_drain(&ch->poll_callout); return (error); #endif } @@ -266,6 +272,8 @@ ata_detach(device_t dev) mtx_lock(&ch->state_mtx); ch->state |= ATA_STALL_QUEUE; mtx_unlock(&ch->state_mtx); + if (ch->flags & ATA_PERIODIC_POLL) + callout_drain(&ch->poll_callout); #ifndef ATA_CAM /* detach & delete all children */ @@ -453,6 +461,8 @@ ata_suspend(device_t dev) if (!dev || !(ch = device_get_softc(dev))) return ENXIO; + if (ch->flags & ATA_PERIODIC_POLL) + callout_drain(&ch->poll_callout); #ifdef ATA_CAM mtx_lock(&ch->state_mtx); xpt_freeze_simq(ch->sim, 1); @@ -497,6 +507,8 @@ ata_resume(device_t dev) /* kick off requests on the queue */ ata_start(dev); #endif + if (ch->flags & ATA_PERIODIC_POLL) + callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); return error; } @@ -563,6 +575,15 @@ ata_interrupt_locked(void *data) #endif } +static void +ata_periodic_poll(void *data) +{ + struct ata_channel *ch = (struct ata_channel *)data; + + callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); + ata_interrupt(ch); +} + void ata_print_cable(device_t dev, u_int8_t *who) { Modified: stable/8/sys/dev/ata/ata-all.h ============================================================================== --- stable/8/sys/dev/ata/ata-all.h Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/ata-all.h Tue Nov 2 09:26:12 2010 (r214671) @@ -114,13 +114,6 @@ #define ATA_SS_IPM_PARTIAL 0x00000200 #define ATA_SS_IPM_SLUMBER 0x00000600 -#define ATA_SS_CONWELL_MASK \ - (ATA_SS_DET_MASK|ATA_SS_SPD_MASK|ATA_SS_IPM_MASK) -#define ATA_SS_CONWELL_GEN1 \ - (ATA_SS_DET_PHY_ONLINE|ATA_SS_SPD_GEN1|ATA_SS_IPM_ACTIVE) -#define ATA_SS_CONWELL_GEN2 \ - (ATA_SS_DET_PHY_ONLINE|ATA_SS_SPD_GEN2|ATA_SS_IPM_ACTIVE) - #define ATA_SERROR 14 #define ATA_SE_DATA_CORRECTED 0x00000001 #define ATA_SE_COMM_CORRECTED 0x00000002 @@ -567,6 +560,7 @@ struct ata_channel { #define ATA_DMA_BEFORE_CMD 0x100 #define ATA_KNOWN_PRESENCE 0x200 #define ATA_STATUS_IS_LONG 0x400 +#define ATA_PERIODIC_POLL 0x800 int pm_level; /* power management level */ int devices; /* what is present */ @@ -593,6 +587,7 @@ struct ata_channel { struct ata_cam_device user[16]; /* User-specified settings */ struct ata_cam_device curr[16]; /* Current settings */ #endif + struct callout poll_callout; /* Periodic status poll. */ }; /* disk bay/enclosure related */ @@ -666,7 +661,7 @@ void ata_dmainit(device_t); void ata_dmafini(device_t dev); /* ata-sata.c: */ -void ata_sata_phy_check_events(device_t dev); +void ata_sata_phy_check_events(device_t dev, int port); int ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val); int ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val); int ata_sata_phy_reset(device_t dev, int port, int quick); Modified: stable/8/sys/dev/ata/ata-pci.c ============================================================================== --- stable/8/sys/dev/ata/ata-pci.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/ata-pci.c Tue Nov 2 09:26:12 2010 (r214671) @@ -615,6 +615,7 @@ ata_pcichannel_attach(device_t dev) return (0); ch->attached = 1; + ch->dev = dev; ch->unit = (intptr_t)device_get_ivars(dev); resource_int_value(device_get_name(dev), Modified: stable/8/sys/dev/ata/ata-sata.c ============================================================================== --- stable/8/sys/dev/ata/ata-sata.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/ata-sata.c Tue Nov 2 09:26:12 2010 (r214671) @@ -48,20 +48,23 @@ __FBSDID("$FreeBSD$"); #include void -ata_sata_phy_check_events(device_t dev) +ata_sata_phy_check_events(device_t dev, int port) { struct ata_channel *ch = device_get_softc(dev); - u_int32_t error = ATA_IDX_INL(ch, ATA_SERROR); + u_int32_t error, status; - /* clear error bits/interrupt */ - ATA_IDX_OUTL(ch, ATA_SERROR, error); + ata_sata_scr_read(ch, port, ATA_SERROR, &error); + /* Clear set error bits/interrupt. */ + if (error) + ata_sata_scr_write(ch, port, ATA_SERROR, error); /* if we have a connection event deal with it */ if ((error & ATA_SE_PHY_CHANGED) && (ch->pm_level == 0)) { if (bootverbose) { - u_int32_t status = ATA_IDX_INL(ch, ATA_SSTATUS); - if (((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN1) || - ((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN2)) { + ata_sata_scr_read(ch, port, ATA_SSTATUS, &status); + if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && + ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && + ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) { device_printf(dev, "CONNECT requested\n"); } else device_printf(dev, "DISCONNECT requested\n"); @@ -73,69 +76,51 @@ ata_sata_phy_check_events(device_t dev) int ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val) { - int r; - if (port < 0) { + if (ch->hw.pm_read != NULL) + return (ch->hw.pm_read(ch->dev, port, reg, val)); + if (ch->r_io[reg].res) { *val = ATA_IDX_INL(ch, reg); return (0); - } else { - switch (reg) { - case ATA_SSTATUS: - r = 0; - break; - case ATA_SERROR: - r = 1; - break; - case ATA_SCONTROL: - r = 2; - break; - default: - return (EINVAL); - } - return (ch->hw.pm_read(ch->dev, port, r, val)); } + return (-1); } int ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val) { - int r; - if (port < 0) { + if (ch->hw.pm_write != NULL) + return (ch->hw.pm_write(ch->dev, port, reg, val)); + if (ch->r_io[reg].res) { ATA_IDX_OUTL(ch, reg, val); return (0); - } else { - switch (reg) { - case ATA_SERROR: - r = 1; - break; - case ATA_SCONTROL: - r = 2; - break; - default: - return (EINVAL); - } - return (ch->hw.pm_write(ch->dev, port, r, val)); } + return (-1); } static int -ata_sata_connect(struct ata_channel *ch, int port) +ata_sata_connect(struct ata_channel *ch, int port, int quick) { u_int32_t status; - int timeout; + int timeout, t; /* wait up to 1 second for "connect well" */ - for (timeout = 0; timeout < 100 ; timeout++) { + timeout = (quick == 2) ? 0 : 100; + t = 0; + while (1) { if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status)) return (0); - if ((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN1 || - (status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN2) + if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && + ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && + ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) + break; + if (++t > timeout) break; ata_udelay(10000); } - if (timeout >= 100) { - if (bootverbose) { + if (bootverbose) { + if (t > timeout) { if (port < 0) { device_printf(ch->dev, "SATA connect timeout status=%08x\n", status); @@ -143,23 +128,19 @@ ata_sata_connect(struct ata_channel *ch, device_printf(ch->dev, "p%d: SATA connect timeout status=%08x\n", port, status); } - } - return 0; - } - if (bootverbose) { - if (port < 0) { + } else if (port < 0) { device_printf(ch->dev, "SATA connect time=%dms status=%08x\n", - timeout * 10, status); + t * 10, status); } else { device_printf(ch->dev, "p%d: SATA connect time=%dms status=%08x\n", - port, timeout * 10, status); + port, t * 10, status); } } /* clear SATA error register */ ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff); - return 1; + return ((t > timeout) ? 0 : 1); } int @@ -173,7 +154,7 @@ ata_sata_phy_reset(device_t dev, int por if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) return (0); if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_IDLE) - return ata_sata_connect(ch, port); + return ata_sata_connect(ch, port, quick); } if (bootverbose) { @@ -203,7 +184,7 @@ ata_sata_phy_reset(device_t dev, int por if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) return (0); if ((val & ATA_SC_DET_MASK) == 0) - return ata_sata_connect(ch, port); + return ata_sata_connect(ch, port, 0); } } return 0; Modified: stable/8/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-ahci.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/chipsets/ata-ahci.c Tue Nov 2 09:26:12 2010 (r214671) @@ -403,7 +403,7 @@ ata_ahci_status(device_t dev) /* do we have any PHY events ? */ if (istatus & (ATA_AHCI_P_IX_PRC | ATA_AHCI_P_IX_PC)) - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* do we have a potentially hanging engine to take care of? */ /* XXX SOS what todo on NCQ */ @@ -623,6 +623,25 @@ ata_ahci_pm_read(device_t dev, int port, (struct ata_ahci_cmd_tab *)(ch->dma.work + ATA_AHCI_CT_OFFSET); u_int8_t *fis = ch->dma.work + ATA_AHCI_FB_OFFSET + 0x40; + if (port < 0) { + *result = ATA_IDX_INL(ch, reg); + return (0); + } + if (port < ATA_PM) { + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + } bzero(ctp->cfis, 64); ctp->cfis[0] = 0x27; /* host to device */ ctp->cfis[1] = 0x8f; /* command FIS to PM port */ @@ -649,6 +668,25 @@ ata_ahci_pm_write(device_t dev, int port (struct ata_ahci_cmd_tab *)(ch->dma.work + ATA_AHCI_CT_OFFSET); int offset = ch->unit << 7; + if (port < 0) { + ATA_IDX_OUTL(ch, reg, value); + return (0); + } + if (port < ATA_PM) { + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + } bzero(ctp->cfis, 64); ctp->cfis[0] = 0x27; /* host to device */ ctp->cfis[1] = 0x8f; /* command FIS to PM port */ Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Tue Nov 2 09:26:12 2010 (r214671) @@ -59,6 +59,15 @@ static int ata_intel_old_setmode(device_ static int ata_intel_new_setmode(device_t dev, int target, int mode); static int ata_intel_sch_setmode(device_t dev, int target, int mode); static int ata_intel_sata_getrev(device_t dev, int target); +static int ata_intel_sata_status(device_t dev); +static int ata_intel_sata_cscr_read(device_t dev, int port, + int reg, u_int32_t *result); +static int ata_intel_sata_sidpr_read(device_t dev, int port, + int reg, u_int32_t *result); +static int ata_intel_sata_cscr_write(device_t dev, int port, + int reg, u_int32_t result); +static int ata_intel_sata_sidpr_write(device_t dev, int port, + int reg, u_int32_t result); static int ata_intel_31244_ch_attach(device_t dev); static int ata_intel_31244_ch_detach(device_t dev); static int ata_intel_31244_status(device_t dev); @@ -67,7 +76,9 @@ static void ata_intel_31244_reset(device /* misc defines */ #define INTEL_AHCI 1 - +#define INTEL_ICH5 2 +#define INTEL_6CH 4 +#define INTEL_6CH2 8 /* * Intel chipset support functions @@ -92,74 +103,74 @@ ata_intel_probe(device_t dev) { ATA_I82801DB, 0, 0, 2, ATA_UDMA5, "ICH4" }, { ATA_I82801DB_1, 0, 0, 2, ATA_UDMA5, "ICH4" }, { ATA_I82801EB, 0, 0, 2, ATA_UDMA5, "ICH5" }, - { ATA_I82801EB_S1, 0, 0, 2, ATA_SA150, "ICH5" }, - { ATA_I82801EB_R1, 0, 0, 2, ATA_SA150, "ICH5" }, + { ATA_I82801EB_S1, 0, INTEL_ICH5, 2, ATA_SA150, "ICH5" }, + { ATA_I82801EB_R1, 0, INTEL_ICH5, 2, ATA_SA150, "ICH5" }, { ATA_I6300ESB, 0, 0, 2, ATA_UDMA5, "6300ESB" }, - { ATA_I6300ESB_S1, 0, 0, 2, ATA_SA150, "6300ESB" }, - { ATA_I6300ESB_R1, 0, 0, 2, ATA_SA150, "6300ESB" }, + { ATA_I6300ESB_S1, 0, INTEL_ICH5, 2, ATA_SA150, "6300ESB" }, + { ATA_I6300ESB_R1, 0, INTEL_ICH5, 2, ATA_SA150, "6300ESB" }, { ATA_I82801FB, 0, 0, 2, ATA_UDMA5, "ICH6" }, { ATA_I82801FB_S1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH6" }, { ATA_I82801FB_R1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH6" }, { ATA_I82801FBM, 0, INTEL_AHCI, 0, ATA_SA150, "ICH6M" }, { ATA_I82801GB, 0, 0, 1, ATA_UDMA5, "ICH7" }, - { ATA_I82801GB_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH7" }, - { ATA_I82801GB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH7" }, + { ATA_I82801GB_S1, 0, 0, 0, ATA_SA300, "ICH7" }, + { ATA_I82801GB_R1, 0, 0, 0, ATA_SA300, "ICH7" }, { ATA_I82801GB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH7" }, - { ATA_I82801GBM_S1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH7M" }, - { ATA_I82801GBM_R1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH7M" }, + { ATA_I82801GBM_S1, 0, 0, 0, ATA_SA150, "ICH7M" }, + { ATA_I82801GBM_R1, 0, 0, 0, ATA_SA150, "ICH7M" }, { ATA_I82801GBM_AH, 0, INTEL_AHCI, 0, ATA_SA150, "ICH7M" }, { ATA_I63XXESB2, 0, 0, 1, ATA_UDMA5, "63XXESB2" }, - { ATA_I63XXESB2_S1, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, + { ATA_I63XXESB2_S1, 0, 0, 0, ATA_SA300, "63XXESB2" }, { ATA_I63XXESB2_S2, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, { ATA_I63XXESB2_R1, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, { ATA_I63XXESB2_R2, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, - { ATA_I82801HB_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, - { ATA_I82801HB_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, + { ATA_I82801HB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH8" }, + { ATA_I82801HB_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, { ATA_I82801HBM, 0, 0, 1, ATA_UDMA5, "ICH8M" }, - { ATA_I82801HBM_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8M" }, + { ATA_I82801HBM_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH8M" }, { ATA_I82801HBM_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8M" }, { ATA_I82801HBM_S3, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8M" }, - { ATA_I82801IB_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, - { ATA_I82801IB_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IB_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, - { ATA_I82801JIB_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JIB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JIB_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JD_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JIB_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JD_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JD_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JD_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JD_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JI_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JD_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JI_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JI_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_5Series_S1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_I82801JI_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, + { ATA_5Series_S1, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S2, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_R1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S3, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S4, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S3, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S4, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH3, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_R2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S5, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S6, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S5, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S6, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_CPT_S1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, - { ATA_CPT_S2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, - { ATA_CPT_S3, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, - { ATA_CPT_S4, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { 0, 0, 0, 0, 0, 0}}; @@ -183,6 +194,8 @@ ata_intel_chipinit(device_t dev) if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; + ctlr->chipset_data = NULL; + /* good old PIIX needs special treatment (not implemented) */ if (ctlr->chip->chipid == ATA_I82371FB) { ctlr->setmode = ata_intel_old_setmode; @@ -233,7 +246,7 @@ ata_intel_chipinit(device_t dev) * if we have AHCI capability and AHCI or RAID mode enabled * in BIOS we try for AHCI mode */ - if ((ctlr->chip->cfg1 == INTEL_AHCI) && + if ((ctlr->chip->cfg1 & INTEL_AHCI) && (pci_read_config(dev, 0x90, 1) & 0xc0) && (ata_ahci_chipinit(dev) != ENXIO)) return 0; @@ -242,7 +255,8 @@ ata_intel_chipinit(device_t dev) ctlr->r_type2 = SYS_RES_IOPORT; ctlr->r_rid2 = PCIR_BAR(5); if ((ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, - &ctlr->r_rid2, RF_ACTIVE))) + &ctlr->r_rid2, RF_ACTIVE)) + || (ctlr->chip->cfg1 & INTEL_ICH5)) ctlr->getrev = ata_intel_sata_getrev; ctlr->setmode = ata_sata_setmode; } @@ -252,63 +266,142 @@ ata_intel_chipinit(device_t dev) static int ata_intel_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); - - /* setup the usual register normal pci style */ - if (ata_pci_ch_attach(dev)) - return ENXIO; - - /* if r_res2 is valid it points to SATA interface registers */ - if (ctlr->r_res2) { - ch->r_io[ATA_IDX_ADDR].res = ctlr->r_res2; - ch->r_io[ATA_IDX_ADDR].offset = 0x00; - ch->r_io[ATA_IDX_DATA].res = ctlr->r_res2; - ch->r_io[ATA_IDX_DATA].offset = 0x04; - } + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + u_char *smap; + u_int map; + + /* setup the usual register normal pci style */ + if (ata_pci_ch_attach(dev)) + return (ENXIO); + + ctlr = device_get_softc(device_get_parent(dev)); + ch = device_get_softc(dev); + + /* if r_res2 is valid it points to SATA interface registers */ + if (ctlr->r_res2) { + ch->r_io[ATA_IDX_ADDR].res = ctlr->r_res2; + ch->r_io[ATA_IDX_ADDR].offset = 0x00; + ch->r_io[ATA_IDX_DATA].res = ctlr->r_res2; + ch->r_io[ATA_IDX_DATA].offset = 0x04; + } - ch->flags |= ATA_ALWAYS_DMASTAT; - if (ctlr->chip->max_dma >= ATA_SA150) { - if (ctlr->chip->cfg1 == 0 && - (pci_read_config(device_get_parent(dev), 0x90, 1) & 0x04) == 0) - ch->flags |= ATA_NO_SLAVE; - ch->flags |= ATA_SATA; - } else if (ctlr->chip->chipid != ATA_ISCH) - ch->flags |= ATA_CHECKS_CABLE; - return 0; + ch->flags |= ATA_ALWAYS_DMASTAT; + if (ctlr->chip->max_dma >= ATA_SA150) { + smap = (u_char *)&ctlr->chipset_data + ch->unit * 2; + map = pci_read_config(device_get_parent(dev), 0x90, 1); + if (ctlr->chip->cfg1 & INTEL_ICH5) { + map &= 0x07; + if ((map & 0x04) == 0) { + ch->flags |= ATA_SATA; + ch->flags |= ATA_NO_SLAVE; + smap[0] = (map & 0x01) ^ ch->unit; + smap[1] = 0; + } else if ((map & 0x02) == 0 && ch->unit == 0) { + ch->flags |= ATA_SATA; + smap[0] = (map & 0x01) ? 1 : 0; + smap[1] = (map & 0x01) ? 0 : 1; + } else if ((map & 0x02) != 0 && ch->unit == 1) { + ch->flags |= ATA_SATA; + smap[0] = (map & 0x01) ? 1 : 0; + smap[1] = (map & 0x01) ? 0 : 1; + } + } else if (ctlr->chip->cfg1 & INTEL_6CH2) { + ch->flags |= ATA_SATA; + ch->flags |= ATA_NO_SLAVE; + smap[0] = (ch->unit == 0) ? 4 : 5; + smap[1] = 0; + } else { + map &= 0x03; + if (map == 0x00) { + ch->flags |= ATA_SATA; + smap[ch->unit] = (ch->unit == 0) ? 0x20 : 0x31; + smap[0] = (ch->unit == 0) ? 0 : 1; + smap[1] = (ch->unit == 0) ? 2 : 3; + } else if (map == 0x02 && ch->unit == 0) { + ch->flags |= ATA_SATA; + smap[0] = 0; + smap[1] = 2; + } else if (map == 0x01 && ch->unit == 1) { + ch->flags |= ATA_SATA; + smap[0] = 1; + smap[1] = 3; + } + } + if (ch->flags & ATA_SATA) { + if ((ctlr->chip->cfg1 & INTEL_ICH5)) { + ch->flags |= ATA_PERIODIC_POLL; + ch->hw.status = ata_intel_sata_status; + ch->hw.pm_read = ata_intel_sata_cscr_read; + ch->hw.pm_write = ata_intel_sata_cscr_write; + } else if (ctlr->r_res2) { + ch->flags |= ATA_PERIODIC_POLL; + ch->hw.status = ata_intel_sata_status; + ch->hw.pm_read = ata_intel_sata_sidpr_read; + ch->hw.pm_write = ata_intel_sata_sidpr_write; + } + if (ch->hw.pm_write != NULL) { + ata_sata_scr_write(ch, 0, + ATA_SERROR, 0xffffffff); + if ((ch->flags & ATA_NO_SLAVE) == 0) { + ata_sata_scr_write(ch, 1, + ATA_SERROR, 0xffffffff); + } + } + } else + ctlr->setmode = ata_intel_new_setmode; + } else if (ctlr->chip->chipid != ATA_ISCH) + ch->flags |= ATA_CHECKS_CABLE; + return (0); } static void ata_intel_reset(device_t dev) { - device_t parent = device_get_parent(dev); - struct ata_pci_controller *ctlr = device_get_softc(parent); - struct ata_channel *ch = device_get_softc(dev); - int mask, timeout; + device_t parent = device_get_parent(dev); + struct ata_pci_controller *ctlr = device_get_softc(parent); + struct ata_channel *ch = device_get_softc(dev); + int mask, pmask, timeout, devs; + u_char *smap; - /* ICH6 & ICH7 in compat mode has 4 SATA ports as master/slave on 2 ch's */ - if (ctlr->chip->cfg1) { - mask = (0x0005 << ch->unit); - } - else { - /* ICH5 in compat mode has SATA ports as master/slave on 1 channel */ - if (pci_read_config(parent, 0x90, 1) & 0x04) - mask = 0x0003; + /* In combined mode, skip SATA stuff for PATA channel. */ + if ((ch->flags & ATA_SATA) == 0) + return (ata_generic_reset(dev)); + + /* Do hard-reset on respective SATA ports. */ + smap = (u_char *)&ctlr->chipset_data + ch->unit * 2; + mask = 1 << smap[0]; + if ((ch->flags & ATA_NO_SLAVE) == 0) + mask |= (1 << smap[1]); + pci_write_config(parent, 0x92, + pci_read_config(parent, 0x92, 2) & ~mask, 2); + DELAY(10); + pci_write_config(parent, 0x92, + pci_read_config(parent, 0x92, 2) | mask, 2); + + /* Wait up to 1 sec for "connect well". */ + if (ctlr->chip->cfg1 & (INTEL_6CH | INTEL_6CH2)) + pmask = mask << 8; else - mask = (0x0001 << ch->unit); - } - pci_write_config(parent, 0x92, pci_read_config(parent, 0x92, 2) & ~mask, 2); - DELAY(10); - pci_write_config(parent, 0x92, pci_read_config(parent, 0x92, 2) | mask, 2); - - /* wait up to 1 sec for "connect well" */ - for (timeout = 0; timeout < 100 ; timeout++) { - if (((pci_read_config(parent, 0x92, 2) & (mask << 4)) == (mask << 4)) && - (ATA_IDX_INB(ch, ATA_STATUS) != 0xff)) - break; - ata_udelay(10000); - } - ata_generic_reset(dev); + pmask = mask << 4; + for (timeout = 0; timeout < 100 ; timeout++) { + if (((pci_read_config(parent, 0x92, 2) & pmask) == pmask) && + (ATA_IDX_INB(ch, ATA_STATUS) != 0xff)) + break; + ata_udelay(10000); + } + + /* If any device found, do soft-reset. */ + if (ch->hw.pm_read != NULL) { + devs = ata_sata_phy_reset(dev, 0, 2); + if ((ch->flags & ATA_NO_SLAVE) == 0) + devs += ata_sata_phy_reset(dev, 1, 2); + } else + devs = 1; + if (devs) + ata_generic_reset(dev); + else + ch->devices = 0; } static int @@ -339,6 +432,10 @@ ata_intel_new_setmode(device_t dev, int u_int8_t timings[] = { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; u_int8_t utimings[] = { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; + /* In combined mode, skip PATA stuff for SATA channel. */ + if (ch->flags & ATA_SATA) + return (ata_sata_setmode(dev, target, mode)); + mode = min(mode, ctlr->chip->max_dma); if (ata_dma_check_80pin && mode > ATA_UDMA2 && !(reg54 & (0x10 << devno))) { @@ -421,12 +518,145 @@ static int ata_intel_sata_getrev(device_t dev, int target) { struct ata_channel *ch = device_get_softc(dev); - int devno = (ch->unit << 1) + target; + uint32_t status; + + if (ata_sata_scr_read(ch, target, ATA_SSTATUS, &status) == 0) + return ((status & 0x0f0) >> 4); + return (0xff); +} + +static int +ata_intel_sata_status(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + ata_sata_phy_check_events(dev, 0); + if ((ch->flags & ATA_NO_SLAVE) == 0) + ata_sata_phy_check_events(dev, 1); - /* set ATA_SSTATUS register offset */ - ATA_IDX_OUTL(ch, ATA_IDX_ADDR, devno * 0x100); - /* query SATA STATUS for the speed */ - return ((ATA_IDX_INL(ch, ATA_IDX_DATA) & 0x0f0) >> 4); + return ata_pci_status(dev); +} + +static int +ata_intel_sata_cscr_read(device_t dev, int port, int reg, u_int32_t *result) +{ + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + device_t parent; + u_char *smap; + + parent = device_get_parent(dev); + ctlr = device_get_softc(parent); + ch = device_get_softc(dev); + smap = (u_char *)&ctlr->chipset_data + ch->unit * 2; + port = (port == 1) ? 1 : 0; + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + pci_write_config(parent, 0xa0, + 0x50 + smap[port] * 0x10 + reg * 4, 4); + *result = pci_read_config(parent, 0xa4, 4); + return (0); +} + +static int +ata_intel_sata_sidpr_read(device_t dev, int port, int reg, u_int32_t *result) +{ + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + device_t parent; + + parent = device_get_parent(dev); + ctlr = device_get_softc(parent); + ch = device_get_softc(dev); + port = (port == 1) ? 1 : 0; + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SCONTROL: + reg = 1; + break; + case ATA_SERROR: + reg = 2; + break; + default: + return (EINVAL); + } + ATA_IDX_OUTL(ch, ATA_IDX_ADDR, ((ch->unit * 2 + port) << 8) + reg); + *result = ATA_IDX_INL(ch, ATA_IDX_DATA); + return (0); +} + +static int +ata_intel_sata_cscr_write(device_t dev, int port, int reg, u_int32_t value) +{ + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + device_t parent; + u_char *smap; + + parent = device_get_parent(dev); + ctlr = device_get_softc(parent); + ch = device_get_softc(dev); + smap = (u_char *)&ctlr->chipset_data + ch->unit * 2; + port = (port == 1) ? 1 : 0; + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + pci_write_config(parent, 0xa0, + 0x50 + smap[port] * 0x10 + reg * 4, 4); + pci_write_config(parent, 0xa4, value, 4); + return (0); +} + +static int +ata_intel_sata_sidpr_write(device_t dev, int port, int reg, u_int32_t value) +{ + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + device_t parent; + + parent = device_get_parent(dev); + ctlr = device_get_softc(parent); + ch = device_get_softc(dev); + port = (port == 1) ? 1 : 0; + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SCONTROL: + reg = 1; + break; + case ATA_SERROR: + reg = 2; + break; + default: + return (EINVAL); + } + ATA_IDX_OUTL(ch, ATA_IDX_ADDR, ((ch->unit * 2 + port) << 8) + reg); + ATA_IDX_OUTL(ch, ATA_IDX_DATA, value); + return (0); } static int @@ -492,7 +722,7 @@ static int ata_intel_31244_status(device_t dev) { /* do we have any PHY events ? */ - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* any drive action to take care of ? */ return ata_pci_status(dev); Modified: stable/8/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-marvell.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/chipsets/ata-marvell.c Tue Nov 2 09:26:12 2010 (r214671) @@ -374,7 +374,7 @@ ata_marvell_edma_status(device_t dev) ATA_OUTL(ctlr->r_res1, 0x02008 + ATA_MV_EDMA_BASE(ch), 0x0); /* do we have any PHY events ? */ - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); } /* do we have any device action ? */ Modified: stable/8/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-nvidia.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/chipsets/ata-nvidia.c Tue Nov 2 09:26:12 2010 (r214671) @@ -281,7 +281,7 @@ ata_nvidia_status(device_t dev) /* do we have any PHY events ? */ if (istatus & (0x0c << shift)) - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* clear interrupt(s) */ if (ctlr->chip->cfg1 & NVQ) Modified: stable/8/sys/dev/ata/chipsets/ata-promise.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-promise.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/chipsets/ata-promise.c Tue Nov 2 09:26:12 2010 (r214671) @@ -830,6 +830,25 @@ ata_promise_mio_pm_read(device_t dev, in struct ata_channel *ch = device_get_softc(dev); int timeout = 0; + if (port < 0) { + *result = ATA_IDX_INL(ch, reg); + return (0); + } + if (port < ATA_PM) { + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + } /* set portmultiplier port */ ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x0f); @@ -862,6 +881,25 @@ ata_promise_mio_pm_write(device_t dev, i struct ata_channel *ch = device_get_softc(dev); int timeout = 0; + if (port < 0) { + ATA_IDX_OUTL(ch, reg, value); + return (0); + } + if (port < ATA_PM) { + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + } /* set portmultiplier port */ ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x0f); Modified: stable/8/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-siliconimage.c Tue Nov 2 09:16:41 2010 (r214670) +++ stable/8/sys/dev/ata/chipsets/ata-siliconimage.c Tue Nov 2 09:26:12 2010 (r214671) @@ -354,7 +354,7 @@ ata_sii_status(device_t dev) /* do we have any PHY events ? */ if (ctlr->chip->max_dma >= ATA_SA150 && (ATA_INL(ctlr->r_res2, 0x10 + offset0) & 0x00000010)) - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); if (ATA_INL(ctlr->r_res2, 0xa0 + offset1) & 0x00000800) return ata_pci_status(dev); @@ -510,7 +510,7 @@ ata_siiprb_status(device_t dev) u_int32_t istatus = ATA_INL(ctlr->r_res2, 0x1008 + offset); /* do we have any PHY events ? */ - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* clear interrupt(s) */ ATA_OUTL(ctlr->r_res2, 0x1008 + offset, istatus); @@ -700,6 +700,25 @@ ata_siiprb_pm_read(device_t dev, int por struct ata_siiprb_command *prb = (struct ata_siiprb_command *)ch->dma.work; int offset = ch->unit * 0x2000; + if (port < 0) { + *result = ATA_IDX_INL(ch, reg); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 09:29:31 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F368106566B; Tue, 2 Nov 2010 09:29:31 +0000 (UTC) (envelope-from ceri@submonkey.net) Received: from scuttle.submonkey.net (scuttle.submonkey.net [208.111.43.184]) by mx1.freebsd.org (Postfix) with ESMTP id D78668FC17; Tue, 2 Nov 2010 09:29:26 +0000 (UTC) Received: from cpc6-cdif11-2-0-cust58.5-1.cable.virginmedia.com ([62.255.146.59] helo=shrike.submonkey.net) by scuttle.submonkey.net with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1PDDB5-0007CF-Ku; Tue, 02 Nov 2010 09:29:15 +0000 Received: from ceri by shrike.submonkey.net with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1PDDB2-000Msd-Ug; Tue, 02 Nov 2010 09:29:12 +0000 Date: Tue, 2 Nov 2010 09:29:12 +0000 From: Ceri Davies To: Alexander Best Message-ID: <20101102092912.GA91295@submonkey.net> References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> <20101031191119.GM46314@acme.spoerlein.net> <1288620951.3596.32.camel@bauer.cse.buffalo.edu> <20101102014059.GA91353@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline In-Reply-To: <20101102014059.GA91353@freebsd.org> X-PGP: finger ceri@FreeBSD.org User-Agent: Mutt/1.5.20 (2009-06-14) Sender: Ceri Davies Cc: src-committers@FreeBSD.org, Pawel Jakub Dawidek , Ken Smith , svn-src-all@FreeBSD.org, Ulrich Spoerlein , svn-src-head@FreeBSD.org Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 09:29:31 -0000 --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 02, 2010 at 01:40:59AM +0000, Alexander Best wrote: >=20 > how about a compromise then? let's leave the -P switch in rm, but make it= a no > op! in addition to that add a new rm(1) entry explaining what the -P swit= ch did > and why exactly it was turned into a no op. let's be really eloborate on = this > issue and tell the user exactly every tiny detail that lead to the conclu= sion > that currently the -P switch serves no purpose and thus it was turned int= o a no > op. also a statement should be added to rm(1) that makes clear that the -= P flag > *will* come back to rm, once the low level work has been finished in orde= r to > decide (from userland) whether a specific disk supports overwriting block= s or > not. Making it a no-op silently breaks it even in the cases where it was working before. It should fail. Ceri --=20 Haffely, Gaffely, Gaffely, Gonward. --k1lZvvs/B4yU6o8G Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iD8DBQFMz9noocfcwTS3JF8RAkJXAKCH80b+IKru40pqKzkqJtZSdgxAvwCfcFt0 E6FowjoQ3V8/T4gPuArXA8s= =zmeX -----END PGP SIGNATURE----- --k1lZvvs/B4yU6o8G-- From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 09:31:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E1B6106564A; Tue, 2 Nov 2010 09:31:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C15E8FC15; Tue, 2 Nov 2010 09:31: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 oA29VOGm033342; Tue, 2 Nov 2010 09:31:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA29VOw2033340; Tue, 2 Nov 2010 09:31:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011020931.oA29VOw2033340@svn.freebsd.org> From: Alexander Motin Date: Tue, 2 Nov 2010 09:31: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: r214672 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 09:31:24 -0000 Author: mav Date: Tue Nov 2 09:31:24 2010 New Revision: 214672 URL: http://svn.freebsd.org/changeset/base/214672 Log: Remove stale line, accidentally slipped into r214016. MFC after: 3 days Modified: head/sys/dev/ata/chipsets/ata-intel.c Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Tue Nov 2 09:26:12 2010 (r214671) +++ head/sys/dev/ata/chipsets/ata-intel.c Tue Nov 2 09:31:24 2010 (r214672) @@ -315,7 +315,6 @@ ata_intel_ch_attach(device_t dev) map &= 0x03; if (map == 0x00) { ch->flags |= ATA_SATA; - smap[ch->unit] = (ch->unit == 0) ? 0x20 : 0x31; smap[0] = (ch->unit == 0) ? 0 : 1; smap[1] = (ch->unit == 0) ? 2 : 3; } else if (map == 0x02 && ch->unit == 0) { From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 12:40:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC66C106564A; Tue, 2 Nov 2010 12:40:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C08E98FC1A; Tue, 2 Nov 2010 12:40: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 oA2CeDVZ045638; Tue, 2 Nov 2010 12:40:13 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2CeD0l045636; Tue, 2 Nov 2010 12:40:13 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011021240.oA2CeD0l045636@svn.freebsd.org> From: John Baldwin Date: Tue, 2 Nov 2010 12:40: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: r214673 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 12:40:14 -0000 Author: jhb Date: Tue Nov 2 12:40:13 2010 New Revision: 214673 URL: http://svn.freebsd.org/changeset/base/214673 Log: Fix a few typos and style nits in the example code. Submitted by: Arnaud Lacombe lacombar of gmail MFC after: 3 days Modified: head/share/man/man9/sysctl_ctx_init.9 Modified: head/share/man/man9/sysctl_ctx_init.9 ============================================================================== --- head/share/man/man9/sysctl_ctx_init.9 Tue Nov 2 09:31:24 2010 (r214672) +++ head/share/man/man9/sysctl_ctx_init.9 Tue Nov 2 12:40:13 2010 (r214673) @@ -188,27 +188,27 @@ This example uses contexts to keep track struct sysctl_ctx_list clist; struct sysctl_oid *oidp; int a_int; -char *string = "dynamic sysctl"; +const char *string = "dynamic sysctl"; ... sysctl_ctx_init(&clist); -oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(/* tree top */), - OID_AUTO, "newtree", CTFLAG_RW, 0, "new top level tree"); -oidp = SYSCTL_ADD_INT( &clist, SYSCTL_CHILDREN(oidp), +oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(/* tree top */), + OID_AUTO, "newtree", CTLFLAG_RW, 0, "new top level tree"); +oidp = SYSCTL_ADD_INT(&clist, SYSCTL_CHILDREN(oidp), OID_AUTO, "newint", CTLFLAG_RW, &a_int, 0, "new int leaf"); ... -oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(_debug), - OID_AUTO, "newtree", CTFLAG_RW, 0, "new tree under debug"); -oidp = SYSCTL_ADD_STRING( &clist, SYSCTL_CHILDREN(oidp), - OID_AUTO, "newstring", CTLFLAG_R, string, 0, "new string leaf"); +oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(_debug), + OID_AUTO, "newtree", CTLFLAG_RW, 0, "new tree under debug"); +oidp = SYSCTL_ADD_STRING(&clist, SYSCTL_CHILDREN(oidp), + OID_AUTO, "newstring", CTLFLAG_RD, string, 0, "new string leaf"); ... /* Now we can free up the oids */ -if(sysctl_ctx_free(&clist)) { +if (sysctl_ctx_free(&clist)) { printf("can't free this context - other oids depend on it"); - return(ENOTEMPTY); + return (ENOTEMPTY); } else { - printf("Success!\\n"): - return(0); + printf("Success!\\n"); + return (0); } .Ed .Pp From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 12:42:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2BBC1065695; Tue, 2 Nov 2010 12:42:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEFE18FC16; Tue, 2 Nov 2010 12:42: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 oA2CgkUK045843; Tue, 2 Nov 2010 12:42:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2CgkIh045841; Tue, 2 Nov 2010 12:42:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011021242.oA2CgkIh045841@svn.freebsd.org> From: John Baldwin Date: Tue, 2 Nov 2010 12:42:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214674 - stable/6/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 12:42:47 -0000 Author: jhb Date: Tue Nov 2 12:42:46 2010 New Revision: 214674 URL: http://svn.freebsd.org/changeset/base/214674 Log: MFC: Use the 'cfg2' value for Intel chipsets to limit the number of channels for non-SATA controllers. Specifically, limit the non-AHCI ICH7, 63XXESB2, and ICHM8 controllers to a single channel. Modified: stable/6/sys/dev/ata/ata-chipset.c Modified: stable/6/sys/dev/ata/ata-chipset.c ============================================================================== --- stable/6/sys/dev/ata/ata-chipset.c Tue Nov 2 12:40:13 2010 (r214673) +++ stable/6/sys/dev/ata/ata-chipset.c Tue Nov 2 12:42:46 2010 (r214674) @@ -1762,58 +1762,58 @@ ata_intel_ident(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); static struct ata_chip_id ids[] = - {{ ATA_I82371FB, 0, 0, 0x00, ATA_WDMA2, "PIIX" }, - { ATA_I82371SB, 0, 0, 0x00, ATA_WDMA2, "PIIX3" }, - { ATA_I82371AB, 0, 0, 0x00, ATA_UDMA2, "PIIX4" }, - { ATA_I82443MX, 0, 0, 0x00, ATA_UDMA2, "PIIX4" }, - { ATA_I82451NX, 0, 0, 0x00, ATA_UDMA2, "PIIX4" }, - { ATA_I82801AB, 0, 0, 0x00, ATA_UDMA2, "ICH0" }, - { ATA_I82801AA, 0, 0, 0x00, ATA_UDMA4, "ICH" }, - { ATA_I82372FB, 0, 0, 0x00, ATA_UDMA4, "ICH" }, - { ATA_I82801BA, 0, 0, 0x00, ATA_UDMA5, "ICH2" }, - { ATA_I82801BA_1, 0, 0, 0x00, ATA_UDMA5, "ICH2" }, - { ATA_I82801CA, 0, 0, 0x00, ATA_UDMA5, "ICH3" }, - { ATA_I82801CA_1, 0, 0, 0x00, ATA_UDMA5, "ICH3" }, - { ATA_I82801DB, 0, 0, 0x00, ATA_UDMA5, "ICH4" }, - { ATA_I82801DB_1, 0, 0, 0x00, ATA_UDMA5, "ICH4" }, - { ATA_I82801EB, 0, 0, 0x00, ATA_UDMA5, "ICH5" }, - { ATA_I82801EB_S1, 0, 0, 0x00, ATA_SA150, "ICH5" }, - { ATA_I82801EB_R1, 0, 0, 0x00, ATA_SA150, "ICH5" }, - { ATA_I6300ESB, 0, 0, 0x00, ATA_UDMA5, "6300ESB" }, - { ATA_I6300ESB_S1, 0, 0, 0x00, ATA_SA150, "6300ESB" }, - { ATA_I6300ESB_R1, 0, 0, 0x00, ATA_SA150, "6300ESB" }, - { ATA_I82801FB, 0, 0, 0x00, ATA_UDMA5, "ICH6" }, - { ATA_I82801FB_S1, 0, AHCI, 0x00, ATA_SA150, "ICH6" }, - { ATA_I82801FB_R1, 0, AHCI, 0x00, ATA_SA150, "ICH6" }, - { ATA_I82801FBM, 0, AHCI, 0x00, ATA_SA150, "ICH6M" }, - { ATA_I82801GB, 0, 0, 0x00, ATA_UDMA5, "ICH7" }, - { ATA_I82801GB_S1, 0, AHCI, 0x00, ATA_SA300, "ICH7" }, - { ATA_I82801GB_R1, 0, AHCI, 0x00, ATA_SA300, "ICH7" }, - { ATA_I82801GB_AH, 0, AHCI, 0x00, ATA_SA300, "ICH7" }, - { ATA_I82801GBM_S1, 0, AHCI, 0x00, ATA_SA300, "ICH7M" }, - { ATA_I82801GBM_R1, 0, AHCI, 0x00, ATA_SA300, "ICH7M" }, - { ATA_I82801GBM_AH, 0, AHCI, 0x00, ATA_SA300, "ICH7M" }, - { ATA_I63XXESB2, 0, 0, 0x00, ATA_UDMA5, "63XXESB2" }, - { ATA_I63XXESB2_S1, 0, AHCI, 0x00, ATA_SA300, "63XXESB2" }, - { ATA_I63XXESB2_S2, 0, AHCI, 0x00, ATA_SA300, "63XXESB2" }, - { ATA_I63XXESB2_R1, 0, AHCI, 0x00, ATA_SA300, "63XXESB2" }, - { ATA_I63XXESB2_R2, 0, AHCI, 0x00, ATA_SA300, "63XXESB2" }, - { ATA_I82801HB_S1, 0, AHCI, 0x00, ATA_SA300, "ICH8" }, - { ATA_I82801HB_S2, 0, AHCI, 0x00, ATA_SA300, "ICH8" }, - { ATA_I82801HB_R1, 0, AHCI, 0x00, ATA_SA300, "ICH8" }, - { ATA_I82801HB_AH4, 0, AHCI, 0x00, ATA_SA300, "ICH8" }, - { ATA_I82801HB_AH6, 0, AHCI, 0x00, ATA_SA300, "ICH8" }, - { ATA_I82801HBM, 0, 0, 0x00, ATA_UDMA5, "ICH8M" }, - { ATA_I82801HBM_S1, 0, 0, 0x00, ATA_SA150, "ICH8M" }, - { ATA_I82801HBM_S2, 0, AHCI, 0x00, ATA_SA300, "ICH8M" }, - { ATA_I82801HBM_S3, 0, AHCI, 0x00, ATA_SA300, "ICH8M" }, - { ATA_I82801IB_S1, 0, AHCI, 0x00, ATA_SA300, "ICH9" }, - { ATA_I82801IB_S2, 0, AHCI, 0x00, ATA_SA300, "ICH9" }, - { ATA_I82801IB_AH2, 0, AHCI, 0x00, ATA_SA300, "ICH9" }, - { ATA_I82801IB_AH4, 0, AHCI, 0x00, ATA_SA300, "ICH9" }, - { ATA_I82801IB_AH6, 0, AHCI, 0x00, ATA_SA300, "ICH9" }, - { ATA_I82801IB_R1, 0, AHCI, 0x00, ATA_SA300, "ICH9" }, - { ATA_I31244, 0, 0, 0x00, ATA_SA150, "31244" }, + {{ ATA_I82371FB, 0, 0, 2, ATA_WDMA2, "PIIX" }, + { ATA_I82371SB, 0, 0, 2, ATA_WDMA2, "PIIX3" }, + { ATA_I82371AB, 0, 0, 2, ATA_UDMA2, "PIIX4" }, + { ATA_I82443MX, 0, 0, 2, ATA_UDMA2, "PIIX4" }, + { ATA_I82451NX, 0, 0, 2, ATA_UDMA2, "PIIX4" }, + { ATA_I82801AB, 0, 0, 2, ATA_UDMA2, "ICH0" }, + { ATA_I82801AA, 0, 0, 2, ATA_UDMA4, "ICH" }, + { ATA_I82372FB, 0, 0, 2, ATA_UDMA4, "ICH" }, + { ATA_I82801BA, 0, 0, 2, ATA_UDMA5, "ICH2" }, + { ATA_I82801BA_1, 0, 0, 2, ATA_UDMA5, "ICH2" }, + { ATA_I82801CA, 0, 0, 2, ATA_UDMA5, "ICH3" }, + { ATA_I82801CA_1, 0, 0, 2, ATA_UDMA5, "ICH3" }, + { ATA_I82801DB, 0, 0, 2, ATA_UDMA5, "ICH4" }, + { ATA_I82801DB_1, 0, 0, 2, ATA_UDMA5, "ICH4" }, + { ATA_I82801EB, 0, 0, 2, ATA_UDMA5, "ICH5" }, + { ATA_I82801EB_S1, 0, 0, 2, ATA_SA150, "ICH5" }, + { ATA_I82801EB_R1, 0, 0, 2, ATA_SA150, "ICH5" }, + { ATA_I6300ESB, 0, 0, 2, ATA_UDMA5, "6300ESB" }, + { ATA_I6300ESB_S1, 0, 0, 2, ATA_SA150, "6300ESB" }, + { ATA_I6300ESB_R1, 0, 0, 2, ATA_SA150, "6300ESB" }, + { ATA_I82801FB, 0, 0, 2, ATA_UDMA5, "ICH6" }, + { ATA_I82801FB_S1, 0, AHCI, 0, ATA_SA150, "ICH6" }, + { ATA_I82801FB_R1, 0, AHCI, 0, ATA_SA150, "ICH6" }, + { ATA_I82801FBM, 0, AHCI, 0, ATA_SA150, "ICH6M" }, + { ATA_I82801GB, 0, 0, 1, ATA_UDMA5, "ICH7" }, + { ATA_I82801GB_S1, 0, AHCI, 0, ATA_SA300, "ICH7" }, + { ATA_I82801GB_R1, 0, AHCI, 0, ATA_SA300, "ICH7" }, + { ATA_I82801GB_AH, 0, AHCI, 0, ATA_SA300, "ICH7" }, + { ATA_I82801GBM_S1, 0, AHCI, 0, ATA_SA300, "ICH7M" }, + { ATA_I82801GBM_R1, 0, AHCI, 0, ATA_SA300, "ICH7M" }, + { ATA_I82801GBM_AH, 0, AHCI, 0, ATA_SA300, "ICH7M" }, + { ATA_I63XXESB2, 0, 0, 1, ATA_UDMA5, "63XXESB2" }, + { ATA_I63XXESB2_S1, 0, AHCI, 0, ATA_SA300, "63XXESB2" }, + { ATA_I63XXESB2_S2, 0, AHCI, 0, ATA_SA300, "63XXESB2" }, + { ATA_I63XXESB2_R1, 0, AHCI, 0, ATA_SA300, "63XXESB2" }, + { ATA_I63XXESB2_R2, 0, AHCI, 0, ATA_SA300, "63XXESB2" }, + { ATA_I82801HB_S1, 0, AHCI, 0, ATA_SA300, "ICH8" }, + { ATA_I82801HB_S2, 0, AHCI, 0, ATA_SA300, "ICH8" }, + { ATA_I82801HB_R1, 0, AHCI, 0, ATA_SA300, "ICH8" }, + { ATA_I82801HB_AH4, 0, AHCI, 0, ATA_SA300, "ICH8" }, + { ATA_I82801HB_AH6, 0, AHCI, 0, ATA_SA300, "ICH8" }, + { ATA_I82801HBM, 0, 0, 1, ATA_UDMA5, "ICH8M" }, + { ATA_I82801HBM_S1, 0, 0, 0, ATA_SA150, "ICH8M" }, + { ATA_I82801HBM_S2, 0, AHCI, 0, ATA_SA300, "ICH8M" }, + { ATA_I82801HBM_S3, 0, AHCI, 0, ATA_SA300, "ICH8M" }, + { ATA_I82801IB_S1, 0, AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IB_S2, 0, AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IB_AH2, 0, AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IB_AH4, 0, AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IB_AH6, 0, AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IB_R1, 0, AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { 0, 0, 0, 0, 0, 0}}; if (!(ctlr->chip = ata_match_chip(dev, ids))) @@ -1855,6 +1855,7 @@ ata_intel_chipinit(device_t dev) /* non SATA intel chips goes here */ else if (ctlr->chip->max_dma < ATA_SA150) { + ctlr->channels = ctlr->chip->cfg2; ctlr->allocate = ata_intel_allocate; ctlr->setmode = ata_intel_new_setmode; } From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 13:00:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 394CF1065670; Tue, 2 Nov 2010 13:00:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 281598FC0C; Tue, 2 Nov 2010 13:00: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 oA2D0vgc047230; Tue, 2 Nov 2010 13:00:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2D0vi2047228; Tue, 2 Nov 2010 13:00:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011021300.oA2D0vi2047228@svn.freebsd.org> From: John Baldwin Date: Tue, 2 Nov 2010 13:00: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: r214675 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 13:00:57 -0000 Author: jhb Date: Tue Nov 2 13:00:56 2010 New Revision: 214675 URL: http://svn.freebsd.org/changeset/base/214675 Log: Don't leak the LLE lock if the arptimer callout is pending or inactive. Reported by: David Rhodus MFC after: 1 month Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Tue Nov 2 12:42:46 2010 (r214674) +++ head/sys/netinet/if_ether.c Tue Nov 2 13:00:56 2010 (r214675) @@ -178,16 +178,16 @@ arptimer(void *arg) LLE_REMREF(lle); (void) llentry_free(lle); ARPSTAT_INC(timeouts); - } + } else { #ifdef DIAGNOSTIC - else { struct sockaddr *l3addr = L3_ADDR(lle); log(LOG_INFO, "arptimer issue: %p, IPv4 address: \"%s\"\n", lle, inet_ntoa( ((const struct sockaddr_in *)l3addr)->sin_addr)); - } #endif + LLE_WUNLOCK(lle); + } } IF_AFDATA_UNLOCK(ifp); CURVNET_RESTORE(); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 13:04:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57A00106564A; Tue, 2 Nov 2010 13:04:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BD548FC1B; Tue, 2 Nov 2010 13:04: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 oA2D4QQk047495; Tue, 2 Nov 2010 13:04:26 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2D4QEB047493; Tue, 2 Nov 2010 13:04:26 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011021304.oA2D4QEB047493@svn.freebsd.org> From: John Baldwin Date: Tue, 2 Nov 2010 13:04: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: r214676 - head/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 13:04:26 -0000 Author: jhb Date: Tue Nov 2 13:04:25 2010 New Revision: 214676 URL: http://svn.freebsd.org/changeset/base/214676 Log: Skip SMAP regions above 4GB on i386 since they will not fit into a long. While here, update some comments to better explain the new code flow. Tested by: dhw Modified: head/sys/x86/x86/nexus.c Modified: head/sys/x86/x86/nexus.c ============================================================================== --- head/sys/x86/x86/nexus.c Tue Nov 2 13:00:56 2010 (r214675) +++ head/sys/x86/x86/nexus.c Tue Nov 2 13:04:25 2010 (r214676) @@ -694,15 +694,24 @@ ram_attach(device_t dev) if (smap->type != SMAP_TYPE_MEMORY || smap->length == 0) continue; +#ifdef __i386__ + /* + * Resources use long's to track resources, so + * we can't include memory regions above 4GB. + */ + if (smap->base >= ~0ul) + break; +#endif error = bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->base, smap->length); if (error) - panic("ram_attach: resource %d failed set with %d", + panic( + "ram_attach: resource %d failed set with %d", rid, error); res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0); if (res == NULL) - panic("ram_attach: resource %d failed to attach", + panic("ram_attach: resource %d failed to attach", rid); rid++; } @@ -710,19 +719,17 @@ ram_attach(device_t dev) } /* - * We use the dump_avail[] array rather than phys_avail[] for - * the memory map as phys_avail[] contains holes for kernel - * memory, page 0, the message buffer, and the dcons buffer. - * We test the end address in the loop instead of the start - * since the start address for the first segment is 0. - * - * XXX: It would be preferable to use the SMAP if it exists - * instead since if the SMAP is very fragmented we may not - * include some memory regions in dump_avail[] and phys_avail[]. + * If the system map is not available, fall back to using + * dump_avail[]. We use the dump_avail[] array rather than + * phys_avail[] for the memory map as phys_avail[] contains + * holes for kernel memory, page 0, the message buffer, and + * the dcons buffer. We test the end address in the loop + * instead of the start since the start address for the first + * segment is 0. */ for (i = 0, p = dump_avail; p[1] != 0; i++, p += 2) { rid = i; -#ifdef PAE +#ifdef __i386__ /* * Resources use long's to track resources, so we can't * include memory regions above 4GB. From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 13:06:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 169CC10656D2; Tue, 2 Nov 2010 13:06:42 +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 DE3CB8FC19; Tue, 2 Nov 2010 13:06:41 +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 9966946B1A; Tue, 2 Nov 2010 09:06:41 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B84168A029; Tue, 2 Nov 2010 09:06:40 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Date: Tue, 2 Nov 2010 09:06:24 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201011021300.oA2D0vi2047228@svn.freebsd.org> In-Reply-To: <201011021300.oA2D0vi2047228@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201011020906.24337.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 02 Nov 2010 09:06:40 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r214675 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 13:06:42 -0000 On Tuesday, November 02, 2010 9:00:57 am John Baldwin wrote: > Author: jhb > Date: Tue Nov 2 13:00:56 2010 > New Revision: 214675 > URL: http://svn.freebsd.org/changeset/base/214675 > > Log: > Don't leak the LLE lock if the arptimer callout is pending or inactive. > > Reported by: David Rhodus > MFC after: 1 month I wonder if this should not be a panic offense instead? -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 13:58:33 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 208081065679; Tue, 2 Nov 2010 13:58:33 +0000 (UTC) (envelope-from kensmith@buffalo.edu) Received: from localmailB.acsu.buffalo.edu (localmail.buffalo.edu [128.205.5.200]) by mx1.freebsd.org (Postfix) with ESMTP id DBDDF8FC08; Tue, 2 Nov 2010 13:58:32 +0000 (UTC) Received: from localmailB.acsu.buffalo.edu (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id BE46E133A; Tue, 2 Nov 2010 09:42:31 -0400 (EDT) Received: from localmailB.acsu.buffalo.edu (localhost [127.0.0.1]) by localmailB.acsu.buffalo.edu (Postfix) with ESMTP id E19A0139F; Tue, 2 Nov 2010 09:42:30 -0400 (EDT) Received: from mweb1.acsu.buffalo.edu (mweb1.acsu.buffalo.edu [128.205.5.238]) by localmailB.acsu.buffalo.edu (Prefixe) with ESMTP id D3E35148A; Tue, 2 Nov 2010 09:42:30 -0400 (EDT) Received: from [128.205.32.76] (bauer.cse.buffalo.edu [128.205.32.76]) by mweb1.acsu.buffalo.edu (Postfix) with ESMTP id BC4795B003B; Tue, 2 Nov 2010 09:42:30 -0400 (EDT) From: Ken Smith To: Alexander Best In-Reply-To: <20101102014059.GA91353@freebsd.org> References: <201010310921.o9V9LSo4075408@svn.freebsd.org> <20101031160603.GD2160@garage.freebsd.pl> <20101031191119.GM46314@acme.spoerlein.net> <1288620951.3596.32.camel@bauer.cse.buffalo.edu> <20101102014059.GA91353@freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-U70p7GzrMpUxTsTTu+x7" Date: Tue, 02 Nov 2010 09:42:30 -0400 Message-ID: <1288705350.7246.24.camel@bauer.cse.buffalo.edu> Mime-Version: 1.0 X-Mailer: Evolution 2.28.2 FreeBSD GNOME Team Port X-PM-EL-Spam-Prob: : 8% Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek , Ulrich Spoerlein Subject: Re: svn commit: r214596 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 13:58:33 -0000 --=-U70p7GzrMpUxTsTTu+x7 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Tue, 2010-11-02 at 01:40 +0000, Alexander Best wrote: > how about a compromise then? let's leave the -P switch in rm, but make it= a no > op! in addition to that add a new rm(1) entry explaining what the -P swit= ch did > and why exactly it was turned into a no op. let's be really eloborate on = this > issue and tell the user exactly every tiny detail that lead to the conclu= sion > that currently the -P switch serves no purpose and thus it was turned int= o a no > op. also a statement should be added to rm(1) that makes clear that the -= P flag > *will* come back to rm, once the low level work has been finished in orde= r to > decide (from userland) whether a specific disk supports overwriting block= s or > not. >=20 > thoughts?=20 This doesn't quite solve the issue I'm most concerned with. As a "best practices" type thing people are told to be careful to erase sensitive data. People right now may be using "rm -P" to do that, thinking they followed the best practices. And how many of you re-read the manual page for every command you use when a new version of the OS comes out? The tweaks to the manual page would prevent new people from being fooled into thinking they're following best practices but would do nothing to let people who found -P a while ago know they aren't actually following best practices after all. Making -P a no-op actually makes the above issue worse. As Ceri said, if anything it should fail. But I'm not sure what the difference is between -P failing any time you use it versus just removing -P until the support for it is in place. From the discussions so far it seems like the world has changed to the point support for it may not be possible. =20 --=20 Ken Smith - From there to here, from here to | kensmith@buffalo.edu there, funny things are everywhere. | - Theodor Geisel | --=-U70p7GzrMpUxTsTTu+x7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEABECAAYFAkzQFTkACgkQ/G14VSmup/YyfgCghXC/2nQvpe2bEZgEzSciN19f 828An3Mss8LjasqmHuNph0+79QswjhVK =MrIi -----END PGP SIGNATURE----- --=-U70p7GzrMpUxTsTTu+x7-- From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 16:56:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FE3E106566B; Tue, 2 Nov 2010 16:56:14 +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 D032B8FC0C; Tue, 2 Nov 2010 16:56:13 +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 5E1CD46BA3; Tue, 2 Nov 2010 12:56:13 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 67E788A009; Tue, 2 Nov 2010 12:56:12 -0400 (EDT) From: John Baldwin To: David Rhodus Date: Tue, 2 Nov 2010 12:56:01 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201011021300.oA2D0vi2047228@svn.freebsd.org> <753733.9668.qm@web114311.mail.gq1.yahoo.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011021256.01083.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 02 Nov 2010 12:56:12 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: Fw: svn commit: r214675 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 16:56:14 -0000 On Tuesday, November 02, 2010 12:41:54 pm David Rhodus wrote: > > ----- Forwarded Message ---- > > From: John Baldwin > > To: src-committers@freebsd.org > > Cc: svn-src-head@freebsd.org; svn-src-all@freebsd.org > > Sent: Tue, November 2, 2010 9:06:24 AM > > Subject: Re: svn commit: r214675 - head/sys/netinet > > > > On Tuesday, November 02, 2010 9:00:57 am John Baldwin wrote: > >> Author: jhb > >> Date: Tue Nov 2 13:00:56 2010 > >> New Revision: 214675 > >> URL: http://svn.freebsd.org/changeset/base/214675 > >> > >> Log: > >> Don't leak the LLE lock if the arptimer callout is pending or inactive. > >> > >> Reported by: David Rhodus > >> MFC after: 1 month > > > > I wonder if this should not be a panic offense instead? > > > > No panic but that kernel appears to have deadlocked. > > dmesg -a|grep arp > arptimer issue: 0xc9335280, IPv4 address: "207.230.215.97" > > > PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND > 11 root 4 171 ki31 0K 32K RUN 0 500.3H 393.12% idle > 12 root 24 -60 - 0K 192K WAIT 0 18.6H 10.94% intr > 22 root 1 45 - 0K 8K syncer 2 67:36 0.98% syncer > 64402 root 1 44 0 9944K 2232K CPU0 0 0:13 0.10% top > 0 root 11 44 0 0K 80K deadlk 1 37.4H 0.00% kernel That is not a deadlock, that is just the deadlkres thread being idle. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 17:00:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 110FE106566C; Tue, 2 Nov 2010 17:00:57 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F23778FC08; Tue, 2 Nov 2010 17:00: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 oA2H0usM069317; Tue, 2 Nov 2010 17:00:56 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2H0uwE069308; Tue, 2 Nov 2010 17:00:56 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201011021700.oA2H0uwE069308@svn.freebsd.org> From: Ed Schouten Date: Tue, 2 Nov 2010 17:00: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: r214680 - in head: bin/stty include lib/libc/gen libexec/getty libexec/rlogind X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 17:00:57 -0000 Author: ed Date: Tue Nov 2 17:00:56 2010 New Revision: 214680 URL: http://svn.freebsd.org/changeset/base/214680 Log: Add a new libc function: cfmakesane(3). I've noticed various terminal emulators that need to obtain a sane default termios structure use very complex `hacks'. Even though POSIX doesn't provide any functionality for this, extend our termios API with cfmakesane(3), which is similar to the commonly supported cfmakeraw(3), except that it fills the termios structure with sane defaults. Change all code in our base system to use this function, instead of depending on to provide TTYDEF_*. Modified: head/bin/stty/key.c head/include/termios.h head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/gen/tcsetattr.3 head/lib/libc/gen/termios.c head/libexec/getty/main.c head/libexec/rlogind/rlogind.c Modified: head/bin/stty/key.c ============================================================================== --- head/bin/stty/key.c Tue Nov 2 14:29:39 2010 (r214679) +++ head/bin/stty/key.c Tue Nov 2 17:00:56 2010 (r214680) @@ -257,14 +257,15 @@ f_rows(struct info *ip) void f_sane(struct info *ip) { + struct termios def; - ip->t.c_cflag = TTYDEF_CFLAG | (ip->t.c_cflag & CLOCAL); - ip->t.c_iflag = TTYDEF_IFLAG; - ip->t.c_iflag |= ICRNL; + cfmakesane(&def); + ip->t.c_cflag = def.c_cflag | (ip->t.c_cflag & CLOCAL); + ip->t.c_iflag = def.c_iflag; /* preserve user-preference flags in lflag */ #define LKEEP (ECHOKE|ECHOE|ECHOK|ECHOPRT|ECHOCTL|ALTWERASE|TOSTOP|NOFLSH) - ip->t.c_lflag = TTYDEF_LFLAG | (ip->t.c_lflag & LKEEP); - ip->t.c_oflag = TTYDEF_OFLAG; + ip->t.c_lflag = def.c_lflag | (ip->t.c_lflag & LKEEP); + ip->t.c_oflag = def.c_oflag; ip->set = 1; } Modified: head/include/termios.h ============================================================================== --- head/include/termios.h Tue Nov 2 14:29:39 2010 (r214679) +++ head/include/termios.h Tue Nov 2 17:00:56 2010 (r214680) @@ -88,6 +88,7 @@ pid_t tcgetsid(int); int tcsetsid(int, pid_t); void cfmakeraw(struct termios *); +void cfmakesane(struct termios *); int cfsetspeed(struct termios *, speed_t); #endif __END_DECLS Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Tue Nov 2 14:29:39 2010 (r214679) +++ head/lib/libc/gen/Makefile.inc Tue Nov 2 17:00:56 2010 (r214680) @@ -180,9 +180,9 @@ MLINKS+=syslog.3 closelog.3 syslog.3 ope syslog.3 vsyslog.3 MLINKS+=tcsendbreak.3 tcdrain.3 tcsendbreak.3 tcflow.3 tcsendbreak.3 tcflush.3 MLINKS+=tcsetattr.3 cfgetispeed.3 tcsetattr.3 cfgetospeed.3 \ - tcsetattr.3 cfmakeraw.3 tcsetattr.3 cfsetispeed.3 \ - tcsetattr.3 cfsetospeed.3 tcsetattr.3 cfsetspeed.3 \ - tcsetattr.3 tcgetattr.3 + tcsetattr.3 cfmakeraw.3 tcsetattr.3 cfmakesane.3 \ + tcsetattr.3 cfsetispeed.3 tcsetattr.3 cfsetospeed.3 \ + tcsetattr.3 cfsetspeed.3 tcsetattr.3 tcgetattr.3 MLINKS+=ttyname.3 isatty.3 ttyname.3 ttyname_r.3 MLINKS+=tzset.3 tzsetwall.3 MLINKS+=unvis.3 strunvis.3 unvis.3 strunvisx.3 Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Tue Nov 2 14:29:39 2010 (r214679) +++ head/lib/libc/gen/Symbol.map Tue Nov 2 17:00:56 2010 (r214680) @@ -358,6 +358,7 @@ FBSD_1.1 { FBSD_1.2 { basename_r; + cfmakesane; endutxent; getpagesizes; getutxent; Modified: head/lib/libc/gen/tcsetattr.3 ============================================================================== --- head/lib/libc/gen/tcsetattr.3 Tue Nov 2 14:29:39 2010 (r214679) +++ head/lib/libc/gen/tcsetattr.3 Tue Nov 2 17:00:56 2010 (r214680) @@ -38,6 +38,7 @@ .Nm cfsetospeed , .Nm cfsetspeed , .Nm cfmakeraw , +.Nm cfmakesane , .Nm tcgetattr , .Nm tcsetattr .Nd manipulating the termios structure @@ -57,6 +58,8 @@ .Fn cfsetspeed "struct termios *t" "speed_t speed" .Ft void .Fn cfmakeraw "struct termios *t" +.Ft void +.Fn cfmakesane "struct termios *t" .Ft int .Fn tcgetattr "int fd" "struct termios *t" .Ft int @@ -64,6 +67,7 @@ .Sh DESCRIPTION The .Fn cfmakeraw , +.Fn cfmakesane , .Fn tcgetattr and .Fn tcsetattr @@ -180,14 +184,20 @@ The .Fn cfmakeraw function sets the flags stored in the termios structure to a state disabling all input and output processing, giving a -.Dq raw I/O path . +.Dq raw I/O path , +while the +.Fn cfmakesane +function sets them to a state similar to those of a newly created +terminal device. It should be noted that there is no function to reverse this effect. This is because there are a variety of processing options that could be re-enabled and the correct method is for an application to snapshot the current terminal state using the function .Fn tcgetattr , -setting raw mode with +setting raw or sane mode with .Fn cfmakeraw +or +.Fn cfmakesane and the subsequent .Fn tcsetattr , and then using another @@ -316,7 +326,8 @@ functions are expected to be compliant w .St -p1003.1-88 specification. The -.Fn cfmakeraw +.Fn cfmakeraw , +.Fn cfmakesane and .Fn cfsetspeed functions, Modified: head/lib/libc/gen/termios.c ============================================================================== --- head/lib/libc/gen/termios.c Tue Nov 2 14:29:39 2010 (r214679) +++ head/lib/libc/gen/termios.c Tue Nov 2 17:00:56 2010 (r214680) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#define TTYDEFCHARS #include #include #include "un-namespace.h" @@ -173,6 +175,23 @@ cfmakeraw(struct termios *t) t->c_cc[VTIME] = 0; } +/* + * Obtain a termios structure which is similar to the one provided by + * the kernel. + */ +void +cfmakesane(struct termios *t) +{ + + t->c_cflag = TTYDEF_CFLAG; + t->c_iflag = TTYDEF_IFLAG; + t->c_lflag = TTYDEF_LFLAG; + t->c_oflag = TTYDEF_OFLAG; + t->c_ispeed = TTYDEF_SPEED; + t->c_ospeed = TTYDEF_SPEED; + memcpy(&t->c_cc, ttydefchars, sizeof ttydefchars); +} + int tcsendbreak(int fd, int len __unused) { Modified: head/libexec/getty/main.c ============================================================================== --- head/libexec/getty/main.c Tue Nov 2 14:29:39 2010 (r214679) +++ head/libexec/getty/main.c Tue Nov 2 17:00:56 2010 (r214680) @@ -454,8 +454,9 @@ opentty(const char *tty, int flags) } static void -defttymode() +defttymode(void) { + struct termios def; /* Start with default tty settings. */ if (tcgetattr(STDIN_FILENO, &tmode) < 0) { @@ -471,10 +472,11 @@ defttymode() * to leave their idea of the preferred VERASE key value * there. */ - tmode.c_iflag = TTYDEF_IFLAG; - tmode.c_oflag = TTYDEF_OFLAG; - tmode.c_lflag = TTYDEF_LFLAG; - tmode.c_cflag = TTYDEF_CFLAG; + cfmakesane(&def); + tmode.c_iflag = def.c_iflag; + tmode.c_oflag = def.c_oflag; + tmode.c_lflag = def.c_lflag; + tmode.c_cflag = def.c_cflag; if (NC) tmode.c_cflag |= CLOCAL; omode = tmode; Modified: head/libexec/rlogind/rlogind.c ============================================================================== --- head/libexec/rlogind/rlogind.c Tue Nov 2 14:29:39 2010 (r214679) +++ head/libexec/rlogind/rlogind.c Tue Nov 2 17:00:56 2010 (r214680) @@ -545,7 +545,7 @@ setup_term(int fd) { char *cp = index(term+ENVSIZE, '/'); char *speed; - struct termios tt; + struct termios tt, def; #ifndef notyet tcgetattr(fd, &tt); @@ -558,9 +558,10 @@ setup_term(int fd) cfsetspeed(&tt, atoi(speed)); } - tt.c_iflag = TTYDEF_IFLAG; - tt.c_oflag = TTYDEF_OFLAG; - tt.c_lflag = TTYDEF_LFLAG; + cfmakesane(&def); + tt.c_iflag = def.c_iflag; + tt.c_oflag = def.c_oflag; + tt.c_lflag = def.c_lflag; tcsetattr(fd, TCSAFLUSH, &tt); #else if (cp) { From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 17:08:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 728D6106564A; Tue, 2 Nov 2010 17:08:34 +0000 (UTC) (envelope-from sdrhodus@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id AA2D58FC23; Tue, 2 Nov 2010 17:08:33 +0000 (UTC) Received: by wyb42 with SMTP id 42so6857222wyb.13 for ; Tue, 02 Nov 2010 10:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Y+fSh3tObVFiqlDDxqQvEROQhnDtVC1vV9VilunoAEE=; b=B6DQysMW9sypy9uhbNet3Xyt0aI2WE9EZ8l31LWP9o0DfNl3i5K0U0UG9zzQozpFUg KAqWjuQ6A9vXyBSL5lVt5Q7huIkpPrLHbo0yScTKGQogvUVwkzbPKUrOFlxftoLjzaib p65B+Oj9/UvhtT3aYRVck4/YOQph7Qy7WgfTs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=nwqHyXy7fw5QCjAwk7VrNGwo5RWPxHpga98Llolw3JJYAqCSeV7dNGSGWheUYzVOS6 WmRE9vzMq7MhUuYSI78eui9SShWEk2F9ody3/BwpOXDSRP4Q6x1LjAj5d0KTvjwZg6UP uplSmHhsvKlGekzb2VO2y7XHMZglqZYziwsbU= Received: by 10.227.157.148 with SMTP id b20mr9745954wbx.14.1288716134748; Tue, 02 Nov 2010 09:42:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.60.137 with HTTP; Tue, 2 Nov 2010 09:41:54 -0700 (PDT) In-Reply-To: <753733.9668.qm@web114311.mail.gq1.yahoo.com> References: <201011021300.oA2D0vi2047228@svn.freebsd.org> <753733.9668.qm@web114311.mail.gq1.yahoo.com> From: David Rhodus Date: Tue, 2 Nov 2010 12:41:54 -0400 Message-ID: To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: Fw: svn commit: r214675 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 17:08:34 -0000 > ----- Forwarded Message ---- > From: John Baldwin > To: src-committers@freebsd.org > Cc: svn-src-head@freebsd.org; svn-src-all@freebsd.org > Sent: Tue, November 2, 2010 9:06:24 AM > Subject: Re: svn commit: r214675 - head/sys/netinet > > On Tuesday, November 02, 2010 9:00:57 am John Baldwin wrote: >> Author: jhb >> Date: Tue Nov =A02 13:00:56 2010 >> New Revision: 214675 >> URL: http://svn.freebsd.org/changeset/base/214675 >> >> Log: >> =A0 Don't leak the LLE lock if the arptimer callout is pending or inacti= ve. >> >> =A0 Reported by: =A0 =A0David Rhodus >> =A0 MFC after: =A0 =A01 month > > I wonder if this should not be a panic offense instead? > No panic but that kernel appears to have deadlocked. dmesg -a|grep arp arptimer issue: 0xc9335280, IPv4 address: "207.230.215.97" PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND 11 root 4 171 ki31 0K 32K RUN 0 500.3H 393.12% idle 12 root 24 -60 - 0K 192K WAIT 0 18.6H 10.94% intr 22 root 1 45 - 0K 8K syncer 2 67:36 0.98% syncer 64402 root 1 44 0 9944K 2232K CPU0 0 0:13 0.10% top 0 root 11 44 0 0K 80K deadlk 1 37.4H 0.00% kernel From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 17:56:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F158C106566C; Tue, 2 Nov 2010 17:56: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 C58E18FC0C; Tue, 2 Nov 2010 17:56: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 oA2HuGw1073486; Tue, 2 Nov 2010 17:56:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2HuGWd073483; Tue, 2 Nov 2010 17:56:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011021756.oA2HuGWd073483@svn.freebsd.org> From: John Baldwin Date: Tue, 2 Nov 2010 17:56: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: r214681 - in head/sys: i386/i386 x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 17:56:17 -0000 Author: jhb Date: Tue Nov 2 17:56:16 2010 New Revision: 214681 URL: http://svn.freebsd.org/changeset/base/214681 Log: Further tweaks to the ram_attach() routine: - Use > 2^32 - 1 instead of >= when checking for memory regions above 4G. - Skip SMAP entries > 4G on i386 rather than breaking out of the loop since SMAP entries are not guaranteed to be in order. - Remove 'i' and loop over 'rid' directly in the dump_avail[] case. - Only check for 4G regions in the dump_avail[] case on i386 if PAE is enabled since vm_paddr_t is 32-bit in the !PAE case. Submitted by: alc Modified: head/sys/i386/i386/machdep.c head/sys/x86/x86/nexus.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Tue Nov 2 17:00:56 2010 (r214680) +++ head/sys/i386/i386/machdep.c Tue Nov 2 17:56:16 2010 (r214681) @@ -1970,7 +1970,7 @@ add_smap_entry(struct bios_smap *smap, v return (1); #ifndef PAE - if (smap->base >= 0xffffffff) { + if (smap->base > 0xffffffff) { printf("%uK of memory above 4GB ignored\n", (u_int)(smap->length / 1024)); return (1); Modified: head/sys/x86/x86/nexus.c ============================================================================== --- head/sys/x86/x86/nexus.c Tue Nov 2 17:00:56 2010 (r214680) +++ head/sys/x86/x86/nexus.c Tue Nov 2 17:56:16 2010 (r214681) @@ -674,7 +674,7 @@ ram_attach(device_t dev) vm_paddr_t *p; caddr_t kmdp; uint32_t smapsize; - int error, i, rid; + int error, rid; /* Retrieve the system memory map from the loader. */ kmdp = preload_search_by_type("elf kernel"); @@ -699,8 +699,8 @@ ram_attach(device_t dev) * Resources use long's to track resources, so * we can't include memory regions above 4GB. */ - if (smap->base >= ~0ul) - break; + if (smap->base > ~0ul) + continue; #endif error = bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->base, smap->length); @@ -727,24 +727,23 @@ ram_attach(device_t dev) * instead of the start since the start address for the first * segment is 0. */ - for (i = 0, p = dump_avail; p[1] != 0; i++, p += 2) { - rid = i; -#ifdef __i386__ + for (rid = 0, p = dump_avail; p[1] != 0; rid++, p += 2) { +#if defined(__i386__) && defined(PAE) /* * Resources use long's to track resources, so we can't * include memory regions above 4GB. */ - if (p[0] >= ~0ul) + if (p[0] > ~0ul) break; #endif error = bus_set_resource(dev, SYS_RES_MEMORY, rid, p[0], p[1] - p[0]); if (error) - panic("ram_attach: resource %d failed set with %d", i, + panic("ram_attach: resource %d failed set with %d", rid, error); res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0); if (res == NULL) - panic("ram_attach: resource %d failed to attach", i); + panic("ram_attach: resource %d failed to attach", rid); } return (0); } From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 18:34:32 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A649106566B; Tue, 2 Nov 2010 18:34:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 196E68FC08; Tue, 2 Nov 2010 18:34: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 oA2IYVX0075506; Tue, 2 Nov 2010 18:34:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2IYVIS075504; Tue, 2 Nov 2010 18:34:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011021834.oA2IYVIS075504@svn.freebsd.org> From: John Baldwin Date: Tue, 2 Nov 2010 18:34: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: r214682 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 18:34:32 -0000 Author: jhb Date: Tue Nov 2 18:34:31 2010 New Revision: 214682 URL: http://svn.freebsd.org/changeset/base/214682 Log: Tweak the waitchannel messages for the dead lock detection kthread. Use a shorter message (userland generally only sees the first 6 to 8 characters) when waiting for the allproc lock. Use "-" when idle to math the behavior of other kthreads. Reviewed by: attilio MFC after: 1 week Modified: head/sys/kern/kern_clock.c Modified: head/sys/kern/kern_clock.c ============================================================================== --- head/sys/kern/kern_clock.c Tue Nov 2 17:56:16 2010 (r214681) +++ head/sys/kern/kern_clock.c Tue Nov 2 18:34:31 2010 (r214682) @@ -195,7 +195,7 @@ deadlkres(void) panic("%s: possible deadlock detected on allproc_lock\n", __func__); tryl++; - pause("allproc_lock deadlkres", sleepfreq * hz); + pause("allproc", sleepfreq * hz); continue; } tryl = 0; @@ -288,7 +288,7 @@ deadlkres(void) sx_sunlock(&allproc_lock); /* Sleep for sleepfreq seconds. */ - pause("deadlkres", sleepfreq * hz); + pause("-", sleepfreq * hz); } } From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 20:06:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDADC1065672; Tue, 2 Nov 2010 20:06:46 +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 D9EE58FC12; Tue, 2 Nov 2010 20:06: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 oA2K6kP1082092; Tue, 2 Nov 2010 20:06:46 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2K6k4s082087; Tue, 2 Nov 2010 20:06:46 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011022006.oA2K6k4s082087@svn.freebsd.org> From: Marius Strobl Date: Tue, 2 Nov 2010 20:06:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214684 - in stable/8/sys: dev/mii modules/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 20:06:47 -0000 Author: marius Date: Tue Nov 2 20:06:46 2010 New Revision: 214684 URL: http://svn.freebsd.org/changeset/base/214684 Log: MFC: r213878 Add a NetBSD-compatible mii_attach(), which is intended to eventually replace mii_phy_probe() altogether. Compared to the latter the advantages of mii_attach() are: - intended to be called multiple times in order to attach PHYs in multiple passes (f.e. in order to only use sub-ranges of the 0 to MII_NPHY - 1 range) - being able to pass along the capability mask from the NIC to the PHY drivers - being able to specify at which address (phyloc) to probe for a PHY (instead of always probing at all addresses from 0 to MII_NPHY - 1) - being able to specify which PHY instance (offloc) to attach - being able to pass along MIIF_* flags from the NIC to the PHY drivers (f.e. as required to indicated to the PHY drivers that flow control is supported by the NIC driver, which actually is the motivation for this change). While at it, I used the opportunity to get rid of some hacks in mii(4) like miibus_probe() generally doing work besides sheer probing and the "EVIL HACK" (which will vanish entirely along with mii_phy_probe()) by passing the struct ifnet pointer via an argument of mii_attach() as well as to fix some resource leaks in mii(4) in case something fails. Commits which will update the PHY drivers to honor the MII flags passed down from the NIC drivers and take advantage of mii_attach() to get rid of certain types of hacks in NIC and PHY drivers as well as a conversion of the remaining uses of mii_phy_probe() will follow shortly. Reviewed by: jhb, yongari Obtained from: NetBSD (partially) Modified: stable/8/sys/dev/mii/mii.c stable/8/sys/dev/mii/mii.h stable/8/sys/dev/mii/miivar.h stable/8/sys/modules/mii/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/mii.c ============================================================================== --- stable/8/sys/dev/mii/mii.c Tue Nov 2 19:33:45 2010 (r214683) +++ stable/8/sys/dev/mii/mii.c Tue Nov 2 20:06:46 2010 (r214684) @@ -58,6 +58,8 @@ MODULE_VERSION(miibus, 1); #include "miibus_if.h" static int miibus_print_child(device_t dev, device_t child); +static int miibus_read_ivar(device_t dev, device_t child, int which, + uintptr_t *result); static int miibus_child_location_str(device_t bus, device_t child, char *buf, size_t buflen); static int miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf, @@ -77,6 +79,7 @@ static device_method_t miibus_methods[] /* bus interface */ DEVMETHOD(bus_print_child, miibus_print_child), + DEVMETHOD(bus_read_ivar, miibus_read_ivar), DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, miibus_child_location_str), @@ -100,87 +103,52 @@ driver_t miibus_driver = { }; struct miibus_ivars { + struct ifnet *ifp; ifm_change_cb_t ifmedia_upd; ifm_stat_cb_t ifmedia_sts; + int mii_flags; }; -/* - * Helper function used by network interface drivers, attaches PHYs - * to the network interface driver parent. - */ int miibus_probe(device_t dev) { - struct mii_attach_args ma, *args; - struct mii_data *mii; - device_t child = NULL, parent; - int bmsr, capmask = 0xFFFFFFFF; - - mii = device_get_softc(dev); - parent = device_get_parent(dev); - LIST_INIT(&mii->mii_phys); - - for (ma.mii_phyno = 0; ma.mii_phyno < MII_NPHY; ma.mii_phyno++) { - /* - * Check to see if there is a PHY at this address. Note, - * many braindead PHYs report 0/0 in their ID registers, - * so we test for media in the BMSR. - */ - bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR); - if (bmsr == 0 || bmsr == 0xffff || - (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) { - /* Assume no PHY at this address. */ - continue; - } - - /* - * Extract the IDs. Braindead PHYs will be handled by - * the `ukphy' driver, as we have no ID information to - * match on. - */ - ma.mii_id1 = MIIBUS_READREG(parent, ma.mii_phyno, - MII_PHYIDR1); - ma.mii_id2 = MIIBUS_READREG(parent, ma.mii_phyno, - MII_PHYIDR2); - - ma.mii_data = mii; - ma.mii_capmask = capmask; - - args = malloc(sizeof(struct mii_attach_args), - M_DEVBUF, M_NOWAIT); - bcopy((char *)&ma, (char *)args, sizeof(ma)); - child = device_add_child(dev, NULL, -1); - device_set_ivars(child, args); - } - - if (child == NULL) - return (ENXIO); device_set_desc(dev, "MII bus"); - return (0); + return (BUS_PROBE_SPECIFIC); } int miibus_attach(device_t dev) { struct miibus_ivars *ivars; + struct mii_attach_args *ma; struct mii_data *mii; + device_t *children; + int i, nchildren; mii = device_get_softc(dev); - /* - * Note that each NIC's softc must start with an ifnet pointer. - * XXX: EVIL HACK! - */ - mii->mii_ifp = *(struct ifnet**)device_get_softc(device_get_parent(dev)); - mii->mii_ifp->if_capabilities |= IFCAP_LINKSTATE; - mii->mii_ifp->if_capenable |= IFCAP_LINKSTATE; + nchildren = 0; + if (device_get_children(dev, &children, &nchildren) == 0) { + for (i = 0; i < nchildren; i++) { + ma = device_get_ivars(children[i]); + ma->mii_data = mii; + } + free(children, M_TEMP); + } + if (nchildren == 0) { + device_printf(dev, "cannot get children"); + return (ENXIO); + } ivars = device_get_ivars(dev); ifmedia_init(&mii->mii_media, IFM_IMASK, ivars->ifmedia_upd, ivars->ifmedia_sts); - bus_generic_attach(dev); + mii->mii_ifp = ivars->ifp; + mii->mii_ifp->if_capabilities |= IFCAP_LINKSTATE; + mii->mii_ifp->if_capenable |= IFCAP_LINKSTATE; + LIST_INIT(&mii->mii_phys); - return (0); + return (bus_generic_attach(dev)); } int @@ -211,7 +179,28 @@ miibus_print_child(device_t dev, device_ } static int -miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf, +miibus_read_ivar(device_t dev, device_t child __unused, int which, + uintptr_t *result) +{ + struct miibus_ivars *ivars; + + /* + * NB: this uses the instance variables of the miibus rather than + * its PHY children. + */ + ivars = device_get_ivars(dev); + switch (which) { + case MIIBUS_IVAR_FLAGS: + *result = ivars->mii_flags; + break; + default: + return (ENOENT); + } + return (0); +} + +static int +miibus_child_pnpinfo_str(device_t bus __unused, device_t child, char *buf, size_t buflen) { struct mii_attach_args *ma; @@ -224,7 +213,7 @@ miibus_child_pnpinfo_str(device_t bus, d } static int -miibus_child_location_str(device_t bus, device_t child, char *buf, +miibus_child_location_str(device_t bus __unused, device_t child, char *buf, size_t buflen) { struct mii_attach_args *ma; @@ -318,40 +307,177 @@ miibus_mediainit(device_t dev) ifmedia_set(&mii->mii_media, media); } +/* + * Helper function used by network interface drivers, attaches the miibus and + * the PHYs to the network interface driver parent. + */ int -mii_phy_probe(device_t dev, device_t *child, ifm_change_cb_t ifmedia_upd, - ifm_stat_cb_t ifmedia_sts) -{ - struct miibus_ivars *ivars; - int bmsr, i; +mii_attach(device_t dev, device_t *miibus, struct ifnet *ifp, + ifm_change_cb_t ifmedia_upd, ifm_stat_cb_t ifmedia_sts, int capmask, + int phyloc, int offloc, int flags) +{ + struct miibus_ivars *ivars; + struct mii_attach_args ma, *args; + device_t *children, phy; + int bmsr, first, i, nchildren, offset, phymax, phymin, rv; + + if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) { + printf("%s: phyloc and offloc specified", __func__); + return (EINVAL); + } - ivars = malloc(sizeof(*ivars), M_DEVBUF, M_NOWAIT); - if (ivars == NULL) - return (ENOMEM); - ivars->ifmedia_upd = ifmedia_upd; - ivars->ifmedia_sts = ifmedia_sts; - *child = device_add_child(dev, "miibus", -1); - device_set_ivars(*child, ivars); - - for (i = 0; i < MII_NPHY; i++) { - bmsr = MIIBUS_READREG(dev, i, MII_BMSR); - if (bmsr == 0 || bmsr == 0xffff || - (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) { - /* Assume no PHY at this address. */ - continue; - } else - break; + if (offloc != MII_OFFSET_ANY && (offloc < 0 || offloc >= MII_NPHY)) { + printf("%s: ivalid offloc %d", __func__, offloc); + return (EINVAL); } - if (i == MII_NPHY) { - device_delete_child(dev, *child); - *child = NULL; - return (ENXIO); + if (phyloc == MII_PHY_ANY) { + phymin = 0; + phymax = MII_NPHY - 1; + } else { + if (phyloc < 0 || phyloc >= MII_NPHY) { + printf("%s: ivalid phyloc %d", __func__, phyloc); + return (EINVAL); + } + phymin = phymax = phyloc; } - bus_generic_attach(dev); + first = 0; + if (*miibus == NULL) { + first = 1; + ivars = malloc(sizeof(*ivars), M_DEVBUF, M_NOWAIT); + if (ivars == NULL) + return (ENOMEM); + ivars->ifp = ifp; + ivars->ifmedia_upd = ifmedia_upd; + ivars->ifmedia_sts = ifmedia_sts; + ivars->mii_flags = flags; + *miibus = device_add_child(dev, "miibus", -1); + if (*miibus == NULL) { + rv = ENXIO; + goto fail; + } + device_set_ivars(*miibus, ivars); + } else { + ivars = device_get_ivars(*miibus); + if (ivars->ifp != ifp || ivars->ifmedia_upd != ifmedia_upd || + ivars->ifmedia_sts != ifmedia_sts || + ivars->mii_flags != flags) { + printf("%s: non-matching invariant", __func__); + return (EINVAL); + } + /* + * Assignment of the attach arguments mii_data for the first + * pass is done in miibus_attach(), i.e. once the miibus softc + * has been allocated. + */ + ma.mii_data = device_get_softc(*miibus); + } + + ma.mii_capmask = capmask; + + phy = NULL; + offset = 0; + for (ma.mii_phyno = phymin; ma.mii_phyno <= phymax; ma.mii_phyno++) { + /* + * Make sure we haven't already configured a PHY at this + * address. This allows mii_attach() to be called + * multiple times. + */ + if (device_get_children(*miibus, &children, &nchildren) == 0) { + for (i = 0; i < nchildren; i++) { + args = device_get_ivars(children[i]); + if (args->mii_phyno == ma.mii_phyno) { + /* + * Yes, there is already something + * configured at this address. + */ + free(children, M_TEMP); + goto skip; + } + } + free(children, M_TEMP); + } + + /* + * Check to see if there is a PHY at this address. Note, + * many braindead PHYs report 0/0 in their ID registers, + * so we test for media in the BMSR. + */ + bmsr = MIIBUS_READREG(dev, ma.mii_phyno, MII_BMSR); + if (bmsr == 0 || bmsr == 0xffff || + (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) { + /* Assume no PHY at this address. */ + continue; + } + + /* + * There is a PHY at this address. If we were given an + * `offset' locator, skip this PHY if it doesn't match. + */ + if (offloc != MII_OFFSET_ANY && offloc != offset) + goto skip; + + /* + * Extract the IDs. Braindead PHYs will be handled by + * the `ukphy' driver, as we have no ID information to + * match on. + */ + ma.mii_id1 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR1); + ma.mii_id2 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR2); + + args = malloc(sizeof(struct mii_attach_args), M_DEVBUF, + M_NOWAIT); + if (args == NULL) + goto skip; + bcopy((char *)&ma, (char *)args, sizeof(ma)); + phy = device_add_child(*miibus, NULL, -1); + if (phy == NULL) { + free(args, M_DEVBUF); + goto skip; + } + device_set_ivars(phy, args); + skip: + offset++; + } + + if (first != 0) { + if (phy == NULL) { + rv = ENXIO; + goto fail; + } + rv = bus_generic_attach(dev); + if (rv != 0) + goto fail; + } + rv = bus_generic_attach(*miibus); + if (rv != 0) + goto fail; return (0); + + fail: + if (*miibus != NULL) + device_delete_child(dev, *miibus); + free(ivars, M_DEVBUF); + if (first != 0) + *miibus = NULL; + return (rv); +} + +int +mii_phy_probe(device_t dev, device_t *child, ifm_change_cb_t ifmedia_upd, + ifm_stat_cb_t ifmedia_sts) +{ + struct ifnet *ifp; + + /* + * Note that each NIC's softc must start with an ifnet pointer. + * XXX: EVIL HACK! + */ + ifp = *(struct ifnet **)device_get_softc(dev); + return (mii_attach(dev, child, ifp, ifmedia_upd, ifmedia_sts, + BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)); } /* Modified: stable/8/sys/dev/mii/mii.h ============================================================================== --- stable/8/sys/dev/mii/mii.h Tue Nov 2 19:33:45 2010 (r214683) +++ stable/8/sys/dev/mii/mii.h Tue Nov 2 20:06:46 2010 (r214684) @@ -1,5 +1,5 @@ /* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $ */ - + /*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * @@ -47,7 +47,7 @@ #define MII_COMMAND_WRITE 0x01 #define MII_COMMAND_ACK 0x02 -#define MII_BMCR 0x00 /* Basic mode control register (rw) */ +#define MII_BMCR 0x00 /* Basic mode control register (rw) */ #define BMCR_RESET 0x8000 /* reset */ #define BMCR_LOOP 0x4000 /* loopback */ #define BMCR_SPEED0 0x2000 /* speed selection (LSB) */ @@ -82,6 +82,8 @@ #define BMSR_JABBER 0x0002 /* Jabber detected */ #define BMSR_EXTCAP 0x0001 /* Extended capability */ +#define BMSR_DEFCAPMASK 0xffffffff + /* * Note that the EXTSTAT bit indicates that there is extended status * info available in register 15, but 802.3 section 22.2.4.3 also Modified: stable/8/sys/dev/mii/miivar.h ============================================================================== --- stable/8/sys/dev/mii/miivar.h Tue Nov 2 19:33:45 2010 (r214683) +++ stable/8/sys/dev/mii/miivar.h Tue Nov 2 20:06:46 2010 (r214684) @@ -102,7 +102,7 @@ typedef int (*mii_downcall_t)(struct mii */ struct mii_softc { device_t mii_dev; /* generic device glue */ - + LIST_ENTRY(mii_softc) mii_list; /* entry on parent's PHY list */ int mii_phy; /* our MII address */ @@ -122,16 +122,22 @@ struct mii_softc { typedef struct mii_softc mii_softc_t; /* mii_flags */ -#define MIIF_INITDONE 0x0001 /* has been initialized (mii_data) */ -#define MIIF_NOISOLATE 0x0002 /* do not isolate the PHY */ -#define MIIF_NOLOOP 0x0004 /* no loopback capability */ -#define MIIF_AUTOTSLEEP 0x0010 /* use tsleep(), not callout() */ -#define MIIF_HAVEFIBER 0x0020 /* from parent: has fiber interface */ -#define MIIF_HAVE_GTCR 0x0040 /* has 100base-T2/1000base-T CR */ -#define MIIF_IS_1000X 0x0080 /* is a 1000BASE-X device */ -#define MIIF_DOPAUSE 0x0100 /* advertise PAUSE capability */ -#define MIIF_IS_HPNA 0x0200 /* is a HomePNA device */ -#define MIIF_FORCEANEG 0x0400 /* force auto-negotiation */ +#define MIIF_INITDONE 0x00000001 /* has been initialized (mii_data) */ +#define MIIF_NOISOLATE 0x00000002 /* do not isolate the PHY */ +#define MIIF_NOLOOP 0x00000004 /* no loopback capability */ +#define MIIF_AUTOTSLEEP 0x00000010 /* use tsleep(), not callout() */ +#define MIIF_HAVEFIBER 0x00000020 /* from parent: has fiber interface */ +#define MIIF_HAVE_GTCR 0x00000040 /* has 100base-T2/1000base-T CR */ +#define MIIF_IS_1000X 0x00000080 /* is a 1000BASE-X device */ +#define MIIF_DOPAUSE 0x00000100 /* advertise PAUSE capability */ +#define MIIF_IS_HPNA 0x00000200 /* is a HomePNA device */ +#define MIIF_FORCEANEG 0x00000400 /* force auto-negotiation */ +#define MIIF_MACPRIV0 0x01000000 /* private to the MAC driver */ +#define MIIF_MACPRIV1 0x02000000 /* private to the MAC driver */ +#define MIIF_MACPRIV2 0x04000000 /* private to the MAC driver */ +#define MIIF_PHYPRIV0 0x10000000 /* private to the PHY driver */ +#define MIIF_PHYPRIV1 0x20000000 /* private to the PHY driver */ +#define MIIF_PHYPRIV2 0x40000000 /* private to the PHY driver */ /* Default mii_anegticks values */ #define MII_ANEGTICKS 5 @@ -140,6 +146,14 @@ typedef struct mii_softc mii_softc_t; #define MIIF_INHERIT_MASK (MIIF_NOISOLATE|MIIF_NOLOOP|MIIF_AUTOTSLEEP) /* + * Special `locators' passed to mii_attach(). If one of these is not + * an `any' value, we look for *that* PHY and configure it. If both + * are not `any', that is an error, and mii_attach() will panic. + */ +#define MII_OFFSET_ANY -1 +#define MII_PHY_ANY -1 + +/* * Used to attach a PHY to a parent. */ struct mii_attach_args { @@ -192,6 +206,18 @@ struct mii_media { #define PHY_WRITE(p, r, v) \ MIIBUS_WRITEREG((p)->mii_dev, (p)->mii_phy, (r), (v)) +enum miibus_device_ivars { + MIIBUS_IVAR_FLAGS +}; + +/* + * Simplified accessors for miibus + */ +#define MIIBUS_ACCESSOR(var, ivar, type) \ + __BUS_ACCESSOR(miibus, var, MIIBUS, ivar, type) + +MIIBUS_ACCESSOR(flags, FLAGS, int) + extern devclass_t miibus_devclass; extern driver_t miibus_driver; @@ -199,6 +225,8 @@ int miibus_probe(device_t); int miibus_attach(device_t); int miibus_detach(device_t); +int mii_attach(device_t, device_t *, struct ifnet *, ifm_change_cb_t, + ifm_stat_cb_t, int, int, int, int); int mii_anar(int); void mii_down(struct mii_data *); int mii_mediachg(struct mii_data *); Modified: stable/8/sys/modules/mii/Makefile ============================================================================== --- stable/8/sys/modules/mii/Makefile Tue Nov 2 19:33:45 2010 (r214683) +++ stable/8/sys/modules/mii/Makefile Tue Nov 2 20:06:46 2010 (r214684) @@ -12,7 +12,8 @@ SRCS+= rgephy.c rlphy.c ruephy.c tdkphy. SRCS+= ukphy_subr.c SRCS+= xmphy.c -EXPORT_SYMS= mii_mediachg \ +EXPORT_SYMS= mii_attach \ + mii_mediachg \ mii_phy_probe \ mii_phy_reset \ mii_pollstat \ From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 20:06:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9841106576D; Tue, 2 Nov 2010 20:06:49 +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 C13388FC17; Tue, 2 Nov 2010 20:06:49 +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 oA2K6nKt082134; Tue, 2 Nov 2010 20:06:49 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2K6niX082129; Tue, 2 Nov 2010 20:06:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011022006.oA2K6niX082129@svn.freebsd.org> From: Marius Strobl Date: Tue, 2 Nov 2010 20:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214685 - in stable/7/sys: dev/mii modules/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 20:06:50 -0000 Author: marius Date: Tue Nov 2 20:06:49 2010 New Revision: 214685 URL: http://svn.freebsd.org/changeset/base/214685 Log: MFC: r213878 Add a NetBSD-compatible mii_attach(), which is intended to eventually replace mii_phy_probe() altogether. Compared to the latter the advantages of mii_attach() are: - intended to be called multiple times in order to attach PHYs in multiple passes (f.e. in order to only use sub-ranges of the 0 to MII_NPHY - 1 range) - being able to pass along the capability mask from the NIC to the PHY drivers - being able to specify at which address (phyloc) to probe for a PHY (instead of always probing at all addresses from 0 to MII_NPHY - 1) - being able to specify which PHY instance (offloc) to attach - being able to pass along MIIF_* flags from the NIC to the PHY drivers (f.e. as required to indicated to the PHY drivers that flow control is supported by the NIC driver, which actually is the motivation for this change). While at it, I used the opportunity to get rid of some hacks in mii(4) like miibus_probe() generally doing work besides sheer probing and the "EVIL HACK" (which will vanish entirely along with mii_phy_probe()) by passing the struct ifnet pointer via an argument of mii_attach() as well as to fix some resource leaks in mii(4) in case something fails. Commits which will update the PHY drivers to honor the MII flags passed down from the NIC drivers and take advantage of mii_attach() to get rid of certain types of hacks in NIC and PHY drivers as well as a conversion of the remaining uses of mii_phy_probe() will follow shortly. Reviewed by: jhb, yongari Obtained from: NetBSD (partially) Modified: stable/7/sys/dev/mii/mii.c stable/7/sys/dev/mii/mii.h stable/7/sys/dev/mii/miivar.h stable/7/sys/modules/mii/Makefile Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/mii/mii.c ============================================================================== --- stable/7/sys/dev/mii/mii.c Tue Nov 2 20:06:46 2010 (r214684) +++ stable/7/sys/dev/mii/mii.c Tue Nov 2 20:06:49 2010 (r214685) @@ -58,6 +58,8 @@ MODULE_VERSION(miibus, 1); #include "miibus_if.h" static int miibus_print_child(device_t dev, device_t child); +static int miibus_read_ivar(device_t dev, device_t child, int which, + uintptr_t *result); static int miibus_child_location_str(device_t bus, device_t child, char *buf, size_t buflen); static int miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf, @@ -77,6 +79,7 @@ static device_method_t miibus_methods[] /* bus interface */ DEVMETHOD(bus_print_child, miibus_print_child), + DEVMETHOD(bus_read_ivar, miibus_read_ivar), DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, miibus_child_location_str), @@ -100,85 +103,50 @@ driver_t miibus_driver = { }; struct miibus_ivars { + struct ifnet *ifp; ifm_change_cb_t ifmedia_upd; ifm_stat_cb_t ifmedia_sts; + int mii_flags; }; -/* - * Helper function used by network interface drivers, attaches PHYs - * to the network interface driver parent. - */ int miibus_probe(device_t dev) { - struct mii_attach_args ma, *args; - struct mii_data *mii; - device_t child = NULL, parent; - int bmsr, capmask = 0xFFFFFFFF; - - mii = device_get_softc(dev); - parent = device_get_parent(dev); - LIST_INIT(&mii->mii_phys); - - for (ma.mii_phyno = 0; ma.mii_phyno < MII_NPHY; ma.mii_phyno++) { - /* - * Check to see if there is a PHY at this address. Note, - * many braindead PHYs report 0/0 in their ID registers, - * so we test for media in the BMSR. - */ - bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR); - if (bmsr == 0 || bmsr == 0xffff || - (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) { - /* Assume no PHY at this address. */ - continue; - } - - /* - * Extract the IDs. Braindead PHYs will be handled by - * the `ukphy' driver, as we have no ID information to - * match on. - */ - ma.mii_id1 = MIIBUS_READREG(parent, ma.mii_phyno, - MII_PHYIDR1); - ma.mii_id2 = MIIBUS_READREG(parent, ma.mii_phyno, - MII_PHYIDR2); - - ma.mii_data = mii; - ma.mii_capmask = capmask; - - args = malloc(sizeof(struct mii_attach_args), - M_DEVBUF, M_NOWAIT); - bcopy((char *)&ma, (char *)args, sizeof(ma)); - child = device_add_child(dev, NULL, -1); - device_set_ivars(child, args); - } - - if (child == NULL) - return (ENXIO); device_set_desc(dev, "MII bus"); - return (0); + return (BUS_PROBE_SPECIFIC); } int miibus_attach(device_t dev) { struct miibus_ivars *ivars; + struct mii_attach_args *ma; struct mii_data *mii; + device_t *children; + int i, nchildren; mii = device_get_softc(dev); - /* - * Note that each NIC's softc must start with an ifnet pointer. - * XXX: EVIL HACK! - */ - mii->mii_ifp = *(struct ifnet**)device_get_softc(device_get_parent(dev)); + nchildren = 0; + if (device_get_children(dev, &children, &nchildren) == 0) { + for (i = 0; i < nchildren; i++) { + ma = device_get_ivars(children[i]); + ma->mii_data = mii; + } + free(children, M_TEMP); + } + if (nchildren == 0) { + device_printf(dev, "cannot get children"); + return (ENXIO); + } ivars = device_get_ivars(dev); ifmedia_init(&mii->mii_media, IFM_IMASK, ivars->ifmedia_upd, ivars->ifmedia_sts); - bus_generic_attach(dev); + mii->mii_ifp = ivars->ifp; + LIST_INIT(&mii->mii_phys); - return (0); + return (bus_generic_attach(dev)); } int @@ -209,7 +177,28 @@ miibus_print_child(device_t dev, device_ } static int -miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf, +miibus_read_ivar(device_t dev, device_t child __unused, int which, + uintptr_t *result) +{ + struct miibus_ivars *ivars; + + /* + * NB: this uses the instance variables of the miibus rather than + * its PHY children. + */ + ivars = device_get_ivars(dev); + switch (which) { + case MIIBUS_IVAR_FLAGS: + *result = ivars->mii_flags; + break; + default: + return (ENOENT); + } + return (0); +} + +static int +miibus_child_pnpinfo_str(device_t bus __unused, device_t child, char *buf, size_t buflen) { struct mii_attach_args *ma; @@ -222,7 +211,7 @@ miibus_child_pnpinfo_str(device_t bus, d } static int -miibus_child_location_str(device_t bus, device_t child, char *buf, +miibus_child_location_str(device_t bus __unused, device_t child, char *buf, size_t buflen) { struct mii_attach_args *ma; @@ -316,40 +305,177 @@ miibus_mediainit(device_t dev) ifmedia_set(&mii->mii_media, media); } +/* + * Helper function used by network interface drivers, attaches the miibus and + * the PHYs to the network interface driver parent. + */ int -mii_phy_probe(device_t dev, device_t *child, ifm_change_cb_t ifmedia_upd, - ifm_stat_cb_t ifmedia_sts) -{ - struct miibus_ivars *ivars; - int bmsr, i; +mii_attach(device_t dev, device_t *miibus, struct ifnet *ifp, + ifm_change_cb_t ifmedia_upd, ifm_stat_cb_t ifmedia_sts, int capmask, + int phyloc, int offloc, int flags) +{ + struct miibus_ivars *ivars; + struct mii_attach_args ma, *args; + device_t *children, phy; + int bmsr, first, i, nchildren, offset, phymax, phymin, rv; + + if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) { + printf("%s: phyloc and offloc specified", __func__); + return (EINVAL); + } - ivars = malloc(sizeof(*ivars), M_DEVBUF, M_NOWAIT); - if (ivars == NULL) - return (ENOMEM); - ivars->ifmedia_upd = ifmedia_upd; - ivars->ifmedia_sts = ifmedia_sts; - *child = device_add_child(dev, "miibus", -1); - device_set_ivars(*child, ivars); - - for (i = 0; i < MII_NPHY; i++) { - bmsr = MIIBUS_READREG(dev, i, MII_BMSR); - if (bmsr == 0 || bmsr == 0xffff || - (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) { - /* Assume no PHY at this address. */ - continue; - } else - break; + if (offloc != MII_OFFSET_ANY && (offloc < 0 || offloc >= MII_NPHY)) { + printf("%s: ivalid offloc %d", __func__, offloc); + return (EINVAL); } - if (i == MII_NPHY) { - device_delete_child(dev, *child); - *child = NULL; - return (ENXIO); + if (phyloc == MII_PHY_ANY) { + phymin = 0; + phymax = MII_NPHY - 1; + } else { + if (phyloc < 0 || phyloc >= MII_NPHY) { + printf("%s: ivalid phyloc %d", __func__, phyloc); + return (EINVAL); + } + phymin = phymax = phyloc; } - bus_generic_attach(dev); + first = 0; + if (*miibus == NULL) { + first = 1; + ivars = malloc(sizeof(*ivars), M_DEVBUF, M_NOWAIT); + if (ivars == NULL) + return (ENOMEM); + ivars->ifp = ifp; + ivars->ifmedia_upd = ifmedia_upd; + ivars->ifmedia_sts = ifmedia_sts; + ivars->mii_flags = flags; + *miibus = device_add_child(dev, "miibus", -1); + if (*miibus == NULL) { + rv = ENXIO; + goto fail; + } + device_set_ivars(*miibus, ivars); + } else { + ivars = device_get_ivars(*miibus); + if (ivars->ifp != ifp || ivars->ifmedia_upd != ifmedia_upd || + ivars->ifmedia_sts != ifmedia_sts || + ivars->mii_flags != flags) { + printf("%s: non-matching invariant", __func__); + return (EINVAL); + } + /* + * Assignment of the attach arguments mii_data for the first + * pass is done in miibus_attach(), i.e. once the miibus softc + * has been allocated. + */ + ma.mii_data = device_get_softc(*miibus); + } + + ma.mii_capmask = capmask; + + phy = NULL; + offset = 0; + for (ma.mii_phyno = phymin; ma.mii_phyno <= phymax; ma.mii_phyno++) { + /* + * Make sure we haven't already configured a PHY at this + * address. This allows mii_attach() to be called + * multiple times. + */ + if (device_get_children(*miibus, &children, &nchildren) == 0) { + for (i = 0; i < nchildren; i++) { + args = device_get_ivars(children[i]); + if (args->mii_phyno == ma.mii_phyno) { + /* + * Yes, there is already something + * configured at this address. + */ + free(children, M_TEMP); + goto skip; + } + } + free(children, M_TEMP); + } + + /* + * Check to see if there is a PHY at this address. Note, + * many braindead PHYs report 0/0 in their ID registers, + * so we test for media in the BMSR. + */ + bmsr = MIIBUS_READREG(dev, ma.mii_phyno, MII_BMSR); + if (bmsr == 0 || bmsr == 0xffff || + (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) { + /* Assume no PHY at this address. */ + continue; + } + + /* + * There is a PHY at this address. If we were given an + * `offset' locator, skip this PHY if it doesn't match. + */ + if (offloc != MII_OFFSET_ANY && offloc != offset) + goto skip; + + /* + * Extract the IDs. Braindead PHYs will be handled by + * the `ukphy' driver, as we have no ID information to + * match on. + */ + ma.mii_id1 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR1); + ma.mii_id2 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR2); + + args = malloc(sizeof(struct mii_attach_args), M_DEVBUF, + M_NOWAIT); + if (args == NULL) + goto skip; + bcopy((char *)&ma, (char *)args, sizeof(ma)); + phy = device_add_child(*miibus, NULL, -1); + if (phy == NULL) { + free(args, M_DEVBUF); + goto skip; + } + device_set_ivars(phy, args); + skip: + offset++; + } + + if (first != 0) { + if (phy == NULL) { + rv = ENXIO; + goto fail; + } + rv = bus_generic_attach(dev); + if (rv != 0) + goto fail; + } + rv = bus_generic_attach(*miibus); + if (rv != 0) + goto fail; return (0); + + fail: + if (*miibus != NULL) + device_delete_child(dev, *miibus); + free(ivars, M_DEVBUF); + if (first != 0) + *miibus = NULL; + return (rv); +} + +int +mii_phy_probe(device_t dev, device_t *child, ifm_change_cb_t ifmedia_upd, + ifm_stat_cb_t ifmedia_sts) +{ + struct ifnet *ifp; + + /* + * Note that each NIC's softc must start with an ifnet pointer. + * XXX: EVIL HACK! + */ + ifp = *(struct ifnet **)device_get_softc(dev); + return (mii_attach(dev, child, ifp, ifmedia_upd, ifmedia_sts, + BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)); } /* Modified: stable/7/sys/dev/mii/mii.h ============================================================================== --- stable/7/sys/dev/mii/mii.h Tue Nov 2 20:06:46 2010 (r214684) +++ stable/7/sys/dev/mii/mii.h Tue Nov 2 20:06:49 2010 (r214685) @@ -1,5 +1,5 @@ /* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $ */ - + /*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * @@ -47,7 +47,7 @@ #define MII_COMMAND_WRITE 0x01 #define MII_COMMAND_ACK 0x02 -#define MII_BMCR 0x00 /* Basic mode control register (rw) */ +#define MII_BMCR 0x00 /* Basic mode control register (rw) */ #define BMCR_RESET 0x8000 /* reset */ #define BMCR_LOOP 0x4000 /* loopback */ #define BMCR_SPEED0 0x2000 /* speed selection (LSB) */ @@ -82,6 +82,8 @@ #define BMSR_JABBER 0x0002 /* Jabber detected */ #define BMSR_EXTCAP 0x0001 /* Extended capability */ +#define BMSR_DEFCAPMASK 0xffffffff + /* * Note that the EXTSTAT bit indicates that there is extended status * info available in register 15, but 802.3 section 22.2.4.3 also Modified: stable/7/sys/dev/mii/miivar.h ============================================================================== --- stable/7/sys/dev/mii/miivar.h Tue Nov 2 20:06:46 2010 (r214684) +++ stable/7/sys/dev/mii/miivar.h Tue Nov 2 20:06:49 2010 (r214685) @@ -102,7 +102,7 @@ typedef int (*mii_downcall_t)(struct mii */ struct mii_softc { device_t mii_dev; /* generic device glue */ - + LIST_ENTRY(mii_softc) mii_list; /* entry on parent's PHY list */ int mii_phy; /* our MII address */ @@ -122,16 +122,22 @@ struct mii_softc { typedef struct mii_softc mii_softc_t; /* mii_flags */ -#define MIIF_INITDONE 0x0001 /* has been initialized (mii_data) */ -#define MIIF_NOISOLATE 0x0002 /* do not isolate the PHY */ -#define MIIF_NOLOOP 0x0004 /* no loopback capability */ -#define MIIF_AUTOTSLEEP 0x0010 /* use tsleep(), not callout() */ -#define MIIF_HAVEFIBER 0x0020 /* from parent: has fiber interface */ -#define MIIF_HAVE_GTCR 0x0040 /* has 100base-T2/1000base-T CR */ -#define MIIF_IS_1000X 0x0080 /* is a 1000BASE-X device */ -#define MIIF_DOPAUSE 0x0100 /* advertise PAUSE capability */ -#define MIIF_IS_HPNA 0x0200 /* is a HomePNA device */ -#define MIIF_FORCEANEG 0x0400 /* force auto-negotiation */ +#define MIIF_INITDONE 0x00000001 /* has been initialized (mii_data) */ +#define MIIF_NOISOLATE 0x00000002 /* do not isolate the PHY */ +#define MIIF_NOLOOP 0x00000004 /* no loopback capability */ +#define MIIF_AUTOTSLEEP 0x00000010 /* use tsleep(), not callout() */ +#define MIIF_HAVEFIBER 0x00000020 /* from parent: has fiber interface */ +#define MIIF_HAVE_GTCR 0x00000040 /* has 100base-T2/1000base-T CR */ +#define MIIF_IS_1000X 0x00000080 /* is a 1000BASE-X device */ +#define MIIF_DOPAUSE 0x00000100 /* advertise PAUSE capability */ +#define MIIF_IS_HPNA 0x00000200 /* is a HomePNA device */ +#define MIIF_FORCEANEG 0x00000400 /* force auto-negotiation */ +#define MIIF_MACPRIV0 0x01000000 /* private to the MAC driver */ +#define MIIF_MACPRIV1 0x02000000 /* private to the MAC driver */ +#define MIIF_MACPRIV2 0x04000000 /* private to the MAC driver */ +#define MIIF_PHYPRIV0 0x10000000 /* private to the PHY driver */ +#define MIIF_PHYPRIV1 0x20000000 /* private to the PHY driver */ +#define MIIF_PHYPRIV2 0x40000000 /* private to the PHY driver */ /* Default mii_anegticks values */ #define MII_ANEGTICKS 5 @@ -140,6 +146,14 @@ typedef struct mii_softc mii_softc_t; #define MIIF_INHERIT_MASK (MIIF_NOISOLATE|MIIF_NOLOOP|MIIF_AUTOTSLEEP) /* + * Special `locators' passed to mii_attach(). If one of these is not + * an `any' value, we look for *that* PHY and configure it. If both + * are not `any', that is an error, and mii_attach() will panic. + */ +#define MII_OFFSET_ANY -1 +#define MII_PHY_ANY -1 + +/* * Used to attach a PHY to a parent. */ struct mii_attach_args { @@ -192,6 +206,18 @@ struct mii_media { #define PHY_WRITE(p, r, v) \ MIIBUS_WRITEREG((p)->mii_dev, (p)->mii_phy, (r), (v)) +enum miibus_device_ivars { + MIIBUS_IVAR_FLAGS +}; + +/* + * Simplified accessors for miibus + */ +#define MIIBUS_ACCESSOR(var, ivar, type) \ + __BUS_ACCESSOR(miibus, var, MIIBUS, ivar, type) + +MIIBUS_ACCESSOR(flags, FLAGS, int) + extern devclass_t miibus_devclass; extern driver_t miibus_driver; @@ -199,6 +225,8 @@ int miibus_probe(device_t); int miibus_attach(device_t); int miibus_detach(device_t); +int mii_attach(device_t, device_t *, struct ifnet *, ifm_change_cb_t, + ifm_stat_cb_t, int, int, int, int); int mii_anar(int); void mii_down(struct mii_data *); int mii_mediachg(struct mii_data *); Modified: stable/7/sys/modules/mii/Makefile ============================================================================== --- stable/7/sys/modules/mii/Makefile Tue Nov 2 20:06:46 2010 (r214684) +++ stable/7/sys/modules/mii/Makefile Tue Nov 2 20:06:49 2010 (r214685) @@ -11,7 +11,8 @@ SRCS+= rgephy.c rlphy.c ruephy.c tdkphy. SRCS+= ukphy_subr.c SRCS+= xmphy.c -EXPORT_SYMS= mii_mediachg \ +EXPORT_SYMS= mii_attach \ + mii_mediachg \ mii_phy_probe \ mii_phy_reset \ mii_pollstat \ From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 20:16:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 681871065672; Tue, 2 Nov 2010 20:16: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 56E7D8FC1E; Tue, 2 Nov 2010 20:16: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 oA2KGfrt083195; Tue, 2 Nov 2010 20:16:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2KGfOP083193; Tue, 2 Nov 2010 20:16:41 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011022016.oA2KGfOP083193@svn.freebsd.org> From: John Baldwin Date: Tue, 2 Nov 2010 20:16:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214686 - head/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 20:16:41 -0000 Author: jhb Date: Tue Nov 2 20:16:41 2010 New Revision: 214686 URL: http://svn.freebsd.org/changeset/base/214686 Log: Cosmetic change to revert one of my earlier ones. #if __i386__ && PAE is identical to just #if PAE since PAE is only a valid option for i386. Submitted by: attilio Modified: head/sys/x86/x86/nexus.c Modified: head/sys/x86/x86/nexus.c ============================================================================== --- head/sys/x86/x86/nexus.c Tue Nov 2 20:06:49 2010 (r214685) +++ head/sys/x86/x86/nexus.c Tue Nov 2 20:16:41 2010 (r214686) @@ -728,7 +728,7 @@ ram_attach(device_t dev) * segment is 0. */ for (rid = 0, p = dump_avail; p[1] != 0; rid++, p += 2) { -#if defined(__i386__) && defined(PAE) +#ifdef PAE /* * Resources use long's to track resources, so we can't * include memory regions above 4GB. From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 21:01:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DB2F106566B; Tue, 2 Nov 2010 21:01:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AB6E8FC12; Tue, 2 Nov 2010 21:01: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 oA2L1Fvx087557; Tue, 2 Nov 2010 21:01:15 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2L1F1a087554; Tue, 2 Nov 2010 21:01:15 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011022101.oA2L1F1a087554@svn.freebsd.org> From: Marius Strobl Date: Tue, 2 Nov 2010 21:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214687 - stable/8/sys/dev/dc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 21:01:15 -0000 Author: marius Date: Tue Nov 2 21:01:15 2010 New Revision: 214687 URL: http://svn.freebsd.org/changeset/base/214687 Log: MFC: r201430 Fix card/device names, no functional change The ADMtek AN985 is the cardbus variant of ADMtek AN983 The Netgear FA511 is just a relabled ADMtek AN985 PR: kern/50574 Modified: stable/8/sys/dev/dc/if_dc.c stable/8/sys/dev/dc/if_dcreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Tue Nov 2 20:16:41 2010 (r214686) +++ stable/8/sys/dev/dc/if_dc.c Tue Nov 2 21:01:15 2010 (r214687) @@ -43,8 +43,9 @@ __FBSDID("$FreeBSD$"); * ASIX Electronics AX88140A (www.asix.com.tw) * ASIX Electronics AX88141 (www.asix.com.tw) * ADMtek AL981 (www.admtek.com.tw) - * ADMtek AN985 (www.admtek.com.tw) - * Netgear FA511 (www.netgear.com) Appears to be rebadged ADMTek AN985 + * ADMtek AN983 (www.admtek.com.tw) + * ADMtek cardbus AN985 (www.admtek.com.tw) + * Netgear FA511 (www.netgear.com) Appears to be rebadged ADMTek cardbus AN985 * Davicom DM9100, DM9102, DM9102A (www.davicom8.com) * Accton EN1217 (www.accton.com) * Xircom X3201 (www.xircom.com) @@ -161,14 +162,14 @@ static const struct dc_type dc_devs[] = "Davicom DM9102 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AL981), 0, "ADMtek AL981 10/100BaseTX" }, + { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AN983), 0, + "ADMtek AN983 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AN985), 0, - "ADMtek AN985 10/100BaseTX" }, + "ADMtek AN985 cardBus 10/100BaseTX or clone" }, { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9511), 0, "ADMtek ADM9511 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9513), 0, "ADMtek ADM9513 10/100BaseTX" }, - { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_FA511), 0, - "Netgear FA511 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ASIX, DC_DEVICEID_AX88140A), DC_REVISION_88141, "ASIX AX88141 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ASIX, DC_DEVICEID_AX88140A), 0, @@ -778,10 +779,10 @@ dc_miibus_readreg(device_t dev, int phy, bzero(&frame, sizeof(frame)); /* - * Note: both the AL981 and AN985 have internal PHYs, + * Note: both the AL981 and AN983 have internal PHYs, * however the AL981 provides direct access to the PHY - * registers while the AN985 uses a serial MII interface. - * The AN985's MII interface is also buggy in that you + * registers while the AN983 uses a serial MII interface. + * The AN983's MII interface is also buggy in that you * can read from any MII address (0 to 31), but only address 1 * behaves normally. To deal with both cases, we pretend * that the PHY is at MII address 1. @@ -1895,11 +1896,11 @@ dc_attach(device_t dev) sc->dc_pmode = DC_PMODE_MII; dc_read_srom(sc, sc->dc_romwidth); break; + case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AN983): case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AN985): case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9511): case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9513): case DC_DEVID(DC_VENDORID_DLINK, DC_DEVICEID_DRP32TXD): - case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_FA511): case DC_DEVID(DC_VENDORID_ABOCOM, DC_DEVICEID_FE2500): case DC_DEVID(DC_VENDORID_ABOCOM, DC_DEVICEID_FE2500MX): case DC_DEVID(DC_VENDORID_ACCTON, DC_DEVICEID_EN2242): @@ -1910,7 +1911,7 @@ dc_attach(device_t dev) case DC_DEVID(DC_VENDORID_MICROSOFT, DC_DEVICEID_MSMN130): case DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB08): case DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB09): - sc->dc_type = DC_TYPE_AN985; + sc->dc_type = DC_TYPE_AN983; sc->dc_flags |= DC_64BIT_HASH; sc->dc_flags |= DC_TX_USE_TX_INTR; sc->dc_flags |= DC_TX_ADMTEK_WAR; @@ -2057,7 +2058,7 @@ dc_attach(device_t dev) dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); break; case DC_TYPE_AL981: - case DC_TYPE_AN985: + case DC_TYPE_AN983: reg = CSR_READ_4(sc, DC_AL_PAR0); mac = (uint8_t *)&eaddr[0]; mac[0] = (reg >> 0) & 0xff; Modified: stable/8/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/8/sys/dev/dc/if_dcreg.h Tue Nov 2 20:16:41 2010 (r214686) +++ stable/8/sys/dev/dc/if_dcreg.h Tue Nov 2 21:01:15 2010 (r214687) @@ -72,7 +72,7 @@ #define DC_TYPE_21143 0x4 /* Intel 21143 */ #define DC_TYPE_ASIX 0x5 /* ASIX AX88140A/AX88141 */ #define DC_TYPE_AL981 0x6 /* ADMtek AL981 Comet */ -#define DC_TYPE_AN985 0x7 /* ADMtek AN985 Centaur */ +#define DC_TYPE_AN983 0x7 /* ADMtek AN983 Centaur */ #define DC_TYPE_DM9102 0x8 /* Davicom DM9102 */ #define DC_TYPE_PNICII 0x9 /* 82c115 PNIC II */ #define DC_TYPE_PNIC 0xA /* 82c168/82c169 PNIC I */ @@ -86,12 +86,12 @@ #define DC_IS_ADMTEK(x) \ (x->dc_type == DC_TYPE_AL981 || \ - x->dc_type == DC_TYPE_AN985) + x->dc_type == DC_TYPE_AN983) #define DC_IS_INTEL(x) (x->dc_type == DC_TYPE_21143) #define DC_IS_ASIX(x) (x->dc_type == DC_TYPE_ASIX) #define DC_IS_COMET(x) (x->dc_type == DC_TYPE_AL981) -#define DC_IS_CENTAUR(x) (x->dc_type == DC_TYPE_AN985) +#define DC_IS_CENTAUR(x) (x->dc_type == DC_TYPE_AN983) #define DC_IS_DAVICOM(x) (x->dc_type == DC_TYPE_DM9102) #define DC_IS_PNICII(x) (x->dc_type == DC_TYPE_PNICII) #define DC_IS_PNIC(x) (x->dc_type == DC_TYPE_PNIC) @@ -543,8 +543,8 @@ struct dc_mii_frame { */ /* - * ADMtek specific registers and constants for the AL981 and AN985. - * The AN985 doesn't use the magic PHY registers. + * ADMtek specific registers and constants for the AL981 and AN983. + * The AN983 doesn't use the magic PHY registers. */ #define DC_AL_CR 0x88 /* command register */ #define DC_AL_PAR0 0xA4 /* station address */ @@ -890,8 +890,8 @@ struct dc_softc { * ADMtek device IDs. */ #define DC_DEVICEID_AL981 0x0981 -#define DC_DEVICEID_AN985 0x0985 -#define DC_DEVICEID_FA511 0x1985 +#define DC_DEVICEID_AN983 0x0985 +#define DC_DEVICEID_AN985 0x1985 #define DC_DEVICEID_ADM9511 0x9511 #define DC_DEVICEID_ADM9513 0x9513 From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 21:01:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA11B106566C; Tue, 2 Nov 2010 21:01:18 +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 B713A8FC13; Tue, 2 Nov 2010 21:01: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 oA2L1InD087605; Tue, 2 Nov 2010 21:01:18 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2L1I4I087602; Tue, 2 Nov 2010 21:01:18 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011022101.oA2L1I4I087602@svn.freebsd.org> From: Marius Strobl Date: Tue, 2 Nov 2010 21:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214688 - stable/7/sys/dev/dc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 21:01:18 -0000 Author: marius Date: Tue Nov 2 21:01:18 2010 New Revision: 214688 URL: http://svn.freebsd.org/changeset/base/214688 Log: MFC: r201430 Fix card/device names, no functional change The ADMtek AN985 is the cardbus variant of ADMtek AN983 The Netgear FA511 is just a relabled ADMtek AN985 PR: kern/50574 Modified: stable/7/sys/dev/dc/if_dc.c stable/7/sys/dev/dc/if_dcreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/dc/if_dc.c ============================================================================== --- stable/7/sys/dev/dc/if_dc.c Tue Nov 2 21:01:15 2010 (r214687) +++ stable/7/sys/dev/dc/if_dc.c Tue Nov 2 21:01:18 2010 (r214688) @@ -43,8 +43,9 @@ __FBSDID("$FreeBSD$"); * ASIX Electronics AX88140A (www.asix.com.tw) * ASIX Electronics AX88141 (www.asix.com.tw) * ADMtek AL981 (www.admtek.com.tw) - * ADMtek AN985 (www.admtek.com.tw) - * Netgear FA511 (www.netgear.com) Appears to be rebadged ADMTek AN985 + * ADMtek AN983 (www.admtek.com.tw) + * ADMtek cardbus AN985 (www.admtek.com.tw) + * Netgear FA511 (www.netgear.com) Appears to be rebadged ADMTek cardbus AN985 * Davicom DM9100, DM9102, DM9102A (www.davicom8.com) * Accton EN1217 (www.accton.com) * Xircom X3201 (www.xircom.com) @@ -161,14 +162,14 @@ static const struct dc_type dc_devs[] = "Davicom DM9102 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AL981), 0, "ADMtek AL981 10/100BaseTX" }, + { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AN983), 0, + "ADMtek AN983 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AN985), 0, - "ADMtek AN985 10/100BaseTX" }, + "ADMtek AN985 cardBus 10/100BaseTX or clone" }, { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9511), 0, "ADMtek ADM9511 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9513), 0, "ADMtek ADM9513 10/100BaseTX" }, - { DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_FA511), 0, - "Netgear FA511 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ASIX, DC_DEVICEID_AX88140A), DC_REVISION_88141, "ASIX AX88141 10/100BaseTX" }, { DC_DEVID(DC_VENDORID_ASIX, DC_DEVICEID_AX88140A), 0, @@ -779,10 +780,10 @@ dc_miibus_readreg(device_t dev, int phy, bzero(&frame, sizeof(frame)); /* - * Note: both the AL981 and AN985 have internal PHYs, + * Note: both the AL981 and AN983 have internal PHYs, * however the AL981 provides direct access to the PHY - * registers while the AN985 uses a serial MII interface. - * The AN985's MII interface is also buggy in that you + * registers while the AN983 uses a serial MII interface. + * The AN983's MII interface is also buggy in that you * can read from any MII address (0 to 31), but only address 1 * behaves normally. To deal with both cases, we pretend * that the PHY is at MII address 1. @@ -1896,11 +1897,11 @@ dc_attach(device_t dev) sc->dc_pmode = DC_PMODE_MII; dc_read_srom(sc, sc->dc_romwidth); break; + case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AN983): case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_AN985): case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9511): case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9513): case DC_DEVID(DC_VENDORID_DLINK, DC_DEVICEID_DRP32TXD): - case DC_DEVID(DC_VENDORID_ADMTEK, DC_DEVICEID_FA511): case DC_DEVID(DC_VENDORID_ABOCOM, DC_DEVICEID_FE2500): case DC_DEVID(DC_VENDORID_ABOCOM, DC_DEVICEID_FE2500MX): case DC_DEVID(DC_VENDORID_ACCTON, DC_DEVICEID_EN2242): @@ -1911,7 +1912,7 @@ dc_attach(device_t dev) case DC_DEVID(DC_VENDORID_MICROSOFT, DC_DEVICEID_MSMN130): case DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB08): case DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB09): - sc->dc_type = DC_TYPE_AN985; + sc->dc_type = DC_TYPE_AN983; sc->dc_flags |= DC_64BIT_HASH; sc->dc_flags |= DC_TX_USE_TX_INTR; sc->dc_flags |= DC_TX_ADMTEK_WAR; @@ -2058,7 +2059,7 @@ dc_attach(device_t dev) dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); break; case DC_TYPE_AL981: - case DC_TYPE_AN985: + case DC_TYPE_AN983: reg = CSR_READ_4(sc, DC_AL_PAR0); mac = (uint8_t *)&eaddr[0]; mac[0] = (reg >> 0) & 0xff; Modified: stable/7/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/7/sys/dev/dc/if_dcreg.h Tue Nov 2 21:01:15 2010 (r214687) +++ stable/7/sys/dev/dc/if_dcreg.h Tue Nov 2 21:01:18 2010 (r214688) @@ -72,7 +72,7 @@ #define DC_TYPE_21143 0x4 /* Intel 21143 */ #define DC_TYPE_ASIX 0x5 /* ASIX AX88140A/AX88141 */ #define DC_TYPE_AL981 0x6 /* ADMtek AL981 Comet */ -#define DC_TYPE_AN985 0x7 /* ADMtek AN985 Centaur */ +#define DC_TYPE_AN983 0x7 /* ADMtek AN983 Centaur */ #define DC_TYPE_DM9102 0x8 /* Davicom DM9102 */ #define DC_TYPE_PNICII 0x9 /* 82c115 PNIC II */ #define DC_TYPE_PNIC 0xA /* 82c168/82c169 PNIC I */ @@ -86,12 +86,12 @@ #define DC_IS_ADMTEK(x) \ (x->dc_type == DC_TYPE_AL981 || \ - x->dc_type == DC_TYPE_AN985) + x->dc_type == DC_TYPE_AN983) #define DC_IS_INTEL(x) (x->dc_type == DC_TYPE_21143) #define DC_IS_ASIX(x) (x->dc_type == DC_TYPE_ASIX) #define DC_IS_COMET(x) (x->dc_type == DC_TYPE_AL981) -#define DC_IS_CENTAUR(x) (x->dc_type == DC_TYPE_AN985) +#define DC_IS_CENTAUR(x) (x->dc_type == DC_TYPE_AN983) #define DC_IS_DAVICOM(x) (x->dc_type == DC_TYPE_DM9102) #define DC_IS_PNICII(x) (x->dc_type == DC_TYPE_PNICII) #define DC_IS_PNIC(x) (x->dc_type == DC_TYPE_PNIC) @@ -543,8 +543,8 @@ struct dc_mii_frame { */ /* - * ADMtek specific registers and constants for the AL981 and AN985. - * The AN985 doesn't use the magic PHY registers. + * ADMtek specific registers and constants for the AL981 and AN983. + * The AN983 doesn't use the magic PHY registers. */ #define DC_AL_CR 0x88 /* command register */ #define DC_AL_PAR0 0xA4 /* station address */ @@ -890,8 +890,8 @@ struct dc_softc { * ADMtek device IDs. */ #define DC_DEVICEID_AL981 0x0981 -#define DC_DEVICEID_AN985 0x0985 -#define DC_DEVICEID_FA511 0x1985 +#define DC_DEVICEID_AN983 0x0985 +#define DC_DEVICEID_AN985 0x1985 #define DC_DEVICEID_ADM9511 0x9511 #define DC_DEVICEID_ADM9513 0x9513 From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:12:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5A26106566C; Tue, 2 Nov 2010 22:12:06 +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 C2D898FC1C; Tue, 2 Nov 2010 22:12: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 oA2MC67S092452; Tue, 2 Nov 2010 22:12:06 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MC6tR092450; Tue, 2 Nov 2010 22:12:06 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011022212.oA2MC6tR092450@svn.freebsd.org> From: Marius Strobl Date: Tue, 2 Nov 2010 22:12:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214690 - stable/8/sys/boot/sparc64/loader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:12:06 -0000 Author: marius Date: Tue Nov 2 22:12:06 2010 New Revision: 214690 URL: http://svn.freebsd.org/changeset/base/214690 Log: MFC: r214526 Partially revert r203829 (MFC'ed to stable/7 in r205920); as it turns out what the PowerPC OFW loader did was incorrect as further down the road cons_probe() calls malloc() so the former can't be called before init_heap() has succeed. Instead just exit to the firmware in case init_heap() fails like OF_init() does when hitting a problem as we're then likely running in a very broken environment where hardly anything can be trusted to work. Modified: stable/8/sys/boot/sparc64/loader/main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/boot/sparc64/loader/main.c ============================================================================== --- stable/8/sys/boot/sparc64/loader/main.c Tue Nov 2 22:06:23 2010 (r214689) +++ stable/8/sys/boot/sparc64/loader/main.c Tue Nov 2 22:12:06 2010 (r214690) @@ -811,15 +811,15 @@ main(int (*openfirm)(void *)) archsw.arch_autoload = sparc64_autoload; archsw.arch_maphint = sparc64_maphint; + if (init_heap() == (vm_offset_t)-1) + OF_exit(); + setheap((void *)heapva, (void *)(heapva + HEAPSZ)); + /* * Probe for a console. */ cons_probe(); - if (init_heap() == (vm_offset_t)-1) - panic("%s: can't claim heap", __func__); - setheap((void *)heapva, (void *)(heapva + HEAPSZ)); - if ((root = OF_peer(0)) == -1) panic("%s: can't get root phandle", __func__); OF_getprop(root, "compatible", compatible, sizeof(compatible)); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:12:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50AF31065673; Tue, 2 Nov 2010 22:12:13 +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 3DE848FC22; Tue, 2 Nov 2010 22:12: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 oA2MCDvM092504; Tue, 2 Nov 2010 22:12:13 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MCD67092502; Tue, 2 Nov 2010 22:12:13 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011022212.oA2MCD67092502@svn.freebsd.org> From: Marius Strobl Date: Tue, 2 Nov 2010 22:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214691 - stable/7/sys/boot/sparc64/loader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:12:13 -0000 Author: marius Date: Tue Nov 2 22:12:12 2010 New Revision: 214691 URL: http://svn.freebsd.org/changeset/base/214691 Log: MFC: r214526 Partially revert r203829 (MFC'ed to stable/7 in r205921); as it turns out what the PowerPC OFW loader did was incorrect as further down the road cons_probe() calls malloc() so the former can't be called before init_heap() has succeed. Instead just exit to the firmware in case init_heap() fails like OF_init() does when hitting a problem as we're then likely running in a very broken environment where hardly anything can be trusted to work. Modified: stable/7/sys/boot/sparc64/loader/main.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/sparc64/loader/main.c ============================================================================== --- stable/7/sys/boot/sparc64/loader/main.c Tue Nov 2 22:12:06 2010 (r214690) +++ stable/7/sys/boot/sparc64/loader/main.c Tue Nov 2 22:12:12 2010 (r214691) @@ -812,15 +812,15 @@ main(int (*openfirm)(void *)) archsw.arch_autoload = sparc64_autoload; archsw.arch_maphint = sparc64_maphint; + if (init_heap() == (vm_offset_t)-1) + OF_exit(); + setheap((void *)heapva, (void *)(heapva + HEAPSZ)); + /* * Probe for a console. */ cons_probe(); - if (init_heap() == (vm_offset_t)-1) - panic("%s: can't claim heap", __func__); - setheap((void *)heapva, (void *)(heapva + HEAPSZ)); - if ((root = OF_peer(0)) == -1) panic("%s: can't get root phandle", __func__); OF_getprop(root, "compatible", compatible, sizeof(compatible)); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:13:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A127F1065672; Tue, 2 Nov 2010 22:13:08 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ED6B8FC1F; Tue, 2 Nov 2010 22:13:08 +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 oA2MD8XT092603; Tue, 2 Nov 2010 22:13:08 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MD8FF092601; Tue, 2 Nov 2010 22:13:08 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201011022213.oA2MD8FF092601@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 2 Nov 2010 22:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214692 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:13:08 -0000 Author: pjd Date: Tue Nov 2 22:13:08 2010 New Revision: 214692 URL: http://svn.freebsd.org/changeset/base/214692 Log: Send packets to remote node only via the send thread to avoid possible races - in this case a keepalive packet was send from wrong thread which lead to connection dropping, because of corrupted packet. Fix it by sending keepalive packets directly from the send thread. As a bonus we now send keepalive packets only when connection is idle. Submitted by: Mikolaj Golub MFC after: 3 days Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Tue Nov 2 22:12:12 2010 (r214691) +++ head/sbin/hastd/primary.c Tue Nov 2 22:13:08 2010 (r214692) @@ -180,14 +180,21 @@ static pthread_mutex_t metadata_lock; if (_wakeup) \ cv_signal(&hio_##name##_list_cond); \ } while (0) -#define QUEUE_TAKE1(hio, name, ncomp) do { \ +#define QUEUE_TAKE1(hio, name, ncomp, timeout) do { \ + bool _last; \ + \ mtx_lock(&hio_##name##_list_lock[(ncomp)]); \ - while (((hio) = TAILQ_FIRST(&hio_##name##_list[(ncomp)])) == NULL) { \ - cv_wait(&hio_##name##_list_cond[(ncomp)], \ - &hio_##name##_list_lock[(ncomp)]); \ + _last = false; \ + while (((hio) = TAILQ_FIRST(&hio_##name##_list[(ncomp)])) == NULL && !_last) { \ + cv_timedwait(&hio_##name##_list_cond[(ncomp)], \ + &hio_##name##_list_lock[(ncomp)], (timeout)); \ + if ((timeout) != 0) \ + _last = true; \ + } \ + if (hio != NULL) { \ + TAILQ_REMOVE(&hio_##name##_list[(ncomp)], (hio), \ + hio_next[(ncomp)]); \ } \ - TAILQ_REMOVE(&hio_##name##_list[(ncomp)], (hio), \ - hio_next[(ncomp)]); \ mtx_unlock(&hio_##name##_list_lock[(ncomp)]); \ } while (0) #define QUEUE_TAKE2(hio, name) do { \ @@ -1112,7 +1119,7 @@ local_send_thread(void *arg) for (;;) { pjdlog_debug(2, "local_send: Taking request."); - QUEUE_TAKE1(hio, send, ncomp); + QUEUE_TAKE1(hio, send, ncomp, 0); pjdlog_debug(2, "local_send: (%p) Got request.", hio); ggio = &hio->hio_ggio; switch (ggio->gctl_cmd) { @@ -1176,6 +1183,38 @@ local_send_thread(void *arg) return (NULL); } +static void +keepalive_send(struct hast_resource *res, unsigned int ncomp) +{ + struct nv *nv; + + if (!ISCONNECTED(res, ncomp)) + return; + + assert(res->hr_remotein != NULL); + assert(res->hr_remoteout != NULL); + + nv = nv_alloc(); + nv_add_uint8(nv, HIO_KEEPALIVE, "cmd"); + if (nv_error(nv) != 0) { + nv_free(nv); + pjdlog_debug(1, + "keepalive_send: Unable to prepare header to send."); + return; + } + if (hast_proto_send(res, res->hr_remoteout, nv, NULL, 0) < 0) { + pjdlog_common(LOG_DEBUG, 1, errno, + "keepalive_send: Unable to send request"); + nv_free(nv); + rw_unlock(&hio_remote_lock[ncomp]); + remote_close(res, ncomp); + rw_rlock(&hio_remote_lock[ncomp]); + return; + } + nv_free(nv); + pjdlog_debug(2, "keepalive_send: Request sent."); +} + /* * Thread sends request to secondary node. */ @@ -1184,6 +1223,7 @@ remote_send_thread(void *arg) { struct hast_resource *res = arg; struct g_gate_ctl_io *ggio; + time_t lastcheck, now; struct hio *hio; struct nv *nv; unsigned int ncomp; @@ -1194,10 +1234,19 @@ remote_send_thread(void *arg) /* Remote component is 1 for now. */ ncomp = 1; + lastcheck = time(NULL); for (;;) { pjdlog_debug(2, "remote_send: Taking request."); - QUEUE_TAKE1(hio, send, ncomp); + QUEUE_TAKE1(hio, send, ncomp, RETRY_SLEEP); + if (hio == NULL) { + now = time(NULL); + if (lastcheck + RETRY_SLEEP <= now) { + keepalive_send(res, ncomp); + lastcheck = now; + } + continue; + } pjdlog_debug(2, "remote_send: (%p) Got request.", hio); ggio = &hio->hio_ggio; switch (ggio->gctl_cmd) { @@ -1883,32 +1932,6 @@ failed: } static void -keepalive_send(struct hast_resource *res, unsigned int ncomp) -{ - struct nv *nv; - - nv = nv_alloc(); - nv_add_uint8(nv, HIO_KEEPALIVE, "cmd"); - if (nv_error(nv) != 0) { - nv_free(nv); - pjdlog_debug(1, - "keepalive_send: Unable to prepare header to send."); - return; - } - if (hast_proto_send(res, res->hr_remoteout, nv, NULL, 0) < 0) { - pjdlog_common(LOG_DEBUG, 1, errno, - "keepalive_send: Unable to send request"); - nv_free(nv); - rw_unlock(&hio_remote_lock[ncomp]); - remote_close(res, ncomp); - rw_rlock(&hio_remote_lock[ncomp]); - return; - } - nv_free(nv); - pjdlog_debug(2, "keepalive_send: Request sent."); -} - -static void guard_one(struct hast_resource *res, unsigned int ncomp) { struct proto_conn *in, *out; @@ -1926,12 +1949,6 @@ guard_one(struct hast_resource *res, uns if (ISCONNECTED(res, ncomp)) { assert(res->hr_remotein != NULL); assert(res->hr_remoteout != NULL); - keepalive_send(res, ncomp); - } - - if (ISCONNECTED(res, ncomp)) { - assert(res->hr_remotein != NULL); - assert(res->hr_remoteout != NULL); rw_unlock(&hio_remote_lock[ncomp]); pjdlog_debug(2, "remote_guard: Connection to %s is ok.", res->hr_remoteaddr); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:30:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0B8210656C0; Tue, 2 Nov 2010 22:30:19 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DC638FC2F; Tue, 2 Nov 2010 22:30: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 oA2MUJab093506; Tue, 2 Nov 2010 22:30:19 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MUJnc093504; Tue, 2 Nov 2010 22:30:19 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201011022230.oA2MUJnc093504@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 2 Nov 2010 22:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214693 - stable/8/sys/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:30:19 -0000 Author: pjd Date: Tue Nov 2 22:30:19 2010 New Revision: 214693 URL: http://svn.freebsd.org/changeset/base/214693 Log: MFC r211854: - When VFS_VGET() is not supported, switch to VOP_LOOKUP(). - We are fine by only share-locking the vnode. - Remove assertion that doesn't hold for ZFS where we cross mount points boundaries by going into .zfs/snapshot//. Reviewed by: rmacklem Reminded by: kib Modified: stable/8/sys/nfsserver/nfs_serv.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/8/sys/nfsserver/nfs_serv.c Tue Nov 2 22:13:08 2010 (r214692) +++ stable/8/sys/nfsserver/nfs_serv.c Tue Nov 2 22:30:19 2010 (r214693) @@ -3041,7 +3041,8 @@ nfsrv_readdirplus(struct nfsrv_descript u_quad_t off, toff, verf; u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */ int v3 = (nfsd->nd_flag & ND_NFSV3); - int vfslocked; + int usevget = 1, vfslocked; + struct componentname cn; nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); vfslocked = 0; @@ -3186,28 +3187,6 @@ again: goto again; } - /* - * Probe one of the directory entries to see if the filesystem - * supports VGET. - */ - error = VFS_VGET(vp->v_mount, dp->d_fileno, LK_EXCLUSIVE, &nvp); - if (error) { - if (error == EOPNOTSUPP) - error = NFSERR_NOTSUPP; - else - error = NFSERR_SERVERFAULT; - vrele(vp); - vp = NULL; - free((caddr_t)cookies, M_TEMP); - free((caddr_t)rbuf, M_TEMP); - nfsm_reply(NFSX_V3POSTOPATTR); - nfsm_srvpostop_attr(getret, &at); - error = 0; - goto nfsmout; - } - vput(nvp); - nvp = NULL; - dirlen = len = NFSX_V3POSTOPATTR + NFSX_V3COOKIEVERF + 2 * NFSX_UNSIGNED; nfsm_reply(cnt); @@ -3224,23 +3203,49 @@ again: nlen = dp->d_namlen; rem = nfsm_rndup(nlen)-nlen; - /* - * For readdir_and_lookup get the vnode using - * the file number. - */ - if (VFS_VGET(vp->v_mount, dp->d_fileno, LK_EXCLUSIVE, - &nvp)) - goto invalid; + if (usevget) { + /* + * For readdir_and_lookup get the vnode using + * the file number. + */ + error = VFS_VGET(vp->v_mount, dp->d_fileno, + LK_SHARED, &nvp); + if (error != 0 && error != EOPNOTSUPP) { + error = 0; + goto invalid; + } else if (error == EOPNOTSUPP) { + /* + * VFS_VGET() not supported? + * Let's switch to VOP_LOOKUP(). + */ + error = 0; + usevget = 0; + cn.cn_nameiop = LOOKUP; + cn.cn_flags = ISLASTCN | NOFOLLOW | \ + LOCKSHARED | LOCKLEAF | MPSAFE; + cn.cn_lkflags = LK_SHARED | LK_RETRY; + cn.cn_cred = cred; + cn.cn_thread = curthread; + } + } + if (!usevget) { + cn.cn_nameptr = dp->d_name; + cn.cn_namelen = dp->d_namlen; + if (dp->d_namlen == 2 && + dp->d_name[0] == '.' && + dp->d_name[1] == '.') { + cn.cn_flags |= ISDOTDOT; + } else { + cn.cn_flags &= ~ISDOTDOT; + } + if (!VOP_ISLOCKED(vp)) + vn_lock(vp, LK_SHARED | LK_RETRY); + if (VOP_LOOKUP(vp, &nvp, &cn) != 0) + goto invalid; + } + bzero((caddr_t)nfhp, NFSX_V3FH); - nfhp->fh_fsid = - nvp->v_mount->mnt_stat.f_fsid; - /* - * XXXRW: Assert the mountpoints are the same so that - * we know that acquiring Giant based on the - * directory is the right thing for the child. - */ - KASSERT(nvp->v_mount == vp->v_mount, - ("nfsrv_readdirplus: nvp mount != vp mount")); + nfhp->fh_fsid = nvp->v_mount->mnt_stat.f_fsid; if (VOP_VPTOFH(nvp, &nfhp->fh_fid)) { vput(nvp); nvp = NULL; @@ -3336,7 +3341,10 @@ invalid: cookiep++; ncookies--; } - vrele(vp); + if (!usevget && VOP_ISLOCKED(vp)) + vput(vp); + else + vrele(vp); vp = NULL; nfsm_clget; *tl = nfsrv_nfs_false; From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:30:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D1891065694; Tue, 2 Nov 2010 22:30:40 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id F2FA88FC13; Tue, 2 Nov 2010 22:30:39 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 58A0245E49; Tue, 2 Nov 2010 23:30:38 +0100 (CET) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 5328C45C9F; Tue, 2 Nov 2010 23:30:32 +0100 (CET) Date: Tue, 2 Nov 2010 23:29:54 +0100 From: Pawel Jakub Dawidek To: Kostik Belousov Message-ID: <20101102222954.GH2051@garage.freebsd.pl> References: <201008262341.o7QNfeR2057181@svn.freebsd.org> <20101101171904.GA92782@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OpLPJvDmhXTZE4Lg" Content-Disposition: inline In-Reply-To: <20101101171904.GA92782@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211854 - head/sys/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:30:40 -0000 --OpLPJvDmhXTZE4Lg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 01, 2010 at 07:19:04PM +0200, Kostik Belousov wrote: > On Thu, Aug 26, 2010 at 11:41:40PM +0000, Pawel Jakub Dawidek wrote: > > Author: pjd > > Date: Thu Aug 26 23:41:40 2010 > > New Revision: 211854 > > URL: http://svn.freebsd.org/changeset/base/211854 > >=20 > > Log: > > - When VFS_VGET() is not supported, switch to VOP_LOOKUP(). > > - We are fine by only share-locking the vnode. > > - Remove assertion that doesn't hold for ZFS where we cross mount poi= nts > > boundaries by going into .zfs/snapshot//. > > =20 > > Reviewed by: rmacklem > > MFC after: 1 month > Do you still plan to merge this commit to stable/8 ? Yes, just did. Thanks for the reminder. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --OpLPJvDmhXTZE4Lg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzQkOIACgkQForvXbEpPzRGhQCbB2dBXMkksQBYrKEAx5dGng6D hHYAnRaSiSPvPMDaD1nVzG+6OBhnCYrn =CISX -----END PGP SIGNATURE----- --OpLPJvDmhXTZE4Lg-- From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:44:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0061106567A; Tue, 2 Nov 2010 22:44:51 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCF218FC14; Tue, 2 Nov 2010 22:44: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 oA2Mip0D094340; Tue, 2 Nov 2010 22:44:51 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MipSg094337; Tue, 2 Nov 2010 22:44:51 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022244.oA2MipSg094337@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 22:44:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214694 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:44:51 -0000 Author: yongari Date: Tue Nov 2 22:44:51 2010 New Revision: 214694 URL: http://svn.freebsd.org/changeset/base/214694 Log: MFC r213081,213225,213280: r213081: Always show asic/chip revision in device attach phase. There are too many bge(4) controllers there and model name does not necessarily match asic/chip revision. Relying on VPD string made it hard to identify exact asic/chip revision so the first step to debug bge(4) was getting exact asic/chip information with verbose boot which may not be available on production server. r213255: Set the number of RX frames to receive after RX MBUF low watermark has reached. This reduced number of dropped frames when flow-control is enabled. Previously it dropped incoming frames once RX MBUF low watermark has reached. The value used in MAC RX MBUF low watermark is greater than or equal to 4 so receiving two more RX frames should not be a problem. Obtained from: OpenBSD r213280: After r207391, brgphy(4) passes resolved flow-control settings to parent driver. Use that information to configure flow-control. One drawback is there is no way to disable flow-control as we still don't have proper way to not advertise RX/TX pause capability to link partner. But I don't think it would cause severe problems and users can selectively disable flow-control in switch port. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Nov 2 22:30:19 2010 (r214693) +++ stable/8/sys/dev/bge/if_bge.c Tue Nov 2 22:44:51 2010 (r214694) @@ -882,10 +882,21 @@ bge_miibus_statchg(device_t dev) else BGE_SETBIT(sc, BGE_MAC_MODE, BGE_PORTMODE_MII); - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) + if (IFM_OPTIONS(mii->mii_media_active & IFM_FDX) != 0) { BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_HALF_DUPLEX); - else + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG1) + BGE_SETBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + else + BGE_CLRBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) + BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + else + BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + } else { BGE_SETBIT(sc, BGE_MAC_MODE, BGE_MACMODE_HALF_DUPLEX); + BGE_CLRBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + } } /* @@ -2644,12 +2655,11 @@ bge_attach(device_t dev) goto fail; } - if (bootverbose) - device_printf(dev, - "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n", - sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev, - (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" : - ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI")); + device_printf(dev, + "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n", + sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev, + (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" : + ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI")); BGE_LOCK_INIT(sc, device_get_nameunit(dev)); @@ -4223,6 +4233,14 @@ bge_init_locked(struct bge_softc *sc) /* Turn on receiver. */ BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); + /* + * Set the number of good frames to receive after RX MBUF + * Low Watermark has been reached. After the RX MAC receives + * this number of frames, it will drop subsequent incoming + * frames until the MBUF High Watermark is reached. + */ + CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2); + /* Tell firmware we're alive. */ BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 22:30:19 2010 (r214693) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 22:44:51 2010 (r214694) @@ -632,6 +632,7 @@ #define BGE_RX_BD_RULES_CTL15 0x04F8 #define BGE_RX_BD_RULES_MASKVAL15 0x04FC #define BGE_RX_RULES_CFG 0x0500 +#define BGE_MAX_RX_FRAME_LOWAT 0x0504 #define BGE_SERDES_CFG 0x0590 #define BGE_SERDES_STS 0x0594 #define BGE_SGDIG_CFG 0x05B0 From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:48:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B8171065672; Tue, 2 Nov 2010 22:48:19 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 587E58FC21; Tue, 2 Nov 2010 22:48: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 oA2MmIuP094631; Tue, 2 Nov 2010 22:48:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MmIet094629; Tue, 2 Nov 2010 22:48:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201011022248.oA2MmIet094629@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 2 Nov 2010 22:48:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214695 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:48:19 -0000 Author: pjd Date: Tue Nov 2 22:48:18 2010 New Revision: 214695 URL: http://svn.freebsd.org/changeset/base/214695 Log: MFC r211855: Update comment now that I finally committed r211854. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Nov 2 22:44:51 2010 (r214694) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Nov 2 22:48:18 2010 (r214695) @@ -1555,15 +1555,9 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla int err; /* - * XXXPJD: zfs_zget() can't operate on virtual entires like .zfs/ or - * .zfs/snapshot/ directories, so for now just return EOPNOTSUPP. - * This will make NFS to fall back to using READDIR instead of - * READDIRPLUS. - * Also snapshots are stored in AVL tree, but based on their names, - * not inode numbers, so it will be very inefficient to iterate - * over all snapshots to find the right one. - * Note that OpenSolaris READDIRPLUS implementation does LOOKUP on - * d_name, and not VGET on d_fileno as we do. + * zfs_zget() can't operate on virtual entires like .zfs/ or + * .zfs/snapshot/ directories, that's why we return EOPNOTSUPP. + * This will make NFS to switch to LOOKUP instead of using VGET. */ if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR) return (EOPNOTSUPP); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:48:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E45C31065674; Tue, 2 Nov 2010 22:48: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 D18968FC1A; Tue, 2 Nov 2010 22:48: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 oA2Mmqm1094687; Tue, 2 Nov 2010 22:48:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MmqSL094684; Tue, 2 Nov 2010 22:48:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022248.oA2MmqSL094684@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 22:48:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214696 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:48:53 -0000 Author: yongari Date: Tue Nov 2 22:48:52 2010 New Revision: 214696 URL: http://svn.freebsd.org/changeset/base/214696 Log: MFC r213081,213225,213280: r213081: Always show asic/chip revision in device attach phase. There are too many bge(4) controllers there and model name does not necessarily match asic/chip revision. Relying on VPD string made it hard to identify exact asic/chip revision so the first step to debug bge(4) was getting exact asic/chip information with verbose boot which may not be available on production server. r213255: Set the number of RX frames to receive after RX MBUF low watermark has reached. This reduced number of dropped frames when flow-control is enabled. Previously it dropped incoming frames once RX MBUF low watermark has reached. The value used in MAC RX MBUF low watermark is greater than or equal to 4 so receiving two more RX frames should not be a problem. Obtained from: OpenBSD r213280: After r207391, brgphy(4) passes resolved flow-control settings to parent driver. Use that information to configure flow-control. One drawback is there is no way to disable flow-control as we still don't have proper way to not advertise RX/TX pause capability to link partner. But I don't think it would cause severe problems and users can selectively disable flow-control in switch port. Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Nov 2 22:48:18 2010 (r214695) +++ stable/7/sys/dev/bge/if_bge.c Tue Nov 2 22:48:52 2010 (r214696) @@ -882,10 +882,21 @@ bge_miibus_statchg(device_t dev) else BGE_SETBIT(sc, BGE_MAC_MODE, BGE_PORTMODE_MII); - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) + if (IFM_OPTIONS(mii->mii_media_active & IFM_FDX) != 0) { BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_HALF_DUPLEX); - else + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG1) + BGE_SETBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + else + BGE_CLRBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) + BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + else + BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + } else { BGE_SETBIT(sc, BGE_MAC_MODE, BGE_MACMODE_HALF_DUPLEX); + BGE_CLRBIT(sc, BGE_TX_MODE, BGE_TXMODE_FLOWCTL_ENABLE); + BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_FLOWCTL_ENABLE); + } } /* @@ -2644,12 +2655,11 @@ bge_attach(device_t dev) goto fail; } - if (bootverbose) - device_printf(dev, - "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n", - sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev, - (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" : - ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI")); + device_printf(dev, + "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n", + sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev, + (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" : + ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI")); BGE_LOCK_INIT(sc, device_get_nameunit(dev)); @@ -4219,6 +4229,14 @@ bge_init_locked(struct bge_softc *sc) /* Turn on receiver. */ BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); + /* + * Set the number of good frames to receive after RX MBUF + * Low Watermark has been reached. After the RX MAC receives + * this number of frames, it will drop subsequent incoming + * frames until the MBUF High Watermark is reached. + */ + CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2); + /* Tell firmware we're alive. */ BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 22:48:18 2010 (r214695) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 22:48:52 2010 (r214696) @@ -632,6 +632,7 @@ #define BGE_RX_BD_RULES_CTL15 0x04F8 #define BGE_RX_BD_RULES_MASKVAL15 0x04FC #define BGE_RX_RULES_CFG 0x0500 +#define BGE_MAX_RX_FRAME_LOWAT 0x0504 #define BGE_SERDES_CFG 0x0590 #define BGE_SERDES_STS 0x0594 #define BGE_SGDIG_CFG 0x05B0 From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:49:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD119106564A; Tue, 2 Nov 2010 22:49:20 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9B748FC22; Tue, 2 Nov 2010 22: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 oA2MnKUU094769; Tue, 2 Nov 2010 22:49:20 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MnKad094760; Tue, 2 Nov 2010 22:49:20 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201011022249.oA2MnKad094760@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 2 Nov 2010 22:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214697 - stable/8/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:49:20 -0000 Author: pjd Date: Tue Nov 2 22:49:20 2010 New Revision: 214697 URL: http://svn.freebsd.org/changeset/base/214697 Log: MFC r214119,r214273,r214274,r214275,r214276,r214282,r214283,r214284,r214692: r214119: Use closefrom(2) instead of close(2) in a loop. r214273: Load geom_gate.ko module after parsing arguments. r214274: Plug memory leaks. Found with: valgrind r214275: Plug memory leak. r214276: Simplify code a bit. r214282: Move all NV defines into nv.c, they are not used externally thus there is no need to make then visible from outside. r214283: Implement nv_exists() function that returns true if argument of the given name exists. r214284: Before this change on first connect between primary and secondary we initialize all the data. This is huge waste of time and resources if there were no writes yet, as there is no real data to synchronize. Optimize this by sending "virgin" argument to secondary, which gives it a hint that synchronization is not needed. In the common case (where noth nodes are configured at the same time) instead of synchronizing everything, we don't synchronize at all. r214692: Send packets to remote node only via the send thread to avoid possible races - in this case a keepalive packet was send from wrong thread which lead to connection dropping, because of corrupted packet. Fix it by sending keepalive packets directly from the send thread. As a bonus we now send keepalive packets only when connection is idle. Submitted by: Mikolaj Golub Modified: stable/8/sbin/hastd/hastd.c stable/8/sbin/hastd/hooks.c stable/8/sbin/hastd/nv.c stable/8/sbin/hastd/nv.h stable/8/sbin/hastd/parse.y stable/8/sbin/hastd/primary.c stable/8/sbin/hastd/secondary.c stable/8/sbin/hastd/synch.h Directory Properties: stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastd/hastd.c ============================================================================== --- stable/8/sbin/hastd/hastd.c Tue Nov 2 22:48:52 2010 (r214696) +++ stable/8/sbin/hastd/hastd.c Tue Nov 2 22:49:20 2010 (r214697) @@ -701,8 +701,6 @@ main(int argc, char *argv[]) int debuglevel; sigset_t mask; - g_gate_load(); - foreground = false; debuglevel = 0; pidfile = HASTD_PIDFILE; @@ -736,6 +734,8 @@ main(int argc, char *argv[]) pjdlog_debug_set(debuglevel); + g_gate_load(); + pfh = pidfile_open(pidfile, 0600, &otherpid); if (pfh == NULL) { if (errno == EEXIST) { Modified: stable/8/sbin/hastd/hooks.c ============================================================================== --- stable/8/sbin/hastd/hooks.c Tue Nov 2 22:48:52 2010 (r214696) +++ stable/8/sbin/hastd/hooks.c Tue Nov 2 22:49:20 2010 (r214697) @@ -88,32 +88,19 @@ static void hook_free(struct hookproc *h static void descriptors(void) { - long maxfd; int fd; /* - * Close all descriptors. + * Close all (or almost all) descriptors. */ - maxfd = sysconf(_SC_OPEN_MAX); - if (maxfd < 0) { - pjdlog_errno(LOG_WARNING, "sysconf(_SC_OPEN_MAX) failed"); - maxfd = 1024; - } - for (fd = 0; fd <= maxfd; fd++) { - switch (fd) { - case STDIN_FILENO: - case STDOUT_FILENO: - case STDERR_FILENO: - if (pjdlog_mode_get() == PJDLOG_MODE_STD) - break; - /* FALLTHROUGH */ - default: - close(fd); - break; - } - } - if (pjdlog_mode_get() == PJDLOG_MODE_STD) + if (pjdlog_mode_get() == PJDLOG_MODE_STD) { + closefrom(MAX(MAX(STDIN_FILENO, STDOUT_FILENO), + STDERR_FILENO) + 1); return; + } + + closefrom(0); + /* * Redirect stdin, stdout and stderr to /dev/null. */ Modified: stable/8/sbin/hastd/nv.c ============================================================================== --- stable/8/sbin/hastd/nv.c Tue Nov 2 22:48:52 2010 (r214696) +++ stable/8/sbin/hastd/nv.c Tue Nov 2 22:49:20 2010 (r214697) @@ -46,6 +46,35 @@ __FBSDID("$FreeBSD$"); #include #include +#define NV_TYPE_NONE 0 + +#define NV_TYPE_INT8 1 +#define NV_TYPE_UINT8 2 +#define NV_TYPE_INT16 3 +#define NV_TYPE_UINT16 4 +#define NV_TYPE_INT32 5 +#define NV_TYPE_UINT32 6 +#define NV_TYPE_INT64 7 +#define NV_TYPE_UINT64 8 +#define NV_TYPE_INT8_ARRAY 9 +#define NV_TYPE_UINT8_ARRAY 10 +#define NV_TYPE_INT16_ARRAY 11 +#define NV_TYPE_UINT16_ARRAY 12 +#define NV_TYPE_INT32_ARRAY 13 +#define NV_TYPE_UINT32_ARRAY 14 +#define NV_TYPE_INT64_ARRAY 15 +#define NV_TYPE_UINT64_ARRAY 16 +#define NV_TYPE_STRING 17 + +#define NV_TYPE_MASK 0x7f +#define NV_TYPE_FIRST NV_TYPE_INT8 +#define NV_TYPE_LAST NV_TYPE_STRING + +#define NV_ORDER_NETWORK 0x00 +#define NV_ORDER_HOST 0x80 + +#define NV_ORDER_MASK 0x80 + #define NV_MAGIC 0xaea1e struct nv { int nv_magic; @@ -534,6 +563,29 @@ nv_get_string(struct nv *nv, const char return (str); } +bool +nv_exists(struct nv *nv, const char *namefmt, ...) +{ + struct nvhdr *nvh; + va_list nameap; + int snverror, serrno; + + if (nv == NULL) + return (false); + + serrno = errno; + snverror = nv->nv_error; + + va_start(nameap, namefmt); + nvh = nv_find(nv, NV_TYPE_NONE, namefmt, nameap); + va_end(nameap); + + errno = serrno; + nv->nv_error = snverror; + + return (nvh != NULL); +} + /* * Dump content of the nv structure. */ @@ -770,7 +822,8 @@ nv_find(struct nv *nv, int type, const c assert(size >= NVH_SIZE(nvh)); nv_swap(nvh, true); if (strcmp(nvh->nvh_name, name) == 0) { - if ((nvh->nvh_type & NV_TYPE_MASK) != type) { + if (type != NV_TYPE_NONE && + (nvh->nvh_type & NV_TYPE_MASK) != type) { errno = EINVAL; if (nv->nv_error == 0) nv->nv_error = EINVAL; Modified: stable/8/sbin/hastd/nv.h ============================================================================== --- stable/8/sbin/hastd/nv.h Tue Nov 2 22:48:52 2010 (r214696) +++ stable/8/sbin/hastd/nv.h Tue Nov 2 22:49:20 2010 (r214697) @@ -41,33 +41,6 @@ #include -#define NV_TYPE_INT8 1 -#define NV_TYPE_UINT8 2 -#define NV_TYPE_INT16 3 -#define NV_TYPE_UINT16 4 -#define NV_TYPE_INT32 5 -#define NV_TYPE_UINT32 6 -#define NV_TYPE_INT64 7 -#define NV_TYPE_UINT64 8 -#define NV_TYPE_INT8_ARRAY 9 -#define NV_TYPE_UINT8_ARRAY 10 -#define NV_TYPE_INT16_ARRAY 11 -#define NV_TYPE_UINT16_ARRAY 12 -#define NV_TYPE_INT32_ARRAY 13 -#define NV_TYPE_UINT32_ARRAY 14 -#define NV_TYPE_INT64_ARRAY 15 -#define NV_TYPE_UINT64_ARRAY 16 -#define NV_TYPE_STRING 17 - -#define NV_TYPE_MASK 0x7f -#define NV_TYPE_FIRST NV_TYPE_INT8 -#define NV_TYPE_LAST NV_TYPE_STRING - -#define NV_ORDER_NETWORK 0x00 -#define NV_ORDER_HOST 0x80 - -#define NV_ORDER_MASK 0x80 - struct nv; struct nv *nv_alloc(void); @@ -153,6 +126,7 @@ const uint64_t *nv_get_uint64_array(stru const char *nv_get_string(struct nv *nv, const char *namefmt, ...) __printflike(2, 3); +bool nv_exists(struct nv *nv, const char *namefmt, ...) __printflike(2, 3); void nv_dump(struct nv *nv); #endif /* !_NV_H_ */ Modified: stable/8/sbin/hastd/parse.y ============================================================================== --- stable/8/sbin/hastd/parse.y Tue Nov 2 22:48:52 2010 (r214696) +++ stable/8/sbin/hastd/parse.y Tue Nov 2 22:49:20 2010 (r214697) @@ -264,6 +264,7 @@ control_statement: CONTROL STR sizeof(depth0_control)) >= sizeof(depth0_control)) { pjdlog_error("control argument is too long."); + free($2); return (1); } break; @@ -274,12 +275,14 @@ control_statement: CONTROL STR sizeof(lconfig->hc_controladdr)) >= sizeof(lconfig->hc_controladdr)) { pjdlog_error("control argument is too long."); + free($2); return (1); } break; default: assert(!"control at wrong depth level"); } + free($2); } ; @@ -291,6 +294,7 @@ listen_statement: LISTEN STR sizeof(depth0_listen)) >= sizeof(depth0_listen)) { pjdlog_error("listen argument is too long."); + free($2); return (1); } break; @@ -301,12 +305,14 @@ listen_statement: LISTEN STR sizeof(lconfig->hc_listenaddr)) >= sizeof(lconfig->hc_listenaddr)) { pjdlog_error("listen argument is too long."); + free($2); return (1); } break; default: assert(!"listen at wrong depth level"); } + free($2); } ; @@ -357,6 +363,7 @@ exec_statement: EXEC STR if (strlcpy(depth0_exec, $2, sizeof(depth0_exec)) >= sizeof(depth0_exec)) { pjdlog_error("Exec path is too long."); + free($2); return (1); } break; @@ -367,12 +374,14 @@ exec_statement: EXEC STR sizeof(curres->hr_exec)) >= sizeof(curres->hr_exec)) { pjdlog_error("Exec path is too long."); + free($2); return (1); } break; default: assert(!"exec at wrong depth level"); } + free($2); } ; @@ -386,6 +395,7 @@ node_start: STR { switch (isitme($1)) { case -1: + free($1); return (1); case 0: break; @@ -395,6 +405,7 @@ node_start: STR default: assert(!"invalid isitme() return value"); } + free($1); } ; @@ -482,14 +493,17 @@ resource_start: STR curres = calloc(1, sizeof(*curres)); if (curres == NULL) { pjdlog_error("Unable to allocate memory for resource."); + free($1); return (1); } if (strlcpy(curres->hr_name, $1, sizeof(curres->hr_name)) >= sizeof(curres->hr_name)) { pjdlog_error("Resource name is too long."); + free($1); return (1); } + free($1); curres->hr_role = HAST_ROLE_INIT; curres->hr_previous_role = HAST_ROLE_INIT; curres->hr_replication = -1; @@ -530,6 +544,7 @@ name_statement: NAME STR sizeof(depth1_provname)) >= sizeof(depth1_provname)) { pjdlog_error("name argument is too long."); + free($2); return (1); } break; @@ -541,12 +556,14 @@ name_statement: NAME STR sizeof(curres->hr_provname)) >= sizeof(curres->hr_provname)) { pjdlog_error("name argument is too long."); + free($2); return (1); } break; default: assert(!"name at wrong depth level"); } + free($2); } ; @@ -558,6 +575,7 @@ local_statement: LOCAL STR sizeof(depth1_localpath)) >= sizeof(depth1_localpath)) { pjdlog_error("local argument is too long."); + free($2); return (1); } break; @@ -569,12 +587,14 @@ local_statement: LOCAL STR sizeof(curres->hr_localpath)) >= sizeof(curres->hr_localpath)) { pjdlog_error("local argument is too long."); + free($2); return (1); } break; default: assert(!"local at wrong depth level"); } + free($2); } ; @@ -589,6 +609,7 @@ resource_node_start: STR if (curres != NULL) { switch (isitme($1)) { case -1: + free($1); return (1); case 0: break; @@ -599,6 +620,7 @@ resource_node_start: STR assert(!"invalid isitme() return value"); } } + free($1); } ; @@ -624,8 +646,10 @@ remote_statement: REMOTE STR sizeof(curres->hr_remoteaddr)) >= sizeof(curres->hr_remoteaddr)) { pjdlog_error("remote argument is too long."); + free($2); return (1); } } + free($2); } ; Modified: stable/8/sbin/hastd/primary.c ============================================================================== --- stable/8/sbin/hastd/primary.c Tue Nov 2 22:48:52 2010 (r214696) +++ stable/8/sbin/hastd/primary.c Tue Nov 2 22:49:20 2010 (r214697) @@ -180,14 +180,21 @@ static pthread_mutex_t metadata_lock; if (_wakeup) \ cv_signal(&hio_##name##_list_cond); \ } while (0) -#define QUEUE_TAKE1(hio, name, ncomp) do { \ +#define QUEUE_TAKE1(hio, name, ncomp, timeout) do { \ + bool _last; \ + \ mtx_lock(&hio_##name##_list_lock[(ncomp)]); \ - while (((hio) = TAILQ_FIRST(&hio_##name##_list[(ncomp)])) == NULL) { \ - cv_wait(&hio_##name##_list_cond[(ncomp)], \ - &hio_##name##_list_lock[(ncomp)]); \ + _last = false; \ + while (((hio) = TAILQ_FIRST(&hio_##name##_list[(ncomp)])) == NULL && !_last) { \ + cv_timedwait(&hio_##name##_list_cond[(ncomp)], \ + &hio_##name##_list_lock[(ncomp)], (timeout)); \ + if ((timeout) != 0) \ + _last = true; \ + } \ + if (hio != NULL) { \ + TAILQ_REMOVE(&hio_##name##_list[(ncomp)], (hio), \ + hio_next[(ncomp)]); \ } \ - TAILQ_REMOVE(&hio_##name##_list[(ncomp)], (hio), \ - hio_next[(ncomp)]); \ mtx_unlock(&hio_##name##_list_lock[(ncomp)]); \ } while (0) #define QUEUE_TAKE2(hio, name) do { \ @@ -417,6 +424,24 @@ init_environment(struct hast_resource *r } } +static bool +init_resuid(struct hast_resource *res) +{ + + mtx_lock(&metadata_lock); + if (res->hr_resuid != 0) { + mtx_unlock(&metadata_lock); + return (false); + } else { + /* Initialize unique resource identifier. */ + arc4random_buf(&res->hr_resuid, sizeof(res->hr_resuid)); + mtx_unlock(&metadata_lock); + if (metadata_write(res) < 0) + exit(EX_NOINPUT); + return (true); + } +} + static void init_local(struct hast_resource *res) { @@ -452,10 +477,12 @@ init_local(struct hast_resource *res) if (res->hr_resuid != 0) return; /* - * We're using provider for the first time, so we have to generate - * resource unique identifier and initialize local and remote counts. + * We're using provider for the first time. Initialize local and remote + * counters. We don't initialize resuid here, as we want to do it just + * in time. The reason for this is that we want to inform secondary + * that there were no writes yet, so there is no need to synchronize + * anything. */ - arc4random_buf(&res->hr_resuid, sizeof(res->hr_resuid)); res->hr_primary_localcnt = 1; res->hr_primary_remotecnt = 0; if (metadata_write(res) < 0) @@ -566,6 +593,19 @@ init_remote(struct hast_resource *res, s nv_add_string(nvout, res->hr_name, "resource"); nv_add_uint8_array(nvout, res->hr_token, sizeof(res->hr_token), "token"); + if (res->hr_resuid == 0) { + /* + * The resuid field was not yet initialized. + * Because we do synchronization inside init_resuid(), it is + * possible that someone already initialized it, the function + * will return false then, but if we successfully initialized + * it, we will get true. True means that there were no writes + * to this resource yet and we want to inform secondary that + * synchronization is not needed by sending "virgin" argument. + */ + if (init_resuid(res)) + nv_add_int8(nvout, 1, "virgin"); + } nv_add_uint64(nvout, res->hr_resuid, "resuid"); nv_add_uint64(nvout, res->hr_primary_localcnt, "localcnt"); nv_add_uint64(nvout, res->hr_primary_remotecnt, "remotecnt"); @@ -646,6 +686,7 @@ init_remote(struct hast_resource *res, s */ (void)hast_activemap_flush(res); } + nv_free(nvin); pjdlog_info("Connected to %s.", res->hr_remoteaddr); if (inp != NULL && outp != NULL) { *inp = in; @@ -1005,6 +1046,10 @@ ggate_recv_thread(void *arg) QUEUE_INSERT1(hio, send, ncomp); break; case BIO_WRITE: + if (res->hr_resuid == 0) { + /* This is first write, initialize resuid. */ + (void)init_resuid(res); + } for (;;) { mtx_lock(&range_lock); if (rangelock_islocked(range_sync, @@ -1074,7 +1119,7 @@ local_send_thread(void *arg) for (;;) { pjdlog_debug(2, "local_send: Taking request."); - QUEUE_TAKE1(hio, send, ncomp); + QUEUE_TAKE1(hio, send, ncomp, 0); pjdlog_debug(2, "local_send: (%p) Got request.", hio); ggio = &hio->hio_ggio; switch (ggio->gctl_cmd) { @@ -1138,6 +1183,38 @@ local_send_thread(void *arg) return (NULL); } +static void +keepalive_send(struct hast_resource *res, unsigned int ncomp) +{ + struct nv *nv; + + if (!ISCONNECTED(res, ncomp)) + return; + + assert(res->hr_remotein != NULL); + assert(res->hr_remoteout != NULL); + + nv = nv_alloc(); + nv_add_uint8(nv, HIO_KEEPALIVE, "cmd"); + if (nv_error(nv) != 0) { + nv_free(nv); + pjdlog_debug(1, + "keepalive_send: Unable to prepare header to send."); + return; + } + if (hast_proto_send(res, res->hr_remoteout, nv, NULL, 0) < 0) { + pjdlog_common(LOG_DEBUG, 1, errno, + "keepalive_send: Unable to send request"); + nv_free(nv); + rw_unlock(&hio_remote_lock[ncomp]); + remote_close(res, ncomp); + rw_rlock(&hio_remote_lock[ncomp]); + return; + } + nv_free(nv); + pjdlog_debug(2, "keepalive_send: Request sent."); +} + /* * Thread sends request to secondary node. */ @@ -1146,6 +1223,7 @@ remote_send_thread(void *arg) { struct hast_resource *res = arg; struct g_gate_ctl_io *ggio; + time_t lastcheck, now; struct hio *hio; struct nv *nv; unsigned int ncomp; @@ -1156,10 +1234,19 @@ remote_send_thread(void *arg) /* Remote component is 1 for now. */ ncomp = 1; + lastcheck = time(NULL); for (;;) { pjdlog_debug(2, "remote_send: Taking request."); - QUEUE_TAKE1(hio, send, ncomp); + QUEUE_TAKE1(hio, send, ncomp, RETRY_SLEEP); + if (hio == NULL) { + now = time(NULL); + if (lastcheck + RETRY_SLEEP <= now) { + keepalive_send(res, ncomp); + lastcheck = now; + } + continue; + } pjdlog_debug(2, "remote_send: (%p) Got request.", hio); ggio = &hio->hio_ggio; switch (ggio->gctl_cmd) { @@ -1845,32 +1932,6 @@ failed: } static void -keepalive_send(struct hast_resource *res, unsigned int ncomp) -{ - struct nv *nv; - - nv = nv_alloc(); - nv_add_uint8(nv, HIO_KEEPALIVE, "cmd"); - if (nv_error(nv) != 0) { - nv_free(nv); - pjdlog_debug(1, - "keepalive_send: Unable to prepare header to send."); - return; - } - if (hast_proto_send(res, res->hr_remoteout, nv, NULL, 0) < 0) { - pjdlog_common(LOG_DEBUG, 1, errno, - "keepalive_send: Unable to send request"); - nv_free(nv); - rw_unlock(&hio_remote_lock[ncomp]); - remote_close(res, ncomp); - rw_rlock(&hio_remote_lock[ncomp]); - return; - } - nv_free(nv); - pjdlog_debug(2, "keepalive_send: Request sent."); -} - -static void guard_one(struct hast_resource *res, unsigned int ncomp) { struct proto_conn *in, *out; @@ -1888,12 +1949,6 @@ guard_one(struct hast_resource *res, uns if (ISCONNECTED(res, ncomp)) { assert(res->hr_remotein != NULL); assert(res->hr_remoteout != NULL); - keepalive_send(res, ncomp); - } - - if (ISCONNECTED(res, ncomp)) { - assert(res->hr_remotein != NULL); - assert(res->hr_remoteout != NULL); rw_unlock(&hio_remote_lock[ncomp]); pjdlog_debug(2, "remote_guard: Connection to %s is ok.", res->hr_remoteaddr); Modified: stable/8/sbin/hastd/secondary.c ============================================================================== --- stable/8/sbin/hastd/secondary.c Tue Nov 2 22:48:52 2010 (r214696) +++ stable/8/sbin/hastd/secondary.c Tue Nov 2 22:49:20 2010 (r214697) @@ -243,13 +243,22 @@ init_remote(struct hast_resource *res, s */ if (res->hr_resuid == 0) { /* - * Provider is used for the first time. Initialize everything. + * Provider is used for the first time. If primary node done no + * writes yet as well (we will find "virgin" argument) then + * there is no need to synchronize anything. If primary node + * done any writes already we have to synchronize everything. */ assert(res->hr_secondary_localcnt == 0); res->hr_resuid = resuid; if (metadata_write(res) < 0) exit(EX_NOINPUT); - memset(map, 0xff, mapsize); + if (nv_exists(nvin, "virgin")) { + free(map); + map = NULL; + mapsize = 0; + } else { + memset(map, 0xff, mapsize); + } nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc"); } else if ( /* Is primary is out-of-date? */ @@ -318,11 +327,11 @@ init_remote(struct hast_resource *res, s (uintmax_t)res->hr_secondary_remotecnt); } if (hast_proto_send(res, res->hr_remotein, nvout, map, mapsize) < 0) { - pjdlog_errno(LOG_WARNING, "Unable to send activemap to %s", + pjdlog_exit(EX_TEMPFAIL, "Unable to send activemap to %s", res->hr_remoteaddr); - nv_free(nvout); - exit(EX_TEMPFAIL); } + if (map != NULL) + free(map); nv_free(nvout); if (res->hr_secondary_localcnt > res->hr_primary_remotecnt && res->hr_primary_localcnt > res->hr_secondary_remotecnt) { Modified: stable/8/sbin/hastd/synch.h ============================================================================== --- stable/8/sbin/hastd/synch.h Tue Nov 2 22:48:52 2010 (r214696) +++ stable/8/sbin/hastd/synch.h Tue Nov 2 22:49:20 2010 (r214697) @@ -140,6 +140,8 @@ cv_init(pthread_cond_t *cv) assert(error == 0); error = pthread_cond_init(cv, &attr); assert(error == 0); + error = pthread_condattr_destroy(&attr); + assert(error == 0); } static __inline void cv_wait(pthread_cond_t *cv, pthread_mutex_t *lock) From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:57:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79A781065670; Tue, 2 Nov 2010 22:57:20 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 657CC8FC0C; Tue, 2 Nov 2010 22:57: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 oA2MvKbr095422; Tue, 2 Nov 2010 22:57:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MvKg9095419; Tue, 2 Nov 2010 22:57:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022257.oA2MvKg9095419@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 22:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214698 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:57:20 -0000 Author: yongari Date: Tue Nov 2 22:57:20 2010 New Revision: 214698 URL: http://svn.freebsd.org/changeset/base/214698 Log: MFC r213283,213410: r213283: Implement hardware MAC statistics for BCM5705 or newer Broadcom controllers. bge(4) exported MAC statistics on controllers that maintain the statistics in the NIC's internal memory. Newer controllers require register access to fetch these values. These counters provide useful information to diagnose driver issues. r213410: Consistently use ifHCOutOctets/ifHCInOctets instead of Octets as these names are used in data sheet. Also use UnicastPkts, MulticastPkts and BroadcastPkts instead of UcastPkts, McastPkts and BcastPkts to clarify its meaning. Suggested by: bde Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Nov 2 22:49:20 2010 (r214697) +++ stable/8/sys/dev/bge/if_bge.c Tue Nov 2 22:57:20 2010 (r214698) @@ -371,6 +371,7 @@ static int bge_rxeof(struct bge_softc *, static void bge_asf_driver_up (struct bge_softc *); static void bge_tick(void *); +static void bge_stats_clear_regs(struct bge_softc *); static void bge_stats_update(struct bge_softc *); static void bge_stats_update_regs(struct bge_softc *); static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, @@ -453,6 +454,10 @@ static int bge_sysctl_reg_read(SYSCTL_HA static int bge_sysctl_mem_read(SYSCTL_HANDLER_ARGS); #endif static void bge_add_sysctls(struct bge_softc *); +static void bge_add_sysctl_stats_regs(struct bge_softc *, + struct sysctl_ctx_list *, struct sysctl_oid_list *); +static void bge_add_sysctl_stats(struct bge_softc *, struct sysctl_ctx_list *, + struct sysctl_oid_list *); static int bge_sysctl_stats(SYSCTL_HANDLER_ARGS); static device_method_t bge_methods[] = { @@ -3730,15 +3735,127 @@ static void bge_stats_update_regs(struct bge_softc *sc) { struct ifnet *ifp; + struct bge_mac_stats *stats; ifp = sc->bge_ifp; + stats = &sc->bge_mac_stats; - ifp->if_collisions += CSR_READ_4(sc, BGE_MAC_STATS + - offsetof(struct bge_mac_stats_regs, etherStatsCollisions)); + stats->ifHCOutOctets += + CSR_READ_4(sc, BGE_TX_MAC_STATS_OCTETS); + stats->etherStatsCollisions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_COLLS); + stats->outXonSent += + CSR_READ_4(sc, BGE_TX_MAC_STATS_XON_SENT); + stats->outXoffSent += + CSR_READ_4(sc, BGE_TX_MAC_STATS_XOFF_SENT); + stats->dot3StatsInternalMacTransmitErrors += + CSR_READ_4(sc, BGE_TX_MAC_STATS_ERRORS); + stats->dot3StatsSingleCollisionFrames += + CSR_READ_4(sc, BGE_TX_MAC_STATS_SINGLE_COLL); + stats->dot3StatsMultipleCollisionFrames += + CSR_READ_4(sc, BGE_TX_MAC_STATS_MULTI_COLL); + stats->dot3StatsDeferredTransmissions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_DEFERRED); + stats->dot3StatsExcessiveCollisions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_EXCESS_COLL); + stats->dot3StatsLateCollisions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_LATE_COLL); + stats->ifHCOutUcastPkts += + CSR_READ_4(sc, BGE_TX_MAC_STATS_UCAST); + stats->ifHCOutMulticastPkts += + CSR_READ_4(sc, BGE_TX_MAC_STATS_MCAST); + stats->ifHCOutBroadcastPkts += + CSR_READ_4(sc, BGE_TX_MAC_STATS_BCAST); + + stats->ifHCInOctets += + CSR_READ_4(sc, BGE_RX_MAC_STATS_OCTESTS); + stats->etherStatsFragments += + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAGMENTS); + stats->ifHCInUcastPkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_UCAST); + stats->ifHCInMulticastPkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_MCAST); + stats->ifHCInBroadcastPkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_BCAST); + stats->dot3StatsFCSErrors += + CSR_READ_4(sc, BGE_RX_MAC_STATS_FCS_ERRORS); + stats->dot3StatsAlignmentErrors += + CSR_READ_4(sc, BGE_RX_MAC_STATS_ALGIN_ERRORS); + stats->xonPauseFramesReceived += + CSR_READ_4(sc, BGE_RX_MAC_STATS_XON_RCVD); + stats->xoffPauseFramesReceived += + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_RCVD); + stats->macControlFramesReceived += + CSR_READ_4(sc, BGE_RX_MAC_STATS_CTRL_RCVD); + stats->xoffStateEntered += + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_ENTERED); + stats->dot3StatsFramesTooLong += + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAME_TOO_LONG); + stats->etherStatsJabbers += + CSR_READ_4(sc, BGE_RX_MAC_STATS_JABBERS); + stats->etherStatsUndersizePkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_UNDERSIZE); + + stats->FramesDroppedDueToFilters += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_FILTDROP); + stats->DmaWriteQueueFull += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_WRQ_FULL); + stats->DmaWriteHighPriQueueFull += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); + stats->NoMoreRxBDs += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); + stats->InputDiscards += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + stats->InputErrors += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + stats->RecvThresholdHit += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_RXTHRESH_HIT); + + ifp->if_collisions = (u_long)stats->etherStatsCollisions; + ifp->if_ierrors = (u_long)(stats->NoMoreRxBDs + stats->InputDiscards + + stats->InputErrors); +} + +static void +bge_stats_clear_regs(struct bge_softc *sc) +{ - ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); - ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); - ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_OCTETS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_COLLS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_XON_SENT); + CSR_READ_4(sc, BGE_TX_MAC_STATS_XOFF_SENT); + CSR_READ_4(sc, BGE_TX_MAC_STATS_ERRORS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_SINGLE_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_MULTI_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_DEFERRED); + CSR_READ_4(sc, BGE_TX_MAC_STATS_EXCESS_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_LATE_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_UCAST); + CSR_READ_4(sc, BGE_TX_MAC_STATS_MCAST); + CSR_READ_4(sc, BGE_TX_MAC_STATS_BCAST); + + CSR_READ_4(sc, BGE_RX_MAC_STATS_OCTESTS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAGMENTS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_UCAST); + CSR_READ_4(sc, BGE_RX_MAC_STATS_MCAST); + CSR_READ_4(sc, BGE_RX_MAC_STATS_BCAST); + CSR_READ_4(sc, BGE_RX_MAC_STATS_FCS_ERRORS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_ALGIN_ERRORS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_XON_RCVD); + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_RCVD); + CSR_READ_4(sc, BGE_RX_MAC_STATS_CTRL_RCVD); + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_ENTERED); + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAME_TOO_LONG); + CSR_READ_4(sc, BGE_RX_MAC_STATS_JABBERS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_UNDERSIZE); + + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_FILTDROP); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_WRQ_FULL); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_RXTHRESH_HIT); } static void @@ -4241,6 +4358,10 @@ bge_init_locked(struct bge_softc *sc) */ CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2); + /* Clear MAC statistics. */ + if (BGE_IS_5705_PLUS(sc)) + bge_stats_clear_regs(sc); + /* Tell firmware we're alive. */ BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); @@ -4642,6 +4763,9 @@ bge_stop(struct bge_softc *sc) BGE_CLRBIT(sc, BGE_BMAN_MODE, BGE_BMANMODE_ENABLE); BGE_CLRBIT(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); } + /* Update MAC statistics. */ + if (BGE_IS_5705_PLUS(sc)) + bge_stats_update_regs(sc); bge_reset(sc); bge_sig_legacy(sc, BGE_RESET_STOP); @@ -4840,17 +4964,11 @@ bge_link_upd(struct bge_softc *sc) BGE_MACSTAT_LINK_CHANGED); } -#define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \ - SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, CTLTYPE_UINT|CTLFLAG_RD, \ - sc, offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", \ - desc) - static void bge_add_sysctls(struct bge_softc *sc) { struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *children, *schildren; - struct sysctl_oid *tree; + struct sysctl_oid_list *children; char tn[32]; int unit; @@ -4912,9 +5030,24 @@ bge_add_sysctls(struct bge_softc *sc) "generate UDP checksum value 0"); if (BGE_IS_5705_PLUS(sc)) - return; + bge_add_sysctl_stats_regs(sc, ctx, children); + else + bge_add_sysctl_stats(sc, ctx, children); +} + +#define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \ + SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, CTLTYPE_UINT|CTLFLAG_RD, \ + sc, offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", \ + desc) - tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, +static void +bge_add_sysctl_stats(struct bge_softc *sc, struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *parent) +{ + struct sysctl_oid *tree; + struct sysctl_oid_list *children, *schildren; + + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD, NULL, "BGE Statistics"); schildren = children = SYSCTL_CHILDREN(tree); BGE_SYSCTL_STAT(sc, ctx, "Frames Dropped Due To Filters", @@ -4953,11 +5086,11 @@ bge_add_sysctls(struct bge_softc *sc) NULL, "BGE RX Statistics"); children = SYSCTL_CHILDREN(tree); BGE_SYSCTL_STAT(sc, ctx, "Inbound Octets", - children, rxstats.ifHCInOctets, "Octets"); + children, rxstats.ifHCInOctets, "ifHCInOctets"); BGE_SYSCTL_STAT(sc, ctx, "Fragments", children, rxstats.etherStatsFragments, "Fragments"); BGE_SYSCTL_STAT(sc, ctx, "Inbound Unicast Packets", - children, rxstats.ifHCInUcastPkts, "UcastPkts"); + children, rxstats.ifHCInUcastPkts, "UnicastPkts"); BGE_SYSCTL_STAT(sc, ctx, "Inbound Multicast Packets", children, rxstats.ifHCInMulticastPkts, "MulticastPkts"); BGE_SYSCTL_STAT(sc, ctx, "FCS Errors", @@ -4989,7 +5122,7 @@ bge_add_sysctls(struct bge_softc *sc) NULL, "BGE TX Statistics"); children = SYSCTL_CHILDREN(tree); BGE_SYSCTL_STAT(sc, ctx, "Outbound Octets", - children, txstats.ifHCOutOctets, "Octets"); + children, txstats.ifHCOutOctets, "ifHCOutOctets"); BGE_SYSCTL_STAT(sc, ctx, "TX Collisions", children, txstats.etherStatsCollisions, "Collisions"); BGE_SYSCTL_STAT(sc, ctx, "XON Sent", @@ -5017,7 +5150,7 @@ bge_add_sysctls(struct bge_softc *sc) children, txstats.dot3StatsLateCollisions, "LateCollisions"); BGE_SYSCTL_STAT(sc, ctx, "Outbound Unicast Packets", - children, txstats.ifHCOutUcastPkts, "UcastPkts"); + children, txstats.ifHCOutUcastPkts, "UnicastPkts"); BGE_SYSCTL_STAT(sc, ctx, "Outbound Multicast Packets", children, txstats.ifHCOutMulticastPkts, "MulticastPkts"); BGE_SYSCTL_STAT(sc, ctx, "Outbound Broadcast Packets", @@ -5031,6 +5164,106 @@ bge_add_sysctls(struct bge_softc *sc) children, txstats.ifOutErrors, "Errors"); } +#undef BGE_SYSCTL_STAT + +#define BGE_SYSCTL_STAT_ADD64(c, h, n, p, d) \ + SYSCTL_ADD_QUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + +static void +bge_add_sysctl_stats_regs(struct bge_softc *sc, struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *parent) +{ + struct sysctl_oid *tree; + struct sysctl_oid_list *child, *schild; + struct bge_mac_stats *stats; + + stats = &sc->bge_mac_stats; + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "BGE Statistics"); + schild = child = SYSCTL_CHILDREN(tree); + BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesDroppedDueToFilters", + &stats->FramesDroppedDueToFilters, "Frames Dropped Due to Filters"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteQueueFull", + &stats->DmaWriteQueueFull, "NIC DMA Write Queue Full"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteHighPriQueueFull", + &stats->DmaWriteHighPriQueueFull, + "NIC DMA Write High Priority Queue Full"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "NoMoreRxBDs", + &stats->NoMoreRxBDs, "NIC No More RX Buffer Descriptors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "InputDiscards", + &stats->InputDiscards, "Discarded Input Frames"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "InputErrors", + &stats->InputErrors, "Input Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "RecvThresholdHit", + &stats->RecvThresholdHit, "NIC Recv Threshold Hit"); + + tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "BGE RX Statistics"); + child = SYSCTL_CHILDREN(tree); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCInOctets", + &stats->ifHCInOctets, "Inbound Octets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Fragments", + &stats->etherStatsFragments, "Fragments"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "UnicastPkts", + &stats->ifHCInUcastPkts, "Inbound Unicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "MulticastPkts", + &stats->ifHCInMulticastPkts, "Inbound Multicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "BroadcastPkts", + &stats->ifHCInBroadcastPkts, "Inbound Broadcast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "FCSErrors", + &stats->dot3StatsFCSErrors, "FCS Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "AlignmentErrors", + &stats->dot3StatsAlignmentErrors, "Alignment Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "xonPauseFramesReceived", + &stats->xonPauseFramesReceived, "XON Pause Frames Received"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "xoffPauseFramesReceived", + &stats->xoffPauseFramesReceived, "XOFF Pause Frames Received"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ControlFramesReceived", + &stats->macControlFramesReceived, "MAC Control Frames Received"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "xoffStateEntered", + &stats->xoffStateEntered, "XOFF State Entered"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesTooLong", + &stats->dot3StatsFramesTooLong, "Frames Too Long"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Jabbers", + &stats->etherStatsJabbers, "Jabbers"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "UndersizePkts", + &stats->etherStatsUndersizePkts, "Undersized Packets"); + + tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "BGE TX Statistics"); + child = SYSCTL_CHILDREN(tree); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCOutOctets", + &stats->ifHCOutOctets, "Outbound Octets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Collisions", + &stats->etherStatsCollisions, "TX Collisions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "XonSent", + &stats->outXonSent, "XON Sent"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "XoffSent", + &stats->outXoffSent, "XOFF Sent"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "InternalMacTransmitErrors", + &stats->dot3StatsInternalMacTransmitErrors, + "Internal MAC TX Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "SingleCollisionFrames", + &stats->dot3StatsSingleCollisionFrames, "Single Collision Frames"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "MultipleCollisionFrames", + &stats->dot3StatsMultipleCollisionFrames, + "Multiple Collision Frames"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "DeferredTransmissions", + &stats->dot3StatsDeferredTransmissions, "Deferred Transmissions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ExcessiveCollisions", + &stats->dot3StatsExcessiveCollisions, "Excessive Collisions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "LateCollisions", + &stats->dot3StatsLateCollisions, "Late Collisions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "UnicastPkts", + &stats->ifHCOutUcastPkts, "Outbound Unicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "MulticastPkts", + &stats->ifHCOutMulticastPkts, "Outbound Multicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "BroadcastPkts", + &stats->ifHCOutBroadcastPkts, "Outbound Broadcast Packets"); +} + +#undef BGE_SYSCTL_STAT_ADD64 + static int bge_sysctl_stats(SYSCTL_HANDLER_ARGS) { Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 22:49:20 2010 (r214697) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 22:57:20 2010 (r214698) @@ -637,7 +637,53 @@ #define BGE_SERDES_STS 0x0594 #define BGE_SGDIG_CFG 0x05B0 #define BGE_SGDIG_STS 0x05B4 -#define BGE_MAC_STATS 0x0800 +#define BGE_TX_MAC_STATS_OCTETS 0x0800 +#define BGE_TX_MAC_STATS_RESERVE_0 0x0804 +#define BGE_TX_MAC_STATS_COLLS 0x0808 +#define BGE_TX_MAC_STATS_XON_SENT 0x080C +#define BGE_TX_MAC_STATS_XOFF_SENT 0x0810 +#define BGE_TX_MAC_STATS_RESERVE_1 0x0814 +#define BGE_TX_MAC_STATS_ERRORS 0x0818 +#define BGE_TX_MAC_STATS_SINGLE_COLL 0x081C +#define BGE_TX_MAC_STATS_MULTI_COLL 0x0820 +#define BGE_TX_MAC_STATS_DEFERRED 0x0824 +#define BGE_TX_MAC_STATS_RESERVE_2 0x0828 +#define BGE_TX_MAC_STATS_EXCESS_COLL 0x082C +#define BGE_TX_MAC_STATS_LATE_COLL 0x0830 +#define BGE_TX_MAC_STATS_RESERVE_3 0x0834 +#define BGE_TX_MAC_STATS_RESERVE_4 0x0838 +#define BGE_TX_MAC_STATS_RESERVE_5 0x083C +#define BGE_TX_MAC_STATS_RESERVE_6 0x0840 +#define BGE_TX_MAC_STATS_RESERVE_7 0x0844 +#define BGE_TX_MAC_STATS_RESERVE_8 0x0848 +#define BGE_TX_MAC_STATS_RESERVE_9 0x084C +#define BGE_TX_MAC_STATS_RESERVE_10 0x0850 +#define BGE_TX_MAC_STATS_RESERVE_11 0x0854 +#define BGE_TX_MAC_STATS_RESERVE_12 0x0858 +#define BGE_TX_MAC_STATS_RESERVE_13 0x085C +#define BGE_TX_MAC_STATS_RESERVE_14 0x0860 +#define BGE_TX_MAC_STATS_RESERVE_15 0x0864 +#define BGE_TX_MAC_STATS_RESERVE_16 0x0868 +#define BGE_TX_MAC_STATS_UCAST 0x086C +#define BGE_TX_MAC_STATS_MCAST 0x0870 +#define BGE_TX_MAC_STATS_BCAST 0x0874 +#define BGE_TX_MAC_STATS_RESERVE_17 0x0878 +#define BGE_TX_MAC_STATS_RESERVE_18 0x087C +#define BGE_RX_MAC_STATS_OCTESTS 0x0880 +#define BGE_RX_MAC_STATS_RESERVE_0 0x0884 +#define BGE_RX_MAC_STATS_FRAGMENTS 0x0888 +#define BGE_RX_MAC_STATS_UCAST 0x088C +#define BGE_RX_MAC_STATS_MCAST 0x0890 +#define BGE_RX_MAC_STATS_BCAST 0x0894 +#define BGE_RX_MAC_STATS_FCS_ERRORS 0x0898 +#define BGE_RX_MAC_STATS_ALGIN_ERRORS 0x089C +#define BGE_RX_MAC_STATS_XON_RCVD 0x08A0 +#define BGE_RX_MAC_STATS_XOFF_RCVD 0x08A4 +#define BGE_RX_MAC_STATS_CTRL_RCVD 0x08A8 +#define BGE_RX_MAC_STATS_XOFF_ENTERED 0x08AC +#define BGE_RX_MAC_STATS_FRAME_TOO_LONG 0x08B0 +#define BGE_RX_MAC_STATS_JABBERS 0x08B4 +#define BGE_RX_MAC_STATS_UNDERSIZE 0x08B8 /* Ethernet MAC Mode register */ #define BGE_MACMODE_RESET 0x00000001 @@ -2349,40 +2395,50 @@ struct bge_tx_mac_stats { }; /* Stats counters access through registers */ -struct bge_mac_stats_regs { - uint32_t ifHCOutOctets; - uint32_t Reserved0; - uint32_t etherStatsCollisions; - uint32_t outXonSent; - uint32_t outXoffSent; - uint32_t Reserved1; - uint32_t dot3StatsInternalMacTransmitErrors; - uint32_t dot3StatsSingleCollisionFrames; - uint32_t dot3StatsMultipleCollisionFrames; - uint32_t dot3StatsDeferredTransmissions; - uint32_t Reserved2; - uint32_t dot3StatsExcessiveCollisions; - uint32_t dot3StatsLateCollisions; - uint32_t Reserved3[14]; - uint32_t ifHCOutUcastPkts; - uint32_t ifHCOutMulticastPkts; - uint32_t ifHCOutBroadcastPkts; - uint32_t Reserved4[2]; - uint32_t ifHCInOctets; - uint32_t Reserved5; - uint32_t etherStatsFragments; - uint32_t ifHCInUcastPkts; - uint32_t ifHCInMulticastPkts; - uint32_t ifHCInBroadcastPkts; - uint32_t dot3StatsFCSErrors; - uint32_t dot3StatsAlignmentErrors; - uint32_t xonPauseFramesReceived; - uint32_t xoffPauseFramesReceived; - uint32_t macControlFramesReceived; - uint32_t xoffStateEntered; - uint32_t dot3StatsFramesTooLong; - uint32_t etherStatsJabbers; - uint32_t etherStatsUndersizePkts; +struct bge_mac_stats { + /* TX MAC statistics */ + uint64_t ifHCOutOctets; + uint64_t Reserved0; + uint64_t etherStatsCollisions; + uint64_t outXonSent; + uint64_t outXoffSent; + uint64_t Reserved1; + uint64_t dot3StatsInternalMacTransmitErrors; + uint64_t dot3StatsSingleCollisionFrames; + uint64_t dot3StatsMultipleCollisionFrames; + uint64_t dot3StatsDeferredTransmissions; + uint64_t Reserved2; + uint64_t dot3StatsExcessiveCollisions; + uint64_t dot3StatsLateCollisions; + uint64_t Reserved3[14]; + uint64_t ifHCOutUcastPkts; + uint64_t ifHCOutMulticastPkts; + uint64_t ifHCOutBroadcastPkts; + uint64_t Reserved4[2]; + /* RX MAC statistics */ + uint64_t ifHCInOctets; + uint64_t Reserved5; + uint64_t etherStatsFragments; + uint64_t ifHCInUcastPkts; + uint64_t ifHCInMulticastPkts; + uint64_t ifHCInBroadcastPkts; + uint64_t dot3StatsFCSErrors; + uint64_t dot3StatsAlignmentErrors; + uint64_t xonPauseFramesReceived; + uint64_t xoffPauseFramesReceived; + uint64_t macControlFramesReceived; + uint64_t xoffStateEntered; + uint64_t dot3StatsFramesTooLong; + uint64_t etherStatsJabbers; + uint64_t etherStatsUndersizePkts; + /* Receive List Placement control */ + uint64_t FramesDroppedDueToFilters; + uint64_t DmaWriteQueueFull; + uint64_t DmaWriteHighPriQueueFull; + uint64_t NoMoreRxBDs; + uint64_t InputDiscards; + uint64_t InputErrors; + uint64_t RecvThresholdHit; }; struct bge_stats { @@ -2660,6 +2716,7 @@ struct bge_softc { #ifdef DEVICE_POLLING int rxcycles; #endif /* DEVICE_POLLING */ + struct bge_mac_stats bge_mac_stats; struct task bge_intr_task; struct taskqueue *bge_tq; }; From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 22:59:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C3031065673; Tue, 2 Nov 2010 22:59: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 0823E8FC1D; Tue, 2 Nov 2010 22:59: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 oA2Mxk8F095772; Tue, 2 Nov 2010 22:59:46 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2MxjgW095769; Tue, 2 Nov 2010 22:59:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022259.oA2MxjgW095769@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 22:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214699 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 22:59:46 -0000 Author: yongari Date: Tue Nov 2 22:59:45 2010 New Revision: 214699 URL: http://svn.freebsd.org/changeset/base/214699 Log: MFC r213283,213410: r213283: Implement hardware MAC statistics for BCM5705 or newer Broadcom controllers. bge(4) exported MAC statistics on controllers that maintain the statistics in the NIC's internal memory. Newer controllers require register access to fetch these values. These counters provide useful information to diagnose driver issues. r213410: Consistently use ifHCOutOctets/ifHCInOctets instead of Octets as these names are used in data sheet. Also use UnicastPkts, MulticastPkts and BroadcastPkts instead of UcastPkts, McastPkts and BcastPkts to clarify its meaning. Suggested by: bde Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Nov 2 22:57:20 2010 (r214698) +++ stable/7/sys/dev/bge/if_bge.c Tue Nov 2 22:59:45 2010 (r214699) @@ -371,6 +371,7 @@ static void bge_rxeof(struct bge_softc * static void bge_asf_driver_up (struct bge_softc *); static void bge_tick(void *); +static void bge_stats_clear_regs(struct bge_softc *); static void bge_stats_update(struct bge_softc *); static void bge_stats_update_regs(struct bge_softc *); static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, @@ -453,6 +454,10 @@ static int bge_sysctl_reg_read(SYSCTL_HA static int bge_sysctl_mem_read(SYSCTL_HANDLER_ARGS); #endif static void bge_add_sysctls(struct bge_softc *); +static void bge_add_sysctl_stats_regs(struct bge_softc *, + struct sysctl_ctx_list *, struct sysctl_oid_list *); +static void bge_add_sysctl_stats(struct bge_softc *, struct sysctl_ctx_list *, + struct sysctl_oid_list *); static int bge_sysctl_stats(SYSCTL_HANDLER_ARGS); static device_method_t bge_methods[] = { @@ -3726,15 +3731,127 @@ static void bge_stats_update_regs(struct bge_softc *sc) { struct ifnet *ifp; + struct bge_mac_stats *stats; ifp = sc->bge_ifp; + stats = &sc->bge_mac_stats; - ifp->if_collisions += CSR_READ_4(sc, BGE_MAC_STATS + - offsetof(struct bge_mac_stats_regs, etherStatsCollisions)); + stats->ifHCOutOctets += + CSR_READ_4(sc, BGE_TX_MAC_STATS_OCTETS); + stats->etherStatsCollisions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_COLLS); + stats->outXonSent += + CSR_READ_4(sc, BGE_TX_MAC_STATS_XON_SENT); + stats->outXoffSent += + CSR_READ_4(sc, BGE_TX_MAC_STATS_XOFF_SENT); + stats->dot3StatsInternalMacTransmitErrors += + CSR_READ_4(sc, BGE_TX_MAC_STATS_ERRORS); + stats->dot3StatsSingleCollisionFrames += + CSR_READ_4(sc, BGE_TX_MAC_STATS_SINGLE_COLL); + stats->dot3StatsMultipleCollisionFrames += + CSR_READ_4(sc, BGE_TX_MAC_STATS_MULTI_COLL); + stats->dot3StatsDeferredTransmissions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_DEFERRED); + stats->dot3StatsExcessiveCollisions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_EXCESS_COLL); + stats->dot3StatsLateCollisions += + CSR_READ_4(sc, BGE_TX_MAC_STATS_LATE_COLL); + stats->ifHCOutUcastPkts += + CSR_READ_4(sc, BGE_TX_MAC_STATS_UCAST); + stats->ifHCOutMulticastPkts += + CSR_READ_4(sc, BGE_TX_MAC_STATS_MCAST); + stats->ifHCOutBroadcastPkts += + CSR_READ_4(sc, BGE_TX_MAC_STATS_BCAST); + + stats->ifHCInOctets += + CSR_READ_4(sc, BGE_RX_MAC_STATS_OCTESTS); + stats->etherStatsFragments += + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAGMENTS); + stats->ifHCInUcastPkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_UCAST); + stats->ifHCInMulticastPkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_MCAST); + stats->ifHCInBroadcastPkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_BCAST); + stats->dot3StatsFCSErrors += + CSR_READ_4(sc, BGE_RX_MAC_STATS_FCS_ERRORS); + stats->dot3StatsAlignmentErrors += + CSR_READ_4(sc, BGE_RX_MAC_STATS_ALGIN_ERRORS); + stats->xonPauseFramesReceived += + CSR_READ_4(sc, BGE_RX_MAC_STATS_XON_RCVD); + stats->xoffPauseFramesReceived += + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_RCVD); + stats->macControlFramesReceived += + CSR_READ_4(sc, BGE_RX_MAC_STATS_CTRL_RCVD); + stats->xoffStateEntered += + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_ENTERED); + stats->dot3StatsFramesTooLong += + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAME_TOO_LONG); + stats->etherStatsJabbers += + CSR_READ_4(sc, BGE_RX_MAC_STATS_JABBERS); + stats->etherStatsUndersizePkts += + CSR_READ_4(sc, BGE_RX_MAC_STATS_UNDERSIZE); + + stats->FramesDroppedDueToFilters += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_FILTDROP); + stats->DmaWriteQueueFull += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_WRQ_FULL); + stats->DmaWriteHighPriQueueFull += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); + stats->NoMoreRxBDs += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); + stats->InputDiscards += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + stats->InputErrors += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + stats->RecvThresholdHit += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_RXTHRESH_HIT); + + ifp->if_collisions = (u_long)stats->etherStatsCollisions; + ifp->if_ierrors = (u_long)(stats->NoMoreRxBDs + stats->InputDiscards + + stats->InputErrors); +} + +static void +bge_stats_clear_regs(struct bge_softc *sc) +{ - ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); - ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); - ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_OCTETS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_COLLS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_XON_SENT); + CSR_READ_4(sc, BGE_TX_MAC_STATS_XOFF_SENT); + CSR_READ_4(sc, BGE_TX_MAC_STATS_ERRORS); + CSR_READ_4(sc, BGE_TX_MAC_STATS_SINGLE_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_MULTI_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_DEFERRED); + CSR_READ_4(sc, BGE_TX_MAC_STATS_EXCESS_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_LATE_COLL); + CSR_READ_4(sc, BGE_TX_MAC_STATS_UCAST); + CSR_READ_4(sc, BGE_TX_MAC_STATS_MCAST); + CSR_READ_4(sc, BGE_TX_MAC_STATS_BCAST); + + CSR_READ_4(sc, BGE_RX_MAC_STATS_OCTESTS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAGMENTS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_UCAST); + CSR_READ_4(sc, BGE_RX_MAC_STATS_MCAST); + CSR_READ_4(sc, BGE_RX_MAC_STATS_BCAST); + CSR_READ_4(sc, BGE_RX_MAC_STATS_FCS_ERRORS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_ALGIN_ERRORS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_XON_RCVD); + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_RCVD); + CSR_READ_4(sc, BGE_RX_MAC_STATS_CTRL_RCVD); + CSR_READ_4(sc, BGE_RX_MAC_STATS_XOFF_ENTERED); + CSR_READ_4(sc, BGE_RX_MAC_STATS_FRAME_TOO_LONG); + CSR_READ_4(sc, BGE_RX_MAC_STATS_JABBERS); + CSR_READ_4(sc, BGE_RX_MAC_STATS_UNDERSIZE); + + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_FILTDROP); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_WRQ_FULL); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_RXTHRESH_HIT); } static void @@ -4237,6 +4354,10 @@ bge_init_locked(struct bge_softc *sc) */ CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2); + /* Clear MAC statistics. */ + if (BGE_IS_5705_PLUS(sc)) + bge_stats_clear_regs(sc); + /* Tell firmware we're alive. */ BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); @@ -4638,6 +4759,9 @@ bge_stop(struct bge_softc *sc) BGE_CLRBIT(sc, BGE_BMAN_MODE, BGE_BMANMODE_ENABLE); BGE_CLRBIT(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); } + /* Update MAC statistics. */ + if (BGE_IS_5705_PLUS(sc)) + bge_stats_update_regs(sc); bge_reset(sc); bge_sig_legacy(sc, BGE_RESET_STOP); @@ -4836,17 +4960,11 @@ bge_link_upd(struct bge_softc *sc) BGE_MACSTAT_LINK_CHANGED); } -#define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \ - SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, CTLTYPE_UINT|CTLFLAG_RD, \ - sc, offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", \ - desc) - static void bge_add_sysctls(struct bge_softc *sc) { struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *children, *schildren; - struct sysctl_oid *tree; + struct sysctl_oid_list *children; char tn[32]; int unit; @@ -4908,9 +5026,24 @@ bge_add_sysctls(struct bge_softc *sc) "generate UDP checksum value 0"); if (BGE_IS_5705_PLUS(sc)) - return; + bge_add_sysctl_stats_regs(sc, ctx, children); + else + bge_add_sysctl_stats(sc, ctx, children); +} + +#define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \ + SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, oid, CTLTYPE_UINT|CTLFLAG_RD, \ + sc, offsetof(struct bge_stats, node), bge_sysctl_stats, "IU", \ + desc) - tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, +static void +bge_add_sysctl_stats(struct bge_softc *sc, struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *parent) +{ + struct sysctl_oid *tree; + struct sysctl_oid_list *children, *schildren; + + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD, NULL, "BGE Statistics"); schildren = children = SYSCTL_CHILDREN(tree); BGE_SYSCTL_STAT(sc, ctx, "Frames Dropped Due To Filters", @@ -4949,11 +5082,11 @@ bge_add_sysctls(struct bge_softc *sc) NULL, "BGE RX Statistics"); children = SYSCTL_CHILDREN(tree); BGE_SYSCTL_STAT(sc, ctx, "Inbound Octets", - children, rxstats.ifHCInOctets, "Octets"); + children, rxstats.ifHCInOctets, "ifHCInOctets"); BGE_SYSCTL_STAT(sc, ctx, "Fragments", children, rxstats.etherStatsFragments, "Fragments"); BGE_SYSCTL_STAT(sc, ctx, "Inbound Unicast Packets", - children, rxstats.ifHCInUcastPkts, "UcastPkts"); + children, rxstats.ifHCInUcastPkts, "UnicastPkts"); BGE_SYSCTL_STAT(sc, ctx, "Inbound Multicast Packets", children, rxstats.ifHCInMulticastPkts, "MulticastPkts"); BGE_SYSCTL_STAT(sc, ctx, "FCS Errors", @@ -4985,7 +5118,7 @@ bge_add_sysctls(struct bge_softc *sc) NULL, "BGE TX Statistics"); children = SYSCTL_CHILDREN(tree); BGE_SYSCTL_STAT(sc, ctx, "Outbound Octets", - children, txstats.ifHCOutOctets, "Octets"); + children, txstats.ifHCOutOctets, "ifHCOutOctets"); BGE_SYSCTL_STAT(sc, ctx, "TX Collisions", children, txstats.etherStatsCollisions, "Collisions"); BGE_SYSCTL_STAT(sc, ctx, "XON Sent", @@ -5013,7 +5146,7 @@ bge_add_sysctls(struct bge_softc *sc) children, txstats.dot3StatsLateCollisions, "LateCollisions"); BGE_SYSCTL_STAT(sc, ctx, "Outbound Unicast Packets", - children, txstats.ifHCOutUcastPkts, "UcastPkts"); + children, txstats.ifHCOutUcastPkts, "UnicastPkts"); BGE_SYSCTL_STAT(sc, ctx, "Outbound Multicast Packets", children, txstats.ifHCOutMulticastPkts, "MulticastPkts"); BGE_SYSCTL_STAT(sc, ctx, "Outbound Broadcast Packets", @@ -5027,6 +5160,106 @@ bge_add_sysctls(struct bge_softc *sc) children, txstats.ifOutErrors, "Errors"); } +#undef BGE_SYSCTL_STAT + +#define BGE_SYSCTL_STAT_ADD64(c, h, n, p, d) \ + SYSCTL_ADD_QUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + +static void +bge_add_sysctl_stats_regs(struct bge_softc *sc, struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *parent) +{ + struct sysctl_oid *tree; + struct sysctl_oid_list *child, *schild; + struct bge_mac_stats *stats; + + stats = &sc->bge_mac_stats; + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "BGE Statistics"); + schild = child = SYSCTL_CHILDREN(tree); + BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesDroppedDueToFilters", + &stats->FramesDroppedDueToFilters, "Frames Dropped Due to Filters"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteQueueFull", + &stats->DmaWriteQueueFull, "NIC DMA Write Queue Full"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "DmaWriteHighPriQueueFull", + &stats->DmaWriteHighPriQueueFull, + "NIC DMA Write High Priority Queue Full"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "NoMoreRxBDs", + &stats->NoMoreRxBDs, "NIC No More RX Buffer Descriptors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "InputDiscards", + &stats->InputDiscards, "Discarded Input Frames"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "InputErrors", + &stats->InputErrors, "Input Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "RecvThresholdHit", + &stats->RecvThresholdHit, "NIC Recv Threshold Hit"); + + tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "BGE RX Statistics"); + child = SYSCTL_CHILDREN(tree); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCInOctets", + &stats->ifHCInOctets, "Inbound Octets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Fragments", + &stats->etherStatsFragments, "Fragments"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "UnicastPkts", + &stats->ifHCInUcastPkts, "Inbound Unicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "MulticastPkts", + &stats->ifHCInMulticastPkts, "Inbound Multicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "BroadcastPkts", + &stats->ifHCInBroadcastPkts, "Inbound Broadcast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "FCSErrors", + &stats->dot3StatsFCSErrors, "FCS Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "AlignmentErrors", + &stats->dot3StatsAlignmentErrors, "Alignment Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "xonPauseFramesReceived", + &stats->xonPauseFramesReceived, "XON Pause Frames Received"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "xoffPauseFramesReceived", + &stats->xoffPauseFramesReceived, "XOFF Pause Frames Received"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ControlFramesReceived", + &stats->macControlFramesReceived, "MAC Control Frames Received"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "xoffStateEntered", + &stats->xoffStateEntered, "XOFF State Entered"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "FramesTooLong", + &stats->dot3StatsFramesTooLong, "Frames Too Long"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Jabbers", + &stats->etherStatsJabbers, "Jabbers"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "UndersizePkts", + &stats->etherStatsUndersizePkts, "Undersized Packets"); + + tree = SYSCTL_ADD_NODE(ctx, schild, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "BGE TX Statistics"); + child = SYSCTL_CHILDREN(tree); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ifHCOutOctets", + &stats->ifHCOutOctets, "Outbound Octets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "Collisions", + &stats->etherStatsCollisions, "TX Collisions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "XonSent", + &stats->outXonSent, "XON Sent"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "XoffSent", + &stats->outXoffSent, "XOFF Sent"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "InternalMacTransmitErrors", + &stats->dot3StatsInternalMacTransmitErrors, + "Internal MAC TX Errors"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "SingleCollisionFrames", + &stats->dot3StatsSingleCollisionFrames, "Single Collision Frames"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "MultipleCollisionFrames", + &stats->dot3StatsMultipleCollisionFrames, + "Multiple Collision Frames"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "DeferredTransmissions", + &stats->dot3StatsDeferredTransmissions, "Deferred Transmissions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "ExcessiveCollisions", + &stats->dot3StatsExcessiveCollisions, "Excessive Collisions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "LateCollisions", + &stats->dot3StatsLateCollisions, "Late Collisions"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "UnicastPkts", + &stats->ifHCOutUcastPkts, "Outbound Unicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "MulticastPkts", + &stats->ifHCOutMulticastPkts, "Outbound Multicast Packets"); + BGE_SYSCTL_STAT_ADD64(ctx, child, "BroadcastPkts", + &stats->ifHCOutBroadcastPkts, "Outbound Broadcast Packets"); +} + +#undef BGE_SYSCTL_STAT_ADD64 + static int bge_sysctl_stats(SYSCTL_HANDLER_ARGS) { Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 22:57:20 2010 (r214698) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 22:59:45 2010 (r214699) @@ -637,7 +637,53 @@ #define BGE_SERDES_STS 0x0594 #define BGE_SGDIG_CFG 0x05B0 #define BGE_SGDIG_STS 0x05B4 -#define BGE_MAC_STATS 0x0800 +#define BGE_TX_MAC_STATS_OCTETS 0x0800 +#define BGE_TX_MAC_STATS_RESERVE_0 0x0804 +#define BGE_TX_MAC_STATS_COLLS 0x0808 +#define BGE_TX_MAC_STATS_XON_SENT 0x080C +#define BGE_TX_MAC_STATS_XOFF_SENT 0x0810 +#define BGE_TX_MAC_STATS_RESERVE_1 0x0814 +#define BGE_TX_MAC_STATS_ERRORS 0x0818 +#define BGE_TX_MAC_STATS_SINGLE_COLL 0x081C +#define BGE_TX_MAC_STATS_MULTI_COLL 0x0820 +#define BGE_TX_MAC_STATS_DEFERRED 0x0824 +#define BGE_TX_MAC_STATS_RESERVE_2 0x0828 +#define BGE_TX_MAC_STATS_EXCESS_COLL 0x082C +#define BGE_TX_MAC_STATS_LATE_COLL 0x0830 +#define BGE_TX_MAC_STATS_RESERVE_3 0x0834 +#define BGE_TX_MAC_STATS_RESERVE_4 0x0838 +#define BGE_TX_MAC_STATS_RESERVE_5 0x083C +#define BGE_TX_MAC_STATS_RESERVE_6 0x0840 +#define BGE_TX_MAC_STATS_RESERVE_7 0x0844 +#define BGE_TX_MAC_STATS_RESERVE_8 0x0848 +#define BGE_TX_MAC_STATS_RESERVE_9 0x084C +#define BGE_TX_MAC_STATS_RESERVE_10 0x0850 +#define BGE_TX_MAC_STATS_RESERVE_11 0x0854 +#define BGE_TX_MAC_STATS_RESERVE_12 0x0858 +#define BGE_TX_MAC_STATS_RESERVE_13 0x085C +#define BGE_TX_MAC_STATS_RESERVE_14 0x0860 +#define BGE_TX_MAC_STATS_RESERVE_15 0x0864 +#define BGE_TX_MAC_STATS_RESERVE_16 0x0868 +#define BGE_TX_MAC_STATS_UCAST 0x086C +#define BGE_TX_MAC_STATS_MCAST 0x0870 +#define BGE_TX_MAC_STATS_BCAST 0x0874 +#define BGE_TX_MAC_STATS_RESERVE_17 0x0878 +#define BGE_TX_MAC_STATS_RESERVE_18 0x087C +#define BGE_RX_MAC_STATS_OCTESTS 0x0880 +#define BGE_RX_MAC_STATS_RESERVE_0 0x0884 +#define BGE_RX_MAC_STATS_FRAGMENTS 0x0888 +#define BGE_RX_MAC_STATS_UCAST 0x088C +#define BGE_RX_MAC_STATS_MCAST 0x0890 +#define BGE_RX_MAC_STATS_BCAST 0x0894 +#define BGE_RX_MAC_STATS_FCS_ERRORS 0x0898 +#define BGE_RX_MAC_STATS_ALGIN_ERRORS 0x089C +#define BGE_RX_MAC_STATS_XON_RCVD 0x08A0 +#define BGE_RX_MAC_STATS_XOFF_RCVD 0x08A4 +#define BGE_RX_MAC_STATS_CTRL_RCVD 0x08A8 +#define BGE_RX_MAC_STATS_XOFF_ENTERED 0x08AC +#define BGE_RX_MAC_STATS_FRAME_TOO_LONG 0x08B0 +#define BGE_RX_MAC_STATS_JABBERS 0x08B4 +#define BGE_RX_MAC_STATS_UNDERSIZE 0x08B8 /* Ethernet MAC Mode register */ #define BGE_MACMODE_RESET 0x00000001 @@ -2349,40 +2395,50 @@ struct bge_tx_mac_stats { }; /* Stats counters access through registers */ -struct bge_mac_stats_regs { - uint32_t ifHCOutOctets; - uint32_t Reserved0; - uint32_t etherStatsCollisions; - uint32_t outXonSent; - uint32_t outXoffSent; - uint32_t Reserved1; - uint32_t dot3StatsInternalMacTransmitErrors; - uint32_t dot3StatsSingleCollisionFrames; - uint32_t dot3StatsMultipleCollisionFrames; - uint32_t dot3StatsDeferredTransmissions; - uint32_t Reserved2; - uint32_t dot3StatsExcessiveCollisions; - uint32_t dot3StatsLateCollisions; - uint32_t Reserved3[14]; - uint32_t ifHCOutUcastPkts; - uint32_t ifHCOutMulticastPkts; - uint32_t ifHCOutBroadcastPkts; - uint32_t Reserved4[2]; - uint32_t ifHCInOctets; - uint32_t Reserved5; - uint32_t etherStatsFragments; - uint32_t ifHCInUcastPkts; - uint32_t ifHCInMulticastPkts; - uint32_t ifHCInBroadcastPkts; - uint32_t dot3StatsFCSErrors; - uint32_t dot3StatsAlignmentErrors; - uint32_t xonPauseFramesReceived; - uint32_t xoffPauseFramesReceived; - uint32_t macControlFramesReceived; - uint32_t xoffStateEntered; - uint32_t dot3StatsFramesTooLong; - uint32_t etherStatsJabbers; - uint32_t etherStatsUndersizePkts; +struct bge_mac_stats { + /* TX MAC statistics */ + uint64_t ifHCOutOctets; + uint64_t Reserved0; + uint64_t etherStatsCollisions; + uint64_t outXonSent; + uint64_t outXoffSent; + uint64_t Reserved1; + uint64_t dot3StatsInternalMacTransmitErrors; + uint64_t dot3StatsSingleCollisionFrames; + uint64_t dot3StatsMultipleCollisionFrames; + uint64_t dot3StatsDeferredTransmissions; + uint64_t Reserved2; + uint64_t dot3StatsExcessiveCollisions; + uint64_t dot3StatsLateCollisions; + uint64_t Reserved3[14]; + uint64_t ifHCOutUcastPkts; + uint64_t ifHCOutMulticastPkts; + uint64_t ifHCOutBroadcastPkts; + uint64_t Reserved4[2]; + /* RX MAC statistics */ + uint64_t ifHCInOctets; + uint64_t Reserved5; + uint64_t etherStatsFragments; + uint64_t ifHCInUcastPkts; + uint64_t ifHCInMulticastPkts; + uint64_t ifHCInBroadcastPkts; + uint64_t dot3StatsFCSErrors; + uint64_t dot3StatsAlignmentErrors; + uint64_t xonPauseFramesReceived; + uint64_t xoffPauseFramesReceived; + uint64_t macControlFramesReceived; + uint64_t xoffStateEntered; + uint64_t dot3StatsFramesTooLong; + uint64_t etherStatsJabbers; + uint64_t etherStatsUndersizePkts; + /* Receive List Placement control */ + uint64_t FramesDroppedDueToFilters; + uint64_t DmaWriteQueueFull; + uint64_t DmaWriteHighPriQueueFull; + uint64_t NoMoreRxBDs; + uint64_t InputDiscards; + uint64_t InputErrors; + uint64_t RecvThresholdHit; }; struct bge_stats { @@ -2660,6 +2716,7 @@ struct bge_softc { #ifdef DEVICE_POLLING int rxcycles; #endif /* DEVICE_POLLING */ + struct bge_mac_stats bge_mac_stats; struct task bge_intr_task; struct taskqueue *bge_tq; }; From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:04:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51522106566B; Tue, 2 Nov 2010 23:04:24 +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 3EB5E8FC0C; Tue, 2 Nov 2010 23:04: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 oA2N4OWb096209; Tue, 2 Nov 2010 23:04:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2N4Oef096206; Tue, 2 Nov 2010 23:04:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022304.oA2N4Oef096206@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214700 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:04:24 -0000 Author: yongari Date: Tue Nov 2 23:04:23 2010 New Revision: 214700 URL: http://svn.freebsd.org/changeset/base/214700 Log: MFC r213316,213333-213334: r213316: Fix IFCAP_TXCSUM/IFCAP_RXCSUM handling. Previously bge(4) used IFCAP_HWCSUM to know which capability should be changed such that disabling RX checksun offloading resulted in disabling TX checksum offloading. r213333: Allow write DMA to request larger DMA burst size to get better performance on BCM5785. Obtained from: OpenBSD r213334: Remove extra semicolon. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Nov 2 22:59:45 2010 (r214699) +++ stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:04:23 2010 (r214700) @@ -1052,7 +1052,7 @@ bge_init_rx_ring_std(struct bge_softc *s if ((error = bge_newbuf_std(sc, i)) != 0) return (error); BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT); - }; + } bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREWRITE); @@ -1095,7 +1095,7 @@ bge_init_rx_ring_jumbo(struct bge_softc if ((error = bge_newbuf_jumbo(sc, i)) != 0) return (error); BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT); - }; + } bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag, sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); @@ -1834,6 +1834,10 @@ bge_blockinit(struct bge_softc *sc) if (BGE_IS_5755_PLUS(sc)) val |= BGE_WDMAMODE_STATUS_TAG_FIX; + /* Request larger DMA burst size to get better performance. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5785) + val |= BGE_WDMAMODE_BURST_ALL_DATA; + /* Turn on write DMA state machine */ CSR_WRITE_4(sc, BGE_WDMA_MODE, val); DELAY(40); @@ -4632,15 +4636,19 @@ bge_ioctl(struct ifnet *ifp, u_long comm } } #endif - if (mask & IFCAP_HWCSUM) { - ifp->if_capenable ^= IFCAP_HWCSUM; - if (IFCAP_HWCSUM & ifp->if_capenable && - IFCAP_HWCSUM & ifp->if_capabilities) + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) ifp->if_hwassist |= sc->bge_csum_features; else ifp->if_hwassist &= ~sc->bge_csum_features; } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_TSO4) != 0 && (ifp->if_capabilities & IFCAP_TSO4) != 0) { ifp->if_capenable ^= IFCAP_TSO4; Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 22:59:45 2010 (r214699) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 23:04:23 2010 (r214700) @@ -1481,6 +1481,7 @@ #define BGE_WDMAMODE_LOCREAD_TOOBIG 0x00000200 #define BGE_WDMAMODE_ALL_ATTNS 0x000003FC #define BGE_WDMAMODE_STATUS_TAG_FIX 0x20000000 +#define BGE_WDMAMODE_BURST_ALL_DATA 0xC0000000 /* Write DMA status register */ #define BGE_WDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:07:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05E48106564A; Tue, 2 Nov 2010 23:07:39 +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 E76858FC19; Tue, 2 Nov 2010 23:07: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 oA2N7ct4096586; Tue, 2 Nov 2010 23:07:38 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2N7cJR096583; Tue, 2 Nov 2010 23:07:38 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022307.oA2N7cJR096583@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:07:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214701 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:07:39 -0000 Author: yongari Date: Tue Nov 2 23:07:38 2010 New Revision: 214701 URL: http://svn.freebsd.org/changeset/base/214701 Log: MFC r213316,213333-213334: r213316: Fix IFCAP_TXCSUM/IFCAP_RXCSUM handling. Previously bge(4) used IFCAP_HWCSUM to know which capability should be changed such that disabling RX checksun offloading resulted in disabling TX checksum offloading. r213333: Allow write DMA to request larger DMA burst size to get better performance on BCM5785. Obtained from: OpenBSD r213334: Remove extra semicolon. Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:04:23 2010 (r214700) +++ stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:07:38 2010 (r214701) @@ -1052,7 +1052,7 @@ bge_init_rx_ring_std(struct bge_softc *s if ((error = bge_newbuf_std(sc, i)) != 0) return (error); BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT); - }; + } bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREWRITE); @@ -1095,7 +1095,7 @@ bge_init_rx_ring_jumbo(struct bge_softc if ((error = bge_newbuf_jumbo(sc, i)) != 0) return (error); BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT); - }; + } bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag, sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); @@ -1834,6 +1834,10 @@ bge_blockinit(struct bge_softc *sc) if (BGE_IS_5755_PLUS(sc)) val |= BGE_WDMAMODE_STATUS_TAG_FIX; + /* Request larger DMA burst size to get better performance. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5785) + val |= BGE_WDMAMODE_BURST_ALL_DATA; + /* Turn on write DMA state machine */ CSR_WRITE_4(sc, BGE_WDMA_MODE, val); DELAY(40); @@ -4628,15 +4632,19 @@ bge_ioctl(struct ifnet *ifp, u_long comm } } #endif - if (mask & IFCAP_HWCSUM) { - ifp->if_capenable ^= IFCAP_HWCSUM; - if (IFCAP_HWCSUM & ifp->if_capenable && - IFCAP_HWCSUM & ifp->if_capabilities) + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) ifp->if_hwassist |= sc->bge_csum_features; else ifp->if_hwassist &= ~sc->bge_csum_features; } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_TSO4) != 0 && (ifp->if_capabilities & IFCAP_TSO4) != 0) { ifp->if_capenable ^= IFCAP_TSO4; Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 23:04:23 2010 (r214700) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 23:07:38 2010 (r214701) @@ -1481,6 +1481,7 @@ #define BGE_WDMAMODE_LOCREAD_TOOBIG 0x00000200 #define BGE_WDMAMODE_ALL_ATTNS 0x000003FC #define BGE_WDMAMODE_STATUS_TAG_FIX 0x20000000 +#define BGE_WDMAMODE_BURST_ALL_DATA 0xC0000000 /* Write DMA status register */ #define BGE_WDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:23:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BC2E106564A; Tue, 2 Nov 2010 23:23:49 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 489538FC0C; Tue, 2 Nov 2010 23:23:49 +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 oA2NNnP3097924; Tue, 2 Nov 2010 23:23:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NNnEe097920; Tue, 2 Nov 2010 23:23:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022323.oA2NNnEe097920@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214702 - in stable/8/sys/dev: bge mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:23:49 -0000 Author: yongari Date: Tue Nov 2 23:23:48 2010 New Revision: 214702 URL: http://svn.freebsd.org/changeset/base/214702 Log: MFC r213411,213464-213465,213468: r213411: Enable fix for read DMA FIFO overruns on controllers that have this fix. Note, we still need workaround for controllers that lacks this fix and it needs more work in RX BD updating. Submitted by: davidch r213464: Separate common flags into controller specific and PHY related flags. There should be no functional changes. This change will make it easy to add more quirk/flags in future. Reviewed by: davidch r213465: Rearrange code a bit to correctly set PHY flags. This change make it easy to add more newer ASICs. Obtained from: OpenBSD r213468: Fix bge(4) build breakage when BGE_REGISTER_DEBUG is defined. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h stable/8/sys/dev/mii/brgphy.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:07:38 2010 (r214701) +++ stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:23:48 2010 (r214702) @@ -1858,6 +1858,19 @@ bge_blockinit(struct bge_softc *sc) sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } + if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || + sc->bge_asicrev == BGE_ASICREV_BCM5784 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || + sc->bge_asicrev == BGE_ASICREV_BCM57780) { + /* + * Enable fix for read DMA FIFO overruns. + * The fix is to limit the number of RX BDs + * the hardware would fetch at a fime. + */ + CSR_WRITE_4(sc, BGE_RDMA_RSRVCTRL, + CSR_READ_4(sc, BGE_RDMA_RSRVCTRL) | + BGE_RDMA_RSRVCTRL_FIFO_OFLW_FIX); + } CSR_WRITE_4(sc, BGE_RDMA_MODE, val); DELAY(40); @@ -2497,7 +2510,7 @@ bge_attach(device_t dev) sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_chipid != BGE_CHIPID_BCM5705_A0 && sc->bge_chipid != BGE_CHIPID_BCM5705_A1) - sc->bge_flags |= BGE_FLAG_WIRESPEED; + sc->bge_phy_flags |= BGE_PHY_WIRESPEED; if (bge_has_eaddr(sc)) sc->bge_flags |= BGE_FLAG_EADDR; @@ -2534,30 +2547,32 @@ bge_attach(device_t dev) break; } - /* Set various bug flags. */ + /* Set various PHY bug flags. */ if (sc->bge_chipid == BGE_CHIPID_BCM5701_A0 || sc->bge_chipid == BGE_CHIPID_BCM5701_B0) - sc->bge_flags |= BGE_FLAG_CRC_BUG; + sc->bge_phy_flags |= BGE_PHY_CRC_BUG; if (sc->bge_chiprev == BGE_CHIPREV_5703_AX || sc->bge_chiprev == BGE_CHIPREV_5704_AX) - sc->bge_flags |= BGE_FLAG_ADC_BUG; + sc->bge_phy_flags |= BGE_PHY_ADC_BUG; if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0) - sc->bge_flags |= BGE_FLAG_5704_A0_BUG; + sc->bge_phy_flags |= BGE_PHY_5704_A0_BUG; if (pci_get_subvendor(dev) == DELL_VENDORID) - sc->bge_flags |= BGE_FLAG_NO_3LED; - if (pci_get_device(dev) == BCOM_DEVICEID_BCM5755M) - sc->bge_flags |= BGE_FLAG_ADJUST_TRIM; - if (BGE_IS_5705_PLUS(sc) && - !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) { + sc->bge_phy_flags |= BGE_PHY_NO_3LED; + if ((BGE_IS_5705_PLUS(sc)) && + sc->bge_asicrev != BGE_ASICREV_BCM5906 && + sc->bge_asicrev != BGE_ASICREV_BCM5785 && + sc->bge_asicrev != BGE_ASICREV_BCM57780) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5787) { if (pci_get_device(dev) != BCOM_DEVICEID_BCM5722 && pci_get_device(dev) != BCOM_DEVICEID_BCM5756) - sc->bge_flags |= BGE_FLAG_JITTER_BUG; - } else if (sc->bge_asicrev != BGE_ASICREV_BCM5906) - sc->bge_flags |= BGE_FLAG_BER_BUG; + sc->bge_phy_flags |= BGE_PHY_JITTER_BUG; + if (pci_get_device(dev) == BCOM_DEVICEID_BCM5755M) + sc->bge_phy_flags |= BGE_PHY_ADJUST_TRIM; + } else + sc->bge_phy_flags |= BGE_PHY_BER_BUG; } /* @@ -5342,7 +5357,7 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG printf(" - PCI-X Bus\n"); if (sc->bge_flags & BGE_FLAG_PCIE) printf(" - PCI Express Bus\n"); - if (sc->bge_flags & BGE_FLAG_NO_3LED) + if (sc->bge_phy_flags & BGE_PHY_NO_3LED) printf(" - No 3 LEDs\n"); if (sc->bge_flags & BGE_FLAG_RX_ALIGNBUG) printf(" - RX Alignment Bug\n"); Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 23:07:38 2010 (r214701) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 23:23:48 2010 (r214702) @@ -1431,6 +1431,7 @@ */ #define BGE_RDMA_MODE 0x4800 #define BGE_RDMA_STATUS 0x4804 +#define BGE_RDMA_RSRVCTRL 0x4900 /* Read DMA mode register */ #define BGE_RDMAMODE_RESET 0x00000001 @@ -1462,6 +1463,9 @@ #define BGE_RDMASTAT_PCI_FIFOOREAD_ATTN 0x00000100 #define BGE_RDMASTAT_LOCWRITE_TOOBIG 0x00000200 +/* Read DMA Reserved Control register */ +#define BGE_RDMA_RSRVCTRL_FIFO_OFLW_FIX 0x00000004 + /* * Write DMA control registers */ @@ -2659,29 +2663,30 @@ struct bge_softc { uint32_t bge_flags; #define BGE_FLAG_TBI 0x00000001 #define BGE_FLAG_JUMBO 0x00000002 -#define BGE_FLAG_WIRESPEED 0x00000004 #define BGE_FLAG_EADDR 0x00000008 #define BGE_FLAG_MII_SERDES 0x00000010 #define BGE_FLAG_MSI 0x00000100 #define BGE_FLAG_PCIX 0x00000200 #define BGE_FLAG_PCIE 0x00000400 #define BGE_FLAG_TSO 0x00000800 -#define BGE_FLAG_5700_FAMILY 0x00001000 -#define BGE_FLAG_5705_PLUS 0x00002000 -#define BGE_FLAG_5714_FAMILY 0x00004000 -#define BGE_FLAG_575X_PLUS 0x00008000 -#define BGE_FLAG_5755_PLUS 0x00010000 -#define BGE_FLAG_40BIT_BUG 0x00020000 -#define BGE_FLAG_4G_BNDRY_BUG 0x00040000 -#define BGE_FLAG_RX_ALIGNBUG 0x00100000 -#define BGE_FLAG_NO_3LED 0x00200000 -#define BGE_FLAG_ADC_BUG 0x00400000 -#define BGE_FLAG_5704_A0_BUG 0x00800000 -#define BGE_FLAG_JITTER_BUG 0x01000000 -#define BGE_FLAG_BER_BUG 0x02000000 -#define BGE_FLAG_ADJUST_TRIM 0x04000000 -#define BGE_FLAG_CRC_BUG 0x08000000 -#define BGE_FLAG_5788 0x20000000 +#define BGE_FLAG_5700_FAMILY 0x00010000 +#define BGE_FLAG_5705_PLUS 0x00020000 +#define BGE_FLAG_5714_FAMILY 0x00040000 +#define BGE_FLAG_575X_PLUS 0x00080000 +#define BGE_FLAG_5755_PLUS 0x00100000 +#define BGE_FLAG_5788 0x00200000 +#define BGE_FLAG_40BIT_BUG 0x01000000 +#define BGE_FLAG_4G_BNDRY_BUG 0x02000000 +#define BGE_FLAG_RX_ALIGNBUG 0x04000000 + uint32_t bge_phy_flags; +#define BGE_PHY_WIRESPEED 0x00000001 +#define BGE_PHY_ADC_BUG 0x00000002 +#define BGE_PHY_5704_A0_BUG 0x00000004 +#define BGE_PHY_JITTER_BUG 0x00000008 +#define BGE_PHY_BER_BUG 0x00000010 +#define BGE_PHY_ADJUST_TRIM 0x00000020 +#define BGE_PHY_CRC_BUG 0x00000040 +#define BGE_PHY_NO_3LED 0x00000080 uint32_t bge_chipid; uint32_t bge_asicrev; uint32_t bge_chiprev; Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Tue Nov 2 23:07:38 2010 (r214701) +++ stable/8/sys/dev/mii/brgphy.c Tue Nov 2 23:23:48 2010 (r214702) @@ -1025,26 +1025,26 @@ brgphy_reset(struct mii_softc *sc) /* Handle any bge (NetXtreme/NetLink) workarounds. */ if (bge_sc) { /* Fix up various bugs */ - if (bge_sc->bge_flags & BGE_FLAG_5704_A0_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_5704_A0_BUG) brgphy_fixup_5704_a0_bug(sc); - if (bge_sc->bge_flags & BGE_FLAG_ADC_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_ADC_BUG) brgphy_fixup_adc_bug(sc); - if (bge_sc->bge_flags & BGE_FLAG_ADJUST_TRIM) + if (bge_sc->bge_phy_flags & BGE_PHY_ADJUST_TRIM) brgphy_fixup_adjust_trim(sc); - if (bge_sc->bge_flags & BGE_FLAG_BER_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_BER_BUG) brgphy_fixup_ber_bug(sc); - if (bge_sc->bge_flags & BGE_FLAG_CRC_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_CRC_BUG) brgphy_fixup_crc_bug(sc); - if (bge_sc->bge_flags & BGE_FLAG_JITTER_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_JITTER_BUG) brgphy_fixup_jitter_bug(sc); brgphy_jumbo_settings(sc, ifp->if_mtu); - if (bge_sc->bge_flags & BGE_FLAG_WIRESPEED) + if (bge_sc->bge_phy_flags & BGE_PHY_WIRESPEED) brgphy_ethernet_wirespeed(sc); /* Enable Link LED on Dell boxes */ - if (bge_sc->bge_flags & BGE_FLAG_NO_3LED) { + if (bge_sc->bge_phy_flags & BGE_PHY_NO_3LED) { PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL, PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL) & ~BRGPHY_PHY_EXTCTL_3_LED); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:26:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9434C106564A; Tue, 2 Nov 2010 23:26:07 +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 812878FC12; Tue, 2 Nov 2010 23: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 oA2NQ7rZ098061; Tue, 2 Nov 2010 23:26:07 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NQ7DU098057; Tue, 2 Nov 2010 23:26:07 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022326.oA2NQ7DU098057@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:26:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214703 - in stable/7/sys/dev: bge mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:26:07 -0000 Author: yongari Date: Tue Nov 2 23:26:07 2010 New Revision: 214703 URL: http://svn.freebsd.org/changeset/base/214703 Log: MFC r213411,213464-213465,213468: r213411: Enable fix for read DMA FIFO overruns on controllers that have this fix. Note, we still need workaround for controllers that lacks this fix and it needs more work in RX BD updating. Submitted by: davidch r213464: Separate common flags into controller specific and PHY related flags. There should be no functional changes. This change will make it easy to add more quirk/flags in future. Reviewed by: davidch r213465: Rearrange code a bit to correctly set PHY flags. This change make it easy to add more newer ASICs. Obtained from: OpenBSD r213468: Fix bge(4) build breakage when BGE_REGISTER_DEBUG is defined. Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h stable/7/sys/dev/mii/brgphy.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:23:48 2010 (r214702) +++ stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:26:07 2010 (r214703) @@ -1858,6 +1858,19 @@ bge_blockinit(struct bge_softc *sc) sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } + if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || + sc->bge_asicrev == BGE_ASICREV_BCM5784 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || + sc->bge_asicrev == BGE_ASICREV_BCM57780) { + /* + * Enable fix for read DMA FIFO overruns. + * The fix is to limit the number of RX BDs + * the hardware would fetch at a fime. + */ + CSR_WRITE_4(sc, BGE_RDMA_RSRVCTRL, + CSR_READ_4(sc, BGE_RDMA_RSRVCTRL) | + BGE_RDMA_RSRVCTRL_FIFO_OFLW_FIX); + } CSR_WRITE_4(sc, BGE_RDMA_MODE, val); DELAY(40); @@ -2497,7 +2510,7 @@ bge_attach(device_t dev) sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_chipid != BGE_CHIPID_BCM5705_A0 && sc->bge_chipid != BGE_CHIPID_BCM5705_A1) - sc->bge_flags |= BGE_FLAG_WIRESPEED; + sc->bge_phy_flags |= BGE_PHY_WIRESPEED; if (bge_has_eaddr(sc)) sc->bge_flags |= BGE_FLAG_EADDR; @@ -2534,30 +2547,32 @@ bge_attach(device_t dev) break; } - /* Set various bug flags. */ + /* Set various PHY bug flags. */ if (sc->bge_chipid == BGE_CHIPID_BCM5701_A0 || sc->bge_chipid == BGE_CHIPID_BCM5701_B0) - sc->bge_flags |= BGE_FLAG_CRC_BUG; + sc->bge_phy_flags |= BGE_PHY_CRC_BUG; if (sc->bge_chiprev == BGE_CHIPREV_5703_AX || sc->bge_chiprev == BGE_CHIPREV_5704_AX) - sc->bge_flags |= BGE_FLAG_ADC_BUG; + sc->bge_phy_flags |= BGE_PHY_ADC_BUG; if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0) - sc->bge_flags |= BGE_FLAG_5704_A0_BUG; + sc->bge_phy_flags |= BGE_PHY_5704_A0_BUG; if (pci_get_subvendor(dev) == DELL_VENDORID) - sc->bge_flags |= BGE_FLAG_NO_3LED; - if (pci_get_device(dev) == BCOM_DEVICEID_BCM5755M) - sc->bge_flags |= BGE_FLAG_ADJUST_TRIM; - if (BGE_IS_5705_PLUS(sc) && - !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) { + sc->bge_phy_flags |= BGE_PHY_NO_3LED; + if ((BGE_IS_5705_PLUS(sc)) && + sc->bge_asicrev != BGE_ASICREV_BCM5906 && + sc->bge_asicrev != BGE_ASICREV_BCM5785 && + sc->bge_asicrev != BGE_ASICREV_BCM57780) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5787) { if (pci_get_device(dev) != BCOM_DEVICEID_BCM5722 && pci_get_device(dev) != BCOM_DEVICEID_BCM5756) - sc->bge_flags |= BGE_FLAG_JITTER_BUG; - } else if (sc->bge_asicrev != BGE_ASICREV_BCM5906) - sc->bge_flags |= BGE_FLAG_BER_BUG; + sc->bge_phy_flags |= BGE_PHY_JITTER_BUG; + if (pci_get_device(dev) == BCOM_DEVICEID_BCM5755M) + sc->bge_phy_flags |= BGE_PHY_ADJUST_TRIM; + } else + sc->bge_phy_flags |= BGE_PHY_BER_BUG; } /* @@ -5338,7 +5353,7 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG printf(" - PCI-X Bus\n"); if (sc->bge_flags & BGE_FLAG_PCIE) printf(" - PCI Express Bus\n"); - if (sc->bge_flags & BGE_FLAG_NO_3LED) + if (sc->bge_phy_flags & BGE_PHY_NO_3LED) printf(" - No 3 LEDs\n"); if (sc->bge_flags & BGE_FLAG_RX_ALIGNBUG) printf(" - RX Alignment Bug\n"); Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 23:23:48 2010 (r214702) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 23:26:07 2010 (r214703) @@ -1431,6 +1431,7 @@ */ #define BGE_RDMA_MODE 0x4800 #define BGE_RDMA_STATUS 0x4804 +#define BGE_RDMA_RSRVCTRL 0x4900 /* Read DMA mode register */ #define BGE_RDMAMODE_RESET 0x00000001 @@ -1462,6 +1463,9 @@ #define BGE_RDMASTAT_PCI_FIFOOREAD_ATTN 0x00000100 #define BGE_RDMASTAT_LOCWRITE_TOOBIG 0x00000200 +/* Read DMA Reserved Control register */ +#define BGE_RDMA_RSRVCTRL_FIFO_OFLW_FIX 0x00000004 + /* * Write DMA control registers */ @@ -2659,29 +2663,30 @@ struct bge_softc { uint32_t bge_flags; #define BGE_FLAG_TBI 0x00000001 #define BGE_FLAG_JUMBO 0x00000002 -#define BGE_FLAG_WIRESPEED 0x00000004 #define BGE_FLAG_EADDR 0x00000008 #define BGE_FLAG_MII_SERDES 0x00000010 #define BGE_FLAG_MSI 0x00000100 #define BGE_FLAG_PCIX 0x00000200 #define BGE_FLAG_PCIE 0x00000400 #define BGE_FLAG_TSO 0x00000800 -#define BGE_FLAG_5700_FAMILY 0x00001000 -#define BGE_FLAG_5705_PLUS 0x00002000 -#define BGE_FLAG_5714_FAMILY 0x00004000 -#define BGE_FLAG_575X_PLUS 0x00008000 -#define BGE_FLAG_5755_PLUS 0x00010000 -#define BGE_FLAG_40BIT_BUG 0x00020000 -#define BGE_FLAG_4G_BNDRY_BUG 0x00040000 -#define BGE_FLAG_RX_ALIGNBUG 0x00100000 -#define BGE_FLAG_NO_3LED 0x00200000 -#define BGE_FLAG_ADC_BUG 0x00400000 -#define BGE_FLAG_5704_A0_BUG 0x00800000 -#define BGE_FLAG_JITTER_BUG 0x01000000 -#define BGE_FLAG_BER_BUG 0x02000000 -#define BGE_FLAG_ADJUST_TRIM 0x04000000 -#define BGE_FLAG_CRC_BUG 0x08000000 -#define BGE_FLAG_5788 0x20000000 +#define BGE_FLAG_5700_FAMILY 0x00010000 +#define BGE_FLAG_5705_PLUS 0x00020000 +#define BGE_FLAG_5714_FAMILY 0x00040000 +#define BGE_FLAG_575X_PLUS 0x00080000 +#define BGE_FLAG_5755_PLUS 0x00100000 +#define BGE_FLAG_5788 0x00200000 +#define BGE_FLAG_40BIT_BUG 0x01000000 +#define BGE_FLAG_4G_BNDRY_BUG 0x02000000 +#define BGE_FLAG_RX_ALIGNBUG 0x04000000 + uint32_t bge_phy_flags; +#define BGE_PHY_WIRESPEED 0x00000001 +#define BGE_PHY_ADC_BUG 0x00000002 +#define BGE_PHY_5704_A0_BUG 0x00000004 +#define BGE_PHY_JITTER_BUG 0x00000008 +#define BGE_PHY_BER_BUG 0x00000010 +#define BGE_PHY_ADJUST_TRIM 0x00000020 +#define BGE_PHY_CRC_BUG 0x00000040 +#define BGE_PHY_NO_3LED 0x00000080 uint32_t bge_chipid; uint32_t bge_asicrev; uint32_t bge_chiprev; Modified: stable/7/sys/dev/mii/brgphy.c ============================================================================== --- stable/7/sys/dev/mii/brgphy.c Tue Nov 2 23:23:48 2010 (r214702) +++ stable/7/sys/dev/mii/brgphy.c Tue Nov 2 23:26:07 2010 (r214703) @@ -1013,26 +1013,26 @@ brgphy_reset(struct mii_softc *sc) /* Handle any bge (NetXtreme/NetLink) workarounds. */ if (bge_sc) { /* Fix up various bugs */ - if (bge_sc->bge_flags & BGE_FLAG_5704_A0_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_5704_A0_BUG) brgphy_fixup_5704_a0_bug(sc); - if (bge_sc->bge_flags & BGE_FLAG_ADC_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_ADC_BUG) brgphy_fixup_adc_bug(sc); - if (bge_sc->bge_flags & BGE_FLAG_ADJUST_TRIM) + if (bge_sc->bge_phy_flags & BGE_PHY_ADJUST_TRIM) brgphy_fixup_adjust_trim(sc); - if (bge_sc->bge_flags & BGE_FLAG_BER_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_BER_BUG) brgphy_fixup_ber_bug(sc); - if (bge_sc->bge_flags & BGE_FLAG_CRC_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_CRC_BUG) brgphy_fixup_crc_bug(sc); - if (bge_sc->bge_flags & BGE_FLAG_JITTER_BUG) + if (bge_sc->bge_phy_flags & BGE_PHY_JITTER_BUG) brgphy_fixup_jitter_bug(sc); brgphy_jumbo_settings(sc, ifp->if_mtu); - if (bge_sc->bge_flags & BGE_FLAG_WIRESPEED) + if (bge_sc->bge_phy_flags & BGE_PHY_WIRESPEED) brgphy_ethernet_wirespeed(sc); /* Enable Link LED on Dell boxes */ - if (bge_sc->bge_flags & BGE_FLAG_NO_3LED) { + if (bge_sc->bge_phy_flags & BGE_PHY_NO_3LED) { PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL, PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL) & ~BRGPHY_PHY_EXTCTL_3_LED); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:35:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9B0C106566B; Tue, 2 Nov 2010 23:35:08 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D62CE8FC14; Tue, 2 Nov 2010 23:35:08 +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 oA2NZ8Qd098377; Tue, 2 Nov 2010 23:35:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NZ84K098374; Tue, 2 Nov 2010 23:35:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022335.oA2NZ84K098374@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:35:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214704 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:35:09 -0000 Author: yongari Date: Tue Nov 2 23:35:08 2010 New Revision: 214704 URL: http://svn.freebsd.org/changeset/base/214704 Log: MFC r213485,213710,213812: r213485: Overhaul MII register access routine and remove unnecessary BGE_MI_MODE register accesses. Previously bge(4) used to read BGE_MI_MODE register to detect whether it needs to disable autopolling feature or not. Because we don't touch autopolling in other part of driver there is no reason to read BGE_MI_MODE register given that we know default value in advance. In order to achieve the goal, check whether the controller has CPMU(Central Power Mangement Unit) capability. If controller has CPMU feature, use 500KHz MII management interface(mdio/mdc) frequency regardless core clock frequency. Otherwise use default MII clock. While I'm here, add CPMU register definition. In bge_miibus_readreg(), rearrange code a bit and remove goto statement. In bge_miibus_writereg(), make sure to restore autopolling even if MII write failed. The delay time inserted after accessing BGE_MI_MODE register increased from 40us to 80us. The default PHY address is now stored in softc. All PHYs supported by bge(4) currently uses PHY address 1 but it will be changed when we add newer controllers. This change will make it easier to change default PHY address depending on PHY models. Submitted by: davidch r213710: Remove one last reference of BGE_MI_MODE register for auto polling. Previously bge(4) always enabled auto polling for non-BGE_FLAG_TBI controllers. With this change, auto polling is not used anymore so polling through mii(4) was introduced. Reviewed by: davidch r213812: Fix a regression introduced in r213710. r213710 removed the use of auto polling such that it made all controllers obtain link status information from the state of the LNKRDY input signal. Broadcom recommends disabling auto polling such that driver should rely on PHY interrupts for link status change indications. Unfortunately it seems some controllers(BCM5703, BCM5704 and BCM5705) have PHY related issues so Linux took other approach to workaround it. bge(4) didn't follow that and it used to enable auto polling to workaround it. Restore this old behavior for BCM5700 family controllers and BCM5705 to use auto polling. For BCM5700 and BCM5701, it seems it does not need to enable auto polling but I restored it for safety. Special thanks to marius who tried lots of patches with patience. Reported by: marius Tested by: marius Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:26:07 2010 (r214703) +++ stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:35:08 2010 (r214704) @@ -768,38 +768,34 @@ static int bge_miibus_readreg(device_t dev, int phy, int reg) { struct bge_softc *sc; - uint32_t val, autopoll; + uint32_t val; int i; sc = device_get_softc(dev); - /* - * Broadcom's own driver always assumes the internal - * PHY is at GMII address 1. On some chips, the PHY responds - * to accesses at all addresses, which could cause us to - * bogusly attach the PHY 32 times at probe type. Always - * restricting the lookup to address 1 is simpler than - * trying to figure out which chips revisions should be - * special-cased. - */ - if (phy != 1) + /* Prevent the probe from finding incorrect devices. */ + if (phy != sc->bge_phy_addr) return (0); - /* Reading with autopolling on may trigger PCI errors */ - autopoll = CSR_READ_4(sc, BGE_MI_MODE); - if (autopoll & BGE_MIMODE_AUTOPOLL) { - BGE_CLRBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); - DELAY(40); + /* Clear the autopoll bit if set, otherwise may trigger PCI errors. */ + if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { + CSR_WRITE_4(sc, BGE_MI_MODE, + sc->bge_mi_mode & ~BGE_MIMODE_AUTOPOLL); + DELAY(80); } CSR_WRITE_4(sc, BGE_MI_COMM, BGE_MICMD_READ | BGE_MICOMM_BUSY | BGE_MIPHY(phy) | BGE_MIREG(reg)); + /* Poll for the PHY register access to complete. */ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); val = CSR_READ_4(sc, BGE_MI_COMM); - if (!(val & BGE_MICOMM_BUSY)) + if ((val & BGE_MICOMM_BUSY) == 0) { + DELAY(5); + val = CSR_READ_4(sc, BGE_MI_COMM); break; + } } if (i == BGE_TIMEOUT) { @@ -807,16 +803,12 @@ bge_miibus_readreg(device_t dev, int phy "PHY read timed out (phy %d, reg %d, val 0x%08x)\n", phy, reg, val); val = 0; - goto done; } - DELAY(5); - val = CSR_READ_4(sc, BGE_MI_COMM); - -done: - if (autopoll & BGE_MIMODE_AUTOPOLL) { - BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); - DELAY(40); + /* Restore the autopoll bit if necessary. */ + if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { + CSR_WRITE_4(sc, BGE_MI_MODE, sc->bge_mi_mode); + DELAY(80); } if (val & BGE_MICOMM_READFAIL) @@ -829,7 +821,6 @@ static int bge_miibus_writereg(device_t dev, int phy, int reg, int val) { struct bge_softc *sc; - uint32_t autopoll; int i; sc = device_get_softc(dev); @@ -838,11 +829,11 @@ bge_miibus_writereg(device_t dev, int ph (reg == BRGPHY_MII_1000CTL || reg == BRGPHY_MII_AUXCTL)) return (0); - /* Reading with autopolling on may trigger PCI errors */ - autopoll = CSR_READ_4(sc, BGE_MI_MODE); - if (autopoll & BGE_MIMODE_AUTOPOLL) { - BGE_CLRBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); - DELAY(40); + /* Clear the autopoll bit if set, otherwise may trigger PCI errors. */ + if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { + CSR_WRITE_4(sc, BGE_MI_MODE, + sc->bge_mi_mode & ~BGE_MIMODE_AUTOPOLL); + DELAY(80); } CSR_WRITE_4(sc, BGE_MI_COMM, BGE_MICMD_WRITE | BGE_MICOMM_BUSY | @@ -857,17 +848,16 @@ bge_miibus_writereg(device_t dev, int ph } } - if (i == BGE_TIMEOUT) { + /* Restore the autopoll bit if necessary. */ + if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { + CSR_WRITE_4(sc, BGE_MI_MODE, sc->bge_mi_mode); + DELAY(80); + } + + if (i == BGE_TIMEOUT) device_printf(sc->bge_dev, "PHY write timed out (phy %d, reg %d, val %d)\n", phy, reg, val); - return (0); - } - - if (autopoll & BGE_MIMODE_AUTOPOLL) { - BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); - DELAY(40); - } return (0); } @@ -1918,11 +1908,17 @@ bge_blockinit(struct bge_softc *sc) BGE_MACSTAT_LINK_CHANGED); CSR_WRITE_4(sc, BGE_MI_STS, 0); - /* Enable PHY auto polling (for MII/GMII only) */ + /* + * Enable attention when the link has changed state for + * devices that use auto polling. + */ if (sc->bge_flags & BGE_FLAG_TBI) { CSR_WRITE_4(sc, BGE_MI_STS, BGE_MISTS_LINK); } else { - BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL | (10 << 16)); + if (sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) { + CSR_WRITE_4(sc, BGE_MI_MODE, sc->bge_mi_mode); + DELAY(80); + } if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && sc->bge_chipid != BGE_CHIPID_BCM5700_B2) CSR_WRITE_4(sc, BGE_MAC_EVT_ENB, @@ -2502,6 +2498,9 @@ bge_attach(device_t dev) sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); + /* Set default PHY address. */ + sc->bge_phy_addr = 1; + /* * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the * 5705 A0 and A1 chips. @@ -2575,6 +2574,20 @@ bge_attach(device_t dev) sc->bge_phy_flags |= BGE_PHY_BER_BUG; } + /* Identify the chips that use an CPMU. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || + sc->bge_asicrev == BGE_ASICREV_BCM5761 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || + sc->bge_asicrev == BGE_ASICREV_BCM57780) + sc->bge_flags |= BGE_FLAG_CPMU_PRESENT; + if ((sc->bge_flags & BGE_FLAG_CPMU_PRESENT) != 0) + sc->bge_mi_mode = BGE_MIMODE_500KHZ_CONST; + else + sc->bge_mi_mode = BGE_MIMODE_BASE; + /* Enable auto polling for BCM570[0-5]. */ + if (BGE_IS_5700_FAMILY(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5705) + sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL; + /* * All controllers that are not 5755 or higher have 4GB * boundary DMA bug. @@ -4948,7 +4961,7 @@ bge_link_upd(struct bge_softc *sc) if_printf(sc->bge_ifp, "link DOWN\n"); if_link_state_change(sc->bge_ifp, LINK_STATE_DOWN); } - } else if (CSR_READ_4(sc, BGE_MI_MODE) & BGE_MIMODE_AUTOPOLL) { + } else if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { /* * Some broken BCM chips have BGE_STATFLAG_LINKSTATE_CHANGED bit * in status word always set. Workaround this bug by reading @@ -4976,9 +4989,17 @@ bge_link_upd(struct bge_softc *sc) } } else { /* - * Discard link events for MII/GMII controllers - * if MI auto-polling is disabled. + * For controllers that call mii_tick, we have to poll + * link status. */ + mii = device_get_softc(sc->bge_miibus); + mii_pollstat(mii); + if (!sc->bge_link && mii->mii_media_status & IFM_ACTIVE && + IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + bge_miibus_statchg(sc->bge_dev); + sc->bge_link = 1; + } else + sc->bge_link = 0; } /* Clear the attention. */ Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 23:26:07 2010 (r214703) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 23:35:08 2010 (r214704) @@ -863,9 +863,12 @@ #define BGE_MISTS_LINK 0x00000001 #define BGE_MISTS_10MBPS 0x00000002 +#define BGE_MIMODE_CLK_10MHZ 0x00000001 #define BGE_MIMODE_SHORTPREAMBLE 0x00000002 #define BGE_MIMODE_AUTOPOLL 0x00000010 #define BGE_MIMODE_CLKCNT 0x001F0000 +#define BGE_MIMODE_500KHZ_CONST 0x00008000 +#define BGE_MIMODE_BASE 0x000C0000 /* @@ -1221,6 +1224,51 @@ /* Receive List Selector Status register */ #define BGE_RXLSSTAT_ERROR 0x00000004 +#define BGE_CPMU_CTRL 0x3600 +#define BGE_CPMU_LSPD_10MB_CLK 0x3604 +#define BGE_CPMU_LSPD_1000MB_CLK 0x360C +#define BGE_CPMU_LNK_AWARE_PWRMD 0x3610 +#define BGE_CPMU_HST_ACC 0x361C +#define BGE_CPMU_CLCK_STAT 0x3630 +#define BGE_CPMU_MUTEX_REQ 0x365C +#define BGE_CPMU_MUTEX_GNT 0x3660 +#define BGE_CPMU_PHY_STRAP 0x3664 + +/* Central Power Management Unit (CPMU) register */ +#define BGE_CPMU_CTRL_LINK_IDLE_MODE 0x00000200 +#define BGE_CPMU_CTRL_LINK_AWARE_MODE 0x00000400 +#define BGE_CPMU_CTRL_LINK_SPEED_MODE 0x00004000 +#define BGE_CPMU_CTRL_GPHY_10MB_RXONLY 0x00010000 + +/* Link Speed 10MB/No Link Power Mode Clock Policy register */ +#define BGE_CPMU_LSPD_10MB_MACCLK_MASK 0x001F0000 +#define BGE_CPMU_LSPD_10MB_MACCLK_6_25 0x00130000 + +/* Link Speed 1000MB Power Mode Clock Policy register */ +#define BGE_CPMU_LSPD_1000MB_MACCLK_62_5 0x00000000 +#define BGE_CPMU_LSPD_1000MB_MACCLK_12_5 0x00110000 +#define BGE_CPMU_LSPD_1000MB_MACCLK_MASK 0x001F0000 + +/* Link Aware Power Mode Clock Policy register */ +#define BGE_CPMU_LNK_AWARE_MACCLK_MASK 0x001F0000 +#define BGE_CPMU_LNK_AWARE_MACCLK_6_25 0x00130000 + +#define BGE_CPMU_HST_ACC_MACCLK_MASK 0x001F0000 +#define BGE_CPMU_HST_ACC_MACCLK_6_25 0x00130000 + +/* CPMU Clock Status register */ +#define BGE_CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001F0000 +#define BGE_CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 +#define BGE_CPMU_CLCK_STAT_MAC_CLCK_12_5 0x00110000 +#define BGE_CPMU_CLCK_STAT_MAC_CLCK_6_25 0x00130000 + +/* CPMU Mutex Request register */ +#define BGE_CPMU_MUTEX_REQ_DRIVER 0x00001000 +#define BGE_CPMU_MUTEX_GNT_DRIVER 0x00001000 + +/* CPMU GPHY Strap register */ +#define BGE_CPMU_PHY_STRAP_IS_SERDES 0x00000020 + /* * Mbuf Cluster Free registers (has nothing to do with BSD mbufs) */ @@ -2665,6 +2713,7 @@ struct bge_softc { #define BGE_FLAG_JUMBO 0x00000002 #define BGE_FLAG_EADDR 0x00000008 #define BGE_FLAG_MII_SERDES 0x00000010 +#define BGE_FLAG_CPMU_PRESENT 0x00000020 #define BGE_FLAG_MSI 0x00000100 #define BGE_FLAG_PCIX 0x00000200 #define BGE_FLAG_PCIE 0x00000400 @@ -2707,7 +2756,9 @@ struct bge_softc { uint32_t bge_rx_max_coal_bds; uint32_t bge_tx_max_coal_bds; uint32_t bge_tx_buf_ratio; + uint32_t bge_mi_mode; int bge_if_flags; + int bge_phy_addr; int bge_txcnt; int bge_link; /* link state */ int bge_link_evt; /* pending link event */ From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:36:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F70D106564A; Tue, 2 Nov 2010 23:36:55 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFECA8FC08; Tue, 2 Nov 2010 23:36: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 oA2NastN098490; Tue, 2 Nov 2010 23:36:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NasLX098487; Tue, 2 Nov 2010 23:36:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022336.oA2NasLX098487@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214705 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:36:55 -0000 Author: yongari Date: Tue Nov 2 23:36:54 2010 New Revision: 214705 URL: http://svn.freebsd.org/changeset/base/214705 Log: MFC r213485,213710,213812: r213485: Overhaul MII register access routine and remove unnecessary BGE_MI_MODE register accesses. Previously bge(4) used to read BGE_MI_MODE register to detect whether it needs to disable autopolling feature or not. Because we don't touch autopolling in other part of driver there is no reason to read BGE_MI_MODE register given that we know default value in advance. In order to achieve the goal, check whether the controller has CPMU(Central Power Mangement Unit) capability. If controller has CPMU feature, use 500KHz MII management interface(mdio/mdc) frequency regardless core clock frequency. Otherwise use default MII clock. While I'm here, add CPMU register definition. In bge_miibus_readreg(), rearrange code a bit and remove goto statement. In bge_miibus_writereg(), make sure to restore autopolling even if MII write failed. The delay time inserted after accessing BGE_MI_MODE register increased from 40us to 80us. The default PHY address is now stored in softc. All PHYs supported by bge(4) currently uses PHY address 1 but it will be changed when we add newer controllers. This change will make it easier to change default PHY address depending on PHY models. Submitted by: davidch r213710: Remove one last reference of BGE_MI_MODE register for auto polling. Previously bge(4) always enabled auto polling for non-BGE_FLAG_TBI controllers. With this change, auto polling is not used anymore so polling through mii(4) was introduced. Reviewed by: davidch r213812: Fix a regression introduced in r213710. r213710 removed the use of auto polling such that it made all controllers obtain link status information from the state of the LNKRDY input signal. Broadcom recommends disabling auto polling such that driver should rely on PHY interrupts for link status change indications. Unfortunately it seems some controllers(BCM5703, BCM5704 and BCM5705) have PHY related issues so Linux took other approach to workaround it. bge(4) didn't follow that and it used to enable auto polling to workaround it. Restore this old behavior for BCM5700 family controllers and BCM5705 to use auto polling. For BCM5700 and BCM5701, it seems it does not need to enable auto polling but I restored it for safety. Special thanks to marius who tried lots of patches with patience. Reported by: marius Tested by: marius Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:35:08 2010 (r214704) +++ stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:36:54 2010 (r214705) @@ -768,38 +768,34 @@ static int bge_miibus_readreg(device_t dev, int phy, int reg) { struct bge_softc *sc; - uint32_t val, autopoll; + uint32_t val; int i; sc = device_get_softc(dev); - /* - * Broadcom's own driver always assumes the internal - * PHY is at GMII address 1. On some chips, the PHY responds - * to accesses at all addresses, which could cause us to - * bogusly attach the PHY 32 times at probe type. Always - * restricting the lookup to address 1 is simpler than - * trying to figure out which chips revisions should be - * special-cased. - */ - if (phy != 1) + /* Prevent the probe from finding incorrect devices. */ + if (phy != sc->bge_phy_addr) return (0); - /* Reading with autopolling on may trigger PCI errors */ - autopoll = CSR_READ_4(sc, BGE_MI_MODE); - if (autopoll & BGE_MIMODE_AUTOPOLL) { - BGE_CLRBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); - DELAY(40); + /* Clear the autopoll bit if set, otherwise may trigger PCI errors. */ + if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { + CSR_WRITE_4(sc, BGE_MI_MODE, + sc->bge_mi_mode & ~BGE_MIMODE_AUTOPOLL); + DELAY(80); } CSR_WRITE_4(sc, BGE_MI_COMM, BGE_MICMD_READ | BGE_MICOMM_BUSY | BGE_MIPHY(phy) | BGE_MIREG(reg)); + /* Poll for the PHY register access to complete. */ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); val = CSR_READ_4(sc, BGE_MI_COMM); - if (!(val & BGE_MICOMM_BUSY)) + if ((val & BGE_MICOMM_BUSY) == 0) { + DELAY(5); + val = CSR_READ_4(sc, BGE_MI_COMM); break; + } } if (i == BGE_TIMEOUT) { @@ -807,16 +803,12 @@ bge_miibus_readreg(device_t dev, int phy "PHY read timed out (phy %d, reg %d, val 0x%08x)\n", phy, reg, val); val = 0; - goto done; } - DELAY(5); - val = CSR_READ_4(sc, BGE_MI_COMM); - -done: - if (autopoll & BGE_MIMODE_AUTOPOLL) { - BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); - DELAY(40); + /* Restore the autopoll bit if necessary. */ + if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { + CSR_WRITE_4(sc, BGE_MI_MODE, sc->bge_mi_mode); + DELAY(80); } if (val & BGE_MICOMM_READFAIL) @@ -829,7 +821,6 @@ static int bge_miibus_writereg(device_t dev, int phy, int reg, int val) { struct bge_softc *sc; - uint32_t autopoll; int i; sc = device_get_softc(dev); @@ -838,11 +829,11 @@ bge_miibus_writereg(device_t dev, int ph (reg == BRGPHY_MII_1000CTL || reg == BRGPHY_MII_AUXCTL)) return (0); - /* Reading with autopolling on may trigger PCI errors */ - autopoll = CSR_READ_4(sc, BGE_MI_MODE); - if (autopoll & BGE_MIMODE_AUTOPOLL) { - BGE_CLRBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); - DELAY(40); + /* Clear the autopoll bit if set, otherwise may trigger PCI errors. */ + if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { + CSR_WRITE_4(sc, BGE_MI_MODE, + sc->bge_mi_mode & ~BGE_MIMODE_AUTOPOLL); + DELAY(80); } CSR_WRITE_4(sc, BGE_MI_COMM, BGE_MICMD_WRITE | BGE_MICOMM_BUSY | @@ -857,17 +848,16 @@ bge_miibus_writereg(device_t dev, int ph } } - if (i == BGE_TIMEOUT) { + /* Restore the autopoll bit if necessary. */ + if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { + CSR_WRITE_4(sc, BGE_MI_MODE, sc->bge_mi_mode); + DELAY(80); + } + + if (i == BGE_TIMEOUT) device_printf(sc->bge_dev, "PHY write timed out (phy %d, reg %d, val %d)\n", phy, reg, val); - return (0); - } - - if (autopoll & BGE_MIMODE_AUTOPOLL) { - BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); - DELAY(40); - } return (0); } @@ -1918,11 +1908,17 @@ bge_blockinit(struct bge_softc *sc) BGE_MACSTAT_LINK_CHANGED); CSR_WRITE_4(sc, BGE_MI_STS, 0); - /* Enable PHY auto polling (for MII/GMII only) */ + /* + * Enable attention when the link has changed state for + * devices that use auto polling. + */ if (sc->bge_flags & BGE_FLAG_TBI) { CSR_WRITE_4(sc, BGE_MI_STS, BGE_MISTS_LINK); } else { - BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL | (10 << 16)); + if (sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) { + CSR_WRITE_4(sc, BGE_MI_MODE, sc->bge_mi_mode); + DELAY(80); + } if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && sc->bge_chipid != BGE_CHIPID_BCM5700_B2) CSR_WRITE_4(sc, BGE_MAC_EVT_ENB, @@ -2502,6 +2498,9 @@ bge_attach(device_t dev) sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); + /* Set default PHY address. */ + sc->bge_phy_addr = 1; + /* * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the * 5705 A0 and A1 chips. @@ -2575,6 +2574,20 @@ bge_attach(device_t dev) sc->bge_phy_flags |= BGE_PHY_BER_BUG; } + /* Identify the chips that use an CPMU. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || + sc->bge_asicrev == BGE_ASICREV_BCM5761 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || + sc->bge_asicrev == BGE_ASICREV_BCM57780) + sc->bge_flags |= BGE_FLAG_CPMU_PRESENT; + if ((sc->bge_flags & BGE_FLAG_CPMU_PRESENT) != 0) + sc->bge_mi_mode = BGE_MIMODE_500KHZ_CONST; + else + sc->bge_mi_mode = BGE_MIMODE_BASE; + /* Enable auto polling for BCM570[0-5]. */ + if (BGE_IS_5700_FAMILY(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5705) + sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL; + /* * All controllers that are not 5755 or higher have 4GB * boundary DMA bug. @@ -4944,7 +4957,7 @@ bge_link_upd(struct bge_softc *sc) if_printf(sc->bge_ifp, "link DOWN\n"); if_link_state_change(sc->bge_ifp, LINK_STATE_DOWN); } - } else if (CSR_READ_4(sc, BGE_MI_MODE) & BGE_MIMODE_AUTOPOLL) { + } else if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { /* * Some broken BCM chips have BGE_STATFLAG_LINKSTATE_CHANGED bit * in status word always set. Workaround this bug by reading @@ -4972,9 +4985,17 @@ bge_link_upd(struct bge_softc *sc) } } else { /* - * Discard link events for MII/GMII controllers - * if MI auto-polling is disabled. + * For controllers that call mii_tick, we have to poll + * link status. */ + mii = device_get_softc(sc->bge_miibus); + mii_pollstat(mii); + if (!sc->bge_link && mii->mii_media_status & IFM_ACTIVE && + IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + bge_miibus_statchg(sc->bge_dev); + sc->bge_link = 1; + } else + sc->bge_link = 0; } /* Clear the attention. */ Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 23:35:08 2010 (r214704) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 23:36:54 2010 (r214705) @@ -863,9 +863,12 @@ #define BGE_MISTS_LINK 0x00000001 #define BGE_MISTS_10MBPS 0x00000002 +#define BGE_MIMODE_CLK_10MHZ 0x00000001 #define BGE_MIMODE_SHORTPREAMBLE 0x00000002 #define BGE_MIMODE_AUTOPOLL 0x00000010 #define BGE_MIMODE_CLKCNT 0x001F0000 +#define BGE_MIMODE_500KHZ_CONST 0x00008000 +#define BGE_MIMODE_BASE 0x000C0000 /* @@ -1221,6 +1224,51 @@ /* Receive List Selector Status register */ #define BGE_RXLSSTAT_ERROR 0x00000004 +#define BGE_CPMU_CTRL 0x3600 +#define BGE_CPMU_LSPD_10MB_CLK 0x3604 +#define BGE_CPMU_LSPD_1000MB_CLK 0x360C +#define BGE_CPMU_LNK_AWARE_PWRMD 0x3610 +#define BGE_CPMU_HST_ACC 0x361C +#define BGE_CPMU_CLCK_STAT 0x3630 +#define BGE_CPMU_MUTEX_REQ 0x365C +#define BGE_CPMU_MUTEX_GNT 0x3660 +#define BGE_CPMU_PHY_STRAP 0x3664 + +/* Central Power Management Unit (CPMU) register */ +#define BGE_CPMU_CTRL_LINK_IDLE_MODE 0x00000200 +#define BGE_CPMU_CTRL_LINK_AWARE_MODE 0x00000400 +#define BGE_CPMU_CTRL_LINK_SPEED_MODE 0x00004000 +#define BGE_CPMU_CTRL_GPHY_10MB_RXONLY 0x00010000 + +/* Link Speed 10MB/No Link Power Mode Clock Policy register */ +#define BGE_CPMU_LSPD_10MB_MACCLK_MASK 0x001F0000 +#define BGE_CPMU_LSPD_10MB_MACCLK_6_25 0x00130000 + +/* Link Speed 1000MB Power Mode Clock Policy register */ +#define BGE_CPMU_LSPD_1000MB_MACCLK_62_5 0x00000000 +#define BGE_CPMU_LSPD_1000MB_MACCLK_12_5 0x00110000 +#define BGE_CPMU_LSPD_1000MB_MACCLK_MASK 0x001F0000 + +/* Link Aware Power Mode Clock Policy register */ +#define BGE_CPMU_LNK_AWARE_MACCLK_MASK 0x001F0000 +#define BGE_CPMU_LNK_AWARE_MACCLK_6_25 0x00130000 + +#define BGE_CPMU_HST_ACC_MACCLK_MASK 0x001F0000 +#define BGE_CPMU_HST_ACC_MACCLK_6_25 0x00130000 + +/* CPMU Clock Status register */ +#define BGE_CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001F0000 +#define BGE_CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 +#define BGE_CPMU_CLCK_STAT_MAC_CLCK_12_5 0x00110000 +#define BGE_CPMU_CLCK_STAT_MAC_CLCK_6_25 0x00130000 + +/* CPMU Mutex Request register */ +#define BGE_CPMU_MUTEX_REQ_DRIVER 0x00001000 +#define BGE_CPMU_MUTEX_GNT_DRIVER 0x00001000 + +/* CPMU GPHY Strap register */ +#define BGE_CPMU_PHY_STRAP_IS_SERDES 0x00000020 + /* * Mbuf Cluster Free registers (has nothing to do with BSD mbufs) */ @@ -2665,6 +2713,7 @@ struct bge_softc { #define BGE_FLAG_JUMBO 0x00000002 #define BGE_FLAG_EADDR 0x00000008 #define BGE_FLAG_MII_SERDES 0x00000010 +#define BGE_FLAG_CPMU_PRESENT 0x00000020 #define BGE_FLAG_MSI 0x00000100 #define BGE_FLAG_PCIX 0x00000200 #define BGE_FLAG_PCIE 0x00000400 @@ -2707,7 +2756,9 @@ struct bge_softc { uint32_t bge_rx_max_coal_bds; uint32_t bge_tx_max_coal_bds; uint32_t bge_tx_buf_ratio; + uint32_t bge_mi_mode; int bge_if_flags; + int bge_phy_addr; int bge_txcnt; int bge_link; /* link state */ int bge_link_evt; /* pending link event */ From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:41:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A51751065695; Tue, 2 Nov 2010 23:41: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 914438FC17; Tue, 2 Nov 2010 23:41: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 oA2NfhaD098656; Tue, 2 Nov 2010 23:41:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NfhCI098654; Tue, 2 Nov 2010 23:41:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022341.oA2NfhCI098654@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214706 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:41:43 -0000 Author: yongari Date: Tue Nov 2 23:41:43 2010 New Revision: 214706 URL: http://svn.freebsd.org/changeset/base/214706 Log: MFC r213495,213742: r213495: Add more comments to rings supported by the controller. Different versions of controller support different number of ring control blocks such that adjust code a bit to access known number of send/receive ring control blocks. Previously bge(4) blindly accessed 16 send/receive RCBs. Also move initializing standard receive producer ring producer index, jumbo receive producer ring producer index and mini receive producer ring producer index to the end of each receive producer ring initialization. Do not assume mini receive producer ring is available only when controller has jumbo frame capability, instead explicitly check ASIC version BCM5700 to disable mini receive producer ring. Additionally always enable send ring 0 regardless of controller versions. Previously bge(4) didn't enable send ring 0 if controller is BGE_IS_5705_PLUS. Becase bge(4) need 1 send ring to send frames at least, I have no idea how it would have worked so far. Submitted by: davidch r213742: Fix a regression introduced in r213495. r213495 disabled mini receive producer ring only for BCM5700. It was believed that BCM5700 with external SSRAM is the only controller that supports mini ring but it seems all BCM570[0-4] requires to disable mini receive producer ring. Otherwise, it caused unexpected RX DMA error or watchdog timeouts. Reported by: marius, Steve Kargl troutmask dot apl dot washington dot edu> Tested by: marius, Steve Kargl troutmask dot apl dot washington dot edu> Modified: stable/8/sys/dev/bge/if_bge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:36:54 2010 (r214705) +++ stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:41:43 2010 (r214706) @@ -1092,9 +1092,10 @@ bge_init_rx_ring_jumbo(struct bge_softc sc->bge_jumbo = 0; + /* Enable the jumbo receive producer ring. */ rcb = &sc->bge_ldata.bge_info.bge_jumbo_rx_rcb; - rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, - BGE_RCB_FLAG_USE_EXT_RX_BD); + rcb->bge_maxlen_flags = + BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, BGE_JUMBO_RX_RING_CNT - 1); @@ -1473,7 +1474,7 @@ bge_blockinit(struct bge_softc *sc) bus_size_t vrcb; bge_hostaddr taddr; uint32_t val; - int i; + int i, limit; /* * Initialize the memory window pointer register so that @@ -1553,7 +1554,38 @@ bge_blockinit(struct bge_softc *sc) return (ENXIO); } - /* Initialize the standard RX ring control block */ + /* + * Summary of rings supported by the controller: + * + * Standard Receive Producer Ring + * - This ring is used to feed receive buffers for "standard" + * sized frames (typically 1536 bytes) to the controller. + * + * Jumbo Receive Producer Ring + * - This ring is used to feed receive buffers for jumbo sized + * frames (i.e. anything bigger than the "standard" frames) + * to the controller. + * + * Mini Receive Producer Ring + * - This ring is used to feed receive buffers for "mini" + * sized frames to the controller. + * - This feature required external memory for the controller + * but was never used in a production system. Should always + * be disabled. + * + * Receive Return Ring + * - After the controller has placed an incoming frame into a + * receive buffer that buffer is moved into a receive return + * ring. The driver is then responsible to passing the + * buffer up to the stack. Many versions of the controller + * support multiple RR rings. + * + * Send Ring + * - This ring is used for outgoing frames. Many versions of + * the controller support multiple send rings. + */ + + /* Initialize the standard receive producer ring control block. */ rcb = &sc->bge_ldata.bge_info.bge_std_rx_rcb; rcb->bge_hostaddr.bge_addr_lo = BGE_ADDR_LO(sc->bge_ldata.bge_rx_std_ring_paddr); @@ -1561,28 +1593,45 @@ bge_blockinit(struct bge_softc *sc) BGE_ADDR_HI(sc->bge_ldata.bge_rx_std_ring_paddr); bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREREAD); - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5705_PLUS(sc)) { + /* + * Bits 31-16: Programmable ring size (512, 256, 128, 64, 32) + * Bits 15-2 : Reserved (should be 0) + * Bit 1 : 1 = Ring Disabled, 0 = Ring Enabled + * Bit 0 : Reserved + */ rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(512, 0); - else + } else { + /* + * Ring size is always XXX entries + * Bits 31-16: Maximum RX frame size + * Bits 15-2 : Reserved (should be 0) + * Bit 1 : 1 = Ring Disabled, 0 = Ring Enabled + * Bit 0 : Reserved + */ rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); + } rcb->bge_nicaddr = BGE_STD_RX_RINGS; + /* Write the standard receive producer ring control block. */ CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_LO, rcb->bge_hostaddr.bge_addr_lo); - CSR_WRITE_4(sc, BGE_RX_STD_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); CSR_WRITE_4(sc, BGE_RX_STD_RCB_NICADDR, rcb->bge_nicaddr); + /* Reset the standard receive producer ring producer index. */ + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, 0); + /* - * Initialize the jumbo RX ring control block - * We set the 'ring disabled' bit in the flags - * field until we're actually ready to start + * Initialize the jumbo RX producer ring control + * block. We set the 'ring disabled' bit in the + * flags field until we're actually ready to start * using this ring (i.e. once we set the MTU * high enough to require it). */ if (BGE_IS_JUMBO_CAPABLE(sc)) { rcb = &sc->bge_ldata.bge_info.bge_jumbo_rx_rcb; - + /* Get the jumbo receive producer ring RCB parameters. */ rcb->bge_hostaddr.bge_addr_lo = BGE_ADDR_LO(sc->bge_ldata.bge_rx_jumbo_ring_paddr); rcb->bge_hostaddr.bge_addr_hi = @@ -1597,20 +1646,31 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_LO, rcb->bge_hostaddr.bge_addr_lo); - + /* Program the jumbo receive producer ring RCB parameters. */ CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_NICADDR, rcb->bge_nicaddr); + /* Reset the jumbo receive producer ring producer index. */ + bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0); + } - /* Set up dummy disabled mini ring RCB */ + /* Disable the mini receive producer ring RCB. */ + if (BGE_IS_5700_FAMILY(sc)) { rcb = &sc->bge_ldata.bge_info.bge_mini_rx_rcb; rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_RING_DISABLED); CSR_WRITE_4(sc, BGE_RX_MINI_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); + /* Reset the mini receive producer ring producer index. */ + bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); } /* + * The BD ring replenish thresholds control how often the + * hardware fetches new BD's from the producer rings in host + * memory. Setting the value too low on a busy system can + * starve the hardware and recue the throughpout. + * * Set the BD ring replentish thresholds. The recommended * values are 1/8th the number of descriptors allocated to * each ring. @@ -1632,61 +1692,67 @@ bge_blockinit(struct bge_softc *sc) BGE_JUMBO_RX_RING_CNT/8); /* - * Disable all unused send rings by setting the 'ring disabled' - * bit in the flags field of all the TX send ring control blocks. - * These are located in NIC memory. - */ + * Disable all send rings by setting the 'ring disabled' bit + * in the flags field of all the TX send ring control blocks, + * located in NIC memory. + */ + if (!BGE_IS_5705_PLUS(sc)) + /* 5700 to 5704 had 16 send rings. */ + limit = BGE_TX_RINGS_EXTSSRAM_MAX; + else + limit = 1; vrcb = BGE_MEMWIN_START + BGE_SEND_RING_RCB; - for (i = 0; i < BGE_TX_RINGS_EXTSSRAM_MAX; i++) { + for (i = 0; i < limit; i++) { RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_RING_DISABLED)); RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0); vrcb += sizeof(struct bge_rcb); } - /* Configure TX RCB 0 (we use only the first ring) */ + /* Configure send ring RCB 0 (we use only the first ring) */ vrcb = BGE_MEMWIN_START + BGE_SEND_RING_RCB; BGE_HOSTADDR(taddr, sc->bge_ldata.bge_tx_ring_paddr); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); - if (!(BGE_IS_5705_PLUS(sc))) - RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, - BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0)); + RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, + BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0)); - /* Disable all unused RX return rings */ + /* + * Disable all receive return rings by setting the + * 'ring diabled' bit in the flags field of all the receive + * return ring control blocks, located in NIC memory. + */ + if (!BGE_IS_5705_PLUS(sc)) + limit = BGE_RX_RINGS_MAX; + else if (sc->bge_asicrev == BGE_ASICREV_BCM5755) + limit = 4; + else + limit = 1; + /* Disable all receive return rings. */ vrcb = BGE_MEMWIN_START + BGE_RX_RETURN_RING_RCB; - for (i = 0; i < BGE_RX_RINGS_MAX; i++) { + for (i = 0; i < limit; i++) { RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, 0); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, 0); RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, - BGE_RCB_MAXLEN_FLAGS(sc->bge_return_ring_cnt, - BGE_RCB_FLAG_RING_DISABLED)); + BGE_RCB_FLAG_RING_DISABLED); RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0); bge_writembx(sc, BGE_MBX_RX_CONS0_LO + (i * (sizeof(uint64_t))), 0); vrcb += sizeof(struct bge_rcb); } - /* Initialize RX ring indexes */ - bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, 0); - if (BGE_IS_JUMBO_CAPABLE(sc)) - bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0); - if (sc->bge_asicrev == BGE_ASICREV_BCM5700) - bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); - /* - * Set up RX return ring 0 - * Note that the NIC address for RX return rings is 0x00000000. - * The return rings live entirely within the host, so the - * nicaddr field in the RCB isn't used. + * Set up receive return ring 0. Note that the NIC address + * for RX return rings is 0x0. The return rings live entirely + * within the host, so the nicaddr field in the RCB isn't used. */ vrcb = BGE_MEMWIN_START + BGE_RX_RETURN_RING_RCB; BGE_HOSTADDR(taddr, sc->bge_ldata.bge_rx_return_ring_paddr); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); - RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0x00000000); + RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0); RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, BGE_RCB_MAXLEN_FLAGS(sc->bge_return_ring_cnt, 0)); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:43:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B34FF1065697; Tue, 2 Nov 2010 23:43:27 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F9CC8FC08; Tue, 2 Nov 2010 23:43: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 oA2NhRdI098761; Tue, 2 Nov 2010 23:43:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NhRtJ098759; Tue, 2 Nov 2010 23:43:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022343.oA2NhRtJ098759@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:43:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214707 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:43:27 -0000 Author: yongari Date: Tue Nov 2 23:43:27 2010 New Revision: 214707 URL: http://svn.freebsd.org/changeset/base/214707 Log: MFC r213495,213742: r213495: Add more comments to rings supported by the controller. Different versions of controller support different number of ring control blocks such that adjust code a bit to access known number of send/receive ring control blocks. Previously bge(4) blindly accessed 16 send/receive RCBs. Also move initializing standard receive producer ring producer index, jumbo receive producer ring producer index and mini receive producer ring producer index to the end of each receive producer ring initialization. Do not assume mini receive producer ring is available only when controller has jumbo frame capability, instead explicitly check ASIC version BCM5700 to disable mini receive producer ring. Additionally always enable send ring 0 regardless of controller versions. Previously bge(4) didn't enable send ring 0 if controller is BGE_IS_5705_PLUS. Becase bge(4) need 1 send ring to send frames at least, I have no idea how it would have worked so far. Submitted by: davidch r213742: Fix a regression introduced in r213495. r213495 disabled mini receive producer ring only for BCM5700. It was believed that BCM5700 with external SSRAM is the only controller that supports mini ring but it seems all BCM570[0-4] requires to disable mini receive producer ring. Otherwise, it caused unexpected RX DMA error or watchdog timeouts. Reported by: marius, Steve Kargl troutmask dot apl dot washington dot edu> Tested by: marius, Steve Kargl troutmask dot apl dot washington dot edu> Modified: stable/7/sys/dev/bge/if_bge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:41:43 2010 (r214706) +++ stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:43:27 2010 (r214707) @@ -1092,9 +1092,10 @@ bge_init_rx_ring_jumbo(struct bge_softc sc->bge_jumbo = 0; + /* Enable the jumbo receive producer ring. */ rcb = &sc->bge_ldata.bge_info.bge_jumbo_rx_rcb; - rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, - BGE_RCB_FLAG_USE_EXT_RX_BD); + rcb->bge_maxlen_flags = + BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, BGE_JUMBO_RX_RING_CNT - 1); @@ -1473,7 +1474,7 @@ bge_blockinit(struct bge_softc *sc) bus_size_t vrcb; bge_hostaddr taddr; uint32_t val; - int i; + int i, limit; /* * Initialize the memory window pointer register so that @@ -1553,7 +1554,38 @@ bge_blockinit(struct bge_softc *sc) return (ENXIO); } - /* Initialize the standard RX ring control block */ + /* + * Summary of rings supported by the controller: + * + * Standard Receive Producer Ring + * - This ring is used to feed receive buffers for "standard" + * sized frames (typically 1536 bytes) to the controller. + * + * Jumbo Receive Producer Ring + * - This ring is used to feed receive buffers for jumbo sized + * frames (i.e. anything bigger than the "standard" frames) + * to the controller. + * + * Mini Receive Producer Ring + * - This ring is used to feed receive buffers for "mini" + * sized frames to the controller. + * - This feature required external memory for the controller + * but was never used in a production system. Should always + * be disabled. + * + * Receive Return Ring + * - After the controller has placed an incoming frame into a + * receive buffer that buffer is moved into a receive return + * ring. The driver is then responsible to passing the + * buffer up to the stack. Many versions of the controller + * support multiple RR rings. + * + * Send Ring + * - This ring is used for outgoing frames. Many versions of + * the controller support multiple send rings. + */ + + /* Initialize the standard receive producer ring control block. */ rcb = &sc->bge_ldata.bge_info.bge_std_rx_rcb; rcb->bge_hostaddr.bge_addr_lo = BGE_ADDR_LO(sc->bge_ldata.bge_rx_std_ring_paddr); @@ -1561,28 +1593,45 @@ bge_blockinit(struct bge_softc *sc) BGE_ADDR_HI(sc->bge_ldata.bge_rx_std_ring_paddr); bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREREAD); - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5705_PLUS(sc)) { + /* + * Bits 31-16: Programmable ring size (512, 256, 128, 64, 32) + * Bits 15-2 : Reserved (should be 0) + * Bit 1 : 1 = Ring Disabled, 0 = Ring Enabled + * Bit 0 : Reserved + */ rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(512, 0); - else + } else { + /* + * Ring size is always XXX entries + * Bits 31-16: Maximum RX frame size + * Bits 15-2 : Reserved (should be 0) + * Bit 1 : 1 = Ring Disabled, 0 = Ring Enabled + * Bit 0 : Reserved + */ rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); + } rcb->bge_nicaddr = BGE_STD_RX_RINGS; + /* Write the standard receive producer ring control block. */ CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_LO, rcb->bge_hostaddr.bge_addr_lo); - CSR_WRITE_4(sc, BGE_RX_STD_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); CSR_WRITE_4(sc, BGE_RX_STD_RCB_NICADDR, rcb->bge_nicaddr); + /* Reset the standard receive producer ring producer index. */ + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, 0); + /* - * Initialize the jumbo RX ring control block - * We set the 'ring disabled' bit in the flags - * field until we're actually ready to start + * Initialize the jumbo RX producer ring control + * block. We set the 'ring disabled' bit in the + * flags field until we're actually ready to start * using this ring (i.e. once we set the MTU * high enough to require it). */ if (BGE_IS_JUMBO_CAPABLE(sc)) { rcb = &sc->bge_ldata.bge_info.bge_jumbo_rx_rcb; - + /* Get the jumbo receive producer ring RCB parameters. */ rcb->bge_hostaddr.bge_addr_lo = BGE_ADDR_LO(sc->bge_ldata.bge_rx_jumbo_ring_paddr); rcb->bge_hostaddr.bge_addr_hi = @@ -1597,20 +1646,31 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_LO, rcb->bge_hostaddr.bge_addr_lo); - + /* Program the jumbo receive producer ring RCB parameters. */ CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_NICADDR, rcb->bge_nicaddr); + /* Reset the jumbo receive producer ring producer index. */ + bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0); + } - /* Set up dummy disabled mini ring RCB */ + /* Disable the mini receive producer ring RCB. */ + if (BGE_IS_5700_FAMILY(sc)) { rcb = &sc->bge_ldata.bge_info.bge_mini_rx_rcb; rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_RING_DISABLED); CSR_WRITE_4(sc, BGE_RX_MINI_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); + /* Reset the mini receive producer ring producer index. */ + bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); } /* + * The BD ring replenish thresholds control how often the + * hardware fetches new BD's from the producer rings in host + * memory. Setting the value too low on a busy system can + * starve the hardware and recue the throughpout. + * * Set the BD ring replentish thresholds. The recommended * values are 1/8th the number of descriptors allocated to * each ring. @@ -1632,61 +1692,67 @@ bge_blockinit(struct bge_softc *sc) BGE_JUMBO_RX_RING_CNT/8); /* - * Disable all unused send rings by setting the 'ring disabled' - * bit in the flags field of all the TX send ring control blocks. - * These are located in NIC memory. - */ + * Disable all send rings by setting the 'ring disabled' bit + * in the flags field of all the TX send ring control blocks, + * located in NIC memory. + */ + if (!BGE_IS_5705_PLUS(sc)) + /* 5700 to 5704 had 16 send rings. */ + limit = BGE_TX_RINGS_EXTSSRAM_MAX; + else + limit = 1; vrcb = BGE_MEMWIN_START + BGE_SEND_RING_RCB; - for (i = 0; i < BGE_TX_RINGS_EXTSSRAM_MAX; i++) { + for (i = 0; i < limit; i++) { RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_RING_DISABLED)); RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0); vrcb += sizeof(struct bge_rcb); } - /* Configure TX RCB 0 (we use only the first ring) */ + /* Configure send ring RCB 0 (we use only the first ring) */ vrcb = BGE_MEMWIN_START + BGE_SEND_RING_RCB; BGE_HOSTADDR(taddr, sc->bge_ldata.bge_tx_ring_paddr); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); - if (!(BGE_IS_5705_PLUS(sc))) - RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, - BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0)); + RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, + BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0)); - /* Disable all unused RX return rings */ + /* + * Disable all receive return rings by setting the + * 'ring diabled' bit in the flags field of all the receive + * return ring control blocks, located in NIC memory. + */ + if (!BGE_IS_5705_PLUS(sc)) + limit = BGE_RX_RINGS_MAX; + else if (sc->bge_asicrev == BGE_ASICREV_BCM5755) + limit = 4; + else + limit = 1; + /* Disable all receive return rings. */ vrcb = BGE_MEMWIN_START + BGE_RX_RETURN_RING_RCB; - for (i = 0; i < BGE_RX_RINGS_MAX; i++) { + for (i = 0; i < limit; i++) { RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, 0); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, 0); RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, - BGE_RCB_MAXLEN_FLAGS(sc->bge_return_ring_cnt, - BGE_RCB_FLAG_RING_DISABLED)); + BGE_RCB_FLAG_RING_DISABLED); RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0); bge_writembx(sc, BGE_MBX_RX_CONS0_LO + (i * (sizeof(uint64_t))), 0); vrcb += sizeof(struct bge_rcb); } - /* Initialize RX ring indexes */ - bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, 0); - if (BGE_IS_JUMBO_CAPABLE(sc)) - bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0); - if (sc->bge_asicrev == BGE_ASICREV_BCM5700) - bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); - /* - * Set up RX return ring 0 - * Note that the NIC address for RX return rings is 0x00000000. - * The return rings live entirely within the host, so the - * nicaddr field in the RCB isn't used. + * Set up receive return ring 0. Note that the NIC address + * for RX return rings is 0x0. The return rings live entirely + * within the host, so the nicaddr field in the RCB isn't used. */ vrcb = BGE_MEMWIN_START + BGE_RX_RETURN_RING_RCB; BGE_HOSTADDR(taddr, sc->bge_ldata.bge_rx_return_ring_paddr); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); - RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0x00000000); + RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0); RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, BGE_RCB_MAXLEN_FLAGS(sc->bge_return_ring_cnt, 0)); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:43:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3240C106566B; Tue, 2 Nov 2010 23:43:45 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20B828FC1D; Tue, 2 Nov 2010 23:43:45 +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 oA2NhjvQ098804; Tue, 2 Nov 2010 23:43:45 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2Nhji1098802; Tue, 2 Nov 2010 23:43:45 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201011022343.oA2Nhji1098802@svn.freebsd.org> From: Juli Mallett Date: Tue, 2 Nov 2010 23:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214708 - head/sys/mips/cavium X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:43:45 -0000 Author: jmallett Date: Tue Nov 2 23:43:44 2010 New Revision: 214708 URL: http://svn.freebsd.org/changeset/base/214708 Log: Declare the CF GEOM class so that g_modevent will get called, the class will be recorded, etc. This fixes libgeom on Octeon. Modified: head/sys/mips/cavium/octeon_ebt3000_cf.c Modified: head/sys/mips/cavium/octeon_ebt3000_cf.c ============================================================================== --- head/sys/mips/cavium/octeon_ebt3000_cf.c Tue Nov 2 23:43:27 2010 (r214707) +++ head/sys/mips/cavium/octeon_ebt3000_cf.c Tue Nov 2 23:43:44 2010 (r214708) @@ -148,6 +148,8 @@ struct g_class g_cf_class = { .ioctl = cf_ioctl, }; +DECLARE_GEOM_CLASS(g_cf_class, g_cf); + /* Device methods */ static int cf_probe(device_t); static void cf_identify(driver_t *, device_t); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:44:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CD131065674; Tue, 2 Nov 2010 23:44:30 +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 EE6978FC24; Tue, 2 Nov 2010 23:44:29 +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 oA2NiTJK098879; Tue, 2 Nov 2010 23:44:29 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NiTJY098876; Tue, 2 Nov 2010 23:44:29 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201011022344.oA2NiTJY098876@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 2 Nov 2010 23:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214709 - in head: bin/sh tools/regression/bin/sh/parser X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:44:30 -0000 Author: jilles Date: Tue Nov 2 23:44:29 2010 New Revision: 214709 URL: http://svn.freebsd.org/changeset/base/214709 Log: sh: Fix some issues with aliases and case, by importing dash checkkwd code. This moves the function of the noaliases variable into the checkkwd variable. This way it is properly reset on errors and aliases can be used normally in the commands for each case (the case labels recognize the keyword esac but no aliases). The new code is clearer as well. Obtained from: dash Added: head/tools/regression/bin/sh/parser/alias3.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Tue Nov 2 23:43:44 2010 (r214708) +++ head/bin/sh/parser.c Tue Nov 2 23:44:29 2010 (r214709) @@ -69,6 +69,11 @@ __FBSDID("$FreeBSD$"); #define EOFMARKLEN 79 #define PROMPTLEN 128 +/* values of checkkwd variable */ +#define CHKALIAS 0x1 +#define CHKKWD 0x2 +#define CHKNL 0x4 + /* values returned by readtoken */ #include "token.h" @@ -102,9 +107,6 @@ static int startlinno; /* line # where static int funclinno; /* line # where the current function started */ static struct parser_temp *parser_temp; -/* XXX When 'noaliases' is set to one, no alias expansion takes place. */ -static int noaliases = 0; - static union node *list(int, int); static union node *andor(void); @@ -230,7 +232,7 @@ list(int nlflag, int erflag) union node *ntop, *n1, *n2, *n3; int tok; - checkkwd = 2; + checkkwd = CHKNL | CHKKWD | CHKALIAS; if (!nlflag && !erflag && tokendlist[peektoken()]) return NULL; ntop = n1 = NULL; @@ -283,7 +285,7 @@ list(int nlflag, int erflag) } else { tokpushback++; } - checkkwd = 2; + checkkwd = CHKNL | CHKKWD | CHKALIAS; if (!nlflag && !erflag && tokendlist[peektoken()]) return ntop; break; @@ -339,7 +341,7 @@ pipeline(void) int negate, t; negate = 0; - checkkwd = 2; + checkkwd = CHKNL | CHKKWD | CHKALIAS; TRACE(("pipeline: entered\n")); while (readtoken() == TNOT) negate = !negate; @@ -355,7 +357,7 @@ pipeline(void) do { prev = lp; lp = (struct nodelist *)stalloc(sizeof (struct nodelist)); - checkkwd = 2; + checkkwd = CHKNL | CHKKWD | CHKALIAS; t = readtoken(); tokpushback++; if (t == TNOT) @@ -388,7 +390,7 @@ command(void) union node *redir, **rpp; int t; - checkkwd = 2; + checkkwd = CHKNL | CHKKWD | CHKALIAS; redir = NULL; n1 = NULL; rpp = &redir; @@ -429,7 +431,7 @@ command(void) } if (readtoken() != TFI) synexpect(TFI); - checkkwd = 1; + checkkwd = CHKKWD | CHKALIAS; break; case TWHILE: case TUNTIL: { @@ -445,7 +447,7 @@ TRACE(("expecting DO got %s %s\n", tokna n1->nbinary.ch2 = list(0, 0); if (readtoken() != TDONE) synexpect(TDONE); - checkkwd = 1; + checkkwd = CHKKWD | CHKALIAS; break; } case TFOR: @@ -487,7 +489,7 @@ TRACE(("expecting DO got %s %s\n", tokna if (lasttoken != TNL && lasttoken != TSEMI) tokpushback++; } - checkkwd = 2; + checkkwd = CHKNL | CHKKWD | CHKALIAS; if ((t = readtoken()) == TDO) t = TDONE; else if (t == TBEGIN) @@ -497,7 +499,7 @@ TRACE(("expecting DO got %s %s\n", tokna n1->nfor.body = list(0, 0); if (readtoken() != t) synexpect(t); - checkkwd = 1; + checkkwd = CHKKWD | CHKALIAS; break; case TCASE: n1 = (union node *)stalloc(sizeof (struct ncase)); @@ -513,8 +515,7 @@ TRACE(("expecting DO got %s %s\n", tokna if (lasttoken != TWORD || ! equal(wordtext, "in")) synerror("expecting \"in\""); cpp = &n1->ncase.cases; - noaliases = 1; /* turn off alias expansion */ - checkkwd = 2, readtoken(); + checkkwd = CHKNL | CHKKWD, readtoken(); while (lasttoken != TESAC) { *cpp = cp = (union node *)stalloc(sizeof (struct nclist)); cp->type = NCLIST; @@ -526,28 +527,28 @@ TRACE(("expecting DO got %s %s\n", tokna ap->type = NARG; ap->narg.text = wordtext; ap->narg.backquote = backquotelist; - if (checkkwd = 2, readtoken() != TPIPE) + checkkwd = CHKNL | CHKKWD; + if (readtoken() != TPIPE) break; app = &ap->narg.next; readtoken(); } ap->narg.next = NULL; if (lasttoken != TRP) - noaliases = 0, synexpect(TRP); + synexpect(TRP); cp->nclist.body = list(0, 0); - checkkwd = 2; + checkkwd = CHKNL | CHKKWD | CHKALIAS; if ((t = readtoken()) != TESAC) { if (t != TENDCASE) - noaliases = 0, synexpect(TENDCASE); + synexpect(TENDCASE); else - checkkwd = 2, readtoken(); + checkkwd = CHKNL | CHKKWD, readtoken(); } cpp = &cp->nclist.next; } - noaliases = 0; /* reset alias expansion */ *cpp = NULL; - checkkwd = 1; + checkkwd = CHKKWD | CHKALIAS; break; case TLP: n1 = (union node *)stalloc(sizeof (struct nredir)); @@ -556,13 +557,13 @@ TRACE(("expecting DO got %s %s\n", tokna n1->nredir.redirect = NULL; if (readtoken() != TRP) synexpect(TRP); - checkkwd = 1; + checkkwd = CHKKWD | CHKALIAS; break; case TBEGIN: n1 = list(0, 0); if (readtoken() != TEND) synexpect(TEND); - checkkwd = 1; + checkkwd = CHKKWD | CHKALIAS; break; /* Handle an empty command like other simple commands. */ case TBACKGND: @@ -796,7 +797,6 @@ static int readtoken(void) { int t; - int savecheckkwd = checkkwd; struct alias *ap; #ifdef DEBUG int alreadyseen = tokpushback; @@ -805,25 +805,24 @@ readtoken(void) top: t = xxreadtoken(); - if (checkkwd) { - /* - * eat newlines - */ - if (checkkwd == 2) { - checkkwd = 0; - while (t == TNL) { - parseheredoc(); - t = xxreadtoken(); - } - } else - checkkwd = 0; - /* - * check for keywords and aliases - */ - if (t == TWORD && !quoteflag) - { - const char * const *pp; + /* + * eat newlines + */ + if (checkkwd & CHKNL) { + while (t == TNL) { + parseheredoc(); + t = xxreadtoken(); + } + } + /* + * check for keywords and aliases + */ + if (t == TWORD && !quoteflag) + { + const char * const *pp; + + if (checkkwd & CHKKWD) for (pp = parsekwd; *pp; pp++) { if (**pp == *wordtext && equal(*pp, wordtext)) { @@ -832,16 +831,16 @@ readtoken(void) goto out; } } - if (noaliases == 0 && - (ap = lookupalias(wordtext, 1)) != NULL) { - pushstring(ap->val, strlen(ap->val), ap); - checkkwd = savecheckkwd; - goto top; - } + if (checkkwd & CHKALIAS && + (ap = lookupalias(wordtext, 1)) != NULL) { + pushstring(ap->val, strlen(ap->val), ap); + goto top; } -out: - checkkwd = (t == TNOT) ? savecheckkwd : 0; } +out: + if (t != TNOT) + checkkwd = 0; + #ifdef DEBUG if (!alreadyseen) TRACE(("token %s %s\n", tokname[t], t == TWORD ? wordtext : "")); Added: head/tools/regression/bin/sh/parser/alias3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parser/alias3.0 Tue Nov 2 23:44:29 2010 (r214709) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +alias alias0=exit +x=alias0 +eval 'case $x in "alias0") alias0 0;; esac' +exit 1 From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:48:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B01851065673; Tue, 2 Nov 2010 23:48:08 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D7D98FC16; Tue, 2 Nov 2010 23:48:08 +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 oA2Nm8N9099062; Tue, 2 Nov 2010 23:48:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2Nm8hf099060; Tue, 2 Nov 2010 23:48:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022348.oA2Nm8hf099060@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214710 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:48:08 -0000 Author: yongari Date: Tue Nov 2 23:48:08 2010 New Revision: 214710 URL: http://svn.freebsd.org/changeset/base/214710 Log: MFC r213522,213587,213711: r213522: Fix a long standing bug which regarded some revisions of controller as 5788. This caused BGE_MISC_LOCAL_CTL register is used to generate link state change interrupt for non-5788 controllers. The interrupt handler may or may not detect link state attention as status block wouldn't be updated when an interrupt was generated with BGE_MISC_LOCAL_CTL register. All controllers except 5700 and 5788 should use host coalescing mode register to trigger an interrupt. r213587: Do not blindly UP the interface when interface's MTU is changed. If driver is not running there is no need to up the interface. While I'm here hold driver lock before modifying MTU as it is referenced in RX handler. r213711: The IFF_DRV_RUNNING flag is set at the end of bge_init_locked. But before setting the flag, interrupt was already enabled such that interrupt handler could be run before setting IFF_DRV_RUNNING flag. This can lose initial link state change interrupt which in turn make bge(4) think that it still does not have valid link. Fix this race by protecting the taskqueue with a driver lock. While I'm here move reenabling interrupt code after handling of link state chage. Reviewed by: davidch Modified: stable/8/sys/dev/bge/if_bge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:44:29 2010 (r214709) +++ stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:48:08 2010 (r214710) @@ -2665,14 +2665,12 @@ bge_attach(device_t dev) if (BGE_IS_5755_PLUS(sc) == 0) sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; - /* - * We could possibly check for BCOM_DEVICEID_BCM5788 in bge_probe() - * but I do not know the DEVICEID for the 5788M. - */ - misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; - if (misccfg == BGE_MISCCFG_BOARD_ID_5788 || - misccfg == BGE_MISCCFG_BOARD_ID_5788M) - sc->bge_flags |= BGE_FLAG_5788; + if (sc->bge_asicrev == BGE_ASICREV_BCM5705) { + misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; + if (misccfg == BGE_MISCCFG_BOARD_ID_5788 || + misccfg == BGE_MISCCFG_BOARD_ID_5788M) + sc->bge_flags |= BGE_FLAG_5788; + } /* * Some controllers seem to require a special firmware to use @@ -3638,8 +3636,11 @@ bge_intr_task(void *arg, int pending) sc = (struct bge_softc *)arg; ifp = sc->bge_ifp; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + BGE_LOCK(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + BGE_UNLOCK(sc); return; + } /* Get updated status block. */ bus_dmamap_sync(sc->bge_cdata.bge_status_tag, @@ -3654,26 +3655,27 @@ bge_intr_task(void *arg, int pending) bus_dmamap_sync(sc->bge_cdata.bge_status_tag, sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + if ((status & BGE_STATFLAG_LINKSTATE_CHANGED) != 0) + bge_link_upd(sc); + /* Let controller work. */ bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); - if ((status & BGE_STATFLAG_LINKSTATE_CHANGED) != 0) { - BGE_LOCK(sc); - bge_link_upd(sc); - BGE_UNLOCK(sc); - } - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING && + sc->bge_rx_saved_considx != rx_prod) { /* Check RX return ring producer/consumer. */ + BGE_UNLOCK(sc); bge_rxeof(sc, rx_prod, 0); + BGE_LOCK(sc); } if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - BGE_LOCK(sc); /* Check TX ring producer/consumer. */ bge_txeof(sc, tx_cons); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); - BGE_UNLOCK(sc); } + BGE_UNLOCK(sc); } static void @@ -4644,6 +4646,7 @@ bge_ioctl(struct ifnet *ifp, u_long comm switch (command) { case SIOCSIFMTU: + BGE_LOCK(sc); if (ifr->ifr_mtu < ETHERMIN || ((BGE_IS_JUMBO_CAPABLE(sc)) && ifr->ifr_mtu > BGE_JUMBO_MTU) || @@ -4652,9 +4655,12 @@ bge_ioctl(struct ifnet *ifp, u_long comm error = EINVAL; else if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - bge_init(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + bge_init_locked(sc); + } } + BGE_UNLOCK(sc); break; case SIOCSIFFLAGS: BGE_LOCK(sc); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:49:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2C11106564A; Tue, 2 Nov 2010 23:49:48 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B035A8FC15; Tue, 2 Nov 2010 23:49: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 oA2Nnmbe099173; Tue, 2 Nov 2010 23:49:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NnmEx099171; Tue, 2 Nov 2010 23:49:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022349.oA2NnmEx099171@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:49:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214711 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:49:48 -0000 Author: yongari Date: Tue Nov 2 23:49:48 2010 New Revision: 214711 URL: http://svn.freebsd.org/changeset/base/214711 Log: MFC r213522,213587,213711: r213522: Fix a long standing bug which regarded some revisions of controller as 5788. This caused BGE_MISC_LOCAL_CTL register is used to generate link state change interrupt for non-5788 controllers. The interrupt handler may or may not detect link state attention as status block wouldn't be updated when an interrupt was generated with BGE_MISC_LOCAL_CTL register. All controllers except 5700 and 5788 should use host coalescing mode register to trigger an interrupt. r213587: Do not blindly UP the interface when interface's MTU is changed. If driver is not running there is no need to up the interface. While I'm here hold driver lock before modifying MTU as it is referenced in RX handler. r213711: The IFF_DRV_RUNNING flag is set at the end of bge_init_locked. But before setting the flag, interrupt was already enabled such that interrupt handler could be run before setting IFF_DRV_RUNNING flag. This can lose initial link state change interrupt which in turn make bge(4) think that it still does not have valid link. Fix this race by protecting the taskqueue with a driver lock. While I'm here move reenabling interrupt code after handling of link state chage. Reviewed by: davidch Modified: stable/7/sys/dev/bge/if_bge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:48:08 2010 (r214710) +++ stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:49:48 2010 (r214711) @@ -2665,14 +2665,12 @@ bge_attach(device_t dev) if (BGE_IS_5755_PLUS(sc) == 0) sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; - /* - * We could possibly check for BCOM_DEVICEID_BCM5788 in bge_probe() - * but I do not know the DEVICEID for the 5788M. - */ - misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; - if (misccfg == BGE_MISCCFG_BOARD_ID_5788 || - misccfg == BGE_MISCCFG_BOARD_ID_5788M) - sc->bge_flags |= BGE_FLAG_5788; + if (sc->bge_asicrev == BGE_ASICREV_BCM5705) { + misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; + if (misccfg == BGE_MISCCFG_BOARD_ID_5788 || + misccfg == BGE_MISCCFG_BOARD_ID_5788M) + sc->bge_flags |= BGE_FLAG_5788; + } /* * Some controllers seem to require a special firmware to use @@ -3634,8 +3632,11 @@ bge_intr_task(void *arg, int pending) sc = (struct bge_softc *)arg; ifp = sc->bge_ifp; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + BGE_LOCK(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + BGE_UNLOCK(sc); return; + } /* Get updated status block. */ bus_dmamap_sync(sc->bge_cdata.bge_status_tag, @@ -3650,26 +3651,27 @@ bge_intr_task(void *arg, int pending) bus_dmamap_sync(sc->bge_cdata.bge_status_tag, sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + if ((status & BGE_STATFLAG_LINKSTATE_CHANGED) != 0) + bge_link_upd(sc); + /* Let controller work. */ bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); - if ((status & BGE_STATFLAG_LINKSTATE_CHANGED) != 0) { - BGE_LOCK(sc); - bge_link_upd(sc); - BGE_UNLOCK(sc); - } - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING && + sc->bge_rx_saved_considx != rx_prod) { /* Check RX return ring producer/consumer. */ + BGE_UNLOCK(sc); bge_rxeof(sc, rx_prod, 0); + BGE_LOCK(sc); } if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - BGE_LOCK(sc); /* Check TX ring producer/consumer. */ bge_txeof(sc, tx_cons); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); - BGE_UNLOCK(sc); } + BGE_UNLOCK(sc); } static void @@ -4640,6 +4642,7 @@ bge_ioctl(struct ifnet *ifp, u_long comm switch (command) { case SIOCSIFMTU: + BGE_LOCK(sc); if (ifr->ifr_mtu < ETHERMIN || ((BGE_IS_JUMBO_CAPABLE(sc)) && ifr->ifr_mtu > BGE_JUMBO_MTU) || @@ -4648,9 +4651,12 @@ bge_ioctl(struct ifnet *ifp, u_long comm error = EINVAL; else if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - bge_init(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + bge_init_locked(sc); + } } + BGE_UNLOCK(sc); break; case SIOCSIFFLAGS: BGE_LOCK(sc); From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:55:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 026B5106564A; Tue, 2 Nov 2010 23:55: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 E41808FC16; Tue, 2 Nov 2010 23:54: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 oA2Nsx3D099368; Tue, 2 Nov 2010 23:54:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NsxF7099365; Tue, 2 Nov 2010 23:54:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022354.oA2NsxF7099365@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:54:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214712 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:55:00 -0000 Author: yongari Date: Tue Nov 2 23:54:59 2010 New Revision: 214712 URL: http://svn.freebsd.org/changeset/base/214712 Log: MFC r213747,213808,214216: r213747: Protect bge(4) from accessing invalid NIC internal memory regions on BCM5906. Tested by: Buganini < buganini <> gmail dot com > r213808: Add more checks for resolved link speed in bge_miibus_statchg(). Link UP state could be reported first before actual completion of auto-negotiation. This change makes bge(4) reprogram BGE_MAC_MODE, BGE_TX_MODE and BGE_RX_MODE register only after controller got a valid link. r214216: Enable TX MAC state machine lockup fix for both BCM5755 or higher and BCM5906. Publicly available data sheet just says it may happen due to corrupted TxMbuf. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:49:48 2010 (r214711) +++ stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:54:59 2010 (r214712) @@ -550,6 +550,10 @@ bge_readmem_ind(struct bge_softc *sc, in device_t dev; uint32_t val; + if (sc->bge_asicrev == BGE_ASICREV_BCM5906 && + off >= BGE_STATS_BLOCK && off < BGE_SEND_RING_1_TO_4) + return (0); + dev = sc->bge_dev; pci_write_config(dev, BGE_PCI_MEMWIN_BASEADDR, off, 4); @@ -563,6 +567,10 @@ bge_writemem_ind(struct bge_softc *sc, i { device_t dev; + if (sc->bge_asicrev == BGE_ASICREV_BCM5906 && + off >= BGE_STATS_BLOCK && off < BGE_SEND_RING_1_TO_4) + return; + dev = sc->bge_dev; pci_write_config(dev, BGE_PCI_MEMWIN_BASEADDR, off, 4); @@ -870,6 +878,29 @@ bge_miibus_statchg(device_t dev) sc = device_get_softc(dev); mii = device_get_softc(sc->bge_miibus); + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->bge_link = 1; + break; + case IFM_1000_T: + case IFM_1000_SX: + case IFM_2500_SX: + if (sc->bge_asicrev != BGE_ASICREV_BCM5906) + sc->bge_link = 1; + else + sc->bge_link = 0; + break; + default: + sc->bge_link = 0; + break; + } + } else + sc->bge_link = 0; + if (sc->bge_link == 0) + return; BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_PORTMODE); if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T || IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX) @@ -4339,6 +4370,7 @@ bge_init_locked(struct bge_softc *sc) { struct ifnet *ifp; uint16_t *m; + uint32_t mode; BGE_LOCK_ASSERT(sc); @@ -4444,8 +4476,12 @@ bge_init_locked(struct bge_softc *sc) /* Init TX ring. */ bge_init_tx_ring(sc); + /* Enable TX MAC state machine lockup fix. */ + mode = CSR_READ_4(sc, BGE_TX_MODE); + if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) + mode |= BGE_TXMODE_MBUF_LOCKUP_FIX; /* Turn on transmitter. */ - BGE_SETBIT(sc, BGE_TX_MODE, BGE_TXMODE_ENABLE); + CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE); /* Turn on receiver. */ BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); @@ -5066,12 +5102,7 @@ bge_link_upd(struct bge_softc *sc) */ mii = device_get_softc(sc->bge_miibus); mii_pollstat(mii); - if (!sc->bge_link && mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - bge_miibus_statchg(sc->bge_dev); - sc->bge_link = 1; - } else - sc->bge_link = 0; + bge_miibus_statchg(sc->bge_dev); } /* Clear the attention. */ Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 23:49:48 2010 (r214711) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 23:54:59 2010 (r214712) @@ -765,6 +765,7 @@ #define BGE_TXMODE_FLOWCTL_ENABLE 0x00000010 #define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020 #define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040 +#define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100 /* Transmit MAC status register */ #define BGE_TXSTAT_RX_XOFFED 0x00000001 From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 23:56:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E207106566B; Tue, 2 Nov 2010 23:56:35 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B9A38FC17; Tue, 2 Nov 2010 23:56: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 oA2NuZuA099490; Tue, 2 Nov 2010 23:56:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2NuZso099487; Tue, 2 Nov 2010 23:56:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011022356.oA2NuZso099487@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Nov 2010 23:56:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214713 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 23:56:35 -0000 Author: yongari Date: Tue Nov 2 23:56:35 2010 New Revision: 214713 URL: http://svn.freebsd.org/changeset/base/214713 Log: MFC r213747,213808,214216: r213747: Protect bge(4) from accessing invalid NIC internal memory regions on BCM5906. Tested by: Buganini < buganini <> gmail dot com > r213808: Add more checks for resolved link speed in bge_miibus_statchg(). Link UP state could be reported first before actual completion of auto-negotiation. This change makes bge(4) reprogram BGE_MAC_MODE, BGE_TX_MODE and BGE_RX_MODE register only after controller got a valid link. r214216: Enable TX MAC state machine lockup fix for both BCM5755 or higher and BCM5906. Publicly available data sheet just says it may happen due to corrupted TxMbuf. Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:54:59 2010 (r214712) +++ stable/7/sys/dev/bge/if_bge.c Tue Nov 2 23:56:35 2010 (r214713) @@ -550,6 +550,10 @@ bge_readmem_ind(struct bge_softc *sc, in device_t dev; uint32_t val; + if (sc->bge_asicrev == BGE_ASICREV_BCM5906 && + off >= BGE_STATS_BLOCK && off < BGE_SEND_RING_1_TO_4) + return (0); + dev = sc->bge_dev; pci_write_config(dev, BGE_PCI_MEMWIN_BASEADDR, off, 4); @@ -563,6 +567,10 @@ bge_writemem_ind(struct bge_softc *sc, i { device_t dev; + if (sc->bge_asicrev == BGE_ASICREV_BCM5906 && + off >= BGE_STATS_BLOCK && off < BGE_SEND_RING_1_TO_4) + return; + dev = sc->bge_dev; pci_write_config(dev, BGE_PCI_MEMWIN_BASEADDR, off, 4); @@ -870,6 +878,29 @@ bge_miibus_statchg(device_t dev) sc = device_get_softc(dev); mii = device_get_softc(sc->bge_miibus); + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->bge_link = 1; + break; + case IFM_1000_T: + case IFM_1000_SX: + case IFM_2500_SX: + if (sc->bge_asicrev != BGE_ASICREV_BCM5906) + sc->bge_link = 1; + else + sc->bge_link = 0; + break; + default: + sc->bge_link = 0; + break; + } + } else + sc->bge_link = 0; + if (sc->bge_link == 0) + return; BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_PORTMODE); if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T || IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX) @@ -4335,6 +4366,7 @@ bge_init_locked(struct bge_softc *sc) { struct ifnet *ifp; uint16_t *m; + uint32_t mode; BGE_LOCK_ASSERT(sc); @@ -4440,8 +4472,12 @@ bge_init_locked(struct bge_softc *sc) /* Init TX ring. */ bge_init_tx_ring(sc); + /* Enable TX MAC state machine lockup fix. */ + mode = CSR_READ_4(sc, BGE_TX_MODE); + if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) + mode |= BGE_TXMODE_MBUF_LOCKUP_FIX; /* Turn on transmitter. */ - BGE_SETBIT(sc, BGE_TX_MODE, BGE_TXMODE_ENABLE); + CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE); /* Turn on receiver. */ BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); @@ -5062,12 +5098,7 @@ bge_link_upd(struct bge_softc *sc) */ mii = device_get_softc(sc->bge_miibus); mii_pollstat(mii); - if (!sc->bge_link && mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - bge_miibus_statchg(sc->bge_dev); - sc->bge_link = 1; - } else - sc->bge_link = 0; + bge_miibus_statchg(sc->bge_dev); } /* Clear the attention. */ Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 23:54:59 2010 (r214712) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Nov 2 23:56:35 2010 (r214713) @@ -765,6 +765,7 @@ #define BGE_TXMODE_FLOWCTL_ENABLE 0x00000010 #define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020 #define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040 +#define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100 /* Transmit MAC status register */ #define BGE_TXSTAT_RX_XOFFED 0x00000001 From owner-svn-src-all@FreeBSD.ORG Wed Nov 3 00:03:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7631106564A; Wed, 3 Nov 2010 00:03:26 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4A9F8FC0A; Wed, 3 Nov 2010 00:03: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 oA303QTZ099794; Wed, 3 Nov 2010 00:03:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA303QGS099791; Wed, 3 Nov 2010 00:03:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011030003.oA303QGS099791@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 3 Nov 2010 00:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214714 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2010 00:03:27 -0000 Author: yongari Date: Wed Nov 3 00:03:26 2010 New Revision: 214714 URL: http://svn.freebsd.org/changeset/base/214714 Log: MFC r214087,214219,214251,214292: r214087: Add workaround for BCM5906 controller silicon bug. If device receive two back-to-back send BDs with less than or equal to 8 total bytes then the device may hang. The two back-to-back send BDs must be in the same frame for this failure to occur. Thanks to davidch for detailed errata information. Reviewed by: davidch r214219: Add workaround for BCM5906 A1 controller silicon bug. When auto-negotiation results in half-duplex operation, excess collision on the ethernet link may cause internal chip delays that may result in subsequent valid frames being dropped due to insufficient receive buffer resources. The workaround is to choose de-pipeline method as a flow control decision for SDI. De-pipeline method allows only 1 data in TxMbuf at a time such that a request to RDMA from SDI is made only when TxMbuf is empty. Thanks for david for providing detailed errata information. r214251: Apply the same workaround for SDI flow control used on BCM5906 A1 to BCM6906 A0/A2. This should fix a long standing BCM5906 A2 lockup issues. Data sheet explicitly mentions BCM5906 A0, A1 and A2 use de-pipelined mode on these revisions. Special thanks to Buganini who tried all combinations of experimental patches for more than 10 days. Tested by: Buganini gmail dot com > r214292: Use bge_chipid to compare controller ids. r214251 incorrectly used bge_chiprev. Reported by: Buganini gmail dot com > Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Nov 2 23:56:35 2010 (r214713) +++ stable/8/sys/dev/bge/if_bge.c Wed Nov 3 00:03:26 2010 (r214714) @@ -374,6 +374,7 @@ static void bge_tick(void *); static void bge_stats_clear_regs(struct bge_softc *); static void bge_stats_update(struct bge_softc *); static void bge_stats_update_regs(struct bge_softc *); +static struct mbuf *bge_check_short_dma(struct mbuf *); static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, uint16_t *); static int bge_encap(struct bge_softc *, struct mbuf **, uint32_t *); @@ -1696,6 +1697,14 @@ bge_blockinit(struct bge_softc *sc) bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); } + /* Choose de-pipeline mode for BCM5906 A0, A1 and A2. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { + if (sc->bge_chipid == BGE_CHIPID_BCM5906_A0 || + sc->bge_chipid == BGE_CHIPID_BCM5906_A1 || + sc->bge_chipid == BGE_CHIPID_BCM5906_A2) + CSR_WRITE_4(sc, BGE_ISO_PKT_TX, + (CSR_READ_4(sc, BGE_ISO_PKT_TX) & ~3) | 2); + } /* * The BD ring replenish thresholds control how often the * hardware fetches new BD's from the producer rings in host @@ -2637,6 +2646,8 @@ bge_attach(device_t dev) case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; /* FALLTHROUGH */ case BGE_ASICREV_BCM5705: sc->bge_flags |= BGE_FLAG_5705_PLUS; @@ -4064,6 +4075,39 @@ bge_cksum_pad(struct mbuf *m) } static struct mbuf * +bge_check_short_dma(struct mbuf *m) +{ + struct mbuf *n; + int found; + + /* + * If device receive two back-to-back send BDs with less than + * or equal to 8 total bytes then the device may hang. The two + * back-to-back send BDs must in the same frame for this failure + * to occur. Scan mbuf chains and see whether two back-to-back + * send BDs are there. If this is the case, allocate new mbuf + * and copy the frame to workaround the silicon bug. + */ + for (n = m, found = 0; n != NULL; n = n->m_next) { + if (n->m_len < 8) { + found++; + if (found > 1) + break; + continue; + } + found = 0; + } + + if (found > 1) { + n = m_defrag(m, M_DONTWAIT); + if (n == NULL) + m_freem(m); + } else + n = m; + return (n); +} + +static struct mbuf * bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss) { struct ip *ip; @@ -4136,6 +4180,13 @@ bge_encap(struct bge_softc *sc, struct m csum_flags = 0; mss = 0; vlan_tag = 0; + if ((sc->bge_flags & BGE_FLAG_SHORT_DMA_BUG) != 0 && + m->m_next != NULL) { + *m_head = bge_check_short_dma(m); + if (*m_head == NULL) + return (ENOBUFS); + m = *m_head; + } if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { *m_head = m = bge_setup_tso(sc, m, &mss); if (*m_head == NULL) Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Nov 2 23:56:35 2010 (r214713) +++ stable/8/sys/dev/bge/if_bgereg.h Wed Nov 3 00:03:26 2010 (r214714) @@ -306,6 +306,7 @@ #define BGE_CHIPID_BCM5787_A0 0xb000 #define BGE_CHIPID_BCM5787_A1 0xb001 #define BGE_CHIPID_BCM5787_A2 0xb002 +#define BGE_CHIPID_BCM5906_A0 0xc000 #define BGE_CHIPID_BCM5906_A1 0xc001 #define BGE_CHIPID_BCM5906_A2 0xc002 #define BGE_CHIPID_BCM57780_A0 0x57780000 @@ -880,6 +881,7 @@ #define BGE_SDI_STATS_CTL 0x0C08 #define BGE_SDI_STATS_ENABLE_MASK 0x0C0C #define BGE_SDI_STATS_INCREMENT_MASK 0x0C10 +#define BGE_ISO_PKT_TX 0x0C20 #define BGE_LOCSTATS_COS0 0x0C80 #define BGE_LOCSTATS_COS1 0x0C84 #define BGE_LOCSTATS_COS2 0x0C88 @@ -2728,6 +2730,7 @@ struct bge_softc { #define BGE_FLAG_40BIT_BUG 0x01000000 #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 +#define BGE_FLAG_SHORT_DMA_BUG 0x08000000 uint32_t bge_phy_flags; #define BGE_PHY_WIRESPEED 0x00000001 #define BGE_PHY_ADC_BUG 0x00000002 From owner-svn-src-all@FreeBSD.ORG Wed Nov 3 00:13:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69DAF106564A; Wed, 3 Nov 2010 00:13: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 56D928FC0A; Wed, 3 Nov 2010 00:13: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 oA30DMSF000291; Wed, 3 Nov 2010 00:13:22 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA30DMkr000288; Wed, 3 Nov 2010 00:13:22 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011030013.oA30DMkr000288@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 3 Nov 2010 00:13:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214715 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2010 00:13:22 -0000 Author: yongari Date: Wed Nov 3 00:13:22 2010 New Revision: 214715 URL: http://svn.freebsd.org/changeset/base/214715 Log: MFC r214087,214219,214251,214292: r214087: Add workaround for BCM5906 controller silicon bug. If device receive two back-to-back send BDs with less than or equal to 8 total bytes then the device may hang. The two back-to-back send BDs must be in the same frame for this failure to occur. Thanks to davidch for detailed errata information. Reviewed by: davidch r214219: Add workaround for BCM5906 A1 controller silicon bug. When auto-negotiation results in half-duplex operation, excess collision on the ethernet link may cause internal chip delays that may result in subsequent valid frames being dropped due to insufficient receive buffer resources. The workaround is to choose de-pipeline method as a flow control decision for SDI. De-pipeline method allows only 1 data in TxMbuf at a time such that a request to RDMA from SDI is made only when TxMbuf is empty. Thanks for david for providing detailed errata information. r214251: Apply the same workaround for SDI flow control used on BCM5906 A1 to BCM6906 A0/A2. This should fix a long standing BCM5906 A2 lockup issues. Data sheet explicitly mentions BCM5906 A0, A1 and A2 use de-pipelined mode on these revisions. Special thanks to Buganini who tried all combinations of experimental patches for more than 10 days. Tested by: Buganini gmail dot com > r214292: Use bge_chipid to compare controller ids. r214251 incorrectly used bge_chiprev. Reported by: Buganini gmail dot com > Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Wed Nov 3 00:03:26 2010 (r214714) +++ stable/7/sys/dev/bge/if_bge.c Wed Nov 3 00:13:22 2010 (r214715) @@ -374,6 +374,7 @@ static void bge_tick(void *); static void bge_stats_clear_regs(struct bge_softc *); static void bge_stats_update(struct bge_softc *); static void bge_stats_update_regs(struct bge_softc *); +static struct mbuf *bge_check_short_dma(struct mbuf *); static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, uint16_t *); static int bge_encap(struct bge_softc *, struct mbuf **, uint32_t *); @@ -1696,6 +1697,14 @@ bge_blockinit(struct bge_softc *sc) bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); } + /* Choose de-pipeline mode for BCM5906 A0, A1 and A2. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { + if (sc->bge_chipid == BGE_CHIPID_BCM5906_A0 || + sc->bge_chipid == BGE_CHIPID_BCM5906_A1 || + sc->bge_chipid == BGE_CHIPID_BCM5906_A2) + CSR_WRITE_4(sc, BGE_ISO_PKT_TX, + (CSR_READ_4(sc, BGE_ISO_PKT_TX) & ~3) | 2); + } /* * The BD ring replenish thresholds control how often the * hardware fetches new BD's from the producer rings in host @@ -2632,12 +2641,14 @@ bge_attach(device_t dev) case BGE_ASICREV_BCM5780: case BGE_ASICREV_BCM5714: sc->bge_flags |= BGE_FLAG_5714_FAMILY /* | BGE_FLAG_JUMBO */; - /* FALLTHRU */ + /* FALLTHROUGH */ case BGE_ASICREV_BCM5750: case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; - /* FALLTHRU */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; + /* FALLTHROUGH */ case BGE_ASICREV_BCM5705: sc->bge_flags |= BGE_FLAG_5705_PLUS; break; @@ -4060,6 +4071,39 @@ bge_cksum_pad(struct mbuf *m) } static struct mbuf * +bge_check_short_dma(struct mbuf *m) +{ + struct mbuf *n; + int found; + + /* + * If device receive two back-to-back send BDs with less than + * or equal to 8 total bytes then the device may hang. The two + * back-to-back send BDs must in the same frame for this failure + * to occur. Scan mbuf chains and see whether two back-to-back + * send BDs are there. If this is the case, allocate new mbuf + * and copy the frame to workaround the silicon bug. + */ + for (n = m, found = 0; n != NULL; n = n->m_next) { + if (n->m_len < 8) { + found++; + if (found > 1) + break; + continue; + } + found = 0; + } + + if (found > 1) { + n = m_defrag(m, M_DONTWAIT); + if (n == NULL) + m_freem(m); + } else + n = m; + return (n); +} + +static struct mbuf * bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss) { struct ip *ip; @@ -4132,6 +4176,13 @@ bge_encap(struct bge_softc *sc, struct m csum_flags = 0; mss = 0; vlan_tag = 0; + if ((sc->bge_flags & BGE_FLAG_SHORT_DMA_BUG) != 0 && + m->m_next != NULL) { + *m_head = bge_check_short_dma(m); + if (*m_head == NULL) + return (ENOBUFS); + m = *m_head; + } if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { *m_head = m = bge_setup_tso(sc, m, &mss); if (*m_head == NULL) Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Wed Nov 3 00:03:26 2010 (r214714) +++ stable/7/sys/dev/bge/if_bgereg.h Wed Nov 3 00:13:22 2010 (r214715) @@ -306,6 +306,7 @@ #define BGE_CHIPID_BCM5787_A0 0xb000 #define BGE_CHIPID_BCM5787_A1 0xb001 #define BGE_CHIPID_BCM5787_A2 0xb002 +#define BGE_CHIPID_BCM5906_A0 0xc000 #define BGE_CHIPID_BCM5906_A1 0xc001 #define BGE_CHIPID_BCM5906_A2 0xc002 #define BGE_CHIPID_BCM57780_A0 0x57780000 @@ -880,6 +881,7 @@ #define BGE_SDI_STATS_CTL 0x0C08 #define BGE_SDI_STATS_ENABLE_MASK 0x0C0C #define BGE_SDI_STATS_INCREMENT_MASK 0x0C10 +#define BGE_ISO_PKT_TX 0x0C20 #define BGE_LOCSTATS_COS0 0x0C80 #define BGE_LOCSTATS_COS1 0x0C84 #define BGE_LOCSTATS_COS2 0x0C88 @@ -2728,6 +2730,7 @@ struct bge_softc { #define BGE_FLAG_40BIT_BUG 0x01000000 #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 +#define BGE_FLAG_SHORT_DMA_BUG 0x08000000 uint32_t bge_phy_flags; #define BGE_PHY_WIRESPEED 0x00000001 #define BGE_PHY_ADC_BUG 0x00000002 From owner-svn-src-all@FreeBSD.ORG Wed Nov 3 01:24:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A43DA106566B; Wed, 3 Nov 2010 01:24:26 +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 779EE8FC12; Wed, 3 Nov 2010 01: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 oA31OQ2v002360; Wed, 3 Nov 2010 01:24:26 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31OQ5O002358; Wed, 3 Nov 2010 01:24:26 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201011030124.oA31OQ5O002358@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 3 Nov 2010 01:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214716 - vendor/tzdata/dist X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2010 01:24:26 -0000 Author: edwin Date: Wed Nov 3 01:24:26 2010 New Revision: 214716 URL: http://svn.freebsd.org/changeset/base/214716 Log: Vendor import of tzdata2010o: - Fiji will end DST 3 weeks earlier than expected - on March 6, 2011, not March 27, 2011. Obtained from: ftp://elsie.nci.nih.gov/pub/ Modified: vendor/tzdata/dist/australasia Modified: vendor/tzdata/dist/australasia ============================================================================== --- vendor/tzdata/dist/australasia Wed Nov 3 00:13:22 2010 (r214715) +++ vendor/tzdata/dist/australasia Wed Nov 3 01:24:26 2010 (r214716) @@ -1,5 +1,5 @@ #

-# @(#)australasia	8.18
+# @(#)australasia	8.20
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -284,13 +284,26 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 # http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
 # 
 
+# From Alexander Krivenyshev (2010-10-24):
+# According to Radio Fiji and Fiji Times online, Fiji will end DST 3 
+# weeks earlier than expected - on March 6, 2011, not March 27, 2011...
+# Here is confirmation from Government of the Republic of the Fiji Islands, 
+# Ministry of Information (fiji.gov.fj) web site:
+# 
+# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=2608:daylight-savings&catid=71:press-releases&Itemid=155
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_fiji04.html
+# 
+
 # 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	-	Mar	lastSun	3:00	0	-
 Rule	Fiji	2010	only	-	Oct	24	2:00	1:00	S
-Rule	Fiji	2011	only	-	Mar	lastSun 3:00	0	-
+Rule	Fiji	2011	only	-	Mar	Sun>=1	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
@@ -487,11 +500,21 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf
 # 
 
+# From Raymond Hughes (2010-10-07):
+# Please see
+# 
+# http://www.mcil.gov.ws
+# ,
+# the Ministry of Commerce, Industry and Labour (sideframe) "Last Sunday
+# September 2010 (26/09/10) - adjust clocks forward from 12:00 midnight
+# to 01:00am and First Sunday April 2011 (03/04/11) - adjust clocks
+# backwards from 1:00am to 12:00am"
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
 			-11:00	-	WST	2010 Sep 26
-			-11:00	1:00	WSDT	2011 Apr 3
+			-11:00	1:00	WSDT	2011 Apr 3 1:00
 			-11:00	-	WST
 
 # Solomon Is

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 01:24:33 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 755B310657B9;
	Wed,  3 Nov 2010 01:24:33 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 48A888FC18;
	Wed,  3 Nov 2010 01:24: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 oA31OX9M002400;
	Wed, 3 Nov 2010 01:24:33 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31OXX5002398;
	Wed, 3 Nov 2010 01:24:33 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201011030124.oA31OXX5002398@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 3 Nov 2010 01:24:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214717 - stable/8/sys/dev/fxp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 01:24:33 -0000

Author: yongari
Date: Wed Nov  3 01:24:33 2010
New Revision: 214717
URL: http://svn.freebsd.org/changeset/base/214717

Log:
  MFC r214302:
    Add TSO support over VLAN for i82550/i82551. Controller requires
    VLAN hardware tagging to make TSO work over VLAN. So if VLAN
    hardware tagging is disabled explicitly clear TSO over VLAN. While
    I'm here allow disabling VLAN TX checksum offloading.
  
    Tested by:	Liudas < liudasb <> centras dot lt >

Modified:
  stable/8/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/8/sys/dev/fxp/if_fxp.c	Wed Nov  3 01:24:26 2010	(r214716)
+++ stable/8/sys/dev/fxp/if_fxp.c	Wed Nov  3 01:24:33 2010	(r214717)
@@ -858,9 +858,9 @@ fxp_attach(device_t dev)
 	ifp->if_capenable |= IFCAP_VLAN_MTU; /* the hw bits already set */
 	if ((sc->flags & FXP_FLAG_EXT_RFA) != 0) {
 		ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING |
-		    IFCAP_VLAN_HWCSUM;
+		    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
 		ifp->if_capenable |= IFCAP_VLAN_HWTAGGING |
-		    IFCAP_VLAN_HWCSUM;
+		    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
 	}
 
 	/*
@@ -2862,10 +2862,19 @@ fxp_ioctl(struct ifnet *ifp, u_long comm
 			if (ifp->if_flags & IFF_UP)
 				reinit++;
 		}
+		if ((mask & IFCAP_VLAN_HWCSUM) != 0 &&
+		    (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0)
+			ifp->if_capenable ^= IFCAP_VLAN_HWCSUM;
+		if ((mask & IFCAP_VLAN_HWTSO) != 0 &&
+		    (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0)
+			ifp->if_capenable ^= IFCAP_VLAN_HWTSO;
 		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
 		    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
 			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
-				reinit++;
+			if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
+				ifp->if_capenable &=
+				    ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM);
+			reinit++;
 		}
 		if (reinit > 0 && ifp->if_flags & IFF_UP)
 			fxp_init_body(sc);

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 01:26:12 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 23B4C106566C;
	Wed,  3 Nov 2010 01:26:12 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EAFCE8FC0C;
	Wed,  3 Nov 2010 01:26:11 +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 oA31QBC6002502;
	Wed, 3 Nov 2010 01:26:11 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31QB2V002500;
	Wed, 3 Nov 2010 01:26:11 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201011030126.oA31QB2V002500@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 3 Nov 2010 01:26:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214718 - stable/7/sys/dev/fxp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 01:26:12 -0000

Author: yongari
Date: Wed Nov  3 01:26:11 2010
New Revision: 214718
URL: http://svn.freebsd.org/changeset/base/214718

Log:
  MFC r214302:
    Add TSO support over VLAN for i82550/i82551. Controller requires
    VLAN hardware tagging to make TSO work over VLAN. So if VLAN
    hardware tagging is disabled explicitly clear TSO over VLAN. While
    I'm here allow disabling VLAN TX checksum offloading.
  
    Tested by:	Liudas < liudasb <> centras dot lt >

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  3 01:24:33 2010	(r214717)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  3 01:26:11 2010	(r214718)
@@ -859,9 +859,9 @@ fxp_attach(device_t dev)
 	ifp->if_capenable |= IFCAP_VLAN_MTU; /* the hw bits already set */
 	if ((sc->flags & FXP_FLAG_EXT_RFA) != 0) {
 		ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING |
-		    IFCAP_VLAN_HWCSUM;
+		    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
 		ifp->if_capenable |= IFCAP_VLAN_HWTAGGING |
-		    IFCAP_VLAN_HWCSUM;
+		    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
 	}
 
 	/*
@@ -2855,10 +2855,19 @@ fxp_ioctl(struct ifnet *ifp, u_long comm
 			if (ifp->if_flags & IFF_UP)
 				reinit++;
 		}
+		if ((mask & IFCAP_VLAN_HWCSUM) != 0 &&
+		    (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0)
+			ifp->if_capenable ^= IFCAP_VLAN_HWCSUM;
+		if ((mask & IFCAP_VLAN_HWTSO) != 0 &&
+		    (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0)
+			ifp->if_capenable ^= IFCAP_VLAN_HWTSO;
 		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
 		    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
 			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
-				reinit++;
+			if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
+				ifp->if_capenable &=
+				    ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM);
+			reinit++;
 		}
 		if (reinit > 0 && ifp->if_flags & IFF_UP)
 			fxp_init_body(sc);

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 01:26:42 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0066B106564A;
	Wed,  3 Nov 2010 01:26:42 +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 C8F408FC12;
	Wed,  3 Nov 2010 01:26: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 oA31QfqA002546;
	Wed, 3 Nov 2010 01:26:41 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31Qfuk002545;
	Wed, 3 Nov 2010 01:26:41 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201011030126.oA31Qfuk002545@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 3 Nov 2010 01:26:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214719 - vendor/tzdata/tzdata2010o
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 01:26:42 -0000

Author: edwin
Date: Wed Nov  3 01:26:41 2010
New Revision: 214719
URL: http://svn.freebsd.org/changeset/base/214719

Log:
  Tag of tzdata2010o

Added:
  vendor/tzdata/tzdata2010o/
     - copied from r214717, vendor/tzdata/dist/

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 01:28:09 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E5C24106566B;
	Wed,  3 Nov 2010 01:28:09 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B8D818FC15;
	Wed,  3 Nov 2010 01:28: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 oA31S9XU002633;
	Wed, 3 Nov 2010 01:28:09 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31S9dk002631;
	Wed, 3 Nov 2010 01:28:09 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201011030128.oA31S9dk002631@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 3 Nov 2010 01:28:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214720 - stable/8/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 01:28:10 -0000

Author: yongari
Date: Wed Nov  3 01:28:09 2010
New Revision: 214720
URL: http://svn.freebsd.org/changeset/base/214720

Log:
  MFC r214432:
    Use shorten model name and add RTL8168, RTL8111 to the list of
    supported device. re(4) had been supported all variants of RTL8168,
    RTL8111 and RTL810x. I think this change will cover all controllers
    supported by re(4).

Modified:
  stable/8/share/man/man4/re.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/re.4
==============================================================================
--- stable/8/share/man/man4/re.4	Wed Nov  3 01:26:41 2010	(r214719)
+++ stable/8/share/man/man4/re.4	Wed Nov  3 01:28:09 2010	(r214720)
@@ -30,12 +30,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 9, 2009
+.Dd October 27, 2010
 .Dt RE 4
 .Os
 .Sh NAME
 .Nm re
-.Nd "RealTek 8139C+/8169/816xS/811xS/8101E PCI/PCIe Ethernet adapter driver"
+.Nd "RealTek 8139C+/8169/816xS/811xS/8168/810xE/8111 PCI/PCIe Ethernet adapter driver"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -55,13 +55,13 @@ if_re_load="YES"
 The
 .Nm
 driver provides support for various NICs based on the RealTek RTL8139C+,
-RTL8169, RTL8169S, RTL8110S, RTL8168S, RTL8111S and RTL8101E PCI and
+RTL8169, RTL816xS, RTL811xS, RTL8168, RTL810xE and RTL8111 PCI and
 PCIe Ethernet controllers.
 .Pp
-NICs based on the 8139C+ and 8101E are capable of 10 and 100Mbps speeds
+NICs based on the 8139C+ and 810xE are capable of 10 and 100Mbps speeds
 over CAT5 cable.
-NICs based on the 8169, 816xS and 811xS are capable of 10, 100 and
-1000Mbps operation.
+NICs based on the 8169, 816xS, 811xS, 8168 and 8111 are capable of 10, 100
+and 1000Mbps operation.
 .Pp
 All NICs supported by the
 .Nm
@@ -72,8 +72,8 @@ capable of TCP large send (TCP segmentat
 .Pp
 The 8139C+ is a single-chip solution combining both a 10/100 MAC and PHY.
 The 8169 is a 10/100/1000 MAC only, requiring a GMII or TBI external PHY.
-The 8169S and 8110S are single-chip devices containing both a 10/100/1000
-MAC and 10/100/1000 copper PHY.
+The 816xS, 811xS, 8168 and 8111 are single-chip devices containing both a
+10/100/1000 MAC and 10/100/1000 copper PHY.
 Standalone 10/100/1000 cards are available
 in both 32-bit PCI and 64-bit PCI models.
 The 8110S is designed for
@@ -144,8 +144,8 @@ For more information on configuring this
 .Sh HARDWARE
 The
 .Nm
-driver supports RealTek RTL8139C+, RTL8169, RTL816xS, RTL811xS,
-and RTL8101E based Fast Ethernet and Gigabit Ethernet adapters including:
+driver supports RealTek RTL8139C+, RTL8169, RTL816xS, RTL811xS, RTL8168,
+RTL810xE and RTL8111 based Fast Ethernet and Gigabit Ethernet adapters including:
 .Pp
 .Bl -bullet -compact
 .It

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 01:28:57 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 79C6C1065670;
	Wed,  3 Nov 2010 01:28:57 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4CE9E8FC0A;
	Wed,  3 Nov 2010 01:28: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 oA31Sv5R002697;
	Wed, 3 Nov 2010 01:28:57 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31SvA8002695;
	Wed, 3 Nov 2010 01:28:57 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201011030128.oA31SvA8002695@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 3 Nov 2010 01:28:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214721 - stable/7/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 01:28:57 -0000

Author: yongari
Date: Wed Nov  3 01:28:57 2010
New Revision: 214721
URL: http://svn.freebsd.org/changeset/base/214721

Log:
  MFC r214432:
    Use shorten model name and add RTL8168, RTL8111 to the list of
    supported device. re(4) had been supported all variants of RTL8168,
    RTL8111 and RTL810x. I think this change will cover all controllers
    supported by re(4).

Modified:
  stable/7/share/man/man4/re.4
Directory Properties:
  stable/7/share/man/man4/   (props changed)

Modified: stable/7/share/man/man4/re.4
==============================================================================
--- stable/7/share/man/man4/re.4	Wed Nov  3 01:28:09 2010	(r214720)
+++ stable/7/share/man/man4/re.4	Wed Nov  3 01:28:57 2010	(r214721)
@@ -30,12 +30,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 9, 2009
+.Dd October 27, 2010
 .Dt RE 4
 .Os
 .Sh NAME
 .Nm re
-.Nd "RealTek 8139C+/8169/816xS/811xS/8101E PCI/PCIe Ethernet adapter driver"
+.Nd "RealTek 8139C+/8169/816xS/811xS/8168/810xE/8111 PCI/PCIe Ethernet adapter driver"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -55,13 +55,13 @@ if_re_load="YES"
 The
 .Nm
 driver provides support for various NICs based on the RealTek RTL8139C+,
-RTL8169, RTL8169S, RTL8110S, RTL8168S, RTL8111S and RTL8101E PCI and
+RTL8169, RTL816xS, RTL811xS, RTL8168, RTL810xE and RTL8111 PCI and
 PCIe Ethernet controllers.
 .Pp
-NICs based on the 8139C+ and 8101E are capable of 10 and 100Mbps speeds
+NICs based on the 8139C+ and 810xE are capable of 10 and 100Mbps speeds
 over CAT5 cable.
-NICs based on the 8169, 816xS and 811xS are capable of 10, 100 and
-1000Mbps operation.
+NICs based on the 8169, 816xS, 811xS, 8168 and 8111 are capable of 10, 100
+and 1000Mbps operation.
 .Pp
 All NICs supported by the
 .Nm
@@ -72,8 +72,8 @@ capable of TCP large send (TCP segmentat
 .Pp
 The 8139C+ is a single-chip solution combining both a 10/100 MAC and PHY.
 The 8169 is a 10/100/1000 MAC only, requiring a GMII or TBI external PHY.
-The 8169S and 8110S are single-chip devices containing both a 10/100/1000
-MAC and 10/100/1000 copper PHY.
+The 816xS, 811xS, 8168 and 8111 are single-chip devices containing both a
+10/100/1000 MAC and 10/100/1000 copper PHY.
 Standalone 10/100/1000 cards are available
 in both 32-bit PCI and 64-bit PCI models.
 The 8110S is designed for
@@ -144,8 +144,8 @@ For more information on configuring this
 .Sh HARDWARE
 The
 .Nm
-driver supports RealTek RTL8139C+, RTL8169, RTL816xS, RTL811xS,
-and RTL8101E based Fast Ethernet and Gigabit Ethernet adapters including:
+driver supports RealTek RTL8139C+, RTL8169, RTL816xS, RTL811xS, RTL8168,
+RTL810xE and RTL8111 based Fast Ethernet and Gigabit Ethernet adapters including:
 .Pp
 .Bl -bullet -compact
 .It

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 01:30:56 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BEA13106564A;
	Wed,  3 Nov 2010 01:30:56 +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 922B58FC19;
	Wed,  3 Nov 2010 01:30: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 oA31UunX002804;
	Wed, 3 Nov 2010 01:30:56 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31Uunn002802;
	Wed, 3 Nov 2010 01:30:56 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201011030130.oA31Uunn002802@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 3 Nov 2010 01:30: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: r214722 - head/contrib/tzdata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 01:30:56 -0000

Author: edwin
Date: Wed Nov  3 01:30:56 2010
New Revision: 214722
URL: http://svn.freebsd.org/changeset/base/214722

Log:
  MFV of tzdata2010o, r214716
  
  - Fiji moves to DST three weeks earlier in 2010.

Modified:
  head/contrib/tzdata/australasia
Directory Properties:
  head/contrib/tzdata/   (props changed)

Modified: head/contrib/tzdata/australasia
==============================================================================
--- head/contrib/tzdata/australasia	Wed Nov  3 01:28:57 2010	(r214721)
+++ head/contrib/tzdata/australasia	Wed Nov  3 01:30:56 2010	(r214722)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.18
+# @(#)australasia	8.20
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -284,13 +284,26 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 # http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
 # 
 
+# From Alexander Krivenyshev (2010-10-24):
+# According to Radio Fiji and Fiji Times online, Fiji will end DST 3 
+# weeks earlier than expected - on March 6, 2011, not March 27, 2011...
+# Here is confirmation from Government of the Republic of the Fiji Islands, 
+# Ministry of Information (fiji.gov.fj) web site:
+# 
+# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=2608:daylight-savings&catid=71:press-releases&Itemid=155
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_fiji04.html
+# 
+
 # 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	-	Mar	lastSun	3:00	0	-
 Rule	Fiji	2010	only	-	Oct	24	2:00	1:00	S
-Rule	Fiji	2011	only	-	Mar	lastSun 3:00	0	-
+Rule	Fiji	2011	only	-	Mar	Sun>=1	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
@@ -487,11 +500,21 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf
 # 
 
+# From Raymond Hughes (2010-10-07):
+# Please see
+# 
+# http://www.mcil.gov.ws
+# ,
+# the Ministry of Commerce, Industry and Labour (sideframe) "Last Sunday
+# September 2010 (26/09/10) - adjust clocks forward from 12:00 midnight
+# to 01:00am and First Sunday April 2011 (03/04/11) - adjust clocks
+# backwards from 1:00am to 12:00am"
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
 			-11:00	-	WST	2010 Sep 26
-			-11:00	1:00	WSDT	2011 Apr 3
+			-11:00	1:00	WSDT	2011 Apr 3 1:00
 			-11:00	-	WST
 
 # Solomon Is

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 01:32:39 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7F0CA1065670;
	Wed,  3 Nov 2010 01:32:39 +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 521978FC1D;
	Wed,  3 Nov 2010 01:32: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 oA31Wd6x002916;
	Wed, 3 Nov 2010 01:32:39 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31WdeD002914;
	Wed, 3 Nov 2010 01:32:39 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201011030132.oA31WdeD002914@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 3 Nov 2010 01:32:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214723 - stable/8/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 01:32:39 -0000

Author: edwin
Date: Wed Nov  3 01:32:39 2010
New Revision: 214723
URL: http://svn.freebsd.org/changeset/base/214723

Log:
  MFC of r214722, tzdata2010o:
  
  - Fiji goes into DST three weeks earlier in 2011.

Modified:
  stable/8/share/zoneinfo/australasia
Directory Properties:
  stable/8/share/zoneinfo/   (props changed)

Modified: stable/8/share/zoneinfo/australasia
==============================================================================
--- stable/8/share/zoneinfo/australasia	Wed Nov  3 01:30:56 2010	(r214722)
+++ stable/8/share/zoneinfo/australasia	Wed Nov  3 01:32:39 2010	(r214723)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.18
+# @(#)australasia	8.20
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -284,13 +284,26 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 # http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
 # 
 
+# From Alexander Krivenyshev (2010-10-24):
+# According to Radio Fiji and Fiji Times online, Fiji will end DST 3 
+# weeks earlier than expected - on March 6, 2011, not March 27, 2011...
+# Here is confirmation from Government of the Republic of the Fiji Islands, 
+# Ministry of Information (fiji.gov.fj) web site:
+# 
+# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=2608:daylight-savings&catid=71:press-releases&Itemid=155
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_fiji04.html
+# 
+
 # 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	-	Mar	lastSun	3:00	0	-
 Rule	Fiji	2010	only	-	Oct	24	2:00	1:00	S
-Rule	Fiji	2011	only	-	Mar	lastSun 3:00	0	-
+Rule	Fiji	2011	only	-	Mar	Sun>=1	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
@@ -487,11 +500,21 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf
 # 
 
+# From Raymond Hughes (2010-10-07):
+# Please see
+# 
+# http://www.mcil.gov.ws
+# ,
+# the Ministry of Commerce, Industry and Labour (sideframe) "Last Sunday
+# September 2010 (26/09/10) - adjust clocks forward from 12:00 midnight
+# to 01:00am and First Sunday April 2011 (03/04/11) - adjust clocks
+# backwards from 1:00am to 12:00am"
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
 			-11:00	-	WST	2010 Sep 26
-			-11:00	1:00	WSDT	2011 Apr 3
+			-11:00	1:00	WSDT	2011 Apr 3 1:00
 			-11:00	-	WST
 
 # Solomon Is

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 01:32:45 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 022B210657C7;
	Wed,  3 Nov 2010 01:32:45 +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 C933C8FC12;
	Wed,  3 Nov 2010 01:32: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 oA31Wig4002954;
	Wed, 3 Nov 2010 01:32:44 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31WiM2002952;
	Wed, 3 Nov 2010 01:32:44 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201011030132.oA31WiM2002952@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 3 Nov 2010 01:32:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214724 - stable/7/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 01:32:45 -0000

Author: edwin
Date: Wed Nov  3 01:32:44 2010
New Revision: 214724
URL: http://svn.freebsd.org/changeset/base/214724

Log:
  MFC of r214722, tzdata2010o:
  
  - Fiji goes into DST three weeks earlier in 2011.

Modified:
  stable/7/share/zoneinfo/australasia
Directory Properties:
  stable/7/share/zoneinfo/   (props changed)

Modified: stable/7/share/zoneinfo/australasia
==============================================================================
--- stable/7/share/zoneinfo/australasia	Wed Nov  3 01:32:39 2010	(r214723)
+++ stable/7/share/zoneinfo/australasia	Wed Nov  3 01:32:44 2010	(r214724)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.18
+# @(#)australasia	8.20
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -284,13 +284,26 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 # http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
 # 
 
+# From Alexander Krivenyshev (2010-10-24):
+# According to Radio Fiji and Fiji Times online, Fiji will end DST 3 
+# weeks earlier than expected - on March 6, 2011, not March 27, 2011...
+# Here is confirmation from Government of the Republic of the Fiji Islands, 
+# Ministry of Information (fiji.gov.fj) web site:
+# 
+# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=2608:daylight-savings&catid=71:press-releases&Itemid=155
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_fiji04.html
+# 
+
 # 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	-	Mar	lastSun	3:00	0	-
 Rule	Fiji	2010	only	-	Oct	24	2:00	1:00	S
-Rule	Fiji	2011	only	-	Mar	lastSun 3:00	0	-
+Rule	Fiji	2011	only	-	Mar	Sun>=1	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
@@ -487,11 +500,21 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf
 # 
 
+# From Raymond Hughes (2010-10-07):
+# Please see
+# 
+# http://www.mcil.gov.ws
+# ,
+# the Ministry of Commerce, Industry and Labour (sideframe) "Last Sunday
+# September 2010 (26/09/10) - adjust clocks forward from 12:00 midnight
+# to 01:00am and First Sunday April 2011 (03/04/11) - adjust clocks
+# backwards from 1:00am to 12:00am"
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
 			-11:00	-	WST	2010 Sep 26
-			-11:00	1:00	WSDT	2011 Apr 3
+			-11:00	1:00	WSDT	2011 Apr 3 1:00
 			-11:00	-	WST
 
 # Solomon Is

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 01:32:50 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A893D1065794;
	Wed,  3 Nov 2010 01:32:50 +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 7B47B8FC16;
	Wed,  3 Nov 2010 01:32: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 oA31Wonk002993;
	Wed, 3 Nov 2010 01:32:50 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA31Wo58002991;
	Wed, 3 Nov 2010 01:32:50 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201011030132.oA31Wo58002991@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 3 Nov 2010 01:32:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214725 - stable/6/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 01:32:50 -0000

Author: edwin
Date: Wed Nov  3 01:32:50 2010
New Revision: 214725
URL: http://svn.freebsd.org/changeset/base/214725

Log:
  MFC of r214722, tzdata2010o:
  
  - Fiji goes into DST three weeks earlier in 2011.

Modified:
  stable/6/share/zoneinfo/australasia
Directory Properties:
  stable/6/share/zoneinfo/   (props changed)

Modified: stable/6/share/zoneinfo/australasia
==============================================================================
--- stable/6/share/zoneinfo/australasia	Wed Nov  3 01:32:44 2010	(r214724)
+++ stable/6/share/zoneinfo/australasia	Wed Nov  3 01:32:50 2010	(r214725)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.18
+# @(#)australasia	8.20
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -284,13 +284,26 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 # http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
 # 
 
+# From Alexander Krivenyshev (2010-10-24):
+# According to Radio Fiji and Fiji Times online, Fiji will end DST 3 
+# weeks earlier than expected - on March 6, 2011, not March 27, 2011...
+# Here is confirmation from Government of the Republic of the Fiji Islands, 
+# Ministry of Information (fiji.gov.fj) web site:
+# 
+# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=2608:daylight-savings&catid=71:press-releases&Itemid=155
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_fiji04.html
+# 
+
 # 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	-	Mar	lastSun	3:00	0	-
 Rule	Fiji	2010	only	-	Oct	24	2:00	1:00	S
-Rule	Fiji	2011	only	-	Mar	lastSun 3:00	0	-
+Rule	Fiji	2011	only	-	Mar	Sun>=1	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
@@ -487,11 +500,21 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf
 # 
 
+# From Raymond Hughes (2010-10-07):
+# Please see
+# 
+# http://www.mcil.gov.ws
+# ,
+# the Ministry of Commerce, Industry and Labour (sideframe) "Last Sunday
+# September 2010 (26/09/10) - adjust clocks forward from 12:00 midnight
+# to 01:00am and First Sunday April 2011 (03/04/11) - adjust clocks
+# backwards from 1:00am to 12:00am"
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
 			-11:00	-	WST	2010 Sep 26
-			-11:00	1:00	WSDT	2011 Apr 3
+			-11:00	1:00	WSDT	2011 Apr 3 1:00
 			-11:00	-	WST
 
 # Solomon Is

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 07:51:33 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 70C59106564A;
	Wed,  3 Nov 2010 07:51:33 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5EEDB8FC12;
	Wed,  3 Nov 2010 07:51: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 oA37pX68011896;
	Wed, 3 Nov 2010 07:51:33 GMT (envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA37pXab011894;
	Wed, 3 Nov 2010 07:51:33 GMT (envelope-from hselasky@svn.freebsd.org)
Message-Id: <201011030751.oA37pXab011894@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Wed, 3 Nov 2010 07:51: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: r214726 - head/sys/dev/usb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 07:51:33 -0000

Author: hselasky
Date: Wed Nov  3 07:51:33 2010
New Revision: 214726
URL: http://svn.freebsd.org/changeset/base/214726

Log:
  Clean up leftover USB device ID after r213856. This fixes:
  options USB_VERBOSE
  
  Submitted by:	Lucius Windschuh
  Approved by:	thompsa (mentor)

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Wed Nov  3 01:32:50 2010	(r214725)
+++ head/sys/dev/usb/usbdevs	Wed Nov  3 07:51:33 2010	(r214726)
@@ -3270,9 +3270,6 @@ product UMEDIA AR5523_2_NF	0x3206	AR5523
 /* Universal Access products */
 product UNIACCESS PANACHE	0x0101	Panache Surf USB ISDN Adapter
 
-/* Unknown vendors */
-product UNKNOWN5 USB2IDEBRIDGE	0x00ff	USB 2.0 ATA/SATA Bridge
-
 /* USI products */
 product USI MC60		0x10c5	MC60 Serial
 

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 08:34:01 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2B747106564A;
	Wed,  3 Nov 2010 08:34:01 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F2C7A8FC18;
	Wed,  3 Nov 2010 08: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 oA38Y0RA013031;
	Wed, 3 Nov 2010 08:34:00 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA38Y0IC013029;
	Wed, 3 Nov 2010 08:34:00 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011030834.oA38Y0IC013029@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 3 Nov 2010 08:34:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214727 - stable/8/sys/nfsserver
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 08:34:01 -0000

Author: kib
Date: Wed Nov  3 08:34:00 2010
New Revision: 214727
URL: http://svn.freebsd.org/changeset/base/214727

Log:
  MFC r214049:
  When readdirplus() is handled on the exported filesystem that does
  not support VFS_VGET, like msdosfs, do not call VOP_LOOKUP() for
  dotdot on the root directory. Our filesystems expect that VFS handles
  dotdot lookups on root on its own.

Modified:
  stable/8/sys/nfsserver/nfs_serv.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/nfsserver/nfs_serv.c
==============================================================================
--- stable/8/sys/nfsserver/nfs_serv.c	Wed Nov  3 07:51:33 2010	(r214726)
+++ stable/8/sys/nfsserver/nfs_serv.c	Wed Nov  3 08:34:00 2010	(r214727)
@@ -3036,7 +3036,7 @@ nfsrv_readdirplus(struct nfsrv_descript 
 	struct iovec iv;
 	struct vattr va, at, *vap = &va;
 	struct nfs_fattr *fp;
-	int len, nlen, rem, xfer, tsiz, i, error = 0, getret = 1;
+	int len, nlen, rem, xfer, tsiz, i, error = 0, error1, getret = 1;
 	int siz, cnt, fullsiz, eofflag, rdonly, dirlen, ncookies;
 	u_quad_t off, toff, verf;
 	u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */
@@ -3240,24 +3240,25 @@ again:
 				}
 				if (!VOP_ISLOCKED(vp))
 					vn_lock(vp, LK_SHARED | LK_RETRY);
-				if (VOP_LOOKUP(vp, &nvp, &cn) != 0)
+				if ((vp->v_vflag & VV_ROOT) != 0 &&
+				    (cn.cn_flags & ISDOTDOT) != 0) {
+					vref(vp);
+					nvp = vp;
+				} else if (VOP_LOOKUP(vp, &nvp, &cn) != 0)
 					goto invalid;
 			}
 
 			bzero((caddr_t)nfhp, NFSX_V3FH);
 			nfhp->fh_fsid = nvp->v_mount->mnt_stat.f_fsid;
-			if (VOP_VPTOFH(nvp, &nfhp->fh_fid)) {
+			if ((error1 = VOP_VPTOFH(nvp, &nfhp->fh_fid)) == 0)
+				error1 = VOP_GETATTR(nvp, vap, cred);
+			if (vp == nvp)
+				vunref(nvp);
+			else
 				vput(nvp);
-				nvp = NULL;
-				goto invalid;
-			}
-			if (VOP_GETATTR(nvp, vap, cred)) {
-				vput(nvp);
-				nvp = NULL;
-				goto invalid;
-			}
-			vput(nvp);
 			nvp = NULL;
+			if (error1 != 0)
+				goto invalid;
 
 			/*
 			 * If either the dircount or maxcount will be

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 09:23:09 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0D505106566B;
	Wed,  3 Nov 2010 09:23:09 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E47BB8FC0A;
	Wed,  3 Nov 2010 09:23:08 +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 oA39N8OC014151;
	Wed, 3 Nov 2010 09:23:08 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA39N8Ki014148;
	Wed, 3 Nov 2010 09:23:08 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011030923.oA39N8Ki014148@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 3 Nov 2010 09:23:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214728 - head/libexec/rtld-elf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 09:23:09 -0000

Author: kib
Date: Wed Nov  3 09:23:08 2010
New Revision: 214728
URL: http://svn.freebsd.org/changeset/base/214728

Log:
  If dlopen() is called for the dso that has been already loaded as a
  dependency, then the dso never has its DAG initialized. Empty DAG
  makes ref_dag() call in dlopen() a nop, and the dso refcount is off
  by one.
  
  Initialize the DAG on the first dlopen() call, using a boolean flag
  to prevent double initialization.
  
  From the PR (edited):
  Assume we have a library liba.so, containing a function a(), and a
  library libb.so, containing function b(). liba.so needs functionality
  from libb.so, so liba.so links in libb.so.
  
  An application doesn't know about the relation between these libraries,
  but needs to call a() and b(). It dlopen()s liba.so and obtains a
  pointer to a(), then it dlopen()s libb.so and obtains a pointer to b().
  
  As soon as the application doesn't need a() anymore, it dlclose()s liba.so.
  
  Expected result: the pointer to b() is still valid and can be called
  Actual result: the pointer to b() has become invalid, even though the
  application did not dlclose() the handle to libb.so. On calling b(), the
  application crashes with a segmentation fault.
  
  PR:	misc/151861
  Based on patch by:	jh
  Reviewed by:	kan
  Tested by:	Arjan van Leeuwen 
  MFC after:	1 week

Modified:
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Wed Nov  3 08:34:00 2010	(r214727)
+++ head/libexec/rtld-elf/rtld.c	Wed Nov  3 09:23:08 2010	(r214728)
@@ -1275,8 +1275,11 @@ init_dag(Obj_Entry *root)
 {
     DoneList donelist;
 
+    if (root->dag_inited)
+	    return;
     donelist_init(&donelist);
     init_dag1(root, root, &donelist);
+    root->dag_inited = true;
 }
 
 static void
@@ -2045,8 +2048,16 @@ dlopen(const char *name, int mode)
 	    }
 	} else {
 
-	    /* Bump the reference counts for objects on this DAG. */
-	    ref_dag(obj);
+	    /*
+	     * Bump the reference counts for objects on this DAG.  If
+	     * this is the first dlopen() call for the object that was
+	     * already loaded as a dependency, initialize the dag
+	     * starting at it.
+	     */
+	    if (obj->dl_refcount == 1)
+		init_dag(obj);
+	    else
+		ref_dag(obj);
 
 	    if (ld_tracing)
 		goto trace;

Modified: head/libexec/rtld-elf/rtld.h
==============================================================================
--- head/libexec/rtld-elf/rtld.h	Wed Nov  3 08:34:00 2010	(r214727)
+++ head/libexec/rtld-elf/rtld.h	Wed Nov  3 09:23:08 2010	(r214728)
@@ -222,6 +222,7 @@ typedef struct Struct_Obj_Entry {
     bool ref_nodel : 1;		/* Refcount increased to prevent dlclose */
     bool init_scanned: 1;	/* Object is already on init list. */
     bool on_fini_list: 1;	/* Object is already on fini list. */
+    bool dag_inited : 1;	/* Object has its DAG initialized. */
 
     struct link_map linkmap;	/* For GDB and dlinfo() */
     Objlist dldags;		/* Object belongs to these dlopened DAGs (%) */

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 10:10:34 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 920F01065670;
	Wed,  3 Nov 2010 10:10:34 +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 7F7EE8FC15;
	Wed,  3 Nov 2010 10:10: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 oA3AAYck015350;
	Wed, 3 Nov 2010 10:10:34 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3AAYjl015348;
	Wed, 3 Nov 2010 10:10:34 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201011031010.oA3AAYjl015348@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 3 Nov 2010 10:10:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214729 - stable/8/usr.bin/uudecode
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 10:10:34 -0000

Author: edwin
Date: Wed Nov  3 10:10:34 2010
New Revision: 214729
URL: http://svn.freebsd.org/changeset/base/214729

Log:
  MFC of r214002, r214010
  
  - Stylify of uudecode(1)
    Part of PR bin/124739.
  
  - "b64decode -r" did not handle arbitary breaks in base64 encoded
    data. White space should be accepted anywhere in a base64 encoded
    stream, not just after every chunk (4 characters).
  
    Test-scenario:
  
    VmVsb2NpdHkgUmV3YXJkcw==
  
    and
  
    VmVsb2NpdHkgUmV3YXJkcw
    ==
  
    should both produce "Velocity Rewards"
  
  PR:		bin/124739
  Submitted by:	Mark Andrews 

Modified:
  stable/8/usr.bin/uudecode/uudecode.c
Directory Properties:
  stable/8/usr.bin/uudecode/   (props changed)

Modified: stable/8/usr.bin/uudecode/uudecode.c
==============================================================================
--- stable/8/usr.bin/uudecode/uudecode.c	Wed Nov  3 09:23:08 2010	(r214728)
+++ stable/8/usr.bin/uudecode/uudecode.c	Wed Nov  3 10:10:34 2010	(r214729)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -87,7 +88,7 @@ main(int argc, char *argv[])
 		base64 = 1;
 
 	while ((ch = getopt(argc, argv, "cimo:prs")) != -1) {
-		switch(ch) {
+		switch (ch) {
 		case 'c':
 			if (oflag || rflag)
 				usage();
@@ -125,10 +126,10 @@ main(int argc, char *argv[])
 			usage();
 		}
 	}
-        argc -= optind;
-        argv += optind;
+	argc -= optind;
+	argv += optind;
 
-	if (*argv) {
+	if (*argv != NULL) {
 		rval = 0;
 		do {
 			infp = fopen(infile = *argv, "r");
@@ -184,7 +185,7 @@ decode2(void)
 	void *handle;
 	struct passwd *pw;
 	struct stat st;
-	char buf[MAXPATHLEN+1];
+	char buf[MAXPATHLEN + 1];
 
 	base64 = 0;
 	/* search for header line */
@@ -259,7 +260,7 @@ decode2(void)
 	if (pflag || strcmp(outfile, "/dev/stdout") == 0)
 		outfp = stdout;
 	else {
-		flags = O_WRONLY|O_CREAT|O_EXCL;
+		flags = O_WRONLY | O_CREAT | O_EXCL;
 		if (lstat(outfile, &st) == 0) {
 			if (iflag) {
 				warnc(EEXIST, "%s: %s", infile, outfile);
@@ -305,6 +306,7 @@ decode2(void)
 static int
 getline(char *buf, size_t size)
 {
+
 	if (fgets(buf, size, infp) != NULL)
 		return (2);
 	if (rflag)
@@ -341,17 +343,19 @@ uu_decode(void)
 	/* for each input line */
 	for (;;) {
 		switch (getline(buf, sizeof(buf))) {
-		case 0: return (0);
-		case 1: return (1);
+		case 0:
+			return (0);
+		case 1:
+			return (1);
 		}
 
-#define	DEC(c)	(((c) - ' ') & 077)		/* single character decode */
-#define IS_DEC(c) ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) )
+#define	DEC(c)		(((c) - ' ') & 077)	/* single character decode */
+#define IS_DEC(c)	 ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) )
 
 #define OUT_OF_RANGE do {						\
 	warnx("%s: %s: character out of range: [%d-%d]",		\
 	    infile, outfile, 1 + ' ', 077 + ' ' + 1);			\
-        return (1);							\
+	return (1);							\
 } while (0)
 
 		/*
@@ -364,8 +368,8 @@ uu_decode(void)
 		for (++p; i > 0; p += 4, i -= 3)
 			if (i >= 3) {
 				if (!(IS_DEC(*p) && IS_DEC(*(p + 1)) &&
-				     IS_DEC(*(p + 2)) && IS_DEC(*(p + 3))))
-                                	OUT_OF_RANGE;
+				    IS_DEC(*(p + 2)) && IS_DEC(*(p + 3))))
+					OUT_OF_RANGE;
 
 				ch = DEC(p[0]) << 2 | DEC(p[1]) >> 4;
 				putc(ch, outfp);
@@ -373,8 +377,7 @@ uu_decode(void)
 				putc(ch, outfp);
 				ch = DEC(p[2]) << 6 | DEC(p[3]);
 				putc(ch, outfp);
-			}
-			else {
+			} else {
 				if (i >= 1) {
 					if (!(IS_DEC(*p) && IS_DEC(*(p + 1))))
 	                                	OUT_OF_RANGE;
@@ -383,56 +386,85 @@ uu_decode(void)
 				}
 				if (i >= 2) {
 					if (!(IS_DEC(*(p + 1)) &&
-						IS_DEC(*(p + 2))))
-		                                OUT_OF_RANGE;
+					    IS_DEC(*(p + 2))))
+						OUT_OF_RANGE;
 
 					ch = DEC(p[1]) << 4 | DEC(p[2]) >> 2;
 					putc(ch, outfp);
 				}
 				if (i >= 3) {
 					if (!(IS_DEC(*(p + 2)) &&
-						IS_DEC(*(p + 3))))
-		                                OUT_OF_RANGE;
+					    IS_DEC(*(p + 3))))
+						OUT_OF_RANGE;
 					ch = DEC(p[2]) << 6 | DEC(p[3]);
 					putc(ch, outfp);
 				}
 			}
 	}
 	switch (getline(buf, sizeof(buf))) {
-	case 0:  return (0);
-	case 1:  return (1);
-	default: return (checkend(buf, "end", "no \"end\" line"));
+	case 0:
+		return (0);
+	case 1:
+		return (1);
+	default:
+		return (checkend(buf, "end", "no \"end\" line"));
 	}
 }
 
 static int
 base64_decode(void)
 {
-	int n;
-	char inbuf[MAXPATHLEN+1];
+	int n, count, count4;
+	char inbuf[MAXPATHLEN + 1], *p;
 	unsigned char outbuf[MAXPATHLEN * 4];
+	char leftover[MAXPATHLEN + 1];
 
+	leftover[0] = '\0';
 	for (;;) {
-		switch (getline(inbuf, sizeof(inbuf))) {
-		case 0: return (0);
-		case 1: return (1);
+		strcpy(inbuf, leftover);
+		switch (getline(inbuf + strlen(inbuf),
+		    sizeof(inbuf) - strlen(inbuf))) {
+		case 0:
+			return (0);
+		case 1:
+			return (1);
 		}
+
+		count = 0;
+		count4 = -1;
+		p = inbuf;
+		while (*p != '\0') {
+			/*
+			 * Base64 encoded strings have the following
+			 * characters in them: A-Z, a-z, 0-9 and +, / and =
+			 */
+			if (isalnum(*p) || *p == '+' || *p == '/' || *p == '=')
+				count++;
+			if (count % 4 == 0)
+				count4 = p - inbuf;
+			p++;
+		}
+
+		strcpy(leftover, inbuf + count4 + 1);
+		inbuf[count4 + 1] = 0;
+
 		n = b64_pton(inbuf, outbuf, sizeof(outbuf));
+
 		if (n < 0)
 			break;
 		fwrite(outbuf, 1, n, outfp);
 	}
-	return (checkend(inbuf, "====",
-		    "error decoding base64 input stream"));
+	return (checkend(inbuf, "====", "error decoding base64 input stream"));
 }
 
 static void
 usage(void)
 {
+
 	(void)fprintf(stderr,
-"usage: uudecode [-cimprs] [file ...]\n"
-"       uudecode [-i] -o output_file [file]\n"
-"       b64decode [-cimprs] [file ...]\n"
-"       b64decode [-i] -o output_file [file]\n");
+	    "usage: uudecode [-cimprs] [file ...]\n"
+	    "       uudecode [-i] -o output_file [file]\n"
+	    "       b64decode [-cimprs] [file ...]\n"
+	    "       b64decode [-i] -o output_file [file]\n");
 	exit(1);
 }

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 10:12:13 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 98D171065670;
	Wed,  3 Nov 2010 10:12:13 +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 864028FC20;
	Wed,  3 Nov 2010 10:12: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 oA3ACDME015466;
	Wed, 3 Nov 2010 10:12:13 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3ACDeW015464;
	Wed, 3 Nov 2010 10:12:13 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201011031012.oA3ACDeW015464@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 3 Nov 2010 10:12:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214730 - stable/7/usr.bin/uudecode
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 10:12:13 -0000

Author: edwin
Date: Wed Nov  3 10:12:13 2010
New Revision: 214730
URL: http://svn.freebsd.org/changeset/base/214730

Log:
  MFC of r214002, r214010
  
  - Stylify of uudecode(1)
    Part of PR bin/124739.
  
  - "b64decode -r" did not handle arbitary breaks in base64 encoded
    data. White space should be accepted anywhere in a base64 encoded
    stream, not just after every chunk (4 characters).
  
    Test-scenario:
  
    VmVsb2NpdHkgUmV3YXJkcw==
  
    and
  
    VmVsb2NpdHkgUmV3YXJkcw
    ==
  
    should both produce "Velocity Rewards"
  
  PR:             bin/124739
  Submitted by:   Mark Andrews 

Modified:
  stable/7/usr.bin/uudecode/uudecode.c
Directory Properties:
  stable/7/usr.bin/uudecode/   (props changed)

Modified: stable/7/usr.bin/uudecode/uudecode.c
==============================================================================
--- stable/7/usr.bin/uudecode/uudecode.c	Wed Nov  3 10:10:34 2010	(r214729)
+++ stable/7/usr.bin/uudecode/uudecode.c	Wed Nov  3 10:12:13 2010	(r214730)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -87,7 +88,7 @@ main(int argc, char *argv[])
 		base64 = 1;
 
 	while ((ch = getopt(argc, argv, "cimo:prs")) != -1) {
-		switch(ch) {
+		switch (ch) {
 		case 'c':
 			if (oflag || rflag)
 				usage();
@@ -125,10 +126,10 @@ main(int argc, char *argv[])
 			usage();
 		}
 	}
-        argc -= optind;
-        argv += optind;
+	argc -= optind;
+	argv += optind;
 
-	if (*argv) {
+	if (*argv != NULL) {
 		rval = 0;
 		do {
 			infp = fopen(infile = *argv, "r");
@@ -184,7 +185,7 @@ decode2(void)
 	void *handle;
 	struct passwd *pw;
 	struct stat st;
-	char buf[MAXPATHLEN+1];
+	char buf[MAXPATHLEN + 1];
 
 	base64 = 0;
 	/* search for header line */
@@ -259,7 +260,7 @@ decode2(void)
 	if (pflag || strcmp(outfile, "/dev/stdout") == 0)
 		outfp = stdout;
 	else {
-		flags = O_WRONLY|O_CREAT|O_EXCL;
+		flags = O_WRONLY | O_CREAT | O_EXCL;
 		if (lstat(outfile, &st) == 0) {
 			if (iflag) {
 				warnc(EEXIST, "%s: %s", infile, outfile);
@@ -305,6 +306,7 @@ decode2(void)
 static int
 getline(char *buf, size_t size)
 {
+
 	if (fgets(buf, size, infp) != NULL)
 		return (2);
 	if (rflag)
@@ -341,17 +343,19 @@ uu_decode(void)
 	/* for each input line */
 	for (;;) {
 		switch (getline(buf, sizeof(buf))) {
-		case 0: return (0);
-		case 1: return (1);
+		case 0:
+			return (0);
+		case 1:
+			return (1);
 		}
 
-#define	DEC(c)	(((c) - ' ') & 077)		/* single character decode */
-#define IS_DEC(c) ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) )
+#define	DEC(c)		(((c) - ' ') & 077)	/* single character decode */
+#define IS_DEC(c)	 ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) )
 
 #define OUT_OF_RANGE do {						\
 	warnx("%s: %s: character out of range: [%d-%d]",		\
 	    infile, outfile, 1 + ' ', 077 + ' ' + 1);			\
-        return (1);							\
+	return (1);							\
 } while (0)
 
 		/*
@@ -364,8 +368,8 @@ uu_decode(void)
 		for (++p; i > 0; p += 4, i -= 3)
 			if (i >= 3) {
 				if (!(IS_DEC(*p) && IS_DEC(*(p + 1)) &&
-				     IS_DEC(*(p + 2)) && IS_DEC(*(p + 3))))
-                                	OUT_OF_RANGE;
+				    IS_DEC(*(p + 2)) && IS_DEC(*(p + 3))))
+					OUT_OF_RANGE;
 
 				ch = DEC(p[0]) << 2 | DEC(p[1]) >> 4;
 				putc(ch, outfp);
@@ -373,8 +377,7 @@ uu_decode(void)
 				putc(ch, outfp);
 				ch = DEC(p[2]) << 6 | DEC(p[3]);
 				putc(ch, outfp);
-			}
-			else {
+			} else {
 				if (i >= 1) {
 					if (!(IS_DEC(*p) && IS_DEC(*(p + 1))))
 	                                	OUT_OF_RANGE;
@@ -383,56 +386,85 @@ uu_decode(void)
 				}
 				if (i >= 2) {
 					if (!(IS_DEC(*(p + 1)) &&
-						IS_DEC(*(p + 2))))
-		                                OUT_OF_RANGE;
+					    IS_DEC(*(p + 2))))
+						OUT_OF_RANGE;
 
 					ch = DEC(p[1]) << 4 | DEC(p[2]) >> 2;
 					putc(ch, outfp);
 				}
 				if (i >= 3) {
 					if (!(IS_DEC(*(p + 2)) &&
-						IS_DEC(*(p + 3))))
-		                                OUT_OF_RANGE;
+					    IS_DEC(*(p + 3))))
+						OUT_OF_RANGE;
 					ch = DEC(p[2]) << 6 | DEC(p[3]);
 					putc(ch, outfp);
 				}
 			}
 	}
 	switch (getline(buf, sizeof(buf))) {
-	case 0:  return (0);
-	case 1:  return (1);
-	default: return (checkend(buf, "end", "no \"end\" line"));
+	case 0:
+		return (0);
+	case 1:
+		return (1);
+	default:
+		return (checkend(buf, "end", "no \"end\" line"));
 	}
 }
 
 static int
 base64_decode(void)
 {
-	int n;
-	char inbuf[MAXPATHLEN+1];
+	int n, count, count4;
+	char inbuf[MAXPATHLEN + 1], *p;
 	unsigned char outbuf[MAXPATHLEN * 4];
+	char leftover[MAXPATHLEN + 1];
 
+	leftover[0] = '\0';
 	for (;;) {
-		switch (getline(inbuf, sizeof(inbuf))) {
-		case 0: return (0);
-		case 1: return (1);
+		strcpy(inbuf, leftover);
+		switch (getline(inbuf + strlen(inbuf),
+		    sizeof(inbuf) - strlen(inbuf))) {
+		case 0:
+			return (0);
+		case 1:
+			return (1);
 		}
+
+		count = 0;
+		count4 = -1;
+		p = inbuf;
+		while (*p != '\0') {
+			/*
+			 * Base64 encoded strings have the following
+			 * characters in them: A-Z, a-z, 0-9 and +, / and =
+			 */
+			if (isalnum(*p) || *p == '+' || *p == '/' || *p == '=')
+				count++;
+			if (count % 4 == 0)
+				count4 = p - inbuf;
+			p++;
+		}
+
+		strcpy(leftover, inbuf + count4 + 1);
+		inbuf[count4 + 1] = 0;
+
 		n = b64_pton(inbuf, outbuf, sizeof(outbuf));
+
 		if (n < 0)
 			break;
 		fwrite(outbuf, 1, n, outfp);
 	}
-	return (checkend(inbuf, "====",
-		    "error decoding base64 input stream"));
+	return (checkend(inbuf, "====", "error decoding base64 input stream"));
 }
 
 static void
 usage(void)
 {
+
 	(void)fprintf(stderr,
-"usage: uudecode [-cimprs] [file ...]\n"
-"       uudecode [-i] -o output_file [file]\n"
-"       b64decode [-cimprs] [file ...]\n"
-"       b64decode [-i] -o output_file [file]\n");
+	    "usage: uudecode [-cimprs] [file ...]\n"
+	    "       uudecode [-i] -o output_file [file]\n"
+	    "       b64decode [-cimprs] [file ...]\n"
+	    "       b64decode [-i] -o output_file [file]\n");
 	exit(1);
 }

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 10:23:06 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 933CF106564A;
	Wed,  3 Nov 2010 10:23:06 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 816518FC17;
	Wed,  3 Nov 2010 10:23: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 oA3AN6Z7015785;
	Wed, 3 Nov 2010 10:23:06 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3AN6AY015783;
	Wed, 3 Nov 2010 10:23:06 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <201011031023.oA3AN6AY015783@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 3 Nov 2010 10:23:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214731 - stable/8/usr.bin/truss
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 10:23:06 -0000

Author: ed
Date: Wed Nov  3 10:23:06 2010
New Revision: 214731
URL: http://svn.freebsd.org/changeset/base/214731

Log:
  MFC r214105:
  
    Remove setpgid() call before executing child process.
  
    Using a separate process group here is bad, since (for example) job
    control in the TTY layer prevents interaction with the TTY, causing the
    child process to hang.

Modified:
  stable/8/usr.bin/truss/setup.c
Directory Properties:
  stable/8/usr.bin/truss/   (props changed)

Modified: stable/8/usr.bin/truss/setup.c
==============================================================================
--- stable/8/usr.bin/truss/setup.c	Wed Nov  3 10:12:13 2010	(r214730)
+++ stable/8/usr.bin/truss/setup.c	Wed Nov  3 10:23:06 2010	(r214731)
@@ -78,7 +78,6 @@ setup_and_wait(char *command[])
 	}
 	if (pid == 0) {	/* Child */
 		ptrace(PT_TRACE_ME, 0, 0, 0);
-		setpgid (0, 0); 
 		execvp(command[0], command);
 		err(1, "execvp %s", command[0]);
 	}

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 10:24:57 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D7C50106564A;
	Wed,  3 Nov 2010 10:24:57 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C63578FC0A;
	Wed,  3 Nov 2010 10:24: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 oA3AOvWL015884;
	Wed, 3 Nov 2010 10:24:57 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3AOvXL015882;
	Wed, 3 Nov 2010 10:24:57 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <201011031024.oA3AOvXL015882@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 3 Nov 2010 10:24:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214732 - stable/7/usr.bin/truss
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 10:24:58 -0000

Author: ed
Date: Wed Nov  3 10:24:57 2010
New Revision: 214732
URL: http://svn.freebsd.org/changeset/base/214732

Log:
  MFC r214105:
  
    Remove setpgid() call before executing child process.
  
    Using a separate process group here is bad, since (for example) job
    control in the TTY layer prevents interaction with the TTY, causing the
    child process to hang.

Modified:
  stable/7/usr.bin/truss/setup.c
Directory Properties:
  stable/7/usr.bin/truss/   (props changed)

Modified: stable/7/usr.bin/truss/setup.c
==============================================================================
--- stable/7/usr.bin/truss/setup.c	Wed Nov  3 10:23:06 2010	(r214731)
+++ stable/7/usr.bin/truss/setup.c	Wed Nov  3 10:24:57 2010	(r214732)
@@ -78,7 +78,6 @@ setup_and_wait(char *command[])
 	}
 	if (pid == 0) {	/* Child */
 		ptrace(PT_TRACE_ME, 0, 0, 0);
-		setpgid (0, 0); 
 		execvp(command[0], command);
 		err(1, "execvp %s", command[0]);
 	}

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 10:43:39 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2A32E1065672;
	Wed,  3 Nov 2010 10:43:39 +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 1321E8FC12;
	Wed,  3 Nov 2010 10:43: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 oA3AhdsQ018146;
	Wed, 3 Nov 2010 10:43:39 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3Ahdf8018142;
	Wed, 3 Nov 2010 10:43:39 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <201011031043.oA3Ahdf8018142@svn.freebsd.org>
From: Rui Paulo 
Date: Wed, 3 Nov 2010 10:43: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: r214734 - in head/contrib/wpa: hostapd hostapd/logwatch
	patches src src/ap src/common src/crypto src/drivers
	src/eap_common src/eap_peer src/eap_server src/eapol_auth
	src/eapol_supp src...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 10:43:39 -0000

Author: rpaulo
Date: Wed Nov  3 10:43:38 2010
New Revision: 214734
URL: http://svn.freebsd.org/changeset/base/214734

Log:
  Merge wpa_supplicant and hostapd 0.7.3.

Added:
  head/contrib/wpa/patches/
     - copied from r214505, vendor/wpa/dist/patches/
  head/contrib/wpa/src/ap/
     - copied from r214505, vendor/wpa/dist/src/ap/
  head/contrib/wpa/src/crypto/.gitignore
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/.gitignore
  head/contrib/wpa/src/crypto/aes-cbc.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-cbc.c
  head/contrib/wpa/src/crypto/aes-ctr.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-ctr.c
  head/contrib/wpa/src/crypto/aes-eax.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-eax.c
  head/contrib/wpa/src/crypto/aes-encblock.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-encblock.c
  head/contrib/wpa/src/crypto/aes-internal-dec.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-internal-dec.c
  head/contrib/wpa/src/crypto/aes-internal-enc.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-internal-enc.c
  head/contrib/wpa/src/crypto/aes-internal.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-internal.c
  head/contrib/wpa/src/crypto/aes-omac1.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-omac1.c
  head/contrib/wpa/src/crypto/aes-unwrap.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-unwrap.c
  head/contrib/wpa/src/crypto/aes-wrap.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes-wrap.c
  head/contrib/wpa/src/crypto/aes_i.h
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/aes_i.h
  head/contrib/wpa/src/crypto/crypto_internal-cipher.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/crypto_internal-cipher.c
  head/contrib/wpa/src/crypto/crypto_internal-modexp.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/crypto_internal-modexp.c
  head/contrib/wpa/src/crypto/crypto_internal-rsa.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/crypto_internal-rsa.c
  head/contrib/wpa/src/crypto/crypto_nss.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/crypto_nss.c
  head/contrib/wpa/src/crypto/des-internal.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/des-internal.c
  head/contrib/wpa/src/crypto/des_i.h
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/des_i.h
  head/contrib/wpa/src/crypto/dh_group5.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/dh_group5.c
  head/contrib/wpa/src/crypto/dh_group5.h
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/dh_group5.h
  head/contrib/wpa/src/crypto/fips_prf_cryptoapi.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/fips_prf_cryptoapi.c
  head/contrib/wpa/src/crypto/fips_prf_gnutls.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/fips_prf_gnutls.c
  head/contrib/wpa/src/crypto/fips_prf_internal.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/fips_prf_internal.c
  head/contrib/wpa/src/crypto/fips_prf_nss.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/fips_prf_nss.c
  head/contrib/wpa/src/crypto/fips_prf_openssl.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/fips_prf_openssl.c
  head/contrib/wpa/src/crypto/md4-internal.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/md4-internal.c
  head/contrib/wpa/src/crypto/md5-internal.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/md5-internal.c
  head/contrib/wpa/src/crypto/md5-non-fips.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/md5-non-fips.c
  head/contrib/wpa/src/crypto/md5_i.h
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/md5_i.h
  head/contrib/wpa/src/crypto/milenage.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/milenage.c
  head/contrib/wpa/src/crypto/milenage.h
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/milenage.h
  head/contrib/wpa/src/crypto/sha1-internal.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/sha1-internal.c
  head/contrib/wpa/src/crypto/sha1-pbkdf2.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/sha1-pbkdf2.c
  head/contrib/wpa/src/crypto/sha1-tlsprf.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/sha1-tlsprf.c
  head/contrib/wpa/src/crypto/sha1-tprf.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/sha1-tprf.c
  head/contrib/wpa/src/crypto/sha1_i.h
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/sha1_i.h
  head/contrib/wpa/src/crypto/sha256-internal.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/sha256-internal.c
  head/contrib/wpa/src/crypto/tls_nss.c
     - copied unchanged from r214505, vendor/wpa/dist/src/crypto/tls_nss.c
  head/contrib/wpa/src/drivers/.gitignore
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/.gitignore
  head/contrib/wpa/src/drivers/driver_atheros.c
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/driver_atheros.c
  head/contrib/wpa/src/drivers/driver_none.c
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/driver_none.c
  head/contrib/wpa/src/drivers/drivers.mak
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/drivers.mak
  head/contrib/wpa/src/drivers/linux_ioctl.c
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/linux_ioctl.c
  head/contrib/wpa/src/drivers/linux_ioctl.h
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/linux_ioctl.h
  head/contrib/wpa/src/drivers/netlink.c
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/netlink.c
  head/contrib/wpa/src/drivers/netlink.h
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/netlink.h
  head/contrib/wpa/src/drivers/nl80211_copy.h
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/nl80211_copy.h
  head/contrib/wpa/src/drivers/wireless_copy.h
     - copied unchanged from r214505, vendor/wpa/dist/src/drivers/wireless_copy.h
  head/contrib/wpa/src/eap_server/eap_server.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server.c
  head/contrib/wpa/src/eap_server/eap_server_aka.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_aka.c
  head/contrib/wpa/src/eap_server/eap_server_fast.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_fast.c
  head/contrib/wpa/src/eap_server/eap_server_gpsk.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_gpsk.c
  head/contrib/wpa/src/eap_server/eap_server_gtc.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_gtc.c
  head/contrib/wpa/src/eap_server/eap_server_identity.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_identity.c
  head/contrib/wpa/src/eap_server/eap_server_ikev2.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_ikev2.c
  head/contrib/wpa/src/eap_server/eap_server_md5.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_md5.c
  head/contrib/wpa/src/eap_server/eap_server_methods.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_methods.c
  head/contrib/wpa/src/eap_server/eap_server_mschapv2.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_mschapv2.c
  head/contrib/wpa/src/eap_server/eap_server_pax.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_pax.c
  head/contrib/wpa/src/eap_server/eap_server_peap.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_peap.c
  head/contrib/wpa/src/eap_server/eap_server_psk.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_psk.c
  head/contrib/wpa/src/eap_server/eap_server_sake.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_sake.c
  head/contrib/wpa/src/eap_server/eap_server_sim.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_sim.c
  head/contrib/wpa/src/eap_server/eap_server_tls.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_tls.c
  head/contrib/wpa/src/eap_server/eap_server_tls_common.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_tls_common.c
  head/contrib/wpa/src/eap_server/eap_server_tnc.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_tnc.c
  head/contrib/wpa/src/eap_server/eap_server_ttls.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_ttls.c
  head/contrib/wpa/src/eap_server/eap_server_vendor_test.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_vendor_test.c
  head/contrib/wpa/src/eap_server/eap_server_wsc.c
     - copied unchanged from r214505, vendor/wpa/dist/src/eap_server/eap_server_wsc.c
  head/contrib/wpa/src/eapol_auth/
     - copied from r214505, vendor/wpa/dist/src/eapol_auth/
  head/contrib/wpa/src/lib.rules
     - copied unchanged from r214505, vendor/wpa/dist/src/lib.rules
  head/contrib/wpa/src/radius/.gitignore
     - copied unchanged from r214505, vendor/wpa/dist/src/radius/.gitignore
  head/contrib/wpa/src/tls/.gitignore
     - copied unchanged from r214505, vendor/wpa/dist/src/tls/.gitignore
  head/contrib/wpa/src/tls/pkcs1.c
     - copied unchanged from r214505, vendor/wpa/dist/src/tls/pkcs1.c
  head/contrib/wpa/src/tls/pkcs1.h
     - copied unchanged from r214505, vendor/wpa/dist/src/tls/pkcs1.h
  head/contrib/wpa/src/tls/pkcs5.c
     - copied unchanged from r214505, vendor/wpa/dist/src/tls/pkcs5.c
  head/contrib/wpa/src/tls/pkcs5.h
     - copied unchanged from r214505, vendor/wpa/dist/src/tls/pkcs5.h
  head/contrib/wpa/src/tls/pkcs8.c
     - copied unchanged from r214505, vendor/wpa/dist/src/tls/pkcs8.c
  head/contrib/wpa/src/tls/pkcs8.h
     - copied unchanged from r214505, vendor/wpa/dist/src/tls/pkcs8.h
  head/contrib/wpa/src/utils/.gitignore
     - copied unchanged from r214505, vendor/wpa/dist/src/utils/.gitignore
  head/contrib/wpa/src/utils/list.h
     - copied unchanged from r214505, vendor/wpa/dist/src/utils/list.h
  head/contrib/wpa/src/utils/radiotap.c
     - copied unchanged from r214505, vendor/wpa/dist/src/utils/radiotap.c
  head/contrib/wpa/src/utils/radiotap.h
     - copied unchanged from r214505, vendor/wpa/dist/src/utils/radiotap.h
  head/contrib/wpa/src/utils/radiotap_iter.h
     - copied unchanged from r214505, vendor/wpa/dist/src/utils/radiotap_iter.h
  head/contrib/wpa/src/utils/trace.c
     - copied unchanged from r214505, vendor/wpa/dist/src/utils/trace.c
  head/contrib/wpa/src/utils/trace.h
     - copied unchanged from r214505, vendor/wpa/dist/src/utils/trace.h
  head/contrib/wpa/src/wps/http.h
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/http.h
  head/contrib/wpa/src/wps/http_client.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/http_client.c
  head/contrib/wpa/src/wps/http_client.h
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/http_client.h
  head/contrib/wpa/src/wps/http_server.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/http_server.c
  head/contrib/wpa/src/wps/http_server.h
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/http_server.h
  head/contrib/wpa/src/wps/ndef.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/ndef.c
  head/contrib/wpa/src/wps/upnp_xml.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/upnp_xml.c
  head/contrib/wpa/src/wps/upnp_xml.h
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/upnp_xml.h
  head/contrib/wpa/src/wps/wps_er.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/wps_er.c
  head/contrib/wpa/src/wps/wps_er.h
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/wps_er.h
  head/contrib/wpa/src/wps/wps_er_ssdp.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/wps_er_ssdp.c
  head/contrib/wpa/src/wps/wps_nfc.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/wps_nfc.c
  head/contrib/wpa/src/wps/wps_nfc_pn531.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/wps_nfc_pn531.c
  head/contrib/wpa/src/wps/wps_ufd.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/wps_ufd.c
  head/contrib/wpa/src/wps/wps_upnp_ap.c
     - copied unchanged from r214505, vendor/wpa/dist/src/wps/wps_upnp_ap.c
  head/contrib/wpa/wpa_supplicant/.gitignore
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/.gitignore
  head/contrib/wpa/wpa_supplicant/ap.c
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/ap.c
  head/contrib/wpa/wpa_supplicant/ap.h
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/ap.h
  head/contrib/wpa/wpa_supplicant/bgscan.c
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/bgscan.c
  head/contrib/wpa/wpa_supplicant/bgscan.h
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/bgscan.h
  head/contrib/wpa/wpa_supplicant/bgscan_simple.c
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/bgscan_simple.c
  head/contrib/wpa/wpa_supplicant/bss.c
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/bss.c
  head/contrib/wpa/wpa_supplicant/bss.h
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/bss.h
  head/contrib/wpa/wpa_supplicant/dbus/
     - copied from r214505, vendor/wpa/dist/wpa_supplicant/dbus/
  head/contrib/wpa/wpa_supplicant/doc/docbook/.gitignore
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/doc/docbook/.gitignore
  head/contrib/wpa/wpa_supplicant/driver_i.h
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/driver_i.h
  head/contrib/wpa/wpa_supplicant/eap_register.c
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/eap_register.c
  head/contrib/wpa/wpa_supplicant/examples/60_wpa_supplicant
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/examples/60_wpa_supplicant
  head/contrib/wpa/wpa_supplicant/examples/wpas-dbus-new-getall.py
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/examples/wpas-dbus-new-getall.py
  head/contrib/wpa/wpa_supplicant/examples/wpas-dbus-new-signals.py
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/examples/wpas-dbus-new-signals.py
  head/contrib/wpa/wpa_supplicant/examples/wpas-dbus-new-wps.py
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/examples/wpas-dbus-new-wps.py
  head/contrib/wpa/wpa_supplicant/examples/wpas-dbus-new.py
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/examples/wpas-dbus-new.py
  head/contrib/wpa/wpa_supplicant/ibss_rsn.c
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/ibss_rsn.c
  head/contrib/wpa/wpa_supplicant/ibss_rsn.h
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/ibss_rsn.h
  head/contrib/wpa/wpa_supplicant/notify.c
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/notify.c
  head/contrib/wpa/wpa_supplicant/notify.h
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/notify.h
  head/contrib/wpa/wpa_supplicant/scan.h
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/scan.h
  head/contrib/wpa/wpa_supplicant/sme.c
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/sme.c
  head/contrib/wpa/wpa_supplicant/sme.h
     - copied unchanged from r214505, vendor/wpa/dist/wpa_supplicant/sme.h
  head/contrib/wpa/wpa_supplicant/xcode/
     - copied from r214505, vendor/wpa/dist/wpa_supplicant/xcode/
Replaced:
  head/contrib/wpa/hostapd/
     - copied from r214505, vendor/wpa/dist/hostapd/
  head/contrib/wpa/hostapd/ChangeLog
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/ChangeLog
  head/contrib/wpa/hostapd/Makefile
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/Makefile
  head/contrib/wpa/hostapd/README
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/README
  head/contrib/wpa/hostapd/README-WPS
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/README-WPS
  head/contrib/wpa/hostapd/ctrl_iface.c
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/ctrl_iface.c
  head/contrib/wpa/hostapd/ctrl_iface.h
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/ctrl_iface.h
  head/contrib/wpa/hostapd/defconfig
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/defconfig
  head/contrib/wpa/hostapd/eap_testing.txt
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/eap_testing.txt
  head/contrib/wpa/hostapd/hostapd.8
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd.8
  head/contrib/wpa/hostapd/hostapd.accept
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd.accept
  head/contrib/wpa/hostapd/hostapd.conf
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd.conf
  head/contrib/wpa/hostapd/hostapd.deny
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd.deny
  head/contrib/wpa/hostapd/hostapd.eap_user
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd.eap_user
  head/contrib/wpa/hostapd/hostapd.radius_clients
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd.radius_clients
  head/contrib/wpa/hostapd/hostapd.sim_db
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd.sim_db
  head/contrib/wpa/hostapd/hostapd.vlan
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd.vlan
  head/contrib/wpa/hostapd/hostapd.wpa_psk
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd.wpa_psk
  head/contrib/wpa/hostapd/hostapd_cli.1
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd_cli.1
  head/contrib/wpa/hostapd/hostapd_cli.c
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/hostapd_cli.c
  head/contrib/wpa/hostapd/logwatch/
     - copied from r214505, vendor/wpa/dist/hostapd/logwatch/
  head/contrib/wpa/hostapd/logwatch/README
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/logwatch/README
  head/contrib/wpa/hostapd/logwatch/hostapd
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/logwatch/hostapd
  head/contrib/wpa/hostapd/logwatch/hostapd.conf
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/logwatch/hostapd.conf
  head/contrib/wpa/hostapd/nt_password_hash.c
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/nt_password_hash.c
  head/contrib/wpa/hostapd/wired.conf
     - copied unchanged from r214505, vendor/wpa/dist/hostapd/wired.conf
Deleted:
  head/contrib/wpa/src/common/nl80211_copy.h
  head/contrib/wpa/src/common/wireless_copy.h
  head/contrib/wpa/src/crypto/aes.c
  head/contrib/wpa/src/crypto/aes_wrap.c
  head/contrib/wpa/src/crypto/des.c
  head/contrib/wpa/src/crypto/md4.c
  head/contrib/wpa/src/crypto/rc4.h
  head/contrib/wpa/src/drivers/radiotap.c
  head/contrib/wpa/src/drivers/radiotap.h
  head/contrib/wpa/src/drivers/radiotap_iter.h
  head/contrib/wpa/src/drivers/scan_helpers.c
  head/contrib/wpa/src/eap_server/eap.c
  head/contrib/wpa/src/eap_server/eap_aka.c
  head/contrib/wpa/src/eap_server/eap_fast.c
  head/contrib/wpa/src/eap_server/eap_gpsk.c
  head/contrib/wpa/src/eap_server/eap_gtc.c
  head/contrib/wpa/src/eap_server/eap_identity.c
  head/contrib/wpa/src/eap_server/eap_ikev2.c
  head/contrib/wpa/src/eap_server/eap_md5.c
  head/contrib/wpa/src/eap_server/eap_methods.c
  head/contrib/wpa/src/eap_server/eap_mschapv2.c
  head/contrib/wpa/src/eap_server/eap_pax.c
  head/contrib/wpa/src/eap_server/eap_peap.c
  head/contrib/wpa/src/eap_server/eap_psk.c
  head/contrib/wpa/src/eap_server/eap_sake.c
  head/contrib/wpa/src/eap_server/eap_sim.c
  head/contrib/wpa/src/eap_server/eap_tls.c
  head/contrib/wpa/src/eap_server/eap_tls_common.c
  head/contrib/wpa/src/eap_server/eap_tnc.c
  head/contrib/wpa/src/eap_server/eap_ttls.c
  head/contrib/wpa/src/eap_server/eap_vendor_test.c
  head/contrib/wpa/src/eap_server/eap_wsc.c
  head/contrib/wpa/src/hlr_auc_gw/Makefile
  head/contrib/wpa/src/hlr_auc_gw/hlr_auc_gw.c
  head/contrib/wpa/src/hlr_auc_gw/hlr_auc_gw.milenage_db
  head/contrib/wpa/src/hlr_auc_gw/milenage.c
  head/contrib/wpa/src/hlr_auc_gw/milenage.h
  head/contrib/wpa/src/tls/asn1_test.c
  head/contrib/wpa/wpa_supplicant/ctrl_iface_dbus.c
  head/contrib/wpa/wpa_supplicant/ctrl_iface_dbus.h
  head/contrib/wpa/wpa_supplicant/ctrl_iface_dbus_handlers.c
  head/contrib/wpa/wpa_supplicant/ctrl_iface_dbus_handlers.h
  head/contrib/wpa/wpa_supplicant/dbus-wpa_supplicant.conf
  head/contrib/wpa/wpa_supplicant/dbus-wpa_supplicant.service
  head/contrib/wpa/wpa_supplicant/dbus_dict_helpers.c
  head/contrib/wpa/wpa_supplicant/dbus_dict_helpers.h
  head/contrib/wpa/wpa_supplicant/doc/code_structure.doxygen
  head/contrib/wpa/wpa_supplicant/doc/ctrl_iface.doxygen
  head/contrib/wpa/wpa_supplicant/doc/doxygen.fast
  head/contrib/wpa/wpa_supplicant/doc/doxygen.full
  head/contrib/wpa/wpa_supplicant/doc/driver_wrapper.doxygen
  head/contrib/wpa/wpa_supplicant/doc/eap.doxygen
  head/contrib/wpa/wpa_supplicant/doc/kerneldoc2doxygen.pl
  head/contrib/wpa/wpa_supplicant/doc/mainpage.doxygen
  head/contrib/wpa/wpa_supplicant/doc/porting.doxygen
  head/contrib/wpa/wpa_supplicant/doc/testing_tools.doxygen
  head/contrib/wpa/wpa_supplicant/doc/wpa_supplicant.fig
  head/contrib/wpa/wpa_supplicant/tests/test_aes.c
  head/contrib/wpa/wpa_supplicant/tests/test_md4.c
  head/contrib/wpa/wpa_supplicant/tests/test_md5.c
  head/contrib/wpa/wpa_supplicant/tests/test_ms_funcs.c
  head/contrib/wpa/wpa_supplicant/tests/test_sha1.c
  head/contrib/wpa/wpa_supplicant/tests/test_sha256.c
  head/contrib/wpa/wpa_supplicant/tests/test_x509v3.c
  head/contrib/wpa/wpa_supplicant/tests/test_x509v3_nist.sh
  head/contrib/wpa/wpa_supplicant/tests/test_x509v3_nist2.sh
Modified:
  head/contrib/wpa/src/Makefile
  head/contrib/wpa/src/common/Makefile
  head/contrib/wpa/src/common/defs.h
  head/contrib/wpa/src/common/ieee802_11_common.c
  head/contrib/wpa/src/common/ieee802_11_common.h
  head/contrib/wpa/src/common/ieee802_11_defs.h
  head/contrib/wpa/src/common/privsep_commands.h
  head/contrib/wpa/src/common/version.h
  head/contrib/wpa/src/common/wpa_common.c
  head/contrib/wpa/src/common/wpa_common.h
  head/contrib/wpa/src/common/wpa_ctrl.h
  head/contrib/wpa/src/crypto/Makefile
  head/contrib/wpa/src/crypto/aes.h
  head/contrib/wpa/src/crypto/crypto.h
  head/contrib/wpa/src/crypto/crypto_cryptoapi.c
  head/contrib/wpa/src/crypto/crypto_gnutls.c
  head/contrib/wpa/src/crypto/crypto_internal.c
  head/contrib/wpa/src/crypto/crypto_libtomcrypt.c
  head/contrib/wpa/src/crypto/crypto_none.c
  head/contrib/wpa/src/crypto/crypto_openssl.c
  head/contrib/wpa/src/crypto/dh_groups.c
  head/contrib/wpa/src/crypto/md5.c
  head/contrib/wpa/src/crypto/md5.h
  head/contrib/wpa/src/crypto/ms_funcs.c
  head/contrib/wpa/src/crypto/ms_funcs.h
  head/contrib/wpa/src/crypto/rc4.c
  head/contrib/wpa/src/crypto/sha1.c
  head/contrib/wpa/src/crypto/sha1.h
  head/contrib/wpa/src/crypto/sha256.c
  head/contrib/wpa/src/crypto/tls.h
  head/contrib/wpa/src/crypto/tls_gnutls.c
  head/contrib/wpa/src/crypto/tls_internal.c
  head/contrib/wpa/src/crypto/tls_none.c
  head/contrib/wpa/src/crypto/tls_openssl.c
  head/contrib/wpa/src/crypto/tls_schannel.c
  head/contrib/wpa/src/drivers/Makefile
  head/contrib/wpa/src/drivers/driver.h
  head/contrib/wpa/src/drivers/driver_ndis.c
  head/contrib/wpa/src/drivers/driver_ndis.h
  head/contrib/wpa/src/drivers/driver_ndiswrapper.c
  head/contrib/wpa/src/drivers/driver_wired.c
  head/contrib/wpa/src/drivers/drivers.c
  head/contrib/wpa/src/eap_common/Makefile
  head/contrib/wpa/src/eap_common/chap.c
  head/contrib/wpa/src/eap_common/chap.h
  head/contrib/wpa/src/eap_common/eap_fast_common.c
  head/contrib/wpa/src/eap_common/eap_gpsk_common.c
  head/contrib/wpa/src/eap_common/eap_pax_common.c
  head/contrib/wpa/src/eap_common/eap_peap_common.c
  head/contrib/wpa/src/eap_common/eap_psk_common.c
  head/contrib/wpa/src/eap_common/eap_sake_common.c
  head/contrib/wpa/src/eap_common/eap_sim_common.c
  head/contrib/wpa/src/eap_common/eap_sim_common.h
  head/contrib/wpa/src/eap_common/ikev2_common.c
  head/contrib/wpa/src/eap_peer/Makefile
  head/contrib/wpa/src/eap_peer/eap.c
  head/contrib/wpa/src/eap_peer/eap.h
  head/contrib/wpa/src/eap_peer/eap_aka.c
  head/contrib/wpa/src/eap_peer/eap_config.h
  head/contrib/wpa/src/eap_peer/eap_fast.c
  head/contrib/wpa/src/eap_peer/eap_fast_pac.c
  head/contrib/wpa/src/eap_peer/eap_leap.c
  head/contrib/wpa/src/eap_peer/eap_md5.c
  head/contrib/wpa/src/eap_peer/eap_methods.c
  head/contrib/wpa/src/eap_peer/eap_methods.h
  head/contrib/wpa/src/eap_peer/eap_mschapv2.c
  head/contrib/wpa/src/eap_peer/eap_pax.c
  head/contrib/wpa/src/eap_peer/eap_peap.c
  head/contrib/wpa/src/eap_peer/eap_psk.c
  head/contrib/wpa/src/eap_peer/eap_sim.c
  head/contrib/wpa/src/eap_peer/eap_tls.c
  head/contrib/wpa/src/eap_peer/eap_tls_common.c
  head/contrib/wpa/src/eap_peer/eap_tls_common.h
  head/contrib/wpa/src/eap_peer/eap_tnc.c
  head/contrib/wpa/src/eap_peer/eap_ttls.c
  head/contrib/wpa/src/eap_peer/eap_wsc.c
  head/contrib/wpa/src/eap_peer/ikev2.c
  head/contrib/wpa/src/eap_peer/mschapv2.c
  head/contrib/wpa/src/eap_peer/mschapv2.h
  head/contrib/wpa/src/eap_server/Makefile
  head/contrib/wpa/src/eap_server/eap.h
  head/contrib/wpa/src/eap_server/eap_i.h
  head/contrib/wpa/src/eap_server/eap_methods.h
  head/contrib/wpa/src/eap_server/eap_sim_db.c
  head/contrib/wpa/src/eap_server/eap_sim_db.h
  head/contrib/wpa/src/eap_server/eap_tls_common.h
  head/contrib/wpa/src/eap_server/ikev2.c
  head/contrib/wpa/src/eap_server/tncs.c
  head/contrib/wpa/src/eapol_supp/Makefile
  head/contrib/wpa/src/eapol_supp/eapol_supp_sm.c
  head/contrib/wpa/src/eapol_supp/eapol_supp_sm.h
  head/contrib/wpa/src/l2_packet/Makefile
  head/contrib/wpa/src/l2_packet/l2_packet_freebsd.c
  head/contrib/wpa/src/l2_packet/l2_packet_ndis.c
  head/contrib/wpa/src/radius/Makefile
  head/contrib/wpa/src/radius/radius.c
  head/contrib/wpa/src/radius/radius.h
  head/contrib/wpa/src/radius/radius_client.c
  head/contrib/wpa/src/radius/radius_client.h
  head/contrib/wpa/src/radius/radius_server.c
  head/contrib/wpa/src/radius/radius_server.h
  head/contrib/wpa/src/rsn_supp/Makefile
  head/contrib/wpa/src/rsn_supp/peerkey.c
  head/contrib/wpa/src/rsn_supp/pmksa_cache.c
  head/contrib/wpa/src/rsn_supp/pmksa_cache.h
  head/contrib/wpa/src/rsn_supp/preauth.c
  head/contrib/wpa/src/rsn_supp/preauth.h
  head/contrib/wpa/src/rsn_supp/wpa.c
  head/contrib/wpa/src/rsn_supp/wpa.h
  head/contrib/wpa/src/rsn_supp/wpa_ft.c
  head/contrib/wpa/src/rsn_supp/wpa_i.h
  head/contrib/wpa/src/rsn_supp/wpa_ie.c
  head/contrib/wpa/src/rsn_supp/wpa_ie.h
  head/contrib/wpa/src/tls/Makefile
  head/contrib/wpa/src/tls/asn1.c
  head/contrib/wpa/src/tls/asn1.h
  head/contrib/wpa/src/tls/rsa.c
  head/contrib/wpa/src/tls/tlsv1_client.c
  head/contrib/wpa/src/tls/tlsv1_client_read.c
  head/contrib/wpa/src/tls/tlsv1_client_write.c
  head/contrib/wpa/src/tls/tlsv1_common.h
  head/contrib/wpa/src/tls/tlsv1_cred.c
  head/contrib/wpa/src/tls/tlsv1_record.c
  head/contrib/wpa/src/tls/tlsv1_record.h
  head/contrib/wpa/src/tls/tlsv1_server.c
  head/contrib/wpa/src/tls/tlsv1_server_read.c
  head/contrib/wpa/src/tls/tlsv1_server_write.c
  head/contrib/wpa/src/tls/x509v3.c
  head/contrib/wpa/src/tls/x509v3.h
  head/contrib/wpa/src/utils/Makefile
  head/contrib/wpa/src/utils/base64.c
  head/contrib/wpa/src/utils/build_config.h
  head/contrib/wpa/src/utils/common.c
  head/contrib/wpa/src/utils/common.h
  head/contrib/wpa/src/utils/eloop.c
  head/contrib/wpa/src/utils/eloop.h
  head/contrib/wpa/src/utils/eloop_none.c
  head/contrib/wpa/src/utils/eloop_win.c
  head/contrib/wpa/src/utils/ip_addr.h
  head/contrib/wpa/src/utils/os.h
  head/contrib/wpa/src/utils/os_internal.c
  head/contrib/wpa/src/utils/os_unix.c
  head/contrib/wpa/src/utils/uuid.c
  head/contrib/wpa/src/utils/uuid.h
  head/contrib/wpa/src/utils/wpa_debug.c
  head/contrib/wpa/src/utils/wpa_debug.h
  head/contrib/wpa/src/utils/wpabuf.c
  head/contrib/wpa/src/utils/wpabuf.h
  head/contrib/wpa/src/wps/Makefile
  head/contrib/wpa/src/wps/httpread.c
  head/contrib/wpa/src/wps/httpread.h
  head/contrib/wpa/src/wps/wps.c
  head/contrib/wpa/src/wps/wps.h
  head/contrib/wpa/src/wps/wps_attr_build.c
  head/contrib/wpa/src/wps/wps_attr_parse.c
  head/contrib/wpa/src/wps/wps_attr_process.c
  head/contrib/wpa/src/wps/wps_common.c
  head/contrib/wpa/src/wps/wps_defs.h
  head/contrib/wpa/src/wps/wps_dev_attr.c
  head/contrib/wpa/src/wps/wps_enrollee.c
  head/contrib/wpa/src/wps/wps_i.h
  head/contrib/wpa/src/wps/wps_registrar.c
  head/contrib/wpa/src/wps/wps_upnp.c
  head/contrib/wpa/src/wps/wps_upnp.h
  head/contrib/wpa/src/wps/wps_upnp_event.c
  head/contrib/wpa/src/wps/wps_upnp_i.h
  head/contrib/wpa/src/wps/wps_upnp_ssdp.c
  head/contrib/wpa/src/wps/wps_upnp_web.c
  head/contrib/wpa/wpa_supplicant/ChangeLog
  head/contrib/wpa/wpa_supplicant/Makefile
  head/contrib/wpa/wpa_supplicant/README
  head/contrib/wpa/wpa_supplicant/README-WPS
  head/contrib/wpa/wpa_supplicant/config.c
  head/contrib/wpa/wpa_supplicant/config.h
  head/contrib/wpa/wpa_supplicant/config_file.c
  head/contrib/wpa/wpa_supplicant/config_ssid.h
  head/contrib/wpa/wpa_supplicant/ctrl_iface.c
  head/contrib/wpa/wpa_supplicant/ctrl_iface_named_pipe.c
  head/contrib/wpa/wpa_supplicant/ctrl_iface_udp.c
  head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c
  head/contrib/wpa/wpa_supplicant/defconfig
  head/contrib/wpa/wpa_supplicant/doc/docbook/wpa_background.8
  head/contrib/wpa/wpa_supplicant/doc/docbook/wpa_cli.8
  head/contrib/wpa/wpa_supplicant/doc/docbook/wpa_gui.8
  head/contrib/wpa/wpa_supplicant/doc/docbook/wpa_passphrase.8
  head/contrib/wpa/wpa_supplicant/doc/docbook/wpa_priv.8
  head/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.8
  head/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5
  head/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.sgml
  head/contrib/wpa/wpa_supplicant/eapol_test.c
  head/contrib/wpa/wpa_supplicant/events.c
  head/contrib/wpa/wpa_supplicant/main.c
  head/contrib/wpa/wpa_supplicant/mlme.c
  head/contrib/wpa/wpa_supplicant/mlme.h
  head/contrib/wpa/wpa_supplicant/nmake.mak
  head/contrib/wpa/wpa_supplicant/preauth_test.c
  head/contrib/wpa/wpa_supplicant/scan.c
  head/contrib/wpa/wpa_supplicant/tests/test_eap_sim_common.c
  head/contrib/wpa/wpa_supplicant/tests/test_wpa.c
  head/contrib/wpa/wpa_supplicant/todo.txt
  head/contrib/wpa/wpa_supplicant/wpa_cli.c
  head/contrib/wpa/wpa_supplicant/wpa_passphrase.c
  head/contrib/wpa/wpa_supplicant/wpa_priv.c
  head/contrib/wpa/wpa_supplicant/wpa_supplicant.c
  head/contrib/wpa/wpa_supplicant/wpa_supplicant.conf
  head/contrib/wpa/wpa_supplicant/wpa_supplicant.nsi
  head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h
  head/contrib/wpa/wpa_supplicant/wpas_glue.c
  head/contrib/wpa/wpa_supplicant/wps_supplicant.c
  head/contrib/wpa/wpa_supplicant/wps_supplicant.h
Directory Properties:
  head/contrib/wpa/   (props changed)

Copied: head/contrib/wpa/hostapd/ChangeLog (from r214505, vendor/wpa/dist/hostapd/ChangeLog)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/wpa/hostapd/ChangeLog	Wed Nov  3 10:43:38 2010	(r214734, copy of r214505, vendor/wpa/dist/hostapd/ChangeLog)
@@ -0,0 +1,663 @@
+ChangeLog for hostapd
+
+2010-09-07 - v0.7.3
+	* fixed re-association after WPS not initializing WPA state machine in
+	  some cases
+	* fixed WPS IE update on reconfiguration
+	* fixed WPS code not to proxy Probe Request frames for foreign SSIDs
+	* added WPS workaround for open networks and some known interop issues
+	* fixed WPS Diffie-Hellman derivation to use correct public key length
+	* fixed FT RRB messages on big endian CPUs
+	* changed WPS protection for brute force AP PIN attacks to disable AP
+	  PIN only temporarily (but with increasing time) to avoid usability
+	  issues on Label-only devices
+	* added wps_ap_pin command for more secure handling of AP PIN
+	  operations (e.g., to generate a random AP PIN and only use it for
+	  short amount of time)
+	* fixed HT STBC negotiation
+
+2010-04-18 - v0.7.2
+	* fix WPS internal Registrar use when an external Registrar is also
+	  active
+	* bsd: Cleaned up driver wrapper and added various low-level
+	  configuration options
+	* TNC: fixed issues with fragmentation
+	* EAP-TNC: add Flags field into fragment acknowledgement (needed to
+	  interoperate with other implementations; may potentially breaks
+	  compatibility with older wpa_supplicant/hostapd versions)
+	* cleaned up driver wrapper API for multi-BSS operations
+	* nl80211: fix multi-BSS and VLAN operations
+	* fix number of issues with IEEE 802.11r/FT; this version is not
+	  backwards compatible with old versions
+	* add SA Query Request processing in AP mode (IEEE 802.11w)
+	* fix IGTK PN in group rekeying (IEEE 802.11w)
+	* fix WPS PBC session overlap detection to use correct attribute
+	* hostapd_notif_Assoc() can now be called with all IEs to simplify
+	  driver wrappers
+	* work around interoperability issue with some WPS External Registrar
+	  implementations
+	* nl80211: fix WPS IE update
+	* hostapd_cli: add support for action script operations (run a script
+	  on hostapd events)
+	* fix DH padding with internal crypto code (mainly, for WPS)
+	* fix WPS association with both WPS IE and WPA/RSN IE present with
+	  driver wrappers that use hostapd MLME (e.g., nl80211)
+
+2010-01-16 - v0.7.1
+	* cleaned up driver wrapper API (struct wpa_driver_ops); the new API
+	  is not fully backwards compatible, so out-of-tree driver wrappers
+	  will need modifications
+	* cleaned up various module interfaces
+	* merge hostapd and wpa_supplicant developers' documentation into a
+	  single document
+	* fixed HT Capabilities IE with nl80211 drivers
+	* moved generic AP functionality code into src/ap
+	* WPS: handle Selected Registrar as union of info from all Registrars
+	* remove obsolte Prism54.org driver wrapper
+	* added internal debugging mechanism with backtrace support and memory
+	  allocation/freeing validation, etc. tests (CONFIG_WPA_TRACE=y)
+	* EAP-FAST server: piggyback Phase 2 start with the end of Phase 1
+	* WPS: add support for dynamically selecting whether to provision the
+	  PSK as an ASCII passphrase or PSK
+	* added support for WDS (4-address frame) mode with per-station virtual
+	  interfaces (wds_sta=1 in config file; only supported with
+	  driver=nl80211 for now)
+	* fixed WPS Probe Request processing to handle missing required
+	  attribute
+	* fixed PKCS#12 use with OpenSSL 1.0.0
+	* detect bridge interface automatically so that bridge parameter in
+	  hostapd.conf becomes optional (though, it may now be used to
+	  automatically add then WLAN interface into a bridge with
+	  driver=nl80211)
+
+2009-11-21 - v0.7.0
+	* increased hostapd_cli ping interval to 5 seconds and made this
+	  configurable with a new command line options (-G)
+	* driver_nl80211: use Linux socket filter to improve performance
+	* added support for external Registrars with WPS (UPnP transport)
+	* 802.11n: scan for overlapping BSSes before starting 20/40 MHz channel
+	* driver_nl80211: fixed STA accounting data collection (TX/RX bytes
+	  reported correctly; TX/RX packets not yet available from kernel)
+	* added support for WPS USBA out-of-band mechanism with USB Flash
+	  Drives (UFD) (CONFIG_WPS_UFD=y)
+	* fixed EAPOL/EAP reauthentication when using an external RADIUS
+	  authentication server
+	* fixed TNC with EAP-TTLS
+	* fixed IEEE 802.11r key derivation function to match with the standard
+	  (note: this breaks interoperability with previous version) [Bug 303]
+	* fixed SHA-256 based key derivation function to match with the
+	  standard when using CCMP (for IEEE 802.11r and IEEE 802.11w)
+	  (note: this breaks interoperability with previous version) [Bug 307]
+	* added number of code size optimizations to remove unnecessary
+	  functionality from the program binary based on build configuration
+	  (part of this automatic; part configurable with CONFIG_NO_* build
+	  options)
+	* use shared driver wrapper files with wpa_supplicant
+	* driver_nl80211: multiple updates to provide support for new Linux
+	  nl80211/mac80211 functionality
+	* updated management frame protection to use IEEE Std 802.11w-2009
+	* fixed number of small WPS issues and added workarounds to
+	  interoperate with common deployed broken implementations
+	* added some IEEE 802.11n co-existance rules to disable 40 MHz channels
+	  or modify primary/secondary channels if needed based on neighboring
+	  networks
+	* added support for NFC out-of-band mechanism with WPS
+	* added preliminary support for IEEE 802.11r RIC processing
+
+2009-01-06 - v0.6.7
+	* added support for Wi-Fi Protected Setup (WPS)
+	  (hostapd can now be configured to act as an integrated WPS Registrar
+	  and provision credentials for WPS Enrollees using PIN and PBC
+	  methods; external wireless Registrar can configure the AP, but
+	  external WLAN Manager Registrars are not supported); WPS support can
+	  be enabled by adding CONFIG_WPS=y into .config and setting the
+	  runtime configuration variables in hostapd.conf (see WPS section in
+	  the example configuration file); new hostapd_cli commands wps_pin and
+	  wps_pbc are used to configure WPS negotiation; see README-WPS for
+	  more details
+	* added IEEE 802.11n HT capability configuration (ht_capab)
+	* added support for generating Country IE based on nl80211 regulatory
+	  information (added if ieee80211d=1 in configuration)
+	* fixed WEP authentication (both Open System and Shared Key) with
+	  mac80211
+	* added support for EAP-AKA' (draft-arkko-eap-aka-kdf)
+	* added support for using driver_test over UDP socket
+	* changed EAP-GPSK to use the IANA assigned EAP method type 51
+	* updated management frame protection to use IEEE 802.11w/D7.0
+	* fixed retransmission of EAP requests if no response is received
+
+2008-11-23 - v0.6.6
+	* added a new configuration option, wpa_ptk_rekey, that can be used to
+	  enforce frequent PTK rekeying, e.g., to mitigate some attacks against
+	  TKIP deficiencies
+	* updated OpenSSL code for EAP-FAST to use an updated version of the
+	  session ticket overriding API that was included into the upstream
+	  OpenSSL 0.9.9 tree on 2008-11-15 (no additional OpenSSL patch is
+	  needed with that version anymore)
+	* changed channel flags configuration to read the information from
+	  the driver (e.g., via driver_nl80211 when using mac80211) instead of
+	  using hostapd as the source of the regulatory information (i.e.,
+	  information from CRDA is now used with mac80211); this allows 5 GHz
+	  channels to be used with hostapd (if allowed in the current
+	  regulatory domain)
+	* fixed EAP-TLS message processing for the last TLS message if it is
+	  large enough to require fragmentation (e.g., if a large Session
+	  Ticket data is included)
+	* fixed listen interval configuration for nl80211 drivers
+
+2008-11-01 - v0.6.5
+	* added support for SHA-256 as X.509 certificate digest when using the
+	  internal X.509/TLSv1 implementation
+	* fixed EAP-FAST PAC-Opaque padding (0.6.4 broke this for some peer
+	  identity lengths)
+	* fixed internal TLSv1 implementation for abbreviated handshake (used
+	  by EAP-FAST server)
+	* added support for setting VLAN ID for STAs based on local MAC ACL
+	  (accept_mac_file) as an alternative for RADIUS server-based
+	  configuration
+	* updated management frame protection to use IEEE 802.11w/D6.0
+	  (adds a new association ping to protect against unauthenticated
+	  authenticate or (re)associate request frames dropping association)
+	* added support for using SHA256-based stronger key derivation for WPA2
+	  (IEEE 802.11w)
+	* added new "driver wrapper" for RADIUS-only configuration
+	  (driver=none in hostapd.conf; CONFIG_DRIVER_NONE=y in .config)
+	* fixed WPA/RSN IE validation to verify that the proto (WPA vs. WPA2)
+	  is enabled in configuration
+	* changed EAP-FAST configuration to use separate fields for A-ID and
+	  A-ID-Info (eap_fast_a_id_info) to allow A-ID to be set to a fixed
+	  16-octet len binary value for better interoperability with some peer
+	  implementations; eap_fast_a_id is now configured as a hex string
+	* driver_nl80211: Updated to match the current Linux mac80211 AP mode
+	  configuration (wireless-testing.git and Linux kernel releases
+	  starting from 2.6.29)
+
+2008-08-10 - v0.6.4
+	* added peer identity into EAP-FAST PAC-Opaque and skip Phase 2
+	  Identity Request if identity is already known
+	* added support for EAP Sequences in EAP-FAST Phase 2
+	* added support for EAP-TNC (Trusted Network Connect)
+	  (this version implements the EAP-TNC method and EAP-TTLS/EAP-FAST
+	  changes needed to run two methods in sequence (IF-T) and the IF-IMV
+	  and IF-TNCCS interfaces from TNCS)
+	* added support for optional cryptobinding with PEAPv0
+	* added fragmentation support for EAP-TNC
+	* added support for fragmenting EAP-TTLS/PEAP/FAST Phase 2 (tunneled)
+	  data
+	* added support for opportunistic key caching (OKC)
+
+2008-02-22 - v0.6.3
+	* fixed Reassociation Response callback processing when using internal
+	  MLME (driver_{hostap,nl80211,test}.c)
+	* updated FT support to use the latest draft, IEEE 802.11r/D9.0
+	* copy optional Proxy-State attributes into RADIUS response when acting
+	  as a RADIUS authentication server
+	* fixed EAPOL state machine to handle a case in which no response is
+	  received from the RADIUS authentication server; previous version
+	  could have triggered a crash in some cases after a timeout
+	* fixed EAP-SIM/AKA realm processing to allow decorated usernames to
+	  be used
+	* added a workaround for EAP-SIM/AKA peers that include incorrect null
+	  termination in the username
+	* fixed EAP-SIM/AKA protected result indication to include AT_COUNTER
+	  attribute in notification messages only when using fast
+	  reauthentication
+	* fixed EAP-SIM Start response processing for fast reauthentication
+	  case
+	* added support for pending EAP processing in EAP-{PEAP,TTLS,FAST}
+	  phase 2 to allow EAP-SIM and EAP-AKA to be used as the Phase 2 method
+
+2008-01-01 - v0.6.2
+	* fixed EAP-SIM and EAP-AKA message parser to validate attribute
+	  lengths properly to avoid potential crash caused by invalid messages
+	* added data structure for storing allocated buffers (struct wpabuf);
+	  this does not affect hostapd usage, but many of the APIs changed
+	  and various interfaces (e.g., EAP) is not compatible with old
+	  versions
+	* added support for protecting EAP-AKA/Identity messages with
+	  AT_CHECKCODE (optional feature in RFC 4187)
+	* added support for protected result indication with AT_RESULT_IND for
+	  EAP-SIM and EAP-AKA (eap_sim_aka_result_ind=1)
+	* added support for configuring EAP-TTLS phase 2 non-EAP methods in
+	  EAP server configuration; previously all four were enabled for every
+	  phase 2 user, now all four are disabled by default and need to be
+	  enabled with new method names TTLS-PAP, TTLS-CHAP, TTLS-MSCHAP,
+	  TTLS-MSCHAPV2
+	* removed old debug printing mechanism and the related 'debug'
+	  parameter in the configuration file; debug verbosity is now set with
+	  -d (or -dd) command line arguments
+	* added support for EAP-IKEv2 (draft-tschofenig-eap-ikev2-15.txt);
+	  only shared key/password authentication is supported in this version
+
+2007-11-24 - v0.6.1
+	* added experimental, integrated TLSv1 server implementation with the
+	  needed X.509/ASN.1/RSA/bignum processing (this can be enabled by
+	  setting CONFIG_TLS=internal and CONFIG_INTERNAL_LIBTOMMATH=y in
+	  .config); this can be useful, e.g., if the target system does not
+	  have a suitable TLS library and a minimal code size is required
+	* added support for EAP-FAST server method to the integrated EAP
+	  server
+	* updated EAP Generalized Pre-Shared Key (EAP-GPSK) to use the latest
+	  draft (draft-ietf-emu-eap-gpsk-07.txt)
+	* added a new configuration parameter, rsn_pairwise, to allow different
+	  pairwise cipher suites to be enabled for WPA and RSN/WPA2
+	  (note: if wpa_pairwise differs from rsn_pairwise, the driver will
+	  either need to support this or will have to use the WPA/RSN IEs from
+	  hostapd; currently, the included madwifi and bsd driver interfaces do
+	  not have support for this)
+	* updated FT support to use the latest draft, IEEE 802.11r/D8.0
+
+2007-05-28 - v0.6.0
+	* added experimental IEEE 802.11r/D6.0 support
+	* updated EAP-SAKE to RFC 4763 and the IANA-allocated EAP type 48
+	* updated EAP-PSK to use the IANA-allocated EAP type 47
+	* fixed EAP-PSK bit ordering of the Flags field
+	* fixed configuration reloading (SIGHUP) to re-initialize WPA PSKs
+	  by reading wpa_psk_file [Bug 181]
+	* fixed EAP-TTLS AVP parser processing for too short AVP lengths
+	* fixed IPv6 connection to RADIUS accounting server
+	* updated EAP Generalized Pre-Shared Key (EAP-GPSK) to use the latest
+	  draft (draft-ietf-emu-eap-gpsk-04.txt)
+	* hlr_auc_gw: read GSM triplet file into memory and rotate through the
+	  entries instead of only using the same three triplets every time
+	  (this does not work properly with tests using multiple clients, but
+	  provides bit better triplet data for testing a single client; anyway,
+	  if a better quality triplets are needed, GSM-Milenage should be used
+	  instead of hardcoded triplet file)
+	* fixed EAP-MSCHAPv2 server to use a space between S and M parameters
+	  in Success Request [Bug 203]
+	* added support for sending EAP-AKA Notifications in error cases
+	* updated to use IEEE 802.11w/D2.0 for management frame protection
+	  (still experimental)
+	* RADIUS server: added support for processing duplicate messages
+	  (retransmissions from RADIUS client) by replying with the previous
+	  reply
+
+2006-11-24 - v0.5.6
+	* added support for configuring and controlling multiple BSSes per
+	  radio interface (bss= in hostapd.conf); this is only
+	  available with Devicescape and test driver interfaces
+	* fixed PMKSA cache update in the end of successful RSN
+	  pre-authentication
+	* added support for dynamic VLAN configuration (i.e., selecting VLAN-ID
+	  for each STA based on RADIUS Access-Accept attributes); this requires
+	  VLAN support from the kernel driver/802.11 stack and this is
+	  currently only available with Devicescape and test driver interfaces
+	* driver_madwifi: fixed configuration of unencrypted modes (plaintext
+	  and IEEE 802.1X without WEP)
+	* removed STAKey handshake since PeerKey handshake has replaced it in
+	  IEEE 802.11ma and there are no known deployments of STAKey
+	* updated EAP Generalized Pre-Shared Key (EAP-GPSK) to use the latest
+	  draft (draft-ietf-emu-eap-gpsk-01.txt)
+	* added preliminary implementation of IEEE 802.11w/D1.0 (management
+	  frame protection)
+	  (Note: this requires driver support to work properly.)
+	  (Note2: IEEE 802.11w is an unapproved draft and subject to change.)
+	* hlr_auc_gw: added support for GSM-Milenage (for EAP-SIM)
+	* hlr_auc_gw: added support for reading per-IMSI Milenage keys and
+	  parameters from a text file to make it possible to implement proper
+	  GSM/UMTS authentication server for multiple SIM/USIM cards using
+	  EAP-SIM/EAP-AKA
+	* fixed session timeout processing with drivers that do not use
+	  ieee802_11.c (e.g., madwifi)
+
+2006-08-27 - v0.5.5
+	* added 'hostapd_cli new_sta ' command for adding a new STA into
+	  hostapd (e.g., to initialize wired network authentication based on an
+	  external signal)
+	* fixed hostapd to add PMKID KDE into 4-Way Handshake Message 1 when
+	  using WPA2 even if PMKSA caching is not used
+	* added -P argument for hostapd to write the current process
+	  id into a file
+	* added support for RADIUS Authentication Server MIB (RFC 2619)
+
+2006-06-20 - v0.5.4
+	* fixed nt_password_hash build [Bug 144]
+	* added PeerKey handshake implementation for IEEE 802.11e
+	  direct link setup (DLS) to replace STAKey handshake
+	* added support for EAP Generalized Pre-Shared Key (EAP-GPSK,
+	  draft-clancy-emu-eap-shared-secret-00.txt)
+	* fixed a segmentation fault when RSN pre-authentication was completed
+	  successfully [Bug 152]
+
+2006-04-27 - v0.5.3
+	* do not build nt_password_hash and hlr_auc_gw by default to avoid
+	  requiring a TLS library for a successful build; these programs can be
+	  build with 'make nt_password_hash' and 'make hlr_auc_gw'
+	* added a new configuration option, eapol_version, that can be used to
+	  set EAPOL version to 1 (default is 2) to work around broken client
+	  implementations that drop EAPOL frames which use version number 2
+	  [Bug 89]
+	* added support for EAP-SAKE (no EAP method number allocated yet, so
+	  this is using the same experimental type 255 as EAP-PSK)
+	* fixed EAP-MSCHAPv2 message length validation
+
+2006-03-19 - v0.5.2
+	* fixed stdarg use in hostapd_logger(): if both stdout and syslog
+	  logging was enabled, hostapd could trigger a segmentation fault in
+	  vsyslog on some CPU -- C library combinations
+	* moved HLR/AuC gateway implementation for EAP-SIM/AKA into an external
+	  program to make it easier to use for implementing real SS7 gateway;
+	  eap_sim_db is not anymore used as a file name for GSM authentication
+	  triplets; instead, it is path to UNIX domain socket that will be used
+	  to communicate with the external gateway program (e.g., hlr_auc_gw)
+	* added example HLR/AuC gateway implementation, hlr_auc_gw, that uses
+	  local information (GSM authentication triplets from a text file and
+	  hardcoded AKA authentication data); this can be used to test EAP-SIM
+	  and EAP-AKA
+	* added Milenage algorithm (example 3GPP AKA algorithm) to hlr_auc_gw
+	  to make it possible to test EAP-AKA with real USIM cards (this is
+	  disabled by default; define AKA_USE_MILENAGE when building hlr_auc_gw
+	  to enable this)
+	* driver_madwifi: added support for getting station RSN IE from
+	  madwifi-ng svn r1453 and newer; this fixes RSN that was apparently
+	  broken with earlier change (r1357) in the driver
+	* changed EAP method registration to use a dynamic list of methods
+	  instead of a static list generated at build time
+	* fixed WPA message 3/4 not to encrypt Key Data field (WPA IE)
+	  [Bug 125]
+	* added ap_max_inactivity configuration parameter
+
+2006-01-29 - v0.5.1
+	* driver_test: added better support for multiple APs and STAs by using
+	  a directory with sockets that include MAC address for each device in
+	  the name (test_socket=DIR:/tmp/test)
+	* added support for EAP expanded type (vendor specific EAP methods)
+
+2005-12-18 - v0.5.0 (beginning of 0.5.x development releases)
+	* added experimental STAKey handshake implementation for IEEE 802.11e
+	  direct link setup (DLS); note: this is disabled by default in both
+	  build and runtime configuration (can be enabled with CONFIG_STAKEY=y
+	  and stakey=1)
+	* added support for EAP methods to use callbacks to external programs
+	  by buffering a pending request and processing it after the EAP method
+	  is ready to continue
+	* improved EAP-SIM database interface to allow external request to GSM
+	  HLR/AuC without blocking hostapd process
+	* added support for using EAP-SIM pseudonyms and fast re-authentication
+	* added support for EAP-AKA in the integrated EAP authenticator
+	* added support for matching EAP identity prefixes (e.g., "1"*) in EAP
+	  user database to allow EAP-SIM/AKA selection without extra roundtrip
+	  for EAP-Nak negotiation
+	* added support for storing EAP user password as NtPasswordHash instead
+	  of plaintext password when using MSCHAP or MSCHAPv2 for
+	  authentication (hash:<16-octet hex value>); added nt_password_hash
+	  tool for hashing password to generate NtPasswordHash
+
+2005-11-20 - v0.4.7 (beginning of 0.4.x stable releases)
+	* driver_wired: fixed EAPOL sending to optionally use PAE group address
+	  as the destination instead of supplicant MAC address; this is
+	  disabled by default, but should be enabled with use_pae_group_addr=1
+	  in configuration file if the wired interface is used by only one
+	  device at the time (common switch configuration)
+	* driver_madwifi: configure driver to use TKIP countermeasures in order
+	  to get correct behavior (IEEE 802.11 association failing; previously,
+	  association succeeded, but hostpad forced disassociation immediately)
+	* driver_madwifi: added support for madwifi-ng
+
+2005-10-27 - v0.4.6
+	* added support for replacing user identity from EAP with RADIUS
+	  User-Name attribute from Access-Accept message, if that is included,
+	  for the RADIUS accounting messages (e.g., for EAP-PEAP/TTLS to get
+	  tunneled identity into accounting messages when the RADIUS server
+	  does not support better way of doing this with Class attribute)
+	* driver_madwifi: fixed EAPOL packet receive for configuration where
+	  ath# is part of a bridge interface
+	* added a configuration file and log analyzer script for logwatch
+	* fixed EAPOL state machine step function to process all state
+	  transitions before processing new events; this resolves a race
+	  condition in which EAPOL-Start message could trigger hostapd to send
+	  two EAP-Response/Identity frames to the authentication server
+
+2005-09-25 - v0.4.5
+	* added client CA list to the TLS certificate request in order to make
+	  it easier for the client to select which certificate to use
+	* added experimental support for EAP-PSK
+	* added support for WE-19 (hostap, madwifi)
+
+2005-08-21 - v0.4.4
+	* fixed build without CONFIG_RSN_PREAUTH
+	* fixed FreeBSD build
+
+2005-06-26 - v0.4.3
+	* fixed PMKSA caching to copy User-Name and Class attributes so that
+	  RADIUS accounting gets correct information
+	* start RADIUS accounting only after successful completion of WPA
+	  4-Way Handshake if WPA-PSK is used
+	* fixed PMKSA caching for the case where STA (re)associates without
+	  first disassociating
+
+2005-06-12 - v0.4.2
+	* EAP-PAX is now registered as EAP type 46
+	* fixed EAP-PAX MAC calculation
+	* fixed EAP-PAX CK and ICK key derivation
+	* renamed eap_authenticator configuration variable to eap_server to
+	  better match with RFC 3748 (EAP) terminology
+	* driver_test: added support for testing hostapd with wpa_supplicant
+	  by using test driver interface without any kernel drivers or network
+	  cards
+
+2005-05-22 - v0.4.1
+	* fixed RADIUS server initialization when only auth or acct server
+	  is configured and the other one is left empty
+	* driver_madwifi: added support for RADIUS accounting
+	* driver_madwifi: added preliminary support for compiling against 'BSD'
+	  branch of madwifi CVS tree
+	* driver_madwifi: fixed pairwise key removal to allow WPA reauth
+	  without disassociation
+	* added support for reading additional certificates from PKCS#12 files
+	  and adding them to the certificate chain
+	* fixed RADIUS Class attribute processing to only use Access-Accept
+	  packets to update Class; previously, other RADIUS authentication
+	  packets could have cleared Class attribute
+	* added support for more than one Class attribute in RADIUS packets
+	* added support for verifying certificate revocation list (CRL) when
+	  using integrated EAP authenticator for EAP-TLS; new hostapd.conf
+	  options 'check_crl'; CRL must be included in the ca_cert file for now
+
+2005-04-25 - v0.4.0 (beginning of 0.4.x development releases)
+	* added support for including network information into
+	  EAP-Request/Identity message (ASCII-0 (nul) in eap_message)
+	  (e.g., to implement draft-adrange-eap-network-discovery-07.txt)
+	* fixed a bug which caused some RSN pre-authentication cases to use
+	  freed memory and potentially crash hostapd
+	* fixed private key loading for cases where passphrase is not set
+	* added support for sending TLS alerts and aborting authentication
+	  when receiving a TLS alert
+	* fixed WPA2 to add PMKSA cache entry when using integrated EAP
+	  authenticator
+	* fixed PMKSA caching (EAP authentication was not skipped correctly
+	  with the new state machine changes from IEEE 802.1X draft)
+	* added support for RADIUS over IPv6; own_ip_addr, auth_server_addr,
+	  and acct_server_addr can now be IPv6 addresses (CONFIG_IPV6=y needs
+	  to be added to .config to include IPv6 support); for RADIUS server,
+	  radius_server_ipv6=1 needs to be set in hostapd.conf and addresses
+	  in RADIUS clients file can then use IPv6 format
+	* added experimental support for EAP-PAX
+	* replaced hostapd control interface library (hostapd_ctrl.[ch]) with
+	  the same implementation that wpa_supplicant is using (wpa_ctrl.[ch])
+
+2005-02-12 - v0.3.7 (beginning of 0.3.x stable releases)
+
+2005-01-23 - v0.3.5
+	* added support for configuring a forced PEAP version based on the
+	  Phase 1 identity
+	* fixed PEAPv1 to use tunneled EAP-Success/Failure instead of EAP-TLV
+	  to terminate authentication
+	* fixed EAP identifier duplicate processing with the new IEEE 802.1X
+	  draft
+	* clear accounting data in the driver when starting a new accounting
+	  session
+	* driver_madwifi: filter wireless events based on ifindex to allow more
+	  than one network interface to be used
+	* fixed WPA message 2/4 processing not to cancel timeout for TimeoutEvt
+	  setting if the packet does not pass MIC verification (e.g., due to
+	  incorrect PSK); previously, message 1/4 was not tried again if an
+	  invalid message 2/4 was received
+	* fixed reconfiguration of RADIUS client retransmission timer when
+	  adding a new message to the pending list; previously, timer was not
+	  updated at this point and if there was a pending message with long
+	  time for the next retry, the new message needed to wait that long for
+	  its first retry, too
+
+2005-01-09 - v0.3.4
+	* added support for configuring multiple allowed EAP types for Phase 2
+	  authentication (EAP-PEAP, EAP-TTLS)
+	* fixed EAPOL-Start processing to trigger WPA reauthentication
+	  (previously, only EAPOL authentication was done)
+
+2005-01-02 - v0.3.3
+	* added support for EAP-PEAP in the integrated EAP authenticator
+	* added support for EAP-GTC in the integrated EAP authenticator
+	* added support for configuring list of EAP methods for Phase 1 so that
+	  the integrated EAP authenticator can, e.g., use the wildcard entry
+	  for EAP-TLS and EAP-PEAP
+	* added support for EAP-TTLS in the integrated EAP authenticator
+	* added support for EAP-SIM in the integrated EAP authenticator
+	* added support for using hostapd as a RADIUS authentication server
+	  with the integrated EAP authenticator taking care of EAP
+	  authentication (new hostapd.conf options: radius_server_clients and
+	  radius_server_auth_port); this is not included in default build; use
+	  CONFIG_RADIUS_SERVER=y in .config to include
+
+2004-12-19 - v0.3.2
+	* removed 'daemonize' configuration file option since it has not really
+	  been used at all for more than year
+	* driver_madwifi: fixed group key setup and added get_ssid method
+	* added support for EAP-MSCHAPv2 in the integrated EAP authenticator
+
+2004-12-12 - v0.3.1
+	* added support for integrated EAP-TLS authentication (new hostapd.conf
+	  variables: ca_cert, server_cert, private_key, private_key_passwd);
+	  this enabled dynamic keying (WPA2/WPA/IEEE 802.1X/WEP) without
+	  external RADIUS server
+	* added support for reading PKCS#12 (PFX) files (as a replacement for
+	  PEM/DER) to get certificate and private key (CONFIG_PKCS12)
+
+2004-12-05 - v0.3.0 (beginning of 0.3.x development releases)
+	* added support for Acct-{Input,Output}-Gigawords
+	* added support for Event-Timestamp (in RADIUS Accounting-Requests)
+	* added support for RADIUS Authentication Client MIB (RFC2618)
+	* added support for RADIUS Accounting Client MIB (RFC2620)
+	* made EAP re-authentication period configurable (eap_reauth_period)
+	* fixed EAPOL reauthentication to trigger WPA/WPA2 reauthentication
+	* fixed EAPOL state machine to stop if STA is removed during
+	  eapol_sm_step(); this fixes at least one segfault triggering bug with
+	  IEEE 802.11i pre-authentication
+	* added support for multiple WPA pre-shared keys (e.g., one for each
+	  client MAC address or keys shared by a group of clients);
+	  new hostapd.conf field wpa_psk_file for setting path to a text file
+	  containing PSKs, see hostapd.wpa_psk for an example
+	* added support for multiple driver interfaces to allow hostapd to be
+	  used with other drivers
+	* added wired authenticator driver interface (driver=wired in
+	  hostapd.conf, see wired.conf for example configuration)
+	* added madwifi driver interface (driver=madwifi in hostapd.conf, see
+	  madwifi.conf for example configuration; Note: include files from
+	  madwifi project is needed for building and a configuration file,
+	  .config, needs to be created in hostapd directory with
+	  CONFIG_DRIVER_MADWIFI=y to include this driver interface in hostapd
+	  build)
+	* fixed an alignment issue that could cause SHA-1 to fail on some
+	  platforms (e.g., Intel ixp425 with a compiler that does not 32-bit
+	  align variables)
+	* fixed RADIUS reconnection after an error in sending interim
+	  accounting packets
+	* added hostapd control interface for external programs and an example
+	  CLI, hostapd_cli (like wpa_cli for wpa_supplicant)
+	* started adding dot11, dot1x, radius MIBs ('hostapd_cli mib',
+	  'hostapd_cli sta ')
+	* finished update from IEEE 802.1X-2001 to IEEE 802.1X-REV (now d11)
+	* added support for strict GTK rekeying (wpa_strict_rekey in
+	  hostapd.conf)
+	* updated IAPP to use UDP port 3517 and multicast address 224.0.1.178
+	  (instead of broadcast) for IAPP ADD-notify (moved from draft 3 to
+	  IEEE 802.11F-2003)
+	* added Prism54 driver interface (driver=prism54 in hostapd.conf;
+	  note: .config needs to be created in hostapd directory with
+	  CONFIG_DRIVER_PRISM54=y to include this driver interface in hostapd
+	  build)
+	* dual-licensed hostapd (GPLv2 and BSD licenses)
+	* fixed RADIUS accounting to generate a new session id for cases where
+	  a station reassociates without first being complete deauthenticated
+	* fixed STA disassociation handler to mark next timeout state to
+	  deauthenticate the station, i.e., skip long wait for inactivity poll
+	  and extra disassociation, if the STA disassociates without
+	  deauthenticating
+	* added integrated EAP authenticator that can be used instead of
+	  external RADIUS authentication server; currently, only EAP-MD5 is
+	  supported, so this cannot yet be used for key distribution; the EAP
+	  method interface is generic, though, so adding new EAP methods should
+	  be straightforward; new hostapd.conf variables: 'eap_authenticator'
+	  and 'eap_user_file'; this obsoletes "minimal authentication server"
+	  ('minimal_eap' in hostapd.conf) which is now removed
+	* added support for FreeBSD and driver interface for the BSD net80211
+	  layer (driver=bsd in hostapd.conf and CONFIG_DRIVER_BSD=y in
+	  .config); please note that some of the required kernel mods have not
+	  yet been committed
+
+2004-07-17 - v0.2.4 (beginning of 0.2.x stable releases)
+	* fixed some accounting cases where Accounting-Start was sent when
+	  IEEE 802.1X port was being deauthorized
+
+2004-06-20 - v0.2.3
+	* modified RADIUS client to re-connect the socket in case of certain
+	  error codes that are generated when a network interface state is
+	  changes (e.g., when IP address changes or the interface is set UP)
+	* fixed couple of cases where EAPOL state for a station was freed
+	  twice causing a segfault for hostapd
+	* fixed couple of bugs in processing WPA deauthentication (freed data
+	  was used)
+
+2004-05-31 - v0.2.2
+	* fixed WPA/WPA2 group rekeying to use key index correctly (GN/GM)
+	* fixed group rekeying to send zero TSC in EAPOL-Key messages to fix
+	  cases where STAs dropped multicast frames as replay attacks
+	* added support for copying RADIUS Attribute 'Class' from
+	  authentication messages into accounting messages
+	* send canned EAP failure if RADIUS server sends Access-Reject without
+	  EAP message (previously, Supplicant was not notified in this case)
+	* fixed mixed WPA-PSK and WPA-EAP mode to work with WPA-PSK (i.e., do
+	  not start EAPOL state machines if the STA selected to use WPA-PSK)
+
+2004-05-06 - v0.2.1
+	* added WPA and IEEE 802.11i/RSN (WPA2) Authenticator functionality
+	  - based on IEEE 802.11i/D10.0 but modified to interoperate with WPA
+	    (i.e., IEEE 802.11i/D3.0)
+	  - supports WPA-only, RSN-only, and mixed WPA/RSN mode
+	  - both WPA-PSK and WPA-RADIUS/EAP are supported
+	  - PMKSA caching and pre-authentication
+	  - new hostapd.conf variables: wpa, wpa_psk, wpa_passphrase,
+	    wpa_key_mgmt, wpa_pairwise, wpa_group_rekey, wpa_gmk_rekey,
+	    rsn_preauth, rsn_preauth_interfaces
+	* fixed interim accounting to remove any pending accounting messages
+	  to the STA before sending a new one
+
+2004-02-15 - v0.2.0
+	* added support for Acct-Interim-Interval:
+	  - draft-ietf-radius-acct-interim-01.txt
+	  - use Acct-Interim-Interval attribute from Access-Accept if local
+	    'radius_acct_interim_interval' is not set
+	  - allow different update intervals for each STA
+	* fixed event loop to call signal handlers only after returning from
+	  the real signal handler
+	* reset sta->timeout_next after successful association to make sure
+	  that the previously registered inactivity timer will not remove the
+	  STA immediately (e.g., if STA deauthenticates and re-associates
+	  before the timer is triggered).
+	* added new hostapd.conf variable, nas_identifier, that can be used to
+	  add an optional RADIUS Attribute, NAS-Identifier, into authentication
+	  and accounting messages
+	* added support for Accounting-On and Accounting-Off messages
+	* fixed accounting session handling to send Accounting-Start only once
+	  per session and not to send Accounting-Stop if the session was not
+	  initialized properly
+	* fixed Accounting-Stop statistics in cases where the message was
+	  previously sent after the kernel entry for the STA (and/or IEEE
+	  802.1X data) was removed
+
+
+Note:
+
+Older changes up to and including v0.1.0 are included in the ChangeLog
+of the Host AP driver.

Copied: head/contrib/wpa/hostapd/Makefile (from r214505, vendor/wpa/dist/hostapd/Makefile)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/wpa/hostapd/Makefile	Wed Nov  3 10:43:38 2010	(r214734, copy of r214505, vendor/wpa/dist/hostapd/Makefile)
@@ -0,0 +1,791 @@
+ifndef CC
+CC=gcc
+endif
+
+ifndef CFLAGS
+CFLAGS = -MMD -O2 -Wall -g
+endif
+
+CFLAGS += -I../src
+CFLAGS += -I../src/utils
+
+# Uncomment following line and set the path to your kernel tree include
+# directory if your C library does not include all header files.
+# CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
+
+-include .config
+
+ifndef CONFIG_OS
+ifdef CONFIG_NATIVE_WINDOWS
+CONFIG_OS=win32
+else
+CONFIG_OS=unix
+endif
+endif
+
+ifeq ($(CONFIG_OS), internal)
+CFLAGS += -DOS_NO_C_LIB_DEFINES
+endif
+
+ifdef CONFIG_NATIVE_WINDOWS
+CFLAGS += -DCONFIG_NATIVE_WINDOWS
+LIBS += -lws2_32
+endif
+
+OBJS += main.o
+OBJS += config_file.o
+
+OBJS += ../src/ap/hostapd.o
+OBJS += ../src/ap/wpa_auth_glue.o
+OBJS += ../src/ap/drv_callbacks.o
+OBJS += ../src/ap/ap_drv_ops.o
+OBJS += ../src/ap/utils.o
+OBJS += ../src/ap/authsrv.o
+OBJS += ../src/ap/ieee802_1x.o
+OBJS += ../src/ap/ap_config.o
+OBJS += ../src/ap/ieee802_11_auth.o
+OBJS += ../src/ap/sta_info.o
+OBJS += ../src/ap/wpa_auth.o
+OBJS += ../src/ap/tkip_countermeasures.o
+OBJS += ../src/ap/ap_mlme.o
+OBJS += ../src/ap/wpa_auth_ie.o
+OBJS += ../src/ap/preauth_auth.o
+OBJS += ../src/ap/pmksa_cache_auth.o
+
+NEED_RC4=y
+NEED_AES=y
+NEED_MD5=y
+NEED_SHA1=y
+
+OBJS += ../src/drivers/drivers.o
+CFLAGS += -DHOSTAPD
+
+ifdef CONFIG_WPA_TRACE
+CFLAGS += -DWPA_TRACE
+OBJS += ../src/utils/trace.o
+LDFLAGS += -rdynamic
+CFLAGS += -funwind-tables
+ifdef CONFIG_WPA_TRACE_BFD
+CFLAGS += -DWPA_TRACE_BFD
+LIBS += -lbfd
+LIBS_c += -lbfd
+endif
+endif
+
+OBJS += ../src/utils/eloop.o
+OBJS += ../src/utils/common.o
+OBJS += ../src/utils/wpa_debug.o
+OBJS += ../src/utils/wpabuf.o
+OBJS += ../src/utils/os_$(CONFIG_OS).o
+OBJS += ../src/utils/ip_addr.o
+
+OBJS += ../src/common/ieee802_11_common.o
+OBJS += ../src/common/wpa_common.o
+
+OBJS += ../src/eapol_auth/eapol_auth_sm.o
+
+
+ifndef CONFIG_NO_DUMP_STATE
+# define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
+# a file (undefine it, if you want to save in binary size)
+CFLAGS += -DHOSTAPD_DUMP_STATE
+OBJS += dump_state.o
+OBJS += ../src/eapol_auth/eapol_auth_dump.o
+endif
+
+ifdef CONFIG_NO_RADIUS
+CFLAGS += -DCONFIG_NO_RADIUS
+CONFIG_NO_ACCOUNTING=y
+else
+OBJS += ../src/radius/radius.o
+OBJS += ../src/radius/radius_client.o
+endif
+
+ifdef CONFIG_NO_ACCOUNTING
+CFLAGS += -DCONFIG_NO_ACCOUNTING
+else
+OBJS += ../src/ap/accounting.o
+endif
+
+ifdef CONFIG_NO_VLAN
+CFLAGS += -DCONFIG_NO_VLAN
+else
+OBJS += ../src/ap/vlan_init.o
+endif
+
+ifdef CONFIG_NO_CTRL_IFACE
+CFLAGS += -DCONFIG_NO_CTRL_IFACE
+else
+OBJS += ctrl_iface.o
+OBJS += ../src/ap/ctrl_iface_ap.o
+endif
+
+OBJS += ../src/crypto/md5.o
+
+CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
+
+ifdef CONFIG_IAPP
+CFLAGS += -DCONFIG_IAPP
+OBJS += ../src/ap/iapp.o
+endif
+
+ifdef CONFIG_RSN_PREAUTH
+CFLAGS += -DCONFIG_RSN_PREAUTH
+CONFIG_L2_PACKET=y
+endif
+
+ifdef CONFIG_PEERKEY
+CFLAGS += -DCONFIG_PEERKEY
+OBJS += ../src/ap/peerkey_auth.o
+endif
+
+ifdef CONFIG_IEEE80211W
+CFLAGS += -DCONFIG_IEEE80211W
+NEED_SHA256=y
+NEED_AES_OMAC1=y
+endif
+
+ifdef CONFIG_IEEE80211R
+CFLAGS += -DCONFIG_IEEE80211R
+OBJS += ../src/ap/wpa_auth_ft.o
+NEED_SHA256=y
+NEED_AES_OMAC1=y
+NEED_AES_UNWRAP=y
+endif
+
+ifdef CONFIG_IEEE80211N
+CFLAGS += -DCONFIG_IEEE80211N
+endif
+
+include ../src/drivers/drivers.mak
+OBJS += $(DRV_AP_OBJS)
+CFLAGS += $(DRV_AP_CFLAGS)
+LDFLAGS += $(DRV_AP_LDFLAGS)
+LIBS += $(DRV_AP_LIBS)
+
+ifdef CONFIG_L2_PACKET
+ifdef CONFIG_DNET_PCAP
+ifdef CONFIG_L2_FREEBSD
+LIBS += -lpcap
+OBJS += ../src/l2_packet/l2_packet_freebsd.o
+else
+LIBS += -ldnet -lpcap
+OBJS += ../src/l2_packet/l2_packet_pcap.o
+endif
+else
+OBJS += ../src/l2_packet/l2_packet_linux.o
+endif
+else
+OBJS += ../src/l2_packet/l2_packet_none.o
+endif
+
+
+ifdef CONFIG_EAP_MD5
+CFLAGS += -DEAP_SERVER_MD5
+OBJS += ../src/eap_server/eap_server_md5.o
+CHAP=y
+endif
+
+ifdef CONFIG_EAP_TLS
+CFLAGS += -DEAP_SERVER_TLS
+OBJS += ../src/eap_server/eap_server_tls.o
+TLS_FUNCS=y
+endif
+
+ifdef CONFIG_EAP_PEAP
+CFLAGS += -DEAP_SERVER_PEAP
+OBJS += ../src/eap_server/eap_server_peap.o
+OBJS += ../src/eap_common/eap_peap_common.o
+TLS_FUNCS=y
+CONFIG_EAP_MSCHAPV2=y
+endif
+
+ifdef CONFIG_EAP_TTLS
+CFLAGS += -DEAP_SERVER_TTLS
+OBJS += ../src/eap_server/eap_server_ttls.o
+TLS_FUNCS=y
+CHAP=y
+endif
+
+ifdef CONFIG_EAP_MSCHAPV2
+CFLAGS += -DEAP_SERVER_MSCHAPV2
+OBJS += ../src/eap_server/eap_server_mschapv2.o
+MS_FUNCS=y
+endif
+
+ifdef CONFIG_EAP_GTC
+CFLAGS += -DEAP_SERVER_GTC
+OBJS += ../src/eap_server/eap_server_gtc.o
+endif
+
+ifdef CONFIG_EAP_SIM
+CFLAGS += -DEAP_SERVER_SIM
+OBJS += ../src/eap_server/eap_server_sim.o
+CONFIG_EAP_SIM_COMMON=y
+NEED_AES_CBC=y
+endif
+
+ifdef CONFIG_EAP_AKA
+CFLAGS += -DEAP_SERVER_AKA
+OBJS += ../src/eap_server/eap_server_aka.o
+CONFIG_EAP_SIM_COMMON=y
+NEED_SHA256=y
+NEED_AES_CBC=y
+endif
+
+ifdef CONFIG_EAP_AKA_PRIME
+CFLAGS += -DEAP_SERVER_AKA_PRIME
+endif
+
+ifdef CONFIG_EAP_SIM_COMMON
+OBJS += ../src/eap_common/eap_sim_common.o
+# Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
+# replaced with another file implementating the interface specified in
+# eap_sim_db.h.
+OBJS += ../src/eap_server/eap_sim_db.o
+NEED_FIPS186_2_PRF=y
+endif
+
+ifdef CONFIG_EAP_PAX
+CFLAGS += -DEAP_SERVER_PAX
+OBJS += ../src/eap_server/eap_server_pax.o ../src/eap_common/eap_pax_common.o
+endif
+
+ifdef CONFIG_EAP_PSK
+CFLAGS += -DEAP_SERVER_PSK
+OBJS += ../src/eap_server/eap_server_psk.o ../src/eap_common/eap_psk_common.o
+NEED_AES_OMAC1=y
+NEED_AES_ENCBLOCK=y
+NEED_AES_EAX=y
+endif
+
+ifdef CONFIG_EAP_SAKE
+CFLAGS += -DEAP_SERVER_SAKE
+OBJS += ../src/eap_server/eap_server_sake.o ../src/eap_common/eap_sake_common.o
+endif
+
+ifdef CONFIG_EAP_GPSK
+CFLAGS += -DEAP_SERVER_GPSK
+OBJS += ../src/eap_server/eap_server_gpsk.o ../src/eap_common/eap_gpsk_common.o
+ifdef CONFIG_EAP_GPSK_SHA256
+CFLAGS += -DEAP_SERVER_GPSK_SHA256
+endif
+NEED_SHA256=y
+NEED_AES_OMAC1=y
+endif
+
+ifdef CONFIG_EAP_VENDOR_TEST
+CFLAGS += -DEAP_SERVER_VENDOR_TEST
+OBJS += ../src/eap_server/eap_server_vendor_test.o
+endif
+
+ifdef CONFIG_EAP_FAST
+CFLAGS += -DEAP_SERVER_FAST
+OBJS += ../src/eap_server/eap_server_fast.o
+OBJS += ../src/eap_common/eap_fast_common.o
+TLS_FUNCS=y
+NEED_T_PRF=y
+NEED_AES_UNWRAP=y
+endif
+
+ifdef CONFIG_WPS
+CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
+OBJS += ../src/utils/uuid.o
+OBJS += ../src/ap/wps_hostapd.o
+OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o
+OBJS += ../src/wps/wps.o
+OBJS += ../src/wps/wps_common.o
+OBJS += ../src/wps/wps_attr_parse.o
+OBJS += ../src/wps/wps_attr_build.o
+OBJS += ../src/wps/wps_attr_process.o
+OBJS += ../src/wps/wps_dev_attr.o
+OBJS += ../src/wps/wps_enrollee.o
+OBJS += ../src/wps/wps_registrar.o
+NEED_DH_GROUPS=y
+NEED_SHA256=y
+NEED_BASE64=y
+NEED_AES_CBC=y
+NEED_MODEXP=y
+CONFIG_EAP=y
+
+ifdef CONFIG_WPS_UFD
+CFLAGS += -DCONFIG_WPS_UFD
+OBJS += ../src/wps/wps_ufd.o
+NEED_WPS_OOB=y
+endif
+
+ifdef CONFIG_WPS_NFC
+CFLAGS += -DCONFIG_WPS_NFC
+OBJS += ../src/wps/ndef.o
+OBJS += ../src/wps/wps_nfc.o
+NEED_WPS_OOB=y
+ifdef CONFIG_WPS_NFC_PN531
+PN531_PATH ?= /usr/local/src/nfc
+CFLAGS += -DCONFIG_WPS_NFC_PN531
+CFLAGS += -I${PN531_PATH}/inc
+OBJS += ../src/wps/wps_nfc_pn531.o
+LIBS += ${PN531_PATH}/lib/wpsnfc.dll
+LIBS += ${PN531_PATH}/lib/libnfc_mapping_pn53x.dll
+endif
+endif
+

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

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 10:44:25 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DEE8B1065695;
	Wed,  3 Nov 2010 10:44:25 +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 CBA678FC24;
	Wed,  3 Nov 2010 10:44:25 +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 oA3AiPE4018219;
	Wed, 3 Nov 2010 10:44:25 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3AiPwS018213;
	Wed, 3 Nov 2010 10:44:25 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <201011031044.oA3AiPwS018213@svn.freebsd.org>
From: Rui Paulo 
Date: Wed, 3 Nov 2010 10:44:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214735 - in head/usr.sbin/wpa: hostapd wpa_passphrase
	wpa_supplicant
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 10:44:26 -0000

Author: rpaulo
Date: Wed Nov  3 10:44:25 2010
New Revision: 214735
URL: http://svn.freebsd.org/changeset/base/214735

Log:
  Adapt for wpa_supplicant / hostapd 0.7.3.

Modified:
  head/usr.sbin/wpa/hostapd/Makefile
  head/usr.sbin/wpa/hostapd/driver_freebsd.c
  head/usr.sbin/wpa/wpa_passphrase/Makefile
  head/usr.sbin/wpa/wpa_supplicant/Makefile
  head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c

Modified: head/usr.sbin/wpa/hostapd/Makefile
==============================================================================
--- head/usr.sbin/wpa/hostapd/Makefile	Wed Nov  3 10:43:38 2010	(r214734)
+++ head/usr.sbin/wpa/hostapd/Makefile	Wed Nov  3 10:44:25 2010	(r214735)
@@ -3,17 +3,31 @@
 .include "${.CURDIR}/../Makefile.inc"
 
 .PATH.c:${HOSTAPD_DISTDIR} \
+	${WPA_DISTDIR}/src/ap \
 	${WPA_DISTDIR}/src/eap_server \
+	${WPA_DISTDIR}/src/eap_common \
+	${WPA_DISTDIR}/src/eapol_auth \
+	${WPA_DISTDIR}/src/drivers \
 	${WPA_DISTDIR}/src/radius \
+	${WPA_DISTDIR}
 
 PROG=	hostapd
-SRCS=	accounting.c aes.c aes_wrap.c ap_list.c beacon.c common.c \
-	config.c ctrl_iface.c drivers.c eapol_sm.c eap.c eap_common.c \
-	eap_identity.c eap_methods.c eloop.c hostapd.c \
-	hw_features.c ieee802_11.c ieee802_11_common.c ieee802_11_auth.c \
-	ieee802_1x.c ip_addr.c md5.c mlme.c pmksa_cache.c radius.c \
-	radius_client.c rc4.c sha1.c sta_info.c vlan_init.c wme.c \
-	wpa.c wpa_auth_ie.c wpa_common.c wpa_debug.c wpabuf.c
+SRCS=	accounting.c aes-wrap.c ap_config.c \
+	ap_drv_ops.c ap_mlme.c authsrv.c \
+	chap.c common.c config_file.c ctrl_iface.c crypto_openssl.c \
+	ctrl_iface_ap.c drivers.c drv_callbacks.c dump_state.c \
+	eap_common.c eap_peap_common.c eap_register.c eap_server.c \
+	eap_server_gtc.c eap_server_identity.c eap_server_md5.c \
+	eap_server_methods.c eap_server_mschapv2.c eap_server_peap.c \
+	eap_server_tls.c eap_server_tls_common.c eap_server_ttls.c \
+	eapol_auth_dump.c eapol_auth_sm.c eloop.c hostapd.c ieee802_11_auth.c \
+	ieee802_11_common.c ieee802_11_ht.c ieee802_1x.c ip_addr.c \
+	md5.c main.c ms_funcs.c peerkey_auth.c pmksa_cache_auth.c \
+	preauth_auth.c radius.c radius_client.c sta_info.c \
+	sha1-pbkdf2.c sha1-tlsprf.c sha1-tprf.c sha1.c \
+	tkip_countermeasures.c utils.c \
+	vlan_init.c wpa_auth.c wpa_auth_glue.c wpa_auth_ie.c wpa_common.c \
+	wpa_debug.c wpabuf.c
 SRCS+=	l2_packet_freebsd.c driver_freebsd.c os_unix.c
 
 MAN=	hostapd.8 hostapd.conf.5
@@ -24,16 +38,16 @@ FILESDIR= ${SHAREDIR}/examples/hostapd
 FILES=	hostapd.conf hostapd.eap_user hostapd.wpa_psk
 .endif
 
-CFLAGS+= -I${HOSTAPD_DISTDIR}
+CFLAGS+= -I${HOSTAPD_DISTDIR} -I${WPA_DISTDIR}/src/drivers
 
-CFLAGS+= -DCONFIG_DRIVER_BSD
+CFLAGS+= -DCONFIG_DRIVER_BSD -DHOSTAPD
 CFLAGS+= -DCONFIG_DRIVER_RADIUS_ACL
 .if ${MK_INET6} != "no"
 CFLAGS+= -DCONFIG_IPV6
 .endif
-CFLAGS+= -g
-DPADD+=	${LIBPCAP}
-LDADD+=	-lpcap
+#CFLAGS+= -g
+DPADD+=	${LIBPCAP} ${LIBSSL}
+LDADD+=	-lpcap -lssl
 
 # User customizations for wpa_supplicant/hostapd build environment
 CFLAGS+=${HOSTAPD_CFLAGS}

Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c
==============================================================================
--- head/usr.sbin/wpa/hostapd/driver_freebsd.c	Wed Nov  3 10:43:38 2010	(r214734)
+++ head/usr.sbin/wpa/hostapd/driver_freebsd.c	Wed Nov  3 10:44:25 2010	(r214735)
@@ -14,12 +14,13 @@
  *
  * $FreeBSD$
  */
-#include 
-#include 
-#include 
-#include 
+#include "includes.h"
 #include 
-#include 
+
+#include "common.h"
+#include "driver.h"
+#include "eloop.h"
+#include "common/ieee802_11_defs.h"
 
 #include 
 #include 
@@ -32,34 +33,29 @@
 #undef WPA_OUI_TYPE
 #undef WME_OUI_TYPE
 
-#include "hostapd.h"
-#include "driver.h"
-#include "ieee802_1x.h"
-#include "ieee802_11_auth.h"
-#include "eloop.h"
-#include "sta_info.h"
 #include "l2_packet/l2_packet.h"
 
-#include "eapol_sm.h"
-#include "wpa.h"
-#include "radius/radius.h"
-#include "ieee802_11.h"
-#include "common.h"
-#include "hostap_common.h"
-
 struct bsd_driver_data {
-	struct hostapd_data *hapd;		/* back pointer */
+	struct hostapd_data *hapd;      /* back pointer */
 
-	char	iface[IFNAMSIZ + 1];
-	unsigned int ifindex;			/* interface index */
-	struct l2_packet_data *sock_xmit;	/* raw packet xmit socket */
-	int	ioctl_sock;			/* socket for ioctl() use */
-	int	wext_sock;			/* socket for wireless events */
+	int     ioctl_sock;                  /* open socket for 802.11 ioctls */
+	int     wext_sock;
+	struct l2_packet_data *sock_xmit;/* raw packet xmit socket */
+	int     route;                  /* routing socket for events */
+	char    iface[IFNAMSIZ+1];     /* interface name */
+	unsigned int ifindex;           /* interface index */
+	void    *ctx;
+	struct wpa_driver_capa capa;    /* driver capability */
+	int     is_ap;                  /* Access point mode */
+	int     prev_roaming;   /* roaming state to restore on deinit */
+	int     prev_privacy;   /* privacy state to restore on deinit */
+	int     prev_wpa;       /* wpa state to restore on deinit */
 };
 
 static const struct wpa_driver_ops bsd_driver_ops;
 
-static int bsd_sta_deauth(void *priv, const u8 *addr, int reason_code);
+static int bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
+    int reason_code);
 
 static int
 set80211var(struct bsd_driver_data *drv, int op, const void *arg, int arg_len)
@@ -171,44 +167,37 @@ bsd_commit(void *priv)
 }
 
 static int
-bsd_set_ieee8021x(const char *ifname, void *priv, int enabled)
+bsd_set_ieee8021x(void *priv, struct wpa_bss_params *params)
 {
-	struct bsd_driver_data *drv = priv;
-	struct hostapd_data *hapd = drv->hapd;
-	struct hostapd_bss_config *conf = hapd->conf;
-
-	wpa_printf(MSG_DEBUG, "%s: enabled=%d\n", __func__, enabled);
+	wpa_printf(MSG_DEBUG, "%s: enabled=%d\n", __func__, params->enabled);
 
-	if (!enabled) {
+	if (!params->enabled) {
 		/* XXX restore state */
 		return set80211param(priv, IEEE80211_IOC_AUTHMODE,
 			IEEE80211_AUTH_AUTO);
 	}
-	if (!conf->wpa && !conf->ieee802_1x) {
-		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_DRIVER,
-			HOSTAPD_LEVEL_WARNING, "No 802.1X or WPA enabled!");
+	if (!params->wpa && !params->ieee802_1x) {
+		wpa_printf(MSG_ERROR, "%s: No 802.1X or WPA enabled",
+			   __func__);
 		return -1;
 	}
-	if (conf->wpa && set80211param(drv, IEEE80211_IOC_WPA, conf->wpa)) {
-		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_DRIVER,
-			HOSTAPD_LEVEL_WARNING, "Error configuring WPA state!");
+	if (params->wpa && set80211param(priv,IEEE80211_IOC_WPA, params->wpa)) {
+		wpa_printf(MSG_ERROR, "%s: Failed to configure WPA state",
+			  __func__);
 		return -1;
 	}
 	if (set80211param(priv, IEEE80211_IOC_AUTHMODE,
-		(conf->wpa ?  IEEE80211_AUTH_WPA : IEEE80211_AUTH_8021X))) {
-		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_DRIVER,
-			HOSTAPD_LEVEL_WARNING, "Error enabling WPA/802.1X!");
+		(params->wpa ?  IEEE80211_AUTH_WPA : IEEE80211_AUTH_8021X))) {
+		wpa_printf(MSG_ERROR, "%s: Failed to enable WPA/802.1X",
+			   __func__);
 		return -1;
 	}
 	return 0;
 }
 
 static int
-bsd_set_privacy(const char *ifname, void *priv, int enabled)
+bsd_set_privacy(void *priv, int enabled)
 {
-	struct bsd_driver_data *drv = priv;
-	struct hostapd_data *hapd = drv->hapd;
-
 	wpa_printf(MSG_DEBUG, "%s: enabled=%d\n", __func__, enabled);
 
 	return set80211param(priv, IEEE80211_IOC_PRIVACY, enabled);
@@ -238,9 +227,9 @@ bsd_sta_set_flags(void *priv, const u8 *
 	int flags_or, int flags_and)
 {
 	/* For now, only support setting Authorized flag */
-	if (flags_or & WLAN_STA_AUTHORIZED)
+	if (flags_or & WPA_STA_AUTHORIZED)
 		return bsd_set_sta_authorized(priv, addr, 1);
-	if (!(flags_and & WLAN_STA_AUTHORIZED))
+	if (!(flags_and & WPA_STA_AUTHORIZED))
 		return bsd_set_sta_authorized(priv, addr, 0);
 	return 0;
 }
@@ -267,53 +256,64 @@ bsd_del_key(void *priv, const unsigned c
 }
 
 static int
-bsd_set_key(const char *ifname, void *priv, const char *alg,
-	    const u8 *addr, int key_idx,
-	    const u8 *key, size_t key_len, int txkey)
+bsd_set_key(const char *ifname, void *priv, enum wpa_alg alg,
+	    const unsigned char *addr, int key_idx, int set_tx, const u8 *seq,
+	    size_t seq_len, const u8 *key, size_t key_len)
 {
-	struct bsd_driver_data *drv = priv;
-	struct hostapd_data *hapd = drv->hapd;
 	struct ieee80211req_key wk;
-	u_int8_t cipher;
 
-	if (strcmp(alg, "none") == 0)
-		return bsd_del_key(priv, addr, key_idx);
+	wpa_printf(MSG_DEBUG, "%s: alg=%d addr=%p key_idx=%d set_tx=%d "
+		  "seq_len=%zu key_len=%zu", __func__, alg, addr, key_idx,
+		  set_tx, seq_len, key_len);
 
-	wpa_printf(MSG_DEBUG, "%s: alg=%s addr=%s key_idx=%d\n",
-		__func__, alg, ether_sprintf(addr), key_idx);
+	if (alg == WPA_ALG_NONE) {
+		return bsd_del_key(priv, addr, key_idx);
+	}
 
-	if (strcmp(alg, "WEP") == 0)
-		cipher = IEEE80211_CIPHER_WEP;
-	else if (strcmp(alg, "TKIP") == 0)
-		cipher = IEEE80211_CIPHER_TKIP;
-	else if (strcmp(alg, "CCMP") == 0)
-		cipher = IEEE80211_CIPHER_AES_CCM;
-	else {
-		printf("%s: unknown/unsupported algorithm %s\n",
-			__func__, alg);
+	os_memset(&wk, 0, sizeof(wk));
+	switch (alg) {
+	case WPA_ALG_WEP:
+		wk.ik_type = IEEE80211_CIPHER_WEP;
+		break;
+	case WPA_ALG_TKIP:
+		wk.ik_type = IEEE80211_CIPHER_TKIP;
+		break;
+	case WPA_ALG_CCMP:
+		wk.ik_type = IEEE80211_CIPHER_AES_CCM;
+		break;
+	default:
+		wpa_printf(MSG_ERROR, "%s: unknown alg=%d", __func__, alg);
 		return -1;
 	}
 
-	if (key_len > sizeof(wk.ik_keydata)) {
-		printf("%s: key length %d too big\n", __func__, key_len);
-		return -3;
-	}
+	wk.ik_flags = IEEE80211_KEY_RECV;
+	if (set_tx)
+		wk.ik_flags |= IEEE80211_KEY_XMIT;
 
-	memset(&wk, 0, sizeof(wk));
-	wk.ik_type = cipher;
 	if (addr == NULL) {
-		memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
+		os_memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
 		wk.ik_keyix = key_idx;
-		wk.ik_flags = IEEE80211_KEY_XMIT
-			    | IEEE80211_KEY_GROUP
-			    | IEEE80211_KEY_DEFAULT;
 	} else {
-		memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
-		wk.ik_keyix = IEEE80211_KEYIX_NONE;
-		wk.ik_flags = IEEE80211_KEY_RECV | IEEE80211_KEY_XMIT;
+		os_memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
+		/*
+		 * Deduce whether group/global or unicast key by checking
+		 * the address (yech).  Note also that we can only mark global
+		 * keys default; doing this for a unicast key is an error.
+		 */
+		if (os_memcmp(addr, "\xff\xff\xff\xff\xff\xff",
+			      IEEE80211_ADDR_LEN) == 0) {
+			wk.ik_flags |= IEEE80211_KEY_GROUP;
+			wk.ik_keyix = key_idx;
+		} else {
+			wk.ik_keyix = key_idx == 0 ? IEEE80211_KEYIX_NONE :
+				key_idx;
+		}
 	}
+	if (wk.ik_keyix != IEEE80211_KEYIX_NONE && set_tx)
+		wk.ik_flags |= IEEE80211_KEY_DEFAULT;
 	wk.ik_keylen = key_len;
-	memcpy(wk.ik_keydata, key, key_len);
+	os_memcpy(&wk.ik_keyrsc, seq, seq_len);
+	os_memcpy(wk.ik_keydata, key, key_len);
 
 	return set80211var(priv, IEEE80211_IOC_WPAKEY, &wk, sizeof(wk));
 }
@@ -355,7 +355,7 @@ bsd_flush(void *priv)
 	u8 allsta[IEEE80211_ADDR_LEN];
 
 	memset(allsta, 0xff, IEEE80211_ADDR_LEN);
-	return bsd_sta_deauth(priv, allsta, IEEE80211_REASON_AUTH_LEAVE);
+	return bsd_sta_deauth(priv, NULL, allsta, IEEE80211_REASON_AUTH_LEAVE);
 }
 
 
@@ -393,7 +393,7 @@ bsd_sta_clear_stats(void *priv, const u8
 }
 
 static int
-bsd_set_opt_ie(const char *ifname, void *priv, const u8 *ie, size_t ie_len)
+bsd_set_opt_ie(void *priv, const u8 *ie, size_t ie_len)
 {
 	struct bsd_driver_data *drv = priv;
 	struct hostapd_data *hapd = drv->hapd;
@@ -416,7 +416,7 @@ bsd_set_opt_ie(const char *ifname, void 
 }
 
 static int
-bsd_sta_deauth(void *priv, const u8 *addr, int reason_code)
+bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, int reason_code)
 {
 	struct bsd_driver_data *drv = priv;
 	struct hostapd_data *hapd = drv->hapd;
@@ -432,7 +432,7 @@ bsd_sta_deauth(void *priv, const u8 *add
 }
 
 static int
-bsd_sta_disassoc(void *priv, const u8 *addr, int reason_code)
+bsd_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr, int reason_code)
 {
 	struct bsd_driver_data *drv = priv;
 	struct hostapd_data *hapd = drv->hapd;
@@ -446,85 +446,32 @@ bsd_sta_disassoc(void *priv, const u8 *a
 	return set80211var(priv, IEEE80211_IOC_MLME, &mlme, sizeof(mlme));
 }
 
-static int
-bsd_del_sta(struct bsd_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
-{
-	struct hostapd_data *hapd = drv->hapd;
-	struct hostapd_bss_config *conf = hapd->conf;
-	struct sta_info *sta;
-
-	hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
-		HOSTAPD_LEVEL_INFO, "deassociated");
-
-	sta = ap_get_sta(hapd, addr);
-	if (sta != NULL) {
-		sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
-		if (conf->wpa)
-			wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
-		sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
-		ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
-		ap_free_sta(hapd, sta);
-	}
-	return 0;
-}
-
-static int
-bsd_new_sta(struct bsd_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
+static void
+bsd_new_sta(void *priv, void *ctx, u8 addr[IEEE80211_ADDR_LEN])
 {
-	struct hostapd_data *hapd = drv->hapd;
-	struct hostapd_bss_config *conf = hapd->conf;
-	struct sta_info *sta;
 	struct ieee80211req_wpaie ie;
-	int new_assoc, ielen, res;
-
-	hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
-		HOSTAPD_LEVEL_INFO, "associated");
+	int ielen = 0;
+	u8 *iebuf = NULL;
 
-	sta = ap_sta_add(hapd, addr);
-	if (sta == NULL)
-		return -1;
 	/*
 	 * Fetch and validate any negotiated WPA/RSN parameters.
 	 */
-	if (conf->wpa) {
-		memset(&ie, 0, sizeof(ie));
-		memcpy(ie.wpa_macaddr, addr, IEEE80211_ADDR_LEN);
-		if (get80211var(drv, IEEE80211_IOC_WPAIE, &ie, sizeof(ie)) < 0) {
-			printf("Failed to get WPA/RSN information element.\n");
-			return -1;		/* XXX not right */
-		}
-		if (ie.wpa_ie[1] == 0) {
-			printf("No WPA/RSN information element for station!\n");
-			return -1;		/* XXX not right */
-		}
-		if (sta->wpa_sm == NULL)
-			sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
-							sta->addr);
-		if (sta->wpa_sm == NULL) {
-			printf("Failed to initialize WPA state machine\n");
-			return -1;
-		}
-		ielen = 2 + ie.wpa_ie[1];
-		res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm,
-					  ie.wpa_ie, ielen, NULL, 0);
-		if (res != WPA_IE_OK) {
-			printf("WPA/RSN information element rejected? "
-				"(res %u)\n", res);
-			return -1;
-		}
-	}
+	memset(&ie, 0, sizeof(ie));
+	memcpy(ie.wpa_macaddr, addr, IEEE80211_ADDR_LEN);
+	if (get80211var(priv, IEEE80211_IOC_WPAIE, &ie, sizeof(ie)) < 0) {
+		printf("Failed to get WPA/RSN information element.\n");
+		goto no_ie;
+	}
+	iebuf = ie.wpa_ie;
+	ielen = ie.wpa_ie[1];
+	if (ielen == 0)
+		iebuf = NULL;
+	else
+		ielen += 2;
 
-	/*
-	 * Now that the internal station state is setup
-	 * kick the authenticator into action.
-	 */
-	new_assoc = (sta->flags & WLAN_STA_ASSOC) == 0;
-	sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC;
-	wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC);
-	hostapd_new_assoc_sta(hapd, sta, !new_assoc);
-	ieee802_1x_notify_port_enabled(sta->eapol_sm, 1);
+no_ie:
+        drv_event_assoc(ctx, addr, iebuf, ielen);
 
-	return 0;
 }
 
 #include 
@@ -545,6 +492,7 @@ bsd_wireless_event_receive(int sock, voi
 	struct ieee80211_auth_event *auth;
 #endif
 	int n;
+	union wpa_event_data data;
 
 	n = read(sock, buf, sizeof(buf));
 	if (n < 0) {
@@ -576,14 +524,14 @@ bsd_wireless_event_receive(int sock, voi
 			break;
 		case RTM_IEEE80211_LEAVE:
 			leave = (struct ieee80211_leave_event *) &ifan[1];
-			bsd_del_sta(drv, leave->iev_addr);
+			drv_event_disassoc(drv->hapd, leave->iev_addr);
 			break;
 		case RTM_IEEE80211_JOIN:
 #ifdef RTM_IEEE80211_REJOIN
 		case RTM_IEEE80211_REJOIN:
 #endif
 			join = (struct ieee80211_join_event *) &ifan[1];
-			bsd_new_sta(drv, join->iev_addr);
+			bsd_new_sta(drv, drv->hapd, join->iev_addr);
 			break;
 		case RTM_IEEE80211_REPLAY:
 			/* ignore */
@@ -594,9 +542,13 @@ bsd_wireless_event_receive(int sock, voi
 				"Michael MIC failure wireless event: "
 				"keyix=%u src_addr=" MACSTR, mic->iev_keyix,
 				MAC2STR(mic->iev_src));
-			ieee80211_michael_mic_failure(hapd, mic->iev_src, 1);
+			os_memset(&data, 0, sizeof(data));
+			data.michael_mic_failure.unicast = 1;
+			data.michael_mic_failure.src = mic->iev_src;
+			wpa_supplicant_event(drv->hapd,
+					     EVENT_MICHAEL_MIC_FAILURE, &data);
 			break;
-#ifdef CONFIG_DRIVER_RADIUS_ACL
+#ifdef CONFIG_DRIVER_RADIUS_ACL_NOT_YET
 		case RTM_IEEE80211_AUTH:
 			auth = (struct ieee80211_auth_event *) &ifan[1];
 			wpa_printf(MSG_DEBUG, "802.11 AUTH, STA = " MACSTR,
@@ -628,41 +580,9 @@ bsd_wireless_event_receive(int sock, voi
 }
 
 static int
-bsd_wireless_event_init(void *priv)
-{
-	struct bsd_driver_data *drv = priv;
-	int s;
-
-	drv->wext_sock = -1;
-
-	s = socket(PF_ROUTE, SOCK_RAW, 0);
-	if (s < 0) {
-		perror("socket(PF_ROUTE,SOCK_RAW)");
-		return -1;
-	}
-	eloop_register_read_sock(s, bsd_wireless_event_receive, drv, NULL);
-	drv->wext_sock = s;
-
-	return 0;
-}
-
-static void
-bsd_wireless_event_deinit(void *priv)
-{
-	struct bsd_driver_data *drv = priv;
-
-	if (drv != NULL) {
-		if (drv->wext_sock < 0)
-			return;
-		eloop_unregister_read_sock(drv->wext_sock);
-		close(drv->wext_sock);
-	}
-}
-
-
-static int
 bsd_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len,
 	       int encrypt, const u8 *own_addr)
+	      
 {
 	struct bsd_driver_data *drv = priv;
 	struct hostapd_data *hapd = drv->hapd;
@@ -706,25 +626,14 @@ static void
 handle_read(void *ctx, const u8 *src_addr, const u8 *buf, size_t len)
 {
 	struct bsd_driver_data *drv = ctx;
-	struct hostapd_data *hapd = drv->hapd;
-	struct sta_info *sta;
-
-	sta = ap_get_sta(hapd, src_addr);
-	if (!sta || !(sta->flags & WLAN_STA_ASSOC)) {
-		printf("Data frame from not associated STA %s\n",
-		       ether_sprintf(src_addr));
-		/* XXX cannot happen */
-		return;
-	}
-	ieee802_1x_receive(hapd, src_addr, buf + sizeof(struct l2_ethhdr),
-			   len - sizeof(struct l2_ethhdr));
+	drv_event_eapol_rx(drv->hapd, src_addr, buf, len);
 }
 
 static int
-bsd_get_ssid(const char *ifname, void *priv, u8 *buf, int len)
+bsd_get_ssid(void *priv, u8 *buf, int len)
 {
 	struct bsd_driver_data *drv = priv;
-	struct hostapd_data *hapd = drv->hapd;
+
 	int ssid_len = get80211var(priv, IEEE80211_IOC_SSID, buf, len);
 
 	wpa_printf(MSG_DEBUG, "%s: ssid=\"%.*s\"\n", __func__, ssid_len, buf);
@@ -733,7 +642,7 @@ bsd_get_ssid(const char *ifname, void *p
 }
 
 static int
-bsd_set_ssid(const char *ifname, void *priv, const u8 *buf, int len)
+bsd_set_ssid(void *priv, const u8 *buf, int len)
 {
 	struct bsd_driver_data *drv = priv;
 	struct hostapd_data *hapd = drv->hapd;
@@ -752,7 +661,7 @@ bsd_set_countermeasures(void *priv, int 
 	return set80211param(drv, IEEE80211_IOC_COUNTERMEASURES, enabled);
 }
 
-#ifdef CONFIG_DRIVER_RADIUS_ACL
+#ifdef CONFIG_DRIVER_RADIUS_ACL_NOT_YET
 static int 
 bsd_set_radius_acl_auth(void *priv, const u8 *mac, int accepted, 
 	u32 session_timeout)
@@ -814,24 +723,23 @@ bsd_set_radius_acl_expire(void *priv, co
 #endif /* CONFIG_DRIVER_RADIUS_ACL */
 
 static void *
-bsd_init(struct hostapd_data *hapd)
+bsd_init(struct hostapd_data *hapd, struct wpa_init_params *params)
 {
 	struct bsd_driver_data *drv;
 
-	drv = malloc(sizeof(struct bsd_driver_data));
+	drv = os_zalloc(sizeof(struct bsd_driver_data));
 	if (drv == NULL) {
 		printf("Could not allocate memory for bsd driver data\n");
 		goto bad;
 	}
 
-	memset(drv, 0, sizeof(*drv));
 	drv->hapd = hapd;
 	drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
 	if (drv->ioctl_sock < 0) {
 		perror("socket[PF_INET,SOCK_DGRAM]");
 		goto bad;
 	}
-	memcpy(drv->iface, hapd->conf->iface, sizeof(drv->iface));
+	memcpy(drv->iface, params->ifname, sizeof(drv->iface));
 	/*
 	 * NB: We require the interface name be mappable to an index.
 	 *     This implies we do not support having wpa_supplicant
@@ -849,10 +757,20 @@ bsd_init(struct hostapd_data *hapd)
 					handle_read, drv, 1);
 	if (drv->sock_xmit == NULL)
 		goto bad;
-	if (l2_packet_get_own_addr(drv->sock_xmit, hapd->own_addr))
+	if (l2_packet_get_own_addr(drv->sock_xmit, params->own_addr))
 		goto bad;
 
-	bsd_set_iface_flags(drv, -IFF_UP);	/* mark down during setup */
+	/* mark down during setup */
+	if (bsd_set_iface_flags(drv, -IFF_UP) < 0)
+		goto bad;
+
+	drv->route = socket(PF_ROUTE, SOCK_RAW, 0);
+	if (drv->route < 0) {
+		perror("socket(PF_ROUTE,SOCK_RAW)");
+		goto bad;
+	}
+	eloop_register_read_sock(drv->route, bsd_wireless_event_receive, drv,
+				 NULL);
 
 	return drv;
 bad:
@@ -872,6 +790,10 @@ bsd_deinit(void *priv)
 {
 	struct bsd_driver_data *drv = priv;
 
+	if (drv->route >= 0) {
+		eloop_unregister_read_sock(drv->route);
+		close(drv->route);
+	}
 	(void) bsd_set_iface_flags(drv, -IFF_UP);
 	if (drv->ioctl_sock >= 0)
 		close(drv->ioctl_sock);
@@ -882,27 +804,25 @@ bsd_deinit(void *priv)
 
 const struct wpa_driver_ops wpa_driver_bsd_ops = {
 	.name			= "bsd",
-	.init			= bsd_init,
-	.deinit			= bsd_deinit,
+	.hapd_init		= bsd_init,
+	.hapd_deinit		= bsd_deinit,
 	.set_ieee8021x		= bsd_set_ieee8021x,
 	.set_privacy		= bsd_set_privacy,
-	.set_encryption		= bsd_set_key,
+	.set_key		= bsd_set_key,
 	.get_seqnum		= bsd_get_seqnum,
 	.flush			= bsd_flush,
 	.set_generic_elem	= bsd_set_opt_ie,
-	.wireless_event_init	= bsd_wireless_event_init,
-	.wireless_event_deinit	= bsd_wireless_event_deinit,
 	.sta_set_flags		= bsd_sta_set_flags,
 	.read_sta_data		= bsd_read_sta_driver_data,
-	.send_eapol		= bsd_send_eapol,
+	.hapd_send_eapol	= bsd_send_eapol,
 	.sta_disassoc		= bsd_sta_disassoc,
 	.sta_deauth		= bsd_sta_deauth,
-	.set_ssid		= bsd_set_ssid,
-	.get_ssid		= bsd_get_ssid,
+	.hapd_set_ssid		= bsd_set_ssid,
+	.hapd_get_ssid		= bsd_get_ssid,
 	.set_countermeasures	= bsd_set_countermeasures,
 	.sta_clear_stats        = bsd_sta_clear_stats,
 	.commit			= bsd_commit,
-#ifdef CONFIG_DRIVER_RADIUS_ACL
+#ifdef CONFIG_DRIVER_RADIUS_ACL_NOT_YET
 	.set_radius_acl_auth	= bsd_set_radius_acl_auth,
 	.set_radius_acl_expire	= bsd_set_radius_acl_expire,
 #endif

Modified: head/usr.sbin/wpa/wpa_passphrase/Makefile
==============================================================================
--- head/usr.sbin/wpa/wpa_passphrase/Makefile	Wed Nov  3 10:43:38 2010	(r214734)
+++ head/usr.sbin/wpa/wpa_passphrase/Makefile	Wed Nov  3 10:44:25 2010	(r214735)
@@ -5,7 +5,8 @@
 .PATH.c:${WPA_SUPPLICANT_DISTDIR}
 
 PROG=	wpa_passphrase
-SRCS=	wpa_passphrase.c sha1.c md5.c
+SRCS=	wpa_passphrase.c sha1.c sha1-internal.c sha1-pbkdf2.c \
+	md5.c md5-internal.c
 
 CFLAGS+= -DINTERNAL_SHA1
 CFLAGS+= -DINTERNAL_MD5

Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile
==============================================================================
--- head/usr.sbin/wpa/wpa_supplicant/Makefile	Wed Nov  3 10:43:38 2010	(r214734)
+++ head/usr.sbin/wpa/wpa_supplicant/Makefile	Wed Nov  3 10:44:25 2010	(r214735)
@@ -6,11 +6,15 @@
 	${WPA_DISTDIR}/src/drivers \
 	${WPA_DISTDIR}/src/eap_peer \
 	${WPA_DISTDIR}/src/rsn_supp
+	${WPA_DISTDIR}/src/crypto
 
 PROG=	wpa_supplicant
-SRCS=	aes.c aes_wrap.c blacklist.c common.c config.c ctrl_iface.c \
+SRCS=	aes-cbc.c aes-ctr.c aes-eax.c aes-encblock.c \
+	aes-internal.c aes-omac1.c aes-unwrap.c \
+	aes-wrap.c bss.c blacklist.c common.c config.c ctrl_iface.c \
 	ctrl_iface_unix.c drivers.c eloop.c events.c l2_packet_freebsd.c main.c\
-	md5.c preauth.c pmksa_cache.c rc4.c scan.c scan_helpers.c sha1.c \
+	md5.c notify.c preauth.c pmksa_cache.c scan.c \
+	sha1-pbkdf2.c sha1-tlsprf.c sha1-tprf.c sha1.c \
 	wpa.c wpa_common.c wpa_debug.c wpa_ie.c wpa_supplicant.c \
 	wpabuf.c wpas_glue.c \
 	driver_ndis.c Packet32.c \
@@ -34,7 +38,7 @@ CFLAGS+= -DCONFIG_DRIVER_NDIS
 CFLAGS+= -DCONFIG_DRIVER_WIRED
 CFLAGS+= -DCONFIG_TERMINATE_ONLASTIF
 CFLAGS+= -DCONFIG_DEBUG_SYSLOG
-CFLAGS+= -g
+#CFLAGS+= -g
 DPADD+=	${LIBPCAP}
 LDADD+=	-lpcap
 
@@ -49,7 +53,7 @@ LDADD+=${WPA_SUPPLICANT_LDADD}
 #LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS}
 
 .if ${MK_WPA_SUPPLICANT_EAPOL} != "no"
-SRCS+=	eapol_supp_sm.c eap.c eap_common.c eap_methods.c
+SRCS+=	eapol_supp_sm.c eap.c eap_common.c eap_methods.c eap_register.c
 CFLAGS+= -DIEEE8021X_EAPOL
 
 .if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)

Modified: head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
==============================================================================
--- head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c	Wed Nov  3 10:43:38 2010	(r214734)
+++ head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c	Wed Nov  3 10:44:25 2010	(r214735)
@@ -220,7 +220,7 @@ wpa_driver_bsd_set_ssid(void *priv, cons
 
 static int
 wpa_driver_bsd_set_wpa_ie(struct wpa_driver_bsd_data *drv,
-	const char *wpa_ie, size_t wpa_ie_len)
+	const u8 *wpa_ie, size_t wpa_ie_len)
 {
 	struct ieee80211req ireq;
 
@@ -259,14 +259,6 @@ wpa_driver_bsd_set_wpa_internal(void *pr
 }
 
 static int
-wpa_driver_bsd_set_wpa(void *priv, int enabled)
-{
-	wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled);
-
-	return wpa_driver_bsd_set_wpa_internal(priv, enabled ? 3 : 0, enabled);
-}
-
-static int
 wpa_driver_bsd_del_key(struct wpa_driver_bsd_data *drv, int key_idx,
 		       const unsigned char *addr)
 {
@@ -290,7 +282,7 @@ wpa_driver_bsd_del_key(struct wpa_driver
 }
 
 static int
-wpa_driver_bsd_set_key(void *priv, wpa_alg alg,
+wpa_driver_bsd_set_key(const char *ifname, void *priv, enum wpa_alg alg,
 		       const unsigned char *addr, int key_idx, int set_tx,
 		       const u8 *seq, size_t seq_len,
 		       const u8 *key, size_t key_len)
@@ -393,6 +385,26 @@ wpa_driver_bsd_set_drop_unencrypted(void
 }
 
 static int
+wpa_driver_bsd_set_auth_alg(void *priv, int auth_alg)
+{
+	struct wpa_driver_bsd_data *drv = priv;
+	int authmode;
+
+	if ((auth_alg & WPA_AUTH_ALG_OPEN) &&
+	    (auth_alg & WPA_AUTH_ALG_SHARED))
+		authmode = IEEE80211_AUTH_AUTO;
+	else if (auth_alg & WPA_AUTH_ALG_SHARED)
+		authmode = IEEE80211_AUTH_SHARED;
+	else
+		authmode = IEEE80211_AUTH_OPEN;
+
+	wpa_printf(MSG_DEBUG, "%s alg 0x%x authmode %u",
+		__func__, auth_alg, authmode);
+
+	return set80211param(drv, IEEE80211_IOC_AUTHMODE, authmode);
+}
+
+static int
 wpa_driver_bsd_deauthenticate(void *priv, const u8 *addr, int reason_code)
 {
 	struct wpa_driver_bsd_data *drv = priv;
@@ -452,6 +464,11 @@ wpa_driver_bsd_associate(void *priv, str
 		return -1;
 	}
 
+        if (wpa_driver_bsd_set_drop_unencrypted(drv, params->drop_unencrypted)
+            < 0)
+                return -1;
+	if (wpa_driver_bsd_set_auth_alg(drv, params->auth_alg) < 0)
+		return -1;
 	/* XXX error handling is wrong but unclear what to do... */
 	if (wpa_driver_bsd_set_wpa_ie(drv, params->wpa_ie, params->wpa_ie_len) < 0)
 		return -1;
@@ -485,30 +502,11 @@ wpa_driver_bsd_associate(void *priv, str
 }
 
 static int
-wpa_driver_bsd_set_auth_alg(void *priv, int auth_alg)
-{
-	struct wpa_driver_bsd_data *drv = priv;
-	int authmode;
-
-	if ((auth_alg & AUTH_ALG_OPEN_SYSTEM) &&
-	    (auth_alg & AUTH_ALG_SHARED_KEY))
-		authmode = IEEE80211_AUTH_AUTO;
-	else if (auth_alg & AUTH_ALG_SHARED_KEY)
-		authmode = IEEE80211_AUTH_SHARED;
-	else
-		authmode = IEEE80211_AUTH_OPEN;
-
-	wpa_printf(MSG_DEBUG, "%s alg 0x%x authmode %u",
-		__func__, auth_alg, authmode);
-
-	return set80211param(drv, IEEE80211_IOC_AUTHMODE, authmode);
-}
-
-static int
-wpa_driver_bsd_scan(void *priv, const u8 *ssid, size_t ssid_len)
+wpa_driver_bsd_scan(void *priv, struct wpa_driver_scan_params *params)
 {
 	struct wpa_driver_bsd_data *drv = priv;
 	struct ieee80211_scan_req sr;
+	int i;
 	int flags;
 
 	/* XXX not true but easiest to perpetuate the myth */
@@ -529,30 +527,21 @@ wpa_driver_bsd_scan(void *priv, const u8
 		    | IEEE80211_IOC_SCAN_NOJOIN
 		    ;
 	sr.sr_duration = IEEE80211_IOC_SCAN_FOREVER;
-	if (ssid_len != 0) {
-		/* XXX ssid_len must be <= IEEE80211_NWID_LEN */
-		memcpy(sr.sr_ssid[sr.sr_nssid].ssid, ssid, ssid_len);
-		sr.sr_ssid[sr.sr_nssid].len = ssid_len;
-		sr.sr_nssid++;
-	}
-	if (drv->lastssid_len != 0 &&
-	    (drv->lastssid_len != ssid_len ||
-	     memcmp(drv->lastssid, ssid, ssid_len) != 0)) {
-		/*
-		 * If we are scanning because we received a deauth
-		 * and the scan cache is warm then we'll find the
-		 * ap there and short circuit a full-blown scan.
-		 */
-		memcpy(sr.sr_ssid[sr.sr_nssid].ssid, drv->lastssid,
-		    drv->lastssid_len);
-		sr.sr_ssid[sr.sr_nssid].len = drv->lastssid_len;
-		sr.sr_nssid++;
-		/* NB: clear so we don't retry w/o associating first */
-		drv->lastssid_len = 0;
-	}
-	if (sr.sr_nssid != 0)		/* NB: check scan cache first */
+	if (params->num_ssids > 0) {
+		sr.sr_nssid = params->num_ssids;
+#if 0
+		/* Boundary check is done by upper layer */
+		if (sr.sr_nssid > IEEE80211_IOC_SCAN_MAX_SSID)
+			sr.sr_nssid = IEEE80211_IOC_SCAN_MAX_SSID;
+#endif
+		/* NB: check scan cache first */
 		sr.sr_flags |= IEEE80211_IOC_SCAN_CHECK;
-
+}
+	for (i = 0; i < sr.sr_nssid; i++) {
+		sr.sr_ssid[i].len = params->ssids[i].ssid_len;
+		os_memcpy(sr.sr_ssid[i].ssid, params->ssids[i].ssid,
+			  sr.sr_ssid[i].len);
+	}
 	/* NB: net80211 delivers a scan complete event so no need to poll */
 	return set80211var(drv, IEEE80211_IOC_SCAN_REQ, &sr, sizeof(sr));
 }
@@ -654,40 +643,6 @@ wpa_driver_bsd_event_receive(int sock, v
 	}
 }
 
-/* Compare function for sorting scan results. Return >0 if @b is consider
- * better. */
-static int
-wpa_scan_result_compar(const void *a, const void *b)
-{
-	const struct wpa_scan_result *wa = a;
-	const struct wpa_scan_result *wb = b;
-
-	/* WPA/WPA2 support preferred */
-	if ((wb->wpa_ie_len || wb->rsn_ie_len) &&
-	    !(wa->wpa_ie_len || wa->rsn_ie_len))
-		return 1;
-	if (!(wb->wpa_ie_len || wb->rsn_ie_len) &&
-	    (wa->wpa_ie_len || wa->rsn_ie_len))
-		return -1;
-
-	/* privacy support preferred */
-	if ((wa->caps & IEEE80211_CAPINFO_PRIVACY) &&
-	    (wb->caps & IEEE80211_CAPINFO_PRIVACY) == 0)
-		return 1;
-	if ((wa->caps & IEEE80211_CAPINFO_PRIVACY) == 0 &&
-	    (wb->caps & IEEE80211_CAPINFO_PRIVACY))
-		return -1;
-
-	/* best/max rate preferred if signal level close enough XXX */
-	if (wa->maxrate != wb->maxrate && abs(wb->level - wa->level) < 5)
-		return wb->maxrate - wa->maxrate;
-
-	/* use freq for channel preference */
-
-	/* all things being equal, use signal level */
-	return wb->level - wa->level;
-}
-
 static int
 getmaxrate(const uint8_t rates[15], uint8_t nrates)
 {
@@ -715,74 +670,97 @@ iswpaoui(const u_int8_t *frm)
 	return frm[1] > 3 && LE_READ_4(frm+2) == ((WPA_OUI_TYPE<<24)|WPA_OUI);
 }
 
-static int
-wpa_driver_bsd_get_scan_results(void *priv,
-				     struct wpa_scan_result *results,
-				     size_t max_size)
-{
-#define	min(a,b)	((a)>(b)?(b):(a))
-	struct wpa_driver_bsd_data *drv = priv;
-	uint8_t buf[24*1024];
-	const uint8_t *cp, *vp;
-	const struct ieee80211req_scan_result *sr;
-	struct wpa_scan_result *wsr;
-	int len, ielen;
 
-	memset(results, 0, max_size * sizeof(struct wpa_scan_result));
+static void
+wpa_driver_bsd_add_scan_entry(struct wpa_scan_results *res,
+                              struct ieee80211req_scan_result *sr)
+{
+        struct wpa_scan_res *result, **tmp;
+        size_t extra_len;
+        u8 *pos;
+
+        extra_len = 2 + sr->isr_ssid_len;
+        extra_len += 2 + sr->isr_nrates;
+        extra_len += 3; /* ERP IE */
+        extra_len += sr->isr_ie_len;
+
+        result = os_zalloc(sizeof(*result) + extra_len);
+        if (result == NULL)
+                return;
+        os_memcpy(result->bssid, sr->isr_bssid, ETH_ALEN);
+        result->freq = sr->isr_freq;
+        result->beacon_int = sr->isr_intval;
+        result->caps = sr->isr_capinfo;
+        result->qual = sr->isr_rssi;
+        result->noise = sr->isr_noise;
+
+        pos = (u8 *)(result + 1);
+
+        *pos++ = WLAN_EID_SSID;
+        *pos++ = sr->isr_ssid_len;
+        os_memcpy(pos, sr + 1, sr->isr_ssid_len);
+        pos += sr->isr_ssid_len;
+
+        /*
+         * Deal all rates as supported rate.
+         * Because net80211 doesn't report extended supported rate or not.
+         */
+        *pos++ = WLAN_EID_SUPP_RATES;
+        *pos++ = sr->isr_nrates;
+        os_memcpy(pos, sr->isr_rates, sr->isr_nrates);
+       pos += sr->isr_nrates;
+
+        *pos++ = WLAN_EID_ERP_INFO;
+        *pos++ = 1;
+        *pos++ = sr->isr_erp;
+
+        os_memcpy(pos, (u8 *)(sr + 1) + sr->isr_ssid_len, sr->isr_ie_len);
+        pos += sr->isr_ie_len;
+
+        result->ie_len = pos - (u8 *)(result + 1);
+
+        tmp = os_realloc(res->res,
+                         (res->num + 1) * sizeof(struct wpa_scan_res *));
+        if (tmp == NULL) {
+                os_free(result);
+                return;
+        }
+        tmp[res->num++] = result;
+        res->res = tmp;
+}
+
+static struct wpa_scan_results *
+wpa_driver_bsd_get_scan_results2(void *priv)
+{
+	struct ieee80211req_scan_result *sr;
+	struct wpa_scan_results *res;
+	int len, rest;
+	uint8_t buf[24*1024], *pos;
 
-	len = get80211var(drv, IEEE80211_IOC_SCAN_RESULTS, buf, sizeof(buf));
+	len = get80211var(priv, IEEE80211_IOC_SCAN_RESULTS, buf, 24*1024);
 	if (len < 0)

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

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 10:46:39 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AB02810656A7;
	Wed,  3 Nov 2010 10:46:39 +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 7F6098FC27;
	Wed,  3 Nov 2010 10:46: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 oA3Akdxf018316;
	Wed, 3 Nov 2010 10:46:39 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3AkdGV018315;
	Wed, 3 Nov 2010 10:46:39 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <201011031046.oA3AkdGV018315@svn.freebsd.org>
From: Rui Paulo 
Date: Wed, 3 Nov 2010 10:46: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: r214736 - in head/contrib/wpa: src/drivers
	wpa_supplicant/xcode
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 10:46:39 -0000

Author: rpaulo
Date: Wed Nov  3 10:46:39 2010
New Revision: 214736
URL: http://svn.freebsd.org/changeset/base/214736

Log:
  Remove unused files.

Deleted:
  head/contrib/wpa/src/drivers/driver_atheros.c
  head/contrib/wpa/src/drivers/driver_none.c
  head/contrib/wpa/src/drivers/linux_ioctl.c
  head/contrib/wpa/src/drivers/linux_ioctl.h
  head/contrib/wpa/src/drivers/netlink.c
  head/contrib/wpa/src/drivers/netlink.h
  head/contrib/wpa/src/drivers/nl80211_copy.h
  head/contrib/wpa/src/drivers/wireless_copy.h
  head/contrib/wpa/wpa_supplicant/xcode/

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 13:43:00 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 06BBD106564A;
	Wed,  3 Nov 2010 13:43:00 +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 EA42B8FC16;
	Wed,  3 Nov 2010 13:42: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 oA3DgxbD022468;
	Wed, 3 Nov 2010 13:42:59 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3DgxeC022466;
	Wed, 3 Nov 2010 13:42:59 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011031342.oA3DgxeC022466@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 3 Nov 2010 13:42: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: r214738 - head
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 13:43:00 -0000

Author: jhb
Date: Wed Nov  3 13:42:59 2010
New Revision: 214738
URL: http://svn.freebsd.org/changeset/base/214738

Log:
  Delete machine/foo.h headers moved to x86/.  I forgot to commit this
  earlier.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Wed Nov  3 12:12:29 2010	(r214737)
+++ head/ObsoleteFiles.inc	Wed Nov  3 13:42:59 2010	(r214738)
@@ -14,6 +14,11 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20101101: headers moved to machine/ to x86/
+.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
+OLD_FILES+=usr/include/machine/apicreg.h
+OLD_FILES+=usr/include/machine/mca.h
+.endif
 # 20101020: catch up with vm_page_sleep_if_busy rename
 OLD_FILES+=usr/share/man/man9/vm_page_sleep_busy.9.gz
 # 20101011: removed subblock.h from liblzma

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 15:15:48 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CEF83106564A;
	Wed,  3 Nov 2010 15:15:48 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BD3718FC08;
	Wed,  3 Nov 2010 15:15: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 oA3FFmND024448;
	Wed, 3 Nov 2010 15:15:48 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FFmiP024443;
	Wed, 3 Nov 2010 15:15:48 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201011031515.oA3FFmiP024443@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Wed, 3 Nov 2010 15:15: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: r214739 - head/sys/powerpc/aim
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 15:15:49 -0000

Author: nwhitehorn
Date: Wed Nov  3 15:15:48 2010
New Revision: 214739
URL: http://svn.freebsd.org/changeset/base/214739

Log:
  Clean up the user segment handling code a little more. Now that
  set_user_sr() itself caches the user segment VSID, there is no need for
  cpu_switch() to do it again. This change also unifies the 32 and 64-bit
  code paths for kernel faults on user pages and remaps the user SLB slot
  on 64-bit systems when taking a syscall to avoid some unnecessary segment
  exception traps.

Modified:
  head/sys/powerpc/aim/copyinout.c
  head/sys/powerpc/aim/swtch32.S
  head/sys/powerpc/aim/swtch64.S
  head/sys/powerpc/aim/trap.c

Modified: head/sys/powerpc/aim/copyinout.c
==============================================================================
--- head/sys/powerpc/aim/copyinout.c	Wed Nov  3 13:42:59 2010	(r214738)
+++ head/sys/powerpc/aim/copyinout.c	Wed Nov  3 15:15:48 2010	(r214739)
@@ -102,11 +102,12 @@ set_user_sr(pmap_t pm, const void *addr)
 	if (curthread->td_pcb->pcb_cpu.aim.usr_vsid == slbv) 
 		return;
 
-	__asm __volatile ("isync; slbie %0; slbmte %1, %2; isync" ::
-	    "r"(USER_ADDR), "r"(slbv), "r"(USER_SLB_SLBE));
+	__asm __volatile("isync");
 	curthread->td_pcb->pcb_cpu.aim.usr_segm =
 	    (uintptr_t)addr >> ADDR_SR_SHFT;
 	curthread->td_pcb->pcb_cpu.aim.usr_vsid = slbv;
+	__asm __volatile ("slbie %0; slbmte %1, %2; isync" ::
+	    "r"(USER_ADDR), "r"(slbv), "r"(USER_SLB_SLBE));
 }
 #else
 static __inline void
@@ -124,6 +125,8 @@ set_user_sr(pmap_t pm, const void *addr)
 	vsid |= SR_N;
 
 	__asm __volatile("isync");
+	curthread->td_pcb->pcb_cpu.aim.usr_segm =
+	    (uintptr_t)addr >> ADDR_SR_SHFT;
 	curthread->td_pcb->pcb_cpu.aim.usr_vsid = vsid;
 	__asm __volatile("mtsr %0,%1; isync" :: "n"(USER_SR), "r"(vsid));
 }

Modified: head/sys/powerpc/aim/swtch32.S
==============================================================================
--- head/sys/powerpc/aim/swtch32.S	Wed Nov  3 13:42:59 2010	(r214738)
+++ head/sys/powerpc/aim/swtch32.S	Wed Nov  3 15:15:48 2010	(r214739)
@@ -88,8 +88,6 @@ ENTRY(cpu_switch)
 	stw	%r16,PCB_CR(%r6)
 	mflr	%r16			/* Save the link register */
 	stw	%r16,PCB_LR(%r6)
-	mfsr	%r16,USER_SR		/* Save USER_SR for copyin/out */
-	stw	%r16,PCB_AIM_USR_VSID(%r6)
 	stw	%r1,PCB_SP(%r6)		/* Save the stack pointer */
 	stw	%r2,PCB_TOC(%r6)	/* Save the TOC pointer */
 

Modified: head/sys/powerpc/aim/swtch64.S
==============================================================================
--- head/sys/powerpc/aim/swtch64.S	Wed Nov  3 13:42:59 2010	(r214738)
+++ head/sys/powerpc/aim/swtch64.S	Wed Nov  3 15:15:48 2010	(r214739)
@@ -110,11 +110,6 @@ ENTRY(cpu_switch)
 	std	%r1,PCB_SP(%r6)		/* Save the stack pointer */
 	std	%r2,PCB_TOC(%r6)	/* Save the TOC pointer */
 	
-	li	%r15,0			/* Save user segment for copyin/out */
-	li	%r16,USER_SLB_SLOT
-	slbmfev %r15, %r16
-	std	%r15,PCB_AIM_USR_VSID(%r6)
-
 	mr	%r14,%r3		/* Copy the old thread ptr... */
 	mr	%r15,%r4		/* and the new thread ptr in scratch */
 	mr	%r16,%r5		/* and the new lock */

Modified: head/sys/powerpc/aim/trap.c
==============================================================================
--- head/sys/powerpc/aim/trap.c	Wed Nov  3 13:42:59 2010	(r214738)
+++ head/sys/powerpc/aim/trap.c	Wed Nov  3 15:15:48 2010	(r214739)
@@ -455,6 +455,13 @@ syscall(struct trapframe *frame)
 	td = PCPU_GET(curthread);
 	td->td_frame = frame;
 
+	/*
+	 * Speculatively restore last user SLB segment, which we know is
+	 * invalid already, since we are likely to do copyin()/copyout().
+	 */
+	__asm __volatile ("slbmte %0, %1; isync" ::
+            "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE));
+
 	error = syscallenter(td, &sa);
 	syscallret(td, error, &sa);
 }
@@ -532,13 +539,7 @@ trap_pfault(struct trapframe *frame, int
 
 			map = &p->p_vmspace->vm_map;
 
-			#ifdef __powerpc64__
 			user_sr = td->td_pcb->pcb_cpu.aim.usr_segm;
-			#else
-			__asm ("mfsr %0, %1"
-			    : "=r"(user_sr)
-			    : "K"(USER_SR));
-			#endif
 			eva &= ADDR_PIDX | ADDR_POFF;
 			eva |= user_sr << ADDR_SR_SHFT;
 		} else {

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 15:24:26 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4CEE61065672;
	Wed,  3 Nov 2010 15:24:26 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3AAE98FC19;
	Wed,  3 Nov 2010 15: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 oA3FOQJF024819;
	Wed, 3 Nov 2010 15:24:26 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FOQu1024817;
	Wed, 3 Nov 2010 15:24:26 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201011031524.oA3FOQu1024817@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Wed, 3 Nov 2010 15:24:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214741 - stable/8/sys/powerpc/aim
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 15:24:26 -0000

Author: nwhitehorn
Date: Wed Nov  3 15:24:25 2010
New Revision: 214741
URL: http://svn.freebsd.org/changeset/base/214741

Log:
  MFC r214601:
  Add some missing parentheses so that moea_bat_mapped() actually works.
  
  Submitted by:	alc

Modified:
  stable/8/sys/powerpc/aim/mmu_oea.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/powerpc/aim/mmu_oea.c
==============================================================================
--- stable/8/sys/powerpc/aim/mmu_oea.c	Wed Nov  3 15:22:09 2010	(r214740)
+++ stable/8/sys/powerpc/aim/mmu_oea.c	Wed Nov  3 15:24:25 2010	(r214741)
@@ -2381,7 +2381,7 @@ moea_bat_mapped(int idx, vm_offset_t pa,
 	/*
 	 * Return immediately if not a valid mapping
 	 */
-	if (!battable[idx].batu & BAT_Vs)
+	if (!(battable[idx].batu & BAT_Vs))
 		return (EINVAL);
 
 	/*

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 15:25:30 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B09741065679;
	Wed,  3 Nov 2010 15:25:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D6AC8FC12;
	Wed,  3 Nov 2010 15:25:30 +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 oA3FPUcf024902;
	Wed, 3 Nov 2010 15:25:30 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FPUuX024894;
	Wed, 3 Nov 2010 15:25:30 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011031525.oA3FPUuX024894@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 3 Nov 2010 15:25:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214742 - stable/8/usr.sbin/mfiutil
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 15:25:30 -0000

Author: jhb
Date: Wed Nov  3 15:25:30 2010
New Revision: 214742
URL: http://svn.freebsd.org/changeset/base/214742

Log:
  MFC 213672,213674,214396:
  - Report subcommand handler errors in mfiutil so that tools that
    invoke the utilities can robustly report errors.
  - Fix compile with -DDEBUG by using the correct mfi_pd_ref union definition
    in mfireg.h.
  - Save errno values before calling warn(3) so that errors are correctly
    reported.
  - Use powerof2() from  rather than a copy and paste version.

Modified:
  stable/8/usr.sbin/mfiutil/mfi_config.c
  stable/8/usr.sbin/mfiutil/mfi_drive.c
  stable/8/usr.sbin/mfiutil/mfi_evt.c
  stable/8/usr.sbin/mfiutil/mfi_flash.c
  stable/8/usr.sbin/mfiutil/mfi_patrol.c
  stable/8/usr.sbin/mfiutil/mfi_show.c
  stable/8/usr.sbin/mfiutil/mfi_volume.c
  stable/8/usr.sbin/mfiutil/mfiutil.c
Directory Properties:
  stable/8/usr.sbin/mfiutil/   (props changed)
  stable/8/usr.sbin/mfiutil/mfiutil.8   (props changed)

Modified: stable/8/usr.sbin/mfiutil/mfi_config.c
==============================================================================
--- stable/8/usr.sbin/mfiutil/mfi_config.c	Wed Nov  3 15:24:25 2010	(r214741)
+++ stable/8/usr.sbin/mfiutil/mfi_config.c	Wed Nov  3 15:25:30 2010	(r214742)
@@ -29,12 +29,12 @@
  * $FreeBSD$
  */
 
-#include 
+#include 
 #ifdef DEBUG
 #include 
 #endif
-#include 
 #include 
+#include 
 #include 
 #ifdef DEBUG
 #include 
@@ -52,8 +52,6 @@ static void	dump_config(int fd, struct m
 static int	add_spare(int ac, char **av);
 static int	remove_spare(int ac, char **av);
 
-#define powerof2(x)    ((((x)-1)&(x))==0)
-
 static long
 dehumanize(const char *value)
 {
@@ -151,13 +149,14 @@ static int
 clear_config(int ac, char **av)
 {
 	struct mfi_ld_list list;
-	int ch, fd;
+	int ch, error, fd;
 	u_int i;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (!mfi_reconfig_supported()) {
@@ -167,8 +166,9 @@ clear_config(int ac, char **av)
 	}
 
 	if (mfi_ld_get_list(fd, &list, NULL) < 0) {
+		error = errno;
 		warn("Failed to get volume list");
-		return (errno);
+		return (error);
 	}
 
 	for (i = 0; i < list.ld_count; i++) {
@@ -189,8 +189,9 @@ clear_config(int ac, char **av)
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_CFG_CLEAR, NULL, 0, NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to clear configuration");
-		return (errno);
+		return (error);
 	}
 
 	printf("mfi%d: Configuration cleared\n", mfi_unit);
@@ -335,8 +336,9 @@ parse_array(int fd, int raid_type, char 
 			return (error);
 
 		if (mfi_pd_get_info(fd, device_id, pinfo, NULL) < 0) {
+			error = errno;
 			warn("Failed to fetch drive info for drive %s", cp);
-			return (errno);
+			return (error);
 		}
 
 		if (pinfo->fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) {
@@ -548,8 +550,9 @@ create_volume(int ac, char **av)
 	
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (!mfi_reconfig_supported()) {
@@ -660,8 +663,9 @@ create_volume(int ac, char **av)
 	 * array and volume identifiers.
 	 */
 	if (mfi_config_read(fd, &config) < 0) {
+		error = errno;
 		warn("Failed to read configuration");
-		return (errno);
+		return (error);
 	}
 	p = (char *)config->array;
 	state.array_ref = 0xffff;
@@ -745,14 +749,14 @@ create_volume(int ac, char **av)
 #ifdef DEBUG
 	if (dump)
 		dump_config(fd, config);
-	else
 #endif
 
 	/* Send the new config to the controller. */
 	if (mfi_dcmd_command(fd, MFI_DCMD_CFG_ADD, config, config_size,
 	    NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to add volume");
-		return (errno);
+		return (error);
 	}
 
 	/* Clean up. */
@@ -774,7 +778,7 @@ static int
 delete_volume(int ac, char **av)
 {
 	struct mfi_ld_info info;
-	int fd;
+	int error, fd;
 	uint8_t target_id, mbox[4];
 
 	/*
@@ -799,8 +803,9 @@ delete_volume(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (!mfi_reconfig_supported()) {
@@ -810,13 +815,15 @@ delete_volume(int ac, char **av)
 	}
 
 	if (mfi_lookup_volume(fd, av[1], &target_id) < 0) {
+		error = errno;
 		warn("Invalid volume %s", av[1]);
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_ld_get_info(fd, target_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get info for volume %d", target_id);
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_volume_busy(fd, target_id)) {
@@ -828,8 +835,9 @@ delete_volume(int ac, char **av)
 	mbox_store_ldref(mbox, &info.ld_config.properties.ld);
 	if (mfi_dcmd_command(fd, MFI_DCMD_LD_DELETE, NULL, 0, mbox,
 	    sizeof(mbox), NULL) < 0) {
+		error = errno;
 		warn("Failed to delete volume");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -858,8 +866,9 @@ add_spare(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -867,8 +876,9 @@ add_spare(int ac, char **av)
 		return (error);
 
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch drive info");
-		return (errno);
+		return (error);
 	}
 
 	if (info.fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) {
@@ -878,14 +888,16 @@ add_spare(int ac, char **av)
 
 	if (ac > 2) {
 		if (mfi_lookup_volume(fd, av[2], &target_id) < 0) {
+			error = errno;
 			warn("Invalid volume %s", av[2]);
-			return (errno);
+			return (error);
 		}
 	}
 
 	if (mfi_config_read(fd, &config) < 0) {
+		error = errno;
 		warn("Failed to read configuration");
-		return (errno);
+		return (error);
 	}
 
 	spare = malloc(sizeof(struct mfi_spare) + sizeof(uint16_t) *
@@ -939,8 +951,9 @@ add_spare(int ac, char **av)
 	if (mfi_dcmd_command(fd, MFI_DCMD_CFG_MAKE_SPARE, spare,
 	    sizeof(struct mfi_spare) + sizeof(uint16_t) * spare->array_count,
 	    NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to assign spare");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -964,8 +977,9 @@ remove_spare(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -974,8 +988,9 @@ remove_spare(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	if (info.fw_state != MFI_PD_STATE_HOT_SPARE) {
@@ -986,8 +1001,9 @@ remove_spare(int ac, char **av)
 	mbox_store_pdref(mbox, &info.ref);
 	if (mfi_dcmd_command(fd, MFI_DCMD_CFG_REMOVE_SPARE, NULL, 0, mbox,
 	    sizeof(mbox), NULL) < 0) {
+		error = errno;
 		warn("Failed to delete spare");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -1024,7 +1040,7 @@ dump_config(int fd, struct mfi_config_da
 		    ar->num_drives);
 		printf("      size = %ju\n", (uintmax_t)ar->size);
 		for (j = 0; j < ar->num_drives; j++) {
-			device_id = ar->pd[j].ref.device_id;
+			device_id = ar->pd[j].ref.v.device_id;
 			if (device_id == 0xffff)
 				printf("        drive MISSING\n");
 			else {
@@ -1080,7 +1096,7 @@ dump_config(int fd, struct mfi_config_da
 		sp = (struct mfi_spare *)p;
 		printf("    %s spare %u ",
 		    sp->spare_type & MFI_SPARE_DEDICATED ? "dedicated" :
-		    "global", sp->ref.device_id);
+		    "global", sp->ref.v.device_id);
 		printf("%s", mfi_pdstate(MFI_PD_STATE_HOT_SPARE));
 		printf(" backs:\n");
 		for (j = 0; j < sp->array_count; j++)
@@ -1093,7 +1109,7 @@ static int
 debug_config(int ac, char **av)
 {
 	struct mfi_config_data *config;
-	int fd;
+	int error, fd;
 
 	if (ac != 1) {
 		warnx("debug: extra arguments");
@@ -1102,14 +1118,16 @@ debug_config(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	/* Get the config from the controller. */
 	if (mfi_config_read(fd, &config) < 0) {
+		error = errno;
 		warn("Failed to get config");
-		return (errno);
+		return (error);
 	}
 
 	/* Dump out the configuration. */
@@ -1127,7 +1145,7 @@ dump(int ac, char **av)
 	struct mfi_config_data *config;
 	char buf[64];
 	size_t len;
-	int fd;
+	int error, fd;
 
 	if (ac != 1) {
 		warnx("dump: extra arguments");
@@ -1136,23 +1154,26 @@ dump(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	/* Get the stashed copy of the last dcmd from the driver. */
 	snprintf(buf, sizeof(buf), "dev.mfi.%d.debug_command", mfi_unit);
 	if (sysctlbyname(buf, NULL, &len, NULL, 0) < 0) {
+		error = errno;
 		warn("Failed to read debug command");
-		if (errno == ENOENT)
-			errno = EOPNOTSUPP;
-		return (errno);
+		if (error == ENOENT)
+			error = EOPNOTSUPP;
+		return (error);
 	}
 
 	config = malloc(len);
 	if (sysctlbyname(buf, config, &len, NULL, 0) < 0) {
+		error = errno;
 		warn("Failed to read debug command");
-		return (errno);
+		return (error);
 	}
 	dump_config(fd, config);
 	free(config);

Modified: stable/8/usr.sbin/mfiutil/mfi_drive.c
==============================================================================
--- stable/8/usr.sbin/mfiutil/mfi_drive.c	Wed Nov  3 15:24:25 2010	(r214741)
+++ stable/8/usr.sbin/mfiutil/mfi_drive.c	Wed Nov  3 15:25:30 2010	(r214742)
@@ -79,10 +79,11 @@ int
 mfi_lookup_drive(int fd, char *drive, uint16_t *device_id)
 {
 	struct mfi_pd_list *list;
-	uint8_t encl, slot;
 	long val;
+	int error;
 	u_int i;
 	char *cp;
+	uint8_t encl, slot;
 
 	/* Look for a raw device id first. */
 	val = strtol(drive, &cp, 0);
@@ -118,8 +119,9 @@ mfi_lookup_drive(int fd, char *drive, ui
 		slot = val;
 
 		if (mfi_pd_get_list(fd, &list, NULL) < 0) {
+			error = errno;
 			warn("Failed to fetch drive list");
-			return (errno);
+			return (error);
 		}
 
 		for (i = 0; i < list->count; i++) {
@@ -302,8 +304,9 @@ drive_set_state(char *drive, uint16_t ne
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, drive, &device_id);
@@ -312,8 +315,9 @@ drive_set_state(char *drive, uint16_t ne
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	/* Try to change the state. */
@@ -327,9 +331,10 @@ drive_set_state(char *drive, uint16_t ne
 	mbox[5] = new_state >> 8;
 	if (mfi_dcmd_command(fd, MFI_DCMD_PD_STATE_SET, NULL, 0, mbox, 6,
 	    NULL) < 0) {
+		error = errno;
 		warn("Failed to set drive %u to %s", device_id,
 		    mfi_pdstate(new_state));
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -395,8 +400,9 @@ start_rebuild(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -405,13 +411,14 @@ start_rebuild(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	/* Check the state, must be REBUILD. */
 	if (info.fw_state != MFI_PD_STATE_REBUILD) {
-		warn("Drive %d is not in the REBUILD state", device_id);
+		warnx("Drive %d is not in the REBUILD state", device_id);
 		return (EINVAL);
 	}
 
@@ -419,8 +426,9 @@ start_rebuild(int ac, char **av)
 	mbox_store_pdref(&mbox[0], &info.ref);
 	if (mfi_dcmd_command(fd, MFI_DCMD_PD_REBUILD_START, NULL, 0, mbox, 4,
 	    NULL) < 0) {
+		error = errno;
 		warn("Failed to start rebuild on drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 	close(fd);
 
@@ -444,8 +452,9 @@ abort_rebuild(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -454,8 +463,9 @@ abort_rebuild(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	/* Check the state, must be REBUILD. */
@@ -468,8 +478,9 @@ abort_rebuild(int ac, char **av)
 	mbox_store_pdref(&mbox[0], &info.ref);
 	if (mfi_dcmd_command(fd, MFI_DCMD_PD_REBUILD_ABORT, NULL, 0, mbox, 4,
 	    NULL) < 0) {
+		error = errno;
 		warn("Failed to abort rebuild on drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 	close(fd);
 
@@ -492,8 +503,9 @@ drive_progress(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -502,8 +514,9 @@ drive_progress(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 	close(fd);
 
@@ -551,8 +564,9 @@ drive_clear(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -561,16 +575,18 @@ drive_clear(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	mbox_store_pdref(&mbox[0], &info.ref);
 	if (mfi_dcmd_command(fd, opcode, NULL, 0, mbox, 4, NULL) < 0) {
+		error = errno;
 		warn("Failed to %s clear on drive %u",
 		    opcode == MFI_DCMD_PD_CLEAR_START ? "start" : "stop",
 		    device_id);
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -604,8 +620,9 @@ drive_locate(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -617,10 +634,11 @@ drive_locate(int ac, char **av)
 	mbox[2] = 0;
 	mbox[3] = 0;
 	if (mfi_dcmd_command(fd, opcode, NULL, 0, mbox, 4, NULL) < 0) {
+		error = errno;
 		warn("Failed to %s locate on drive %u",
 		    opcode == MFI_DCMD_PD_LOCATE_START ? "start" : "stop",
 		    device_id);
-		return (errno);
+		return (error);
 	}
 	close(fd);
 

Modified: stable/8/usr.sbin/mfiutil/mfi_evt.c
==============================================================================
--- stable/8/usr.sbin/mfiutil/mfi_evt.c	Wed Nov  3 15:24:25 2010	(r214741)
+++ stable/8/usr.sbin/mfiutil/mfi_evt.c	Wed Nov  3 15:25:30 2010	(r214742)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-//#include 
 #include 
 #include 
 #include 
@@ -67,7 +66,7 @@ static int
 show_logstate(int ac, char **av)
 {
 	struct mfi_evt_log_state info;
-	int fd;
+	int error, fd;
 
 	if (ac != 1) {
 		warnx("show logstate: extra arguments");
@@ -76,13 +75,15 @@ show_logstate(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_event_get_info(fd, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get event log info");
-		return (errno);
+		return (error);
 	}
 
 	printf("mfi%d Event Log Sequence Numbers:\n", mfi_unit);
@@ -536,18 +537,20 @@ show_events(int ac, char **av)
 	ssize_t size;
 	uint32_t seq, start, stop;
 	uint8_t status;
-	int ch, fd, num_events, verbose;
+	int ch, error, fd, num_events, verbose;
 	u_int i;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_event_get_info(fd, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get event log info");
-		return (errno);
+		return (error);
 	}
 
 	/* Default settings. */
@@ -565,14 +568,16 @@ show_events(int ac, char **av)
 		switch (ch) {
 		case 'c':
 			if (parse_class(optarg, &filter.members.class) < 0) {
+				error = errno;
 				warn("Error parsing event class");
-				return (errno);
+				return (error);
 			}
 			break;
 		case 'l':
 			if (parse_locale(optarg, &filter.members.locale) < 0) {
+				error = errno;
 				warn("Error parsing event locale");
-				return (errno);
+				return (error);
 			}
 			break;
 		case 'n':
@@ -608,20 +613,23 @@ show_events(int ac, char **av)
 		return (EINVAL);
 	}
 	if (ac > 0 && parse_seq(&info, av[0], &start) < 0) {
+		error = errno;
 		warn("Error parsing starting sequence number");
-		return (errno);
+		return (error);
 	}
 	if (ac > 1 && parse_seq(&info, av[1], &stop) < 0) {
+		error = errno;
 		warn("Error parsing ending sequence number");
-		return (errno);
+		return (error);
 	}
 
 	list = malloc(size);
 	for (seq = start;;) {
 		if (mfi_get_events(fd, list, num_events, filter, seq,
 		    &status) < 0) {
+			error = errno;
 			warn("Failed to fetch events");
-			return (errno);
+			return (error);
 		}
 		if (status == MFI_STAT_NOT_FOUND) {
 			if (seq == start)

Modified: stable/8/usr.sbin/mfiutil/mfi_flash.c
==============================================================================
--- stable/8/usr.sbin/mfiutil/mfi_flash.c	Wed Nov  3 15:24:25 2010	(r214741)
+++ stable/8/usr.sbin/mfiutil/mfi_flash.c	Wed Nov  3 15:25:30 2010	(r214742)
@@ -72,16 +72,18 @@ display_firmware(struct mfi_info_compone
 	    fw_time_width, comp->build_time);
 }
 
-static void
+static int
 display_pending_firmware(int fd)
 {
 	struct mfi_ctrl_info info;
 	struct mfi_info_component header;
+	int error;
 	u_int i;
 
 	if (mfi_ctrl_get_info(fd, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get controller info");
-		return;
+		return (error);
 	}
 
 	printf("mfi%d Pending Firmware Images:\n", mfi_unit);
@@ -97,6 +99,8 @@ display_pending_firmware(int fd)
 	display_firmware(&header);
 	for (i = 0; i < info.pending_image_component_count; i++)
 		display_firmware(&info.pending_image_component[i]);
+
+	return (0);
 }
 
 static void
@@ -117,7 +121,7 @@ flash_adapter(int ac, char **av)
 	size_t nread;
 	char *buf;
 	struct stat sb;
-	int fd, flash;
+	int error, fd, flash;
 	uint8_t mbox[4], status;
 
 	if (ac != 2) {
@@ -127,13 +131,15 @@ flash_adapter(int ac, char **av)
 
 	flash = open(av[1], O_RDONLY);
 	if (flash < 0) {
+		error = errno;
 		warn("flash: Failed to open %s", av[1]);
-		return (errno);
+		return (error);
 	}
 
 	if (fstat(flash, &sb) < 0) {
+		error = errno;
 		warn("fstat(%s)", av[1]);
-		return (errno);
+		return (error);
 	}
 	if (sb.st_size % 1024 != 0 || sb.st_size > 0x7fffffff) {
 		warnx("Invalid flash file size");
@@ -142,8 +148,9 @@ flash_adapter(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	/* First, ask the firmware to allocate space for the flash file. */
@@ -190,10 +197,10 @@ flash_adapter(int ac, char **av)
 		return (ENXIO);
 	}
 	printf("finished\n");
-	display_pending_firmware(fd);
+	error = display_pending_firmware(fd);
 
 	close(fd);
 
-	return (0);
+	return (error);
 }
 MFI_COMMAND(top, flash, flash_adapter);

Modified: stable/8/usr.sbin/mfiutil/mfi_patrol.c
==============================================================================
--- stable/8/usr.sbin/mfiutil/mfi_patrol.c	Wed Nov  3 15:24:25 2010	(r214741)
+++ stable/8/usr.sbin/mfiutil/mfi_patrol.c	Wed Nov  3 15:25:30 2010	(r214742)
@@ -62,11 +62,13 @@ mfi_get_time(int fd, uint32_t *at)
 static int
 patrol_get_props(int fd, struct mfi_pr_properties *prop)
 {
+	int error;
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_GET_PROPERTIES, prop,
 	    sizeof(*prop), NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to get patrol read properties");
-		return (-1);
+		return (error);
 	}
 	return (0);
 }
@@ -81,19 +83,21 @@ show_patrol(int ac, char **av)
 	char label[16];
 	time_t now;
 	uint32_t at;
-	int fd;
+	int error, fd;
 	u_int i;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	time(&now);
 	mfi_get_time(fd, &at);
-	if (patrol_get_props(fd, &prop) < 0)
-		return (errno);
+	error = patrol_get_props(fd, &prop);
+	if (error)
+		return (error);
 	printf("Operation Mode: ");
 	switch (prop.op_mode) {
 	case MFI_PR_OPMODE_AUTO:
@@ -122,8 +126,9 @@ show_patrol(int ac, char **av)
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_GET_STATUS, &status,
 	    sizeof(status), NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to get patrol read properties");
-		return (errno);
+		return (error);
 	}
 	printf("Runs Completed: %u\n", status.num_iteration);
 	printf("Current State: ");
@@ -146,8 +151,9 @@ show_patrol(int ac, char **av)
 	}
 	if (status.state == MFI_PR_STATE_ACTIVE) {
 		if (mfi_pd_get_list(fd, &list, NULL) < 0) {
+			error = errno;
 			warn("Failed to get drive list");
-			return (errno);
+			return (error);
 		}
 
 		for (i = 0; i < list->count; i++) {
@@ -156,9 +162,10 @@ show_patrol(int ac, char **av)
 
 			if (mfi_pd_get_info(fd, list->addr[i].device_id, &info,
 			    NULL) < 0) {
+				error = errno;
 				warn("Failed to fetch info for drive %u",
 				    list->addr[i].device_id);
-				return (errno);
+				return (error);
 			}
 			if (info.prog_info.active & MFI_PD_PROGRESS_PATROL) {
 				snprintf(label, sizeof(label), "    Drive %u",
@@ -178,18 +185,20 @@ MFI_COMMAND(show, patrol, show_patrol);
 static int
 start_patrol(int ac, char **av)
 {
-	int fd;
+	int error, fd;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_START, NULL, 0, NULL, 0, NULL) <
 	    0) {
+		error = errno;
 		warn("Failed to start patrol read");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -201,18 +210,20 @@ MFI_COMMAND(start, patrol, start_patrol)
 static int
 stop_patrol(int ac, char **av)
 {
-	int fd;
+	int error, fd;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_STOP, NULL, 0, NULL, 0, NULL) <
 	    0) {
+		error = errno;
 		warn("Failed to stop patrol read");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -227,10 +238,10 @@ patrol_config(int ac, char **av)
 	struct mfi_pr_properties prop;
 	long val;
 	time_t now;
+	int error, fd;
 	uint32_t at, next_exec, exec_freq;
 	char *cp;
 	uint8_t op_mode;
-	int fd;
 
 	exec_freq = 0;	/* GCC too stupid */
 	next_exec = 0;
@@ -272,12 +283,14 @@ patrol_config(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
-	if (patrol_get_props(fd, &prop) < 0)
-		return (errno);
+	error = patrol_get_props(fd, &prop);
+	if (error)
+		return (error);
 	prop.op_mode = op_mode;
 	if (op_mode == MFI_PR_OPMODE_AUTO) {
 		if (ac > 2)
@@ -294,8 +307,9 @@ patrol_config(int ac, char **av)
 	}
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_SET_PROPERTIES, &prop,
 	    sizeof(prop), NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to set patrol read properties");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);

Modified: stable/8/usr.sbin/mfiutil/mfi_show.c
==============================================================================
--- stable/8/usr.sbin/mfiutil/mfi_show.c	Wed Nov  3 15:24:25 2010	(r214741)
+++ stable/8/usr.sbin/mfiutil/mfi_show.c	Wed Nov  3 15:25:30 2010	(r214742)
@@ -54,7 +54,7 @@ show_adapter(int ac, char **av)
 {
 	struct mfi_ctrl_info info;
 	char stripe[5];
-	int fd, comma;
+	int error, fd, comma;
 
 	if (ac != 1) {
 		warnx("show adapter: extra arguments");
@@ -63,13 +63,15 @@ show_adapter(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_ctrl_get_info(fd, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get controller info");
-		return (errno);
+		return (error);
 	}
 	printf("mfi%d Adapter:\n", mfi_unit);
 	printf("    Product Name: %.80s\n", info.product_name);
@@ -137,7 +139,7 @@ show_battery(int ac, char **av)
 	struct mfi_bbu_capacity_info cap;
 	struct mfi_bbu_design_info design;
 	uint8_t status;
-	int fd;
+	int error, fd;
 
 	if (ac != 1) {
 		warnx("show battery: extra arguments");
@@ -146,8 +148,9 @@ show_battery(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_CAPACITY_INFO, &cap,
@@ -156,14 +159,16 @@ show_battery(int ac, char **av)
 			printf("mfi%d: No battery present\n", mfi_unit);
 			return (0);
 		}
+		error = errno;
 		warn("Failed to get capacity info");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_DESIGN_INFO, &design,
 	    sizeof(design), NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to get design info");
-		return (errno);
+		return (error);
 	}
 
 	printf("mfi%d: Battery State:\n", mfi_unit);
@@ -242,7 +247,7 @@ show_config(int ac, char **av)
 	struct mfi_pd_info pinfo;
 	uint16_t device_id;
 	char *p;
-	int fd, i, j;
+	int error, fd, i, j;
 
 	if (ac != 1) {
 		warnx("show config: extra arguments");
@@ -251,14 +256,16 @@ show_config(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	/* Get the config from the controller. */
 	if (mfi_config_read(fd, &config) < 0) {
+		error = errno;
 		warn("Failed to get config");
-		return (errno);
+		return (error);
 	}
 
 	/* Dump out the configuration. */
@@ -337,8 +344,8 @@ show_volumes(int ac, char **av)
 {

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

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 15:25:40 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E8CD4106564A;
	Wed,  3 Nov 2010 15:25: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 D5B3B8FC0A;
	Wed,  3 Nov 2010 15:25: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 oA3FPeGw024950;
	Wed, 3 Nov 2010 15:25:40 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FPeqb024942;
	Wed, 3 Nov 2010 15:25:40 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011031525.oA3FPeqb024942@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 3 Nov 2010 15:25:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214743 - stable/7/usr.sbin/mfiutil
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 15:25:41 -0000

Author: jhb
Date: Wed Nov  3 15:25:40 2010
New Revision: 214743
URL: http://svn.freebsd.org/changeset/base/214743

Log:
  MFC 213672,213674,214396:
  - Report subcommand handler errors in mfiutil so that tools that
    invoke the utilities can robustly report errors.
  - Fix compile with -DDEBUG by using the correct mfi_pd_ref union definition
    in mfireg.h.
  - Save errno values before calling warn(3) so that errors are correctly
    reported.
  - Use powerof2() from  rather than a copy and paste version.

Modified:
  stable/7/usr.sbin/mfiutil/mfi_config.c
  stable/7/usr.sbin/mfiutil/mfi_drive.c
  stable/7/usr.sbin/mfiutil/mfi_evt.c
  stable/7/usr.sbin/mfiutil/mfi_flash.c
  stable/7/usr.sbin/mfiutil/mfi_patrol.c
  stable/7/usr.sbin/mfiutil/mfi_show.c
  stable/7/usr.sbin/mfiutil/mfi_volume.c
  stable/7/usr.sbin/mfiutil/mfiutil.c
Directory Properties:
  stable/7/usr.sbin/mfiutil/   (props changed)
  stable/7/usr.sbin/mfiutil/mfiutil.8   (props changed)

Modified: stable/7/usr.sbin/mfiutil/mfi_config.c
==============================================================================
--- stable/7/usr.sbin/mfiutil/mfi_config.c	Wed Nov  3 15:25:30 2010	(r214742)
+++ stable/7/usr.sbin/mfiutil/mfi_config.c	Wed Nov  3 15:25:40 2010	(r214743)
@@ -29,12 +29,12 @@
  * $FreeBSD$
  */
 
-#include 
+#include 
 #ifdef DEBUG
 #include 
 #endif
-#include 
 #include 
+#include 
 #include 
 #ifdef DEBUG
 #include 
@@ -52,8 +52,6 @@ static void	dump_config(int fd, struct m
 static int	add_spare(int ac, char **av);
 static int	remove_spare(int ac, char **av);
 
-#define powerof2(x)    ((((x)-1)&(x))==0)
-
 static long
 dehumanize(const char *value)
 {
@@ -151,13 +149,14 @@ static int
 clear_config(int ac, char **av)
 {
 	struct mfi_ld_list list;
-	int ch, fd;
+	int ch, error, fd;
 	u_int i;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (!mfi_reconfig_supported()) {
@@ -167,8 +166,9 @@ clear_config(int ac, char **av)
 	}
 
 	if (mfi_ld_get_list(fd, &list, NULL) < 0) {
+		error = errno;
 		warn("Failed to get volume list");
-		return (errno);
+		return (error);
 	}
 
 	for (i = 0; i < list.ld_count; i++) {
@@ -189,8 +189,9 @@ clear_config(int ac, char **av)
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_CFG_CLEAR, NULL, 0, NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to clear configuration");
-		return (errno);
+		return (error);
 	}
 
 	printf("mfi%d: Configuration cleared\n", mfi_unit);
@@ -335,8 +336,9 @@ parse_array(int fd, int raid_type, char 
 			return (error);
 
 		if (mfi_pd_get_info(fd, device_id, pinfo, NULL) < 0) {
+			error = errno;
 			warn("Failed to fetch drive info for drive %s", cp);
-			return (errno);
+			return (error);
 		}
 
 		if (pinfo->fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) {
@@ -548,8 +550,9 @@ create_volume(int ac, char **av)
 	
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (!mfi_reconfig_supported()) {
@@ -660,8 +663,9 @@ create_volume(int ac, char **av)
 	 * array and volume identifiers.
 	 */
 	if (mfi_config_read(fd, &config) < 0) {
+		error = errno;
 		warn("Failed to read configuration");
-		return (errno);
+		return (error);
 	}
 	p = (char *)config->array;
 	state.array_ref = 0xffff;
@@ -745,14 +749,14 @@ create_volume(int ac, char **av)
 #ifdef DEBUG
 	if (dump)
 		dump_config(fd, config);
-	else
 #endif
 
 	/* Send the new config to the controller. */
 	if (mfi_dcmd_command(fd, MFI_DCMD_CFG_ADD, config, config_size,
 	    NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to add volume");
-		return (errno);
+		return (error);
 	}
 
 	/* Clean up. */
@@ -774,7 +778,7 @@ static int
 delete_volume(int ac, char **av)
 {
 	struct mfi_ld_info info;
-	int fd;
+	int error, fd;
 	uint8_t target_id, mbox[4];
 
 	/*
@@ -799,8 +803,9 @@ delete_volume(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (!mfi_reconfig_supported()) {
@@ -810,13 +815,15 @@ delete_volume(int ac, char **av)
 	}
 
 	if (mfi_lookup_volume(fd, av[1], &target_id) < 0) {
+		error = errno;
 		warn("Invalid volume %s", av[1]);
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_ld_get_info(fd, target_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get info for volume %d", target_id);
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_volume_busy(fd, target_id)) {
@@ -828,8 +835,9 @@ delete_volume(int ac, char **av)
 	mbox_store_ldref(mbox, &info.ld_config.properties.ld);
 	if (mfi_dcmd_command(fd, MFI_DCMD_LD_DELETE, NULL, 0, mbox,
 	    sizeof(mbox), NULL) < 0) {
+		error = errno;
 		warn("Failed to delete volume");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -858,8 +866,9 @@ add_spare(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -867,8 +876,9 @@ add_spare(int ac, char **av)
 		return (error);
 
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch drive info");
-		return (errno);
+		return (error);
 	}
 
 	if (info.fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) {
@@ -878,14 +888,16 @@ add_spare(int ac, char **av)
 
 	if (ac > 2) {
 		if (mfi_lookup_volume(fd, av[2], &target_id) < 0) {
+			error = errno;
 			warn("Invalid volume %s", av[2]);
-			return (errno);
+			return (error);
 		}
 	}
 
 	if (mfi_config_read(fd, &config) < 0) {
+		error = errno;
 		warn("Failed to read configuration");
-		return (errno);
+		return (error);
 	}
 
 	spare = malloc(sizeof(struct mfi_spare) + sizeof(uint16_t) *
@@ -939,8 +951,9 @@ add_spare(int ac, char **av)
 	if (mfi_dcmd_command(fd, MFI_DCMD_CFG_MAKE_SPARE, spare,
 	    sizeof(struct mfi_spare) + sizeof(uint16_t) * spare->array_count,
 	    NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to assign spare");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -964,8 +977,9 @@ remove_spare(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -974,8 +988,9 @@ remove_spare(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	if (info.fw_state != MFI_PD_STATE_HOT_SPARE) {
@@ -986,8 +1001,9 @@ remove_spare(int ac, char **av)
 	mbox_store_pdref(mbox, &info.ref);
 	if (mfi_dcmd_command(fd, MFI_DCMD_CFG_REMOVE_SPARE, NULL, 0, mbox,
 	    sizeof(mbox), NULL) < 0) {
+		error = errno;
 		warn("Failed to delete spare");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -1024,7 +1040,7 @@ dump_config(int fd, struct mfi_config_da
 		    ar->num_drives);
 		printf("      size = %ju\n", (uintmax_t)ar->size);
 		for (j = 0; j < ar->num_drives; j++) {
-			device_id = ar->pd[j].ref.device_id;
+			device_id = ar->pd[j].ref.v.device_id;
 			if (device_id == 0xffff)
 				printf("        drive MISSING\n");
 			else {
@@ -1080,7 +1096,7 @@ dump_config(int fd, struct mfi_config_da
 		sp = (struct mfi_spare *)p;
 		printf("    %s spare %u ",
 		    sp->spare_type & MFI_SPARE_DEDICATED ? "dedicated" :
-		    "global", sp->ref.device_id);
+		    "global", sp->ref.v.device_id);
 		printf("%s", mfi_pdstate(MFI_PD_STATE_HOT_SPARE));
 		printf(" backs:\n");
 		for (j = 0; j < sp->array_count; j++)
@@ -1093,7 +1109,7 @@ static int
 debug_config(int ac, char **av)
 {
 	struct mfi_config_data *config;
-	int fd;
+	int error, fd;
 
 	if (ac != 1) {
 		warnx("debug: extra arguments");
@@ -1102,14 +1118,16 @@ debug_config(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	/* Get the config from the controller. */
 	if (mfi_config_read(fd, &config) < 0) {
+		error = errno;
 		warn("Failed to get config");
-		return (errno);
+		return (error);
 	}
 
 	/* Dump out the configuration. */
@@ -1127,7 +1145,7 @@ dump(int ac, char **av)
 	struct mfi_config_data *config;
 	char buf[64];
 	size_t len;
-	int fd;
+	int error, fd;
 
 	if (ac != 1) {
 		warnx("dump: extra arguments");
@@ -1136,23 +1154,26 @@ dump(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	/* Get the stashed copy of the last dcmd from the driver. */
 	snprintf(buf, sizeof(buf), "dev.mfi.%d.debug_command", mfi_unit);
 	if (sysctlbyname(buf, NULL, &len, NULL, 0) < 0) {
+		error = errno;
 		warn("Failed to read debug command");
-		if (errno == ENOENT)
-			errno = EOPNOTSUPP;
-		return (errno);
+		if (error == ENOENT)
+			error = EOPNOTSUPP;
+		return (error);
 	}
 
 	config = malloc(len);
 	if (sysctlbyname(buf, config, &len, NULL, 0) < 0) {
+		error = errno;
 		warn("Failed to read debug command");
-		return (errno);
+		return (error);
 	}
 	dump_config(fd, config);
 	free(config);

Modified: stable/7/usr.sbin/mfiutil/mfi_drive.c
==============================================================================
--- stable/7/usr.sbin/mfiutil/mfi_drive.c	Wed Nov  3 15:25:30 2010	(r214742)
+++ stable/7/usr.sbin/mfiutil/mfi_drive.c	Wed Nov  3 15:25:40 2010	(r214743)
@@ -79,10 +79,11 @@ int
 mfi_lookup_drive(int fd, char *drive, uint16_t *device_id)
 {
 	struct mfi_pd_list *list;
-	uint8_t encl, slot;
 	long val;
+	int error;
 	u_int i;
 	char *cp;
+	uint8_t encl, slot;
 
 	/* Look for a raw device id first. */
 	val = strtol(drive, &cp, 0);
@@ -118,8 +119,9 @@ mfi_lookup_drive(int fd, char *drive, ui
 		slot = val;
 
 		if (mfi_pd_get_list(fd, &list, NULL) < 0) {
+			error = errno;
 			warn("Failed to fetch drive list");
-			return (errno);
+			return (error);
 		}
 
 		for (i = 0; i < list->count; i++) {
@@ -302,8 +304,9 @@ drive_set_state(char *drive, uint16_t ne
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, drive, &device_id);
@@ -312,8 +315,9 @@ drive_set_state(char *drive, uint16_t ne
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	/* Try to change the state. */
@@ -327,9 +331,10 @@ drive_set_state(char *drive, uint16_t ne
 	mbox[5] = new_state >> 8;
 	if (mfi_dcmd_command(fd, MFI_DCMD_PD_STATE_SET, NULL, 0, mbox, 6,
 	    NULL) < 0) {
+		error = errno;
 		warn("Failed to set drive %u to %s", device_id,
 		    mfi_pdstate(new_state));
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -395,8 +400,9 @@ start_rebuild(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -405,13 +411,14 @@ start_rebuild(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	/* Check the state, must be REBUILD. */
 	if (info.fw_state != MFI_PD_STATE_REBUILD) {
-		warn("Drive %d is not in the REBUILD state", device_id);
+		warnx("Drive %d is not in the REBUILD state", device_id);
 		return (EINVAL);
 	}
 
@@ -419,8 +426,9 @@ start_rebuild(int ac, char **av)
 	mbox_store_pdref(&mbox[0], &info.ref);
 	if (mfi_dcmd_command(fd, MFI_DCMD_PD_REBUILD_START, NULL, 0, mbox, 4,
 	    NULL) < 0) {
+		error = errno;
 		warn("Failed to start rebuild on drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 	close(fd);
 
@@ -444,8 +452,9 @@ abort_rebuild(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -454,8 +463,9 @@ abort_rebuild(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	/* Check the state, must be REBUILD. */
@@ -468,8 +478,9 @@ abort_rebuild(int ac, char **av)
 	mbox_store_pdref(&mbox[0], &info.ref);
 	if (mfi_dcmd_command(fd, MFI_DCMD_PD_REBUILD_ABORT, NULL, 0, mbox, 4,
 	    NULL) < 0) {
+		error = errno;
 		warn("Failed to abort rebuild on drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 	close(fd);
 
@@ -492,8 +503,9 @@ drive_progress(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -502,8 +514,9 @@ drive_progress(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 	close(fd);
 
@@ -551,8 +564,9 @@ drive_clear(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -561,16 +575,18 @@ drive_clear(int ac, char **av)
 
 	/* Get the info for this drive. */
 	if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to fetch info for drive %u", device_id);
-		return (errno);
+		return (error);
 	}
 
 	mbox_store_pdref(&mbox[0], &info.ref);
 	if (mfi_dcmd_command(fd, opcode, NULL, 0, mbox, 4, NULL) < 0) {
+		error = errno;
 		warn("Failed to %s clear on drive %u",
 		    opcode == MFI_DCMD_PD_CLEAR_START ? "start" : "stop",
 		    device_id);
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -604,8 +620,9 @@ drive_locate(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	error = mfi_lookup_drive(fd, av[1], &device_id);
@@ -617,10 +634,11 @@ drive_locate(int ac, char **av)
 	mbox[2] = 0;
 	mbox[3] = 0;
 	if (mfi_dcmd_command(fd, opcode, NULL, 0, mbox, 4, NULL) < 0) {
+		error = errno;
 		warn("Failed to %s locate on drive %u",
 		    opcode == MFI_DCMD_PD_LOCATE_START ? "start" : "stop",
 		    device_id);
-		return (errno);
+		return (error);
 	}
 	close(fd);
 

Modified: stable/7/usr.sbin/mfiutil/mfi_evt.c
==============================================================================
--- stable/7/usr.sbin/mfiutil/mfi_evt.c	Wed Nov  3 15:25:30 2010	(r214742)
+++ stable/7/usr.sbin/mfiutil/mfi_evt.c	Wed Nov  3 15:25:40 2010	(r214743)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-//#include 
 #include 
 #include 
 #include 
@@ -67,7 +66,7 @@ static int
 show_logstate(int ac, char **av)
 {
 	struct mfi_evt_log_state info;
-	int fd;
+	int error, fd;
 
 	if (ac != 1) {
 		warnx("show logstate: extra arguments");
@@ -76,13 +75,15 @@ show_logstate(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_event_get_info(fd, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get event log info");
-		return (errno);
+		return (error);
 	}
 
 	printf("mfi%d Event Log Sequence Numbers:\n", mfi_unit);
@@ -536,18 +537,20 @@ show_events(int ac, char **av)
 	ssize_t size;
 	uint32_t seq, start, stop;
 	uint8_t status;
-	int ch, fd, num_events, verbose;
+	int ch, error, fd, num_events, verbose;
 	u_int i;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_event_get_info(fd, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get event log info");
-		return (errno);
+		return (error);
 	}
 
 	/* Default settings. */
@@ -565,14 +568,16 @@ show_events(int ac, char **av)
 		switch (ch) {
 		case 'c':
 			if (parse_class(optarg, &filter.members.class) < 0) {
+				error = errno;
 				warn("Error parsing event class");
-				return (errno);
+				return (error);
 			}
 			break;
 		case 'l':
 			if (parse_locale(optarg, &filter.members.locale) < 0) {
+				error = errno;
 				warn("Error parsing event locale");
-				return (errno);
+				return (error);
 			}
 			break;
 		case 'n':
@@ -608,20 +613,23 @@ show_events(int ac, char **av)
 		return (EINVAL);
 	}
 	if (ac > 0 && parse_seq(&info, av[0], &start) < 0) {
+		error = errno;
 		warn("Error parsing starting sequence number");
-		return (errno);
+		return (error);
 	}
 	if (ac > 1 && parse_seq(&info, av[1], &stop) < 0) {
+		error = errno;
 		warn("Error parsing ending sequence number");
-		return (errno);
+		return (error);
 	}
 
 	list = malloc(size);
 	for (seq = start;;) {
 		if (mfi_get_events(fd, list, num_events, filter, seq,
 		    &status) < 0) {
+			error = errno;
 			warn("Failed to fetch events");
-			return (errno);
+			return (error);
 		}
 		if (status == MFI_STAT_NOT_FOUND) {
 			if (seq == start)

Modified: stable/7/usr.sbin/mfiutil/mfi_flash.c
==============================================================================
--- stable/7/usr.sbin/mfiutil/mfi_flash.c	Wed Nov  3 15:25:30 2010	(r214742)
+++ stable/7/usr.sbin/mfiutil/mfi_flash.c	Wed Nov  3 15:25:40 2010	(r214743)
@@ -72,16 +72,18 @@ display_firmware(struct mfi_info_compone
 	    fw_time_width, comp->build_time);
 }
 
-static void
+static int
 display_pending_firmware(int fd)
 {
 	struct mfi_ctrl_info info;
 	struct mfi_info_component header;
+	int error;
 	u_int i;
 
 	if (mfi_ctrl_get_info(fd, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get controller info");
-		return;
+		return (error);
 	}
 
 	printf("mfi%d Pending Firmware Images:\n", mfi_unit);
@@ -97,6 +99,8 @@ display_pending_firmware(int fd)
 	display_firmware(&header);
 	for (i = 0; i < info.pending_image_component_count; i++)
 		display_firmware(&info.pending_image_component[i]);
+
+	return (0);
 }
 
 static void
@@ -117,7 +121,7 @@ flash_adapter(int ac, char **av)
 	size_t nread;
 	char *buf;
 	struct stat sb;
-	int fd, flash;
+	int error, fd, flash;
 	uint8_t mbox[4], status;
 
 	if (ac != 2) {
@@ -127,13 +131,15 @@ flash_adapter(int ac, char **av)
 
 	flash = open(av[1], O_RDONLY);
 	if (flash < 0) {
+		error = errno;
 		warn("flash: Failed to open %s", av[1]);
-		return (errno);
+		return (error);
 	}
 
 	if (fstat(flash, &sb) < 0) {
+		error = errno;
 		warn("fstat(%s)", av[1]);
-		return (errno);
+		return (error);
 	}
 	if (sb.st_size % 1024 != 0 || sb.st_size > 0x7fffffff) {
 		warnx("Invalid flash file size");
@@ -142,8 +148,9 @@ flash_adapter(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	/* First, ask the firmware to allocate space for the flash file. */
@@ -190,10 +197,10 @@ flash_adapter(int ac, char **av)
 		return (ENXIO);
 	}
 	printf("finished\n");
-	display_pending_firmware(fd);
+	error = display_pending_firmware(fd);
 
 	close(fd);
 
-	return (0);
+	return (error);
 }
 MFI_COMMAND(top, flash, flash_adapter);

Modified: stable/7/usr.sbin/mfiutil/mfi_patrol.c
==============================================================================
--- stable/7/usr.sbin/mfiutil/mfi_patrol.c	Wed Nov  3 15:25:30 2010	(r214742)
+++ stable/7/usr.sbin/mfiutil/mfi_patrol.c	Wed Nov  3 15:25:40 2010	(r214743)
@@ -62,11 +62,13 @@ mfi_get_time(int fd, uint32_t *at)
 static int
 patrol_get_props(int fd, struct mfi_pr_properties *prop)
 {
+	int error;
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_GET_PROPERTIES, prop,
 	    sizeof(*prop), NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to get patrol read properties");
-		return (-1);
+		return (error);
 	}
 	return (0);
 }
@@ -81,19 +83,21 @@ show_patrol(int ac, char **av)
 	char label[16];
 	time_t now;
 	uint32_t at;
-	int fd;
+	int error, fd;
 	u_int i;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	time(&now);
 	mfi_get_time(fd, &at);
-	if (patrol_get_props(fd, &prop) < 0)
-		return (errno);
+	error = patrol_get_props(fd, &prop);
+	if (error)
+		return (error);
 	printf("Operation Mode: ");
 	switch (prop.op_mode) {
 	case MFI_PR_OPMODE_AUTO:
@@ -122,8 +126,9 @@ show_patrol(int ac, char **av)
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_GET_STATUS, &status,
 	    sizeof(status), NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to get patrol read properties");
-		return (errno);
+		return (error);
 	}
 	printf("Runs Completed: %u\n", status.num_iteration);
 	printf("Current State: ");
@@ -146,8 +151,9 @@ show_patrol(int ac, char **av)
 	}
 	if (status.state == MFI_PR_STATE_ACTIVE) {
 		if (mfi_pd_get_list(fd, &list, NULL) < 0) {
+			error = errno;
 			warn("Failed to get drive list");
-			return (errno);
+			return (error);
 		}
 
 		for (i = 0; i < list->count; i++) {
@@ -156,9 +162,10 @@ show_patrol(int ac, char **av)
 
 			if (mfi_pd_get_info(fd, list->addr[i].device_id, &info,
 			    NULL) < 0) {
+				error = errno;
 				warn("Failed to fetch info for drive %u",
 				    list->addr[i].device_id);
-				return (errno);
+				return (error);
 			}
 			if (info.prog_info.active & MFI_PD_PROGRESS_PATROL) {
 				snprintf(label, sizeof(label), "    Drive %u",
@@ -178,18 +185,20 @@ MFI_COMMAND(show, patrol, show_patrol);
 static int
 start_patrol(int ac, char **av)
 {
-	int fd;
+	int error, fd;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_START, NULL, 0, NULL, 0, NULL) <
 	    0) {
+		error = errno;
 		warn("Failed to start patrol read");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -201,18 +210,20 @@ MFI_COMMAND(start, patrol, start_patrol)
 static int
 stop_patrol(int ac, char **av)
 {
-	int fd;
+	int error, fd;
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_STOP, NULL, 0, NULL, 0, NULL) <
 	    0) {
+		error = errno;
 		warn("Failed to stop patrol read");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);
@@ -227,10 +238,10 @@ patrol_config(int ac, char **av)
 	struct mfi_pr_properties prop;
 	long val;
 	time_t now;
+	int error, fd;
 	uint32_t at, next_exec, exec_freq;
 	char *cp;
 	uint8_t op_mode;
-	int fd;
 
 	exec_freq = 0;	/* GCC too stupid */
 	next_exec = 0;
@@ -272,12 +283,14 @@ patrol_config(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
-	if (patrol_get_props(fd, &prop) < 0)
-		return (errno);
+	error = patrol_get_props(fd, &prop);
+	if (error)
+		return (error);
 	prop.op_mode = op_mode;
 	if (op_mode == MFI_PR_OPMODE_AUTO) {
 		if (ac > 2)
@@ -294,8 +307,9 @@ patrol_config(int ac, char **av)
 	}
 	if (mfi_dcmd_command(fd, MFI_DCMD_PR_SET_PROPERTIES, &prop,
 	    sizeof(prop), NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to set patrol read properties");
-		return (errno);
+		return (error);
 	}
 
 	close(fd);

Modified: stable/7/usr.sbin/mfiutil/mfi_show.c
==============================================================================
--- stable/7/usr.sbin/mfiutil/mfi_show.c	Wed Nov  3 15:25:30 2010	(r214742)
+++ stable/7/usr.sbin/mfiutil/mfi_show.c	Wed Nov  3 15:25:40 2010	(r214743)
@@ -54,7 +54,7 @@ show_adapter(int ac, char **av)
 {
 	struct mfi_ctrl_info info;
 	char stripe[5];
-	int fd, comma;
+	int error, fd, comma;
 
 	if (ac != 1) {
 		warnx("show adapter: extra arguments");
@@ -63,13 +63,15 @@ show_adapter(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_ctrl_get_info(fd, &info, NULL) < 0) {
+		error = errno;
 		warn("Failed to get controller info");
-		return (errno);
+		return (error);
 	}
 	printf("mfi%d Adapter:\n", mfi_unit);
 	printf("    Product Name: %.80s\n", info.product_name);
@@ -137,7 +139,7 @@ show_battery(int ac, char **av)
 	struct mfi_bbu_capacity_info cap;
 	struct mfi_bbu_design_info design;
 	uint8_t status;
-	int fd;
+	int error, fd;
 
 	if (ac != 1) {
 		warnx("show battery: extra arguments");
@@ -146,8 +148,9 @@ show_battery(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_CAPACITY_INFO, &cap,
@@ -156,14 +159,16 @@ show_battery(int ac, char **av)
 			printf("mfi%d: No battery present\n", mfi_unit);
 			return (0);
 		}
+		error = errno;
 		warn("Failed to get capacity info");
-		return (errno);
+		return (error);
 	}
 
 	if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_DESIGN_INFO, &design,
 	    sizeof(design), NULL, 0, NULL) < 0) {
+		error = errno;
 		warn("Failed to get design info");
-		return (errno);
+		return (error);
 	}
 
 	printf("mfi%d: Battery State:\n", mfi_unit);
@@ -242,7 +247,7 @@ show_config(int ac, char **av)
 	struct mfi_pd_info pinfo;
 	uint16_t device_id;
 	char *p;
-	int fd, i, j;
+	int error, fd, i, j;
 
 	if (ac != 1) {
 		warnx("show config: extra arguments");
@@ -251,14 +256,16 @@ show_config(int ac, char **av)
 
 	fd = mfi_open(mfi_unit);
 	if (fd < 0) {
+		error = errno;
 		warn("mfi_open");
-		return (errno);
+		return (error);
 	}
 
 	/* Get the config from the controller. */
 	if (mfi_config_read(fd, &config) < 0) {
+		error = errno;
 		warn("Failed to get config");
-		return (errno);
+		return (error);
 	}
 
 	/* Dump out the configuration. */
@@ -337,8 +344,8 @@ show_volumes(int ac, char **av)
 {

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

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 15:31:11 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 424BD106566B;
	Wed,  3 Nov 2010 15:31:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 15F6B8FC0A;
	Wed,  3 Nov 2010 15:31:11 +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 oA3FVAMD025164;
	Wed, 3 Nov 2010 15:31:10 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FVAQN025163;
	Wed, 3 Nov 2010 15:31:10 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011031531.oA3FVAQN025163@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 3 Nov 2010 15:31:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214744 - in stable: 7/usr.sbin/mfiutil
	8/usr.sbin/mfiutil
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 15:31:11 -0000

Author: jhb
Date: Wed Nov  3 15:31:10 2010
New Revision: 214744
URL: http://svn.freebsd.org/changeset/base/214744

Log:
  Trim unneeded mergeinfo from a file.

Modified:
Directory Properties:
  stable/7/usr.sbin/mfiutil/mfiutil.8   (props changed)

Changes in other areas also in this revision:
Modified:
Directory Properties:
  stable/8/usr.sbin/mfiutil/mfiutil.8   (props changed)

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 15:31:11 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 68DED1065675;
	Wed,  3 Nov 2010 15:31:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 357F28FC0C;
	Wed,  3 Nov 2010 15:31:11 +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 oA3FVBm3025169;
	Wed, 3 Nov 2010 15:31:11 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FVBaQ025168;
	Wed, 3 Nov 2010 15:31:11 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011031531.oA3FVBaQ025168@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 3 Nov 2010 15:31:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214744 - in stable: 7/usr.sbin/mfiutil
	8/usr.sbin/mfiutil
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 15:31:11 -0000

Author: jhb
Date: Wed Nov  3 15:31:10 2010
New Revision: 214744
URL: http://svn.freebsd.org/changeset/base/214744

Log:
  Trim unneeded mergeinfo from a file.

Modified:
Directory Properties:
  stable/8/usr.sbin/mfiutil/mfiutil.8   (props changed)

Changes in other areas also in this revision:
Modified:
Directory Properties:
  stable/7/usr.sbin/mfiutil/mfiutil.8   (props changed)

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 15:31:37 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7AB2D106580C;
	Wed,  3 Nov 2010 15:31:37 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5E53A8FC14;
	Wed,  3 Nov 2010 15:31:37 +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 oA3FVbEv025215;
	Wed, 3 Nov 2010 15:31:37 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FVbTV025211;
	Wed, 3 Nov 2010 15:31:37 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201011031531.oA3FVbTV025211@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Wed, 3 Nov 2010 15:31:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214745 - in stable/8/sys/dev: pci usb/controller
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 15:31:37 -0000

Author: nwhitehorn
Date: Wed Nov  3 15:31:37 2010
New Revision: 214745
URL: http://svn.freebsd.org/changeset/base/214745

Log:
  MFC r214349:
  The EHCI_CAPLENGTH and EHCI_HCIVERSION registers are actually sub-registers
  within the first 4 bytes of the EHCI memory space. For controllers that
  use big-endian MMIO, reading them with 1- and 2-byte reads would then
  return the wrong values. Instead, read the combined register with a
  4-byte read and mask out the interesting quantities.
  
  Requested by:	marius

Modified:
  stable/8/sys/dev/pci/pci.c
  stable/8/sys/dev/usb/controller/ehci.c
  stable/8/sys/dev/usb/controller/ehcireg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/pci/pci.c
==============================================================================
--- stable/8/sys/dev/pci/pci.c	Wed Nov  3 15:31:10 2010	(r214744)
+++ stable/8/sys/dev/pci/pci.c	Wed Nov  3 15:31:37 2010	(r214745)
@@ -2729,7 +2729,7 @@ ehci_early_takeover(device_t self)
 				    "SMM does not respond\n");
 		}
 		/* Disable interrupts */
-		offs = bus_read_1(res, EHCI_CAPLENGTH);
+		offs = EHCI_CAPLENGTH(bus_read_4(res, EHCI_CAPLEN_HCIVERSION));
 		bus_write_4(res, offs + EHCI_USBINTR, 0);
 	}
 	bus_release_resource(self, SYS_RES_MEMORY, rid, res);

Modified: stable/8/sys/dev/usb/controller/ehci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci.c	Wed Nov  3 15:31:10 2010	(r214744)
+++ stable/8/sys/dev/usb/controller/ehci.c	Wed Nov  3 15:31:37 2010	(r214745)
@@ -268,9 +268,9 @@ ehci_init(ehci_softc_t *sc)
 	}
 #endif
 
-	sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);
+	sc->sc_offs = EHCI_CAPLENGTH(EREAD4(sc, EHCI_CAPLEN_HCIVERSION));
 
-	version = EREAD2(sc, EHCI_HCIVERSION);
+	version = EHCI_HCIVERSION(EREAD4(sc, EHCI_CAPLEN_HCIVERSION));
 	device_printf(sc->sc_bus.bdev, "EHCI version %x.%x\n",
 	    version >> 8, version & 0xff);
 

Modified: stable/8/sys/dev/usb/controller/ehcireg.h
==============================================================================
--- stable/8/sys/dev/usb/controller/ehcireg.h	Wed Nov  3 15:31:10 2010	(r214744)
+++ stable/8/sys/dev/usb/controller/ehcireg.h	Wed Nov  3 15:31:37 2010	(r214745)
@@ -61,9 +61,13 @@
 #define	EHCI_LEGSUP_USBLEGCTLSTS	0x04
 
 /* EHCI capability registers */
-#define	EHCI_CAPLENGTH		0x00	/* RO Capability register length field */
-/* reserved			0x01 */
-#define	EHCI_HCIVERSION		0x02	/* RO Interface version number */
+#define	EHCI_CAPLEN_HCIVERSION	0x00	/* RO Capability register length
+					 * (least-significant byte) and 
+					 * interface version number (two
+					 * most significant)
+					 */
+#define EHCI_CAPLENGTH(x)	((x) & 0xff)
+#define EHCI_HCIVERSION(x)	(((x) >> 16) & 0xffff)
 #define	EHCI_HCSPARAMS		0x04	/* RO Structural parameters */
 #define	EHCI_HCS_DEBUGPORT(x)	(((x) >> 20) & 0xf)
 #define	EHCI_HCS_P_INDICATOR(x) ((x) & 0x10000)

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 15:38:53 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 327721065675;
	Wed,  3 Nov 2010 15:38:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 216E28FC0A;
	Wed,  3 Nov 2010 15:38: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 oA3FcrEN025432;
	Wed, 3 Nov 2010 15:38:53 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FcrvQ025429;
	Wed, 3 Nov 2010 15:38:53 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011031538.oA3FcrvQ025429@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 3 Nov 2010 15:38: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: r214746 - in head/sys: kern sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 15:38:53 -0000

Author: jhb
Date: Wed Nov  3 15:38:52 2010
New Revision: 214746
URL: http://svn.freebsd.org/changeset/base/214746

Log:
  Remove 'softclock_ih' as it is no longer used.

Modified:
  head/sys/kern/kern_timeout.c
  head/sys/sys/interrupt.h

Modified: head/sys/kern/kern_timeout.c
==============================================================================
--- head/sys/kern/kern_timeout.c	Wed Nov  3 15:31:37 2010	(r214745)
+++ head/sys/kern/kern_timeout.c	Wed Nov  3 15:38:52 2010	(r214746)
@@ -214,8 +214,6 @@ kern_timeout_callwheel_init(void)
 /*
  * Start standard softclock thread.
  */
-void    *softclock_ih;
-
 static void
 start_softclock(void *dummy)
 {
@@ -226,9 +224,8 @@ start_softclock(void *dummy)
 
 	cc = CC_CPU(timeout_cpu);
 	if (swi_add(&clk_intr_event, "clock", softclock, cc, SWI_CLOCK,
-	    INTR_MPSAFE, &softclock_ih))
+	    INTR_MPSAFE, &cc->cc_cookie))
 		panic("died while creating standard software ithreads");
-	cc->cc_cookie = softclock_ih;
 #ifdef SMP
 	CPU_FOREACH(cpu) {
 		if (cpu == timeout_cpu)

Modified: head/sys/sys/interrupt.h
==============================================================================
--- head/sys/sys/interrupt.h	Wed Nov  3 15:31:37 2010	(r214745)
+++ head/sys/sys/interrupt.h	Wed Nov  3 15:38:52 2010	(r214746)
@@ -146,7 +146,6 @@ struct proc;
 
 extern struct	intr_event *tty_intr_event;
 extern struct	intr_event *clk_intr_event;
-extern void	*softclock_ih;
 extern void	*vm_ih;
 
 /* Counts and names for statistics (defined in MD code). */

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 15:54:51 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 48500106564A;
	Wed,  3 Nov 2010 15:54:51 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 365A98FC0C;
	Wed,  3 Nov 2010 15:54: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 oA3FspLX025844;
	Wed, 3 Nov 2010 15:54:51 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3FspiO025842;
	Wed, 3 Nov 2010 15:54:51 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <201011031554.oA3FspiO025842@svn.freebsd.org>
From: Jamie Gritton 
Date: Wed, 3 Nov 2010 15:54:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214747 - stable/8/lib/libjail
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 15:54:51 -0000

Author: jamie
Date: Wed Nov  3 15:54:50 2010
New Revision: 214747
URL: http://svn.freebsd.org/changeset/base/214747

Log:
  MFC 214434:
  
    Find a jail's type as part of jailparam_init rather than waiting until
    it's absolutely necessary.

Modified:
  stable/8/lib/libjail/jail.c
Directory Properties:
  stable/8/lib/libjail/   (props changed)

Modified: stable/8/lib/libjail/jail.c
==============================================================================
--- stable/8/lib/libjail/jail.c	Wed Nov  3 15:38:52 2010	(r214746)
+++ stable/8/lib/libjail/jail.c	Wed Nov  3 15:54:50 2010	(r214747)
@@ -250,10 +250,6 @@ jailparam_all(struct jailparam **jpp)
 		}
 		if (jailparam_init(jp + njp, buf + sizeof(SJPARAM)) < 0)
 			goto error;
-		if (jailparam_type(jp + njp) < 0) {
-			njp++;
-			goto error;
-		}
 		mib1[1] = 2;
 	}
 	jp = realloc(jp, njp * sizeof(*jp));
@@ -279,6 +275,10 @@ jailparam_init(struct jailparam *jp, con
 		strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN);
 		return (-1);
 	}
+	if (jailparam_type(jp) < 0) {
+		jailparam_free(jp, 1);
+		return (-1);
+	}
 	return (0);
 }
 
@@ -293,8 +293,6 @@ jailparam_import(struct jailparam *jp, c
 	const char *avalue;
 	int i, nval, fw;
 
-	if (!jp->jp_ctltype && jailparam_type(jp) < 0)
-		return (-1);
 	if (value == NULL)
 		return (0);
 	if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) {
@@ -563,8 +561,6 @@ jailparam_get(struct jailparam *jp, unsi
 	jp_lastjid = jp_jid = jp_name = NULL;
 	arrays = 0;
 	for (ai = j = 0; j < njp; j++) {
-		if (!jp[j].jp_ctltype && jailparam_type(jp + j) < 0)
-			return (-1);
 		if (!strcmp(jp[j].jp_name, "lastjid"))
 			jp_lastjid = jp + j;
 		else if (!strcmp(jp[j].jp_name, "jid"))
@@ -725,8 +721,6 @@ jailparam_export(struct jailparam *jp)
 	int i, nval, ival;
 	char valbuf[INET6_ADDRSTRLEN];
 
-	if (!jp->jp_ctltype && jailparam_type(jp) < 0)
-		return (NULL);
 	if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) {
 		value = strdup(jp->jp_value);
 		if (value == NULL)

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 16:19:35 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CA3C5106564A;
	Wed,  3 Nov 2010 16:19:35 +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 B95848FC1C;
	Wed,  3 Nov 2010 16:19: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 oA3GJZKO026525;
	Wed, 3 Nov 2010 16:19:35 GMT (envelope-from jh@svn.freebsd.org)
Received: (from jh@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3GJZ2s026523;
	Wed, 3 Nov 2010 16:19:35 GMT (envelope-from jh@svn.freebsd.org)
Message-Id: <201011031619.oA3GJZ2s026523@svn.freebsd.org>
From: Jaakko Heinonen 
Date: Wed, 3 Nov 2010 16:19: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: r214748 - head/sys/geom
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 16:19:35 -0000

Author: jh
Date: Wed Nov  3 16:19:35 2010
New Revision: 214748
URL: http://svn.freebsd.org/changeset/base/214748

Log:
  Extend the g_eventlock mutex coverage in one_event() to include setting
  of the EV_DONE flag and use the mutex to protect against losing wakeups
  in g_waitfor_event().
  
  Reported by:	davidxu
  Tested by:	davidxu
  Discussed on:	freebsd-current

Modified:
  head/sys/geom/geom_event.c

Modified: head/sys/geom/geom_event.c
==============================================================================
--- head/sys/geom/geom_event.c	Wed Nov  3 15:54:50 2010	(r214747)
+++ head/sys/geom/geom_event.c	Wed Nov  3 16:19:35 2010	(r214748)
@@ -220,11 +220,12 @@ one_event(void)
 	mtx_lock(&g_eventlock);
 	TAILQ_REMOVE(&g_events, ep, events);
 	ep->flag &= ~EV_INPROGRESS;
-	mtx_unlock(&g_eventlock);
 	if (ep->flag & EV_WAKEUP) {
 		ep->flag |= EV_DONE;
+		mtx_unlock(&g_eventlock);
 		wakeup(ep);
 	} else {
+		mtx_unlock(&g_eventlock);
 		g_free(ep);
 	}
 	g_topology_unlock();
@@ -365,11 +366,14 @@ g_waitfor_event(g_event_t *func, void *a
 	va_end(ap);
 	if (error)
 		return (error);
-	do 
-		tsleep(ep, PRIBIO, "g_waitfor_event", hz);
-	while (!(ep->flag & EV_DONE));
+
+	mtx_lock(&g_eventlock);
+	while (!(ep->flag & EV_DONE))
+		msleep(ep, &g_eventlock, PRIBIO, "g_waitfor_event", hz);
 	if (ep->flag & EV_CANCELED)
 		error = EAGAIN;
+	mtx_unlock(&g_eventlock);
+
 	g_free(ep);
 	return (error);
 }

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 16:21:47 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EDA86106566B;
	Wed,  3 Nov 2010 16:21:47 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DC1F18FC1C;
	Wed,  3 Nov 2010 16:21: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 oA3GLl3u026615;
	Wed, 3 Nov 2010 16:21:47 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3GLlOk026612;
	Wed, 3 Nov 2010 16:21:47 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201011031621.oA3GLlOk026612@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Wed, 3 Nov 2010 16:21: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: r214749 - head/sys/powerpc/aim
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 16:21:48 -0000

Author: nwhitehorn
Date: Wed Nov  3 16:21:47 2010
New Revision: 214749
URL: http://svn.freebsd.org/changeset/base/214749

Log:
  Fix two mistakes on 32-bit systems. The slbmte code in syscall() is 64-bit
  only, and should be protected with an ifdef, and the no-execute bit in
  32-bit set_user_sr() should be set before the comparison, not after, or
  it will never match.

Modified:
  head/sys/powerpc/aim/copyinout.c
  head/sys/powerpc/aim/trap.c

Modified: head/sys/powerpc/aim/copyinout.c
==============================================================================
--- head/sys/powerpc/aim/copyinout.c	Wed Nov  3 16:19:35 2010	(r214748)
+++ head/sys/powerpc/aim/copyinout.c	Wed Nov  3 16:21:47 2010	(r214749)
@@ -117,13 +117,13 @@ set_user_sr(pmap_t pm, const void *addr)
 
 	vsid = va_to_vsid(pm, (vm_offset_t)addr);
 
+	/* Mark segment no-execute */
+	vsid |= SR_N;
+
 	/* If we have already set this VSID, we can just return */
 	if (curthread->td_pcb->pcb_cpu.aim.usr_vsid == vsid)
 		return;
 
-	/* Mark segment no-execute */
-	vsid |= SR_N;
-
 	__asm __volatile("isync");
 	curthread->td_pcb->pcb_cpu.aim.usr_segm =
 	    (uintptr_t)addr >> ADDR_SR_SHFT;

Modified: head/sys/powerpc/aim/trap.c
==============================================================================
--- head/sys/powerpc/aim/trap.c	Wed Nov  3 16:19:35 2010	(r214748)
+++ head/sys/powerpc/aim/trap.c	Wed Nov  3 16:21:47 2010	(r214749)
@@ -455,12 +455,14 @@ syscall(struct trapframe *frame)
 	td = PCPU_GET(curthread);
 	td->td_frame = frame;
 
+#ifdef __powerpc64__
 	/*
 	 * Speculatively restore last user SLB segment, which we know is
 	 * invalid already, since we are likely to do copyin()/copyout().
 	 */
 	__asm __volatile ("slbmte %0, %1; isync" ::
             "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE));
+#endif
 
 	error = syscallenter(td, &sa);
 	syscallret(td, error, &sa);

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 18:49:51 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 206C8106564A;
	Wed,  3 Nov 2010 18:49:51 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0EEDE8FC0A;
	Wed,  3 Nov 2010 18:49: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 oA3InodZ030025;
	Wed, 3 Nov 2010 18:49:50 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3InofI030022;
	Wed, 3 Nov 2010 18:49:50 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201011031849.oA3InofI030022@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Wed, 3 Nov 2010 18:49: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: r214752 - head/share/man/man9
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 18:49:51 -0000

Author: trasz
Date: Wed Nov  3 18:49:50 2010
New Revision: 214752
URL: http://svn.freebsd.org/changeset/base/214752

Log:
  Xref BUS_SETUP_INTR(9) and locking(9).

Modified:
  head/share/man/man9/BUS_SETUP_INTR.9
  head/share/man/man9/locking.9

Modified: head/share/man/man9/BUS_SETUP_INTR.9
==============================================================================
--- head/share/man/man9/BUS_SETUP_INTR.9	Wed Nov  3 16:46:05 2010	(r214751)
+++ head/share/man/man9/BUS_SETUP_INTR.9	Wed Nov  3 18:49:50 2010	(r214752)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 18, 2007
+.Dd November 3, 2010
 .Dt BUS_SETUP_INTR 9
 .Os
 .Sh NAME
@@ -205,8 +205,7 @@ otherwise an appropriate error is return
 .Xr random 4 ,
 .Xr device 9 ,
 .Xr driver 9 ,
-.Xr mtx_init 9 ,
-.Xr wakeup 9
+.Xr locking 9
 .Sh AUTHORS
 .An -nosplit
 This manual page was written by

Modified: head/share/man/man9/locking.9
==============================================================================
--- head/share/man/man9/locking.9	Wed Nov  3 16:46:05 2010	(r214751)
+++ head/share/man/man9/locking.9	Wed Nov  3 18:49:50 2010	(r214752)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 24, 2010
+.Dd November 3, 2010
 .Dt LOCKING 9
 .Os
 .Sh NAME
@@ -356,6 +356,7 @@ At this time this is a rather easy to re
 .Xr sema 9 ,
 .Xr sleep 9 ,
 .Xr sx 9 ,
+.Xr BUS_SETUP_INTR 9 ,
 .Xr LOCK_PROFILING 9
 .Sh HISTORY
 These

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 21:10:12 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8343A1065670;
	Wed,  3 Nov 2010 21:10:12 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7288D8FC26;
	Wed,  3 Nov 2010 21:10: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 oA3LAC4H033325;
	Wed, 3 Nov 2010 21:10:12 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3LACTT033323;
	Wed, 3 Nov 2010 21:10:12 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <201011032110.oA3LACTT033323@svn.freebsd.org>
From: Nick Hibma 
Date: Wed, 3 Nov 2010 21:10: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: r214754 - head/sys/netinet/libalias
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 21:10:12 -0000

Author: n_hibma
Date: Wed Nov  3 21:10:12 2010
New Revision: 214754
URL: http://svn.freebsd.org/changeset/base/214754

Log:
  Don't spam the console with loaded modules during boot and/or during
  startup of ppp.
  
  Note: This cannot be hidden behind bootverbose as this file is included
  from lib/libalias as well.

Modified:
  head/sys/netinet/libalias/alias.c

Modified: head/sys/netinet/libalias/alias.c
==============================================================================
--- head/sys/netinet/libalias/alias.c	Wed Nov  3 20:50:41 2010	(r214753)
+++ head/sys/netinet/libalias/alias.c	Wed Nov  3 21:10:12 2010	(r214754)
@@ -1665,7 +1665,6 @@ LibAliasRefreshModules(void)
 			if (buf[i] == '#')
 				continue;
 			buf[len - 1] = '\0';
-			printf("Loading %s\n", buf);
 			LibAliasLoadModule(buf);
 		}
 	}

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 21:21:12 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C796A1065673;
	Wed,  3 Nov 2010 21:21:12 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B1F7C8FC08;
	Wed,  3 Nov 2010 21:21: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 oA3LLCjh033741;
	Wed, 3 Nov 2010 21:21:12 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3LLCVH033720;
	Wed, 3 Nov 2010 21:21:12 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011032121.oA3LLCVH033720@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 3 Nov 2010 21:21:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214755 - in stable/8/sys: amd64/amd64 amd64/conf
	amd64/ia32 amd64/include amd64/linux32 arm/arm
	cddl/dev/systrace compat/ia32 compat/svr4 conf i386/conf
	i386/i386 i386/ibcs2 i386/inclu...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 21:21:13 -0000

Author: kib
Date: Wed Nov  3 21:21:12 2010
New Revision: 214755
URL: http://svn.freebsd.org/changeset/base/214755

Log:
  MFC r208453:
  Reorganize syscall entry and leave handling.
  Implement ptrace_lwpinfo pl_flags PL_FLAG_SCE, PL_FLAG_SCX and
  PL_FLAG_EXEC.
  
  The i386, amd64, sparc64, sun4v, powerpc and ia64 syscall()s are
  changed to use syscallenter()/syscallret(). MIPS and arm are not
  converted and use the mostly unchanged syscall() implementation.
  
  MFC r208514:
  Change ia64' struct syscall_args definition so that args is a pointer to
  the arguments array instead of array itself.
  
  MFC r208566:
  Allow to use syscallname(9) outside subr_trap.c.
  
  MFC r209258 (by rpaulo):
  Make DTrace syscall provider work again by including opt_kdtrace.h here.
  
  MFC r209313:
  Only enable kdtrace hook in the LINT on the architectures that implement it.
  
  MFC r209697:
  Obey sv_syscallnames bounds in syscallname().
  
  NOTE: The KBI of the struct sysentvec is changed, new required members
  sv_set_syscall_retval, sv_fetch_syscall_args and sv_syscallnames are
  added. The sv_prepsyscall field is now ignored. Third-party modules
  using the struct sysentvec must be modified and recompiled, we believe
  that only ABI emulators are affected. No such out-of-tree modules are
  known. In-tree modules that are affected by the change were converted
  to depend on exact version of the kernel, see r214421.

Modified:
  stable/8/sys/amd64/amd64/elf_machdep.c
  stable/8/sys/amd64/amd64/trap.c
  stable/8/sys/amd64/conf/NOTES
  stable/8/sys/amd64/ia32/ia32_syscall.c
  stable/8/sys/amd64/include/proc.h
  stable/8/sys/amd64/linux32/linux32_sysvec.c
  stable/8/sys/arm/arm/elf_machdep.c
  stable/8/sys/arm/arm/trap.c
  stable/8/sys/cddl/dev/systrace/systrace.c
  stable/8/sys/compat/ia32/ia32_sysvec.c
  stable/8/sys/compat/ia32/ia32_util.h
  stable/8/sys/compat/svr4/svr4_sysvec.c
  stable/8/sys/conf/NOTES
  stable/8/sys/conf/files
  stable/8/sys/i386/conf/NOTES
  stable/8/sys/i386/i386/elf_machdep.c
  stable/8/sys/i386/i386/trap.c
  stable/8/sys/i386/ibcs2/ibcs2_sysvec.c
  stable/8/sys/i386/include/proc.h
  stable/8/sys/i386/linux/linux_sysvec.c
  stable/8/sys/ia64/ia32/ia32_trap.c
  stable/8/sys/ia64/ia64/elf_machdep.c
  stable/8/sys/ia64/ia64/trap.c
  stable/8/sys/ia64/include/proc.h
  stable/8/sys/kern/imgact_aout.c
  stable/8/sys/kern/init_main.c
  stable/8/sys/kern/kern_exec.c
  stable/8/sys/kern/kern_sig.c
  stable/8/sys/kern/subr_trap.c
  stable/8/sys/kern/sys_process.c
  stable/8/sys/mips/mips/elf64_machdep.c
  stable/8/sys/mips/mips/elf_machdep.c
  stable/8/sys/mips/mips/trap.c
  stable/8/sys/powerpc/aim/trap.c
  stable/8/sys/powerpc/booke/trap.c
  stable/8/sys/powerpc/include/proc.h
  stable/8/sys/powerpc/powerpc/elf_machdep.c
  stable/8/sys/sparc64/include/proc.h
  stable/8/sys/sparc64/sparc64/elf_machdep.c
  stable/8/sys/sparc64/sparc64/trap.c
  stable/8/sys/sun4v/include/proc.h
  stable/8/sys/sun4v/sun4v/trap.c
  stable/8/sys/sys/proc.h
  stable/8/sys/sys/ptrace.h
  stable/8/sys/sys/sysent.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/elf_machdep.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/amd64/amd64/elf_machdep.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -74,7 +75,10 @@ struct sysentvec elf64_freebsd_sysvec = 
 	.sv_setregs	= exec_setregs,
 	.sv_fixlimit	= NULL,
 	.sv_maxssiz	= NULL,
-	.sv_flags	= SV_ABI_FREEBSD | SV_LP64
+	.sv_flags	= SV_ABI_FREEBSD | SV_LP64,
+	.sv_set_syscall_retval = cpu_set_syscall_retval,
+	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
+	.sv_syscallnames = syscallnames,
 };
 
 static Elf64_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/amd64/amd64/trap.c
==============================================================================
--- stable/8/sys/amd64/amd64/trap.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/amd64/amd64/trap.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -76,7 +76,6 @@ __FBSDID("$FreeBSD$");
 #ifdef HWPMC_HOOKS
 #include 
 #endif
-#include 
 
 #include 
 #include 
@@ -170,8 +169,6 @@ static int prot_fault_translation = 0;
 SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW,
 	&prot_fault_translation, 0, "Select signal to deliver on protection fault");
 
-extern char *syscallnames[];
-
 /*
  * Exception, fault, and trap interface to the FreeBSD kernel.
  * This common code is called from assembly language IDT gate entry
@@ -804,19 +801,12 @@ dblfault_handler(struct trapframe *frame
 	panic("double fault");
 }
 
-struct syscall_args {
-	u_int code;
-	struct sysent *callp;
-	register_t args[8];
-	register_t *argp;
-	int narg;
-};
-
-static int
-fetch_syscall_args(struct thread *td, struct syscall_args *sa)
+int
+cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
 {
 	struct proc *p;
 	struct trapframe *frame;
+	register_t *argp;
 	caddr_t params;
 	int reg, regcnt, error;
 
@@ -828,15 +818,10 @@ fetch_syscall_args(struct thread *td, st
 	params = (caddr_t)frame->tf_rsp + sizeof(register_t);
 	sa->code = frame->tf_rax;
 
-	if (p->p_sysent->sv_prepsyscall) {
-		(*p->p_sysent->sv_prepsyscall)(frame, (int *)sa->args,
-		    &sa->code, ¶ms);
-	} else {
-		if (sa->code == SYS_syscall || sa->code == SYS___syscall) {
-			sa->code = frame->tf_rdi;
-			reg++;
-			regcnt--;
-		}
+	if (sa->code == SYS_syscall || sa->code == SYS___syscall) {
+		sa->code = frame->tf_rdi;
+		reg++;
+		regcnt--;
 	}
  	if (p->p_sysent->sv_mask)
  		sa->code &= p->p_sysent->sv_mask;
@@ -850,24 +835,20 @@ fetch_syscall_args(struct thread *td, st
 	KASSERT(sa->narg <= sizeof(sa->args) / sizeof(sa->args[0]),
 	    ("Too many syscall arguments!"));
 	error = 0;
-	sa->argp = &frame->tf_rdi;
-	sa->argp += reg;
-	bcopy(sa->argp, sa->args, sizeof(sa->args[0]) * regcnt);
+	argp = &frame->tf_rdi;
+	argp += reg;
+	bcopy(argp, sa->args, sizeof(sa->args[0]) * regcnt);
 	if (sa->narg > regcnt) {
 		KASSERT(params != NULL, ("copyin args with no params!"));
 		error = copyin(params, &sa->args[regcnt],
 	    	    (sa->narg - regcnt) * sizeof(sa->args[0]));
 	}
-	sa->argp = &sa->args[0];
 
-	/*
-	 * This may result in two records if debugger modified
-	 * registers or memory during sleep at stop/ptrace point.
-	 */
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSCALL))
-		ktrsyscall(sa->code, sa->narg, sa->argp);
-#endif
+	if (error == 0) {
+		td->td_retval[0] = 0;
+		td->td_retval[1] = frame->tf_rdx;
+	}
+
 	return (error);
 }
 
@@ -880,87 +861,22 @@ void
 syscall(struct trapframe *frame)
 {
 	struct thread *td;
-	struct proc *p;
 	struct syscall_args sa;
 	register_t orig_tf_rflags;
 	int error;
 	ksiginfo_t ksi;
 
-	PCPU_INC(cnt.v_syscall);
-	td = curthread;
-	p = td->td_proc;
-	td->td_syscalls++;
-
 #ifdef DIAGNOSTIC
 	if (ISPL(frame->tf_cs) != SEL_UPL) {
 		panic("syscall");
 		/* NOT REACHED */
 	}
 #endif
-
-	td->td_pticks = 0;
-	td->td_frame = frame;
-	if (td->td_ucred != p->p_ucred) 
-		cred_update_thread(td);
 	orig_tf_rflags = frame->tf_rflags;
-	if (p->p_flag & P_TRACED) {
-		PROC_LOCK(p);
-		td->td_dbgflags &= ~TDB_USERWR;
-		PROC_UNLOCK(p);
-	}
-	error = fetch_syscall_args(td, &sa);
-
-	CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_name, sa.code);
-
-	if (error == 0) {
-		td->td_retval[0] = 0;
-		td->td_retval[1] = frame->tf_rdx;
-
-		STOPEVENT(p, S_SCE, sa.narg);
-		PTRACESTOP_SC(p, td, S_PT_SCE);
-		if (td->td_dbgflags & TDB_USERWR) {
-			/*
-			 * Reread syscall number and arguments if
-			 * debugger modified registers or memory.
-			 */
-			error = fetch_syscall_args(td, &sa);
-			if (error != 0)
-				goto retval;
-			td->td_retval[1] = frame->tf_rdx;
-		}
-
-#ifdef KDTRACE_HOOKS
-		/*
-		 * If the systrace module has registered it's probe
-		 * callback and if there is a probe active for the
-		 * syscall 'entry', process the probe.
-		 */
-		if (systrace_probe_func != NULL && sa.callp->sy_entry != 0)
-			(*systrace_probe_func)(sa.callp->sy_entry, sa.code,
-			    sa.callp, sa.args);
-#endif
-
-		AUDIT_SYSCALL_ENTER(sa.code, td);
-		error = (*sa.callp->sy_call)(td, sa.argp);
-		AUDIT_SYSCALL_EXIT(error, td);
-
-		/* Save the latest error return value. */
-		td->td_errno = error;
+	td = curthread;
+	td->td_frame = frame;
 
-#ifdef KDTRACE_HOOKS
-		/*
-		 * If the systrace module has registered it's probe
-		 * callback and if there is a probe active for the
-		 * syscall 'return', process the probe.
-		 */
-		if (systrace_probe_func != NULL && sa.callp->sy_return != 0)
-			(*systrace_probe_func)(sa.callp->sy_return, sa.code,
-			    sa.callp, sa.args);
-#endif
-	}
- retval:
-	cpu_set_syscall_retval(td, error);
+	error = syscallenter(td, &sa);
 
 	/*
 	 * Traced syscall.
@@ -974,40 +890,5 @@ syscall(struct trapframe *frame)
 		trapsignal(td, &ksi);
 	}
 
-	/*
-	 * Check for misbehavior.
-	 */
-	WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     syscallnames[sa.code] : "???");
-	KASSERT(td->td_critnest == 0,
-	    ("System call %s returning in a critical section",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     syscallnames[sa.code] : "???"));
-	KASSERT(td->td_locks == 0,
-	    ("System call %s returning with %d locks held",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     syscallnames[sa.code] : "???", td->td_locks));
-
-	/*
-	 * Handle reschedule and other end-of-syscall issues
-	 */
-	userret(td, frame);
-
-	CTR4(KTR_SYSC, "syscall exit thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_name, sa.code);
-
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSRET))
-		ktrsysret(sa.code, error, td->td_retval[0]);
-#endif
-
-	/*
-	 * This works because errno is findable through the
-	 * register set.  If we ever support an emulation where this
-	 * is not the case, this code will need to be revisited.
-	 */
-	STOPEVENT(p, S_SCX, sa.code);
-
-	PTRACESTOP_SC(p, td, S_PT_SCX);
+	syscallret(td, error, &sa);
 }

Modified: stable/8/sys/amd64/conf/NOTES
==============================================================================
--- stable/8/sys/amd64/conf/NOTES	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/amd64/conf/NOTES	Wed Nov  3 21:21:12 2010	(r214755)
@@ -11,6 +11,12 @@
 # We want LINT to cover profiling as well.
 profile         2
 
+#
+# Enable the kernel DTrace hooks which are required to load the DTrace
+# kernel modules.
+#
+options 	KDTRACE_HOOKS
+
 
 #####################################################################
 # SMP OPTIONS:

Modified: stable/8/sys/amd64/ia32/ia32_syscall.c
==============================================================================
--- stable/8/sys/amd64/ia32/ia32_syscall.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/amd64/ia32/ia32_syscall.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -81,62 +82,54 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #define	IDTVEC(name)	__CONCAT(X,name)
 
 extern inthand_t IDTVEC(int0x80_syscall), IDTVEC(rsvd);
-extern const char *freebsd32_syscallnames[];
 
 void ia32_syscall(struct trapframe *frame);	/* Called from asm code */
 
-struct ia32_syscall_args {
-	u_int code;
-	caddr_t params;
-	struct sysent *callp;
-	u_int64_t args64[8];
-	int narg;
-};
+void
+ia32_set_syscall_retval(struct thread *td, int error)
+{
 
-static int
-fetch_ia32_syscall_args(struct thread *td, struct ia32_syscall_args *sa)
+	cpu_set_syscall_retval(td, error);
+}
+
+int
+ia32_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
 {
 	struct proc *p;
 	struct trapframe *frame;
+	caddr_t params;
 	u_int32_t args[8];
 	int error, i;
 
 	p = td->td_proc;
 	frame = td->td_frame;
 
-	sa->params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t);
+	params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t);
 	sa->code = frame->tf_rax;
 
-	if (p->p_sysent->sv_prepsyscall) {
+	/*
+	 * Need to check if this is a 32 bit or 64 bit syscall.
+	 */
+	if (sa->code == SYS_syscall) {
 		/*
-		 * The prep code is MP aware.
+		 * Code is first argument, followed by actual args.
 		 */
-		(*p->p_sysent->sv_prepsyscall)(frame, args, &sa->code,
-		    &sa->params);
-	} else {
+		sa->code = fuword32(params);
+		params += sizeof(int);
+	} else if (sa->code == SYS___syscall) {
 		/*
-		 * Need to check if this is a 32 bit or 64 bit syscall.
-		 * fuword is MP aware.
+		 * Like syscall, but code is a quad, so as to maintain
+		 * quad alignment for the rest of the arguments.
+		 * We use a 32-bit fetch in case params is not
+		 * aligned.
 		 */
-		if (sa->code == SYS_syscall) {
-			/*
-			 * Code is first argument, followed by actual args.
-			 */
-			sa->code = fuword32(sa->params);
-			sa->params += sizeof(int);
-		} else if (sa->code == SYS___syscall) {
-			/*
-			 * Like syscall, but code is a quad, so as to maintain
-			 * quad alignment for the rest of the arguments.
-			 * We use a 32-bit fetch in case params is not
-			 * aligned.
-			 */
-			sa->code = fuword32(sa->params);
-			sa->params += sizeof(quad_t);
-		}
+		sa->code = fuword32(params);
+		params += sizeof(quad_t);
 	}
  	if (p->p_sysent->sv_mask)
  		sa->code &= p->p_sysent->sv_mask;
@@ -146,19 +139,19 @@ fetch_ia32_syscall_args(struct thread *t
  		sa->callp = &p->p_sysent->sv_table[sa->code];
 	sa->narg = sa->callp->sy_narg;
 
-	if (sa->params != NULL && sa->narg != 0)
-		error = copyin(sa->params, (caddr_t)args,
+	if (params != NULL && sa->narg != 0)
+		error = copyin(params, (caddr_t)args,
 		    (u_int)(sa->narg * sizeof(int)));
 	else
 		error = 0;
 
 	for (i = 0; i < sa->narg; i++)
-		sa->args64[i] = args[i];
+		sa->args[i] = args[i];
 
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSCALL))
-		ktrsyscall(sa->code, sa->narg, sa->args64);
-#endif
+	if (error == 0) {
+		td->td_retval[0] = 0;
+		td->td_retval[1] = frame->tf_rdx;
+	}
 
 	return (error);
 }
@@ -167,58 +160,16 @@ void
 ia32_syscall(struct trapframe *frame)
 {
 	struct thread *td;
-	struct proc *p;
-	struct ia32_syscall_args sa;
+	struct syscall_args sa;
 	register_t orig_tf_rflags;
 	int error;
 	ksiginfo_t ksi;
 
-	PCPU_INC(cnt.v_syscall);
+	orig_tf_rflags = frame->tf_rflags;
 	td = curthread;
-	p = td->td_proc;
-	td->td_syscalls++;
-
-	td->td_pticks = 0;
 	td->td_frame = frame;
-	if (td->td_ucred != p->p_ucred) 
-		cred_update_thread(td);
-	orig_tf_rflags = frame->tf_rflags;
-	if (p->p_flag & P_TRACED) {
-		PROC_LOCK(p);
-		td->td_dbgflags &= ~TDB_USERWR;
-		PROC_UNLOCK(p);
-	}
-	error = fetch_ia32_syscall_args(td, &sa);
-
-	CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_name, sa.code);
-
-	if (error == 0) {
-		td->td_retval[0] = 0;
-		td->td_retval[1] = frame->tf_rdx;
 
-		STOPEVENT(p, S_SCE, sa.narg);
-		PTRACESTOP_SC(p, td, S_PT_SCE);
-		if (td->td_dbgflags & TDB_USERWR) {
-			/*
-			 * Reread syscall number and arguments if
-			 * debugger modified registers or memory.
-			 */
-			error = fetch_ia32_syscall_args(td, &sa);
-			if (error != 0)
-				goto retval;
-			td->td_retval[1] = frame->tf_rdx;
-		}
-
-		AUDIT_SYSCALL_ENTER(sa.code, td);
-		error = (*sa.callp->sy_call)(td, sa.args64);
-		AUDIT_SYSCALL_EXIT(error, td);
-
-		/* Save the latest error return value. */
-		td->td_errno = error;
-	}
- retval:
-	cpu_set_syscall_retval(td, error);
+	error = syscallenter(td, &sa);
 
 	/*
 	 * Traced syscall.
@@ -232,44 +183,9 @@ ia32_syscall(struct trapframe *frame)
 		trapsignal(td, &ksi);
 	}
 
-	/*
-	 * Check for misbehavior.
-	 */
-	WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     freebsd32_syscallnames[sa.code] : "???");
-	KASSERT(td->td_critnest == 0,
-	    ("System call %s returning in a critical section",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     freebsd32_syscallnames[sa.code] : "???"));
-	KASSERT(td->td_locks == 0,
-	    ("System call %s returning with %d locks held",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     freebsd32_syscallnames[sa.code] : "???", td->td_locks));
-
-	/*
-	 * Handle reschedule and other end-of-syscall issues
-	 */
-	userret(td, frame);
-
-	CTR4(KTR_SYSC, "syscall exit thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_proc->p_comm, sa.code);
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSRET))
-		ktrsysret(sa.code, error, td->td_retval[0]);
-#endif
-
-	/*
-	 * This works because errno is findable through the
-	 * register set.  If we ever support an emulation where this
-	 * is not the case, this code will need to be revisited.
-	 */
-	STOPEVENT(p, S_SCX, sa.code);
- 
-	PTRACESTOP_SC(p, td, S_PT_SCX);
+	syscallret(td, error, &sa);
 }
 
-
 static void
 ia32_syscall_enable(void *dummy)
 {

Modified: stable/8/sys/amd64/include/proc.h
==============================================================================
--- stable/8/sys/amd64/include/proc.h	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/amd64/include/proc.h	Wed Nov  3 21:21:12 2010	(r214755)
@@ -79,6 +79,14 @@ int amd64_set_ldt_data(struct thread *td
 extern struct mtx dt_lock;
 extern int max_ldt_segment;
 
+struct syscall_args {
+	u_int code;
+	struct sysent *callp;
+	register_t args[8];
+	int narg;
+};
+#define	HAVE_SYSCALL_ARGS_DEF 1
+
 #endif  /* _KERNEL */
 
 #endif /* !_MACHINE_PROC_H_ */

Modified: stable/8/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/8/sys/amd64/linux32/linux32_sysvec.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/amd64/linux32/linux32_sysvec.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -121,8 +121,6 @@ SET_DECLARE(linux_device_handler_set, st
 static int	elf_linux_fixup(register_t **stack_base,
 		    struct image_params *iparams);
 static register_t *linux_copyout_strings(struct image_params *imgp);
-static void	linux_prepsyscall(struct trapframe *tf, int *args, u_int *code,
-		    caddr_t *params);
 static void     linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
@@ -764,19 +762,33 @@ linux_rt_sigreturn(struct thread *td, st
 	return (EJUSTRETURN);
 }
 
-/*
- * MPSAFE
- */
-static void
-linux_prepsyscall(struct trapframe *tf, int *args, u_int *code, caddr_t *params)
+static int
+linux32_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
 {
-	args[0] = tf->tf_rbx;
-	args[1] = tf->tf_rcx;
-	args[2] = tf->tf_rdx;
-	args[3] = tf->tf_rsi;
-	args[4] = tf->tf_rdi;
-	args[5] = tf->tf_rbp;	/* Unconfirmed */
-	*params = NULL;		/* no copyin */
+	struct proc *p;
+	struct trapframe *frame;
+
+	p = td->td_proc;
+	frame = td->td_frame;
+
+	sa->args[0] = frame->tf_rbx;
+	sa->args[1] = frame->tf_rcx;
+	sa->args[2] = frame->tf_rdx;
+	sa->args[3] = frame->tf_rsi;
+	sa->args[4] = frame->tf_rdi;
+	sa->args[5] = frame->tf_rbp;	/* Unconfirmed */
+	sa->code = frame->tf_rax;
+
+	if (sa->code >= p->p_sysent->sv_size)
+		sa->callp = &p->p_sysent->sv_table[0];
+	else
+		sa->callp = &p->p_sysent->sv_table[sa->code];
+	sa->narg = sa->callp->sy_narg;
+
+	td->td_retval[0] = 0;
+	td->td_retval[1] = frame->tf_rdx;
+
+	return (0);
 }
 
 /*
@@ -1043,7 +1055,7 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_sendsig	= linux_sendsig,
 	.sv_sigcode	= linux_sigcode,
 	.sv_szsigcode	= &linux_szsigcode,
-	.sv_prepsyscall	= linux_prepsyscall,
+	.sv_prepsyscall	= NULL,
 	.sv_name	= "Linux ELF32",
 	.sv_coredump	= elf32_coredump,
 	.sv_imgact_try	= exec_linux_imgact_try,
@@ -1058,7 +1070,10 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_setregs	= exec_linux_setregs,
 	.sv_fixlimit	= linux32_fixlimit,
 	.sv_maxssiz	= &linux32_maxssiz,
-	.sv_flags	= SV_ABI_LINUX | SV_ILP32 | SV_IA32
+	.sv_flags	= SV_ABI_LINUX | SV_ILP32 | SV_IA32,
+	.sv_set_syscall_retval = cpu_set_syscall_retval,
+	.sv_fetch_syscall_args = linux32_fetch_syscall_args,
+	.sv_syscallnames = NULL,
 };
 
 static char GNU_ABI_VENDOR[] = "GNU";

Modified: stable/8/sys/arm/arm/elf_machdep.c
==============================================================================
--- stable/8/sys/arm/arm/elf_machdep.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/arm/arm/elf_machdep.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -73,7 +74,10 @@ struct sysentvec elf32_freebsd_sysvec = 
 	.sv_setregs	= exec_setregs,
 	.sv_fixlimit	= NULL,
 	.sv_maxssiz	= NULL,
-	.sv_flags	= SV_ABI_FREEBSD | SV_ILP32
+	.sv_flags	= SV_ABI_FREEBSD | SV_ILP32,
+	.sv_set_syscall_retval = cpu_set_syscall_retval,
+	.sv_fetch_syscall_args = NULL, /* XXXKIB */
+	.sv_syscallnames = syscallnames,
 };
 
 static Elf32_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/arm/arm/trap.c
==============================================================================
--- stable/8/sys/arm/arm/trap.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/arm/arm/trap.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -130,7 +130,6 @@ void undefinedinstruction(trapframe_t *)
 #include 
  
 extern char fusubailout[];
-extern char *syscallnames[];
 
 #ifdef DEBUG
 int last_fault_code;	/* For the benefit of pmap_fault_fixup() */

Modified: stable/8/sys/cddl/dev/systrace/systrace.c
==============================================================================
--- stable/8/sys/cddl/dev/systrace/systrace.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/cddl/dev/systrace/systrace.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -77,7 +77,6 @@ extern struct sysent linux_sysent[];
  */
 #include 
 #include 
-extern const char	*syscallnames[];
 #define	DEVNAME		"dtrace/systrace"
 #define	PROVNAME	"syscall"
 #define	MAXSYSCALL	SYS_MAXSYSCALL

Modified: stable/8/sys/compat/ia32/ia32_sysvec.c
==============================================================================
--- stable/8/sys/compat/ia32/ia32_sysvec.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/compat/ia32/ia32_sysvec.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -93,6 +93,8 @@ CTASSERT(sizeof(struct ia32_ucontext4) =
 CTASSERT(sizeof(struct ia32_sigframe4) == 408);
 #endif
 
+extern const char *freebsd32_syscallnames[];
+
 static void ia32_fixlimit(struct rlimit *rl, int which);
 
 SYSCTL_NODE(_compat, OID_AUTO, ia32, CTLFLAG_RW, 0, "ia32 mode");
@@ -135,7 +137,10 @@ struct sysentvec ia32_freebsd_sysvec = {
 	.sv_setregs	= ia32_setregs,
 	.sv_fixlimit	= ia32_fixlimit,
 	.sv_maxssiz	= &ia32_maxssiz,
-	.sv_flags	= SV_ABI_FREEBSD | SV_IA32 | SV_ILP32
+	.sv_flags	= SV_ABI_FREEBSD | SV_IA32 | SV_ILP32,
+	.sv_set_syscall_retval = ia32_set_syscall_retval,
+	.sv_fetch_syscall_args = ia32_fetch_syscall_args,
+	.sv_syscallnames = freebsd32_syscallnames,
 };
 
 

Modified: stable/8/sys/compat/ia32/ia32_util.h
==============================================================================
--- stable/8/sys/compat/ia32/ia32_util.h	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/compat/ia32/ia32_util.h	Wed Nov  3 21:21:12 2010	(r214755)
@@ -47,3 +47,7 @@
 #define	IA32_MAXDSIZ	(512*1024*1024)		/* 512MB */
 #define	IA32_MAXSSIZ	(64*1024*1024)		/* 64MB */
 #define IA32_MAXVMEM	0			/* Unlimited */
+
+struct syscall_args;
+int ia32_fetch_syscall_args(struct thread *td, struct syscall_args *sa);
+void ia32_set_syscall_retval(struct thread *, int);

Modified: stable/8/sys/compat/svr4/svr4_sysvec.c
==============================================================================
--- stable/8/sys/compat/svr4/svr4_sysvec.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/compat/svr4/svr4_sysvec.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -191,7 +191,10 @@ struct sysentvec svr4_sysvec = {
 	.sv_setregs	= exec_setregs,
 	.sv_fixlimit	= NULL,
 	.sv_maxssiz     = NULL,
-	.sv_flags	= SV_ABI_UNDEF | SV_IA32 | SV_ILP32
+	.sv_flags	= SV_ABI_UNDEF | SV_IA32 | SV_ILP32,
+	.sv_set_syscall_retval = cpu_set_syscall_retval,
+	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
+	.sv_syscallnames = NULL,
 };
 
 const char      svr4_emul_path[] = "/compat/svr4";

Modified: stable/8/sys/conf/NOTES
==============================================================================
--- stable/8/sys/conf/NOTES	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/conf/NOTES	Wed Nov  3 21:21:12 2010	(r214755)
@@ -363,12 +363,6 @@ options 	DDB_NUMSYM
 options 	GDB
 
 #
-# Enable the kernel DTrace hooks which are required to load the DTrace
-# kernel modules.
-#
-options 	KDTRACE_HOOKS
-
-#
 # SYSCTL_DEBUG enables a 'sysctl' debug tree that can be used to dump the
 # contents of the registered sysctl nodes on the console.  It is disabled by
 # default because it generates excessively verbose console output that can

Modified: stable/8/sys/conf/files
==============================================================================
--- stable/8/sys/conf/files	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/conf/files	Wed Nov  3 21:21:12 2010	(r214755)
@@ -2171,7 +2171,7 @@ kern/sys_generic.c		standard
 kern/sys_pipe.c			standard
 kern/sys_process.c		standard
 kern/sys_socket.c		standard
-kern/syscalls.c			optional witness | invariants | kdtrace_hooks
+kern/syscalls.c			standard
 kern/sysv_ipc.c			standard
 kern/sysv_msg.c			optional sysvmsg
 kern/sysv_sem.c			optional sysvsem

Modified: stable/8/sys/i386/conf/NOTES
==============================================================================
--- stable/8/sys/i386/conf/NOTES	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/i386/conf/NOTES	Wed Nov  3 21:21:12 2010	(r214755)
@@ -11,6 +11,12 @@
 # We want LINT to cover profiling as well.
 profile         2
 
+#
+# Enable the kernel DTrace hooks which are required to load the DTrace
+# kernel modules.
+#
+options 	KDTRACE_HOOKS
+
 
 #####################################################################
 # SMP OPTIONS:

Modified: stable/8/sys/i386/i386/elf_machdep.c
==============================================================================
--- stable/8/sys/i386/i386/elf_machdep.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/i386/i386/elf_machdep.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -73,7 +74,10 @@ struct sysentvec elf32_freebsd_sysvec = 
 	.sv_setregs	= exec_setregs,
 	.sv_fixlimit	= NULL,
 	.sv_maxssiz	= NULL,
-	.sv_flags	= SV_ABI_FREEBSD | SV_IA32 | SV_ILP32
+	.sv_flags	= SV_ABI_FREEBSD | SV_IA32 | SV_ILP32,
+	.sv_set_syscall_retval = cpu_set_syscall_retval,
+	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
+	.sv_syscallnames = syscallnames,
 };
 
 static Elf32_Brandinfo freebsd_brand_info = {

Modified: stable/8/sys/i386/i386/trap.c
==============================================================================
--- stable/8/sys/i386/i386/trap.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/i386/i386/trap.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -184,8 +184,6 @@ static int prot_fault_translation = 0;
 SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW,
 	&prot_fault_translation, 0, "Select signal to deliver on protection fault");
 
-extern char *syscallnames[];
-
 /*
  * Exception, fault, and trap interface to the FreeBSD kernel.
  * This common code is called from assembly language IDT gate entry
@@ -971,16 +969,8 @@ dblfault_handler()
 	panic("double fault");
 }
 
-struct syscall_args {
-	u_int code;
-	struct sysent *callp;
-	int args[8];
-	register_t *argp;
-	int narg;
-};
-
-static int
-fetch_syscall_args(struct thread *td, struct syscall_args *sa)
+int
+cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
 {
 	struct proc *p;
 	struct trapframe *frame;
@@ -993,27 +983,22 @@ fetch_syscall_args(struct thread *td, st
 	params = (caddr_t)frame->tf_esp + sizeof(int);
 	sa->code = frame->tf_eax;
 
-	if (p->p_sysent->sv_prepsyscall) {
-		(*p->p_sysent->sv_prepsyscall)(frame, sa->args, &sa->code,
-		    ¶ms);
-	} else {
+	/*
+	 * Need to check if this is a 32 bit or 64 bit syscall.
+	 */
+	if (sa->code == SYS_syscall) {
 		/*
-		 * Need to check if this is a 32 bit or 64 bit syscall.
+		 * Code is first argument, followed by actual args.
 		 */
-		if (sa->code == SYS_syscall) {
-			/*
-			 * Code is first argument, followed by actual args.
-			 */
-			sa->code = fuword(params);
-			params += sizeof(int);
-		} else if (sa->code == SYS___syscall) {
-			/*
-			 * Like syscall, but code is a quad, so as to maintain
-			 * quad alignment for the rest of the arguments.
-			 */
-			sa->code = fuword(params);
-			params += sizeof(quad_t);
-		}
+		sa->code = fuword(params);
+		params += sizeof(int);
+	} else if (sa->code == SYS___syscall) {
+		/*
+		 * Like syscall, but code is a quad, so as to maintain
+		 * quad alignment for the rest of the arguments.
+		 */
+		sa->code = fuword(params);
+		params += sizeof(quad_t);
 	}
 
  	if (p->p_sysent->sv_mask)
@@ -1029,11 +1014,12 @@ fetch_syscall_args(struct thread *td, st
 		    (u_int)(sa->narg * sizeof(int)));
 	else
 		error = 0;
+
+	if (error == 0) {
+		td->td_retval[0] = 0;
+		td->td_retval[1] = frame->tf_edx;
+	}
 		
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSCALL))
-		ktrsyscall(sa->code, sa->narg, sa->args);
-#endif
 	return (error);
 }
 
@@ -1046,87 +1032,23 @@ void
 syscall(struct trapframe *frame)
 {
 	struct thread *td;
-	struct proc *p;
 	struct syscall_args sa;
 	register_t orig_tf_eflags;
 	int error;
 	ksiginfo_t ksi;
 
-	PCPU_INC(cnt.v_syscall);
-	td = curthread;
-	p = td->td_proc;
-	td->td_syscalls++;
-
 #ifdef DIAGNOSTIC
 	if (ISPL(frame->tf_cs) != SEL_UPL) {
 		panic("syscall");
 		/* NOT REACHED */
 	}
 #endif
-
-	td->td_pticks = 0;
-	td->td_frame = frame;
-	if (td->td_ucred != p->p_ucred) 
-		cred_update_thread(td);
 	orig_tf_eflags = frame->tf_eflags;
-	if (p->p_flag & P_TRACED) {
-		PROC_LOCK(p);
-		td->td_dbgflags &= ~TDB_USERWR;
-		PROC_UNLOCK(p);
-	}
-	error = fetch_syscall_args(td, &sa);
-
-	CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_name, sa.code);
-
-	if (error == 0) {
-		td->td_retval[0] = 0;
-		td->td_retval[1] = frame->tf_edx;
-
-		STOPEVENT(p, S_SCE, sa.narg);
-		PTRACESTOP_SC(p, td, S_PT_SCE);
-		if (td->td_dbgflags & TDB_USERWR) {
-			/*
-			 * Reread syscall number and arguments if
-			 * debugger modified registers or memory.
-			 */
-			error = fetch_syscall_args(td, &sa);
-			if (error != 0)
-				goto retval;
-			td->td_retval[1] = frame->tf_edx;
-		}
-
-#ifdef KDTRACE_HOOKS
-		/*
-		 * If the systrace module has registered it's probe
-		 * callback and if there is a probe active for the
-		 * syscall 'entry', process the probe.
-		 */
-		if (systrace_probe_func != NULL && sa.callp->sy_entry != 0)
-			(*systrace_probe_func)(sa.callp->sy_entry, sa.code,
-			    sa.callp, sa.args);
-#endif
 
-		AUDIT_SYSCALL_ENTER(sa.code, td);
-		error = (*sa.callp->sy_call)(td, sa.args);
-		AUDIT_SYSCALL_EXIT(error, td);
+	td = curthread;
+	td->td_frame = frame;
 
-		/* Save the latest error return value. */
-		td->td_errno = error;
-
-#ifdef KDTRACE_HOOKS
-		/*
-		 * If the systrace module has registered it's probe
-		 * callback and if there is a probe active for the
-		 * syscall 'return', process the probe.
-		 */
-		if (systrace_probe_func != NULL && sa.callp->sy_return != 0)
-			(*systrace_probe_func)(sa.callp->sy_return, sa.code,
-			    sa.callp, sa.args);
-#endif
-	}
- retval:
-	cpu_set_syscall_retval(td, error);
+	error = syscallenter(td, &sa);
 
 	/*
 	 * Traced syscall.
@@ -1140,41 +1062,5 @@ syscall(struct trapframe *frame)
 		trapsignal(td, &ksi);
 	}
 
-	/*
-	 * Check for misbehavior.
-	 */
-	WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     syscallnames[sa.code] : "???");
-	KASSERT(td->td_critnest == 0,
-	    ("System call %s returning in a critical section",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     syscallnames[sa.code] : "???"));
-	KASSERT(td->td_locks == 0,
-	    ("System call %s returning with %d locks held",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     syscallnames[sa.code] : "???", td->td_locks));
-
-	/*
-	 * Handle reschedule and other end-of-syscall issues
-	 */
-	userret(td, frame);
-
-	CTR4(KTR_SYSC, "syscall exit thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_name, sa.code);
-
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSRET))
-		ktrsysret(sa.code, error, td->td_retval[0]);
-#endif
-
-	/*
-	 * This works because errno is findable through the
-	 * register set.  If we ever support an emulation where this
-	 * is not the case, this code will need to be revisited.
-	 */
-	STOPEVENT(p, S_SCX, sa.code);
-
-	PTRACESTOP_SC(p, td, S_PT_SCX);
+	syscallret(td, error, &sa);
 }
-

Modified: stable/8/sys/i386/ibcs2/ibcs2_sysvec.c
==============================================================================
--- stable/8/sys/i386/ibcs2/ibcs2_sysvec.c	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/i386/ibcs2/ibcs2_sysvec.c	Wed Nov  3 21:21:12 2010	(r214755)
@@ -86,7 +86,10 @@ struct sysentvec ibcs2_svr3_sysvec = {
 	.sv_setregs	= exec_setregs,
 	.sv_fixlimit	= NULL,
 	.sv_maxssiz	= NULL,
-	.sv_flags	= SV_ABI_UNDEF | SV_IA32 | SV_ILP32
+	.sv_flags	= SV_ABI_UNDEF | SV_IA32 | SV_ILP32,
+	.sv_set_syscall_retval = cpu_set_syscall_retval,
+	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
+	.sv_syscallnames = NULL,
 };
 
 static int

Modified: stable/8/sys/i386/include/proc.h
==============================================================================
--- stable/8/sys/i386/include/proc.h	Wed Nov  3 21:10:12 2010	(r214754)
+++ stable/8/sys/i386/include/proc.h	Wed Nov  3 21:21:12 2010	(r214755)
@@ -77,6 +77,14 @@ void	user_ldt_deref(struct proc_ldt *pld
 
 extern struct mtx dt_lock;
 
+struct syscall_args {
+	u_int code;
+	struct sysent *callp;
+	register_t args[8];
+	int narg;
+};
+#define	HAVE_SYSCALL_ARGS_DEF 1
+
 #endif	/* _KERNEL */
 
 #endif /* !_MACHINE_PROC_H_ */

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

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 21:24:21 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CEF47106566B;
	Wed,  3 Nov 2010 21:24:21 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BCF198FC15;
	Wed,  3 Nov 2010 21:24: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 oA3LOLUq033874;
	Wed, 3 Nov 2010 21:24:21 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3LOLJ7033869;
	Wed, 3 Nov 2010 21:24:21 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011032124.oA3LOLJ7033869@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 3 Nov 2010 21:24:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214756 - in stable/8/sys: kern sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 21:24:21 -0000

Author: kib
Date: Wed Nov  3 21:24:21 2010
New Revision: 214756
URL: http://svn.freebsd.org/changeset/base/214756

Log:
  MFC r209688:
  Extend ptrace(PT_LWPINFO) to report siginfo for the signal that caused
  debugee stop.

Modified:
  stable/8/sys/kern/kern_sig.c
  stable/8/sys/kern/sys_process.c
  stable/8/sys/sys/proc.h
  stable/8/sys/sys/ptrace.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/kern/kern_sig.c
==============================================================================
--- stable/8/sys/kern/kern_sig.c	Wed Nov  3 21:21:12 2010	(r214755)
+++ stable/8/sys/kern/kern_sig.c	Wed Nov  3 21:24:21 2010	(r214756)
@@ -2517,7 +2517,6 @@ issignal(struct thread *td, int stop_all
 	struct sigacts *ps;
 	struct sigqueue *queue;
 	sigset_t sigpending;
-	ksiginfo_t ksi;
 	int sig, prop, newsig;
 
 	p = td->td_proc;
@@ -2560,10 +2559,10 @@ issignal(struct thread *td, int stop_all
 			 * be thrown away.
 			 */
 			queue = &td->td_sigqueue;
-			ksi.ksi_signo = 0;
-			if (sigqueue_get(queue, sig, &ksi) == 0) {
+			td->td_dbgksi.ksi_signo = 0;
+			if (sigqueue_get(queue, sig, &td->td_dbgksi) == 0) {
 				queue = &p->p_sigqueue;
-				sigqueue_get(queue, sig, &ksi);
+				sigqueue_get(queue, sig, &td->td_dbgksi);
 			}
 
 			mtx_unlock(&ps->ps_mtx);
@@ -2590,13 +2589,13 @@ issignal(struct thread *td, int stop_all
 					continue;
 				signotify(td);
 			} else {
-				if (ksi.ksi_signo != 0) {
-					ksi.ksi_flags |= KSI_HEAD;
+				if (td->td_dbgksi.ksi_signo != 0) {
+					td->td_dbgksi.ksi_flags |= KSI_HEAD;
 					if (sigqueue_add(&td->td_sigqueue, sig,
-					    &ksi) != 0)
-						ksi.ksi_signo = 0;
+					    &td->td_dbgksi) != 0)
+						td->td_dbgksi.ksi_signo = 0;
 				}
-				if (ksi.ksi_signo == 0)
+				if (td->td_dbgksi.ksi_signo == 0)
 					sigqueue_add(&td->td_sigqueue, sig,
 					    NULL);
 			}

Modified: stable/8/sys/kern/sys_process.c
==============================================================================
--- stable/8/sys/kern/sys_process.c	Wed Nov  3 21:21:12 2010	(r214755)
+++ stable/8/sys/kern/sys_process.c	Wed Nov  3 21:24:21 2010	(r214756)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef COMPAT_FREEBSD32
 #include 
+#include 
 
 struct ptrace_io_desc32 {
 	int		piod_op;
@@ -84,6 +85,15 @@ struct ptrace_vm_entry32 {
 	uint32_t	pve_path;
 };
 
+struct ptrace_lwpinfo32 {
+	lwpid_t	pl_lwpid;	/* LWP described. */
+	int	pl_event;	/* Event that stopped the LWP. */
+	int	pl_flags;	/* LWP flags. */
+	sigset_t	pl_sigmask;	/* LWP signal mask */
+	sigset_t	pl_siglist;	/* LWP pending signal */
+	struct siginfo32 pl_siginfo;	/* siginfo for signal */
+};
+
 #endif
 
 /*
@@ -495,6 +505,19 @@ ptrace_vm_entry32(struct thread *td, str
 	pve32->pve_pathlen = pve.pve_pathlen;
 	return (error);
 }
+
+static void
+ptrace_lwpinfo_to32(const struct ptrace_lwpinfo *pl,
+    struct ptrace_lwpinfo32 *pl32)
+{
+
+	pl32->pl_lwpid = pl->pl_lwpid;
+	pl32->pl_event = pl->pl_event;
+	pl32->pl_flags = pl->pl_flags;
+	pl32->pl_sigmask = pl->pl_sigmask;
+	pl32->pl_siglist = pl->pl_siglist;
+	siginfo_to_siginfo32(&pl->pl_siginfo, &pl32->pl_siginfo);
+}
 #endif /* COMPAT_FREEBSD32 */
 
 /*
@@ -549,6 +572,7 @@ ptrace(struct thread *td, struct ptrace_
 		struct fpreg32 fpreg32;
 		struct reg32 reg32;
 		struct ptrace_io_desc32 piod32;
+		struct ptrace_lwpinfo32 pl32;
 		struct ptrace_vm_entry32 pve32;
 #endif
 	} r;
@@ -659,6 +683,8 @@ kern_ptrace(struct thread *td, int req, 
 #ifdef COMPAT_FREEBSD32
 	int wrap32 = 0, safe = 0;
 	struct ptrace_io_desc32 *piod32 = NULL;
+	struct ptrace_lwpinfo32 *pl32 = NULL;
+	struct ptrace_lwpinfo plr;
 #endif
 
 	curp = td->td_proc;
@@ -1100,15 +1126,44 @@ kern_ptrace(struct thread *td, int req, 
 		break;
 
 	case PT_LWPINFO:
-		if (data <= 0 || data > sizeof(*pl)) {
+		if (data <= 0 ||
+#ifdef COMPAT_FREEBSD32
+		    (!wrap32 && data > sizeof(*pl)) ||
+		    (wrap32 && data > sizeof(*pl32))) {
+#else
+		    data > sizeof(*pl)) {
+#endif
 			error = EINVAL;
 			break;
 		}
+#ifdef COMPAT_FREEBSD32
+		if (wrap32) {
+			pl = &plr;
+			pl32 = addr;
+		} else
+#endif
 		pl = addr;
 		pl->pl_lwpid = td2->td_tid;
-		if (td2->td_dbgflags & TDB_XSIG)
-			pl->pl_event = PL_EVENT_SIGNAL;
 		pl->pl_flags = 0;
+		if (td2->td_dbgflags & TDB_XSIG) {
+			pl->pl_event = PL_EVENT_SIGNAL;
+			if (td2->td_dbgksi.ksi_signo != 0 &&
+#ifdef COMPAT_FREEBSD32
+			    ((!wrap32 && data >= offsetof(struct ptrace_lwpinfo,
+			    pl_siginfo) + sizeof(pl->pl_siginfo)) ||
+			    (wrap32 && data >= offsetof(struct ptrace_lwpinfo32,
+			    pl_siginfo) + sizeof(struct siginfo32)))
+#else
+			    data >= offsetof(struct ptrace_lwpinfo, pl_siginfo)
+			    + sizeof(pl->pl_siginfo)
+#endif
+			){
+				pl->pl_flags |= PL_FLAG_SI;
+				pl->pl_siginfo = td2->td_dbgksi.ksi_info;
+			}
+		}
+		if ((pl->pl_flags & PL_FLAG_SI) == 0)
+			bzero(&pl->pl_siginfo, sizeof(pl->pl_siginfo));
 		if (td2->td_dbgflags & TDB_SCE)
 			pl->pl_flags |= PL_FLAG_SCE;
 		else if (td2->td_dbgflags & TDB_SCX)
@@ -1117,6 +1172,10 @@ kern_ptrace(struct thread *td, int req, 
 			pl->pl_flags |= PL_FLAG_EXEC;
 		pl->pl_sigmask = td2->td_sigmask;
 		pl->pl_siglist = td2->td_siglist;
+#ifdef COMPAT_FREEBSD32
+		if (wrap32)
+			ptrace_lwpinfo_to32(pl, pl32);
+#endif
 		break;
 
 	case PT_GETNUMLWPS:

Modified: stable/8/sys/sys/proc.h
==============================================================================
--- stable/8/sys/sys/proc.h	Wed Nov  3 21:21:12 2010	(r214755)
+++ stable/8/sys/sys/proc.h	Wed Nov  3 21:24:21 2010	(r214756)
@@ -257,6 +257,7 @@ struct thread {
 	char		td_name[MAXCOMLEN + 1];	/* (*) Thread name. */
 	struct file	*td_fpop;	/* (k) file referencing cdev under op */
 	int		td_dbgflags;	/* (c) Userland debugger flags */
+	struct ksiginfo td_dbgksi;	/* (c) ksi reflected to debugger. */
 	int		td_ng_outbound;	/* (k) Thread entered ng from above. */
 	struct osd	td_osd;		/* (k) Object specific data. */
 #define	td_endzero td_base_pri

Modified: stable/8/sys/sys/ptrace.h
==============================================================================
--- stable/8/sys/sys/ptrace.h	Wed Nov  3 21:21:12 2010	(r214755)
+++ stable/8/sys/sys/ptrace.h	Wed Nov  3 21:24:21 2010	(r214756)
@@ -33,7 +33,7 @@
 #ifndef	_SYS_PTRACE_H_
 #define	_SYS_PTRACE_H_
 
-#include 
+#include 
 #include 
 
 #define	PT_TRACE_ME	0	/* child declares it's being traced */
@@ -102,8 +102,10 @@ struct ptrace_lwpinfo {
 #define	PL_FLAG_SCE	0x04	/* syscall enter point */
 #define	PL_FLAG_SCX	0x08	/* syscall leave point */
 #define	PL_FLAG_EXEC	0x10	/* exec(2) succeeded */
+#define	PL_FLAG_SI	0x20	/* siginfo is valid */
 	sigset_t	pl_sigmask;	/* LWP signal mask */
 	sigset_t	pl_siglist;	/* LWP pending signal */
+	struct __siginfo pl_siginfo;	/* siginfo for signal */
 };
 
 /* Argument structure for PT_VM_ENTRY. */

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 21:31:04 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5F5ED106566B;
	Wed,  3 Nov 2010 21:31:04 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 444908FC16;
	Wed,  3 Nov 2010 21:31: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 oA3LV4EM034080;
	Wed, 3 Nov 2010 21:31:04 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3LV4Lb034078;
	Wed, 3 Nov 2010 21:31:04 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011032131.oA3LV4Lb034078@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 3 Nov 2010 21:31:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214757 - stable/8/lib/libc/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 21:31:04 -0000

Author: kib
Date: Wed Nov  3 21:31:03 2010
New Revision: 214757
URL: http://svn.freebsd.org/changeset/base/214757

Log:
  MFC r208513:
  Improve the documentation for PT_LWPINFO. Note that some features are
  not implemented on MIPS and ARM.

Modified:
  stable/8/lib/libc/sys/ptrace.2
Directory Properties:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/locale/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/sys/   (props changed)

Modified: stable/8/lib/libc/sys/ptrace.2
==============================================================================
--- stable/8/lib/libc/sys/ptrace.2	Wed Nov  3 21:24:21 2010	(r214756)
+++ stable/8/lib/libc/sys/ptrace.2	Wed Nov  3 21:31:03 2010	(r214757)
@@ -2,7 +2,7 @@
 .\"	$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
 .\"
 .\" This file is in the public domain.
-.Dd February 11, 2010
+.Dd May 24, 2010
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -289,8 +289,11 @@ argument specifies a pointer to a
 which is defined as follows:
 .Bd -literal
 struct ptrace_lwpinfo {
-	lwpid_t pl_lwpid;	/* LWP described. */
-	int	pl_event;	/* Event received. */
+	lwpid_t pl_lwpid;
+	int	pl_event;
+	int	pl_flags;
+	sigset_t pl_sigmask;
+	sigset_t pl_siglist;
 };
 .Ed
 .Pp
@@ -298,6 +301,51 @@ The
 .Fa data
 argument is to be set to the size of the structure known to the caller.
 This allows the structure to grow without affecting older programs.
+.Pp
+The fields in the
+.Vt "struct ptrace_lwpinfo"
+have the following meaning:
+.Bl -tag -width indent -compact
+.It pl_lwpid
+LWP id of the thread
+.It pl_event
+Event that caused the stop.
+Currently defined events are
+.Bl -tag -width indent -compact
+.It PL_EVENT_NONE
+No reason given
+.It PL_EVENT_SIGNAL
+Thread stopped due to the pending signal
+.El
+.It pl_flags
+Flags that specify additional details about observed stop.
+Currently defined flags are:
+.Bl -tag -width indent -compact
+.It PL_FLAG_SCE
+The thread stopped due to system call entry, right after the kernel is entered.
+The debugger may examine syscall arguments that are stored in memory and
+registers according to the ABI of the current process, and modify them,
+if needed.
+.It PL_FLAG_SCX
+The thread is stopped immediately before syscall is returning to the usermode.
+The debugger may examine system call return values in the ABI-defined registers
+and/or memory.
+.It PL_FLAG_EXEC
+When
+.Dv PL_FLAG_SCX
+is set, this flag may be additionally specified to inform that the
+program being executed by debuggee process has been changed by succesful
+execution of a system call from the
+.Fn execve 2
+family.
+.El
+.It pl_sigmask
+The current signal mask of the LWP
+.It pl_siglist
+The current pending set of signals for the LWP. Note that signals that
+are delivered to the process would not appear on an LWP siglist until
+the thread is selected for delivery.
+.El
 .It PT_GETNUMLWPS
 This request returns the number of kernel threads associated with the
 traced process.
@@ -501,3 +549,10 @@ The
 .Fn ptrace
 function appeared in
 .At v7 .
+.Sh BUGS
+The
+.Dv PL_FLAG_SCE ,
+.Dv PL_FLAG_SCX
+and
+.Dv PL_FLAG_EXEC
+are not implemented for MIPS and ARM architectures.

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 21:32:31 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9BA0E1065695;
	Wed,  3 Nov 2010 21:32:31 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8A8C38FC25;
	Wed,  3 Nov 2010 21:32: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 oA3LWVAL034153;
	Wed, 3 Nov 2010 21:32:31 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3LWVDq034151;
	Wed, 3 Nov 2010 21:32:31 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011032132.oA3LWVDq034151@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 3 Nov 2010 21:32:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214758 - stable/8/lib/libc/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 21:32:31 -0000

Author: kib
Date: Wed Nov  3 21:32:31 2010
New Revision: 214758
URL: http://svn.freebsd.org/changeset/base/214758

Log:
  MFC r209873:
  Document pl_siginfo and PT_FLAG_SI for PT_LWPINFO.

Modified:
  stable/8/lib/libc/sys/ptrace.2
Directory Properties:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/locale/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/sys/   (props changed)

Modified: stable/8/lib/libc/sys/ptrace.2
==============================================================================
--- stable/8/lib/libc/sys/ptrace.2	Wed Nov  3 21:31:03 2010	(r214757)
+++ stable/8/lib/libc/sys/ptrace.2	Wed Nov  3 21:32:31 2010	(r214758)
@@ -2,7 +2,7 @@
 .\"	$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
 .\"
 .\" This file is in the public domain.
-.Dd May 24, 2010
+.Dd July 10, 2010
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -294,6 +294,7 @@ struct ptrace_lwpinfo {
 	int	pl_flags;
 	sigset_t pl_sigmask;
 	sigset_t pl_siglist;
+	siginfo_t pl_siginfo;
 };
 .Ed
 .Pp
@@ -338,13 +339,28 @@ program being executed by debuggee proce
 execution of a system call from the
 .Fn execve 2
 family.
+.It PL_FLAG_SI
+Indicates that
+.Va pl_siginfo
+member of
+.Vt "struct ptrace_lwpinfo"
+contains valid information.
 .El
 .It pl_sigmask
 The current signal mask of the LWP
 .It pl_siglist
-The current pending set of signals for the LWP. Note that signals that
-are delivered to the process would not appear on an LWP siglist until
-the thread is selected for delivery.
+The current pending set of signals for the LWP.
+Note that signals that are delivered to the process would not appear
+on an LWP siglist until the thread is selected for delivery.
+.It pl_siginfo
+The siginfo that accompanies the signal pending.
+Only valid for
+.Dv PL_EVENT_SIGNAL
+kind of stop, when
+.Va pl_flags
+has
+.Dv PL_FLAG_SI
+set.
 .El
 .It PT_GETNUMLWPS
 This request returns the number of kernel threads associated with the

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 21:39:12 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 305F01065675;
	Wed,  3 Nov 2010 21:39:12 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1E60E8FC1B;
	Wed,  3 Nov 2010 21:39: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 oA3LdCcw034364;
	Wed, 3 Nov 2010 21:39:12 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3LdBSX034357;
	Wed, 3 Nov 2010 21:39:11 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011032139.oA3LdBSX034357@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 3 Nov 2010 21:39:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214759 - stable/8/lib/libthread_db
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 21:39:12 -0000

Author: kib
Date: Wed Nov  3 21:39:11 2010
New Revision: 214759
URL: http://svn.freebsd.org/changeset/base/214759

Log:
  MFC r209689:
  Extend the td_thrinfo_t to include siginfo for the signal that stopped
  the target.

Modified:
  stable/8/lib/libthread_db/Symbol.map
  stable/8/lib/libthread_db/libpthread_db.c
  stable/8/lib/libthread_db/libthr_db.c
  stable/8/lib/libthread_db/thread_db.c
  stable/8/lib/libthread_db/thread_db.h
  stable/8/lib/libthread_db/thread_db_int.h
Directory Properties:
  stable/8/lib/libthread_db/   (props changed)

Modified: stable/8/lib/libthread_db/Symbol.map
==============================================================================
--- stable/8/lib/libthread_db/Symbol.map	Wed Nov  3 21:32:31 2010	(r214758)
+++ stable/8/lib/libthread_db/Symbol.map	Wed Nov  3 21:39:11 2010	(r214759)
@@ -19,7 +19,6 @@ FBSD_1.0 {
 	td_thr_dbsuspend;
 	td_thr_event_enable;
 	td_thr_event_getmsg;
-	td_thr_get_info;
 	td_thr_getfpregs;
 	td_thr_getgregs;
 #if defined(i386)
@@ -33,3 +32,7 @@ FBSD_1.0 {
 	td_thr_tls_get_addr;
 	td_thr_validate;
 };
+
+FBSD_1.2 {
+	td_thr_get_info;
+};

Modified: stable/8/lib/libthread_db/libpthread_db.c
==============================================================================
--- stable/8/lib/libthread_db/libpthread_db.c	Wed Nov  3 21:32:31 2010	(r214758)
+++ stable/8/lib/libthread_db/libpthread_db.c	Wed Nov  3 21:39:11 2010	(r214759)
@@ -570,7 +570,7 @@ pt_thr_validate(const td_thrhandle_t *th
 }
 
 static td_err_e
-pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info)
+pt_thr_old_get_info(const td_thrhandle_t *th, td_old_thrinfo_t *info)
 {
 	const td_thragent_t *ta = th->th_ta;
 	struct ptrace_lwpinfo linfo;
@@ -659,6 +659,16 @@ pt_thr_get_info(const td_thrhandle_t *th
 	return (0);
 }
 
+static td_err_e
+pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info)
+{
+	td_err_e e;
+
+	e = pt_thr_old_get_info(th, (td_old_thrinfo_t *)info);
+	bzero(&info->ti_siginfo, sizeof(info->ti_siginfo));
+	return (e);
+}
+
 #ifdef __i386__
 static td_err_e
 pt_thr_getxmmregs(const td_thrhandle_t *th, char *fxsave)
@@ -1114,6 +1124,7 @@ struct ta_ops libpthread_db_ops = {
 	.to_thr_dbsuspend	= pt_thr_dbsuspend,
 	.to_thr_event_enable	= pt_thr_event_enable,
 	.to_thr_event_getmsg	= pt_thr_event_getmsg,
+	.to_thr_old_get_info	= pt_thr_old_get_info,
 	.to_thr_get_info	= pt_thr_get_info,
 	.to_thr_getfpregs	= pt_thr_getfpregs,
 	.to_thr_getgregs	= pt_thr_getgregs,

Modified: stable/8/lib/libthread_db/libthr_db.c
==============================================================================
--- stable/8/lib/libthread_db/libthr_db.c	Wed Nov  3 21:32:31 2010	(r214758)
+++ stable/8/lib/libthread_db/libthr_db.c	Wed Nov  3 21:39:11 2010	(r214759)
@@ -453,7 +453,7 @@ pt_thr_validate(const td_thrhandle_t *th
 }
 
 static td_err_e
-pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info)
+pt_thr_get_info_common(const td_thrhandle_t *th, td_thrinfo_t *info, int old)
 {
 	const td_thragent_t *ta = th->th_ta;
 	struct ptrace_lwpinfo linfo;
@@ -489,6 +489,13 @@ pt_thr_get_info(const td_thrhandle_t *th
 	if (ret == PS_OK) {
 		info->ti_sigmask = linfo.pl_sigmask;
 		info->ti_pending = linfo.pl_siglist;
+		if (!old) {
+			if ((linfo.pl_flags & PL_FLAG_SI) != 0)
+				info->ti_siginfo = linfo.pl_siginfo;
+			else
+				bzero(&info->ti_siginfo,
+				    sizeof(info->ti_siginfo));
+		}
 	} else
 		return (ret);
 	if (state == ta->thread_state_running)
@@ -501,6 +508,20 @@ pt_thr_get_info(const td_thrhandle_t *th
 	return (0);
 }
 
+static td_err_e
+pt_thr_old_get_info(const td_thrhandle_t *th, td_old_thrinfo_t *info)
+{
+
+	return (pt_thr_get_info_common(th, (td_thrinfo_t *)info, 1));
+}
+
+static td_err_e
+pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info)
+{
+
+	return (pt_thr_get_info_common(th, info, 0));
+}
+
 #ifdef __i386__
 static td_err_e
 pt_thr_getxmmregs(const td_thrhandle_t *th, char *fxsave)
@@ -761,6 +782,7 @@ struct ta_ops libthr_db_ops = {
 	.to_thr_dbsuspend	= pt_thr_dbsuspend,
 	.to_thr_event_enable	= pt_thr_event_enable,
 	.to_thr_event_getmsg	= pt_thr_event_getmsg,
+	.to_thr_old_get_info	= pt_thr_old_get_info,
 	.to_thr_get_info	= pt_thr_get_info,
 	.to_thr_getfpregs	= pt_thr_getfpregs,
 	.to_thr_getgregs	= pt_thr_getgregs,

Modified: stable/8/lib/libthread_db/thread_db.c
==============================================================================
--- stable/8/lib/libthread_db/thread_db.c	Wed Nov  3 21:32:31 2010	(r214758)
+++ stable/8/lib/libthread_db/thread_db.c	Wed Nov  3 21:39:11 2010	(r214759)
@@ -176,6 +176,14 @@ td_thr_event_getmsg(const td_thrhandle_t
 }
 
 td_err_e
+td_thr_old_get_info(const td_thrhandle_t *th, td_old_thrinfo_t *info)
+{
+	const td_thragent_t *ta = th->th_ta;
+	return (ta->ta_ops->to_thr_old_get_info(th, info));
+}
+__sym_compat(td_thr_get_info, td_thr_old_get_info, FBSD_1.0);
+
+td_err_e
 td_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info)
 {
 	const td_thragent_t *ta = th->th_ta;

Modified: stable/8/lib/libthread_db/thread_db.h
==============================================================================
--- stable/8/lib/libthread_db/thread_db.h	Wed Nov  3 21:32:31 2010	(r214758)
+++ stable/8/lib/libthread_db/thread_db.h	Wed Nov  3 21:39:11 2010	(r214759)
@@ -191,6 +191,7 @@ typedef struct {
 	psaddr_t	ti_startfunc;
 	psaddr_t	ti_stkbase;
 	size_t		ti_stksize;
+	siginfo_t	ti_siginfo;
 } td_thrinfo_t;
 
 /*

Modified: stable/8/lib/libthread_db/thread_db_int.h
==============================================================================
--- stable/8/lib/libthread_db/thread_db_int.h	Wed Nov  3 21:32:31 2010	(r214758)
+++ stable/8/lib/libthread_db/thread_db_int.h	Wed Nov  3 21:39:11 2010	(r214759)
@@ -32,6 +32,25 @@
 #include 
 #include 
 
+typedef struct {
+	const td_thragent_t *ti_ta_p;
+	thread_t	ti_tid;
+	psaddr_t	ti_thread;
+	td_thr_state_e	ti_state;
+	td_thr_type_e	ti_type;
+	td_thr_events_t	ti_events;
+	int		ti_pri;
+	lwpid_t		ti_lid;
+	char		ti_db_suspended;
+	char		ti_traceme;
+	sigset_t	ti_sigmask;
+	sigset_t	ti_pending;
+	psaddr_t	ti_tls;
+	psaddr_t	ti_startfunc;
+	psaddr_t	ti_stkbase;
+	size_t		ti_stksize;
+} td_old_thrinfo_t;
+
 #define	TD_THRAGENT_FIELDS			\
 	struct ta_ops		*ta_ops;	\
 	TAILQ_ENTRY(td_thragent) ta_next;	\
@@ -65,6 +84,8 @@ struct ta_ops {
 	td_err_e (*to_thr_event_enable)(const td_thrhandle_t *, int);
 	td_err_e (*to_thr_event_getmsg)(const td_thrhandle_t *,
 	    td_event_msg_t *);
+	td_err_e (*to_thr_old_get_info)(const td_thrhandle_t *,
+	    td_old_thrinfo_t *);
 	td_err_e (*to_thr_get_info)(const td_thrhandle_t *, td_thrinfo_t *);
 	td_err_e (*to_thr_getfpregs)(const td_thrhandle_t *, prfpregset_t *);
 	td_err_e (*to_thr_getgregs)(const td_thrhandle_t *, prgregset_t);
@@ -103,4 +124,6 @@ int thr_pwrite_int(const struct td_thrag
 int thr_pwrite_long(const struct td_thragent *, psaddr_t, uint64_t);
 int thr_pwrite_ptr(const struct td_thragent *, psaddr_t, psaddr_t);
 
+td_err_e td_thr_old_get_info(const td_thrhandle_t *th, td_old_thrinfo_t *info);
+
 #endif /* _THREAD_DB_INT_H_ */

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 21:40:58 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 101A81065672;
	Wed,  3 Nov 2010 21:40:58 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D88578FC13;
	Wed,  3 Nov 2010 21:40: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 oA3LevZL034461;
	Wed, 3 Nov 2010 21:40:57 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3Levi9034459;
	Wed, 3 Nov 2010 21:40:57 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011032140.oA3Levi9034459@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 3 Nov 2010 21:40:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214760 - stable/8/gnu/usr.bin/gdb/libgdb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 21:40:58 -0000

Author: kib
Date: Wed Nov  3 21:40:57 2010
New Revision: 214760
URL: http://svn.freebsd.org/changeset/base/214760

Log:
  MFC r209690:
  For "thread signal" command, print some information from siginfo when
  available.

Modified:
  stable/8/gnu/usr.bin/gdb/libgdb/fbsd-threads.c
Directory Properties:
  stable/8/gnu/usr.bin/gdb/   (props changed)
  stable/8/gnu/usr.bin/gdb/kgdb/   (props changed)

Modified: stable/8/gnu/usr.bin/gdb/libgdb/fbsd-threads.c
==============================================================================
--- stable/8/gnu/usr.bin/gdb/libgdb/fbsd-threads.c	Wed Nov  3 21:39:11 2010	(r214759)
+++ stable/8/gnu/usr.bin/gdb/libgdb/fbsd-threads.c	Wed Nov  3 21:40:57 2010	(r214760)
@@ -1299,6 +1299,7 @@ fbsd_thread_signal_cmd (char *exp, int f
   td_thrhandle_t th;
   td_thrinfo_t ti;
   td_err_e err;
+  const char *code;
 
   if (!fbsd_thread_active || !IS_THREAD(inferior_ptid))
     return;
@@ -1315,6 +1316,42 @@ fbsd_thread_signal_cmd (char *exp, int f
   fbsd_print_sigset(&ti.ti_sigmask);
   printf_filtered("signal pending:\n");
   fbsd_print_sigset(&ti.ti_pending);
+  if (ti.ti_siginfo.si_signo != 0) {
+   printf_filtered("si_signo %d si_errno %d", ti.ti_siginfo.si_signo,
+     ti.ti_siginfo.si_errno);
+   if (ti.ti_siginfo.si_errno != 0)
+    printf_filtered(" (%s)", strerror(ti.ti_siginfo.si_errno));
+   printf_filtered("\n");
+   switch (ti.ti_siginfo.si_code) {
+   case SI_NOINFO:
+	code = "NOINFO";
+	break;
+    case SI_USER:
+	code = "USER";
+	break;
+    case SI_QUEUE:
+	code = "QUEUE";
+	break;
+    case SI_TIMER:
+	code = "TIMER";
+	break;
+    case SI_ASYNCIO:
+	code = "ASYNCIO";
+	break;
+    case SI_MESGQ:
+	code = "MESGQ";
+	break;
+    case SI_KERNEL:
+	code = "KERNEL";
+	break;
+    default:
+	code = "UNKNOWN";
+	break;
+    }
+    printf_filtered("si_code %s si_pid %d si_uid %d si_status %x si_addr %p\n",
+      code, ti.ti_siginfo.si_pid, ti.ti_siginfo.si_uid, ti.ti_siginfo.si_status,
+      ti.ti_siginfo.si_addr);
+  }
 }
 
 static int

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 21:50:50 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 08E1F1065670;
	Wed,  3 Nov 2010 21:50:50 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EAB8B8FC0A;
	Wed,  3 Nov 2010 21:50:49 +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 oA3Longg034778;
	Wed, 3 Nov 2010 21:50:49 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3LonRB034757;
	Wed, 3 Nov 2010 21:50:49 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <201011032150.oA3LonRB034757@svn.freebsd.org>
From: Nick Hibma 
Date: Wed, 3 Nov 2010 21:50: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: r214761 - in head/sys/dev/usb: net serial
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 21:50:50 -0000

Author: n_hibma
Date: Wed Nov  3 21:50:49 2010
New Revision: 214761
URL: http://svn.freebsd.org/changeset/base/214761

Log:
  - Simplify the way unit/subunit allocation is done in ucom.
  - hw.usb.ucom.cons_unit is now split into
    hw.usb.ucom.cons_unit/...cons_subunit.
  
  Note: The tunable/sysctl hw.usb.ucom.cons_unit needs to be reviewed if
  
  a) a console was defined a USB serial devices, and a USB device with
  more than 1 subunit is present, and this device is attached before the
  device functioning as a console
  
  or
  
  b) a console was defined on a USB device with more than 1 subunit
  
  Reviewed by:	hps
  MFC after:	2 weeks

Modified:
  head/sys/dev/usb/net/uhso.c
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/serial/uark.c
  head/sys/dev/usb/serial/ubsa.c
  head/sys/dev/usb/serial/ubser.c
  head/sys/dev/usb/serial/uchcom.c
  head/sys/dev/usb/serial/ucycom.c
  head/sys/dev/usb/serial/ufoma.c
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/serial/ugensa.c
  head/sys/dev/usb/serial/uipaq.c
  head/sys/dev/usb/serial/umct.c
  head/sys/dev/usb/serial/umodem.c
  head/sys/dev/usb/serial/umoscom.c
  head/sys/dev/usb/serial/uplcom.c
  head/sys/dev/usb/serial/usb_serial.c
  head/sys/dev/usb/serial/usb_serial.h
  head/sys/dev/usb/serial/uslcom.c
  head/sys/dev/usb/serial/uvisor.c
  head/sys/dev/usb/serial/uvscom.c

Modified: head/sys/dev/usb/net/uhso.c
==============================================================================
--- head/sys/dev/usb/net/uhso.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/net/uhso.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -633,11 +633,10 @@ uhso_attach(device_t self)
 
 		ht->ht_name[0] = 0;
 		if (sc->sc_ttys == 1)
-			snprintf(ht->ht_name, 32, "cuaU%d", ucom->sc_unit);
+			snprintf(ht->ht_name, 32, "cuaU%d", ucom->sc_super->sc_unit);
 		else {
 			snprintf(ht->ht_name, 32, "cuaU%d.%d",
-			    ucom->sc_unit - ucom->sc_local_unit,
-			    ucom->sc_local_unit);
+			    ucom->sc_super->sc_unit, ucom->sc_subunit);
 		}
 
 		desc = uhso_port_type[port];
@@ -666,7 +665,7 @@ uhso_detach(device_t self)
 	usbd_transfer_unsetup(sc->sc_xfer, 3);
 	usbd_transfer_unsetup(sc->sc_ctrl_xfer, UHSO_CTRL_MAX);
 	if (sc->sc_ttys > 0) {
-		ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_ttys);
+		ucom_detach(&sc->sc_super_ucom, sc->sc_ucom);
 
 		for (i = 0; i < sc->sc_ttys; i++) {
 			if (sc->sc_tty[i].ht_muxport != -1) {
@@ -1448,11 +1447,11 @@ uhso_ucom_start_read(struct ucom_softc *
 {
 	struct uhso_softc *sc = ucom->sc_parent;
 
-	UHSO_DPRINTF(3, "unit=%d, local_unit=%d\n",
-	    ucom->sc_unit, ucom->sc_local_unit);
+	UHSO_DPRINTF(3, "unit=%d, subunit=%d\n",
+	    ucom->sc_super->sc_unit, ucom->sc_subunit);
 
 	if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_MUX) {
-		sc->sc_tty[ucom->sc_local_unit].ht_open = 1;
+		sc->sc_tty[ucom->sc_subunit].ht_open = 1;
 		usbd_transfer_start(sc->sc_xfer[UHSO_MUX_ENDPT_INTR]);
 	}
 	else if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_BULK) {
@@ -1470,9 +1469,9 @@ uhso_ucom_stop_read(struct ucom_softc *u
 	struct uhso_softc *sc = ucom->sc_parent;
 
 	if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_MUX) {
-		sc->sc_tty[ucom->sc_local_unit].ht_open = 0;
+		sc->sc_tty[ucom->sc_subunit].ht_open = 0;
 		usbd_transfer_stop(
-		    sc->sc_tty[ucom->sc_local_unit].ht_xfer[UHSO_CTRL_READ]);
+		    sc->sc_tty[ucom->sc_subunit].ht_xfer[UHSO_CTRL_READ]);
 	}
 	else if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_BULK) {
 		sc->sc_tty[0].ht_open = 0;
@@ -1488,15 +1487,15 @@ uhso_ucom_start_write(struct ucom_softc 
 	struct uhso_softc *sc = ucom->sc_parent;
 
 	if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_MUX) {
-		UHSO_DPRINTF(3, "local unit %d\n", ucom->sc_local_unit);
+		UHSO_DPRINTF(3, "local unit %d\n", ucom->sc_subunit);
 
 		usbd_transfer_start(sc->sc_xfer[UHSO_MUX_ENDPT_INTR]);
 
 		usbd_xfer_set_priv(
-		    sc->sc_tty[ucom->sc_local_unit].ht_xfer[UHSO_CTRL_WRITE],
-		    &sc->sc_tty[ucom->sc_local_unit]);
+		    sc->sc_tty[ucom->sc_subunit].ht_xfer[UHSO_CTRL_WRITE],
+		    &sc->sc_tty[ucom->sc_subunit]);
 		usbd_transfer_start(
-		    sc->sc_tty[ucom->sc_local_unit].ht_xfer[UHSO_CTRL_WRITE]);
+		    sc->sc_tty[ucom->sc_subunit].ht_xfer[UHSO_CTRL_WRITE]);
 
 	}
 	else if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_BULK) {
@@ -1511,7 +1510,7 @@ uhso_ucom_stop_write(struct ucom_softc *
 
 	if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_MUX) {
 		usbd_transfer_stop(
-		    sc->sc_tty[ucom->sc_local_unit].ht_xfer[UHSO_CTRL_WRITE]);
+		    sc->sc_tty[ucom->sc_subunit].ht_xfer[UHSO_CTRL_WRITE]);
 	}
 	else if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_BULK) {
 		usbd_transfer_stop(sc->sc_xfer[UHSO_BULK_ENDPT_WRITE]);

Modified: head/sys/dev/usb/serial/u3g.c
==============================================================================
--- head/sys/dev/usb/serial/u3g.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/u3g.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -831,15 +831,15 @@ static int
 u3g_detach(device_t dev)
 {
 	struct u3g_softc *sc = device_get_softc(dev);
-	uint8_t m;
+	uint8_t subunit;
 
 	DPRINTF("sc=%p\n", sc);
 
 	/* NOTE: It is not dangerous to detach more ports than attached! */
-	ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, U3G_MAXPORTS);
+	ucom_detach(&sc->sc_super_ucom, sc->sc_ucom);
 
-	for (m = 0; m != U3G_MAXPORTS; m++)
-		usbd_transfer_unsetup(sc->sc_xfer[m], U3G_N_TRANSFER);
+	for (subunit = 0; subunit != U3G_MAXPORTS; subunit++)
+		usbd_transfer_unsetup(sc->sc_xfer[subunit], U3G_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 
 	return (0);
@@ -851,7 +851,7 @@ u3g_start_read(struct ucom_softc *ucom)
 	struct u3g_softc *sc = ucom->sc_parent;
 
 	/* start read endpoint */
-	usbd_transfer_start(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_RD]);
+	usbd_transfer_start(sc->sc_xfer[ucom->sc_subunit][U3G_BULK_RD]);
 	return;
 }
 
@@ -861,7 +861,7 @@ u3g_stop_read(struct ucom_softc *ucom)
 	struct u3g_softc *sc = ucom->sc_parent;
 
 	/* stop read endpoint */
-	usbd_transfer_stop(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_RD]);
+	usbd_transfer_stop(sc->sc_xfer[ucom->sc_subunit][U3G_BULK_RD]);
 	return;
 }
 
@@ -870,7 +870,7 @@ u3g_start_write(struct ucom_softc *ucom)
 {
 	struct u3g_softc *sc = ucom->sc_parent;
 
-	usbd_transfer_start(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_WR]);
+	usbd_transfer_start(sc->sc_xfer[ucom->sc_subunit][U3G_BULK_WR]);
 	return;
 }
 
@@ -879,7 +879,7 @@ u3g_stop_write(struct ucom_softc *ucom)
 {
 	struct u3g_softc *sc = ucom->sc_parent;
 
-	usbd_transfer_stop(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_WR]);
+	usbd_transfer_stop(sc->sc_xfer[ucom->sc_subunit][U3G_BULK_WR]);
 	return;
 }
 

Modified: head/sys/dev/usb/serial/uark.c
==============================================================================
--- head/sys/dev/usb/serial/uark.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/uark.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -239,7 +239,7 @@ uark_detach(device_t dev)
 {
 	struct uark_softc *sc = device_get_softc(dev);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UARK_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/ubsa.c
==============================================================================
--- head/sys/dev/usb/serial/ubsa.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/ubsa.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -345,7 +345,7 @@ ubsa_detach(device_t dev)
 
 	DPRINTF("sc=%p\n", sc);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UBSA_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/ubser.c
==============================================================================
--- head/sys/dev/usb/serial/ubser.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/ubser.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -317,7 +317,7 @@ ubser_detach(device_t dev)
 
 	DPRINTF("\n");
 
-	ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_numser);
+	ucom_detach(&sc->sc_super_ucom, sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UBSER_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/uchcom.c
==============================================================================
--- head/sys/dev/usb/serial/uchcom.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/uchcom.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -368,7 +368,7 @@ uchcom_detach(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UCHCOM_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/ucycom.c
==============================================================================
--- head/sys/dev/usb/serial/ucycom.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/ucycom.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -294,7 +294,7 @@ ucycom_detach(device_t dev)
 {
 	struct ucycom_softc *sc = device_get_softc(dev);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UCYCOM_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/ufoma.c
==============================================================================
--- head/sys/dev/usb/serial/ufoma.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/ufoma.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -466,7 +466,7 @@ ufoma_attach(device_t dev)
 			CTLFLAG_RW|CTLTYPE_STRING, sc, 0, ufoma_sysctl_open,
 			"A", "Mode to transit when port is opened");
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "comunit",
-			CTLFLAG_RD, &(sc->sc_ucom.sc_unit), 0, 
+			CTLFLAG_RD, &(sc->sc_super_ucom.sc_unit), 0, 
 			"Unit number as USB serial");
 
 	return (0);			/* success */
@@ -481,7 +481,7 @@ ufoma_detach(device_t dev)
 {
 	struct ufoma_softc *sc = device_get_softc(dev);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_ctrl_xfer, UFOMA_CTRL_ENDPT_MAX);
 	usbd_transfer_unsetup(sc->sc_bulk_xfer, UFOMA_BULK_ENDPT_MAX);
 

Modified: head/sys/dev/usb/serial/uftdi.c
==============================================================================
--- head/sys/dev/usb/serial/uftdi.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/uftdi.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -344,7 +344,7 @@ uftdi_detach(device_t dev)
 {
 	struct uftdi_softc *sc = device_get_softc(dev);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UFTDI_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/ugensa.c
==============================================================================
--- head/sys/dev/usb/serial/ugensa.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/ugensa.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -260,7 +260,7 @@ ugensa_detach(device_t dev)
 	struct ugensa_softc *sc = device_get_softc(dev);
 	uint8_t x;
 
-	ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface);
+	ucom_detach(&sc->sc_super_ucom, sc->sc_ucom);
 
 	for (x = 0; x < sc->sc_niface; x++) {
 		usbd_transfer_unsetup(sc->sc_sub[x].sc_xfer, UGENSA_N_TRANSFER);

Modified: head/sys/dev/usb/serial/uipaq.c
==============================================================================
--- head/sys/dev/usb/serial/uipaq.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/uipaq.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -1173,7 +1173,7 @@ uipaq_detach(device_t dev)
 {
 	struct uipaq_softc *sc = device_get_softc(dev);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/umct.c
==============================================================================
--- head/sys/dev/usb/serial/umct.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/umct.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -309,7 +309,7 @@ umct_detach(device_t dev)
 {
 	struct umct_softc *sc = device_get_softc(dev);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UMCT_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/umodem.c
==============================================================================
--- head/sys/dev/usb/serial/umodem.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/umodem.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -816,7 +816,7 @@ umodem_detach(device_t dev)
 
 	DPRINTF("sc=%p\n", sc);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UMODEM_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/umoscom.c
==============================================================================
--- head/sys/dev/usb/serial/umoscom.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/umoscom.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -351,7 +351,7 @@ umoscom_detach(device_t dev)
 {
 	struct umoscom_softc *sc = device_get_softc(dev);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UMOSCOM_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/uplcom.c
==============================================================================
--- head/sys/dev/usb/serial/uplcom.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/uplcom.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -459,7 +459,7 @@ uplcom_detach(device_t dev)
 
 	DPRINTF("sc=%p\n", sc);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UPLCOM_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/usb_serial.c
==============================================================================
--- head/sys/dev/usb/serial/usb_serial.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/usb_serial.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -123,13 +123,16 @@ static unsigned int ucom_cons_tx_low = 0
 static unsigned int ucom_cons_tx_high = 0;
 
 static int ucom_cons_unit = -1;
+static int ucom_cons_subunit = 0;
 static int ucom_cons_baud = 9600;
 static struct ucom_softc *ucom_cons_softc = NULL;
 
 TUNABLE_INT("hw.usb.ucom.cons_unit", &ucom_cons_unit);
 SYSCTL_INT(_hw_usb_ucom, OID_AUTO, cons_unit, CTLFLAG_RW,
     &ucom_cons_unit, 0, "console unit number");
-
+TUNABLE_INT("hw.usb.ucom.cons_subunit", &ucom_cons_subunit);
+SYSCTL_INT(_hw_usb_ucom, OID_AUTO, cons_subunit, CTLFLAG_RW,
+    &ucom_cons_subunit, 0, "console subunit number");
 TUNABLE_INT("hw.usb.ucom.cons_baud", &ucom_cons_baud);
 SYSCTL_INT(_hw_usb_ucom, OID_AUTO, cons_baud, CTLFLAG_RW,
     &ucom_cons_baud, 0, "console baud rate");
@@ -141,9 +144,9 @@ static usb_proc_callback_t ucom_cfg_line
 static usb_proc_callback_t ucom_cfg_status_change;
 static usb_proc_callback_t ucom_cfg_param;
 
-static uint8_t	ucom_units_alloc(uint32_t, uint32_t *);
-static void	ucom_units_free(uint32_t, uint32_t);
-static int	ucom_attach_tty(struct ucom_softc *, uint32_t);
+static int	ucom_unit_alloc(void);
+static void	ucom_unit_free(int);
+static int	ucom_attach_tty(struct ucom_super_softc *, struct ucom_softc *);
 static void	ucom_detach_tty(struct ucom_softc *);
 static void	ucom_queue_command(struct ucom_softc *,
 		    usb_proc_callback_t *, struct termios *pt,
@@ -176,84 +179,52 @@ static struct ttydevsw ucom_class = {
 MODULE_DEPEND(ucom, usb, 1, 1, 1);
 MODULE_VERSION(ucom, 1);
 
-#define	UCOM_UNIT_MAX 0x200		/* exclusive */
-#define	UCOM_SUB_UNIT_MAX 0x100		/* exclusive */
+#define	UCOM_UNIT_MAX 		128	/* limits size of ucom_bitmap */
 
 static uint8_t ucom_bitmap[(UCOM_UNIT_MAX + 7) / 8];
 static struct mtx ucom_bitmap_mtx;
 MTX_SYSINIT(ucom_bitmap_mtx, &ucom_bitmap_mtx, "ucom bitmap", MTX_DEF);
 
-static uint8_t
-ucom_units_alloc(uint32_t sub_units, uint32_t *p_root_unit)
+/*
+ * Mark a unit number (the X in cuaUX) as in use.
+ *
+ * Note that devices using a different naming scheme (see ucom_tty_name()
+ * callback) still use this unit allocation.
+ */
+static int
+ucom_unit_alloc(void)
 {
-	uint32_t n;
-	uint32_t o;
-	uint32_t x;
-	uint32_t max = UCOM_UNIT_MAX - (UCOM_UNIT_MAX % sub_units);
-	uint8_t error = 1;
+	int unit;
 
 	mtx_lock(&ucom_bitmap_mtx);
 
-	for (n = 0; n < max; n += sub_units) {
-
-		/* check for free consecutive bits */
-
-		for (o = 0; o < sub_units; o++) {
-
-			x = n + o;
-
-			if (ucom_bitmap[x / 8] & (1 << (x % 8))) {
-				goto skip;
-			}
-		}
-
-		/* allocate */
-
-		for (o = 0; o < sub_units; o++) {
-
-			x = n + o;
-
-			ucom_bitmap[x / 8] |= (1 << (x % 8));
-		}
-
-		error = 0;
-
-		break;
-
-skip:		;
-	}
+	for (unit = 0; unit < UCOM_UNIT_MAX; unit++)
+		if ((ucom_bitmap[unit / 8] & (1 << (unit % 8))) == 0)
+			break;
 
 	mtx_unlock(&ucom_bitmap_mtx);
 
-	/*
-	 * Always set the variable pointed to by "p_root_unit" so that
-	 * the compiler does not think that it is used uninitialised:
-	 */
-	*p_root_unit = n;
-
-	return (error);
+	if (unit == UCOM_UNIT_MAX)
+		return -1;
+	else
+		return unit;
 }
 
+/*
+ * Mark the unit number as not in use.
+ */
 static void
-ucom_units_free(uint32_t root_unit, uint32_t sub_units)
+ucom_unit_free(int unit)
 {
-	uint32_t x;
-
 	mtx_lock(&ucom_bitmap_mtx);
 
-	while (sub_units--) {
-		x = root_unit + sub_units;
-		ucom_bitmap[x / 8] &= ~(1 << (x % 8));
-	}
+	ucom_bitmap[unit / 8] &= ~(1 << (unit % 8));
 
 	mtx_unlock(&ucom_bitmap_mtx);
 }
 
 /*
- * "N" sub_units are setup at a time. All sub-units will
- * be given sequential unit numbers. The number of
- * sub-units can be used to differentiate among
- * different types of devices.
+ * Setup a group of one or more serial ports.
  *
  * The mutex pointed to by "mtx" is applied before all
  * callbacks are called back. Also "mtx" must be applied
@@ -261,47 +232,47 @@ ucom_units_free(uint32_t root_unit, uint
  */
 int
 ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc,
-    uint32_t sub_units, void *parent,
+    uint32_t subunits, void *parent,
     const struct ucom_callback *callback, struct mtx *mtx)
 {
-	uint32_t n;
-	uint32_t root_unit;
+	uint32_t subunit;
 	int error = 0;
 
 	if ((sc == NULL) ||
-	    (sub_units == 0) ||
-	    (sub_units > UCOM_SUB_UNIT_MAX) ||
+	    (subunits == 0) ||
 	    (callback == NULL)) {
 		return (EINVAL);
 	}
 
-	/* XXX unit management does not really belong here */
-	if (ucom_units_alloc(sub_units, &root_unit)) {
+	ssc->sc_unit = ucom_unit_alloc();
+	if (ssc->sc_unit == -1)
 		return (ENOMEM);
-	}
 
 	error = usb_proc_create(&ssc->sc_tq, mtx, "ucom", USB_PRI_MED);
 	if (error) {
-		ucom_units_free(root_unit, sub_units);
+		ucom_unit_free(ssc->sc_unit);
 		return (error);
 	}
+	ssc->sc_subunits = subunits;
 
-	for (n = 0; n != sub_units; n++, sc++) {
-		sc->sc_unit = root_unit + n;
-		sc->sc_local_unit = n;
-		sc->sc_super = ssc;
-		sc->sc_mtx = mtx;
-		sc->sc_parent = parent;
-		sc->sc_callback = callback;
+	for (subunit = 0; subunit != ssc->sc_subunits; subunit++) {
+		sc[subunit].sc_subunit = subunit;
+		sc[subunit].sc_super = ssc;
+		sc[subunit].sc_mtx = mtx;
+		sc[subunit].sc_parent = parent;
+		sc[subunit].sc_callback = callback;
 
-		error = ucom_attach_tty(sc, sub_units);
+		error = ucom_attach_tty(ssc, &sc[subunit]);
 		if (error) {
-			ucom_detach(ssc, sc - n, n);
-			ucom_units_free(root_unit + n, sub_units - n);
+			ucom_detach(ssc, &sc[0]);
 			return (error);
 		}
-		sc->sc_flag |= UCOM_FLAG_ATTACHED;
+		sc[subunit].sc_flag |= UCOM_FLAG_ATTACHED;
 	}
+
+	DPRINTF("tp = %p, unit = %d, subunits = %d, device name subunit 0 = %s\n",
+		sc->sc_tty, ssc->sc_unit, ssc->sc_subunits, sc[0].sc_devname);
+
 	return (0);
 }
 
@@ -310,62 +281,50 @@ ucom_attach(struct ucom_super_softc *ssc
  * the structure pointed to by "ssc" and "sc" is zero.
  */
 void
-ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc,
-    uint32_t sub_units)
+ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc)
 {
-	uint32_t n;
+	uint32_t subunit;
 
 	usb_proc_drain(&ssc->sc_tq);
 
-	for (n = 0; n != sub_units; n++, sc++) {
-		if (sc->sc_flag & UCOM_FLAG_ATTACHED) {
-
-			ucom_detach_tty(sc);
+	for (subunit = 0; subunit <= ssc->sc_subunits; subunit++) {
+		if (sc[subunit].sc_flag & UCOM_FLAG_ATTACHED) {
 
-			ucom_units_free(sc->sc_unit, 1);
+			ucom_detach_tty(&sc[subunit]);
 
-			/* avoid duplicate detach: */
-			sc->sc_flag &= ~UCOM_FLAG_ATTACHED;
+			/* avoid duplicate detach */
+			sc[subunit].sc_flag &= ~UCOM_FLAG_ATTACHED;
 		}
 	}
+	ucom_unit_free(ssc->sc_unit);
 	usb_proc_free(&ssc->sc_tq);
 }
 
 static int
-ucom_attach_tty(struct ucom_softc *sc, uint32_t sub_units)
+ucom_attach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc)
 {
 	struct tty *tp;
-	int error = 0;
-	char buf[32];			/* temporary TTY device name buffer */
+	char buf[10];			/* temporary TTY device name buffer */
 
 	tp = tty_alloc_mutex(&ucom_class, sc, sc->sc_mtx);
-	if (tp == NULL) {
-		error = ENOMEM;
-		goto done;
-	}
-	DPRINTF("tp = %p, unit = %d\n", tp, sc->sc_unit);
-
-	buf[0] = 0;			/* set some default value */
+	if (tp == NULL)
+		return (ENOMEM);
 
 	/* Check if the client has a custom TTY name */
+	buf[0] = '\0';
 	if (sc->sc_callback->ucom_tty_name) {
 		sc->sc_callback->ucom_tty_name(sc, buf,
-		    sizeof(buf), sc->sc_local_unit);
+		    sizeof(buf), ssc->sc_unit, sc->sc_subunit);
 	}
 	if (buf[0] == 0) {
 		/* Use default TTY name */
-		if (sub_units > 1) {
+		if (ssc->sc_subunits > 1) {
 			/* multiple modems in one */
-			if (snprintf(buf, sizeof(buf), "U%u.%u",
-			    sc->sc_unit - sc->sc_local_unit,
-			    sc->sc_local_unit)) {
-				/* ignore */
-			}
+			snprintf(buf, sizeof(buf), "U%u.%u",
+			    ssc->sc_unit, sc->sc_subunit);
 		} else {
 			/* single modem */
-			if (snprintf(buf, sizeof(buf), "U%u", sc->sc_unit)) {
-				/* ignore */
-			}
+			snprintf(buf, sizeof(buf), "U%u", ssc->sc_unit);
 		}
 	}
 	tty_makedev(tp, NULL, "%s", buf);
@@ -377,10 +336,12 @@ ucom_attach_tty(struct ucom_softc *sc, u
 
 	/* Check if this device should be a console */
 	if ((ucom_cons_softc == NULL) && 
-	    (sc->sc_unit == ucom_cons_unit)) {
-
+	    (ssc->sc_unit == ucom_cons_unit) &&
+	    (sc->sc_subunit == ucom_cons_subunit)) {
 		struct termios t;
 
+		DPRINTF("unit %d subunit %d is console", ssc->sc_unit, sc->sc_subunit);
+
 		ucom_cons_softc = sc;
 
 		memset(&t, 0, sizeof(t));
@@ -398,8 +359,8 @@ ucom_attach_tty(struct ucom_softc *sc, u
 		ucom_param(ucom_cons_softc->sc_tty, &t);
 		mtx_unlock(ucom_cons_softc->sc_mtx);
 	}
-done:
-	return (error);
+
+	return (0);
 }
 
 static void
@@ -412,6 +373,7 @@ ucom_detach_tty(struct ucom_softc *sc)
 	if (sc->sc_flag & UCOM_FLAG_CONSOLE) {
 		mtx_lock(ucom_cons_softc->sc_mtx);
 		ucom_close(ucom_cons_softc->sc_tty);
+		sc->sc_flag &= ~UCOM_FLAG_CONSOLE;
 		mtx_unlock(ucom_cons_softc->sc_mtx);
 		ucom_cons_softc = NULL;
 	}

Modified: head/sys/dev/usb/serial/usb_serial.h
==============================================================================
--- head/sys/dev/usb/serial/usb_serial.h	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/usb_serial.h	Wed Nov  3 21:50:49 2010	(r214761)
@@ -104,7 +104,7 @@ struct ucom_callback {
 	void    (*ucom_stop_read) (struct ucom_softc *);
 	void    (*ucom_start_write) (struct ucom_softc *);
 	void    (*ucom_stop_write) (struct ucom_softc *);
-	void    (*ucom_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t local_subunit);
+	void    (*ucom_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t unit, uint16_t subunit);
 	void    (*ucom_poll) (struct ucom_softc *);
 };
 
@@ -132,6 +132,8 @@ struct ucom_param_task {
 
 struct ucom_super_softc {
 	struct usb_process sc_tq;
+	uint32_t sc_unit;
+	uint32_t sc_subunits;
 };
 
 struct ucom_softc {
@@ -158,10 +160,10 @@ struct ucom_softc {
 	const struct ucom_callback *sc_callback;
 	struct ucom_super_softc *sc_super;
 	struct tty *sc_tty;
+	char sc_devname[10];
 	struct mtx *sc_mtx;
 	void   *sc_parent;
-	uint32_t sc_unit;
-	uint32_t sc_local_unit;
+	uint32_t sc_subunit;
 	uint16_t sc_portno;
 	uint16_t sc_flag;
 #define	UCOM_FLAG_RTS_IFLOW	0x01	/* use RTS input flow control */
@@ -191,8 +193,7 @@ struct ucom_softc {
 int	ucom_attach(struct ucom_super_softc *,
 	    struct ucom_softc *, uint32_t, void *,
 	    const struct ucom_callback *callback, struct mtx *);
-void	ucom_detach(struct ucom_super_softc *,
-	    struct ucom_softc *, uint32_t);
+void	ucom_detach(struct ucom_super_softc *, struct ucom_softc *);
 void	ucom_status_change(struct ucom_softc *);
 uint8_t	ucom_get_data(struct ucom_softc *, struct usb_page_cache *,
 	    uint32_t, uint32_t, uint32_t *);

Modified: head/sys/dev/usb/serial/uslcom.c
==============================================================================
--- head/sys/dev/usb/serial/uslcom.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/uslcom.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -338,7 +338,7 @@ uslcom_detach(device_t dev)
 
 	DPRINTF("sc=%p\n", sc);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, USLCOM_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/uvisor.c
==============================================================================
--- head/sys/dev/usb/serial/uvisor.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/uvisor.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -361,7 +361,7 @@ uvisor_detach(device_t dev)
 
 	DPRINTF("sc=%p\n", sc);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UVISOR_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

Modified: head/sys/dev/usb/serial/uvscom.c
==============================================================================
--- head/sys/dev/usb/serial/uvscom.c	Wed Nov  3 21:40:57 2010	(r214760)
+++ head/sys/dev/usb/serial/uvscom.c	Wed Nov  3 21:50:49 2010	(r214761)
@@ -345,7 +345,7 @@ uvscom_detach(device_t dev)
 	if (sc->sc_xfer[UVSCOM_INTR_DT_RD])
 		usbd_transfer_stop(sc->sc_xfer[UVSCOM_INTR_DT_RD]);
 
-	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
+	ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
 	usbd_transfer_unsetup(sc->sc_xfer, UVSCOM_N_TRANSFER);
 	mtx_destroy(&sc->sc_mtx);
 

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 21:51:05 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B1D08106566B;
	Wed,  3 Nov 2010 21:51:05 +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 A05298FC15;
	Wed,  3 Nov 2010 21:51: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 oA3Lp5Di034823;
	Wed, 3 Nov 2010 21:51:05 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3Lp5K1034821;
	Wed, 3 Nov 2010 21:51:05 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011032151.oA3Lp5K1034821@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 3 Nov 2010 21:51:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214762 - stable/8/sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 21:51:05 -0000

Author: kib
Date: Wed Nov  3 21:51:05 2010
New Revision: 214762
URL: http://svn.freebsd.org/changeset/base/214762

Log:
  Bump __FreeBSD_version for struct sysentvec changes in r214755.

Modified:
  stable/8/sys/sys/param.h

Modified: stable/8/sys/sys/param.h
==============================================================================
--- stable/8/sys/sys/param.h	Wed Nov  3 21:50:49 2010	(r214761)
+++ stable/8/sys/sys/param.h	Wed Nov  3 21:51:05 2010	(r214762)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 801500	/* Master, propagated to newvers */
+#define __FreeBSD_version 801501	/* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 22:17:42 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E45B31065670;
	Wed,  3 Nov 2010 22:17:42 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BA5F08FC14;
	Wed,  3 Nov 2010 22:17: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 oA3MHgba035546;
	Wed, 3 Nov 2010 22:17:42 GMT (envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3MHgVB035543;
	Wed, 3 Nov 2010 22:17:42 GMT (envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201011032217.oA3MHgVB035543@svn.freebsd.org>
From: Rick Macklem 
Date: Wed, 3 Nov 2010 22:17:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214763 - in stable/8/sys/fs: nfs nfsserver
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 22:17:43 -0000

Author: rmacklem
Date: Wed Nov  3 22:17:42 2010
New Revision: 214763
URL: http://svn.freebsd.org/changeset/base/214763

Log:
  MFC: r214255
  Modify the experimental NFSv4 server's file handle hash function
  to use the generic hash32_buf() function. Although adding the
  bytes seemed sufficient for UFS and ZFS, since most of the bytes
  are the same for file handles on the same volume, this might not
  be sufficient for other file systems. Use of a generic function
  also seems preferable to one specific to NFSv4.

Modified:
  stable/8/sys/fs/nfs/nfs_var.h
  stable/8/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs_var.h
==============================================================================
--- stable/8/sys/fs/nfs/nfs_var.h	Wed Nov  3 21:51:05 2010	(r214762)
+++ stable/8/sys/fs/nfs/nfs_var.h	Wed Nov  3 22:17:42 2010	(r214763)
@@ -578,7 +578,7 @@ void nfsvno_unlockvfs(mount_t);
 int nfsvno_lockvfs(mount_t);
 int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *);
 int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *);
-int nfsrv_hashfh(fhandle_t *);
+uint32_t nfsrv_hashfh(fhandle_t *);
 
 /* nfs_commonkrpc.c */
 int newnfs_nmcancelreqs(struct nfsmount *);

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Wed Nov  3 21:51:05 2010	(r214762)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Wed Nov  3 22:17:42 2010	(r214763)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3090,15 +3091,12 @@ nfsvno_testexp(struct nfsrv_descript *nd
 /*
  * Calculate a hash value for the fid in a file handle.
  */
-int
+uint32_t
 nfsrv_hashfh(fhandle_t *fhp)
 {
-	int hashval = 0, i;
-	uint8_t *cp;
+	uint32_t hashval;
 
-	cp = (uint8_t *)&fhp->fh_fid;
-	for (i = 0; i < sizeof(struct fid); i++)
-		hashval += *cp++;
+	hashval = hash32_buf(&fhp->fh_fid, sizeof(struct fid), 0);
 	return (hashval);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 23:16:35 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8FE381065675;
	Wed,  3 Nov 2010 23:16:35 +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 55F8E8FC19;
	Wed,  3 Nov 2010 23:16: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 oA3NGZDe036908;
	Wed, 3 Nov 2010 23:16:35 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3NGZra036906;
	Wed, 3 Nov 2010 23:16:35 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201011032316.oA3NGZra036906@svn.freebsd.org>
From: Jung-uk Kim 
Date: Wed, 3 Nov 2010 23:16: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: r214765 - head/sys/dev/acpica
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 23:16:35 -0000

Author: jkim
Date: Wed Nov  3 23:16:35 2010
New Revision: 214765
URL: http://svn.freebsd.org/changeset/base/214765

Log:
  Adjust a comment to clarify why \_SB_ and \_TZ_ are defined as device type
  in ACPICA.  Reshuffle the code a bit to make sure this kludge only applies
  to these two specical cases and to make it cleaner.

Modified:
  head/sys/dev/acpica/acpi.c

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Wed Nov  3 22:21:21 2010	(r214764)
+++ head/sys/dev/acpica/acpi.c	Wed Nov  3 23:16:35 2010	(r214765)
@@ -1673,38 +1673,36 @@ acpi_probe_child(ACPI_HANDLE handle, UIN
     ACPI_OBJECT_TYPE type;
     ACPI_HANDLE h;
     device_t bus, child;
+    char *handle_str;
     int order;
-    char *handle_str, **search;
-    static char *scopes[] = {"\\_PR_", "\\_TZ_", "\\_SI_", "\\_SB_", NULL};
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
+    if (acpi_disabled("children"))
+	return_ACPI_STATUS (AE_OK);
+
     /* Skip this device if we think we'll have trouble with it. */
     if (acpi_avoid(handle))
 	return_ACPI_STATUS (AE_OK);
 
     bus = (device_t)context;
     if (ACPI_SUCCESS(AcpiGetType(handle, &type))) {
+	handle_str = acpi_name(handle);
 	switch (type) {
 	case ACPI_TYPE_DEVICE:
-	case ACPI_TYPE_PROCESSOR:
-	case ACPI_TYPE_THERMAL:
-	case ACPI_TYPE_POWER:
-	    if (acpi_disabled("children"))
-		break;
-
 	    /*
 	     * Since we scan from \, be sure to skip system scope objects.
-	     * At least \_SB and \_TZ are detected as devices (ACPI-CA bug?)
+	     * \_SB_ and \_TZ_ are defined in ACPICA as devices to work around
+	     * BIOS bugs.  For example, \_SB_ is to allow \_SB._INI to be run
+	     * during the intialization and \_TZ_ is to support Notify() on it.
 	     */
-	    handle_str = acpi_name(handle);
-	    for (search = scopes; *search != NULL; search++) {
-		if (strcmp(handle_str, *search) == 0)
-		    break;
-	    }
-	    if (*search != NULL)
+	    if (strcmp(handle_str, "\\_SB_") == 0 ||
+		strcmp(handle_str, "\\_TZ_") == 0)
 		break;
-
+	    /* FALLTHROUGH */
+	case ACPI_TYPE_PROCESSOR:
+	case ACPI_TYPE_THERMAL:
+	case ACPI_TYPE_POWER:
 	    /* 
 	     * Create a placeholder device for this node.  Sort the
 	     * placeholder so that the probe/attach passes will run

From owner-svn-src-all@FreeBSD.ORG  Wed Nov  3 23:29:52 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C8474106564A;
	Wed,  3 Nov 2010 23:29:52 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B7D508FC14;
	Wed,  3 Nov 2010 23:29: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 oA3NTqbH037214;
	Wed, 3 Nov 2010 23:29:52 GMT (envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA3NTqaw037212;
	Wed, 3 Nov 2010 23:29:52 GMT (envelope-from jmallett@svn.freebsd.org)
Message-Id: <201011032329.oA3NTqaw037212@svn.freebsd.org>
From: Juli Mallett 
Date: Wed, 3 Nov 2010 23:29: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: r214766 - head/sys/mips/cavium
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 03 Nov 2010 23:29:52 -0000

Author: jmallett
Date: Wed Nov  3 23:29:52 2010
New Revision: 214766
URL: http://svn.freebsd.org/changeset/base/214766

Log:
  Don't attach the PCI bus driver if the board we're being run on has PCIe.  The
  two are mutually-exclusive on Octeon.

Modified:
  head/sys/mips/cavium/octopci.c

Modified: head/sys/mips/cavium/octopci.c
==============================================================================
--- head/sys/mips/cavium/octopci.c	Wed Nov  3 23:16:35 2010	(r214765)
+++ head/sys/mips/cavium/octopci.c	Wed Nov  3 23:29:52 2010	(r214766)
@@ -108,6 +108,8 @@ octopci_probe(device_t dev)
 {
 	if (device_get_unit(dev) != 0)
 		return (ENXIO);
+	if (octeon_has_feature(OCTEON_FEATURE_PCIE))
+		return (ENXIO);
 	/* XXX Check sysinfo flag.  */
 	device_set_desc(dev, "Cavium Octeon PCI bridge");
 	return (0);

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 08:51:45 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 75932106566C;
	Thu,  4 Nov 2010 08:51:45 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 57F8B8FC18;
	Thu,  4 Nov 2010 08:51:45 +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 oA48pjF1049603;
	Thu, 4 Nov 2010 08:51:45 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA48pj96049600;
	Thu, 4 Nov 2010 08:51:45 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <201011040851.oA48pj96049600@svn.freebsd.org>
From: Andriy Gapon 
Date: Thu, 4 Nov 2010 08:51:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214774 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 08:51:45 -0000

Author: avg
Date: Thu Nov  4 08:51:45 2010
New Revision: 214774
URL: http://svn.freebsd.org/changeset/base/214774

Log:
  x86 topo_probe: do not probe smp topology if only one cpu is visible
  
  This could lead to a division by zero if hardware is multi-core and/or
  multi-threaded, but for some (quite unusual) reason FreeBSD sees only
  one logical processor.  This could happen, for example, if neither MADT
  nor MP Table are presented by BIOS.
  
  Also:
  - assert in topo_probe_0x4 that BSP is accounted for
  - neither cpu_cores nor cpu_logical should be zero after successful
    probing, so either being zero is an indication of failed probing
  
  Reported by:	vwe, Dan Allen 
  Tested by:	Dan Allen 
  MFC after:	3 days

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

Modified: head/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- head/sys/amd64/amd64/mp_machdep.c	Thu Nov  4 07:53:09 2010	(r214773)
+++ head/sys/amd64/amd64/mp_machdep.c	Thu Nov  4 08:51:45 2010	(r214774)
@@ -239,6 +239,9 @@ topo_probe_0x4(void)
 			cpu_logical++;
 	}
 
+	KASSERT(cpu_cores >= 1 && cpu_logical >= 1,
+	    ("topo_probe_0x4 couldn't find BSP"));
+
 	cpu_cores /= cpu_logical;
 	hyperthreading_cpus = cpu_logical;
 }
@@ -310,7 +313,9 @@ topo_probe(void)
 		return;
 
 	logical_cpus_mask = 0;
-	if (cpu_vendor_id == CPU_VENDOR_AMD)
+	if (mp_ncpus <= 1)
+		cpu_cores = cpu_logical = 1;
+	else if (cpu_vendor_id == CPU_VENDOR_AMD)
 		topo_probe_amd();
 	else if (cpu_vendor_id == CPU_VENDOR_INTEL) {
 		/*
@@ -332,10 +337,8 @@ topo_probe(void)
 	 * Fallback: assume each logical CPU is in separate
 	 * physical package.  That is, no multi-core, no SMT.
 	 */
-	if (cpu_cores == 0)
-		cpu_cores = 1;
-	if (cpu_logical == 0)
-		cpu_logical = 1;
+	if (cpu_cores == 0 || cpu_logical == 0)
+		cpu_cores = cpu_logical = 1;
 	cpu_topo_probed = 1;
 }
 

Modified: head/sys/i386/i386/mp_machdep.c
==============================================================================
--- head/sys/i386/i386/mp_machdep.c	Thu Nov  4 07:53:09 2010	(r214773)
+++ head/sys/i386/i386/mp_machdep.c	Thu Nov  4 08:51:45 2010	(r214774)
@@ -286,6 +286,9 @@ topo_probe_0x4(void)
 			cpu_logical++;
 	}
 
+	KASSERT(cpu_cores >= 1 && cpu_logical >= 1,
+	    ("topo_probe_0x4 couldn't find BSP"));
+
 	cpu_cores /= cpu_logical;
 	hyperthreading_cpus = cpu_logical;
 }
@@ -357,7 +360,9 @@ topo_probe(void)
 		return;
 
 	logical_cpus_mask = 0;
-	if (cpu_vendor_id == CPU_VENDOR_AMD)
+	if (mp_ncpus <= 1)
+		cpu_cores = cpu_logical = 1;
+	else if (cpu_vendor_id == CPU_VENDOR_AMD)
 		topo_probe_amd();
 	else if (cpu_vendor_id == CPU_VENDOR_INTEL) {
 		/*
@@ -379,10 +384,8 @@ topo_probe(void)
 	 * Fallback: assume each logical CPU is in separate
 	 * physical package.  That is, no multi-core, no SMT.
 	 */
-	if (cpu_cores == 0)
-		cpu_cores = 1;
-	if (cpu_logical == 0)
-		cpu_logical = 1;
+	if (cpu_cores == 0 || cpu_logical == 0)
+		cpu_cores = cpu_logical = 1;
 	cpu_topo_probed = 1;
 }
 

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 09:19:14 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A79B11065672;
	Thu,  4 Nov 2010 09:19:14 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 95B108FC16;
	Thu,  4 Nov 2010 09:19: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 oA49JEYe050244;
	Thu, 4 Nov 2010 09:19:14 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA49JEVI050242;
	Thu, 4 Nov 2010 09:19:14 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011040919.oA49JEVI050242@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 4 Nov 2010 09:19: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: r214776 - head/libexec/rtld-elf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 09:19:14 -0000

Author: kib
Date: Thu Nov  4 09:19:14 2010
New Revision: 214776
URL: http://svn.freebsd.org/changeset/base/214776

Log:
  Fix style.
  
  MFC after:	6 days

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Thu Nov  4 08:58:16 2010	(r214775)
+++ head/libexec/rtld-elf/rtld.c	Thu Nov  4 09:19:14 2010	(r214776)
@@ -1276,7 +1276,7 @@ init_dag(Obj_Entry *root)
     DoneList donelist;
 
     if (root->dag_inited)
-	    return;
+	return;
     donelist_init(&donelist);
     init_dag1(root, root, &donelist);
     root->dag_inited = true;

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 09:29:00 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 90EC4106564A;
	Thu,  4 Nov 2010 09:29:00 +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 645C88FC13;
	Thu,  4 Nov 2010 09:29: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 oA49T0ZP050500;
	Thu, 4 Nov 2010 09:29:00 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA49T0Xb050498;
	Thu, 4 Nov 2010 09:29:00 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201011040929.oA49T0Xb050498@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 4 Nov 2010 09:29:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214777 - head/libexec/rtld-elf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 09:29:00 -0000

Author: kib
Date: Thu Nov  4 09:29:00 2010
New Revision: 214777
URL: http://svn.freebsd.org/changeset/base/214777

Log:
  In r214728, if dlopen() is called for the object that has been already
  loaded as a dependency and marked -z nodlopen, object' DAG is already
  initialized by load_needed_objects(). Due to this, the init_dag() call
  from dlopen() does not increment refcount for the object [1].
  
  Change init_dag() to not increment DAG refcount. Require explicit calls
  to ref_dag() to increment, and assert that ref_dag() and unref_dag()
  are called for root that has dag initialized. To fix the noted issue,
  unconditionally call both init_dag() and ref_dag() in dlopen() for the
  case when the object was already loaded, making it similar to the case
  of newly loaded object.
  
  Noted by:	jh [1]
  Reviewed by:	jh, kan
  MFC after:	6 days

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Thu Nov  4 09:19:14 2010	(r214776)
+++ head/libexec/rtld-elf/rtld.c	Thu Nov  4 09:29:00 2010	(r214777)
@@ -1290,7 +1290,6 @@ init_dag1(Obj_Entry *root, Obj_Entry *ob
     if (donelist_check(dlp, obj))
 	return;
 
-    obj->refcount++;
     objlist_push_tail(&obj->dldags, root);
     objlist_push_tail(&root->dagmembers, obj);
     for (needed = obj->needed;  needed != NULL;  needed = needed->next)
@@ -2031,6 +2030,7 @@ dlopen(const char *name, int mode)
 	    assert(*old_obj_tail == obj);
 	    result = load_needed_objects(obj, RTLD_LO_DLOPEN);
 	    init_dag(obj);
+	    ref_dag(obj);
 	    if (result != -1)
 		result = rtld_verify_versions(&obj->dagmembers);
 	    if (result != -1 && ld_tracing)
@@ -2054,10 +2054,8 @@ dlopen(const char *name, int mode)
 	     * already loaded as a dependency, initialize the dag
 	     * starting at it.
 	     */
-	    if (obj->dl_refcount == 1)
-		init_dag(obj);
-	    else
-		ref_dag(obj);
+	    init_dag(obj);
+	    ref_dag(obj);
 
 	    if (ld_tracing)
 		goto trace;
@@ -3085,6 +3083,7 @@ ref_dag(Obj_Entry *root)
 {
     Objlist_Entry *elm;
 
+    assert(root->dag_inited);
     STAILQ_FOREACH(elm, &root->dagmembers, link)
 	elm->obj->refcount++;
 }
@@ -3094,6 +3093,7 @@ unref_dag(Obj_Entry *root)
 {
     Objlist_Entry *elm;
 
+    assert(root->dag_inited);
     STAILQ_FOREACH(elm, &root->dagmembers, link)
 	elm->obj->refcount--;
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 10:47:19 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CCD511065672;
	Thu,  4 Nov 2010 10:47:19 +0000 (UTC) (envelope-from bcr@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BAD8D8FC21;
	Thu,  4 Nov 2010 10:47: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 oA4AlJn5057505;
	Thu, 4 Nov 2010 10:47:19 GMT (envelope-from bcr@svn.freebsd.org)
Received: (from bcr@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4AlJv2057503;
	Thu, 4 Nov 2010 10:47:19 GMT (envelope-from bcr@svn.freebsd.org)
Message-Id: <201011041047.oA4AlJv2057503@svn.freebsd.org>
From: Benedict Reuschling 
Date: Thu, 4 Nov 2010 10: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: r214778 - head/usr.sbin/mfiutil
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 10:47:19 -0000

Author: bcr (doc committer)
Date: Thu Nov  4 10:47:19 2010
New Revision: 214778
URL: http://svn.freebsd.org/changeset/base/214778

Log:
  Fix typo.

Modified:
  head/usr.sbin/mfiutil/mfi_cmd.c

Modified: head/usr.sbin/mfiutil/mfi_cmd.c
==============================================================================
--- head/usr.sbin/mfiutil/mfi_cmd.c	Thu Nov  4 09:29:00 2010	(r214777)
+++ head/usr.sbin/mfiutil/mfi_cmd.c	Thu Nov  4 10:47:19 2010	(r214778)
@@ -46,7 +46,7 @@
 #include 
 
 static const char *mfi_status_codes[] = {
-	"Command completed succesfully",
+	"Command completed successfully",
 	"Invalid command",
 	"Invalid DMCD opcode",
 	"Invalid parameter",

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 10:53:51 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F377C106564A;
	Thu,  4 Nov 2010 10:53:50 +0000 (UTC) (envelope-from uqs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E03EC8FC0C;
	Thu,  4 Nov 2010 10:53: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 oA4AroNj057697;
	Thu, 4 Nov 2010 10:53:50 GMT (envelope-from uqs@svn.freebsd.org)
Received: (from uqs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4AroW0057692;
	Thu, 4 Nov 2010 10:53:50 GMT (envelope-from uqs@svn.freebsd.org)
Message-Id: <201011041053.oA4AroW0057692@svn.freebsd.org>
From: Ulrich Spoerlein 
Date: Thu, 4 Nov 2010 10:53:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214779 - in stable/8/usr.bin: lex yacc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 10:53:51 -0000

Author: uqs
Date: Thu Nov  4 10:53:50 2010
New Revision: 214779
URL: http://svn.freebsd.org/changeset/base/214779

Log:
  MFC r200626,201289,213764,214272, syncing yacc and flex to -CURRENT
  
  r200626:
  remove external reference to not (or at least no longer) existing variable 'myname'
  
  r201289:
  Let both yacc and lex generate code that passes -Wold-style-definition.
  
  Both these tools emit code where several functions have no `void'
  keyword placed in the arugment list when the function has no arguments.
  
  r213764:
  Don't define the input() function ifdef YY_NO_INPUT.
  This was previously done for the input() function.
  
  r214272:
  flex: add missing ifdef magic to create/hide prototypes
  This unbreaks build for some software with higher WARNS flags.

Modified:
  stable/8/usr.bin/lex/flex.skl
  stable/8/usr.bin/lex/initscan.c
  stable/8/usr.bin/yacc/defs.h
  stable/8/usr.bin/yacc/skeleton.c
Directory Properties:
  stable/8/usr.bin/lex/   (props changed)
  stable/8/usr.bin/yacc/   (props changed)

Modified: stable/8/usr.bin/lex/flex.skl
==============================================================================
--- stable/8/usr.bin/lex/flex.skl	Thu Nov  4 10:47:19 2010	(r214778)
+++ stable/8/usr.bin/lex/flex.skl	Thu Nov  4 10:53:50 2010	(r214779)
@@ -747,7 +747,11 @@ void yyFlexLexer::LexerOutput( const cha
  */
 
 %-
+#ifdef YY_USE_PROTOS
+static int yy_get_next_buffer(void)
+#else
 static int yy_get_next_buffer()
+#endif
 %+
 int yyFlexLexer::yy_get_next_buffer()
 %*
@@ -883,7 +887,11 @@ int yyFlexLexer::yy_get_next_buffer()
 /* yy_get_previous_state - get the state just before the EOB char was reached */
 
 %-
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_get_previous_state(void)
+#else
 static yy_state_type yy_get_previous_state()
+#endif
 %+
 yy_state_type yyFlexLexer::yy_get_previous_state()
 %*
@@ -979,11 +987,16 @@ void yyFlexLexer::yyunput( int c, char* 
 
 
 %-
+#ifndef YY_NO_INPUT
 #ifdef __cplusplus
 static int yyinput()
 #else
+#ifdef YY_USE_PROTOS
+static int input(void)
+#else
 static int input()
 #endif
+#endif
 %+
 int yyFlexLexer::yyinput()
 %*
@@ -1054,6 +1067,9 @@ int yyFlexLexer::yyinput()
 
 	return c;
 	}
+%-
+#endif	/* ifndef YY_NO_INPUT */
+%*
 
 
 %-
@@ -1402,7 +1418,11 @@ void yyFlexLexer::yy_push_state( int new
 
 #ifndef YY_NO_POP_STATE
 %-
+#ifdef YY_USE_PROTOS
+static void yy_pop_state(void)
+#else
 static void yy_pop_state()
+#endif
 %+
 void yyFlexLexer::yy_pop_state()
 %*
@@ -1417,7 +1437,11 @@ void yyFlexLexer::yy_pop_state()
 
 #ifndef YY_NO_TOP_STATE
 %-
+#ifdef YY_USE_PROTOS
+static int yy_top_state(void)
+#else
 static int yy_top_state()
+#endif
 %+
 int yyFlexLexer::yy_top_state()
 %*

Modified: stable/8/usr.bin/lex/initscan.c
==============================================================================
--- stable/8/usr.bin/lex/initscan.c	Thu Nov  4 10:47:19 2010	(r214778)
+++ stable/8/usr.bin/lex/initscan.c	Thu Nov  4 10:53:50 2010	(r214779)
@@ -2894,7 +2894,7 @@ case YY_STATE_EOF(LINEDIR):
  *	EOB_ACT_END_OF_FILE - end of file
  */
 
-static int yy_get_next_buffer()
+static int yy_get_next_buffer(void)
 	{
 	char *dest = yy_current_buffer->yy_ch_buf;
 	char *source = yytext_ptr;
@@ -3026,7 +3026,7 @@ static int yy_get_next_buffer()
 
 /* yy_get_previous_state - get the state just before the EOB char was reached */
 
-static yy_state_type yy_get_previous_state()
+static yy_state_type yy_get_previous_state(void)
 	{
 	yy_state_type yy_current_state;
 	char *yy_cp;
@@ -3138,7 +3138,7 @@ char *yy_bp;
 #ifdef __cplusplus
 static int yyinput()
 #else
-static int input()
+static int input(void)
 #endif
 	{
 	int c;

Modified: stable/8/usr.bin/yacc/defs.h
==============================================================================
--- stable/8/usr.bin/yacc/defs.h	Thu Nov  4 10:47:19 2010	(r214778)
+++ stable/8/usr.bin/yacc/defs.h	Thu Nov  4 10:53:50 2010	(r214779)
@@ -220,7 +220,6 @@ extern char tflag;
 extern char vflag;
 extern const char *symbol_prefix;
 
-extern char *myname;
 extern char *cptr;
 extern char *line;
 extern int lineno;

Modified: stable/8/usr.bin/yacc/skeleton.c
==============================================================================
--- stable/8/usr.bin/yacc/skeleton.c	Thu Nov  4 10:47:19 2010	(r214778)
+++ stable/8/usr.bin/yacc/skeleton.c	Thu Nov  4 10:53:50 2010	(r214779)
@@ -140,7 +140,11 @@ const char *header[] =
 const char *body[] =
 {
     "/* allocate initial stack or double stack size, up to YYMAXDEPTH */",
+    "#if defined(__cplusplus) || __STDC__",
+    "static int yygrowstack(void)",
+    "#else",
     "static int yygrowstack()",
+    "#endif",
     "{",
     "    int newsize, i;",
     "    short *newss;",

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 12:33:08 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 544EC106566B;
	Thu,  4 Nov 2010 12:33:08 +0000 (UTC) (envelope-from uqs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 41AF88FC19;
	Thu,  4 Nov 2010 12:33:08 +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 oA4CX8lr060060;
	Thu, 4 Nov 2010 12:33:08 GMT (envelope-from uqs@svn.freebsd.org)
Received: (from uqs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4CX86u060057;
	Thu, 4 Nov 2010 12:33:08 GMT (envelope-from uqs@svn.freebsd.org)
Message-Id: <201011041233.oA4CX86u060057@svn.freebsd.org>
From: Ulrich Spoerlein 
Date: Thu, 4 Nov 2010 12:33:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214780 - stable/8/usr.sbin/rtadvd
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 12:33:08 -0000

Author: uqs
Date: Thu Nov  4 12:33:07 2010
New Revision: 214780
URL: http://svn.freebsd.org/changeset/base/214780

Log:
  MFC r208028,214491: Sync manpages to -CURRENT
  
  r208028:
  mdoc: move remaining sections into consistent order
  
  r214491:
  Fix another "string" typo.

Modified:
  stable/8/usr.sbin/rtadvd/rtadvd.8
  stable/8/usr.sbin/rtadvd/rtadvd.conf.5
Directory Properties:
  stable/8/usr.sbin/rtadvd/   (props changed)

Modified: stable/8/usr.sbin/rtadvd/rtadvd.8
==============================================================================
--- stable/8/usr.sbin/rtadvd/rtadvd.8	Thu Nov  4 10:53:50 2010	(r214779)
+++ stable/8/usr.sbin/rtadvd/rtadvd.8	Thu Nov  4 12:33:07 2010	(r214780)
@@ -162,8 +162,6 @@ In this case,
 will transmit router advertisement with router lifetime 0
 to all the interfaces
 .Pq in accordance with RFC2461 6.2.5 .
-.Sh EXIT STATUS
-.Ex -std
 .Sh FILES
 .Bl -tag -width Pa -compact
 .It Pa /etc/rtadvd.conf
@@ -176,6 +174,8 @@ The file in which
 .Nm
 dumps its internal state.
 .El
+.Sh EXIT STATUS
+.Ex -std
 .Sh SEE ALSO
 .Xr rtadvd.conf 5 ,
 .Xr rtsol 8

Modified: stable/8/usr.sbin/rtadvd/rtadvd.conf.5
==============================================================================
--- stable/8/usr.sbin/rtadvd/rtadvd.conf.5	Thu Nov  4 10:53:50 2010	(r214779)
+++ stable/8/usr.sbin/rtadvd/rtadvd.conf.5	Thu Nov  4 12:33:07 2010	(r214780)
@@ -201,7 +201,7 @@ The default value is 64.
 (str or num) A 8-bit flags field in prefix information option.
 This field can be specified either as a case-sensitive string or as an
 integer.
-A sting consists of characters each of which corresponds to a
+A string consists of characters each of which corresponds to a
 particular flag bit(s).
 An integer should be the logical OR of all enabled bits.
 Bit 7

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 15:24:32 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 906891065695;
	Thu,  4 Nov 2010 15:24:32 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7F8B58FC25;
	Thu,  4 Nov 2010 15:24: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 oA4FOWql063814;
	Thu, 4 Nov 2010 15:24:32 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4FOWd7063812;
	Thu, 4 Nov 2010 15:24:32 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201011041524.oA4FOWd7063812@svn.freebsd.org>
From: Bruce Cran 
Date: Thu, 4 Nov 2010 15:24: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: r214781 - head/sbin/camcontrol
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 15:24:32 -0000

Author: brucec
Date: Thu Nov  4 15:24:32 2010
New Revision: 214781
URL: http://svn.freebsd.org/changeset/base/214781

Log:
  Fix standby timer calculation: the timer was being set 30 minutes later
  than the user requested.
  Also, 21 minutes is encoded as 252 and 22-29 minutes cannot be encoded
  so must be rounded up to 30.
  
  PR:	bin/151871

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Thu Nov  4 12:33:07 2010	(r214780)
+++ head/sbin/camcontrol/camcontrol.c	Thu Nov  4 15:24:32 2010	(r214781)
@@ -4316,10 +4316,17 @@ atapm(struct cam_device *device, int arg
 		sc = 0;
 	else if (t <= (240 * 5))
 		sc = t / 5;
+	else if (t == (252 * 5))
+		/* special encoding for 21 minutes */
+		sc = 252;
+	else if (t < (30 * 60))
+		/* no encoding exists for 22-29 minutes, so set to 30 mins */
+		sc = 241;
 	else if (t <= (11 * 30 * 60))
-		sc = t / (30 * 60) + 241;
+		sc = t / (30 * 60) + 240;
 	else
 		sc = 253;
+
 	cam_fill_ataio(&ccb->ataio,
 		      retry_count,
 		      NULL,

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 15:33:50 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8824E10656A6;
	Thu,  4 Nov 2010 15:33:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 775AA8FC1D;
	Thu,  4 Nov 2010 15:33: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 oA4FXoDt064063;
	Thu, 4 Nov 2010 15:33:50 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4FXox4064061;
	Thu, 4 Nov 2010 15:33:50 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041533.oA4FXox4064061@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 15:33: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: r214782 - head/sys/vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 15:33:50 -0000

Author: jhb
Date: Thu Nov  4 15:33:50 2010
New Revision: 214782
URL: http://svn.freebsd.org/changeset/base/214782

Log:
  Update startup_alloc() to support multi-page allocations and allow internal
  zones whose objects are larger than a page to use startup_alloc().  This
  allows allocation of zone objects during early boot on machines with a large
  number of CPUs since the resulting zone objects are larger than a page.
  
  Submitted by:	trema
  Reviewed by:	attilio
  MFC after:	1 week

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Thu Nov  4 15:24:32 2010	(r214781)
+++ head/sys/vm/uma_core.c	Thu Nov  4 15:33:50 2010	(r214782)
@@ -930,15 +930,32 @@ startup_alloc(uma_zone_t zone, int bytes
 {
 	uma_keg_t keg;
 	uma_slab_t tmps;
+	int pages, check_pages;
 
 	keg = zone_first_keg(zone);
+	pages = howmany(bytes, PAGE_SIZE);
+	check_pages = pages - 1;
+	KASSERT(pages > 0, ("startup_alloc can't reserve 0 pages\n"));
 
 	/*
 	 * Check our small startup cache to see if it has pages remaining.
 	 */
 	mtx_lock(&uma_boot_pages_mtx);
-	if ((tmps = LIST_FIRST(&uma_boot_pages)) != NULL) {
-		LIST_REMOVE(tmps, us_link);
+
+	/* First check if we have enough room. */
+	tmps = LIST_FIRST(&uma_boot_pages);
+	while (tmps != NULL && check_pages-- > 0)
+		tmps = LIST_NEXT(tmps, us_link);
+	if (tmps != NULL) {
+		/*
+		 * It's ok to lose tmps references.  The last one will
+		 * have tmps->us_data pointing to the start address of
+		 * "pages" contiguous pages of memory.
+		 */
+		while (pages-- > 0) {
+			tmps = LIST_FIRST(&uma_boot_pages);
+			LIST_REMOVE(tmps, us_link);
+		}
 		mtx_unlock(&uma_boot_pages_mtx);
 		*pflag = tmps->us_flags;
 		return (tmps->us_data);
@@ -950,7 +967,7 @@ startup_alloc(uma_zone_t zone, int bytes
 	 * Now that we've booted reset these users to their real allocator.
 	 */
 #ifdef UMA_MD_SMALL_ALLOC
-	keg->uk_allocf = uma_small_alloc;
+	keg->uk_allocf = (keg->uk_ppera > 1) ? page_alloc : uma_small_alloc;
 #else
 	keg->uk_allocf = page_alloc;
 #endif
@@ -1177,12 +1194,15 @@ keg_large_init(uma_keg_t keg)
 
 	keg->uk_ppera = pages;
 	keg->uk_ipers = 1;
+	keg->uk_rsize = keg->uk_size;
+
+	/* We can't do OFFPAGE if we're internal, bail out here. */
+	if (keg->uk_flags & UMA_ZFLAG_INTERNAL)
+		return;
 
 	keg->uk_flags |= UMA_ZONE_OFFPAGE;
 	if ((keg->uk_flags & UMA_ZONE_VTOSLAB) == 0)
 		keg->uk_flags |= UMA_ZONE_HASH;
-
-	keg->uk_rsize = keg->uk_size;
 }
 
 static void
@@ -1301,7 +1321,8 @@ keg_ctor(void *mem, int size, void *udat
 #endif
 		if (booted == 0)
 			keg->uk_allocf = startup_alloc;
-	}
+	} else if (booted == 0 && (keg->uk_flags & UMA_ZFLAG_INTERNAL))
+		keg->uk_allocf = startup_alloc;
 
 	/*
 	 * Initialize keg's lock (shared among zones).
@@ -1330,7 +1351,7 @@ keg_ctor(void *mem, int size, void *udat
 		if (totsize & UMA_ALIGN_PTR)
 			totsize = (totsize & ~UMA_ALIGN_PTR) +
 			    (UMA_ALIGN_PTR + 1);
-		keg->uk_pgoff = UMA_SLAB_SIZE - totsize;
+		keg->uk_pgoff = (UMA_SLAB_SIZE * keg->uk_ppera) - totsize;
 
 		if (keg->uk_flags & UMA_ZONE_REFCNT)
 			totsize = keg->uk_pgoff + sizeof(struct uma_slab_refcnt)
@@ -1346,7 +1367,7 @@ keg_ctor(void *mem, int size, void *udat
 		 * mathematically possible for all cases, so we make
 		 * sure here anyway.
 		 */
-		if (totsize > UMA_SLAB_SIZE) {
+		if (totsize > UMA_SLAB_SIZE * keg->uk_ppera) {
 			printf("zone %s ipers %d rsize %d size %d\n",
 			    zone->uz_name, keg->uk_ipers, keg->uk_rsize,
 			    keg->uk_size);

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:06:55 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 53C3A106564A;
	Thu,  4 Nov 2010 17:06: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 415AA8FC12;
	Thu,  4 Nov 2010 17:06: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 oA4H6tNd066335;
	Thu, 4 Nov 2010 17:06:55 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4H6t1d066331;
	Thu, 4 Nov 2010 17:06:55 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041706.oA4H6t1d066331@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 17:06:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214784 - in stable/8/sys: conf x86 x86/pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:06:55 -0000

Author: jhb
Date: Thu Nov  4 17:06:54 2010
New Revision: 214784
URL: http://svn.freebsd.org/changeset/base/214784

Log:
  MFC 211820,211821,212292:
  Intel QPI chipsets actually provide extra "non-core" PCI buses that
  provide PCI devices for various hardware such as memory controllers,
  etc.  for each socket.  These PCI buses are not enumerated via ACPI
  however.  Add qpi(4) psuedo bus and Host-PCI bridge drivers to
  enumerate these buses.  Currently the driver uses the CPU ID to
  determine the bridges' presence.

Added:
  stable/8/sys/x86/
  stable/8/sys/x86/pci/
     - copied from r211820, head/sys/x86/pci/
Modified:
  stable/8/sys/conf/files.amd64
  stable/8/sys/conf/files.i386
  stable/8/sys/x86/pci/qpi.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/conf/files.amd64
==============================================================================
--- stable/8/sys/conf/files.amd64	Thu Nov  4 17:01:21 2010	(r214783)
+++ stable/8/sys/conf/files.amd64	Thu Nov  4 17:06:54 2010	(r214784)
@@ -313,3 +313,7 @@ libkern/memset.c		standard
 #
 compat/x86bios/x86bios.c	optional x86bios | atkbd | dpms | vesa
 contrib/x86emu/x86emu.c		optional x86bios | atkbd | dpms | vesa
+#
+# x86 shared code between IA32, AMD64 and PC98 architectures
+#
+x86/pci/qpi.c			standard

Modified: stable/8/sys/conf/files.i386
==============================================================================
--- stable/8/sys/conf/files.i386	Thu Nov  4 17:01:21 2010	(r214783)
+++ stable/8/sys/conf/files.i386	Thu Nov  4 17:06:54 2010	(r214784)
@@ -388,3 +388,7 @@ i386/xbox/pic16l.s		optional xbox
 #
 compat/x86bios/x86bios.c	optional x86bios | atkbd | dpms | vesa
 contrib/x86emu/x86emu.c		optional x86bios | atkbd | dpms | vesa
+#
+# x86 shared code between IA32, AMD64 and PC98 architectures
+#
+x86/pci/qpi.c			standard

Modified: stable/8/sys/x86/pci/qpi.c
==============================================================================
--- head/sys/x86/pci/qpi.c	Wed Aug 25 19:12:05 2010	(r211820)
+++ stable/8/sys/x86/pci/qpi.c	Thu Nov  4 17:06:54 2010	(r214784)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include "pcib_if.h"
@@ -62,7 +63,8 @@ qpi_identify(driver_t *driver, device_t 
 {
 
         /* Check CPUID to ensure this is an i7 CPU of some sort. */
-        if (!(cpu_vendor_id == CPU_VENDOR_INTEL && CPUID_TO_FAMILY(cpu_id) &&
+        if (!(cpu_vendor_id == CPU_VENDOR_INTEL &&
+	    CPUID_TO_FAMILY(cpu_id) == 0x6 &&
 	    (CPUID_TO_MODEL(cpu_id) == 0x1a || CPUID_TO_MODEL(cpu_id) == 0x2c)))
                 return;
 
@@ -83,31 +85,62 @@ qpi_probe(device_t dev)
 	return (BUS_PROBE_SPECIFIC);
 }
 
+/*
+ * Look for a PCI bus with the specified bus address.  If one is found,
+ * add a pcib device and return 0.  Otherwise, return an error code.
+ */
 static int
-qpi_attach(device_t dev)
+qpi_probe_pcib(device_t dev, int bus)
 {
 	struct qpi_device *qdev;
 	device_t child;
+	uint32_t devid;
 
 	/*
-	 * Add two Host-PCI bridge devices, one for PCI bus 254 and
-	 * one for PCI bus 255.
+	 * If a PCI bus already exists for this bus number, then
+	 * fail.
 	 */
-	child = BUS_ADD_CHILD(dev, 0, "pcib", -1);
-	if (child == NULL)
-		panic("%s: failed to add pci bus 254",
-		    device_get_nameunit(dev));
-	qdev = malloc(sizeof(struct qpi_device), M_QPI, M_WAITOK);
-	qdev->qd_pcibus = 254;
-	device_set_ivars(child, qdev);
+	if (pci_find_bsf(bus, 0, 0) != NULL)
+		return (EEXIST);
+
+	/*
+	 * Attempt to read the device id for device 0, function 0 on
+	 * the bus.  A value of 0xffffffff means that the bus is not
+	 * present.
+	 */
+	devid = pci_cfgregread(bus, 0, 0, PCIR_DEVVENDOR, 4);
+	if (devid == 0xffffffff)
+		return (ENOENT);
+
+	if ((devid & 0xffff) != 0x8086) {
+		device_printf(dev,
+		    "Device at pci%d.0.0 has non-Intel vendor 0x%x\n", bus,
+		    devid & 0xffff);
+		return (ENXIO);
+	}
 
 	child = BUS_ADD_CHILD(dev, 0, "pcib", -1);
 	if (child == NULL)
-		panic("%s: failed to add pci bus 255",
-		    device_get_nameunit(dev));
+		panic("%s: failed to add pci bus %d", device_get_nameunit(dev),
+		    bus);
 	qdev = malloc(sizeof(struct qpi_device), M_QPI, M_WAITOK);
-	qdev->qd_pcibus = 255;
+	qdev->qd_pcibus = bus;
 	device_set_ivars(child, qdev);
+	return (0);
+}
+
+static int
+qpi_attach(device_t dev)
+{
+	int bus;
+
+	/*
+	 * Each processor socket has a dedicated PCI bus counting down from
+	 * 255.  We keep probing buses until one fails.
+	 */
+	for (bus = 255;; bus--)
+		if (qpi_probe_pcib(dev, bus) != 0)
+			break;
 
 	return (bus_generic_attach(dev));
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:07:13 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B77A3106566B;
	Thu,  4 Nov 2010 17:07:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A51FE8FC15;
	Thu,  4 Nov 2010 17:07: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 oA4H7DE9066382;
	Thu, 4 Nov 2010 17:07:13 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4H7Dni066378;
	Thu, 4 Nov 2010 17:07:13 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041707.oA4H7Dni066378@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 17:07:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214785 - in stable/7/sys: conf x86 x86/pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:07:13 -0000

Author: jhb
Date: Thu Nov  4 17:07:13 2010
New Revision: 214785
URL: http://svn.freebsd.org/changeset/base/214785

Log:
  MFC 211820,211821,212292:
  Intel QPI chipsets actually provide extra "non-core" PCI buses that
  provide PCI devices for various hardware such as memory controllers,
  etc.  for each socket.  These PCI buses are not enumerated via ACPI
  however.  Add qpi(4) psuedo bus and Host-PCI bridge drivers to
  enumerate these buses.  Currently the driver uses the CPU ID to
  determine the bridges' presence.

Added:
  stable/7/sys/x86/
  stable/7/sys/x86/pci/
     - copied from r211820, head/sys/x86/pci/
Modified:
  stable/7/sys/conf/files.amd64
  stable/7/sys/conf/files.i386
  stable/7/sys/x86/pci/qpi.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/conf/files.amd64
==============================================================================
--- stable/7/sys/conf/files.amd64	Thu Nov  4 17:06:54 2010	(r214784)
+++ stable/7/sys/conf/files.amd64	Thu Nov  4 17:07:13 2010	(r214785)
@@ -277,3 +277,7 @@ i386/cpufreq/hwpstate.c		optional	cpufre
 i386/cpufreq/p4tcc.c		optional	cpufreq
 #
 libkern/memset.c		standard
+#
+# x86 shared code between IA32, AMD64 and PC98 architectures
+#
+x86/pci/qpi.c			standard

Modified: stable/7/sys/conf/files.i386
==============================================================================
--- stable/7/sys/conf/files.i386	Thu Nov  4 17:06:54 2010	(r214784)
+++ stable/7/sys/conf/files.i386	Thu Nov  4 17:07:13 2010	(r214785)
@@ -463,3 +463,7 @@ i386/xbox/xbox.c		optional	xbox
 i386/xbox/xboxfb.c		optional	xboxfb
 dev/fb/boot_font.c		optional	xboxfb
 i386/xbox/pic16l.s		optional	xbox
+#
+# x86 shared code between IA32, AMD64 and PC98 architectures
+#
+x86/pci/qpi.c			standard

Modified: stable/7/sys/x86/pci/qpi.c
==============================================================================
--- head/sys/x86/pci/qpi.c	Wed Aug 25 19:12:05 2010	(r211820)
+++ stable/7/sys/x86/pci/qpi.c	Thu Nov  4 17:07:13 2010	(r214785)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include "pcib_if.h"
@@ -62,7 +63,8 @@ qpi_identify(driver_t *driver, device_t 
 {
 
         /* Check CPUID to ensure this is an i7 CPU of some sort. */
-        if (!(cpu_vendor_id == CPU_VENDOR_INTEL && CPUID_TO_FAMILY(cpu_id) &&
+        if (!(cpu_vendor_id == CPU_VENDOR_INTEL &&
+	    CPUID_TO_FAMILY(cpu_id) == 0x6 &&
 	    (CPUID_TO_MODEL(cpu_id) == 0x1a || CPUID_TO_MODEL(cpu_id) == 0x2c)))
                 return;
 
@@ -83,31 +85,62 @@ qpi_probe(device_t dev)
 	return (BUS_PROBE_SPECIFIC);
 }
 
+/*
+ * Look for a PCI bus with the specified bus address.  If one is found,
+ * add a pcib device and return 0.  Otherwise, return an error code.
+ */
 static int
-qpi_attach(device_t dev)
+qpi_probe_pcib(device_t dev, int bus)
 {
 	struct qpi_device *qdev;
 	device_t child;
+	uint32_t devid;
 
 	/*
-	 * Add two Host-PCI bridge devices, one for PCI bus 254 and
-	 * one for PCI bus 255.
+	 * If a PCI bus already exists for this bus number, then
+	 * fail.
 	 */
-	child = BUS_ADD_CHILD(dev, 0, "pcib", -1);
-	if (child == NULL)
-		panic("%s: failed to add pci bus 254",
-		    device_get_nameunit(dev));
-	qdev = malloc(sizeof(struct qpi_device), M_QPI, M_WAITOK);
-	qdev->qd_pcibus = 254;
-	device_set_ivars(child, qdev);
+	if (pci_find_bsf(bus, 0, 0) != NULL)
+		return (EEXIST);
+
+	/*
+	 * Attempt to read the device id for device 0, function 0 on
+	 * the bus.  A value of 0xffffffff means that the bus is not
+	 * present.
+	 */
+	devid = pci_cfgregread(bus, 0, 0, PCIR_DEVVENDOR, 4);
+	if (devid == 0xffffffff)
+		return (ENOENT);
+
+	if ((devid & 0xffff) != 0x8086) {
+		device_printf(dev,
+		    "Device at pci%d.0.0 has non-Intel vendor 0x%x\n", bus,
+		    devid & 0xffff);
+		return (ENXIO);
+	}
 
 	child = BUS_ADD_CHILD(dev, 0, "pcib", -1);
 	if (child == NULL)
-		panic("%s: failed to add pci bus 255",
-		    device_get_nameunit(dev));
+		panic("%s: failed to add pci bus %d", device_get_nameunit(dev),
+		    bus);
 	qdev = malloc(sizeof(struct qpi_device), M_QPI, M_WAITOK);
-	qdev->qd_pcibus = 255;
+	qdev->qd_pcibus = bus;
 	device_set_ivars(child, qdev);
+	return (0);
+}
+
+static int
+qpi_attach(device_t dev)
+{
+	int bus;
+
+	/*
+	 * Each processor socket has a dedicated PCI bus counting down from
+	 * 255.  We keep probing buses until one fails.
+	 */
+	for (bus = 255;; bus--)
+		if (qpi_probe_pcib(dev, bus) != 0)
+			break;
 
 	return (bus_generic_attach(dev));
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:12:29 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C687A106566B;
	Thu,  4 Nov 2010 17:12:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9A55D8FC20;
	Thu,  4 Nov 2010 17:12:29 +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 oA4HCTTo066557;
	Thu, 4 Nov 2010 17:12:29 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4HCTHw066555;
	Thu, 4 Nov 2010 17:12:29 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041712.oA4HCTHw066555@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 17:12:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214786 - stable/8/sys/dev/pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:12:29 -0000

Author: jhb
Date: Thu Nov  4 17:12:29 2010
New Revision: 214786
URL: http://svn.freebsd.org/changeset/base/214786

Log:
  MFC 214203:
  - Add a new PCI quirk to whitelist an old chipset that doesn't support
    PCI-express or PCI-X capabilities if we are running in a virtual machine.
  - Whitelist the Intel 82440 chipset used by QEMU.

Modified:
  stable/8/sys/dev/pci/pci.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/pci/pci.c
==============================================================================
--- stable/8/sys/dev/pci/pci.c	Thu Nov  4 17:07:13 2010	(r214785)
+++ stable/8/sys/dev/pci/pci.c	Thu Nov  4 17:12:29 2010	(r214786)
@@ -184,6 +184,7 @@ struct pci_quirk {
 	int	type;
 #define	PCI_QUIRK_MAP_REG	1 /* PCI map register in weird place */
 #define	PCI_QUIRK_DISABLE_MSI	2 /* MSI/MSI-X doesn't work */
+#define	PCI_QUIRK_ENABLE_MSI_VM	3 /* Older chipset in VM where MSI works */
 	int	arg1;
 	int	arg2;
 };
@@ -220,6 +221,12 @@ struct pci_quirk pci_quirks[] = {
 	 */
 	{ 0x74501022, PCI_QUIRK_DISABLE_MSI,	0,	0 },
 
+	/*
+	 * Some virtualization environments emulate an older chipset
+	 * but support MSI just fine.  QEMU uses the Intel 82440.
+	 */
+	{ 0x12378086, PCI_QUIRK_ENABLE_MSI_VM,	0,	0 },
+
 	{ 0 }
 };
 
@@ -1803,6 +1810,23 @@ pci_msi_device_blacklisted(device_t dev)
 }
 
 /*
+ * Returns true if a specified chipset supports MSI when it is
+ * emulated hardware in a virtual machine.
+ */
+static int
+pci_msi_vm_chipset(device_t dev)
+{
+	struct pci_quirk *q;
+
+	for (q = &pci_quirks[0]; q->devid; q++) {
+		if (q->devid == pci_get_devid(dev) &&
+		    q->type == PCI_QUIRK_ENABLE_MSI_VM)
+			return (1);
+	}
+	return (0);
+}
+
+/*
  * Determine if MSI is blacklisted globally on this sytem.  Currently,
  * we just check for blacklisted chipsets as represented by the
  * host-PCI bridge at device 0:0:0.  In the future, it may become
@@ -1818,8 +1842,14 @@ pci_msi_blacklisted(void)
 		return (0);
 
 	/* Blacklist all non-PCI-express and non-PCI-X chipsets. */
-	if (!(pcie_chipset || pcix_chipset))
+	if (!(pcie_chipset || pcix_chipset)) {
+		if (vm_guest != VM_GUEST_NO) {
+			dev = pci_find_bsf(0, 0, 0);
+			if (dev != NULL)
+				return (pci_msi_vm_chipset(dev) == 0);
+		}
 		return (1);
+	}
 
 	dev = pci_find_bsf(0, 0, 0);
 	if (dev != NULL)

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:13:30 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B32AD1065675;
	Thu,  4 Nov 2010 17:13:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8744E8FC18;
	Thu,  4 Nov 2010 17:13:30 +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 oA4HDU2c066614;
	Thu, 4 Nov 2010 17: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 oA4HDUpA066611;
	Thu, 4 Nov 2010 17:13:30 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041713.oA4HDUpA066611@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 17:13:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214787 - stable/7/sys/dev/pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:13:30 -0000

Author: jhb
Date: Thu Nov  4 17:13:30 2010
New Revision: 214787
URL: http://svn.freebsd.org/changeset/base/214787

Log:
  MFC 214203:
  - Add a new PCI quirk to whitelist an old chipset that doesn't support
    PCI-express or PCI-X capabilities if we are running in a virtual machine.
  - Whitelist the Intel 82440 chipset used by QEMU.

Modified:
  stable/7/sys/dev/pci/pci.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/pci/pci.c
==============================================================================
--- stable/7/sys/dev/pci/pci.c	Thu Nov  4 17:12:29 2010	(r214786)
+++ stable/7/sys/dev/pci/pci.c	Thu Nov  4 17:13:30 2010	(r214787)
@@ -178,6 +178,7 @@ struct pci_quirk {
 	int	type;
 #define	PCI_QUIRK_MAP_REG	1 /* PCI map register in weird place */
 #define	PCI_QUIRK_DISABLE_MSI	2 /* MSI/MSI-X doesn't work */
+#define	PCI_QUIRK_ENABLE_MSI_VM	3 /* Older chipset in VM where MSI works */
 	int	arg1;
 	int	arg2;
 };
@@ -214,6 +215,12 @@ struct pci_quirk pci_quirks[] = {
 	 */
 	{ 0x74501022, PCI_QUIRK_DISABLE_MSI,	0,	0 },
 
+	/*
+	 * Some virtualization environments emulate an older chipset
+	 * but support MSI just fine.  QEMU uses the Intel 82440.
+	 */
+	{ 0x12378086, PCI_QUIRK_ENABLE_MSI_VM,	0,	0 },
+
 	{ 0 }
 };
 
@@ -1771,6 +1778,23 @@ pci_msi_device_blacklisted(device_t dev)
 }
 
 /*
+ * Returns true if a specified chipset supports MSI when it is
+ * emulated hardware in a virtual machine.
+ */
+static int
+pci_msi_vm_chipset(device_t dev)
+{
+	struct pci_quirk *q;
+
+	for (q = &pci_quirks[0]; q->devid; q++) {
+		if (q->devid == pci_get_devid(dev) &&
+		    q->type == PCI_QUIRK_ENABLE_MSI_VM)
+			return (1);
+	}
+	return (0);
+}
+
+/*
  * Determine if MSI is blacklisted globally on this sytem.  Currently,
  * we just check for blacklisted chipsets as represented by the
  * host-PCI bridge at device 0:0:0.  In the future, it may become
@@ -1786,8 +1810,14 @@ pci_msi_blacklisted(void)
 		return (0);
 
 	/* Blacklist all non-PCI-express and non-PCI-X chipsets. */
-	if (!(pcie_chipset || pcix_chipset))
+	if (!(pcie_chipset || pcix_chipset)) {
+		if (vm_guest != VM_GUEST_NO) {
+			dev = pci_find_bsf(0, 0, 0);
+			if (dev != NULL)
+				return (pci_msi_vm_chipset(dev) == 0);
+		}
 		return (1);
+	}
 
 	dev = pci_find_bsf(0, 0, 0);
 	if (dev != NULL)

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:19:16 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC38E106564A;
	Thu,  4 Nov 2010 17:19: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 9A5228FC0C;
	Thu,  4 Nov 2010 17:19: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 oA4HJGnU066775;
	Thu, 4 Nov 2010 17:19:16 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4HJGaU066772;
	Thu, 4 Nov 2010 17:19:16 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041719.oA4HJGaU066772@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 17:19:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214788 - in stable/8/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:19:16 -0000

Author: jhb
Date: Thu Nov  4 17:19:16 2010
New Revision: 214788
URL: http://svn.freebsd.org/changeset/base/214788

Log:
  MFC 214448:
  Use 'PCPU_GET(apic_id)' to determine the BSP's APIC ID on a UP machine
  when routing interrupts instead of cpu_apic_ids[0] since cpu_apic_ids[]
  is only populated for multiple-CPU machines.  This also matches what the
  code does when SMP is not enabled.

Modified:
  stable/8/sys/amd64/amd64/intr_machdep.c
  stable/8/sys/i386/i386/intr_machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/amd64/amd64/intr_machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/intr_machdep.c	Thu Nov  4 17:13:30 2010	(r214787)
+++ stable/8/sys/amd64/amd64/intr_machdep.c	Thu Nov  4 17:19:16 2010	(r214788)
@@ -458,7 +458,7 @@ intr_next_cpu(void)
 
 	/* Leave all interrupts on the BSP during boot. */
 	if (!assign_cpu)
-		return (cpu_apic_ids[0]);
+		return (PCPU_GET(apic_id));
 
 	mtx_lock_spin(&icu_lock);
 	apic_id = cpu_apic_ids[current_cpu];

Modified: stable/8/sys/i386/i386/intr_machdep.c
==============================================================================
--- stable/8/sys/i386/i386/intr_machdep.c	Thu Nov  4 17:13:30 2010	(r214787)
+++ stable/8/sys/i386/i386/intr_machdep.c	Thu Nov  4 17:19:16 2010	(r214788)
@@ -424,7 +424,7 @@ intr_next_cpu(void)
 
 	/* Leave all interrupts on the BSP during boot. */
 	if (!assign_cpu)
-		return (cpu_apic_ids[0]);
+		return (PCPU_GET(apic_id));
 
 	mtx_lock_spin(&icu_lock);
 	apic_id = cpu_apic_ids[current_cpu];

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:22:49 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E5F65106564A;
	Thu,  4 Nov 2010 17:22:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D44AC8FC12;
	Thu,  4 Nov 2010 17:22:49 +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 oA4HMnwP066916;
	Thu, 4 Nov 2010 17:22:49 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4HMn77066914;
	Thu, 4 Nov 2010 17:22:49 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041722.oA4HMn77066914@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 17:22:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214789 - stable/8/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:22:50 -0000

Author: jhb
Date: Thu Nov  4 17:22:49 2010
New Revision: 214789
URL: http://svn.freebsd.org/changeset/base/214789

Log:
  MFC 214449:
  Set bootverbose directly in mi_startup() rather than via a SYSINIT.  This
  ensures 'bootverbose' is in a valid state for all SYSINITs.

Modified:
  stable/8/sys/kern/init_main.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/kern/init_main.c
==============================================================================
--- stable/8/sys/kern/init_main.c	Thu Nov  4 17:19:16 2010	(r214788)
+++ stable/8/sys/kern/init_main.c	Thu Nov  4 17:22:49 2010	(r214789)
@@ -178,6 +178,9 @@ mi_startup(void)
 	int verbose;
 #endif
 
+	if (boothowto & RB_VERBOSE)
+		bootverbose++;
+
 	if (sysinit == NULL) {
 		sysinit = SET_BEGIN(sysinit_set);
 		sysinit_end = SET_LIMIT(sysinit_set);
@@ -325,15 +328,6 @@ SYSINIT(diagwarn2, SI_SUB_RUN_SCHEDULER,
     print_caddr_t, diag_warn);
 #endif
 
-static void
-set_boot_verbose(void *data __unused)
-{
-
-	if (boothowto & RB_VERBOSE)
-		bootverbose++;
-}
-SYSINIT(boot_verbose, SI_SUB_TUNABLES, SI_ORDER_ANY, set_boot_verbose, NULL);
-
 static int
 null_fetch_syscall_args(struct thread *td __unused,
     struct syscall_args *sa __unused)

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:23:07 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F1D61065673;
	Thu,  4 Nov 2010 17:23:07 +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 3DB1F8FC16;
	Thu,  4 Nov 2010 17:23: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 oA4HN72E066963;
	Thu, 4 Nov 2010 17:23:07 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4HN7ji066961;
	Thu, 4 Nov 2010 17:23:07 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041723.oA4HN7ji066961@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 17:23:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214790 - stable/7/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:23:07 -0000

Author: jhb
Date: Thu Nov  4 17:23:06 2010
New Revision: 214790
URL: http://svn.freebsd.org/changeset/base/214790

Log:
  MFC 214449:
  Set bootverbose directly in mi_startup() rather than via a SYSINIT.  This
  ensures 'bootverbose' is in a valid state for all SYSINITs.

Modified:
  stable/7/sys/kern/init_main.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/init_main.c
==============================================================================
--- stable/7/sys/kern/init_main.c	Thu Nov  4 17:22:49 2010	(r214789)
+++ stable/7/sys/kern/init_main.c	Thu Nov  4 17:23:06 2010	(r214790)
@@ -178,6 +178,9 @@ mi_startup(void)
 	int verbose;
 #endif
 
+	if (boothowto & RB_VERBOSE)
+		bootverbose++;
+
 	if (sysinit == NULL) {
 		sysinit = SET_BEGIN(sysinit_set);
 		sysinit_end = SET_LIMIT(sysinit_set);
@@ -325,15 +328,6 @@ SYSINIT(diagwarn2, SI_SUB_RUN_SCHEDULER,
     print_caddr_t, diag_warn);
 #endif
 
-static void
-set_boot_verbose(void *data __unused)
-{
-
-	if (boothowto & RB_VERBOSE)
-		bootverbose++;
-}
-SYSINIT(boot_verbose, SI_SUB_TUNABLES, SI_ORDER_ANY, set_boot_verbose, NULL);
-
 struct sysentvec null_sysvec = {
 	.sv_size	= 0,
 	.sv_table	= NULL,

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:25:31 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 63686106566B;
	Thu,  4 Nov 2010 17:25: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 5194D8FC16;
	Thu,  4 Nov 2010 17:25: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 oA4HPVR6067096;
	Thu, 4 Nov 2010 17:25:31 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4HPVtQ067094;
	Thu, 4 Nov 2010 17:25:31 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041725.oA4HPVtQ067094@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 17:25:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214791 - stable/8/usr.bin/kdump
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:25:31 -0000

Author: jhb
Date: Thu Nov  4 17:25:31 2010
New Revision: 214791
URL: http://svn.freebsd.org/changeset/base/214791

Log:
  MFC 214625: Correct the abbreviations for general I/O and signal traces.

Modified:
  stable/8/usr.bin/kdump/kdump.1
Directory Properties:
  stable/8/usr.bin/kdump/   (props changed)

Modified: stable/8/usr.bin/kdump/kdump.1
==============================================================================
--- stable/8/usr.bin/kdump/kdump.1	Thu Nov  4 17:23:06 2010	(r214790)
+++ stable/8/usr.bin/kdump/kdump.1	Thu Nov  4 17:25:31 2010	(r214791)
@@ -162,13 +162,13 @@ Seven bytes were written by the
 system call, so 7 is the return value.
 .Pp
 The possible operations are:
-.Bl -column -offset indent ".Li GENIO" ".No data from user process"
+.Bl -column -offset indent ".Li CALL" ".No data from user process"
 .It Sy Name Ta Sy Operation Ta Sy Fourth field
 .It Li CALL Ta enter syscall Ta syscall name and arguments
 .It Li RET Ta return from syscall Ta syscall name and return value
 .It Li NAMI Ta file name lookup Ta path to file
-.It Li GENIO Ta general I/O Ta fd, read/write, number of bytes
-.It Li SIG Ta signal Ta signal name, handler, mask, code
+.It Li GIO Ta general I/O Ta fd, read/write, number of bytes
+.It Li PSIG Ta signal Ta signal name, handler, mask, code
 .It Li CSW Ta context switch Ta stop/resume user/kernel
 .It Li USER Ta data from user process Ta the data
 .It Li STRU Ta various syscalls Ta structure

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:25:41 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 44AC010656C3;
	Thu,  4 Nov 2010 17:25: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 32C788FC0A;
	Thu,  4 Nov 2010 17: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 oA4HPfLP067134;
	Thu, 4 Nov 2010 17:25:41 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4HPfct067132;
	Thu, 4 Nov 2010 17:25:41 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201011041725.oA4HPfct067132@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 4 Nov 2010 17:25:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214792 - stable/7/usr.bin/kdump
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:25:41 -0000

Author: jhb
Date: Thu Nov  4 17:25:40 2010
New Revision: 214792
URL: http://svn.freebsd.org/changeset/base/214792

Log:
  MFC 214625: Correct the abbreviations for general I/O and signal traces.

Modified:
  stable/7/usr.bin/kdump/kdump.1
Directory Properties:
  stable/7/usr.bin/kdump/   (props changed)

Modified: stable/7/usr.bin/kdump/kdump.1
==============================================================================
--- stable/7/usr.bin/kdump/kdump.1	Thu Nov  4 17:25:31 2010	(r214791)
+++ stable/7/usr.bin/kdump/kdump.1	Thu Nov  4 17:25:40 2010	(r214792)
@@ -162,13 +162,13 @@ Seven bytes were written by the
 system call, so 7 is the return value.
 .Pp
 The possible operations are:
-.Bl -column -offset indent ".Li GENIO" ".No data from user process"
+.Bl -column -offset indent ".Li CALL" ".No data from user process"
 .It Sy Name Ta Sy Operation Ta Sy Fourth field
 .It Li CALL Ta enter syscall Ta syscall name and arguments
 .It Li RET Ta return from syscall Ta syscall name and return value
 .It Li NAMI Ta file name lookup Ta path to file
-.It Li GENIO Ta general I/O Ta fd, read/write, number of bytes
-.It Li SIG Ta signal Ta signal name, handler, mask, code
+.It Li GIO Ta general I/O Ta fd, read/write, number of bytes
+.It Li PSIG Ta signal Ta signal name, handler, mask, code
 .It Li CSW Ta context switch Ta stop/resume user/kernel
 .It Li USER Ta data from user process Ta the data
 .It Li STRU Ta various syscalls Ta structure

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 17:49:36 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BC5A1106564A;
	Thu,  4 Nov 2010 17:49:36 +0000 (UTC)
	(envelope-from mavbsd@gmail.com)
Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com
	[209.85.213.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 471528FC08;
	Thu,  4 Nov 2010 17:49:35 +0000 (UTC)
Received: by yxl31 with SMTP id 31so1668105yxl.13
	for ; Thu, 04 Nov 2010 10:49:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:sender:message-id:date:from
	:user-agent:mime-version:to:cc:subject:references:in-reply-to
	:x-enigmail-version:content-type:content-transfer-encoding;
	bh=qSAwPhemYgoUD0SkwlpBjFngPDREfxz42bIXaLGscCg=;
	b=rzjvMNEFVvq9/4I7xT3kM8gasAyvfXxuF2nZ8k465AmlP33kxHcr43dS9eK9/MAZcK
	OPEZkjoBObzqizYhk11HAEgRCfBmJTCdSGg7bptRA1hy3E/T5AaU3eVaM8N4OMPCNjnK
	E2zPe9qfFjN22SMCu7JbRdFd6pR+qfI4f7yuo=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:x-enigmail-version:content-type
	:content-transfer-encoding;
	b=JJ6XbezopNRr0kUAIsOMAua6PyexDNHd0dNf79TRbqTS+ljX4PYO/pTQz0LhN/OqBz
	3ljs1OUplKAKi6F5wu4egg6YRJkP+7U6pKTiUI8iMZlXADwEsenepe5qJVlaRRX7HXrq
	oKZBF9qRf1AJzhqij/dJkPFKhopDuvCk9fViM=
Received: by 10.204.54.16 with SMTP id o16mr903275bkg.196.1288892974453;
	Thu, 04 Nov 2010 10:49:34 -0700 (PDT)
Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226])
	by mx.google.com with ESMTPS id 4sm196705bki.1.2010.11.04.10.49.31
	(version=SSLv3 cipher=RC4-MD5); Thu, 04 Nov 2010 10:49:33 -0700 (PDT)
Sender: Alexander Motin 
Message-ID: <4CD2F224.1040008@FreeBSD.org>
Date: Thu, 04 Nov 2010 19:49:24 +0200
From: Alexander Motin 
User-Agent: Thunderbird 2.0.0.23 (X11/20091212)
MIME-Version: 1.0
To: Bruce Cran 
References: <201011041524.oA4FOWd7063812@svn.freebsd.org>
In-Reply-To: <201011041524.oA4FOWd7063812@svn.freebsd.org>
X-Enigmail-Version: 0.96.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r214781 - head/sbin/camcontrol
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 17:49:36 -0000

Bruce Cran wrote:
> Author: brucec
> Date: Thu Nov  4 15:24:32 2010
> New Revision: 214781
> URL: http://svn.freebsd.org/changeset/base/214781
> 
> Log:
>   Fix standby timer calculation: the timer was being set 30 minutes later
>   than the user requested.
>   Also, 21 minutes is encoded as 252 and 22-29 minutes cannot be encoded
>   so must be rounded up to 30.
>   
>   PR:	bin/151871
> 
> Modified:
>   head/sbin/camcontrol/camcontrol.c
> 
> Modified: head/sbin/camcontrol/camcontrol.c
> ==============================================================================
> --- head/sbin/camcontrol/camcontrol.c	Thu Nov  4 12:33:07 2010	(r214780)
> +++ head/sbin/camcontrol/camcontrol.c	Thu Nov  4 15:24:32 2010	(r214781)
> @@ -4316,10 +4316,17 @@ atapm(struct cam_device *device, int arg
>  		sc = 0;
>  	else if (t <= (240 * 5))
>  		sc = t / 5;
> +	else if (t == (252 * 5))

There should be "<=".

> +		/* special encoding for 21 minutes */
> +		sc = 252;
> +	else if (t < (30 * 60))
> +		/* no encoding exists for 22-29 minutes, so set to 30 mins */
> +		sc = 241;
>  	else if (t <= (11 * 30 * 60))
> -		sc = t / (30 * 60) + 241;
> +		sc = t / (30 * 60) + 240;

This will round period down. You will get 30 minutes instead of 59. In
this case rounding up IMHO more appropriate. I agree that previous
rounding up was over aggressive. I would prefer something like:
		sc = (t - 1) / (30 * 60) + 241;
or at least
		sc = (t + 15 * 60) / (30 * 60) + 240;
This will also make previous range unneeded.

Range "t <= (240 * 5)" probably also should be corrected to round up or
at least closest.

-- 
Alexander Motin

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 18:00:26 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 545141065673;
	Thu,  4 Nov 2010 18:00:26 +0000 (UTC)
	(envelope-from philip@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 432B88FC18;
	Thu,  4 Nov 2010 18:00: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 oA4I0QFt067939;
	Thu, 4 Nov 2010 18:00:26 GMT (envelope-from philip@svn.freebsd.org)
Received: (from philip@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4I0QP8067937;
	Thu, 4 Nov 2010 18:00:26 GMT (envelope-from philip@svn.freebsd.org)
Message-Id: <201011041800.oA4I0QP8067937@svn.freebsd.org>
From: Philip Paeps 
Date: Thu, 4 Nov 2010 18:00:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-svnadmin@freebsd.org
X-SVN-Group: svnadmin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214793 - svnadmin/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 18:00:26 -0000

Author: philip
Date: Thu Nov  4 18:00:25 2010
New Revision: 214793
URL: http://svn.freebsd.org/changeset/base/214793

Log:
  Take snb's and rink's commit bits for safekeeping per their request.
  
  Approved by:	core

Modified:
  svnadmin/conf/access

Modified: svnadmin/conf/access
==============================================================================
--- svnadmin/conf/access	Thu Nov  4 17:25:40 2010	(r214792)
+++ svnadmin/conf/access	Thu Nov  4 18:00:25 2010	(r214793)
@@ -188,7 +188,6 @@ randi
 rdivacky
 remko
 rik
-rink
 rmacklem
 rnoland
 roberto
@@ -211,7 +210,6 @@ sepotvin
 silby
 simokawa
 simon
-snb
 sobomax
 sos	commit@deepcore.dk
 sson

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 18:43:57 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B99661065673;
	Thu,  4 Nov 2010 18:43:57 +0000 (UTC)
	(envelope-from bschmidt@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A75C68FC19;
	Thu,  4 Nov 2010 18:43: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 oA4IhvRA069355;
	Thu, 4 Nov 2010 18:43:57 GMT (envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4IhvWF069351;
	Thu, 4 Nov 2010 18:43:57 GMT (envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201011041843.oA4IhvWF069351@svn.freebsd.org>
From: Bernhard Schmidt 
Date: Thu, 4 Nov 2010 18:43: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: r214798 - head/sys/compat/ndis
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 18:43:57 -0000

Author: bschmidt
Date: Thu Nov  4 18:43:57 2010
New Revision: 214798
URL: http://svn.freebsd.org/changeset/base/214798

Log:
  Remove 4.x, 5.x and 6.x compatibility bits.
  
  Submitted by:	Paul B Mahol 

Modified:
  head/sys/compat/ndis/kern_ndis.c
  head/sys/compat/ndis/subr_ndis.c
  head/sys/compat/ndis/subr_ntoskrnl.c

Modified: head/sys/compat/ndis/kern_ndis.c
==============================================================================
--- head/sys/compat/ndis/kern_ndis.c	Thu Nov  4 18:40:29 2010	(r214797)
+++ head/sys/compat/ndis/kern_ndis.c	Thu Nov  4 18:43:57 2010	(r214798)
@@ -287,15 +287,6 @@ ndis_create_sysctls(arg)
 
 	TAILQ_INIT(&sc->ndis_cfglist_head);
 
-#if __FreeBSD_version < 502113
-	/* Create the sysctl tree. */
-
-	sc->ndis_tree = SYSCTL_ADD_NODE(&sc->ndis_ctx,
-	    SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-	    device_get_nameunit(sc->ndis_dev), CTLFLAG_RD, 0,
-	    device_get_desc(sc->ndis_dev));
-
-#endif
 	/* Add the driver-specific registry keys. */
 
 	while(1) {
@@ -310,11 +301,7 @@ ndis_create_sysctls(arg)
 		/* See if we already have a sysctl with this name */
 
 		oidp = NULL;
-#if __FreeBSD_version < 502113
-		TAILQ_FOREACH(e, &sc->ndis_ctx, link) {
-#else
 		TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
-#endif
 			oidp = e->entry;
 			if (strcasecmp(oidp->oid_name, vals->nc_cfgkey) == 0)
 				break;
@@ -395,18 +382,11 @@ ndis_add_sysctl(arg, key, desc, val, fla
 	TAILQ_INSERT_TAIL(&sc->ndis_cfglist_head, cfg, link);
 
 	cfg->ndis_oid =
-#if __FreeBSD_version < 502113
-	SYSCTL_ADD_STRING(&sc->ndis_ctx, SYSCTL_CHILDREN(sc->ndis_tree),
-	    OID_AUTO, cfg->ndis_cfg.nc_cfgkey, flag,
-	    cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val),
-	    cfg->ndis_cfg.nc_cfgdesc);
-#else
 	SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev),
 	    SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)),
 	    OID_AUTO, cfg->ndis_cfg.nc_cfgkey, flag,
 	    cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val),
 	    cfg->ndis_cfg.nc_cfgdesc);
-#endif
 
 	return (0);
 }
@@ -428,11 +408,7 @@ ndis_flush_sysctls(arg)
 
 	sc = arg;
 
-#if __FreeBSD_version < 502113
-	clist = &sc->ndis_ctx;
-#else
 	clist = device_get_sysctl_ctx(sc->ndis_dev);
-#endif
 
 	while (!TAILQ_EMPTY(&sc->ndis_cfglist_head)) {
 		cfg = TAILQ_FIRST(&sc->ndis_cfglist_head);

Modified: head/sys/compat/ndis/subr_ndis.c
==============================================================================
--- head/sys/compat/ndis/subr_ndis.c	Thu Nov  4 18:40:29 2010	(r214797)
+++ head/sys/compat/ndis/subr_ndis.c	Thu Nov  4 18:43:57 2010	(r214798)
@@ -639,11 +639,7 @@ NdisReadConfiguration(status, parm, cfg,
 	 * See if registry key is already in a list of known keys
 	 * included with the driver.
 	 */
-#if __FreeBSD_version < 502113
-	TAILQ_FOREACH(e, &sc->ndis_ctx, link) {
-#else
 	TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
-#endif
 		oidp = e->entry;
 		if (strcasecmp(oidp->oid_name, keystr) == 0) {
 			if (strcmp((char *)oidp->oid_arg1, "UNSET") == 0) {
@@ -746,11 +742,7 @@ NdisWriteConfiguration(status, cfg, key,
 
 	/* See if the key already exists. */
 
-#if __FreeBSD_version < 502113
-	TAILQ_FOREACH(e, &sc->ndis_ctx, link) {
-#else
 	TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
-#endif
 		oidp = e->entry;
 		if (strcasecmp(oidp->oid_name, keystr) == 0) {
 			/* Found it, set the value. */
@@ -1318,23 +1310,11 @@ NdisReadNetworkAddress(status, addr, add
 		return;
 	}
 
-#ifdef IFP2ENADDR
-	if (bcmp(IFP2ENADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0)
-#elif __FreeBSD_version >= 700000
 	if (sc->ifp->if_addr == NULL ||
 	    bcmp(IF_LLADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0)
-#else
-	if (bcmp(sc->arpcom.ac_enaddr, empty, ETHER_ADDR_LEN) == 0)
-#endif
 		*status = NDIS_STATUS_FAILURE;
 	else {
-#ifdef IFP2ENADDR
-		*addr = IFP2ENADDR(sc->ifp);
-#elif __FreeBSD_version >= 700000
 		*addr = IF_LLADDR(sc->ifp);
-#else
-		*addr = sc->arpcom.ac_enaddr;
-#endif
 		*addrlen = ETHER_ADDR_LEN;
 		*status = NDIS_STATUS_SUCCESS;
 	}

Modified: head/sys/compat/ndis/subr_ntoskrnl.c
==============================================================================
--- head/sys/compat/ndis/subr_ntoskrnl.c	Thu Nov  4 18:40:29 2010	(r214797)
+++ head/sys/compat/ndis/subr_ntoskrnl.c	Thu Nov  4 18:43:57 2010	(r214798)
@@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#if __FreeBSD_version > 502113
 #include 
-#endif
 #include 
 #include 
 #include 
@@ -2602,11 +2600,7 @@ ntoskrnl_finddev(dev, paddr, res)
 
 	rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev);
 	if (rl != NULL) {
-#if __FreeBSD_version < 600022
-		SLIST_FOREACH(rle, rl, link) {
-#else
 		STAILQ_FOREACH(rle, rl, link) {
-#endif
 			r = rle->res;
 
 			if (r == NULL)
@@ -2698,9 +2692,6 @@ ntoskrnl_workitem_thread(arg)
 		KeReleaseSpinLock(&kq->kq_lock, irql);
 	}
 
-#if __FreeBSD_version < 502113
-	mtx_lock(&Giant);
-#endif
 	kproc_exit(0);
 	return; /* notreached */
 }
@@ -3429,9 +3420,6 @@ PsTerminateSystemThread(status)
 
 	ntoskrnl_kth--;
 
-#if __FreeBSD_version < 502113
-	mtx_lock(&Giant);
-#endif
 	kproc_exit(0);
 	return (0);	/* notreached */
 }
@@ -3453,11 +3441,7 @@ static void
 DbgBreakPoint(void)
 {
 
-#if __FreeBSD_version < 502113
-	Debugger("DbgBreakPoint(): breakpoint");
-#else
 	kdb_enter(KDB_WHY_NDIS, "DbgBreakPoint(): breakpoint");
-#endif
 }
 
 static void
@@ -3697,14 +3681,9 @@ ntoskrnl_dpc_thread(arg)
 
 	thread_lock(curthread);
 #ifdef NTOSKRNL_MULTIPLE_DPCS
-#if __FreeBSD_version >= 502102
 	sched_bind(curthread, kq->kq_cpu);
 #endif
-#endif
 	sched_prio(curthread, PRI_MIN_KERN);
-#if __FreeBSD_version < 600000
-	curthread->td_base_pri = PRI_MIN_KERN;
-#endif
 	thread_unlock(curthread);
 
 	while (1) {
@@ -3737,9 +3716,6 @@ ntoskrnl_dpc_thread(arg)
 		KeSetEvent(&kq->kq_done, IO_NO_INCREMENT, FALSE);
 	}
 
-#if __FreeBSD_version < 502113
-	mtx_lock(&Giant);
-#endif
 	kproc_exit(0);
 	return; /* notreached */
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 19:05:35 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C9D671065674;
	Thu,  4 Nov 2010 19:05:35 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B80398FC21;
	Thu,  4 Nov 2010 19:05: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 oA4J5Z1f070000;
	Thu, 4 Nov 2010 19:05:35 GMT (envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4J5Zfd069997;
	Thu, 4 Nov 2010 19:05:35 GMT (envelope-from hselasky@svn.freebsd.org)
Message-Id: <201011041905.oA4J5Zfd069997@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 4 Nov 2010 19:05: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: r214800 - in head/sys/dev/usb: . quirk
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 19:05:35 -0000

Author: hselasky
Date: Thu Nov  4 19:05:35 2010
New Revision: 214800
URL: http://svn.freebsd.org/changeset/base/214800

Log:
  Add new USB quirk.
  
  Submitted by:	Dmitry Luhtionov
  Approved by:	thompsa (mentor)

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==============================================================================
--- head/sys/dev/usb/quirk/usb_quirk.c	Thu Nov  4 18:57:51 2010	(r214799)
+++ head/sys/dev/usb/quirk/usb_quirk.c	Thu Nov  4 19:05:35 2010	(r214800)
@@ -120,6 +120,7 @@ static struct usb_quirk_entry usb_quirks
 	USB_QUIRK(MGE, UPS2, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(APPLE, IPHONE, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(APPLE, IPHONE_3G, 0x0000, 0xffff, UQ_HID_IGNORE),
+	USB_QUIRK(MEGATEC, UPS, 0x0000, 0xffff, UQ_HID_IGNORE),
 	/* Devices which should be ignored by both ukbd and uhid */
 	USB_QUIRK(CYPRESS, WISPY1A, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE),
 	USB_QUIRK(METAGEEK, WISPY1B, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE),

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Thu Nov  4 18:57:51 2010	(r214799)
+++ head/sys/dev/usb/usbdevs	Thu Nov  4 19:05:35 2010	(r214800)
@@ -2518,7 +2518,7 @@ product PHILIPS RT2870		0x200f	RT2870
 product PHILIPSSEMI HUB1122	0x1122	HUB
 
 /* Megatec */
-product MEGATEC UPS		0x5161	Protocol based UPS
+product MEGATEC UPS		0x5161	Phoenixtec protocol based UPS
 
 /* P.I. Engineering products */
 product PIENGINEERING PS2USB	0x020b	PS2 to Mac USB Adapter

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 19:18:33 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12B701065698;
	Thu,  4 Nov 2010 19:18:33 +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 F2C7E8FC23;
	Thu,  4 Nov 2010 19:18: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 oA4JIWqn070347;
	Thu, 4 Nov 2010 19:18:32 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4JIWCT070343;
	Thu, 4 Nov 2010 19:18:32 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201011041918.oA4JIWCT070343@svn.freebsd.org>
From: Doug Barton 
Date: Thu, 4 Nov 2010 19:18:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214802 - in vendor/bind9/dist-9.4: . bin/named doc/arm
	doc/draft doc/rfc lib/dns lib/dns/include/dns
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 19:18:33 -0000

Author: dougb
Date: Thu Nov  4 19:18:32 2010
New Revision: 214802
URL: http://svn.freebsd.org/changeset/base/214802

Log:
  Vendor import of BIND 9.4-ESV-R3

Added:
  vendor/bind9/dist-9.4/doc/draft/draft-ietf-behave-dns64-10.txt   (contents, props changed)
  vendor/bind9/dist-9.4/doc/draft/draft-ietf-dnsext-dnssec-registry-fixes-06.txt   (contents, props changed)
  vendor/bind9/dist-9.4/doc/draft/draft-ietf-dnsop-dnssec-key-timing-00.txt   (contents, props changed)
  vendor/bind9/dist-9.4/doc/draft/draft-mekking-dnsop-auto-cpsync-00.txt   (contents, props changed)
  vendor/bind9/dist-9.4/doc/draft/draft-yao-dnsext-bname-04.txt   (contents, props changed)
  vendor/bind9/dist-9.4/doc/rfc/rfc5933.txt   (contents, props changed)
Deleted:
  vendor/bind9/dist-9.4/doc/draft/draft-ietf-behave-dns64-09.txt
  vendor/bind9/dist-9.4/doc/draft/draft-ietf-dnsext-dnssec-gost-07.txt
Modified:
  vendor/bind9/dist-9.4/CHANGES
  vendor/bind9/dist-9.4/bin/named/query.c
  vendor/bind9/dist-9.4/doc/arm/isc-logo.eps
  vendor/bind9/dist-9.4/doc/arm/isc-logo.pdf
  vendor/bind9/dist-9.4/doc/rfc/index
  vendor/bind9/dist-9.4/lib/dns/api
  vendor/bind9/dist-9.4/lib/dns/include/dns/ncache.h
  vendor/bind9/dist-9.4/lib/dns/include/dns/types.h
  vendor/bind9/dist-9.4/lib/dns/ncache.c
  vendor/bind9/dist-9.4/lib/dns/resolver.c
  vendor/bind9/dist-9.4/lib/dns/validator.c
  vendor/bind9/dist-9.4/version

Modified: vendor/bind9/dist-9.4/CHANGES
==============================================================================
--- vendor/bind9/dist-9.4/CHANGES	Thu Nov  4 19:07:52 2010	(r214801)
+++ vendor/bind9/dist-9.4/CHANGES	Thu Nov  4 19:18:32 2010	(r214802)
@@ -1,3 +1,32 @@
+	--- 9.4-ESV-R3 released ---
+
+2925.	[bug]		Named failed to accept uncachable negative responses
+			from insecure zones. [RT# 21555]
+
+2921.	[bug]		The resolver could attempt to destroy a fetch context
+			too soon.  [RT #19878]
+
+2904.   [bug]           When using DLV, sub-zones of the zones in the DLV,
+			could be incorrectly marked as insecure instead of
+			secure leading to negative proofs failing.  This was
+			a unintended outcome from change 2890. [RT# 21392]
+
+2900.	[bug]	 	The placeholder negative caching element was not
+			properly constructed triggering a INSIST in 
+			dns_ncache_towire(). [RT #21346]
+
+2890.	[bug]		Handle the introduction of new trusted-keys and
+			DS, DLV RRsets better. [RT #21097]
+
+2869.	[bug]		Fix arguments to dns_keytable_findnextkeynode() call.
+			[RT #20877]
+
+2678.	[func]		Treat DS queries as if "minimal-response yes;"
+			was set. [RT #20258]
+
+2427.	[func]		Treat DNSKEY queries as if "minimal-response yes;"
+			was set. [RT #18528]
+
 	--- 9.4-ESV-R2 released ---
 
 2876.	[bug]		Named could return SERVFAIL for negative responses

Modified: vendor/bind9/dist-9.4/bin/named/query.c
==============================================================================
--- vendor/bind9/dist-9.4/bin/named/query.c	Thu Nov  4 19:07:52 2010	(r214801)
+++ vendor/bind9/dist-9.4/bin/named/query.c	Thu Nov  4 19:18:32 2010	(r214802)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2010  Internet Systems Consortium, Inc. ("ISC")
  * Copyright (C) 1999-2003  Internet Software Consortium.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: query.c,v 1.257.18.53 2009/12/30 08:55:48 jinmei Exp $ */
+/* $Id: query.c,v 1.257.18.55 2010/07/03 23:45:26 tbox Exp $ */
 
 /*! \file */
 
@@ -4654,6 +4654,13 @@ ns_query_start(ns_client_t *client) {
 	}
 
 	/*
+	 * Turn on minimal response for DNSKEY and DS queries.
+	 */
+	if (qtype == dns_rdatatype_dnskey || qtype == dns_rdatatype_ds)
+		client->query.attributes |= (NS_QUERYATTR_NOAUTHORITY |
+					     NS_QUERYATTR_NOADDITIONAL);
+
+	/*
 	 * If the client has requested that DNSSEC checking be disabled,
 	 * allow lookups to return pending data and instruct the resolver
 	 * to return data before validation has completed.

Modified: vendor/bind9/dist-9.4/doc/arm/isc-logo.eps
==============================================================================
--- vendor/bind9/dist-9.4/doc/arm/isc-logo.eps	Thu Nov  4 19:07:52 2010	(r214801)
+++ vendor/bind9/dist-9.4/doc/arm/isc-logo.eps	Thu Nov  4 19:18:32 2010	(r214802)
@@ -1,255 +1,63 @@
 %!PS-Adobe-3.1 EPSF-3.0
-%%Title: Alternate-ISC-logo-v2.ai
-%%Creator: Adobe Illustrator(R) 11
-%%AI8_CreatorVersion: 11.0.0
-%AI9_PrintingDataBegin
-%%For: Douglas E. Appelt
-%%CreationDate: 10/22/04
-%%BoundingBox: 0 0 255 149
-%%HiResBoundingBox: 0 0 254.8672 148.7520
-%%CropBox: 0 0 254.8672 148.7520
+%ADO_DSC_Encoding: MacOS Roman
+%%Title: ISC_logo_only_RGB.eps
+%%Creator: Adobe Illustrator(R) 13.0
+%%For: Brian Reid
+%%CreationDate: 3/25/10
+%%BoundingBox: 0 0 118 46
+%%HiResBoundingBox: 0 0 117.9991 45.0176
+%%CropBox: 0 0 117.9991 45.0176
 %%LanguageLevel: 2
 %%DocumentData: Clean7Bit
+%ADOBeginClientInjection: DocumentHeader "AI11EPS"
+%%AI8_CreatorVersion: 13.0.2
%AI9_PrintingDataBegin
%ADO_BuildNumber: Adobe Illustrator(R) 13.0.2 x434 R agm 4.4379 ct 5.1039
%ADO_ContainsXMP: MainFirst
+%ADOEndClientInjection: DocumentHeader "AI11EPS"
 %%Pages: 1
-%%DocumentNeededResources:
-%%DocumentSuppliedResources: procset Adobe_AGM_Image (1.0 0)
-%%+ procset Adobe_CoolType_Utility_T42 (1.0 0)
-%%+ procset Adobe_CoolType_Utility_MAKEOCF (1.19 0)
-%%+ procset Adobe_CoolType_Core (2.23 0)
-%%+ procset Adobe_AGM_Core (2.0 0)
-%%+ procset Adobe_AGM_Utils (1.0 0)
-%%DocumentFonts:
-%%DocumentNeededFonts:
-%%DocumentNeededFeatures:
-%%DocumentSuppliedFeatures:
-%%DocumentProcessColors:  Cyan Magenta Yellow Black
-%%DocumentCustomColors: (PANTONE 1805 C)
-%%+ (PANTONE 871 C)
-%%+ (PANTONE 301 C)
-%%+ (PANTONE 7506 C)
-%%CMYKCustomColor: 0 0.9100 1 0.2300 (PANTONE 1805 C)
-%%+ 0.3569 0.3608 0.6353 0.1882 (PANTONE 871 C)
-%%+ 1 0.4500 0 0.1800 (PANTONE 301 C)
-%%+ 0 0.0500 0.1500 0 (PANTONE 7506 C)
-%%RGBCustomColor:
-%ADO_ContainsXMP: MainFirst
-%AI7_Thumbnail: 128 76 8
-%%BeginData: 10692 Hex Bytes
-%0000330000660000990000CC0033000033330033660033990033CC0033FF
-%0066000066330066660066990066CC0066FF009900009933009966009999
-%0099CC0099FF00CC0000CC3300CC6600CC9900CCCC00CCFF00FF3300FF66
-%00FF9900FFCC3300003300333300663300993300CC3300FF333300333333
-%3333663333993333CC3333FF3366003366333366663366993366CC3366FF
-%3399003399333399663399993399CC3399FF33CC0033CC3333CC6633CC99
-%33CCCC33CCFF33FF0033FF3333FF6633FF9933FFCC33FFFF660000660033
-%6600666600996600CC6600FF6633006633336633666633996633CC6633FF
-%6666006666336666666666996666CC6666FF669900669933669966669999
-%6699CC6699FF66CC0066CC3366CC6666CC9966CCCC66CCFF66FF0066FF33
-%66FF6666FF9966FFCC66FFFF9900009900339900669900999900CC9900FF
-%9933009933339933669933999933CC9933FF996600996633996666996699
-%9966CC9966FF9999009999339999669999999999CC9999FF99CC0099CC33
-%99CC6699CC9999CCCC99CCFF99FF0099FF3399FF6699FF9999FFCC99FFFF
-%CC0000CC0033CC0066CC0099CC00CCCC00FFCC3300CC3333CC3366CC3399
-%CC33CCCC33FFCC6600CC6633CC6666CC6699CC66CCCC66FFCC9900CC9933
-%CC9966CC9999CC99CCCC99FFCCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFF
-%CCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFFFF0033FF0066FF0099FF00CC
-%FF3300FF3333FF3366FF3399FF33CCFF33FFFF6600FF6633FF6666FF6699
-%FF66CCFF66FFFF9900FF9933FF9966FF9999FF99CCFF99FFFFCC00FFCC33
-%FFCC66FFCC99FFCCCCFFCCFFFFFF33FFFF66FFFF99FFFFCC110000001100
-%000011111111220000002200000022222222440000004400000044444444
-%550000005500000055555555770000007700000077777777880000008800
-%000088888888AA000000AA000000AAAAAAAABB000000BB000000BBBBBBBB
-%DD000000DD000000DDDDDDDDEE000000EE000000EEEEEEEE0000000000FF
-%00FF0000FFFFFF0000FF00FFFFFF00FFFFFF
-%524C45FD1CF852FD63FFF820272726272727264B27272627272726272727
-%26272727264B20F827FD63FFF827FFFFFFCFFF84365AFFFFFFCFFFFFFFCF
-%FFFFFFCFFD04FFCAF852FD63FFF827CFCFCACFCA2F0607A8CFCACFCACFCA
-%CFCACFCACFCACFCACF7CF827FD63FFF800FFCFFFA8A8070D06A8CFFFCFFF
-%CFFFCFFFCFFFCFFFCFFFCFA7F852FD63FFF800077E2F0D060D060706537D
-%CF7D2FA8CFCACFCACFCACFCAFF7CF827FD63FFF8000D062F070D062F070D
-%062F2F0D062FCACFCFFFCFCFCFFFCFA1F852FD63FFF8050707062E517651
-%522807060706072ECFCACFCACFCACFCAFF7CF827FD63FFF8002F067C757B
-%757C757B512F072F2FFFCFCFCFFFCFFFCFFFCFA1F852FD63FFF805075251
-%75517551755175512F062FCACFCACFCACFCACFCAFF7CF827FD63FFF8F859
-%75765176757C517C757B2E2F07A8CFFFCFCFCFFFCFCFCFA1F852FD63FFF8
-%00517551757CCFCAA751755175060753CFCACFCACFCACFCACF7CF827FD63
-%FFF8F87C75757CFFCFFFCFA7517C752F072F59A8CFCFCFFFCFFFCFA7F852
-%FD04FFA87D527DA8FD5AFFF827757551A1CFCFCAFFA0755175280D060706
-%A8CFCFCACFCAFF7CF827FD05FF27F827FD5BFFF8F87C51767CFFCFFFCFA0
-%517C752F062F060D84FFCFFFCFFFCFA1F852FD05FF7DF87DFD5BFFF80552
-%7551757CC9A7A05175517606072F7E7DCFCACFC9CFCAFF6FF827FD05FF52
-%F852FD27FFA8FD33FFF80059757C7575517C517C517C2E2F06CFCFFFCFCF
-%9293CAFFCF6FF852FD05FF7DF87DFD04FFA8FD05FF7D7DA8FF527D7D7D52
-%7D52A8FFA8527D527DA8FF7D7D527D52FD05FFA8FD05FFA87D7DFFFFA852
-%7D527DA8FF527D7D7D527D52A8FD19FFF805075275755175517551752D0D
-%0653CFFFCFFFA78C6899939344F827FD05FF52F852FFFFFFA8F87DFD04FF
-%7D27FFA87D7DA8F827A87D7DFFA8F827A8527DFFA8F852A827F8A8FFFFFF
-%7DF8FD05FF2752FFFFA8F827A8527DA87D7DA8F827A87D7DFD19FFF8F82F
-%0752517C757B757C2E0D062FA8C999CFCFC28C928C8C8C6EF852FD05FF7D
-%F87DFD04FFF8F87DFFFFFF7D52FD05FFF852FD05FFF87DFD05FFF852FFFF
-%F852FFFFFF7DF8F8FD04FF7D52FFFFFFF87DFD07FFF852FD1CFFF8000607
-%062F2852282E060D0607067D928C9293688C6892688C44F827FD05FF52F8
-%52FFFFFFA85252F852FFFF7D27FD05FFF87DFD04FFA8F852FD05FFF852FF
-%FFF8A8FFFFFF7D5227F8A8FFFF527DFFFFA8F852FD07FFF87DFD1CFFF800
-%852F2F062F070D062F072F062F0D9A8C928C928C928C928C6EF852FD05FF
-%7DF87DFD04FF27FF52F852FF7D52FD05FFF852FD05FFF82752527DFFFFF8
-%52FF527DFD04FF527DFF27F8A8FF7D7DFFFFFFF82752527DFD04FFF852FD
-%1CFFF827CFCF7D2F060D062F2F7EA82F062F938C68928C8C68926E994AF8
-%27FD05FF52F852FFFFFFA827FFFF52F852A852FD05FFF87DFD04FFA8F852
-%FF7DA8FFFFF82752F8A8FD04FF7D52FFA827F8A87D7DFFFFA8F852FF7DA8
-%FD04FFF87DFD1CFFF827FFCFFFA80D062FA8CFCFCA927693928C928C9292
-%75517C7B51F852FD05FF7DF87DFFFFFFA827FFFFFF52F8F87DFD05FFF852
-%FD05FFF87DFD05FFF852FF52F8A8FFFFFF5252FFFFFF27F8277DFFFFFFF8
-%7DFD07FFF852FD1CFFF827CFCFCACF06062ECFCAFF928C688C6892688C6E
-%765175517C26F827FD05FF52F852FFFFFFA827FD04FF52F852FD05FFF852
-%FD04FFA8F852FFFFA8A8FFF87DFFFFF8F8A8FFFF5227FD04FF27F8A8FFFF
-%A8F852FFFFA8A8FFFFFFF852FD1CFFF827FFCFFFCF7E53A8CFFFCFC99292
-%8C928C92757C757C517C7551F852FD04FFA852F852A8FFFFA8F8A8FD04FF
-%527DFD04FF7DF827FD04FFA8F827525252FF7DF827FFFFFF2727A8FF5227
-%A8FD04FF52A8FFFFA8F827525252FFFFFF7DF827FD1CFFF827CFCFCACFCF
-%CFCAFD04CF93688C688C6F7651755175517C4BF827FD05FFA8FFA8FFFFFF
-%A8FFA8FD0BFFA8FFA8FFFFFFA8FFA8A8A8FFFFFFA8FFA8FFFFFFA8FFA8FF
-%A8FD09FFA8FFA8A8A8FD05FFA8FFA8FD1BFFF827FFCFCFCFFFCFCFCFFFCF
-%C38C928C8C6E7C7576517C75767551F852FD63FFF827CFCFCACFCACFCACF
-%92928C8C688C6875517551755175517526F827FD63FFF827FFCFFFCFFFCF
-%FFCA938C928C928C99517C757C517C757C7551F852FD63FFF827CFCFCACF
-%CACFCACFA093688C6892757551755175517551754BF827FD63FFF827FFCF
-%FFCFCFCFFFCFFF998C8C926E7C7576517C7576517CA7A1F852FD06FFA87D
-%527DA8FD58FFF827CFCFCACFCACFCAFFCF996892686F5175517551755175
-%7CFF7CF827FD05FF7D2752A82727A8FD57FFF827FFCFFFCFFFCFFFC2BB8C
-%928C8C6E7C757C517C757C51CFFFA1F852FD05FF2752FFFFFF52FD58FFF8
-%27CFCFCACFCACFCF99688C68928C6F5175517551755175CAFF7CF827FD04
-%FFA8F852FD5CFFF827FFCFCFCFFFCFFFA0998C928C926E7C517C7576517C
-%51CACFA1F852FD04FFA827F87DFFFFFFA8527DFD04FF527DFFFFA87D52A8
-%FF7D527D527D527D7DFF7D7D527D527DFFFFFFA8FD06FFA8FD04FFA87D7D
-%7DFD26FFF827CFCFCACFCACFCACFCF99688C6893517551755175517575FF
-%7CF827FD05FF52F8F852FFFFFF52F8A8FFFF7D27A8FF5252A8A852A852A8
-%7DF827A87D7DFFA8F852A87D52FFFFFFF8A8FD04FF5227FFFFFF7D27A8A8
-%52A8FD25FFF827FFCFFFCFFFCFFFCFFFA08C8C92927C517C757C517C7575
-%7C7CF852FD06FF52F8F852FFFFFF27F8FFFF52A8FFFFF87DFD07FFF87DFD
-%05FFF852FD06FFF827FD04FF2727FFFFFF2752FD29FFF827CFCFCACFCACF
-%CACFA799688C68927575517551755175517526F84BFD07FF52F8F87DFFFF
-%A8F87D7D52FFFFFFF8F87DFD05FFA8F852FD05FFF87DFD05FFA8F8F8A8FF
-%FF7DF8F8A8FFFF52F852A8FD27FFF827FFCFFFCFCFCFFFCF9368928C928C
-%995176517C7576517C7551F852FD08FF7DF8F8FFFFFF52F827FD05FFF8F8
-%27FD05FFF87DFD05FFF8277D527DFFFF7D52F852FFFF277DF8A8FFFFFF52
-%F8F87DFD26FFF827CFCFCACFCACFCAFF938C688C688C6875517551755175
-%517C26F827FD09FF27F8A8FFFFFFF852FD06FF52F827FFFFFFA8F852FD05
-%FFF852A8A87DFFFF527D7DF8FF7D52A8F87DFD04FF7DF8F8A8FD25FFF827
-%FFCFFFCFFFCFFFCFCFCFC98C928C92927C517C757C517C7551F852FD04FF
-%7DFD04FF7DF8FD04FFF852FD07FF7DF8A8FFFFFFF87DFD05FFF852FD05FF
-%52A8FF272752A8FFF87DFD06FFF8A8FD25FFF827CFCFCACFCACFCAFD04CF
-%99688C688C6E7651755175517C4BF827FD04FF5227FFFFA8F852FD04FFF8
-%7DFFFFFF7D7DFFFF7D27FD04FFF852FD05FFF852FFFFA8FFFF27A8FF7DF8
-%52FFFFF852FFA852FFFF7D27A8FD25FFF827FFCFCFCFFFCFCFCFFFCFCF92
-%928C928C926E7C517C75767551F852FD04FF7D272752277DFD04FF7DF827
-%FFFFFF7D27525227FD04FFA8F852A8FFFFFF7D2727525252FFA8F8A8FFFF
-%52FFFFFF2727A8FF275252527DFD26FFF827CFCFCACFCACFCACFCAFF998C
-%688C688C688C68755176517526F827FD07FFA8FD07FFA8FFA8FFFFFFA8A8
-%A8FD05FFA8FFA8FD05FFA8FFA8A8A8FFA8FFA8FD07FFA8FFFFFFA8A8FD28
-%FFF827FFCFFFCFFFCFFFCFFFCFCF92C29A928C928C928C99757C7551F852
-%FD63FFF827CFCFCACFCACFCACFCAFD04CFFF998C68928C8C6892689344F8
-%27FD63FFF827FFCFFFCFCFCFFFCFCFCFFFCFCFCFC98C928C928C928C928C
-%68F852FD63FFF827CFCFCACFCACFCAA8537ECACFCAFF938C6899688C688C
-%689244F827FD63FFF827FFCFFFCFFFCFA8072F07FFCFFFCFCF992F0D5992
-%928C928C68F852FD08FF7D7D527D52A8A8FD54FFF827CFCFCACFCACFA70D
-%060753A87DA8CA5A0607069368929AC244F827FD06FF7DF8527D7D7D52F8
-%27FD54FFF827FFCFCFCFFFCFCF2F2F070D062F072F062F07539993C2FFFF
-%76F852FD05FF7DF87DFD06FF27FD54FFF827CFCFCACFCACF7D0D060D0607
-%060D0607060753FFCACFCAFF76F827FD04FFA8F827FD07FFA8A8FD15FFA8
-%FD3DFFF827FFCFFFCFFF592F062F072F2852282F072F072F7DFFCFFFCFA7
-%F852FD04FF52F87DFD0CFFA87D7D7DFD05FFA8FD05FF7D7DA8FFFFA87D7D
-%7DFFFFFFA87D527D7DFD04FFA8527D527DA8FFFF7D527D527D527D7DFF7D
-%7D7DFFFFA8527DA8FFFFA8527DFFFFFFA8FD06FFA8FFFFF827CF5959CA53
-%07060D066F688C6892684B060D06077DCFCFCF7CF827FD04FF27F8A8FD0A
-%FFA82752A87D52F852FFFFA8F87DFD04FF7D27FFFF7D27A87D52FFFF5227
-%7DA87D27F8A8FFFFA8F827A827F8A8A852A87DF827A87D7DFFA8F852FFFF
-%A8F827FD04FF2727FFFFFFF8A8FD04FF5227FFFFF827A9062F070D062F28
-%928C928C928C928C92282F072F847E5953F852FD04FFF8F8A8FD0AFF2752
-%FD04FF7DF87DFFFFF8F852FFFFFF7D52FFFFF8A8FFFFA8FF7DF8A8FD04FF
-%27F8FFFFFFF87DFFFFF87DFD04FFF87DFD05FFF852FFFFFFF87DFD04FF27
-%52FFFFFFF827FD04FF2727FFFFF8272F07060D060D278C688C68928C8C68
-%8C688C060D0607060D06F827FFFFFFA827F87DFD09FF7DF8FD06FF27F8FF
-%A85252F852FFFF7D27FFFF27F87DFFFFFF2727FD05FF7DF852FFA8F852FF
-%A8F87DFFFFFFA8F852FD05FFF852FFFFA8F852FD04FF5252FFFFA8F8F8A8
-%FFFF7DF827A8FFF827FF2F2F070D06938C928CBCC9CFC9BB8C928C6F070D
-%062F0706F852FD04FF27F852FD09FF52F8FD06FF52F8FFFF27FF52F852FF
-%7D52FFFFA827F827A8FFF852FD06FFF852FFFFF852FF7D7DFD05FFF87DFD
-%05FFF852FFFFFFF87DFD04FF2752FFFF7D52F852FFFF277DF8A8FFF827CF
-%CF2F0D064C689268C2CFFFCFFFCFC2688C682E0607062F52F827FD04FF7D
-%F8F8A8FD08FF52F8A8FD05FF52F8FFA827FFFF52F852A852FD04FF7DF827
-%FF2727FD05FFA8F852FFA8F82752F8A8FD04FFA8F852FD05FFF852FFFFA8
-%F852FD04FF5252FFFF7D7D7DF8FF7D52A8F87DFFF827FFCF59062F6F8C8C
-%99CFFFCFFFCFFFCF938C8C4B2F0759CFA7F852FD05FF52F827FD06FF7DFF
-%A8F852FD05FFF852FFA827FFFFFF52F8F87DFD05FF7DF8FF52F8A8FD04FF
-%A8F8A8FFFFF87DFF52F8FD05FFF87DFD05FFF852FFFFFFF852FD04FF277D
-%FFFF27A8FF272752FFFFF87DFFF827CFCF2F070693688C99FFCACFCACFCA
-%FF998C686F060759CF7CF827FD05FFA852F8F87DFFFFFF5227FFFF52F87D
-%FFFFFF5227A8FFA827FD04FF52F852FF527DFFFF5227FFFFF827A8FFFFFF
-%2752FFFFFFF852FFFF27F8FFFFFFA8F852FD05FFF87DFFFFFF52F8A8FFFF
-%7D27A8FFFF27A8FF7DF852FFFFF827FFF827FFCF53062F6E928CC2FFFFCF
-%FFCFFFCFC28C926F2F077ECFA7F852FD07FFA8FD06277DFFFFFF7D27277D
-%527DFFFFFF7DF8A8FD04FF527DFFA827525252A8FFFFFF5227527D52A8FF
-%FFFFA8F852A8FFA82727A8FFA8F852A8FFFFFF7DF827FD04FF52277D5252
-%A8FFFFA8F8A8FFFF52FFFFFF2727A8F827CFCF2F07066F8C8C92FFCFCFCA
-%CFCFCF8C8C8C4B060D59CF7CF827FD0BFFA8FD09FFA8FD05FFA8FFA8FD09
-%FFA8A8FD07FFA8A8FD05FFA8FFA8FD05FFA8FFA8FFA8FD05FFA8FFA8FD05
-%FFA8FD05FFA8FFA8FD07FFA8FFF827AF2F2F070D4B928C8CA0FFCFFFCFFF
-%998C8C92280D067ECFA1F852FD63FFF8270707060D0607688C688C99C9CA
-%C9938C688C680D0607065A76F827FD63FFF8275A062F070D07528C928C92
-%8C928C928C928C2F070D062F072EF852FD63FFF84B842F597E0607064C8C
-%8C68928C8C688C6828060D0607060D52F827FD63FFF827FFCFCFCF7E060D
-%062F6F928C928C934B2F070D0684A85A59A1F852FD63FFF827CFCFCACFCA
-%590607060D06282728060D0607067ECACFCFCF7CF827FD63FFF827FFCFFF
-%CFFFCF59062F070D072F070D062F2FA8CFFFCFFFCFA7F852FD63FFF827CF
-%CFCACFCACF2F07060D0607060D06070653CFCFCACFCAFF7CF827FD63FFF8
-%27FFCFFFCFCFA82F070D59CFA8A8A859060D07FD04CFFFCFA1F852FD63FF
-%F827CFCFCACFCFA82F0D2FCFCACFCFCFA80D060DA8CFCACFCAFF7CF827FD
-%63FFF827FFCFFFCFFFCFFFA8FFCFFFCFFFCFFF7E7EA8FFCFFFCFFFFFA7F8
-%52FD63FFFD09F820FD07F820FD07F820F8F827FD63FF27F827F820F827F8
-%20F827F820F827F820F827F820F827F820F827F87CFDE2FFFF
-%%EndData
+%%DocumentNeededResources: 
+%%DocumentSuppliedResources: procset Adobe_AGM_Image 1.0 0
+%%+ procset Adobe_CoolType_Utility_T42 1.0 0
+%%+ procset Adobe_CoolType_Utility_MAKEOCF 1.23 0
+%%+ procset Adobe_CoolType_Core 2.31 0
+%%+ procset Adobe_AGM_Core 2.0 0
+%%+ procset Adobe_AGM_Utils 1.0 0
+%%DocumentFonts: 
+%%DocumentNeededFonts: 
+%%DocumentNeededFeatures: 
+%%DocumentSuppliedFeatures: 
+%%DocumentCustomColors: 
+%%CMYKCustomColor: 
+%%RGBCustomColor: 
 %%EndComments
+                        
+                                                                                                                                                                                                                                                         
+                                                                                                                                                                                                                                                         
+                                                                                                                                                                                                                                                         
+                                                                                                                                                                                                                                                         
+                                                                                                                                                                                                                                                         
+                                                                                                                                                                                                                                                         
 %%BeginDefaults
 %%ViewingOrientation: 1 0 0 1
 %%EndDefaults
 %%BeginProlog
 %%BeginResource: procset Adobe_AGM_Utils 1.0 0
 %%Version: 1.0 0
-%%Copyright: Copyright (C) 2000-2003 Adobe Systems, Inc.  All Rights Reserved.
-systemdict /setpacking known
-{
-	currentpacking
-	true setpacking
-} if
-userdict /Adobe_AGM_Utils 68 dict dup begin put
+%%Copyright: Copyright(C)2000-2006 Adobe Systems, Inc. All Rights Reserved.
+systemdict/setpacking known
+{currentpacking	true setpacking}if
+userdict/Adobe_AGM_Utils 73 dict dup begin put
 /bdf
-{
-	bind def
-} bind def
-/nd{
-	null def
-}bdf
+{bind def}bind def
+/nd{null def}bdf
 /xdf
-{
-	exch def
-}bdf
-/ldf
-{
-	load def
-}bdf
+{exch def}bdf
+/ldf 
+{load def}bdf
 /ddf
-{
-	put
-}bdf	
+{put}bdf	
 /xddf
-{
-	3 -1 roll put
-}bdf	
+{3 -1 roll put}bdf	
 /xpt
-{
-	exch put
-}bdf
+{exch put}bdf
 /ndf
 {
 	exch dup where{
@@ -266,54 +74,48 @@ userdict /Adobe_AGM_Utils 68 dict dup be
 		exch def
 	}ifelse
 }def
-/bdict
-{
-	mark
-}bdf
-/edict
-{
-	counttomark 2 idiv dup dict begin {def} repeat pop currentdict end
-}def
+/gx
+{get exec}bdf
 /ps_level
 	/languagelevel where{
-		pop systemdict /languagelevel get exec
+		pop systemdict/languagelevel gx
 	}{
 		1
 	}ifelse
 def
-/level2
+/level2 
 	ps_level 2 ge
 def
-/level3
+/level3 
 	ps_level 3 ge
 def
 /ps_version
-	{version cvr} stopped {
-		-1
-	}if
+	{version cvr}stopped{-1}if
 def
+/set_gvm
+{currentglobal exch setglobal}bdf
+/reset_gvm
+{setglobal}bdf
 /makereadonlyarray
 {
-	/packedarray where{
-		pop packedarray
+	/packedarray where{pop packedarray
 	}{
-		array astore readonly
-	}ifelse
+		array astore readonly}ifelse
 }bdf
 /map_reserved_ink_name
 {
-	dup type /stringtype eq{
-		dup /Red eq{
-			pop (_Red_)
+	dup type/stringtype eq{
+		dup/Red eq{
+			pop(_Red_)
 		}{
-			dup /Green eq{
-				pop (_Green_)
+			dup/Green eq{
+				pop(_Green_)
 			}{
-				dup /Blue eq{
-					pop (_Blue_)
+				dup/Blue eq{
+					pop(_Blue_)
 				}{
-					dup () cvn eq{
-						pop (Process)
+					dup()cvn eq{
+						pop(Process)
 					}if
 				}ifelse
 			}ifelse
@@ -329,20 +131,20 @@ def
 	/AGMUTIL_GSTATE_clr_comps 12 array def
 	mark currentcolor counttomark
 		{AGMUTIL_GSTATE_clr_comps AGMUTIL_GSTATE_clr_indx 3 -1 roll put
-		/AGMUTIL_GSTATE_clr_indx AGMUTIL_GSTATE_clr_indx 1 add def} repeat pop
+		/AGMUTIL_GSTATE_clr_indx AGMUTIL_GSTATE_clr_indx 1 add def}repeat pop
 	/AGMUTIL_GSTATE_fnt rootfont def
 	/AGMUTIL_GSTATE_lw currentlinewidth def
 	/AGMUTIL_GSTATE_lc currentlinecap def
 	/AGMUTIL_GSTATE_lj currentlinejoin def
 	/AGMUTIL_GSTATE_ml currentmiterlimit def
-	currentdash /AGMUTIL_GSTATE_do xdf /AGMUTIL_GSTATE_da xdf
+	currentdash/AGMUTIL_GSTATE_do xdf/AGMUTIL_GSTATE_da xdf
 	/AGMUTIL_GSTATE_sa currentstrokeadjust def
 	/AGMUTIL_GSTATE_clr_rnd currentcolorrendering def
 	/AGMUTIL_GSTATE_op currentoverprint def
 	/AGMUTIL_GSTATE_bg currentblackgeneration cvlit def
 	/AGMUTIL_GSTATE_ucr currentundercolorremoval cvlit def
-	currentcolortransfer cvlit /AGMUTIL_GSTATE_gy_xfer xdf cvlit /AGMUTIL_GSTATE_b_xfer xdf
-		cvlit /AGMUTIL_GSTATE_g_xfer xdf cvlit /AGMUTIL_GSTATE_r_xfer xdf
+	currentcolortransfer cvlit/AGMUTIL_GSTATE_gy_xfer xdf cvlit/AGMUTIL_GSTATE_b_xfer xdf
+		cvlit/AGMUTIL_GSTATE_g_xfer xdf cvlit/AGMUTIL_GSTATE_r_xfer xdf
 	/AGMUTIL_GSTATE_ht currenthalftone def
 	/AGMUTIL_GSTATE_flt currentflat def
 	end
@@ -351,8 +153,8 @@ def
 {
 	AGMUTIL_GSTATE begin
 	AGMUTIL_GSTATE_clr_spc setcolorspace
-	AGMUTIL_GSTATE_clr_indx {AGMUTIL_GSTATE_clr_comps AGMUTIL_GSTATE_clr_indx 1 sub get
-	/AGMUTIL_GSTATE_clr_indx AGMUTIL_GSTATE_clr_indx 1 sub def} repeat setcolor
+	AGMUTIL_GSTATE_clr_indx{AGMUTIL_GSTATE_clr_comps AGMUTIL_GSTATE_clr_indx 1 sub get
+	/AGMUTIL_GSTATE_clr_indx AGMUTIL_GSTATE_clr_indx 1 sub def}repeat setcolor
 	AGMUTIL_GSTATE_fnt setfont
 	AGMUTIL_GSTATE_lw setlinewidth
 	AGMUTIL_GSTATE_lc setlinecap
@@ -366,15 +168,15 @@ def
 	AGMUTIL_GSTATE_ucr cvx setundercolorremoval
 	AGMUTIL_GSTATE_r_xfer cvx AGMUTIL_GSTATE_g_xfer cvx AGMUTIL_GSTATE_b_xfer cvx
 		AGMUTIL_GSTATE_gy_xfer cvx setcolortransfer
-	AGMUTIL_GSTATE_ht /HalftoneType get dup 9 eq exch 100 eq or
+	AGMUTIL_GSTATE_ht/HalftoneType get dup 9 eq exch 100 eq or
 		{
-		currenthalftone /HalftoneType get AGMUTIL_GSTATE_ht /HalftoneType get ne
+		currenthalftone/HalftoneType get AGMUTIL_GSTATE_ht/HalftoneType get ne
 			{
-			  mark AGMUTIL_GSTATE_ht {sethalftone} stopped cleartomark
-			} if
+			 mark AGMUTIL_GSTATE_ht{sethalftone}stopped cleartomark
+			}if
 		}{
 		AGMUTIL_GSTATE_ht sethalftone
-		} ifelse
+		}ifelse
 	AGMUTIL_GSTATE_flt setflat
 	end
 }def
@@ -397,31 +199,38 @@ def
 /AGMUTIL_dst64 64 string def
 /AGMUTIL_srcLen nd
 /AGMUTIL_ndx nd
-/agm_sethalftone
+/AGMUTIL_cpd nd
+/capture_cpd{
+	//Adobe_AGM_Utils/AGMUTIL_cpd currentpagedevice ddf
+}def
+/thold_halftone
 {
-	dup
-	begin
-		/_Data load
-		/Thresholds xdf
-	end
 	level3
-	{ sethalftone }{
-		dup /HalftoneType get 3 eq {
-			sethalftone
-		} {pop} ifelse
-	}ifelse
-} def
+		{sethalftone currenthalftone}
+		{
+			dup/HalftoneType get 3 eq
+			{
+				sethalftone currenthalftone
+			}{
+				begin
+				Width Height mul{
+					Thresholds read{pop}if
+				}repeat
+				end
+				currenthalftone
+			}ifelse
+		}ifelse
+}def 
 /rdcmntline
 {
 	currentfile AGMUTIL_str256 readline pop
-	(%) anchorsearch {pop} if
-} bdf
+	(%)anchorsearch{pop}if
+}bdf
 /filter_cmyk
 {	
-	dup type /filetype ne{
-		exch () /SubFileDecode filter
-	}
-	{
+	dup type/filetype ne{
+		exch()/SubFileDecode filter
+	}{
 		exch pop
 	}
 	ifelse
@@ -429,7 +238,7 @@ def
 	exch
 	{
 		AGMUTIL_src256 readstring pop
-		dup length /AGMUTIL_srcLen exch def
+		dup length/AGMUTIL_srcLen exch def
 		/AGMUTIL_ndx 0 def
 		AGMCORE_plate_ndx 4 AGMUTIL_srcLen 1 sub{
 			1 index exch get
@@ -441,41 +250,41 @@ def
 	}
 	bind
 	/exec cvx
-	] cvx
-} bdf
+	]cvx
+}bdf
 /filter_indexed_devn
 {
 	cvi Names length mul names_index add Lookup exch get
-} bdf
+}bdf
 /filter_devn
 {	
 	4 dict begin
 	/srcStr xdf
 	/dstStr xdf
-	dup type /filetype ne{
-		0 () /SubFileDecode filter
+	dup type/filetype ne{
+		0()/SubFileDecode filter
 	}if
 	[
 	exch
 		[
-			/devicen_colorspace_dict /AGMCORE_gget cvx /begin cvx
-			currentdict /srcStr get /readstring cvx /pop cvx
-			/dup cvx /length cvx 0 /gt cvx [
-				Adobe_AGM_Utils /AGMUTIL_ndx 0 /ddf cvx
-				names_index Names length currentdict /srcStr get length 1 sub {
-					1 /index cvx /exch cvx /get cvx
-					currentdict /dstStr get /AGMUTIL_ndx /load cvx 3 -1 /roll cvx /put cvx
-					Adobe_AGM_Utils /AGMUTIL_ndx /AGMUTIL_ndx /load cvx 1 /add cvx /ddf cvx
-				} for
-				currentdict /dstStr get 0 /AGMUTIL_ndx /load cvx /getinterval cvx
-			] cvx /if cvx
+			/devicen_colorspace_dict/AGMCORE_gget cvx/begin cvx
+			currentdict/srcStr get/readstring cvx/pop cvx
+			/dup cvx/length cvx 0/gt cvx[
+				Adobe_AGM_Utils/AGMUTIL_ndx 0/ddf cvx
+				names_index Names length currentdict/srcStr get length 1 sub{
+					1/index cvx/exch cvx/get cvx
+					currentdict/dstStr get/AGMUTIL_ndx/load cvx 3 -1/roll cvx/put cvx
+					Adobe_AGM_Utils/AGMUTIL_ndx/AGMUTIL_ndx/load cvx 1/add cvx/ddf cvx
+				}for
+				currentdict/dstStr get 0/AGMUTIL_ndx/load cvx/getinterval cvx
+			]cvx/if cvx
 			/end cvx
-		] cvx
+		]cvx
 		bind
 		/exec cvx
-	] cvx
+	]cvx
 	end
-} bdf
+}bdf
 /AGMUTIL_imagefile nd
 /read_image_file
 {
@@ -484,177 +293,195 @@ def
 	/imageDict xdf
 	/imbufLen Width BitsPerComponent mul 7 add 8 idiv def
 	/imbufIdx 0 def
-	/origDataSource imageDict /DataSource get def
-	/origMultipleDataSources imageDict /MultipleDataSources get def
-	/origDecode imageDict /Decode get def
-	/dstDataStr imageDict /Width get colorSpaceElemCnt mul string def
-	/srcDataStrs [ imageDict begin
-		currentdict /MultipleDataSources known {MultipleDataSources {DataSource length}{1}ifelse}{1} ifelse
-		{
-			Width Decode length 2 div mul cvi string
-		} repeat
-		end ] def
-	imageDict /MultipleDataSources known {MultipleDataSources}{false} ifelse
+	/origDataSource imageDict/DataSource get def
+	/origMultipleDataSources imageDict/MultipleDataSources get def
+	/origDecode imageDict/Decode get def
+	/dstDataStr imageDict/Width get colorSpaceElemCnt mul string def
+	imageDict/MultipleDataSources known{MultipleDataSources}{false}ifelse
 	{
-		/imbufCnt imageDict /DataSource get length def
+		/imbufCnt imageDict/DataSource get length def
 		/imbufs imbufCnt array def
-		0 1 imbufCnt 1 sub {
+		0 1 imbufCnt 1 sub{
 			/imbufIdx xdf
 			imbufs imbufIdx imbufLen string put
-			imageDict /DataSource get imbufIdx [ AGMUTIL_imagefile imbufs imbufIdx get /readstring cvx /pop cvx ] cvx put
-		} for
-		DeviceN_PS2 {
+			imageDict/DataSource get imbufIdx[AGMUTIL_imagefile imbufs imbufIdx get/readstring cvx/pop cvx]cvx put
+		}for
+		DeviceN_PS2{
 			imageDict begin
-		 	/DataSource [ DataSource /devn_sep_datasource cvx ] cvx def
+		 	/DataSource[DataSource/devn_sep_datasource cvx]cvx def
 			/MultipleDataSources false def
-			/Decode [0 1] def
+			/Decode[0 1]def
 			end
-		} if
+		}if
 	}{
 		/imbuf imbufLen string def
-		Indexed_DeviceN level3 not and DeviceN_NoneName or {
+		Indexed_DeviceN level3 not and DeviceN_NoneName or{
+			/srcDataStrs[imageDict begin
+				currentdict/MultipleDataSources known{MultipleDataSources{DataSource length}{1}ifelse}{1}ifelse
+				{
+					Width Decode length 2 div mul cvi string
+				}repeat
+				end]def		
 			imageDict begin
-		 	/DataSource [AGMUTIL_imagefile Decode BitsPerComponent false 1 /filter_indexed_devn load dstDataStr srcDataStrs devn_alt_datasource /exec cvx] cvx def
-			/Decode [0 1] def
+		 	/DataSource[AGMUTIL_imagefile Decode BitsPerComponent false 1/filter_indexed_devn load dstDataStr srcDataStrs devn_alt_datasource/exec cvx]cvx def
+			/Decode[0 1]def
 			end
 		}{
-			imageDict /DataSource {AGMUTIL_imagefile imbuf readstring pop} put
-		} ifelse
-	} ifelse
+			imageDict/DataSource[1 string dup 0 AGMUTIL_imagefile Decode length 2 idiv string/readstring cvx/pop cvx names_index/get cvx/put cvx]cvx put
+			imageDict/Decode[0 1]put
+		}ifelse
+	}ifelse
 	imageDict exch
 	load exec
-	imageDict /DataSource origDataSource put
-	imageDict /MultipleDataSources origMultipleDataSources put
-	imageDict /Decode origDecode put	
+	imageDict/DataSource origDataSource put
+	imageDict/MultipleDataSources origMultipleDataSources put
+	imageDict/Decode origDecode put	
 	end
-} bdf
+}bdf
 /write_image_file
 {
 	begin
-	{ (AGMUTIL_imagefile) (w+) file } stopped{
+	{(AGMUTIL_imagefile)(w+)file}stopped{
 		false
 	}{
-		Adobe_AGM_Utils/AGMUTIL_imagefile xddf
+		Adobe_AGM_Utils/AGMUTIL_imagefile xddf 
 		2 dict begin
 		/imbufLen Width BitsPerComponent mul 7 add 8 idiv def
-		MultipleDataSources {DataSource 0 get}{DataSource}ifelse type /filetype eq {
+		MultipleDataSources{DataSource 0 get}{DataSource}ifelse type/filetype eq{
 			/imbuf imbufLen string def
 		}if
-		1 1 Height {
+		1 1 Height MultipleDataSources not{Decode length 2 idiv mul}if{
 			pop
-			MultipleDataSources {
-			 	0 1 DataSource length 1 sub {
+			MultipleDataSources{
+			 	0 1 DataSource length 1 sub{
 					DataSource type dup
-					/arraytype eq {
-						pop DataSource exch get exec
+					/arraytype eq{
+						pop DataSource exch gx
 					}{
-						/filetype eq {
+						/filetype eq{
 							DataSource exch get imbuf readstring pop
 						}{
 							DataSource exch get
-						} ifelse
-					} ifelse
+						}ifelse
+					}ifelse
 					AGMUTIL_imagefile exch writestring
-				} for
+				}for
 			}{
 				DataSource type dup
-				/arraytype eq {
+				/arraytype eq{
 					pop DataSource exec
 				}{
-					/filetype eq {
+					/filetype eq{
 						DataSource imbuf readstring pop
 					}{
 						DataSource
-					} ifelse
-				} ifelse
+					}ifelse
+				}ifelse
 				AGMUTIL_imagefile exch writestring
-			} ifelse
+			}ifelse
 		}for
 		end
 		true
 	}ifelse
 	end
-} bdf
+}bdf
 /close_image_file
 {
-	AGMUTIL_imagefile closefile (AGMUTIL_imagefile) deletefile
+	AGMUTIL_imagefile closefile(AGMUTIL_imagefile)deletefile
 }def
-statusdict /product known userdict /AGMP_current_show known not and{
-	/pstr statusdict /product get def
-	pstr (HP LaserJet 2200) eq 	
-	pstr (HP LaserJet 4000 Series) eq or
-	pstr (HP LaserJet 4050 Series ) eq or
-	pstr (HP LaserJet 8000 Series) eq or
-	pstr (HP LaserJet 8100 Series) eq or
-	pstr (HP LaserJet 8150 Series) eq or
-	pstr (HP LaserJet 5000 Series) eq or
-	pstr (HP LaserJet 5100 Series) eq or
-	pstr (HP Color LaserJet 4500) eq or
-	pstr (HP Color LaserJet 4600) eq or
-	pstr (HP LaserJet 5Si) eq or
-	pstr (HP LaserJet 1200 Series) eq or
-	pstr (HP LaserJet 1300 Series) eq or
-	pstr (HP LaserJet 4100 Series) eq or
-	{
- 		userdict /AGMP_current_show /show load put
-		userdict /show {
-		  currentcolorspace 0 get
-		  /Pattern eq
-		  {false charpath f}
-		  {AGMP_current_show} ifelse
-		} put
+statusdict/product known userdict/AGMP_current_show known not and{
+	/pstr statusdict/product get def
+	pstr(HP LaserJet 2200)eq 	
+	pstr(HP LaserJet 4000 Series)eq or
+	pstr(HP LaserJet 4050 Series )eq or
+	pstr(HP LaserJet 8000 Series)eq or
+	pstr(HP LaserJet 8100 Series)eq or
+	pstr(HP LaserJet 8150 Series)eq or
+	pstr(HP LaserJet 5000 Series)eq or
+	pstr(HP LaserJet 5100 Series)eq or
+	pstr(HP Color LaserJet 4500)eq or
+	pstr(HP Color LaserJet 4600)eq or
+	pstr(HP LaserJet 5Si)eq or
+	pstr(HP LaserJet 1200 Series)eq or
+	pstr(HP LaserJet 1300 Series)eq or
+	pstr(HP LaserJet 4100 Series)eq or 
+	{
+ 		userdict/AGMP_current_show/show load put
+		userdict/show{
+		 currentcolorspace 0 get
+		 /Pattern eq
+		 {false charpath f}
+		 {AGMP_current_show}ifelse
+		}put
 	}if
-	currentdict /pstr undef
-} if
+	currentdict/pstr undef
+}if
 /consumeimagedata
 {
 	begin
-	currentdict /MultipleDataSources known not
-		{/MultipleDataSources false def} if
+	AGMIMG_init_common
+	currentdict/MultipleDataSources known not
+		{/MultipleDataSources false def}if
 	MultipleDataSources
 		{
-		1 dict begin
-		/flushbuffer Width cvi string def
-		1 1 Height cvi
+		DataSource 0 get type
+		dup/filetype eq
 			{
-			pop
-			0 1 DataSource length 1 sub
+			1 dict begin
+			/flushbuffer Width cvi string def
+			1 1 Height cvi
 				{
-				DataSource exch get
-				dup type dup
-				/filetype eq
-					{
-					exch flushbuffer readstring pop pop
-					}if
-				/arraytype eq
+				pop
+				0 1 DataSource length 1 sub
 					{
-					exec pop
-					}if
+					DataSource exch get
+					flushbuffer readstring pop pop
+					}for
 				}for
-			}for
-		end
+			end
+			}if
+		dup/arraytype eq exch/packedarraytype eq or DataSource 0 get xcheck and
+			{
+			Width Height mul cvi
+				{
+				0 1 DataSource length 1 sub
+					{dup DataSource exch gx length exch 0 ne{pop}if}for
+				dup 0 eq
+					{pop exit}if
+				sub dup 0 le
+					{exit}if
+				}loop
+			pop
+			}if		
 		}
 		{
-		/DataSource load type dup
-		/filetype eq
+		/DataSource load type 
+		dup/filetype eq
 			{
 			1 dict begin
-			/flushbuffer Width Decode length 2 div mul cvi string def
-			1 1 Height { pop DataSource flushbuffer readstring pop pop} for
+			/flushbuffer Width Decode length 2 idiv mul cvi string def
+			1 1 Height{pop DataSource flushbuffer readstring pop pop}for
 			end
 			}if
-		/arraytype eq
+		dup/arraytype eq exch/packedarraytype eq or/DataSource load xcheck and
 			{
-			1 1 Height { pop DataSource pop } for
+				Height Width BitsPerComponent mul 8 BitsPerComponent sub add 8 idiv Decode length 2 idiv mul mul
+					{
+					DataSource length dup 0 eq
+						{pop exit}if
+					sub dup 0 le
+						{exit}if
+					}loop
+				pop
 			}if
 		}ifelse
 	end
 }bdf
 /addprocs
 {
-	  2{/exec load}repeat
-	  3 1 roll
-	  [ 5 1 roll ] bind cvx
+	 2{/exec load}repeat
+	 3 1 roll
+	 [5 1 roll]bind cvx
 }def
 /modify_halftone_xfer
 {
@@ -666,16 +493,16 @@ statusdict /product known userdict /AGMP
 		}{
 			currenttransfer
 		}ifelse
-		 addprocs /TransferFunction xdf
+		 addprocs/TransferFunction xdf 
 		 currentdict end def
 		currentdict end sethalftone
 	}{
 		currentdict/TransferFunction known{
-			/TransferFunction load
+			/TransferFunction load 
 		}{
 			currenttransfer
 		}ifelse
-		addprocs /TransferFunction xdf
+		addprocs/TransferFunction xdf
 		currentdict end sethalftone		
 		pop
 	}ifelse
@@ -684,122 +511,141 @@ statusdict /product known userdict /AGMP
 {
 	dup xcheck exch
 	dup length array exch
-	Adobe_AGM_Core/AGMCORE_tmp -1 ddf
+	Adobe_AGM_Core/AGMCORE_tmp -1 ddf 
 	{
-	Adobe_AGM_Core/AGMCORE_tmp AGMCORE_tmp 1 add ddf
-	dup type /dicttype eq
+	Adobe_AGM_Core/AGMCORE_tmp 2 copy get 1 add ddf 
+	dup type/dicttype eq
 		{
-			AGMCORE_tmp
+			Adobe_AGM_Core/AGMCORE_tmp get
 			exch
 			clonedict
-			Adobe_AGM_Core/AGMCORE_tmp 4 -1 roll ddf
-		} if
-	dup type /arraytype eq
+			Adobe_AGM_Core/AGMCORE_tmp 4 -1 roll ddf 
+		}if
+	dup type/arraytype eq
 		{
-			AGMCORE_tmp exch
+			Adobe_AGM_Core/AGMCORE_tmp get exch
 			clonearray
-			Adobe_AGM_Core/AGMCORE_tmp 4 -1 roll ddf
-		} if
+			Adobe_AGM_Core/AGMCORE_tmp 4 -1 roll ddf 
+		}if
 	exch dup
-	AGMCORE_tmp 4 -1 roll put
+	Adobe_AGM_Core/AGMCORE_tmp get 4 -1 roll put
 	}forall
-	exch {cvx} if
+	exch{cvx}if
 }bdf
 /clonedict
 {
 	dup length dict
 	begin
-		{
-		dup type /dicttype eq
-			{
-				clonedict
-			} if
-		dup type /arraytype eq
-			{
-				clonearray
-			} if
+	{
+		dup type/dicttype eq
+			{clonedict}if
+		dup type/arraytype eq

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

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 19:20:03 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DFA0F1065670;
	Thu,  4 Nov 2010 19:20:03 +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 AD7978FC16;
	Thu,  4 Nov 2010 19:20: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 oA4JK3Em070419;
	Thu, 4 Nov 2010 19:20:03 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4JK36u070418;
	Thu, 4 Nov 2010 19:20:03 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201011041920.oA4JK36u070418@svn.freebsd.org>
From: Doug Barton 
Date: Thu, 4 Nov 2010 19:20:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214803 - vendor/bind9/9.4-ESV-R3
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 19:20:04 -0000

Author: dougb
Date: Thu Nov  4 19:20:03 2010
New Revision: 214803
URL: http://svn.freebsd.org/changeset/base/214803

Log:
  Tag the 9.4-ESV-R3 release

Added:
  vendor/bind9/9.4-ESV-R3/
     - copied from r214802, vendor/bind9/dist-9.4/

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 19:24:21 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BCD8F106566C;
	Thu,  4 Nov 2010 19:24:21 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AAB908FC17;
	Thu,  4 Nov 2010 19:24: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 oA4JOLgG070563;
	Thu, 4 Nov 2010 19:24:21 GMT (envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4JOLDx070560;
	Thu, 4 Nov 2010 19:24:21 GMT (envelope-from hselasky@svn.freebsd.org)
Message-Id: <201011041924.oA4JOLDx070560@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 4 Nov 2010 19:24: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: r214804 - head/sys/dev/usb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 19:24:21 -0000

Author: hselasky
Date: Thu Nov  4 19:24:21 2010
New Revision: 214804
URL: http://svn.freebsd.org/changeset/base/214804

Log:
  Add code to warm reset a USB 3.0 port.
  
  Approved by:	thompsa (mentor)

Modified:
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_request.h

Modified: head/sys/dev/usb/usb_request.c
==============================================================================
--- head/sys/dev/usb/usb_request.c	Thu Nov  4 19:20:03 2010	(r214803)
+++ head/sys/dev/usb/usb_request.c	Thu Nov  4 19:24:21 2010	(r214804)
@@ -741,7 +741,7 @@ done:
 /*------------------------------------------------------------------------*
  *	usbd_req_reset_port
  *
- * This function will instruct an USB HUB to perform a reset sequence
+ * This function will instruct a USB HUB to perform a reset sequence
  * on the specified port number.
  *
  * Returns:
@@ -793,12 +793,105 @@ usbd_req_reset_port(struct usb_device *u
 		if (err) {
 			goto done;
 		}
+		/* check if reset is complete */
+		if (UGETW(ps.wPortChange) & UPS_C_PORT_RESET) {
+			break;
+		}
+		/* check for timeout */
+		if (n > 1000) {
+			n = 0;
+			break;
+		}
+	}
+
+	/* clear port reset first */
+	err = usbd_req_clear_port_feature(
+	    udev, mtx, port, UHF_C_PORT_RESET);
+	if (err) {
+		goto done;
+	}
+	/* check for timeout */
+	if (n == 0) {
+		err = USB_ERR_TIMEOUT;
+		goto done;
+	}
+#ifdef USB_DEBUG
+	/* wait for the device to recover from reset */
+	usb_pause_mtx(mtx, USB_MS_TO_TICKS(pr_recovery_delay));
+#else
+	/* wait for the device to recover from reset */
+	usb_pause_mtx(mtx, USB_MS_TO_TICKS(USB_PORT_RESET_RECOVERY));
+#endif
+
+done:
+	DPRINTFN(2, "port %d reset returning error=%s\n",
+	    port, usbd_errstr(err));
+	return (err);
+}
+
+/*------------------------------------------------------------------------*
+ *	usbd_req_warm_reset_port
+ *
+ * This function will instruct an USB HUB to perform a warm reset
+ * sequence on the specified port number. This kind of reset is not
+ * mandatory for LOW-, FULL- and HIGH-speed USB HUBs and is targeted
+ * for SUPER-speed USB HUBs.
+ *
+ * Returns:
+ *    0: Success. The USB device should now be available again.
+ * Else: Failure. No USB device is present and the USB port should be
+ *       disabled.
+ *------------------------------------------------------------------------*/
+usb_error_t
+usbd_req_warm_reset_port(struct usb_device *udev, struct mtx *mtx, uint8_t port)
+{
+	struct usb_port_status ps;
+	usb_error_t err;
+	uint16_t n;
+
+#ifdef USB_DEBUG
+	uint16_t pr_poll_delay;
+	uint16_t pr_recovery_delay;
+
+#endif
+	err = usbd_req_set_port_feature(udev, mtx, port, UHF_BH_PORT_RESET);
+	if (err) {
+		goto done;
+	}
+#ifdef USB_DEBUG
+	/* range check input parameters */
+	pr_poll_delay = usb_pr_poll_delay;
+	if (pr_poll_delay < 1) {
+		pr_poll_delay = 1;
+	} else if (pr_poll_delay > 1000) {
+		pr_poll_delay = 1000;
+	}
+	pr_recovery_delay = usb_pr_recovery_delay;
+	if (pr_recovery_delay > 1000) {
+		pr_recovery_delay = 1000;
+	}
+#endif
+	n = 0;
+	while (1) {
+#ifdef USB_DEBUG
+		/* wait for the device to recover from reset */
+		usb_pause_mtx(mtx, USB_MS_TO_TICKS(pr_poll_delay));
+		n += pr_poll_delay;
+#else
+		/* wait for the device to recover from reset */
+		usb_pause_mtx(mtx, USB_MS_TO_TICKS(USB_PORT_RESET_DELAY));
+		n += USB_PORT_RESET_DELAY;
+#endif
+		err = usbd_req_get_port_status(udev, mtx, &ps, port);
+		if (err) {
+			goto done;
+		}
 		/* if the device disappeared, just give up */
 		if (!(UGETW(ps.wPortStatus) & UPS_CURRENT_CONNECT_STATUS)) {
 			goto done;
 		}
 		/* check if reset is complete */
-		if (UGETW(ps.wPortChange) & UPS_C_PORT_RESET) {
+		if (UGETW(ps.wPortChange) & UPS_C_BH_PORT_RESET) {
 			break;
 		}
 		/* check for timeout */
@@ -810,7 +903,7 @@ usbd_req_reset_port(struct usb_device *u
 
 	/* clear port reset first */
 	err = usbd_req_clear_port_feature(
-	    udev, mtx, port, UHF_C_PORT_RESET);
+	    udev, mtx, port, UHF_C_BH_PORT_RESET);
 	if (err) {
 		goto done;
 	}
@@ -828,7 +921,7 @@ usbd_req_reset_port(struct usb_device *u
 #endif
 
 done:
-	DPRINTFN(2, "port %d reset returning error=%s\n",
+	DPRINTFN(2, "port %d warm reset returning error=%s\n",
 	    port, usbd_errstr(err));
 	return (err);
 }

Modified: head/sys/dev/usb/usb_request.h
==============================================================================
--- head/sys/dev/usb/usb_request.h	Thu Nov  4 19:20:03 2010	(r214803)
+++ head/sys/dev/usb/usb_request.h	Thu Nov  4 19:24:21 2010	(r214804)
@@ -65,6 +65,8 @@ usb_error_t usbd_req_get_port_status(str
 		    struct usb_port_status *ps, uint8_t port);
 usb_error_t usbd_req_reset_port(struct usb_device *udev, struct mtx *mtx,
 		    uint8_t port);
+usb_error_t usbd_req_warm_reset_port(struct usb_device *udev,
+		    struct mtx *mtx, uint8_t port);
 usb_error_t usbd_req_set_address(struct usb_device *udev, struct mtx *mtx,
 		    uint16_t addr);
 usb_error_t usbd_req_set_hub_feature(struct usb_device *udev, struct mtx *mtx,

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 20:22:08 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 996CF106564A;
	Thu,  4 Nov 2010 20:22:08 +0000 (UTC)
	(envelope-from bruce@cran.org.uk)
Received: from muon.cran.org.uk (muon.cran.org.uk
	[IPv6:2a01:348:0:15:5d59:5c40:0:1])
	by mx1.freebsd.org (Postfix) with ESMTP id 3125B8FC0A;
	Thu,  4 Nov 2010 20:22:08 +0000 (UTC)
Received: from muon.cran.org.uk (localhost [127.0.0.1])
	by muon.cran.org.uk (Postfix) with ESMTP id 459A1E7211;
	Thu,  4 Nov 2010 20:22:07 +0000 (GMT)
Received: from unknown (client-82-26-147-199.pete.adsl.virginmedia.com
	[82.26.147.199])
	(using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
	(No client certificate requested)
	by muon.cran.org.uk (Postfix) with ESMTPSA;
	Thu,  4 Nov 2010 20:22:06 +0000 (GMT)
Date: Thu, 4 Nov 2010 20:22:03 +0000
From: Bruce Cran 
To: Alexander Motin 
Message-ID: <20101104202203.000043a6@unknown>
In-Reply-To: <4CD2F224.1040008@FreeBSD.org>
References: <201011041524.oA4FOWd7063812@svn.freebsd.org>
	<4CD2F224.1040008@FreeBSD.org>
X-Mailer: Claws Mail 3.7.6 (GTK+ 2.16.6; i586-pc-mingw32msvc)
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, Bruce Cran 
Subject: Re: svn commit: r214781 - head/sbin/camcontrol
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 20:22:08 -0000

On Thu, 04 Nov 2010 19:49:24 +0200
Alexander Motin  wrote:

> This will round period down. You will get 30 minutes instead of 59. In
> this case rounding up IMHO more appropriate. I agree that previous
> rounding up was over aggressive. I would prefer something like:
> 		sc = (t - 1) / (30 * 60) + 241;
> or at least
> 		sc = (t + 15 * 60) / (30 * 60) + 240;
> This will also make previous range unneeded.
> 
> Range "t <= (240 * 5)" probably also should be corrected to round up
> or at least closest.
> 

Of course rounding up is more suitable. Would the following patch be
ok:

Index: camcontrol.c
===================================================================
--- camcontrol.c	(revision 214793)
+++ camcontrol.c	(working copy)
@@ -4312,18 +4312,16 @@
 		cmd = ATA_SLEEP;
 		t = -1;
 	}
+
 	if (t < 0)
 		sc = 0;
 	else if (t <= (240 * 5))
-		sc = t / 5;
-	else if (t == (252 * 5))
+		sc = (t + 4) / 5;
+	else if (t <= (252 * 5))
 		/* special encoding for 21 minutes */
 		sc = 252;
-	else if (t < (30 * 60))
-		/* no encoding exists for 22-29 minutes, so set to 30
mins */
-		sc = 241;
 	else if (t <= (11 * 30 * 60))
-		sc = t / (30 * 60) + 240;
+		sc = (t - 1) / (30 * 60) + 241;
 	else
 		sc = 253;
 

-- 
Bruce Cran

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 20:24:18 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 395EB106566B;
	Thu,  4 Nov 2010 20:24:18 +0000 (UTC)
	(envelope-from mavbsd@gmail.com)
Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54])
	by mx1.freebsd.org (Postfix) with ESMTP id A64F88FC08;
	Thu,  4 Nov 2010 20:24:17 +0000 (UTC)
Received: by gwj16 with SMTP id 16so1824297gwj.13
	for ; Thu, 04 Nov 2010 13:24:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:sender:message-id:date:from
	:user-agent:mime-version:to:cc:subject:references:in-reply-to
	:x-enigmail-version:content-type:content-transfer-encoding;
	bh=3g7QLFyMYJK0+n8VsxAckrvvGn/Gk4xo4aNTMFgmL3M=;
	b=xbPtcCL4iPk32MdlzODk963Yll3yQVRt0Y1L9kgizrkcq3bAE65QeqrKnrFfW+nCZ+
	udHFuSx1JodzkNVHlaZBa+rKkc8GWCR7ex8VY45Z/sJnPPvn/+OQLDZDQbnQGdHeFQEn
	zqCV6801qSKLTHVtOS6YcIEbVgDo3taQpP7Wc=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:x-enigmail-version:content-type
	:content-transfer-encoding;
	b=kphl/cbBnDyVCqOe9eT00wxmiK6xBD4kSgD3CkkS4lm4JIr1q+xXfMErmWIUrI1ga2
	lvWjPcC0xx3mDKFErFdMOVH5dbvyFH06KVTwe1cYUSHZ8YsYvyjNjMRZ4g7pS2m+wB5/
	vOgrfl7A94qFFMbK9RLkfTKjFIJ/bj9kS8X7I=
Received: by 10.204.68.142 with SMTP id v14mr1043503bki.106.1288902255715;
	Thu, 04 Nov 2010 13:24:15 -0700 (PDT)
Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226])
	by mx.google.com with ESMTPS id d12sm335120bkw.7.2010.11.04.13.24.13
	(version=SSLv3 cipher=RC4-MD5); Thu, 04 Nov 2010 13:24:14 -0700 (PDT)
Sender: Alexander Motin 
Message-ID: <4CD3166C.4030003@FreeBSD.org>
Date: Thu, 04 Nov 2010 22:24:12 +0200
From: Alexander Motin 
User-Agent: Thunderbird 2.0.0.24 (X11/20100402)
MIME-Version: 1.0
To: Bruce Cran 
References: <201011041524.oA4FOWd7063812@svn.freebsd.org>	<4CD2F224.1040008@FreeBSD.org>
	<20101104202203.000043a6@unknown>
In-Reply-To: <20101104202203.000043a6@unknown>
X-Enigmail-Version: 0.96.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Bruce Cran 
Subject: Re: svn commit: r214781 - head/sbin/camcontrol
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 20:24:18 -0000

Bruce Cran wrote:
> On Thu, 04 Nov 2010 19:49:24 +0200
> Alexander Motin  wrote:
> 
>> This will round period down. You will get 30 minutes instead of 59. In
>> this case rounding up IMHO more appropriate. I agree that previous
>> rounding up was over aggressive. I would prefer something like:
>> 		sc = (t - 1) / (30 * 60) + 241;
>> or at least
>> 		sc = (t + 15 * 60) / (30 * 60) + 240;
>> This will also make previous range unneeded.
>>
>> Range "t <= (240 * 5)" probably also should be corrected to round up
>> or at least closest.
>>
> 
> Of course rounding up is more suitable. Would the following patch be
> ok:
> 
> Index: camcontrol.c
> ===================================================================
> --- camcontrol.c	(revision 214793)
> +++ camcontrol.c	(working copy)
> @@ -4312,18 +4312,16 @@
>  		cmd = ATA_SLEEP;
>  		t = -1;
>  	}
> +
>  	if (t < 0)
>  		sc = 0;
>  	else if (t <= (240 * 5))
> -		sc = t / 5;
> -	else if (t == (252 * 5))
> +		sc = (t + 4) / 5;
> +	else if (t <= (252 * 5))
>  		/* special encoding for 21 minutes */
>  		sc = 252;
> -	else if (t < (30 * 60))
> -		/* no encoding exists for 22-29 minutes, so set to 30
> mins */
> -		sc = 241;
>  	else if (t <= (11 * 30 * 60))
> -		sc = t / (30 * 60) + 240;
> +		sc = (t - 1) / (30 * 60) + 241;
>  	else
>  		sc = 253;

It seems so. Thank you.

-- 
Alexander Motin

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 20:31:12 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DDE4F1065674;
	Thu,  4 Nov 2010 20:31:12 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CC8838FC15;
	Thu,  4 Nov 2010 20:31: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 oA4KVC3X072260;
	Thu, 4 Nov 2010 20:31:12 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4KVCYW072258;
	Thu, 4 Nov 2010 20:31:12 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201011042031.oA4KVCYW072258@svn.freebsd.org>
From: Bruce Cran 
Date: Thu, 4 Nov 2010 20:31: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: r214807 - head/sbin/camcontrol
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 20:31:13 -0000

Author: brucec
Date: Thu Nov  4 20:31:12 2010
New Revision: 214807
URL: http://svn.freebsd.org/changeset/base/214807

Log:
  r214781 caused the timer value to be rounded down, so that if the user asked
  for 59 minutes 30 was sent to the drive. The timer value is now always
  rounded up.
  
  Reported by: mav

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Thu Nov  4 20:22:44 2010	(r214806)
+++ head/sbin/camcontrol/camcontrol.c	Thu Nov  4 20:31:12 2010	(r214807)
@@ -4312,18 +4312,16 @@ atapm(struct cam_device *device, int arg
 		cmd = ATA_SLEEP;
 		t = -1;
 	}
+
 	if (t < 0)
 		sc = 0;
 	else if (t <= (240 * 5))
-		sc = t / 5;
-	else if (t == (252 * 5))
+		sc = (t + 4) / 5;
+	else if (t <= (252 * 5))
 		/* special encoding for 21 minutes */
 		sc = 252;
-	else if (t < (30 * 60))
-		/* no encoding exists for 22-29 minutes, so set to 30 mins */
-		sc = 241;
 	else if (t <= (11 * 30 * 60))
-		sc = t / (30 * 60) + 240;
+		sc = (t - 1) / (30 * 60) + 241;
 	else
 		sc = 253;
 

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 21:03:51 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 057B3106566C;
	Thu,  4 Nov 2010 21:03:51 +0000 (UTC) (envelope-from uqs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E7D318FC14;
	Thu,  4 Nov 2010 21:03: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 oA4L3oJb073059;
	Thu, 4 Nov 2010 21:03:50 GMT (envelope-from uqs@svn.freebsd.org)
Received: (from uqs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4L3odc073056;
	Thu, 4 Nov 2010 21:03:50 GMT (envelope-from uqs@svn.freebsd.org)
Message-Id: <201011042103.oA4L3odc073056@svn.freebsd.org>
From: Ulrich Spoerlein 
Date: Thu, 4 Nov 2010 21:03: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: r214808 - head/share/man/man4/man4.sparc64
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 21:03:51 -0000

Author: uqs
Date: Thu Nov  4 21:03:50 2010
New Revision: 214808
URL: http://svn.freebsd.org/changeset/base/214808

Log:
  In man section 4, ERRORS is spelled DIAGNOSTICS

Modified:
  head/share/man/man4/man4.sparc64/openfirm.4
  head/share/man/man4/man4.sparc64/openprom.4

Modified: head/share/man/man4/man4.sparc64/openfirm.4
==============================================================================
--- head/share/man/man4/man4.sparc64/openfirm.4	Thu Nov  4 20:31:12 2010	(r214807)
+++ head/share/man/man4/man4.sparc64/openfirm.4	Thu Nov  4 21:03:50 2010	(r214808)
@@ -231,7 +231,7 @@ is returned.
 .It Pa /dev/openfirm
 Open Firmware interface node
 .El
-.Sh ERRORS
+.Sh DIAGNOSTICS
 The following may result in rejection of an operation:
 .Bl -tag -width Er
 .It Bq Er EBADF

Modified: head/share/man/man4/man4.sparc64/openprom.4
==============================================================================
--- head/share/man/man4/man4.sparc64/openprom.4	Thu Nov  4 20:31:12 2010	(r214807)
+++ head/share/man/man4/man4.sparc64/openprom.4	Thu Nov  4 21:03:50 2010	(r214808)
@@ -187,7 +187,7 @@ an empty string is returned.
 .It Pa /dev/openprom
 OPENPROM interface node
 .El
-.Sh ERRORS
+.Sh DIAGNOSTICS
 The following may result in rejection of an operation:
 .Bl -tag -width Er
 .It Bq Er EBUSY

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 21:06:36 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E6F1D106566C;
	Thu,  4 Nov 2010 21:06:36 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D5A028FC12;
	Thu,  4 Nov 2010 21:06: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 oA4L6acY073147;
	Thu, 4 Nov 2010 21:06:36 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4L6aBT073145;
	Thu, 4 Nov 2010 21:06:36 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <201011042106.oA4L6aBT073145@svn.freebsd.org>
From: Nick Hibma 
Date: Thu, 4 Nov 2010 21:06: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: r214809 - head/sys/dev/usb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 21:06:37 -0000

Author: n_hibma
Date: Thu Nov  4 21:06:36 2010
New Revision: 214809
URL: http://svn.freebsd.org/changeset/base/214809

Log:
  Don't terminate the notification with \n. This is done in
  usb_device.c:devctl_notify_f().

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Thu Nov  4 21:03:50 2010	(r214808)
+++ head/sys/dev/usb/usb_device.c	Thu Nov  4 21:06:36 2010	(r214809)
@@ -2486,7 +2486,7 @@ usb_notify_addq(const char *type, struct
 	    "mode=%s "
 	    "port=%u "
 #if USB_HAVE_UGEN
-	    "parent=%s\n"
+	    "parent=%s"
 #endif
 	    "",
 #if USB_HAVE_UGEN
@@ -2534,7 +2534,7 @@ usb_notify_addq(const char *type, struct
 		    "endpoints=%d "
 		    "intclass=0x%02x "
 		    "intsubclass=0x%02x "
-		    "intprotocol=0x%02x\n",
+		    "intprotocol=0x%02x",
 #if USB_HAVE_UGEN
 		    udev->ugen_name,
 #endif

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 21:47:28 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7DAD01065672;
	Thu,  4 Nov 2010 21:47:28 +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 50BD98FC1E;
	Thu,  4 Nov 2010 21:47:28 +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 oA4LlSRJ074062;
	Thu, 4 Nov 2010 21:47:28 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4LlSqp074059;
	Thu, 4 Nov 2010 21:47:28 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201011042147.oA4LlSqp074059@svn.freebsd.org>
From: Doug Barton 
Date: Thu, 4 Nov 2010 21:47:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214810 - in stable/8/lib/bind: . isc/isc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 21:47:28 -0000

Author: dougb
Date: Thu Nov  4 21:47:28 2010
New Revision: 214810
URL: http://svn.freebsd.org/changeset/base/214810

Log:
  MFC 214585:
  
  Prep for the 9.6-ESV-R2 update

Modified:
  stable/8/lib/bind/config.h
  stable/8/lib/bind/isc/isc/platform.h
Directory Properties:
  stable/8/lib/bind/   (props changed)

Modified: stable/8/lib/bind/config.h
==============================================================================
--- stable/8/lib/bind/config.h	Thu Nov  4 21:06:36 2010	(r214809)
+++ stable/8/lib/bind/config.h	Thu Nov  4 21:47:28 2010	(r214810)
@@ -147,6 +147,9 @@ int sigwait(const unsigned int *set, int
 /* Define if threads need PTHREAD_SCOPE_SYSTEM */
 /* #undef NEED_PTHREAD_SCOPE_SYSTEM */
 
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
 /* Define if recvmsg() does not meet all of the BSD socket API specifications.
    */
 /* #undef BROKEN_RECVMSG */
@@ -306,6 +309,9 @@ int sigwait(const unsigned int *set, int
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME ""
 
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
 /* Define to the version of this package. */
 #define PACKAGE_VERSION ""
 
@@ -327,11 +333,15 @@ int sigwait(const unsigned int *set, int
 /* #undef WITH_IDN */
 
 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
-   significant byte first (like Motorola and SPARC, unlike Intel and VAX). */
-#if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-#elif ! defined __LITTLE_ENDIAN__
-/* # undef WORDS_BIGENDIAN */
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
+# endif
 #endif
 
 /* Define to empty if `const' does not conform to ANSI C. */

Modified: stable/8/lib/bind/isc/isc/platform.h
==============================================================================
--- stable/8/lib/bind/isc/isc/platform.h	Thu Nov  4 21:06:36 2010	(r214809)
+++ stable/8/lib/bind/isc/isc/platform.h	Thu Nov  4 21:47:28 2010	(r214810)
@@ -252,7 +252,14 @@
  * If the "xaddq" operation (64bit xadd) is available on this architecture,
  * ISC_PLATFORM_HAVEXADDQ will be defined.
  */
+/*
+ * FreeBSD local modification, preserve this over upgrades
+ */
+#ifdef __amd64__
+#define ISC_PLATFORM_HAVEXADDQ 1
+#else
 #undef ISC_PLATFORM_HAVEXADDQ
+#endif
 
 /*
  * If the "atomic swap" operation is available on this architecture,

From owner-svn-src-all@FreeBSD.ORG  Thu Nov  4 21:48:40 2010
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 23B8C1065673;
	Thu,  4 Nov 2010 21:48:40 +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 0D5D58FC08;
	Thu,  4 Nov 2010 21:48: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 oA4LmdrN074154;
	Thu, 4 Nov 2010 21:48:39 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4Lmdjt074118;
	Thu, 4 Nov 2010 21:48:39 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201011042148.oA4Lmdjt074118@svn.freebsd.org>
From: Doug Barton 
Date: Thu, 4 Nov 2010 21:48:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r214811 - in stable/8/contrib/bind9: . bin/dnssec
	bin/named bin/named/include/named bin/nsupdate doc/arm
	lib/dns lib/dns/include/dns lib/isc lib/isc/include/isc
	lib/lwres/man
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 04 Nov 2010 21:48:40 -0000

Author: dougb
Date: Thu Nov  4 21:48:39 2010
New Revision: 214811
URL: http://svn.freebsd.org/changeset/base/214811

Log:
  Update to 9.6-ESV-R2, the latest from ISC.
  
  This version contains bug fixes that are relevant to any
  caching/resolving name server; as well as DNSSEC-related
  fixes.

Modified:
  stable/8/contrib/bind9/CHANGES
  stable/8/contrib/bind9/README
  stable/8/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html
  stable/8/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.html
  stable/8/contrib/bind9/bin/dnssec/dnssec-keygen.html
  stable/8/contrib/bind9/bin/dnssec/dnssec-signzone.html
  stable/8/contrib/bind9/bin/named/include/named/globals.h
  stable/8/contrib/bind9/bin/named/main.c
  stable/8/contrib/bind9/bin/named/query.c
  stable/8/contrib/bind9/bin/named/server.c
  stable/8/contrib/bind9/bin/nsupdate/nsupdate.html
  stable/8/contrib/bind9/doc/arm/Bv9ARM-book.xml
  stable/8/contrib/bind9/doc/arm/Bv9ARM.ch06.html
  stable/8/contrib/bind9/doc/arm/Bv9ARM.ch07.html
  stable/8/contrib/bind9/doc/arm/Bv9ARM.ch08.html
  stable/8/contrib/bind9/doc/arm/Bv9ARM.ch09.html
  stable/8/contrib/bind9/doc/arm/Bv9ARM.html
  stable/8/contrib/bind9/doc/arm/Bv9ARM.pdf
  stable/8/contrib/bind9/doc/arm/isc-logo.eps
  stable/8/contrib/bind9/doc/arm/isc-logo.pdf
  stable/8/contrib/bind9/doc/arm/man.dig.html
  stable/8/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html
  stable/8/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html
  stable/8/contrib/bind9/doc/arm/man.dnssec-keygen.html
  stable/8/contrib/bind9/doc/arm/man.dnssec-signzone.html
  stable/8/contrib/bind9/doc/arm/man.host.html
  stable/8/contrib/bind9/doc/arm/man.named-checkconf.html
  stable/8/contrib/bind9/doc/arm/man.named-checkzone.html
  stable/8/contrib/bind9/doc/arm/man.named.html
  stable/8/contrib/bind9/doc/arm/man.nsupdate.html
  stable/8/contrib/bind9/doc/arm/man.rndc-confgen.html
  stable/8/contrib/bind9/doc/arm/man.rndc.conf.html
  stable/8/contrib/bind9/doc/arm/man.rndc.html
  stable/8/contrib/bind9/lib/dns/adb.c
  stable/8/contrib/bind9/lib/dns/api
  stable/8/contrib/bind9/lib/dns/include/dns/diff.h
  stable/8/contrib/bind9/lib/dns/include/dns/ncache.h
  stable/8/contrib/bind9/lib/dns/include/dns/rdataset.h
  stable/8/contrib/bind9/lib/dns/include/dns/resolver.h
  stable/8/contrib/bind9/lib/dns/include/dns/result.h
  stable/8/contrib/bind9/lib/dns/include/dns/types.h
  stable/8/contrib/bind9/lib/dns/include/dns/validator.h
  stable/8/contrib/bind9/lib/dns/ncache.c
  stable/8/contrib/bind9/lib/dns/rbtdb.c
  stable/8/contrib/bind9/lib/dns/rdatalist.c
  stable/8/contrib/bind9/lib/dns/rdataset.c
  stable/8/contrib/bind9/lib/dns/rdataslab.c
  stable/8/contrib/bind9/lib/dns/resolver.c
  stable/8/contrib/bind9/lib/dns/result.c
  stable/8/contrib/bind9/lib/dns/sdb.c
  stable/8/contrib/bind9/lib/dns/sdlz.c
  stable/8/contrib/bind9/lib/dns/validator.c
  stable/8/contrib/bind9/lib/dns/view.c
  stable/8/contrib/bind9/lib/isc/api
  stable/8/contrib/bind9/lib/isc/include/isc/mem.h
  stable/8/contrib/bind9/lib/isc/mem.c
  stable/8/contrib/bind9/lib/lwres/man/lwres.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_buffer.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_config.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_context.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_gabn.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_gai_strerror.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_getaddrinfo.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_gethostent.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_getipnode.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_getnameinfo.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_getrrsetbyname.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_gnba.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_hstrerror.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_inetntop.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_noop.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_packet.html
  stable/8/contrib/bind9/lib/lwres/man/lwres_resutil.html
  stable/8/contrib/bind9/version
Directory Properties:
  stable/8/contrib/bind9/   (props changed)

Modified: stable/8/contrib/bind9/CHANGES
==============================================================================
--- stable/8/contrib/bind9/CHANGES	Thu Nov  4 21:47:28 2010	(r214810)
+++ stable/8/contrib/bind9/CHANGES	Thu Nov  4 21:48:39 2010	(r214811)
@@ -1,9 +1,48 @@
-	--- 9.6.2-P2 released ---
+	--- 9.6-ESV-R2 released ---
+
+2939.	[func]		Check that named successfully skips NSEC3 records
+			that fail to match the NSEC3PARAM record currently
+			in use. [RT# 21868]
+
+2937.	[bug]		Worked around an apparent race condition in over
+			memory conditions.  Without this fix a DNS cache DB or
+			ADB could incorrectly stay in an over memory state,
+			effectively refusing further caching, which
+			subsequently made a BIND 9 caching server unworkable.
+			This fix prevents this problem from happening by
+			polling the state of the memory context, rather than
+			making a copy of the state, which appeared to cause
+			a race.  This is a "workaround" in that it doesn't
+			solve the possible race per se, but several experiments
+			proved this change solves the symptom.  Also, the
+			polling overhead hasn't been reported to be an issue.
+			This bug should only affect a caching server that
+			specifies a finite max-cache-size.  It's also quite
+			likely that the bug happens only when enabling threads,
+			but it's not confirmed yet. [RT #21818]
+
+2925.	[bug]		Named failed to accept uncachable negative responses
+			from insecure zones. [RT# 21555]
+
+2921.	[bug]		The resolver could attempt to destroy a fetch context
+			too soon.  [RT #19878]
+
+2900.	[bug]		The placeholder negative caching element was not
+			properly constructed triggering a INSIST in 
+			dns_ncache_towire(). [RT #21346]
+			
+2890.	[bug]		Handle the introduction of new trusted-keys and
+			DS, DLV RRsets better. [RT #21097]
+
+2869.	[bug]		Fix arguments to dns_keytable_findnextkeynode() call.
+			[RT #20877]
+
+	--- 9.6-ESV-R1 released ---
 
 2876.	[bug]		Named could return SERVFAIL for negative responses
 			from unsigned zones. [RT #21131]
 
-	--- 9.6.2-P1 released ---
+	--- 9.6-ESV released ---
 
 2852.	[bug]		Handle broken DNSSEC trust chains better. [RT #15619]
 

Modified: stable/8/contrib/bind9/README
==============================================================================
--- stable/8/contrib/bind9/README	Thu Nov  4 21:47:28 2010	(r214810)
+++ stable/8/contrib/bind9/README	Thu Nov  4 21:48:39 2010	(r214811)
@@ -42,6 +42,12 @@ BIND 9
 		Stichting NLnet - NLnet Foundation
 		Nominum, Inc.
 
+BIND 9.6-ESV (Extended Support Version)
+
+	BIND 9.6-ESV will be supported until March 31, 2013, at
+	which time you will need to upgrade to the current release
+	of BIND.
+
 BIND 9.6.2
 
 	BIND 9.6.2 is a maintenance release, fixing bugs in 9.6.1.

Modified: stable/8/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html
==============================================================================
--- stable/8/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html	Thu Nov  4 21:47:28 2010	(r214810)
+++ stable/8/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html	Thu Nov  4 21:48:39 2010	(r214811)
@@ -1,5 +1,5 @@
 
 
-
+
 
 
 
@@ -33,14 +33,14 @@
 

dnssec-dsfromkey {-s} [-v level] [-1] [-2] [-a alg] [-c class] [-d dir] {dnsname}

-

DESCRIPTION

+

DESCRIPTION

dnssec-dsfromkey outputs the Delegation Signer (DS) resource record (RR), as defined in RFC 3658 and RFC 4509, for the given key(s).

-

OPTIONS

+

OPTIONS

-1

@@ -81,7 +81,7 @@

-

EXAMPLE

+

EXAMPLE

To build the SHA-256 DS RR from the Kexample.com.+003+26160 @@ -96,7 +96,7 @@

-

FILES

+

FILES

The keyfile can be designed by the key identification Knnnn.+aaa+iiiii or the full file name @@ -110,13 +110,13 @@

-

CAVEAT

+

CAVEAT

A keyfile error can give a "file not found" even if the file exists.

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -125,7 +125,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

Modified: stable/8/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.html ============================================================================== --- stable/8/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.html Thu Nov 4 21:48:39 2010 (r214811) @@ -13,7 +13,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -31,7 +31,7 @@

dnssec-keyfromlabel {-a algorithm} {-l label} [-c class] [-f flag] [-k] [-n nametype] [-p protocol] [-t type] [-v level] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keyfromlabel gets keys with the given label from a crypto hardware and builds key files for DNSSEC (Secure DNS), as defined in RFC 2535 @@ -39,7 +39,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm
@@ -120,7 +120,7 @@
-

GENERATED KEY FILES

+

GENERATED KEY FILES

When dnssec-keyfromlabel completes successfully, @@ -161,7 +161,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -169,7 +169,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

Modified: stable/8/contrib/bind9/bin/dnssec/dnssec-keygen.html ============================================================================== --- stable/8/contrib/bind9/bin/dnssec/dnssec-keygen.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/bin/dnssec/dnssec-keygen.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -32,7 +32,7 @@

dnssec-keygen {-a algorithm} {-b keysize} {-n nametype} [-c class] [-e] [-f flag] [-g generator] [-h] [-k] [-p protocol] [-r randomdev] [-s strength] [-t type] [-v level] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keygen generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 and RFC 4034. It can also generate keys for use with @@ -45,7 +45,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm
@@ -155,7 +155,7 @@
-

GENERATED KEYS

+

GENERATED KEYS

When dnssec-keygen completes successfully, @@ -201,7 +201,7 @@

-

EXAMPLE

+

EXAMPLE

To generate a 768-bit DSA key for the domain example.com, the following command would be @@ -222,7 +222,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-signzone(8), BIND 9 Administrator Reference Manual, RFC 2539, @@ -231,7 +231,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

Modified: stable/8/contrib/bind9/bin/dnssec/dnssec-signzone.html ============================================================================== --- stable/8/contrib/bind9/bin/dnssec/dnssec-signzone.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/bin/dnssec/dnssec-signzone.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -32,7 +32,7 @@

dnssec-signzone [-a] [-c class] [-d directory] [-e end-time] [-f output-file] [-g] [-h] [-k key] [-l domain] [-i interval] [-I input-format] [-j jitter] [-N soa-seria l-format] [-o origin] [-O output-format] [-p] [-P] [-r randomdev] [-s start-time] [-t] [-v level] [-z] [-3 salt] [-H iterations] [-A] {zonefile} [key...]

-

DESCRIPTION

+

DESCRIPTION

dnssec-signzone signs a zone. It generates NSEC and RRSIG records and produces a signed version of the @@ -43,7 +43,7 @@

-

OPTIONS

+

OPTIONS

-a

@@ -273,7 +273,7 @@

-

EXAMPLE

+

EXAMPLE

The following command signs the example.com zone with the DSA key generated by dnssec-keygen @@ -302,7 +302,7 @@ db.example.com.signed %

-

KNOWN BUGS

+

KNOWN BUGS

dnssec-signzone was designed so that it could sign a zone partially, using only a subset of the DNSSEC keys @@ -327,14 +327,14 @@ db.example.com.signed

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), BIND 9 Administrator Reference Manual, RFC 4033.

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

Modified: stable/8/contrib/bind9/bin/named/include/named/globals.h ============================================================================== --- stable/8/contrib/bind9/bin/named/include/named/globals.h Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/bin/named/include/named/globals.h Thu Nov 4 21:48:39 2010 (r214811) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008, 2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: globals.h,v 1.80 2008/11/16 22:49:18 marka Exp $ */ +/* $Id: globals.h,v 1.80.84.2 2010/06/26 23:46:15 tbox Exp $ */ #ifndef NAMED_GLOBALS_H #define NAMED_GLOBALS_H 1 @@ -132,6 +132,7 @@ EXTERN int ns_g_listen INIT(3); EXTERN isc_time_t ns_g_boottime; EXTERN isc_boolean_t ns_g_memstatistics INIT(ISC_FALSE); EXTERN isc_boolean_t ns_g_clienttest INIT(ISC_FALSE); +EXTERN isc_boolean_t ns_g_nosoa INIT(ISC_FALSE); #undef EXTERN #undef INIT Modified: stable/8/contrib/bind9/bin/named/main.c ============================================================================== --- stable/8/contrib/bind9/bin/named/main.c Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/bin/named/main.c Thu Nov 4 21:48:39 2010 (r214811) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: main.c,v 1.166.34.3 2009/04/03 20:18:59 marka Exp $ */ +/* $Id: main.c,v 1.166.34.3.24.3 2010/09/06 03:58:32 marka Exp $ */ /*! \file */ @@ -446,13 +446,15 @@ parse_command_line(int argc, char *argv[ /* XXXJAB should we make a copy? */ ns_g_chrootdir = isc_commandline_argument; break; - case 'T': + case 'T': /* NOT DOCUMENTED */ /* * clienttest: make clients single shot with their * own memory context. */ if (strcmp(isc_commandline_argument, "clienttest") == 0) ns_g_clienttest = ISC_TRUE; + else if (!strcmp(isc_commandline_argument, "nosoa")) + ns_g_nosoa = ISC_TRUE; else fprintf(stderr, "unknown -T flag '%s\n", isc_commandline_argument); Modified: stable/8/contrib/bind9/bin/named/query.c ============================================================================== --- stable/8/contrib/bind9/bin/named/query.c Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/bin/named/query.c Thu Nov 4 21:48:39 2010 (r214811) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.313.20.16 2009/12/30 08:34:29 jinmei Exp $ */ +/* $Id: query.c,v 1.313.20.16.10.2 2010/06/26 23:46:14 tbox Exp $ */ /*! \file */ @@ -56,6 +56,7 @@ #include #include +#include #include #include #include @@ -2038,7 +2039,7 @@ query_addrrset(ns_client_t *client, dns_ static inline isc_result_t query_addsoa(ns_client_t *client, dns_db_t *db, dns_dbversion_t *version, - isc_boolean_t zero_ttl) + isc_boolean_t zero_ttl, isc_boolean_t isassociated) { dns_name_t *name; dns_dbnode_t *node; @@ -2056,6 +2057,12 @@ query_addsoa(ns_client_t *client, dns_db node = NULL; /* + * Don't add the SOA record for test which set "-T nosoa". + */ + if (ns_g_nosoa && (!WANTDNSSEC(client) || !isassociated)) + return (ISC_R_SUCCESS); + + /* * Get resources and make 'name' be the database origin. */ result = dns_message_gettempname(client->message, &name); @@ -4324,7 +4331,8 @@ query_find(ns_client_t *client, dns_fetc /* * Add SOA. */ - result = query_addsoa(client, db, version, ISC_FALSE); + result = query_addsoa(client, db, version, ISC_FALSE, + dns_rdataset_isassociated(rdataset)); if (result != ISC_R_SUCCESS) { QUERY_ERROR(result); goto cleanup; @@ -4372,9 +4380,11 @@ query_find(ns_client_t *client, dns_fetc zone != NULL && #endif dns_zone_getzeronosoattl(zone)) - result = query_addsoa(client, db, version, ISC_TRUE); + result = query_addsoa(client, db, version, ISC_TRUE, + dns_rdataset_isassociated(rdataset)); else - result = query_addsoa(client, db, version, ISC_FALSE); + result = query_addsoa(client, db, version, ISC_FALSE, + dns_rdataset_isassociated(rdataset)); if (result != ISC_R_SUCCESS) { QUERY_ERROR(result); goto cleanup; @@ -4742,7 +4752,7 @@ query_find(ns_client_t *client, dns_fetc * Add SOA. */ result = query_addsoa(client, db, version, - ISC_FALSE); + ISC_FALSE, ISC_FALSE); if (result == ISC_R_SUCCESS) result = ISC_R_NOMORE; } else { Modified: stable/8/contrib/bind9/bin/named/server.c ============================================================================== --- stable/8/contrib/bind9/bin/named/server.c Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/bin/named/server.c Thu Nov 4 21:48:39 2010 (r214811) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.520.12.11.8.2 2010/02/25 10:57:11 tbox Exp $ */ +/* $Id: server.c,v 1.520.12.11.10.1 2010/03/03 22:06:36 marka Exp $ */ /*! \file */ Modified: stable/8/contrib/bind9/bin/nsupdate/nsupdate.html ============================================================================== --- stable/8/contrib/bind9/bin/nsupdate/nsupdate.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/bin/nsupdate/nsupdate.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -32,7 +32,7 @@

nsupdate [-d] [-D] [[-g] | [-o] | [-y [hmac:]keyname:secret] | [-k keyfile]] [-t timeout] [-u udptimeout] [-r udpretries] [-R randomdev] [-v] [filename]

-

DESCRIPTION

+

DESCRIPTION

nsupdate is used to submit Dynamic DNS Update requests as defined in RFC2136 to a name server. @@ -169,7 +169,7 @@

-

INPUT FORMAT

+

INPUT FORMAT

nsupdate reads input from filename @@ -433,7 +433,7 @@

-

EXAMPLES

+

EXAMPLES

The examples below show how nsupdate @@ -487,7 +487,7 @@

-

FILES

+

FILES

/etc/resolv.conf

@@ -506,7 +506,7 @@

-

SEE ALSO

+

SEE ALSO

RFC2136, RFC3007, RFC2104, @@ -519,7 +519,7 @@

-

BUGS

+

BUGS

The TSIG key is redundantly stored in two separate files. This is a consequence of nsupdate using the DST library Modified: stable/8/contrib/bind9/doc/arm/Bv9ARM-book.xml ============================================================================== --- stable/8/contrib/bind9/doc/arm/Bv9ARM-book.xml Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/Bv9ARM-book.xml Thu Nov 4 21:48:39 2010 (r214811) @@ -18,7 +18,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + BIND 9 Administrator Reference Manual Modified: stable/8/contrib/bind9/doc/arm/Bv9ARM.ch06.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/Bv9ARM.ch06.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/Bv9ARM.ch06.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/Bv9ARM.ch07.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/Bv9ARM.ch07.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/Bv9ARM.ch07.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/Bv9ARM.ch08.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/Bv9ARM.ch08.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/Bv9ARM.ch08.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/Bv9ARM.ch09.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/Bv9ARM.ch09.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/Bv9ARM.ch09.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/Bv9ARM.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/Bv9ARM.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/Bv9ARM.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/Bv9ARM.pdf ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/8/contrib/bind9/doc/arm/isc-logo.eps ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/8/contrib/bind9/doc/arm/isc-logo.pdf ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/8/contrib/bind9/doc/arm/man.dig.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.dig.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.dig.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.dnssec-keygen.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.dnssec-keygen.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.dnssec-keygen.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.dnssec-signzone.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.dnssec-signzone.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.dnssec-signzone.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.host.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.host.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.host.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.named-checkconf.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.named-checkconf.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.named-checkconf.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.named-checkzone.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.named-checkzone.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.named-checkzone.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.named.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.named.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.named.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.nsupdate.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.nsupdate.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.nsupdate.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.rndc-confgen.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.rndc-confgen.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.rndc-confgen.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.rndc.conf.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.rndc.conf.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.rndc.conf.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/doc/arm/man.rndc.html ============================================================================== --- stable/8/contrib/bind9/doc/arm/man.rndc.html Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/doc/arm/man.rndc.html Thu Nov 4 21:48:39 2010 (r214811) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + Modified: stable/8/contrib/bind9/lib/dns/adb.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/adb.c Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/lib/dns/adb.c Thu Nov 4 21:48:39 2010 (r214811) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: adb.c,v 1.243.42.4 2009/02/03 22:34:28 jinmei Exp $ */ +/* $Id: adb.c,v 1.243.42.4.24.2 2010/08/12 23:46:24 tbox Exp $ */ /*! \file * @@ -118,7 +118,6 @@ struct dns_adb { isc_taskmgr_t *taskmgr; isc_task_t *task; - isc_boolean_t overmem; isc_interval_t tick_interval; int next_cleanbucket; @@ -294,8 +293,8 @@ static inline void inc_adb_irefcnt(dns_a static inline void inc_adb_erefcnt(dns_adb_t *); static inline void inc_entry_refcnt(dns_adb_t *, dns_adbentry_t *, isc_boolean_t); -static inline isc_boolean_t dec_entry_refcnt(dns_adb_t *, dns_adbentry_t *, - isc_boolean_t); +static inline isc_boolean_t dec_entry_refcnt(dns_adb_t *, isc_boolean_t, + dns_adbentry_t *, isc_boolean_t); static inline void violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *); static isc_boolean_t clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static void clean_target(dns_adb_t *, dns_name_t *); @@ -777,7 +776,7 @@ link_entry(dns_adb_t *adb, int bucket, d int i; dns_adbentry_t *e; - if (adb->overmem) { + if (isc_mem_isovermem(adb->mctx)) { for (i = 0; i < 2; i++) { e = ISC_LIST_TAIL(adb->entries[bucket]); if (e == NULL) @@ -943,6 +942,7 @@ clean_namehooks(dns_adb_t *adb, dns_adbn dns_adbnamehook_t *namehook; int addr_bucket; isc_boolean_t result = ISC_FALSE; + isc_boolean_t overmem = isc_mem_isovermem(adb->mctx); addr_bucket = DNS_ADB_INVALIDBUCKET; namehook = ISC_LIST_HEAD(*namehooks); @@ -963,7 +963,8 @@ clean_namehooks(dns_adb_t *adb, dns_adbn LOCK(&adb->entrylocks[addr_bucket]); } - result = dec_entry_refcnt(adb, entry, ISC_FALSE); + result = dec_entry_refcnt(adb, overmem, entry, + ISC_FALSE); } /* @@ -1235,7 +1236,9 @@ inc_entry_refcnt(dns_adb_t *adb, dns_adb } static inline isc_boolean_t -dec_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) { +dec_entry_refcnt(dns_adb_t *adb, isc_boolean_t overmem, dns_adbentry_t *entry, + isc_boolean_t lock) +{ int bucket; isc_boolean_t destroy_entry; isc_boolean_t result = ISC_FALSE; @@ -1250,7 +1253,7 @@ dec_entry_refcnt(dns_adb_t *adb, dns_adb destroy_entry = ISC_FALSE; if (entry->refcnt == 0 && - (adb->entry_sd[bucket] || entry->expires == 0 || adb->overmem || + (adb->entry_sd[bucket] || entry->expires == 0 || overmem || (entry->flags & ENTRY_IS_DEAD) != 0)) { destroy_entry = ISC_TRUE; result = unlink_entry(adb, entry); @@ -1852,7 +1855,7 @@ check_stale_name(dns_adb_t *adb, int buc int victims, max_victims; isc_boolean_t result; dns_adbname_t *victim, *next_victim; - isc_boolean_t overmem = adb->overmem; + isc_boolean_t overmem = isc_mem_isovermem(adb->mctx); int scans = 0; INSIST(bucket != DNS_ADB_INVALIDBUCKET); @@ -2049,7 +2052,6 @@ dns_adb_create(isc_mem_t *mem, dns_view_ adb, NULL, NULL); adb->cevent_sent = ISC_FALSE; adb->shutting_down = ISC_FALSE; - adb->overmem = ISC_FALSE; ISC_LIST_INIT(adb->whenshutdown); isc_mem_attach(mem, &adb->mctx); @@ -2616,6 +2618,7 @@ dns_adb_destroyfind(dns_adbfind_t **find dns_adbaddrinfo_t *ai; int bucket; dns_adb_t *adb; + isc_boolean_t overmem; REQUIRE(findp != NULL && DNS_ADBFIND_VALID(*findp)); find = *findp; @@ -2640,13 +2643,14 @@ dns_adb_destroyfind(dns_adbfind_t **find * Return the find to the memory pool, and decrement the adb's * reference count. */ + overmem = isc_mem_isovermem(adb->mctx); ai = ISC_LIST_HEAD(find->list); while (ai != NULL) { ISC_LIST_UNLINK(find->list, ai, publink); entry = ai->entry; ai->entry = NULL; INSIST(DNS_ADBENTRY_VALID(entry)); - RUNTIME_CHECK(dec_entry_refcnt(adb, entry, ISC_TRUE) == + RUNTIME_CHECK(dec_entry_refcnt(adb, overmem, entry, ISC_TRUE) == ISC_FALSE); free_adbaddrinfo(adb, &ai); ai = ISC_LIST_HEAD(find->list); @@ -3509,6 +3513,7 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns int bucket; isc_stdtime_t now; isc_boolean_t want_check_exit = ISC_FALSE; + isc_boolean_t overmem; REQUIRE(DNS_ADB_VALID(adb)); REQUIRE(addrp != NULL); @@ -3520,13 +3525,14 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns isc_stdtime_get(&now); *addrp = NULL; + overmem = isc_mem_isovermem(adb->mctx); bucket = addr->entry->lock_bucket; LOCK(&adb->entrylocks[bucket]); entry->expires = now + ADB_ENTRY_WINDOW; - want_check_exit = dec_entry_refcnt(adb, entry, ISC_FALSE); + want_check_exit = dec_entry_refcnt(adb, overmem, entry, ISC_FALSE); UNLOCK(&adb->entrylocks[bucket]); @@ -3591,6 +3597,14 @@ dns_adb_flushname(dns_adb_t *adb, dns_na static void water(void *arg, int mark) { + /* + * We're going to change the way to handle overmem condition: use + * isc_mem_isovermem() instead of storing the state via this callback, + * since the latter way tends to cause race conditions. + * To minimize the change, and in case we re-enable the callback + * approach, however, keep this function at the moment. + */ + dns_adb_t *adb = arg; isc_boolean_t overmem = ISC_TF(mark == ISC_MEM_HIWATER); @@ -3598,17 +3612,6 @@ water(void *arg, int mark) { DP(ISC_LOG_DEBUG(1), "adb reached %s water mark", overmem ? "high" : "low"); - - /* - * We can't use adb->lock as there is potential for water - * to be called when adb->lock is held. - */ - LOCK(&adb->overmemlock); - if (adb->overmem != overmem) { - adb->overmem = overmem; - isc_mem_waterack(adb->mctx, mark); - } - UNLOCK(&adb->overmemlock); } void Modified: stable/8/contrib/bind9/lib/dns/api ============================================================================== --- stable/8/contrib/bind9/lib/dns/api Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/lib/dns/api Thu Nov 4 21:48:39 2010 (r214811) @@ -1,3 +1,3 @@ -LIBINTERFACE = 56 -LIBREVISION = 1 -LIBAGE = 1 +LIBINTERFACE = 57 +LIBREVISION = 0 +LIBAGE = 2 Modified: stable/8/contrib/bind9/lib/dns/include/dns/diff.h ============================================================================== --- stable/8/contrib/bind9/lib/dns/include/dns/diff.h Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/lib/dns/include/dns/diff.h Thu Nov 4 21:48:39 2010 (r214811) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: diff.h,v 1.15.120.2 2009/01/18 23:47:41 tbox Exp $ */ +/* $Id: diff.h,v 1.15.120.2.24.2 2010/06/04 23:49:23 tbox Exp $ */ #ifndef DNS_DIFF_H #define DNS_DIFF_H 1 @@ -70,7 +70,7 @@ typedef enum { DNS_DIFFOP_DEL = 1, /*%< Delete an RR. */ DNS_DIFFOP_EXISTS = 2, /*%< Assert RR existence. */ DNS_DIFFOP_ADDRESIGN = 4, /*%< ADD + RESIGN. */ - DNS_DIFFOP_DELRESIGN = 5, /*%< DEL + RESIGN. */ + DNS_DIFFOP_DELRESIGN = 5 /*%< DEL + RESIGN. */ } dns_diffop_t; typedef struct dns_difftuple dns_difftuple_t; Modified: stable/8/contrib/bind9/lib/dns/include/dns/ncache.h ============================================================================== --- stable/8/contrib/bind9/lib/dns/include/dns/ncache.h Thu Nov 4 21:47:28 2010 (r214810) +++ stable/8/contrib/bind9/lib/dns/include/dns/ncache.h Thu Nov 4 21:48:39 2010 (r214811) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ncache.h,v 1.25.48.2 2009/12/30 23:47:31 tbox Exp $ */ +/* $Id: ncache.h,v 1.25.48.2.10.2 2010/05/14 23:48:44 tbox Exp $ */ #ifndef DNS_NCACHE_H #define DNS_NCACHE_H 1 @@ -161,6 +161,13 @@ dns_ncache_getrdataset(dns_rdataset_t *n * */ +isc_result_t +dns_ncache_getsigrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Nov 4 21:50:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7CAB1065693; Thu, 4 Nov 2010 21:50:19 +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 923548FC1B; Thu, 4 Nov 2010 21:50: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 oA4LoJVM074229; Thu, 4 Nov 2010 21:50:19 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4LoJH8074225; Thu, 4 Nov 2010 21:50:19 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201011042150.oA4LoJH8074225@svn.freebsd.org> From: Doug Barton Date: Thu, 4 Nov 2010 21:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214812 - in stable/7/contrib/bind9: . bin/named doc/arm doc/draft doc/rfc lib/dns lib/dns/include/dns X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2010 21:50:19 -0000 Author: dougb Date: Thu Nov 4 21:50:19 2010 New Revision: 214812 URL: http://svn.freebsd.org/changeset/base/214812 Log: MFV version 9.4-ESV-R3 This version contains several fixes for DNSSEC and DLV, as well as fixes relevant to any resolving name server. Added: stable/7/contrib/bind9/doc/draft/draft-ietf-behave-dns64-10.txt - copied unchanged from r214805, vendor/bind9/dist-9.4/doc/draft/draft-ietf-behave-dns64-10.txt stable/7/contrib/bind9/doc/draft/draft-ietf-dnsext-dnssec-registry-fixes-06.txt - copied unchanged from r214805, vendor/bind9/dist-9.4/doc/draft/draft-ietf-dnsext-dnssec-registry-fixes-06.txt stable/7/contrib/bind9/doc/draft/draft-ietf-dnsop-dnssec-key-timing-00.txt - copied unchanged from r214805, vendor/bind9/dist-9.4/doc/draft/draft-ietf-dnsop-dnssec-key-timing-00.txt stable/7/contrib/bind9/doc/draft/draft-mekking-dnsop-auto-cpsync-00.txt - copied unchanged from r214805, vendor/bind9/dist-9.4/doc/draft/draft-mekking-dnsop-auto-cpsync-00.txt stable/7/contrib/bind9/doc/draft/draft-yao-dnsext-bname-04.txt - copied unchanged from r214805, vendor/bind9/dist-9.4/doc/draft/draft-yao-dnsext-bname-04.txt stable/7/contrib/bind9/doc/rfc/rfc5933.txt - copied unchanged from r214805, vendor/bind9/dist-9.4/doc/rfc/rfc5933.txt Deleted: stable/7/contrib/bind9/doc/draft/draft-ietf-behave-dns64-09.txt stable/7/contrib/bind9/doc/draft/draft-ietf-dnsext-dnssec-gost-07.txt Modified: stable/7/contrib/bind9/CHANGES stable/7/contrib/bind9/bin/named/query.c stable/7/contrib/bind9/doc/arm/isc-logo.eps stable/7/contrib/bind9/doc/arm/isc-logo.pdf stable/7/contrib/bind9/doc/rfc/index stable/7/contrib/bind9/lib/dns/api stable/7/contrib/bind9/lib/dns/include/dns/ncache.h stable/7/contrib/bind9/lib/dns/include/dns/types.h stable/7/contrib/bind9/lib/dns/ncache.c stable/7/contrib/bind9/lib/dns/resolver.c stable/7/contrib/bind9/lib/dns/validator.c stable/7/contrib/bind9/version Directory Properties: stable/7/contrib/bind9/ (props changed) Modified: stable/7/contrib/bind9/CHANGES ============================================================================== --- stable/7/contrib/bind9/CHANGES Thu Nov 4 21:48:39 2010 (r214811) +++ stable/7/contrib/bind9/CHANGES Thu Nov 4 21:50:19 2010 (r214812) @@ -1,3 +1,32 @@ + --- 9.4-ESV-R3 released --- + +2925. [bug] Named failed to accept uncachable negative responses + from insecure zones. [RT# 21555] + +2921. [bug] The resolver could attempt to destroy a fetch context + too soon. [RT #19878] + +2904. [bug] When using DLV, sub-zones of the zones in the DLV, + could be incorrectly marked as insecure instead of + secure leading to negative proofs failing. This was + a unintended outcome from change 2890. [RT# 21392] + +2900. [bug] The placeholder negative caching element was not + properly constructed triggering a INSIST in + dns_ncache_towire(). [RT #21346] + +2890. [bug] Handle the introduction of new trusted-keys and + DS, DLV RRsets better. [RT #21097] + +2869. [bug] Fix arguments to dns_keytable_findnextkeynode() call. + [RT #20877] + +2678. [func] Treat DS queries as if "minimal-response yes;" + was set. [RT #20258] + +2427. [func] Treat DNSKEY queries as if "minimal-response yes;" + was set. [RT #18528] + --- 9.4-ESV-R2 released --- 2876. [bug] Named could return SERVFAIL for negative responses Modified: stable/7/contrib/bind9/bin/named/query.c ============================================================================== --- stable/7/contrib/bind9/bin/named/query.c Thu Nov 4 21:48:39 2010 (r214811) +++ stable/7/contrib/bind9/bin/named/query.c Thu Nov 4 21:50:19 2010 (r214812) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.257.18.53 2009/12/30 08:55:48 jinmei Exp $ */ +/* $Id: query.c,v 1.257.18.55 2010/07/03 23:45:26 tbox Exp $ */ /*! \file */ @@ -4654,6 +4654,13 @@ ns_query_start(ns_client_t *client) { } /* + * Turn on minimal response for DNSKEY and DS queries. + */ + if (qtype == dns_rdatatype_dnskey || qtype == dns_rdatatype_ds) + client->query.attributes |= (NS_QUERYATTR_NOAUTHORITY | + NS_QUERYATTR_NOADDITIONAL); + + /* * If the client has requested that DNSSEC checking be disabled, * allow lookups to return pending data and instruct the resolver * to return data before validation has completed. Modified: stable/7/contrib/bind9/doc/arm/isc-logo.eps ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/7/contrib/bind9/doc/arm/isc-logo.pdf ============================================================================== Binary file (source and/or target). No diff available. Copied: stable/7/contrib/bind9/doc/draft/draft-ietf-behave-dns64-10.txt (from r214805, vendor/bind9/dist-9.4/doc/draft/draft-ietf-behave-dns64-10.txt) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/contrib/bind9/doc/draft/draft-ietf-behave-dns64-10.txt Thu Nov 4 21:50:19 2010 (r214812, copy of r214805, vendor/bind9/dist-9.4/doc/draft/draft-ietf-behave-dns64-10.txt) @@ -0,0 +1,1736 @@ + + + +BEHAVE WG M. Bagnulo +Internet-Draft UC3M +Intended status: Standards Track A. Sullivan +Expires: January 6, 2011 Shinkuro + P. Matthews + Alcatel-Lucent + I. van Beijnum + IMDEA Networks + July 5, 2010 + + +DNS64: DNS extensions for Network Address Translation from IPv6 Clients + to IPv4 Servers + draft-ietf-behave-dns64-10 + +Abstract + + DNS64 is a mechanism for synthesizing AAAA records from A records. + DNS64 is used with an IPv6/IPv4 translator to enable client-server + communication between an IPv6-only client and an IPv4-only server, + without requiring any changes to either the IPv6 or the IPv4 node, + for the class of applications that work through NATs. This document + specifies DNS64, and provides suggestions on how it should be + deployed in conjunction with IPv6/IPv4 translators. + +Status of this Memo + + This Internet-Draft is submitted in full conformance with the + provisions of BCP 78 and BCP 79. + + Internet-Drafts are working documents of the Internet Engineering + Task Force (IETF). Note that other groups may also distribute + working documents as Internet-Drafts. The list of current Internet- + Drafts is at http://datatracker.ietf.org/drafts/current/. + + Internet-Drafts are draft documents valid for a maximum of six months + and may be updated, replaced, or obsoleted by other documents at any + time. It is inappropriate to use Internet-Drafts as reference + material or to cite them other than as "work in progress." + + This Internet-Draft will expire on January 6, 2011. + +Copyright Notice + + Copyright (c) 2010 IETF Trust and the persons identified as the + document authors. All rights reserved. + + This document is subject to BCP 78 and the IETF Trust's Legal + + + +Bagnulo, et al. Expires January 6, 2011 [Page 1] + +Internet-Draft DNS64 July 2010 + + + Provisions Relating to IETF Documents + (http://trustee.ietf.org/license-info) in effect on the date of + publication of this document. Please review these documents + carefully, as they describe your rights and restrictions with respect + to this document. Code Components extracted from this document must + include Simplified BSD License text as described in Section 4.e of + the Trust Legal Provisions and are provided without warranty as + described in the Simplified BSD License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Bagnulo, et al. Expires January 6, 2011 [Page 2] + +Internet-Draft DNS64 July 2010 + + +Table of Contents + + 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5 + 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 + 3. Background to DNS64-DNSSEC interaction . . . . . . . . . . . . 8 + 4. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 9 + 5. DNS64 Normative Specification . . . . . . . . . . . . . . . . 10 + 5.1. Resolving AAAA queries and the answer section . . . . . . 11 + 5.1.1. The answer when there is AAAA data available . . . . . 11 + 5.1.2. The answer when there is an error . . . . . . . . . . 11 + 5.1.3. Dealing with timeouts . . . . . . . . . . . . . . . . 12 + 5.1.4. Special exclusion set for AAAA records . . . . . . . . 12 + 5.1.5. Dealing with CNAME and DNAME . . . . . . . . . . . . . 12 + 5.1.6. Data for the answer when performing synthesis . . . . 13 + 5.1.7. Performing the synthesis . . . . . . . . . . . . . . . 13 + 5.1.8. Querying in parallel . . . . . . . . . . . . . . . . . 14 + 5.2. Generation of the IPv6 representations of IPv4 + addresses . . . . . . . . . . . . . . . . . . . . . . . . 14 + 5.3. Handling other Resource Records and the Additional + Section . . . . . . . . . . . . . . . . . . . . . . . . . 15 + 5.3.1. PTR Resource Record . . . . . . . . . . . . . . . . . 15 + 5.3.2. Handling the additional section . . . . . . . . . . . 16 + 5.3.3. Other Resource Records . . . . . . . . . . . . . . . . 17 + 5.4. Assembling a synthesized response to a AAAA query . . . . 17 + 5.5. DNSSEC processing: DNS64 in recursive resolver mode . . . 17 + 6. Deployment notes . . . . . . . . . . . . . . . . . . . . . . . 18 + 6.1. DNS resolvers and DNS64 . . . . . . . . . . . . . . . . . 19 + 6.2. DNSSEC validators and DNS64 . . . . . . . . . . . . . . . 19 + 6.3. DNS64 and multihomed and dual-stack hosts . . . . . . . . 19 + 6.3.1. IPv6 multihomed hosts . . . . . . . . . . . . . . . . 19 + 6.3.2. Accidental dual-stack DNS64 use . . . . . . . . . . . 20 + 6.3.3. Intentional dual-stack DNS64 use . . . . . . . . . . . 20 + 7. Deployment scenarios and examples . . . . . . . . . . . . . . 21 + 7.1. Example of An-IPv6-network-to-IPv4-Internet setup with + DNS64 in DNS server mode . . . . . . . . . . . . . . . . . 22 + 7.2. An example of an-IPv6-network-to-IPv4-Internet setup + with DNS64 in stub-resolver mode . . . . . . . . . . . . . 23 + 7.3. Example of IPv6-Internet-to-an-IPv4-network setup + DNS64 in DNS server mode . . . . . . . . . . . . . . . . . 24 + 8. Security Considerations . . . . . . . . . . . . . . . . . . . 27 + 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 27 + 10. Contributors . . . . . . . . . . . . . . . . . . . . . . . . . 27 + 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 27 + 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 28 + 12.1. Normative References . . . . . . . . . . . . . . . . . . . 28 + 12.2. Informative References . . . . . . . . . . . . . . . . . . 28 + Appendix A. Motivations and Implications of synthesizing AAAA + Resource Records when real AAAA Resource Records + + + +Bagnulo, et al. Expires January 6, 2011 [Page 3] + +Internet-Draft DNS64 July 2010 + + + exist . . . . . . . . . . . . . . . . . . . . . . . . 29 + Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 31 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Bagnulo, et al. Expires January 6, 2011 [Page 4] + +Internet-Draft DNS64 July 2010 + + +1. Introduction + + This document specifies DNS64, a mechanism that is part of the + toolbox for IPv6-IPv4 transition and co-existence. DNS64, used + together with an IPv6/IPv4 translator such as stateful NAT64 + [I-D.ietf-behave-v6v4-xlate-stateful], allows an IPv6-only client to + initiate communications by name to an IPv4-only server. + + DNS64 is a mechanism for synthesizing AAAA resource records (RRs) + from A RRs. A synthetic AAAA RR created by the DNS64 from an + original A RR contains the same owner name of the original A RR but + it contains an IPv6 address instead of an IPv4 address. The IPv6 + address is an IPv6 representation of the IPv4 address contained in + the original A RR. The IPv6 representation of the IPv4 address is + algorithmically generated from the IPv4 address returned in the A RR + and a set of parameters configured in the DNS64 (typically, an IPv6 + prefix used by IPv6 representations of IPv4 addresses and optionally + other parameters). + + Together with an IPv6/IPv4 translator, these two mechanisms allow an + IPv6-only client to initiate communications to an IPv4-only server + using the FQDN of the server. + + These mechanisms are expected to play a critical role in the IPv4- + IPv6 transition and co-existence. Due to IPv4 address depletion, it + is likely that in the future, many IPv6-only clients will want to + connect to IPv4-only servers. In the typical case, the approach only + requires the deployment of IPv6/IPv4 translators that connect an + IPv6-only network to an IPv4-only network, along with the deployment + of one or more DNS64-enabled name servers. However, some advanced + features require performing the DNS64 function directly in the end- + hosts themselves. + + +2. Overview + + This section provides a non-normative introduction to the DNS64 + mechanism. + + We assume that we have one or more IPv6/IPv4 translator boxes + connecting an IPv4 network and an IPv6 network. The IPv6/IPv4 + translator device provides translation services between the two + networks enabling communication between IPv4-only hosts and IPv6-only + hosts. (NOTE: By IPv6-only hosts we mean hosts running IPv6-only + applications, hosts that can only use IPv6, as well as cases where + only IPv6 connectivity is available to the client. By IPv4-only + servers we mean servers running IPv4-only applications, servers that + can only use IPv4, as well as cases where only IPv4 connectivity is + + + +Bagnulo, et al. Expires January 6, 2011 [Page 5] + +Internet-Draft DNS64 July 2010 + + + available to the server). Each IPv6/IPv4 translator used in + conjunction with DNS64 must allow communications initiated from the + IPv6-only host to the IPv4-only host. + + To allow an IPv6 initiator to do a standard AAAA RR DNS lookup to + learn the address of the responder, DNS64 is used to synthesize a + AAAA record from an A record containing a real IPv4 address of the + responder, whenever the DNS64 cannot retrieve a AAAA record for the + queried name. The DNS64 service appears as a regular DNS server or + resolver to the IPv6 initiator. The DNS64 receives a AAAA DNS query + generated by the IPv6 initiator. It first attempts a resolution for + the requested AAAA records. If there are no AAAA records available + for the target node (which is the normal case when the target node is + an IPv4-only node), DNS64 performs a query for A records. For each A + record discovered, DNS64 creates a synthetic AAAA RR from the + information retrieved in the A RR. + + The owner name of a synthetic AAAA RR is the same as that of the + original A RR, but an IPv6 representation of the IPv4 address + contained in the original A RR is included in the AAAA RR. The IPv6 + representation of the IPv4 address is algorithmically generated from + the IPv4 address and additional parameters configured in the DNS64. + Among those parameters configured in the DNS64, there is at least one + IPv6 prefix. If not explicitly mentioned, all prefixes are treated + equally and the operations described in this document are performed + using the prefixes available. So as to be general, we will call any + of these prefixes Pref64::/n, and describe the operations made with + the generic prefix Pref64::/n. The IPv6 address representing IPv4 + addresses included in the AAAA RR synthesized by the DNS64 contain + Pref64::/n and they also embed the original IPv4 address. + + The same algorithm and the same Pref64::/n prefix(es) must be + configured both in the DNS64 device and the IPv6/IPv4 translator(s), + so that both can algorithmically generate the same IPv6 + representation for a given IPv4 address. In addition, it is required + that IPv6 packets addressed to an IPv6 destination address that + contains the Pref64::/n be delivered to an IPv6/IPv4 translator that + has that particular Pref64::/n configured, so they can be translated + into IPv4 packets. + + Once the DNS64 has synthesized the AAAA RRs, the synthetic AAAA RRs + are passed back to the IPv6 initiator, which will initiate an IPv6 + communication with the IPv6 address associated with the IPv4 + receiver. The packet will be routed to an IPv6/IPv4 translator which + will forward it to the IPv4 network. + + In general, the only shared state between the DNS64 and the IPv6/IPv4 + translator is the Pref64::/n and an optional set of static + + + +Bagnulo, et al. Expires January 6, 2011 [Page 6] + +Internet-Draft DNS64 July 2010 + + + parameters. The Pref64::/n and the set of static parameters must be + configured to be the same on both; there is no communication between + the DNS64 device and IPv6/IPv4 translator functions. The mechanism + to be used for configuring the parameters of the DNS64 is beyond the + scope of this memo. + + The prefixes to be used as Pref64::/n and their applicability are + discussed in [I-D.ietf-behave-address-format]. There are two types + of prefixes that can be used as Pref64::/n. + + The Pref64::/n can be the Well-Known Prefix 64:FF9B::/96 reserved + by [I-D.ietf-behave-address-format] for the purpose of + representing IPv4 addresses in IPv6 address space. + + The Pref64::/n can be a Network-Specific Prefix (NSP). An NSP is + an IPv6 prefix assigned by an organization to create IPv6 + representations of IPv4 addresses. + + The main difference in the nature of the two types of prefixes is + that the NSP is a locally assigned prefix that is under control of + the organization that is providing the translation services, while + the Well-Known Prefix is a prefix that has a global meaning since it + has been assigned for the specific purpose of representing IPv4 + addresses in IPv6 address space. + + The DNS64 function can be performed in any of three places. The + terms below are more formally defined in Section 4. + + The first option is to locate the DNS64 function in authoritative + servers for a zone. In this case, the authoritative server provides + synthetic AAAA RRs for an IPv4-only host in its zone. This is one + type of DNS64 server. + + Another option is to locate the DNS64 function in recursive name + servers serving end hosts. In this case, when an IPv6-only host + queries the name server for AAAA RRs for an IPv4-only host, the name + server can perform the synthesis of AAAA RRs and pass them back to + the IPv6-only initiator. The main advantage of this mode is that + current IPv6 nodes can use this mechanism without requiring any + modification. This mode is called "DNS64 in DNS recursive resolver + mode" . This is a second type of DNS64 server, and it is also one + type of DNS64 resolver. + + The last option is to place the DNS64 function in the end hosts, + coupled to the local (stub) resolver. In this case, the stub + resolver will try to obtain (real) AAAA RRs and in case they are not + available, the DNS64 function will synthesize AAAA RRs for internal + usage. This mode is compatible with some advanced functions like + + + +Bagnulo, et al. Expires January 6, 2011 [Page 7] + +Internet-Draft DNS64 July 2010 + + + DNSSEC validation in the end host. The main drawback of this mode is + its deployability, since it requires changes in the end hosts. This + mode is called "DNS64 in stub-resolver mode". This is the second + type of DNS64 resolver. + + +3. Background to DNS64-DNSSEC interaction + + DNSSEC ([RFC4033], [RFC4034], [RFC4035]) presents a special challenge + for DNS64, because DNSSEC is designed to detect changes to DNS + answers, and DNS64 may alter answers coming from an authoritative + server. + + A recursive resolver can be security-aware or security-oblivious. + Moreover, a security-aware recursive resolver can be validating or + non-validating, according to operator policy. In the cases below, + the recursive resolver is also performing DNS64, and has a local + policy to validate. We call this general case vDNS64, but in all the + cases below the DNS64 functionality should be assumed needed. + + DNSSEC includes some signaling bits that offer some indicators of + what the query originator understands. + + If a query arrives at a vDNS64 device with the "DNSSEC OK" (DO) bit + set, the query originator is signaling that it understands DNSSEC. + The DO bit does not indicate that the query originator will validate + the response. It only means that the query originator can understand + responses containing DNSSEC data. Conversely, if the DO bit is + clear, that is evidence that the querying agent is not aware of + DNSSEC. + + If a query arrives at a vDNS64 device with the "Checking Disabled" + (CD) bit set, it is an indication that the querying agent wants all + the validation data so it can do checking itself. By local policy, + vDNS64 could still validate, but it must return all data to the + querying agent anyway. + + Here are the possible cases: + + 1. A DNS64 (DNSSEC-aware or DNSSEC-oblivious) receives a query with + the DO bit clear. In this case, DNSSEC is not a concern, because + the querying agent does not understand DNSSEC responses. + + 2. A security-oblivious DNS64 receives a query with the DO bit set, + and the CD bit clear or set. This is just like the case of a + non-DNS64 case: the server doesn't support it, so the querying + agent is out of luck. + + + + +Bagnulo, et al. Expires January 6, 2011 [Page 8] + +Internet-Draft DNS64 July 2010 + + + 3. A security-aware and non-validating DNS64 receives a query with + the DO bit set and the CD bit clear. Such a resolver is not + validating responses, likely due to local policy (see [RFC4035], + section 4.2). For that reason, this case amounts to the same as + the previous case, and no validation happens. + + 4. A security-aware and non-validating DNS64 receives a query with + the DO bit set and the CD bit set. In this case, the resolver is + supposed to pass on all the data it gets to the query initiator + (see section 3.2.2 of [RFC4035]). This case will not work with + DNS64, unless the validating resolver is prepared to do DNS64 + itself. If the DNS64 server modifies the record, the client will + get the data back and try to validate it, and the data will be + invalid as far as the client is concerned. + + 5. A security-aware and validating DNS64 node receives a query with + the DO bit clear and CD clear. In this case, the resolver + validates the data. If it fails, it returns RCODE 2 (Server + failure); otherwise, it returns the answer. This is the ideal + case for vDNS64. The resolver validates the data, and then + synthesizes the new record and passes that to the client. The + client, which is presumably not validating (else it should have + set DO and CD), cannot tell that DNS64 is involved. + + 6. A security-aware and validating DNS64 node receives a query with + the DO bit set and CD clear. This works like the previous case, + except that the resolver should also set the "Authentic Data" + (AD) bit on the response. + + 7. A security-aware and validating DNS64 node receives a query with + the DO bit set and CD set. This is effectively the same as the + case where a security-aware and non-validating recursive resolver + receives a similar query, and the same thing will happen: the + downstream validator will mark the data as invalid if DNS64 has + performed synthesis. The node needs to do DNS64 itself, or else + communication will fail. + + +4. Terminology + + This section provides definitions for the special terms used in the + document. + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in RFC 2119 [RFC2119]. + + + + + +Bagnulo, et al. Expires January 6, 2011 [Page 9] + +Internet-Draft DNS64 July 2010 + + + Authoritative server: A DNS server that can answer authoritatively a + given DNS question. + + DNS64: A logical function that synthesizes DNS resource records (e.g + AAAA records containing IPv6 addresses) from DNS resource records + actually contained in the DNS (e.g., A records containing IPv4 + addresses). + + DNS64 recursor: A recursive resolver that provides the DNS64 + functionality as part of its operation. This is the same thing as + "DNS64 in recursive resolver mode". + + DNS64 resolver: Any resolver (stub resolver or recursive resolver) + that provides the DNS64 function. + + DNS64 server: Any server providing the DNS64 function. + + Recursive resolver: A DNS server that accepts requests from one + resolver, and asks another server (of some description) for the + answer on behalf of the first resolver. + + Synthetic RR: A DNS resource record (RR) that is not contained in + any zone data file, but has been synthesized from other RRs. An + example is a synthetic AAAA record created from an A record. + + IPv6/IPv4 translator: A device that translates IPv6 packets to IPv4 + packets and vice-versa. It is only required that the + communication initiated from the IPv6 side be supported. + + For a detailed understanding of this document, the reader should also + be familiar with DNS terminology from [RFC1034], [RFC1035] and + current NAT terminology from [RFC4787]. Some parts of this document + assume familiarity with the terminology of the DNS security + extensions outlined in [RFC4035]. It is worth emphasizing that while + DNS64 is a logical function separate from the DNS, it is nevertheless + closely associated with that protocol. It depends on the DNS + protocol, and some behavior of DNS64 will interact with regular DNS + responses. + + +5. DNS64 Normative Specification + + DNS64 is a logical function that synthesizes AAAA records from A + records. The DNS64 function may be implemented in a stub resolver, + in a recursive resolver, or in an authoritative name server. It + works within those DNS functions, and appears on the network as + though it were a "plain" DNS resolver or name server conforming to + [RFC1034], and [RFC1035]. + + + +Bagnulo, et al. Expires January 6, 2011 [Page 10] + +Internet-Draft DNS64 July 2010 + + + The implementation SHOULD support mapping of separate IPv4 address + ranges to separate IPv6 prefixes for AAAA record synthesis. This + allows handling of special use IPv4 addresses [RFC5735]. + + DNS64 also responds to PTR queries involving addresses containing any + of the IPv6 prefixes it uses for synthesis of AAAA RRs. + +5.1. Resolving AAAA queries and the answer section + + When the DNS64 receives a query for RRs of type AAAA and class IN, it + first attempts to retrieve non-synthetic RRs of this type and class, + either by performing a query or, in the case of an authoritative + server, by examining its own results. The query may be answered from + a local cache, if one is available. DNS64 operation for classes + other than IN is undefined, and a DNS64 MUST behave as though no + DNS64 function is configured. + +5.1.1. The answer when there is AAAA data available + + If the query results in one or more AAAA records in the answer + section, the result is returned to the requesting client as per + normal DNS semantics, except in the case where any of the AAAA + records match a special exclusion set of prefixes, considered in + Section 5.1.4. If there is (non-excluded) AAAA data available, DNS64 + SHOULD NOT include synthetic AAAA RRs in the response (see Appendix A + for an analysis of the motivations for and the implications of not + complying with this recommendation). By default DNS64 + implementations MUST NOT synthesize AAAA RRs when real AAAA RRs + exist. + +5.1.2. The answer when there is an error + + If the query results in a response with RCODE other than 0 (No error + condition), then there are two possibilities. A result with RCODE=3 + (Name Error) is handled according to normal DNS operation (which is + normally to return the error to the client). This stage is still + prior to any synthesis having happened, so a response to be returned + to the client does not need any special assembly than would usually + happen in DNS operation. + + Any other RCODE is treated as though the RCODE were 0 and the answer + section were empty. This is because of the large number of different + responses from deployed name servers when they receive AAAA queries + without a AAAA record being available (see [RFC4074]). Note that + this means, for practical purposes, that several different classes of + error in the DNS are all treated as though a AAAA record is not + available for that owner name. + + + + +Bagnulo, et al. Expires January 6, 2011 [Page 11] + +Internet-Draft DNS64 July 2010 + + + It is important to note that, as of this writing, some servers + respond with RCODE=3 to a AAAA query even if there is an A record + available for that owner name. Those servers are in clear violation + of the meaning of RCODE 3, and it is expected that they will decline + in use as IPv6 deployment increases. + +5.1.3. Dealing with timeouts + + If the query receives no answer before the timeout (which might be + the timeout from every authoritative server, depending on whether the + DNS64 is in recursive resolver mode), it is treated as RCODE=2 + (Server failure). . + +5.1.4. Special exclusion set for AAAA records + + Some IPv6 addresses are not actually usable by IPv6-only hosts. If + they are returned to IPv6-only querying agents as AAAA records, + therefore, the goal of decreasing the number of failure modes will + not be attained. Examples include AAAA records with addresses in the + ::ffff:0:0/96 network, and possibly (depending on the context) AAAA + records with the site's Pref::64/n or the Well-Known Prefix (see + below for more about the Well-Known Prefix). A DNS64 implementation + SHOULD provide a mechanism to specify IPv6 prefix ranges to be + treated as though the AAAA containing them were an empty answer. An + implementation SHOULD include the ::ffff/96 network in that range by + default. Failure to provide this facility will mean that clients + querying the DNS64 function may not be able to communicate with hosts + that would be reachable from a dual-stack host. + + When the DNS64 performs its initial AAAA query, if it receives an + answer with only AAAA records containing addresses in the excluded + range(s), then it MUST treat the answer as though it were an empty + answer, and proceed accordingly. If it receives an answer with at + least one AAAA record containing an address outside any of the + excluded range(s), then it MAY build an answer section for a response + including only the AAAA record(s) that do not contain any of the + addresses inside the excluded ranges. That answer section is used in + the assembly of a response as detailed in Section 5.4. + Alternatively, it MAY treat the answer as though it were an empty + answer, and proceed accordingly. It MUST NOT return the offending + AAAA records as part of a response. + +5.1.5. Dealing with CNAME and DNAME + + If the response contains a CNAME or a DNAME, then the CNAME or DNAME + chain is followed until the first terminating A or AAAA record is + reached. This may require the DNS64 to ask for an A record, in case + the response to the original AAAA query is a CNAME or DNAME without a + + + +Bagnulo, et al. Expires January 6, 2011 [Page 12] + +Internet-Draft DNS64 July 2010 + + + AAAA record to follow. The resulting AAAA or A record is treated + like any other AAAA or A case, as appropriate. + + When assembling the answer section, any chains of CNAME or DNAME RRs + are included as part of the answer along with the synthetic AAAA (if + appropriate). + +5.1.6. Data for the answer when performing synthesis + + If the query results in no error but an empty answer section in the + response, the DNS64 attempts to retrieve A records for the name in + question, either by performing another query or, in the case of an + authoritative server, by examining its own results. If this new A RR + query results in an empty answer or in an error, then the empty + result or error is used as the basis for the answer returned to the + querying client. If instead the query results in one or more A RRs, + the DNS64 synthesizes AAAA RRs based on the A RRs according to the + procedure outlined in Section 5.1.7. The DNS64 returns the + synthesized AAAA records in the answer section, removing the A + records that form the basis of the synthesis. + +5.1.7. Performing the synthesis + + A synthetic AAAA record is created from an A record as follows: + + o The NAME field is set to the NAME field from the A record + + o The TYPE field is set to 28 (AAAA) + + o The CLASS field is set to the original CLASS field, 1. Under this + specification, DNS64 for any CLASS other than 1 is undefined. + + o The TTL field is set to the minimum of the TTL of the original A + RR and the SOA RR for the queried domain. (Note that in order to + obtain the TTL of the SOA RR, the DNS64 does not need to perform a + new query, but it can remember the TTL from the SOA RR in the + negative response to the AAAA query. If the SOA RR was not + delivered with the negative response to the AAAA query, then the + DNS64 SHOULD use a default value of 600 seconds. It is possible + instead to query explicitly for the SOA RR and use the result of + that query, but this will increase query load and time to + resolution for little additional benefit.) This is in keeping + with the approach used in negative caching ([RFC2308] + + o The RDLENGTH field is set to 16 + + o The RDATA field is set to the IPv6 representation of the IPv4 + address from the RDATA field of the A record. The DNS64 SHOULD + + + +Bagnulo, et al. Expires January 6, 2011 [Page 13] + +Internet-Draft DNS64 July 2010 + + + check each A RR against configured IPv4 address ranges and select + the corresponding IPv6 prefix to use in synthesizing the AAAA RR. + See Section 5.2 for discussion of the algorithms to be used in + effecting the transformation. + +5.1.8. Querying in parallel + + The DNS64 MAY perform the query for the AAAA RR and for the A RR in + parallel, in order to minimize the delay. However, this would result + in performing unnecessary A RR queries in the case where no AAAA RR + synthesis is required. A possible trade-off would be to perform them + sequentially but with a very short interval between them, so if we + obtain a fast reply, we avoid doing the additional query. (Note that + this discussion is relevant only if the DNS64 function needs to + perform external queries to fetch the RR. If the needed RR + information is available locally, as in the case of an authoritative + server, the issue is no longer relevant.) + +5.2. Generation of the IPv6 representations of IPv4 addresses + + DNS64 supports multiple algorithms for the generation of the IPv6 + representation of an IPv4 address. The constraints imposed on the + generation algorithms are the following: + + The same algorithm to create an IPv6 address from an IPv4 address + MUST be used by both a DNS64 to create the IPv6 address to be + returned in the synthetic AAAA RR from the IPv4 address contained + in an original A RR, and by a IPv6/IPv4 translator to create the + IPv6 address to be included in the source address field of the + outgoing IPv6 packets from the IPv4 address included in the source + address field of the incoming IPv4 packet. + + The algorithm MUST be reversible; i.e., it MUST be possible to + derive the original IPv4 address from the IPv6 representation. + + The input for the algorithm MUST be limited to the IPv4 address, + the IPv6 prefix (denoted Pref64::/n) used in the IPv6 + representations and optionally a set of stable parameters that are + configured in the DNS64 and in the NAT64 (such as fixed string to + be used as a suffix). + + For each prefix Pref64::/n, n MUST be less than or equal to 96. + If one or more Pref64::/n are configured in the DNS64 through + any means (such as manually configured, or other automatic + means not specified in this document), the default algorithm + MUST use these prefixes (and not use the Well-Known Prefix). + If no prefix is available, the algorithm MUST use the Well- + Known Prefix 64:FF9B::/96 defined in + + + +Bagnulo, et al. Expires January 6, 2011 [Page 14] + +Internet-Draft DNS64 July 2010 + + + [I-D.ietf-behave-address-format] to represent the IPv4 unicast + address range + + [[anchor8: Note in document: The value 64:FF9B::/96 is proposed as + the value for the Well-Known prefix and needs to be confirmed + whenis published as RFC.]][I-D.ietf-behave-address-format] + + A DNS64 MUST support the algorithm for generating IPv6 + representations of IPv4 addresses defined in Section 2 of + [I-D.ietf-behave-address-format]. Moreover, the aforementioned + algorithm MUST be the default algorithm used by the DNS64. While the + normative description of the algorithm is provided in + [I-D.ietf-behave-address-format], a sample description of the + algorithm and its application to different scenarios is provided in + Section 7 for illustration purposes. + +5.3. Handling other Resource Records and the Additional Section + +5.3.1. PTR Resource Record + + If a DNS64 server receives a PTR query for a record in the IP6.ARPA + domain, it MUST strip the IP6.ARPA labels from the QNAME, reverse the + address portion of the QNAME according to the encoding scheme + outlined in section 2.5 of [RFC3596], and examine the resulting + address to see whether its prefix matches any of the locally- + configured Pref64::/n. There are two alternatives for a DNS64 server + to respond to such PTR queries. A DNS64 server MUST provide one of + these, and SHOULD NOT provide both at the same time unless different + IP6.ARPA zones require answers of different sorts: + + 1. The first option is for the DNS64 server to respond + authoritatively for its prefixes. If the address prefix matches + any Pref64::/n used in the site, either a NSP or the Well-Known + Prefix (i.e. 64:FF9B::/96), then the DNS64 server MAY answer the + query using locally-appropriate RDATA. The DNS64 server MAY use + the same RDATA for all answers. Note that the requirement is to + match any Pref64::/n used at the site, and not merely the + locally-configured Pref64::/n. This is because end clients could + ask for a PTR record matching an address received through a + different (site-provided) DNS64, and if this strategy is in + effect, those queries should never be sent to the global DNS. + The advantage of this strategy is that it makes plain to the + querying client that the prefix is one operated by the (DNS64) + site, and that the answers the client is getting are generated by + DNS64. The disadvantage is that any useful reverse-tree + information that might be in the global DNS is unavailable to the + clients querying the DNS64. + + + + +Bagnulo, et al. Expires January 6, 2011 [Page 15] + +Internet-Draft DNS64 July 2010 + + + 2. The second option is for the DNS64 nameserver to synthesize a + CNAME mapping the IP6.ARPA namespace to the corresponding IN- + ADDR.ARPA name. The rest of the response would be the normal DNS + processing. The CNAME can be signed on the fly if need be. The + advantage of this approach is that any useful information in the + reverse tree is available to the querying client. The + disadvantage is that it adds additional load to the DNS64 + (because CNAMEs have to be synthesized for each PTR query that + matches the Pref64::/n), and that it may require signing on the + fly. In addition, the generated CNAME could correspond to an + unpopulated in-addr.arpa zone, so the CNAME would provide a + reference to a non-existent record. + + If the address prefix does not match any Pref64::/n, then the DNS64 + server MUST process the query as though it were any other query; i.e. + a recursive nameserver MUST attempt to resolve the query as though it + were any other (non-A/AAAA) query, and an authoritative server MUST + respond authoritatively or with a referral, as appropriate. + +5.3.2. Handling the additional section + + DNS64 synthesis MUST NOT be performed on any records in the + additional section of synthesized answers. The DNS64 MUST pass the + additional section unchanged. + + It may appear that adding synthetic records to the additional section + is desirable, because clients sometimes use the data in the + additional section to proceed without having to re-query. There is + in general no promise, however, that the additional section will + contain all the relevant records, so any client that depends on the + additional section being able to satisfy its needs (i.e. without + additional queries) is necessarily broken. An IPv6-only client that + needs a AAAA record, therefore, will send a query for the necessary + AAAA record if it is unable to find such a record in the additional + section of an answer it is consuming. For a correctly-functioning + client, the effect would be no different if the additional section + were empty. + + The alternative, of removing the A records in the additional section + and replacing them with synthetic AAAA records, may cause a host + behind a NAT64 to query directly a nameserver that is unaware of the + NAT64 in question. The result in this case will be resolution + failure anyway, only later in the resolution operation. + + The prohibition on synthetic data in the additional section reduces, + but does not eliminate, the possibility of resolution failures due to + cached DNS data from behind the DNS64. See Section 6. + + + + +Bagnulo, et al. Expires January 6, 2011 [Page 16] + +Internet-Draft DNS64 July 2010 + + +5.3.3. Other Resource Records + + If the DNS64 is in recursive resolver mode, then considerations + outlined in [I-D.ietf-dnsop-default-local-zones] may be relevant. + + All other RRs MUST be returned unchanged. This includes responses to + queries for A RRs. + +5.4. Assembling a synthesized response to a AAAA query + + A DNS64 uses different pieces of data to build the response returned + to the querying client. + + The query that is used as the basis for synthesis results either in + an error, an answer that can be used as a basis for synthesis, or an + empty (authoritative) answer. If there is an empty answer, then the + DNS64 responds to the original querying client with the answer the + DNS64 received to the original (initiator's) query. Otherwise, the + response is assembled as follows. + + The header fields are set according to the usual rules for recursive + or authoritative servers, depending on the role that the DNS64 is + serving. The question section is copied from the original + (initiator's) query. The answer section is populated according to + the rules in Section 5.1.7. The authority and additional sections + are copied from the response to the final query that the DNS64 + performed, and used as the basis for synthesis. + + The final response from the DNS64 is subject to all the standard DNS + rules, including truncation [RFC1035] and EDNS0 handling [RFC2671]. + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 00:56:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79C92106564A; Fri, 5 Nov 2010 00:56:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DB228FC12; Fri, 5 Nov 2010 00:56: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 oA50uLSY078429; Fri, 5 Nov 2010 00:56:21 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA50uLk5078426; Fri, 5 Nov 2010 00:56:21 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201011050056.oA50uLk5078426@svn.freebsd.org> From: Ed Schouten Date: Fri, 5 Nov 2010 00:56: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: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 00:56:21 -0000 Author: ed Date: Fri Nov 5 00:56:21 2010 New Revision: 214817 URL: http://svn.freebsd.org/changeset/base/214817 Log: Partially implement the mysterious cons25 \e[x escape sequence. It seems the terminfo library on some systems (OS X, Linux) may emit the sequence \e[x to reset to default attributes. Apart from using the zero-command, this escape sequence allows many more operations, such as setting ANSI colors. I don't see this used anywhere, so this should be sufficient for now. This deficiency was spotted by the Debian GNU/kFreeBSD. They have their own patch, which is slightly flawed in my opinion. I don't know why they never reported this issue to us. MFC after: 1 week Modified: head/sys/teken/sequences head/sys/teken/teken_subr_compat.h Modified: head/sys/teken/sequences ============================================================================== --- head/sys/teken/sequences Fri Nov 5 00:31:09 2010 (r214816) +++ head/sys/teken/sequences Fri Nov 5 00:56:21 2010 (r214817) @@ -106,6 +106,7 @@ C25ADFG Cons25 set adapter foreground ^ C25BLPD Cons25 set bell pitch duration ^[ [ = B r r C25CURS Cons25 set cursor type ^[ [ = S r C25MODE Cons25 set terminal mode ^[ [ = T r +C25SGR Cons25 set graphic rendition ^[ [ x r r C25VTSW Cons25 switch virtual terminal ^[ [ z r # VT52 compatibility Modified: head/sys/teken/teken_subr_compat.h ============================================================================== --- head/sys/teken/teken_subr_compat.h Fri Nov 5 00:31:09 2010 (r214816) +++ head/sys/teken/teken_subr_compat.h Fri Nov 5 00:56:21 2010 (r214817) @@ -88,6 +88,20 @@ teken_subr_cons25_set_bell_pitch_duratio } static void +teken_subr_cons25_set_graphic_rendition(teken_t *t, unsigned int cmd, + unsigned int param __unused) +{ + + switch (cmd) { + case 0: /* Reset. */ + t->t_curattr = t->t_defattr; + break; + default: + teken_printf("unsupported attribute %u\n", cmd); + } +} + +static void teken_subr_cons25_set_terminal_mode(teken_t *t, unsigned int mode) { From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 01:21:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 7C00F1065694; Fri, 5 Nov 2010 01:21:03 +0000 (UTC) Date: Fri, 5 Nov 2010 01:21:03 +0000 From: Alexander Best To: Ed Schouten Message-ID: <20101105012103.GA26789@freebsd.org> References: <201011050056.oA50uLk5078426@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201011050056.oA50uLk5078426@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 01:21:03 -0000 On Fri Nov 5 10, Ed Schouten wrote: > Author: ed > Date: Fri Nov 5 00:56:21 2010 > New Revision: 214817 > URL: http://svn.freebsd.org/changeset/base/214817 > > Log: > Partially implement the mysterious cons25 \e[x escape sequence. > > It seems the terminfo library on some systems (OS X, Linux) may emit the > sequence \e[x to reset to default attributes. Apart from using the > zero-command, this escape sequence allows many more operations, such as > setting ANSI colors. I don't see this used anywhere, so this should be > sufficient for now. > > This deficiency was spotted by the Debian GNU/kFreeBSD. They have their > own patch, which is slightly flawed in my opinion. I don't know why they > never reported this issue to us. maybe, because nearly all PRs (most of them including patches) they have submitted via GNATS in the past remain unnoticed and thus they've gotten tired of reporting issues and submitting patches if nobody seems to care? ;) cheers. alex > > MFC after: 1 week > > Modified: > head/sys/teken/sequences > head/sys/teken/teken_subr_compat.h > > Modified: head/sys/teken/sequences > ============================================================================== > --- head/sys/teken/sequences Fri Nov 5 00:31:09 2010 (r214816) > +++ head/sys/teken/sequences Fri Nov 5 00:56:21 2010 (r214817) > @@ -106,6 +106,7 @@ C25ADFG Cons25 set adapter foreground ^ > C25BLPD Cons25 set bell pitch duration ^[ [ = B r r > C25CURS Cons25 set cursor type ^[ [ = S r > C25MODE Cons25 set terminal mode ^[ [ = T r > +C25SGR Cons25 set graphic rendition ^[ [ x r r > C25VTSW Cons25 switch virtual terminal ^[ [ z r > > # VT52 compatibility > > Modified: head/sys/teken/teken_subr_compat.h > ============================================================================== > --- head/sys/teken/teken_subr_compat.h Fri Nov 5 00:31:09 2010 (r214816) > +++ head/sys/teken/teken_subr_compat.h Fri Nov 5 00:56:21 2010 (r214817) > @@ -88,6 +88,20 @@ teken_subr_cons25_set_bell_pitch_duratio > } > > static void > +teken_subr_cons25_set_graphic_rendition(teken_t *t, unsigned int cmd, > + unsigned int param __unused) > +{ > + > + switch (cmd) { > + case 0: /* Reset. */ > + t->t_curattr = t->t_defattr; > + break; > + default: > + teken_printf("unsupported attribute %u\n", cmd); > + } > +} > + > +static void > teken_subr_cons25_set_terminal_mode(teken_t *t, unsigned int mode) > { > -- a13x From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 02:12:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EAC310656C4; Fri, 5 Nov 2010 02:12:19 +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 0B42A8FC19; Fri, 5 Nov 2010 02:12: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 oA52CIUj080484; Fri, 5 Nov 2010 02:12:18 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA52CIQD080481; Fri, 5 Nov 2010 02:12:18 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201011050212.oA52CIQD080481@svn.freebsd.org> From: Rick Macklem Date: Fri, 5 Nov 2010 02:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214819 - in stable/8/sys/fs: nfs nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 02:12:19 -0000 Author: rmacklem Date: Fri Nov 5 02:12:18 2010 New Revision: 214819 URL: http://svn.freebsd.org/changeset/base/214819 Log: MFC: r214406 Add a flag to the experimental NFSv4 client to indicate when delegations are being returned for reasons other than a Recall. Also, re-organize nfscl_recalldeleg() slightly, so that it leaves clearing NMODIFIED to the ncl_flush() call and invalidates the attribute cache after flushing. It is hoped that these changes might fix the problem others have seen when using the NFSv4 client with delegations enabled, since I can't reliably reproduce the problem. These changes only affect the client when doing NFSv4 mounts with delegations enabled. Modified: stable/8/sys/fs/nfs/nfsclstate.h stable/8/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/8/sys/fs/nfs/nfsclstate.h Fri Nov 5 01:50:18 2010 (r214818) +++ stable/8/sys/fs/nfs/nfsclstate.h Fri Nov 5 02:12:18 2010 (r214819) @@ -118,6 +118,7 @@ struct nfscldeleg { #define NFSCLDL_NEEDRECLAIM 0x08 #define NFSCLDL_ZAPPED 0x10 #define NFSCLDL_MODTIMESET 0x20 +#define NFSCLDL_DELEGRET 0x40 /* * MALLOC'd to the correct length to accommodate the file handle. Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Fri Nov 5 01:50:18 2010 (r214818) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Fri Nov 5 02:12:18 2010 (r214819) @@ -929,8 +929,10 @@ nfscl_getbytelock(vnode_t vp, u_int64_t ldp = dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); /* Just sanity check for correct type of delegation */ - if (dp != NULL && ((dp->nfsdl_flags & NFSCLDL_RECALL) || - (type == F_WRLCK && !(dp->nfsdl_flags & NFSCLDL_WRITE)))) + if (dp != NULL && ((dp->nfsdl_flags & + (NFSCLDL_RECALL | NFSCLDL_DELEGRET)) != 0 || + (type == F_WRLCK && + (dp->nfsdl_flags & NFSCLDL_WRITE) == 0))) dp = NULL; } if (dp != NULL) { @@ -2495,8 +2497,8 @@ tryagain: if (dp->nfsdl_rwlock.nfslock_usecnt == 0 && dp->nfsdl_rwlock.nfslock_lock == 0 && dp->nfsdl_timestamp < NFSD_MONOSEC && - !(dp->nfsdl_flags & (NFSCLDL_RECALL | NFSCLDL_ZAPPED | - NFSCLDL_NEEDRECLAIM))) { + (dp->nfsdl_flags & (NFSCLDL_RECALL | NFSCLDL_ZAPPED | + NFSCLDL_NEEDRECLAIM | NFSCLDL_DELEGRET)) == 0) { clearok = 1; LIST_FOREACH(owp, &dp->nfsdl_owner, nfsow_list) { op = LIST_FIRST(&owp->nfsow_open); @@ -3086,7 +3088,8 @@ nfscl_docb(struct nfsrv_descript *nd, NF if (clp != NULL) { dp = nfscl_finddeleg(clp, nfhp->nfh_fh, nfhp->nfh_len); - if (dp != NULL) { + if (dp != NULL && (dp->nfsdl_flags & + NFSCLDL_DELEGRET) == 0) { dp->nfsdl_flags |= NFSCLDL_RECALL; wakeup((caddr_t)clp); @@ -3338,7 +3341,6 @@ nfscl_recalldeleg(struct nfsclclient *cl np = VTONFS(vp); } dp->nfsdl_flags &= ~NFSCLDL_MODTIMESET; - NFSINVALATTRCACHE(np); /* * Ok, if it's a write delegation, flush data to the server, so @@ -3347,21 +3349,14 @@ nfscl_recalldeleg(struct nfsclclient *cl ret = 0; NFSLOCKNODE(np); if ((dp->nfsdl_flags & NFSCLDL_WRITE) && (np->n_flag & NMODIFIED)) { -#ifdef APPLE - OSBitOrAtomic((u_int32_t)NDELEGRECALL, (UInt32 *)&np->n_flag); -#else np->n_flag |= NDELEGRECALL; -#endif NFSUNLOCKNODE(np); ret = ncl_flush(vp, MNT_WAIT, cred, p, 1, called_from_renewthread); NFSLOCKNODE(np); -#ifdef APPLE - OSBitAndAtomic((int32_t)~(NMODIFIED | NDELEGRECALL), (UInt32 *)&np->n_flag); -#else - np->n_flag &= ~(NMODIFIED | NDELEGRECALL); -#endif + np->n_flag &= ~NDELEGRECALL; } + NFSINVALATTRCACHE(np); NFSUNLOCKNODE(np); if (ret == EIO && called_from_renewthread != 0) { /* @@ -3534,8 +3529,10 @@ nfscl_totalrecall(struct nfsclclient *cl { struct nfscldeleg *dp; - TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) - dp->nfsdl_flags |= NFSCLDL_RECALL; + TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { + if ((dp->nfsdl_flags & NFSCLDL_DELEGRET) == 0) + dp->nfsdl_flags |= NFSCLDL_RECALL; + } } /* @@ -3754,8 +3751,9 @@ nfscl_mustflush(vnode_t vp) return (1); } dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); - if (dp != NULL && (dp->nfsdl_flags & (NFSCLDL_WRITE | NFSCLDL_RECALL)) - == NFSCLDL_WRITE && + if (dp != NULL && (dp->nfsdl_flags & + (NFSCLDL_WRITE | NFSCLDL_RECALL | NFSCLDL_DELEGRET)) == + NFSCLDL_WRITE && (dp->nfsdl_sizelimit >= np->n_size || !NFSHASSTRICT3530(nmp))) { NFSUNLOCKCLSTATE(); @@ -3787,9 +3785,10 @@ nfscl_nodeleg(vnode_t vp, int writedeleg return (1); } dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); - if (dp != NULL && (dp->nfsdl_flags & NFSCLDL_RECALL) == 0 && - (writedeleg == 0 || (dp->nfsdl_flags & NFSCLDL_WRITE) - == NFSCLDL_WRITE)) { + if (dp != NULL && + (dp->nfsdl_flags & (NFSCLDL_RECALL | NFSCLDL_DELEGRET)) == 0 && + (writedeleg == 0 || (dp->nfsdl_flags & NFSCLDL_WRITE) == + NFSCLDL_WRITE)) { NFSUNLOCKCLSTATE(); return (0); } @@ -3860,6 +3859,7 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T } } if (needsrecall && !triedrecall) { + dp->nfsdl_flags |= NFSCLDL_DELEGRET; islept = 0; while (!igotlock) { igotlock = nfsv4_lock(&clp->nfsc_lock, 1, @@ -3958,6 +3958,7 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stat } } if (needsrecall && !triedrecall) { + dp->nfsdl_flags |= NFSCLDL_DELEGRET; islept = 0; while (!igotlock) { igotlock = nfsv4_lock(&clp->nfsc_lock, 1, From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 02:33:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C576106566B; Fri, 5 Nov 2010 02:33:27 +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 692958FC0C; Fri, 5 Nov 2010 02:33: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 oA52XRQx081043; Fri, 5 Nov 2010 02:33:27 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA52XRb6081041; Fri, 5 Nov 2010 02:33:27 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201011050233.oA52XRb6081041@svn.freebsd.org> From: Rick Macklem Date: Fri, 5 Nov 2010 02:33:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214820 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 02:33:27 -0000 Author: rmacklem Date: Fri Nov 5 02:33:27 2010 New Revision: 214820 URL: http://svn.freebsd.org/changeset/base/214820 Log: MFC: r214511 Add a call for nfsrpc_close() to ncl_reclaim() in the experimental NFSv4 client, since the call in ncl_inactive() might be missed because VOP_INACTIVE() is not guaranteed to be called before VOP_RECLAIM(). Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clnode.c Fri Nov 5 02:12:18 2010 (r214819) +++ stable/8/sys/fs/nfsclient/nfs_clnode.c Fri Nov 5 02:33:27 2010 (r214820) @@ -236,6 +236,15 @@ ncl_reclaim(struct vop_reclaim_args *ap) if (prtactive && vrefcnt(vp) != 0) vprint("ncl_reclaim: pushing active", vp); + if (NFS_ISV4(vp) && vp->v_type == VREG) + /* + * Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4 + * Close operations are delayed until ncl_inactive(). + * However, since VOP_INACTIVE() is not guaranteed to be + * called, we need to do it again here. + */ + (void) nfsrpc_close(vp, 1, ap->a_td); + /* * If the NLM is running, give it a chance to abort pending * locks. From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 02:45:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF4F61065673; Fri, 5 Nov 2010 02:45: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 CBE288FC12; Fri, 5 Nov 2010 02:45: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 oA52jDHU081355; Fri, 5 Nov 2010 02:45:13 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA52jDWG081353; Fri, 5 Nov 2010 02:45:13 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201011050245.oA52jDWG081353@svn.freebsd.org> From: Rick Macklem Date: Fri, 5 Nov 2010 02:45:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214821 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 02:45:14 -0000 Author: rmacklem Date: Fri Nov 5 02:45:13 2010 New Revision: 214821 URL: http://svn.freebsd.org/changeset/base/214821 Log: MFC: r214513 Modify nfs_open() in the experimental NFS client to be compatible with the regular NFS client. Also, fix a couple of mutex lock issues. Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Fri Nov 5 02:33:27 2010 (r214820) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Fri Nov 5 02:45:13 2010 (r214821) @@ -505,24 +505,46 @@ nfs_open(struct vop_open_args *ap) * Now, if this Open will be doing reading, re-validate/flush the * cache, so that Close/Open coherency is maintained. */ - if ((fmode & FREAD) != 0 && - (!NFS_ISV4(vp) || nfscl_mustflush(vp) != 0)) { + mtx_lock(&np->n_mtx); + if (np->n_flag & NMODIFIED) { + mtx_unlock(&np->n_mtx); + error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); + if (error == EINTR || error == EIO) { + if (NFS_ISV4(vp)) + (void) nfsrpc_close(vp, 0, ap->a_td); + return (error); + } mtx_lock(&np->n_mtx); - if (np->n_flag & NMODIFIED) { - mtx_unlock(&np->n_mtx); - error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); - if (error == EINTR || error == EIO) { - if (NFS_ISV4(vp)) - (void) nfsrpc_close(vp, 0, ap->a_td); - return (error); - } - mtx_lock(&np->n_mtx); - np->n_attrstamp = 0; + np->n_attrstamp = 0; + if (vp->v_type == VDIR) + np->n_direofoffset = 0; + mtx_unlock(&np->n_mtx); + error = VOP_GETATTR(vp, &vattr, ap->a_cred); + if (error) { + if (NFS_ISV4(vp)) + (void) nfsrpc_close(vp, 0, ap->a_td); + return (error); + } + mtx_lock(&np->n_mtx); + np->n_mtime = vattr.va_mtime; + if (NFS_ISV4(vp)) + np->n_change = vattr.va_filerev; + } else { + mtx_unlock(&np->n_mtx); + error = VOP_GETATTR(vp, &vattr, ap->a_cred); + if (error) { + if (NFS_ISV4(vp)) + (void) nfsrpc_close(vp, 0, ap->a_td); + return (error); + } + mtx_lock(&np->n_mtx); + if ((NFS_ISV4(vp) && np->n_change != vattr.va_filerev) || + NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) { if (vp->v_type == VDIR) np->n_direofoffset = 0; mtx_unlock(&np->n_mtx); - error = VOP_GETATTR(vp, &vattr, ap->a_cred); - if (error) { + error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); + if (error == EINTR || error == EIO) { if (NFS_ISV4(vp)) (void) nfsrpc_close(vp, 0, ap->a_td); return (error); @@ -531,42 +553,16 @@ nfs_open(struct vop_open_args *ap) np->n_mtime = vattr.va_mtime; if (NFS_ISV4(vp)) np->n_change = vattr.va_filerev; - mtx_unlock(&np->n_mtx); - } else { - mtx_unlock(&np->n_mtx); - error = VOP_GETATTR(vp, &vattr, ap->a_cred); - if (error) { - if (NFS_ISV4(vp)) - (void) nfsrpc_close(vp, 0, ap->a_td); - return (error); - } - mtx_lock(&np->n_mtx); - if ((NFS_ISV4(vp) && np->n_change != vattr.va_filerev) || - NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) { - if (vp->v_type == VDIR) - np->n_direofoffset = 0; - mtx_unlock(&np->n_mtx); - error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); - if (error == EINTR || error == EIO) { - if (NFS_ISV4(vp)) - (void) nfsrpc_close(vp, 0, - ap->a_td); - return (error); - } - mtx_lock(&np->n_mtx); - np->n_mtime = vattr.va_mtime; - if (NFS_ISV4(vp)) - np->n_change = vattr.va_filerev; - } - mtx_unlock(&np->n_mtx); } } /* * If the object has >= 1 O_DIRECT active opens, we disable caching. */ - if (newnfs_directio_enable && (fmode & O_DIRECT) && (vp->v_type == VREG)) { + if (newnfs_directio_enable && (fmode & O_DIRECT) && + (vp->v_type == VREG)) { if (np->n_directio_opens == 0) { + mtx_unlock(&np->n_mtx); error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); if (error) { if (NFS_ISV4(vp)) @@ -575,12 +571,10 @@ nfs_open(struct vop_open_args *ap) } mtx_lock(&np->n_mtx); np->n_flag |= NNONCACHE; - } else { - mtx_lock(&np->n_mtx); } np->n_directio_opens++; - mtx_unlock(&np->n_mtx); } + mtx_unlock(&np->n_mtx); vnode_create_vobject(vp, vattr.va_size, ap->a_td); return (0); } From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 05:11:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89BC8106564A; Fri, 5 Nov 2010 05:11:54 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 762A38FC16; Fri, 5 Nov 2010 05:11: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 oA55BsXP085277; Fri, 5 Nov 2010 05:11:54 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA55BsCK085263; Fri, 5 Nov 2010 05:11:54 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201011050511.oA55BsCK085263@svn.freebsd.org> From: Tim Kientzle Date: Fri, 5 Nov 2010 05:11: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: r214822 - head/lib/libarchive X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 05:11:54 -0000 Author: kientzle Date: Fri Nov 5 05:11:54 2010 New Revision: 214822 URL: http://svn.freebsd.org/changeset/base/214822 Log: Clarify the naming: Methods that free an object should be called "free". Retain the old "finish" names to preserve source compatibility for now. Modified: head/lib/libarchive/archive.h head/lib/libarchive/archive_private.h head/lib/libarchive/archive_read.3 head/lib/libarchive/archive_read.c head/lib/libarchive/archive_read_disk.3 head/lib/libarchive/archive_read_disk.c head/lib/libarchive/archive_read_extract.c head/lib/libarchive/archive_virtual.c head/lib/libarchive/archive_write.3 head/lib/libarchive/archive_write.c head/lib/libarchive/archive_write_disk.3 head/lib/libarchive/archive_write_disk.c head/lib/libarchive/libarchive.3 Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive.h Fri Nov 5 05:11:54 2010 (r214822) @@ -482,11 +482,10 @@ __LA_DECL void archive_read_extract_set /* Close the file and release most resources. */ __LA_DECL int archive_read_close(struct archive *); /* Release all resources and destroy the object. */ -/* Note that archive_read_finish will call archive_read_close for you. */ -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Erroneously declared to return void in libarchive 1.x */ -__LA_DECL void archive_read_finish(struct archive *); -#else +/* Note that archive_read_free will call archive_read_close for you. */ +__LA_DECL int archive_read_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_read_free() for backwards compatibility. */ __LA_DECL int archive_read_finish(struct archive *); #endif @@ -503,7 +502,7 @@ __LA_DECL int archive_read_finish(stru * - archive_write_header to write the header * - archive_write_data to write the entry data * 5) archive_write_close to close the output - * 6) archive_write_finish to cleanup the writer and release resources + * 6) archive_write_free to cleanup the writer and release resources */ __LA_DECL struct archive *archive_write_new(void); __LA_DECL int archive_write_set_bytes_per_block(struct archive *, @@ -584,13 +583,12 @@ __LA_DECL __LA_SSIZE_T archive_write_da #endif __LA_DECL int archive_write_finish_entry(struct archive *); __LA_DECL int archive_write_close(struct archive *); -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Return value was incorrect in libarchive 1.x. */ -__LA_DECL void archive_write_finish(struct archive *); -#else -/* Libarchive 2.x and later returns an error if this fails. */ -/* It can fail if the archive wasn't already closed, in which case - * archive_write_finish() will implicitly call archive_write_close(). */ + +/* This can fail if the archive wasn't already closed, in which case + * archive_write_free() will implicitly call archive_write_close(). */ +__LA_DECL int archive_write_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_write_free() for backwards compatibility. */ __LA_DECL int archive_write_finish(struct archive *); #endif @@ -619,7 +617,7 @@ __LA_DECL int archive_write_set_options * - construct an appropriate struct archive_entry structure * - archive_write_header to create the file/dir/etc on disk * - archive_write_data to write the entry data - * 4) archive_write_finish to cleanup the writer and release resources + * 4) archive_write_free to cleanup the writer and release resources * * In particular, you can use this in conjunction with archive_read() * to pull entries out of an archive and create them on disk. Modified: head/lib/libarchive/archive_private.h ============================================================================== --- head/lib/libarchive/archive_private.h Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_private.h Fri Nov 5 05:11:54 2010 (r214822) @@ -58,7 +58,7 @@ struct archive_vtable { int (*archive_close)(struct archive *); - int (*archive_finish)(struct archive *); + int (*archive_free)(struct archive *); int (*archive_write_header)(struct archive *, struct archive_entry *); int (*archive_write_finish_entry)(struct archive *); Modified: head/lib/libarchive/archive_read.3 ============================================================================== --- head/lib/libarchive/archive_read.3 Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_read.3 Fri Nov 5 05:11:54 2010 (r214822) @@ -69,7 +69,7 @@ .Nm archive_read_extract2 , .Nm archive_read_extract_set_progress_callback , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading streaming archives .Sh SYNOPSIS .In archive.h @@ -196,7 +196,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide a complete API for reading streaming archives. The general process is to first create the @@ -457,7 +457,7 @@ object and the archive_entry object so t can be retrieved for the progress display. .It Fn archive_read_close Complete the archive and invoke the close callback. -.It Fn archive_read_finish +.It Fn archive_read_free Invokes .Fn archive_read_close if it was not invoked manually, then release all resources. @@ -600,7 +600,7 @@ list_archive(const char *name) printf("%s\\n",archive_entry_pathname(entry)); archive_read_data_skip(a); } - archive_read_finish(a); + archive_read_free(a); free(mydata); } Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_read.c Fri Nov 5 05:11:54 2010 (r214822) @@ -60,7 +60,7 @@ static int choose_format(struct archive_ static int cleanup_filters(struct archive_read *); static struct archive_vtable *archive_read_vtable(void); static int _archive_read_close(struct archive *); -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static struct archive_vtable * archive_read_vtable(void) @@ -69,7 +69,7 @@ archive_read_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -779,7 +779,7 @@ cleanup_filters(struct archive_read *a) * Release memory and other resources. */ static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; int i; @@ -787,7 +787,7 @@ _archive_read_finish(struct archive *_a) int r = ARCHIVE_OK; __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_ANY, - "archive_read_finish"); + "archive_read_free"); if (a->archive.state != ARCHIVE_STATE_CLOSED) r = archive_read_close(&a->archive); Modified: head/lib/libarchive/archive_read_disk.3 ============================================================================== --- head/lib/libarchive/archive_read_disk.3 Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_read_disk.3 Fri Nov 5 05:11:54 2010 (r214822) @@ -39,7 +39,7 @@ .Nm archive_read_disk_set_gname_lookup , .Nm archive_read_disk_set_standard_lookup , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading objects from disk .Sh SYNOPSIS .In archive.h @@ -81,7 +81,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide an API for reading information about objects on disk. @@ -178,9 +178,9 @@ This affects the file ownership fields a object. .It Fn archive_read_close This currently does nothing. -.It Fn archive_write_finish +.It Fn archive_read_free Invokes -.Fn archive_write_close +.Fn archive_read_close if it was not invoked manually, then releases all resources. .El More information about the @@ -213,7 +213,7 @@ file_to_archive(struct archive *a, const while ((bytes_read = read(fd, buff, sizeof(buff))) > 0) archive_write_data(a, buff, bytes_read); archive_write_finish_entry(a); - archive_read_finish(ard); + archive_read_free(ard); archive_entry_free(entry); } .Ed Modified: head/lib/libarchive/archive_read_disk.c ============================================================================== --- head/lib/libarchive/archive_read_disk.c Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_read_disk.c Fri Nov 5 05:11:54 2010 (r214822) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include "archive_private.h" #include "archive_read_disk_private.h" -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static int _archive_read_close(struct archive *); static const char *trivial_lookup_gname(void *, gid_t gid); static const char *trivial_lookup_uname(void *, uid_t uid); @@ -45,7 +45,7 @@ archive_read_disk_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -129,7 +129,7 @@ archive_read_disk_new(void) } static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read_disk *a = (struct archive_read_disk *)_a; Modified: head/lib/libarchive/archive_read_extract.c ============================================================================== --- head/lib/libarchive/archive_read_extract.c Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_read_extract.c Fri Nov 5 05:11:54 2010 (r214822) @@ -172,10 +172,7 @@ archive_read_extract_cleanup(struct arch { int ret = ARCHIVE_OK; -#if ARCHIVE_API_VERSION > 1 - ret = -#endif - archive_write_finish(a->extract->ad); + ret = archive_write_free(a->extract->ad); free(a->extract); a->extract = NULL; return (ret); Modified: head/lib/libarchive/archive_virtual.c ============================================================================== --- head/lib/libarchive/archive_virtual.c Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_virtual.c Fri Nov 5 05:11:54 2010 (r214822) @@ -42,26 +42,35 @@ archive_read_close(struct archive *a) return ((a->vtable->archive_close)(a)); } -#if ARCHIVE_API_VERSION > 1 int -archive_write_finish(struct archive *a) +archive_write_free(struct archive *a) { - return ((a->vtable->archive_finish)(a)); + return ((a->vtable->archive_free)(a)); } -#else -/* Temporarily allow library to compile with either 1.x or 2.0 API. */ -void + +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* For backwards compatibility; will be removed with libarchive 4.0. */ +int archive_write_finish(struct archive *a) { - (void)(a->vtable->archive_finish)(a); + return ((a->vtable->archive_free)(a)); } #endif int +archive_read_free(struct archive *a) +{ + return ((a->vtable->archive_free)(a)); +} + +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* For backwards compatibility; will be removed with libarchive 4.0. */ +int archive_read_finish(struct archive *a) { - return ((a->vtable->archive_finish)(a)); + return ((a->vtable->archive_free)(a)); } +#endif int archive_write_header(struct archive *a, struct archive_entry *entry) @@ -76,12 +85,7 @@ archive_write_finish_entry(struct archiv return ((a->vtable->archive_write_finish_entry)(a)); } -#if ARCHIVE_API_VERSION > 1 ssize_t -#else -/* Temporarily allow library to compile with either 1.x or 2.0 API. */ -int -#endif archive_write_data(struct archive *a, const void *buff, size_t s) { return ((a->vtable->archive_write_data)(a, buff, s)); Modified: head/lib/libarchive/archive_write.3 ============================================================================== --- head/lib/libarchive/archive_write.3 Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_write.3 Fri Nov 5 05:11:54 2010 (r214822) @@ -55,7 +55,7 @@ .Nm archive_write_data , .Nm archive_write_finish_entry , .Nm archive_write_close , -.Nm archive_write_finish +.Nm archive_write_free .Nd functions for creating archives .Sh SYNOPSIS .In archive.h @@ -125,7 +125,7 @@ .Ft int .Fn archive_write_close "struct archive *" .Ft int -.Fn archive_write_finish "struct archive *" +.Fn archive_write_free "struct archive *" .Sh DESCRIPTION These functions provide a complete API for creating streaming archive files. @@ -363,16 +363,16 @@ and as needed. .It Fn archive_write_close Complete the archive and invoke the close callback. -.It Fn archive_write_finish +.It Fn archive_write_free Invokes .Fn archive_write_close -if it was not invoked manually, then releases all resources. -Note that this function was declared to return -.Ft void -in libarchive 1.x, which made it impossible to detect errors when +if necessary, then releases all resources. +If you need detailed information about .Fn archive_write_close -was invoked implicitly from this function. -This is corrected beginning with libarchive 2.0. +failures, you should be careful to call it separately, as +you cannot obtain error information after +.Fn archive_write_free +returns. .El More information about the .Va struct archive @@ -529,7 +529,7 @@ write_archive(const char *outname, const archive_entry_free(entry); filename++; } - archive_write_finish(a); + archive_write_free(a); } int main(int argc, const char **argv) @@ -580,7 +580,7 @@ may include .Fn archive_write_data , .Fn archive_write_close , or -.Fn archive_write_finish . +.Fn archive_write_free . The client callback can call .Fn archive_set_error to provide values that can then be retrieved by Modified: head/lib/libarchive/archive_write.c ============================================================================== --- head/lib/libarchive/archive_write.c Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_write.c Fri Nov 5 05:11:54 2010 (r214822) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); static struct archive_vtable *archive_write_vtable(void); static int _archive_write_close(struct archive *); -static int _archive_write_finish(struct archive *); +static int _archive_write_free(struct archive *); static int _archive_write_header(struct archive *, struct archive_entry *); static int _archive_write_finish_entry(struct archive *); static ssize_t _archive_write_data(struct archive *, const void *, size_t); @@ -73,7 +73,7 @@ archive_write_vtable(void) if (!inited) { av.archive_close = _archive_write_close; - av.archive_finish = _archive_write_finish; + av.archive_free = _archive_write_free; av.archive_write_header = _archive_write_header; av.archive_write_finish_entry = _archive_write_finish_entry; av.archive_write_data = _archive_write_data; @@ -383,13 +383,13 @@ _archive_write_close(struct archive *_a) * Destroy the archive structure. */ static int -_archive_write_finish(struct archive *_a) +_archive_write_free(struct archive *_a) { struct archive_write *a = (struct archive_write *)_a; int r = ARCHIVE_OK; __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_finish"); + ARCHIVE_STATE_ANY, "archive_write_free"); if (a->archive.state != ARCHIVE_STATE_CLOSED) r = archive_write_close(&a->archive); Modified: head/lib/libarchive/archive_write_disk.3 ============================================================================== --- head/lib/libarchive/archive_write_disk.3 Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_write_disk.3 Fri Nov 5 05:11:54 2010 (r214822) @@ -38,7 +38,7 @@ .Nm archive_write_data , .Nm archive_write_finish_entry , .Nm archive_write_close , -.Nm archive_write_finish +.Nm archive_write_free .Nd functions for creating objects on disk .Sh SYNOPSIS .In archive.h @@ -73,7 +73,7 @@ .Ft int .Fn archive_write_close "struct archive *" .Ft int -.Fn archive_write_finish "struct archive *" +.Fn archive_write_free "struct archive *" .Sh DESCRIPTION These functions provide a complete API for creating objects on disk from @@ -239,7 +239,7 @@ The .Nm library maintains a list of all such deferred attributes and sets them when this function is invoked. -.It Fn archive_write_finish +.It Fn archive_write_free Invokes .Fn archive_write_close if it was not invoked manually, then releases all resources. Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/archive_write_disk.c Fri Nov 5 05:11:54 2010 (r214822) @@ -252,7 +252,7 @@ static ssize_t write_data_block(struct a static struct archive_vtable *archive_write_disk_vtable(void); static int _archive_write_close(struct archive *); -static int _archive_write_finish(struct archive *); +static int _archive_write_free(struct archive *); static int _archive_write_header(struct archive *, struct archive_entry *); static int _archive_write_finish_entry(struct archive *); static ssize_t _archive_write_data(struct archive *, const void *, size_t); @@ -291,7 +291,7 @@ archive_write_disk_vtable(void) if (!inited) { av.archive_close = _archive_write_close; - av.archive_finish = _archive_write_finish; + av.archive_free = _archive_write_free; av.archive_write_header = _archive_write_header; av.archive_write_finish_entry = _archive_write_finish_entry; av.archive_write_data = _archive_write_data; @@ -1295,7 +1295,7 @@ _archive_write_close(struct archive *_a) } static int -_archive_write_finish(struct archive *_a) +_archive_write_free(struct archive *_a) { struct archive_write_disk *a = (struct archive_write_disk *)_a; int ret; Modified: head/lib/libarchive/libarchive.3 ============================================================================== --- head/lib/libarchive/libarchive.3 Fri Nov 5 02:45:13 2010 (r214821) +++ head/lib/libarchive/libarchive.3 Fri Nov 5 05:11:54 2010 (r214822) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 17, 2010 +.Dd February 6, 2010 .Dt LIBARCHIVE 3 .Os .Sh NAME @@ -61,13 +61,14 @@ GNU-format tar archives, .It most common cpio archive formats, .It -ISO9660 CD images (with or without RockRidge extensions), +ISO9660 CD images (including RockRidge and Joliet extensions), .It Zip archives. .El The library automatically detects archives compressed with .Xr gzip 1 , .Xr bzip2 1 , +.Xr xz 1 , or .Xr compress 1 and decompresses them transparently. @@ -87,6 +88,8 @@ archives, .It POSIX octet-oriented cpio archives, .It +Zip archive, +.It two different variants of shar archives. .El Pax interchange format is an extension of the tar archive format that @@ -168,12 +171,12 @@ You can use (which works much like the .Xr read 2 system call) -to read this data from the archive. +to read this data from the archive, or +.Fn archive_read_data_block +which provides a slightly more efficient interface. You may prefer to use the higher-level .Fn archive_read_data_skip , which reads and discards the data for this entry, -.Fn archive_read_data_to_buffer , -which reads the data into an in-memory buffer, .Fn archive_read_data_to_file , which copies the data to the provided file descriptor, or .Fn archive_read_extract , @@ -192,7 +195,7 @@ Once you have finished reading data from should call .Fn archive_read_close to close the archive, then call -.Fn archive_read_finish +.Fn archive_read_free to release all resources, including all memory allocated by the library. .Pp The @@ -230,12 +233,34 @@ You can then use to write the actual data. .Pp After all entries have been written, use the -.Fn archive_write_finish +.Fn archive_write_free function to release all resources. .Pp The .Xr archive_write 3 manual page provides more detailed calling information for this API. +.Sh WRITING ENTRIES TO DISK +The +.Xr archive_write_disk 3 +API allows you to write +.Xr archive_entry 3 +objects to disk using the same API used by +.Xr archive_write 3 . +The +.Xr archive_write_disk 3 +API is used internally by +.Fn archive_read_extract ; +using it directly can provide greater control over how entries +get written to disk. +This API also makes it possible to share code between +archive-to-archive copy and archive-to-disk extraction +operations. +.Sh READING ENTRIES FROM DISK +The +.Xr archive_read_disk 3 +provides some support for populating +.Xr archive_entry 3 +objects from information in the filesystem. .Sh DESCRIPTION Detailed descriptions of each function are provided by the corresponding manual pages. @@ -259,7 +284,9 @@ In particular, pax interchange format ca in arbitrary character sets that exceed .Va PATH_MAX . .Sh RETURN VALUES -Most functions return zero on success, non-zero on error. +Most functions return +.Cm ARCHIVE_OK +(zero) on success, non-zero on error. The return value indicates the general severity of the error, ranging from .Cm ARCHIVE_WARN , @@ -329,3 +356,14 @@ stored in a is supported by all formats. For example, cpio formats do not support nanosecond timestamps; old tar formats do not support large device numbers. +.Pp +The +.Xr archive_read_disk 3 +API should support iterating over filesystems; +that would make it possible to share code among +disk-to-archive, archive-to-archive, archive-to-disk, +and disk-to-disk operations. +Currently, it only supports reading the +information for a single file. +(Which is still quite useful, as it hides a lot +of system-specific details.) From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 06:03:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5925C1065694; Fri, 5 Nov 2010 06:03:17 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id BBED08FC25; Fri, 5 Nov 2010 06:03:15 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id IAA07056; Fri, 05 Nov 2010 08:03:13 +0200 (EET) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1PEFOL-000HPP-MB; Fri, 05 Nov 2010 08:03:13 +0200 Message-ID: <4CD39E20.1000402@freebsd.org> Date: Fri, 05 Nov 2010 08:03:12 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101029 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: Alexander Best References: <201011050056.oA50uLk5078426@svn.freebsd.org> <20101105012103.GA26789@freebsd.org> In-Reply-To: <20101105012103.GA26789@freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 06:03:17 -0000 on 05/11/2010 03:21 Alexander Best said the following: > On Fri Nov 5 10, Ed Schouten wrote: >> Author: ed >> Date: Fri Nov 5 00:56:21 2010 >> New Revision: 214817 >> URL: http://svn.freebsd.org/changeset/base/214817 >> >> Log: >> Partially implement the mysterious cons25 \e[x escape sequence. >> >> It seems the terminfo library on some systems (OS X, Linux) may emit the >> sequence \e[x to reset to default attributes. Apart from using the >> zero-command, this escape sequence allows many more operations, such as >> setting ANSI colors. I don't see this used anywhere, so this should be >> sufficient for now. >> >> This deficiency was spotted by the Debian GNU/kFreeBSD. They have their >> own patch, which is slightly flawed in my opinion. I don't know why they >> never reported this issue to us. > > maybe, because nearly all PRs (most of them including patches) they have > submitted via GNATS in the past remain unnoticed and thus they've gotten tired > of reporting issues and submitting patches if nobody seems to care? ;) Pity that they haven't discovered the mailing lists. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 07:44:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41271106566C; Fri, 5 Nov 2010 07:44:10 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (pancho.soaustin.net [76.74.250.40]) by mx1.freebsd.org (Postfix) with ESMTP id 1EB338FC08; Fri, 5 Nov 2010 07:44:09 +0000 (UTC) Received: by mail.soaustin.net (Postfix, from userid 502) id 7C26F56026; Fri, 5 Nov 2010 07:25:15 +0000 (UTC) Date: Fri, 5 Nov 2010 07:25:15 +0000 From: Mark Linimon To: Alexander Best Message-ID: <20101105072515.GA8725@lonesome.com> References: <201011050056.oA50uLk5078426@svn.freebsd.org> <20101105012103.GA26789@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101105012103.GA26789@freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 07:44:10 -0000 On Fri, Nov 05, 2010 at 01:21:03AM +0000, Alexander Best wrote: > maybe, because nearly all PRs (most of them including patches) they > have submitted via GNATS in the past remain unnoticed and thus they've > gotten tired of reporting issues and submitting patches if nobody > seems to care? ;) We actually do better these days w/rt userland bugs (and some src bugs) than we were a few years ago. I'm always looking for suggestions on how we can get more committers interested in PRs (especially those with patches). mcl From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 08:30:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF0B9106566C; Fri, 5 Nov 2010 08:30:16 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCC168FC12; Fri, 5 Nov 2010 08:30: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 oA58UGUL089875; Fri, 5 Nov 2010 08:30:16 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA58UG1j089873; Fri, 5 Nov 2010 08:30:16 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <201011050830.oA58UG1j089873@svn.freebsd.org> From: Nick Hibma Date: Fri, 5 Nov 2010 08:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214830 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 08:30:16 -0000 Author: n_hibma Date: Fri Nov 5 08:30:16 2010 New Revision: 214830 URL: http://svn.freebsd.org/changeset/base/214830 Log: Bugfix: Move the 'at =') and hence prevent 'port=X' (and 'bus=<"on" string>) from making it into the environment for the devd action. Reviewed by: hselasky MFC after: 2 weeks Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Fri Nov 5 07:49:47 2010 (r214829) +++ head/sys/dev/usb/usb_device.c Fri Nov 5 08:30:16 2010 (r214830) @@ -2426,14 +2426,13 @@ usb_notify_addq_compat(const char *type, #if USB_HAVE_UGEN "%s " #endif + "at port=%u " "vendor=0x%04x " "product=0x%04x " "devclass=0x%02x " "devsubclass=0x%02x " "sernum=\"%s\" " "release=0x%04x " - "at " - "port=%u " #if USB_HAVE_UGEN "on %s\n" #endif @@ -2442,13 +2441,13 @@ usb_notify_addq_compat(const char *type, #if USB_HAVE_UGEN udev->ugen_name, #endif + udev->port_no, UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, udev->ddesc.bDeviceSubClass, usb_get_serial(udev), - UGETW(udev->ddesc.bcdDevice), - udev->port_no + UGETW(udev->ddesc.bcdDevice) #if USB_HAVE_UGEN , udev->parent_hub != NULL ? udev->parent_hub->ugen_name : From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 08:59:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C7D1106567A; Fri, 5 Nov 2010 08:59:41 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 838178FC1F; Fri, 5 Nov 2010 08:59:40 +0000 (UTC) Received: by wwb17 with SMTP id 17so2691987wwb.31 for ; Fri, 05 Nov 2010 01:59:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=RXFZlSDv8nuHWv4D6PzKtZAs1vtdO+5YxCbVVLPx04s=; b=mHZZfUEaBsh7usnMw6We0UIAdB18uzcq8dsbbB74xecAv4NlZlisPl8V6ijbgT19i8 iKjrdoVyotMSK8FNvKMprxB5C2TJdBI8b8yKabDpJsqRKb9a0eWlMva1d0LIE0qE8Awu 9Zl4koXjs0mpm2QC7B8Z6E9gkOtm1iS/NH5nE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=WDKClw2YVZI0MBf3fpcxtdkYP5qv380xX5nlY9bRpML03C0ZTs5ff6I8cab5zuo3w+ OEAUW4yaZnUh30pauXmbySYbfJWD2xkxMHw2H3zMAGJW2Nk1YuiOFFrnMRg3DB6WU3eN HJ4yGm7QpFpNKiv7OUtUiUXNSrcdCmlq+2Wqc= MIME-Version: 1.0 Received: by 10.216.175.18 with SMTP id y18mr1849291wel.30.1288947578821; Fri, 05 Nov 2010 01:59:38 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.198.27 with HTTP; Fri, 5 Nov 2010 01:59:38 -0700 (PDT) In-Reply-To: <20101105072515.GA8725@lonesome.com> References: <201011050056.oA50uLk5078426@svn.freebsd.org> <20101105012103.GA26789@freebsd.org> <20101105072515.GA8725@lonesome.com> Date: Fri, 5 Nov 2010 01:59:38 -0700 X-Google-Sender-Auth: UkHxKiTTDNpf7ol7RbTOQ4oIM-M Message-ID: From: Garrett Cooper To: Mark Linimon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Alexander Best , svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 08:59:41 -0000 On Fri, Nov 5, 2010 at 12:25 AM, Mark Linimon wrote: > On Fri, Nov 05, 2010 at 01:21:03AM +0000, Alexander Best wrote: >> maybe, because nearly all PRs (most of them including patches) they >> have submitted via GNATS in the past remain unnoticed and thus they've >> gotten tired of reporting issues and submitting patches if nobody >> seems to care? ;) > > We actually do better these days w/rt userland bugs (and some src > bugs) than we were a few years ago. =A0I'm always looking for suggestions > on how we can get more committers interested in PRs (especially those > with patches). [As is probably well known already among FreeBSD developers] it's better for junior committers (and otherwise newbie committers) to get into the whole userland commit arena. Most of what I see in committer status seems to evolve from userland (optional) to kernel due to the sexiness of kernel work vs userland work. -Garrett From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 09:06:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03D59106566B; Fri, 5 Nov 2010 09:06:24 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAF3C8FC12; Fri, 5 Nov 2010 09:06: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 oA596NPD090655; Fri, 5 Nov 2010 09:06:23 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA596Ntp090652; Fri, 5 Nov 2010 09:06:23 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <201011050906.oA596Ntp090652@svn.freebsd.org> From: Nick Hibma Date: Fri, 5 Nov 2010 09:06: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: r214831 - head/sys/dev/usb/serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 09:06:24 -0000 Author: n_hibma Date: Fri Nov 5 09:06:23 2010 New Revision: 214831 URL: http://svn.freebsd.org/changeset/base/214831 Log: - Remove an unused entry from the softc (only used in a debugging printf). - Fix the loop count on detach (causing a panic on detaching a serial dongle). - Increase a buffer in case some driver want extra long tty device names (postfixing the purpose of the tty for example, e.g. u3g.ppp). Modified: head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/usb_serial.h Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Fri Nov 5 08:30:16 2010 (r214830) +++ head/sys/dev/usb/serial/usb_serial.c Fri Nov 5 09:06:23 2010 (r214831) @@ -255,7 +255,7 @@ ucom_attach(struct ucom_super_softc *ssc } ssc->sc_subunits = subunits; - for (subunit = 0; subunit != ssc->sc_subunits; subunit++) { + for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { sc[subunit].sc_subunit = subunit; sc[subunit].sc_super = ssc; sc[subunit].sc_mtx = mtx; @@ -270,8 +270,8 @@ ucom_attach(struct ucom_super_softc *ssc sc[subunit].sc_flag |= UCOM_FLAG_ATTACHED; } - DPRINTF("tp = %p, unit = %d, subunits = %d, device name subunit 0 = %s\n", - sc->sc_tty, ssc->sc_unit, ssc->sc_subunits, sc[0].sc_devname); + DPRINTF("tp = %p, unit = %d, subunits = %d\n", + sc->sc_tty, ssc->sc_unit, ssc->sc_subunits); return (0); } @@ -287,7 +287,7 @@ ucom_detach(struct ucom_super_softc *ssc usb_proc_drain(&ssc->sc_tq); - for (subunit = 0; subunit <= ssc->sc_subunits; subunit++) { + for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { if (sc[subunit].sc_flag & UCOM_FLAG_ATTACHED) { ucom_detach_tty(&sc[subunit]); @@ -304,7 +304,7 @@ static int ucom_attach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) { struct tty *tp; - char buf[10]; /* temporary TTY device name buffer */ + char buf[32]; /* temporary TTY device name buffer */ tp = tty_alloc_mutex(&ucom_class, sc, sc->sc_mtx); if (tp == NULL) Modified: head/sys/dev/usb/serial/usb_serial.h ============================================================================== --- head/sys/dev/usb/serial/usb_serial.h Fri Nov 5 08:30:16 2010 (r214830) +++ head/sys/dev/usb/serial/usb_serial.h Fri Nov 5 09:06:23 2010 (r214831) @@ -160,7 +160,6 @@ struct ucom_softc { const struct ucom_callback *sc_callback; struct ucom_super_softc *sc_super; struct tty *sc_tty; - char sc_devname[10]; struct mtx *sc_mtx; void *sc_parent; uint32_t sc_subunit; From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 09:38:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 96DEA1065672; Fri, 5 Nov 2010 09:38:44 +0000 (UTC) Date: Fri, 5 Nov 2010 09:38:44 +0000 From: Alexander Best To: Mark Linimon Message-ID: <20101105093844.GA75981@freebsd.org> References: <201011050056.oA50uLk5078426@svn.freebsd.org> <20101105012103.GA26789@freebsd.org> <20101105072515.GA8725@lonesome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101105072515.GA8725@lonesome.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 09:38:44 -0000 On Fri Nov 5 10, Mark Linimon wrote: > On Fri, Nov 05, 2010 at 01:21:03AM +0000, Alexander Best wrote: > > maybe, because nearly all PRs (most of them including patches) they > > have submitted via GNATS in the past remain unnoticed and thus they've > > gotten tired of reporting issues and submitting patches if nobody > > seems to care? ;) > > We actually do better these days w/rt userland bugs (and some src > bugs) than we were a few years ago. I'm always looking for suggestions > on how we can get more committers interested in PRs (especially those > with patches). unfortunately this might come too late. in 2006 and 2007 apple e.g. submitted quite some patches and tried contributing some work back to the freebsd project. since most of their PR didn't trigger any attention at all, they seem to have completely stopped sending in patches. even if a higher response rate in connection with GNATS can be achieved, these parties (GNU/kFreeBSD, apple, ...) and their "manpower" are probably lost forever for the freebsd project. since their patches didn't trigger any interest, it is very likely that they have no intentions anymore to contribute any work back: reasonably. expecially in the apple case that's a huge loss. personally i think any contributions by such companies like apple need to have high priority. maybe having a single committer who will interact with apple or other major companies might even be a good idea. this doesn't mean that user contributions aren't as valuable as contributions by companies, but the fact that certain companies have quite a massive "manpower", the impact of ignoring their patches is far more severe. if a company wished to have their work pushed back into the freebsd tree this seems to be quite a complex process. maybe 2 or 3 years ago nvidia requested some VM changes for their closed source driver to work on freebsd amd64. they decided to skip the PR databse and directly interacted with developers (i think mostly alc@). so that kinda prooves that the PR databse is not suited very well to get patches committed to freebsd; instead contacting with developers directly seems to be far more successful. but again (as mark pointed out many times) freebsd doesn't have a culture of bug busting. cheers. alex > > mcl -- a13x From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 11:31:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F65C106564A; Fri, 5 Nov 2010 11:31:39 +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 443E28FC2A; Fri, 5 Nov 2010 11:31: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 oA5BVdmK095629; Fri, 5 Nov 2010 11:31:39 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5BVdd4095627; Fri, 5 Nov 2010 11:31:39 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201011051131.oA5BVdd4095627@svn.freebsd.org> From: Rui Paulo Date: Fri, 5 Nov 2010 11:31: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: r214834 - head/sbin/pflogd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 11:31:39 -0000 Author: rpaulo Date: Fri Nov 5 11:31:39 2010 New Revision: 214834 URL: http://svn.freebsd.org/changeset/base/214834 Log: Append to CFLAGS, don't clobber it. Submitted by: loos Modified: head/sbin/pflogd/Makefile Modified: head/sbin/pflogd/Makefile ============================================================================== --- head/sbin/pflogd/Makefile Fri Nov 5 09:32:32 2010 (r214833) +++ head/sbin/pflogd/Makefile Fri Nov 5 11:31:39 2010 (r214834) @@ -6,7 +6,7 @@ PROG= pflogd SRCS= pflogd.c pidfile.c privsep.c privsep_fdpass.c MAN= pflogd.8 -CFLAGS=-include ${.CURDIR}/../../lib/libpcap/config.h +CFLAGS+=-include ${.CURDIR}/../../lib/libpcap/config.h LDADD= -lpcap -lutil DPADD= ${LIBPCAP} ${LIBUTIL} From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 11:59:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 945081065675; Fri, 5 Nov 2010 11:59:37 +0000 (UTC) (envelope-from skip@menantico.com) Received: from vms173003pub.verizon.net (vms173003pub.verizon.net [206.46.173.3]) by mx1.freebsd.org (Postfix) with ESMTP id 6FCD48FC22; Fri, 5 Nov 2010 11:59:37 +0000 (UTC) Received: from mx.menantico.com ([unknown] [71.168.247.194]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LBE00MCSRUMYDW5@vms173003.mailsrvcs.net>; Fri, 05 Nov 2010 05:59:11 -0500 (CDT) Date: Fri, 05 Nov 2010 07:02:44 -0400 From: Skip Ford To: Mark Linimon Message-id: <20101105110244.GE72983@menantico.com> References: <201011050056.oA50uLk5078426@svn.freebsd.org> <20101105012103.GA26789@freebsd.org> <20101105072515.GA8725@lonesome.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline In-reply-to: <20101105072515.GA8725@lonesome.com> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Alexander Best , svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 11:59:37 -0000 Mark Linimon wrote: > I'm always looking for suggestions on how we can get more committers > interested in PRs (especially those with patches). For PRs with patches that apply to code with a listed MAINTAINER, that maintainer should have to address the PR within 3 days or their own commits should get blocked until they do. Maintainers will then either handle PRs, or stop listing themselves as maintainers, which would open "their" code up to other committers to commit without maintainer review. It's a win either way, IMO, as far as handling PRs goes. -- Skip From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 12:11:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 8CD121065679; Fri, 5 Nov 2010 12:11:10 +0000 (UTC) Date: Fri, 5 Nov 2010 12:11:10 +0000 From: Alexander Best To: Skip Ford Message-ID: <20101105121110.GA95191@freebsd.org> References: <201011050056.oA50uLk5078426@svn.freebsd.org> <20101105012103.GA26789@freebsd.org> <20101105072515.GA8725@lonesome.com> <20101105110244.GE72983@menantico.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101105110244.GE72983@menantico.com> Cc: svn-src-head@freebsd.org, Mark Linimon , svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 12:11:10 -0000 On Fri Nov 5 10, Skip Ford wrote: > Mark Linimon wrote: > > I'm always looking for suggestions on how we can get more committers > > interested in PRs (especially those with patches). > > For PRs with patches that apply to code with a listed MAINTAINER, that > maintainer should have to address the PR within 3 days or their own > commits should get blocked until they do. > > Maintainers will then either handle PRs, or stop listing themselves as > maintainers, which would open "their" code up to other committers to > commit without maintainer review. It's a win either way, IMO, as far as > handling PRs goes. *lol* that would be like polititians agreeing to have their salaries cut in half: NOT GOING TO HAPPEN! > > -- > Skip -- a13x From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 13:04:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F09D106566B; Fri, 5 Nov 2010 13:04:28 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from mail1.sandvine.com (Mail1.sandvine.com [64.7.137.134]) by mx1.freebsd.org (Postfix) with ESMTP id 5777C8FC14; Fri, 5 Nov 2010 13:04:27 +0000 (UTC) Received: from labgw2.phaedrus.sandvine.com (192.168.222.22) by WTL-EXCH-1.sandvine.com (192.168.196.31) with Microsoft SMTP Server id 14.0.694.0; Fri, 5 Nov 2010 09:04:26 -0400 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 10332) id 6BD1433C00; Fri, 5 Nov 2010 09:04:26 -0400 (EDT) Date: Fri, 5 Nov 2010 09:04:26 -0400 From: Ed Maste To: Ed Schouten Message-ID: <20101105130426.GA47601@sandvine.com> References: <201011050056.oA50uLk5078426@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <201011050056.oA50uLk5078426@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: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 13:04:28 -0000 On Fri, Nov 05, 2010 at 12:56:21AM +0000, Ed Schouten wrote: > Author: ed > Date: Fri Nov 5 00:56:21 2010 > New Revision: 214817 > URL: http://svn.freebsd.org/changeset/base/214817 > > Log: > Partially implement the mysterious cons25 \e[x escape sequence. > > It seems the terminfo library on some systems (OS X, Linux) may emit the > sequence \e[x to reset to default attributes. Apart from using the > zero-command, this escape sequence allows many more operations, such as > setting ANSI colors. I don't see this used anywhere, so this should be > sufficient for now. > > This deficiency was spotted by the Debian GNU/kFreeBSD. They have their > own patch, which is slightly flawed in my opinion. I don't know why they > never reported this issue to us. I'm not sure what happened with this specific patch, but as a general plan they wish to push patches upstream, although it seems we've rejected several of their diffs so far. The full set of their patches are in their svn repository at http://svn.debian.org/wsvn/glibc-bsd/trunk/kfreebsd-8/debian/patches/ and are divided into three categories - changes that are already in our tree now but were not in 8.1, patches they intend to send our way, and patches that are not appropriate for FreeBSD or that we've rejected. I'll see if I can find one of the GNU/kFreeBSD people willing to write up a short summary for each of the patches they apply (and take the thread to freebsd-hackers, if so). -Ed From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 13:42:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F7F1106566B; Fri, 5 Nov 2010 13:42:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AFB18FC12; Fri, 5 Nov 2010 13:42: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 oA5Dgx23098557; Fri, 5 Nov 2010 13:42:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5DgwNr098546; Fri, 5 Nov 2010 13:42:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011051342.oA5DgwNr098546@svn.freebsd.org> From: John Baldwin Date: Fri, 5 Nov 2010 13:42: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: r214835 - in head/sys: amd64/amd64 arm/arm i386/i386 ia64/ia64 mips/mips pc98/pc98 powerpc/aim powerpc/booke sparc64/sparc64 sun4v/sun4v X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 13:42:59 -0000 Author: jhb Date: Fri Nov 5 13:42:58 2010 New Revision: 214835 URL: http://svn.freebsd.org/changeset/base/214835 Log: Adjust the order of operations in spinlock_enter() and spinlock_exit() to work properly with single-stepping in a kernel debugger. Specifically, these routines have always disabled interrupts before increasing the nesting count and restored the prior state of interrupts after decreasing the nesting count to avoid problems with a nested interrupt not disabling interrupts when acquiring a spin lock. However, trap interrupts for single-stepping can still occur even when interrupts are disabled. Now the saved state of interrupts is not saved in the thread until after interrupts have been disabled and the nesting count has been increased. Similarly, the saved state from the thread cannot be read once the nesting count has been decreased to zero. To fix this, use temporary variables to store interrupt state and shuffle it between the thread's MD area and the appropriate registers. In cooperation with: bde MFC after: 1 month Modified: head/sys/amd64/amd64/machdep.c head/sys/arm/arm/machdep.c head/sys/i386/i386/machdep.c head/sys/ia64/ia64/machdep.c head/sys/mips/mips/machdep.c head/sys/pc98/pc98/machdep.c head/sys/powerpc/aim/machdep.c head/sys/powerpc/booke/machdep.c head/sys/sparc64/sparc64/machdep.c head/sys/sun4v/sun4v/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/amd64/amd64/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -1762,11 +1762,15 @@ void spinlock_enter(void) { struct thread *td; + register_t flags; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_flags = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + flags = intr_disable(); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_flags = flags; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -1774,12 +1778,14 @@ void spinlock_exit(void) { struct thread *td; + register_t flags; td = curthread; critical_exit(); + flags = td->td_md.md_saved_flags; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_flags); + intr_restore(flags); } /* Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/arm/arm/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -493,11 +493,15 @@ void spinlock_enter(void) { struct thread *td; + register_t cspr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_cspr = disable_interrupts(I32_bit | F32_bit); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + cspr = disable_interrupts(I32_bit | F32_bit); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_cspr = cspr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -505,12 +509,14 @@ void spinlock_exit(void) { struct thread *td; + register_t cspr; td = curthread; critical_exit(); + cspr = td->td_md.md_saved_cspr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - restore_interrupts(td->td_md.md_saved_cspr); + restore_interrupts(cspr); } /* Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/i386/i386/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -2997,11 +2997,15 @@ void spinlock_enter(void) { struct thread *td; + register_t flags; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_flags = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + flags = intr_disable(); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_flags = flags; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -3009,12 +3013,14 @@ void spinlock_exit(void) { struct thread *td; + register_t flags; td = curthread; critical_exit(); + flags = td->td_md.md_saved_flags; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_flags); + intr_restore(flags); } #if defined(I586_CPU) && !defined(NO_F00F_HACK) Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/ia64/ia64/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -513,11 +513,15 @@ void spinlock_enter(void) { struct thread *td; + int intr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_intr = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + intr = intr_disable(); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_intr = intr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -525,12 +529,14 @@ void spinlock_exit(void) { struct thread *td; + int intr; td = curthread; critical_exit(); + intr = td->td_md.md_saved_intr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_intr); + intr_restore(intr); } void Modified: head/sys/mips/mips/machdep.c ============================================================================== --- head/sys/mips/mips/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/mips/mips/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -450,11 +450,15 @@ void spinlock_enter(void) { struct thread *td; + register_t intr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_intr = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + intr = intr_disable(); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_intr = intr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -462,12 +466,14 @@ void spinlock_exit(void) { struct thread *td; + register_t intr; td = curthread; critical_exit(); + intr = td->td_md.md_saved_intr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_intr); + intr_restore(intr); } /* Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/pc98/pc98/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -2340,11 +2340,15 @@ void spinlock_enter(void) { struct thread *td; + register_t flags; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_flags = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + flags = intr_disable(); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_flags = flags; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -2352,12 +2356,14 @@ void spinlock_exit(void) { struct thread *td; + register_t flags; td = curthread; critical_exit(); + flags = td->td_md.md_saved_flags; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_flags); + intr_restore(flags); } #if defined(I586_CPU) && !defined(NO_F00F_HACK) Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/powerpc/aim/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -751,11 +751,15 @@ void spinlock_enter(void) { struct thread *td; + register_t msr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_msr = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + msr = intr_disable(); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_msr = msr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -763,12 +767,14 @@ void spinlock_exit(void) { struct thread *td; + register_t msr; td = curthread; critical_exit(); + msr = td->td_md.md_saved_msr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_msr); + intr_restore(msr); } /* Modified: head/sys/powerpc/booke/machdep.c ============================================================================== --- head/sys/powerpc/booke/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/powerpc/booke/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -516,11 +516,15 @@ void spinlock_enter(void) { struct thread *td; + register_t msr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_msr = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + msr = intr_disable(); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_msr = msr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -528,12 +532,14 @@ void spinlock_exit(void) { struct thread *td; + register_t msr; td = curthread; critical_exit(); + msr = td->td_md.md_saved_msr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_msr); + intr_restore(msr); } /* Shutdown the CPU as much as possible. */ Modified: head/sys/sparc64/sparc64/machdep.c ============================================================================== --- head/sys/sparc64/sparc64/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/sparc64/sparc64/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -224,9 +224,10 @@ spinlock_enter(void) if (td->td_md.md_spinlock_count == 0) { pil = rdpr(pil); wrpr(pil, 0, PIL_TICK); + td->td_md.md_spinlock_count = 1; td->td_md.md_saved_pil = pil; - } - td->td_md.md_spinlock_count++; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -234,12 +235,14 @@ void spinlock_exit(void) { struct thread *td; + register_t pil; td = curthread; critical_exit(); + pil = td->td_md.md_saved_pil; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - wrpr(pil, td->td_md.md_saved_pil, 0); + wrpr(pil, pil, 0); } static phandle_t Modified: head/sys/sun4v/sun4v/machdep.c ============================================================================== --- head/sys/sun4v/sun4v/machdep.c Fri Nov 5 11:31:39 2010 (r214834) +++ head/sys/sun4v/sun4v/machdep.c Fri Nov 5 13:42:58 2010 (r214835) @@ -269,9 +269,10 @@ spinlock_enter(void) td = curthread; if (td->td_md.md_spinlock_count == 0) { pil = intr_disable(); + td->td_md.md_spinlock_count = 1; td->td_md.md_saved_pil = pil; - } - td->td_md.md_spinlock_count++; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -279,14 +280,14 @@ void spinlock_exit(void) { struct thread *td; + register_t pil; td = curthread; critical_exit(); + pil = td->td_md.md_saved_pil; td->td_md.md_spinlock_count--; - if (td->td_md.md_spinlock_count == 0) { - intr_restore(td->td_md.md_saved_pil); - } - + if (td->td_md.md_spinlock_count == 0) + intr_restore(pil); } unsigned From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 13:45:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A82A3106564A; Fri, 5 Nov 2010 13:45:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B7168FC1B; Fri, 5 Nov 2010 13:45: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 oA5DjDRs098678; Fri, 5 Nov 2010 13:45:13 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5DjDHv098676; Fri, 5 Nov 2010 13:45:13 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011051345.oA5DjDHv098676@svn.freebsd.org> From: John Baldwin Date: Fri, 5 Nov 2010 13:45:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214836 - stable/8/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 13:45:13 -0000 Author: jhb Date: Fri Nov 5 13:45:13 2010 New Revision: 214836 URL: http://svn.freebsd.org/changeset/base/214836 Log: MFC 214673: Fix a few typos and style nits in the example code. Modified: stable/8/share/man/man9/sysctl_ctx_init.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/sysctl_ctx_init.9 ============================================================================== --- stable/8/share/man/man9/sysctl_ctx_init.9 Fri Nov 5 13:42:58 2010 (r214835) +++ stable/8/share/man/man9/sysctl_ctx_init.9 Fri Nov 5 13:45:13 2010 (r214836) @@ -188,27 +188,27 @@ This example uses contexts to keep track struct sysctl_ctx_list clist; struct sysctl_oid *oidp; int a_int; -char *string = "dynamic sysctl"; +const char *string = "dynamic sysctl"; ... sysctl_ctx_init(&clist); -oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(/* tree top */), - OID_AUTO, "newtree", CTFLAG_RW, 0, "new top level tree"); -oidp = SYSCTL_ADD_INT( &clist, SYSCTL_CHILDREN(oidp), +oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(/* tree top */), + OID_AUTO, "newtree", CTLFLAG_RW, 0, "new top level tree"); +oidp = SYSCTL_ADD_INT(&clist, SYSCTL_CHILDREN(oidp), OID_AUTO, "newint", CTLFLAG_RW, &a_int, 0, "new int leaf"); ... -oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(_debug), - OID_AUTO, "newtree", CTFLAG_RW, 0, "new tree under debug"); -oidp = SYSCTL_ADD_STRING( &clist, SYSCTL_CHILDREN(oidp), - OID_AUTO, "newstring", CTLFLAG_R, string, 0, "new string leaf"); +oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(_debug), + OID_AUTO, "newtree", CTLFLAG_RW, 0, "new tree under debug"); +oidp = SYSCTL_ADD_STRING(&clist, SYSCTL_CHILDREN(oidp), + OID_AUTO, "newstring", CTLFLAG_RD, string, 0, "new string leaf"); ... /* Now we can free up the oids */ -if(sysctl_ctx_free(&clist)) { +if (sysctl_ctx_free(&clist)) { printf("can't free this context - other oids depend on it"); - return(ENOTEMPTY); + return (ENOTEMPTY); } else { - printf("Success!\\n"): - return(0); + printf("Success!\\n"); + return (0); } .Ed .Pp From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 13:45:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0374106564A; Fri, 5 Nov 2010 13:45:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A33168FC12; Fri, 5 Nov 2010 13:45: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 oA5DjQQt098717; Fri, 5 Nov 2010 13:45:26 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5DjQFu098715; Fri, 5 Nov 2010 13:45:26 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011051345.oA5DjQFu098715@svn.freebsd.org> From: John Baldwin Date: Fri, 5 Nov 2010 13:45:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214837 - stable/7/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 13:45:26 -0000 Author: jhb Date: Fri Nov 5 13:45:26 2010 New Revision: 214837 URL: http://svn.freebsd.org/changeset/base/214837 Log: MFC 214673: Fix a few typos and style nits in the example code. Modified: stable/7/share/man/man9/sysctl_ctx_init.9 Directory Properties: stable/7/share/man/man9/ (props changed) Modified: stable/7/share/man/man9/sysctl_ctx_init.9 ============================================================================== --- stable/7/share/man/man9/sysctl_ctx_init.9 Fri Nov 5 13:45:13 2010 (r214836) +++ stable/7/share/man/man9/sysctl_ctx_init.9 Fri Nov 5 13:45:26 2010 (r214837) @@ -188,27 +188,27 @@ This example uses contexts to keep track struct sysctl_ctx_list clist; struct sysctl_oid *oidp; int a_int; -char *string = "dynamic sysctl"; +const char *string = "dynamic sysctl"; ... sysctl_ctx_init(&clist); -oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(/* tree top */), - OID_AUTO, "newtree", CTFLAG_RW, 0, "new top level tree"); -oidp = SYSCTL_ADD_INT( &clist, SYSCTL_CHILDREN(oidp), +oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(/* tree top */), + OID_AUTO, "newtree", CTLFLAG_RW, 0, "new top level tree"); +oidp = SYSCTL_ADD_INT(&clist, SYSCTL_CHILDREN(oidp), OID_AUTO, "newint", CTLFLAG_RW, &a_int, 0, "new int leaf"); ... -oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(_debug), - OID_AUTO, "newtree", CTFLAG_RW, 0, "new tree under debug"); -oidp = SYSCTL_ADD_STRING( &clist, SYSCTL_CHILDREN(oidp), - OID_AUTO, "newstring", CTLFLAG_R, string, 0, "new string leaf"); +oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(_debug), + OID_AUTO, "newtree", CTLFLAG_RW, 0, "new tree under debug"); +oidp = SYSCTL_ADD_STRING(&clist, SYSCTL_CHILDREN(oidp), + OID_AUTO, "newstring", CTLFLAG_RD, string, 0, "new string leaf"); ... /* Now we can free up the oids */ -if(sysctl_ctx_free(&clist)) { +if (sysctl_ctx_free(&clist)) { printf("can't free this context - other oids depend on it"); - return(ENOTEMPTY); + return (ENOTEMPTY); } else { - printf("Success!\\n"): - return(0); + printf("Success!\\n"); + return (0); } .Ed .Pp From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 14:56:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EC261065673; Fri, 5 Nov 2010 14:56:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 831818FC08; Fri, 5 Nov 2010 14:56:12 +0000 (UTC) Received: from c122-107-112-122.carlnfd1.nsw.optusnet.com.au (c122-107-112-122.carlnfd1.nsw.optusnet.com.au [122.107.112.122]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id oA5Eu8Cn016050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 6 Nov 2010 01:56:10 +1100 Date: Sat, 6 Nov 2010 01:56:08 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten In-Reply-To: <201011050056.oA50uLk5078426@svn.freebsd.org> Message-ID: <20101105231811.V1254@besplex.bde.org> References: <201011050056.oA50uLk5078426@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214817 - head/sys/teken X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 14:56:13 -0000 On Fri, 5 Nov 2010, Ed Schouten wrote: > Log: > Partially implement the mysterious cons25 \e[x escape sequence. CSI x is not mysterious. It is from pccons in 386BSD (probably from Net/2, since pccons is also in 4.4BSD). I think it came from pc3 originally. It is still in pccons in NetBSD, at least in 2005. NetBSD pccons only supports CSI [0-3];*x, even in 2005. I added CSI [5-7];*x (set reverse video colors) to pccons in FreeBSD-1. syscons supported all these until recently. Syscons also had the aliases CSI =F/G/H/I, where F/G set normal video colors and H/I set reverse video colors. Now it only has F/G, and has lost its support for setting reverse video colors. I use CSI x in ~/.profile since it was more portable that CSI =F/G/H/I. This broke when I downgraded to -current, so I now use the partial workaround of setting reverse video colors in $TERMCAP: %%% case $TERM in cons25) # Broken in -current: printf '\033[x\033[2;6x\033[1;0x\033[6;7x\033[5;4x' # CSI 0x reset to defaults # CSI 2;6x set ansi foreground cyan # default to ansi background black # CSI 6;7x set ansi reverse foreground white # CSI 5;4x set ansi reverse background blue # Part that still works in -current: printf '\033[=3F\033[=0G' # CSI =3F set ansi foreground cyan (not different color numbers) # CSI =0G set ansi background black ;; linux) # I don't remember what this does. Probably less. printf '\033[36;40m\033[1;4]\033[8]' ;; esac case $TERM in cons25) # Workaround for -current brokenness: set colors in termcap, and use better # colors too. This loses mainly the simple restore of defaults by CSI m, # and by expanding the size of the escape sequences. TERMCAP="$TERM:md=\E[1;37m:so=\E[37;44m:se=\E[39;49m:us=\E[1;33;44m:ue=\E[22;39;49m:tc=$TERM:" ;; esac %%% The reasons for this fiddling like this with colors are: (1) Reverse video that just reverses the colors tends to give a horrible combination of colors, since the best choices for foreground/background tend to be the worst choices when they are reversed. Thus reverse video should normally be configured to not just reverse the colors, and there should be a way to control this. The CSI [6-7]*x sequences and the CSI =*H/I provided a good way to do this. (2) The colors selected for reverse video should not be undone by other color selections or by almost any escape sequence. the CSI x sequences and CSI =F/G/H/I sequences work right for this. They are not affected by the ANSI color escapes. Of course, an ANSI color escape will change colors set by CSI x, but then on the next CSI m to normal or reverse (etc.) mode, the colors selected by CSI x will be restored. Only a "hard" terminal reset should lose the settings of CSI x. Hardware terminals are now rare, but ESC c is considered to be a hard reset and does undo CSI x. You have to be careful not to use it. cons25 may also have a "soft" reset but I don't remember what it is. IIRC, ESC c is from vt100, and vt220 or vt320 had escape sequences for several levels of softer resets, some involving keeping color settings and others not. Termcaps for vt100 mostly don't use ESC c since it really is a hard reset so it resets too much for most purposes. (3) The ANSI color sequences (put in TERMCAP as above) don't work so well for this. First you have to put them in TERMCAP and propagate this to many machines, instead of just writing a single setup sequence on the machine emulating a terminal. Then they have to be written on ever change to/from reverse video/standout/underline. I've noticed a couple of bugs involving the normal mode not being restored. Simpler CSI m sequences tend to restore the normal mode (if there is one) more reliably. (4) To be complete, there would be a separate reverse color pair for every normal color pair (256 combinations even for only 8 colors), but configuring this would be too painful, and fixing 1 normal color pair and its corresponding reverse color pair works OK in practice. Note that normal reverse video gives a different reverse pair for every normal pair, and this feature is lost by fixing the reverse pair. (5) To be complete, standout, underline and blinking (all 2**N combinations of these) would be handled similarly, with a CSI x sequence to select the default colors used in all these modes. x86 displays have various deficiencies in being able to display all combinations of attributes simultaneously or at all, and syscons has too many hard-coded color choices for combinations that are not directly representable. But configuring the general case would be too painful. In the above, my TERMCAP color choices don't worry about this, so standout followed by underline would give the colors for just one of standout or underline depending on which order the escape sequences happen to be written in. ORing together colors in their RGB or other representation would be worse. > It seems the terminfo library on some systems (OS X, Linux) may emit the > sequence \e[x to reset to default attributes. Apart from using the > zero-command, this escape sequence allows many more operations, such as > setting ANSI colors. I don't see this used anywhere, so this should be > sufficient for now. Perhaps plain CSI x (\e[0x or \e[x) is used because it is a good or the only "soft" reset. Grepping in termcap.src didn't show many uses of CSI x. Here it is for pc3 (only the reset sequence): % # The following is a version of the ibm-pc entry distributed with PC/IX, % # (Interactive Systems' System 3 for the Big Blue), modified by Richard % # McIntosh at UCB/CSM. The :pt: and :uc: have been removed from the original, % # (the former is untrue, and the latter failed under UCB/man); standout and % # underline modes have been added. Note: this entry describes the "native" % # capabilities of the PC monochrome display, without ANY emulation; most % # communications packages (but NOT PC/IX connect) do some kind of emulation. % pc|ibmpc|ibm pc PC/IX:\ % ... % pc3|ibmpc3|IBM PC 386BSD Console:\ % ... % :op=\E[x:\ % ... cons25 is basically pc3 + sco cons. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 16:04:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0BD0106566B; Fri, 5 Nov 2010 16:04:10 +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 8DD578FC08; Fri, 5 Nov 2010 16:04: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 oA5G4A79001840; Fri, 5 Nov 2010 16:04:10 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5G4AR6001838; Fri, 5 Nov 2010 16:04:10 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201011051604.oA5G4AR6001838@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 5 Nov 2010 16:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214839 - stable/8/usr.sbin/freebsd-update X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 16:04:10 -0000 Author: jh Date: Fri Nov 5 16:04:10 2010 New Revision: 214839 URL: http://svn.freebsd.org/changeset/base/214839 Log: MFC r212505: In backup_kernel(), support backing up subdirectories and handle files with spaces correctly. Modified: stable/8/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: stable/8/usr.sbin/freebsd-update/ (props changed) Modified: stable/8/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- stable/8/usr.sbin/freebsd-update/freebsd-update.sh Fri Nov 5 13:46:58 2010 (r214838) +++ stable/8/usr.sbin/freebsd-update/freebsd-update.sh Fri Nov 5 16:04:10 2010 (r214839) @@ -2619,11 +2619,13 @@ backup_kernel () { # "not ours", backup_kernel_finddir would have exited, so # deleting the directory content is as safe as we can make it. if [ -d $BACKUPKERNELDIR ]; then - rm -f $BACKUPKERNELDIR/* + rm -fr $BACKUPKERNELDIR fi - # Create directory for backup if it doesn't exist. + # Create directories for backup. mkdir -p $BACKUPKERNELDIR + mtree -cdn -p "${KERNELDIR}" | \ + mtree -Ue -p "${BACKUPKERNELDIR}" > /dev/null # Mark the directory as having been created by freebsd-update. touch $BACKUPKERNELDIR/.freebsd-update @@ -2644,9 +2646,8 @@ backup_kernel () { fi # Backup all the kernel files using hardlinks. - find $KERNELDIR -type f $FINDFILTER | \ - sed -Ee "s,($KERNELDIR)/?(.*),\1/\2 ${BACKUPKERNELDIR}/\2," | \ - xargs -n 2 cp -pl + (cd $KERNELDIR && find . -type f $FINDFILTER -exec \ + cp -pl '{}' ${BACKUPKERNELDIR}/'{}' \;) # Re-enable patchname expansion. set +f From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 18:19:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 559D61065674; Fri, 5 Nov 2010 18:19:55 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 437408FC0C; Fri, 5 Nov 2010 18:19: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 oA5IJti9005066; Fri, 5 Nov 2010 18:19:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5IJtk2005064; Fri, 5 Nov 2010 18:19:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011051819.oA5IJtk2005064@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 5 Nov 2010 18:19: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: r214840 - head/sys/dev/re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 18:19:55 -0000 Author: yongari Date: Fri Nov 5 18:19:54 2010 New Revision: 214840 URL: http://svn.freebsd.org/changeset/base/214840 Log: Enable 64bit DMA addressing for RTL810xE/RTL8168/RTL8111 PCIe controllers. Some old PCI controllers may work with DAC but it was known to be buggy so 64bit DMA addressing is used only on PCIe controllers. Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Fri Nov 5 16:04:10 2010 (r214839) +++ head/sys/dev/re/if_re.c Fri Nov 5 18:19:54 2010 (r214840) @@ -934,6 +934,7 @@ re_dma_map_addr(void *arg, bus_dma_segme static int re_allocmem(device_t dev, struct rl_softc *sc) { + bus_addr_t lowaddr; bus_size_t rx_list_size, tx_list_size; int error; int i; @@ -947,10 +948,13 @@ re_allocmem(device_t dev, struct rl_soft * register should be set. However some RealTek chips are known * to be buggy on DAC handling, therefore disable DAC by limiting * DMA address space to 32bit. PCIe variants of RealTek chips - * may not have the limitation but I took safer path. + * may not have the limitation. */ + lowaddr = BUS_SPACE_MAXADDR; + if ((sc->rl_flags & RL_FLAG_PCIE) == 0) + lowaddr = BUS_SPACE_MAXADDR_32BIT; error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + lowaddr, BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->rl_parent_tag); if (error) { From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 18:23:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61252106566B; Fri, 5 Nov 2010 18:23: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 4EF008FC15; Fri, 5 Nov 2010 18:23: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 oA5INhgK005202; Fri, 5 Nov 2010 18:23:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5INhJI005200; Fri, 5 Nov 2010 18:23:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011051823.oA5INhJI005200@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 5 Nov 2010 18:23: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: r214841 - head/sys/dev/re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 18:23:43 -0000 Author: yongari Date: Fri Nov 5 18:23:43 2010 New Revision: 214841 URL: http://svn.freebsd.org/changeset/base/214841 Log: Remove extra white spaces. Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Fri Nov 5 18:19:54 2010 (r214840) +++ head/sys/dev/re/if_re.c Fri Nov 5 18:23:43 2010 (r214841) @@ -880,7 +880,7 @@ re_probe(device_t dev) uint16_t devid, vendor; uint16_t revid, sdevid; int i; - + vendor = pci_get_vendor(dev); devid = pci_get_device(dev); revid = pci_get_revid(dev); @@ -1121,7 +1121,7 @@ re_attach(device_t dev) /* * Prefer memory space register mapping over IO space. * Because RTL8169SC does not seem to work when memory mapping - * is used always activate io mapping. + * is used always activate io mapping. */ if (devid == RT_DEVICEID_8169SC) prefer_iomap = 1; @@ -2111,7 +2111,7 @@ re_tick(void *xsc) * Reclaim transmitted frames here. Technically it is not * necessary to do here but it ensures periodic reclamation * regardless of Tx completion interrupt which seems to be - * lost on PCIe based controllers under certain situations. + * lost on PCIe based controllers under certain situations. */ re_txeof(sc); re_watchdog(sc); From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 18:24:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86F1A1065672; Fri, 5 Nov 2010 18:24:50 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74CDF8FC18; Fri, 5 Nov 2010 18:24: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 oA5IOo5r005261; Fri, 5 Nov 2010 18:24:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5IOoaT005259; Fri, 5 Nov 2010 18:24:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011051824.oA5IOoaT005259@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 5 Nov 2010 18:24: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: r214842 - head/sys/dev/re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 18:24:50 -0000 Author: yongari Date: Fri Nov 5 18:24:50 2010 New Revision: 214842 URL: http://svn.freebsd.org/changeset/base/214842 Log: style(9). Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Fri Nov 5 18:23:43 2010 (r214841) +++ head/sys/dev/re/if_re.c Fri Nov 5 18:24:50 2010 (r214842) @@ -2020,9 +2020,9 @@ re_rxeof(struct rl_softc *sc, int *rx_np if (rx_npktsp != NULL) *rx_npktsp = rx_npkts; if (maxpkt) - return(EAGAIN); + return (EAGAIN); - return(0); + return (0); } static void @@ -2839,7 +2839,7 @@ re_ioctl(struct ifnet *ifp, u_long comma if (ifr->ifr_reqcap & IFCAP_POLLING) { error = ether_poll_register(re_poll, ifp); if (error) - return(error); + return (error); RL_LOCK(sc); /* Disable interrupts */ CSR_WRITE_2(sc, RL_IMR, 0x0000); From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 19:12:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E98810656A5; Fri, 5 Nov 2010 19:12:48 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 821EA8FC1B; Fri, 5 Nov 2010 19:12: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 oA5JCmAs006494; Fri, 5 Nov 2010 19:12:48 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5JCmJ2006473; Fri, 5 Nov 2010 19:12:48 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <201011051912.oA5JCmJ2006473@svn.freebsd.org> From: Nick Hibma Date: Fri, 5 Nov 2010 19:12: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: r214843 - in head/sys/dev/usb: net serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 19:12:48 -0000 Author: n_hibma Date: Fri Nov 5 19:12:48 2010 New Revision: 214843 URL: http://svn.freebsd.org/changeset/base/214843 Log: Implement ucom_set_pnpinfo_usb() providing ttyname and port number information through devd. My E220 now produces the notification (1 line): +u3g0 at bus=1 hubaddr=1 port=0 devaddr=2 interface=0 \ vendor=0x12d1 product=0x1003 devclass=0x00 devsubclass=0x00 \ sernum="" release=0x0000 intclass=0xff intsubclass=0xff \ ttyname=U0 ttyports=2 on uhub0 Note: serial/ufoma and net/uhso still provide port number and tty name (uhso only) information through sysctls, which should now be removed. Reviewed by: hpselasky Modified: head/sys/dev/usb/net/uhso.c head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/serial/uark.c head/sys/dev/usb/serial/ubsa.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/ugensa.c head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/serial/umct.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/serial/umoscom.c head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/usb_serial.h head/sys/dev/usb/serial/uslcom.c head/sys/dev/usb/serial/uvisor.c head/sys/dev/usb/serial/uvscom.c Modified: head/sys/dev/usb/net/uhso.c ============================================================================== --- head/sys/dev/usb/net/uhso.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/net/uhso.c Fri Nov 5 19:12:48 2010 (r214843) @@ -902,6 +902,7 @@ uhso_probe_iface(struct uhso_softc *sc, device_printf(sc->sc_dev, "ucom_attach failed\n"); return (ENXIO); } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, sc->sc_dev); mtx_lock(&sc->sc_mtx); usbd_transfer_start(sc->sc_xfer[UHSO_MUX_ENDPT_INTR]); @@ -920,6 +921,7 @@ uhso_probe_iface(struct uhso_softc *sc, device_printf(sc->sc_dev, "ucom_attach failed\n"); return (ENXIO); } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, sc->sc_dev); } else { UHSO_DPRINTF(0, "Unknown type %x\n", type); Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/u3g.c Fri Nov 5 19:12:48 2010 (r214843) @@ -818,8 +818,10 @@ u3g_attach(device_t dev) DPRINTF("ucom_attach failed\n"); goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); device_printf(dev, "Found %u port%s.\n", sc->sc_numports, sc->sc_numports > 1 ? "s":""); + return (0); detach: Modified: head/sys/dev/usb/serial/uark.c ============================================================================== --- head/sys/dev/usb/serial/uark.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/uark.c Fri Nov 5 19:12:48 2010 (r214843) @@ -227,6 +227,8 @@ uark_attach(device_t dev) DPRINTF("ucom_attach failed\n"); goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); /* success */ detach: Modified: head/sys/dev/usb/serial/ubsa.c ============================================================================== --- head/sys/dev/usb/serial/ubsa.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/ubsa.c Fri Nov 5 19:12:48 2010 (r214843) @@ -331,6 +331,8 @@ ubsa_attach(device_t dev) DPRINTF("ucom_attach failed\n"); goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); detach: Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/ubser.c Fri Nov 5 19:12:48 2010 (r214843) @@ -296,6 +296,7 @@ ubser_attach(device_t dev) if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); mtx_lock(&sc->sc_mtx); usbd_xfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]); Modified: head/sys/dev/usb/serial/uchcom.c ============================================================================== --- head/sys/dev/usb/serial/uchcom.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/uchcom.c Fri Nov 5 19:12:48 2010 (r214843) @@ -354,6 +354,8 @@ uchcom_attach(device_t dev) if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); detach: Modified: head/sys/dev/usb/serial/ucycom.c ============================================================================== --- head/sys/dev/usb/serial/ucycom.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/ucycom.c Fri Nov 5 19:12:48 2010 (r214843) @@ -272,13 +272,15 @@ ucycom_attach(device_t dev) } error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, &ucycom_callback, &sc->sc_mtx); - if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + if (urd_ptr) { free(urd_ptr, M_USBDEV); } + return (0); /* success */ detach: Modified: head/sys/dev/usb/serial/ufoma.c ============================================================================== --- head/sys/dev/usb/serial/ufoma.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/ufoma.c Fri Nov 5 19:12:48 2010 (r214843) @@ -450,6 +450,8 @@ ufoma_attach(device_t dev) DPRINTF("ucom_attach failed\n"); goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + /*Sysctls*/ sctx = device_get_sysctl_ctx(dev); soid = device_get_sysctl_tree(dev); Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/uftdi.c Fri Nov 5 19:12:48 2010 (r214843) @@ -332,6 +332,8 @@ uftdi_attach(device_t dev) if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); /* success */ detach: Modified: head/sys/dev/usb/serial/ugensa.c ============================================================================== --- head/sys/dev/usb/serial/ugensa.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/ugensa.c Fri Nov 5 19:12:48 2010 (r214843) @@ -247,6 +247,8 @@ ugensa_attach(device_t dev) DPRINTF("attach failed\n"); goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); /* success */ detach: Modified: head/sys/dev/usb/serial/uipaq.c ============================================================================== --- head/sys/dev/usb/serial/uipaq.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/uipaq.c Fri Nov 5 19:12:48 2010 (r214843) @@ -1161,6 +1161,8 @@ uipaq_attach(device_t dev) if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); detach: Modified: head/sys/dev/usb/serial/umct.c ============================================================================== --- head/sys/dev/usb/serial/umct.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/umct.c Fri Nov 5 19:12:48 2010 (r214843) @@ -297,6 +297,8 @@ umct_attach(device_t dev) if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); /* success */ detach: Modified: head/sys/dev/usb/serial/umodem.c ============================================================================== --- head/sys/dev/usb/serial/umodem.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/umodem.c Fri Nov 5 19:12:48 2010 (r214843) @@ -389,6 +389,8 @@ umodem_attach(device_t dev) if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); detach: Modified: head/sys/dev/usb/serial/umoscom.c ============================================================================== --- head/sys/dev/usb/serial/umoscom.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/umoscom.c Fri Nov 5 19:12:48 2010 (r214843) @@ -338,6 +338,8 @@ umoscom_attach(device_t dev) if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); detach: Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/uplcom.c Fri Nov 5 19:12:48 2010 (r214843) @@ -445,6 +445,8 @@ uplcom_attach(device_t dev) device_printf(dev, "init failed\n"); goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); detach: Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/usb_serial.c Fri Nov 5 19:12:48 2010 (r214843) @@ -185,6 +185,8 @@ static uint8_t ucom_bitmap[(UCOM_UNIT_MA static struct mtx ucom_bitmap_mtx; MTX_SYSINIT(ucom_bitmap_mtx, &ucom_bitmap_mtx, "ucom bitmap", MTX_DEF); +#define UCOM_TTY_PREFIX "U" + /* * Mark a unit number (the X in cuaUX) as in use. * @@ -320,11 +322,12 @@ ucom_attach_tty(struct ucom_super_softc /* Use default TTY name */ if (ssc->sc_subunits > 1) { /* multiple modems in one */ - snprintf(buf, sizeof(buf), "U%u.%u", + snprintf(buf, sizeof(buf), UCOM_TTY_PREFIX "%u.%u", ssc->sc_unit, sc->sc_subunit); } else { /* single modem */ - snprintf(buf, sizeof(buf), "U%u", ssc->sc_unit); + snprintf(buf, sizeof(buf), UCOM_TTY_PREFIX "%u", + ssc->sc_unit); } } tty_makedev(tp, NULL, "%s", buf); @@ -409,6 +412,24 @@ ucom_detach_tty(struct ucom_softc *sc) cv_destroy(&sc->sc_cv); } +void +ucom_set_pnpinfo_usb(struct ucom_super_softc *ssc, device_t dev) +{ + char buf[64]; + uint8_t iface_index; + struct usb_attach_arg *uaa; + + snprintf(buf, sizeof(buf), "ttyname=%s%d ttyports=%d", + UCOM_TTY_PREFIX, ssc->sc_unit, ssc->sc_subunits); + + /* Store the PNP info in the first interface for the dev */ + uaa = device_get_ivars(dev); + iface_index = uaa->info.bIfaceIndex; + + if (usbd_set_pnpinfo(uaa->device, iface_index, buf) != 0) + device_printf(dev, "Could not set PNP info\n"); +} + static void ucom_queue_command(struct ucom_softc *sc, usb_proc_callback_t *fn, struct termios *pt, Modified: head/sys/dev/usb/serial/usb_serial.h ============================================================================== --- head/sys/dev/usb/serial/usb_serial.h Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/usb_serial.h Fri Nov 5 19:12:48 2010 (r214843) @@ -193,6 +193,7 @@ int ucom_attach(struct ucom_super_softc struct ucom_softc *, uint32_t, void *, const struct ucom_callback *callback, struct mtx *); void ucom_detach(struct ucom_super_softc *, struct ucom_softc *); +void ucom_set_pnpinfo_usb(struct ucom_super_softc *, device_t); void ucom_status_change(struct ucom_softc *); uint8_t ucom_get_data(struct ucom_softc *, struct usb_page_cache *, uint32_t, uint32_t, uint32_t *); Modified: head/sys/dev/usb/serial/uslcom.c ============================================================================== --- head/sys/dev/usb/serial/uslcom.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/uslcom.c Fri Nov 5 19:12:48 2010 (r214843) @@ -324,6 +324,8 @@ uslcom_attach(device_t dev) if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); detach: Modified: head/sys/dev/usb/serial/uvisor.c ============================================================================== --- head/sys/dev/usb/serial/uvisor.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/uvisor.c Fri Nov 5 19:12:48 2010 (r214843) @@ -347,6 +347,8 @@ uvisor_attach(device_t dev) DPRINTF("ucom_attach failed\n"); goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + return (0); detach: Modified: head/sys/dev/usb/serial/uvscom.c ============================================================================== --- head/sys/dev/usb/serial/uvscom.c Fri Nov 5 18:24:50 2010 (r214842) +++ head/sys/dev/usb/serial/uvscom.c Fri Nov 5 19:12:48 2010 (r214843) @@ -321,6 +321,8 @@ uvscom_attach(device_t dev) if (error) { goto detach; } + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + /* start interrupt pipe */ mtx_lock(&sc->sc_mtx); usbd_transfer_start(sc->sc_xfer[UVSCOM_INTR_DT_RD]); From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 19:26:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86F691065672; Fri, 5 Nov 2010 19:26:55 +0000 (UTC) (envelope-from nick@van-laarhoven.org) Received: from cpsmtpb-ews10.kpnxchange.com (cpsmtpb-ews10.kpnxchange.com [213.75.39.15]) by mx1.freebsd.org (Postfix) with ESMTP id 01CC18FC0C; Fri, 5 Nov 2010 19:26:54 +0000 (UTC) Received: from cpbrm-ews33.kpnxchange.com ([10.94.84.164]) by cpsmtpb-ews10.kpnxchange.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 5 Nov 2010 20:14:49 +0100 Received: from CPSMTPM-EML109.kpnxchange.com ([195.121.3.13]) by cpbrm-ews33.kpnxchange.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 5 Nov 2010 20:14:48 +0100 Received: from uitsmijter.van-laarhoven.org ([81.207.207.222]) by CPSMTPM-EML109.kpnxchange.com with Microsoft SMTPSVC(7.0.6002.18222); Fri, 5 Nov 2010 20:14:47 +0100 Received: from hillary.van-laarhoven.org (Hillary.van-laarhoven.org [10.66.0.100]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by uitsmijter.van-laarhoven.org (Postfix) with ESMTPSA id 691D64567; Fri, 5 Nov 2010 20:14:34 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Nick Hibma In-Reply-To: <201011051912.oA5JCmJ2006473@svn.freebsd.org> Date: Fri, 5 Nov 2010 20:14:33 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201011051912.oA5JCmJ2006473@svn.freebsd.org> To: Nick Hibma X-Mailer: Apple Mail (2.1081) X-Spam-Status: No, score=-15.4 required=5.0 tests=J_CHICKENPOX_83, UNPARSEABLE_RELAY,USER_IN_WHITELIST,USER_IN_WHITELIST_TO autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on uitsmijter.van-laarhoven.org X-OriginalArrivalTime: 05 Nov 2010 19:14:48.0077 (UTC) FILETIME=[B69283D0:01CB7D1D] X-RcptDomain: freebsd.org Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214843 - in head/sys/dev/usb: net serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 19:26:55 -0000 Forgot to mention: MFC: 2 weeks On 5 Nov 2010, at 20:12, Nick Hibma wrote: > Author: n_hibma > Date: Fri Nov 5 19:12:48 2010 > New Revision: 214843 > URL: http://svn.freebsd.org/changeset/base/214843 >=20 > Log: > Implement ucom_set_pnpinfo_usb() providing ttyname and port number > information through devd. My E220 now produces the notification (1 = line): >=20 > +u3g0 at bus=3D1 hubaddr=3D1 port=3D0 devaddr=3D2 interface=3D0 = \ > vendor=3D0x12d1 product=3D0x1003 devclass=3D0x00 = devsubclass=3D0x00 \ > sernum=3D"" release=3D0x0000 intclass=3D0xff intsubclass=3D0xff = \ > ttyname=3DU0 ttyports=3D2 on uhub0 >=20 > Note: serial/ufoma and net/uhso still provide port number and tty = name > (uhso only) information through sysctls, which should now be removed. >=20 > Reviewed by: hpselasky >=20 > Modified: > head/sys/dev/usb/net/uhso.c > head/sys/dev/usb/serial/u3g.c > head/sys/dev/usb/serial/uark.c > head/sys/dev/usb/serial/ubsa.c > head/sys/dev/usb/serial/ubser.c > head/sys/dev/usb/serial/uchcom.c > head/sys/dev/usb/serial/ucycom.c > head/sys/dev/usb/serial/ufoma.c > head/sys/dev/usb/serial/uftdi.c > head/sys/dev/usb/serial/ugensa.c > head/sys/dev/usb/serial/uipaq.c > head/sys/dev/usb/serial/umct.c > head/sys/dev/usb/serial/umodem.c > head/sys/dev/usb/serial/umoscom.c > head/sys/dev/usb/serial/uplcom.c > head/sys/dev/usb/serial/usb_serial.c > head/sys/dev/usb/serial/usb_serial.h > head/sys/dev/usb/serial/uslcom.c > head/sys/dev/usb/serial/uvisor.c > head/sys/dev/usb/serial/uvscom.c >=20 > Modified: head/sys/dev/usb/net/uhso.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/net/uhso.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/net/uhso.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -902,6 +902,7 @@ uhso_probe_iface(struct uhso_softc *sc,=20 > device_printf(sc->sc_dev, "ucom_attach = failed\n"); > return (ENXIO); > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, = sc->sc_dev); >=20 > mtx_lock(&sc->sc_mtx); > = usbd_transfer_start(sc->sc_xfer[UHSO_MUX_ENDPT_INTR]); > @@ -920,6 +921,7 @@ uhso_probe_iface(struct uhso_softc *sc,=20 > device_printf(sc->sc_dev, "ucom_attach = failed\n"); > return (ENXIO); > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, sc->sc_dev); > } > else { > UHSO_DPRINTF(0, "Unknown type %x\n", type); >=20 > Modified: head/sys/dev/usb/serial/u3g.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/u3g.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/u3g.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -818,8 +818,10 @@ u3g_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > device_printf(dev, "Found %u port%s.\n", sc->sc_numports, > sc->sc_numports > 1 ? "s":""); > + > return (0); >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/uark.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/uark.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/uark.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -227,6 +227,8 @@ uark_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); /* success */ >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/ubsa.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/ubsa.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/ubsa.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -331,6 +331,8 @@ ubsa_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/ubser.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/ubser.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/ubser.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -296,6 +296,7 @@ ubser_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); >=20 > mtx_lock(&sc->sc_mtx); > usbd_xfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]); >=20 > Modified: head/sys/dev/usb/serial/uchcom.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/uchcom.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/uchcom.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -354,6 +354,8 @@ uchcom_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/ucycom.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/ucycom.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/ucycom.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -272,13 +272,15 @@ ucycom_attach(device_t dev) > } > error =3D ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, > &ucycom_callback, &sc->sc_mtx); > - > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > if (urd_ptr) { > free(urd_ptr, M_USBDEV); > } > + > return (0); /* success */ >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/ufoma.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/ufoma.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/ufoma.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -450,6 +450,8 @@ ufoma_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > /*Sysctls*/ > sctx =3D device_get_sysctl_ctx(dev); > soid =3D device_get_sysctl_tree(dev); >=20 > Modified: head/sys/dev/usb/serial/uftdi.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/uftdi.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/uftdi.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -332,6 +332,8 @@ uftdi_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); /* success */ >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/ugensa.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/ugensa.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/ugensa.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -247,6 +247,8 @@ ugensa_attach(device_t dev) > DPRINTF("attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); /* success */ >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/uipaq.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/uipaq.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/uipaq.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -1161,6 +1161,8 @@ uipaq_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/umct.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/umct.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/umct.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -297,6 +297,8 @@ umct_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); /* success */ >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/umodem.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/umodem.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/umodem.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -389,6 +389,8 @@ umodem_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/umoscom.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/umoscom.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/umoscom.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -338,6 +338,8 @@ umoscom_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/uplcom.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/uplcom.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/uplcom.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -445,6 +445,8 @@ uplcom_attach(device_t dev) > device_printf(dev, "init failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/usb_serial.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/usb_serial.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/usb_serial.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -185,6 +185,8 @@ static uint8_t ucom_bitmap[(UCOM_UNIT_MA > static struct mtx ucom_bitmap_mtx; > MTX_SYSINIT(ucom_bitmap_mtx, &ucom_bitmap_mtx, "ucom bitmap", = MTX_DEF); >=20 > +#define UCOM_TTY_PREFIX "U" > + > /* > * Mark a unit number (the X in cuaUX) as in use. > * > @@ -320,11 +322,12 @@ ucom_attach_tty(struct ucom_super_softc=20 > /* Use default TTY name */ > if (ssc->sc_subunits > 1) { > /* multiple modems in one */ > - snprintf(buf, sizeof(buf), "U%u.%u", > + snprintf(buf, sizeof(buf), UCOM_TTY_PREFIX = "%u.%u", > ssc->sc_unit, sc->sc_subunit); > } else { > /* single modem */ > - snprintf(buf, sizeof(buf), "U%u", ssc->sc_unit); > + snprintf(buf, sizeof(buf), UCOM_TTY_PREFIX "%u", > + ssc->sc_unit); > } > } > tty_makedev(tp, NULL, "%s", buf); > @@ -409,6 +412,24 @@ ucom_detach_tty(struct ucom_softc *sc) > cv_destroy(&sc->sc_cv); > } >=20 > +void > +ucom_set_pnpinfo_usb(struct ucom_super_softc *ssc, device_t dev) > +{ > + char buf[64]; > + uint8_t iface_index; > + struct usb_attach_arg *uaa; > + > + snprintf(buf, sizeof(buf), "ttyname=3D%s%d ttyports=3D%d", > + UCOM_TTY_PREFIX, ssc->sc_unit, ssc->sc_subunits); > + > + /* Store the PNP info in the first interface for the dev */ > + uaa =3D device_get_ivars(dev); > + iface_index =3D uaa->info.bIfaceIndex; > + =20 > + if (usbd_set_pnpinfo(uaa->device, iface_index, buf) !=3D 0) > + device_printf(dev, "Could not set PNP info\n"); > +} > + > static void > ucom_queue_command(struct ucom_softc *sc, > usb_proc_callback_t *fn, struct termios *pt, >=20 > Modified: head/sys/dev/usb/serial/usb_serial.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/usb_serial.h Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/usb_serial.h Fri Nov 5 19:12:48 2010 = (r214843) > @@ -193,6 +193,7 @@ int ucom_attach(struct ucom_super_softc=20 > struct ucom_softc *, uint32_t, void *, > const struct ucom_callback *callback, struct mtx *); > void ucom_detach(struct ucom_super_softc *, struct ucom_softc *); > +void ucom_set_pnpinfo_usb(struct ucom_super_softc *, device_t); > void ucom_status_change(struct ucom_softc *); > uint8_t ucom_get_data(struct ucom_softc *, struct usb_page_cache = *, > uint32_t, uint32_t, uint32_t *); >=20 > Modified: head/sys/dev/usb/serial/uslcom.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/uslcom.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/uslcom.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -324,6 +324,8 @@ uslcom_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/uvisor.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/uvisor.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/uvisor.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -347,6 +347,8 @@ uvisor_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); >=20 > detach: >=20 > Modified: head/sys/dev/usb/serial/uvscom.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/serial/uvscom.c Fri Nov 5 18:24:50 2010 = (r214842) > +++ head/sys/dev/usb/serial/uvscom.c Fri Nov 5 19:12:48 2010 = (r214843) > @@ -321,6 +321,8 @@ uvscom_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > /* start interrupt pipe */ > mtx_lock(&sc->sc_mtx); > usbd_transfer_start(sc->sc_xfer[UVSCOM_INTR_DT_RD]); > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 19:28:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D913106566C; Fri, 5 Nov 2010 19:28:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C93328FC19; Fri, 5 Nov 2010 19:28: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 oA5JS09R006864; Fri, 5 Nov 2010 19:28:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5JS0G8006861; Fri, 5 Nov 2010 19:28:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011051928.oA5JS0G8006861@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 5 Nov 2010 19:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214844 - in head/sys: dev/re pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 19:28:01 -0000 Author: yongari Date: Fri Nov 5 19:28:00 2010 New Revision: 214844 URL: http://svn.freebsd.org/changeset/base/214844 Log: Add simple MAC statistics counter reading support. Unfortunately useful counters like rl_missed_pkts is 16 bits quantity which is too small to hold meaningful information happened in a second. This means driver should frequently read these counters in order not to lose accuracy and that approach is too inefficient in driver's view. Moreover it seems there is no way to trigger an interrupt to detect counter near-full or wraparound event as well as lacking clearing the MAC counters. Another limitation of reading the counters from RealTek controllers is lack of interrupt firing at the end of DMA cycle of MAC counter read request such that driver have to poll the end of the DMA which is a time consuming process as well as inefficient. The more severe issue of the MAC counter read request is it takes too long to complete the DMA. All these limitation made maintaining MAC counters in driver impractical. For now, just provide simple sysctl interface to trigger reading the MAC counters. These counters could be used to track down driver issues. Users can read MAC counters maintained in controller with the following command. #sysctl dev.re.0.stats=1 While I'm here add check for validity of dma map and allocated memory before unloading/freeing them. Tested by: rmacklem Modified: head/sys/dev/re/if_re.c head/sys/pci/if_rlreg.h Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Fri Nov 5 19:12:48 2010 (r214843) +++ head/sys/dev/re/if_re.c Fri Nov 5 19:28:00 2010 (r214844) @@ -123,6 +123,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -281,6 +282,9 @@ static void re_clrwol (struct rl_softc static int re_diag (struct rl_softc *); #endif +static void re_add_sysctls (struct rl_softc *); +static int re_sysctl_stats (SYSCTL_HANDLER_ARGS); + static device_method_t re_methods[] = { /* Device interface */ DEVMETHOD(device_probe, re_probe), @@ -1084,6 +1088,35 @@ re_allocmem(device_t dev, struct rl_soft } } + /* Create DMA map for statistics. */ + error = bus_dma_tag_create(sc->rl_parent_tag, RL_DUMP_ALIGN, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + sizeof(struct rl_stats), 1, sizeof(struct rl_stats), 0, NULL, NULL, + &sc->rl_ldata.rl_stag); + if (error) { + device_printf(dev, "could not create statistics DMA tag\n"); + return (error); + } + /* Allocate DMA'able memory for statistics. */ + error = bus_dmamem_alloc(sc->rl_ldata.rl_stag, + (void **)&sc->rl_ldata.rl_stats, + BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO, + &sc->rl_ldata.rl_smap); + if (error) { + device_printf(dev, + "could not allocate statistics DMA memory\n"); + return (error); + } + /* Load the map for statistics. */ + sc->rl_ldata.rl_stats_addr = 0; + error = bus_dmamap_load(sc->rl_ldata.rl_stag, sc->rl_ldata.rl_smap, + sc->rl_ldata.rl_stats, sizeof(struct rl_stats), re_dma_map_addr, + &sc->rl_ldata.rl_stats_addr, BUS_DMA_NOWAIT); + if (error != 0 || sc->rl_ldata.rl_stats_addr == 0) { + device_printf(dev, "could not load statistics DMA memory\n"); + return (ENOMEM); + } + return (0); } @@ -1374,6 +1407,7 @@ re_attach(device_t dev) error = re_allocmem(dev, sc); if (error) goto fail; + re_add_sysctls(sc); ifp = sc->rl_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -1603,22 +1637,26 @@ re_detach(device_t dev) /* Unload and free the RX DMA ring memory and map */ if (sc->rl_ldata.rl_rx_list_tag) { - bus_dmamap_unload(sc->rl_ldata.rl_rx_list_tag, - sc->rl_ldata.rl_rx_list_map); - bus_dmamem_free(sc->rl_ldata.rl_rx_list_tag, - sc->rl_ldata.rl_rx_list, - sc->rl_ldata.rl_rx_list_map); + if (sc->rl_ldata.rl_rx_list_map) + bus_dmamap_unload(sc->rl_ldata.rl_rx_list_tag, + sc->rl_ldata.rl_rx_list_map); + if (sc->rl_ldata.rl_rx_list_map && sc->rl_ldata.rl_rx_list) + bus_dmamem_free(sc->rl_ldata.rl_rx_list_tag, + sc->rl_ldata.rl_rx_list, + sc->rl_ldata.rl_rx_list_map); bus_dma_tag_destroy(sc->rl_ldata.rl_rx_list_tag); } /* Unload and free the TX DMA ring memory and map */ if (sc->rl_ldata.rl_tx_list_tag) { - bus_dmamap_unload(sc->rl_ldata.rl_tx_list_tag, - sc->rl_ldata.rl_tx_list_map); - bus_dmamem_free(sc->rl_ldata.rl_tx_list_tag, - sc->rl_ldata.rl_tx_list, - sc->rl_ldata.rl_tx_list_map); + if (sc->rl_ldata.rl_tx_list_map) + bus_dmamap_unload(sc->rl_ldata.rl_tx_list_tag, + sc->rl_ldata.rl_tx_list_map); + if (sc->rl_ldata.rl_tx_list_map && sc->rl_ldata.rl_tx_list) + bus_dmamem_free(sc->rl_ldata.rl_tx_list_tag, + sc->rl_ldata.rl_tx_list, + sc->rl_ldata.rl_tx_list_map); bus_dma_tag_destroy(sc->rl_ldata.rl_tx_list_tag); } @@ -1643,11 +1681,12 @@ re_detach(device_t dev) /* Unload and free the stats buffer and map */ if (sc->rl_ldata.rl_stag) { - bus_dmamap_unload(sc->rl_ldata.rl_stag, - sc->rl_ldata.rl_rx_list_map); - bus_dmamem_free(sc->rl_ldata.rl_stag, - sc->rl_ldata.rl_stats, - sc->rl_ldata.rl_smap); + if (sc->rl_ldata.rl_smap) + bus_dmamap_unload(sc->rl_ldata.rl_stag, + sc->rl_ldata.rl_smap); + if (sc->rl_ldata.rl_smap && sc->rl_ldata.rl_stats) + bus_dmamem_free(sc->rl_ldata.rl_stag, + sc->rl_ldata.rl_stats, sc->rl_ldata.rl_smap); bus_dma_tag_destroy(sc->rl_ldata.rl_stag); } @@ -3185,3 +3224,88 @@ re_clrwol(struct rl_softc *sc) v &= ~RL_CFG5_WOL_LANWAKE; CSR_WRITE_1(sc, RL_CFG5, v); } + +static void +re_add_sysctls(struct rl_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *children; + + ctx = device_get_sysctl_ctx(sc->rl_dev); + children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->rl_dev)); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "stats", + CTLTYPE_INT | CTLFLAG_RW, sc, 0, re_sysctl_stats, "I", + "Statistics Information"); +} + +static int +re_sysctl_stats(SYSCTL_HANDLER_ARGS) +{ + struct rl_softc *sc; + struct rl_stats *stats; + int error, i, result; + + result = -1; + error = sysctl_handle_int(oidp, &result, 0, req); + if (error || req->newptr == NULL) + return (error); + + if (result == 1) { + sc = (struct rl_softc *)arg1; + RL_LOCK(sc); + bus_dmamap_sync(sc->rl_ldata.rl_stag, + sc->rl_ldata.rl_smap, BUS_DMASYNC_PREREAD); + CSR_WRITE_4(sc, RL_DUMPSTATS_HI, + RL_ADDR_HI(sc->rl_ldata.rl_stats_addr)); + CSR_WRITE_4(sc, RL_DUMPSTATS_LO, + RL_ADDR_LO(sc->rl_ldata.rl_stats_addr)); + CSR_WRITE_4(sc, RL_DUMPSTATS_LO, + RL_ADDR_LO(sc->rl_ldata.rl_stats_addr | + RL_DUMPSTATS_START)); + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_4(sc, RL_DUMPSTATS_LO) & + RL_DUMPSTATS_START) == 0) + break; + DELAY(1000); + } + bus_dmamap_sync(sc->rl_ldata.rl_stag, + sc->rl_ldata.rl_smap, BUS_DMASYNC_POSTREAD); + RL_UNLOCK(sc); + if (i == 0) { + device_printf(sc->rl_dev, + "DUMP statistics request timedout\n"); + return (ETIMEDOUT); + } + stats = sc->rl_ldata.rl_stats; + printf("%s statistics:\n", device_get_nameunit(sc->rl_dev)); + printf("Tx frames : %ju\n", + (uintmax_t)le64toh(stats->rl_tx_pkts)); + printf("Rx frames : %ju\n", + (uintmax_t)le64toh(stats->rl_rx_pkts)); + printf("Tx errors : %ju\n", + (uintmax_t)le64toh(stats->rl_tx_errs)); + printf("Rx errors : %u\n", + le32toh(stats->rl_rx_errs)); + printf("Rx missed frames : %u\n", + (uint32_t)le16toh(stats->rl_missed_pkts)); + printf("Rx frame alignment errs : %u\n", + (uint32_t)le16toh(stats->rl_rx_framealign_errs)); + printf("Tx single collisions : %u\n", + le32toh(stats->rl_tx_onecoll)); + printf("Tx multiple collisions : %u\n", + le32toh(stats->rl_tx_multicolls)); + printf("Rx unicast frames : %ju\n", + (uintmax_t)le64toh(stats->rl_rx_ucasts)); + printf("Rx broadcast frames : %ju\n", + (uintmax_t)le64toh(stats->rl_rx_bcasts)); + printf("Rx multicast frames : %u\n", + le32toh(stats->rl_rx_mcasts)); + printf("Tx aborts : %u\n", + (uint32_t)le16toh(stats->rl_tx_aborts)); + printf("Tx underruns : %u\n", + (uint32_t)le16toh(stats->rl_rx_underruns)); + } + + return (error); +} Modified: head/sys/pci/if_rlreg.h ============================================================================== --- head/sys/pci/if_rlreg.h Fri Nov 5 19:12:48 2010 (r214843) +++ head/sys/pci/if_rlreg.h Fri Nov 5 19:28:00 2010 (r214844) @@ -723,19 +723,16 @@ struct rl_desc { * Statistics counter structure (8139C+ and 8169 only) */ struct rl_stats { - uint32_t rl_tx_pkts_lo; - uint32_t rl_tx_pkts_hi; - uint32_t rl_tx_errs_lo; - uint32_t rl_tx_errs_hi; - uint32_t rl_tx_errs; + uint64_t rl_tx_pkts; + uint64_t rl_rx_pkts; + uint64_t rl_tx_errs; + uint32_t rl_rx_errs; uint16_t rl_missed_pkts; uint16_t rl_rx_framealign_errs; uint32_t rl_tx_onecoll; uint32_t rl_tx_multicolls; - uint32_t rl_rx_ucasts_hi; - uint32_t rl_rx_ucasts_lo; - uint32_t rl_rx_bcasts_lo; - uint32_t rl_rx_bcasts_hi; + uint64_t rl_rx_ucasts; + uint64_t rl_rx_bcasts; uint32_t rl_rx_mcasts; uint16_t rl_tx_aborts; uint16_t rl_rx_underruns; @@ -769,6 +766,7 @@ struct rl_stats { #define RL_NTXSEGS 32 #define RL_RING_ALIGN 256 +#define RL_DUMP_ALIGN 64 #define RL_IFQ_MAXLEN 512 #define RL_TX_DESC_NXT(sc,x) ((x + 1) & ((sc)->rl_ldata.rl_tx_desc_cnt - 1)) #define RL_TX_DESC_PRV(sc,x) ((x - 1) & ((sc)->rl_ldata.rl_tx_desc_cnt - 1)) From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 19:38:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1433C106566C; Fri, 5 Nov 2010 19:38:29 +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 026008FC08; Fri, 5 Nov 2010 19:38:29 +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 oA5JcSQA007160; Fri, 5 Nov 2010 19:38:28 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5JcS6T007158; Fri, 5 Nov 2010 19:38:28 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011051938.oA5JcS6T007158@svn.freebsd.org> From: Marius Strobl Date: Fri, 5 Nov 2010 19:38:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214846 - head/sys/dev/xl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 19:38:29 -0000 Author: marius Date: Fri Nov 5 19:38:28 2010 New Revision: 214846 URL: http://svn.freebsd.org/changeset/base/214846 Log: Correct an inverted check in r213893. Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Fri Nov 5 19:30:30 2010 (r214845) +++ head/sys/dev/xl/if_xl.c Fri Nov 5 19:38:28 2010 (r214846) @@ -1461,7 +1461,7 @@ xl_attach(device_t dev) * control registers at all MII addresses. */ phy = MII_PHY_ANY; - if ((sc->xl_flags & XL_FLAG_PHYOK) != 0) + if ((sc->xl_flags & XL_FLAG_PHYOK) == 0) phy = 24; error = mii_attach(dev, &sc->xl_miibus, ifp, xl_ifmedia_upd, xl_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 19:50:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D99EB1065670; Fri, 5 Nov 2010 19:50: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 C727D8FC19; Fri, 5 Nov 2010 19:50: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 oA5Jo9lJ007457; Fri, 5 Nov 2010 19:50:09 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5Jo9nt007455; Fri, 5 Nov 2010 19:50:09 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201011051950.oA5Jo9nt007455@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 5 Nov 2010 19:50: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: r214848 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 19:50:09 -0000 Author: jkim Date: Fri Nov 5 19:50:09 2010 New Revision: 214848 URL: http://svn.freebsd.org/changeset/base/214848 Log: Fix a use-after-free bug for extended IRQ resource[1]. When _PRS buffer is copied as a template for _SRS, a string pointer for descriptor name is also copied and it becomes stale as soon as it gets de-allocated[2]. Now _CRS is used as a template for _SRS as ACPI specification suggests if it is usable. The template from _PRS is still utilized but only when _CRS is not available or broken. To avoid use-after-free the problem in this case, however, only mandatory fields are copied, optional data is removed, and structure length is adjusted accordingly. Reported by: hps[1] Analyzed by: avg[2] Tested by: hps Modified: head/sys/dev/acpica/acpi_pci_link.c Modified: head/sys/dev/acpica/acpi_pci_link.c ============================================================================== --- head/sys/dev/acpica/acpi_pci_link.c Fri Nov 5 19:40:27 2010 (r214847) +++ head/sys/dev/acpica/acpi_pci_link.c Fri Nov 5 19:50:09 2010 (r214848) @@ -268,6 +268,7 @@ link_add_crs(ACPI_RESOURCE *res, void *c static ACPI_STATUS link_add_prs(ACPI_RESOURCE *res, void *context) { + ACPI_RESOURCE *tmp; struct link_res_request *req; struct link *link; UINT8 *irqs = NULL; @@ -321,12 +322,23 @@ link_add_prs(ACPI_RESOURCE *res, void *c * Stash a copy of the resource for later use when doing * _SRS. */ - bcopy(res, &link->l_prs_template, sizeof(ACPI_RESOURCE)); + tmp = &link->l_prs_template; if (is_ext_irq) { + bcopy(res, tmp, ACPI_RS_SIZE(tmp->Data.ExtendedIrq)); + + /* + * XXX acpi_AppendBufferResource() cannot handle + * optional data. + */ + bzero(&tmp->Data.ExtendedIrq.ResourceSource, + sizeof(tmp->Data.ExtendedIrq.ResourceSource)); + tmp->Length = ACPI_RS_SIZE(tmp->Data.ExtendedIrq); + link->l_num_irqs = res->Data.ExtendedIrq.InterruptCount; ext_irqs = res->Data.ExtendedIrq.Interrupts; } else { + bcopy(res, tmp, ACPI_RS_SIZE(tmp->Data.Irq)); link->l_num_irqs = res->Data.Irq.InterruptCount; irqs = res->Data.Irq.Interrupts; } @@ -688,18 +700,17 @@ acpi_pci_link_add_reference(device_t dev static ACPI_STATUS acpi_pci_link_srs_from_crs(struct acpi_pci_link_softc *sc, ACPI_BUFFER *srsbuf) { - ACPI_RESOURCE *resource, *end, newres, *resptr; - ACPI_BUFFER crsbuf; + ACPI_RESOURCE *end, *res; ACPI_STATUS status; struct link *link; int i, in_dpf; /* Fetch the _CRS. */ ACPI_SERIAL_ASSERT(pci_link); - crsbuf.Pointer = NULL; - crsbuf.Length = ACPI_ALLOCATE_BUFFER; - status = AcpiGetCurrentResources(acpi_get_handle(sc->pl_dev), &crsbuf); - if (ACPI_SUCCESS(status) && crsbuf.Pointer == NULL) + srsbuf->Pointer = NULL; + srsbuf->Length = ACPI_ALLOCATE_BUFFER; + status = AcpiGetCurrentResources(acpi_get_handle(sc->pl_dev), srsbuf); + if (ACPI_SUCCESS(status) && srsbuf->Pointer == NULL) status = AE_NO_MEMORY; if (ACPI_FAILURE(status)) { if (bootverbose) @@ -710,14 +721,13 @@ acpi_pci_link_srs_from_crs(struct acpi_p } /* Fill in IRQ resources via link structures. */ - srsbuf->Pointer = NULL; link = sc->pl_links; i = 0; in_dpf = DPF_OUTSIDE; - resource = (ACPI_RESOURCE *)crsbuf.Pointer; - end = (ACPI_RESOURCE *)((char *)crsbuf.Pointer + crsbuf.Length); + res = (ACPI_RESOURCE *)srsbuf->Pointer; + end = (ACPI_RESOURCE *)((char *)srsbuf->Pointer + srsbuf->Length); for (;;) { - switch (resource->Type) { + switch (res->Type) { case ACPI_RESOURCE_TYPE_START_DEPENDENT: switch (in_dpf) { case DPF_OUTSIDE: @@ -731,67 +741,44 @@ acpi_pci_link_srs_from_crs(struct acpi_p __func__); break; } - resptr = NULL; break; case ACPI_RESOURCE_TYPE_END_DEPENDENT: /* We are finished with DPF parsing. */ KASSERT(in_dpf != DPF_OUTSIDE, ("%s: end dpf when not parsing a dpf", __func__)); in_dpf = DPF_OUTSIDE; - resptr = NULL; break; case ACPI_RESOURCE_TYPE_IRQ: MPASS(i < sc->pl_num_links); - MPASS(link->l_prs_template.Type == ACPI_RESOURCE_TYPE_IRQ); - newres = link->l_prs_template; - resptr = &newres; - resptr->Data.Irq.InterruptCount = 1; + res->Data.Irq.InterruptCount = 1; if (PCI_INTERRUPT_VALID(link->l_irq)) { KASSERT(link->l_irq < NUM_ISA_INTERRUPTS, ("%s: can't put non-ISA IRQ %d in legacy IRQ resource type", __func__, link->l_irq)); - resptr->Data.Irq.Interrupts[0] = link->l_irq; + res->Data.Irq.Interrupts[0] = link->l_irq; } else - resptr->Data.Irq.Interrupts[0] = 0; + res->Data.Irq.Interrupts[0] = 0; link++; i++; break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: MPASS(i < sc->pl_num_links); - MPASS(link->l_prs_template.Type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ); - newres = link->l_prs_template; - resptr = &newres; - resptr->Data.ExtendedIrq.InterruptCount = 1; + res->Data.ExtendedIrq.InterruptCount = 1; if (PCI_INTERRUPT_VALID(link->l_irq)) - resptr->Data.ExtendedIrq.Interrupts[0] = + res->Data.ExtendedIrq.Interrupts[0] = link->l_irq; else - resptr->Data.ExtendedIrq.Interrupts[0] = 0; + res->Data.ExtendedIrq.Interrupts[0] = 0; link++; i++; break; - default: - resptr = resource; - } - if (resptr != NULL) { - status = acpi_AppendBufferResource(srsbuf, resptr); - if (ACPI_FAILURE(status)) { - device_printf(sc->pl_dev, - "Unable to build resources: %s\n", - AcpiFormatException(status)); - if (srsbuf->Pointer != NULL) - AcpiOsFree(srsbuf->Pointer); - AcpiOsFree(crsbuf.Pointer); - return (status); - } } - if (resource->Type == ACPI_RESOURCE_TYPE_END_TAG) + if (res->Type == ACPI_RESOURCE_TYPE_END_TAG) break; - resource = ACPI_NEXT_RESOURCE(resource); - if (resource >= end) + res = ACPI_NEXT_RESOURCE(res); + if (res >= end) break; } - AcpiOsFree(crsbuf.Pointer); return (AE_OK); } @@ -811,10 +798,11 @@ acpi_pci_link_srs_from_links(struct acpi /* Add a new IRQ resource from each link. */ link = &sc->pl_links[i]; - newres = link->l_prs_template; if (newres.Type == ACPI_RESOURCE_TYPE_IRQ) { /* Build an IRQ resource. */ + bcopy(&link->l_prs_template, &newres, + ACPI_RS_SIZE(newres.Data.Irq)); newres.Data.Irq.InterruptCount = 1; if (PCI_INTERRUPT_VALID(link->l_irq)) { KASSERT(link->l_irq < NUM_ISA_INTERRUPTS, @@ -826,6 +814,8 @@ acpi_pci_link_srs_from_links(struct acpi } else { /* Build an ExtIRQ resuorce. */ + bcopy(&link->l_prs_template, &newres, + ACPI_RS_SIZE(newres.Data.ExtendedIrq)); newres.Data.ExtendedIrq.InterruptCount = 1; if (PCI_INTERRUPT_VALID(link->l_irq)) newres.Data.ExtendedIrq.Interrupts[0] = From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 20:24:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82E6F106566C; Fri, 5 Nov 2010 20:24:26 +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 717308FC12; Fri, 5 Nov 2010 20: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 oA5KOQhe008222; Fri, 5 Nov 2010 20:24:26 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5KOQbV008220; Fri, 5 Nov 2010 20:24:26 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201011052024.oA5KOQbV008220@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 5 Nov 2010 20: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: r214849 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 20:24:26 -0000 Author: jkim Date: Fri Nov 5 20:24:26 2010 New Revision: 214849 URL: http://svn.freebsd.org/changeset/base/214849 Log: Add a forgotten change from the previous commit. Modified: head/sys/dev/acpica/acpi_pci_link.c Modified: head/sys/dev/acpica/acpi_pci_link.c ============================================================================== --- head/sys/dev/acpica/acpi_pci_link.c Fri Nov 5 19:50:09 2010 (r214848) +++ head/sys/dev/acpica/acpi_pci_link.c Fri Nov 5 20:24:26 2010 (r214849) @@ -798,7 +798,7 @@ acpi_pci_link_srs_from_links(struct acpi /* Add a new IRQ resource from each link. */ link = &sc->pl_links[i]; - if (newres.Type == ACPI_RESOURCE_TYPE_IRQ) { + if (link->l_prs_template.Type == ACPI_RESOURCE_TYPE_IRQ) { /* Build an IRQ resource. */ bcopy(&link->l_prs_template, &newres, From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 21:13:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE3CD1065672; Fri, 5 Nov 2010 21:13: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 DCC8B8FC16; Fri, 5 Nov 2010 21:13: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 oA5LDGLa009416; Fri, 5 Nov 2010 21:13:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5LDGxH009414; Fri, 5 Nov 2010 21:13:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011052113.oA5LDGxH009414@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 5 Nov 2010 21:13: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: r214851 - head/sys/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 21:13:17 -0000 Author: kib Date: Fri Nov 5 21:13:16 2010 New Revision: 214851 URL: http://svn.freebsd.org/changeset/base/214851 Log: Fix a bug in r214049. The nvp == vp case shall be handled specially only for !usevget case. If VFS_VGET is working, the vnode shared lock is obtained recursively and vput() shall be done, not vunref(). Submitted by: rmacklem Tested by: Josh Carroll MFC after: 3 days Modified: head/sys/nfsserver/nfs_serv.c Modified: head/sys/nfsserver/nfs_serv.c ============================================================================== --- head/sys/nfsserver/nfs_serv.c Fri Nov 5 20:58:18 2010 (r214850) +++ head/sys/nfsserver/nfs_serv.c Fri Nov 5 21:13:16 2010 (r214851) @@ -3252,7 +3252,7 @@ again: nfhp->fh_fsid = nvp->v_mount->mnt_stat.f_fsid; if ((error1 = VOP_VPTOFH(nvp, &nfhp->fh_fid)) == 0) error1 = VOP_GETATTR(nvp, vap, cred); - if (vp == nvp) + if (!usevget && vp == nvp) vunref(nvp); else vput(nvp); From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 21:17:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 303801065673; Fri, 5 Nov 2010 21:17:56 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E6158FC1B; Fri, 5 Nov 2010 21:17: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 oA5LHt2v009551; Fri, 5 Nov 2010 21:17:55 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5LHtnH009548; Fri, 5 Nov 2010 21:17:55 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <201011052117.oA5LHtnH009548@svn.freebsd.org> From: Nick Hibma Date: Fri, 5 Nov 2010 21:17: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: r214852 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 21:17:56 -0000 Author: n_hibma Date: Fri Nov 5 21:17:55 2010 New Revision: 214852 URL: http://svn.freebsd.org/changeset/base/214852 Log: Bugfix: In rev 213509 Alexander committed a duplicate ID for ZTE STOR based devices (QUALCOMMINC 0x2000). He made it use SCSI eject instead of ZTE STOR eject. This prevented my ZTE MF626 dongle from switching. - Apply both eject methods for ZTE STOR based devices. Works on my as well as mav's device. - Remove the duplicate. - Sort the usbdevs entries for Qualcomm so this won't happen again. - Add bootverbose message displaying the fact that we are ejecting (and how). Reviewed by: mav MFC after: 2 weeks 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 Fri Nov 5 21:13:16 2010 (r214851) +++ head/sys/dev/usb/serial/u3g.c Fri Nov 5 21:17:55 2010 (r214852) @@ -411,7 +411,6 @@ static const struct usb_device_id u3g_de U3G_DEV(QUALCOMMINC, E0078, 0), U3G_DEV(QUALCOMMINC, E0082, 0), U3G_DEV(QUALCOMMINC, E0086, 0), - U3G_DEV(QUALCOMMINC, E2000, U3GINIT_SCSIEJECT), U3G_DEV(QUALCOMMINC, E2002, 0), U3G_DEV(QUALCOMMINC, E2003, 0), U3G_DEV(QUALCOMMINC, MF626, 0), @@ -655,6 +654,12 @@ u3g_test_autoinst(void *arg, struct usb_ if (usbd_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa)) return; /* no device match */ + if (bootverbose) { + printf("Ejecting 0x%04x:0x%04x using method %ld\n", + uaa->info.idVendor, uaa->info.idProduct, + USB_GET_DRIVER_INFO(uaa)); + } + switch (USB_GET_DRIVER_INFO(uaa)) { case U3GINIT_HUAWEI: error = u3g_huawei_init(udev); @@ -669,7 +674,8 @@ u3g_test_autoinst(void *arg, struct usb_ error = usb_msc_eject(udev, 0, MSC_EJECT_REZERO); break; case U3GINIT_ZTESTOR: - error = usb_msc_eject(udev, 0, MSC_EJECT_ZTESTOR); + error = usb_msc_eject(udev, 0, MSC_EJECT_STOPUNIT); + error |= usb_msc_eject(udev, 0, MSC_EJECT_ZTESTOR); break; case U3GINIT_CMOTECH: error = usb_msc_eject(udev, 0, MSC_EJECT_CMOTECH); Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Fri Nov 5 21:13:16 2010 (r214851) +++ head/sys/dev/usb/usbdevs Fri Nov 5 21:17:55 2010 (r214852) @@ -2612,15 +2612,11 @@ product QISDA H20_2 0x4519 3G modem /* Qualcomm products */ product QUALCOMM CDMA_MSM 0x6000 CDMA Technologies MSM phone +product QUALCOMM2 MF330 0x6613 MF330 product QUALCOMM2 RWT_FCT 0x3100 RWT FCT-CDMA 2000 1xRTT modem product QUALCOMM2 CDMA_MSM 0x3196 CDMA Technologies MSM modem product QUALCOMM2 AC8700 0x6000 AC8700 -product QUALCOMM2 MF330 0x6613 MF330 product QUALCOMMINC CDMA_MSM 0x0001 CDMA Technologies MSM modem -product QUALCOMMINC ZTE_STOR 0x2000 USB ZTE Storage -product QUALCOMMINC AC8710 0xfff1 3G modem -product QUALCOMMINC AC2726 0xfff5 3G modem -product QUALCOMMINC AC8700 0xfffe CDMA 1xEVDO USB modem product QUALCOMMINC E0002 0x0002 3G modem product QUALCOMMINC E0003 0x0003 3G modem product QUALCOMMINC E0004 0x0004 3G modem @@ -2686,9 +2682,12 @@ product QUALCOMMINC E0076 0x0076 3G mode product QUALCOMMINC E0078 0x0078 3G modem product QUALCOMMINC E0082 0x0082 3G modem product QUALCOMMINC E0086 0x0086 3G modem -product QUALCOMMINC E2000 0x2000 3G modem +product QUALCOMMINC ZTE_STOR 0x2000 USB ZTE Storage product QUALCOMMINC E2002 0x2002 3G modem product QUALCOMMINC E2003 0x2003 3G modem +product QUALCOMMINC AC8710 0xfff1 3G modem +product QUALCOMMINC AC2726 0xfff5 3G modem +product QUALCOMMINC AC8700 0xfffe CDMA 1xEVDO USB modem /* Quanta products */ product QUANTA RW6815_1 0x00ce HP iPAQ rw6815 From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 21:47:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CF3E106566C; Fri, 5 Nov 2010 21:47:59 +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 2B2D78FC13; Fri, 5 Nov 2010 21:47: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 oA5LlxTe010162; Fri, 5 Nov 2010 21:47:59 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5Llxmc010160; Fri, 5 Nov 2010 21:47:59 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201011052147.oA5Llxmc010160@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 5 Nov 2010 21:47: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: r214853 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 21:47:59 -0000 Author: jilles Date: Fri Nov 5 21:47:58 2010 New Revision: 214853 URL: http://svn.freebsd.org/changeset/base/214853 Log: sh: Add simple tests for printf. These are not meant as a replacement for tools/regression/usr.bin/printf/* but to detect errors specific to making it a shell builtin. Added: head/tools/regression/bin/sh/builtins/printf1.0 (contents, props changed) head/tools/regression/bin/sh/builtins/printf2.0 (contents, props changed) Added: head/tools/regression/bin/sh/builtins/printf1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/printf1.0 Fri Nov 5 21:47:58 2010 (r214853) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +[ "$(printf '%c\0%s%d' x '\' 010 | tr '\0' Z)" = 'xZ\8' ] Added: head/tools/regression/bin/sh/builtins/printf2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/printf2.0 Fri Nov 5 21:47:58 2010 (r214853) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +[ "$(printf '%cZ%s%d' x '\' 010)" = 'xZ\8' ] From owner-svn-src-all@FreeBSD.ORG Fri Nov 5 22:18:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 071EE1065672; Fri, 5 Nov 2010 22:18:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E95298FC18; Fri, 5 Nov 2010 22:18: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 oA5MI9vX010849; Fri, 5 Nov 2010 22:18:09 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA5MI9MR010847; Fri, 5 Nov 2010 22:18:09 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201011052218.oA5MI9MR010847@svn.freebsd.org> From: Xin LI Date: Fri, 5 Nov 2010 22:18: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: r214854 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 22:18:10 -0000 Author: delphij Date: Fri Nov 5 22:18:09 2010 New Revision: 214854 URL: http://svn.freebsd.org/changeset/base/214854 Log: Validate whether the zfs_cmd_t submitted from userland is not smaller than what we have. Without the check the kernel could accessing memory that does not belong to the request struct. Note that we do not test if the struct equals in size at this time, which may faciliate forward compatibility with newer binaries. Reviewed by: pjd at MeetBSD CA '2010 MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Nov 5 21:47:58 2010 (r214853) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Nov 5 22:18:09 2010 (r214854) @@ -3627,6 +3627,14 @@ zfsdev_ioctl(struct cdev *dev, u_long cm uint_t vec; int error; + /* + * Check if we have sufficient kernel memory allocated + * for the zfs_cmd_t request. Bail out if not so we + * will not access undefined memory region. + */ + if (IOCPARM_LEN(cmd) < sizeof(zfs_cmd_t)) + return (EINVAL); + vec = ZFS_IOC(cmd); if (vec >= sizeof (zfs_ioc_vec) / sizeof (zfs_ioc_vec[0])) From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 01:09:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FF88106564A; Sat, 6 Nov 2010 01:09:01 +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 F1F778FC08; Sat, 6 Nov 2010 01:09: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 oA6190Q9014690; Sat, 6 Nov 2010 01:09:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA61902B014688; Sat, 6 Nov 2010 01:09:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011060109.oA61902B014688@svn.freebsd.org> From: Marius Strobl Date: Sat, 6 Nov 2010 01:09:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214856 - stable/8/sys/arm/mv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 01:09:01 -0000 Author: marius Date: Sat Nov 6 01:09:00 2010 New Revision: 214856 URL: http://svn.freebsd.org/changeset/base/214856 Log: Fix an instance missed in r212892: MFC r212413: bus_add_child: change type of order parameter to u_int Modified: stable/8/sys/arm/mv/obio.c Modified: stable/8/sys/arm/mv/obio.c ============================================================================== --- stable/8/sys/arm/mv/obio.c Sat Nov 6 00:53:54 2010 (r214855) +++ stable/8/sys/arm/mv/obio.c Sat Nov 6 01:09:00 2010 (r214856) @@ -324,7 +324,7 @@ mbus_activate_resource(device_t dev, dev } static device_t -mbus_add_child(device_t bus, int order, const char *name, int unit) +mbus_add_child(device_t bus, u_int order, const char *name, int unit) { struct obio_device *od; device_t child; From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 03:59:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5027106564A; Sat, 6 Nov 2010 03:59:21 +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 A36788FC1F; Sat, 6 Nov 2010 03:59: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 oA63xLAC018364; Sat, 6 Nov 2010 03:59:21 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA63xLED018361; Sat, 6 Nov 2010 03:59:21 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201011060359.oA63xLED018361@svn.freebsd.org> From: Xin LI Date: Sat, 6 Nov 2010 03:59: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: r214857 - head/contrib/top X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 03:59:21 -0000 Author: delphij Date: Sat Nov 6 03:59:21 2010 New Revision: 214857 URL: http://svn.freebsd.org/changeset/base/214857 Log: Inverse display of top(1)'s table header when running in inactive mode. MFC after: 2 weeks Modified: head/contrib/top/display.c head/contrib/top/top.h Modified: head/contrib/top/display.c ============================================================================== --- head/contrib/top/display.c Sat Nov 6 01:09:00 2010 (r214856) +++ head/contrib/top/display.c Sat Nov 6 03:59:21 2010 (r214857) @@ -694,7 +694,7 @@ char *text; int width; s = NULL; - width = display_width; + width = screen_width; header_length = strlen(text); if (header_length >= width) { s = malloc((width + 1) * sizeof(char)); @@ -702,6 +702,14 @@ char *text; return (NULL); strncpy(s, text, width); s[width] = '\0'; + } else { + s = malloc((width + 1) * sizeof(char)); + if (s == NULL) + return (NULL); + strncpy(s, text, width); + while (screen_width > header_length) + s[header_length++] = ' '; + s[width] = '\0'; } return (s); } @@ -726,7 +734,7 @@ char *text; if (header_status == ON) { putchar('\n'); - fputs(text, stdout); + standout(text, stdout); lastline++; } else if (header_status == ERASE) Modified: head/contrib/top/top.h ============================================================================== --- head/contrib/top/top.h Sat Nov 6 01:09:00 2010 (r214856) +++ head/contrib/top/top.h Sat Nov 6 03:59:21 2010 (r214857) @@ -14,7 +14,7 @@ extern int Header_lines; /* 7 */ /* Maximum number of columns allowed for display */ -#define MAX_COLS 128 +#define MAX_COLS 512 /* Log base 2 of 1024 is 10 (2^10 == 1024) */ #define LOG1024 10 From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 04:55:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BEF51065675; Sat, 6 Nov 2010 04:55:10 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mail.vx.sk (mail.vx.sk [IPv6:2a01:4f8:100:1043::3]) by mx1.freebsd.org (Postfix) with ESMTP id EEB948FC15; Sat, 6 Nov 2010 04:55:09 +0000 (UTC) Received: from core.vx.sk (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id 57AA712A8EA; Sat, 6 Nov 2010 05:55:09 +0100 (CET) X-Virus-Scanned: amavisd-new at mail.vx.sk Received: from mail.vx.sk ([127.0.0.1]) by core.vx.sk (mail.vx.sk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id R80I7BWZweQa; Sat, 6 Nov 2010 05:55:07 +0100 (CET) Received: from [10.9.8.1] (188-167-78-139.dynamic.chello.sk [188.167.78.139]) by mail.vx.sk (Postfix) with ESMTPSA id 3D97C12A8DC; Sat, 6 Nov 2010 05:55:07 +0100 (CET) Message-ID: <4CD4DFAB.3030500@FreeBSD.org> Date: Sat, 06 Nov 2010 05:55:07 +0100 From: Martin Matuska User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; sk; rv:1.8.1.23) Gecko/20090812 Lightning/0.9 Thunderbird/2.0.0.23 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201008211141.o7LBfWdv067923@svn.freebsd.org> <20100828172744.GJ2077@garage.freebsd.pl> In-Reply-To: <20100828172744.GJ2077@garage.freebsd.pl> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=windows-1250 Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Rui Paulo Subject: Re: svn commit: r211553 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 04:55:10 -0000 I agree with Pawel, we should use "FreeBSD". Is this (+ the dtrace test) going to be changed + set for MFC? Dòa 28.08.2010 19:27, Pawel Jakub Dawidek wrote / napísal(a): > On Sat, Aug 21, 2010 at 11:41:32AM +0000, Rui Paulo wrote: >> Author: rpaulo >> Date: Sat Aug 21 11:41:32 2010 >> New Revision: 211553 >> URL: http://svn.freebsd.org/changeset/base/211553 >> >> Log: >> Add sysname to struct opensolaris_utsname. This is needed by one DTrace >> test. >> >> Sponsored by: The FreeBSD Foundation >> >> Modified: >> head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c >> >> Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c >> ============================================================================== >> --- head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c Sat Aug 21 11:33:49 2010 (r211552) >> +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c Sat Aug 21 11:41:32 2010 (r211553) >> @@ -38,7 +38,8 @@ __FBSDID("$FreeBSD$"); >> char hw_serial[11] = "0"; >> >> struct opensolaris_utsname utsname = { >> - .nodename = "unset" >> + .nodename = "unset", >> + .sysname = "SunOS" > > This collides with the changes I have in perforce. Could you take a look at: > > //depot/user/pjd/zfs/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c > //depot/user/pjd/zfs/sys/cddl/compat/opensolaris/sys/misc.h > > I'd prefer sysname to say FreeBSD on FreeBSD, rather than SunOS. > I see it is being used in one DTrace test. Changing 'tst.str.d.out' to > expect "FreeBSD" instead of "SunOS" is ok? > From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 09:23:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EBAF106564A; Sat, 6 Nov 2010 09:23:50 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0221F8FC0A; Sat, 6 Nov 2010 09:23: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 oA69NnwP025143; Sat, 6 Nov 2010 09:23:49 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA69NnOn025141; Sat, 6 Nov 2010 09:23:49 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011060923.oA69NnOn025141@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 09:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214858 - stable/8/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 09:23:50 -0000 Author: lstewart Date: Sat Nov 6 09:23:49 2010 New Revision: 214858 URL: http://svn.freebsd.org/changeset/base/214858 Log: MFC r209050 (originally committed by jhb): Add helper macros to iterate over available CPUs in the system. CPU_FOREACH(i) iterates over the CPU IDs of all available CPUs. The CPU_FIRST() and CPU_NEXT(i) macros can also be used to iterate over available CPU IDs. CPU_NEXT(i) wraps around to CPU_FIRST() rather than returning some sort of terminator. Requested by: rwatson Reviewed by: attilio Modified: stable/8/sys/sys/smp.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sys/smp.h ============================================================================== --- stable/8/sys/sys/smp.h Sat Nov 6 03:59:21 2010 (r214857) +++ stable/8/sys/sys/smp.h Sat Nov 6 09:23:49 2010 (r214858) @@ -91,6 +91,44 @@ extern cpumask_t all_cpus; */ #define CPU_ABSENT(x_cpu) ((all_cpus & (1 << (x_cpu))) == 0) +/* + * Macros to iterate over non-absent CPUs. CPU_FOREACH() takes an + * integer iterator and iterates over the available set of CPUs. + * CPU_FIRST() returns the id of the first non-absent CPU. CPU_NEXT() + * returns the id of the next non-absent CPU. It will wrap back to + * CPU_FIRST() once the end of the list is reached. The iterators are + * currently implemented via inline functions. + */ +#define CPU_FOREACH(i) \ + for ((i) = 0; (i) <= mp_maxid; (i)++) \ + if (!CPU_ABSENT((i))) + +static __inline int +cpu_first(void) +{ + int i; + + for (i = 0;; i++) + if (!CPU_ABSENT(i)) + return (i); +} + +static __inline int +cpu_next(int i) +{ + + for (;;) { + i++; + if (i > mp_maxid) + i = 0; + if (!CPU_ABSENT(i)) + return (i); + } +} + +#define CPU_FIRST() cpu_first() +#define CPU_NEXT(i) cpu_next((i)) + #ifdef SMP /* * Machine dependent functions used to initialize MP support. From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 09:34:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FFE9106566B; Sat, 6 Nov 2010 09:34:52 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AFE58FC08; Sat, 6 Nov 2010 09:34: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 oA69Yq94025447; Sat, 6 Nov 2010 09:34:52 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA69Yq32025442; Sat, 6 Nov 2010 09:34:52 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011060934.oA69Yq32025442@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 09:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214859 - in stable/8: share/man/man4 sys/modules sys/modules/siftr sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 09:34:52 -0000 Author: lstewart Date: Sat Nov 6 09:34:51 2010 New Revision: 214859 URL: http://svn.freebsd.org/changeset/base/214859 Log: MFC r209662,209665: Import the Statistical Information For TCP Research (SIFTR) kernel module into FreeBSD. SIFTR logs a range of statistics on active TCP connections to a log file, providing the ability to make highly granular measurements of TCP connection state. The tool is aimed at system administrators, developers and researchers alike. Please take it for a spin and test it out - the man page should have all the information required to get you going. Many thanks go to the Cisco University Research Program Fund at Community Foundation Silicon Valley and the FreeBSD Foundation. Their support of our work at the Centre for Advanced Internet Architectures, Swinburne University of Technology is greatly appreciated. r209980: Catch up with the rename of DPCPU_SUM to DPCPU_VARSUM. r209982: The SIFTR DPCPU statistics struct was not being zeroed between enable/disable cycles so the values would accumulate rather than reset for each cycle. Sponsored by: Cisco URP (r209662), FreeBSD Foundation Reviewed by: dwmalone, gnn, rpaulo (r209662) Tested by: Many on freebsd-current@ and elsewhere over the years Added: stable/8/share/man/man4/siftr.4 - copied unchanged from r209662, head/share/man/man4/siftr.4 stable/8/sys/modules/siftr/ - copied from r209662, head/sys/modules/siftr/ stable/8/sys/netinet/siftr.c - copied, changed from r209662, head/sys/netinet/siftr.c Modified: stable/8/share/man/man4/Makefile stable/8/sys/modules/Makefile Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man1/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man8/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man4/Makefile ============================================================================== --- stable/8/share/man/man4/Makefile Sat Nov 6 09:23:49 2010 (r214858) +++ stable/8/share/man/man4/Makefile Sat Nov 6 09:34:51 2010 (r214859) @@ -353,8 +353,9 @@ MAN= aac.4 \ sf.4 \ sge.4 \ si.4 \ - sio.4 \ + siftr.4 \ siis.4 \ + sio.4 \ sis.4 \ sk.4 \ smb.4 \ Copied: stable/8/share/man/man4/siftr.4 (from r209662, head/share/man/man4/siftr.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man4/siftr.4 Sat Nov 6 09:34:51 2010 (r214859, copy of r209662, head/share/man/man4/siftr.4) @@ -0,0 +1,752 @@ +.\" +.\" Copyright (c) 2010 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" Portions of this software were developed at the Centre for Advanced +.\" Internet Architectures, Swinburne University of Technology, Melbourne, +.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD +.\" Foundation. +.\" +.\" 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, +.\" without modification, immediately at the beginning of the file. +.\" 2. The name of the author may not 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 June 23, 2010 +.Dt SIFTR 4 +.Os +.Sh NAME +.Nm SIFTR +.Nd Statistical Information For TCP Research +.Sh SYNOPSIS +To load +.Ns Nm +as a module at run-time, run the following command as root: +.Bd -literal -offset indent +kldload siftr +.Ed +.Pp +Alternatively, to load +.Ns Nm +as a module at boot time, add the following line into the +.Xr loader.conf 5 +file: +.Bd -literal -offset indent +siftr_load="YES" +.Ed +.Sh DESCRIPTION +.Nm +.Ns ( Em S Ns tatistical +.Em I Ns nformation +.Em F Ns or +.Em T Ns CP +.Em R Ns esearch ) +is a kernel module that logs a range of statistics on active TCP connections to +a log file. +It provides the ability to make highly granular measurements of TCP connection +state, aimed at system administrators, developers and researchers. +.Ss Compile-time Configuration +The default operation of +.Nm +is to capture IPv4 TCP/IP packets. +.Nm +can be configured to support IPv4 and IPv6 by uncommenting: +.Bd -literal -offset indent +CFLAGS+=-DSIFTR_IPV6 +.Ed +.Pp +in +.Aq sys/modules/siftr/Makefile +and recompiling. +.Pp +In the IPv4-only (default) mode, standard dotted decimal notation (e.g. +"136.186.229.95") is used to format IPv4 addresses for logging. +In IPv6 mode, standard dotted decimal notation is used to format IPv4 addresses, +and standard colon-separated hex notation (see RFC 4291) is used to format IPv6 +addresses for logging. Note that SIFTR uses uncompressed notation to format IPv6 +addresses. +For example, the address "fe80::20f:feff:fea2:531b" would be logged as +"fe80:0:0:0:20f:feff:fea2:531b". +.Ss Run-time Configuration +.Nm +utilises the +.Xr sysctl 8 +interface to export its configuration variables to user-space. +The following variables are available: +.Bl -tag -offset indent +.It Va net.inet.siftr.enabled +controls whether the module performs its +measurements or not. +By default, the value is set to 0, which means the module +will not be taking any measurements. +Having the module loaded with +.Va net.inet.siftr.enabled +set to 0 will have no impact on the performance of the network stack, as the +packet filtering hooks are only inserted when +.Va net.inet.siftr.enabled +is set to 1. +.El +.Bl -tag -offset indent +.It Va net.inet.siftr.ppl +controls how many inbound/outbound packets for a given TCP connection will cause +a log message to be generated for the connection. +By default, the value is set to 1, which means the module will log a message for +every packet of every TCP connection. +The value can be set to any integer in the range [1,2^32], and can be changed at +any time, even while the module is enabled. +.El +.Bl -tag -offset indent +.It Va net.inet.siftr.logfile +controls the path to the file that the module writes its log messages to. +By default, the file /var/log/siftr.log is used. +The path can be changed at any time, even while the module is enabled. +.El +.Bl -tag -offset indent +.It Va net.inet.siftr.genhashes +controls whether a hash is generated for each TCP packet seen by +.Nm . +By default, the value is set to 0, which means no hashes are generated. +The hashes are useful to correlate which TCP packet triggered the generation of +a particular log message, but calculating them adds additional computational +overhead into the fast path. +.El +.Ss Log Format +A typical +.Nm +log file will contain 3 different types of log message. +All messages are written in plain ASCII text. +.Pp +Note: The +.Qq \e +present in the example log messages in this section indicates a +line continuation and is not part of the actual log message +.Pp +The first type of log message is written to the file when the module is +enabled and starts collecting data from the running kernel. The text below +shows an example module enable log. The fields are tab delimited key-value +pairs which describe some basic information about the system. +.Bd -literal -offset indent +enable_time_secs=1238556193 enable_time_usecs=462104 \\ +siftrver=1.2.2 hz=1000 tcp_rtt_scale=32 \\ +sysname=FreeBSD sysver=604000 ipmode=4 +.Ed +.Pp +Field descriptions are as follows: +.Bl -tag -offset indent +.It Va enable_time_secs +time at which the module was enabled, in seconds since the UNIX epoch. +.El +.Bl -tag -offset indent +.It Va enable_time_usecs +time at which the module was enabled, in microseconds since enable_time_secs. +.El +.Bl -tag -offset indent +.It Va siftrver +version of +.Nm . +.El +.Bl -tag -offset indent +.It Va hz +tick rate of the kernel in ticks per second. +.El +.Bl -tag -offset indent +.It Va tcp_rtt_scale +smoothed RTT estimate scaling factor +.El +.Bl -tag -offset indent +.It Va sysname +operating system name +.El +.Bl -tag -offset indent +.It Va sysver +operating system version +.El +.Bl -tag -offset indent +.It Va ipmode +IP mode as defined at compile time. +An ipmode of "4" means IPv6 is not supported and IP addresses are logged in +regular dotted quad format. +An ipmode of "6" means IPv6 is supported, and IP addresses are logged in dotted +quad or hex format, as described in the +.Qq Compile-time Configuration +subsection. +.El +.Pp +The second type of log message is written to the file when a data log message +is generated. +The text below shows an example data log triggered by an IPv4 +TCP/IP packet. +The data is CSV formatted. +.Bd -literal -offset indent +o,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\ +1073725440,172312,6144,66560,66608,8,1,4,1448,936,1,996,255, \\ +33304,208,66608,0,208 +.Ed +.Pp +Field descriptions are as follows: +.Bl -tag -offset indent +.It Va 1 +Direction of packet that triggered the log message. +Either +.Qq i +for in, or +.Qq o +for out. +.El +.Bl -tag -offset indent +.It Va 2 +Hash of the packet that triggered the log message. +.El +.Bl -tag -offset indent +.It Va 3 +Time at which the packet that triggered the log message was processed by +the +.Xr pfil 9 +hook function, in seconds and microseconds since the UNIX epoch. +.El +.Bl -tag -offset indent +.It Va 4 +The IPv4 or IPv6 address of the local host, in dotted quad (IPv4 packet) +or colon-separated hex (IPv6 packet) notation. +.El +.Bl -tag -offset indent +.It Va 5 +The TCP port that the local host is communicating via. +.El +.Bl -tag -offset indent +.It Va 6 +The IPv4 or IPv6 address of the foreign host, in dotted quad (IPv4 packet) +or colon-separated hex (IPv6 packet) notation. +.El +.Bl -tag -offset indent +.It Va 7 +The TCP port that the foreign host is communicating via. +.El +.Bl -tag -offset indent +.It Va 8 +The slow start threshold for the flow, in bytes. +.El +.Bl -tag -offset indent +.It Va 9 +The current congestion window for the flow, in bytes. +.El +.Bl -tag -offset indent +.It Va 10 +The current bandwidth-controlled window for the flow, in bytes. +.El +.Bl -tag -offset indent +.It Va 11 +The current sending window for the flow, in bytes. +The post scaled value is reported, except during the initial handshake (first +few packets), during which time the unscaled value is reported. +.El +.Bl -tag -offset indent +.It Va 12 +The current receive window for the flow, in bytes. +The post scaled value is always reported. +.El +.Bl -tag -offset indent +.It Va 13 +The current window scaling factor for the sending window. +.El +.Bl -tag -offset indent +.It Va 14 +The current window scaling factor for the receiving window. +.El +.Bl -tag -offset indent +.It Va 15 +The current state of the TCP finite state machine, as defined +in +.Aq Pa netinet/tcp_fsm.h . +.El +.Bl -tag -offset indent +.It Va 16 +The maximum segment size for the flow, in bytes. +.El +.Bl -tag -offset indent +.It Va 17 +The current smoothed RTT estimate for the flow, in units of TCP_RTT_SCALE * HZ, +where TCP_RTT_SCALE is a define found in tcp_var.h, and HZ is the kernel's tick +timer. +Divide by TCP_RTT_SCALE * HZ to get the RTT in secs. TCP_RTT_SCALE and HZ are +reported in the enable log message. +.El +.Bl -tag -offset indent +.It Va 18 +SACK enabled indicator. 1 if SACK enabled, 0 otherwise. +.El +.Bl -tag -offset indent +.It Va 19 +The current state of the TCP flags for the flow. +See +.Aq Pa netinet/tcp_var.h +for information about the various flags. +.El +.Bl -tag -offset indent +.It Va 20 +The current retransmission timeout length for the flow, in units of HZ, where HZ +is the kernel's tick timer. +Divide by HZ to get the timeout length in seconds. HZ is reported in the +enable log message. +.El +.Bl -tag -offset indent +.It Va 21 +The current size of the socket send buffer in bytes. +.El +.Bl -tag -offset indent +.It Va 22 +The current number of bytes in the socket send buffer. +.El +.Bl -tag -offset indent +.It Va 23 +The current size of the socket receive buffer in bytes. +.El +.Bl -tag -offset indent +.It Va 24 +The current number of bytes in the socket receive buffer. +.El +.Bl -tag -offset indent +.It Va 25 +The current number of unacknowledged bytes in-flight. +Bytes acknowledged via SACK are not excluded from this count. +.El +.Pp +The third type of log message is written to the file when the module is disabled +and ceases collecting data from the running kernel. +The text below shows an example module disable log. +The fields are tab delimited key-value pairs which provide statistics about +operations since the module was most recently enabled. +.Bd -literal -offset indent +disable_time_secs=1238556197 disable_time_usecs=933607 \\ +num_inbound_tcp_pkts=356 num_outbound_tcp_pkts=627 \\ +total_tcp_pkts=983 num_inbound_skipped_pkts_malloc=0 \\ +num_outbound_skipped_pkts_malloc=0 num_inbound_skipped_pkts_mtx=0 \\ +num_outbound_skipped_pkts_mtx=0 num_inbound_skipped_pkts_tcb=0 \\ +num_outbound_skipped_pkts_tcb=0 num_inbound_skipped_pkts_icb=0 \\ +num_outbound_skipped_pkts_icb=0 total_skipped_tcp_pkts=0 \\ +flow_list=172.16.7.28;22-172.16.2.5;55931, +.Ed +.Pp +Field descriptions are as follows: +.Bl -tag -offset indent +.It Va disable_time_secs +Time at which the module was disabled, in seconds since the UNIX epoch. +.El +.Bl -tag -offset indent +.It Va disable_time_usecs +Time at which the module was disabled, in microseconds since disable_time_secs. +.El +.Bl -tag -offset indent +.It Va num_inbound_tcp_pkts +Number of TCP packets that traversed up the network stack. +This only includes inbound TCP packets during the periods when +.Nm +was enabled. +.El +.Bl -tag -offset indent +.It Va num_outbound_tcp_pkts +Number of TCP packets that traversed down the network stack. +This only includes outbound TCP packets during the periods when +.Nm +was enabled. +.El +.Bl -tag -offset indent +.It Va total_tcp_pkts +The summation of num_inbound_tcp_pkts and num_outbound_tcp_pkts. +.El +.Bl -tag -offset indent +.It Va num_inbound_skipped_pkts_malloc +Number of inbound packets that were not processed because of failed malloc() calls. +.El +.Bl -tag -offset indent +.It Va num_outbound_skipped_pkts_malloc +Number of outbound packets that were not processed because of failed malloc() calls. +.El +.Bl -tag -offset indent +.It Va num_inbound_skipped_pkts_mtx +Number of inbound packets that were not processed because of failure to add the +packet to the packet processing queue. +.El +.Bl -tag -offset indent +.It Va num_outbound_skipped_pkts_mtx +Number of outbound packets that were not processed because of failure to add the +packet to the packet processing queue. +.El +.Bl -tag -offset indent +.It Va num_inbound_skipped_pkts_tcb +Number of inbound packets that were not processed because of failure to find the +TCP control block associated with the packet. +.El +.Bl -tag -offset indent +.It Va num_outbound_skipped_pkts_tcb +Number of outbound packets that were not processed because of failure to find +the TCP control block associated with the packet. +.El +.Bl -tag -offset indent +.It Va num_inbound_skipped_pkts_icb +Number of inbound packets that were not processed because of failure to find the +IP control block associated with the packet. +.El +.Bl -tag -offset indent +.It Va num_outbound_skipped_pkts_icb +Number of outbound packets that were not processed because of failure to find +the IP control block associated with the packet. +.El +.Bl -tag -offset indent +.It Va total_skipped_tcp_pkts +The summation of all skipped packet counters. +.El +.Bl -tag -offset indent +.It Va flow_list +A CSV list of TCP flows that triggered data log messages to be generated since +the module was loaded. +Each flow entry in the CSV list is +formatted as +.Qq local_ip;local_port-foreign_ip;foreign_port . +If there are no entries in the list (i.e. no data log messages were generated), +the value will be blank. +If there is at least one entry in the list, a trailing comma will always be +present. +.El +.Pp +The total number of data log messages found in the log file for a module +enable/disable cycle should equate to total_tcp_pkts - total_skipped_tcp_pkts. +.Sh IMPLEMENTATION NOTES +.Nm +hooks into the network stack using the +.Xr pfil 9 +interface. +In its current incarnation, it hooks into the AF_INET/AF_INET6 (IPv4/IPv6) +.Xr pfil 9 +filtering points, which means it sees packets at the IP layer of the network +stack. +This means that TCP packets inbound to the stack are intercepted before +they have been processed by the TCP layer. +Packets outbound from the stack are intercepted after they have been processed +by the TCP layer. +.Pp +The diagram below illustrates how +.Nm +inserts itself into the stack. +.Bd -literal -offset indent +---------------------------------- + Upper Layers +---------------------------------- + ^ | + | | + | | + | v + TCP in TCP out +---------------------------------- + ^ | + |________ _________| + | | + | v + --------- + | SIFTR | + --------- + ^ | + ________| |__________ + | | + | v +IPv{4/6} in IPv{4/6} out +---------------------------------- + ^ | + | | + | v +Layer 2 in Layer 2 out +---------------------------------- + Physical Layer +---------------------------------- +.Ed +.Pp +.Nm +uses the +.Xr alq 9 +interface to manage writing data to disk. +.Pp +At first glance, you might mistakenly think that +.Nm +extracts information from +individual TCP packets. +This is not the case. +.Nm +uses TCP packet events (inbound and outbound) for each TCP flow originating from +the system to trigger a dump of the state of the TCP control block for that +flow. +With the PPL set to 1, we are in effect sampling each TCP flow's control block +state as frequently as flow packets enter/leave the system. +For example, setting PPL to 2 halves the sampling rate i.e. every second flow +packet (inbound OR outbound) causes a dump of the control block state. +.Pp +The distinction between interrogating individual packets vs interrogating the +control block is important, because +.Nm +does not remove the need for packet capturing tools like +.Xr tcpdump 1 . +.Nm +allows you to correlate and observe the cause-and-affect relationship between +what you see on the wire (captured using a tool like +.Xr tcpdump 1 Ns ) +and changes in the TCP control block corresponding to the flow of interest. +It is therefore useful to use +.Nm +and a tool like +.Xr tcpdump 1 +to gather the necessary data to piece together the complete picture. +Use of either tool on its own will not be able to provide all of the necessary +data. +.Pp +As a result of needing to interrogate the TCP control block, certain packets +during the lifecycle of a connection are unable to trigger a +.Nm +log message. +The initial handshake takes place without the existence of a control block and +the final ACK is exchanged when the connection is in the TIMEWAIT state. +.Pp +.Nm +was designed to minimise the delay introduced to packets traversing the network +stack. +This design called for a highly optimised and minimal hook function that +extracted the minimal details necessary whilst holding the packet up, and +passing these details to another thread for actual processing and logging. +.Pp +This multithreaded design does introduce some contention issues when accessing +the data structure shared between the threads of operation. +When the hook function tries to place details in the structure, it must first +acquire an exclusive lock. +Likewise, when the processing thread tries to read details from the structure, +it must also acquire an exclusive lock to do so. +If one thread holds the lock, the other must wait before it can obtain it. +This does introduce some additional bounded delay into the kernel's packet +processing code path. +.Pp +In some cases (e.g. low memory, connection termination), TCP packets that enter +the +.Nm +.Xr pfil 9 +hook function will not trigger a log message to be generated. +.Nm +refers to this outcome as a +.Qq skipped packet . +Note that +.Nm +always ensures that packets are allowed to continue through the stack, even if +they could not successfully trigger a data log message. +.Nm +will therefore not introduce any packet loss for TCP/IP packets traversing the +network stack. +.Ss Important Behaviours +The behaviour of a log file path change whilst the module is enabled is as +follows: +.Bl -enum +.It +Attempt to open the new file path for writing. +If this fails, the path change will fail and the existing path will continue to +be used. +.It +Assuming the new path is valid and opened successfully: +.Bl -dash +.It +Flush all pending log messages to the old file path. +.It +Close the old file path. +.It +Switch the active log file pointer to point at the new file path. +.It +Commence logging to the new file. +.El +.El +.Pp +During the time between the flush of pending log messages to the old file and +commencing logging to the new file, new log messages will still be generated and +buffered. +As soon as the new file path is ready for writing, the accumulated log messages +will be written out to the file. +.Sh EXAMPLES +To enable the module's operations, run the following command as root: +sysctl net.inet.siftr.enabled=1 +.Pp +To change the granularity of log messages such that 1 log message is +generated for every 10 TCP packets per connection, run the following +command as root: +sysctl net.inet.siftr.ppl=10 +.Pp +To change the log file location to /tmp/siftr.log, run the following +command as root: +sysctl net.inet.siftr.logfile=/tmp/siftr.log +.Sh SEE ALSO +.Xr alq 9 , +.Xr pfil 9 +.Xr sysctl 8 , +.Xr tcp 4 , +.Xr tcpdump 1 , +.Sh ACKNOWLEDGEMENTS +Development of this software was made possible in part by grants from the +Cisco University Research Program Fund at Community Foundation Silicon Valley, +and the FreeBSD Foundation. +.Sh HISTORY +.Nm +first appeared in +.Fx 9.0 . +.Pp +.Nm +was first released in 2007 by Lawrence Stewart and James Healy whilst working on +the NewTCP research project at Swinburne University's Centre for Advanced +Internet Architectures, Melbourne, Australia, which was made possible in part by +a grant from the Cisco University Research Program Fund at Community Foundation +Silicon Valley. +More details are available at: +.Pp +http://caia.swin.edu.au/urp/newtcp/ +.Pp +Work on +.Nm +v1.2.x was sponsored by the FreeBSD Foundation as part of +the +.Qq Enhancing the FreeBSD TCP Implementation +project 2008-2009. +More details are available at: +.Pp +http://www.freebsdfoundation.org/ +.Pp +http://caia.swin.edu.au/freebsd/etcp09/ +.Sh AUTHORS +.An -nosplit +.Nm +was written by +.An Lawrence Stewart Aq lstewart@FreeBSD.org +and +.An James Healy Aq jimmy@deefa.com . +.Pp +This manual page was written by +.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.Sh BUGS +Current known limitations and any relevant workarounds are outlined below: +.Bl -dash +.It +The internal queue used to pass information between the threads of operation is +currently unbounded. +This allows +.Nm +to cope with bursty network traffic, but sustained high packet-per-second +traffic can cause exhaustion of kernel memory if the processing thread cannot +keep up with the packet rate. +.It +If using +.Nm +on a machine that is also running other modules utilising the +.Xr pfil 9 +framework e.g. +.Xr dummynet 4 , +.Xr ipfw 8 , +.Xr pf 4 Ns , +the order in which you load the modules is important. +You should kldload the other modules first, as this will ensure TCP packets +undergo any necessary manipulations before +.Nm +.Qq sees +and processes them. +.It +There is a known, harmless lock order reversal warning between the +.Xr pfil 9 +mutex and tcbinfo TCP lock reported by +.Xr witness 4 +when +.Nm +is enabled in a kernel compiled with +.Xr witness 4 +support. +.It +There is no way to filter which TCP flows you wish to capture data for. +Post processing is required to separate out data belonging to particular flows +of interest. +.It +The module does not detect deletion of the log file path. +New log messages will simply be lost if the log file being used by +.Nm +is deleted whilst the module is set to use the file. +Switching to a new log file using the +.Em net.inet.siftr.logfile +variable will create the new file and allow log messages to begin being written +to disk again. +The new log file path must differ from the path to the deleted file. +.It +The hash table used within the code is sized to hold 65536 flows. This is not a +hard limit, because chaining is used to handle collisions within the hash table +structure. +However, we suspect (based on analogies with other hash table performance data) +that the hash table look up performance (and therefore the module's packet +processing performance) will degrade in an exponential manner as the number of +unique flows handled in a module enable/disable cycle approaches and surpasses +65536. +.It +There is no garbage collection performed on the flow hash table. +The only way currently to flush it is to disable +.Nm . +.It +The PPL variable applies to packets that make it into the processing thread, +not total packets received in the hook function. +Packets are skipped before the PPL variable is applied, which means there may be +a slight discrepancy in the triggering of log messages. +For example, if PPL was set to 10, and the 8th packet since the last log message +is skipped, the 11th packet will actually trigger the log message to be +generated. +This is discussed in greater depth in CAIA technical report 070824A. +.It +At the time of writing, there was no simple way to hook into the TCP layer +to intercept packets. +.Nm Ap s +use of IP layer hook points means all IP +traffic will be processed by the +.Nm +.Xr pfil 9 +hook function, which introduces minor, but nonetheless unnecessary packet delay +and processing overhead on the system for non-TCP packets as well. +Hooking in at the IP layer is also not ideal from the data gathering point of +view. +Packets traversing up the stack will be intercepted and cause a log message +generation BEFORE they have been processed by the TCP layer, which means we +cannot observe the cause-and-affect relationship between inbound events and the +corresponding TCP control block as precisely as could be. +Ideally, +.Nm +should intercept packets after they have been processed by the TCP layer i.e. +intercept packets coming up the stack after they have been processed by +tcp_input(), and intercept packets coming down the stack after they have been +processed by tcp_output(). +The current code still gives satisfactory granularity though, as inbound events +tend to trigger outbound events, allowing the cause-and-effect to be observed +indirectly by capturing the state on outbound events as well. +.It +The +.Qq inflight bytes +value logged by +.Nm +does not take into account bytes that have been +.No SACK Ap ed +by the receiving host. +.It +Packet hash generation does not currently work for IPv6 based TCP packets. +.It +Compressed notation is not used for IPv6 address representation. +This consumes more bytes than is necessary in log output. +.El Modified: stable/8/sys/modules/Makefile ============================================================================== --- stable/8/sys/modules/Makefile Sat Nov 6 09:23:49 2010 (r214858) +++ stable/8/sys/modules/Makefile Sat Nov 6 09:34:51 2010 (r214859) @@ -258,6 +258,7 @@ SUBDIR= ${_3dfx} \ sf \ sge \ siba_bwn \ + siftr \ siis \ sis \ sk \ Copied and modified: stable/8/sys/netinet/siftr.c (from r209662, head/sys/netinet/siftr.c) ============================================================================== --- head/sys/netinet/siftr.c Sat Jul 3 13:32:39 2010 (r209662, copy source) +++ stable/8/sys/netinet/siftr.c Sat Nov 6 09:34:51 2010 (r214859) @@ -1233,6 +1233,8 @@ siftr_manage_ops(uint8_t action) STAILQ_INIT(&pkt_queue); + DPCPU_ZERO(ss); + siftr_exit_pkt_manager_thread = 0; ret = kthread_add(&siftr_pkt_manager_thread, NULL, NULL, @@ -1282,16 +1284,16 @@ siftr_manage_ops(uint8_t action) siftr_pkt_manager_thr = NULL; mtx_unlock(&siftr_pkt_mgr_mtx); - totalss.n_in = DPCPU_SUM(ss, n_in); - totalss.n_out = DPCPU_SUM(ss, n_out); - totalss.nskip_in_malloc = DPCPU_SUM(ss, nskip_in_malloc); - totalss.nskip_out_malloc = DPCPU_SUM(ss, nskip_out_malloc); - totalss.nskip_in_mtx = DPCPU_SUM(ss, nskip_in_mtx); - totalss.nskip_out_mtx = DPCPU_SUM(ss, nskip_out_mtx); - totalss.nskip_in_tcpcb = DPCPU_SUM(ss, nskip_in_tcpcb); - totalss.nskip_out_tcpcb = DPCPU_SUM(ss, nskip_out_tcpcb); - totalss.nskip_in_inpcb = DPCPU_SUM(ss, nskip_in_inpcb); - totalss.nskip_out_inpcb = DPCPU_SUM(ss, nskip_out_inpcb); + totalss.n_in = DPCPU_VARSUM(ss, n_in); + totalss.n_out = DPCPU_VARSUM(ss, n_out); + totalss.nskip_in_malloc = DPCPU_VARSUM(ss, nskip_in_malloc); + totalss.nskip_out_malloc = DPCPU_VARSUM(ss, nskip_out_malloc); + totalss.nskip_in_mtx = DPCPU_VARSUM(ss, nskip_in_mtx); + totalss.nskip_out_mtx = DPCPU_VARSUM(ss, nskip_out_mtx); + totalss.nskip_in_tcpcb = DPCPU_VARSUM(ss, nskip_in_tcpcb); + totalss.nskip_out_tcpcb = DPCPU_VARSUM(ss, nskip_out_tcpcb); + totalss.nskip_in_inpcb = DPCPU_VARSUM(ss, nskip_in_inpcb); + totalss.nskip_out_inpcb = DPCPU_VARSUM(ss, nskip_out_inpcb); total_skipped_pkts = totalss.nskip_in_malloc + totalss.nskip_out_malloc + totalss.nskip_in_mtx + From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 09:42:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9BE1106566C; Sat, 6 Nov 2010 09:42:41 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6F558FC12; Sat, 6 Nov 2010 09:42: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 oA69gf1F025646; Sat, 6 Nov 2010 09:42:41 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA69gfYW025642; Sat, 6 Nov 2010 09:42:41 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011060942.oA69gfYW025642@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 09:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214860 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 09:42:41 -0000 Author: lstewart Date: Sat Nov 6 09:42:41 2010 New Revision: 214860 URL: http://svn.freebsd.org/changeset/base/214860 Log: MFC r213158: Internalise reassembly queue related functionality and variables which should not be used outside of the reassembly queue implementation. Provide a new function to flush all segments from a reassembly queue and call it from the appropriate places instead of manipulating the queue directly. Sponsored by: FreeBSD Foundation Reviewed by: andre, gnn, rpaulo Modified: stable/8/sys/netinet/tcp_reass.c stable/8/sys/netinet/tcp_subr.c stable/8/sys/netinet/tcp_var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/tcp_reass.c ============================================================================== --- stable/8/sys/netinet/tcp_reass.c Sat Nov 6 09:34:51 2010 (r214859) +++ stable/8/sys/netinet/tcp_reass.c Sat Nov 6 09:42:41 2010 (r214860) @@ -83,7 +83,8 @@ SYSCTL_VNET_INT(_net_inet_tcp_reass, OID &VNET_NAME(tcp_reass_maxseg), 0, "Global maximum number of TCP Segments in Reassembly Queue"); -VNET_DEFINE(int, tcp_reass_qsize) = 0; +static VNET_DEFINE(int, tcp_reass_qsize) = 0; +#define V_tcp_reass_qsize VNET(tcp_reass_qsize) SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, &VNET_NAME(tcp_reass_qsize), 0, "Global number of TCP Segments currently in Reassembly Queue"); @@ -100,6 +101,9 @@ SYSCTL_VNET_INT(_net_inet_tcp_reass, OID &VNET_NAME(tcp_reass_overflows), 0, "Global number of TCP Segment Reassembly Queue Overflows"); +static VNET_DEFINE(uma_zone_t, tcp_reass_zone); +#define V_tcp_reass_zone VNET(tcp_reass_zone) + /* Initialize TCP reassembly queue */ static void tcp_reass_zone_change(void *tag) @@ -109,8 +113,6 @@ tcp_reass_zone_change(void *tag) uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); } -VNET_DEFINE(uma_zone_t, tcp_reass_zone); - void tcp_reass_init(void) { @@ -134,6 +136,26 @@ tcp_reass_destroy(void) } #endif +void +tcp_reass_flush(struct tcpcb *tp) +{ + struct tseg_qent *qe; + + INP_WLOCK_ASSERT(tp->t_inpcb); + + while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { + LIST_REMOVE(qe, tqe_q); + m_freem(qe->tqe_m); + uma_zfree(V_tcp_reass_zone, qe); + tp->t_segqlen--; + V_tcp_reass_qsize--; + } + + KASSERT((tp->t_segqlen == 0), + ("TCP reass queue %p segment count is %d instead of 0 after flush.", + tp, tp->t_segqlen)); +} + int tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { Modified: stable/8/sys/netinet/tcp_subr.c ============================================================================== --- stable/8/sys/netinet/tcp_subr.c Sat Nov 6 09:34:51 2010 (r214859) +++ stable/8/sys/netinet/tcp_subr.c Sat Nov 6 09:42:41 2010 (r214860) @@ -775,7 +775,6 @@ tcp_drop(struct tcpcb *tp, int errno) void tcp_discardcb(struct tcpcb *tp) { - struct tseg_qent *q; struct inpcb *inp = tp->t_inpcb; struct socket *so = inp->inp_socket; #ifdef INET6 @@ -853,13 +852,7 @@ tcp_discardcb(struct tcpcb *tp) } /* free the reassembly queue, if any */ - while ((q = LIST_FIRST(&tp->t_segq)) != NULL) { - LIST_REMOVE(q, tqe_q); - m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); - tp->t_segqlen--; - V_tcp_reass_qsize--; - } + tcp_reass_flush(tp); /* Disconnect offload device, if any. */ tcp_offload_detach(tp); @@ -917,7 +910,6 @@ tcp_drain(void) CURVNET_SET(vnet_iter); struct inpcb *inpb; struct tcpcb *tcpb; - struct tseg_qent *te; /* * Walk the tcpbs, if existing, and flush the reassembly queue, @@ -933,14 +925,7 @@ tcp_drain(void) continue; INP_WLOCK(inpb); if ((tcpb = intotcpcb(inpb)) != NULL) { - while ((te = LIST_FIRST(&tcpb->t_segq)) - != NULL) { - LIST_REMOVE(te, tqe_q); - m_freem(te->tqe_m); - uma_zfree(V_tcp_reass_zone, te); - tcpb->t_segqlen--; - V_tcp_reass_qsize--; - } + tcp_reass_flush(tcpb); tcp_clean_sackreport(tcpb); } INP_WUNLOCK(inpb); Modified: stable/8/sys/netinet/tcp_var.h ============================================================================== --- stable/8/sys/netinet/tcp_var.h Sat Nov 6 09:34:51 2010 (r214859) +++ stable/8/sys/netinet/tcp_var.h Sat Nov 6 09:42:41 2010 (r214860) @@ -44,10 +44,6 @@ VNET_DECLARE(int, tcp_do_rfc1323); #define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323) -VNET_DECLARE(int, tcp_reass_qsize); -VNET_DECLARE(struct uma_zone *, tcp_reass_zone); -#define V_tcp_reass_qsize VNET(tcp_reass_qsize) -#define V_tcp_reass_zone VNET(tcp_reass_zone) #endif /* _KERNEL */ /* TCP segment queue entry */ @@ -608,6 +604,7 @@ char *tcp_log_vain(struct in_conninfo *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); void tcp_reass_init(void); +void tcp_reass_flush(struct tcpcb *); #ifdef VIMAGE void tcp_reass_destroy(void); #endif From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 09:56:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 834C0106564A; Sat, 6 Nov 2010 09:56:14 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5662A8FC12; Sat, 6 Nov 2010 09: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 oA69uE6f025970; Sat, 6 Nov 2010 09:56:14 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA69uEjn025967; Sat, 6 Nov 2010 09:56:14 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011060956.oA69uEjn025967@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 09:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214861 - stable/8/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 09:56:14 -0000 Author: lstewart Date: Sat Nov 6 09:56:14 2010 New Revision: 214861 URL: http://svn.freebsd.org/changeset/base/214861 Log: MFC r211396 (originally committed by andre): Add uma_zone_get_max() to obtain the effective limit after a call to uma_zone_set_max(). The UMA zone limit is not exactly set to the value supplied but rounded up to completely fill the backing store increment (a page normally). This can lead to surprising situations where the number of elements allocated from UMA is higher than the supplied limit value. The new get function reads back the effective value so that the supplied limit value can be adjusted to the real limit. Reviewed by: jeffr Modified: stable/8/sys/vm/uma.h stable/8/sys/vm/uma_core.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/vm/uma.h ============================================================================== --- stable/8/sys/vm/uma.h Sat Nov 6 09:42:41 2010 (r214860) +++ stable/8/sys/vm/uma.h Sat Nov 6 09:56:14 2010 (r214861) @@ -459,6 +459,18 @@ int uma_zone_set_obj(uma_zone_t zone, st void uma_zone_set_max(uma_zone_t zone, int nitems); /* + * Obtains the effective limit on the number of items in a zone + * + * Arguments: + * zone The zone to obtain the effective limit from + * + * Return: + * 0 No limit + * int The effective limit of the zone + */ +int uma_zone_get_max(uma_zone_t zone); + +/* * The following two routines (uma_zone_set_init/fini) * are used to set the backend init/fini pair which acts on an * object as it becomes allocated and is placed in a slab within Modified: stable/8/sys/vm/uma_core.c ============================================================================== --- stable/8/sys/vm/uma_core.c Sat Nov 6 09:42:41 2010 (r214860) +++ stable/8/sys/vm/uma_core.c Sat Nov 6 09:56:14 2010 (r214861) @@ -2803,6 +2803,24 @@ uma_zone_set_max(uma_zone_t zone, int ni } /* See uma.h */ +int +uma_zone_get_max(uma_zone_t zone) +{ + int nitems; + uma_keg_t keg; + + ZONE_LOCK(zone); + keg = zone_first_keg(zone); + if (keg->uk_maxpages) + nitems = keg->uk_maxpages * keg->uk_ipers; + else + nitems = 0; + ZONE_UNLOCK(zone); + + return (nitems); +} + +/* See uma.h */ void uma_zone_set_init(uma_zone_t zone, uma_init uminit) { From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 10:06:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A0D0106564A; Sat, 6 Nov 2010 10:06:59 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06F438FC0C; Sat, 6 Nov 2010 10:06: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 oA6A6wvO026284; Sat, 6 Nov 2010 10:06:58 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6A6wps026280; Sat, 6 Nov 2010 10:06:58 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061006.oA6A6wps026280@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 10:06:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214862 - in stable/8: share/man/man9 sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 10:06:59 -0000 Author: lstewart Date: Sat Nov 6 10:06:58 2010 New Revision: 214862 URL: http://svn.freebsd.org/changeset/base/214862 Log: MFC r213910: - Simplify implementation of uma_zone_get_max. - Add uma_zone_get_cur which returns the current approximate occupancy of a zone. This is useful for providing stats via sysctl amongst other things. Sponsored by: FreeBSD Foundation Reviewed by: gnn, jhb Modified: stable/8/share/man/man9/zone.9 stable/8/sys/vm/uma.h stable/8/sys/vm/uma_core.c Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man1/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man8/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man9/zone.9 ============================================================================== --- stable/8/share/man/man9/zone.9 Sat Nov 6 09:56:14 2010 (r214861) +++ stable/8/share/man/man9/zone.9 Sat Nov 6 10:06:58 2010 (r214862) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 19, 2008 +.Dd October 9, 2010 .Dt ZONE 9 .Os .Sh NAME @@ -35,7 +35,9 @@ .Nm uma_zfree , .Nm uma_zfree_arg , .Nm uma_zdestroy , -.Nm uma_zone_set_max +.Nm uma_zone_set_max, +.Nm uma_zone_get_max, +.Nm uma_zone_get_cur .Nd zone allocator .Sh SYNOPSIS .In sys/param.h @@ -59,6 +61,10 @@ .Fn uma_zdestroy "uma_zone_t zone" .Ft void .Fn uma_zone_set_max "uma_zone_t zone" "int nitems" +.Ft int +.Fn uma_zone_get_max "uma_zone_t zone" +.Ft int +.Fn uma_zone_get_cur "uma_zone_t zone" .Sh DESCRIPTION The zone allocator provides an efficient interface for managing dynamically-sized collections of items of similar size. @@ -177,21 +183,36 @@ must have been freed with .Fn uma_zfree before. .Pp -The purpose of +The .Fn uma_zone_set_max -is to limit the maximum amount of memory that the system can dedicated -toward the zone specified by the -.Fa zone -argument. +function limits the number of items +.Pq and therefore memory +that can be allocated to +.Fa zone . The .Fa nitems -argument gives the upper limit of items in the zone. -This limits the total number of items in the zone which includes: +argument specifies the requested upper limit number of items. +The effective limit may end up being higher than requested, as the +implementation will round up to ensure all memory pages allocated to the zone +are utilised to capacity. +The limit applies to the total number of items in the zone, which includes allocated items, free items and free items in the per-cpu caches. On systems with more than one CPU it may not be possible to allocate the specified number of items even when there is no shortage of memory, because all of the remaining free items may be in the caches of the other CPUs when the limit is hit. +.Pp +The +.Fn uma_zone_get_max +function returns the effective upper limit number of items for a zone. +.Pp +The +.Fn uma_zone_get_cur +function returns the approximate current occupancy of the zone. +The returned value is approximate because appropriate synchronisation to +determine an exact value is not performend by the implementation. +This ensures low overhead at the expense of potentially stale data being used +in the calculation. .Sh RETURN VALUES The .Fn uma_zalloc Modified: stable/8/sys/vm/uma.h ============================================================================== --- stable/8/sys/vm/uma.h Sat Nov 6 09:56:14 2010 (r214861) +++ stable/8/sys/vm/uma.h Sat Nov 6 10:06:58 2010 (r214862) @@ -471,6 +471,17 @@ void uma_zone_set_max(uma_zone_t zone, i int uma_zone_get_max(uma_zone_t zone); /* + * Obtains the approximate current number of items allocated from a zone + * + * Arguments: + * zone The zone to obtain the current allocation count from + * + * Return: + * int The approximate current number of items allocated from the zone + */ +int uma_zone_get_cur(uma_zone_t zone); + +/* * The following two routines (uma_zone_set_init/fini) * are used to set the backend init/fini pair which acts on an * object as it becomes allocated and is placed in a slab within Modified: stable/8/sys/vm/uma_core.c ============================================================================== --- stable/8/sys/vm/uma_core.c Sat Nov 6 09:56:14 2010 (r214861) +++ stable/8/sys/vm/uma_core.c Sat Nov 6 10:06:58 2010 (r214862) @@ -2811,16 +2811,36 @@ uma_zone_get_max(uma_zone_t zone) ZONE_LOCK(zone); keg = zone_first_keg(zone); - if (keg->uk_maxpages) - nitems = keg->uk_maxpages * keg->uk_ipers; - else - nitems = 0; + nitems = keg->uk_maxpages * keg->uk_ipers; ZONE_UNLOCK(zone); return (nitems); } /* See uma.h */ +int +uma_zone_get_cur(uma_zone_t zone) +{ + int64_t nitems; + u_int i; + + ZONE_LOCK(zone); + nitems = zone->uz_allocs - zone->uz_frees; + CPU_FOREACH(i) { + /* + * See the comment in sysctl_vm_zone_stats() regarding the + * safety of accessing the per-cpu caches. With the zone lock + * held, it is safe, but can potentially result in stale data. + */ + nitems += zone->uz_cpu[i].uc_allocs - + zone->uz_cpu[i].uc_frees; + } + ZONE_UNLOCK(zone); + + return (nitems < 0 ? 0 : nitems); +} + +/* See uma.h */ void uma_zone_set_init(uma_zone_t zone, uma_init uminit) { From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 10:17:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB9DF106566C; Sat, 6 Nov 2010 10:17:43 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B84AC8FC17; Sat, 6 Nov 2010 10:17: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 oA6AHhnA026550; Sat, 6 Nov 2010 10:17:43 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6AHhS4026548; Sat, 6 Nov 2010 10:17:43 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061017.oA6AHhS4026548@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 10:17:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214863 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 10:17:43 -0000 Author: lstewart Date: Sat Nov 6 10:17:43 2010 New Revision: 214863 URL: http://svn.freebsd.org/changeset/base/214863 Log: MFC r210203: - Move common code from the hook functions that fills in a packet node struct to a separate inline function. This further reduces duplicate code that didn't have a good reason to stay as it was. - Reorder the malloc of a pkt_node struct in the hook functions such that it only occurs if we managed to find a usable tcpcb associated with the packet. - Make the inp_locally_locked variable's type consistent with the prototype of siftr_siftdata(). Sponsored by: FreeBSD Foundation Modified: stable/8/sys/netinet/siftr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/siftr.c ============================================================================== --- stable/8/sys/netinet/siftr.c Sat Nov 6 10:06:58 2010 (r214862) +++ stable/8/sys/netinet/siftr.c Sat Nov 6 10:17:43 2010 (r214863) @@ -746,6 +746,67 @@ siftr_findinpcb(int ipver, struct ip *ip } +static inline void +siftr_siftdata(struct pkt_node *pn, struct inpcb *inp, struct tcpcb *tp, + int ipver, int dir, int inp_locally_locked) +{ +#ifdef SIFTR_IPV6 + if (ipver == INP_IPV4) { + pn->ip_laddr[3] = inp->inp_laddr.s_addr; + pn->ip_faddr[3] = inp->inp_faddr.s_addr; +#else + *((uint32_t *)pn->ip_laddr) = inp->inp_laddr.s_addr; + *((uint32_t *)pn->ip_faddr) = inp->inp_faddr.s_addr; +#endif +#ifdef SIFTR_IPV6 + } else { + pn->ip_laddr[0] = inp->in6p_laddr.s6_addr32[0]; + pn->ip_laddr[1] = inp->in6p_laddr.s6_addr32[1]; + pn->ip_laddr[2] = inp->in6p_laddr.s6_addr32[2]; + pn->ip_laddr[3] = inp->in6p_laddr.s6_addr32[3]; + pn->ip_faddr[0] = inp->in6p_faddr.s6_addr32[0]; + pn->ip_faddr[1] = inp->in6p_faddr.s6_addr32[1]; + pn->ip_faddr[2] = inp->in6p_faddr.s6_addr32[2]; + pn->ip_faddr[3] = inp->in6p_faddr.s6_addr32[3]; + } +#endif + pn->tcp_localport = inp->inp_lport; + pn->tcp_foreignport = inp->inp_fport; + pn->snd_cwnd = tp->snd_cwnd; + pn->snd_wnd = tp->snd_wnd; + pn->rcv_wnd = tp->rcv_wnd; + pn->snd_bwnd = tp->snd_bwnd; + pn->snd_ssthresh = tp->snd_ssthresh; + pn->snd_scale = tp->snd_scale; + pn->rcv_scale = tp->rcv_scale; + pn->conn_state = tp->t_state; + pn->max_seg_size = tp->t_maxseg; + pn->smoothed_rtt = tp->t_srtt; + pn->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0; + pn->flags = tp->t_flags; + pn->rxt_length = tp->t_rxtcur; + pn->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat; + pn->snd_buf_cc = inp->inp_socket->so_snd.sb_cc; + pn->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat; + pn->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc; + pn->sent_inflight_bytes = tp->snd_max - tp->snd_una; + + /* We've finished accessing the tcb so release the lock. */ + if (inp_locally_locked) + INP_RUNLOCK(inp); + + pn->ipver = ipver; + pn->direction = dir; + + /* + * Significantly more accurate than using getmicrotime(), but slower! + * Gives true microsecond resolution at the expense of a hit to + * maximum pps throughput processing when SIFTR is loaded and enabled. + */ + microtime(&pn->tval); +} + + /* * pfil hook that is called for each IPv4 packet making its way through the * stack in either direction. @@ -758,13 +819,13 @@ static int siftr_chkpkt(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, struct inpcb *inp) { - struct pkt_node *pkt_node; + struct pkt_node *pn; struct ip *ip; struct tcphdr *th; struct tcpcb *tp; struct siftr_stats *ss; unsigned int ip_hl; - uint8_t inp_locally_locked; + int inp_locally_locked; inp_locally_locked = 0; ss = DPCPU_PTR(ss); @@ -818,18 +879,6 @@ siftr_chkpkt(void *arg, struct mbuf **m, INP_LOCK_ASSERT(inp); - pkt_node = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE, - M_NOWAIT | M_ZERO); - - if (pkt_node == NULL) { - if (dir == PFIL_IN) - ss->nskip_in_malloc++; - else - ss->nskip_out_malloc++; - - goto inp_unlock; - } - /* Find the TCP control block that corresponds with this packet */ tp = intotcpcb(inp); @@ -844,53 +893,21 @@ siftr_chkpkt(void *arg, struct mbuf **m, else ss->nskip_out_tcpcb++; - free(pkt_node, M_SIFTR_PKTNODE); goto inp_unlock; } - /* Fill in pkt_node data */ -#ifdef SIFTR_IPV6 - pkt_node->ip_laddr[3] = inp->inp_laddr.s_addr; - pkt_node->ip_faddr[3] = inp->inp_faddr.s_addr; -#else - *((uint32_t *)pkt_node->ip_laddr) = inp->inp_laddr.s_addr; - *((uint32_t *)pkt_node->ip_faddr) = inp->inp_faddr.s_addr; -#endif - pkt_node->tcp_localport = inp->inp_lport; - pkt_node->tcp_foreignport = inp->inp_fport; - pkt_node->snd_cwnd = tp->snd_cwnd; - pkt_node->snd_wnd = tp->snd_wnd; - pkt_node->rcv_wnd = tp->rcv_wnd; - pkt_node->snd_bwnd = tp->snd_bwnd; - pkt_node->snd_ssthresh = tp->snd_ssthresh; - pkt_node->snd_scale = tp->snd_scale; - pkt_node->rcv_scale = tp->rcv_scale; - pkt_node->conn_state = tp->t_state; - pkt_node->max_seg_size = tp->t_maxseg; - pkt_node->smoothed_rtt = tp->t_srtt; - pkt_node->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0; - pkt_node->flags = tp->t_flags; - pkt_node->rxt_length = tp->t_rxtcur; - pkt_node->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat; - pkt_node->snd_buf_cc = inp->inp_socket->so_snd.sb_cc; - pkt_node->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat; - pkt_node->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc; - pkt_node->sent_inflight_bytes = tp->snd_max - tp->snd_una; + pn = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE, M_NOWAIT|M_ZERO); - /* We've finished accessing the tcb so release the lock. */ - if (inp_locally_locked) - INP_RUNLOCK(inp); + if (pn == NULL) { + if (dir == PFIL_IN) + ss->nskip_in_malloc++; + else + ss->nskip_out_malloc++; - /* These are safe to access without the inp lock. */ - pkt_node->ipver = INP_IPV4; - pkt_node->direction = dir; + goto inp_unlock; + } - /* - * Significantly more accurate than using getmicrotime(), but slower! - * Gives true microsecond resolution at the expense of a hit to - * maximum pps throughput processing when SIFTR is loaded and enabled. - */ - microtime(&(pkt_node->tval)); + siftr_siftdata(pn, inp, tp, INP_IPV4, dir, inp_locally_locked); if (siftr_generate_hashes) { if ((*m)->m_pkthdr.csum_flags & CSUM_TCP) { @@ -950,11 +967,11 @@ siftr_chkpkt(void *arg, struct mbuf **m, * find a way to create the hash and checksum in the same pass * over the bytes. */ - pkt_node->hash = hash_pkt(*m, ip_hl); + pn->hash = hash_pkt(*m, ip_hl); } mtx_lock(&siftr_pkt_queue_mtx); - STAILQ_INSERT_TAIL(&pkt_queue, pkt_node, nodes); + STAILQ_INSERT_TAIL(&pkt_queue, pn, nodes); mtx_unlock(&siftr_pkt_queue_mtx); goto ret; @@ -973,13 +990,13 @@ static int siftr_chkpkt6(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, struct inpcb *inp) { - struct pkt_node *pkt_node; + struct pkt_node *pn; struct ip6_hdr *ip6; struct tcphdr *th; struct tcpcb *tp; struct siftr_stats *ss; unsigned int ip6_hl; - uint8_t inp_locally_locked; + int inp_locally_locked; inp_locally_locked = 0; ss = DPCPU_PTR(ss); @@ -1037,18 +1054,6 @@ siftr_chkpkt6(void *arg, struct mbuf **m inp_locally_locked = 1; } - pkt_node = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE, - M_NOWAIT | M_ZERO); - - if (pkt_node == NULL) { - if (dir == PFIL_IN) - ss->nskip_in_malloc++; - else - ss->nskip_out_malloc++; - - goto inp_unlock6; - } - /* Find the TCP control block that corresponds with this packet. */ tp = intotcpcb(inp); @@ -1063,59 +1068,26 @@ siftr_chkpkt6(void *arg, struct mbuf **m else ss->nskip_out_tcpcb++; - free(pkt_node, M_SIFTR_PKTNODE); goto inp_unlock6; } - /* Fill in pkt_node data. */ - pkt_node->ip_laddr[0] = inp->in6p_laddr.s6_addr32[0]; - pkt_node->ip_laddr[1] = inp->in6p_laddr.s6_addr32[1]; - pkt_node->ip_laddr[2] = inp->in6p_laddr.s6_addr32[2]; - pkt_node->ip_laddr[3] = inp->in6p_laddr.s6_addr32[3]; - pkt_node->ip_faddr[0] = inp->in6p_faddr.s6_addr32[0]; - pkt_node->ip_faddr[1] = inp->in6p_faddr.s6_addr32[1]; - pkt_node->ip_faddr[2] = inp->in6p_faddr.s6_addr32[2]; - pkt_node->ip_faddr[3] = inp->in6p_faddr.s6_addr32[3]; - pkt_node->tcp_localport = inp->inp_lport; - pkt_node->tcp_foreignport = inp->inp_fport; - pkt_node->snd_cwnd = tp->snd_cwnd; - pkt_node->snd_wnd = tp->snd_wnd; - pkt_node->rcv_wnd = tp->rcv_wnd; - pkt_node->snd_bwnd = tp->snd_bwnd; - pkt_node->snd_ssthresh = tp->snd_ssthresh; - pkt_node->snd_scale = tp->snd_scale; - pkt_node->rcv_scale = tp->rcv_scale; - pkt_node->conn_state = tp->t_state; - pkt_node->max_seg_size = tp->t_maxseg; - pkt_node->smoothed_rtt = tp->t_srtt; - pkt_node->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0; - pkt_node->flags = tp->t_flags; - pkt_node->rxt_length = tp->t_rxtcur; - pkt_node->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat; - pkt_node->snd_buf_cc = inp->inp_socket->so_snd.sb_cc; - pkt_node->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat; - pkt_node->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc; - pkt_node->sent_inflight_bytes = tp->snd_max - tp->snd_una; + pn = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE, M_NOWAIT|M_ZERO); - /* We've finished accessing the tcb so release the lock. */ - if (inp_locally_locked) - INP_RUNLOCK(inp); + if (pn == NULL) { + if (dir == PFIL_IN) + ss->nskip_in_malloc++; + else + ss->nskip_out_malloc++; - /* These are safe to access without the inp lock. */ - pkt_node->ipver = INP_IPV6; - pkt_node->direction = dir; + goto inp_unlock6; + } - /* - * Significantly more accurate than using getmicrotime(), but slower! - * Gives true microsecond resolution at the expense of a hit to - * maximum pps throughput processing when SIFTR is loaded and enabled. - */ - microtime(&(pkt_node->tval)); + siftr_siftdata(pn, inp, tp, INP_IPV6, dir, inp_locally_locked); - /* XXX: Figure out how to do hash calcs for IPv6 */ + /* XXX: Figure out how to generate hashes for IPv6 packets. */ mtx_lock(&siftr_pkt_queue_mtx); - STAILQ_INSERT_TAIL(&pkt_queue, pkt_node, nodes); + STAILQ_INSERT_TAIL(&pkt_queue, pn, nodes); mtx_unlock(&siftr_pkt_queue_mtx); goto ret6; From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 10:21:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3389106564A; Sat, 6 Nov 2010 10:21:46 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D00B78FC1D; Sat, 6 Nov 2010 10:21: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 oA6ALkYZ026689; Sat, 6 Nov 2010 10:21:46 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6ALk7x026686; Sat, 6 Nov 2010 10:21:46 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061021.oA6ALk7x026686@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 10:21:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214864 - in stable/8: share/man/man4 sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 10:21:47 -0000 Author: lstewart Date: Sat Nov 6 10:21:46 2010 New Revision: 214864 URL: http://svn.freebsd.org/changeset/base/214864 Log: MFC r213162: Log the number of segments currently in the reassembly queue. Sponsored by: FreeBSD Foundation Modified: stable/8/share/man/man4/siftr.4 stable/8/sys/netinet/siftr.c Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man1/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man8/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man4/siftr.4 ============================================================================== --- stable/8/share/man/man4/siftr.4 Sat Nov 6 10:17:43 2010 (r214863) +++ stable/8/share/man/man4/siftr.4 Sat Nov 6 10:21:46 2010 (r214864) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2010 +.Dd September 25, 2010 .Dt SIFTR 4 .Os .Sh NAME @@ -198,7 +198,7 @@ The data is CSV formatted. .Bd -literal -offset indent o,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\ 1073725440,172312,6144,66560,66608,8,1,4,1448,936,1,996,255, \\ -33304,208,66608,0,208 +33304,208,66608,0,208,0 .Ed .Pp Field descriptions are as follows: @@ -328,6 +328,10 @@ The current number of bytes in the socke The current number of unacknowledged bytes in-flight. Bytes acknowledged via SACK are not excluded from this count. .El +.Bl -tag -offset indent +.It Va 26 +The current number of segments in the reassembly queue. +.El .Pp The third type of log message is written to the file when the module is disabled and ceases collecting data from the running kernel. Modified: stable/8/sys/netinet/siftr.c ============================================================================== --- stable/8/sys/netinet/siftr.c Sat Nov 6 10:17:43 2010 (r214863) +++ stable/8/sys/netinet/siftr.c Sat Nov 6 10:21:46 2010 (r214864) @@ -55,7 +55,7 @@ * SIFTR should be directed to him via email: lastewart@swin.edu.au * * Initial release date: June 2007 - * Most recent update: June 2010 + * Most recent update: September 2010 ******************************************************/ #include @@ -105,7 +105,7 @@ __FBSDID("$FreeBSD$"); */ #define V_MAJOR 1 #define V_BACKBREAK 2 -#define V_BACKCOMPAT 3 +#define V_BACKCOMPAT 4 #define MODVERSION __CONCAT(V_MAJOR, __CONCAT(V_BACKBREAK, V_BACKCOMPAT)) #define MODVERSION_STR __XSTRING(V_MAJOR) "." __XSTRING(V_BACKBREAK) "." \ __XSTRING(V_BACKCOMPAT) @@ -226,6 +226,8 @@ struct pkt_node { u_int rcv_buf_cc; /* Number of bytes inflight that we are waiting on ACKs for. */ u_int sent_inflight_bytes; + /* Number of segments currently in the reassembly queue. */ + int t_segqlen; /* Link to next pkt_node in the list. */ STAILQ_ENTRY(pkt_node) nodes; }; @@ -442,7 +444,7 @@ siftr_process_pkt(struct pkt_node * pkt_ MAX_LOG_MSG_LEN, "%c,0x%08x,%zd.%06ld,%x:%x:%x:%x:%x:%x:%x:%x,%u,%x:%x:%x:" "%x:%x:%x:%x:%x,%u,%ld,%ld,%ld,%ld,%ld,%u,%u,%u,%u,%u,%u," - "%u,%d,%u,%u,%u,%u,%u\n", + "%u,%d,%u,%u,%u,%u,%u,%u\n", direction[pkt_node->direction], pkt_node->hash, pkt_node->tval.tv_sec, @@ -482,7 +484,8 @@ siftr_process_pkt(struct pkt_node * pkt_ pkt_node->snd_buf_cc, pkt_node->rcv_buf_hiwater, pkt_node->rcv_buf_cc, - pkt_node->sent_inflight_bytes); + pkt_node->sent_inflight_bytes, + pkt_node->t_segqlen); } else { /* IPv4 packet */ pkt_node->ip_laddr[0] = FIRST_OCTET(pkt_node->ip_laddr[3]); pkt_node->ip_laddr[1] = SECOND_OCTET(pkt_node->ip_laddr[3]); @@ -498,7 +501,7 @@ siftr_process_pkt(struct pkt_node * pkt_ log_buf->ae_bytesused = snprintf(log_buf->ae_data, MAX_LOG_MSG_LEN, "%c,0x%08x,%jd.%06ld,%u.%u.%u.%u,%u,%u.%u.%u.%u,%u,%ld,%ld," - "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u\n", + "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u,%u\n", direction[pkt_node->direction], pkt_node->hash, (intmax_t)pkt_node->tval.tv_sec, @@ -530,7 +533,8 @@ siftr_process_pkt(struct pkt_node * pkt_ pkt_node->snd_buf_cc, pkt_node->rcv_buf_hiwater, pkt_node->rcv_buf_cc, - pkt_node->sent_inflight_bytes); + pkt_node->sent_inflight_bytes, + pkt_node->t_segqlen); #ifdef SIFTR_IPV6 } #endif @@ -790,6 +794,7 @@ siftr_siftdata(struct pkt_node *pn, stru pn->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat; pn->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc; pn->sent_inflight_bytes = tp->snd_max - tp->snd_una; + pn->t_segqlen = tp->t_segqlen; /* We've finished accessing the tcb so release the lock. */ if (inp_locally_locked) From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 10:26:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5743106567A; Sat, 6 Nov 2010 10:26:49 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2A158FC15; Sat, 6 Nov 2010 10:26:49 +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 oA6AQn4O027792; Sat, 6 Nov 2010 10:26:49 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6AQnW4027790; Sat, 6 Nov 2010 10:26:49 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061026.oA6AQnW4027790@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 10:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214865 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 10:26:49 -0000 Author: lstewart Date: Sat Nov 6 10:26:49 2010 New Revision: 214865 URL: http://svn.freebsd.org/changeset/base/214865 Log: MFC r213912: - Switch the "net.inet.tcp.reass.cursegments" and "net.inet.tcp.reass.maxsegments" sysctl variables to be based on UMA zone stats. The value returned by the cursegments sysctl is approximate owing to the way in which uma_zone_get_cur is implemented. - Discontinue use of V_tcp_reass_qsize as a global reassembly segment count variable in the reassembly implementation. The variable was used without proper synchronisation and was duplicating accounting done by UMA already. The lack of synchronisation was particularly problematic on SMP systems terminating many TCP sessions, resulting in poor TCP performance for connections with non-zero packet loss. Sponsored by: FreeBSD Foundation Reviewed by: andre, gnn, rpaulo (as part of a larger patch) Modified: stable/8/sys/netinet/tcp_reass.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/tcp_reass.c ============================================================================== --- stable/8/sys/netinet/tcp_reass.c Sat Nov 6 10:21:46 2010 (r214864) +++ stable/8/sys/netinet/tcp_reass.c Sat Nov 6 10:26:49 2010 (r214865) @@ -74,19 +74,22 @@ __FBSDID("$FreeBSD$"); #include #endif /* TCPDEBUG */ +static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS); +static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS); + SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); static VNET_DEFINE(int, tcp_reass_maxseg) = 0; #define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, +SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &VNET_NAME(tcp_reass_maxseg), 0, &tcp_reass_sysctl_maxseg, "I", "Global maximum number of TCP Segments in Reassembly Queue"); static VNET_DEFINE(int, tcp_reass_qsize) = 0; #define V_tcp_reass_qsize VNET(tcp_reass_qsize) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, - &VNET_NAME(tcp_reass_qsize), 0, +SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, + &VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); static VNET_DEFINE(int, tcp_reass_maxqlen) = 48; @@ -148,7 +151,6 @@ tcp_reass_flush(struct tcpcb *tp) m_freem(qe->tqe_m); uma_zfree(V_tcp_reass_zone, qe); tp->t_segqlen--; - V_tcp_reass_qsize--; } KASSERT((tp->t_segqlen == 0), @@ -156,6 +158,20 @@ tcp_reass_flush(struct tcpcb *tp) tp, tp->t_segqlen)); } +static int +tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS) +{ + V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone); + return (sysctl_handle_int(oidp, arg1, arg2, req)); +} + +static int +tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS) +{ + V_tcp_reass_qsize = uma_zone_get_cur(V_tcp_reass_zone); + return (sysctl_handle_int(oidp, arg1, arg2, req)); +} + int tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { @@ -184,12 +200,10 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Limit the number of segments in the reassembly queue to prevent * holding on to too many segments (and thus running out of mbufs). * Make sure to let the missing segment through which caused this - * queue. Always keep one global queue entry spare to be able to - * process the missing segment. + * queue. */ if (th->th_seq != tp->rcv_nxt && - (V_tcp_reass_qsize + 1 >= V_tcp_reass_maxseg || - tp->t_segqlen >= V_tcp_reass_maxqlen)) { + tp->t_segqlen >= V_tcp_reass_maxqlen) { V_tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); @@ -209,7 +223,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd return (0); } tp->t_segqlen++; - V_tcp_reass_qsize++; /* * Find a segment which begins after this one does. @@ -236,7 +249,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd m_freem(m); uma_zfree(V_tcp_reass_zone, te); tp->t_segqlen--; - V_tcp_reass_qsize--; /* * Try to present any queued data * at the left window edge to the user. @@ -273,7 +285,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd m_freem(q->tqe_m); uma_zfree(V_tcp_reass_zone, q); tp->t_segqlen--; - V_tcp_reass_qsize--; q = nq; } @@ -310,7 +321,6 @@ present: sbappendstream_locked(&so->so_rcv, q->tqe_m); uma_zfree(V_tcp_reass_zone, q); tp->t_segqlen--; - V_tcp_reass_qsize--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); ND6_HINT(tp); From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 10:31:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DFCE106566B; Sat, 6 Nov 2010 10:31:52 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B4FE8FC17; Sat, 6 Nov 2010 10:31: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 oA6AVqRa027939; Sat, 6 Nov 2010 10:31:52 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6AVqPr027937; Sat, 6 Nov 2010 10:31:52 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061031.oA6AVqPr027937@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 10:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214866 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 10:31:52 -0000 Author: lstewart Date: Sat Nov 6 10:31:52 2010 New Revision: 214866 URL: http://svn.freebsd.org/changeset/base/214866 Log: MFC r213913: Retire the system-wide, per-reassembly queue segment limit. The mechanism is far too coarse grained to be useful and the default value significantly degrades TCP performance on moderate to high bandwidth-delay product paths with non-zero loss (e.g. 5+Mbps connections across the public Internet often suffer). Replace the outgoing mechanism with an individual per-queue limit based on the number of MSS segments that fit into the socket's receive buffer. This should strike a good balance between performance and the potential for resource exhaustion when FreeBSD is acting as a TCP receiver. With socket buffer autotuning (which is enabled by default), the reassembly queue tracks the socket buffer and benefits too. As the XXX comment suggests, my testing uncovered some unexpected behaviour which requires further investigation. By using so->so_rcv.sb_hiwat instead of sbspace(&so->so_rcv), we allow more segments to be held across both the socket receive buffer and reassembly queue than we probably should. The tradeoff is better performance in at least one common scenario, versus a devious sender's ability to consume more resources on a FreeBSD receiver. Sponsored by: FreeBSD Foundation Reviewed by: andre, gnn, rpaulo Modified: stable/8/sys/netinet/tcp_reass.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/tcp_reass.c ============================================================================== --- stable/8/sys/netinet/tcp_reass.c Sat Nov 6 10:26:49 2010 (r214865) +++ stable/8/sys/netinet/tcp_reass.c Sat Nov 6 10:31:52 2010 (r214866) @@ -92,12 +92,6 @@ SYSCTL_VNET_PROC(_net_inet_tcp_reass, OI &VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxqlen) = 48; -#define V_tcp_reass_maxqlen VNET(tcp_reass_maxqlen) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxqlen, CTLFLAG_RW, - &VNET_NAME(tcp_reass_maxqlen), 0, - "Maximum number of TCP Segments per individual Reassembly Queue"); - static VNET_DEFINE(int, tcp_reass_overflows) = 0; #define V_tcp_reass_overflows VNET(tcp_reass_overflows) SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, @@ -197,13 +191,23 @@ tcp_reass(struct tcpcb *tp, struct tcphd goto present; /* - * Limit the number of segments in the reassembly queue to prevent - * holding on to too many segments (and thus running out of mbufs). - * Make sure to let the missing segment through which caused this - * queue. + * Limit the number of segments that can be queued to reduce the + * potential for mbuf exhaustion. For best performance, we want to be + * able to queue a full window's worth of segments. The size of the + * socket receive buffer determines our advertised window and grows + * automatically when socket buffer autotuning is enabled. Use it as the + * basis for our queue limit. + * Always let the missing segment through which caused this queue. + * NB: Access to the socket buffer is left intentionally unlocked as we + * can tolerate stale information here. + * + * XXXLAS: Using sbspace(so->so_rcv) instead of so->so_rcv.sb_hiwat + * should work but causes packets to be dropped when they shouldn't. + * Investigate why and re-evaluate the below limit after the behaviour + * is understood. */ if (th->th_seq != tp->rcv_nxt && - tp->t_segqlen >= V_tcp_reass_maxqlen) { + tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { V_tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 10:54:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 557061065670; Sat, 6 Nov 2010 10:54:34 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 426E08FC13; Sat, 6 Nov 2010 10:54: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 oA6AsYeC028519; Sat, 6 Nov 2010 10:54:34 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6AsY5o028514; Sat, 6 Nov 2010 10:54:34 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011061054.oA6AsY5o028514@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 6 Nov 2010 10:54: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: r214867 - in head: lib/libarchive lib/libpmc usr.bin/setchannel X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 10:54:34 -0000 Author: uqs Date: Sat Nov 6 10:54:33 2010 New Revision: 214867 URL: http://svn.freebsd.org/changeset/base/214867 Log: Fix manpage markup. Modified: head/lib/libarchive/libarchive_internals.3 head/lib/libpmc/pmc.mips.3 head/lib/libpmc/pmc.xscale.3 head/usr.bin/setchannel/setchannel.1 Modified: head/lib/libarchive/libarchive_internals.3 ============================================================================== --- head/lib/libarchive/libarchive_internals.3 Sat Nov 6 10:31:52 2010 (r214866) +++ head/lib/libarchive/libarchive_internals.3 Sat Nov 6 10:54:33 2010 (r214867) @@ -363,4 +363,3 @@ The .Nm libarchive library was written by .An Tim Kientzle Aq kientzle@acm.org . -.Sh BUGS Modified: head/lib/libpmc/pmc.mips.3 ============================================================================== --- head/lib/libpmc/pmc.mips.3 Sat Nov 6 10:31:52 2010 (r214866) +++ head/lib/libpmc/pmc.mips.3 Sat Nov 6 10:54:33 2010 (r214867) @@ -24,8 +24,8 @@ .\" $FreeBSD$ .\" .Dd February 11, 2010 -.Os .Dt PMC.MIPS 3 +.Os .Sh NAME .Nm pmc.mips .Nd measurement events for @@ -123,7 +123,6 @@ Counts every time the instruction cache wasted fetches etc. are counted. For example, following a branch, even though the prediction is taken, the fall through access is counted. - .It Li IC_MISS .Pq Event 9, Counter 1 Counts all instruction cache misses that result in a bus request. Modified: head/lib/libpmc/pmc.xscale.3 ============================================================================== --- head/lib/libpmc/pmc.xscale.3 Sat Nov 6 10:31:52 2010 (r214866) +++ head/lib/libpmc/pmc.xscale.3 Sat Nov 6 10:54:33 2010 (r214867) @@ -24,8 +24,8 @@ .\" $FreeBSD$ .\" .Dd December 23, 2009 -.Os .Dt PMC.XSCALE 3 +.Os .Sh NAME .Nm pmc.xscale .Nd measurement events for Modified: head/usr.bin/setchannel/setchannel.1 ============================================================================== --- head/usr.bin/setchannel/setchannel.1 Sat Nov 6 10:31:52 2010 (r214866) +++ head/usr.bin/setchannel/setchannel.1 Sat Nov 6 10:54:33 2010 (r214867) @@ -1,32 +1,32 @@ +.\"- +.\" Copyright (C) 2004-2006 The FreeBSD Project. 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 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 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. .\" -.\ Copyright (C) 2004-2006 The FreeBSD Project. 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 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 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. -.\ .\" $Id: cxm.4,v 1.1 2004/10/16 00:12:35 mavetju Exp $ .\" $FreeBSD$ .\" .Dd November 30, 2006 -.Dt pvr250-setchannel 1 +.Dt PVR250-SETCHANNEL 1 .Os .Sh NAME .Nm pvr250-setchannel @@ -48,10 +48,10 @@ Disable AFC. .It Fl c Select composite input. .It Fl d -Select the tuner unit number. -This is appended to the base device file name +Select the tuner unit number. +This is appended to the base device file name .Pa /dev/cxm -to form a device name such as +to form a device name such as .Pa /dev/cxm0 or .Pa /dev/cxm1 . From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 11:09:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A02C106566B; Sat, 6 Nov 2010 11:09:05 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 070A98FC14; Sat, 6 Nov 2010 11:09: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 oA6B94Wa028876; Sat, 6 Nov 2010 11:09:04 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6B94ba028873; Sat, 6 Nov 2010 11:09:04 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061109.oA6B94ba028873@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 11:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214868 - in stable/7/sys: kern modules modules/alq X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 11:09:05 -0000 Author: lstewart Date: Sat Nov 6 11:09:04 2010 New Revision: 214868 URL: http://svn.freebsd.org/changeset/base/214868 Log: MFC r205959: Add support for ALQ(9) to be compiled and loaded as a kernel module. Sponsored by: FreeBSD Foundation Reviewed by: dwmalone, jeff, rpaulo, rwatson Added: stable/7/sys/modules/alq/ - copied from r205959, head/sys/modules/alq/ Modified: stable/7/sys/kern/kern_alq.c stable/7/sys/modules/Makefile Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/kern_alq.c ============================================================================== --- stable/7/sys/kern/kern_alq.c Sat Nov 6 10:54:33 2010 (r214867) +++ stable/7/sys/kern/kern_alq.c Sat Nov 6 11:09:04 2010 (r214868) @@ -1,7 +1,13 @@ /*- * Copyright (c) 2002, Jeffrey Roberson + * Copyright (c) 2008-2009, Lawrence Stewart + * Copyright (c) 2009-2010, The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed at the Centre for Advanced + * Internet Architectures, Swinburne University of Technology, Melbourne, + * Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -182,9 +188,16 @@ ald_daemon(void) ALD_LOCK(); for (;;) { - while ((alq = LIST_FIRST(&ald_active)) == NULL) + while ((alq = LIST_FIRST(&ald_active)) == NULL && + !ald_shutingdown) msleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0); + /* Don't shutdown until all active ALQs are flushed. */ + if (ald_shutingdown && alq == NULL) { + ALD_UNLOCK(); + break; + } + ALQ_LOCK(alq); ald_deactivate(alq); ALD_UNLOCK(); @@ -194,6 +207,8 @@ ald_daemon(void) wakeup(alq); ALD_LOCK(); } + + kproc_exit(0); } static void @@ -202,14 +217,29 @@ ald_shutdown(void *arg, int howto) struct alq *alq; ALD_LOCK(); + + /* Ensure no new queues can be created. */ ald_shutingdown = 1; + /* Shutdown all ALQs prior to terminating the ald_daemon. */ while ((alq = LIST_FIRST(&ald_queues)) != NULL) { LIST_REMOVE(alq, aq_link); ALD_UNLOCK(); alq_shutdown(alq); ALD_LOCK(); } + + /* At this point, all ALQs are flushed and shutdown. */ + + /* + * Wake ald_daemon so that it exits. It won't be able to do + * anything until we msleep because we hold the ald_mtx. + */ + wakeup(&ald_active); + + /* Wait for ald_daemon to exit. */ + msleep(ald_proc, &ald_mtx, PWAIT, "aldslp", 0); + ALD_UNLOCK(); } @@ -517,3 +547,53 @@ alq_close(struct alq *alq) free(alq->aq_entbuf, M_ALD); free(alq, M_ALD); } + +static int +alq_load_handler(module_t mod, int what, void *arg) +{ + int ret; + + ret = 0; + + switch (what) { + case MOD_LOAD: + case MOD_SHUTDOWN: + break; + + case MOD_QUIESCE: + ALD_LOCK(); + /* Only allow unload if there are no open queues. */ + if (LIST_FIRST(&ald_queues) == NULL) { + ald_shutingdown = 1; + ALD_UNLOCK(); + ald_shutdown(NULL, 0); + mtx_destroy(&ald_mtx); + } else { + ALD_UNLOCK(); + ret = EBUSY; + } + break; + + case MOD_UNLOAD: + /* If MOD_QUIESCE failed we must fail here too. */ + if (ald_shutingdown == 0) + ret = EBUSY; + break; + + default: + ret = EINVAL; + break; + } + + return (ret); +} + +static moduledata_t alq_mod = +{ + "alq", + alq_load_handler, + NULL +}; + +DECLARE_MODULE(alq, alq_mod, SI_SUB_SMP, SI_ORDER_ANY); +MODULE_VERSION(alq, 1); Modified: stable/7/sys/modules/Makefile ============================================================================== --- stable/7/sys/modules/Makefile Sat Nov 6 10:54:33 2010 (r214867) +++ stable/7/sys/modules/Makefile Sat Nov 6 11:09:04 2010 (r214868) @@ -18,6 +18,7 @@ SUBDIR= ${_3dfx} \ aio \ alc \ ale \ + alq \ ${_amd} \ ${_amdsbwd} \ ${_amdtemp} \ From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 11:17:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E810C106564A; Sat, 6 Nov 2010 11:17:30 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBA9B8FC15; Sat, 6 Nov 2010 11:17:30 +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 oA6BHUXT029086; Sat, 6 Nov 2010 11:17:30 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6BHU1J029084; Sat, 6 Nov 2010 11:17:30 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061117.oA6BHU1J029084@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 11:17:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214869 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 11:17:31 -0000 Author: lstewart Date: Sat Nov 6 11:17:30 2010 New Revision: 214869 URL: http://svn.freebsd.org/changeset/base/214869 Log: MFC r206026: - Factor code to destroy an ALQ out of alq_close() into a private alq_destroy(). - Use the new alq_destroy() to properly handle a failure case in alq_open(). Sponsored by: FreeBSD Foundation Reviewed by: dwmalone, jeff, rpaulo, rwatson (as part of a larger patch) Modified: stable/7/sys/kern/kern_alq.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/kern_alq.c ============================================================================== --- stable/7/sys/kern/kern_alq.c Sat Nov 6 11:09:04 2010 (r214868) +++ stable/7/sys/kern/kern_alq.c Sat Nov 6 11:17:30 2010 (r214869) @@ -103,6 +103,7 @@ static void ald_deactivate(struct alq *) /* Internal queue functions */ static void alq_shutdown(struct alq *); +static void alq_destroy(struct alq *); static int alq_doio(struct alq *); @@ -265,6 +266,18 @@ alq_shutdown(struct alq *alq) crfree(alq->aq_cred); } +void +alq_destroy(struct alq *alq) +{ + /* Drain all pending IO. */ + alq_shutdown(alq); + + mtx_destroy(&alq->aq_mtx); + free(alq->aq_first, M_ALD); + free(alq->aq_entbuf, M_ALD); + free(alq, M_ALD); +} + /* * Flush all pending data to disk. This operation will block. */ @@ -423,8 +436,11 @@ alq_open(struct alq **alqp, const char * alp->ae_next = alq->aq_first; - if ((error = ald_add(alq)) != 0) + if ((error = ald_add(alq)) != 0) { + alq_destroy(alq); return (error); + } + *alqp = alq; return (0); @@ -530,22 +546,9 @@ alq_flush(struct alq *alq) void alq_close(struct alq *alq) { - /* - * If we're already shuting down someone else will flush and close - * the vnode. - */ - if (ald_rem(alq) != 0) - return; - - /* - * Drain all pending IO. - */ - alq_shutdown(alq); - - mtx_destroy(&alq->aq_mtx); - free(alq->aq_first, M_ALD); - free(alq->aq_entbuf, M_ALD); - free(alq, M_ALD); + /* Only flush and destroy alq if not already shutting down. */ + if (ald_rem(alq) == 0) + alq_destroy(alq); } static int From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 11:20:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 301F51065670; Sat, 6 Nov 2010 11:20:21 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DE5F8FC1C; Sat, 6 Nov 2010 11:20: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 oA6BKLax029188; Sat, 6 Nov 2010 11:20:21 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6BKLxD029186; Sat, 6 Nov 2010 11:20:21 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061120.oA6BKLxD029186@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 11:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214870 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 11:20:21 -0000 Author: lstewart Date: Sat Nov 6 11:20:20 2010 New Revision: 214870 URL: http://svn.freebsd.org/changeset/base/214870 Log: MFC r206027: According to SLEEP(9), msleep() is deprecated in favour of mtx_sleep(). Sponsored by: FreeBSD Foundation Reviewed by: dwmalone, jeff, rpaulo, rwatson (as part of a larger patch) Modified: stable/7/sys/kern/kern_alq.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/kern_alq.c ============================================================================== --- stable/7/sys/kern/kern_alq.c Sat Nov 6 11:17:30 2010 (r214869) +++ stable/7/sys/kern/kern_alq.c Sat Nov 6 11:20:20 2010 (r214870) @@ -191,7 +191,7 @@ ald_daemon(void) for (;;) { while ((alq = LIST_FIRST(&ald_active)) == NULL && !ald_shutingdown) - msleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0); + mtx_sleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0); /* Don't shutdown until all active ALQs are flushed. */ if (ald_shutingdown && alq == NULL) { @@ -234,12 +234,12 @@ ald_shutdown(void *arg, int howto) /* * Wake ald_daemon so that it exits. It won't be able to do - * anything until we msleep because we hold the ald_mtx. + * anything until we mtx_sleep because we hold the ald_mtx. */ wakeup(&ald_active); /* Wait for ald_daemon to exit. */ - msleep(ald_proc, &ald_mtx, PWAIT, "aldslp", 0); + mtx_sleep(ald_proc, &ald_mtx, PWAIT, "aldslp", 0); ALD_UNLOCK(); } From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 11:23:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FE5D106566B; Sat, 6 Nov 2010 11:23:46 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DD478FC15; Sat, 6 Nov 2010 11:23: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 oA6BNkg3029315; Sat, 6 Nov 2010 11:23:46 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6BNkq6029313; Sat, 6 Nov 2010 11:23:46 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061123.oA6BNkq6029313@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 11:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214871 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 11:23:46 -0000 Author: lstewart Date: Sat Nov 6 11:23:46 2010 New Revision: 214871 URL: http://svn.freebsd.org/changeset/base/214871 Log: MFC r206028: The ALQ should not be considered drained until it has been made inactive. Sponsored by: FreeBSD Foundation Reviewed by: dwmalone, jeff, rpaulo, rwatson (as part of a larger patch) Modified: stable/7/sys/kern/kern_alq.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/kern_alq.c ============================================================================== --- stable/7/sys/kern/kern_alq.c Sat Nov 6 11:20:20 2010 (r214870) +++ stable/7/sys/kern/kern_alq.c Sat Nov 6 11:23:46 2010 (r214871) @@ -253,7 +253,7 @@ alq_shutdown(struct alq *alq) alq->aq_flags |= AQ_SHUTDOWN; /* Drain IO */ - while (alq->aq_flags & (AQ_FLUSHING|AQ_ACTIVE)) { + while (alq->aq_flags & AQ_ACTIVE) { alq->aq_flags |= AQ_WANTED; ALQ_UNLOCK(alq); tsleep(alq, PWAIT, "aldclose", 0); From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 11:38:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC832106564A; Sat, 6 Nov 2010 11:38:40 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C89B38FC08; Sat, 6 Nov 2010 11:38: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 oA6Bce7v029654; Sat, 6 Nov 2010 11:38:40 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6BceFi029650; Sat, 6 Nov 2010 11:38:40 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061138.oA6BceFi029650@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 11:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214872 - in stable/7: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 11:38:41 -0000 Author: lstewart Date: Sat Nov 6 11:38:40 2010 New Revision: 214872 URL: http://svn.freebsd.org/changeset/base/214872 Log: MFC r207223: - Rework the underlying ALQ storage to be a circular buffer, which amongst other things allows variable length messages to be easily supported. - Extend KPI with alq_writen() and alq_getn() to support variable length messages, which is enabled at ALQ creation time depending on the arguments passed to alq_open(). Also add variants of alq_open() and alq_post() that accept a flags argument. The KPI is still fully backwards compatible and shouldn't require any change in ALQ consumers unless they wish to utilise the new features. - Introduce the ALQ_NOACTIVATE and ALQ_ORDERED flags to allow ALQ consumers to have more control over IO scheduling and resource acquisition respectively. - Strengthen invariants checking. - Document ALQ changes in ALQ(9) man page. Sponsored by: FreeBSD Foundation Reviewed by: gnn, jeff, rpaulo, rwatson Modified: stable/7/share/man/man9/alq.9 stable/7/sys/kern/kern_alq.c stable/7/sys/sys/alq.h Directory Properties: stable/7/share/man/ (props changed) stable/7/share/man/man1/ (props changed) stable/7/share/man/man3/ (props changed) stable/7/share/man/man4/ (props changed) stable/7/share/man/man5/ (props changed) stable/7/share/man/man7/ (props changed) stable/7/share/man/man8/ (props changed) stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man9/alq.9 ============================================================================== --- stable/7/share/man/man9/alq.9 Sat Nov 6 11:23:46 2010 (r214871) +++ stable/7/share/man/man9/alq.9 Sat Nov 6 11:38:40 2010 (r214872) @@ -1,7 +1,13 @@ .\" .\" Copyright (c) 2003 Hiten Pandya +.\" Copyright (c) 2009-2010 The FreeBSD Foundation .\" All rights reserved. .\" +.\" Portions of this software were developed at the Centre for Advanced +.\" Internet Architectures, Swinburne University of Technology, Melbourne, +.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD +.\" Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -25,21 +31,34 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2003 +.Dd April 26, 2010 .Dt ALQ 9 .Os .Sh NAME .Nm alq , +.Nm alq_open_flags , .Nm alq_open , +.Nm alq_writen , .Nm alq_write , .Nm alq_flush , .Nm alq_close , +.Nm alq_getn , .Nm alq_get , +.Nm alq_post_flags , .Nm alq_post .Nd Asynchronous Logging Queues .Sh SYNOPSIS .In sys/alq.h .Ft int +.Fo alq_open_flags +.Fa "struct alq **app" +.Fa "const char *file" +.Fa "struct ucred *cred" +.Fa "int cmode" +.Fa "int size" +.Fa "int flags" +.Fc +.Ft int .Fo alq_open .Fa "struct alq **app" .Fa "const char *file" @@ -49,19 +68,25 @@ .Fa "int count" .Fc .Ft int -.Fn alq_write "struct alq *alq" "void *data" "int waitok" +.Fn alq_writen "struct alq *alq" "void *data" "int len" "int flags" +.Ft int +.Fn alq_write "struct alq *alq" "void *data" "int flags" .Ft void .Fn alq_flush "struct alq *alq" .Ft void .Fn alq_close "struct alq *alq" .Ft struct ale * -.Fn alq_get "struct alq *alq" "int waitok" +.Fn alq_getn "struct alq *alq" "int len" "int flags" +.Ft struct ale * +.Fn alq_get "struct alq *alq" "int flags" +.Ft void +.Fn alq_post_flags "struct alq *alq" "struct ale *ale" "int flags" .Ft void .Fn alq_post "struct alq *alq" "struct ale *ale" .Sh DESCRIPTION The .Nm -facility provides an asynchronous fixed length recording +facility provides an asynchronous fixed or variable length recording mechanism, known as Asynchronous Logging Queues. It can record to any .Xr vnode 9 , @@ -81,26 +106,37 @@ is defined as which has the following members: .Bd -literal -offset indent struct ale { - struct ale *ae_next; /* Next Entry */ - char *ae_data; /* Entry buffer */ - int ae_flags; /* Entry flags */ + intptr_t ae_bytesused; /* # bytes written to ALE. */ + char *ae_data; /* Write ptr. */ + int ae_pad; /* Unused, compat. */ }; .Ed .Pp -The -.Va ae_flags -field is for internal use, clients of the +An .Nm -interface should not modify this field. -Behaviour is undefined if this field is modified. +can be created in either fixed or variable length mode. +A variable length +.Nm +accommodates writes of varying length using +.Fn alq_writen +and +.Fn alq_getn . +A fixed length +.Nm +accommodates a fixed number of writes using +.Fn alq_write +and +.Fn alq_get , +each of fixed size (set at queue creation time). +Fixed length mode is deprecated in favour of variable length mode. .Sh FUNCTIONS The -.Fn alq_open -function creates a new logging queue. +.Fn alq_open_flags +function creates a new variable length asynchronous logging queue. The .Fa file -argument is the name of the file to open for logging; if the file does not -yet exist, +argument is the name of the file to open for logging. +If the file does not yet exist, .Fn alq_open will attempt to create it. The @@ -112,33 +148,99 @@ as the requested creation mode, to be us Consumers of this API may wish to pass .Dv ALQ_DEFAULT_CMODE , a default creation mode suitable for most applications. -The argument +The .Fa cred -specifies the credentials to use when opening and performing I/O on the file. -The size of each entry in the queue is determined by -.Fa size . +argument specifies the credentials to use when opening and performing I/O on the file. The +.Fa size +argument sets the size (in bytes) of the underlying queue. +The ALQ_ORDERED flag may be passed in via +.Fa flags +to indicate that the ordering of writer threads waiting for a busy +.Nm +to free up resources should be preserved. +.Pp +The deprecated +.Fn alq_open +function is implemented as a wrapper around +.Fn alq_open_flags +to provide backwards compatibility to consumers that have not been updated to +utilise the newer +.Fn alq_open_flags +function. +It passes all arguments through to +.Fn alq_open_flags +untouched except for +.Fa size +and +.Fa count , +and sets +.Fa flags +to 0. +To create a variable length mode +.Nm , +the +.Fa size +argument should be set to the size (in bytes) of the underlying queue and the +.Fa count +argument should be set to 0. +To create a fixed length mode +.Nm , +the +.Fa size +argument should be set to the size (in bytes) of each write and the .Fa count -argument determines the number of items to be stored in the -asynchronous queue over an approximate period of a disk -write operation. +argument should be set to the number of +.Fa size +byte chunks to reserve capacity for. .Pp The -.Fn alq_write +.Fn alq_writen function writes +.Fa len +bytes from .Fa data -to the designated queue, +to the designated variable length mode queue .Fa alq . -In the event that -.Fn alq_write -could not write the entry immediately, and +If +.Fn alq_writen +could not write the entry immediately and .Dv ALQ_WAITOK -is passed to -.Fa waitok , -then +is set in +.Fa flags , +the function will be allowed to +.Xr msleep_spin 9 +with the +.Dq Li alqwnord +or +.Dq Li alqwnres +wait message. +A write will automatically schedule the queue +.Fa alq +to be flushed to disk. +This behaviour can be controlled by passing ALQ_NOACTIVATE via +.Fa flags +to indicate that the write should not schedule +.Fa alq +to be flushed to disk. +.Pp +The deprecated +.Fn alq_write +function is implemented as a wrapper around +.Fn alq_writen +to provide backwards compatibility to consumers that have not been updated to +utilise variable length mode queues. +The function will write +.Fa size +bytes of data (where +.Fa size +was specified at queue creation time) from the +.Fa data +buffer to the +.Fa alq . +Note that it is an error to call .Fn alq_write -will be allowed to -.Xr tsleep 9 . +on a variable length mode queue. .Pp The .Fn alq_flush @@ -146,61 +248,136 @@ function is used for flushing .Fa alq to the log medium that was passed to .Fn alq_open . +If +.Fa alq +has data to flush and is not already in the process of being flushed, the +function will block doing IO. +Otherwise, the function will return immediately. .Pp The .Fn alq_close -function will close the asynchronous logging queue, -.Fa alq , +function will close the asynchronous logging queue +.Fa alq and flush all pending write requests to the log medium. It will free all resources that were previously allocated. .Pp The -.Fn alq_get -function returns the next available asynchronous logging entry -from the queue, -.Fa alq . -This function leaves the queue in a locked state, until a subsequent +.Fn alq_getn +function returns an asynchronous log entry from +.Fa alq , +initialised to point at a buffer capable of receiving +.Fa len +bytes of data. +This function leaves +.Fa alq +in a locked state, until a subsequent .Fn alq_post +or +.Fn alq_post_flags call is made. -In the event that -.Fn alq_get -could not retrieve an entry immediately, it will -.Xr tsleep 9 +If +.Fn alq_getn +could not obtain +.Fa len +bytes of buffer immediately and +.Dv ALQ_WAITOK +is set in +.Fa flags , +the function will be allowed to +.Xr msleep_spin 9 with the -.Dq Li alqget +.Dq Li alqgnord +or +.Dq Li alqgnres wait message. +The caller can choose to write less than +.Fa len +bytes of data to the returned asynchronous log entry by setting the entry's +ae_bytesused field to the number of bytes actually written. +This must be done prior to calling +.Fn alq_post . .Pp -The -.Fn alq_post -function schedules the asynchronous logging entry, -.Fa ale , -which is retrieved using the +The deprecated .Fn alq_get -function, -for writing to the asynchronous logging queue, +function is implemented as a wrapper around +.Fn alq_getn +to provide backwards compatibility to consumers that have not been updated to +utilise variable length mode queues. +The asynchronous log entry returned will be initialised to point at a buffer +capable of receiving +.Fa size +bytes of data (where +.Fa size +was specified at queue creation time). +Note that it is an error to call +.Fn alq_get +on a variable length mode queue. +.Pp +The +.Fn alq_post_flags +function schedules the asynchronous log entry +.Fa ale +(obtained from +.Fn alq_getn +or +.Fn alq_get ) +for writing to .Fa alq . -This function leaves the queue, -.Fa alq , +The ALQ_NOACTIVATE flag may be passed in via +.Fa flags +to indicate that the queue should not be immediately scheduled to be flushed to +disk. +This function leaves +.Fa alq in an unlocked state. +.Pp +The +.Fn alq_post +function is implemented as a wrapper around +.Fn alq_post_flags +to provide backwards compatibility to consumers that have not been updated to +utilise the newer +.Fn alq_post_flags +function. +It simply passes all arguments through to +.Fn alq_post_flags +untouched, and sets +.Fa flags +to 0. .Sh IMPLEMENTATION NOTES The +.Fn alq_writen +and .Fn alq_write -function is a wrapper around the +functions both perform a +.Xr bcopy 3 +from the supplied +.Fa data +buffer into the underlying +.Nm +buffer. +Performance critical code paths may wish to consider using +.Fn alq_getn +(variable length queues) or +.Fn alq_get +(fixed length queues) to avoid the extra memory copy. Note that a queue +remains locked between calls to +.Fn alq_getn +or .Fn alq_get and .Fn alq_post -functions; by using these functions separately, a call -to -.Fn bcopy -can be avoided for performance critical code paths. +or +.Fn alq_post_flags , +so this method of writing to a queue is unsuitable for situations where the +time between calls may be substantial. .Sh LOCKING -Each asynchronous queue is protected by a spin mutex. +Each asynchronous logging queue is protected by a spin mutex. .Pp Functions -.Fn alq_flush , -.Fn alq_open +.Fn alq_flush and -.Fn alq_post +.Fn alq_open may attempt to acquire an internal sleep mutex, and should consequently not be used in contexts where sleeping is not allowed. @@ -214,32 +391,36 @@ if it fails to open or else it returns 0. .Pp The +.Fn alq_writen +and .Fn alq_write -function returns +functions return .Er EWOULDBLOCK if .Dv ALQ_NOWAIT -was provided as a value to -.Fa waitok -and either the queue is full, or when the system is shutting down. +was set in +.Fa flags +and either the queue is full or the system is shutting down. .Pp The +.Fn alq_getn +and .Fn alq_get -function returns -.Dv NULL , +functions return +.Dv NULL if .Dv ALQ_NOWAIT -was provided as a value to -.Fa waitok -and either the queue is full, or when the system is shutting down. +was set in +.Fa flags +and either the queue is full or the system is shutting down. .Pp NOTE: invalid arguments to non-void functions will result in undefined behaviour. .Sh SEE ALSO -.Xr syslog 3 , -.Xr kthread 9 , +.Xr kproc 9 , .Xr ktr 9 , -.Xr tsleep 9 , +.Xr msleep_spin 9 , +.Xr syslog 3 , .Xr vnode 9 .Sh HISTORY The @@ -250,7 +431,11 @@ Asynchronous Logging Queues (ALQ) facili The .Nm facility was written by -.An Jeffrey Roberson Aq jeff@FreeBSD.org . +.An Jeffrey Roberson Aq jeff@FreeBSD.org +and extended by +.An Lawrence Stewart Aq lstewart@freebsd.org . .Pp This manual page was written by -.An Hiten Pandya Aq hmp@FreeBSD.org . +.An Hiten Pandya Aq hmp@FreeBSD.org +and revised by +.An Lawrence Stewart Aq lstewart@freebsd.org . Modified: stable/7/sys/kern/kern_alq.c ============================================================================== --- stable/7/sys/kern/kern_alq.c Sat Nov 6 11:23:46 2010 (r214871) +++ stable/7/sys/kern/kern_alq.c Sat Nov 6 11:38:40 2010 (r214872) @@ -55,16 +55,23 @@ __FBSDID("$FreeBSD$"); /* Async. Logging Queue */ struct alq { + char *aq_entbuf; /* Buffer for stored entries */ int aq_entmax; /* Max entries */ int aq_entlen; /* Entry length */ - char *aq_entbuf; /* Buffer for stored entries */ + int aq_freebytes; /* Bytes available in buffer */ + int aq_buflen; /* Total length of our buffer */ + int aq_writehead; /* Location for next write */ + int aq_writetail; /* Flush starts at this location */ + int aq_wrapearly; /* # bytes left blank at end of buf */ int aq_flags; /* Queue flags */ + int aq_waiters; /* Num threads waiting for resources + * NB: Used as a wait channel so must + * not be first field in the alq struct + */ + struct ale aq_getpost; /* ALE for use by get/post */ struct mtx aq_mtx; /* Queue lock */ struct vnode *aq_vp; /* Open vnode handle */ struct ucred *aq_cred; /* Credentials of the opening thread */ - struct ale *aq_first; /* First ent */ - struct ale *aq_entfree; /* First free ent */ - struct ale *aq_entvalid; /* First ent valid for writing */ LIST_ENTRY(alq) aq_act; /* List of active queues */ LIST_ENTRY(alq) aq_link; /* List of all queues */ }; @@ -73,10 +80,14 @@ struct alq { #define AQ_ACTIVE 0x0002 /* on the active list */ #define AQ_FLUSHING 0x0004 /* doing IO */ #define AQ_SHUTDOWN 0x0008 /* Queue no longer valid */ +#define AQ_ORDERED 0x0010 /* Queue enforces ordered writes */ +#define AQ_LEGACY 0x0020 /* Legacy queue (fixed length writes) */ #define ALQ_LOCK(alq) mtx_lock_spin(&(alq)->aq_mtx) #define ALQ_UNLOCK(alq) mtx_unlock_spin(&(alq)->aq_mtx) +#define HAS_PENDING_DATA(alq) ((alq)->aq_freebytes != (alq)->aq_buflen) + static MALLOC_DEFINE(M_ALD, "ALD", "ALD"); /* @@ -205,7 +216,7 @@ ald_daemon(void) needwakeup = alq_doio(alq); ALQ_UNLOCK(alq); if (needwakeup) - wakeup(alq); + wakeup_one(alq); ALD_LOCK(); } @@ -252,6 +263,20 @@ alq_shutdown(struct alq *alq) /* Stop any new writers. */ alq->aq_flags |= AQ_SHUTDOWN; + /* + * If the ALQ isn't active but has unwritten data (possible if + * the ALQ_NOACTIVATE flag has been used), explicitly activate the + * ALQ here so that the pending data gets flushed by the ald_daemon. + */ + if (!(alq->aq_flags & AQ_ACTIVE) && HAS_PENDING_DATA(alq)) { + alq->aq_flags |= AQ_ACTIVE; + ALQ_UNLOCK(alq); + ALD_LOCK(); + ald_activate(alq); + ALD_UNLOCK(); + ALQ_LOCK(alq); + } + /* Drain IO */ while (alq->aq_flags & AQ_ACTIVE) { alq->aq_flags |= AQ_WANTED; @@ -273,7 +298,6 @@ alq_destroy(struct alq *alq) alq_shutdown(alq); mtx_destroy(&alq->aq_mtx); - free(alq->aq_first, M_ALD); free(alq->aq_entbuf, M_ALD); free(alq, M_ALD); } @@ -289,46 +313,54 @@ alq_doio(struct alq *alq) struct vnode *vp; struct uio auio; struct iovec aiov[2]; - struct ale *ale; - struct ale *alstart; int totlen; int iov; int vfslocked; + int wrapearly; + + KASSERT((HAS_PENDING_DATA(alq)), ("%s: queue empty!", __func__)); vp = alq->aq_vp; td = curthread; totlen = 0; - iov = 0; - - alstart = ale = alq->aq_entvalid; - alq->aq_entvalid = NULL; + iov = 1; + wrapearly = alq->aq_wrapearly; bzero(&aiov, sizeof(aiov)); bzero(&auio, sizeof(auio)); - do { - if (aiov[iov].iov_base == NULL) - aiov[iov].iov_base = ale->ae_data; - aiov[iov].iov_len += alq->aq_entlen; - totlen += alq->aq_entlen; - /* Check to see if we're wrapping the buffer */ - if (ale->ae_data + alq->aq_entlen != ale->ae_next->ae_data) - iov++; - ale->ae_flags &= ~AE_VALID; - ale = ale->ae_next; - } while (ale->ae_flags & AE_VALID); + /* Start the write from the location of our buffer tail pointer. */ + aiov[0].iov_base = alq->aq_entbuf + alq->aq_writetail; + + if (alq->aq_writetail < alq->aq_writehead) { + /* Buffer not wrapped. */ + totlen = aiov[0].iov_len = alq->aq_writehead - alq->aq_writetail; + } else if (alq->aq_writehead == 0) { + /* Buffer not wrapped (special case to avoid an empty iov). */ + totlen = aiov[0].iov_len = alq->aq_buflen - alq->aq_writetail - + wrapearly; + } else { + /* + * Buffer wrapped, requires 2 aiov entries: + * - first is from writetail to end of buffer + * - second is from start of buffer to writehead + */ + aiov[0].iov_len = alq->aq_buflen - alq->aq_writetail - + wrapearly; + iov++; + aiov[1].iov_base = alq->aq_entbuf; + aiov[1].iov_len = alq->aq_writehead; + totlen = aiov[0].iov_len + aiov[1].iov_len; + } alq->aq_flags |= AQ_FLUSHING; ALQ_UNLOCK(alq); - if (iov == 2 || aiov[iov].iov_base == NULL) - iov--; - auio.uio_iov = &aiov[0]; auio.uio_offset = 0; auio.uio_segflg = UIO_SYSSPACE; auio.uio_rw = UIO_WRITE; - auio.uio_iovcnt = iov + 1; + auio.uio_iovcnt = iov; auio.uio_resid = totlen; auio.uio_td = td; @@ -353,8 +385,28 @@ alq_doio(struct alq *alq) ALQ_LOCK(alq); alq->aq_flags &= ~AQ_FLUSHING; - if (alq->aq_entfree == NULL) - alq->aq_entfree = alstart; + /* Adjust writetail as required, taking into account wrapping. */ + alq->aq_writetail = (alq->aq_writetail + totlen + wrapearly) % + alq->aq_buflen; + alq->aq_freebytes += totlen + wrapearly; + + /* + * If we just flushed part of the buffer which wrapped, reset the + * wrapearly indicator. + */ + if (wrapearly) + alq->aq_wrapearly = 0; + + /* + * If we just flushed the buffer completely, reset indexes to 0 to + * minimise buffer wraps. + * This is also required to ensure alq_getn() can't wedge itself. + */ + if (!HAS_PENDING_DATA(alq)) + alq->aq_writehead = alq->aq_writetail = 0; + + KASSERT((alq->aq_writetail >= 0 && alq->aq_writetail < alq->aq_buflen), + ("%s: aq_writetail < 0 || aq_writetail >= aq_buflen", __func__)); if (alq->aq_flags & AQ_WANTED) { alq->aq_flags &= ~AQ_WANTED; @@ -379,27 +431,27 @@ SYSINIT(ald, SI_SUB_LOCK, SI_ORDER_ANY, /* * Create the queue data structure, allocate the buffer, and open the file. */ + int -alq_open(struct alq **alqp, const char *file, struct ucred *cred, int cmode, - int size, int count) +alq_open_flags(struct alq **alqp, const char *file, struct ucred *cred, int cmode, + int size, int flags) { struct thread *td; struct nameidata nd; - struct ale *ale; - struct ale *alp; struct alq *alq; - char *bufp; - int flags; + int oflags; int error; - int i, vfslocked; + int vfslocked; + + KASSERT((size > 0), ("%s: size <= 0", __func__)); *alqp = NULL; td = curthread; NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, file, td); - flags = FWRITE | O_NOFOLLOW | O_CREAT; + oflags = FWRITE | O_NOFOLLOW | O_CREAT; - error = vn_open_cred(&nd, &flags, cmode, cred, NULL); + error = vn_open_cred(&nd, &oflags, cmode, cred, NULL); if (error) return (error); @@ -410,31 +462,20 @@ alq_open(struct alq **alqp, const char * VFS_UNLOCK_GIANT(vfslocked); alq = malloc(sizeof(*alq), M_ALD, M_WAITOK|M_ZERO); - alq->aq_entbuf = malloc(count * size, M_ALD, M_WAITOK|M_ZERO); - alq->aq_first = malloc(sizeof(*ale) * count, M_ALD, M_WAITOK|M_ZERO); alq->aq_vp = nd.ni_vp; alq->aq_cred = crhold(cred); - alq->aq_entmax = count; - alq->aq_entlen = size; - alq->aq_entfree = alq->aq_first; mtx_init(&alq->aq_mtx, "ALD Queue", NULL, MTX_SPIN|MTX_QUIET); - bufp = alq->aq_entbuf; - ale = alq->aq_first; - alp = NULL; - - /* Match up entries with buffers */ - for (i = 0; i < count; i++) { - if (alp) - alp->ae_next = ale; - ale->ae_data = bufp; - alp = ale; - ale++; - bufp += size; - } - - alp->ae_next = alq->aq_first; + alq->aq_buflen = size; + alq->aq_entmax = 0; + alq->aq_entlen = 0; + + alq->aq_freebytes = alq->aq_buflen; + alq->aq_entbuf = malloc(alq->aq_buflen, M_ALD, M_WAITOK|M_ZERO); + alq->aq_writehead = alq->aq_writetail = 0; + if (flags & ALQ_ORDERED) + alq->aq_flags |= AQ_ORDERED; if ((error = ald_add(alq)) != 0) { alq_destroy(alq); @@ -446,79 +487,405 @@ alq_open(struct alq **alqp, const char * return (0); } +int +alq_open(struct alq **alqp, const char *file, struct ucred *cred, int cmode, + int size, int count) +{ + int ret; + + KASSERT((count >= 0), ("%s: count < 0", __func__)); + + if (count > 0) { + ret = alq_open_flags(alqp, file, cred, cmode, size*count, 0); + (*alqp)->aq_flags |= AQ_LEGACY; + (*alqp)->aq_entmax = count; + (*alqp)->aq_entlen = size; + } else + ret = alq_open_flags(alqp, file, cred, cmode, size, 0); + + return (ret); +} + + /* * Copy a new entry into the queue. If the operation would block either * wait or return an error depending on the value of waitok. */ int -alq_write(struct alq *alq, void *data, int waitok) +alq_writen(struct alq *alq, void *data, int len, int flags) { - struct ale *ale; + int activate, copy, ret; + void *waitchan; + + KASSERT((len > 0 && len <= alq->aq_buflen), + ("%s: len <= 0 || len > aq_buflen", __func__)); - if ((ale = alq_get(alq, waitok)) == NULL) + activate = ret = 0; + copy = len; + waitchan = NULL; + + ALQ_LOCK(alq); + + /* + * Fail to perform the write and return EWOULDBLOCK if: + * - The message is larger than our underlying buffer. + * - The ALQ is being shutdown. + * - There is insufficient free space in our underlying buffer + * to accept the message and the user can't wait for space. + * - There is insufficient free space in our underlying buffer + * to accept the message and the alq is inactive due to prior + * use of the ALQ_NOACTIVATE flag (which would lead to deadlock). + */ + if (len > alq->aq_buflen || + alq->aq_flags & AQ_SHUTDOWN || + (((flags & ALQ_NOWAIT) || (!(alq->aq_flags & AQ_ACTIVE) && + HAS_PENDING_DATA(alq))) && alq->aq_freebytes < len)) { + ALQ_UNLOCK(alq); return (EWOULDBLOCK); + } - bcopy(data, ale->ae_data, alq->aq_entlen); - alq_post(alq, ale); + /* + * If we want ordered writes and there is already at least one thread + * waiting for resources to become available, sleep until we're woken. + */ + if (alq->aq_flags & AQ_ORDERED && alq->aq_waiters > 0) { + KASSERT(!(flags & ALQ_NOWAIT), + ("%s: ALQ_NOWAIT set but incorrectly ignored!", __func__)); + alq->aq_waiters++; + msleep_spin(&alq->aq_waiters, &alq->aq_mtx, "alqwnord", 0); + alq->aq_waiters--; + } - return (0); + /* + * (ALQ_WAITOK && aq_freebytes < len) or aq_freebytes >= len, either + * enter while loop and sleep until we have enough free bytes (former) + * or skip (latter). If AQ_ORDERED is set, only 1 thread at a time will + * be in this loop. Otherwise, multiple threads may be sleeping here + * competing for ALQ resources. + */ + while (alq->aq_freebytes < len && !(alq->aq_flags & AQ_SHUTDOWN)) { + KASSERT(!(flags & ALQ_NOWAIT), + ("%s: ALQ_NOWAIT set but incorrectly ignored!", __func__)); + alq->aq_flags |= AQ_WANTED; + alq->aq_waiters++; + if (waitchan) + wakeup(waitchan); + msleep_spin(alq, &alq->aq_mtx, "alqwnres", 0); + alq->aq_waiters--; + + /* + * If we're the first thread to wake after an AQ_WANTED wakeup + * but there isn't enough free space for us, we're going to loop + * and sleep again. If there are other threads waiting in this + * loop, schedule a wakeup so that they can see if the space + * they require is available. + */ + if (alq->aq_waiters > 0 && !(alq->aq_flags & AQ_ORDERED) && + alq->aq_freebytes < len && !(alq->aq_flags & AQ_WANTED)) + waitchan = alq; + else + waitchan = NULL; + } + + /* + * If there are waiters, we need to signal the waiting threads after we + * complete our work. The alq ptr is used as a wait channel for threads + * requiring resources to be freed up. In the AQ_ORDERED case, threads + * are not allowed to concurrently compete for resources in the above + * while loop, so we use a different wait channel in this case. + */ + if (alq->aq_waiters > 0) { + if (alq->aq_flags & AQ_ORDERED) + waitchan = &alq->aq_waiters; + else + waitchan = alq; + } else + waitchan = NULL; + + /* Bail if we're shutting down. */ + if (alq->aq_flags & AQ_SHUTDOWN) { + ret = EWOULDBLOCK; + goto unlock; + } + + /* + * If we need to wrap the buffer to accommodate the write, + * we'll need 2 calls to bcopy. + */ + if ((alq->aq_buflen - alq->aq_writehead) < len) + copy = alq->aq_buflen - alq->aq_writehead; + + /* Copy message (or part thereof if wrap required) to the buffer. */ + bcopy(data, alq->aq_entbuf + alq->aq_writehead, copy); + alq->aq_writehead += copy; + + if (alq->aq_writehead >= alq->aq_buflen) { + KASSERT((alq->aq_writehead == alq->aq_buflen), + ("%s: alq->aq_writehead (%d) > alq->aq_buflen (%d)", + __func__, + alq->aq_writehead, + alq->aq_buflen)); + alq->aq_writehead = 0; + } + + if (copy != len) { + /* + * Wrap the buffer by copying the remainder of our message + * to the start of the buffer and resetting aq_writehead. + */ + bcopy(((uint8_t *)data)+copy, alq->aq_entbuf, len - copy); + alq->aq_writehead = len - copy; + } + + KASSERT((alq->aq_writehead >= 0 && alq->aq_writehead < alq->aq_buflen), + ("%s: aq_writehead < 0 || aq_writehead >= aq_buflen", __func__)); + + alq->aq_freebytes -= len; + + if (!(alq->aq_flags & AQ_ACTIVE) && !(flags & ALQ_NOACTIVATE)) { + alq->aq_flags |= AQ_ACTIVE; + activate = 1; + } + + KASSERT((HAS_PENDING_DATA(alq)), ("%s: queue empty!", __func__)); + +unlock: + ALQ_UNLOCK(alq); + + if (activate) { + ALD_LOCK(); + ald_activate(alq); + ALD_UNLOCK(); + } + + /* NB: We rely on wakeup_one waking threads in a FIFO manner. */ + if (waitchan != NULL) + wakeup_one(waitchan); + + return (ret); } +int +alq_write(struct alq *alq, void *data, int flags) +{ + /* Should only be called in fixed length message (legacy) mode. */ + KASSERT((alq->aq_flags & AQ_LEGACY), + ("%s: fixed length write on variable length queue", __func__)); + return (alq_writen(alq, data, alq->aq_entlen, flags)); +} + +/* + * Retrieve a pointer for the ALQ to write directly into, avoiding bcopy. + */ struct ale * -alq_get(struct alq *alq, int waitok) +alq_getn(struct alq *alq, int len, int flags) { - struct ale *ale; - struct ale *aln; + int contigbytes; + void *waitchan; + + KASSERT((len > 0 && len <= alq->aq_buflen), + ("%s: len <= 0 || len > alq->aq_buflen", __func__)); - ale = NULL; + waitchan = NULL; ALQ_LOCK(alq); - /* Loop until we get an entry or we're shutting down */ - while ((alq->aq_flags & AQ_SHUTDOWN) == 0 && - (ale = alq->aq_entfree) == NULL && - (waitok & ALQ_WAITOK)) { - alq->aq_flags |= AQ_WANTED; + /* + * Determine the number of free contiguous bytes. + * We ensure elsewhere that if aq_writehead == aq_writetail because + * the buffer is empty, they will both be set to 0 and therefore + * aq_freebytes == aq_buflen and is fully contiguous. + * If they are equal and the buffer is not empty, aq_freebytes will + * be 0 indicating the buffer is full. + */ + if (alq->aq_writehead <= alq->aq_writetail) + contigbytes = alq->aq_freebytes; + else { + contigbytes = alq->aq_buflen - alq->aq_writehead; + + if (contigbytes < len) { + /* + * Insufficient space at end of buffer to handle a + * contiguous write. Wrap early if there's space at + * the beginning. This will leave a hole at the end + * of the buffer which we will have to skip over when + * flushing the buffer to disk. + */ + if (alq->aq_writetail >= len || flags & ALQ_WAITOK) { + /* Keep track of # bytes left blank. */ + alq->aq_wrapearly = contigbytes; + /* Do the wrap and adjust counters. */ + contigbytes = alq->aq_freebytes = + alq->aq_writetail; + alq->aq_writehead = 0; + } + } + } + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 11:38:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42E6110657AF; Sat, 6 Nov 2010 11:38:50 +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 168F18FC14; Sat, 6 Nov 2010 11:38: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 oA6Bcn39029693; Sat, 6 Nov 2010 11:38:49 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6BcnLi029691; Sat, 6 Nov 2010 11:38:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011061138.oA6BcnLi029691@svn.freebsd.org> From: Marius Strobl Date: Sat, 6 Nov 2010 11:38: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: r214873 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 11:38:50 -0000 Author: marius Date: Sat Nov 6 11:38:49 2010 New Revision: 214873 URL: http://svn.freebsd.org/changeset/base/214873 Log: - Move Sun Fire V240 to the list of known working machines. - For the parallel stable/7 and stable/8 branches mention both releases that first supported a particular sparc64 machine and update the sparc64 hardware list regarding machines that will be supported beginning with 7.4-RELEASE. Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Nov 6 11:38:40 2010 (r214872) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Nov 6 11:38:49 2010 (r214873) @@ -585,7 +585,11 @@ - &sun.fire; V215 (support first appeared in 7.3-RELEASE) + &sun.fire; V215 (support first appeared in 7.3-RELEASE and 8.1-RELEASE) + + + + &sun.fire; V240 @@ -594,12 +598,12 @@ &sun.fire; V440 (support for the on-board NICs first - appeared in 8.0-RELEASE) + appeared in 7.3-RELEASE and 8.0-RELEASE) &sun.fire; V480 (501-6780 and 501-6790 centerplanes only, for - which support first appeared in 7.3-RELEASE) + which support first appeared in 7.3-RELEASE and 8.1-RELEASE) @@ -607,7 +611,7 @@ - &sun.fire; V890 (support first appeared in 8.1-RELEASE, + &sun.fire; V890 (support first appeared in 7.4-RELEASE and 8.1-RELEASE, non-mixed &ultrasparc; IV/IV+ CPU-configurations only) @@ -625,20 +629,16 @@ - &sun.fire; V240 - - - - &sun.fire; V245 (support first appeared in 7.3-RELEASE) + &sun.fire; V245 (support first appeared in 7.3-RELEASE and 8.1-RELEASE) - &sun.fire; V490 (support first appeared in 8.1-RELEASE, + &sun.fire; V490 (support first appeared in 7.4-RELEASE and 8.1-RELEASE, non-mixed &ultrasparc; IV/IV+ CPU-configurations only) - Starting with 8.1-RELEASE, &arch.sparc64; systems based on + Starting with 7.4-RELEASE and 8.1-RELEASE, &arch.sparc64; systems based on Fujitsu &sparc64; V are also supported by &os;, which includes the following known working systems: From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 12:41:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D22591065679; Sat, 6 Nov 2010 12:41:47 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C025A8FC0A; Sat, 6 Nov 2010 12:41: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 oA6Cfl87031304; Sat, 6 Nov 2010 12:41:47 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6Cflv9031302; Sat, 6 Nov 2010 12:41:47 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061241.oA6Cflv9031302@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 12:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214874 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 12:41:47 -0000 Author: lstewart Date: Sat Nov 6 12:41:47 2010 New Revision: 214874 URL: http://svn.freebsd.org/changeset/base/214874 Log: The kthread/kproc KPI differs between 7.x and 8.x+ and requires the use of kthread_exit() in order to get a wakeup delivered to the "struct proc *" which ALQ relies on. This is an intentional direct commit to the 7-STABLE branch. Modified: stable/7/sys/kern/kern_alq.c Modified: stable/7/sys/kern/kern_alq.c ============================================================================== --- stable/7/sys/kern/kern_alq.c Sat Nov 6 11:38:49 2010 (r214873) +++ stable/7/sys/kern/kern_alq.c Sat Nov 6 12:41:47 2010 (r214874) @@ -220,7 +220,7 @@ ald_daemon(void) ALD_LOCK(); } - kproc_exit(0); + kthread_exit(0); } static void From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 13:03:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC77F106564A; Sat, 6 Nov 2010 13:03:33 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C78718FC0A; Sat, 6 Nov 2010 13:03: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 oA6D3XtG031858; Sat, 6 Nov 2010 13:03:33 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6D3Xh1031853; Sat, 6 Nov 2010 13:03:33 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061303.oA6D3Xh1031853@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 13:03:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214875 - in stable/7: share/man/man4 sys/modules sys/modules/siftr sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 13:03:34 -0000 Author: lstewart Date: Sat Nov 6 13:03:33 2010 New Revision: 214875 URL: http://svn.freebsd.org/changeset/base/214875 Log: MFC r209662,209665: Import the Statistical Information For TCP Research (SIFTR) kernel module into FreeBSD. SIFTR logs a range of statistics on active TCP connections to a log file, providing the ability to make highly granular measurements of TCP connection state. The tool is aimed at system administrators, developers and researchers alike. Please take it for a spin and test it out - the man page should have all the information required to get you going. Many thanks go to the Cisco University Research Program Fund at Community Foundation Silicon Valley and the FreeBSD Foundation. Their support of our work at the Centre for Advanced Internet Architectures, Swinburne University of Technology is greatly appreciated. The base SIFTR code from r209662 was modified as part of this MFC in order to work correctly on FreeBSD 7. r209980: Catch up with the rename of DPCPU_SUM to DPCPU_VARSUM. r209982: The SIFTR DPCPU statistics struct was not being zeroed between enable/disable cycles so the values would accumulate rather than reset for each cycle. Sponsored by: Cisco URP (r209662), FreeBSD Foundation Reviewed by: dwmalone, gnn, rpaulo (r209662) Tested by: Many on freebsd-current@ and elsewhere over the years Added: stable/7/share/man/man4/siftr.4 - copied unchanged from r209662, head/share/man/man4/siftr.4 stable/7/sys/modules/siftr/ - copied from r209662, head/sys/modules/siftr/ stable/7/sys/netinet/siftr.c - copied, changed from r209662, head/sys/netinet/siftr.c Modified: stable/7/share/man/man4/Makefile stable/7/sys/modules/Makefile Directory Properties: stable/7/share/man/ (props changed) stable/7/share/man/man1/ (props changed) stable/7/share/man/man3/ (props changed) stable/7/share/man/man4/ (props changed) stable/7/share/man/man5/ (props changed) stable/7/share/man/man7/ (props changed) stable/7/share/man/man8/ (props changed) stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man4/Makefile ============================================================================== --- stable/7/share/man/man4/Makefile Sat Nov 6 12:41:47 2010 (r214874) +++ stable/7/share/man/man4/Makefile Sat Nov 6 13:03:33 2010 (r214875) @@ -314,6 +314,8 @@ MAN= aac.4 \ sf.4 \ sge.4 \ si.4 \ + siftr.4 \ + siis.4 \ sio.4 \ sis.4 \ sk.4 \ Copied: stable/7/share/man/man4/siftr.4 (from r209662, head/share/man/man4/siftr.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/share/man/man4/siftr.4 Sat Nov 6 13:03:33 2010 (r214875, copy of r209662, head/share/man/man4/siftr.4) @@ -0,0 +1,752 @@ +.\" +.\" Copyright (c) 2010 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" Portions of this software were developed at the Centre for Advanced +.\" Internet Architectures, Swinburne University of Technology, Melbourne, +.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD +.\" Foundation. +.\" +.\" 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, +.\" without modification, immediately at the beginning of the file. +.\" 2. The name of the author may not 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 June 23, 2010 +.Dt SIFTR 4 +.Os +.Sh NAME +.Nm SIFTR +.Nd Statistical Information For TCP Research +.Sh SYNOPSIS +To load +.Ns Nm +as a module at run-time, run the following command as root: +.Bd -literal -offset indent +kldload siftr +.Ed +.Pp +Alternatively, to load +.Ns Nm +as a module at boot time, add the following line into the +.Xr loader.conf 5 +file: +.Bd -literal -offset indent +siftr_load="YES" +.Ed +.Sh DESCRIPTION +.Nm +.Ns ( Em S Ns tatistical +.Em I Ns nformation +.Em F Ns or +.Em T Ns CP +.Em R Ns esearch ) +is a kernel module that logs a range of statistics on active TCP connections to +a log file. +It provides the ability to make highly granular measurements of TCP connection +state, aimed at system administrators, developers and researchers. +.Ss Compile-time Configuration +The default operation of +.Nm +is to capture IPv4 TCP/IP packets. +.Nm +can be configured to support IPv4 and IPv6 by uncommenting: +.Bd -literal -offset indent +CFLAGS+=-DSIFTR_IPV6 +.Ed +.Pp +in +.Aq sys/modules/siftr/Makefile +and recompiling. +.Pp +In the IPv4-only (default) mode, standard dotted decimal notation (e.g. +"136.186.229.95") is used to format IPv4 addresses for logging. +In IPv6 mode, standard dotted decimal notation is used to format IPv4 addresses, +and standard colon-separated hex notation (see RFC 4291) is used to format IPv6 +addresses for logging. Note that SIFTR uses uncompressed notation to format IPv6 +addresses. +For example, the address "fe80::20f:feff:fea2:531b" would be logged as +"fe80:0:0:0:20f:feff:fea2:531b". +.Ss Run-time Configuration +.Nm +utilises the +.Xr sysctl 8 +interface to export its configuration variables to user-space. +The following variables are available: +.Bl -tag -offset indent +.It Va net.inet.siftr.enabled +controls whether the module performs its +measurements or not. +By default, the value is set to 0, which means the module +will not be taking any measurements. +Having the module loaded with +.Va net.inet.siftr.enabled +set to 0 will have no impact on the performance of the network stack, as the +packet filtering hooks are only inserted when +.Va net.inet.siftr.enabled +is set to 1. +.El +.Bl -tag -offset indent +.It Va net.inet.siftr.ppl +controls how many inbound/outbound packets for a given TCP connection will cause +a log message to be generated for the connection. +By default, the value is set to 1, which means the module will log a message for +every packet of every TCP connection. +The value can be set to any integer in the range [1,2^32], and can be changed at +any time, even while the module is enabled. +.El +.Bl -tag -offset indent +.It Va net.inet.siftr.logfile +controls the path to the file that the module writes its log messages to. +By default, the file /var/log/siftr.log is used. +The path can be changed at any time, even while the module is enabled. +.El +.Bl -tag -offset indent +.It Va net.inet.siftr.genhashes +controls whether a hash is generated for each TCP packet seen by +.Nm . +By default, the value is set to 0, which means no hashes are generated. +The hashes are useful to correlate which TCP packet triggered the generation of +a particular log message, but calculating them adds additional computational +overhead into the fast path. +.El +.Ss Log Format +A typical +.Nm +log file will contain 3 different types of log message. +All messages are written in plain ASCII text. +.Pp +Note: The +.Qq \e +present in the example log messages in this section indicates a +line continuation and is not part of the actual log message +.Pp +The first type of log message is written to the file when the module is +enabled and starts collecting data from the running kernel. The text below +shows an example module enable log. The fields are tab delimited key-value +pairs which describe some basic information about the system. +.Bd -literal -offset indent +enable_time_secs=1238556193 enable_time_usecs=462104 \\ +siftrver=1.2.2 hz=1000 tcp_rtt_scale=32 \\ +sysname=FreeBSD sysver=604000 ipmode=4 +.Ed +.Pp +Field descriptions are as follows: +.Bl -tag -offset indent +.It Va enable_time_secs +time at which the module was enabled, in seconds since the UNIX epoch. +.El +.Bl -tag -offset indent +.It Va enable_time_usecs +time at which the module was enabled, in microseconds since enable_time_secs. +.El +.Bl -tag -offset indent +.It Va siftrver +version of +.Nm . +.El +.Bl -tag -offset indent +.It Va hz +tick rate of the kernel in ticks per second. +.El +.Bl -tag -offset indent +.It Va tcp_rtt_scale +smoothed RTT estimate scaling factor +.El +.Bl -tag -offset indent +.It Va sysname +operating system name +.El +.Bl -tag -offset indent +.It Va sysver +operating system version +.El +.Bl -tag -offset indent +.It Va ipmode +IP mode as defined at compile time. +An ipmode of "4" means IPv6 is not supported and IP addresses are logged in +regular dotted quad format. +An ipmode of "6" means IPv6 is supported, and IP addresses are logged in dotted +quad or hex format, as described in the +.Qq Compile-time Configuration +subsection. +.El +.Pp +The second type of log message is written to the file when a data log message +is generated. +The text below shows an example data log triggered by an IPv4 +TCP/IP packet. +The data is CSV formatted. +.Bd -literal -offset indent +o,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\ +1073725440,172312,6144,66560,66608,8,1,4,1448,936,1,996,255, \\ +33304,208,66608,0,208 +.Ed +.Pp +Field descriptions are as follows: +.Bl -tag -offset indent +.It Va 1 +Direction of packet that triggered the log message. +Either +.Qq i +for in, or +.Qq o +for out. +.El +.Bl -tag -offset indent +.It Va 2 +Hash of the packet that triggered the log message. +.El +.Bl -tag -offset indent +.It Va 3 +Time at which the packet that triggered the log message was processed by +the +.Xr pfil 9 +hook function, in seconds and microseconds since the UNIX epoch. +.El +.Bl -tag -offset indent +.It Va 4 +The IPv4 or IPv6 address of the local host, in dotted quad (IPv4 packet) +or colon-separated hex (IPv6 packet) notation. +.El +.Bl -tag -offset indent +.It Va 5 +The TCP port that the local host is communicating via. +.El +.Bl -tag -offset indent +.It Va 6 +The IPv4 or IPv6 address of the foreign host, in dotted quad (IPv4 packet) +or colon-separated hex (IPv6 packet) notation. +.El +.Bl -tag -offset indent +.It Va 7 +The TCP port that the foreign host is communicating via. +.El +.Bl -tag -offset indent +.It Va 8 +The slow start threshold for the flow, in bytes. +.El +.Bl -tag -offset indent +.It Va 9 +The current congestion window for the flow, in bytes. +.El +.Bl -tag -offset indent +.It Va 10 +The current bandwidth-controlled window for the flow, in bytes. +.El +.Bl -tag -offset indent +.It Va 11 +The current sending window for the flow, in bytes. +The post scaled value is reported, except during the initial handshake (first +few packets), during which time the unscaled value is reported. +.El +.Bl -tag -offset indent +.It Va 12 +The current receive window for the flow, in bytes. +The post scaled value is always reported. +.El +.Bl -tag -offset indent +.It Va 13 +The current window scaling factor for the sending window. +.El +.Bl -tag -offset indent +.It Va 14 +The current window scaling factor for the receiving window. +.El +.Bl -tag -offset indent +.It Va 15 +The current state of the TCP finite state machine, as defined +in +.Aq Pa netinet/tcp_fsm.h . +.El +.Bl -tag -offset indent +.It Va 16 +The maximum segment size for the flow, in bytes. +.El +.Bl -tag -offset indent +.It Va 17 +The current smoothed RTT estimate for the flow, in units of TCP_RTT_SCALE * HZ, +where TCP_RTT_SCALE is a define found in tcp_var.h, and HZ is the kernel's tick +timer. +Divide by TCP_RTT_SCALE * HZ to get the RTT in secs. TCP_RTT_SCALE and HZ are +reported in the enable log message. +.El +.Bl -tag -offset indent +.It Va 18 +SACK enabled indicator. 1 if SACK enabled, 0 otherwise. +.El +.Bl -tag -offset indent +.It Va 19 +The current state of the TCP flags for the flow. +See +.Aq Pa netinet/tcp_var.h +for information about the various flags. +.El +.Bl -tag -offset indent +.It Va 20 +The current retransmission timeout length for the flow, in units of HZ, where HZ +is the kernel's tick timer. +Divide by HZ to get the timeout length in seconds. HZ is reported in the +enable log message. +.El +.Bl -tag -offset indent +.It Va 21 +The current size of the socket send buffer in bytes. +.El +.Bl -tag -offset indent +.It Va 22 +The current number of bytes in the socket send buffer. +.El +.Bl -tag -offset indent +.It Va 23 +The current size of the socket receive buffer in bytes. +.El +.Bl -tag -offset indent +.It Va 24 +The current number of bytes in the socket receive buffer. +.El +.Bl -tag -offset indent +.It Va 25 +The current number of unacknowledged bytes in-flight. +Bytes acknowledged via SACK are not excluded from this count. +.El +.Pp +The third type of log message is written to the file when the module is disabled +and ceases collecting data from the running kernel. +The text below shows an example module disable log. +The fields are tab delimited key-value pairs which provide statistics about +operations since the module was most recently enabled. +.Bd -literal -offset indent +disable_time_secs=1238556197 disable_time_usecs=933607 \\ +num_inbound_tcp_pkts=356 num_outbound_tcp_pkts=627 \\ +total_tcp_pkts=983 num_inbound_skipped_pkts_malloc=0 \\ +num_outbound_skipped_pkts_malloc=0 num_inbound_skipped_pkts_mtx=0 \\ +num_outbound_skipped_pkts_mtx=0 num_inbound_skipped_pkts_tcb=0 \\ +num_outbound_skipped_pkts_tcb=0 num_inbound_skipped_pkts_icb=0 \\ +num_outbound_skipped_pkts_icb=0 total_skipped_tcp_pkts=0 \\ +flow_list=172.16.7.28;22-172.16.2.5;55931, +.Ed +.Pp +Field descriptions are as follows: +.Bl -tag -offset indent +.It Va disable_time_secs +Time at which the module was disabled, in seconds since the UNIX epoch. +.El +.Bl -tag -offset indent +.It Va disable_time_usecs +Time at which the module was disabled, in microseconds since disable_time_secs. +.El +.Bl -tag -offset indent +.It Va num_inbound_tcp_pkts +Number of TCP packets that traversed up the network stack. +This only includes inbound TCP packets during the periods when +.Nm +was enabled. +.El +.Bl -tag -offset indent +.It Va num_outbound_tcp_pkts +Number of TCP packets that traversed down the network stack. +This only includes outbound TCP packets during the periods when +.Nm +was enabled. +.El +.Bl -tag -offset indent +.It Va total_tcp_pkts +The summation of num_inbound_tcp_pkts and num_outbound_tcp_pkts. +.El +.Bl -tag -offset indent +.It Va num_inbound_skipped_pkts_malloc +Number of inbound packets that were not processed because of failed malloc() calls. +.El +.Bl -tag -offset indent +.It Va num_outbound_skipped_pkts_malloc +Number of outbound packets that were not processed because of failed malloc() calls. +.El +.Bl -tag -offset indent +.It Va num_inbound_skipped_pkts_mtx +Number of inbound packets that were not processed because of failure to add the +packet to the packet processing queue. +.El +.Bl -tag -offset indent +.It Va num_outbound_skipped_pkts_mtx +Number of outbound packets that were not processed because of failure to add the +packet to the packet processing queue. +.El +.Bl -tag -offset indent +.It Va num_inbound_skipped_pkts_tcb +Number of inbound packets that were not processed because of failure to find the +TCP control block associated with the packet. +.El +.Bl -tag -offset indent +.It Va num_outbound_skipped_pkts_tcb +Number of outbound packets that were not processed because of failure to find +the TCP control block associated with the packet. +.El +.Bl -tag -offset indent +.It Va num_inbound_skipped_pkts_icb +Number of inbound packets that were not processed because of failure to find the +IP control block associated with the packet. +.El +.Bl -tag -offset indent +.It Va num_outbound_skipped_pkts_icb +Number of outbound packets that were not processed because of failure to find +the IP control block associated with the packet. +.El +.Bl -tag -offset indent +.It Va total_skipped_tcp_pkts +The summation of all skipped packet counters. +.El +.Bl -tag -offset indent +.It Va flow_list +A CSV list of TCP flows that triggered data log messages to be generated since +the module was loaded. +Each flow entry in the CSV list is +formatted as +.Qq local_ip;local_port-foreign_ip;foreign_port . +If there are no entries in the list (i.e. no data log messages were generated), +the value will be blank. +If there is at least one entry in the list, a trailing comma will always be +present. +.El +.Pp +The total number of data log messages found in the log file for a module +enable/disable cycle should equate to total_tcp_pkts - total_skipped_tcp_pkts. +.Sh IMPLEMENTATION NOTES +.Nm +hooks into the network stack using the +.Xr pfil 9 +interface. +In its current incarnation, it hooks into the AF_INET/AF_INET6 (IPv4/IPv6) +.Xr pfil 9 +filtering points, which means it sees packets at the IP layer of the network +stack. +This means that TCP packets inbound to the stack are intercepted before +they have been processed by the TCP layer. +Packets outbound from the stack are intercepted after they have been processed +by the TCP layer. +.Pp +The diagram below illustrates how +.Nm +inserts itself into the stack. +.Bd -literal -offset indent +---------------------------------- + Upper Layers +---------------------------------- + ^ | + | | + | | + | v + TCP in TCP out +---------------------------------- + ^ | + |________ _________| + | | + | v + --------- + | SIFTR | + --------- + ^ | + ________| |__________ + | | + | v +IPv{4/6} in IPv{4/6} out +---------------------------------- + ^ | + | | + | v +Layer 2 in Layer 2 out +---------------------------------- + Physical Layer +---------------------------------- +.Ed +.Pp +.Nm +uses the +.Xr alq 9 +interface to manage writing data to disk. +.Pp +At first glance, you might mistakenly think that +.Nm +extracts information from +individual TCP packets. +This is not the case. +.Nm +uses TCP packet events (inbound and outbound) for each TCP flow originating from +the system to trigger a dump of the state of the TCP control block for that +flow. +With the PPL set to 1, we are in effect sampling each TCP flow's control block +state as frequently as flow packets enter/leave the system. +For example, setting PPL to 2 halves the sampling rate i.e. every second flow +packet (inbound OR outbound) causes a dump of the control block state. +.Pp +The distinction between interrogating individual packets vs interrogating the +control block is important, because +.Nm +does not remove the need for packet capturing tools like +.Xr tcpdump 1 . +.Nm +allows you to correlate and observe the cause-and-affect relationship between +what you see on the wire (captured using a tool like +.Xr tcpdump 1 Ns ) +and changes in the TCP control block corresponding to the flow of interest. +It is therefore useful to use +.Nm +and a tool like +.Xr tcpdump 1 +to gather the necessary data to piece together the complete picture. +Use of either tool on its own will not be able to provide all of the necessary +data. +.Pp +As a result of needing to interrogate the TCP control block, certain packets +during the lifecycle of a connection are unable to trigger a +.Nm +log message. +The initial handshake takes place without the existence of a control block and +the final ACK is exchanged when the connection is in the TIMEWAIT state. +.Pp +.Nm +was designed to minimise the delay introduced to packets traversing the network +stack. +This design called for a highly optimised and minimal hook function that +extracted the minimal details necessary whilst holding the packet up, and +passing these details to another thread for actual processing and logging. +.Pp +This multithreaded design does introduce some contention issues when accessing +the data structure shared between the threads of operation. +When the hook function tries to place details in the structure, it must first +acquire an exclusive lock. +Likewise, when the processing thread tries to read details from the structure, +it must also acquire an exclusive lock to do so. +If one thread holds the lock, the other must wait before it can obtain it. +This does introduce some additional bounded delay into the kernel's packet +processing code path. +.Pp +In some cases (e.g. low memory, connection termination), TCP packets that enter +the +.Nm +.Xr pfil 9 +hook function will not trigger a log message to be generated. +.Nm +refers to this outcome as a +.Qq skipped packet . +Note that +.Nm +always ensures that packets are allowed to continue through the stack, even if +they could not successfully trigger a data log message. +.Nm +will therefore not introduce any packet loss for TCP/IP packets traversing the +network stack. +.Ss Important Behaviours +The behaviour of a log file path change whilst the module is enabled is as +follows: +.Bl -enum +.It +Attempt to open the new file path for writing. +If this fails, the path change will fail and the existing path will continue to +be used. +.It +Assuming the new path is valid and opened successfully: +.Bl -dash +.It +Flush all pending log messages to the old file path. +.It +Close the old file path. +.It +Switch the active log file pointer to point at the new file path. +.It +Commence logging to the new file. +.El +.El +.Pp +During the time between the flush of pending log messages to the old file and +commencing logging to the new file, new log messages will still be generated and +buffered. +As soon as the new file path is ready for writing, the accumulated log messages +will be written out to the file. +.Sh EXAMPLES +To enable the module's operations, run the following command as root: +sysctl net.inet.siftr.enabled=1 +.Pp +To change the granularity of log messages such that 1 log message is +generated for every 10 TCP packets per connection, run the following +command as root: +sysctl net.inet.siftr.ppl=10 +.Pp +To change the log file location to /tmp/siftr.log, run the following +command as root: +sysctl net.inet.siftr.logfile=/tmp/siftr.log +.Sh SEE ALSO +.Xr alq 9 , +.Xr pfil 9 +.Xr sysctl 8 , +.Xr tcp 4 , +.Xr tcpdump 1 , +.Sh ACKNOWLEDGEMENTS +Development of this software was made possible in part by grants from the +Cisco University Research Program Fund at Community Foundation Silicon Valley, +and the FreeBSD Foundation. +.Sh HISTORY +.Nm +first appeared in +.Fx 9.0 . +.Pp +.Nm +was first released in 2007 by Lawrence Stewart and James Healy whilst working on +the NewTCP research project at Swinburne University's Centre for Advanced +Internet Architectures, Melbourne, Australia, which was made possible in part by +a grant from the Cisco University Research Program Fund at Community Foundation +Silicon Valley. +More details are available at: +.Pp +http://caia.swin.edu.au/urp/newtcp/ +.Pp +Work on +.Nm +v1.2.x was sponsored by the FreeBSD Foundation as part of +the +.Qq Enhancing the FreeBSD TCP Implementation +project 2008-2009. +More details are available at: +.Pp +http://www.freebsdfoundation.org/ +.Pp +http://caia.swin.edu.au/freebsd/etcp09/ +.Sh AUTHORS +.An -nosplit +.Nm +was written by +.An Lawrence Stewart Aq lstewart@FreeBSD.org +and +.An James Healy Aq jimmy@deefa.com . +.Pp +This manual page was written by +.An Lawrence Stewart Aq lstewart@FreeBSD.org . +.Sh BUGS +Current known limitations and any relevant workarounds are outlined below: +.Bl -dash +.It +The internal queue used to pass information between the threads of operation is +currently unbounded. +This allows +.Nm +to cope with bursty network traffic, but sustained high packet-per-second +traffic can cause exhaustion of kernel memory if the processing thread cannot +keep up with the packet rate. +.It +If using +.Nm +on a machine that is also running other modules utilising the +.Xr pfil 9 +framework e.g. +.Xr dummynet 4 , +.Xr ipfw 8 , +.Xr pf 4 Ns , +the order in which you load the modules is important. +You should kldload the other modules first, as this will ensure TCP packets +undergo any necessary manipulations before +.Nm +.Qq sees +and processes them. +.It +There is a known, harmless lock order reversal warning between the +.Xr pfil 9 +mutex and tcbinfo TCP lock reported by +.Xr witness 4 +when +.Nm +is enabled in a kernel compiled with +.Xr witness 4 +support. +.It +There is no way to filter which TCP flows you wish to capture data for. +Post processing is required to separate out data belonging to particular flows +of interest. +.It +The module does not detect deletion of the log file path. +New log messages will simply be lost if the log file being used by +.Nm +is deleted whilst the module is set to use the file. +Switching to a new log file using the +.Em net.inet.siftr.logfile +variable will create the new file and allow log messages to begin being written +to disk again. +The new log file path must differ from the path to the deleted file. +.It +The hash table used within the code is sized to hold 65536 flows. This is not a +hard limit, because chaining is used to handle collisions within the hash table +structure. +However, we suspect (based on analogies with other hash table performance data) +that the hash table look up performance (and therefore the module's packet +processing performance) will degrade in an exponential manner as the number of +unique flows handled in a module enable/disable cycle approaches and surpasses +65536. +.It +There is no garbage collection performed on the flow hash table. +The only way currently to flush it is to disable +.Nm . +.It +The PPL variable applies to packets that make it into the processing thread, +not total packets received in the hook function. +Packets are skipped before the PPL variable is applied, which means there may be +a slight discrepancy in the triggering of log messages. +For example, if PPL was set to 10, and the 8th packet since the last log message +is skipped, the 11th packet will actually trigger the log message to be +generated. +This is discussed in greater depth in CAIA technical report 070824A. +.It +At the time of writing, there was no simple way to hook into the TCP layer +to intercept packets. +.Nm Ap s +use of IP layer hook points means all IP +traffic will be processed by the +.Nm +.Xr pfil 9 +hook function, which introduces minor, but nonetheless unnecessary packet delay +and processing overhead on the system for non-TCP packets as well. +Hooking in at the IP layer is also not ideal from the data gathering point of +view. +Packets traversing up the stack will be intercepted and cause a log message +generation BEFORE they have been processed by the TCP layer, which means we +cannot observe the cause-and-affect relationship between inbound events and the +corresponding TCP control block as precisely as could be. +Ideally, +.Nm +should intercept packets after they have been processed by the TCP layer i.e. +intercept packets coming up the stack after they have been processed by +tcp_input(), and intercept packets coming down the stack after they have been +processed by tcp_output(). +The current code still gives satisfactory granularity though, as inbound events +tend to trigger outbound events, allowing the cause-and-effect to be observed +indirectly by capturing the state on outbound events as well. +.It +The +.Qq inflight bytes +value logged by +.Nm +does not take into account bytes that have been +.No SACK Ap ed +by the receiving host. +.It +Packet hash generation does not currently work for IPv6 based TCP packets. +.It +Compressed notation is not used for IPv6 address representation. +This consumes more bytes than is necessary in log output. +.El Modified: stable/7/sys/modules/Makefile ============================================================================== --- stable/7/sys/modules/Makefile Sat Nov 6 12:41:47 2010 (r214874) +++ stable/7/sys/modules/Makefile Sat Nov 6 13:03:33 2010 (r214875) @@ -255,6 +255,7 @@ SUBDIR= ${_3dfx} \ sem \ sf \ sge \ + siftr \ ${_sio} \ sis \ sk \ Copied and modified: stable/7/sys/netinet/siftr.c (from r209662, head/sys/netinet/siftr.c) ============================================================================== --- head/sys/netinet/siftr.c Sat Jul 3 13:32:39 2010 (r209662, copy source) +++ stable/7/sys/netinet/siftr.c Sat Nov 6 13:03:33 2010 (r214875) @@ -259,7 +259,13 @@ struct siftr_stats uint32_t nskip_out_dejavu; }; -static DPCPU_DEFINE(struct siftr_stats, ss); +/* Pre 8 and pre DPCPU. */ +static struct proc *siftr_pkt_manager_proc = NULL; +#define V_tcbinfo tcbinfo +static struct siftr_stats nondpcpu_ss; +#define DPCPU_PTR(n) &nondpcpu_##n +#define DPCPU_VARSUM(n, var) nondpcpu_##n.var +#define DPCPU_ZERO(n) bzero(&nondpcpu_##n, sizeof(nondpcpu_##n)) static volatile unsigned int siftr_exit_pkt_manager_thread = 0; static unsigned int siftr_enabled = 0; @@ -612,8 +618,8 @@ siftr_pkt_manager_thread(void *arg) mtx_unlock(&siftr_pkt_mgr_mtx); - /* Calls wakeup on this thread's struct thread ptr. */ - kthread_exit(); + /* Calls wakeup on this thread's struct proc ptr on 7.x. */ + kthread_exit(0); } @@ -1233,11 +1239,14 @@ siftr_manage_ops(uint8_t action) STAILQ_INIT(&pkt_queue); + DPCPU_ZERO(ss); + siftr_exit_pkt_manager_thread = 0; - ret = kthread_add(&siftr_pkt_manager_thread, NULL, NULL, - &siftr_pkt_manager_thr, RFNOWAIT, 0, + ret = kthread_create(&siftr_pkt_manager_thread, NULL, + &siftr_pkt_manager_proc, RFNOWAIT, 0, "siftr_pkt_manager_thr"); + siftr_pkt_manager_thr = FIRST_THREAD_IN_PROC(siftr_pkt_manager_proc); siftr_pfil(HOOK); @@ -1276,22 +1285,22 @@ siftr_manage_ops(uint8_t action) wakeup(&wait_for_pkt); /* Wait for the pkt_manager thread to exit. */ - mtx_sleep(siftr_pkt_manager_thr, &siftr_pkt_mgr_mtx, PWAIT, + mtx_sleep(siftr_pkt_manager_proc, &siftr_pkt_mgr_mtx, PWAIT, "thrwait", 0); - + siftr_pkt_manager_proc = NULL; siftr_pkt_manager_thr = NULL; mtx_unlock(&siftr_pkt_mgr_mtx); - totalss.n_in = DPCPU_SUM(ss, n_in); - totalss.n_out = DPCPU_SUM(ss, n_out); - totalss.nskip_in_malloc = DPCPU_SUM(ss, nskip_in_malloc); - totalss.nskip_out_malloc = DPCPU_SUM(ss, nskip_out_malloc); - totalss.nskip_in_mtx = DPCPU_SUM(ss, nskip_in_mtx); - totalss.nskip_out_mtx = DPCPU_SUM(ss, nskip_out_mtx); - totalss.nskip_in_tcpcb = DPCPU_SUM(ss, nskip_in_tcpcb); - totalss.nskip_out_tcpcb = DPCPU_SUM(ss, nskip_out_tcpcb); - totalss.nskip_in_inpcb = DPCPU_SUM(ss, nskip_in_inpcb); - totalss.nskip_out_inpcb = DPCPU_SUM(ss, nskip_out_inpcb); + totalss.n_in = DPCPU_VARSUM(ss, n_in); + totalss.n_out = DPCPU_VARSUM(ss, n_out); + totalss.nskip_in_malloc = DPCPU_VARSUM(ss, nskip_in_malloc); + totalss.nskip_out_malloc = DPCPU_VARSUM(ss, nskip_out_malloc); + totalss.nskip_in_mtx = DPCPU_VARSUM(ss, nskip_in_mtx); + totalss.nskip_out_mtx = DPCPU_VARSUM(ss, nskip_out_mtx); + totalss.nskip_in_tcpcb = DPCPU_VARSUM(ss, nskip_in_tcpcb); + totalss.nskip_out_tcpcb = DPCPU_VARSUM(ss, nskip_out_tcpcb); + totalss.nskip_in_inpcb = DPCPU_VARSUM(ss, nskip_in_inpcb); + totalss.nskip_out_inpcb = DPCPU_VARSUM(ss, nskip_out_inpcb); total_skipped_pkts = totalss.nskip_in_malloc + totalss.nskip_out_malloc + totalss.nskip_in_mtx + From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 13:30:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCE8B1065673; Sat, 6 Nov 2010 13:30:54 +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 CB3858FC18; Sat, 6 Nov 2010 13:30: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 oA6DUskn032470; Sat, 6 Nov 2010 13:30:54 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6DUsGl032468; Sat, 6 Nov 2010 13:30:54 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201011061330.oA6DUsGl032468@svn.freebsd.org> From: Michael Tuexen Date: Sat, 6 Nov 2010 13:30: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: r214876 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 13:30:55 -0000 Author: tuexen Date: Sat Nov 6 13:30:54 2010 New Revision: 214876 URL: http://svn.freebsd.org/changeset/base/214876 Log: * Fix an accounting bug regarding SACK/NR-SACK chunks. * Fix the generation of the SACK/NR-SACK gap lists. MFC after: 3 days. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Nov 6 13:03:33 2010 (r214875) +++ head/sys/netinet/sctp_output.c Sat Nov 6 13:30:54 2010 (r214876) @@ -9927,7 +9927,7 @@ sctp_send_sack(struct sctp_tcb *stcb) caddr_t limit; uint32_t *dup; int limit_reached = 0; - unsigned int i, sel_start, siz, j, starting_index; + unsigned int i, sel_start, siz, j; unsigned int num_gap_blocks = 0, num_nr_gap_blocks = 0, space; int num_dups = 0; int space_req; @@ -9954,7 +9954,7 @@ sctp_send_sack(struct sctp_tcb *stcb) if (chk->rec.chunk_id.id == type) { /* Hmm, found a sack already on queue, remove it */ TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); - asoc->ctrl_queue_cnt++; + asoc->ctrl_queue_cnt--; a_chk = chk; if (a_chk->data) { sctp_m_freem(a_chk->data); @@ -9993,15 +9993,13 @@ sctp_send_sack(struct sctp_tcb *stcb) a_chk->whoTo = NULL; if ((asoc->numduptsns) || - (asoc->last_data_chunk_from->dest_state & SCTP_ADDR_NOT_REACHABLE) - ) { + (asoc->last_data_chunk_from->dest_state & SCTP_ADDR_NOT_REACHABLE)) { /*- * Ok, we have some duplicates or the destination for the * sack is unreachable, lets see if we can select an * alternate than asoc->last_data_chunk_from */ - if ((!(asoc->last_data_chunk_from->dest_state & - SCTP_ADDR_NOT_REACHABLE)) && + if ((!(asoc->last_data_chunk_from->dest_state & SCTP_ADDR_NOT_REACHABLE)) && (asoc->used_alt_onsack > asoc->numnets)) { /* We used an alt last time, don't this time */ a_chk->whoTo = NULL; @@ -10120,53 +10118,25 @@ sctp_send_sack(struct sctp_tcb *stcb) } } - if (compare_with_wrap(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, MAX_TSN)) { - offset = 1; - /*- - * The base TSN is intialized to be the first TSN the peer - * will send us. If the cum-ack is behind this then when they - * send us the next in sequence it will mark the base_tsn bit. - * Thus we need to use the very first selector and the offset - * is 1. Our table is built for this case. - */ - starting_index = 0; + if (((type == SCTP_SELECTIVE_ACK) && + (((asoc->mapping_array[0] | asoc->nr_mapping_array[0]) & 0x01) == 0x00)) || + ((type == SCTP_NR_SELECTIVE_ACK) && + ((asoc->mapping_array[0] & 0x01) == 0x00))) { sel_start = 0; } else { - /*- - * we skip the first selector when the cum-ack is at or above the - * mapping array base. This is because the bits at the base or above - * are turned on and our first selector in the table assumes they are - * off. We thus will use the second selector (first is 0). We use - * the reverse of our macro to fix the offset, in bits, that our - * table is at. Note that this method assumes that the cum-tsn is - * within the first bit, i.e. its value is 0-7 which means the - * result to our offset will be either a 0 - -7. If the cumack - * is NOT in the first byte (0) (which it should be since we did - * a mapping array slide above) then we need to calculate the starting - * index i.e. which byte of the mapping array we should start at. We - * do this by dividing by 8 and pushing the remainder (mod) into offset. - * then we multiply the offset to be negative, since we need a negative - * offset into the selector table. - */ - SCTP_CALC_TSN_TO_GAP(offset, asoc->cumulative_tsn, asoc->mapping_array_base_tsn); - if (offset > 7) { - starting_index = offset / 8; - offset = offset % 8; - printf("Strange starting index is %d offset:%d (not 0/x)\n", - starting_index, offset); - } else { - starting_index = 0; - } - /* We need a negative offset in our table */ - offset *= -1; sel_start = 1; } + if (compare_with_wrap(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, MAX_TSN)) { + offset = 1; + } else { + offset = asoc->mapping_array_base_tsn - asoc->cumulative_tsn; + } if (((type == SCTP_SELECTIVE_ACK) && compare_with_wrap(highest_tsn, asoc->cumulative_tsn, MAX_TSN)) || ((type == SCTP_NR_SELECTIVE_ACK) && compare_with_wrap(asoc->highest_tsn_inside_map, asoc->cumulative_tsn, MAX_TSN))) { /* we have a gap .. maybe */ - for (i = starting_index; i < siz; i++) { + for (i = 0; i < siz; i++) { if (type == SCTP_SELECTIVE_ACK) { selector = &sack_array[asoc->mapping_array[i] | asoc->nr_mapping_array[i]]; } else { @@ -10224,25 +10194,21 @@ sctp_send_sack(struct sctp_tcb *stcb) mergeable = 0; - if (asoc->highest_tsn_inside_nr_map > asoc->mapping_array_base_tsn) + if (asoc->highest_tsn_inside_nr_map > asoc->mapping_array_base_tsn) { siz = (((asoc->highest_tsn_inside_nr_map - asoc->mapping_array_base_tsn) + 1) + 7) / 8; - else + } else { siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + asoc->highest_tsn_inside_nr_map + 7) / 8; + } + if ((asoc->nr_mapping_array[0] & 0x01) == 0x00) { + sel_start = 0; + } else { + sel_start = 1; + } if (compare_with_wrap(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, MAX_TSN)) { offset = 1; - /*- - * cum-ack behind the mapping array, so we start and use all - * entries. - */ - sel_start = 0; } else { offset = asoc->mapping_array_base_tsn - asoc->cumulative_tsn; - /*- - * we skip the first one when the cum-ack is at or above the - * mapping array base. Note this only works if - */ - sel_start = 1; } if (compare_with_wrap(asoc->highest_tsn_inside_nr_map, asoc->cumulative_tsn, MAX_TSN)) { /* we have a gap .. maybe */ From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 13:43:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D7E8106564A; Sat, 6 Nov 2010 13:43:19 +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 3C4688FC12; Sat, 6 Nov 2010 13:43: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 oA6DhJHu032747; Sat, 6 Nov 2010 13:43:19 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6DhJJ8032745; Sat, 6 Nov 2010 13:43:19 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201011061343.oA6DhJJ8032745@svn.freebsd.org> From: Michael Tuexen Date: Sat, 6 Nov 2010 13:43: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: r214877 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 13:43:19 -0000 Author: tuexen Date: Sat Nov 6 13:43:18 2010 New Revision: 214877 URL: http://svn.freebsd.org/changeset/base/214877 Log: Do not resend DATA chunks without delay when dropped by the peer and the CRC was correct. MFC after: 3 days. Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Nov 6 13:30:54 2010 (r214876) +++ head/sys/netinet/sctp_input.c Sat Nov 6 13:43:18 2010 (r214877) @@ -3115,6 +3115,10 @@ process_chunk_drop(struct sctp_tcb *stcb if ((tp1) && (tp1->sent < SCTP_DATAGRAM_ACKED)) { uint8_t *ddp; + if (((flg & SCTP_BADCRC) == 0) && + ((flg & SCTP_FROM_MIDDLE_BOX) == 0)) { + return (0); + } if ((stcb->asoc.peers_rwnd == 0) && ((flg & SCTP_FROM_MIDDLE_BOX) == 0)) { SCTP_STAT_INCR(sctps_pdrpdiwnp); From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 13:46:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A126106564A; Sat, 6 Nov 2010 13:46:59 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 378318FC19; Sat, 6 Nov 2010 13:46: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 oA6Dkx2i032875; Sat, 6 Nov 2010 13:46:59 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6DkxWv032871; Sat, 6 Nov 2010 13:46:59 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061346.oA6DkxWv032871@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 13:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214878 - stable/7/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 13:46:59 -0000 Author: lstewart Date: Sat Nov 6 13:46:58 2010 New Revision: 214878 URL: http://svn.freebsd.org/changeset/base/214878 Log: MFC r213158: Internalise reassembly queue related functionality and variables which should not be used outside of the reassembly queue implementation. Provide a new function to flush all segments from a reassembly queue and call it from the appropriate places instead of manipulating the queue directly. The base code from r213158 was modified as part of this MFC in order to work correctly on FreeBSD 7. Sponsored by: FreeBSD Foundation Reviewed by: andre, gnn, rpaulo Modified: stable/7/sys/netinet/tcp_reass.c stable/7/sys/netinet/tcp_subr.c stable/7/sys/netinet/tcp_var.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/tcp_reass.c ============================================================================== --- stable/7/sys/netinet/tcp_reass.c Sat Nov 6 13:43:18 2010 (r214877) +++ stable/7/sys/netinet/tcp_reass.c Sat Nov 6 13:46:58 2010 (r214878) @@ -81,7 +81,7 @@ SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO &tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue"); -int tcp_reass_qsize = 0; +static int tcp_reass_qsize = 0; SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, &tcp_reass_qsize, 0, "Global number of TCP Segments currently in Reassembly Queue"); @@ -96,6 +96,8 @@ SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); +static uma_zone_t tcp_reass_zone; + /* Initialize TCP reassembly queue */ static void tcp_reass_zone_change(void *tag) @@ -105,8 +107,6 @@ tcp_reass_zone_change(void *tag) uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg); } -uma_zone_t tcp_reass_zone; - void tcp_reass_init(void) { @@ -121,6 +121,26 @@ tcp_reass_init(void) tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } +void +tcp_reass_flush(struct tcpcb *tp) +{ + struct tseg_qent *qe; + + INP_WLOCK_ASSERT(tp->t_inpcb); + + while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { + LIST_REMOVE(qe, tqe_q); + m_freem(qe->tqe_m); + uma_zfree(tcp_reass_zone, qe); + tp->t_segqlen--; + tcp_reass_qsize--; + } + + KASSERT((tp->t_segqlen == 0), + ("TCP reass queue %p segment count is %d instead of 0 after flush.", + tp, tp->t_segqlen)); +} + int tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { Modified: stable/7/sys/netinet/tcp_subr.c ============================================================================== --- stable/7/sys/netinet/tcp_subr.c Sat Nov 6 13:43:18 2010 (r214877) +++ stable/7/sys/netinet/tcp_subr.c Sat Nov 6 13:46:58 2010 (r214878) @@ -704,7 +704,6 @@ tcp_drop(struct tcpcb *tp, int errno) void tcp_discardcb(struct tcpcb *tp) { - struct tseg_qent *q; struct inpcb *inp = tp->t_inpcb; struct socket *so = inp->inp_socket; #ifdef INET6 @@ -782,13 +781,7 @@ tcp_discardcb(struct tcpcb *tp) } /* free the reassembly queue, if any */ - while ((q = LIST_FIRST(&tp->t_segq)) != NULL) { - LIST_REMOVE(q, tqe_q); - m_freem(q->tqe_m); - uma_zfree(tcp_reass_zone, q); - tp->t_segqlen--; - tcp_reass_qsize--; - } + tcp_reass_flush(tp); /* Disconnect offload device, if any. */ tcp_offload_detach(tp); @@ -840,7 +833,6 @@ tcp_drain(void) if (do_tcpdrain) { struct inpcb *inpb; struct tcpcb *tcpb; - struct tseg_qent *te; /* * Walk the tcpbs, if existing, and flush the reassembly queue, @@ -856,14 +848,7 @@ tcp_drain(void) continue; INP_WLOCK(inpb); if ((tcpb = intotcpcb(inpb)) != NULL) { - while ((te = LIST_FIRST(&tcpb->t_segq)) - != NULL) { - LIST_REMOVE(te, tqe_q); - m_freem(te->tqe_m); - uma_zfree(tcp_reass_zone, te); - tcpb->t_segqlen--; - tcp_reass_qsize--; - } + tcp_reass_flush(tcpb); tcp_clean_sackreport(tcpb); } INP_WUNLOCK(inpb); Modified: stable/7/sys/netinet/tcp_var.h ============================================================================== --- stable/7/sys/netinet/tcp_var.h Sat Nov 6 13:43:18 2010 (r214877) +++ stable/7/sys/netinet/tcp_var.h Sat Nov 6 13:46:58 2010 (r214878) @@ -48,8 +48,6 @@ struct tseg_qent { struct mbuf *tqe_m; /* mbuf contains packet */ }; LIST_HEAD(tsegqe_head, tseg_qent); -extern int tcp_reass_qsize; -extern struct uma_zone *tcp_reass_zone; struct sackblk { tcp_seq start; /* start seq no. of sack block */ @@ -543,6 +541,7 @@ char *tcp_log_vain(struct in_conninfo *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); void tcp_reass_init(void); +void tcp_reass_flush(struct tcpcb *); void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, int *); u_long tcp_maxmtu6(struct in_conninfo *, int *); From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 13:58:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 548151065702; Sat, 6 Nov 2010 13:58:25 +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 431CF8FC1A; Sat, 6 Nov 2010 13:58:25 +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 oA6DwPnk033155; Sat, 6 Nov 2010 13:58:25 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6DwPC1033153; Sat, 6 Nov 2010 13:58:25 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011061358.oA6DwPC1033153@svn.freebsd.org> From: Marius Strobl Date: Sat, 6 Nov 2010 13:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214879 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 13:58:25 -0000 Author: marius Date: Sat Nov 6 13:58:24 2010 New Revision: 214879 URL: http://svn.freebsd.org/changeset/base/214879 Log: Implement pmap_is_prefaultable(). Reviewed by: alc (with bugfix) Modified: head/sys/sparc64/sparc64/pmap.c Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Sat Nov 6 13:46:58 2010 (r214878) +++ head/sys/sparc64/sparc64/pmap.c Sat Nov 6 13:58:24 2010 (r214879) @@ -1960,8 +1960,12 @@ pmap_is_modified(vm_page_t m) boolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) { + boolean_t rv; - return (FALSE); + PMAP_LOCK(pmap); + rv = tsb_tte_lookup(pmap, addr) == NULL; + PMAP_UNLOCK(pmap); + return (rv); } /* From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 14:22:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01D5C1065694; Sat, 6 Nov 2010 14:22:51 +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 CA2D38FC19; Sat, 6 Nov 2010 14:22: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 oA6EMoXS033711; Sat, 6 Nov 2010 14:22:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6EMout033709; Sat, 6 Nov 2010 14:22:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011061422.oA6EMout033709@svn.freebsd.org> From: Alexander Motin Date: Sat, 6 Nov 2010 14:22: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: r214880 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 14:22:51 -0000 Author: mav Date: Sat Nov 6 14:22:50 2010 New Revision: 214880 URL: http://svn.freebsd.org/changeset/base/214880 Log: Add support for odd-sized PIO transfers, sometimes used by ATAPI. Modified: head/sys/dev/ata/ata-lowlevel.c Modified: head/sys/dev/ata/ata-lowlevel.c ============================================================================== --- head/sys/dev/ata/ata-lowlevel.c Sat Nov 6 13:58:24 2010 (r214879) +++ head/sys/dev/ata/ata-lowlevel.c Sat Nov 6 14:22:50 2010 (r214880) @@ -833,12 +833,18 @@ ata_pio_read(struct ata_request *request struct ata_channel *ch = device_get_softc(request->parent); int size = min(request->transfersize, length); int resid; + uint8_t buf[2]; - if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t))) + if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t))) { ATA_IDX_INSW_STRM(ch, ATA_DATA, (void*)((uintptr_t)request->data+request->donecount), size / sizeof(int16_t)); - else + if (size & 1) { + ATA_IDX_INSW_STRM(ch, ATA_DATA, (void*)buf, 1); + ((uint8_t *)request->data + request->donecount + + (size & ~1))[0] = buf[0]; + } + } else ATA_IDX_INSL_STRM(ch, ATA_DATA, (void*)((uintptr_t)request->data+request->donecount), size / sizeof(int32_t)); @@ -846,7 +852,7 @@ ata_pio_read(struct ata_request *request if (request->transfersize < length) { device_printf(request->parent, "WARNING - %s read data overrun %d>%d\n", ata_cmd2str(request), length, request->transfersize); - for (resid = request->transfersize; resid < length; + for (resid = request->transfersize + (size & 1); resid < length; resid += sizeof(int16_t)) ATA_IDX_INW(ch, ATA_DATA); } @@ -858,12 +864,18 @@ ata_pio_write(struct ata_request *reques struct ata_channel *ch = device_get_softc(request->parent); int size = min(request->transfersize, length); int resid; + uint8_t buf[2]; - if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t))) + if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t))) { ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (void*)((uintptr_t)request->data+request->donecount), size / sizeof(int16_t)); - else + if (size & 1) { + buf[0] = ((uint8_t *)request->data + request->donecount + + (size & ~1))[0]; + ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (void*)buf, 1); + } + } else ATA_IDX_OUTSL_STRM(ch, ATA_DATA, (void*)((uintptr_t)request->data+request->donecount), size / sizeof(int32_t)); @@ -871,7 +883,7 @@ ata_pio_write(struct ata_request *reques if (request->transfersize < length) { device_printf(request->parent, "WARNING - %s write data underrun %d>%d\n", ata_cmd2str(request), length, request->transfersize); - for (resid = request->transfersize; resid < length; + for (resid = request->transfersize + (size & 1); resid < length; resid += sizeof(int16_t)) ATA_IDX_OUTW(ch, ATA_DATA, 0); } From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 14:38:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3BB5106566B; Sat, 6 Nov 2010 14:38:57 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C72678FC0C; Sat, 6 Nov 2010 14:38: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 oA6Ecvk9034139; Sat, 6 Nov 2010 14:38:57 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6EcvW5034136; Sat, 6 Nov 2010 14:38:57 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061438.oA6EcvW5034136@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 14:38:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214881 - stable/7/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 14:38:58 -0000 Author: lstewart Date: Sat Nov 6 14:38:57 2010 New Revision: 214881 URL: http://svn.freebsd.org/changeset/base/214881 Log: MFC r211396 (originally committed by andre): Add uma_zone_get_max() to obtain the effective limit after a call to uma_zone_set_max(). The UMA zone limit is not exactly set to the value supplied but rounded up to completely fill the backing store increment (a page normally). This can lead to surprising situations where the number of elements allocated from UMA is higher than the supplied limit value. The new get function reads back the effective value so that the supplied limit value can be adjusted to the real limit. The base code from r211396 was modified as part of this MFC in order to work correctly on FreeBSD 7. Reviewed by: jeffr Modified: stable/7/sys/vm/uma.h stable/7/sys/vm/uma_core.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/vm/uma.h ============================================================================== --- stable/7/sys/vm/uma.h Sat Nov 6 14:22:50 2010 (r214880) +++ stable/7/sys/vm/uma.h Sat Nov 6 14:38:57 2010 (r214881) @@ -431,6 +431,18 @@ int uma_zone_set_obj(uma_zone_t zone, st void uma_zone_set_max(uma_zone_t zone, int nitems); /* + * Obtains the effective limit on the number of items in a zone + * + * Arguments: + * zone The zone to obtain the effective limit from + * + * Return: + * 0 No limit + * int The effective limit of the zone + */ +int uma_zone_get_max(uma_zone_t zone); + +/* * The following two routines (uma_zone_set_init/fini) * are used to set the backend init/fini pair which acts on an * object as it becomes allocated and is placed in a slab within Modified: stable/7/sys/vm/uma_core.c ============================================================================== --- stable/7/sys/vm/uma_core.c Sat Nov 6 14:22:50 2010 (r214880) +++ stable/7/sys/vm/uma_core.c Sat Nov 6 14:38:57 2010 (r214881) @@ -2521,6 +2521,24 @@ uma_zone_set_max(uma_zone_t zone, int ni } /* See uma.h */ +int +uma_zone_get_max(uma_zone_t zone) +{ + int nitems; + uma_keg_t keg; + + ZONE_LOCK(zone); + keg = zone->uz_keg; + if (keg->uk_maxpages) + nitems = keg->uk_maxpages * keg->uk_ipers; + else + nitems = 0; + ZONE_UNLOCK(zone); + + return (nitems); +} + +/* See uma.h */ void uma_zone_set_init(uma_zone_t zone, uma_init uminit) { From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 14:46:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1639106564A; Sat, 6 Nov 2010 14:46:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EB5A8FC0A; Sat, 6 Nov 2010 14:46: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 oA6EkOoX034370; Sat, 6 Nov 2010 14:46:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6EkOV9034364; Sat, 6 Nov 2010 14:46:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201011061446.oA6EkOV9034364@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 6 Nov 2010 14:46:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214882 - in stable/8/sys: netinet netinet6 netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 14:46:24 -0000 Author: bz Date: Sat Nov 6 14:46:24 2010 New Revision: 214882 URL: http://svn.freebsd.org/changeset/base/214882 Log: MFC r214250: Make the IPsec SADB embedded route cache a union to be able to hold both the legacy and IPv6 route destination address. Previously in case of IPv6, there was a memory overwrite due to not enough space for the IPv6 address. PR: kern/122565 Modified: stable/8/sys/netinet/ip_ipsec.c stable/8/sys/netinet6/ip6_ipsec.c stable/8/sys/netipsec/ipsec_output.c stable/8/sys/netipsec/key.c stable/8/sys/netipsec/keydb.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/ip_ipsec.c ============================================================================== --- stable/8/sys/netinet/ip_ipsec.c Sat Nov 6 14:38:57 2010 (r214881) +++ stable/8/sys/netinet/ip_ipsec.c Sat Nov 6 14:46:24 2010 (r214882) @@ -239,7 +239,7 @@ ip_ipsec_mtu(struct mbuf *m, int mtu) if (sp->req != NULL && sp->req->sav != NULL && sp->req->sav->sah != NULL) { - ro = &sp->req->sav->sah->sa_route; + ro = &sp->req->sav->sah->route_cache.sa_route; if (ro->ro_rt && ro->ro_rt->rt_ifp) { mtu = ro->ro_rt->rt_rmx.rmx_mtu ? Modified: stable/8/sys/netinet6/ip6_ipsec.c ============================================================================== --- stable/8/sys/netinet6/ip6_ipsec.c Sat Nov 6 14:38:57 2010 (r214881) +++ stable/8/sys/netinet6/ip6_ipsec.c Sat Nov 6 14:46:24 2010 (r214882) @@ -366,7 +366,7 @@ ip6_ipsec_mtu(struct mbuf *m) if (sp->req != NULL && sp->req->sav != NULL && sp->req->sav->sah != NULL) { - ro = &sp->req->sav->sah->sa_route; + ro = &sp->req->sav->sah->route_cache.sa_route; if (ro->ro_rt && ro->ro_rt->rt_ifp) { mtu = ro->ro_rt->rt_rmx.rmx_mtu ? Modified: stable/8/sys/netipsec/ipsec_output.c ============================================================================== --- stable/8/sys/netipsec/ipsec_output.c Sat Nov 6 14:38:57 2010 (r214881) +++ stable/8/sys/netipsec/ipsec_output.c Sat Nov 6 14:46:24 2010 (r214882) @@ -829,7 +829,8 @@ ipsec6_output_tunnel(struct ipsec_output } ip6 = mtod(m, struct ip6_hdr *); - state->ro = &isr->sav->sah->sa_route; + state->ro = + (struct route *)&isr->sav->sah->route_cache.sin6_route; state->dst = (struct sockaddr *)&state->ro->ro_dst; dst6 = (struct sockaddr_in6 *)state->dst; if (state->ro->ro_rt Modified: stable/8/sys/netipsec/key.c ============================================================================== --- stable/8/sys/netipsec/key.c Sat Nov 6 14:38:57 2010 (r214881) +++ stable/8/sys/netipsec/key.c Sat Nov 6 14:46:24 2010 (r214882) @@ -2767,9 +2767,9 @@ key_delsah(sah) /* remove from tree of SA index */ if (__LIST_CHAINED(sah)) LIST_REMOVE(sah, chain); - if (sah->sa_route.ro_rt) { - RTFREE(sah->sa_route.ro_rt); - sah->sa_route.ro_rt = (struct rtentry *)NULL; + if (sah->route_cache.sa_route.ro_rt) { + RTFREE(sah->route_cache.sa_route.ro_rt); + sah->route_cache.sa_route.ro_rt = (struct rtentry *)NULL; } free(sah, M_IPSEC_SAH); } @@ -7933,7 +7933,7 @@ key_sa_routechange(dst) SAHTREE_LOCK(); LIST_FOREACH(sah, &V_sahtree, chain) { - ro = &sah->sa_route; + ro = &sah->route_cache.sa_route; if (ro->ro_rt && dst->sa_len == ro->ro_dst.sa_len && bcmp(dst, &ro->ro_dst, dst->sa_len) == 0) { RTFREE(ro->ro_rt); Modified: stable/8/sys/netipsec/keydb.h ============================================================================== --- stable/8/sys/netipsec/keydb.h Sat Nov 6 14:38:57 2010 (r214881) +++ stable/8/sys/netipsec/keydb.h Sat Nov 6 14:46:24 2010 (r214882) @@ -85,6 +85,12 @@ struct seclifetime { u_int64_t usetime; }; +union sa_route_union { + struct route sa_route; + struct route sin_route; /* Duplicate for consistency. */ + struct route_in6 sin6_route; +}; + /* Security Association Data Base */ struct secashead { LIST_ENTRY(secashead) chain; @@ -100,7 +106,7 @@ struct secashead { /* SA chain */ /* The first of this list is newer SA */ - struct route sa_route; /* route cache */ + union sa_route_union route_cache; }; struct xformsw; From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 14:49:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EAB1106566C; Sat, 6 Nov 2010 14:49:10 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B7778FC19; Sat, 6 Nov 2010 14:49: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 oA6EnAjT034458; Sat, 6 Nov 2010 14:49:10 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6EnAPq034456; Sat, 6 Nov 2010 14:49:10 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061449.oA6EnAPq034456@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 14:49:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214883 - stable/7/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 14:49:10 -0000 Author: lstewart Date: Sat Nov 6 14:49:10 2010 New Revision: 214883 URL: http://svn.freebsd.org/changeset/base/214883 Log: MFC r210203: - Move common code from the hook functions that fills in a packet node struct to a separate inline function. This further reduces duplicate code that didn't have a good reason to stay as it was. - Reorder the malloc of a pkt_node struct in the hook functions such that it only occurs if we managed to find a usable tcpcb associated with the packet. - Make the inp_locally_locked variable's type consistent with the prototype of siftr_siftdata(). Sponsored by: FreeBSD Foundation Modified: stable/7/sys/netinet/siftr.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/siftr.c ============================================================================== --- stable/7/sys/netinet/siftr.c Sat Nov 6 14:46:24 2010 (r214882) +++ stable/7/sys/netinet/siftr.c Sat Nov 6 14:49:10 2010 (r214883) @@ -752,6 +752,67 @@ siftr_findinpcb(int ipver, struct ip *ip } +static inline void +siftr_siftdata(struct pkt_node *pn, struct inpcb *inp, struct tcpcb *tp, + int ipver, int dir, int inp_locally_locked) +{ +#ifdef SIFTR_IPV6 + if (ipver == INP_IPV4) { + pn->ip_laddr[3] = inp->inp_laddr.s_addr; + pn->ip_faddr[3] = inp->inp_faddr.s_addr; +#else + *((uint32_t *)pn->ip_laddr) = inp->inp_laddr.s_addr; + *((uint32_t *)pn->ip_faddr) = inp->inp_faddr.s_addr; +#endif +#ifdef SIFTR_IPV6 + } else { + pn->ip_laddr[0] = inp->in6p_laddr.s6_addr32[0]; + pn->ip_laddr[1] = inp->in6p_laddr.s6_addr32[1]; + pn->ip_laddr[2] = inp->in6p_laddr.s6_addr32[2]; + pn->ip_laddr[3] = inp->in6p_laddr.s6_addr32[3]; + pn->ip_faddr[0] = inp->in6p_faddr.s6_addr32[0]; + pn->ip_faddr[1] = inp->in6p_faddr.s6_addr32[1]; + pn->ip_faddr[2] = inp->in6p_faddr.s6_addr32[2]; + pn->ip_faddr[3] = inp->in6p_faddr.s6_addr32[3]; + } +#endif + pn->tcp_localport = inp->inp_lport; + pn->tcp_foreignport = inp->inp_fport; + pn->snd_cwnd = tp->snd_cwnd; + pn->snd_wnd = tp->snd_wnd; + pn->rcv_wnd = tp->rcv_wnd; + pn->snd_bwnd = tp->snd_bwnd; + pn->snd_ssthresh = tp->snd_ssthresh; + pn->snd_scale = tp->snd_scale; + pn->rcv_scale = tp->rcv_scale; + pn->conn_state = tp->t_state; + pn->max_seg_size = tp->t_maxseg; + pn->smoothed_rtt = tp->t_srtt; + pn->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0; + pn->flags = tp->t_flags; + pn->rxt_length = tp->t_rxtcur; + pn->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat; + pn->snd_buf_cc = inp->inp_socket->so_snd.sb_cc; + pn->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat; + pn->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc; + pn->sent_inflight_bytes = tp->snd_max - tp->snd_una; + + /* We've finished accessing the tcb so release the lock. */ + if (inp_locally_locked) + INP_RUNLOCK(inp); + + pn->ipver = ipver; + pn->direction = dir; + + /* + * Significantly more accurate than using getmicrotime(), but slower! + * Gives true microsecond resolution at the expense of a hit to + * maximum pps throughput processing when SIFTR is loaded and enabled. + */ + microtime(&pn->tval); +} + + /* * pfil hook that is called for each IPv4 packet making its way through the * stack in either direction. @@ -764,13 +825,13 @@ static int siftr_chkpkt(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, struct inpcb *inp) { - struct pkt_node *pkt_node; + struct pkt_node *pn; struct ip *ip; struct tcphdr *th; struct tcpcb *tp; struct siftr_stats *ss; unsigned int ip_hl; - uint8_t inp_locally_locked; + int inp_locally_locked; inp_locally_locked = 0; ss = DPCPU_PTR(ss); @@ -824,18 +885,6 @@ siftr_chkpkt(void *arg, struct mbuf **m, INP_LOCK_ASSERT(inp); - pkt_node = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE, - M_NOWAIT | M_ZERO); - - if (pkt_node == NULL) { - if (dir == PFIL_IN) - ss->nskip_in_malloc++; - else - ss->nskip_out_malloc++; - - goto inp_unlock; - } - /* Find the TCP control block that corresponds with this packet */ tp = intotcpcb(inp); @@ -850,53 +899,21 @@ siftr_chkpkt(void *arg, struct mbuf **m, else ss->nskip_out_tcpcb++; - free(pkt_node, M_SIFTR_PKTNODE); goto inp_unlock; } - /* Fill in pkt_node data */ -#ifdef SIFTR_IPV6 - pkt_node->ip_laddr[3] = inp->inp_laddr.s_addr; - pkt_node->ip_faddr[3] = inp->inp_faddr.s_addr; -#else - *((uint32_t *)pkt_node->ip_laddr) = inp->inp_laddr.s_addr; - *((uint32_t *)pkt_node->ip_faddr) = inp->inp_faddr.s_addr; -#endif - pkt_node->tcp_localport = inp->inp_lport; - pkt_node->tcp_foreignport = inp->inp_fport; - pkt_node->snd_cwnd = tp->snd_cwnd; - pkt_node->snd_wnd = tp->snd_wnd; - pkt_node->rcv_wnd = tp->rcv_wnd; - pkt_node->snd_bwnd = tp->snd_bwnd; - pkt_node->snd_ssthresh = tp->snd_ssthresh; - pkt_node->snd_scale = tp->snd_scale; - pkt_node->rcv_scale = tp->rcv_scale; - pkt_node->conn_state = tp->t_state; - pkt_node->max_seg_size = tp->t_maxseg; - pkt_node->smoothed_rtt = tp->t_srtt; - pkt_node->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0; - pkt_node->flags = tp->t_flags; - pkt_node->rxt_length = tp->t_rxtcur; - pkt_node->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat; - pkt_node->snd_buf_cc = inp->inp_socket->so_snd.sb_cc; - pkt_node->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat; - pkt_node->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc; - pkt_node->sent_inflight_bytes = tp->snd_max - tp->snd_una; + pn = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE, M_NOWAIT|M_ZERO); - /* We've finished accessing the tcb so release the lock. */ - if (inp_locally_locked) - INP_RUNLOCK(inp); + if (pn == NULL) { + if (dir == PFIL_IN) + ss->nskip_in_malloc++; + else + ss->nskip_out_malloc++; - /* These are safe to access without the inp lock. */ - pkt_node->ipver = INP_IPV4; - pkt_node->direction = dir; + goto inp_unlock; + } - /* - * Significantly more accurate than using getmicrotime(), but slower! - * Gives true microsecond resolution at the expense of a hit to - * maximum pps throughput processing when SIFTR is loaded and enabled. - */ - microtime(&(pkt_node->tval)); + siftr_siftdata(pn, inp, tp, INP_IPV4, dir, inp_locally_locked); if (siftr_generate_hashes) { if ((*m)->m_pkthdr.csum_flags & CSUM_TCP) { @@ -956,11 +973,11 @@ siftr_chkpkt(void *arg, struct mbuf **m, * find a way to create the hash and checksum in the same pass * over the bytes. */ - pkt_node->hash = hash_pkt(*m, ip_hl); + pn->hash = hash_pkt(*m, ip_hl); } mtx_lock(&siftr_pkt_queue_mtx); - STAILQ_INSERT_TAIL(&pkt_queue, pkt_node, nodes); + STAILQ_INSERT_TAIL(&pkt_queue, pn, nodes); mtx_unlock(&siftr_pkt_queue_mtx); goto ret; @@ -979,13 +996,13 @@ static int siftr_chkpkt6(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, struct inpcb *inp) { - struct pkt_node *pkt_node; + struct pkt_node *pn; struct ip6_hdr *ip6; struct tcphdr *th; struct tcpcb *tp; struct siftr_stats *ss; unsigned int ip6_hl; - uint8_t inp_locally_locked; + int inp_locally_locked; inp_locally_locked = 0; ss = DPCPU_PTR(ss); @@ -1043,18 +1060,6 @@ siftr_chkpkt6(void *arg, struct mbuf **m inp_locally_locked = 1; } - pkt_node = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE, - M_NOWAIT | M_ZERO); - - if (pkt_node == NULL) { - if (dir == PFIL_IN) - ss->nskip_in_malloc++; - else - ss->nskip_out_malloc++; - - goto inp_unlock6; - } - /* Find the TCP control block that corresponds with this packet. */ tp = intotcpcb(inp); @@ -1069,59 +1074,26 @@ siftr_chkpkt6(void *arg, struct mbuf **m else ss->nskip_out_tcpcb++; - free(pkt_node, M_SIFTR_PKTNODE); goto inp_unlock6; } - /* Fill in pkt_node data. */ - pkt_node->ip_laddr[0] = inp->in6p_laddr.s6_addr32[0]; - pkt_node->ip_laddr[1] = inp->in6p_laddr.s6_addr32[1]; - pkt_node->ip_laddr[2] = inp->in6p_laddr.s6_addr32[2]; - pkt_node->ip_laddr[3] = inp->in6p_laddr.s6_addr32[3]; - pkt_node->ip_faddr[0] = inp->in6p_faddr.s6_addr32[0]; - pkt_node->ip_faddr[1] = inp->in6p_faddr.s6_addr32[1]; - pkt_node->ip_faddr[2] = inp->in6p_faddr.s6_addr32[2]; - pkt_node->ip_faddr[3] = inp->in6p_faddr.s6_addr32[3]; - pkt_node->tcp_localport = inp->inp_lport; - pkt_node->tcp_foreignport = inp->inp_fport; - pkt_node->snd_cwnd = tp->snd_cwnd; - pkt_node->snd_wnd = tp->snd_wnd; - pkt_node->rcv_wnd = tp->rcv_wnd; - pkt_node->snd_bwnd = tp->snd_bwnd; - pkt_node->snd_ssthresh = tp->snd_ssthresh; - pkt_node->snd_scale = tp->snd_scale; - pkt_node->rcv_scale = tp->rcv_scale; - pkt_node->conn_state = tp->t_state; - pkt_node->max_seg_size = tp->t_maxseg; - pkt_node->smoothed_rtt = tp->t_srtt; - pkt_node->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0; - pkt_node->flags = tp->t_flags; - pkt_node->rxt_length = tp->t_rxtcur; - pkt_node->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat; - pkt_node->snd_buf_cc = inp->inp_socket->so_snd.sb_cc; - pkt_node->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat; - pkt_node->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc; - pkt_node->sent_inflight_bytes = tp->snd_max - tp->snd_una; + pn = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE, M_NOWAIT|M_ZERO); - /* We've finished accessing the tcb so release the lock. */ - if (inp_locally_locked) - INP_RUNLOCK(inp); + if (pn == NULL) { + if (dir == PFIL_IN) + ss->nskip_in_malloc++; + else + ss->nskip_out_malloc++; - /* These are safe to access without the inp lock. */ - pkt_node->ipver = INP_IPV6; - pkt_node->direction = dir; + goto inp_unlock6; + } - /* - * Significantly more accurate than using getmicrotime(), but slower! - * Gives true microsecond resolution at the expense of a hit to - * maximum pps throughput processing when SIFTR is loaded and enabled. - */ - microtime(&(pkt_node->tval)); + siftr_siftdata(pn, inp, tp, INP_IPV6, dir, inp_locally_locked); - /* XXX: Figure out how to do hash calcs for IPv6 */ + /* XXX: Figure out how to generate hashes for IPv6 packets. */ mtx_lock(&siftr_pkt_queue_mtx); - STAILQ_INSERT_TAIL(&pkt_queue, pkt_node, nodes); + STAILQ_INSERT_TAIL(&pkt_queue, pn, nodes); mtx_unlock(&siftr_pkt_queue_mtx); goto ret6; From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 14:53:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62C291065674; Sat, 6 Nov 2010 14:53:22 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FDC68FC16; Sat, 6 Nov 2010 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 oA6ErMkn034600; Sat, 6 Nov 2010 14:53:22 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6ErMt5034597; Sat, 6 Nov 2010 14:53:22 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061453.oA6ErMt5034597@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 14:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214884 - in stable/7: share/man/man4 sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 14:53:22 -0000 Author: lstewart Date: Sat Nov 6 14:53:22 2010 New Revision: 214884 URL: http://svn.freebsd.org/changeset/base/214884 Log: MFC r213162: Log the number of segments currently in the reassembly queue. Sponsored by: FreeBSD Foundation Modified: stable/7/share/man/man4/siftr.4 stable/7/sys/netinet/siftr.c Directory Properties: stable/7/share/man/ (props changed) stable/7/share/man/man1/ (props changed) stable/7/share/man/man3/ (props changed) stable/7/share/man/man4/ (props changed) stable/7/share/man/man5/ (props changed) stable/7/share/man/man7/ (props changed) stable/7/share/man/man8/ (props changed) stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man4/siftr.4 ============================================================================== --- stable/7/share/man/man4/siftr.4 Sat Nov 6 14:49:10 2010 (r214883) +++ stable/7/share/man/man4/siftr.4 Sat Nov 6 14:53:22 2010 (r214884) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2010 +.Dd September 25, 2010 .Dt SIFTR 4 .Os .Sh NAME @@ -198,7 +198,7 @@ The data is CSV formatted. .Bd -literal -offset indent o,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\ 1073725440,172312,6144,66560,66608,8,1,4,1448,936,1,996,255, \\ -33304,208,66608,0,208 +33304,208,66608,0,208,0 .Ed .Pp Field descriptions are as follows: @@ -328,6 +328,10 @@ The current number of bytes in the socke The current number of unacknowledged bytes in-flight. Bytes acknowledged via SACK are not excluded from this count. .El +.Bl -tag -offset indent +.It Va 26 +The current number of segments in the reassembly queue. +.El .Pp The third type of log message is written to the file when the module is disabled and ceases collecting data from the running kernel. Modified: stable/7/sys/netinet/siftr.c ============================================================================== --- stable/7/sys/netinet/siftr.c Sat Nov 6 14:49:10 2010 (r214883) +++ stable/7/sys/netinet/siftr.c Sat Nov 6 14:53:22 2010 (r214884) @@ -55,7 +55,7 @@ * SIFTR should be directed to him via email: lastewart@swin.edu.au * * Initial release date: June 2007 - * Most recent update: June 2010 + * Most recent update: September 2010 ******************************************************/ #include @@ -105,7 +105,7 @@ __FBSDID("$FreeBSD$"); */ #define V_MAJOR 1 #define V_BACKBREAK 2 -#define V_BACKCOMPAT 3 +#define V_BACKCOMPAT 4 #define MODVERSION __CONCAT(V_MAJOR, __CONCAT(V_BACKBREAK, V_BACKCOMPAT)) #define MODVERSION_STR __XSTRING(V_MAJOR) "." __XSTRING(V_BACKBREAK) "." \ __XSTRING(V_BACKCOMPAT) @@ -226,6 +226,8 @@ struct pkt_node { u_int rcv_buf_cc; /* Number of bytes inflight that we are waiting on ACKs for. */ u_int sent_inflight_bytes; + /* Number of segments currently in the reassembly queue. */ + int t_segqlen; /* Link to next pkt_node in the list. */ STAILQ_ENTRY(pkt_node) nodes; }; @@ -448,7 +450,7 @@ siftr_process_pkt(struct pkt_node * pkt_ MAX_LOG_MSG_LEN, "%c,0x%08x,%zd.%06ld,%x:%x:%x:%x:%x:%x:%x:%x,%u,%x:%x:%x:" "%x:%x:%x:%x:%x,%u,%ld,%ld,%ld,%ld,%ld,%u,%u,%u,%u,%u,%u," - "%u,%d,%u,%u,%u,%u,%u\n", + "%u,%d,%u,%u,%u,%u,%u,%u\n", direction[pkt_node->direction], pkt_node->hash, pkt_node->tval.tv_sec, @@ -488,7 +490,8 @@ siftr_process_pkt(struct pkt_node * pkt_ pkt_node->snd_buf_cc, pkt_node->rcv_buf_hiwater, pkt_node->rcv_buf_cc, - pkt_node->sent_inflight_bytes); + pkt_node->sent_inflight_bytes, + pkt_node->t_segqlen); } else { /* IPv4 packet */ pkt_node->ip_laddr[0] = FIRST_OCTET(pkt_node->ip_laddr[3]); pkt_node->ip_laddr[1] = SECOND_OCTET(pkt_node->ip_laddr[3]); @@ -504,7 +507,7 @@ siftr_process_pkt(struct pkt_node * pkt_ log_buf->ae_bytesused = snprintf(log_buf->ae_data, MAX_LOG_MSG_LEN, "%c,0x%08x,%jd.%06ld,%u.%u.%u.%u,%u,%u.%u.%u.%u,%u,%ld,%ld," - "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u\n", + "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u,%u\n", direction[pkt_node->direction], pkt_node->hash, (intmax_t)pkt_node->tval.tv_sec, @@ -536,7 +539,8 @@ siftr_process_pkt(struct pkt_node * pkt_ pkt_node->snd_buf_cc, pkt_node->rcv_buf_hiwater, pkt_node->rcv_buf_cc, - pkt_node->sent_inflight_bytes); + pkt_node->sent_inflight_bytes, + pkt_node->t_segqlen); #ifdef SIFTR_IPV6 } #endif @@ -796,6 +800,7 @@ siftr_siftdata(struct pkt_node *pn, stru pn->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat; pn->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc; pn->sent_inflight_bytes = tp->snd_max - tp->snd_una; + pn->t_segqlen = tp->t_segqlen; /* We've finished accessing the tcb so release the lock. */ if (inp_locally_locked) From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 15:04:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CDA1106566B; Sat, 6 Nov 2010 15:04:49 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 217B98FC08; Sat, 6 Nov 2010 15:04:49 +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 oA6F4nbq034912; Sat, 6 Nov 2010 15:04:49 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6F4nhe034910; Sat, 6 Nov 2010 15:04:49 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011061504.oA6F4nhe034910@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 6 Nov 2010 15:04: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: r214885 - head/usr.sbin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 15:04:49 -0000 Author: uqs Date: Sat Nov 6 15:04:48 2010 New Revision: 214885 URL: http://svn.freebsd.org/changeset/base/214885 Log: Put string in quotes, like is done everywhere. Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Sat Nov 6 14:53:22 2010 (r214884) +++ head/usr.sbin/Makefile Sat Nov 6 15:04:48 2010 (r214885) @@ -155,7 +155,7 @@ SUBDIR+= fdwrite SUBDIR+= freebsd-update .endif -.if ${MK_GSSAPI} != no +.if ${MK_GSSAPI} != "no" SUBDIR+= gssd .endif From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 15:04:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3AE51065728; Sat, 6 Nov 2010 15:04:56 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B679E8FC0A; Sat, 6 Nov 2010 15:04: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 oA6F4ufY034951; Sat, 6 Nov 2010 15:04:56 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6F4uEN034949; Sat, 6 Nov 2010 15:04:56 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011061504.oA6F4uEN034949@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 6 Nov 2010 15:04: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: r214886 - head/usr.bin/setchannel X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 15:04:56 -0000 Author: uqs Date: Sat Nov 6 15:04:56 2010 New Revision: 214886 URL: http://svn.freebsd.org/changeset/base/214886 Log: Apply style(9) and unbreak build. This went unnoticed during the WARNS bump, as this tool is not connected to the build. Modified: head/usr.bin/setchannel/setchannel.c Modified: head/usr.bin/setchannel/setchannel.c ============================================================================== --- head/usr.bin/setchannel/setchannel.c Sat Nov 6 15:04:48 2010 (r214885) +++ head/usr.bin/setchannel/setchannel.c Sat Nov 6 15:04:56 2010 (r214886) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003, 2004, 2005 * John Wehle . All rights reserved. * @@ -28,40 +28,34 @@ /* Set the channel of the tuner card. */ -#include -#include +#include +#include + #include #include #include +#include +#include #include -#include -#include -#include #include -#if __FreeBSD_version < 503001 -# include -# include -#else -# include -# include -#endif - +#include +#include static void -usage() +usage(void) { printf ("Usage: setchannel [-a {on|off}] [-c | -r | -s | -t] " "[-g geom] [-m chnl_set] [chnl | freq]\n" " -a Enable / disable AFC.\n" " -c Select composite input.\n" - " -d Select tuner unit number.\n" - " -r Select radio input.\n" + " -d Select tuner unit number.\n" + " -r Select radio input.\n" " -s Select svideo input.\n" - " -t Select tuner.\n" + " -t Select tuner.\n" " -g Select geometry.\n" - " 352x240 or 352x288 = VCD\n" + " 352x240 or 352x288 = VCD\n" " 480x480 or 480x576 = SVCD\n" " 352x480 or 352x576 = DVD (half D1)\n" " 720x480 or 720x576 = DVD (full D1)\n" @@ -74,7 +68,7 @@ usage() " %u = Japan Cable / NTSC\n" " %u = Australia / PAL\n" " %u = France / SECAM\n" - " chnl Channel\n" + " chnl Channel\n" " freq Frequency in MHz (must include decimal point).\n", CHNLSET_NABCST, CHNLSET_CABLEIRC, CHNLSET_WEUROPE, CHNLSET_JPNBCST, CHNLSET_JPNCABLE, CHNLSET_AUSTRALIA, CHNLSET_FRANCE); @@ -94,7 +88,7 @@ main(int argc, char *argv[]) int channel_set; int i; int status; - int unit; + int unit; int tfd; unsigned int channel; unsigned int fraction; @@ -111,7 +105,7 @@ main(int argc, char *argv[]) device = 0; freq = 0; status = 0; - unit = 0; + unit = 0; x_size = 0; y_size = 0; @@ -214,11 +208,11 @@ main(int argc, char *argv[]) exit(1); } - sprintf(dev_name, DEVNAME_BASE "%d", unit); - tfd = open(dev_name, O_RDONLY); + sprintf(dev_name, DEVNAME_BASE "%d", unit); + tfd = open(dev_name, O_RDONLY); if (tfd < 0) { fprintf(stderr, "Can't open %s: %s (%d)\n", dev_name, - strerror(errno), errno); + strerror(errno), errno); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 15:10:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F86F1065672; Sat, 6 Nov 2010 15:10:31 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 731B38FC15; Sat, 6 Nov 2010 15:10: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 oA6FAVnY035112; Sat, 6 Nov 2010 15:10:31 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6FAV1I035110; Sat, 6 Nov 2010 15:10:31 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061510.oA6FAV1I035110@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 15:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214887 - stable/7/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 15:10:31 -0000 Author: lstewart Date: Sat Nov 6 15:10:31 2010 New Revision: 214887 URL: http://svn.freebsd.org/changeset/base/214887 Log: MFC r209050 (originally committed by jhb): Add helper macros to iterate over available CPUs in the system. CPU_FOREACH(i) iterates over the CPU IDs of all available CPUs. The CPU_FIRST() and CPU_NEXT(i) macros can also be used to iterate over available CPU IDs. CPU_NEXT(i) wraps around to CPU_FIRST() rather than returning some sort of terminator. Requested by: rwatson Reviewed by: attilio Modified: stable/7/sys/sys/smp.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sys/smp.h ============================================================================== --- stable/7/sys/sys/smp.h Sat Nov 6 15:04:56 2010 (r214886) +++ stable/7/sys/sys/smp.h Sat Nov 6 15:10:31 2010 (r214887) @@ -68,6 +68,44 @@ extern cpumask_t all_cpus; */ #define CPU_ABSENT(x_cpu) ((all_cpus & (1 << (x_cpu))) == 0) +/* + * Macros to iterate over non-absent CPUs. CPU_FOREACH() takes an + * integer iterator and iterates over the available set of CPUs. + * CPU_FIRST() returns the id of the first non-absent CPU. CPU_NEXT() + * returns the id of the next non-absent CPU. It will wrap back to + * CPU_FIRST() once the end of the list is reached. The iterators are + * currently implemented via inline functions. + */ +#define CPU_FOREACH(i) \ + for ((i) = 0; (i) <= mp_maxid; (i)++) \ + if (!CPU_ABSENT((i))) + +static __inline int +cpu_first(void) +{ + int i; + + for (i = 0;; i++) + if (!CPU_ABSENT(i)) + return (i); +} + +static __inline int +cpu_next(int i) +{ + + for (;;) { + i++; + if (i > mp_maxid) + i = 0; + if (!CPU_ABSENT(i)) + return (i); + } +} + +#define CPU_FIRST() cpu_first() +#define CPU_NEXT(i) cpu_next((i)) + #ifdef SMP /* * Machine dependent functions used to initialize MP support. From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 15:21:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC6361065672; Sat, 6 Nov 2010 15:21:46 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 998F18FC0C; Sat, 6 Nov 2010 15:21: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 oA6FLkM9035413; Sat, 6 Nov 2010 15:21:46 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6FLkH9035409; Sat, 6 Nov 2010 15:21:46 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061521.oA6FLkH9035409@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 15:21:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214888 - in stable/7: share/man/man9 sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 15:21:46 -0000 Author: lstewart Date: Sat Nov 6 15:21:46 2010 New Revision: 214888 URL: http://svn.freebsd.org/changeset/base/214888 Log: MFC r213910: - Simplify implementation of uma_zone_get_max. - Add uma_zone_get_cur which returns the current approximate occupancy of a zone. This is useful for providing stats via sysctl amongst other things. Sponsored by: FreeBSD Foundation Reviewed by: gnn, jhb Modified: stable/7/share/man/man9/zone.9 stable/7/sys/vm/uma.h stable/7/sys/vm/uma_core.c Directory Properties: stable/7/share/man/ (props changed) stable/7/share/man/man1/ (props changed) stable/7/share/man/man3/ (props changed) stable/7/share/man/man4/ (props changed) stable/7/share/man/man5/ (props changed) stable/7/share/man/man7/ (props changed) stable/7/share/man/man8/ (props changed) stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man9/zone.9 ============================================================================== --- stable/7/share/man/man9/zone.9 Sat Nov 6 15:10:31 2010 (r214887) +++ stable/7/share/man/man9/zone.9 Sat Nov 6 15:21:46 2010 (r214888) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 19, 2008 +.Dd October 9, 2010 .Dt ZONE 9 .Os .Sh NAME @@ -35,7 +35,9 @@ .Nm uma_zfree , .Nm uma_zfree_arg , .Nm uma_zdestroy , -.Nm uma_zone_set_max +.Nm uma_zone_set_max, +.Nm uma_zone_get_max, +.Nm uma_zone_get_cur .Nd zone allocator .Sh SYNOPSIS .In sys/param.h @@ -59,6 +61,10 @@ .Fn uma_zdestroy "uma_zone_t zone" .Ft void .Fn uma_zone_set_max "uma_zone_t zone" "int nitems" +.Ft int +.Fn uma_zone_get_max "uma_zone_t zone" +.Ft int +.Fn uma_zone_get_cur "uma_zone_t zone" .Sh DESCRIPTION The zone allocator provides an efficient interface for managing dynamically-sized collections of items of similar size. @@ -177,21 +183,36 @@ must have been freed with .Fn uma_zfree before. .Pp -The purpose of +The .Fn uma_zone_set_max -is to limit the maximum amount of memory that the system can dedicated -toward the zone specified by the -.Fa zone -argument. +function limits the number of items +.Pq and therefore memory +that can be allocated to +.Fa zone . The .Fa nitems -argument gives the upper limit of items in the zone. -This limits the total number of items in the zone which includes: +argument specifies the requested upper limit number of items. +The effective limit may end up being higher than requested, as the +implementation will round up to ensure all memory pages allocated to the zone +are utilised to capacity. +The limit applies to the total number of items in the zone, which includes allocated items, free items and free items in the per-cpu caches. On systems with more than one CPU it may not be possible to allocate the specified number of items even when there is no shortage of memory, because all of the remaining free items may be in the caches of the other CPUs when the limit is hit. +.Pp +The +.Fn uma_zone_get_max +function returns the effective upper limit number of items for a zone. +.Pp +The +.Fn uma_zone_get_cur +function returns the approximate current occupancy of the zone. +The returned value is approximate because appropriate synchronisation to +determine an exact value is not performend by the implementation. +This ensures low overhead at the expense of potentially stale data being used +in the calculation. .Sh RETURN VALUES The .Fn uma_zalloc Modified: stable/7/sys/vm/uma.h ============================================================================== --- stable/7/sys/vm/uma.h Sat Nov 6 15:10:31 2010 (r214887) +++ stable/7/sys/vm/uma.h Sat Nov 6 15:21:46 2010 (r214888) @@ -443,6 +443,17 @@ void uma_zone_set_max(uma_zone_t zone, i int uma_zone_get_max(uma_zone_t zone); /* + * Obtains the approximate current number of items allocated from a zone + * + * Arguments: + * zone The zone to obtain the current allocation count from + * + * Return: + * int The approximate current number of items allocated from the zone + */ +int uma_zone_get_cur(uma_zone_t zone); + +/* * The following two routines (uma_zone_set_init/fini) * are used to set the backend init/fini pair which acts on an * object as it becomes allocated and is placed in a slab within Modified: stable/7/sys/vm/uma_core.c ============================================================================== --- stable/7/sys/vm/uma_core.c Sat Nov 6 15:10:31 2010 (r214887) +++ stable/7/sys/vm/uma_core.c Sat Nov 6 15:21:46 2010 (r214888) @@ -2529,16 +2529,36 @@ uma_zone_get_max(uma_zone_t zone) ZONE_LOCK(zone); keg = zone->uz_keg; - if (keg->uk_maxpages) - nitems = keg->uk_maxpages * keg->uk_ipers; - else - nitems = 0; + nitems = keg->uk_maxpages * keg->uk_ipers; ZONE_UNLOCK(zone); return (nitems); } /* See uma.h */ +int +uma_zone_get_cur(uma_zone_t zone) +{ + int64_t nitems; + u_int i; + + ZONE_LOCK(zone); + nitems = zone->uz_allocs - zone->uz_frees; + CPU_FOREACH(i) { + /* + * See the comment in sysctl_vm_zone_stats() regarding the + * safety of accessing the per-cpu caches. With the zone lock + * held, it is safe, but can potentially result in stale data. + */ + nitems += zone->uz_cpu[i].uc_allocs - + zone->uz_cpu[i].uc_frees; + } + ZONE_UNLOCK(zone); + + return (nitems < 0 ? 0 : nitems); +} + +/* See uma.h */ void uma_zone_set_init(uma_zone_t zone, uma_init uminit) { From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 15:40:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E29071065670; Sat, 6 Nov 2010 15:40:34 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96DE58FC08; Sat, 6 Nov 2010 15: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 oA6FeYoc035840; Sat, 6 Nov 2010 15:40:34 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6FeYSL035838; Sat, 6 Nov 2010 15:40:34 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061540.oA6FeYSL035838@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 15:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214889 - stable/7/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 15:40:35 -0000 Author: lstewart Date: Sat Nov 6 15:40:34 2010 New Revision: 214889 URL: http://svn.freebsd.org/changeset/base/214889 Log: MFC r213912: - Switch the "net.inet.tcp.reass.cursegments" and "net.inet.tcp.reass.maxsegments" sysctl variables to be based on UMA zone stats. The value returned by the cursegments sysctl is approximate owing to the way in which uma_zone_get_cur is implemented. - Discontinue use of V_tcp_reass_qsize as a global reassembly segment count variable in the reassembly implementation. The variable was used without proper synchronisation and was duplicating accounting done by UMA already. The lack of synchronisation was particularly problematic on SMP systems terminating many TCP sessions, resulting in poor TCP performance for connections with non-zero packet loss. The base code from r213912 was modified as part of this MFC in order to work correctly on FreeBSD 7. Sponsored by: FreeBSD Foundation Reviewed by: andre, gnn, rpaulo (as part of a larger patch) Modified: stable/7/sys/netinet/tcp_reass.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/tcp_reass.c ============================================================================== --- stable/7/sys/netinet/tcp_reass.c Sat Nov 6 15:21:46 2010 (r214888) +++ stable/7/sys/netinet/tcp_reass.c Sat Nov 6 15:40:34 2010 (r214889) @@ -73,17 +73,20 @@ __FBSDID("$FreeBSD$"); #include #endif /* TCPDEBUG */ +static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS); +static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS); + SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); static int tcp_reass_maxseg = 0; -SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &tcp_reass_maxseg, 0, +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &tcp_reass_maxseg, 0, &tcp_reass_sysctl_maxseg, "I", "Global maximum number of TCP Segments in Reassembly Queue"); static int tcp_reass_qsize = 0; -SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, - &tcp_reass_qsize, 0, +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, + &tcp_reass_qsize, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); static int tcp_reass_maxqlen = 48; @@ -133,7 +136,6 @@ tcp_reass_flush(struct tcpcb *tp) m_freem(qe->tqe_m); uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; - tcp_reass_qsize--; } KASSERT((tp->t_segqlen == 0), @@ -141,6 +143,20 @@ tcp_reass_flush(struct tcpcb *tp) tp, tp->t_segqlen)); } +static int +tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS) +{ + tcp_reass_maxseg = uma_zone_get_max(tcp_reass_zone); + return (sysctl_handle_int(oidp, arg1, arg2, req)); +} + +static int +tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS) +{ + tcp_reass_qsize = uma_zone_get_cur(tcp_reass_zone); + return (sysctl_handle_int(oidp, arg1, arg2, req)); +} + int tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { @@ -170,12 +186,10 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Limit the number of segments in the reassembly queue to prevent * holding on to too many segments (and thus running out of mbufs). * Make sure to let the missing segment through which caused this - * queue. Always keep one global queue entry spare to be able to - * process the missing segment. + * queue. */ if (th->th_seq != tp->rcv_nxt && - (tcp_reass_qsize + 1 >= tcp_reass_maxseg || - tp->t_segqlen >= tcp_reass_maxqlen)) { + tp->t_segqlen >= tcp_reass_maxqlen) { tcp_reass_overflows++; tcpstat.tcps_rcvmemdrop++; m_freem(m); @@ -195,7 +209,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd return (0); } tp->t_segqlen++; - tcp_reass_qsize++; /* * Find a segment which begins after this one does. @@ -222,7 +235,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd m_freem(m); uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; - tcp_reass_qsize--; /* * Try to present any queued data * at the left window edge to the user. @@ -259,7 +271,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd m_freem(q->tqe_m); uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; - tcp_reass_qsize--; q = nq; } @@ -296,7 +307,6 @@ present: sbappendstream_locked(&so->so_rcv, q->tqe_m); uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; - tcp_reass_qsize--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); ND6_HINT(tp); From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 15:49:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA510106566B; Sat, 6 Nov 2010 15:49:59 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97BED8FC13; Sat, 6 Nov 2010 15:49: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 oA6Fnxaf036075; Sat, 6 Nov 2010 15:49:59 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6FnxCs036073; Sat, 6 Nov 2010 15:49:59 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011061549.oA6FnxCs036073@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 6 Nov 2010 15:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214890 - stable/7/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 15:49:59 -0000 Author: lstewart Date: Sat Nov 6 15:49:59 2010 New Revision: 214890 URL: http://svn.freebsd.org/changeset/base/214890 Log: MFC r213913: Retire the system-wide, per-reassembly queue segment limit. The mechanism is far too coarse grained to be useful and the default value significantly degrades TCP performance on moderate to high bandwidth-delay product paths with non-zero loss (e.g. 5+Mbps connections across the public Internet often suffer). Replace the outgoing mechanism with an individual per-queue limit based on the number of MSS segments that fit into the socket's receive buffer. This should strike a good balance between performance and the potential for resource exhaustion when FreeBSD is acting as a TCP receiver. With socket buffer autotuning (which is enabled by default), the reassembly queue tracks the socket buffer and benefits too. As the XXX comment suggests, my testing uncovered some unexpected behaviour which requires further investigation. By using so->so_rcv.sb_hiwat instead of sbspace(&so->so_rcv), we allow more segments to be held across both the socket receive buffer and reassembly queue than we probably should. The tradeoff is better performance in at least one common scenario, versus a devious sender's ability to consume more resources on a FreeBSD receiver. The base code from r213913 was modified as part of this MFC in order to work correctly on FreeBSD 7. Sponsored by: FreeBSD Foundation Reviewed by: andre, gnn, rpaulo Modified: stable/7/sys/netinet/tcp_reass.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/tcp_reass.c ============================================================================== --- stable/7/sys/netinet/tcp_reass.c Sat Nov 6 15:40:34 2010 (r214889) +++ stable/7/sys/netinet/tcp_reass.c Sat Nov 6 15:49:59 2010 (r214890) @@ -89,11 +89,6 @@ SYSCTL_PROC(_net_inet_tcp_reass, OID_AUT &tcp_reass_qsize, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static int tcp_reass_maxqlen = 48; -SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxqlen, CTLFLAG_RW, - &tcp_reass_maxqlen, 0, - "Maximum number of TCP Segments per individual Reassembly Queue"); - static int tcp_reass_overflows = 0; SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, &tcp_reass_overflows, 0, @@ -183,13 +178,23 @@ tcp_reass(struct tcpcb *tp, struct tcphd goto present; /* - * Limit the number of segments in the reassembly queue to prevent - * holding on to too many segments (and thus running out of mbufs). - * Make sure to let the missing segment through which caused this - * queue. + * Limit the number of segments that can be queued to reduce the + * potential for mbuf exhaustion. For best performance, we want to be + * able to queue a full window's worth of segments. The size of the + * socket receive buffer determines our advertised window and grows + * automatically when socket buffer autotuning is enabled. Use it as the + * basis for our queue limit. + * Always let the missing segment through which caused this queue. + * NB: Access to the socket buffer is left intentionally unlocked as we + * can tolerate stale information here. + * + * XXXLAS: Using sbspace(so->so_rcv) instead of so->so_rcv.sb_hiwat + * should work but causes packets to be dropped when they shouldn't. + * Investigate why and re-evaluate the below limit after the behaviour + * is understood. */ if (th->th_seq != tp->rcv_nxt && - tp->t_segqlen >= tcp_reass_maxqlen) { + tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { tcp_reass_overflows++; tcpstat.tcps_rcvmemdrop++; m_freem(m); From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 15:56:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7316106564A; Sat, 6 Nov 2010 15:56:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B47918FC16; Sat, 6 Nov 2010 15:56: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 oA6FuiSp036251; Sat, 6 Nov 2010 15:56:44 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6FuiHb036245; Sat, 6 Nov 2010 15:56:44 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201011061556.oA6FuiHb036245@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 6 Nov 2010 15:56:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214891 - in stable/7/sys: netinet netinet6 netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 15:56:45 -0000 Author: bz Date: Sat Nov 6 15:56:44 2010 New Revision: 214891 URL: http://svn.freebsd.org/changeset/base/214891 Log: MFC r214250: Make the IPsec SADB embedded route cache a union to be able to hold both the legacy and IPv6 route destination address. Previously in case of IPv6, there was a memory overwrite due to not enough space for the IPv6 address. PR: kern/122565 Modified: stable/7/sys/netinet/ip_ipsec.c stable/7/sys/netinet6/ip6_ipsec.c stable/7/sys/netipsec/ipsec_output.c stable/7/sys/netipsec/key.c stable/7/sys/netipsec/keydb.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/ip_ipsec.c ============================================================================== --- stable/7/sys/netinet/ip_ipsec.c Sat Nov 6 15:49:59 2010 (r214890) +++ stable/7/sys/netinet/ip_ipsec.c Sat Nov 6 15:56:44 2010 (r214891) @@ -220,7 +220,7 @@ ip_ipsec_mtu(struct mbuf *m, int mtu) if (sp->req != NULL && sp->req->sav != NULL && sp->req->sav->sah != NULL) { - ro = &sp->req->sav->sah->sa_route; + ro = &sp->req->sav->sah->route_cache.sa_route; if (ro->ro_rt && ro->ro_rt->rt_ifp) { mtu = ro->ro_rt->rt_rmx.rmx_mtu ? Modified: stable/7/sys/netinet6/ip6_ipsec.c ============================================================================== --- stable/7/sys/netinet6/ip6_ipsec.c Sat Nov 6 15:49:59 2010 (r214890) +++ stable/7/sys/netinet6/ip6_ipsec.c Sat Nov 6 15:56:44 2010 (r214891) @@ -346,7 +346,7 @@ ip6_ipsec_mtu(struct mbuf *m) if (sp->req != NULL && sp->req->sav != NULL && sp->req->sav->sah != NULL) { - ro = &sp->req->sav->sah->sa_route; + ro = &sp->req->sav->sah->route_cache.sa_route; if (ro->ro_rt && ro->ro_rt->rt_ifp) { mtu = ro->ro_rt->rt_rmx.rmx_mtu ? Modified: stable/7/sys/netipsec/ipsec_output.c ============================================================================== --- stable/7/sys/netipsec/ipsec_output.c Sat Nov 6 15:49:59 2010 (r214890) +++ stable/7/sys/netipsec/ipsec_output.c Sat Nov 6 15:56:44 2010 (r214891) @@ -773,7 +773,8 @@ ipsec6_output_tunnel(struct ipsec_output } ip6 = mtod(m, struct ip6_hdr *); - state->ro = &isr->sav->sah->sa_route; + state->ro = + (struct route *)&isr->sav->sah->route_cache.sin6_route; state->dst = (struct sockaddr *)&state->ro->ro_dst; dst6 = (struct sockaddr_in6 *)state->dst; if (state->ro->ro_rt Modified: stable/7/sys/netipsec/key.c ============================================================================== --- stable/7/sys/netipsec/key.c Sat Nov 6 15:49:59 2010 (r214890) +++ stable/7/sys/netipsec/key.c Sat Nov 6 15:56:44 2010 (r214891) @@ -2674,9 +2674,9 @@ key_delsah(sah) /* remove from tree of SA index */ if (__LIST_CHAINED(sah)) LIST_REMOVE(sah, chain); - if (sah->sa_route.ro_rt) { - RTFREE(sah->sa_route.ro_rt); - sah->sa_route.ro_rt = (struct rtentry *)NULL; + if (sah->route_cache.sa_route.ro_rt) { + RTFREE(sah->route_cache.sa_route.ro_rt); + sah->route_cache.sa_route.ro_rt = (struct rtentry *)NULL; } free(sah, M_IPSEC_SAH); } @@ -7196,7 +7196,7 @@ key_sa_routechange(dst) SAHTREE_LOCK(); LIST_FOREACH(sah, &sahtree, chain) { - ro = &sah->sa_route; + ro = &sah->route_cache.sa_route; if (ro->ro_rt && dst->sa_len == ro->ro_dst.sa_len && bcmp(dst, &ro->ro_dst, dst->sa_len) == 0) { RTFREE(ro->ro_rt); Modified: stable/7/sys/netipsec/keydb.h ============================================================================== --- stable/7/sys/netipsec/keydb.h Sat Nov 6 15:49:59 2010 (r214890) +++ stable/7/sys/netipsec/keydb.h Sat Nov 6 15:56:44 2010 (r214891) @@ -85,6 +85,12 @@ struct seclifetime { u_int64_t usetime; }; +union sa_route_union { + struct route sa_route; + struct route sin_route; /* Duplicate for consistency. */ + struct route_in6 sin6_route; +}; + /* Security Association Data Base */ struct secashead { LIST_ENTRY(secashead) chain; @@ -100,7 +106,7 @@ struct secashead { /* SA chain */ /* The first of this list is newer SA */ - struct route sa_route; /* route cache */ + union sa_route_union route_cache; }; struct xformsw; From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 16:09:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AED15106564A; Sat, 6 Nov 2010 16:09:25 +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 9C9948FC13; Sat, 6 Nov 2010 16:09:25 +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 oA6G9PXs036595; Sat, 6 Nov 2010 16:09:25 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6G9PIC036593; Sat, 6 Nov 2010 16:09:25 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201011061609.oA6G9PIC036593@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 6 Nov 2010 16:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214892 - stable/8/release/powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 16:09:25 -0000 Author: marcel Date: Sat Nov 6 16:09:25 2010 New Revision: 214892 URL: http://svn.freebsd.org/changeset/base/214892 Log: MFC 213381: Replace an obsolete flag -L in an mkisofs(1) command line with -allow-leading-dots to fix "make release" for FreeBSD/powerpc. Author: hrs Modified: stable/8/release/powerpc/mkisoimages.sh Directory Properties: stable/8/release/powerpc/ (props changed) Modified: stable/8/release/powerpc/mkisoimages.sh ============================================================================== --- stable/8/release/powerpc/mkisoimages.sh Sat Nov 6 15:56:44 2010 (r214891) +++ stable/8/release/powerpc/mkisoimages.sh Sat Nov 6 16:09:25 2010 (r214892) @@ -54,4 +54,4 @@ fi LABEL=$1; shift NAME=$1; shift -mkisofs $bootable -r -hfs -part -no-desktop -hfs-volid $LABEL -l -J -L -o $NAME $* +mkisofs $bootable -r -hfs -part -no-desktop -hfs-volid $LABEL -l -J -allow-leading-dots -o $NAME $* From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 17:48:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA2091065675; Sat, 6 Nov 2010 17:48:46 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DE928FC15; Sat, 6 Nov 2010 17:48: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 oA6HmkPp038861; Sat, 6 Nov 2010 17:48:46 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6HmkTi038859; Sat, 6 Nov 2010 17:48:46 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201011061748.oA6HmkTi038859@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 6 Nov 2010 17:48: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: r214893 - head/usr.bin/fold X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 17:48:46 -0000 Author: dumbbell Date: Sat Nov 6 17:48:46 2010 New Revision: 214893 URL: http://svn.freebsd.org/changeset/base/214893 Log: Fix a segmentation fault in argument processing. The crash was caused by a command line such as this one: # foldl -b1 PR: bin/151592 Reported by: Marcus Reid Tested by: Marcus Reid MFC after: 3 days Modified: head/usr.bin/fold/fold.c Modified: head/usr.bin/fold/fold.c ============================================================================== --- head/usr.bin/fold/fold.c Sat Nov 6 16:09:25 2010 (r214892) +++ head/usr.bin/fold/fold.c Sat Nov 6 17:48:46 2010 (r214893) @@ -71,14 +71,14 @@ int sflag; /* Split on word boundaries int main(int argc, char **argv) { - int ch; + int ch, previous_ch; int rval, width; - char *p; (void) setlocale(LC_CTYPE, ""); width = -1; - while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1) + previous_ch = 0; + while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1) { switch (ch) { case 'b': bflag = 1; @@ -93,17 +93,33 @@ main(int argc, char **argv) break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - if (width == -1) { - p = argv[optind - 1]; - if (p[0] == '-' && p[1] == ch && !p[2]) - width = atoi(++p); - else - width = atoi(argv[optind] + 1); + /* Accept a width as eg. -30. Note that a width + * specified using the -w option is always used prior + * to this undocumented option. */ + switch (previous_ch) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + /* The width is a number with multiple digits: + * add the last one. */ + width = width * 10 + (ch - '0'); + break; + default: + /* Set the width, unless it was previously + * set. For instance, the following options + * would all give a width of 5 and not 10: + * -10 -w5 + * -5b10 + * -5 -10b */ + if (width == -1) + width = ch - '0'; + break; } break; default: usage(); } + previous_ch = ch; + } argv += optind; argc -= optind; From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 18:17:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EA83106564A; Sat, 6 Nov 2010 18:17:21 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B2448FC12; Sat, 6 Nov 2010 18:17: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 oA6IHLnI043537; Sat, 6 Nov 2010 18:17:21 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6IHKcp043518; Sat, 6 Nov 2010 18:17:20 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201011061817.oA6IHKcp043518@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 6 Nov 2010 18:17: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: r214894 - in head/sys: dev/bwi dev/bwn dev/iwn dev/ral dev/usb/wlan dev/wpi net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 18:17:21 -0000 Author: bschmidt Date: Sat Nov 6 18:17:20 2010 New Revision: 214894 URL: http://svn.freebsd.org/changeset/base/214894 Log: Instead of using the AMRR ratectl algo as default for drivers which have the IEEE80211_C_RATECTL flag set, default to NONE for all drivers. Only if a driver calls ieee80211_ratectl_init() check if the NONE algo is still selected and try to use AMRR in that case. Drivers are still free to use any other algo by calling ieee80211_ratectl_set() prior to the ieee80211_ratectl_init() call. After this change it is now safe to assume that a ratectl algo is always available and selected, which renders the IEEE80211_C_RATECTL flag pretty much useless. Therefore revert r211314 and 211546. Reviewed by: rpaulo MFC after: 2 weeks Modified: head/sys/dev/bwi/if_bwi.c head/sys/dev/bwn/if_bwn.c head/sys/dev/iwn/if_iwn.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_zyd.c head/sys/dev/wpi/if_wpi.c head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_ratectl.c head/sys/net80211/ieee80211_ratectl.h head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_var.h Modified: head/sys/dev/bwi/if_bwi.c ============================================================================== --- head/sys/dev/bwi/if_bwi.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/bwi/if_bwi.c Sat Nov 6 18:17:20 2010 (r214894) @@ -511,8 +511,7 @@ bwi_attach(struct bwi_softc *sc) IEEE80211_C_SHPREAMBLE | IEEE80211_C_WPA | IEEE80211_C_BGSCAN | - IEEE80211_C_MONITOR | - IEEE80211_C_RATECTL; + IEEE80211_C_MONITOR; ic->ic_opmode = IEEE80211_M_STA; ieee80211_ifattach(ic, macaddr); Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/bwn/if_bwn.c Sat Nov 6 18:17:20 2010 (r214894) @@ -1070,7 +1070,6 @@ bwn_attach_post(struct bwn_softc *sc) | IEEE80211_C_WPA /* capable of WPA1+WPA2 */ | IEEE80211_C_BGSCAN /* capable of bg scanning */ | IEEE80211_C_TXPMGT /* capable of txpow mgt */ - | IEEE80211_C_RATECTL /* use ratectl */ ; ic->ic_flags_ext |= IEEE80211_FEXT_SWBMISS; /* s/w bmiss */ Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/iwn/if_iwn.c Sat Nov 6 18:17:20 2010 (r214894) @@ -584,7 +584,6 @@ iwn_attach(device_t dev) | IEEE80211_C_IBSS /* ibss/adhoc mode */ #endif | IEEE80211_C_WME /* WME */ - | IEEE80211_C_RATECTL /* use ratectl */ ; #if 0 /* HT */ /* XXX disable until HT channel setup works */ Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/ral/rt2560.c Sat Nov 6 18:17:20 2010 (r214894) @@ -291,7 +291,6 @@ rt2560_attach(device_t dev, int id) #ifdef notyet | IEEE80211_C_TXFRAG /* handle tx frags */ #endif - | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/ral/rt2661.c Sat Nov 6 18:17:20 2010 (r214894) @@ -294,7 +294,6 @@ rt2661_attach(device_t dev, int id) | IEEE80211_C_TXFRAG /* handle tx frags */ | IEEE80211_C_WME /* 802.11e */ #endif - | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/usb/wlan/if_rum.c Sat Nov 6 18:17:20 2010 (r214894) @@ -496,7 +496,6 @@ rum_attach(device_t self) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_BGSCAN /* bg scanning supported */ | IEEE80211_C_WPA /* 802.11i */ - | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/usb/wlan/if_run.c Sat Nov 6 18:17:20 2010 (r214894) @@ -632,8 +632,7 @@ run_attach(device_t self) IEEE80211_C_SHPREAMBLE | /* short preamble supported */ IEEE80211_C_SHSLOT | /* short slot time supported */ IEEE80211_C_WME | /* WME */ - IEEE80211_C_WPA | /* WPA1|WPA2(RSN) */ - IEEE80211_C_RATECTL; /* use ratectl */ + IEEE80211_C_WPA; /* WPA1|WPA2(RSN) */ ic->ic_cryptocaps = IEEE80211_CRYPTO_WEP | Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/usb/wlan/if_ural.c Sat Nov 6 18:17:20 2010 (r214894) @@ -486,7 +486,6 @@ ural_attach(device_t self) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_BGSCAN /* bg scanning supported */ | IEEE80211_C_WPA /* 802.11i */ - | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/usb/wlan/if_zyd.c Sat Nov 6 18:17:20 2010 (r214894) @@ -397,7 +397,6 @@ zyd_attach(device_t dev) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_BGSCAN /* capable of bg scanning */ | IEEE80211_C_WPA /* 802.11i */ - | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/dev/wpi/if_wpi.c Sat Nov 6 18:17:20 2010 (r214894) @@ -634,7 +634,6 @@ wpi_attach(device_t dev) | IEEE80211_C_WME /* 802.11e */ | IEEE80211_C_HOSTAP /* Host access point mode */ #endif - | IEEE80211_C_RATECTL /* use ratectl */ ; /* Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/net80211/ieee80211.c Sat Nov 6 18:17:20 2010 (r214894) @@ -486,9 +486,7 @@ ieee80211_vap_setup(struct ieee80211com ieee80211_scan_vattach(vap); ieee80211_regdomain_vattach(vap); ieee80211_radiotap_vattach(vap); - - if (vap->iv_caps & IEEE80211_C_RATECTL) - ieee80211_ratectl_set(vap, IEEE80211_RATECTL_AMRR); + ieee80211_ratectl_set(vap, IEEE80211_RATECTL_NONE); return 0; } Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/net80211/ieee80211_node.c Sat Nov 6 18:17:20 2010 (r214894) @@ -817,8 +817,7 @@ ieee80211_sta_join(struct ieee80211vap * if (ieee80211_iserp_rateset(&ni->ni_rates)) ni->ni_flags |= IEEE80211_NODE_ERP; ieee80211_node_setuptxparms(ni); - if (vap->iv_caps & IEEE80211_C_RATECTL) - ieee80211_ratectl_node_init(ni); + ieee80211_ratectl_node_init(ni); return ieee80211_sta_join1(ieee80211_ref_node(ni)); } @@ -1038,8 +1037,7 @@ node_free(struct ieee80211_node *ni) { struct ieee80211com *ic = ni->ni_ic; - if (ni->ni_vap->iv_caps & IEEE80211_C_RATECTL) - ieee80211_ratectl_node_deinit(ni); + ieee80211_ratectl_node_deinit(ni); ic->ic_node_cleanup(ni); ieee80211_ies_cleanup(&ni->ni_ies); ieee80211_psq_cleanup(&ni->ni_psq); @@ -1404,8 +1402,7 @@ ieee80211_fakeup_adhoc_node(struct ieee8 #endif } ieee80211_node_setuptxparms(ni); - if (vap->iv_caps & IEEE80211_C_RATECTL) - ieee80211_ratectl_node_init(ni); + ieee80211_ratectl_node_init(ni); if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, 1); /* XXX not right for 802.1x/WPA */ @@ -1475,8 +1472,7 @@ ieee80211_add_neighbor(struct ieee80211v if (ieee80211_iserp_rateset(&ni->ni_rates)) ni->ni_flags |= IEEE80211_NODE_ERP; ieee80211_node_setuptxparms(ni); - if (vap->iv_caps & IEEE80211_C_RATECTL) - ieee80211_ratectl_node_init(ni); + ieee80211_ratectl_node_init(ni); if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, 1); /* XXX not right for 802.1x/WPA */ @@ -2345,8 +2341,7 @@ ieee80211_node_join(struct ieee80211_nod ); ieee80211_node_setuptxparms(ni); - if (vap->iv_caps & IEEE80211_C_RATECTL) - ieee80211_ratectl_node_init(ni); + ieee80211_ratectl_node_init(ni); /* give driver a chance to setup state like ni_txrate */ if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, newassoc); Modified: head/sys/net80211/ieee80211_ratectl.c ============================================================================== --- head/sys/net80211/ieee80211_ratectl.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/net80211/ieee80211_ratectl.c Sat Nov 6 18:17:20 2010 (r214894) @@ -66,6 +66,14 @@ ieee80211_ratectl_unregister(int type) } void +ieee80211_ratectl_init(struct ieee80211vap *vap) +{ + if (vap->iv_rate == ratectls[IEEE80211_RATECTL_NONE]) + ieee80211_ratectl_set(vap, IEEE80211_RATECTL_AMRR); + vap->iv_rate->ir_init(vap); +} + +void ieee80211_ratectl_set(struct ieee80211vap *vap, int type) { if (type >= IEEE80211_RATECTL_MAX) Modified: head/sys/net80211/ieee80211_ratectl.h ============================================================================== --- head/sys/net80211/ieee80211_ratectl.h Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/net80211/ieee80211_ratectl.h Sat Nov 6 18:17:20 2010 (r214894) @@ -57,17 +57,12 @@ struct ieee80211_ratectl { void ieee80211_ratectl_register(int, const struct ieee80211_ratectl *); void ieee80211_ratectl_unregister(int); +void ieee80211_ratectl_init(struct ieee80211vap *); void ieee80211_ratectl_set(struct ieee80211vap *, int); MALLOC_DECLARE(M_80211_RATECTL); static void __inline -ieee80211_ratectl_init(struct ieee80211vap *vap) -{ - vap->iv_rate->ir_init(vap); -} - -static void __inline ieee80211_ratectl_deinit(struct ieee80211vap *vap) { vap->iv_rate->ir_deinit(vap); Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/net80211/ieee80211_sta.c Sat Nov 6 18:17:20 2010 (r214894) @@ -1597,8 +1597,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, htinfo); ieee80211_node_setuptxparms(ni); - if (vap->iv_caps & IEEE80211_C_RATECTL) - ieee80211_ratectl_node_init(ni); + ieee80211_ratectl_node_init(ni); } else { #ifdef IEEE80211_SUPPORT_SUPERG if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_ATH)) Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sat Nov 6 17:48:46 2010 (r214893) +++ head/sys/net80211/ieee80211_var.h Sat Nov 6 18:17:20 2010 (r214894) @@ -601,8 +601,7 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */ #define IEEE80211_C_DFS 0x00020000 /* CAPABILITY: DFS/radar avail*/ #define IEEE80211_C_MBSS 0x00040000 /* CAPABILITY: MBSS available */ -#define IEEE80211_C_RATECTL 0x00080000 /* CAPABILITY: use ratectl */ -/* 0x700000 available */ +/* 0x7c0000 available */ #define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */ #define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */ #define IEEE80211_C_WPA 0x01800000 /* CAPABILITY: WPA1+WPA2 avail*/ From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 19:11:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC51C1065672; Sat, 6 Nov 2010 19:11:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 906E98FC14; Sat, 6 Nov 2010 19:11:49 +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 oA6JBnUF045200; Sat, 6 Nov 2010 19:11:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6JBnaQ045198; Sat, 6 Nov 2010 19:11:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011061911.oA6JBnaQ045198@svn.freebsd.org> From: Alexander Motin Date: Sat, 6 Nov 2010 19:11: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: r214896 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 19:11:49 -0000 Author: mav Date: Sat Nov 6 19:11:49 2010 New Revision: 214896 URL: http://svn.freebsd.org/changeset/base/214896 Log: Mark command submission timeouts as timeouts. This should trigger device resets and increase chances of getting device back again. Modified: head/sys/dev/ata/ata-lowlevel.c Modified: head/sys/dev/ata/ata-lowlevel.c ============================================================================== --- head/sys/dev/ata/ata-lowlevel.c Sat Nov 6 18:36:21 2010 (r214895) +++ head/sys/dev/ata/ata-lowlevel.c Sat Nov 6 19:11:49 2010 (r214896) @@ -672,7 +672,8 @@ ata_generic_command(struct ata_request * /* ready to issue command ? */ if (ata_wait(ch, request->unit, 0) < 0) { device_printf(request->parent, "timeout waiting to issue command\n"); - return -1; + request->flags |= ATA_R_TIMEOUT; + return (-1); } /* enable interrupt */ @@ -697,13 +698,16 @@ ata_generic_command(struct ata_request * /* command interrupt device ? just return and wait for interrupt */ if (request->flags & ATA_R_ATAPI_INTR) - return 0; + return (0); /* command processed ? */ res = ata_wait(ch, request->unit, 0); if (res != 0) { - if (res < 0) - device_printf(request->parent, "timeout waiting for PACKET command\n"); + if (res < 0) { + device_printf(request->parent, + "timeout waiting for PACKET command\n"); + request->flags |= ATA_R_TIMEOUT; + } return (-1); } /* wait for ready to write ATAPI command block */ @@ -717,9 +721,10 @@ ata_generic_command(struct ata_request * DELAY(20); } if (timeout <= 0) { - device_printf(request->parent, "timeout waiting for ATAPI ready\n"); - request->result = EIO; - return -1; + device_printf(request->parent, + "timeout waiting for ATAPI ready\n"); + request->flags |= ATA_R_TIMEOUT; + return (-1); } /* this seems to be needed for some (slow) devices */ @@ -735,7 +740,7 @@ ata_generic_command(struct ata_request * /* issue command to controller */ ATA_IDX_OUTB(ch, ATA_COMMAND, request->u.ata.command); } - return 0; + return (0); } static void From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 21:04:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77880106566B; Sat, 6 Nov 2010 21:04:02 +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 649A78FC12; Sat, 6 Nov 2010 21:04: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 oA6L42Gt048979; Sat, 6 Nov 2010 21:04:02 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6L42q7048976; Sat, 6 Nov 2010 21:04:02 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201011062104.oA6L42q7048976@svn.freebsd.org> From: Gabor Kovesdan Date: Sat, 6 Nov 2010 21:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214897 - stable/8/etc/periodic/security X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 21:04:02 -0000 Author: gabor Date: Sat Nov 6 21:04:01 2010 New Revision: 214897 URL: http://svn.freebsd.org/changeset/base/214897 Log: MFC r210254: - Add a periodic script, which can be used to find installed ports' files with mismatched checksum MFC r211141 - Fixes to the chkportsum script to handle better some special cases, like spaces in filename Approved by: delphij (mentor) Added: - copied unchanged from r214895, head/etc/periodic/security/460.chkportsum Directory Properties: stable/8/etc/periodic/security/460.chkportsum (props changed) Modified: stable/8/etc/periodic/security/Makefile Copied: stable/8/etc/periodic/security/460.chkportsum (from r214895, head/etc/periodic/security/460.chkportsum) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/etc/periodic/security/460.chkportsum Sat Nov 6 21:04:01 2010 (r214897, copy of r214895, head/etc/periodic/security/460.chkportsum) @@ -0,0 +1,68 @@ +#!/bin/sh - +# +# Copyright (c) 2010 The FreeBSD Project +# 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$ +# + +if [ -r /etc/defaults/periodic.conf ] +then + . /etc/defaults/periodic.conf + source_periodic_confs +fi + +. /etc/periodic/security/security.functions + +rc=0 + +echo "" +echo 'Checking for ports with mismatched checksums:' + +case "${daily_status_security_chkportsum_enable}" in + [Yy][Ee][Ss]) + set -f + pkg_info -ga 2>/dev/null | \ + while IFS= read -r line; do + set -- $line + case $1 in + Information) + case $2 in + for) name="${3%%:}" ;; + *) name='??' ;; + esac + ;; + Mismatched|'') ;; + *) [ -n "${name}" ] && + echo "${name}: ${line%% fails the original MD5 checksum}" + ;; + esac + done + ;; + *) + rc=0 + ;; +esac + +exit $rc Modified: stable/8/etc/periodic/security/Makefile ============================================================================== --- stable/8/etc/periodic/security/Makefile Sat Nov 6 19:11:49 2010 (r214896) +++ stable/8/etc/periodic/security/Makefile Sat Nov 6 21:04:01 2010 (r214897) @@ -6,6 +6,7 @@ FILES= 100.chksetuid \ 200.chkmounts \ 300.chkuid0 \ 400.passwdless \ + 460.chkportsum \ 410.logincheck \ 700.kernelmsg \ 800.loginfail \ From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 21:54:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE4791065675; Sat, 6 Nov 2010 21:54:32 +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 CC7D58FC1A; Sat, 6 Nov 2010 21:54: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 oA6LsWAA053088; Sat, 6 Nov 2010 21:54:32 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6LsWB6053086; Sat, 6 Nov 2010 21:54:32 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011062154.oA6LsWB6053086@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 6 Nov 2010 21:54: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: r214898 - head/sys/dev/sk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 21:54:33 -0000 Author: yongari Date: Sat Nov 6 21:54:32 2010 New Revision: 214898 URL: http://svn.freebsd.org/changeset/base/214898 Log: If we got an invalid station address, generate random address. This might be caused by broken BIOS. Reported by: "Mikhail T." aldan.algebra.com> MFC after: 1 week Modified: head/sys/dev/sk/if_sk.c Modified: head/sys/dev/sk/if_sk.c ============================================================================== --- head/sys/dev/sk/if_sk.c Sat Nov 6 21:04:01 2010 (r214897) +++ head/sys/dev/sk/if_sk.c Sat Nov 6 21:54:32 2010 (r214898) @@ -1319,8 +1319,10 @@ sk_attach(dev) struct sk_softc *sc; struct sk_if_softc *sc_if; struct ifnet *ifp; + u_int32_t r; int error, i, phy, port; u_char eaddr[6]; + u_char inv_mac[] = {0, 0, 0, 0, 0, 0}; if (dev == NULL) return(EINVAL); @@ -1400,6 +1402,23 @@ sk_attach(dev) eaddr[i] = sk_win_read_1(sc, SK_MAC0_0 + (port * 8) + i); + /* Verify whether the station address is invalid or not. */ + if (bcmp(eaddr, inv_mac, sizeof(inv_mac)) == 0) { + device_printf(sc_if->sk_if_dev, + "Generating random ethernet address\n"); + r = arc4random(); + /* + * Set OUI to convenient locally assigned address. 'b' + * is 0x62, which has the locally assigned bit set, and + * the broadcast/multicast bit clear. + */ + eaddr[0] = 'b'; + eaddr[1] = 's'; + eaddr[2] = 'd'; + eaddr[3] = (r >> 16) & 0xff; + eaddr[4] = (r >> 8) & 0xff; + eaddr[5] = (r >> 0) & 0xff; + } /* * Set up RAM buffer addresses. The NIC will have a certain * amount of SRAM on it, somewhere between 512K and 2MB. We From owner-svn-src-all@FreeBSD.ORG Sat Nov 6 22:07:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 703FA106564A; Sat, 6 Nov 2010 22:07:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43EF98FC0C; Sat, 6 Nov 2010 22: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 oA6M7Nmh055458; Sat, 6 Nov 2010 22:07:23 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA6M7NtM055456; Sat, 6 Nov 2010 22:07:23 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011062207.oA6M7NtM055456@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 6 Nov 2010 22: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: r214899 - head/sys/dev/sk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2010 22:07:23 -0000 Author: yongari Date: Sat Nov 6 22:07:22 2010 New Revision: 214899 URL: http://svn.freebsd.org/changeset/base/214899 Log: Fix a long standing bug in programming station address for Yukon controllers. sk(4) never reprogrammed station address for Yukon controllers so overriding station address with ifconfig(8) was not possible. Fix the bug by reprogramming all registers that control station address, flow-control and virtual station address. Virtual station address has no use at this moment since driver does not make use of fail over feature. Tested by: "Mikhail T." aldan.algebra.com> MFC after: 1 week Modified: head/sys/dev/sk/if_sk.c Modified: head/sys/dev/sk/if_sk.c ============================================================================== --- head/sys/dev/sk/if_sk.c Sat Nov 6 21:54:32 2010 (r214898) +++ head/sys/dev/sk/if_sk.c Sat Nov 6 22:07:22 2010 (r214899) @@ -3356,6 +3356,7 @@ sk_init_yukon(sc_if) u_int16_t reg; struct sk_softc *sc; struct ifnet *ifp; + u_int8_t *eaddr; int i; SK_IF_LOCK_ASSERT(sc_if); @@ -3431,19 +3432,19 @@ sk_init_yukon(sc_if) reg |= YU_SMR_MFL_JUMBO; SK_YU_WRITE_2(sc_if, YUKON_SMR, reg); - /* Setup Yukon's address */ - for (i = 0; i < 3; i++) { - /* Write Source Address 1 (unicast filter) */ + /* Setup Yukon's station address */ + eaddr = IF_LLADDR(sc_if->sk_ifp); + for (i = 0; i < 3; i++) + SK_YU_WRITE_2(sc_if, SK_MAC0_0 + i * 4, + eaddr[i * 2] | eaddr[i * 2 + 1] << 8); + /* Set GMAC source address of flow control. */ + for (i = 0; i < 3; i++) SK_YU_WRITE_2(sc_if, YUKON_SAL1 + i * 4, - IF_LLADDR(sc_if->sk_ifp)[i * 2] | - IF_LLADDR(sc_if->sk_ifp)[i * 2 + 1] << 8); - } - - for (i = 0; i < 3; i++) { - reg = sk_win_read_2(sc_if->sk_softc, - SK_MAC1_0 + i * 2 + sc_if->sk_port * 8); - SK_YU_WRITE_2(sc_if, YUKON_SAL2 + i * 4, reg); - } + eaddr[i * 2] | eaddr[i * 2 + 1] << 8); + /* Set GMAC virtual address. */ + for (i = 0; i < 3; i++) + SK_YU_WRITE_2(sc_if, YUKON_SAL2 + i * 4, + eaddr[i * 2] | eaddr[i * 2 + 1] << 8); /* Set Rx filter */ sk_rxfilter_yukon(sc_if);