From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 09:29:56 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B801E106566C; Mon, 22 Mar 2010 09:29:56 +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 A51908FC0A; Mon, 22 Mar 2010 09:29: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 o2M9Tusf079439; Mon, 22 Mar 2010 09:29:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2M9TupT079433; Mon, 22 Mar 2010 09:29:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201003220929.o2M9TupT079433@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 22 Mar 2010 09:29:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205438 - stable/8/usr.bin/procstat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 09:29:56 -0000 Author: kib Date: Mon Mar 22 09:29:56 2010 New Revision: 205438 URL: http://svn.freebsd.org/changeset/base/205438 Log: MFC r204879: Teach procstat(1) to display some information about signal disposition and pending/blocked status for signals. MFC r204880: Add file forgotten in r204879. Added: stable/8/usr.bin/procstat/procstat_sigs.c - copied unchanged from r204880, head/usr.bin/procstat/procstat_sigs.c Modified: stable/8/usr.bin/procstat/Makefile stable/8/usr.bin/procstat/procstat.1 stable/8/usr.bin/procstat/procstat.c stable/8/usr.bin/procstat/procstat.h Directory Properties: stable/8/usr.bin/procstat/ (props changed) Modified: stable/8/usr.bin/procstat/Makefile ============================================================================== --- stable/8/usr.bin/procstat/Makefile Mon Mar 22 07:06:12 2010 (r205437) +++ stable/8/usr.bin/procstat/Makefile Mon Mar 22 09:29:56 2010 (r205438) @@ -9,6 +9,7 @@ SRCS= procstat.c \ procstat_cred.c \ procstat_files.c \ procstat_kstack.c \ + procstat_sigs.c \ procstat_threads.c \ procstat_vm.c Modified: stable/8/usr.bin/procstat/procstat.1 ============================================================================== --- stable/8/usr.bin/procstat/procstat.1 Mon Mar 22 07:06:12 2010 (r205437) +++ stable/8/usr.bin/procstat/procstat.1 Mon Mar 22 09:29:56 2010 (r205438) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 20, 2008 +.Dd March 7, 2010 .Dt PROCSTAT 1 .Os .Sh NAME @@ -34,8 +34,9 @@ .Sh SYNOPSIS .Nm .Op Fl h +.Op Fl n .Op Fl w Ar interval -.Op Fl b | c | f | k | s | t | v +.Op Fl b | c | f | i | j | k | s | t | v .Op Fl a | Ar pid ... .Sh DESCRIPTION The @@ -56,6 +57,10 @@ Display binary information for the proce Display command line arguments for the process. .It Fl f Display file descriptor information for the process. +.It Fl i +Display signal pending and disposition information for the process. +.It Fl j +Display signal pending and blocked information for the process threads. .It Fl k Display the stacks of kernel threads in the process, excluding stacks of threads currently running on a CPU and threads with stacks swapped to disk. @@ -198,6 +203,58 @@ direct I/O .It l lock held .El +.Ss Signal Disposition Information +Display signal pending and disposition for a process: +.Pp +.Bl -tag -width ident -compact +.It PID +process ID +.It COMM +command +.It SIG +signal name +.It FLAGS +process signal disposition details, three symbols +.Bl -tag -width X -compact +.It P +if signal is pending in the global process queue, - otherwise +.It I +if signal delivery disposition is SIGIGN, - otherwise +.It C +if signal delivery is to catch it, - otherwise +.El +.El +.Pp +If +.Fl n +switch is given, the signal numbers are shown instead of signal names. +.Ss Thread Signal Information +Display signal pending and blocked for a process threads: +.Pp +.Bl -tag -width ident -compact +.It PID +process ID +.It COMM +command +.It TID +thread ID +.It SIG +signal name +.It FLAGS +thread signal delivery status, two symbols +.Bl -tag -width X -compact +.It P +if signal is pending for the thread, - otherwise +.It B +if signal is blocked in the thread signal mask, - if not blocked +.El +.El +.Pp +The +.Fl n +switch has the same effect as for the +.Fl i +switch, the signals numbers are shown instead of signal names. .Ss Kernel Thread Stacks Display kernel thread stacks for a process, allowing further interpretation of thread wait channels. Modified: stable/8/usr.bin/procstat/procstat.c ============================================================================== --- stable/8/usr.bin/procstat/procstat.c Mon Mar 22 07:06:12 2010 (r205437) +++ stable/8/usr.bin/procstat/procstat.c Mon Mar 22 09:29:56 2010 (r205438) @@ -38,15 +38,15 @@ #include "procstat.h" -static int aflag, bflag, cflag, fflag, kflag, sflag, tflag, vflag; -int hflag; +static int aflag, bflag, cflag, fflag, iflag, jflag, kflag, sflag, tflag, vflag; +int hflag, nflag; static void usage(void) { - fprintf(stderr, "usage: procstat [-h] [-w interval] [-b | -c | -f | " - "-k | -s | -t | -v]\n"); + fprintf(stderr, "usage: procstat [-h] [-n] [-w interval] [-b | -c | -f | " + "-i | -j | -k | -s | -t | -v]\n"); fprintf(stderr, " [-a | pid ...]\n"); exit(EX_USAGE); } @@ -61,6 +61,10 @@ procstat(pid_t pid, struct kinfo_proc *k procstat_args(pid, kipp); else if (fflag) procstat_files(pid, kipp); + else if (iflag) + procstat_sigs(pid, kipp); + else if (jflag) + procstat_threads_sigs(pid, kipp); else if (kflag) procstat_kstack(pid, kipp, kflag); else if (sflag) @@ -109,7 +113,7 @@ main(int argc, char *argv[]) char *dummy; interval = 0; - while ((ch = getopt(argc, argv, "abcfkhstvw:")) != -1) { + while ((ch = getopt(argc, argv, "abcfijknhstvw:")) != -1) { switch (ch) { case 'a': aflag++; @@ -127,10 +131,22 @@ main(int argc, char *argv[]) fflag++; break; + case 'i': + iflag++; + break; + + case 'j': + jflag++; + break; + case 'k': kflag++; break; + case 'n': + nflag++; + break; + case 'h': hflag++; break; Modified: stable/8/usr.bin/procstat/procstat.h ============================================================================== --- stable/8/usr.bin/procstat/procstat.h Mon Mar 22 07:06:12 2010 (r205437) +++ stable/8/usr.bin/procstat/procstat.h Mon Mar 22 09:29:56 2010 (r205438) @@ -29,7 +29,7 @@ #ifndef PROCSTAT_H #define PROCSTAT_H -extern int hflag; +extern int hflag, nflag; struct kinfo_proc; void kinfo_proc_sort(struct kinfo_proc *kipp, int count); @@ -40,7 +40,9 @@ void procstat_bin(pid_t pid, struct kinf void procstat_cred(pid_t pid, struct kinfo_proc *kipp); void procstat_files(pid_t pid, struct kinfo_proc *kipp); void procstat_kstack(pid_t pid, struct kinfo_proc *kipp, int kflag); +void procstat_sigs(pid_t pid, struct kinfo_proc *kipp); void procstat_threads(pid_t pid, struct kinfo_proc *kipp); +void procstat_threads_sigs(pid_t pid, struct kinfo_proc *kipp); void procstat_vm(pid_t pid, struct kinfo_proc *kipp); #endif /* !PROCSTAT_H */ Copied: stable/8/usr.bin/procstat/procstat_sigs.c (from r204880, head/usr.bin/procstat/procstat_sigs.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.bin/procstat/procstat_sigs.c Mon Mar 22 09:29:56 2010 (r205438, copy of r204880, head/usr.bin/procstat/procstat_sigs.c) @@ -0,0 +1,139 @@ +/*- + * Copyright (c) 2010 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "procstat.h" + +static void +procstat_print_signame(int sig) +{ + char name[12]; + int i; + + if (!nflag && sig < sys_nsig) { + strlcpy(name, sys_signame[sig], sizeof(name)); + for (i = 0; name[i] != 0; i++) + name[i] = toupper(name[i]); + printf("%-7s ", name); + } else + printf("%-7d ", sig); +} + +static void +procstat_print_sig(const sigset_t *set, int sig, char flag) +{ + + printf("%c", sigismember(set, sig) ? flag : '-'); +} + +void +procstat_sigs(pid_t pid, struct kinfo_proc *kipp) +{ + int j; + + if (!hflag) + printf("%5s %-16s %-7s %4s\n", "PID", "COMM", "SIG", "FLAGS"); + + for (j = 1; j <= _SIG_MAXSIG; j++) { + printf("%5d ", pid); + printf("%-16s ", kipp->ki_comm); + procstat_print_signame(j); + printf(" "); + procstat_print_sig(&kipp->ki_siglist, j, 'P'); + procstat_print_sig(&kipp->ki_sigignore, j, 'I'); + procstat_print_sig(&kipp->ki_sigcatch, j, 'C'); + printf("\n"); + } +} + +void +procstat_threads_sigs(pid_t pid, struct kinfo_proc *kipp) +{ + struct kinfo_proc *kip; + int error, name[4], j; + unsigned int i; + size_t len; + + if (!hflag) + printf("%5s %6s %-16s %-7s %4s\n", "PID", "TID", "COMM", + "SIG", "FLAGS"); + + /* + * We need to re-query for thread information, so don't use *kipp. + */ + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_PID | KERN_PROC_INC_THREAD; + name[3] = pid; + + len = 0; + error = sysctl(name, 4, NULL, &len, NULL, 0); + if (error < 0 && errno != ESRCH) { + warn("sysctl: kern.proc.pid: %d", pid); + return; + } + if (error < 0) + return; + + kip = malloc(len); + if (kip == NULL) + err(-1, "malloc"); + + if (sysctl(name, 4, kip, &len, NULL, 0) < 0) { + warn("sysctl: kern.proc.pid: %d", pid); + free(kip); + return; + } + + kinfo_proc_sort(kip, len / sizeof(*kipp)); + for (i = 0; i < len / sizeof(*kipp); i++) { + kipp = &kip[i]; + for (j = 1; j <= _SIG_MAXSIG; j++) { + printf("%5d ", pid); + printf("%6d ", kipp->ki_tid); + printf("%-16s ", kipp->ki_comm); + procstat_print_signame(j); + printf(" "); + procstat_print_sig(&kipp->ki_siglist, j, 'P'); + procstat_print_sig(&kipp->ki_sigmask, j, 'B'); + printf("\n"); + } + } + free(kip); +} From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 10:12:00 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82BF6106566C; Mon, 22 Mar 2010 10:12:00 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71EE18FC08; Mon, 22 Mar 2010 10:12: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 o2MAC0pR088795; Mon, 22 Mar 2010 10:12:00 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MAC0ZR088793; Mon, 22 Mar 2010 10:12:00 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201003221012.o2MAC0ZR088793@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 22 Mar 2010 10:12: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: r205439 - stable/8/sbin/ipfw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 10:12:00 -0000 Author: glebius Date: Mon Mar 22 10:11:59 2010 New Revision: 205439 URL: http://svn.freebsd.org/changeset/base/205439 Log: MFC r200183 by luigi: restore setting of sin_len (was removed in 1.146 last february) as it seems that now it is necessary for 'forward' to work outside lo0. Approved by: luigi Modified: stable/8/sbin/ipfw/ipfw2.c Directory Properties: stable/8/sbin/ipfw/ (props changed) Modified: stable/8/sbin/ipfw/ipfw2.c ============================================================================== --- stable/8/sbin/ipfw/ipfw2.c Mon Mar 22 09:29:56 2010 (r205438) +++ stable/8/sbin/ipfw/ipfw2.c Mon Mar 22 10:11:59 2010 (r205439) @@ -2740,9 +2740,11 @@ chkarg: /* * In the kernel we assume AF_INET and use only - * sin_port and sin_addr. + * sin_port and sin_addr. Remember to set sin_len as + * the routing code seems to use it too. */ p->sa.sin_family = AF_INET; + p->sa.sin_len = sizeof(struct sockaddr_in); p->sa.sin_port = 0; /* * locate the address-port separator (':' or ',') From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 11:18:51 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF2351065673; Mon, 22 Mar 2010 11:18:51 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEC248FC15; Mon, 22 Mar 2010 11:18: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 o2MBIphK005205; Mon, 22 Mar 2010 11:18:51 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MBIpnM005203; Mon, 22 Mar 2010 11:18:51 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <201003221118.o2MBIpnM005203@svn.freebsd.org> From: Andrew Gallatin Date: Mon, 22 Mar 2010 11:18: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: r205442 - stable/8/sys/dev/mxge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 11:18:51 -0000 Author: gallatin Date: Mon Mar 22 11:18:51 2010 New Revision: 205442 URL: http://svn.freebsd.org/changeset/base/205442 Log: MFC 205255: Fix 2 bugs in mxge_attach() Modified: stable/8/sys/dev/mxge/if_mxge.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/mxge/if_mxge.c ============================================================================== --- stable/8/sys/dev/mxge/if_mxge.c Mon Mar 22 11:00:57 2010 (r205441) +++ stable/8/sys/dev/mxge/if_mxge.c Mon Mar 22 11:18:51 2010 (r205442) @@ -4610,8 +4610,6 @@ mxge_attach(device_t dev) err = ENOMEM; goto abort_with_nothing; } - taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq", - device_get_nameunit(sc->dev)); err = bus_dma_tag_create(NULL, /* parent */ 1, /* alignment */ @@ -4717,7 +4715,7 @@ mxge_attach(device_t dev) err = mxge_alloc_rings(sc); if (err != 0) { device_printf(sc->dev, "failed to allocate rings\n"); - goto abort_with_dmabench; + goto abort_with_slices; } err = mxge_add_irq(sc); @@ -4770,6 +4768,8 @@ mxge_attach(device_t dev) ifp->if_transmit = mxge_transmit; ifp->if_qflush = mxge_qflush; #endif + taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq", + device_get_nameunit(sc->dev)); callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc); return 0; From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 14:50:08 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B13F106564A; Mon, 22 Mar 2010 14:50:08 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68DF28FC15; Mon, 22 Mar 2010 14:50: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 o2MEo87j052222; Mon, 22 Mar 2010 14:50:08 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MEo823052220; Mon, 22 Mar 2010 14:50:08 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <201003221450.o2MEo823052220@svn.freebsd.org> From: Andrew Gallatin Date: Mon, 22 Mar 2010 14:50: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: r205447 - stable/8/sys/dev/mxge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 14:50:08 -0000 Author: gallatin Date: Mon Mar 22 14:50:08 2010 New Revision: 205447 URL: http://svn.freebsd.org/changeset/base/205447 Log: MFC 204212: Update mxge to support IFCAP_VLAN_HWTSO. Modified: stable/8/sys/dev/mxge/if_mxge.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/mxge/if_mxge.c ============================================================================== --- stable/8/sys/dev/mxge/if_mxge.c Mon Mar 22 13:21:52 2010 (r205446) +++ stable/8/sys/dev/mxge/if_mxge.c Mon Mar 22 14:50:08 2010 (r205447) @@ -4122,6 +4122,13 @@ mxge_ioctl(struct ifnet *ifp, u_long com } if (mask & IFCAP_VLAN_HWTAGGING) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if (mask & IFCAP_VLAN_HWTSO) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; + + if (!(ifp->if_capabilities & IFCAP_VLAN_HWTSO) || + !(ifp->if_capenable & IFCAP_VLAN_HWTAGGING)) + ifp->if_capenable &= ~IFCAP_VLAN_HWTSO; + mtx_unlock(&sc->driver_mtx); VLAN_CAPABILITIES(ifp); @@ -4733,6 +4740,11 @@ mxge_attach(device_t dev) #ifdef MXGE_NEW_VLAN_API ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM; + + /* Only FW 1.4.32 and newer can do TSO over vlans */ + if (sc->fw_ver_major == 1 && sc->fw_ver_minor == 4 && + sc->fw_ver_tiny >= 32) + ifp->if_capabilities |= IFCAP_VLAN_HWTSO; #endif sc->max_mtu = mxge_max_mtu(sc); From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 15:52:27 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CAA1106564A; Mon, 22 Mar 2010 15:52:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 590048FC13; Mon, 22 Mar 2010 15:52: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 o2MFqRC3066347; Mon, 22 Mar 2010 15:52:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MFqRl7066339; Mon, 22 Mar 2010 15:52:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201003221552.o2MFqRl7066339@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Mar 2010 15:52: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: r205449 - stable/8/lib/libc/rpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 15:52:27 -0000 Author: jhb Date: Mon Mar 22 15:52:26 2010 New Revision: 205449 URL: http://svn.freebsd.org/changeset/base/205449 Log: MFC 204950,205020: Use thr_once() with once_t controls to initialize various thread_key_t objects used to provide per-thread storage in the RPC code. Almost all of these used double-checking with a dedicated mutex (tsd_lock) to do this before. However, that is not always safe with more relaxed memory orders. There were also other bugs, such as one in __rpc_createrr() that caused a new key to be allocated each time __rpc_createrr() was invoked. Modified: stable/8/lib/libc/rpc/Symbol.map stable/8/lib/libc/rpc/clnt_simple.c stable/8/lib/libc/rpc/getnetconfig.c stable/8/lib/libc/rpc/key_call.c stable/8/lib/libc/rpc/mt_misc.c stable/8/lib/libc/rpc/mt_misc.h stable/8/lib/libc/rpc/rpc_generic.c stable/8/lib/libc/rpc/rpc_soc.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/rpc/Symbol.map ============================================================================== --- stable/8/lib/libc/rpc/Symbol.map Mon Mar 22 15:08:26 2010 (r205448) +++ stable/8/lib/libc/rpc/Symbol.map Mon Mar 22 15:52:26 2010 (r205449) @@ -239,10 +239,6 @@ FBSDprivate_1.0 { __key_encryptsession_pk_LOCAL; __key_decryptsession_pk_LOCAL; __key_gendes_LOCAL; - __tsd_lock; /* - * Why does usr.bin/rpcinfo/Makefile need rpc_generic.c? - * Remove this hack if rpcinfo stops building with it. - */ __svc_clean_idle; __rpc_gss_unwrap; __rpc_gss_unwrap_stub; Modified: stable/8/lib/libc/rpc/clnt_simple.c ============================================================================== --- stable/8/lib/libc/rpc/clnt_simple.c Mon Mar 22 15:08:26 2010 (r205448) +++ stable/8/lib/libc/rpc/clnt_simple.c Mon Mar 22 15:52:26 2010 (r205449) @@ -76,7 +76,11 @@ struct rpc_call_private { char nettype[NETIDLEN]; /* Network type */ }; static struct rpc_call_private *rpc_call_private_main; +static thread_key_t rpc_call_key; +static once_t rpc_call_once = ONCE_INITIALIZER; +static int rpc_call_key_error; +static void rpc_call_key_init(void); static void rpc_call_destroy(void *); static void @@ -91,6 +95,13 @@ rpc_call_destroy(void *vp) } } +static void +rpc_call_key_init(void) +{ + + rpc_call_key_error = thr_keycreate(&rpc_call_key, rpc_call_destroy); +} + /* * This is the simplified interface to the client rpc layer. * The client handle is not destroyed here and is reused for @@ -112,17 +123,16 @@ rpc_call(host, prognum, versnum, procnum struct rpc_call_private *rcp = (struct rpc_call_private *) 0; enum clnt_stat clnt_stat; struct timeval timeout, tottimeout; - static thread_key_t rpc_call_key; int main_thread = 1; if ((main_thread = thr_main())) { rcp = rpc_call_private_main; } else { - if (rpc_call_key == 0) { - mutex_lock(&tsd_lock); - if (rpc_call_key == 0) - thr_keycreate(&rpc_call_key, rpc_call_destroy); - mutex_unlock(&tsd_lock); + if (thr_once(&rpc_call_once, rpc_call_key_init) != 0 || + rpc_call_key_error != 0) { + rpc_createerr.cf_stat = RPC_SYSTEMERROR; + rpc_createerr.cf_error.re_errno = rpc_call_key_error; + return (rpc_createerr.cf_stat); } rcp = (struct rpc_call_private *)thr_getspecific(rpc_call_key); } Modified: stable/8/lib/libc/rpc/getnetconfig.c ============================================================================== --- stable/8/lib/libc/rpc/getnetconfig.c Mon Mar 22 15:08:26 2010 (r205448) +++ stable/8/lib/libc/rpc/getnetconfig.c Mon Mar 22 15:52:26 2010 (r205449) @@ -130,21 +130,29 @@ static struct netconfig *dup_ncp(struct static FILE *nc_file; /* for netconfig db */ -static pthread_mutex_t nc_file_lock = PTHREAD_MUTEX_INITIALIZER; +static mutex_t nc_file_lock = MUTEX_INITIALIZER; static struct netconfig_info ni = { 0, 0, NULL, NULL}; -static pthread_mutex_t ni_lock = PTHREAD_MUTEX_INITIALIZER; +static mutex_t ni_lock = MUTEX_INITIALIZER; +static thread_key_t nc_key; +static once_t nc_once = ONCE_INITIALIZER; +static int nc_key_error; + +static void +nc_key_init(void) +{ + + nc_key_error = thr_keycreate(&nc_key, free); +} #define MAXNETCONFIGLINE 1000 static int * __nc_error() { - static pthread_mutex_t nc_lock = PTHREAD_MUTEX_INITIALIZER; - static thread_key_t nc_key = 0; static int nc_error = 0; - int error, *nc_addr; + int *nc_addr; /* * Use the static `nc_error' if we are the main thread @@ -153,15 +161,8 @@ __nc_error() */ if (thr_main()) return (&nc_error); - if (nc_key == 0) { - error = 0; - mutex_lock(&nc_lock); - if (nc_key == 0) - error = thr_keycreate(&nc_key, free); - mutex_unlock(&nc_lock); - if (error) - return (&nc_error); - } + if (thr_once(&nc_once, nc_key_init) != 0 || nc_key_error != 0) + return (&nc_error); if ((nc_addr = (int *)thr_getspecific(nc_key)) == NULL) { nc_addr = (int *)malloc(sizeof (int)); if (thr_setspecific(nc_key, (void *) nc_addr) != 0) { Modified: stable/8/lib/libc/rpc/key_call.c ============================================================================== --- stable/8/lib/libc/rpc/key_call.c Mon Mar 22 15:08:26 2010 (r205448) +++ stable/8/lib/libc/rpc/key_call.c Mon Mar 22 15:52:26 2010 (r205449) @@ -279,6 +279,9 @@ struct key_call_private { uid_t uid; /* user-id at last authorization */ }; static struct key_call_private *key_call_private_main = NULL; +static thread_key_t key_call_key; +static once_t key_call_once = ONCE_INITIALIZER; +static int key_call_key_error; static void key_call_destroy(void *vp) @@ -292,6 +295,13 @@ key_call_destroy(void *vp) } } +static void +key_call_init(void) +{ + + key_call_key_error = thr_keycreate(&key_call_key, key_call_destroy); +} + /* * Keep the handle cached. This call may be made quite often. */ @@ -307,7 +317,6 @@ int vers; struct utsname u; int main_thread; int fd; - static thread_key_t key_call_key; #define TOTAL_TIMEOUT 30 /* total timeout talking to keyserver */ #define TOTAL_TRIES 5 /* Number of tries */ @@ -315,12 +324,9 @@ int vers; if ((main_thread = thr_main())) { kcp = key_call_private_main; } else { - if (key_call_key == 0) { - mutex_lock(&tsd_lock); - if (key_call_key == 0) - thr_keycreate(&key_call_key, key_call_destroy); - mutex_unlock(&tsd_lock); - } + if (thr_once(&key_call_once, key_call_init) != 0 || + key_call_key_error != 0) + return ((CLIENT *) NULL); kcp = (struct key_call_private *)thr_getspecific(key_call_key); } if (kcp == (struct key_call_private *)NULL) { Modified: stable/8/lib/libc/rpc/mt_misc.c ============================================================================== --- stable/8/lib/libc/rpc/mt_misc.c Mon Mar 22 15:08:26 2010 (r205448) +++ stable/8/lib/libc/rpc/mt_misc.c Mon Mar 22 15:52:26 2010 (r205449) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #define proglst_lock __proglst_lock #define rpcsoc_lock __rpcsoc_lock #define svcraw_lock __svcraw_lock -#define tsd_lock __tsd_lock #define xprtlist_lock __xprtlist_lock /* protects the services list (svc.c) */ @@ -76,33 +75,33 @@ pthread_mutex_t rpcsoc_lock = PTHREAD_MU /* svc_raw.c serialization */ pthread_mutex_t svcraw_lock = PTHREAD_MUTEX_INITIALIZER; -/* protects TSD key creation */ -pthread_mutex_t tsd_lock = PTHREAD_MUTEX_INITIALIZER; - /* xprtlist (svc_generic.c) */ pthread_mutex_t xprtlist_lock = PTHREAD_MUTEX_INITIALIZER; #undef rpc_createerr struct rpc_createerr rpc_createerr; +static thread_key_t rce_key; +static once_t rce_once = ONCE_INITIALIZER; +static int rce_key_error; + +static void +rce_key_init(void) +{ + + rce_key_error = thr_keycreate(&rce_key, free); +} struct rpc_createerr * __rpc_createerr() { - static thread_key_t rce_key = 0; struct rpc_createerr *rce_addr = 0; if (thr_main()) return (&rpc_createerr); - if ((rce_addr = - (struct rpc_createerr *)thr_getspecific(rce_key)) != 0) { - mutex_lock(&tsd_lock); - if (thr_keycreate(&rce_key, free) != 0) { - mutex_unlock(&tsd_lock); - return (&rpc_createerr); - } - mutex_unlock(&tsd_lock); - } + if (thr_once(&rce_once, rce_key_init) != 0 || rce_key_error != 0) + return (&rpc_createerr); + rce_addr = (struct rpc_createerr *)thr_getspecific(rce_key); if (!rce_addr) { rce_addr = (struct rpc_createerr *) malloc(sizeof (struct rpc_createerr)); Modified: stable/8/lib/libc/rpc/mt_misc.h ============================================================================== --- stable/8/lib/libc/rpc/mt_misc.h Mon Mar 22 15:08:26 2010 (r205448) +++ stable/8/lib/libc/rpc/mt_misc.h Mon Mar 22 15:52:26 2010 (r205449) @@ -42,7 +42,6 @@ #define proglst_lock __proglst_lock #define rpcsoc_lock __rpcsoc_lock #define svcraw_lock __svcraw_lock -#define tsd_lock __tsd_lock #define xprtlist_lock __xprtlist_lock extern pthread_rwlock_t svc_lock; Modified: stable/8/lib/libc/rpc/rpc_generic.c ============================================================================== --- stable/8/lib/libc/rpc/rpc_generic.c Mon Mar 22 15:08:26 2010 (r205448) +++ stable/8/lib/libc/rpc/rpc_generic.c Mon Mar 22 15:52:26 2010 (r205449) @@ -221,6 +221,18 @@ getnettype(nettype) return (_rpctypelist[i].type); } +static thread_key_t tcp_key, udp_key; +static once_t keys_once = ONCE_INITIALIZER; +static int tcp_key_error, udp_key_error; + +static void +keys_init(void) +{ + + tcp_key_error = thr_keycreate(&tcp_key, free); + udp_key_error = thr_keycreate(&udp_key, free); +} + /* * For the given nettype (tcp or udp only), return the first structure found. * This should be freed by calling freenetconfigent() @@ -236,25 +248,15 @@ __rpc_getconfip(nettype) static char *netid_udp_main; struct netconfig *dummy; int main_thread; - static thread_key_t tcp_key, udp_key; if ((main_thread = thr_main())) { netid_udp = netid_udp_main; netid_tcp = netid_tcp_main; } else { - if (tcp_key == 0) { - mutex_lock(&tsd_lock); - if (tcp_key == 0) - thr_keycreate(&tcp_key, free); - mutex_unlock(&tsd_lock); - } + if (thr_once(&keys_once, keys_init) != 0 || + tcp_key_error != 0 || udp_key_error != 0) + return (NULL); netid_tcp = (char *)thr_getspecific(tcp_key); - if (udp_key == 0) { - mutex_lock(&tsd_lock); - if (udp_key == 0) - thr_keycreate(&udp_key, free); - mutex_unlock(&tsd_lock); - } netid_udp = (char *)thr_getspecific(udp_key); } if (!netid_udp && !netid_tcp) { Modified: stable/8/lib/libc/rpc/rpc_soc.c ============================================================================== --- stable/8/lib/libc/rpc/rpc_soc.c Mon Mar 22 15:08:26 2010 (r205448) +++ stable/8/lib/libc/rpc/rpc_soc.c Mon Mar 22 15:52:26 2010 (r205449) @@ -360,6 +360,14 @@ registerrpc(prognum, versnum, procnum, p */ static thread_key_t clnt_broadcast_key; static resultproc_t clnt_broadcast_result_main; +static once_t clnt_broadcast_once = ONCE_INITIALIZER; + +static void +clnt_broadcast_key_init(void) +{ + + thr_keycreate(&clnt_broadcast_key, free); +} /* * Need to translate the netbuf address into sockaddr_in address. @@ -402,12 +410,7 @@ clnt_broadcast(prog, vers, proc, xargs, if (thr_main()) clnt_broadcast_result_main = eachresult; else { - if (clnt_broadcast_key == 0) { - mutex_lock(&tsd_lock); - if (clnt_broadcast_key == 0) - thr_keycreate(&clnt_broadcast_key, free); - mutex_unlock(&tsd_lock); - } + thr_once(&clnt_broadcast_once, clnt_broadcast_key_init); thr_setspecific(clnt_broadcast_key, (void *) eachresult); } return rpc_broadcast((rpcprog_t)prog, (rpcvers_t)vers, From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 16:40:10 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95FBA1065672; Mon, 22 Mar 2010 16:40:10 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 681708FC14; Mon, 22 Mar 2010 16:40: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 o2MGeAsv076932; Mon, 22 Mar 2010 16:40:10 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MGeAKK076930; Mon, 22 Mar 2010 16:40:10 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201003221640.o2MGeAKK076930@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 22 Mar 2010 16:40: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: r205451 - stable/8/sbin/ipfw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 16:40:10 -0000 Author: luigi Date: Mon Mar 22 16:40:10 2010 New Revision: 205451 URL: http://svn.freebsd.org/changeset/base/205451 Log: mfc r205179: print correctly addresses with an OR block Modified: stable/8/sbin/ipfw/ipfw2.c Directory Properties: stable/8/sbin/ipfw/ (props changed) Modified: stable/8/sbin/ipfw/ipfw2.c ============================================================================== --- stable/8/sbin/ipfw/ipfw2.c Mon Mar 22 15:54:56 2010 (r205450) +++ stable/8/sbin/ipfw/ipfw2.c Mon Mar 22 16:40:10 2010 (r205451) @@ -895,9 +895,9 @@ print_icmptypes(ipfw_insn_u32 *cmd) #define HAVE_DSTIP 0x0004 #define HAVE_PROTO4 0x0008 #define HAVE_PROTO6 0x0010 +#define HAVE_IP 0x0100 #define HAVE_OPTIONS 0x8000 -#define HAVE_IP (HAVE_PROTO | HAVE_SRCIP | HAVE_DSTIP) static void show_prerequisites(int *flags, int want, int cmd __unused) { @@ -998,7 +998,9 @@ show_ipfw(struct ip_fw *rule, int pcwidt switch(cmd->opcode) { case O_CHECK_STATE: printf("check-state"); - flags = HAVE_IP; /* avoid printing anything else */ + /* avoid printing anything else */ + flags = HAVE_PROTO | HAVE_SRCIP | + HAVE_DSTIP | HAVE_IP; break; case O_ACCEPT: @@ -1136,7 +1138,8 @@ show_ipfw(struct ip_fw *rule, int pcwidt show_prerequisites(&flags, HAVE_PROTO, 0); printf(" from any to any"); } - flags |= HAVE_IP | HAVE_OPTIONS; + flags |= HAVE_IP | HAVE_OPTIONS | HAVE_PROTO | + HAVE_SRCIP | HAVE_DSTIP; } if (co.comment_only) @@ -1225,9 +1228,12 @@ show_ipfw(struct ip_fw *rule, int pcwidt break; case O_IP_DSTPORT: - show_prerequisites(&flags, HAVE_IP, 0); + show_prerequisites(&flags, + HAVE_PROTO | HAVE_SRCIP | + HAVE_DSTIP | HAVE_IP, 0); case O_IP_SRCPORT: - show_prerequisites(&flags, HAVE_PROTO|HAVE_SRCIP, 0); + show_prerequisites(&flags, + HAVE_PROTO | HAVE_SRCIP, 0); if ((cmd->len & F_OR) && !or_block) printf(" {"); if (cmd->len & F_NOT) @@ -1248,7 +1254,8 @@ show_ipfw(struct ip_fw *rule, int pcwidt if ((flags & (HAVE_PROTO4 | HAVE_PROTO6)) && !(flags & HAVE_PROTO)) show_prerequisites(&flags, - HAVE_IP | HAVE_OPTIONS, 0); + HAVE_PROTO | HAVE_IP | HAVE_SRCIP | + HAVE_DSTIP | HAVE_OPTIONS, 0); if (flags & HAVE_OPTIONS) printf(" proto"); if (pe) @@ -1266,7 +1273,8 @@ show_ipfw(struct ip_fw *rule, int pcwidt ((cmd->opcode == O_IP4) && (flags & HAVE_PROTO4))) break; - show_prerequisites(&flags, HAVE_IP | HAVE_OPTIONS, 0); + show_prerequisites(&flags, HAVE_PROTO | HAVE_SRCIP | + HAVE_DSTIP | HAVE_IP | HAVE_OPTIONS, 0); if ((cmd->len & F_OR) && !or_block) printf(" {"); if (cmd->len & F_NOT && cmd->opcode != O_IN) @@ -1520,7 +1528,8 @@ show_ipfw(struct ip_fw *rule, int pcwidt or_block = 0; } } - show_prerequisites(&flags, HAVE_IP, 0); + show_prerequisites(&flags, HAVE_PROTO | HAVE_SRCIP | HAVE_DSTIP + | HAVE_IP, 0); if (comment) printf(" // %s", comment); printf("\n"); From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 19:50:57 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8F25106564A; Mon, 22 Mar 2010 19:50:57 +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 986338FC13; Mon, 22 Mar 2010 19:50: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 o2MJovbe022662; Mon, 22 Mar 2010 19:50:57 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MJovE3022660; Mon, 22 Mar 2010 19:50:57 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201003221950.o2MJovE3022660@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 22 Mar 2010 19:50: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: r205461 - stable/8/etc/ppp X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 19:50:57 -0000 Author: jkim Date: Mon Mar 22 19:50:57 2010 New Revision: 205461 URL: http://svn.freebsd.org/changeset/base/205461 Log: MFC: r203943 Remove COMPILATIONDATE from the default section. This string is no longer being substituted since r162063. Modified: stable/8/etc/ppp/ppp.conf Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/ppp/ppp.conf ============================================================================== --- stable/8/etc/ppp/ppp.conf Mon Mar 22 19:50:33 2010 (r205460) +++ stable/8/etc/ppp/ppp.conf Mon Mar 22 19:50:57 2010 (r205461) @@ -10,7 +10,7 @@ default: set log Phase Chat LCP IPCP CCP tun command - ident user-ppp VERSION (built COMPILATIONDATE) + ident user-ppp VERSION # Ensure that "device" references the correct serial port # for your modem. (cuau0 = COM1, cuau1 = COM2) From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 19:59:01 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BB77106568B; Mon, 22 Mar 2010 19:59:01 +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 EF6448FC28; Mon, 22 Mar 2010 19:59: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 o2MJx0Pj024573; Mon, 22 Mar 2010 19:59:00 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MJx0SX024571; Mon, 22 Mar 2010 19:59:00 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201003221959.o2MJx0SX024571@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 22 Mar 2010 19:59: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: r205463 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 19:59:01 -0000 Author: jkim Date: Mon Mar 22 19:59:00 2010 New Revision: 205463 URL: http://svn.freebsd.org/changeset/base/205463 Log: MFC: r205092 Tidy up callout for select(2) and read timeout. - Add a missing callout_drain(9) before the descriptor deallocation.[1] - Prefer callout_init_mtx(9) over callout_init(9) and let the callout subsystem handle the mutex for callout function. PR: kern/144453 Submitted by: Alexander Sack (asack at niksun dot com)[1] Modified: stable/8/sys/net/bpf.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/net/bpf.c ============================================================================== --- stable/8/sys/net/bpf.c Mon Mar 22 19:52:06 2010 (r205462) +++ stable/8/sys/net/bpf.c Mon Mar 22 19:59:00 2010 (r205463) @@ -611,6 +611,7 @@ bpf_dtor(void *data) mac_bpfdesc_destroy(d); #endif /* MAC */ knlist_destroy(&d->bd_sel.si_note); + callout_drain(&d->bd_callout); bpf_freed(d); free(d, M_BPF); } @@ -648,7 +649,7 @@ bpfopen(struct cdev *dev, int flags, int mac_bpfdesc_create(td->td_ucred, d); #endif mtx_init(&d->bd_mtx, devtoname(dev), "bpf cdev lock", MTX_DEF); - callout_init(&d->bd_callout, CALLOUT_MPSAFE); + callout_init_mtx(&d->bd_callout, &d->bd_mtx, 0); knlist_init_mtx(&d->bd_sel.si_note, &d->bd_mtx); return (0); @@ -804,13 +805,15 @@ bpf_timed_out(void *arg) { struct bpf_d *d = (struct bpf_d *)arg; - BPFD_LOCK(d); + BPFD_LOCK_ASSERT(d); + + if (callout_pending(&d->bd_callout) || !callout_active(&d->bd_callout)) + return; if (d->bd_state == BPF_WAITING) { d->bd_state = BPF_TIMED_OUT; if (d->bd_slen != 0) bpf_wakeup(d); } - BPFD_UNLOCK(d); } static int From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 20:36:35 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94DF5106566C; Mon, 22 Mar 2010 20:36: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 69D4D8FC23; Mon, 22 Mar 2010 20:36: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 o2MKaZmX033204; Mon, 22 Mar 2010 20:36:35 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MKaZUP033202; Mon, 22 Mar 2010 20:36:35 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201003222036.o2MKaZUP033202@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 22 Mar 2010 20:36:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205468 - stable/8/sys/fs/fdescfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 20:36:35 -0000 Author: jkim Date: Mon Mar 22 20:36:35 2010 New Revision: 205468 URL: http://svn.freebsd.org/changeset/base/205468 Log: MFC: r205223 Fix a long standing regression of readdir(3) in fdescfs(5) introduced in r1.48. We were stopping at the first null pointer when multiple file descriptors were opened and one in the middle was closed. This restores traditional behaviour of fdescfs. Modified: stable/8/sys/fs/fdescfs/fdesc_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- stable/8/sys/fs/fdescfs/fdesc_vnops.c Mon Mar 22 20:26:52 2010 (r205467) +++ stable/8/sys/fs/fdescfs/fdesc_vnops.c Mon Mar 22 20:36:35 2010 (r205468) @@ -522,11 +522,10 @@ fdesc_readdir(ap) FILEDESC_SLOCK(fdp); while (i < fdp->fd_nfiles + 2 && uio->uio_resid >= UIO_MX) { + bzero((caddr_t)dp, UIO_MX); switch (i) { case 0: /* `.' */ case 1: /* `..' */ - bzero((caddr_t)dp, UIO_MX); - dp->d_fileno = i + FD_ROOT; dp->d_namlen = i + 1; dp->d_reclen = UIO_MX; @@ -535,26 +534,24 @@ fdesc_readdir(ap) dp->d_type = DT_DIR; break; default: - if (fdp->fd_ofiles[fcnt] == NULL) { - FILEDESC_SUNLOCK(fdp); - goto done; - } - - bzero((caddr_t) dp, UIO_MX); + if (fdp->fd_ofiles[fcnt] == NULL) + break; dp->d_namlen = sprintf(dp->d_name, "%d", fcnt); dp->d_reclen = UIO_MX; dp->d_type = DT_UNKNOWN; dp->d_fileno = i + FD_DESC; break; } - /* - * And ship to userland - */ - FILEDESC_SUNLOCK(fdp); - error = uiomove(dp, UIO_MX, uio); - if (error) - goto done; - FILEDESC_SLOCK(fdp); + if (dp->d_namlen != 0) { + /* + * And ship to userland + */ + FILEDESC_SUNLOCK(fdp); + error = uiomove(dp, UIO_MX, uio); + if (error) + goto done; + FILEDESC_SLOCK(fdp); + } i++; fcnt++; } From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 22 21:35:55 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 160C8106564A; Mon, 22 Mar 2010 21:35:55 +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 046798FC08; Mon, 22 Mar 2010 21:35: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 o2MLZsLI046869; Mon, 22 Mar 2010 21:35:54 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MLZs9Z046864; Mon, 22 Mar 2010 21:35:54 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201003222135.o2MLZs9Z046864@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 22 Mar 2010 21:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205476 - stable/8/share/zoneinfo X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2010 21:35:55 -0000 Author: edwin Date: Mon Mar 22 21:35:54 2010 New Revision: 205476 URL: http://svn.freebsd.org/changeset/base/205476 Log: MFC of r205475, tzdata2010f: The Australian Antartic Division: - Macquarie Island will stay on UTC+11 for winter and not switch back from DST. - Casey station reverted to its normal time of UTC+8 on 5 March 2010. - Davis station will revert to its normal time of UTC+7 at 10 March 2010 - Mawson station stays on UTC+5. Syria will start DST on Thursday 1 April 2010 at midnight. Correct Samao DST start date (26 Sep vs 24 Oct) Modified: stable/8/share/zoneinfo/antarctica stable/8/share/zoneinfo/asia stable/8/share/zoneinfo/australasia stable/8/share/zoneinfo/zone.tab Directory Properties: stable/8/share/zoneinfo/ (props changed) Modified: stable/8/share/zoneinfo/antarctica ============================================================================== --- stable/8/share/zoneinfo/antarctica Mon Mar 22 21:27:51 2010 (r205475) +++ stable/8/share/zoneinfo/antarctica Mon Mar 22 21:35:54 2010 (r205476) @@ -1,5 +1,5 @@ #
-# @(#)antarctica	8.7
+# @(#)antarctica	8.8
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -57,6 +57,33 @@ Rule	ChileAQ	1999	only	-	Apr	 4	3:00u	0	
 Rule	ChileAQ	1999	max	-	Oct	Sun>=9	4:00u	1:00	S
 Rule	ChileAQ	2000	max	-	Mar	Sun>=9	3:00u	0	-
 
+# These rules are stolen from the `australasia' file.
+Rule	AusAQ	1917	only	-	Jan	 1	0:01	1:00	-
+Rule	AusAQ	1917	only	-	Mar	25	2:00	0	-
+Rule	AusAQ	1942	only	-	Jan	 1	2:00	1:00	-
+Rule	AusAQ	1942	only	-	Mar	29	2:00	0	-
+Rule	AusAQ	1942	only	-	Sep	27	2:00	1:00	-
+Rule	AusAQ	1943	1944	-	Mar	lastSun	2:00	0	-
+Rule	AusAQ	1943	only	-	Oct	 3	2:00	1:00	-
+Rule	ATAQ	1967	only	-	Oct	Sun>=1	2:00s	1:00	-
+Rule	ATAQ	1968	only	-	Mar	lastSun	2:00s	0	-
+Rule	ATAQ	1968	1985	-	Oct	lastSun	2:00s	1:00	-
+Rule	ATAQ	1969	1971	-	Mar	Sun>=8	2:00s	0	-
+Rule	ATAQ	1972	only	-	Feb	lastSun	2:00s	0	-
+Rule	ATAQ	1973	1981	-	Mar	Sun>=1	2:00s	0	-
+Rule	ATAQ	1982	1983	-	Mar	lastSun	2:00s	0	-
+Rule	ATAQ	1984	1986	-	Mar	Sun>=1	2:00s	0	-
+Rule	ATAQ	1986	only	-	Oct	Sun>=15	2:00s	1:00	-
+Rule	ATAQ	1987	1990	-	Mar	Sun>=15	2:00s	0	-
+Rule	ATAQ	1987	only	-	Oct	Sun>=22	2:00s	1:00	-
+Rule	ATAQ	1988	1990	-	Oct	lastSun	2:00s	1:00	-
+Rule	ATAQ	1991	1999	-	Oct	Sun>=1	2:00s	1:00	-
+Rule	ATAQ	1991	2005	-	Mar	lastSun	2:00s	0	-
+Rule	ATAQ	2000	only	-	Aug	lastSun	2:00s	1:00	-
+Rule	ATAQ	2001	max	-	Oct	Sun>=1	2:00s	1:00	-
+Rule	ATAQ	2006	only	-	Apr	Sun>=1	2:00s	0	-
+Rule	ATAQ	2007	only	-	Mar	lastSun	2:00s	0	-
+Rule	ATAQ	2008	max	-	Apr	Sun>=1	2:00s	0	-
 
 # Argentina - year-round bases
 # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
@@ -98,20 +125,52 @@ Rule	ChileAQ	2000	max	-	Mar	Sun>=9	3:00u
 # http://www.timeanddate.com/news/time/antarctica-new-times.html
 # 
 
+# From Steffen Thorsen (2010-03-10):
+# We got these changes from the Australian Antarctic Division:
+# - Macquarie Island will stay on UTC+11 for winter and therefore not
+# switch back from daylight savings time when other parts of Australia do
+# on 4 April.
+#
+# - Casey station reverted to its normal time of UTC+8 on 5 March 2010.
+# The change to UTC+11 is being considered as a regular summer thing but
+# has not been decided yet.
+#
+# - Davis station will revert to its normal time of UTC+7 at 10 March 2010
+# 20:00 UTC.
+#
+# - Mawson station stays on UTC+5.
+#
+# In addition to the Rule changes for Casey/Davis, it means that Macquarie
+# will no longer be like Hobart and will have to have its own Zone created.
+#
+# Background:
+# 
+# http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
+# 
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Casey	0	-	zzz	1969
 			8:00	-	WST	2009 Oct 18 2:00
 						# Western (Aus) Standard Time
-			11:00	-	CAST	# Casey Time
+			11:00	-	CAST	2010 Mar 5 2:00
+						# Casey Time
+			8:00	-	WST
 Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
 			7:00	-	DAVT	1964 Nov # Davis Time
 			0	-	zzz	1969 Feb
 			7:00	-	DAVT	2009 Oct 18 2:00
-			5:00	-	DAVT
+			5:00	-	DAVT	2010 Mar 10 20:00u
+			7:00	-	DAVT
 Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
 			6:00	-	MAWT	2009 Oct 18 2:00
 						# Mawson Time
 			5:00	-	MAWT
+Zone Antarctica/Macquarie 0	-	zzz	1911
+			10:00	-	EST	1916 Oct 1 2:00
+			10:00	1:00	EST	1917 Feb
+			10:00	AusAQ	EST	1967
+			10:00	ATAQ	EST	2010 Apr 4 3:00
+			11:00	-	MIST	# Macquarie Island Time
 # References:
 # 
 # Casey Weather (1998-02-26)

Modified: stable/8/share/zoneinfo/asia
==============================================================================
--- stable/8/share/zoneinfo/asia	Mon Mar 22 21:27:51 2010	(r205475)
+++ stable/8/share/zoneinfo/asia	Mon Mar 22 21:35:54 2010	(r205476)
@@ -1,4 +1,4 @@
-# @(#)asia	8.55
+# @(#)asia	8.56
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -2438,9 +2438,18 @@ Rule	Syria	2007	only	-	Nov	 Fri>=1	0:00	
 # Thursday of the month or the start of the last Friday of the month or
 # something else. For now, use the start of the last Friday.
 
+# From Steffen Thorsen (2010-03-17):
+# The "Syrian News Station" reported on 2010-03-16 that the Council of
+# Ministers has decided that Syria will start DST on midnight Thursday
+# 2010-04-01: (midnight between Thursday and Friday):
+# 
+# http://sns.sy/sns/?path=news/read/11421 (Arabic)
+# 
+
 Rule	Syria	2008	only	-	Apr	Fri>=1	0:00	1:00	S
 Rule	Syria	2008	only	-	Nov	1	0:00	0	-
-Rule	Syria	2009	max	-	Mar	lastFri	0:00	1:00	S
+Rule	Syria	2009	only	-	Mar	lastFri	0:00	1:00	S
+Rule	Syria	2010	max	-	Apr	Fri>=1	0:00	1:00	S
 Rule	Syria	2009	max	-	Oct	lastFri	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]

Modified: stable/8/share/zoneinfo/australasia
==============================================================================
--- stable/8/share/zoneinfo/australasia	Mon Mar 22 21:27:51 2010	(r205475)
+++ stable/8/share/zoneinfo/australasia	Mon Mar 22 21:35:54 2010	(r205476)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.16
+# @(#)australasia	8.17
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -490,7 +490,7 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 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 Oct 24
+			-11:00	-	WST	2010 Sep 26
 			-11:00	1:00	WSDT	2011 Apr 3
 			-11:00	-	WST
 

Modified: stable/8/share/zoneinfo/zone.tab
==============================================================================
--- stable/8/share/zoneinfo/zone.tab	Mon Mar 22 21:27:51 2010	(r205475)
+++ stable/8/share/zoneinfo/zone.tab	Mon Mar 22 21:35:54 2010	(r205476)
@@ -1,5 +1,5 @@
 # 
-# @(#)zone.tab	8.33
+# @(#)zone.tab	8.34
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
@@ -44,6 +44,7 @@ AQ	-6617+11031	Antarctica/Casey	Casey St
 AQ	-7824+10654	Antarctica/Vostok	Vostok Station, S Magnetic Pole
 AQ	-6640+14001	Antarctica/DumontDUrville	Dumont-d'Urville Station, Terre Adelie
 AQ	-690022+0393524	Antarctica/Syowa	Syowa Station, E Ongul I
+AQ	-5430+15857	Antarctica/Macquarie	Macquarie Island Station, Macquarie Island
 AR	-3436-05827	America/Argentina/Buenos_Aires	Buenos Aires (BA, CF)
 AR	-3124-06411	America/Argentina/Cordoba	most locations (CB, CC, CN, ER, FM, MN, SE, SF)
 AR	-2447-06525	America/Argentina/Salta	(SA, LP, NQ, RN)

From owner-svn-src-stable-8@FreeBSD.ORG  Mon Mar 22 22:07:20 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 42857106566B;
	Mon, 22 Mar 2010 22:07:20 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 26B258FC16;
	Mon, 22 Mar 2010 22:07: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 o2MM7KE9054350;
	Mon, 22 Mar 2010 22:07:20 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MM7KKu054348;
	Mon, 22 Mar 2010 22:07:20 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <201003222207.o2MM7KKu054348@svn.freebsd.org>
From: Hiroki Sato 
Date: Mon, 22 Mar 2010 22:07: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: r205485 - stable/8/sys/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 22 Mar 2010 22:07:20 -0000

Author: hrs
Date: Mon Mar 22 22:07:19 2010
New Revision: 205485
URL: http://svn.freebsd.org/changeset/base/205485

Log:
  MFC r203272:
  
  - Fix a bug when adding an interface with an invalid MTU sets the
    bridge's MTU if it is the firstly-added one while the addition
    itself fails.
  
  - Allow SIOCSIFMTU only when all members have the same MTU.
  
  - Remove IFT_GIF check when defining the brige MTU by the
    firstly-added interface's one.  The MTU of the gif interface
    has to be the same as the bridge's one.

Modified:
  stable/8/sys/net/if_bridge.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/net/if_bridge.c
==============================================================================
--- stable/8/sys/net/if_bridge.c	Mon Mar 22 22:05:58 2010	(r205484)
+++ stable/8/sys/net/if_bridge.c	Mon Mar 22 22:07:19 2010	(r205485)
@@ -682,6 +682,8 @@ static int
 bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
 	struct bridge_softc *sc = ifp->if_softc;
+	struct ifreq *ifr = (struct ifreq *)data;
+	struct bridge_iflist *bif;
 	struct thread *td = curthread;
 	union {
 		struct ifbreq ifbreq;
@@ -771,10 +773,29 @@ bridge_ioctl(struct ifnet *ifp, u_long c
 		break;
 
 	case SIOCSIFMTU:
-		/* Do not allow the MTU to be changed on the bridge */
-		error = EINVAL;
+		if (ifr->ifr_mtu < 576) {
+			error = EINVAL;
+			break;
+		}
+		if (LIST_EMPTY(&sc->sc_iflist)) {
+			sc->sc_ifp->if_mtu = ifr->ifr_mtu;
+			break;
+		}
+		BRIDGE_LOCK(sc);
+		LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
+			if (bif->bif_ifp->if_mtu != ifr->ifr_mtu) {
+				log(LOG_NOTICE, "%s: invalid MTU: %lu(%s)"
+				    " != %d\n", sc->sc_ifp->if_xname,
+				    bif->bif_ifp->if_mtu,
+				    bif->bif_ifp->if_xname, ifr->ifr_mtu);
+				error = EINVAL;
+				break;
+			}
+		}
+		if (!error)
+			sc->sc_ifp->if_mtu = ifr->ifr_mtu;
+		BRIDGE_UNLOCK(sc);
 		break;
-
 	default:
 		/*
 		 * drop the lock as ether_ioctl() will call bridge_start() and
@@ -987,17 +1008,6 @@ bridge_ioctl_add(struct bridge_softc *sc
 		if (ifs == bif->bif_ifp)
 			return (EBUSY);
 
-	/* Allow the first Ethernet member to define the MTU */
-	if (ifs->if_type != IFT_GIF) {
-		if (LIST_EMPTY(&sc->sc_iflist))
-			sc->sc_ifp->if_mtu = ifs->if_mtu;
-		else if (sc->sc_ifp->if_mtu != ifs->if_mtu) {
-			if_printf(sc->sc_ifp, "invalid MTU for %s\n",
-			    ifs->if_xname);
-			return (EINVAL);
-		}
-	}
-
 	if (ifs->if_bridge == sc)
 		return (EEXIST);
 
@@ -1023,6 +1033,16 @@ bridge_ioctl_add(struct bridge_softc *sc
 		goto out;
 	}
 
+	/* Allow the first Ethernet member to define the MTU */
+	if (LIST_EMPTY(&sc->sc_iflist))
+		sc->sc_ifp->if_mtu = ifs->if_mtu;
+	else if (sc->sc_ifp->if_mtu != ifs->if_mtu) {
+		if_printf(sc->sc_ifp, "invalid MTU: %lu(%s) != %lu\n",
+		    ifs->if_mtu, ifs->if_xname, sc->sc_ifp->if_mtu);
+		error = EINVAL;
+		goto out;
+	}
+
 	/*
 	 * Assign the interface's MAC address to the bridge if it's the first
 	 * member and the MAC address of the bridge has not been changed from

From owner-svn-src-stable-8@FreeBSD.ORG  Mon Mar 22 23:23:48 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 245911065672;
	Mon, 22 Mar 2010 23:23: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 135C38FC0C;
	Mon, 22 Mar 2010 23:23: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 o2MNNlEZ071402;
	Mon, 22 Mar 2010 23:23:47 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MNNlBv071400;
	Mon, 22 Mar 2010 23:23:47 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003222323.o2MNNlBv071400@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 22 Mar 2010 23:23: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: r205490 - stable/8/sys/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 22 Mar 2010 23:23:48 -0000

Author: yongari
Date: Mon Mar 22 23:23:47 2010
New Revision: 205490
URL: http://svn.freebsd.org/changeset/base/205490

Log:
  MFC r204156:
    Add __FBSDID.

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

Modified: stable/8/sys/net/if_vlan.c
==============================================================================
--- stable/8/sys/net/if_vlan.c	Mon Mar 22 23:15:19 2010	(r205489)
+++ stable/8/sys/net/if_vlan.c	Mon Mar 22 23:23:47 2010	(r205490)
@@ -25,8 +25,6 @@
  * 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$
  */
 
 /*
@@ -41,6 +39,9 @@
  * and ask it to send them.
  */
 
+#include 
+__FBSDID("$FreeBSD$");
+
 #include "opt_vlan.h"
 
 #include 

From owner-svn-src-stable-8@FreeBSD.ORG  Mon Mar 22 23:33:41 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4A26F106566C;
	Mon, 22 Mar 2010 23:33:41 +0000 (UTC)
	(envelope-from qingli@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2DD618FC19;
	Mon, 22 Mar 2010 23:33: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 o2MNXfIP073723;
	Mon, 22 Mar 2010 23:33:41 GMT (envelope-from qingli@svn.freebsd.org)
Received: (from qingli@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2MNXfnD073721;
	Mon, 22 Mar 2010 23:33:41 GMT (envelope-from qingli@svn.freebsd.org)
Message-Id: <201003222333.o2MNXfnD073721@svn.freebsd.org>
From: Qing Li 
Date: Mon, 22 Mar 2010 23:33: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: r205493 - in stable/8/usr.sbin: . dumpcis makefs
	makefs/ffs mfiutil ppp
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 22 Mar 2010 23:33:41 -0000

Author: qingli
Date: Mon Mar 22 23:33:40 2010
New Revision: 205493
URL: http://svn.freebsd.org/changeset/base/205493

Log:
  MFC	r205272
  
  Need to set the proper flag bit when inserting ARP
  entries into the kernel.

Modified:
  stable/8/usr.sbin/ppp/arp.c
Directory Properties:
  stable/8/usr.sbin/   (props changed)
  stable/8/usr.sbin/Makefile   (props changed)
  stable/8/usr.sbin/acpi/   (props changed)
  stable/8/usr.sbin/arp/   (props changed)
  stable/8/usr.sbin/bsnmpd/   (props changed)
  stable/8/usr.sbin/burncd/   (props changed)
  stable/8/usr.sbin/cdcontrol/   (props changed)
  stable/8/usr.sbin/cpucontrol/   (props changed)
  stable/8/usr.sbin/crashinfo/   (props changed)
  stable/8/usr.sbin/cron/   (props changed)
  stable/8/usr.sbin/diskinfo/   (props changed)
  stable/8/usr.sbin/dumpcis/cardinfo.h   (props changed)
  stable/8/usr.sbin/dumpcis/cis.h   (props changed)
  stable/8/usr.sbin/faithd/   (props changed)
  stable/8/usr.sbin/freebsd-update/   (props changed)
  stable/8/usr.sbin/inetd/   (props changed)
  stable/8/usr.sbin/iostat/   (props changed)
  stable/8/usr.sbin/jail/   (props changed)
  stable/8/usr.sbin/jls/   (props changed)
  stable/8/usr.sbin/lpr/   (props changed)
  stable/8/usr.sbin/makefs/ffs/ffs_bswap.c   (props changed)
  stable/8/usr.sbin/makefs/ffs/ffs_subr.c   (props changed)
  stable/8/usr.sbin/makefs/ffs/ufs_bswap.h   (props changed)
  stable/8/usr.sbin/makefs/getid.c   (props changed)
  stable/8/usr.sbin/mergemaster/   (props changed)
  stable/8/usr.sbin/mfiutil/mfiutil.8   (props changed)
  stable/8/usr.sbin/mptutil/   (props changed)
  stable/8/usr.sbin/ndp/   (props changed)
  stable/8/usr.sbin/newsyslog/   (props changed)
  stable/8/usr.sbin/ntp/   (props changed)
  stable/8/usr.sbin/pmcstat/   (props changed)
  stable/8/usr.sbin/powerd/   (props changed)
  stable/8/usr.sbin/ppp/   (props changed)
  stable/8/usr.sbin/pstat/   (props changed)
  stable/8/usr.sbin/rpc.umntall/   (props changed)
  stable/8/usr.sbin/rtsold/   (props changed)
  stable/8/usr.sbin/service/   (props changed)
  stable/8/usr.sbin/sysinstall/   (props changed)
  stable/8/usr.sbin/syslogd/   (props changed)
  stable/8/usr.sbin/traceroute/   (props changed)
  stable/8/usr.sbin/traceroute6/   (props changed)
  stable/8/usr.sbin/usbconfig/   (props changed)
  stable/8/usr.sbin/wpa/   (props changed)
  stable/8/usr.sbin/ypserv/   (props changed)
  stable/8/usr.sbin/zic/   (props changed)

Modified: stable/8/usr.sbin/ppp/arp.c
==============================================================================
--- stable/8/usr.sbin/ppp/arp.c	Mon Mar 22 23:31:48 2010	(r205492)
+++ stable/8/usr.sbin/ppp/arp.c	Mon Mar 22 23:33:40 2010	(r205493)
@@ -119,7 +119,7 @@ arp_ProxySub(struct bundle *bundle, stru
     return 0;
   }
   arpmsg.hdr.rtm_type = add ? RTM_ADD : RTM_DELETE;
-  arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC;
+  arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC | RTF_LLDATA;
   arpmsg.hdr.rtm_version = RTM_VERSION;
   arpmsg.hdr.rtm_seq = ++bundle->routing_seq;
   arpmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 09:58:59 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C0B6C106566C;
	Tue, 23 Mar 2010 09:58:59 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ADCCC8FC18;
	Tue, 23 Mar 2010 09:58: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 o2N9wxHq037259;
	Tue, 23 Mar 2010 09:58:59 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2N9wxoL037254;
	Tue, 23 Mar 2010 09:58:59 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201003230958.o2N9wxoL037254@svn.freebsd.org>
From: Luigi Rizzo 
Date: Tue, 23 Mar 2010 09:58: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: r205511 - in stable/8: . contrib/top lib lib/libusb
	sbin/ipfw sys/conf sys/net sys/netgraph sys/netinet
	sys/netinet/ipfw sys/netinet/ipfw/test
	tools/regression/lib/msun tools/regression...
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 09:59:00 -0000

Author: luigi
Date: Tue Mar 23 09:58:59 2010
New Revision: 205511
URL: http://svn.freebsd.org/changeset/base/205511

Log:
  MFC of a large number of ipfw and dummynet fixes and enhancements
  done in CURRENT over the last 4 months.
  HEAD and RELENG_8 are almost in sync now for ipfw, dummynet
  the pfil hooks and related components.
  
  Among the most noticeable changes:
  - r200855 more efficient lookup of skipto rules, and remove O(N)
    blocks from critical sections in the kernel;
  - r204591 large restructuring of the dummynet module, with support
    for multiple scheduling algorithms (4 available so far)
  See the original commit logs for details.
  
  Changes in the kernel/userland ABI should be harmless because the
  kernel is able to understand previous requests from RELENG_8 and
  RELENG_7. For this reason, this changeset would be applicable
  to RELENG_7 as well, but i am not sure if it is worthwhile.

Added:
  stable/8/sys/netinet/ipfw/dn_heap.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_heap.c
  stable/8/sys/netinet/ipfw/dn_heap.h
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_heap.h
  stable/8/sys/netinet/ipfw/dn_sched.h
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_sched.h
  stable/8/sys/netinet/ipfw/dn_sched_fifo.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_sched_fifo.c
  stable/8/sys/netinet/ipfw/dn_sched_qfq.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_sched_qfq.c
  stable/8/sys/netinet/ipfw/dn_sched_rr.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_sched_rr.c
  stable/8/sys/netinet/ipfw/dn_sched_wf2q.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/dn_sched_wf2q.c
  stable/8/sys/netinet/ipfw/dummynet.txt
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/dummynet.txt
  stable/8/sys/netinet/ipfw/ip_dn_glue.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_dn_glue.c
  stable/8/sys/netinet/ipfw/ip_dn_io.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_dn_io.c
  stable/8/sys/netinet/ipfw/ip_dn_private.h
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_dn_private.h
  stable/8/sys/netinet/ipfw/ip_fw_dynamic.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_dynamic.c
  stable/8/sys/netinet/ipfw/ip_fw_log.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_log.c
  stable/8/sys/netinet/ipfw/ip_fw_private.h
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_private.h
  stable/8/sys/netinet/ipfw/ip_fw_sockopt.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_sockopt.c
  stable/8/sys/netinet/ipfw/ip_fw_table.c
     - copied unchanged from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/ip_fw_table.c
  stable/8/sys/netinet/ipfw/test/
     - copied from r205419, user/luigi/ipfw3-r8/sys/netinet/ipfw/test/
Modified:
  stable/8/sbin/ipfw/Makefile
  stable/8/sbin/ipfw/altq.c
  stable/8/sbin/ipfw/dummynet.c
  stable/8/sbin/ipfw/ipfw.8
  stable/8/sbin/ipfw/ipfw2.c
  stable/8/sbin/ipfw/ipfw2.h
  stable/8/sbin/ipfw/main.c
  stable/8/sys/conf/files
  stable/8/sys/net/if_bridge.c
  stable/8/sys/net/if_ethersubr.c
  stable/8/sys/net/radix.c
  stable/8/sys/net/radix.h
  stable/8/sys/net/route.c
  stable/8/sys/netgraph/ng_ipfw.c
  stable/8/sys/netgraph/ng_ipfw.h
  stable/8/sys/netinet/in.h
  stable/8/sys/netinet/ip_divert.c
  stable/8/sys/netinet/ip_divert.h
  stable/8/sys/netinet/ip_dummynet.h
  stable/8/sys/netinet/ip_fw.h
  stable/8/sys/netinet/ip_var.h
  stable/8/sys/netinet/ipfw/ip_dummynet.c
  stable/8/sys/netinet/ipfw/ip_fw2.c
  stable/8/sys/netinet/ipfw/ip_fw_nat.c
  stable/8/sys/netinet/ipfw/ip_fw_pfil.c
  stable/8/sys/netinet/raw_ip.c
Directory Properties:
  stable/8/   (props changed)
  stable/8/Makefile.inc1   (props changed)
  stable/8/ObsoleteFiles.inc   (props changed)
  stable/8/UPDATING   (props changed)
  stable/8/bin/   (props changed)
  stable/8/bin/chmod/   (props changed)
  stable/8/bin/cp/   (props changed)
  stable/8/bin/csh/   (props changed)
  stable/8/bin/getfacl/   (props changed)
  stable/8/bin/kill/   (props changed)
  stable/8/bin/ls/   (props changed)
  stable/8/bin/mv/   (props changed)
  stable/8/bin/pax/   (props changed)
  stable/8/bin/pkill/   (props changed)
  stable/8/bin/ps/   (props changed)
  stable/8/bin/setfacl/   (props changed)
  stable/8/bin/sh/   (props changed)
  stable/8/cddl/compat/opensolaris/   (props changed)
  stable/8/cddl/contrib/opensolaris/   (props changed)
  stable/8/cddl/contrib/opensolaris/cmd/zdb/   (props changed)
  stable/8/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  stable/8/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  stable/8/cddl/lib/libnvpair/   (props changed)
  stable/8/contrib/bind9/   (props changed)
  stable/8/contrib/bsnmp/   (props changed)
  stable/8/contrib/bzip2/   (props changed)
  stable/8/contrib/cpio/   (props changed)
  stable/8/contrib/csup/   (props changed)
  stable/8/contrib/ee/   (props changed)
  stable/8/contrib/expat/   (props changed)
  stable/8/contrib/file/   (props changed)
  stable/8/contrib/gcc/   (props changed)
  stable/8/contrib/gdb/   (props changed)
  stable/8/contrib/gdtoa/   (props changed)
  stable/8/contrib/groff/   (props changed)
  stable/8/contrib/less/   (props changed)
  stable/8/contrib/libpcap/   (props changed)
  stable/8/contrib/ncurses/   (props changed)
  stable/8/contrib/netcat/   (props changed)
  stable/8/contrib/ntp/   (props changed)
  stable/8/contrib/one-true-awk/   (props changed)
  stable/8/contrib/openbsm/   (props changed)
  stable/8/contrib/openpam/   (props changed)
  stable/8/contrib/pf/   (props changed)
  stable/8/contrib/sendmail/   (props changed)
  stable/8/contrib/tcpdump/   (props changed)
  stable/8/contrib/tcsh/   (props changed)
  stable/8/contrib/top/   (props changed)
  stable/8/contrib/top/install-sh   (props changed)
  stable/8/contrib/traceroute/   (props changed)
  stable/8/contrib/wpa/   (props changed)
  stable/8/crypto/heimdal/   (props changed)
  stable/8/crypto/openssh/   (props changed)
  stable/8/crypto/openssl/   (props changed)
  stable/8/etc/   (props changed)
  stable/8/games/factor/   (props changed)
  stable/8/games/fortune/   (props changed)
  stable/8/games/fortune/datfiles/   (props changed)
  stable/8/games/grdc/   (props changed)
  stable/8/gnu/usr.bin/gdb/kgdb/   (props changed)
  stable/8/gnu/usr.bin/groff/   (props changed)
  stable/8/gnu/usr.bin/patch/   (props changed)
  stable/8/include/   (props changed)
  stable/8/kerberos5/lib/libgssapi_krb5/   (props changed)
  stable/8/kerberos5/lib/libgssapi_spnego/   (props changed)
  stable/8/kerberos5/usr.bin/kdestroy/   (props changed)
  stable/8/kerberos5/usr.bin/kpasswd/   (props changed)
  stable/8/lib/Makefile   (props changed)
  stable/8/lib/bind/   (props changed)
  stable/8/lib/csu/   (props changed)
  stable/8/lib/libarchive/   (props changed)
  stable/8/lib/libbluetooth/   (props changed)
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc_r/   (props changed)
  stable/8/lib/libdevinfo/   (props changed)
  stable/8/lib/libdisk/   (props changed)
  stable/8/lib/libelf/   (props changed)
  stable/8/lib/libexpat/   (props changed)
  stable/8/lib/libfetch/   (props changed)
  stable/8/lib/libgpib/   (props changed)
  stable/8/lib/libgssapi/   (props changed)
  stable/8/lib/libjail/   (props changed)
  stable/8/lib/libkse/   (props changed)
  stable/8/lib/libkvm/   (props changed)
  stable/8/lib/libpmc/   (props changed)
  stable/8/lib/libradius/   (props changed)
  stable/8/lib/librpcsec_gss/   (props changed)
  stable/8/lib/libsm/   (props changed)
  stable/8/lib/libstand/   (props changed)
  stable/8/lib/libtacplus/   (props changed)
  stable/8/lib/libthr/   (props changed)
  stable/8/lib/libufs/   (props changed)
  stable/8/lib/libusb/   (props changed)
  stable/8/lib/libusb/usb.h   (props changed)
  stable/8/lib/libutil/   (props changed)
  stable/8/lib/msun/   (props changed)
  stable/8/libexec/rtld-elf/   (props changed)
  stable/8/release/   (props changed)
  stable/8/release/picobsd/   (props changed)
  stable/8/release/picobsd/floppy.tree/sbin/   (props changed)
  stable/8/release/picobsd/qemu/   (props changed)
  stable/8/sbin/   (props changed)
  stable/8/sbin/atacontrol/   (props changed)
  stable/8/sbin/bsdlabel/   (props changed)
  stable/8/sbin/camcontrol/   (props changed)
  stable/8/sbin/ddb/   (props changed)
  stable/8/sbin/devfs/   (props changed)
  stable/8/sbin/dhclient/   (props changed)
  stable/8/sbin/dump/   (props changed)
  stable/8/sbin/dumpfs/   (props changed)
  stable/8/sbin/fsck/   (props changed)
  stable/8/sbin/fsck_ffs/   (props changed)
  stable/8/sbin/geom/   (props changed)
  stable/8/sbin/geom/class/stripe/   (props changed)
  stable/8/sbin/ggate/   (props changed)
  stable/8/sbin/growfs/   (props changed)
  stable/8/sbin/ifconfig/   (props changed)
  stable/8/sbin/ipfw/   (props changed)
  stable/8/sbin/iscontrol/   (props changed)
  stable/8/sbin/mdconfig/   (props changed)
  stable/8/sbin/mksnap_ffs/   (props changed)
  stable/8/sbin/mount/   (props changed)
  stable/8/sbin/mount_cd9660/   (props changed)
  stable/8/sbin/mount_msdosfs/   (props changed)
  stable/8/sbin/mount_nfs/   (props changed)
  stable/8/sbin/natd/   (props changed)
  stable/8/sbin/newfs/   (props changed)
  stable/8/sbin/restore/   (props changed)
  stable/8/sbin/routed/   (props changed)
  stable/8/sbin/sysctl/   (props changed)
  stable/8/sbin/tunefs/   (props changed)
  stable/8/sbin/umount/   (props changed)
  stable/8/secure/usr.bin/bdes/   (props changed)
  stable/8/share/examples/   (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/share/misc/   (props changed)
  stable/8/share/mk/   (props changed)
  stable/8/share/timedef/   (props changed)
  stable/8/share/zoneinfo/   (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)
  stable/8/sys/net/   (props changed)
  stable/8/sys/netinet/ipfw/   (props changed)
  stable/8/tools/   (props changed)
  stable/8/tools/kerneldoc/subsys/   (props changed)
  stable/8/tools/regression/acltools/   (props changed)
  stable/8/tools/regression/aio/aiotest/   (props changed)
  stable/8/tools/regression/bin/sh/   (props changed)
  stable/8/tools/regression/fifo/   (props changed)
  stable/8/tools/regression/geom/   (props changed)
  stable/8/tools/regression/lib/libc/   (props changed)
  stable/8/tools/regression/lib/msun/test-conj.t   (props changed)
  stable/8/tools/regression/mqueue/mqtest1/   (props changed)
  stable/8/tools/regression/mqueue/mqtest2/   (props changed)
  stable/8/tools/regression/mqueue/mqtest3/   (props changed)
  stable/8/tools/regression/mqueue/mqtest4/   (props changed)
  stable/8/tools/regression/mqueue/mqtest5/   (props changed)
  stable/8/tools/regression/poll/   (props changed)
  stable/8/tools/regression/posixsem/   (props changed)
  stable/8/tools/regression/priv/   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pgrep-_s.t   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pkill-_g.t   (props changed)
  stable/8/tools/tools/ath/   (props changed)
  stable/8/tools/tools/ath/common/dumpregs.h   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5210.c   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5211.c   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5212.c   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5416.c   (props changed)
  stable/8/tools/tools/termcap/termcap.pl   (props changed)
  stable/8/tools/tools/vimage/   (props changed)
  stable/8/usr.bin/awk/   (props changed)
  stable/8/usr.bin/calendar/   (props changed)
  stable/8/usr.bin/catman/   (props changed)
  stable/8/usr.bin/comm/   (props changed)
  stable/8/usr.bin/csup/   (props changed)
  stable/8/usr.bin/fetch/   (props changed)
  stable/8/usr.bin/find/   (props changed)
  stable/8/usr.bin/finger/   (props changed)
  stable/8/usr.bin/fstat/   (props changed)
  stable/8/usr.bin/gcore/   (props changed)
  stable/8/usr.bin/gzip/   (props changed)
  stable/8/usr.bin/hexdump/   (props changed)
  stable/8/usr.bin/kdump/   (props changed)
  stable/8/usr.bin/locale/   (props changed)
  stable/8/usr.bin/look/   (props changed)
  stable/8/usr.bin/makewhatis/   (props changed)
  stable/8/usr.bin/netstat/   (props changed)
  stable/8/usr.bin/perror/   (props changed)
  stable/8/usr.bin/procstat/   (props changed)
  stable/8/usr.bin/systat/   (props changed)
  stable/8/usr.bin/tftp/   (props changed)
  stable/8/usr.bin/truss/   (props changed)
  stable/8/usr.bin/unifdef/   (props changed)
  stable/8/usr.bin/uniq/   (props changed)
  stable/8/usr.bin/vmstat/   (props changed)
  stable/8/usr.bin/w/   (props changed)
  stable/8/usr.bin/whois/   (props changed)
  stable/8/usr.bin/xlint/   (props changed)
  stable/8/usr.sbin/   (props changed)
  stable/8/usr.sbin/Makefile   (props changed)
  stable/8/usr.sbin/acpi/   (props changed)
  stable/8/usr.sbin/arp/   (props changed)
  stable/8/usr.sbin/bsnmpd/   (props changed)
  stable/8/usr.sbin/burncd/   (props changed)
  stable/8/usr.sbin/cdcontrol/   (props changed)
  stable/8/usr.sbin/cpucontrol/   (props changed)
  stable/8/usr.sbin/crashinfo/   (props changed)
  stable/8/usr.sbin/cron/   (props changed)
  stable/8/usr.sbin/diskinfo/   (props changed)
  stable/8/usr.sbin/dumpcis/cardinfo.h   (props changed)
  stable/8/usr.sbin/dumpcis/cis.h   (props changed)
  stable/8/usr.sbin/faithd/   (props changed)
  stable/8/usr.sbin/freebsd-update/   (props changed)
  stable/8/usr.sbin/inetd/   (props changed)
  stable/8/usr.sbin/iostat/   (props changed)
  stable/8/usr.sbin/jail/   (props changed)
  stable/8/usr.sbin/jls/   (props changed)
  stable/8/usr.sbin/lpr/   (props changed)
  stable/8/usr.sbin/makefs/ffs/ffs_bswap.c   (props changed)
  stable/8/usr.sbin/makefs/ffs/ffs_subr.c   (props changed)
  stable/8/usr.sbin/makefs/ffs/ufs_bswap.h   (props changed)
  stable/8/usr.sbin/makefs/getid.c   (props changed)
  stable/8/usr.sbin/mergemaster/   (props changed)
  stable/8/usr.sbin/mfiutil/mfiutil.8   (props changed)
  stable/8/usr.sbin/mptutil/   (props changed)
  stable/8/usr.sbin/ndp/   (props changed)
  stable/8/usr.sbin/newsyslog/   (props changed)
  stable/8/usr.sbin/ntp/   (props changed)
  stable/8/usr.sbin/pmcstat/   (props changed)
  stable/8/usr.sbin/powerd/   (props changed)
  stable/8/usr.sbin/ppp/   (props changed)
  stable/8/usr.sbin/pstat/   (props changed)
  stable/8/usr.sbin/rpc.umntall/   (props changed)
  stable/8/usr.sbin/rtsold/   (props changed)
  stable/8/usr.sbin/service/   (props changed)
  stable/8/usr.sbin/sysinstall/   (props changed)
  stable/8/usr.sbin/syslogd/   (props changed)
  stable/8/usr.sbin/traceroute/   (props changed)
  stable/8/usr.sbin/traceroute6/   (props changed)
  stable/8/usr.sbin/usbconfig/   (props changed)
  stable/8/usr.sbin/wpa/   (props changed)
  stable/8/usr.sbin/ypserv/   (props changed)
  stable/8/usr.sbin/zic/   (props changed)

Modified: stable/8/sbin/ipfw/Makefile
==============================================================================
--- stable/8/sbin/ipfw/Makefile	Tue Mar 23 06:42:52 2010	(r205510)
+++ stable/8/sbin/ipfw/Makefile	Tue Mar 23 09:58:59 2010	(r205511)
@@ -3,6 +3,7 @@
 PROG=	ipfw
 SRCS=	ipfw2.c dummynet.c ipv6.c main.c nat.c altq.c
 WARNS?=	2
+DPADD=	${LIBUTIL}
 LDADD=	-lutil
 MAN=	ipfw.8
 

Modified: stable/8/sbin/ipfw/altq.c
==============================================================================
--- stable/8/sbin/ipfw/altq.c	Tue Mar 23 06:42:52 2010	(r205510)
+++ stable/8/sbin/ipfw/altq.c	Tue Mar 23 09:58:59 2010	(r205511)
@@ -39,6 +39,7 @@
 
 #include 		/* IFNAMSIZ */
 #include 
+#include 	/* in_addr */
 #include 
 
 /*

Modified: stable/8/sbin/ipfw/dummynet.c
==============================================================================
--- stable/8/sbin/ipfw/dummynet.c	Tue Mar 23 06:42:52 2010	(r205510)
+++ stable/8/sbin/ipfw/dummynet.c	Tue Mar 23 09:58:59 2010	(r205511)
@@ -1,10 +1,5 @@
 /*
- * Copyright (c) 2002-2003 Luigi Rizzo
- * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp
- * Copyright (c) 1994 Ugen J.S.Antsilevich
- *
- * Idea and grammar partially left from:
- * Copyright (c) 1993 Daniel Boulet
+ * Copyright (c) 2002-2003,2010 Luigi Rizzo
  *
  * Redistribution and use in source forms, with and without modification,
  * are permitted provided that this entire comment appears intact.
@@ -15,8 +10,6 @@
  *
  * This software is provided ``AS IS'' without any warranties of any kind.
  *
- * NEW command line interface for IP firewall facility
- *
  * $FreeBSD$
  *
  * dummynet support
@@ -24,7 +17,6 @@
 
 #include 
 #include 
-#include 
 /* XXX there are several sysctl leftover here */
 #include 
 
@@ -46,6 +38,7 @@
 #include 
 #include 	/* inet_ntoa */
 
+
 static struct _s_x dummynet_params[] = {
 	{ "plr",		TOK_PLR },
 	{ "noerror",		TOK_NOERROR },
@@ -56,27 +49,59 @@ static struct _s_x dummynet_params[] = {
 	{ "src-port",		TOK_SRCPORT },
 	{ "proto",		TOK_PROTO },
 	{ "weight",		TOK_WEIGHT },
+	{ "lmax",		TOK_LMAX },
+	{ "maxlen",		TOK_LMAX },
 	{ "all",		TOK_ALL },
-	{ "mask",		TOK_MASK },
+	{ "mask",		TOK_MASK }, /* alias for both */
+	{ "sched_mask",		TOK_SCHED_MASK },
+	{ "flow_mask",		TOK_FLOW_MASK },
 	{ "droptail",		TOK_DROPTAIL },
 	{ "red",		TOK_RED },
 	{ "gred",		TOK_GRED },
 	{ "bw",			TOK_BW },
 	{ "bandwidth",		TOK_BW },
 	{ "delay",		TOK_DELAY },
+	{ "link",		TOK_LINK },
 	{ "pipe",		TOK_PIPE },
 	{ "queue",		TOK_QUEUE },
+	{ "flowset",		TOK_FLOWSET },
+	{ "sched",		TOK_SCHED },
+	{ "pri",		TOK_PRI },
+	{ "priority",		TOK_PRI },
+	{ "type",		TOK_TYPE },
 	{ "flow-id",		TOK_FLOWID},
 	{ "dst-ipv6",		TOK_DSTIP6},
 	{ "dst-ip6",		TOK_DSTIP6},
 	{ "src-ipv6",		TOK_SRCIP6},
 	{ "src-ip6",		TOK_SRCIP6},
-	{ "profile",		TOK_PIPE_PROFILE},
+	{ "profile",		TOK_PROFILE},
 	{ "burst",		TOK_BURST},
 	{ "dummynet-params",	TOK_NULL },
 	{ NULL, 0 }	/* terminator */
 };
 
+#define O_NEXT(p, len) ((void *)((char *)p + len))
+
+static void
+oid_fill(struct dn_id *oid, int len, int type, uintptr_t id)
+{
+	oid->len = len;
+	oid->type = type;
+	oid->subtype = 0;
+	oid->id = id;
+}
+
+/* make room in the buffer and move the pointer forward */
+static void *
+o_next(struct dn_id **o, int len, int type)
+{
+	struct dn_id *ret = *o;
+	oid_fill(ret, len, type, 0);
+	*o = O_NEXT(*o, len);
+	return ret;
+}
+
+#if 0
 static int
 sort_q(void *arg, const void *pa, const void *pb)
 {
@@ -108,117 +133,84 @@ sort_q(void *arg, const void *pa, const 
 		res = 1;
 	return (int)(rev ? res : -res);
 }
+#endif
 
+/* print a mask and header for the subsequent list of flows */
 static void
-list_queues(struct dn_flow_set *fs, struct dn_flow_queue *q)
+print_mask(struct ipfw_flow_id *id)
+{
+	if (!IS_IP6_FLOW_ID(id)) {
+		printf("    "
+		    "mask: %s 0x%02x 0x%08x/0x%04x -> 0x%08x/0x%04x\n",
+		    id->extra ? "queue," : "",
+		    id->proto,
+		    id->src_ip, id->src_port,
+		    id->dst_ip, id->dst_port);
+
+		printf("BKT Prot ___Source IP/port____ "
+		    "____Dest. IP/port____ "
+		    "Tot_pkt/bytes Pkt/Byte Drp\n");
+	} else {
+		char buf[255];
+		printf("\n        mask: %sproto: 0x%02x, flow_id: 0x%08x,  ",
+		    id->extra ? "queue," : "",
+		    id->proto, id->flow_id6);
+		inet_ntop(AF_INET6, &(id->src_ip6), buf, sizeof(buf));
+		printf("%s/0x%04x -> ", buf, id->src_port);
+		inet_ntop(AF_INET6, &(id->dst_ip6), buf, sizeof(buf));
+		printf("%s/0x%04x\n", buf, id->dst_port);
+
+		printf("BKT ___Prot___ _flow-id_ "
+		    "______________Source IPv6/port_______________ "
+		    "_______________Dest. IPv6/port_______________ "
+		    "Tot_pkt/bytes Pkt/Byte Drp\n");
+	}
+}
+
+static void
+list_flow(struct dn_flow *ni)
 {
-	int l;
-	int index_printed, indexes = 0;
 	char buff[255];
 	struct protoent *pe;
+	struct in_addr ina;
+	struct ipfw_flow_id *id = &ni->fid;
 
-	if (fs->rq_elements == 0)
-		return;
-
-	if (co.do_sort != 0)
-		qsort_r(q, fs->rq_elements, sizeof *q, NULL, sort_q);
-
-	/* Print IPv4 flows */
-	index_printed = 0;
-	for (l = 0; l < fs->rq_elements; l++) {
-		struct in_addr ina;
-
+	pe = getprotobynumber(id->proto);
 		/* XXX: Should check for IPv4 flows */
-		if (IS_IP6_FLOW_ID(&(q[l].id)))
-			continue;
-
-		if (!index_printed) {
-			index_printed = 1;
-			if (indexes > 0)	/* currently a no-op */
-				printf("\n");
-			indexes++;
-			printf("    "
-			    "mask: 0x%02x 0x%08x/0x%04x -> 0x%08x/0x%04x\n",
-			    fs->flow_mask.proto,
-			    fs->flow_mask.src_ip, fs->flow_mask.src_port,
-			    fs->flow_mask.dst_ip, fs->flow_mask.dst_port);
-
-			printf("BKT Prot ___Source IP/port____ "
-			    "____Dest. IP/port____ "
-			    "Tot_pkt/bytes Pkt/Byte Drp\n");
-		}
-
-		printf("%3d ", q[l].hash_slot);
-		pe = getprotobynumber(q[l].id.proto);
+	printf("%3u%c", (ni->oid.id) & 0xff,
+		id->extra ? '*' : ' ');
+	if (!IS_IP6_FLOW_ID(id)) {
 		if (pe)
 			printf("%-4s ", pe->p_name);
 		else
-			printf("%4u ", q[l].id.proto);
-		ina.s_addr = htonl(q[l].id.src_ip);
+			printf("%4u ", id->proto);
+		ina.s_addr = htonl(id->src_ip);
 		printf("%15s/%-5d ",
-		    inet_ntoa(ina), q[l].id.src_port);
-		ina.s_addr = htonl(q[l].id.dst_ip);
+		    inet_ntoa(ina), id->src_port);
+		ina.s_addr = htonl(id->dst_ip);
 		printf("%15s/%-5d ",
-		    inet_ntoa(ina), q[l].id.dst_port);
-		printf("%4llu %8llu %2u %4u %3u\n",
-		    align_uint64(&q[l].tot_pkts),
-		    align_uint64(&q[l].tot_bytes),
-		    q[l].len, q[l].len_bytes, q[l].drops);
-		if (co.verbose)
-			printf("   S %20llu  F %20llu\n",
-			    align_uint64(&q[l].S), align_uint64(&q[l].F));
-	}
-
-	/* Print IPv6 flows */
-	index_printed = 0;
-	for (l = 0; l < fs->rq_elements; l++) {
-		if (!IS_IP6_FLOW_ID(&(q[l].id)))
-			continue;
-
-		if (!index_printed) {
-			index_printed = 1;
-			if (indexes > 0)
-				printf("\n");
-			indexes++;
-			printf("\n        mask: proto: 0x%02x, flow_id: 0x%08x,  ",
-			    fs->flow_mask.proto, fs->flow_mask.flow_id6);
-			inet_ntop(AF_INET6, &(fs->flow_mask.src_ip6),
-			    buff, sizeof(buff));
-			printf("%s/0x%04x -> ", buff, fs->flow_mask.src_port);
-			inet_ntop( AF_INET6, &(fs->flow_mask.dst_ip6),
-			    buff, sizeof(buff) );
-			printf("%s/0x%04x\n", buff, fs->flow_mask.dst_port);
-
-			printf("BKT ___Prot___ _flow-id_ "
-			    "______________Source IPv6/port_______________ "
-			    "_______________Dest. IPv6/port_______________ "
-			    "Tot_pkt/bytes Pkt/Byte Drp\n");
-		}
-		printf("%3d ", q[l].hash_slot);
-		pe = getprotobynumber(q[l].id.proto);
+		    inet_ntoa(ina), id->dst_port);
+	} else {
+		/* Print IPv6 flows */
 		if (pe != NULL)
 			printf("%9s ", pe->p_name);
 		else
-			printf("%9u ", q[l].id.proto);
-		printf("%7d  %39s/%-5d ", q[l].id.flow_id6,
-		    inet_ntop(AF_INET6, &(q[l].id.src_ip6), buff, sizeof(buff)),
-		    q[l].id.src_port);
+			printf("%9u ", id->proto);
+		printf("%7d  %39s/%-5d ", id->flow_id6,
+		    inet_ntop(AF_INET6, &(id->src_ip6), buff, sizeof(buff)),
+		    id->src_port);
 		printf(" %39s/%-5d ",
-		    inet_ntop(AF_INET6, &(q[l].id.dst_ip6), buff, sizeof(buff)),
-		    q[l].id.dst_port);
-		printf(" %4llu %8llu %2u %4u %3u\n",
-		    align_uint64(&q[l].tot_pkts),
-		    align_uint64(&q[l].tot_bytes),
-		    q[l].len, q[l].len_bytes, q[l].drops);
-		if (co.verbose)
-			printf("   S %20llu  F %20llu\n",
-			    align_uint64(&q[l].S),
-			    align_uint64(&q[l].F));
+		    inet_ntop(AF_INET6, &(id->dst_ip6), buff, sizeof(buff)),
+		    id->dst_port);
 	}
+	printf("%4llu %8llu %2u %4u %3u\n",
+	    align_uint64(&ni->tot_pkts),
+	    align_uint64(&ni->tot_bytes),
+	    ni->length, ni->len_bytes, ni->drops);
 }
 
 static void
-print_flowset_parms(struct dn_flow_set *fs, char *prefix)
+print_flowset_parms(struct dn_fs *fs, char *prefix)
 {
 	int l;
 	char qs[30];
@@ -226,7 +218,7 @@ print_flowset_parms(struct dn_flow_set *
 	char red[90];	/* Display RED parameters */
 
 	l = fs->qsize;
-	if (fs->flags_fs & DN_QSIZE_IS_BYTES) {
+	if (fs->flags & DN_QSIZE_BYTES) {
 		if (l >= 8192)
 			sprintf(qs, "%d KB", l / 1024);
 		else
@@ -237,23 +229,34 @@ print_flowset_parms(struct dn_flow_set *
 		sprintf(plr, "plr %f", 1.0 * fs->plr / (double)(0x7fffffff));
 	else
 		plr[0] = '\0';
-	if (fs->flags_fs & DN_IS_RED)	/* RED parameters */
+
+	if (fs->flags & DN_IS_RED)	/* RED parameters */
 		sprintf(red,
 		    "\n\t %cRED w_q %f min_th %d max_th %d max_p %f",
-		    (fs->flags_fs & DN_IS_GENTLE_RED) ? 'G' : ' ',
+		    (fs->flags & DN_IS_GENTLE_RED) ? 'G' : ' ',
 		    1.0 * fs->w_q / (double)(1 << SCALE_RED),
-		    SCALE_VAL(fs->min_th),
-		    SCALE_VAL(fs->max_th),
+		    fs->min_th,
+		    fs->max_th,
 		    1.0 * fs->max_p / (double)(1 << SCALE_RED));
 	else
 		sprintf(red, "droptail");
 
-	printf("%s %s%s %d queues (%d buckets) %s\n",
-	    prefix, qs, plr, fs->rq_elements, fs->rq_size, red);
+	if (prefix[0]) {
+	    printf("%s %s%s %d queues (%d buckets) %s\n",
+		prefix, qs, plr, fs->oid.id, fs->buckets, red);
+	    prefix[0] = '\0';
+	} else {
+	    printf("q%05d %s%s %d flows (%d buckets) sched %d "
+			"weight %d lmax %d pri %d %s\n",
+		fs->fs_nr, qs, plr, fs->oid.id, fs->buckets,
+		fs->sched_nr, fs->par[0], fs->par[1], fs->par[2], red);
+	    if (fs->flags & DN_HAVE_MASK)
+		print_mask(&fs->flow_mask);
+	}
 }
 
 static void
-print_extra_delay_parms(struct dn_pipe *p)
+print_extra_delay_parms(struct dn_profile *p)
 {
 	double loss;
 	if (p->samples_no <= 0)
@@ -265,105 +268,126 @@ print_extra_delay_parms(struct dn_pipe *
 		p->name, loss, p->samples_no);
 }
 
-void
-ipfw_list_pipes(void *data, uint nbytes, int ac, char *av[])
+static void
+flush_buf(char *buf)
 {
-	int rulenum;
-	void *next = data;
-	struct dn_pipe *p = (struct dn_pipe *) data;
-	struct dn_flow_set *fs;
-	struct dn_flow_queue *q;
-	int l;
-
-	if (ac > 0)
-		rulenum = strtoul(*av++, NULL, 10);
-	else
-		rulenum = 0;
-	for (; nbytes >= sizeof *p; p = (struct dn_pipe *)next) {
-		double b = p->bandwidth;
-		char buf[30];
-		char prefix[80];
-		char burst[5 + 7];
-
-		if (SLIST_NEXT(p, next) != (struct dn_pipe *)DN_IS_PIPE)
-			break;	/* done with pipes, now queues */
-
-		/*
-		 * compute length, as pipe have variable size
-		 */
-		l = sizeof(*p) + p->fs.rq_elements * sizeof(*q);
-		next = (char *)p + l;
-		nbytes -= l;
-
-		if ((rulenum != 0 && rulenum != p->pipe_nr) || co.do_pipe == 2)
-			continue;
-
-		/*
-		 * Print rate (or clocking interface)
-		 */
-		if (p->if_name[0] != '\0')
-			sprintf(buf, "%s", p->if_name);
-		else if (b == 0)
-			sprintf(buf, "unlimited");
-		else if (b >= 1000000)
-			sprintf(buf, "%7.3f Mbit/s", b/1000000);
-		else if (b >= 1000)
-			sprintf(buf, "%7.3f Kbit/s", b/1000);
-		else
-			sprintf(buf, "%7.3f bit/s ", b);
-
-		sprintf(prefix, "%05d: %s %4d ms ",
-		    p->pipe_nr, buf, p->delay);
-
-		print_flowset_parms(&(p->fs), prefix);
-
-		if (humanize_number(burst, sizeof(burst), p->burst,
-		    "Byte", HN_AUTOSCALE, 0) < 0 || co.verbose)
-			printf("\t burst: %ju Byte\n", p->burst);
-		else
-			printf("\t burst: %s\n", burst);
-
-		print_extra_delay_parms(p);
-
-		q = (struct dn_flow_queue *)(p+1);
-		list_queues(&(p->fs), q);
-	}
-	for (fs = next; nbytes >= sizeof *fs; fs = next) {
-		char prefix[80];
+	if (buf[0])
+		printf("%s\n", buf);
+	buf[0] = '\0';
+}
+	
+/*
+ * generic list routine. We expect objects in a specific order, i.e.
+ * PIPES AND SCHEDULERS:
+ *	link; scheduler; internal flowset if any; instances
+ * we can tell a pipe from the number.
+ *
+ * FLOWSETS:
+ *	flowset; queues;
+ * link i (int queue); scheduler i; si(i) { flowsets() : queues }
+ */
+static void
+list_pipes(struct dn_id *oid, struct dn_id *end)
+{
+    char buf[160];	/* pending buffer */
+    buf[0] = '\0';
 
-		if (SLIST_NEXT(fs, next) != (struct dn_flow_set *)DN_IS_QUEUE)
-			break;
-		l = sizeof(*fs) + fs->rq_elements * sizeof(*q);
-		next = (char *)fs + l;
-		nbytes -= l;
+    for (; oid != end; oid = O_NEXT(oid, oid->len)) {
+	if (oid->len < sizeof(*oid))
+		errx(1, "invalid oid len %d\n", oid->len);
+
+	switch (oid->type) {
+	default:
+	    flush_buf(buf);
+	    printf("unrecognized object %d size %d\n", oid->type, oid->len);
+	    break;
+	case DN_TEXT: /* list of attached flowsets */
+	    {
+		int i, l;
+		struct {
+			struct dn_id id;
+			uint32_t p[0];
+		} *d = (void *)oid;
+		l = (oid->len - sizeof(*oid))/sizeof(d->p[0]);
+		if (l == 0)
+		    break;
+		printf("   Children flowsets: ");
+		for (i = 0; i < l; i++)
+			printf("%u ", d->p[i]);
+		printf("\n");
+		break;
+	    }
+	case DN_CMD_GET:
+	    if (co.verbose)
+		printf("answer for cmd %d, len %d\n", oid->type, oid->id);
+	    break;
+	case DN_SCH: {
+	    struct dn_sch *s = (struct dn_sch *)oid;
+	    flush_buf(buf);
+	    printf(" sched %d type %s flags 0x%x %d buckets %d active\n",
+			s->sched_nr,
+			s->name, s->flags, s->buckets, s->oid.id);
+	    if (s->flags & DN_HAVE_MASK)
+		print_mask(&s->sched_mask);
+	    }
+	    break;
 
-		if (rulenum != 0 && ((rulenum != fs->fs_nr && co.do_pipe == 2) ||
-		    (rulenum != fs->parent_nr && co.do_pipe == 1))) {
-			continue;
-		}
+	case DN_FLOW:
+	    list_flow((struct dn_flow *)oid);
+	    break;
+
+	case DN_LINK: {
+	    struct dn_link *p = (struct dn_link *)oid;
+	    double b = p->bandwidth;
+	    char bwbuf[30];
+	    char burst[5 + 7];
+
+	    /* This starts a new object so flush buffer */
+	    flush_buf(buf);
+	    /* data rate */
+	    if (b == 0)
+		sprintf(bwbuf, "unlimited     ");
+	    else if (b >= 1000000)
+		sprintf(bwbuf, "%7.3f Mbit/s", b/1000000);
+	    else if (b >= 1000)
+		sprintf(bwbuf, "%7.3f Kbit/s", b/1000);
+	    else
+		sprintf(bwbuf, "%7.3f bit/s ", b);
+
+	    if (humanize_number(burst, sizeof(burst), p->burst,
+		    "", HN_AUTOSCALE, 0) < 0 || co.verbose)
+		sprintf(burst, "%d", (int)p->burst);
+	    sprintf(buf, "%05d: %s %4d ms burst %s",
+		p->link_nr % DN_MAX_ID, bwbuf, p->delay, burst);
+	    }
+	    break;
 
-		q = (struct dn_flow_queue *)(fs+1);
-		sprintf(prefix, "q%05d: weight %d pipe %d ",
-		    fs->fs_nr, fs->weight, fs->parent_nr);
-		print_flowset_parms(fs, prefix);
-		list_queues(fs, q);
+	case DN_FS:
+	    print_flowset_parms((struct dn_fs *)oid, buf);
+	    break;
+	case DN_PROFILE:
+	    flush_buf(buf);
+	    print_extra_delay_parms((struct dn_profile *)oid);
 	}
+	flush_buf(buf); // XXX does it really go here ?
+    }
 }
 
 /*
- * Delete pipe or queue i
+ * Delete pipe, queue or scheduler i
  */
 int
-ipfw_delete_pipe(int pipe_or_queue, int i)
+ipfw_delete_pipe(int do_pipe, int i)
 {
-	struct dn_pipe p;
-
-	memset(&p, 0, sizeof p);
-	if (pipe_or_queue == 1)
-		p.pipe_nr = i;		/* pipe */
-	else
-		p.fs.fs_nr = i;		/* queue */
-	i = do_cmd(IP_DUMMYNET_DEL, &p, sizeof p);
+	struct {
+		struct dn_id oid;
+		uintptr_t a[1];	/* add more if we want a list */
+	} cmd;
+	oid_fill((void *)&cmd, sizeof(cmd), DN_CMD_DELETE, DN_API_VERSION);
+	cmd.oid.subtype = (do_pipe == 1) ? DN_LINK :
+		( (do_pipe == 2) ? DN_FS : DN_SCH);
+	cmd.a[0] = i;
+	i = do_cmd(IP_DUMMYNET3, &cmd, cmd.oid.len);
 	if (i) {
 		i = 1;
 		warn("rule %u: setsockopt(IP_DUMMYNET_DEL)", i);
@@ -400,7 +424,7 @@ ipfw_delete_pipe(int pipe_or_queue, int 
  * The empirical curve may have both vertical and horizontal lines.
  * Vertical lines represent constant delay for a range of
  * probabilities; horizontal lines correspond to a discontinuty
- * in the delay distribution: the pipe will use the largest delay
+ * in the delay distribution: the link will use the largest delay
  * for a given probability.
  * 
  * To pass the curve to dummynet, we must store the parameters
@@ -490,9 +514,12 @@ static void
 read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen)
 {
 	if (*bandwidth != -1)
-		warn("duplicate token, override bandwidth value!");
+		warnx("duplicate token, override bandwidth value!");
 
 	if (arg[0] >= 'a' && arg[0] <= 'z') {
+		if (!if_name) {
+			errx(1, "no if support");
+		}
 		if (namelen >= IFNAMSIZ)
 			warn("interface name truncated");
 		namelen--;
@@ -508,7 +535,7 @@ read_bandwidth(char *arg, int *bandwidth
 		if (*end == 'K' || *end == 'k') {
 			end++;
 			bw *= 1000;
-		} else if (*end == 'M') {
+		} else if (*end == 'M' || *end == 'm') {
 			end++;
 			bw *= 1000000;
 		}
@@ -521,7 +548,8 @@ read_bandwidth(char *arg, int *bandwidth
 			errx(EX_DATAERR, "bandwidth too large");
 
 		*bandwidth = bw;
-		if_name[0] = '\0';
+		if (if_name)
+			if_name[0] = '\0';
 	}
 }
 
@@ -551,7 +579,8 @@ compare_points(const void *vp1, const vo
 #define ED_EFMT(s) EX_DATAERR,"error in %s at line %d: "#s,filename,lineno
 
 static void
-load_extra_delays(const char *filename, struct dn_pipe *p)
+load_extra_delays(const char *filename, struct dn_profile *p,
+	struct dn_link *link)
 {
 	char    line[ED_MAX_LINE_LEN];
 	FILE    *f;
@@ -566,6 +595,9 @@ load_extra_delays(const char *filename, 
 	struct point    points[ED_MAX_SAMPLES_NO];
 	int     points_no = 0;
 
+	/* XXX link never NULL? */
+	p->link_nr = link->link_nr;
+
 	profile_name[0] = '\0';
 	f = fopen(filename, "r");
 	if (f == NULL)
@@ -606,7 +638,8 @@ load_extra_delays(const char *filename, 
 				ED_MAX_SAMPLES_NO);
 		    do_points = 0;
 		} else if (!strcasecmp(name, ED_TOK_BW)) {
-		    read_bandwidth(arg, &p->bandwidth, p->if_name, sizeof(p->if_name));
+		    char buf[IFNAMSIZ];
+		    read_bandwidth(arg, &link->bandwidth, buf, sizeof(buf));
 		} else if (!strcasecmp(name, ED_TOK_LOSS)) {
 		    if (loss != -1.0)
 			errx(ED_EFMT("duplicated token: %s"), name);
@@ -676,17 +709,17 @@ load_extra_delays(const char *filename, 
 	    double y2 = points[i+1].prob * samples;
 	    double x2 = points[i+1].delay;
 
-	    int index = y1;
+	    int ix = y1;
 	    int stop = y2;
 
 	    if (x1 == x2) {
-		for (; indexsamples[index] = x1;
+		for (; ixsamples[ix] = x1;
 	    } else {
 		double m = (y2-y1)/(x2-x1);
 		double c = y1 - m*x1;
-		for (; indexsamples[index] = (index - c)/m;
+		for (; ixsamples[ix] = (ix - c)/m;
 	    }
 	}
 	p->samples_no = samples;
@@ -694,27 +727,120 @@ load_extra_delays(const char *filename, 
 	strncpy(p->name, profile_name, sizeof(p->name));
 }
 
+/*
+ * configuration of pipes, schedulers, flowsets.
+ * When we configure a new scheduler, an empty pipe is created, so:
+ * 
+ * do_pipe = 1 -> "pipe N config ..." only for backward compatibility
+ *	sched N+Delta type fifo sched_mask ...
+ *	pipe N+Delta 
+ *	flowset N+Delta pipe N+Delta (no parameters)
+ *	sched N type wf2q+ sched_mask ...
+ *	pipe N 
+ *
+ * do_pipe = 2 -> flowset N config
+ *	flowset N parameters
+ *
+ * do_pipe = 3 -> sched N config
+ *	sched N parameters (default no pipe)
+ *	optional Pipe N config ...
+ * pipe ==>
+ */
 void
 ipfw_config_pipe(int ac, char **av)
 {
-	int samples[ED_MAX_SAMPLES_NO];
-	struct dn_pipe p;
-	int i;
+	int i, j;
 	char *end;
 	void *par = NULL;
-
-	memset(&p, 0, sizeof p);
-	p.bandwidth = -1;
+	struct dn_id *buf, *base;
+	struct dn_sch *sch = NULL;
+	struct dn_link *p = NULL;
+	struct dn_fs *fs = NULL;
+	struct dn_profile *pf = NULL;
+	struct ipfw_flow_id *mask = NULL;
+	int lmax;
+	uint32_t _foo = 0, *flags = &_foo , *buckets = &_foo;
+
+	/*
+	 * allocate space for 1 header,
+	 * 1 scheduler, 1 link, 1 flowset, 1 profile
+	 */
+	lmax = sizeof(struct dn_id);	/* command header */
+	lmax += sizeof(struct dn_sch) + sizeof(struct dn_link) +
+		sizeof(struct dn_fs) + sizeof(struct dn_profile);
 
 	av++; ac--;
 	/* Pipe number */
 	if (ac && isdigit(**av)) {
 		i = atoi(*av); av++; ac--;
-		if (co.do_pipe == 1)
-			p.pipe_nr = i;
-		else
-			p.fs.fs_nr = i;
+	} else
+		i = -1;
+	if (i <= 0)
+		errx(EX_USAGE, "need a pipe/flowset/sched number");
+	base = buf = safe_calloc(1, lmax);
+	/* all commands start with a 'CONFIGURE' and a version */
+	o_next(&buf, sizeof(struct dn_id), DN_CMD_CONFIG);
+	base->id = DN_API_VERSION;
+
+	switch (co.do_pipe) {
+	case 1: /* "pipe N config ..." */
+		/* Allocate space for the WF2Q+ scheduler, its link
+		 * and the FIFO flowset. Set the number, but leave
+		 * the scheduler subtype and other parameters to 0
+		 * so the kernel will use appropriate defaults.
+		 * XXX todo: add a flag to record if a parameter
+		 * is actually configured.
+		 * If we do a 'pipe config' mask -> sched_mask.
+		 * The FIFO scheduler and link are derived from the
+		 * WF2Q+ one in the kernel.
+		 */
+		sch = o_next(&buf, sizeof(*sch), DN_SCH);
+		p = o_next(&buf, sizeof(*p), DN_LINK);
+		fs = o_next(&buf, sizeof(*fs), DN_FS);
+
+		sch->sched_nr = i;
+		sch->oid.subtype = 0;	/* defaults to WF2Q+ */
+		mask = &sch->sched_mask;
+		flags = &sch->flags;
+		buckets = &sch->buckets;
+		*flags |= DN_PIPE_CMD;
+
+		p->link_nr = i;
+
+		/* This flowset is only for the FIFO scheduler */
+		fs->fs_nr = i + 2*DN_MAX_ID;
+		fs->sched_nr = i + DN_MAX_ID;
+		break;
+
+	case 2: /* "queue N config ... " */
+		fs = o_next(&buf, sizeof(*fs), DN_FS);
+		fs->fs_nr = i;
+		mask = &fs->flow_mask;
+		flags = &fs->flags;
+		buckets = &fs->buckets;
+		break;
+
+	case 3: /* "sched N config ..." */
+		sch = o_next(&buf, sizeof(*sch), DN_SCH);
+		fs = o_next(&buf, sizeof(*fs), DN_FS);
+		sch->sched_nr = i;
+		mask = &sch->sched_mask;
+		flags = &sch->flags;
+		buckets = &sch->buckets;
+		/* fs is used only with !MULTIQUEUE schedulers */
+		fs->fs_nr = i + DN_MAX_ID;
+		fs->sched_nr = i;
+		break;
 	}
+	/* set to -1 those fields for which we want to reuse existing
+	 * values from the kernel.
+	 * Also, *_nr and subtype = 0 mean reuse the value from the kernel.
+	 * XXX todo: support reuse of the mask.
+	 */
+	if (p)
+		p->bandwidth = -1;
+	for (j = 0; j < sizeof(fs->par)/sizeof(fs->par[0]); j++)
+		fs->par[j] = -1;
 	while (ac > 0) {
 		double d;
 		int tok = match_token(dummynet_params, *av);
@@ -722,41 +848,48 @@ ipfw_config_pipe(int ac, char **av)
 
 		switch(tok) {
 		case TOK_NOERROR:
-			p.fs.flags_fs |= DN_NOERROR;
+			NEED(fs, "noerror is only for pipes");
+			fs->flags |= DN_NOERROR;
 			break;
 
 		case TOK_PLR:
+			NEED(fs, "plr is only for pipes");
 			NEED1("plr needs argument 0..1\n");
 			d = strtod(av[0], NULL);
 			if (d > 1)
 				d = 1;
 			else if (d < 0)
 				d = 0;
-			p.fs.plr = (int)(d*0x7fffffff);
+			fs->plr = (int)(d*0x7fffffff);
 			ac--; av++;
 			break;
 
 		case TOK_QUEUE:
+			NEED(fs, "queue is only for pipes or flowsets");
 			NEED1("queue needs queue size\n");
 			end = NULL;
-			p.fs.qsize = strtoul(av[0], &end, 0);
+			fs->qsize = strtoul(av[0], &end, 0);
 			if (*end == 'K' || *end == 'k') {
-				p.fs.flags_fs |= DN_QSIZE_IS_BYTES;
-				p.fs.qsize *= 1024;
+				fs->flags |= DN_QSIZE_BYTES;
+				fs->qsize *= 1024;
 			} else if (*end == 'B' ||
 			    _substrcmp2(end, "by", "bytes") == 0) {
-				p.fs.flags_fs |= DN_QSIZE_IS_BYTES;
+				fs->flags |= DN_QSIZE_BYTES;
 			}
 			ac--; av++;
 			break;
 
 		case TOK_BUCKETS:
+			NEED(fs, "buckets is only for pipes or flowsets");
 			NEED1("buckets needs argument\n");
-			p.fs.rq_size = strtoul(av[0], NULL, 0);
+			*buckets = strtoul(av[0], NULL, 0);
 			ac--; av++;
 			break;
 
+		case TOK_FLOW_MASK:
+		case TOK_SCHED_MASK:
 		case TOK_MASK:
+			NEED(mask, "tok_mask");
 			NEED1("mask needs mask specifier\n");
 			/*
 			 * per-flow queue, mask is dst_ip, dst_port,
@@ -764,7 +897,7 @@ ipfw_config_pipe(int ac, char **av)
 			 */
 			par = NULL;
 
-			bzero(&p.fs.flow_mask, sizeof(p.fs.flow_mask));
+			bzero(mask, sizeof(*mask));
 			end = NULL;
 
 			while (ac >= 1) {
@@ -780,44 +913,55 @@ ipfw_config_pipe(int ac, char **av)
 			    case TOK_ALL:
 				    /*
 				     * special case, all bits significant
+				     * except 'extra' (the queue number)
 				     */
-				    p.fs.flow_mask.dst_ip = ~0;
-				    p.fs.flow_mask.src_ip = ~0;
-				    p.fs.flow_mask.dst_port = ~0;
-				    p.fs.flow_mask.src_port = ~0;
-				    p.fs.flow_mask.proto = ~0;
-				    n2mask(&(p.fs.flow_mask.dst_ip6), 128);
-				    n2mask(&(p.fs.flow_mask.src_ip6), 128);
-				    p.fs.flow_mask.flow_id6 = ~0;
-				    p.fs.flags_fs |= DN_HAVE_FLOW_MASK;
+				    mask->dst_ip = ~0;
+				    mask->src_ip = ~0;
+				    mask->dst_port = ~0;
+				    mask->src_port = ~0;
+				    mask->proto = ~0;
+				    n2mask(&mask->dst_ip6, 128);
+				    n2mask(&mask->src_ip6, 128);
+				    mask->flow_id6 = ~0;
+				    *flags |= DN_HAVE_MASK;
+				    goto end_mask;
+
+			    case TOK_QUEUE:
+				    mask->extra = ~0;
+				    *flags |= DN_HAVE_MASK;
 				    goto end_mask;
 
 			    case TOK_DSTIP:
-				    p32 = &p.fs.flow_mask.dst_ip;
+				    mask->addr_type = 4;
+				    p32 = &mask->dst_ip;
 				    break;
 
 			    case TOK_SRCIP:
-				    p32 = &p.fs.flow_mask.src_ip;
+				    mask->addr_type = 4;
+				    p32 = &mask->src_ip;
 				    break;
 
 			    case TOK_DSTIP6:
-				    pa6 = &(p.fs.flow_mask.dst_ip6);
+				    mask->addr_type = 6;
+				    pa6 = &mask->dst_ip6;
 				    break;
 			    
 			    case TOK_SRCIP6:
-				    pa6 = &(p.fs.flow_mask.src_ip6);
+				    mask->addr_type = 6;
+				    pa6 = &mask->src_ip6;
 				    break;
 
 			    case TOK_FLOWID:
-				    p20 = &p.fs.flow_mask.flow_id6;
+				    mask->addr_type = 6;
+				    p20 = &mask->flow_id6;
 				    break;
 
 			    case TOK_DSTPORT:
-				    p16 = &p.fs.flow_mask.dst_port;
+				    p16 = &mask->dst_port;
 				    break;
 
 			    case TOK_SRCPORT:
-				    p16 = &p.fs.flow_mask.src_port;
+				    p16 = &mask->src_port;
 				    break;
 
 			    case TOK_PROTO:
@@ -857,10 +1001,10 @@ ipfw_config_pipe(int ac, char **av)
 				    if (a > 0xFF)
 					    errx(EX_DATAERR,
 						"proto mask must be 8 bit");
-				    p.fs.flow_mask.proto = (uint8_t)a;
+				    mask->proto = (uint8_t)a;
 			    }
 			    if (a != 0)
-				    p.fs.flags_fs |= DN_HAVE_FLOW_MASK;
+				    *flags |= DN_HAVE_MASK;
 			    ac--; av++;
 			} /* end while, config masks */
 end_mask:
@@ -869,9 +1013,9 @@ end_mask:
 		case TOK_RED:
 		case TOK_GRED:
 			NEED1("red/gred needs w_q/min_th/max_th/max_p\n");
-			p.fs.flags_fs |= DN_IS_RED;
+			fs->flags |= DN_IS_RED;
 			if (tok == TOK_GRED)
-				p.fs.flags_fs |= DN_IS_GENTLE_RED;
+				fs->flags |= DN_IS_GENTLE_RED;
 			/*
 			 * the format for parameters is w_q/min_th/max_th/max_p
 			 */
@@ -879,82 +1023,108 @@ end_mask:
 			    double w_q = strtod(end, NULL);
 			    if (w_q > 1 || w_q <= 0)
 				errx(EX_DATAERR, "0 < w_q <= 1");
-			    p.fs.w_q = (int) (w_q * (1 << SCALE_RED));
+			    fs->w_q = (int) (w_q * (1 << SCALE_RED));
 			}
 			if ((end = strsep(&av[0], "/"))) {
-			    p.fs.min_th = strtoul(end, &end, 0);
+			    fs->min_th = strtoul(end, &end, 0);
 			    if (*end == 'K' || *end == 'k')
-				p.fs.min_th *= 1024;
+				fs->min_th *= 1024;
 			}
 			if ((end = strsep(&av[0], "/"))) {
-			    p.fs.max_th = strtoul(end, &end, 0);
+			    fs->max_th = strtoul(end, &end, 0);
 			    if (*end == 'K' || *end == 'k')
-				p.fs.max_th *= 1024;
+				fs->max_th *= 1024;
 			}
 			if ((end = strsep(&av[0], "/"))) {
 			    double max_p = strtod(end, NULL);
 			    if (max_p > 1 || max_p <= 0)
 				errx(EX_DATAERR, "0 < max_p <= 1");
-			    p.fs.max_p = (int)(max_p * (1 << SCALE_RED));
+			    fs->max_p = (int)(max_p * (1 << SCALE_RED));
 			}
 			ac--; av++;
 			break;
 
 		case TOK_DROPTAIL:
-			p.fs.flags_fs &= ~(DN_IS_RED|DN_IS_GENTLE_RED);
+			NEED(fs, "droptail is only for flowsets");
+			fs->flags &= ~(DN_IS_RED|DN_IS_GENTLE_RED);
 			break;
 
 		case TOK_BW:
+			NEED(p, "bw is only for links");
 			NEED1("bw needs bandwidth or interface\n");
-			if (co.do_pipe != 1)
-			    errx(EX_DATAERR, "bandwidth only valid for pipes");
-			read_bandwidth(av[0], &p.bandwidth, p.if_name, sizeof(p.if_name));
+			read_bandwidth(av[0], &p->bandwidth, NULL, 0);
 			ac--; av++;
 			break;
 
 		case TOK_DELAY:
-			if (co.do_pipe != 1)

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

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 10:21:33 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CE94D106564A;
	Tue, 23 Mar 2010 10:21:33 +0000 (UTC)
	(envelope-from luigi@onelab2.iet.unipi.it)
Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238])
	by mx1.freebsd.org (Postfix) with ESMTP id 930738FC18;
	Tue, 23 Mar 2010 10:21:33 +0000 (UTC)
Received: by onelab2.iet.unipi.it (Postfix, from userid 275)
	id 5F95D7310A; Tue, 23 Mar 2010 11:15:27 +0100 (CET)
Date: Tue, 23 Mar 2010 11:15:27 +0100
From: Luigi Rizzo 
To: Luigi Rizzo 
Message-ID: <20100323101527.GA11809@onelab2.iet.unipi.it>
References: <201003230958.o2N9wxoL037254@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201003230958.o2N9wxoL037254@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org
Subject: Re: svn commit: r205511 - in stable/8: . contrib/top lib lib/libusb
	sbin/ipfw sys/conf sys/net sys/netgraph sys/netinet
	sys/netinet/ipfw sys/netinet/ipfw/test
	tools/regression/lib/msun tools/regression...
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 10:21:33 -0000

On Tue, Mar 23, 2010 at 09:58:59AM +0000, Luigi Rizzo wrote:
...

> Directory Properties:
>   stable/8/   (props changed)
>   stable/8/Makefile.inc1   (props changed)
>   stable/8/ObsoleteFiles.inc   (props changed)
...
>   stable/8/usr.sbin/wpa/   (props changed)
>   stable/8/usr.sbin/ypserv/   (props changed)
>   stable/8/usr.sbin/zic/   (props changed)

hmmm... all these "props changed" must be a side effect of
   svn merge -r X:Y svn+ssh://...users/luigi/ipfw3-r8
but there were no actual changes that i know of. Does anyone know
why they came out and how to prevent such things in the future ?

cheers
luigi

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 14:27:56 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C8B7D106566B;
	Tue, 23 Mar 2010 14:27:56 +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 985F48FC1B;
	Tue, 23 Mar 2010 14:27:56 +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 527E146B8A;
	Tue, 23 Mar 2010 10:27:56 -0400 (EDT)
Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 8A7F68A021;
	Tue, 23 Mar 2010 10:27:55 -0400 (EDT)
From: John Baldwin 
To: Luigi Rizzo 
Date: Tue, 23 Mar 2010 09:55:28 -0400
User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; )
References: <201003230958.o2N9wxoL037254@svn.freebsd.org>
	<20100323101527.GA11809@onelab2.iet.unipi.it>
In-Reply-To: <20100323101527.GA11809@onelab2.iet.unipi.it>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <201003230955.28154.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Tue, 23 Mar 2010 10:27:55 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-1.7 required=4.2 tests=AWL,BAYES_00 autolearn=ham
	version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-stable@freebsd.org, Luigi Rizzo ,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org,
	svn-src-all@freebsd.org
Subject: Re: svn commit: r205511 - in stable/8: . contrib/top lib lib/libusb
	sbin/ipfw sys/conf sys/net sys/netgraph sys/netinet
	sys/netinet/ipfw sys/netinet/ipfw/test
	tools/regression/lib/msun tools/regression...
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 14:27:56 -0000

On Tuesday 23 March 2010 6:15:27 am Luigi Rizzo wrote:
> On Tue, Mar 23, 2010 at 09:58:59AM +0000, Luigi Rizzo wrote:
> ...
> 
> > Directory Properties:
> >   stable/8/   (props changed)
> >   stable/8/Makefile.inc1   (props changed)
> >   stable/8/ObsoleteFiles.inc   (props changed)
> ...
> >   stable/8/usr.sbin/wpa/   (props changed)
> >   stable/8/usr.sbin/ypserv/   (props changed)
> >   stable/8/usr.sbin/zic/   (props changed)
> 
> hmmm... all these "props changed" must be a side effect of
>    svn merge -r X:Y svn+ssh://...users/luigi/ipfw3-r8
> but there were no actual changes that i know of. Does anyone know
> why they came out and how to prevent such things in the future ?

Yes, don't merge to stable/8 directory.  Instead, merge to subdirectories as 
the directions on the wiki say.  In this case you would have done two merges, 
one to stable/8/sys and one to stable/8/sbin/ipfw.  You could still commit it 
all at once with a single svn ci.

-- 
John Baldwin

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 15:01:27 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB42E106566C;
	Tue, 23 Mar 2010 15:01:27 +0000 (UTC)
	(envelope-from luigi@onelab2.iet.unipi.it)
Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238])
	by mx1.freebsd.org (Postfix) with ESMTP id A70C38FC16;
	Tue, 23 Mar 2010 15:01:27 +0000 (UTC)
Received: by onelab2.iet.unipi.it (Postfix, from userid 275)
	id 3045073106; Tue, 23 Mar 2010 16:11:21 +0100 (CET)
Date: Tue, 23 Mar 2010 16:11:21 +0100
From: Luigi Rizzo 
To: John Baldwin 
Message-ID: <20100323151121.GB15175@onelab2.iet.unipi.it>
References: <201003230958.o2N9wxoL037254@svn.freebsd.org>
	<20100323101527.GA11809@onelab2.iet.unipi.it>
	<201003230955.28154.jhb@freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201003230955.28154.jhb@freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-stable@freebsd.org, Luigi Rizzo ,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org,
	svn-src-all@freebsd.org
Subject: Re: svn commit: r205511 - in stable/8: . contrib/top lib lib/libusb
	sbin/ipfw sys/conf sys/net sys/netgraph sys/netinet
	sys/netinet/ipfw sys/netinet/ipfw/test
	tools/regression/lib/msun tools/regression...
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 15:01:28 -0000

On Tue, Mar 23, 2010 at 09:55:28AM -0400, John Baldwin wrote:
> On Tuesday 23 March 2010 6:15:27 am Luigi Rizzo wrote:
> > On Tue, Mar 23, 2010 at 09:58:59AM +0000, Luigi Rizzo wrote:
> > ...
> > 
> > > Directory Properties:
> > >   stable/8/   (props changed)
> > >   stable/8/Makefile.inc1   (props changed)
> > >   stable/8/ObsoleteFiles.inc   (props changed)
> > ...
> > >   stable/8/usr.sbin/wpa/   (props changed)
> > >   stable/8/usr.sbin/ypserv/   (props changed)
> > >   stable/8/usr.sbin/zic/   (props changed)
> > 
> > hmmm... all these "props changed" must be a side effect of
> >    svn merge -r X:Y svn+ssh://...users/luigi/ipfw3-r8
> > but there were no actual changes that i know of. Does anyone know
> > why they came out and how to prevent such things in the future ?
> 
> Yes, don't merge to stable/8 directory.  Instead, merge to subdirectories as 
> the directions on the wiki say.  In this case you would have done two merges, 
> one to stable/8/sys and one to stable/8/sbin/ipfw.  You could still commit it 

ah, ok. sorry for the confusion

cheers
luigi

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 16:45:30 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F354F1065674;
	Tue, 23 Mar 2010 16:45:29 +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 E1C758FC20;
	Tue, 23 Mar 2010 16:45: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 o2NGjTcB028775;
	Tue, 23 Mar 2010 16:45:29 GMT (envelope-from jh@svn.freebsd.org)
Received: (from jh@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NGjTQI028773;
	Tue, 23 Mar 2010 16:45:29 GMT (envelope-from jh@svn.freebsd.org)
Message-Id: <201003231645.o2NGjTQI028773@svn.freebsd.org>
From: Jaakko Heinonen 
Date: Tue, 23 Mar 2010 16:45: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: r205518 - stable/8/etc/rc.d
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 16:45:30 -0000

Author: jh
Date: Tue Mar 23 16:45:29 2010
New Revision: 205518
URL: http://svn.freebsd.org/changeset/base/205518

Log:
  MFC r205121:
  
  Use an unique directory name instead of hardcoded /tmp/.diskless.
  A malicious user could create a file named /tmp/.diskless and cause
  the script to misbehave.
  
  PR:		conf/141258

Modified:
  stable/8/etc/rc.d/tmp
Directory Properties:
  stable/8/etc/   (props changed)

Modified: stable/8/etc/rc.d/tmp
==============================================================================
--- stable/8/etc/rc.d/tmp	Tue Mar 23 15:14:45 2010	(r205517)
+++ stable/8/etc/rc.d/tmp	Tue Mar 23 16:45:29 2010	(r205518)
@@ -51,8 +51,8 @@ case "${tmpmfs}" in
 [Nn][Oo])
 	;;
 *)
-	if /bin/mkdir -p /tmp/.diskless 2> /dev/null; then
-		rmdir /tmp/.diskless
+	if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then
+		rmdir ${_tmpdir}
 	else
 		if [ -h /tmp ]; then
 			echo "*** /tmp is a symlink to a non-writable area!"

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 17:14:50 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C29EE1065673;
	Tue, 23 Mar 2010 17:14:50 +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 B14A28FC1B;
	Tue, 23 Mar 2010 17:14: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 o2NHEodS035375;
	Tue, 23 Mar 2010 17:14:50 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NHEoDA035373;
	Tue, 23 Mar 2010 17:14:50 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <201003231714.o2NHEoDA035373@svn.freebsd.org>
From: Andriy Gapon 
Date: Tue, 23 Mar 2010 17:14:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205519 - stable/8/share/man/man9
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 17:14:50 -0000

Author: avg
Date: Tue Mar 23 17:14:50 2010
New Revision: 205519
URL: http://svn.freebsd.org/changeset/base/205519

Log:
  MFC r205333: vfs_mount.9: drop cross-reference to a removed manual

Modified:
  stable/8/share/man/man9/vfs_mount.9
Directory Properties:
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/vfs_mount.9
==============================================================================
--- stable/8/share/man/man9/vfs_mount.9	Tue Mar 23 16:45:29 2010	(r205518)
+++ stable/8/share/man/man9/vfs_mount.9	Tue Mar 23 17:14:50 2010	(r205519)
@@ -127,8 +127,7 @@ this call relies on a large number of ot
 whose errors it returns so this list may not be exhaustive.
 .Sh SEE ALSO
 .Xr mount 2 ,
-.Xr mount 8 ,
-.Xr vfs_mountedon 9
+.Xr mount 8
 .Pp
 .Va vfs.usermount
 .Sh AUTHORS

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 19:16:35 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 895B01065672;
	Tue, 23 Mar 2010 19:16: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 779008FC13;
	Tue, 23 Mar 2010 19: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 o2NJGZZv062585;
	Tue, 23 Mar 2010 19:16:35 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NJGZ7a062583;
	Tue, 23 Mar 2010 19:16:35 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003231916.o2NJGZ7a062583@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 19:16:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205523 - stable/8/sys/dev/bge
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 19:16:35 -0000

Author: yongari
Date: Tue Mar 23 19:16:35 2010
New Revision: 205523
URL: http://svn.freebsd.org/changeset/base/205523

Log:
  MFC r204151,204223:
  r204151:
    Add TSO support on VLAN. Controller requires VLAN hardware tagging
    to make TSO work on VLAN. So if VLAN hardware tagging is disabled
    explicitly clear TSO on VLAN. While I'm here remove duplicated
    VLAN_CAPABILITIES call.
  
  r204223:
    Remove Tx mbuf parsing code for VLAN in TSO path. Controller does
    not support TSO over VLAN if VLAN hardware tagging is disabled so
    there is no need to check VLAN here.
    While I'm here make sure to pullup IP/TCP headers in the first
    buffer.

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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==============================================================================
--- stable/8/sys/dev/bge/if_bge.c	Tue Mar 23 19:11:25 2010	(r205522)
+++ stable/8/sys/dev/bge/if_bge.c	Tue Mar 23 19:16:35 2010	(r205523)
@@ -2816,7 +2816,7 @@ bge_attach(device_t dev)
 	    IFCAP_VLAN_MTU;
 	if ((sc->bge_flags & BGE_FLAG_TSO) != 0) {
 		ifp->if_hwassist |= CSUM_TSO;
-		ifp->if_capabilities |= IFCAP_TSO4;
+		ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO;
 	}
 #ifdef IFCAP_VLAN_HWCSUM
 	ifp->if_capabilities |= IFCAP_VLAN_HWCSUM;
@@ -3835,12 +3835,11 @@ bge_cksum_pad(struct mbuf *m)
 static struct mbuf *
 bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss)
 {
-	struct ether_header *eh;
 	struct ip *ip;
 	struct tcphdr *tcp;
 	struct mbuf *n;
 	uint16_t hlen;
-	uint32_t ip_off, poff;
+	uint32_t poff;
 
 	if (M_WRITABLE(m) == 0) {
 		/* Get a writable copy. */
@@ -3850,28 +3849,16 @@ bge_setup_tso(struct bge_softc *sc, stru
 			return (NULL);
 		m = n;
 	}
-	ip_off = sizeof(struct ether_header);
-	m = m_pullup(m, ip_off);
+	m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip));
 	if (m == NULL)
 		return (NULL);
-	eh = mtod(m, struct ether_header *);
-	/* Check the existence of VLAN tag. */
-	if (eh->ether_type == htons(ETHERTYPE_VLAN)) {
-		ip_off = sizeof(struct ether_vlan_header);
-		m = m_pullup(m, ip_off);
-		if (m == NULL)
-			return (NULL);
-	}
-	m = m_pullup(m, ip_off + sizeof(struct ip));
-	if (m == NULL)
-		return (NULL);
-	ip = (struct ip *)(mtod(m, char *) + ip_off);
-	poff = ip_off + (ip->ip_hl << 2);
+	ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header));
+	poff = sizeof(struct ether_header) + (ip->ip_hl << 2);
 	m = m_pullup(m, poff + sizeof(struct tcphdr));
 	if (m == NULL)
 		return (NULL);
 	tcp = (struct tcphdr *)(mtod(m, char *) + poff);
-	m = m_pullup(m, poff + sizeof(struct tcphdr) + tcp->th_off);
+	m = m_pullup(m, poff + (tcp->th_off << 2));
 	if (m == NULL)
 		return (NULL);
 	/*
@@ -4526,9 +4513,6 @@ bge_ioctl(struct ifnet *ifp, u_long comm
 				ifp->if_hwassist |= BGE_CSUM_FEATURES;
 			else
 				ifp->if_hwassist &= ~BGE_CSUM_FEATURES;
-#ifdef VLAN_CAPABILITIES
-			VLAN_CAPABILITIES(ifp);
-#endif
 		}
 
 		if ((mask & IFCAP_TSO4) != 0 &&
@@ -4546,16 +4530,21 @@ bge_ioctl(struct ifnet *ifp, u_long comm
 			bge_init(sc);
 		}
 
-		if (mask & IFCAP_VLAN_HWTAGGING) {
+		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;
+			if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
+				ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
 			BGE_LOCK(sc);
 			bge_setvlan(sc);
 			BGE_UNLOCK(sc);
+		}
 #ifdef VLAN_CAPABILITIES
-			VLAN_CAPABILITIES(ifp);
+		VLAN_CAPABILITIES(ifp);
 #endif
-		}
-
 		break;
 	default:
 		error = ether_ioctl(ifp, command, data);

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 19:30:15 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B7C37106564A;
	Tue, 23 Mar 2010 19:30:15 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A63838FC14;
	Tue, 23 Mar 2010 19:30: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 o2NJUFQ5065768;
	Tue, 23 Mar 2010 19:30:15 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NJUFJK065766;
	Tue, 23 Mar 2010 19:30:15 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003231930.o2NJUFJK065766@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 19:30: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: r205526 - stable/8/sys/dev/re
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 19:30:15 -0000

Author: yongari
Date: Tue Mar 23 19:30:15 2010
New Revision: 205526
URL: http://svn.freebsd.org/changeset/base/205526

Log:
  MFC r204155,204219:
  r204155:
    Increase PCIe maximuim read request size to 2048. Because re(4) uses
    Tx DMA burst size 2048, I beleive PCIe maximum read request size
    also should match to the value of Tx DMA burst size. With this
    change I can get more than 800Mbps for TCP bulk transfers.
    Previously I was not able to get more than 700Mbps. If I enable TSO
    it now shows 927Mbps.
  
  r204219:
    Add TSO on VLANs. Because re(4) has a TSO limitation for jumbo
    frame, make sure to update VLAN capabilities whenever jumbo frame
    is configured.
    While I'm here rearrange interface capabilities configuration. The
    controller requires VLAN hardware tagging to make TSO work on VLANs
    so explicitly check this requirement.

Modified:
  stable/8/sys/dev/re/if_re.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/re/if_re.c
==============================================================================
--- stable/8/sys/dev/re/if_re.c	Tue Mar 23 19:27:24 2010	(r205525)
+++ stable/8/sys/dev/re/if_re.c	Tue Mar 23 19:30:15 2010	(r205526)
@@ -1162,6 +1162,9 @@ re_attach(device_t dev)
 	msic = 0;
 	if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) {
 		sc->rl_flags |= RL_FLAG_PCIE;
+		/* Set PCIe maximum read request size to 2048. */
+		if (pci_get_max_read_req(dev) < 2048)
+			pci_set_max_read_req(dev, 2048);
 		msic = pci_msi_count(dev);
 		if (bootverbose)
 			device_printf(dev, "MSI count : %d\n", msic);
@@ -1426,7 +1429,7 @@ re_attach(device_t dev)
 	 */
 	if ((sc->rl_flags & RL_FLAG_DESCV2) == 0) {
 		ifp->if_hwassist |= CSUM_TSO;
-		ifp->if_capabilities |= IFCAP_TSO4;
+		ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO;
 	}
 
 	/*
@@ -1448,7 +1451,7 @@ re_attach(device_t dev)
 	 * packets in TSO size.
 	 */
 	ifp->if_hwassist &= ~CSUM_TSO;
-	ifp->if_capenable &= ~IFCAP_TSO4;
+	ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_VLAN_HWTSO);
 #ifdef DEVICE_POLLING
 	ifp->if_capabilities |= IFCAP_POLLING;
 #endif
@@ -2786,6 +2789,7 @@ re_ioctl(struct ifnet *ifp, u_long comma
 		    (ifp->if_capenable & IFCAP_TSO4) != 0) {
 			ifp->if_capenable &= ~IFCAP_TSO4;
 			ifp->if_hwassist &= ~CSUM_TSO;
+			VLAN_CAPABILITIES(ifp);
 		}
 		RL_UNLOCK(sc);
 		break;
@@ -2852,14 +2856,10 @@ re_ioctl(struct ifnet *ifp, u_long comma
 				ifp->if_hwassist &= ~RE_CSUM_FEATURES;
 			reinit = 1;
 		}
-		if (mask & IFCAP_VLAN_HWTAGGING) {
-			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
-			reinit = 1;
-		}
-		if (mask & IFCAP_TSO4) {
+		if ((mask & IFCAP_TSO4) != 0 &&
+		    (ifp->if_capabilities & IFCAP_TSO) != 0) {
 			ifp->if_capenable ^= IFCAP_TSO4;
-			if ((IFCAP_TSO4 & ifp->if_capenable) &&
-			    (IFCAP_TSO4 & ifp->if_capabilities))
+			if ((IFCAP_TSO4 & ifp->if_capenable) != 0)
 				ifp->if_hwassist |= CSUM_TSO;
 			else
 				ifp->if_hwassist &= ~CSUM_TSO;
@@ -2869,6 +2869,17 @@ re_ioctl(struct ifnet *ifp, u_long comma
 				ifp->if_hwassist &= ~CSUM_TSO;
 			}
 		}
+		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;
+			/* TSO over VLAN requires VLAN hardware tagging. */
+			if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
+				ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
+			reinit = 1;
+		}
 		if ((mask & IFCAP_WOL) != 0 &&
 		    (ifp->if_capabilities & IFCAP_WOL) != 0) {
 			if ((mask & IFCAP_WOL_UCAST) != 0)

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 19:37:16 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2D4AB1065674;
	Tue, 23 Mar 2010 19:37:16 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1C3218FC21;
	Tue, 23 Mar 2010 19:37: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 o2NJbGDk067455;
	Tue, 23 Mar 2010 19:37:16 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NJbFHn067453;
	Tue, 23 Mar 2010 19:37:15 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003231937.o2NJbFHn067453@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 19:37: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: r205529 - stable/8/sys/dev/jme
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 19:37:16 -0000

Author: yongari
Date: Tue Mar 23 19:37:15 2010
New Revision: 205529
URL: http://svn.freebsd.org/changeset/base/205529

Log:
  MFC r204225:
    Add TSO support on VLANs. jme(4) controllers do not require VLAN
    hardware tagging to make TSO work over VLANs.

Modified:
  stable/8/sys/dev/jme/if_jme.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/jme/if_jme.c
==============================================================================
--- stable/8/sys/dev/jme/if_jme.c	Tue Mar 23 19:34:34 2010	(r205528)
+++ stable/8/sys/dev/jme/if_jme.c	Tue Mar 23 19:37:15 2010	(r205529)
@@ -783,7 +783,7 @@ jme_attach(device_t dev)
 
 	/* VLAN capability setup */
 	ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
-	    IFCAP_VLAN_HWCSUM;
+	    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
 	ifp->if_capenable = ifp->if_capabilities;
 
 	/* Tell the upper layer(s) we support long frames. */
@@ -2000,6 +2000,9 @@ jme_ioctl(struct ifnet *ifp, u_long cmd,
 		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 &&
 		    (IFCAP_VLAN_HWTAGGING & ifp->if_capabilities) != 0) {
 			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 19:41:44 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E7CE106566C;
	Tue, 23 Mar 2010 19:41:44 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D12A8FC2E;
	Tue, 23 Mar 2010 19:41: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 o2NJfiON068549;
	Tue, 23 Mar 2010 19:41:44 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NJfihj068547;
	Tue, 23 Mar 2010 19:41:44 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003231941.o2NJfihj068547@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 19:41: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: r205531 - stable/8/sys/dev/alc
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 19:41:44 -0000

Author: yongari
Date: Tue Mar 23 19:41:43 2010
New Revision: 205531
URL: http://svn.freebsd.org/changeset/base/205531

Log:
  MFC r204228,204230:
  r204228:
    Add TSO support on VLANs. Also make sure to update TSO capability
    whenever jumbo frame is configured.
    While I'm here remove unnecessary check of VLAN hardware checksum
    offloading. vlan(4) already takes care of this.
  
  r204230:
    Remove Tx mbuf parsing code for VLAN in TSO path. Controller does
    not support TSO over VLAN if VLAN hardware tagging is disabled so
    there is no need to check VLAN here.

Modified:
  stable/8/sys/dev/alc/if_alc.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/alc/if_alc.c
==============================================================================
--- stable/8/sys/dev/alc/if_alc.c	Tue Mar 23 19:38:45 2010	(r205530)
+++ stable/8/sys/dev/alc/if_alc.c	Tue Mar 23 19:41:43 2010	(r205531)
@@ -84,9 +84,6 @@ __FBSDID("$FreeBSD$");
 #else
 #define	ALC_CSUM_FEATURES	(CSUM_IP | CSUM_TCP | CSUM_UDP)
 #endif
-#ifndef	IFCAP_VLAN_HWTSO
-#define	IFCAP_VLAN_HWTSO	0
-#endif
 
 MODULE_DEPEND(alc, pci, 1, 1, 1);
 MODULE_DEPEND(alc, ether, 1, 1, 1);
@@ -756,8 +753,8 @@ alc_attach(device_t dev)
 	ether_ifattach(ifp, sc->alc_eaddr);
 
 	/* VLAN capability setup. */
-	ifp->if_capabilities |= IFCAP_VLAN_MTU;
-	ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM;
+	ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
+	    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
 	ifp->if_capenable = ifp->if_capabilities;
 	/*
 	 * XXX
@@ -1791,7 +1788,7 @@ alc_encap(struct alc_softc *sc, struct m
 	struct tcphdr *tcp;
 	bus_dma_segment_t txsegs[ALC_MAXTXSEGS];
 	bus_dmamap_t map;
-	uint32_t cflags, hdrlen, ip_off, poff, vtag;
+	uint32_t cflags, hdrlen, poff, vtag;
 	int error, idx, nsegs, prod;
 
 	ALC_LOCK_ASSERT(sc);
@@ -1801,7 +1798,7 @@ alc_encap(struct alc_softc *sc, struct m
 	m = *m_head;
 	ip = NULL;
 	tcp = NULL;
-	ip_off = poff = 0;
+	poff = 0;
 	if ((m->m_pkthdr.csum_flags & (ALC_CSUM_FEATURES | CSUM_TSO)) != 0) {
 		/*
 		 * AR8131/AR8132 requires offset of TCP/UDP header in its
@@ -1811,7 +1808,6 @@ alc_encap(struct alc_softc *sc, struct m
 		 * cycles on FreeBSD so fast host CPU is required to get
 		 * smooth TSO performance.
 		 */
-		struct ether_header *eh;
 
 		if (M_WRITABLE(m) == 0) {
 			/* Get a writable copy. */
@@ -1825,32 +1821,13 @@ alc_encap(struct alc_softc *sc, struct m
 			*m_head = m;
 		}
 
-		ip_off = sizeof(struct ether_header);
-		m = m_pullup(m, ip_off);
-		if (m == NULL) {
-			*m_head = NULL;
-			return (ENOBUFS);
-		}
-		eh = mtod(m, struct ether_header *);
-		/*
-		 * Check if hardware VLAN insertion is off.
-		 * Additional check for LLC/SNAP frame?
-		 */
-		if (eh->ether_type == htons(ETHERTYPE_VLAN)) {
-			ip_off = sizeof(struct ether_vlan_header);
-			m = m_pullup(m, ip_off);
-			if (m == NULL) {
-				*m_head = NULL;
-				return (ENOBUFS);
-			}
-		}
-		m = m_pullup(m, ip_off + sizeof(struct ip));
+		m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip));
 		if (m == NULL) {
 			*m_head = NULL;
 			return (ENOBUFS);
 		}
-		ip = (struct ip *)(mtod(m, char *) + ip_off);
-		poff = ip_off + (ip->ip_hl << 2);
+		ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header));
+		poff = sizeof(struct ether_header) + (ip->ip_hl << 2);
 		if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
 			m = m_pullup(m, poff + sizeof(struct tcphdr));
 			if (m == NULL) {
@@ -2133,6 +2110,7 @@ alc_ioctl(struct ifnet *ifp, u_long cmd,
 			    (ifp->if_capenable & IFCAP_TSO4) != 0) {
 				ifp->if_capenable &= ~IFCAP_TSO4;
 				ifp->if_hwassist &= ~CSUM_TSO;
+				VLAN_CAPABILITIES(ifp);
 			}
 			ALC_UNLOCK(sc);
 		}
@@ -2204,14 +2182,6 @@ alc_ioctl(struct ifnet *ifp, u_long cmd,
 		if ((mask & IFCAP_VLAN_HWTSO) != 0 &&
 		    (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0)
 			ifp->if_capenable ^= IFCAP_VLAN_HWTSO;
-		/*
-		 * VLAN hardware tagging is required to do checksum
-		 * offload or TSO on VLAN interface. Checksum offload
-		 * on VLAN interface also requires hardware checksum
-		 * offload of parent interface.
-		 */
-		if ((ifp->if_capenable & IFCAP_TXCSUM) == 0)
-			ifp->if_capenable &= ~IFCAP_VLAN_HWCSUM;
 		if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
 			ifp->if_capenable &=
 			    ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM);

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 21:38:26 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 666F9106566C;
	Tue, 23 Mar 2010 21:38: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 3AF868FC19;
	Tue, 23 Mar 2010 21:38: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 o2NLcQEC094509;
	Tue, 23 Mar 2010 21:38:26 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NLcQPE094507;
	Tue, 23 Mar 2010 21:38:26 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003232138.o2NLcQPE094507@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 21:38: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: r205537 - stable/8/sys/dev/msk
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 21:38:26 -0000

Author: yongari
Date: Tue Mar 23 21:38:25 2010
New Revision: 205537
URL: http://svn.freebsd.org/changeset/base/205537

Log:
  MFC r204361-204362:
  r204361:
    Reuse the configured LE for VLAN if new LE was created for TSO.
    Only old controllers need to create new LE for TSO. This change
    makes TSO work over VLANs.
  
  r204362:
    Add TSO support on VLANs. Controller requires VLAN hardware tagging
    to make TSO work over VLANs.

Modified:
  stable/8/sys/dev/msk/if_msk.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/msk/if_msk.c
==============================================================================
--- stable/8/sys/dev/msk/if_msk.c	Tue Mar 23 21:08:07 2010	(r205536)
+++ stable/8/sys/dev/msk/if_msk.c	Tue Mar 23 21:38:25 2010	(r205537)
@@ -1006,11 +1006,6 @@ msk_ioctl(struct ifnet *ifp, u_long comm
 		if ((mask & IFCAP_RXCSUM) != 0 &&
 		    (IFCAP_RXCSUM & ifp->if_capabilities) != 0)
 			ifp->if_capenable ^= IFCAP_RXCSUM;
-		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
-		    (IFCAP_VLAN_HWTAGGING & ifp->if_capabilities) != 0) {
-			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
-			msk_setvlan(sc_if, ifp);
-		}
 		if ((mask & IFCAP_VLAN_HWCSUM) != 0 &&
 		    (IFCAP_VLAN_HWCSUM & ifp->if_capabilities) != 0)
 			ifp->if_capenable ^= IFCAP_VLAN_HWCSUM;
@@ -1022,6 +1017,16 @@ msk_ioctl(struct ifnet *ifp, u_long comm
 			else
 				ifp->if_hwassist &= ~CSUM_TSO;
 		}
+		if ((mask & IFCAP_VLAN_HWTSO) != 0 &&
+		    (IFCAP_VLAN_HWTSO & ifp->if_capabilities) != 0)
+			ifp->if_capenable ^= IFCAP_VLAN_HWTSO;
+		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
+		    (IFCAP_VLAN_HWTAGGING & ifp->if_capabilities) != 0) {
+			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
+			if ((IFCAP_VLAN_HWTAGGING & ifp->if_capenable) == 0)
+				ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
+			msk_setvlan(sc_if, ifp);
+		}
 		if (ifp->if_mtu > ETHERMTU &&
 		    (sc_if->msk_flags & MSK_FLAG_JUMBO_NOCSUM) != 0) {
 			ifp->if_hwassist &= ~(MSK_CSUM_FEATURES | CSUM_TSO);
@@ -1561,7 +1566,7 @@ msk_attach(device_t dev)
 		 * this workaround does not work so disable checksum offload
 		 * for VLAN interface.
 		 */
-        	ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
+        	ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO;
 		/*
 		 * Enable Rx checksum offloading for VLAN taggedd frames
 		 * if controller support new descriptor format.
@@ -2688,7 +2693,7 @@ msk_encap(struct msk_if_softc *sc_if, st
 	}
 	/* Check if we have a VLAN tag to insert. */
 	if ((m->m_flags & M_VLANTAG) != 0) {
-		if (tso == 0) {
+		if (tx_le == NULL) {
 			tx_le = &sc_if->msk_rdata.msk_tx_ring[prod];
 			tx_le->msk_addr = htole32(0);
 			tx_le->msk_control = htole32(OP_VLAN | HW_OWNER |

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 21:51:31 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 583F91065677;
	Tue, 23 Mar 2010 21:51:31 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 45E3D8FC23;
	Tue, 23 Mar 2010 21:51: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 o2NLpVFA097691;
	Tue, 23 Mar 2010 21:51:31 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NLpVpi097688;
	Tue, 23 Mar 2010 21:51:31 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003232151.o2NLpVpi097688@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 21:51: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: r205542 - stable/8/sys/dev/msk
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 21:51:31 -0000

Author: yongari
Date: Tue Mar 23 21:51:31 2010
New Revision: 205542
URL: http://svn.freebsd.org/changeset/base/205542

Log:
  MFC r204363,204365-204367,204539-204540:
  r204363:
    Optimize inserting LE for TX checksum computation. Controller does
    not require checksum LE configuration if checksum start and write
    position is the same as before. So keep track last checksum start
    and write position and insert new LE whenever the position is
    changed. This reduces number of LEs used in TX path as well as
    slightly enhance TX performance.
  
  r204365:
    Don't hardcod register offset to set PCIe max read request size.
    The register offset is not valid on 88E8072 controller. Also don't
    blindly increase max read request size to 4096, instead, use 2048
    which seems to be more sane value and only change the value if the
    hardware default size(512) was used on that register.
    For PCIX controllers, use system defined constant rather than using
    magic value.
    While I'm here stop showing negotiated link width.
  
  r204366:
    Allocate single MSI message. msk(4) used to allocate 2 MSI messages
    for controllers like 88E8053 which reports two MSI messages.
    Because we don't get anything useful things with 2 MSI messages,
    allocating 1 MSI message would be more sane approach.
    While I'm here, enable MSI for dual-port controllers too. Because
    status block is shared for dual-port controllers, I don't think
    msk(4) will encounter problem for using MSI on dual-port
    controllers.
  
  r204367:
    Remove trailing white spaces.
  
  r204539:
    Properly sync status LEs after processing.
  
  r204540:
    Make sure to enable flow-control only if established link is
    full-duplex. Previously msk(4) used to allow flow-control on
    1000baseT half-duplex media. Also GMAC pause is enabled if link
    partner is capable of handling it.
    While I'm here use IFM_OPTIONS instead of using IFM_GMASK to check
    optional flags of link.

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

Modified: stable/8/sys/dev/msk/if_msk.c
==============================================================================
--- stable/8/sys/dev/msk/if_msk.c	Tue Mar 23 21:49:33 2010	(r205541)
+++ stable/8/sys/dev/msk/if_msk.c	Tue Mar 23 21:51:31 2010	(r205542)
@@ -393,12 +393,6 @@ static struct resource_spec msk_irq_spec
 	{ -1,			0,		0 }
 };
 
-static struct resource_spec msk_irq_spec_msi2[] = {
-	{ SYS_RES_IRQ,		1,		RF_ACTIVE },
-	{ SYS_RES_IRQ,		2,		RF_ACTIVE },
-	{ -1,			0,		0 }
-};
-
 static int
 msk_miibus_readreg(device_t dev, int phy, int reg)
 {
@@ -538,28 +532,25 @@ msk_miibus_statchg(device_t dev)
 			break;
 		}
 
-		if (((mii->mii_media_active & IFM_GMASK) & IFM_FDX) != 0)
-			gmac |= GM_GPCR_DUP_FULL;
 		/* Disable Rx flow control. */
-		if (((mii->mii_media_active & IFM_GMASK) & IFM_FLAG0) == 0)
+		if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) == 0)
 			gmac |= GM_GPCR_FC_RX_DIS;
 		/* Disable Tx flow control. */
-		if (((mii->mii_media_active & IFM_GMASK) & IFM_FLAG1) == 0)
+		if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG1) == 0)
 			gmac |= GM_GPCR_FC_TX_DIS;
+		if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
+			gmac |= GM_GPCR_DUP_FULL;
+		else
+			gmac |= GM_GPCR_FC_RX_DIS | GM_GPCR_FC_TX_DIS;
 		gmac |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA;
 		GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac);
 		/* Read again to ensure writing. */
 		GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
-
-		gmac = GMC_PAUSE_ON;
-		if (((mii->mii_media_active & IFM_GMASK) &
-		    (IFM_FLAG0 | IFM_FLAG1)) == 0)
-			gmac = GMC_PAUSE_OFF;
-		/* Diable pause for 10/100 Mbps in half-duplex mode. */
-		if ((((mii->mii_media_active & IFM_GMASK) & IFM_FDX) == 0) &&
-		    (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX ||
-		    IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T))
-			gmac = GMC_PAUSE_OFF;
+		gmac = GMC_PAUSE_OFF;
+		if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) {
+			if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) != 0)
+				gmac = GMC_PAUSE_ON;
+		}
 		CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), gmac);
 
 		/* Enable PHY interrupt for FIFO underrun/overflow. */
@@ -738,6 +729,7 @@ msk_init_tx_ring(struct msk_if_softc *sc
 	int i;
 
 	sc_if->msk_cdata.msk_tso_mtu = 0;
+	sc_if->msk_cdata.msk_last_csum = 0;
 	sc_if->msk_cdata.msk_tx_prod = 0;
 	sc_if->msk_cdata.msk_tx_cons = 0;
 	sc_if->msk_cdata.msk_tx_cnt = 0;
@@ -1355,35 +1347,22 @@ mskc_reset(struct msk_softc *sc)
          * On dual port PCI-X card, there is an problem where status
          * can be received out of order due to split transactions.
          */
-	if (sc->msk_bustype == MSK_PCIX_BUS && sc->msk_num_port > 1) {
-		int pcix;
+	if (sc->msk_pcixcap != 0 && sc->msk_num_port > 1) {
 		uint16_t pcix_cmd;
 
-		if (pci_find_extcap(sc->msk_dev, PCIY_PCIX, &pcix) == 0) {
-			pcix_cmd = pci_read_config(sc->msk_dev, pcix + 2, 2);
-			/* Clear Max Outstanding Split Transactions. */
-			pcix_cmd &= ~0x70;
-			CSR_WRITE_1(sc, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-			pci_write_config(sc->msk_dev, pcix + 2, pcix_cmd, 2);
-			CSR_WRITE_1(sc, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-		}
+		pcix_cmd = pci_read_config(sc->msk_dev,
+		    sc->msk_pcixcap + PCIXR_COMMAND, 2);
+		/* Clear Max Outstanding Split Transactions. */
+		pcix_cmd &= ~PCIXM_COMMAND_MAX_SPLITS;
+		CSR_WRITE_1(sc, B2_TST_CTRL1, TST_CFG_WRITE_ON);
+		pci_write_config(sc->msk_dev,
+		    sc->msk_pcixcap + PCIXR_COMMAND, pcix_cmd, 2);
+		CSR_WRITE_1(sc, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
         }
-	if (sc->msk_bustype == MSK_PEX_BUS) {
-		uint16_t v, width;
-
-		v = pci_read_config(sc->msk_dev, PEX_DEV_CTRL, 2);
-		/* Change Max. Read Request Size to 4096 bytes. */
-		v &= ~PEX_DC_MAX_RRS_MSK;
-		v |= PEX_DC_MAX_RD_RQ_SIZE(5);
-		pci_write_config(sc->msk_dev, PEX_DEV_CTRL, v, 2);
-		width = pci_read_config(sc->msk_dev, PEX_LNK_STAT, 2);
-		width = (width & PEX_LS_LINK_WI_MSK) >> 4;
-		v = pci_read_config(sc->msk_dev, PEX_LNK_CAP, 2);
-		v = (v & PEX_LS_LINK_WI_MSK) >> 4;
-		if (v != width)
-			device_printf(sc->msk_dev,
-			    "negotiated width of link(x%d) != "
-			    "max. width of link(x%d)\n", width, v); 
+	if (sc->msk_expcap != 0) {
+		/* Change Max. Read Request Size to 2048 bytes. */
+		if (pci_get_max_read_req(sc->msk_dev) == 512)
+			pci_set_max_read_req(sc->msk_dev, 2048);
 	}
 
 	/* Clear status list. */
@@ -1521,7 +1500,7 @@ msk_attach(device_t dev)
 	 * Enable Rx checksum offloading if controller support new
 	 * descriptor format.
 	 */
-	if ((sc_if->msk_flags & MSK_FLAG_DESCV2) != 0 && 
+	if ((sc_if->msk_flags & MSK_FLAG_DESCV2) != 0 &&
 	    (sc_if->msk_flags & MSK_FLAG_NORX_CSUM) == 0)
 		ifp->if_capabilities |= IFCAP_RXCSUM;
 	ifp->if_hwassist = MSK_CSUM_FEATURES | CSUM_TSO;
@@ -1571,7 +1550,7 @@ msk_attach(device_t dev)
 		 * Enable Rx checksum offloading for VLAN taggedd frames
 		 * if controller support new descriptor format.
 		 */
-		if ((sc_if->msk_flags & MSK_FLAG_DESCV2) != 0 && 
+		if ((sc_if->msk_flags & MSK_FLAG_DESCV2) != 0 &&
 		    (sc_if->msk_flags & MSK_FLAG_NORX_CSUM) == 0)
 			ifp->if_capabilities |= IFCAP_VLAN_HWCSUM;
 	}
@@ -1695,11 +1674,13 @@ mskc_attach(device_t dev)
 	}
 
 	/* Check bus type. */
-	if (pci_find_extcap(sc->msk_dev, PCIY_EXPRESS, ®) == 0)
+	if (pci_find_extcap(sc->msk_dev, PCIY_EXPRESS, ®) == 0) {
 		sc->msk_bustype = MSK_PEX_BUS;
-	else if (pci_find_extcap(sc->msk_dev, PCIY_PCIX, ®) == 0)
+		sc->msk_expcap = reg;
+	} else if (pci_find_extcap(sc->msk_dev, PCIY_PCIX, ®) == 0) {
 		sc->msk_bustype = MSK_PCIX_BUS;
-	else
+		sc->msk_pcixcap = reg;
+	} else
 		sc->msk_bustype = MSK_PCI_BUS;
 
 	switch (sc->msk_hw_id) {
@@ -1769,37 +1750,16 @@ mskc_attach(device_t dev)
 	msic = pci_msi_count(dev);
 	if (bootverbose)
 		device_printf(dev, "MSI count : %d\n", msic);
-	/*
-	 * The Yukon II reports it can handle two messages, one for each
-	 * possible port.  We go ahead and allocate two messages and only
-	 * setup a handler for both if we have a dual port card.
-	 *
-	 * XXX: I haven't untangled the interrupt handler to handle dual
-	 * port cards with separate MSI messages, so for now I disable MSI
-	 * on dual port cards.
-	 */
 	if (legacy_intr != 0)
 		msi_disable = 1;
-	if (msi_disable == 0) {
-		switch (msic) {
-		case 2:
-		case 1: /* 88E8058 reports 1 MSI message */
-			msir = msic;
-			if (sc->msk_num_port == 1 &&
-			    pci_alloc_msi(dev, &msir) == 0) {
-				if (msic == msir) {
-					sc->msk_pflags |= MSK_FLAG_MSI;
-					sc->msk_irq_spec = msic == 2 ?
-					    msk_irq_spec_msi2 :
-					    msk_irq_spec_msi;
-				} else
-					pci_release_msi(dev);
-			}
-			break;
-		default:
-			device_printf(dev,
-			    "Unexpected number of MSI messages : %d\n", msic);
-			break;
+	if (msi_disable == 0 && msic > 0) {
+		msir = 1;
+		if (pci_alloc_msi(dev, &msir) == 0) {
+			if (msir == 1) {
+				sc->msk_pflags |= MSK_FLAG_MSI;
+				sc->msk_irq_spec = msk_irq_spec_msi;
+			} else
+				pci_release_msi(dev);
 		}
 	}
 
@@ -1873,7 +1833,7 @@ mskc_attach(device_t dev)
 	if (legacy_intr)
 		error = bus_setup_intr(dev, sc->msk_irq[0], INTR_TYPE_NET |
 		    INTR_MPSAFE, NULL, msk_legacy_intr, sc,
-		    &sc->msk_intrhand[0]);
+		    &sc->msk_intrhand);
 	else {
 		TASK_INIT(&sc->msk_int_task, 0, msk_int_task, sc);
 		sc->msk_tq = taskqueue_create_fast("msk_taskq", M_WAITOK,
@@ -1881,7 +1841,7 @@ mskc_attach(device_t dev)
 		taskqueue_start_threads(&sc->msk_tq, 1, PI_NET, "%s taskq",
 		    device_get_nameunit(sc->msk_dev));
 		error = bus_setup_intr(dev, sc->msk_irq[0], INTR_TYPE_NET |
-		    INTR_MPSAFE, msk_intr, NULL, sc, &sc->msk_intrhand[0]);
+		    INTR_MPSAFE, msk_intr, NULL, sc, &sc->msk_intrhand);
 	}
 
 	if (error != 0) {
@@ -1995,13 +1955,9 @@ mskc_detach(device_t dev)
 		taskqueue_free(sc->msk_tq);
 		sc->msk_tq = NULL;
 	}
-	if (sc->msk_intrhand[0]) {
-		bus_teardown_intr(dev, sc->msk_irq[0], sc->msk_intrhand[0]);
-		sc->msk_intrhand[0] = NULL;
-	}
-	if (sc->msk_intrhand[1]) {
-		bus_teardown_intr(dev, sc->msk_irq[0], sc->msk_intrhand[0]);
-		sc->msk_intrhand[1] = NULL;
+	if (sc->msk_intrhand) {
+		bus_teardown_intr(dev, sc->msk_irq[0], sc->msk_intrhand);
+		sc->msk_intrhand = NULL;
 	}
 	bus_release_resources(dev, sc->msk_irq_spec, sc->msk_irq);
 	if ((sc->msk_pflags & MSK_FLAG_MSI) != 0)
@@ -2532,7 +2488,7 @@ msk_encap(struct msk_if_softc *sc_if, st
 	struct mbuf *m;
 	bus_dmamap_t map;
 	bus_dma_segment_t txsegs[MSK_MAXTXSEGS];
-	uint32_t control, prod, si;
+	uint32_t control, csum, prod, si;
 	uint16_t offset, tcp_offset, tso_mtu;
 	int error, i, nseg, tso;
 
@@ -2711,17 +2667,22 @@ msk_encap(struct msk_if_softc *sc_if, st
 		if ((sc_if->msk_flags & MSK_FLAG_AUTOTX_CSUM) != 0)
 			control |= CALSUM;
 		else {
-			tx_le = &sc_if->msk_rdata.msk_tx_ring[prod];
-			tx_le->msk_addr = htole32(((tcp_offset +
-			    m->m_pkthdr.csum_data) & 0xffff) |
-			    ((uint32_t)tcp_offset << 16));
-			tx_le->msk_control = htole32(1 << 16 |
-			    (OP_TCPLISW | HW_OWNER));
-			control = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
+			control |= CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
 			if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0)
 				control |= UDPTCP;
-			sc_if->msk_cdata.msk_tx_cnt++;
-			MSK_INC(prod, MSK_TX_RING_CNT);
+			/* Checksum write position. */
+			csum = (tcp_offset + m->m_pkthdr.csum_data) & 0xffff;
+			/* Checksum start position. */
+			csum |= (uint32_t)tcp_offset << 16;
+			if (csum != sc_if->msk_cdata.msk_last_csum) {
+				tx_le = &sc_if->msk_rdata.msk_tx_ring[prod];
+				tx_le->msk_addr = htole32(csum);
+				tx_le->msk_control = htole32(1 << 16 |
+				    (OP_TCPLISW | HW_OWNER));
+				sc_if->msk_cdata.msk_tx_cnt++;
+				MSK_INC(prod, MSK_TX_RING_CNT);
+				sc_if->msk_cdata.msk_last_csum = csum;
+			}
 		}
 	}
 
@@ -3414,7 +3375,6 @@ msk_handle_events(struct msk_softc *sc)
 	/* Sync status LEs. */
 	bus_dmamap_sync(sc->msk_stat_tag, sc->msk_stat_map,
 	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
-	/* XXX Sync Rx LEs here. */
 
 	rxput[MSK_PORT_A] = rxput[MSK_PORT_B] = 0;
 
@@ -3424,13 +3384,6 @@ msk_handle_events(struct msk_softc *sc)
 		control = le32toh(sd->msk_control);
 		if ((control & HW_OWNER) == 0)
 			break;
-		/*
-		 * Marvell's FreeBSD driver updates status LE after clearing
-		 * HW_OWNER. However we don't have a way to sync single LE
-		 * with bus_dma(9) API. bus_dma(9) provides a way to sync
-		 * an entire DMA map. So don't sync LE until we have a better
-		 * way to sync LEs.
-		 */
 		control &= ~HW_OWNER;
 		sd->msk_control = htole32(control);
 		status = le32toh(sd->msk_status);
@@ -3491,7 +3444,8 @@ msk_handle_events(struct msk_softc *sc)
 	}
 
 	sc->msk_stat_cons = cons;
-	/* XXX We should sync status LEs here. See above notes. */
+	bus_dmamap_sync(sc->msk_stat_tag, sc->msk_stat_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	if (rxput[MSK_PORT_A] > 0)
 		msk_rxput(sc->msk_if[MSK_PORT_A]);
@@ -3757,7 +3711,7 @@ msk_init_locked(struct msk_if_softc *sc_
 		CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL),
 		    GMC_BYP_MACSECRX_ON | GMC_BYP_MACSECTX_ON |
 		    GMC_BYP_RETR_ON);
- 
+
 	/*
 	 * Initialize GMAC first such that speed/duplex/flow-control
 	 * parameters are renegotiated when interface is brought up.
@@ -3805,7 +3759,7 @@ msk_init_locked(struct msk_if_softc *sc_
 	    eaddr[2] | (eaddr[3] << 8));
 	GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2H,
 	    eaddr[4] | (eaddr[5] << 8));
-	
+
 	/* Disable interrupts for counter overflows. */
 	GMAC_WRITE_2(sc, sc_if->msk_port, GM_TX_IRQ_MSK, 0);
 	GMAC_WRITE_2(sc, sc_if->msk_port, GM_RX_IRQ_MSK, 0);

Modified: stable/8/sys/dev/msk/if_mskreg.h
==============================================================================
--- stable/8/sys/dev/msk/if_mskreg.h	Tue Mar 23 21:49:33 2010	(r205541)
+++ stable/8/sys/dev/msk/if_mskreg.h	Tue Mar 23 21:51:31 2010	(r205542)
@@ -2361,6 +2361,7 @@ struct msk_chain_data {
 	bus_dmamap_t		msk_jumbo_rx_ring_map;
 	bus_dmamap_t		msk_jumbo_rx_sparemap;
 	uint16_t		msk_tso_mtu;
+	uint32_t		msk_last_csum;
 	int			msk_tx_prod;
 	int			msk_tx_cons;
 	int			msk_tx_cnt;
@@ -2467,14 +2468,16 @@ struct msk_hw_stats {
 struct msk_softc {
 	struct resource		*msk_res[1];	/* I/O resource */
 	struct resource_spec	*msk_res_spec;
-	struct resource		*msk_irq[2];	/* IRQ resources */
+	struct resource		*msk_irq[1];	/* IRQ resources */
 	struct resource_spec	*msk_irq_spec;
-	void			*msk_intrhand[2]; /* irq handler handle */
+	void			*msk_intrhand; /* irq handler handle */
 	device_t		msk_dev;
 	uint8_t			msk_hw_id;
 	uint8_t			msk_hw_rev;
 	uint8_t			msk_bustype;
 	uint8_t			msk_num_port;
+	int			msk_expcap;
+	int			msk_pcixcap;
 	int			msk_ramsize;	/* amount of SRAM on NIC */
 	uint32_t		msk_pmd;	/* physical media type */
 	uint32_t		msk_intrmask;

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 22:04:18 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B180D106566B;
	Tue, 23 Mar 2010 22:04:18 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9F4108FC20;
	Tue, 23 Mar 2010 22:04: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 o2NM4Ilq000879;
	Tue, 23 Mar 2010 22:04:18 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NM4IbQ000877;
	Tue, 23 Mar 2010 22:04:18 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003232204.o2NM4IbQ000877@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 22:04: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: r205544 - stable/8/sys/dev/bce
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 22:04:18 -0000

Author: yongari
Date: Tue Mar 23 22:04:18 2010
New Revision: 205544
URL: http://svn.freebsd.org/changeset/base/205544

Log:
  MFC r204368,204370-204372:
  r204368:
    Allow disabling VLAN hardware tag stripping with software work
    around. Management firmware(ASF/IPMI/UMP) requires the VLAN
    hardware tag stripping so don't actually disable VLAN hardware tag
    stripping. If VLAN hardware tag stripping was disabled, bce(4)
    manually reconstruct VLAN frame by appending stripped VLAN tag.
    Also remove unnecessary IFCAP_VLAN_MTU message.
  
  r204370:
    Make sure to stop controller first before changing MTU. And if
    interface is not running don't initialize controller.
    While here remove unnecessary update of error variable.
  
  r204371:
    Make toggling TSO, VLAN hardware checksum offloading work. Also fix
    TX/RX checksum handler to set/clear relavant assist bits which was
    used to cause unexpected results.
    With this change, bce(4) can be bridged with other interfaces that
    lack TSO, VLAN checksum offloading.
  
  r204372:
    Prefer m_collapse(9) over m_defrag(9).

Modified:
  stable/8/sys/dev/bce/if_bce.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/bce/if_bce.c
==============================================================================
--- stable/8/sys/dev/bce/if_bce.c	Tue Mar 23 21:56:07 2010	(r205543)
+++ stable/8/sys/dev/bce/if_bce.c	Tue Mar 23 22:04:18 2010	(r205544)
@@ -5886,6 +5886,7 @@ bce_rx_intr(struct bce_softc *sc)
 {
 	struct ifnet *ifp = sc->bce_ifp;
 	struct l2_fhdr *l2fhdr;
+	struct ether_vlan_header *vh;
 	unsigned int pkt_len;
 	u16 sw_rx_cons, sw_rx_cons_idx, hw_rx_cons;
 	u32 status;
@@ -6141,12 +6142,37 @@ bce_rx_intr(struct bce_softc *sc)
 
 		/* Attach the VLAN tag.	*/
 		if (status & L2_FHDR_STATUS_L2_VLAN_TAG) {
+			if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) {
 #if __FreeBSD_version < 700000
-			VLAN_INPUT_TAG(ifp, m0, l2fhdr->l2_fhdr_vlan_tag, continue);
+				VLAN_INPUT_TAG(ifp, m0,
+				    l2fhdr->l2_fhdr_vlan_tag, continue);
 #else
-			m0->m_pkthdr.ether_vtag = l2fhdr->l2_fhdr_vlan_tag;
-			m0->m_flags |= M_VLANTAG;
+				m0->m_pkthdr.ether_vtag =
+				    l2fhdr->l2_fhdr_vlan_tag;
+				m0->m_flags |= M_VLANTAG;
 #endif
+			} else {
+				/*
+				 * bce(4) controllers can't disable VLAN
+				 * tag stripping if management firmware
+				 * (ASF/IPMI/UMP) is running. So we always
+				 * strip VLAN tag and manually reconstruct
+				 * the VLAN frame by appending stripped
+				 * VLAN tag in driver if VLAN tag stripping
+				 * was disabled.
+				 *
+				 * TODO: LLC SNAP handling.
+				 */
+				bcopy(mtod(m0, uint8_t *),
+				    mtod(m0, uint8_t *) - ETHER_VLAN_ENCAP_LEN,
+				    ETHER_ADDR_LEN * 2);
+				m0->m_data -= ETHER_VLAN_ENCAP_LEN;
+				vh = mtod(m0, struct ether_vlan_header *);
+				vh->evl_encap_proto = htons(ETHERTYPE_VLAN);
+				vh->evl_tag = htons(l2fhdr->l2_fhdr_vlan_tag);
+				m0->m_pkthdr.len += ETHER_VLAN_ENCAP_LEN;
+				m0->m_len += ETHER_VLAN_ENCAP_LEN;
+			}
 		}
 
 		/* Increment received packet statistics. */
@@ -6687,7 +6713,7 @@ bce_tx_encap_skip_tso:
 		sc->fragmented_mbuf_count++;
 
 		/* Try to defrag the mbuf. */
-		m0 = m_defrag(*m_head, M_DONTWAIT);
+		m0 = m_collapse(*m_head, M_DONTWAIT, BCE_MAX_SEGMENTS);
 		if (m0 == NULL) {
 			/* Defrag was unsuccessful */
 			m_freem(*m_head);
@@ -6963,7 +6989,7 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 	struct bce_softc *sc = ifp->if_softc;
 	struct ifreq *ifr = (struct ifreq *) data;
 	struct mii_data *mii;
-	int mask, error = 0;
+	int mask, error = 0, reinit;
 
 	DBENTER(BCE_VERBOSE_MISC);
 
@@ -6984,7 +7010,16 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 
 			BCE_LOCK(sc);
 			ifp->if_mtu = ifr->ifr_mtu;
-			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+			reinit = 0;
+			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+				/*
+				 * Because allocation size is used in RX
+				 * buffer allocation, stop controller if
+				 * it is already running.
+				 */
+				bce_stop(sc);
+				reinit = 1;
+			}
 #ifdef BCE_JUMBO_HDRSPLIT
 			/* No buffer allocation size changes are necessary. */
 #else
@@ -7002,7 +7037,8 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 			}
 #endif
 
-			bce_init_locked(sc);
+			if (reinit != 0)
+				bce_init_locked(sc);
 			BCE_UNLOCK(sc);
 			break;
 
@@ -7036,7 +7072,6 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 			}
 
 			BCE_UNLOCK(sc);
-			error = 0;
 
 			break;
 
@@ -7046,10 +7081,8 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 			DBPRINT(sc, BCE_VERBOSE_MISC, "Received SIOCADDMULTI/SIOCDELMULTI\n");
 
 			BCE_LOCK(sc);
-			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 				bce_set_rx_mode(sc);
-				error = 0;
-			}
 			BCE_UNLOCK(sc);
 
 			break;
@@ -7069,50 +7102,46 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 			mask = ifr->ifr_reqcap ^ ifp->if_capenable;
 			DBPRINT(sc, BCE_INFO_MISC, "Received SIOCSIFCAP = 0x%08X\n", (u32) mask);
 
-			/* Toggle the TX checksum capabilites enable flag. */
-			if (mask & IFCAP_TXCSUM) {
+			/* Toggle the TX checksum capabilities enable flag. */
+			if (mask & IFCAP_TXCSUM &&
+			    ifp->if_capabilities & IFCAP_TXCSUM) {
 				ifp->if_capenable ^= IFCAP_TXCSUM;
 				if (IFCAP_TXCSUM & ifp->if_capenable)
-					ifp->if_hwassist = BCE_IF_HWASSIST;
+					ifp->if_hwassist |= BCE_IF_HWASSIST;
 				else
-					ifp->if_hwassist = 0;
+					ifp->if_hwassist &= ~BCE_IF_HWASSIST;
 			}
 
 			/* Toggle the RX checksum capabilities enable flag. */
-			if (mask & IFCAP_RXCSUM) {
+			if (mask & IFCAP_RXCSUM &&
+			    ifp->if_capabilities & IFCAP_RXCSUM)
 				ifp->if_capenable ^= IFCAP_RXCSUM;
-				if (IFCAP_RXCSUM & ifp->if_capenable)
-					ifp->if_hwassist = BCE_IF_HWASSIST;
-				else
-					ifp->if_hwassist = 0;
-			}
 
 			/* Toggle the TSO capabilities enable flag. */
-			if (bce_tso_enable && (mask & IFCAP_TSO4)) {
+			if (bce_tso_enable && (mask & IFCAP_TSO4) &&
+			    ifp->if_capabilities & IFCAP_TSO4) {
 				ifp->if_capenable ^= IFCAP_TSO4;
-				if (IFCAP_RXCSUM & ifp->if_capenable)
-					ifp->if_hwassist = BCE_IF_HWASSIST;
+				if (IFCAP_TSO4 & ifp->if_capenable)
+					ifp->if_hwassist |= CSUM_TSO;
 				else
-					ifp->if_hwassist = 0;
+					ifp->if_hwassist &= ~CSUM_TSO;
 			}
 
-			/* Toggle VLAN_MTU capabilities enable flag. */
-			if (mask & IFCAP_VLAN_MTU) {
-				BCE_PRINTF("%s(%d): Changing VLAN_MTU not supported.\n",
-					__FILE__, __LINE__);
-			}
-
-			/* Toggle VLANHWTAG capabilities enabled flag. */
-			if (mask & IFCAP_VLAN_HWTAGGING) {
-				if (sc->bce_flags & BCE_MFW_ENABLE_FLAG)
-					BCE_PRINTF("%s(%d): Cannot change VLAN_HWTAGGING while "
-						"management firmware (ASF/IPMI/UMP) is running!\n",
-						__FILE__, __LINE__);
-				else
-					BCE_PRINTF("%s(%d): Changing VLAN_HWTAGGING not supported!\n",
-						__FILE__, __LINE__);
-			}
+			if (mask & IFCAP_VLAN_HWCSUM &&
+			    ifp->if_capabilities & IFCAP_VLAN_HWCSUM)
+				ifp->if_capenable ^= IFCAP_VLAN_HWCSUM;
 
+			/*
+			 * Don't actually disable VLAN tag stripping as
+			 * management firmware (ASF/IPMI/UMP) requires the
+			 * feature. If VLAN tag stripping is disabled driver
+			 * will manually reconstruct the VLAN frame by
+			 * appending stripped VLAN tag.
+			 */
+			if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
+			    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING))
+				ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
+			VLAN_CAPABILITIES(ifp);
 			break;
 		default:
 			/* We don't know how to handle the IOCTL, pass it on. */

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 22:11:40 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 47258106564A;
	Tue, 23 Mar 2010 22:11:40 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 34F438FC16;
	Tue, 23 Mar 2010 22:11: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 o2NMBeIN002805;
	Tue, 23 Mar 2010 22:11:40 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NMBekC002803;
	Tue, 23 Mar 2010 22:11:40 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003232211.o2NMBekC002803@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 22:11: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: r205547 - stable/8/sys/dev/bce
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 22:11:40 -0000

Author: yongari
Date: Tue Mar 23 22:11:39 2010
New Revision: 205547
URL: http://svn.freebsd.org/changeset/base/205547

Log:
  MFC r204373-204374:
  r204373:
    Move TSO setup to new function bce_tso_setup(). Also remove VLAN
    parsing code in TSO path as the controller requires VLAN hardware
    tagging to make TSO work over VLANs.
    While parsing the mbuf in TSO patch, always perform check for
    writable mbuf as bce(4) have to reset IP length and IP checksum
    field of IP header and make sure to ensure contiguous buffer before
    accessing IP/TCP headers. While I'm here replace magic number 40 to
    more readable sizeof(struct ip) + sizeof(struct tcphdr).
  
  r204374:
    Add TSO support on VLANs. bce(4) controllers require VLAN hardware
    tagging to make TSO work on VLANs so explicitly disable TSO on VLAN
    if VLAN hardware tagging is disabled.

Modified:
  stable/8/sys/dev/bce/if_bce.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/bce/if_bce.c
==============================================================================
--- stable/8/sys/dev/bce/if_bce.c	Tue Mar 23 22:06:59 2010	(r205546)
+++ stable/8/sys/dev/bce/if_bce.c	Tue Mar 23 22:11:39 2010	(r205547)
@@ -403,6 +403,7 @@ static void bce_fill_pg_chain		(struct b
 static void bce_free_pg_chain		(struct bce_softc *);
 #endif
 
+static struct mbuf *bce_tso_setup	(struct bce_softc *, struct mbuf **, u16 *);
 static int  bce_tx_encap			(struct bce_softc *, struct mbuf **);
 static void bce_start_locked		(struct ifnet *);
 static void bce_start				(struct ifnet *);
@@ -1057,7 +1058,8 @@ bce_attach(device_t dev)
 
 	if (bce_tso_enable) {
 		ifp->if_hwassist = BCE_IF_HWASSIST | CSUM_TSO;
-		ifp->if_capabilities = BCE_IF_CAPABILITIES | IFCAP_TSO4;
+		ifp->if_capabilities = BCE_IF_CAPABILITIES | IFCAP_TSO4 |
+		    IFCAP_VLAN_HWTSO;
 	} else {
 		ifp->if_hwassist = BCE_IF_HWASSIST;
 		ifp->if_capabilities = BCE_IF_CAPABILITIES;
@@ -6585,6 +6587,110 @@ bce_init(void *xsc)
 }
 
 
+static struct mbuf *
+bce_tso_setup(struct bce_softc *sc, struct mbuf **m_head, u16 *flags)
+{
+	struct mbuf *m;
+	struct ether_header *eh;
+	struct ip *ip;
+	struct tcphdr *th;
+	u16 etype;
+	int hdr_len, ip_hlen = 0, tcp_hlen = 0, ip_len = 0;
+
+	DBRUN(sc->requested_tso_frames++);
+	/* Controller requires to monify mbuf chains. */
+	if (M_WRITABLE(*m_head) == 0) {
+		m = m_dup(*m_head, M_DONTWAIT);
+		m_freem(*m_head);
+		if (m == NULL) {
+			sc->mbuf_alloc_failed_count++;
+			*m_head = NULL;
+			return (NULL);
+		}
+		*m_head = m;
+	}
+	/*
+	 * For TSO the controller needs two pieces of info,
+	 * the MSS and the IP+TCP options length.
+	 */
+	m = m_pullup(*m_head, sizeof(struct ether_header) + sizeof(struct ip));
+	if (m == NULL) {
+		*m_head = NULL;
+		return (NULL);
+	}
+	eh = mtod(m, struct ether_header *);
+	etype = ntohs(eh->ether_type);
+
+	/* Check for supported TSO Ethernet types (only IPv4 for now) */
+	switch (etype) {
+	case ETHERTYPE_IP:
+		ip = (struct ip *)(m->m_data + sizeof(struct ether_header));
+		/* TSO only supported for TCP protocol. */
+		if (ip->ip_p != IPPROTO_TCP) {
+			BCE_PRINTF("%s(%d): TSO enabled for non-TCP frame!.\n",
+			    __FILE__, __LINE__);
+			m_freem(*m_head);
+			*m_head = NULL;
+			return (NULL);
+		}
+
+		/* Get IP header length in bytes (min 20) */
+		ip_hlen = ip->ip_hl << 2;
+		m = m_pullup(*m_head, sizeof(struct ether_header) + ip_hlen +
+		    sizeof(struct tcphdr));
+		if (m == NULL) {
+			*m_head = NULL;
+			return (NULL);
+		}
+
+		/* Get the TCP header length in bytes (min 20) */
+		th = (struct tcphdr *)((caddr_t)ip + ip_hlen);
+		tcp_hlen = (th->th_off << 2);
+
+		/* Make sure all IP/TCP options live in the same buffer. */
+		m = m_pullup(*m_head,  sizeof(struct ether_header)+ ip_hlen +
+		    tcp_hlen);
+		if (m == NULL) {
+			*m_head = NULL;
+			return (NULL);
+		}
+
+		/* IP header length and checksum will be calc'd by hardware */
+		ip_len = ip->ip_len;
+		ip->ip_len = 0;
+		ip->ip_sum = 0;
+		break;
+	case ETHERTYPE_IPV6:
+		BCE_PRINTF("%s(%d): TSO over IPv6 not supported!.\n",
+		    __FILE__, __LINE__);
+		m_freem(*m_head);
+		*m_head = NULL;
+		return (NULL);
+		/* NOT REACHED */
+	default:
+		BCE_PRINTF("%s(%d): TSO enabled for unsupported protocol!.\n",
+		    __FILE__, __LINE__);
+		m_freem(*m_head);
+		*m_head = NULL;
+		return (NULL);
+	}
+
+	hdr_len = sizeof(struct ether_header) + ip_hlen + tcp_hlen;
+
+	DBPRINT(sc, BCE_EXTREME_SEND, "%s(): hdr_len = %d, e_hlen = %d, "
+	    "ip_hlen = %d, tcp_hlen = %d, ip_len = %d\n",
+	    __FUNCTION__, hdr_len, sizeof(struct ether_header), ip_hlen,
+	    tcp_hlen, ip_len);
+
+	/* Set the LSO flag in the TX BD */
+	*flags |= TX_BD_FLAGS_SW_LSO;
+	/* Set the length of IP + TCP options (in 32 bit words) */
+	*flags |= (((ip_hlen + tcp_hlen - sizeof(struct ip) -
+	    sizeof(struct tcphdr)) >> 2) << 8);
+	return (*m_head);
+}
+
+
 /****************************************************************************/
 /* Encapsultes an mbuf cluster into the tx_bd chain structure and makes the */
 /* memory visible to the controller.                                        */
@@ -6601,12 +6707,8 @@ bce_tx_encap(struct bce_softc *sc, struc
 	bus_dmamap_t map;
 	struct tx_bd *txbd = NULL;
 	struct mbuf *m0;
-	struct ether_vlan_header *eh;
-	struct ip *ip;
-	struct tcphdr *th;
-	u16 prod, chain_prod, etype, mss = 0, vlan_tag = 0, flags = 0;
+	u16 prod, chain_prod, mss = 0, vlan_tag = 0, flags = 0;
 	u32 prod_bseq;
-	int hdr_len = 0, e_hlen = 0, ip_hlen = 0, tcp_hlen = 0, ip_len = 0;
 
 #ifdef BCE_DEBUG
 	u16 debug_prod;
@@ -6623,72 +6725,16 @@ bce_tx_encap(struct bce_softc *sc, struc
 	/* Transfer any checksum offload flags to the bd. */
 	m0 = *m_head;
 	if (m0->m_pkthdr.csum_flags) {
-		if (m0->m_pkthdr.csum_flags & CSUM_IP)
-			flags |= TX_BD_FLAGS_IP_CKSUM;
-		if (m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP))
-			flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
 		if (m0->m_pkthdr.csum_flags & CSUM_TSO) {
-			/* For TSO the controller needs two pieces of info, */
-			/* the MSS and the IP+TCP options length.           */
+			m0 = bce_tso_setup(sc, m_head, &flags);
+			if (m0 == NULL)
+				goto bce_tx_encap_exit;
 			mss = htole16(m0->m_pkthdr.tso_segsz);
-
-			/* Map the header and find the Ethernet type & header length */
-			eh = mtod(m0, struct ether_vlan_header *);
-			if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) {
-				etype = ntohs(eh->evl_proto);
-				e_hlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
-			} else {
-				etype = ntohs(eh->evl_encap_proto);
-				e_hlen = ETHER_HDR_LEN;
-			}
-
-			/* Check for supported TSO Ethernet types (only IPv4 for now) */
-			switch (etype) {
-				case ETHERTYPE_IP:
-					ip = (struct ip *)(m0->m_data + e_hlen);
-
-					/* TSO only supported for TCP protocol */
-					if (ip->ip_p != IPPROTO_TCP) {
-						BCE_PRINTF("%s(%d): TSO enabled for non-TCP frame!.\n",
-							__FILE__, __LINE__);
-						goto bce_tx_encap_skip_tso;
-					}
-
-					/* Get IP header length in bytes (min 20) */
-					ip_hlen = ip->ip_hl << 2;
-
-					/* Get the TCP header length in bytes (min 20) */
-					th = (struct tcphdr *)((caddr_t)ip + ip_hlen);
-					tcp_hlen = (th->th_off << 2);
-
-					/* IP header length and checksum will be calc'd by hardware */
-					ip_len = ip->ip_len;
-					ip->ip_len = 0;
-					ip->ip_sum = 0;
-					break;
-				case ETHERTYPE_IPV6:
-					BCE_PRINTF("%s(%d): TSO over IPv6 not supported!.\n",
-						__FILE__, __LINE__);
-					goto bce_tx_encap_skip_tso;
-				default:
-					BCE_PRINTF("%s(%d): TSO enabled for unsupported protocol!.\n",
-						__FILE__, __LINE__);
-					goto bce_tx_encap_skip_tso;
-			}
-
-			hdr_len = e_hlen + ip_hlen + tcp_hlen;
-
-			DBPRINT(sc, BCE_EXTREME_SEND,
-				"%s(): hdr_len = %d, e_hlen = %d, ip_hlen = %d, tcp_hlen = %d, ip_len = %d\n",
-				 __FUNCTION__, hdr_len, e_hlen, ip_hlen, tcp_hlen, ip_len);
-
-			/* Set the LSO flag in the TX BD */
-			flags |= TX_BD_FLAGS_SW_LSO;
-			/* Set the length of IP + TCP options (in 32 bit words) */
-			flags |= (((ip_hlen + tcp_hlen - 40) >> 2) << 8);
-
-bce_tx_encap_skip_tso:
-			DBRUN(sc->requested_tso_frames++);
+		} else {
+			if (m0->m_pkthdr.csum_flags & CSUM_IP)
+				flags |= TX_BD_FLAGS_IP_CKSUM;
+			if (m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP))
+				flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
 		}
 	}
 
@@ -7131,6 +7177,9 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 			    ifp->if_capabilities & IFCAP_VLAN_HWCSUM)
 				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;
 			/*
 			 * Don't actually disable VLAN tag stripping as
 			 * management firmware (ASF/IPMI/UMP) requires the
@@ -7139,8 +7188,12 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 			 * appending stripped VLAN tag.
 			 */
 			if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
-			    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING))
+			    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING)) {
 				ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
+				if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
+				    == 0)
+					ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
+			}
 			VLAN_CAPABILITIES(ifp);
 			break;
 		default:

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 22:16:12 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD8EA106566C;
	Tue, 23 Mar 2010 22:16: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 BC26B8FC0A;
	Tue, 23 Mar 2010 22:16: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 o2NMGC6Y003984;
	Tue, 23 Mar 2010 22:16:12 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NMGCLQ003982;
	Tue, 23 Mar 2010 22:16:12 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003232216.o2NMGCLQ003982@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 22:16: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: r205549 - stable/8/sys/dev/bge
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 22:16:12 -0000

Author: yongari
Date: Tue Mar 23 22:16:12 2010
New Revision: 205549
URL: http://svn.freebsd.org/changeset/base/205549

Log:
  MFC r204376:
    Disable TSO on BCM5755M controller until I understand better for
    the issue. I still have no idea why TSO does not work on this
    controller. davidch@ also confirmed there is no known TSO related
    issues for this controller.

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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==============================================================================
--- stable/8/sys/dev/bge/if_bge.c	Tue Mar 23 22:14:05 2010	(r205548)
+++ stable/8/sys/dev/bge/if_bge.c	Tue Mar 23 22:16:12 2010	(r205549)
@@ -2656,9 +2656,11 @@ bge_attach(device_t dev)
 		/*
 		 * BCM5754 and BCM5787 shares the same ASIC id so
 		 * explicit device id check is required.
+		 * Due to unknown reason TSO does not work on BCM5755M.
 		 */
 		if (pci_get_device(dev) != BCOM_DEVICEID_BCM5754 &&
-		    pci_get_device(dev) != BCOM_DEVICEID_BCM5754M)
+		    pci_get_device(dev) != BCOM_DEVICEID_BCM5754M &&
+		    pci_get_device(dev) != BCOM_DEVICEID_BCM5755M)
 			sc->bge_flags |= BGE_FLAG_TSO;
 	}
 

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 22:19:27 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A538C106566C;
	Tue, 23 Mar 2010 22:19: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 8926A8FC0C;
	Tue, 23 Mar 2010 22:19: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 o2NMJRTd004938;
	Tue, 23 Mar 2010 22:19:27 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NMJR9T004936;
	Tue, 23 Mar 2010 22:19:27 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003232219.o2NMJR9T004936@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 22:19: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: r205553 - stable/8/sys/dev/age
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 22:19:27 -0000

Author: yongari
Date: Tue Mar 23 22:19:27 2010
New Revision: 205553
URL: http://svn.freebsd.org/changeset/base/205553

Log:
  MFC r204377:
    Add TSO support on VLANs. While I'm here remove unnecessary check
    of VLAN hardware checksum offloading. vlan(4) already takes care of
    this.

Modified:
  stable/8/sys/dev/age/if_age.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/age/if_age.c
==============================================================================
--- stable/8/sys/dev/age/if_age.c	Tue Mar 23 22:17:49 2010	(r205552)
+++ stable/8/sys/dev/age/if_age.c	Tue Mar 23 22:19:27 2010	(r205553)
@@ -74,9 +74,6 @@ __FBSDID("$FreeBSD$");
 /* "device miibus" required.  See GENERIC if you get errors here. */
 #include "miibus_if.h"
 
-#ifndef	IFCAP_VLAN_HWTSO
-#define	IFCAP_VLAN_HWTSO	0
-#endif
 #define	AGE_CSUM_FEATURES	(CSUM_TCP | CSUM_UDP)
 
 MODULE_DEPEND(age, pci, 1, 1, 1);
@@ -633,8 +630,8 @@ age_attach(device_t dev)
 	ether_ifattach(ifp, sc->age_eaddr);
 
 	/* VLAN capability setup. */
-	ifp->if_capabilities |= IFCAP_VLAN_MTU;
-	ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM;
+	ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
+	    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
 	ifp->if_capenable = ifp->if_capabilities;
 
 	/* Tell the upper layer(s) we support long frames. */
@@ -1892,29 +1889,19 @@ age_ioctl(struct ifnet *ifp, u_long cmd,
 		if ((mask & IFCAP_WOL_MAGIC) != 0 &&
 		    (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0)
 			ifp->if_capenable ^= IFCAP_WOL_MAGIC;
-
-		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
-		    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
-			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
-			age_rxvlan(sc);
-		}
 		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;
-		/*
-		 * VLAN hardware tagging is required to do checksum
-		 * offload or TSO on VLAN interface. Checksum offload
-		 * on VLAN interface also requires hardware assistance
-		 * of parent interface.
-		 */
-		if ((ifp->if_capenable & IFCAP_TXCSUM) == 0)
-			ifp->if_capenable &= ~IFCAP_VLAN_HWCSUM;
-		if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
-			ifp->if_capenable &=
-			    ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM);
+		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
+		    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
+			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
+			if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
+				ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
+			age_rxvlan(sc);
+		}
 		AGE_UNLOCK(sc);
 		VLAN_CAPABILITIES(ifp);
 		break;

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 22:22:27 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4180A1065673;
	Tue, 23 Mar 2010 22:22: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 26AD38FC14;
	Tue, 23 Mar 2010 22:22: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 o2NMMRTd005754;
	Tue, 23 Mar 2010 22:22:27 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NMMRhj005752;
	Tue, 23 Mar 2010 22:22:27 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003232222.o2NMMRhj005752@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 23 Mar 2010 22:22: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: r205555 - stable/8/sys/dev/ale
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 22:22:27 -0000

Author: yongari
Date: Tue Mar 23 22:22:26 2010
New Revision: 205555
URL: http://svn.freebsd.org/changeset/base/205555

Log:
  MFC r204378:
    Add TSO support on VLANs. While I'm here remove unnecessary check
    of VLAN hardware checksum offloading. vlan(4) already takes care of
    this.

Modified:
  stable/8/sys/dev/ale/if_ale.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/ale/if_ale.c
==============================================================================
--- stable/8/sys/dev/ale/if_ale.c	Tue Mar 23 22:20:51 2010	(r205554)
+++ stable/8/sys/dev/ale/if_ale.c	Tue Mar 23 22:22:26 2010	(r205555)
@@ -78,9 +78,6 @@ __FBSDID("$FreeBSD$");
 
 /* For more information about Tx checksum offload issues see ale_encap(). */
 #define	ALE_CSUM_FEATURES	(CSUM_TCP | CSUM_UDP)
-#ifndef	IFCAP_VLAN_HWTSO
-#define	IFCAP_VLAN_HWTSO	0
-#endif
 
 MODULE_DEPEND(ale, pci, 1, 1, 1);
 MODULE_DEPEND(ale, ether, 1, 1, 1);
@@ -617,8 +614,8 @@ ale_attach(device_t dev)
 	ether_ifattach(ifp, sc->ale_eaddr);
 
 	/* VLAN capability setup. */
-	ifp->if_capabilities |= IFCAP_VLAN_MTU;
-	ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM;
+	ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
+	    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
 	ifp->if_capenable = ifp->if_capabilities;
 	/*
 	 * Even though controllers supported by ale(3) have Rx checksum
@@ -2003,29 +2000,19 @@ ale_ioctl(struct ifnet *ifp, u_long cmd,
 		if ((mask & IFCAP_WOL_MAGIC) != 0 &&
 		    (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0)
 			ifp->if_capenable ^= IFCAP_WOL_MAGIC;
-
-		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
-		    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
-			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
-			ale_rxvlan(sc);
-		}
 		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;
-		/*
-		 * VLAN hardware tagging is required to do checksum
-		 * offload or TSO on VLAN interface. Checksum offload
-		 * on VLAN interface also requires hardware checksum
-		 * offload of parent interface.
-		 */
-		if ((ifp->if_capenable & IFCAP_TXCSUM) == 0)
-			ifp->if_capenable &= ~IFCAP_VLAN_HWCSUM;
-		if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
-			ifp->if_capenable &=
-			    ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM);
+		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
+		    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
+			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
+			if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
+				ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
+			ale_rxvlan(sc);
+		}
 		ALE_UNLOCK(sc);
 		VLAN_CAPABILITIES(ifp);
 		break;

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 23:16:36 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 14F05106566C;
	Tue, 23 Mar 2010 23:16:36 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DC8EA8FC17;
	Tue, 23 Mar 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 o2NNGZF2018234;
	Tue, 23 Mar 2010 23:16:35 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NNGZSB018233;
	Tue, 23 Mar 2010 23:16:35 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201003232316.o2NNGZSB018233@svn.freebsd.org>
From: Xin LI 
Date: Tue, 23 Mar 2010 23:16:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205565 - in stable/8/contrib: less netcat
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 23:16:36 -0000

Author: delphij
Date: Tue Mar 23 23:16:35 2010
New Revision: 205565
URL: http://svn.freebsd.org/changeset/base/205565

Log:
  Collapase mergeinfo.  No content change.

Modified:
Directory Properties:
  stable/8/contrib/less/   (props changed)
  stable/8/contrib/netcat/   (props changed)

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Mar 23 23:25:17 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8EECE106564A;
	Tue, 23 Mar 2010 23:25: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 7D53B8FC13;
	Tue, 23 Mar 2010 23:25: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 o2NNPHPo020352;
	Tue, 23 Mar 2010 23:25:17 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NNPHVW020350;
	Tue, 23 Mar 2010 23:25:17 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201003232325.o2NNPHVW020350@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Tue, 23 Mar 2010 23:25:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205567 - stable/8/lib/csu/i386-elf
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 23 Mar 2010 23:25:17 -0000

Author: jilles
Date: Tue Mar 23 23:25:17 2010
New Revision: 205567
URL: http://svn.freebsd.org/changeset/base/205567

Log:
  MFC r205398: Do not create *.gmon files for PIE executables on i386.
  
  Scrt1_c.o was accidentally compiled with -DGCRT (profiling), like gcrt1_c.o.
  This problem is i386-specific, the other architectures are OK.
  
  If you have problems with PIE executables such as samba and cups leaving
  behind gmon files, rebuild them after installing this change.
  
  PR:		ports/143924

Modified:
  stable/8/lib/csu/i386-elf/Makefile
Directory Properties:
  stable/8/lib/csu/   (props changed)

Modified: stable/8/lib/csu/i386-elf/Makefile
==============================================================================
--- stable/8/lib/csu/i386-elf/Makefile	Tue Mar 23 23:19:23 2010	(r205566)
+++ stable/8/lib/csu/i386-elf/Makefile	Tue Mar 23 23:25:17 2010	(r205567)
@@ -24,7 +24,7 @@ crt1.o:	crt1_c.o crt1_s.o
 	objcopy --localize-symbol _start1 crt1.o
 
 Scrt1_c.o:	crt1_c.c
-	${CC} ${CFLAGS} -DGCRT -fPIC -DPIC -c -o Scrt1_c.o ${.CURDIR}/crt1_c.c
+	${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1_c.o ${.CURDIR}/crt1_c.c
 
 Scrt1.o: Scrt1_c.o crt1_s.o
 	${LD} ${LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 09:27:12 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 76CD51065670;
	Wed, 24 Mar 2010 09:27: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 651148FC0C;
	Wed, 24 Mar 2010 09:27: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 o2O9RC4A053456;
	Wed, 24 Mar 2010 09:27:12 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2O9RCwl053454;
	Wed, 24 Mar 2010 09:27:12 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003240927.o2O9RCwl053454@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 09:27: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: r205581 - stable/8/share/man/man9
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 09:27:12 -0000

Author: kib
Date: Wed Mar 24 09:27:12 2010
New Revision: 205581
URL: http://svn.freebsd.org/changeset/base/205581

Log:
  MFC r205416:
  Correct the type for uio_resid.

Modified:
  stable/8/share/man/man9/uio.9
Directory Properties:
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/uio.9
==============================================================================
--- stable/8/share/man/man9/uio.9	Wed Mar 24 07:03:11 2010	(r205580)
+++ stable/8/share/man/man9/uio.9	Wed Mar 24 09:27:12 2010	(r205581)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 30, 2007
+.Dd March 21, 2010
 .Os
 .Dt UIO 9
 .Sh NAME
@@ -41,7 +41,7 @@ struct uio {
 	struct	iovec *uio_iov;		/* scatter/gather list */
 	int	uio_iovcnt;		/* length of scatter/gather list */
 	off_t	uio_offset;		/* offset in target object */
-	int	uio_resid;		/* remaining bytes to copy */
+	ssize_t	uio_resid;		/* remaining bytes to copy */
 	enum	uio_seg uio_segflg;	/* address space */
 	enum	uio_rw uio_rw;		/* operation */
 	struct	thread *uio_td;		/* owner */

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 09:45:18 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 70973106566B;
	Wed, 24 Mar 2010 09:45:18 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 43ED28FC14;
	Wed, 24 Mar 2010 09:45: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 o2O9jINH057471;
	Wed, 24 Mar 2010 09:45:18 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2O9jI4j057468;
	Wed, 24 Mar 2010 09:45:18 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003240945.o2O9jI4j057468@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 09:45: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: r205582 - in stable/8/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 09:45:18 -0000

Author: kib
Date: Wed Mar 24 09:45:17 2010
New Revision: 205582
URL: http://svn.freebsd.org/changeset/base/205582

Log:
  MFC r204957:
  Fall back to wbinvd when region for CLFLUSH is >= 2MB.
  
  MFC r205334 (by avg):
  Fix a typo in a comment.

Modified:
  stable/8/sys/amd64/amd64/pmap.c
  stable/8/sys/i386/i386/pmap.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)
  stable/8/sys/net/   (props changed)
  stable/8/sys/netinet/ipfw/   (props changed)

Modified: stable/8/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/8/sys/amd64/amd64/pmap.c	Wed Mar 24 09:27:12 2010	(r205581)
+++ stable/8/sys/amd64/amd64/pmap.c	Wed Mar 24 09:45:17 2010	(r205582)
@@ -941,7 +941,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 
 	if (cpu_feature & CPUID_SS)
 		; /* If "Self Snoop" is supported, do nothing. */
-	else if (cpu_feature & CPUID_CLFSH) {
+	else if ((cpu_feature & CPUID_CLFSH) != 0 &&
+		 eva - sva < 2 * 1024 * 1024) {
 
 		/*
 		 * Otherwise, do per-cache line flush.  Use the mfence
@@ -958,7 +959,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 
 		/*
 		 * No targeted cache flush methods are supported by CPU,
-		 * globally invalidate cache as a last resort.
+		 * or the supplied range is bigger than 2MB.
+		 * Globally invalidate cache.
 		 */
 		pmap_invalidate_cache();
 	}

Modified: stable/8/sys/i386/i386/pmap.c
==============================================================================
--- stable/8/sys/i386/i386/pmap.c	Wed Mar 24 09:27:12 2010	(r205581)
+++ stable/8/sys/i386/i386/pmap.c	Wed Mar 24 09:45:17 2010	(r205582)
@@ -982,7 +982,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 
 	if (cpu_feature & CPUID_SS)
 		; /* If "Self Snoop" is supported, do nothing. */
-	else if (cpu_feature & CPUID_CLFSH) {
+	else if ((cpu_feature & CPUID_CLFSH) != 0 &&
+		 eva - sva < 2 * 1024 * 1024) {
 
 		/*
 		 * Otherwise, do per-cache line flush.  Use the mfence
@@ -999,7 +1000,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 
 		/*
 		 * No targeted cache flush methods are supported by CPU,
-		 * globally invalidate cache as a last resort.
+		 * or the supplied range is bigger than 2MB.
+		 * Globally invalidate cache.
 		 */
 		pmap_invalidate_cache();
 	}

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 12:12:00 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1DA92106564A;
	Wed, 24 Mar 2010 12:12:00 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0C4758FC1E;
	Wed, 24 Mar 2010 12:12: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 o2OCBxd6092252;
	Wed, 24 Mar 2010 12:11:59 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OCBxUp092250;
	Wed, 24 Mar 2010 12:11:59 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <201003241211.o2OCBxUp092250@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 24 Mar 2010 12:11: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: r205585 - stable/8/usr.sbin/jls
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 12:12:00 -0000

Author: ed
Date: Wed Mar 24 12:11:59 2010
New Revision: 205585
URL: http://svn.freebsd.org/changeset/base/205585

Log:
  MFC r205296:
  
    Properly progress through the list of IPv6 addresses using in6_addr size.
  
    Right now if a jail has multiple IPv6 addresses, it will print them
    shifting only 4 bytes at a time. Example:
  
          2001:4dd0:ff41::b23f:a9
          2001:4dd0:ff41::b23f:aa
  
    Becomes:
  
          2001:4dd0:ff41::b23f:a9
          ff41::b23f:a9:2001:4dd0
  
    By casting to in6_addr, it uses the correct offsets.

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

Modified: stable/8/usr.sbin/jls/jls.c
==============================================================================
--- stable/8/usr.sbin/jls/jls.c	Wed Mar 24 11:21:33 2010	(r205584)
+++ stable/8/usr.sbin/jls/jls.c	Wed Mar 24 12:11:59 2010	(r205585)
@@ -355,7 +355,7 @@ print_jail(int pflags, int jflags)
 			count = params[7].jp_valuelen / sizeof(struct in6_addr);
 			for (ai = 0; ai < count; ai++)
 				if (inet_ntop(AF_INET6,
-				    &((struct in_addr *)params[7].jp_value)[ai],
+				    &((struct in6_addr *)params[7].jp_value)[ai],
 				    ipbuf, sizeof(ipbuf)) == NULL)
 					err(1, "inet_ntop");
 				else

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 12:15:00 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 19A5F10656AD;
	Wed, 24 Mar 2010 12:15:00 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C9B088FC29;
	Wed, 24 Mar 2010 12:14: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 o2OCExGd092964;
	Wed, 24 Mar 2010 12:14:59 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OCExkK092962;
	Wed, 24 Mar 2010 12:14:59 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <201003241214.o2OCExkK092962@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 24 Mar 2010 12:14: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: r205586 - stable/8/etc
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 12:15:00 -0000

Author: ed
Date: Wed Mar 24 12:14:59 2010
New Revision: 205586
URL: http://svn.freebsd.org/changeset/base/205586

Log:
  MFC r205329 and r205335:
  
    Don't add the atrun-line to the crontab when MK_AT is set.
  
    This prevents spurious calls to sendmail every 5 minutes.

Modified:
  stable/8/etc/Makefile
Directory Properties:
  stable/8/etc/   (props changed)

Modified: stable/8/etc/Makefile
==============================================================================
--- stable/8/etc/Makefile	Wed Mar 24 12:11:59 2010	(r205585)
+++ stable/8/etc/Makefile	Wed Mar 24 12:14:59 2010	(r205586)
@@ -157,6 +157,9 @@ distribution:
 		${BIN2} ${DESTDIR}/etc; \
 	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
 		master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
+.if ${MK_AT} == "no"
+	sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
+.endif
 .if ${MK_TCSH} == "no"
 	sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
 .endif

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:08:02 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BAA761065672;
	Wed, 24 Mar 2010 14:08:02 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8E9468FC1D;
	Wed, 24 Mar 2010 14:08: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 o2OE820W018842;
	Wed, 24 Mar 2010 14:08:02 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OE81vY018841;
	Wed, 24 Mar 2010 14:08:01 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241408.o2OE81vY018841@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:08:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205587 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:08:02 -0000

Author: kib
Date: Wed Mar 24 14:08:01 2010
New Revision: 205587
URL: http://svn.freebsd.org/changeset/base/205587

Log:
  MFC r204465:
  Remove unused global statistic about fat cache usage.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_fat.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_fat.c	Wed Mar 24 12:14:59 2010	(r205586)
+++ stable/8/sys/fs/msdosfs/msdosfs_fat.c	Wed Mar 24 14:08:01 2010	(r205587)
@@ -60,19 +60,6 @@
 #include 
 #include 
 
-/*
- * Fat cache stats.
- */
-static int fc_fileextends;	/* # of file extends			 */
-static int fc_lfcempty;		/* # of time last file cluster cache entry
-				 * was empty */
-static int fc_bmapcalls;		/* # of times pcbmap was called		 */
-
-#define	LMMAX	20
-static int fc_lmdistance[LMMAX];/* counters for how far off the last
-				 * cluster mapped entry was. */
-static int fc_largedistance;	/* off by more than LMMAX		 */
-
 static int	chainalloc(struct msdosfsmount *pmp, u_long start,
 		    u_long count, u_long fillwith, u_long *retcluster,
 		    u_long *got);
@@ -152,8 +139,6 @@ pcbmap(dep, findcn, bnp, cnp, sp)
 	struct msdosfsmount *pmp = dep->de_pmp;
 	u_long bsize;
 
-	fc_bmapcalls++;
-
 	/*
 	 * If they don't give us someplace to return a value then don't
 	 * bother doing anything.
@@ -203,10 +188,6 @@ pcbmap(dep, findcn, bnp, cnp, sp)
 	 */
 	i = 0;
 	fc_lookup(dep, findcn, &i, &cn);
-	if ((bn = findcn - i) >= LMMAX)
-		fc_largedistance++;
-	else
-		fc_lmdistance[bn]++;
 
 	/*
 	 * Handle all other files or directories the normal way.
@@ -992,10 +973,8 @@ extendfile(dep, count, bpp, ncp, flags)
 	 * If the "file's last cluster" cache entry is empty, and the file
 	 * is not empty, then fill the cache entry by calling pcbmap().
 	 */
-	fc_fileextends++;
 	if (dep->de_fc[FC_LASTFC].fc_frcn == FCE_EMPTY &&
 	    dep->de_StartCluster != 0) {
-		fc_lfcempty++;
 		error = pcbmap(dep, 0xffff, 0, &cn, 0);
 		/* we expect it to return E2BIG */
 		if (error != E2BIG)

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:10:11 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5D355106568D;
	Wed, 24 Mar 2010 14:10:11 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 25C4D8FC22;
	Wed, 24 Mar 2010 14:10: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 o2OEA9gW019394;
	Wed, 24 Mar 2010 14:10:09 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEA9bQ019391;
	Wed, 24 Mar 2010 14:10:09 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241410.o2OEA9bQ019391@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:10: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: r205588 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:10:11 -0000

Author: kib
Date: Wed Mar 24 14:10:08 2010
New Revision: 205588
URL: http://svn.freebsd.org/changeset/base/205588

Log:
  MFC r204466:
  Assert that the msdosfs vnode is (e)locked in several places.
  Change the check and return on impossible condition into KASSERT().

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_denode.c
  stable/8/sys/fs/msdosfs/msdosfs_fat.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_denode.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_denode.c	Wed Mar 24 14:08:01 2010	(r205587)
+++ stable/8/sys/fs/msdosfs/msdosfs_denode.c	Wed Mar 24 14:10:08 2010	(r205588)
@@ -167,9 +167,8 @@ deget(pmp, dirclust, diroffset, depp)
 	ldep->de_dirclust = dirclust;
 	ldep->de_diroffset = diroffset;
 	ldep->de_inode = inode;
-	fc_purge(ldep, 0);	/* init the fat cache for this denode */
-
 	lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL);
+	fc_purge(ldep, 0);	/* init the fat cache for this denode */
 	error = insmntque(nvp, mntp);
 	if (error != 0) {
 		free(ldep, M_MSDOSFSNODE);

Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_fat.c	Wed Mar 24 14:08:01 2010	(r205587)
+++ stable/8/sys/fs/msdosfs/msdosfs_fat.c	Wed Mar 24 14:10:08 2010	(r205588)
@@ -139,12 +139,9 @@ pcbmap(dep, findcn, bnp, cnp, sp)
 	struct msdosfsmount *pmp = dep->de_pmp;
 	u_long bsize;
 
-	/*
-	 * If they don't give us someplace to return a value then don't
-	 * bother doing anything.
-	 */
-	if (bnp == NULL && cnp == NULL && sp == NULL)
-		return (0);
+	KASSERT(bnp != NULL || cnp != NULL || sp != NULL,
+	    ("pcbmap: extra call"));
+	ASSERT_VOP_ELOCKED(DETOV(dep), "pcbmap");
 
 	cn = dep->de_StartCluster;
 	/*
@@ -270,6 +267,8 @@ fc_lookup(dep, findcn, frcnp, fsrcnp)
 	u_long cn;
 	struct fatcache *closest = 0;
 
+	ASSERT_VOP_LOCKED(DETOV(dep), "fc_lookup");
+
 	for (i = 0; i < FC_SIZE; i++) {
 		cn = dep->de_fc[i].fc_frcn;
 		if (cn != FCE_EMPTY && cn <= findcn) {
@@ -295,6 +294,8 @@ fc_purge(dep, frcn)
 	int i;
 	struct fatcache *fcp;
 
+	ASSERT_VOP_ELOCKED(DETOV(dep), "fc_purge");
+
 	fcp = dep->de_fc;
 	for (i = 0; i < FC_SIZE; i++, fcp++) {
 		if (fcp->fc_frcn >= frcn)

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:13:28 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2C0E6106564A;
	Wed, 24 Mar 2010 14:13:28 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1AD8E8FC20;
	Wed, 24 Mar 2010 14:13: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 o2OEDRDG020224;
	Wed, 24 Mar 2010 14:13:28 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEDRIH020222;
	Wed, 24 Mar 2010 14:13:27 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241413.o2OEDRIH020222@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:13: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: r205589 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:13:28 -0000

Author: kib
Date: Wed Mar 24 14:13:27 2010
New Revision: 205589
URL: http://svn.freebsd.org/changeset/base/205589

Log:
  MFC r204467:
  Remove seemingly unneeded unlock/relock of the dvp in msdosfs_rmdir,
  causing LOR.

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

Modified: stable/8/sys/fs/msdosfs/msdosfs_vnops.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_vnops.c	Wed Mar 24 14:10:08 2010	(r205588)
+++ stable/8/sys/fs/msdosfs/msdosfs_vnops.c	Wed Mar 24 14:13:27 2010	(r205589)
@@ -1468,14 +1468,12 @@ msdosfs_rmdir(ap)
 	 * the name cache.
 	 */
 	cache_purge(dvp);
-	VOP_UNLOCK(dvp, 0);
 	/*
 	 * Truncate the directory that is being deleted.
 	 */
 	error = detrunc(ip, (u_long)0, IO_SYNC, cnp->cn_cred, td);
 	cache_purge(vp);
 
-	vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
 out:
 	return (error);
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:15:47 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0527C1065676;
	Wed, 24 Mar 2010 14:15:47 +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 DAEE48FC0A;
	Wed, 24 Mar 2010 14:15: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 o2OEFkjs020813;
	Wed, 24 Mar 2010 14:15:46 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEFkD8020811;
	Wed, 24 Mar 2010 14:15:46 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241415.o2OEFkD8020811@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:15: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: r205590 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:15:47 -0000

Author: kib
Date: Wed Mar 24 14:15:46 2010
New Revision: 205590
URL: http://svn.freebsd.org/changeset/base/205590

Log:
  MFC r204468:
  In msdosfs_inactive(), reclaim the vnodes both for SLOT_DELETED and
  SLOT_EMPTY deName[0] values.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_denode.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_denode.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_denode.c	Wed Mar 24 14:13:27 2010	(r205589)
+++ stable/8/sys/fs/msdosfs/msdosfs_denode.c	Wed Mar 24 14:15:46 2010	(r205590)
@@ -593,7 +593,7 @@ msdosfs_inactive(ap)
 	/*
 	 * Ignore denodes related to stale file handles.
 	 */
-	if (dep->de_Name[0] == SLOT_DELETED)
+	if (dep->de_Name[0] == SLOT_DELETED || dep->de_Name[0] == SLOT_EMPTY)
 		goto out;
 
 	/*
@@ -621,7 +621,7 @@ out:
 	printf("msdosfs_inactive(): v_usecount %d, de_Name[0] %x\n",
 	       vrefcnt(vp), dep->de_Name[0]);
 #endif
-	if (dep->de_Name[0] == SLOT_DELETED)
+	if (dep->de_Name[0] == SLOT_DELETED || dep->de_Name[0] == SLOT_EMPTY)
 		vrecycle(vp, td);
 	return (error);
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:18:11 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 20B721065673;
	Wed, 24 Mar 2010 14:18:11 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0FC2E8FC1E;
	Wed, 24 Mar 2010 14:18: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 o2OEIA03021379;
	Wed, 24 Mar 2010 14:18:10 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEIAre021377;
	Wed, 24 Mar 2010 14:18:10 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241418.o2OEIAre021377@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:18: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: r205591 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:18:11 -0000

Author: kib
Date: Wed Mar 24 14:18:10 2010
New Revision: 205591
URL: http://svn.freebsd.org/changeset/base/205591

Log:
  MFC r204469:
  In msdosfs deget(), properly handle the case when the vnode is found in hash.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_denode.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_denode.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_denode.c	Wed Mar 24 14:15:46 2010	(r205590)
+++ stable/8/sys/fs/msdosfs/msdosfs_denode.c	Wed Mar 24 14:18:10 2010	(r205591)
@@ -182,9 +182,8 @@ deget(pmp, dirclust, diroffset, depp)
 		return (error);
 	}
 	if (xvp != NULL) {
-		/* XXX: Not sure this is right */
-		nvp = xvp;
-		ldep->de_vnode = nvp;
+		*depp = xvp->v_data;
+		return (0);
 	}
 
 	ldep->de_pmp = pmp;

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:25:16 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 04182106566B;
	Wed, 24 Mar 2010 14:25: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 DD0D98FC08;
	Wed, 24 Mar 2010 14:25: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 o2OEPFkn023042;
	Wed, 24 Mar 2010 14:25:15 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEPFp6023039;
	Wed, 24 Mar 2010 14:25:15 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241425.o2OEPFp6023039@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:25: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: r205593 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:25:16 -0000

Author: kib
Date: Wed Mar 24 14:25:15 2010
New Revision: 205593
URL: http://svn.freebsd.org/changeset/base/205593

Log:
  MFC r204470:
  Add per-mountpoint lockmgr lock for msdosfs.
  
  MFC r204576:
  Only destroy pm_fatlock on error if it was initialized.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_vfsops.c
  stable/8/sys/fs/msdosfs/msdosfsmount.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_vfsops.c	Wed Mar 24 14:20:37 2010	(r205592)
+++ stable/8/sys/fs/msdosfs/msdosfs_vfsops.c	Wed Mar 24 14:25:15 2010	(r205593)
@@ -75,6 +75,8 @@
 #include 
 #include 
 
+static const char msdosfs_lock_msg[] = "fatlk";
+
 /* Mount options that we support. */
 static const char *msdosfs_opts[] = {
 	"async", "noatime", "noclusterr", "noclusterw",
@@ -466,6 +468,8 @@ mountmsdosfs(struct vnode *devvp, struct
 	pmp->pm_cp = cp;
 	pmp->pm_bo = bo;
 
+	lockinit(&pmp->pm_fatlock, 0, msdosfs_lock_msg, 0, 0);
+
 	/*
 	 * Initialize ownerships and permissions, since nothing else will
 	 * initialize them iff we are mounting root.
@@ -763,6 +767,7 @@ error_exit:
 		PICKUP_GIANT();
 	}
 	if (pmp) {
+		lockdestroy(&pmp->pm_fatlock);
 		if (pmp->pm_inusemap)
 			free(pmp->pm_inusemap, M_MSDOSFSFAT);
 		free(pmp, M_MSDOSFSMNT);
@@ -837,6 +842,7 @@ msdosfs_unmount(struct mount *mp, int mn
 	free(pmp->pm_inusemap, M_MSDOSFSFAT);
 	if (pmp->pm_flags & MSDOSFS_LARGEFS)
 		msdosfs_fileno_free(mp);
+	lockdestroy(&pmp->pm_fatlock);
 	free(pmp, M_MSDOSFSMNT);
 	mp->mnt_data = NULL;
 	MNT_ILOCK(mp);

Modified: stable/8/sys/fs/msdosfs/msdosfsmount.h
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfsmount.h	Wed Mar 24 14:20:37 2010	(r205592)
+++ stable/8/sys/fs/msdosfs/msdosfsmount.h	Wed Mar 24 14:25:15 2010	(r205593)
@@ -53,6 +53,9 @@
 
 #ifdef _KERNEL
 
+#include 
+#include 
+#include 
 #include 
 
 #ifdef MALLOC_DECLARE
@@ -106,7 +109,9 @@ struct msdosfsmount {
 	void *pm_u2d;	/* Unicode->DOS iconv handle */
 	void *pm_d2u;	/* DOS->Local iconv handle */
 	u_int32_t pm_nfileno;	/* next 32-bit fileno */
-	RB_HEAD(msdosfs_filenotree, msdosfs_fileno) pm_filenos; /* 64<->32-bit fileno mapping */
+	RB_HEAD(msdosfs_filenotree, msdosfs_fileno)
+	    pm_filenos; /* 64<->32-bit fileno mapping */
+	struct lock pm_fatlock;	/* lockmgr protecting allocations and rb tree */
 };
 
 /*
@@ -215,6 +220,13 @@ void msdosfs_fileno_init(struct mount *)
 void msdosfs_fileno_free(struct mount *);
 uint32_t msdosfs_fileno_map(struct mount *, uint64_t);
 
+#define	MSDOSFS_LOCK_MP(pmp) \
+	lockmgr(&(pmp)->pm_fatlock, LK_EXCLUSIVE, NULL)
+#define	MSDOSFS_UNLOCK_MP(pmp) \
+	lockmgr(&(pmp)->pm_fatlock, LK_RELEASE, NULL)
+#define	MSDOSFS_ASSERT_MP_LOCKED(pmp) \
+	lockmgr_assert(&(pmp)->pm_fatlock, KA_XLOCKED)
+
 #endif /* _KERNEL */
 
 /*

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:37:17 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D04D71065670;
	Wed, 24 Mar 2010 14:37:17 +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 BE5E88FC08;
	Wed, 24 Mar 2010 14:37: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 o2OEbHZg025707;
	Wed, 24 Mar 2010 14:37:17 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEbH3J025704;
	Wed, 24 Mar 2010 14:37:17 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241437.o2OEbH3J025704@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:37:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205594 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:37:17 -0000

Author: kib
Date: Wed Mar 24 14:37:17 2010
New Revision: 205594
URL: http://svn.freebsd.org/changeset/base/205594

Log:
  MFC r204471:
  Use pm_fatlock to protect fat bitmap.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_fat.c
  stable/8/sys/fs/msdosfs/msdosfs_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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_fat.c	Wed Mar 24 14:25:15 2010	(r205593)
+++ stable/8/sys/fs/msdosfs/msdosfs_fat.c	Wed Mar 24 14:37:17 2010	(r205594)
@@ -77,6 +77,9 @@ static __inline void
 		usemap_alloc(struct msdosfsmount *pmp, u_long cn);
 static __inline void
 		usemap_free(struct msdosfsmount *pmp, u_long cn);
+static int	clusteralloc1(struct msdosfsmount *pmp, u_long start,
+		    u_long count, u_long fillwith, u_long *retcluster,
+		    u_long *got);
 
 static void
 fatblock(pmp, ofs, bnp, sizep, bop)
@@ -409,6 +412,7 @@ usemap_alloc(pmp, cn)
 	u_long cn;
 {
 
+	MSDOSFS_ASSERT_MP_LOCKED(pmp);
 	pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS);
 	pmp->pm_freeclustercount--;
 }
@@ -419,6 +423,7 @@ usemap_free(pmp, cn)
 	u_long cn;
 {
 
+	MSDOSFS_ASSERT_MP_LOCKED(pmp);
 	pmp->pm_freeclustercount++;
 	pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1 << (cn % N_INUSEBITS));
 }
@@ -432,17 +437,17 @@ clusterfree(pmp, cluster, oldcnp)
 	int error;
 	u_long oldcn;
 
-	usemap_free(pmp, cluster);
 	error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE);
-	if (error) {
-		usemap_alloc(pmp, cluster);
+	if (error)
 		return (error);
-	}
 	/*
 	 * If the cluster was successfully marked free, then update
 	 * the count of free clusters, and turn off the "allocated"
 	 * bit in the "in use" cluster bit map.
 	 */
+	MSDOSFS_LOCK_MP(pmp);
+	usemap_free(pmp, cluster);
+	MSDOSFS_UNLOCK_MP(pmp);
 	if (oldcnp)
 		*oldcnp = oldcn;
 	return (0);
@@ -660,6 +665,8 @@ chainlength(pmp, start, count)
 	u_int map;
 	u_long len;
 
+	MSDOSFS_ASSERT_MP_LOCKED(pmp);
+
 	max_idx = pmp->pm_maxcluster / N_INUSEBITS;
 	idx = start / N_INUSEBITS;
 	start %= N_INUSEBITS;
@@ -708,6 +715,8 @@ chainalloc(pmp, start, count, fillwith, 
 	int error;
 	u_long cl, n;
 
+	MSDOSFS_ASSERT_MP_LOCKED(pmp);
+
 	for (cl = start, n = count; n-- > 0;)
 		usemap_alloc(pmp, cl++);
 
@@ -740,19 +749,28 @@ chainalloc(pmp, start, count, fillwith, 
  * got	      - how many clusters were actually allocated.
  */
 int
-clusteralloc(pmp, start, count, fillwith, retcluster, got)
-	struct msdosfsmount *pmp;
-	u_long start;
-	u_long count;
-	u_long fillwith;
-	u_long *retcluster;
-	u_long *got;
+clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count,
+    u_long fillwith, u_long *retcluster, u_long *got)
+{
+	int error;
+
+	MSDOSFS_LOCK_MP(pmp);
+	error = clusteralloc1(pmp, start, count, fillwith, retcluster, got);
+	MSDOSFS_UNLOCK_MP(pmp);
+	return (error);
+}
+
+static int
+clusteralloc1(struct msdosfsmount *pmp, u_long start, u_long count,
+    u_long fillwith, u_long *retcluster, u_long *got)
 {
 	u_long idx;
 	u_long len, newst, foundl, cn, l;
 	u_long foundcn = 0; /* XXX: foundcn could be used unititialized */
 	u_int map;
 
+	MSDOSFS_ASSERT_MP_LOCKED(pmp);
+
 #ifdef MSDOSFS_DEBUG
 	printf("clusteralloc(): find %lu clusters\n", count);
 #endif
@@ -828,6 +846,7 @@ freeclusterchain(pmp, cluster)
 	u_long bn, bo, bsize, byteoffset;
 	u_long readcn, lbn = -1;
 
+	MSDOSFS_LOCK_MP(pmp);
 	while (cluster >= CLUST_FIRST && cluster <= pmp->pm_maxcluster) {
 		byteoffset = FATOFS(pmp, cluster);
 		fatblock(pmp, byteoffset, &bn, &bsize, &bo);
@@ -837,6 +856,7 @@ freeclusterchain(pmp, cluster)
 			error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp);
 			if (error) {
 				brelse(bp);
+				MSDOSFS_UNLOCK_MP(pmp);
 				return (error);
 			}
 			lbn = bn;
@@ -872,6 +892,7 @@ freeclusterchain(pmp, cluster)
 	}
 	if (bp)
 		updatefats(pmp, bp, bn);
+	MSDOSFS_UNLOCK_MP(pmp);
 	return (0);
 }
 
@@ -888,6 +909,8 @@ fillinusemap(pmp)
 	int error;
 	u_long bn, bo, bsize, byteoffset;
 
+	MSDOSFS_ASSERT_MP_LOCKED(pmp);
+
 	/*
 	 * Mark all clusters in use, we mark the free ones in the fat scan
 	 * loop further down.

Modified: stable/8/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_vfsops.c	Wed Mar 24 14:25:15 2010	(r205593)
+++ stable/8/sys/fs/msdosfs/msdosfs_vfsops.c	Wed Mar 24 14:37:17 2010	(r205594)
@@ -720,7 +720,10 @@ mountmsdosfs(struct vnode *devvp, struct
 	/*
 	 * Have the inuse map filled in.
 	 */
-	if ((error = fillinusemap(pmp)) != 0)
+	MSDOSFS_LOCK_MP(pmp);
+	error = fillinusemap(pmp);
+	MSDOSFS_UNLOCK_MP(pmp);
+	if (error != 0)
 		goto error_exit;
 
 	/*

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:43:19 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E2CDE106566B;
	Wed, 24 Mar 2010 14:43:19 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CFC118FC16;
	Wed, 24 Mar 2010 14: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 o2OEhJGU027068;
	Wed, 24 Mar 2010 14:43:19 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEhJQl027066;
	Wed, 24 Mar 2010 14:43:19 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241443.o2OEhJQl027066@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:43: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: r205595 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:43:20 -0000

Author: kib
Date: Wed Mar 24 14:43:19 2010
New Revision: 205595
URL: http://svn.freebsd.org/changeset/base/205595

Log:
  MFC r204472:
  Add assertions for FAT bitmap state.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_fat.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_fat.c	Wed Mar 24 14:37:17 2010	(r205594)
+++ stable/8/sys/fs/msdosfs/msdosfs_fat.c	Wed Mar 24 14:43:19 2010	(r205595)
@@ -413,7 +413,12 @@ usemap_alloc(pmp, cn)
 {
 
 	MSDOSFS_ASSERT_MP_LOCKED(pmp);
+
+	KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
+	    == 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS,
+		(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
 	pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS);
+	KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little"));
 	pmp->pm_freeclustercount--;
 }
 
@@ -425,6 +430,9 @@ usemap_free(pmp, cn)
 
 	MSDOSFS_ASSERT_MP_LOCKED(pmp);
 	pmp->pm_freeclustercount++;
+	KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
+	    != 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS,
+		(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
 	pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1 << (cn % N_INUSEBITS));
 }
 

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:45:51 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5BBC71065672;
	Wed, 24 Mar 2010 14:45:51 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2FE058FC15;
	Wed, 24 Mar 2010 14:45: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 o2OEjplm027660;
	Wed, 24 Mar 2010 14:45:51 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEjpCK027658;
	Wed, 24 Mar 2010 14:45:51 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241445.o2OEjpCK027658@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:45: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: r205596 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:45:51 -0000

Author: kib
Date: Wed Mar 24 14:45:50 2010
New Revision: 205596
URL: http://svn.freebsd.org/changeset/base/205596

Log:
  MFC r204473:
  Use pm_fatlock to protect per-filesystem rb tree used to allocate fileno
  on the large FAT volumes.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_fileno.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_fileno.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_fileno.c	Wed Mar 24 14:43:19 2010	(r205595)
+++ stable/8/sys/fs/msdosfs/msdosfs_fileno.c	Wed Mar 24 14:45:50 2010	(r205596)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -59,9 +58,6 @@ __FBSDID("$FreeBSD$");
 
 static MALLOC_DEFINE(M_MSDOSFSFILENO, "msdosfs_fileno", "MSDOSFS fileno mapping node");
 
-static struct mtx fileno_mtx;
-MTX_SYSINIT(fileno, &fileno_mtx, "MSDOSFS fileno", MTX_DEF);
-
 RB_PROTOTYPE(msdosfs_filenotree, msdosfs_fileno, mf_tree,
     msdosfs_fileno_compare)
 
@@ -117,30 +113,30 @@ msdosfs_fileno_map(mp, fileno)
 	}
 	if (fileno < FILENO_FIRST_DYN)
 		return ((uint32_t)fileno);
-	mtx_lock(&fileno_mtx);
+	MSDOSFS_LOCK_MP(pmp);
 	key.mf_fileno64 = fileno;
 	mf = RB_FIND(msdosfs_filenotree, &pmp->pm_filenos, &key);
 	if (mf != NULL) {
 		mapped = mf->mf_fileno32;
-		mtx_unlock(&fileno_mtx);
+		MSDOSFS_UNLOCK_MP(pmp);
 		return (mapped);
 	}
 	if (pmp->pm_nfileno < FILENO_FIRST_DYN)
 		panic("msdosfs_fileno_map: wraparound");
-	mtx_unlock(&fileno_mtx);
+	MSDOSFS_UNLOCK_MP(pmp);
 	mf = malloc(sizeof(*mf), M_MSDOSFSFILENO, M_WAITOK);
-	mtx_lock(&fileno_mtx);
+	MSDOSFS_LOCK_MP(pmp);
 	tmf = RB_FIND(msdosfs_filenotree, &pmp->pm_filenos, &key);
 	if (tmf != NULL) {
 		mapped = tmf->mf_fileno32;
-		mtx_unlock(&fileno_mtx);
+		MSDOSFS_UNLOCK_MP(pmp);
 		free(mf, M_MSDOSFSFILENO);
 		return (mapped);
 	}
 	mf->mf_fileno64 = fileno;
 	mapped = mf->mf_fileno32 = pmp->pm_nfileno++;
 	RB_INSERT(msdosfs_filenotree, &pmp->pm_filenos, mf);
-	mtx_unlock(&fileno_mtx);
+	MSDOSFS_UNLOCK_MP(pmp);
 	return (mapped);
 }
 

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:50:04 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5F1BC106564A;
	Wed, 24 Mar 2010 14:50: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 4CFB38FC1E;
	Wed, 24 Mar 2010 14:50: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 o2OEo4NT028661;
	Wed, 24 Mar 2010 14:50:04 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEo4GR028659;
	Wed, 24 Mar 2010 14:50:04 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241450.o2OEo4GR028659@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:50: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: r205597 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:50:04 -0000

Author: kib
Date: Wed Mar 24 14:50:04 2010
New Revision: 205597
URL: http://svn.freebsd.org/changeset/base/205597

Log:
  MFC r204474:
  Fix the race between dotdot lookup and forced unmount, by using
  msdosfs-specific variant of vn_vget_ino(), msdosfs_deget_dotdot().
  
  As was done for UFS, relookup the dotdot denode after the call to
  msdosfs_deget_dotdot(), because vnode lock is dropped and directory
  might be moved.
  
  MFC r204675:
  When returning error from msdosfs_lookup(), make sure that *vpp is NULL.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_lookup.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_lookup.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_lookup.c	Wed Mar 24 14:45:50 2010	(r205596)
+++ stable/8/sys/fs/msdosfs/msdosfs_lookup.c	Wed Mar 24 14:50:04 2010	(r205597)
@@ -61,6 +61,18 @@
 #include 
 #include 
 
+static int msdosfs_lookup_(struct vnode *vdp, struct vnode **vpp,
+    struct componentname *cnp, u_int64_t *inum);
+static int msdosfs_deget_dotdot(struct vnode *vp, u_long cluster, int blkoff,
+    struct vnode **rvp);
+
+int
+msdosfs_lookup(struct vop_cachedlookup_args *ap)
+{
+
+	return (msdosfs_lookup_(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL));
+}
+
 /*
  * When we search a directory the blocks containing directory entries are
  * read and examined.  The directory entries contain information that would
@@ -76,18 +88,11 @@
  * out to disk.  This way disk blocks containing directory entries and in
  * memory denode's will be in synch.
  */
-int
-msdosfs_lookup(ap)
-	struct vop_cachedlookup_args /* {
-		struct vnode *a_dvp;
-		struct vnode **a_vpp;
-		struct componentname *a_cnp;
-	} */ *ap;
+static int
+msdosfs_lookup_(struct vnode *vdp, struct vnode **vpp,
+    struct componentname *cnp, u_int64_t *dd_inum)
 {
 	struct mbnambuf nb;
-	struct vnode *vdp = ap->a_dvp;
-	struct vnode **vpp = ap->a_vpp;
-	struct componentname *cnp = ap->a_cnp;
 	daddr_t bn;
 	int error;
 	int slotcount;
@@ -109,6 +114,7 @@ msdosfs_lookup(ap)
 	int flags = cnp->cn_flags;
 	int nameiop = cnp->cn_nameiop;
 	int unlen;
+	u_int64_t inode1;
 
 	int wincnt = 1;
 	int chksum = -1, chksum_ok;
@@ -119,12 +125,14 @@ msdosfs_lookup(ap)
 #endif
 	dp = VTODE(vdp);
 	pmp = dp->de_pmp;
-	*vpp = NULL;
 #ifdef MSDOSFS_DEBUG
 	printf("msdosfs_lookup(): vdp %p, dp %p, Attr %02x\n",
 	    vdp, dp, dp->de_Attributes);
 #endif
 
+ restart:
+	if (vpp != NULL)
+		*vpp = NULL;
 	/*
 	 * If they are going after the . or .. entry in the root directory,
 	 * they won't find it.  DOS filesystems don't have them in the root
@@ -436,6 +444,11 @@ foundroot:
 	if (FAT32(pmp) && scn == MSDOSFSROOT)
 		scn = pmp->pm_rootdirblk;
 
+	if (dd_inum != NULL) {
+		*dd_inum = (uint64_t)pmp->pm_bpcluster * scn + blkoff;
+		return (0);
+	}
+
 	/*
 	 * If deleting, and at end of pathname, return
 	 * parameters which can be used to remove file.
@@ -508,23 +521,28 @@ foundroot:
 	 * inodes from the root, moving down the directory tree. Thus
 	 * when following backward pointers ".." we must unlock the
 	 * parent directory before getting the requested directory.
-	 * There is a potential race condition here if both the current
-	 * and parent directories are removed before the VFS_VGET for the
-	 * inode associated with ".." returns.  We hope that this occurs
-	 * infrequently since we cannot avoid this race condition without
-	 * implementing a sophisticated deadlock detection algorithm.
-	 * Note also that this simple deadlock detection scheme will not
-	 * work if the filesystem has any hard links other than ".."
-	 * that point backwards in the directory structure.
 	 */
 	pdp = vdp;
 	if (flags & ISDOTDOT) {
-		VOP_UNLOCK(pdp, 0);
-		error = deget(pmp, cluster, blkoff,  &tdp);
-		vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY); 
-		if (error)
+		error = msdosfs_deget_dotdot(pdp, cluster, blkoff, vpp);
+		if (error) {
+			*vpp = NULL;
 			return (error);
-		*vpp = DETOV(tdp);
+		}
+		/*
+		 * Recheck that ".." still points to the inode we
+		 * looked up before pdp lock was dropped.
+		 */
+		error = msdosfs_lookup_(pdp, NULL, cnp, &inode1);
+		if (error) {
+			vput(*vpp);
+			*vpp = NULL;
+			return (error);
+		}
+		if (VTODE(*vpp)->de_inode != inode1) {
+			vput(*vpp);
+			goto restart;
+		}
 	} else if (dp->de_StartCluster == scn && isadir) {
 		VREF(vdp);	/* we want ourself, ie "." */
 		*vpp = vdp;
@@ -542,6 +560,49 @@ foundroot:
 	return (0);
 }
 
+static int
+msdosfs_deget_dotdot(struct vnode *vp, u_long cluster, int blkoff,
+    struct vnode **rvp)
+{
+	struct mount *mp;
+	struct msdosfsmount *pmp;
+	struct denode *rdp;
+	int ltype, error;
+
+	mp = vp->v_mount;
+	pmp = VFSTOMSDOSFS(mp);
+	ltype = VOP_ISLOCKED(vp);
+	KASSERT(ltype == LK_EXCLUSIVE || ltype == LK_SHARED,
+	    ("msdosfs_deget_dotdot: vp not locked"));
+
+	error = vfs_busy(mp, MBF_NOWAIT);
+	if (error != 0) {
+		vfs_ref(mp);
+		VOP_UNLOCK(vp, 0);
+		error = vfs_busy(mp, 0);
+		vn_lock(vp, ltype | LK_RETRY);
+		vfs_rel(mp);
+		if (error != 0)
+			return (ENOENT);
+		if (vp->v_iflag & VI_DOOMED) {
+			vfs_unbusy(mp);
+			return (ENOENT);
+		}
+	}
+	VOP_UNLOCK(vp, 0);
+	error = deget(pmp, cluster, blkoff,  &rdp);
+	vfs_unbusy(mp);
+	if (error == 0)
+		*rvp = DETOV(rdp);
+	vn_lock(vp, ltype | LK_RETRY);
+	if (vp->v_iflag & VI_DOOMED) {
+		if (error == 0)
+			vput(*rvp);
+		error = ENOENT;
+	}
+	return (error);
+}
+
 /*
  * dep  - directory entry to copy into the directory
  * ddep - directory to add to

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:53:29 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F0FD106564A;
	Wed, 24 Mar 2010 14:53:29 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3DFB78FC0C;
	Wed, 24 Mar 2010 14:53: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 o2OErTV7029429;
	Wed, 24 Mar 2010 14:53:29 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OErTQS029427;
	Wed, 24 Mar 2010 14:53:29 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241453.o2OErTQS029427@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:53: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: r205598 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:53:29 -0000

Author: kib
Date: Wed Mar 24 14:53:28 2010
New Revision: 205598
URL: http://svn.freebsd.org/changeset/base/205598

Log:
  MFC r204589:
  Do not leak vnode lock when msdosfs mount is updated and specified
  device is different from the device used to the original mount.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_vfsops.c	Wed Mar 24 14:50:04 2010	(r205597)
+++ stable/8/sys/fs/msdosfs/msdosfs_vfsops.c	Wed Mar 24 14:53:28 2010	(r205598)
@@ -383,10 +383,9 @@ msdosfs_mount(struct mount *mp)
 		pmp = VFSTOMSDOSFS(mp);
 #endif
 	} else {
+		vput(devvp);
 		if (devvp != pmp->pm_devvp)
-			error = EINVAL;	/* XXX needs translation */
-		else
-			vput(devvp);
+			return (EINVAL);	/* XXX needs translation */
 	}
 	if (error) {
 		vrele(devvp);

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 14:56:57 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 286FC106566B;
	Wed, 24 Mar 2010 14:56:57 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 152DE8FC13;
	Wed, 24 Mar 2010 14:56: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 o2OEuu94030238;
	Wed, 24 Mar 2010 14:56:56 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OEuu24030236;
	Wed, 24 Mar 2010 14:56:56 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201003241456.o2OEuu24030236@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 24 Mar 2010 14:56:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205599 - stable/8/sys/fs/msdosfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 14:56:57 -0000

Author: kib
Date: Wed Mar 24 14:56:56 2010
New Revision: 205599
URL: http://svn.freebsd.org/changeset/base/205599

Log:
  MFC r204475:
  Mark msdosfs as mpsafe.

Modified:
  stable/8/sys/fs/msdosfs/msdosfs_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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- stable/8/sys/fs/msdosfs/msdosfs_vfsops.c	Wed Mar 24 14:53:28 2010	(r205598)
+++ stable/8/sys/fs/msdosfs/msdosfs_vfsops.c	Wed Mar 24 14:56:56 2010	(r205599)
@@ -751,6 +751,7 @@ mountmsdosfs(struct vnode *devvp, struct
 	mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
 	MNT_ILOCK(mp);
 	mp->mnt_flag |= MNT_LOCAL;
+	mp->mnt_kern_flag |= MNTK_MPSAFE;
 	MNT_IUNLOCK(mp);
 
 	if (pmp->pm_flags & MSDOSFS_LARGEFS)

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 15:11:10 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6235A1065676;
	Wed, 24 Mar 2010 15:11:10 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5113E8FC14;
	Wed, 24 Mar 2010 15:11: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 o2OFBAtN033464;
	Wed, 24 Mar 2010 15:11:10 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OFBA28033462;
	Wed, 24 Mar 2010 15:11:10 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201003241511.o2OFBA28033462@svn.freebsd.org>
From: Luigi Rizzo 
Date: Wed, 24 Mar 2010 15:11: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: r205600 - stable/8/sys/modules/ipfw
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 15:11:10 -0000

Author: luigi
Date: Wed Mar 24 15:11:10 2010
New Revision: 205600
URL: http://svn.freebsd.org/changeset/base/205600

Log:
  MFC r200636, list all files needed to build the ipfw module
  
  Submitted by:	Alexander Wittig

Modified:
  stable/8/sys/modules/ipfw/Makefile

Modified: stable/8/sys/modules/ipfw/Makefile
==============================================================================
--- stable/8/sys/modules/ipfw/Makefile	Wed Mar 24 14:56:56 2010	(r205599)
+++ stable/8/sys/modules/ipfw/Makefile	Wed Mar 24 15:11:10 2010	(r205600)
@@ -6,6 +6,8 @@
 
 KMOD=	ipfw
 SRCS=	ip_fw2.c ip_fw_pfil.c
+SRCS+=	ip_fw_dynamic.c ip_fw_log.c ip_fw_nat.c
+SRCS+=	ip_fw_sockopt.c ip_fw_table.c
 SRCS+=	opt_inet6.h opt_ipsec.h
 
 CFLAGS+= -DIPFIREWALL

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 15:19:47 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DD6B91065677;
	Wed, 24 Mar 2010 15:19:47 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CC1A18FC12;
	Wed, 24 Mar 2010 15:19: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 o2OFJl11035434;
	Wed, 24 Mar 2010 15:19:47 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OFJlMT035432;
	Wed, 24 Mar 2010 15:19:47 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201003241519.o2OFJlMT035432@svn.freebsd.org>
From: Luigi Rizzo 
Date: Wed, 24 Mar 2010 15:19: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: r205603 - stable/8/sys/netinet/ipfw
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 15:19:48 -0000

Author: luigi
Date: Wed Mar 24 15:19:47 2010
New Revision: 205603
URL: http://svn.freebsd.org/changeset/base/205603

Log:
  MFC 205602:
  Honor ip.fw.one_pass when a packet comes out of a pipe without being delayed.
  I forgot to handle this case when i did the mtag cleanup three months ago.
  
  I am merging immediately because this bugfix is important for
  people using RELENG_8.
  
  PR:           145004

Modified:
  stable/8/sys/netinet/ipfw/ip_dn_io.c

Modified: stable/8/sys/netinet/ipfw/ip_dn_io.c
==============================================================================
--- stable/8/sys/netinet/ipfw/ip_dn_io.c	Wed Mar 24 15:16:59 2010	(r205602)
+++ stable/8/sys/netinet/ipfw/ip_dn_io.c	Wed Mar 24 15:19:47 2010	(r205603)
@@ -762,7 +762,11 @@ dummynet_io(struct mbuf **m0, int dir, s
 	 *     
 	 */
 	if (/*dn_cfg.io_fast &&*/ m == *m0 && (dir & PROTO_LAYER2) == 0 ) {
-		/* fast io */
+		/* fast io, rename the tag * to carry reinject info. */
+		struct m_tag *tag = m_tag_first(m);
+
+		tag->m_tag_cookie = MTAG_IPFW_RULE;
+		tag->m_tag_id = 0;
 		io_pkt_fast++;
 		if (m->m_nextpkt != NULL) {
 			printf("dummynet: fast io: pkt chain detected!\n");

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 17:11:01 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 627F8106566C;
	Wed, 24 Mar 2010 17:11: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 500FE8FC0C;
	Wed, 24 Mar 2010 17:11:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2OHB1If061069;
	Wed, 24 Mar 2010 17:11:01 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OHB13t061066;
	Wed, 24 Mar 2010 17:11:01 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003241711.o2OHB13t061066@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 24 Mar 2010 17:11:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205609 - stable/8/sys/dev/msk
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 17:11:01 -0000

Author: yongari
Date: Wed Mar 24 17:11:01 2010
New Revision: 205609
URL: http://svn.freebsd.org/changeset/base/205609

Log:
  MFC r204541:
    Implement rudimentary interrupt moderation with programmable
    countdown timer register. The timer resolution may vary among
    controllers but the value would be represented by core clock
    cycles. msk(4) will automatically computes number of required clock
    cycles from given micro-seconds unit.
    The default interrupt holdoff timer value is 100us which will
    ensure less than 10k interrupts under load. The timer value can be
    changed with dev.mskc.0.int_holdoff sysctl node.
  
    Note, the interrupt moderation is shared resource on dual-port
    controllers so you can't use separate interrupt moderation value
    for each port. This means we can't stop interrupt moderation in
    driver stop routine. Also have msk_tick() reclaim transmitted Tx
    buffers as safety belt. With this change there is no need to check
    missing Tx completion interrupt in watchdog handler, so remove it.

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

Modified: stable/8/sys/dev/msk/if_msk.c
==============================================================================
--- stable/8/sys/dev/msk/if_msk.c	Wed Mar 24 16:47:12 2010	(r205608)
+++ stable/8/sys/dev/msk/if_msk.c	Wed Mar 24 17:11:01 2010	(r205609)
@@ -1661,6 +1661,14 @@ mskc_attach(device_t dev)
 		}
 	}
 
+	sc->msk_int_holdoff = MSK_INT_HOLDOFF_DEFAULT;
+	SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+	    "int_holdoff", CTLFLAG_RW, &sc->msk_int_holdoff, 0,
+	    "Maximum number of time to delay interrupts");
+	resource_int_value(device_get_name(dev), device_get_unit(dev),
+	    "int_holdoff", &sc->msk_int_holdoff);
+
 	/* Soft reset. */
 	CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
 	CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
@@ -2803,8 +2811,6 @@ static void
 msk_watchdog(struct msk_if_softc *sc_if)
 {
 	struct ifnet *ifp;
-	uint32_t ridx;
-	int idx;
 
 	MSK_IF_LOCK_ASSERT(sc_if);
 
@@ -2821,24 +2827,6 @@ msk_watchdog(struct msk_if_softc *sc_if)
 		return;
 	}
 
-	/*
-	 * Reclaim first as there is a possibility of losing Tx completion
-	 * interrupts.
-	 */
-	ridx = sc_if->msk_port == MSK_PORT_A ? STAT_TXA1_RIDX : STAT_TXA2_RIDX;
-	idx = CSR_READ_2(sc_if->msk_softc, ridx);
-	if (sc_if->msk_cdata.msk_tx_cons != idx) {
-		msk_txeof(sc_if, idx);
-		if (sc_if->msk_cdata.msk_tx_cnt == 0) {
-			if_printf(ifp, "watchdog timeout (missed Tx interrupts) "
-			    "-- recovering\n");
-			if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-				taskqueue_enqueue(taskqueue_fast,
-				    &sc_if->msk_tx_task);
-			return;
-		}
-	}
-
 	if_printf(ifp, "watchdog timeout\n");
 	ifp->if_oerrors++;
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
@@ -3168,6 +3156,7 @@ msk_tick(void *xsc_if)
 	mii_tick(mii);
 	if ((sc_if->msk_flags & MSK_FLAG_LINK) == 0)
 		msk_miibus_statchg(sc_if->msk_if_dev);
+	msk_handle_events(sc_if->msk_softc);
 	msk_watchdog(sc_if);
 	callout_reset(&sc_if->msk_tick_ch, hz, msk_tick, sc_if);
 }
@@ -3906,6 +3895,17 @@ msk_init_locked(struct msk_if_softc *sc_
 		sc->msk_intrmask |= Y2_IS_PORT_B;
 		sc->msk_intrhwemask |= Y2_HWE_L2_MASK;
 	}
+	/* Configure IRQ moderation mask. */
+	CSR_WRITE_4(sc, B2_IRQM_MSK, sc->msk_intrmask);
+	if (sc->msk_int_holdoff > 0) {
+		/* Configure initial IRQ moderation timer value. */
+		CSR_WRITE_4(sc, B2_IRQM_INI,
+		    MSK_USECS(sc, sc->msk_int_holdoff));
+		CSR_WRITE_4(sc, B2_IRQM_VAL,
+		    MSK_USECS(sc, sc->msk_int_holdoff));
+		/* Start IRQ moderation. */
+		CSR_WRITE_1(sc, B2_IRQM_CTRL, TIM_START);
+	}
 	CSR_WRITE_4(sc, B0_HWE_IMSK, sc->msk_intrhwemask);
 	CSR_READ_4(sc, B0_HWE_IMSK);
 	CSR_WRITE_4(sc, B0_IMSK, sc->msk_intrmask);

Modified: stable/8/sys/dev/msk/if_mskreg.h
==============================================================================
--- stable/8/sys/dev/msk/if_mskreg.h	Wed Mar 24 16:47:12 2010	(r205608)
+++ stable/8/sys/dev/msk/if_mskreg.h	Wed Mar 24 17:11:01 2010	(r205609)
@@ -2406,6 +2406,8 @@ struct msk_ring_data {
 #define	MSK_PROC_MIN		30
 #define	MSK_PROC_MAX		(MSK_RX_RING_CNT - 1)
 
+#define	MSK_INT_HOLDOFF_DEFAULT	100
+
 #define	MSK_TX_TIMEOUT		5
 #define	MSK_PUT_WM	10
 
@@ -2496,6 +2498,7 @@ struct msk_softc {
 	bus_dmamap_t		msk_stat_map;
 	struct msk_stat_desc	*msk_stat_ring;
 	bus_addr_t		msk_stat_ring_paddr;
+	int			msk_int_holdoff;
 	int			msk_process_limit;
 	int			msk_stat_cons;
 	struct taskqueue	*msk_tq;

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 17:15:05 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2553B106567B;
	Wed, 24 Mar 2010 17:15:05 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 136088FC2C;
	Wed, 24 Mar 2010 17:15: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 o2OHF4mp062074;
	Wed, 24 Mar 2010 17:15:04 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OHF4e0062072;
	Wed, 24 Mar 2010 17:15:04 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003241715.o2OHF4e0062072@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 24 Mar 2010 17:15: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: r205611 - stable/8/share/man/man4
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 17:15:05 -0000

Author: yongari
Date: Wed Mar 24 17:15:04 2010
New Revision: 205611
URL: http://svn.freebsd.org/changeset/base/205611

Log:
  MFC r204543:
    Document newly added loader tunable and sysctl variable dev.mskc.%d.int_holdoff

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

Modified: stable/8/share/man/man4/msk.4
==============================================================================
--- stable/8/share/man/man4/msk.4	Wed Mar 24 17:13:19 2010	(r205610)
+++ stable/8/share/man/man4/msk.4	Wed Mar 24 17:15:04 2010	(r205611)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 6, 2009
+.Dd March 1, 2010
 .Dt MSK 4
 .Os
 .Sh NAME
@@ -235,6 +235,12 @@ variables and
 .Xr loader 8
 tunables:
 .Bl -tag -width indent
+.It Va dev.mskc.%d.int_holdoff
+Maximum number of time to delay interrupts.
+The valid range is 0 to 34359738 for 125MHz clock in units of 1us,
+the default is 100 (100us).
+The interface need to be brought down and up again before a change
+takes effect.
 .It Va dev.mskc.%d.process_limit
 Maximum amount of Rx events to be processed in the event loop before
 rescheduling a taskqueue.

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 17:18:44 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 699F3106566B;
	Wed, 24 Mar 2010 17:18:44 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5701F8FC12;
	Wed, 24 Mar 2010 17:18: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 o2OHIiCN062959;
	Wed, 24 Mar 2010 17:18:44 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OHIiHZ062956;
	Wed, 24 Mar 2010 17:18:44 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003241718.o2OHIiHZ062956@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 24 Mar 2010 17:18: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: r205613 - stable/8/sys/dev/msk
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 17:18:44 -0000

Author: yongari
Date: Wed Mar 24 17:18:44 2010
New Revision: 205613
URL: http://svn.freebsd.org/changeset/base/205613

Log:
  MFC r204545:
    Remove taskqueue based interrupt handling. After r204541 msk(4)
    does not generate excessive interrupts any more so we don't need
    to have two copies of interrupt handler.
    While I'm here remove two STAT_PUT_IDX register accesses in LE
    status event handler. After r204539 msk(4) always sync status LEs
    so there is no need to resort to reading STAT_PUT_IDX register to
    know the end of status LE processing. Just trust status LE's
    ownership bit.

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

Modified: stable/8/sys/dev/msk/if_msk.c
==============================================================================
--- stable/8/sys/dev/msk/if_msk.c	Wed Mar 24 17:15:39 2010	(r205612)
+++ stable/8/sys/dev/msk/if_msk.c	Wed Mar 24 17:18:44 2010	(r205613)
@@ -113,7 +113,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -257,9 +256,7 @@ static int msk_attach(device_t);
 static int msk_detach(device_t);
 
 static void msk_tick(void *);
-static void msk_legacy_intr(void *);
-static int msk_intr(void *);
-static void msk_int_task(void *, int);
+static void msk_intr(void *);
 static void msk_intr_phy(struct msk_if_softc *);
 static void msk_intr_gmac(struct msk_if_softc *);
 static __inline void msk_rxput(struct msk_if_softc *);
@@ -273,8 +270,8 @@ static void msk_rxeof(struct msk_if_soft
 static void msk_jumbo_rxeof(struct msk_if_softc *, uint32_t, uint32_t, int);
 static void msk_txeof(struct msk_if_softc *, int);
 static int msk_encap(struct msk_if_softc *, struct mbuf **);
-static void msk_tx_task(void *, int);
 static void msk_start(struct ifnet *);
+static void msk_start_locked(struct ifnet *);
 static int msk_ioctl(struct ifnet *, u_long, caddr_t);
 static void msk_set_prefetch(struct msk_softc *, int, bus_addr_t, uint32_t);
 static void msk_set_rambuffer(struct msk_if_softc *);
@@ -1513,9 +1510,6 @@ msk_attach(device_t dev)
 	IFQ_SET_MAXLEN(&ifp->if_snd, MSK_TX_RING_CNT - 1);
 	ifp->if_snd.ifq_drv_maxlen = MSK_TX_RING_CNT - 1;
 	IFQ_SET_READY(&ifp->if_snd);
-
-	TASK_INIT(&sc_if->msk_tx_task, 1, msk_tx_task, ifp);
-
 	/*
 	 * Get station address for this interface. Note that
 	 * dual port cards actually come with three station
@@ -1838,25 +1832,10 @@ mskc_attach(device_t dev)
 	}
 
 	/* Hook interrupt last to avoid having to lock softc. */
-	if (legacy_intr)
-		error = bus_setup_intr(dev, sc->msk_irq[0], INTR_TYPE_NET |
-		    INTR_MPSAFE, NULL, msk_legacy_intr, sc,
-		    &sc->msk_intrhand);
-	else {
-		TASK_INIT(&sc->msk_int_task, 0, msk_int_task, sc);
-		sc->msk_tq = taskqueue_create_fast("msk_taskq", M_WAITOK,
-		    taskqueue_thread_enqueue, &sc->msk_tq);
-		taskqueue_start_threads(&sc->msk_tq, 1, PI_NET, "%s taskq",
-		    device_get_nameunit(sc->msk_dev));
-		error = bus_setup_intr(dev, sc->msk_irq[0], INTR_TYPE_NET |
-		    INTR_MPSAFE, msk_intr, NULL, sc, &sc->msk_intrhand);
-	}
-
+	error = bus_setup_intr(dev, sc->msk_irq[0], INTR_TYPE_NET |
+	    INTR_MPSAFE, NULL, msk_intr, sc, &sc->msk_intrhand);
 	if (error != 0) {
 		device_printf(dev, "couldn't set up interrupt handler\n");
-		if (legacy_intr == 0)
-			taskqueue_free(sc->msk_tq);
-		sc->msk_tq = NULL;
 		goto fail;
 	}
 fail:
@@ -1893,7 +1872,6 @@ msk_detach(device_t dev)
 		/* Can't hold locks while calling detach. */
 		MSK_IF_UNLOCK(sc_if);
 		callout_drain(&sc_if->msk_tick_ch);
-		taskqueue_drain(taskqueue_fast, &sc_if->msk_tx_task);
 		ether_ifdetach(ifp);
 		MSK_IF_LOCK(sc_if);
 	}
@@ -1958,11 +1936,6 @@ mskc_detach(device_t dev)
 
 	msk_status_dma_free(sc);
 
-	if (legacy_intr == 0 && sc->msk_tq != NULL) {
-		taskqueue_drain(sc->msk_tq, &sc->msk_int_task);
-		taskqueue_free(sc->msk_tq);
-		sc->msk_tq = NULL;
-	}
 	if (sc->msk_intrhand) {
 		bus_teardown_intr(dev, sc->msk_irq[0], sc->msk_intrhand);
 		sc->msk_intrhand = NULL;
@@ -2742,30 +2715,29 @@ msk_encap(struct msk_if_softc *sc_if, st
 }
 
 static void
-msk_tx_task(void *arg, int pending)
+msk_start(struct ifnet *ifp)
 {
-	struct ifnet *ifp;
+	struct msk_if_softc *sc_if;
 
-	ifp = arg;
-	msk_start(ifp);
+	sc_if = ifp->if_softc;
+	MSK_IF_LOCK(sc_if);
+	msk_start_locked(ifp);
+	MSK_IF_UNLOCK(sc_if);
 }
 
 static void
-msk_start(struct ifnet *ifp)
+msk_start_locked(struct ifnet *ifp)
 {
-        struct msk_if_softc *sc_if;
-        struct mbuf *m_head;
+	struct msk_if_softc *sc_if;
+	struct mbuf *m_head;
 	int enq;
 
 	sc_if = ifp->if_softc;
-
-	MSK_IF_LOCK(sc_if);
+	MSK_IF_LOCK_ASSERT(sc_if);
 
 	if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
-	    IFF_DRV_RUNNING || (sc_if->msk_flags & MSK_FLAG_LINK) == 0) {
-		MSK_IF_UNLOCK(sc_if);
+	    IFF_DRV_RUNNING || (sc_if->msk_flags & MSK_FLAG_LINK) == 0)
 		return;
-	}
 
 	for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
 	    sc_if->msk_cdata.msk_tx_cnt <
@@ -2803,8 +2775,6 @@ msk_start(struct ifnet *ifp)
 		/* Set a timeout in case the chip goes out to lunch. */
 		sc_if->msk_watchdog_timer = MSK_TX_TIMEOUT;
 	}
-
-	MSK_IF_UNLOCK(sc_if);
 }
 
 static void
@@ -2832,7 +2802,7 @@ msk_watchdog(struct msk_if_softc *sc_if)
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	msk_init_locked(sc_if);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-		taskqueue_enqueue(taskqueue_fast, &sc_if->msk_tx_task);
+		msk_start_locked(ifp);
 }
 
 static int
@@ -3355,20 +3325,16 @@ msk_handle_events(struct msk_softc *sc)
 	int rxput[2];
 	struct msk_stat_desc *sd;
 	uint32_t control, status;
-	int cons, idx, len, port, rxprog;
-
-	idx = CSR_READ_2(sc, STAT_PUT_IDX);
-	if (idx == sc->msk_stat_cons)
-		return (0);
+	int cons, len, port, rxprog;
 
 	/* Sync status LEs. */
 	bus_dmamap_sync(sc->msk_stat_tag, sc->msk_stat_map,
 	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
 	rxput[MSK_PORT_A] = rxput[MSK_PORT_B] = 0;
-
 	rxprog = 0;
-	for (cons = sc->msk_stat_cons; cons != idx;) {
+	cons = sc->msk_stat_cons;
+	for (;;) {
 		sd = &sc->msk_stat_ring[cons];
 		control = le32toh(sd->msk_control);
 		if ((control & HW_OWNER) == 0)
@@ -3441,17 +3407,17 @@ msk_handle_events(struct msk_softc *sc)
 	if (rxput[MSK_PORT_B] > 0)
 		msk_rxput(sc->msk_if[MSK_PORT_B]);
 
-	return (sc->msk_stat_cons != CSR_READ_2(sc, STAT_PUT_IDX));
+	return (rxprog > sc->msk_process_limit ? EAGAIN : 0);
 }
 
-/* Legacy interrupt handler for shared interrupt. */
 static void
-msk_legacy_intr(void *xsc)
+msk_intr(void *xsc)
 {
 	struct msk_softc *sc;
 	struct msk_if_softc *sc_if0, *sc_if1;
 	struct ifnet *ifp0, *ifp1;
 	uint32_t status;
+	int domore;
 
 	sc = xsc;
 	MSK_LOCK(sc);
@@ -3496,9 +3462,8 @@ msk_legacy_intr(void *xsc)
 	if ((status & Y2_IS_HW_ERR) != 0)
 		msk_intr_hwerr(sc);
 
-	while (msk_handle_events(sc) != 0)
-		;
-	if ((status & Y2_IS_STAT_BMU) != 0)
+	domore = msk_handle_events(sc);
+	if ((status & Y2_IS_STAT_BMU) != 0 && domore == 0)
 		CSR_WRITE_4(sc, STAT_CTRL, SC_STAT_CLR_IRQ);
 
 	/* Reenable interrupts. */
@@ -3506,103 +3471,12 @@ msk_legacy_intr(void *xsc)
 
 	if (ifp0 != NULL && (ifp0->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
 	    !IFQ_DRV_IS_EMPTY(&ifp0->if_snd))
-		taskqueue_enqueue(taskqueue_fast, &sc_if0->msk_tx_task);
-	if (ifp1 != NULL && (ifp1->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
-	    !IFQ_DRV_IS_EMPTY(&ifp1->if_snd))
-		taskqueue_enqueue(taskqueue_fast, &sc_if1->msk_tx_task);
-
-	MSK_UNLOCK(sc);
-}
-
-static int
-msk_intr(void *xsc)
-{
-	struct msk_softc *sc;
-	uint32_t status;
-
-	sc = xsc;
-	status = CSR_READ_4(sc, B0_Y2_SP_ISRC2);
-	/* Reading B0_Y2_SP_ISRC2 masks further interrupts. */
-	if (status == 0 || status == 0xffffffff) {
-		CSR_WRITE_4(sc, B0_Y2_SP_ICR, 2);
-		return (FILTER_STRAY);
-	}
-
-	taskqueue_enqueue(sc->msk_tq, &sc->msk_int_task);
-	return (FILTER_HANDLED);
-}
-
-static void
-msk_int_task(void *arg, int pending)
-{
-	struct msk_softc *sc;
-	struct msk_if_softc *sc_if0, *sc_if1;
-	struct ifnet *ifp0, *ifp1;
-	uint32_t status;
-	int domore;
-
-	sc = arg;
-	MSK_LOCK(sc);
-
-	/* Get interrupt source. */
-	status = CSR_READ_4(sc, B0_ISRC);
-	if (status == 0 || status == 0xffffffff ||
-	    (sc->msk_pflags & MSK_FLAG_SUSPEND) != 0 ||
-	    (status & sc->msk_intrmask) == 0)
-		goto done;
-
-	sc_if0 = sc->msk_if[MSK_PORT_A];
-	sc_if1 = sc->msk_if[MSK_PORT_B];
-	ifp0 = ifp1 = NULL;
-	if (sc_if0 != NULL)
-		ifp0 = sc_if0->msk_ifp;
-	if (sc_if1 != NULL)
-		ifp1 = sc_if1->msk_ifp;
-
-	if ((status & Y2_IS_IRQ_PHY1) != 0 && sc_if0 != NULL)
-		msk_intr_phy(sc_if0);
-	if ((status & Y2_IS_IRQ_PHY2) != 0 && sc_if1 != NULL)
-		msk_intr_phy(sc_if1);
-	if ((status & Y2_IS_IRQ_MAC1) != 0 && sc_if0 != NULL)
-		msk_intr_gmac(sc_if0);
-	if ((status & Y2_IS_IRQ_MAC2) != 0 && sc_if1 != NULL)
-		msk_intr_gmac(sc_if1);
-	if ((status & (Y2_IS_CHK_RX1 | Y2_IS_CHK_RX2)) != 0) {
-		device_printf(sc->msk_dev, "Rx descriptor error\n");
-		sc->msk_intrmask &= ~(Y2_IS_CHK_RX1 | Y2_IS_CHK_RX2);
-		CSR_WRITE_4(sc, B0_IMSK, sc->msk_intrmask);
-		CSR_READ_4(sc, B0_IMSK);
-	}
-        if ((status & (Y2_IS_CHK_TXA1 | Y2_IS_CHK_TXA2)) != 0) {
-		device_printf(sc->msk_dev, "Tx descriptor error\n");
-		sc->msk_intrmask &= ~(Y2_IS_CHK_TXA1 | Y2_IS_CHK_TXA2);
-		CSR_WRITE_4(sc, B0_IMSK, sc->msk_intrmask);
-		CSR_READ_4(sc, B0_IMSK);
-	}
-	if ((status & Y2_IS_HW_ERR) != 0)
-		msk_intr_hwerr(sc);
-
-	domore = msk_handle_events(sc);
-	if ((status & Y2_IS_STAT_BMU) != 0)
-		CSR_WRITE_4(sc, STAT_CTRL, SC_STAT_CLR_IRQ);
-
-	if (ifp0 != NULL && (ifp0->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
-	    !IFQ_DRV_IS_EMPTY(&ifp0->if_snd))
-		taskqueue_enqueue(taskqueue_fast, &sc_if0->msk_tx_task);
+		msk_start_locked(ifp0);
 	if (ifp1 != NULL && (ifp1->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
 	    !IFQ_DRV_IS_EMPTY(&ifp1->if_snd))
-		taskqueue_enqueue(taskqueue_fast, &sc_if1->msk_tx_task);
+		msk_start_locked(ifp1);
 
-	if (domore > 0) {
-		taskqueue_enqueue(sc->msk_tq, &sc->msk_int_task);
-		MSK_UNLOCK(sc);
-		return;
-	}
-done:
 	MSK_UNLOCK(sc);
-
-	/* Reenable interrupts. */
-	CSR_WRITE_4(sc, B0_Y2_SP_ICR, 2);
 }
 
 static void

Modified: stable/8/sys/dev/msk/if_mskreg.h
==============================================================================
--- stable/8/sys/dev/msk/if_mskreg.h	Wed Mar 24 17:15:39 2010	(r205612)
+++ stable/8/sys/dev/msk/if_mskreg.h	Wed Mar 24 17:18:44 2010	(r205613)
@@ -2501,8 +2501,6 @@ struct msk_softc {
 	int			msk_int_holdoff;
 	int			msk_process_limit;
 	int			msk_stat_cons;
-	struct taskqueue	*msk_tq;
-	struct task		msk_int_task;
 	struct mtx		msk_mtx;
 };
 
@@ -2547,7 +2545,6 @@ struct msk_if_softc {
 	struct msk_ring_data	msk_rdata;
 	struct msk_softc	*msk_softc;	/* parent controller */
 	struct msk_hw_stats	msk_stats;
-	struct task		msk_tx_task;
 	int			msk_if_flags;
 	uint16_t		msk_vtag;	/* VLAN tag id. */
 };

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 17:29:33 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4AA9D1065674;
	Wed, 24 Mar 2010 17:29: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 38B648FC18;
	Wed, 24 Mar 2010 17:29: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 o2OHTXLV065467;
	Wed, 24 Mar 2010 17:29:33 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OHTXlr065465;
	Wed, 24 Mar 2010 17:29:33 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003241729.o2OHTXlr065465@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 24 Mar 2010 17:29: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: r205615 - stable/8/sys/dev/bge
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 17:29:33 -0000

Author: yongari
Date: Wed Mar 24 17:29:32 2010
New Revision: 205615
URL: http://svn.freebsd.org/changeset/base/205615

Log:
  MFC r204975,204978-204979,204981:
  r204975:
    Enable hardware fixes for BCM5704 B0 as recommended by data sheet.
  r204978:
    Set maximum read byte count to 2048 for PCI-X BCM5703/5704 devices.
    Also disable relaxed ordering as recommended by data sheet for
    PCI-X devices. For PCI-X BCM5704, set maximum outstanding split
    transactions to 0 as indicated by data sheet.
    For BCM5703 in PCI-X mode, DMA read watermark should be less than
    or equal to maximum read byte count configuration. Enforce this
    limitation in DMA read watermark configuration.
  r204979:
    Fix typo in r204975.
  r204981:
    Fix typo in r204978.

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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==============================================================================
--- stable/8/sys/dev/bge/if_bge.c	Wed Mar 24 17:21:05 2010	(r205614)
+++ stable/8/sys/dev/bge/if_bge.c	Wed Mar 24 17:29:32 2010	(r205615)
@@ -1342,6 +1342,7 @@ static int
 bge_chipinit(struct bge_softc *sc)
 {
 	uint32_t dma_rw_ctl;
+	uint16_t val;
 	int i;
 
 	/* Set endianness before we access any non-PCI registers. */
@@ -1362,6 +1363,17 @@ bge_chipinit(struct bge_softc *sc)
 	    i < BGE_STATUS_BLOCK_END + 1; i += sizeof(uint32_t))
 		BGE_MEMWIN_WRITE(sc, i, 0);
 
+	if (sc->bge_chiprev == BGE_CHIPREV_5704_BX) {
+		/*
+		 *  Fix data corruption caused by non-qword write with WB.
+		 *  Fix master abort in PCI mode.
+		 *  Fix PCI latency timer.
+		 */
+		val = pci_read_config(sc->bge_dev, BGE_PCI_MSI_DATA + 2, 2);
+		val |= (1 << 10) | (1 << 12) | (1 << 13);
+		pci_write_config(sc->bge_dev, BGE_PCI_MSI_DATA + 2, val, 2);
+	}
+
 	/*
 	 * Set up the PCI DMA control register.
 	 */
@@ -1378,6 +1390,15 @@ bge_chipinit(struct bge_softc *sc)
 			dma_rw_ctl |= (sc->bge_asicrev == BGE_ASICREV_BCM5780) ?
 			    BGE_PCIDMARWCTL_ONEDMA_ATONCE_GLOBAL :
 			    BGE_PCIDMARWCTL_ONEDMA_ATONCE_LOCAL;
+		} else if (sc->bge_asicrev == BGE_ASICREV_BCM5703) {
+			/*
+			 * In the BCM5703, the DMA read watermark should
+			 * be set to less than or equal to the maximum
+			 * memory read byte count of the PCI-X command
+			 * register.
+			 */
+			dma_rw_ctl |= BGE_PCIDMARWCTL_RD_WAT_SHIFT(4) |
+			    BGE_PCIDMARWCTL_WR_WAT_SHIFT(3);
 		} else if (sc->bge_asicrev == BGE_ASICREV_BCM5704) {
 			/* 1536 bytes for read, 384 bytes for write. */
 			dma_rw_ctl |= BGE_PCIDMARWCTL_RD_WAT_SHIFT(7) |
@@ -3158,7 +3179,26 @@ bge_reset(struct bge_softc *sc)
 	pci_write_config(dev, BGE_PCI_CACHESZ, cachesize, 4);
 	pci_write_config(dev, BGE_PCI_CMD, command, 4);
 	write_op(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ);
-
+	/*
+	 * Disable PCI-X relaxed ordering to ensure status block update
+	 * comes first then packet buffer DMA. Otherwise driver may
+	 * read stale status block.
+	 */
+	if (sc->bge_flags & BGE_FLAG_PCIX) {
+		devctl = pci_read_config(dev,
+		    sc->bge_pcixcap + PCIXR_COMMAND, 2);
+		devctl &= ~PCIXM_COMMAND_ERO;
+		if (sc->bge_asicrev == BGE_ASICREV_BCM5703) {
+			devctl &= ~PCIXM_COMMAND_MAX_READ;
+			devctl |= PCIXM_COMMAND_MAX_READ_2048;
+		} else if (sc->bge_asicrev == BGE_ASICREV_BCM5704) {
+			devctl &= ~(PCIXM_COMMAND_MAX_SPLITS |
+			    PCIXM_COMMAND_MAX_READ);
+			devctl |= PCIXM_COMMAND_MAX_READ_2048;
+		}
+		pci_write_config(dev, sc->bge_pcixcap + PCIXR_COMMAND,
+		    devctl, 2);
+	}
 	/* Re-enable MSI, if neccesary, and enable the memory arbiter. */
 	if (BGE_IS_5714_FAMILY(sc)) {
 		/* This chip disables MSI on reset. */

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 17:36:56 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 762011065670;
	Wed, 24 Mar 2010 17:36:56 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 63C758FC19;
	Wed, 24 Mar 2010 17:36: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 o2OHauPB067224;
	Wed, 24 Mar 2010 17:36:56 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OHauhu067222;
	Wed, 24 Mar 2010 17:36:56 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201003241736.o2OHauhu067222@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 24 Mar 2010 17:36:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205617 - stable/8/sys/dev/msk
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 17:36:56 -0000

Author: yongari
Date: Wed Mar 24 17:36:56 2010
New Revision: 205617
URL: http://svn.freebsd.org/changeset/base/205617

Log:
  MFC r205161:
    It seems PCI_OUR_REG_[1-5] registers are not mapped on PCI
    configuration space on Yukon Ultra(88E8056) such that accesses to
    these registers were NOPs which in turn make msk(4) instable on
    this controller. Use indirect access method to access
    PCI_OUR_REG_[1-5] registers. This should fix a long standing
    instability bug which prevented msk(4) working on Yukon Ultra.
    Special thanks to koitsu who gave me remote access to his system.
  
    PR:	kern/114631, kern/116853

Modified:
  stable/8/sys/dev/msk/if_msk.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)
  stable/8/sys/net/   (props changed)
  stable/8/sys/netinet/ipfw/   (props changed)

Modified: stable/8/sys/dev/msk/if_msk.c
==============================================================================
--- stable/8/sys/dev/msk/if_msk.c	Wed Mar 24 17:32:20 2010	(r205616)
+++ stable/8/sys/dev/msk/if_msk.c	Wed Mar 24 17:36:56 2010	(r205617)
@@ -1125,7 +1125,7 @@ msk_phy_power(struct msk_softc *sc, int 
 		 */
 		CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
 
-		val = pci_read_config(sc->msk_dev, PCI_OUR_REG_1, 4);
+		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
 		val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
 		if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
 			if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
@@ -1136,7 +1136,7 @@ msk_phy_power(struct msk_softc *sc, int 
 			}
 		}
 		/* Release PHY from PowerDown/COMA mode. */
-		pci_write_config(sc->msk_dev, PCI_OUR_REG_1, val, 4);
+		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
 		switch (sc->msk_hw_id) {
 		case CHIP_ID_YUKON_EC_U:
 		case CHIP_ID_YUKON_EX:
@@ -1145,16 +1145,16 @@ msk_phy_power(struct msk_softc *sc, int 
 			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
 
 			/* Enable all clocks. */
-			pci_write_config(sc->msk_dev, PCI_OUR_REG_3, 0, 4);
-			our = pci_read_config(sc->msk_dev, PCI_OUR_REG_4, 4);
+			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
+			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
 			our &= (PCI_FORCE_ASPM_REQUEST|PCI_ASPM_GPHY_LINK_DOWN|
 			    PCI_ASPM_INT_FIFO_EMPTY|PCI_ASPM_CLKRUN_REQUEST);
 			/* Set all bits to 0 except bits 15..12. */
-			pci_write_config(sc->msk_dev, PCI_OUR_REG_4, our, 4);
-			our = pci_read_config(sc->msk_dev, PCI_OUR_REG_5, 4);
+			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, our);
+			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
 			our &= PCI_CTL_TIM_VMAIN_AV_MSK;
-			pci_write_config(sc->msk_dev, PCI_OUR_REG_5, our, 4);
-			pci_write_config(sc->msk_dev, PCI_CFG_REG_1, 0, 4);
+			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, our);
+			CSR_PCI_WRITE_4(sc, PCI_CFG_REG_1, 0);
 			/*
 			 * Disable status race, workaround for
 			 * Yukon EC Ultra & Yukon EX.
@@ -1175,7 +1175,7 @@ msk_phy_power(struct msk_softc *sc, int 
 		}
 		break;
 	case MSK_PHY_POWERDOWN:
-		val = pci_read_config(sc->msk_dev, PCI_OUR_REG_1, 4);
+		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
 		val |= PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD;
 		if (sc->msk_hw_id == CHIP_ID_YUKON_XL &&
 		    sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
@@ -1183,7 +1183,7 @@ msk_phy_power(struct msk_softc *sc, int 
 			if (sc->msk_num_port > 1)
 				val &= ~PCI_Y2_PHY2_COMA;
 		}
-		pci_write_config(sc->msk_dev, PCI_OUR_REG_1, val, 4);
+		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
 
 		val = Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
 		      Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 18:37:59 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2899E1065692;
	Wed, 24 Mar 2010 18:37:59 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD7988FC21;
	Wed, 24 Mar 2010 18:37: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 o2OIbwdf080860;
	Wed, 24 Mar 2010 18:37:58 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OIbwC8080858;
	Wed, 24 Mar 2010 18:37:58 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201003241837.o2OIbwC8080858@svn.freebsd.org>
From: Luigi Rizzo 
Date: Wed, 24 Mar 2010 18:37: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: r205621 - stable/8/sys/modules/dummynet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 18:37:59 -0000

Author: luigi
Date: Wed Mar 24 18:37:58 2010
New Revision: 205621
URL: http://svn.freebsd.org/changeset/base/205621

Log:
  make the module loadable
  
  Submitted by:	Marcin Wisnicki

Modified:
  stable/8/sys/modules/dummynet/Makefile

Modified: stable/8/sys/modules/dummynet/Makefile
==============================================================================
--- stable/8/sys/modules/dummynet/Makefile	Wed Mar 24 18:35:31 2010	(r205620)
+++ stable/8/sys/modules/dummynet/Makefile	Wed Mar 24 18:37:58 2010	(r205621)
@@ -5,6 +5,8 @@
 .PATH:  ${.CURDIR}/../../netinet/ipfw
 KMOD=   dummynet
 SRCS=   ip_dummynet.c
+SRCS+= ip_dn_glue.c ip_dn_io.c
+SRCS+= dn_heap.c dn_sched_fifo.c dn_sched_qfq.c dn_sched_rr.c dn_sched_wf2q.
 SRCS+=	opt_inet6.h
 
 .if !defined(KERNBUILDDIR)

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 19:20:50 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4FA66106566C;
	Wed, 24 Mar 2010 19:20:50 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E4298FC0C;
	Wed, 24 Mar 2010 19:20: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 o2OJKofW090572;
	Wed, 24 Mar 2010 19:20:50 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2OJKoFW090570;
	Wed, 24 Mar 2010 19:20:50 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201003241920.o2OJKoFW090570@svn.freebsd.org>
From: Luigi Rizzo 
Date: Wed, 24 Mar 2010 19:20: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: r205625 - stable/8/sys/modules/dummynet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 19:20:50 -0000

Author: luigi
Date: Wed Mar 24 19:20:49 2010
New Revision: 205625
URL: http://svn.freebsd.org/changeset/base/205625

Log:
  typo...

Modified:
  stable/8/sys/modules/dummynet/Makefile

Modified: stable/8/sys/modules/dummynet/Makefile
==============================================================================
--- stable/8/sys/modules/dummynet/Makefile	Wed Mar 24 19:00:29 2010	(r205624)
+++ stable/8/sys/modules/dummynet/Makefile	Wed Mar 24 19:20:49 2010	(r205625)
@@ -6,7 +6,7 @@
 KMOD=   dummynet
 SRCS=   ip_dummynet.c
 SRCS+= ip_dn_glue.c ip_dn_io.c
-SRCS+= dn_heap.c dn_sched_fifo.c dn_sched_qfq.c dn_sched_rr.c dn_sched_wf2q.
+SRCS+= dn_heap.c dn_sched_fifo.c dn_sched_qfq.c dn_sched_rr.c dn_sched_wf2q.c
 SRCS+=	opt_inet6.h
 
 .if !defined(KERNBUILDDIR)

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Mar 24 23:08:25 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 675E7106564A;
	Wed, 24 Mar 2010 23:08:25 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 573B18FC0C;
	Wed, 24 Mar 2010 23:08: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 o2ON8PL7042687;
	Wed, 24 Mar 2010 23:08:25 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2ON8PeC042685;
	Wed, 24 Mar 2010 23:08:25 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201003242308.o2ON8PeC042685@svn.freebsd.org>
From: Luigi Rizzo 
Date: Wed, 24 Mar 2010 23:08: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: r205632 - stable/8/sbin/ipfw
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 24 Mar 2010 23:08:25 -0000

Author: luigi
Date: Wed Mar 24 23:08:25 2010
New Revision: 205632
URL: http://svn.freebsd.org/changeset/base/205632

Log:
  fix handling of "ipfw set N ..."
  
  Submitted by:	Marcin Wisnicki

Modified:
  stable/8/sbin/ipfw/ipfw2.c

Modified: stable/8/sbin/ipfw/ipfw2.c
==============================================================================
--- stable/8/sbin/ipfw/ipfw2.c	Wed Mar 24 23:06:16 2010	(r205631)
+++ stable/8/sbin/ipfw/ipfw2.c	Wed Mar 24 23:08:25 2010	(r205632)
@@ -2656,7 +2656,7 @@ ipfw_add(char *av[])
 	}
 
 	/* [set N]	-- set number (0..RESVD_SET), optional */
-	if (av[0] && !av[1] && _substrcmp(*av, "set") == 0) {
+	if (av[0] && av[1] && _substrcmp(*av, "set") == 0) {
 		int set = strtoul(av[1], NULL, 10);
 		if (set < 0 || set > RESVD_SET)
 			errx(EX_DATAERR, "illegal set %s", av[1]);

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Mar 25 02:14:04 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CBB80106566B;
	Thu, 25 Mar 2010 02:14:04 +0000 (UTC)
	(envelope-from sobomax@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BA59F8FC0C;
	Thu, 25 Mar 2010 02: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 o2P2E4X9072190;
	Thu, 25 Mar 2010 02:14:04 GMT (envelope-from sobomax@svn.freebsd.org)
Received: (from sobomax@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2P2E4bi072188;
	Thu, 25 Mar 2010 02:14:04 GMT (envelope-from sobomax@svn.freebsd.org)
Message-Id: <201003250214.o2P2E4bi072188@svn.freebsd.org>
From: Maxim Sobolev 
Date: Thu, 25 Mar 2010 02: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: r205634 - stable/8/contrib/tcp_wrappers
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 25 Mar 2010 02:14:04 -0000

Author: sobomax
Date: Thu Mar 25 02:14:04 2010
New Revision: 205634
URL: http://svn.freebsd.org/changeset/base/205634

Log:
  MFC: Allow comment in the middle of the line.

Modified:
  stable/8/contrib/tcp_wrappers/hosts_access.c
Directory Properties:
  stable/8/contrib/tcp_wrappers/   (props changed)

Modified: stable/8/contrib/tcp_wrappers/hosts_access.c
==============================================================================
--- stable/8/contrib/tcp_wrappers/hosts_access.c	Thu Mar 25 00:37:13 2010	(r205633)
+++ stable/8/contrib/tcp_wrappers/hosts_access.c	Thu Mar 25 02:14:04 2010	(r205634)
@@ -148,6 +148,7 @@ struct request_info *request;
     char   *sh_cmd;			/* becomes optional shell command */
     int     match = NO;
     struct tcpd_context saved_context;
+    char   *cp;
 
     saved_context = tcpd_context;		/* stupid compilers */
 
@@ -164,7 +165,16 @@ struct request_info *request;
 		tcpd_warn("missing newline or line too long");
 		continue;
 	    }
-	    if (sv_list[0] == '#' || sv_list[strspn(sv_list, " \t\r\n")] == 0)
+	    /* Ignore anything after unescaped # character */
+	    for (cp = strchr(sv_list, '#'); cp != NULL;) {
+		if (cp > sv_list && cp[-1] == '\\') {
+		    cp = strchr(cp + 1, '#');
+		    continue;
+		}
+		*cp = '\0';
+		break;
+	    }
+	    if (sv_list[strspn(sv_list, " \t\r\n")] == 0)
 		continue;
 	    if ((cl_list = split_at(sv_list, ':')) == 0) {
 		tcpd_warn("missing \":\" separator");

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Mar 25 08:33:57 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 81CC31065674;
	Thu, 25 Mar 2010 08:33: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 701828FC1B;
	Thu, 25 Mar 2010 08:33: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 o2P8XvwD022454;
	Thu, 25 Mar 2010 08:33:57 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2P8XvXR022451;
	Thu, 25 Mar 2010 08:33:57 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <201003250833.o2P8XvXR022451@svn.freebsd.org>
From: Ed Schouten 
Date: Thu, 25 Mar 2010 08:33: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: r205635 - stable/8/usr.bin/script
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 25 Mar 2010 08:33:57 -0000

Author: ed
Date: Thu Mar 25 08:33:56 2010
New Revision: 205635
URL: http://svn.freebsd.org/changeset/base/205635

Log:
  MFC r205008 and 205009:
  
    Make script(1) a little less broken.
  
    Close the file descriptor to the TTY. There is no reason why the parent
    process should keep track of the descriptor. This ensures that the
    application inside properly drains the TTY during exit(2).
  
    Reported by:  alfred

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

Modified: stable/8/usr.bin/script/script.c
==============================================================================
--- stable/8/usr.bin/script/script.c	Thu Mar 25 02:14:04 2010	(r205634)
+++ stable/8/usr.bin/script/script.c	Thu Mar 25 08:33:56 2010	(r205635)
@@ -158,6 +158,7 @@ main(int argc, char *argv[])
 	}
 	if (child == 0)
 		doshell(argv);
+	close(slave);
 
 	if (flushtime > 0)
 		tvp = &tv;

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Mar 25 12:56:20 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CBFDB106566B;
	Thu, 25 Mar 2010 12:56:20 +0000 (UTC)
	(envelope-from gavin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B9C078FC0A;
	Thu, 25 Mar 2010 12: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 o2PCuKVZ074261;
	Thu, 25 Mar 2010 12:56:20 GMT (envelope-from gavin@svn.freebsd.org)
Received: (from gavin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2PCuKfv074259;
	Thu, 25 Mar 2010 12:56:20 GMT (envelope-from gavin@svn.freebsd.org)
Message-Id: <201003251256.o2PCuKfv074259@svn.freebsd.org>
From: Gavin Atkinson 
Date: Thu, 25 Mar 2010 12: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: r205638 - stable/8/usr.sbin/chown
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 25 Mar 2010 12:56:20 -0000

Author: gavin
Date: Thu Mar 25 12:56:20 2010
New Revision: 205638
URL: http://svn.freebsd.org/changeset/base/205638

Log:
  Merge r204165 from head:
  
    Add a "-x" option to chown(8)/chgrp(1) similar to the same option in
    du(1), cp(1) etc, to prevent the crossing of mountpoints whilst using the
    commands recursively.
  
  PR:		bin/130855
  Submitted by:	keramida

Modified:
  stable/8/usr.sbin/chown/chgrp.1
  stable/8/usr.sbin/chown/chown.8
  stable/8/usr.sbin/chown/chown.c
Directory Properties:
  stable/8/usr.sbin/chown/   (props changed)

Modified: stable/8/usr.sbin/chown/chgrp.1
==============================================================================
--- stable/8/usr.sbin/chown/chgrp.1	Thu Mar 25 10:29:00 2010	(r205637)
+++ stable/8/usr.sbin/chown/chgrp.1	Thu Mar 25 12:56:20 2010	(r205638)
@@ -31,7 +31,7 @@
 .\"     @(#)chgrp.1	8.3 (Berkeley) 3/31/94
 .\" $FreeBSD$
 .\"
-.Dd April 25, 2003
+.Dd February 21, 2010
 .Dt CHGRP 1
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .Nd change group
 .Sh SYNOPSIS
 .Nm
-.Op Fl fhv
+.Op Fl fhvx
 .Oo
 .Fl R
 .Op Fl H | Fl L | Fl P
@@ -89,6 +89,8 @@ If the
 flag is specified more than once,
 .Nm
 will print the filename, followed by the old and new numeric group ID.
+.It Fl x
+File system mount points are not traversed.
 .El
 .Pp
 The
@@ -125,7 +127,9 @@ In previous versions of this system, sym
 .Pp
 The
 .Fl v
-option is non-standard and its use in scripts is not recommended.
+and
+.Fl x
+options are non-standard and their use in scripts is not recommended.
 .Sh SEE ALSO
 .Xr chown 2 ,
 .Xr fts 3 ,

Modified: stable/8/usr.sbin/chown/chown.8
==============================================================================
--- stable/8/usr.sbin/chown/chown.8	Thu Mar 25 10:29:00 2010	(r205637)
+++ stable/8/usr.sbin/chown/chown.8	Thu Mar 25 12:56:20 2010	(r205638)
@@ -28,7 +28,7 @@
 .\"     @(#)chown.8	8.3 (Berkeley) 3/31/94
 .\" $FreeBSD$
 .\"
-.Dd April 25, 2003
+.Dd February 21, 2010
 .Dt CHOWN 8
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Nd change file owner and group
 .Sh SYNOPSIS
 .Nm
-.Op Fl fhv
+.Op Fl fhvx
 .Oo
 .Fl R
 .Op Fl H | Fl L | Fl P
@@ -44,7 +44,7 @@
 .Ar owner Ns Op : Ns Ar group
 .Ar
 .Nm
-.Op Fl fhv
+.Op Fl fhvx
 .Oo
 .Fl R
 .Op Fl H | Fl L | Fl P
@@ -97,6 +97,8 @@ If the
 flag is specified more than once,
 .Nm
 will print the filename, followed by the old and new numeric user/group ID.
+.It Fl x
+File system mount points are not traversed.
 .El
 .Pp
 The
@@ -146,7 +148,9 @@ owners.
 .Pp
 The
 .Fl v
-option is non-standard and its use in scripts is not recommended.
+and
+.Fl x
+options are non-standard and their use in scripts is not recommended.
 .Sh SEE ALSO
 .Xr chgrp 1 ,
 .Xr find 1 ,

Modified: stable/8/usr.sbin/chown/chown.c
==============================================================================
--- stable/8/usr.sbin/chown/chown.c	Thu Mar 25 10:29:00 2010	(r205637)
+++ stable/8/usr.sbin/chown/chown.c	Thu Mar 25 12:56:20 2010	(r205638)
@@ -73,14 +73,14 @@ main(int argc, char **argv)
 {
 	FTS *ftsp;
 	FTSENT *p;
-	int Hflag, Lflag, Rflag, fflag, hflag, vflag;
+	int Hflag, Lflag, Rflag, fflag, hflag, vflag, xflag;
 	int ch, fts_options, rval;
 	char *cp;
 
 	ischown = (strcmp(basename(argv[0]), "chown") == 0);
 
-	Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
-	while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
+	Hflag = Lflag = Rflag = fflag = hflag = vflag = xflag = 0;
+	while ((ch = getopt(argc, argv, "HLPRfhvx")) != -1)
 		switch (ch) {
 		case 'H':
 			Hflag = 1;
@@ -105,6 +105,9 @@ main(int argc, char **argv)
 		case 'v':
 			vflag++;
 			break;
+		case 'x':
+			xflag = 1;
+			break;
 		case '?':
 		default:
 			usage();
@@ -128,6 +131,8 @@ main(int argc, char **argv)
 		}
 	} else
 		fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
+	if (xflag)
+		fts_options |= FTS_XDEV;
 
 	uid = (uid_t)-1;
 	gid = (gid_t)-1;
@@ -301,11 +306,11 @@ usage(void)
 
 	if (ischown)
 		(void)fprintf(stderr, "%s\n%s\n",
-		    "usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group]"
+		    "usage: chown [-fhvx] [-R [-H | -L | -P]] owner[:group]"
 		    " file ...",
-		    "       chown [-fhv] [-R [-H | -L | -P]] :group file ...");
+		    "       chown [-fhvx] [-R [-H | -L | -P]] :group file ...");
 	else
 		(void)fprintf(stderr, "%s\n",
-		    "usage: chgrp [-fhv] [-R [-H | -L | -P]] group file ...");
+		    "usage: chgrp [-fhvx] [-R [-H | -L | -P]] group file ...");
 	exit(1);
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Mar 25 15:48:24 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6B540106566C;
	Thu, 25 Mar 2010 15:48:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3F9518FC15;
	Thu, 25 Mar 2010 15:48: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 o2PFmOL9066286;
	Thu, 25 Mar 2010 15:48:24 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2PFmOcx066283;
	Thu, 25 Mar 2010 15:48:24 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201003251548.o2PFmOcx066283@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 25 Mar 2010 15:48:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205645 - in stable/8/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 25 Mar 2010 15:48:24 -0000

Author: jhb
Date: Thu Mar 25 15:48:23 2010
New Revision: 205645
URL: http://svn.freebsd.org/changeset/base/205645

Log:
  MFC 205013:
  Print out the family and model from the cpu_id.  This is especially useful
  given the advent of the extended family and extended model fields.  The
  values are printed in hex to match their common usage in documentation.

Modified:
  stable/8/sys/amd64/amd64/identcpu.c
  stable/8/sys/i386/i386/identcpu.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/amd64/amd64/identcpu.c
==============================================================================
--- stable/8/sys/amd64/amd64/identcpu.c	Thu Mar 25 14:44:13 2010	(r205644)
+++ stable/8/sys/amd64/amd64/identcpu.c	Thu Mar 25 15:48:23 2010	(r205645)
@@ -187,7 +187,9 @@ printcpuinfo(void)
 	if (cpu_vendor_id == CPU_VENDOR_INTEL ||
 	    cpu_vendor_id == CPU_VENDOR_AMD ||
 	    cpu_vendor_id == CPU_VENDOR_CENTAUR) {
-		printf("  Stepping = %u", cpu_id & 0xf);
+		printf("  Family = %x", CPUID_TO_FAMILY(cpu_id));
+		printf("  Model = %x", CPUID_TO_MODEL(cpu_id));
+		printf("  Stepping = %u", cpu_id & CPUID_STEPPING);
 		if (cpu_high > 0) {
 
 			/*

Modified: stable/8/sys/i386/i386/identcpu.c
==============================================================================
--- stable/8/sys/i386/i386/identcpu.c	Thu Mar 25 14:44:13 2010	(r205644)
+++ stable/8/sys/i386/i386/identcpu.c	Thu Mar 25 15:48:23 2010	(r205645)
@@ -672,9 +672,11 @@ printcpuinfo(void)
 	    cpu_vendor_id == CPU_VENDOR_NSC ||
 		(cpu_vendor_id == CPU_VENDOR_CYRIX &&
 		 ((cpu_id & 0xf00) > 0x500))) {
-		printf("  Stepping = %u", cpu_id & 0xf);
+		printf("  Family = %x", CPUID_TO_FAMILY(cpu_id));
+		printf("  Model = %x", CPUID_TO_MODEL(cpu_id));
+		printf("  Stepping = %u", cpu_id & CPUID_STEPPING);
 		if (cpu_vendor_id == CPU_VENDOR_CYRIX)
-			printf("  DIR=0x%04x", cyrix_did);
+			printf("\n  DIR=0x%04x", cyrix_did);
 		if (cpu_high > 0) {
 
 			/*

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Mar 25 20:07:31 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 02B2A106566B;
	Thu, 25 Mar 2010 20:07:31 +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 E499C8FC17;
	Thu, 25 Mar 2010 20:07: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 o2PK7UqH024047;
	Thu, 25 Mar 2010 20:07:30 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2PK7ULI024045;
	Thu, 25 Mar 2010 20:07:30 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201003252007.o2PK7ULI024045@svn.freebsd.org>
From: Xin LI 
Date: Thu, 25 Mar 2010 20:07: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: r205655 - in stable: 6/contrib/cpio/lib
	7/contrib/cpio/lib 8/contrib/cpio/lib
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 25 Mar 2010 20:07:31 -0000

Author: delphij
Date: Thu Mar 25 20:07:30 2010
New Revision: 205655
URL: http://svn.freebsd.org/changeset/base/205655

Log:
  MFC r205654:
  
  The rmt client in GNU cpio could have a heap overflow when a malicious
  remote tape service returns deliberately crafted packets containing
  more data than requested.
  
  Fix this by checking the returned amount of data and bail out when it
  is more than what we requested.
  
  PR:		gnu/145010
  Submitted by:	naddy
  Reviewed by:	imp
  Security:	CVE-2010-0624

Modified:
  stable/8/contrib/cpio/lib/rtapelib.c
Directory Properties:
  stable/8/contrib/cpio/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/6/contrib/cpio/lib/rtapelib.c
  stable/7/contrib/cpio/lib/rtapelib.c
Directory Properties:
  stable/6/contrib/cpio/   (props changed)
  stable/7/contrib/cpio/   (props changed)

Modified: stable/8/contrib/cpio/lib/rtapelib.c
==============================================================================
--- stable/8/contrib/cpio/lib/rtapelib.c	Thu Mar 25 20:02:54 2010	(r205654)
+++ stable/8/contrib/cpio/lib/rtapelib.c	Thu Mar 25 20:07:30 2010	(r205655)
@@ -570,7 +570,8 @@ rmt_read__ (int handle, char *buffer, si
 
   sprintf (command_buffer, "R%lu\n", (unsigned long) length);
   if (do_command (handle, command_buffer) == -1
-      || (status = get_status (handle)) == SAFE_READ_ERROR)
+      || (status = get_status (handle)) == SAFE_READ_ERROR
+      || status > length)
     return SAFE_READ_ERROR;
 
   for (counter = 0; counter < status; counter += rlen, buffer += rlen)

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Mar 25 23:38:10 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6EE39106566B;
	Thu, 25 Mar 2010 23:38:10 +0000 (UTC)
	(envelope-from sobomax@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5CBBE8FC0A;
	Thu, 25 Mar 2010 23:38: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 o2PNcA9D070425;
	Thu, 25 Mar 2010 23:38:10 GMT (envelope-from sobomax@svn.freebsd.org)
Received: (from sobomax@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2PNcA7Z070423;
	Thu, 25 Mar 2010 23:38:10 GMT (envelope-from sobomax@svn.freebsd.org)
Message-Id: <201003252338.o2PNcA7Z070423@svn.freebsd.org>
From: Maxim Sobolev 
Date: Thu, 25 Mar 2010 23:38: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: r205657 - stable/8/sys/dev/mii
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 25 Mar 2010 23:38:10 -0000

Author: sobomax
Date: Thu Mar 25 23:38:10 2010
New Revision: 205657
URL: http://svn.freebsd.org/changeset/base/205657

Log:
  MFC: workaround no-carrier issue on IBM HS21.
  
  PR:		118238

Modified:
  stable/8/sys/dev/mii/brgphy.c
Directory Properties:
  stable/8/sys/dev/mii/   (props changed)

Modified: stable/8/sys/dev/mii/brgphy.c
==============================================================================
--- stable/8/sys/dev/mii/brgphy.c	Thu Mar 25 22:41:01 2010	(r205656)
+++ stable/8/sys/dev/mii/brgphy.c	Thu Mar 25 23:38:10 2010	(r205657)
@@ -72,8 +72,9 @@ struct brgphy_softc {
 	int mii_model;
 	int mii_rev;
 	int serdes_flags;	/* Keeps track of the serdes type used */
-#define BRGPHY_5706S	0x0001
-#define BRGPHY_5708S	0x0002
+#define BRGPHY_5706S		0x0001
+#define BRGPHY_5708S		0x0002
+#define BRGPHY_NOANWAIT		0x0004
 	int bce_phy_flags;	/* PHY flags transferred from the MAC driver */
 };
 
@@ -142,6 +143,23 @@ static const struct mii_phydesc brgphys[
 	MII_PHY_END
 };
 
+#define HS21_PRODUCT_ID	"IBM eServer BladeCenter HS21"
+#define HS21_BCM_CHIPID	0x57081021
+
+static int
+detect_hs21(struct bce_softc *bce_sc)
+{
+	char *sysenv;
+
+	if (bce_sc->bce_chipid != HS21_BCM_CHIPID)
+		return (0);
+	sysenv = getenv("smbios.system.product");
+	if (sysenv == NULL)
+		return (0);
+	if (strncmp(sysenv, HS21_PRODUCT_ID, strlen(HS21_PRODUCT_ID)) != 0)
+		return (0);
+	return (1);
+}
 
 /* Search for our PHY in the list of known PHYs */
 static int
@@ -291,6 +309,19 @@ brgphy_attach(device_t dev)
 		if (bce_sc && (bce_sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG)) {
 			ADD(IFM_MAKEWORD(IFM_ETHER, IFM_2500_SX, IFM_FDX, sc->mii_inst), 0);
 			printf("2500baseSX-FDX, ");
+		} else if ((bsc->serdes_flags & BRGPHY_5708S) && bce_sc &&
+		    (detect_hs21(bce_sc) != 0)) {
+			/*
+			 * There appears to be certain silicon revision
+			 * in IBM HS21 blades that is having issues with
+			 * this driver wating for the auto-negotiation to
+			 * complete. This happens with a specific chip id
+			 * only and when the 1000baseSX-FDX is the only
+			 * mode. Workaround this issue since it's unlikely
+			 * to be ever addressed.
+			 */
+			printf("auto-neg workaround, ");
+			bsc->serdes_flags |= BRGPHY_NOANWAIT;
 		}
 	}
 
@@ -544,7 +575,8 @@ brgphy_status(struct mii_softc *sc)
 
 	/* Autoneg is still in progress. */
 	if ((bmcr & BRGPHY_BMCR_AUTOEN) &&
-	    (bmsr & BRGPHY_BMSR_ACOMP) == 0) {
+	    (bmsr & BRGPHY_BMSR_ACOMP) == 0 &&
+	    (bsc->serdes_flags & BRGPHY_NOANWAIT) == 0) {
 		/* Erg, still trying, I guess... */
 		mii->mii_media_active |= IFM_NONE;
 		goto brgphy_status_exit;

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 05:13:44 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 88099106564A;
	Fri, 26 Mar 2010 05:13:44 +0000 (UTC)
	(envelope-from joerg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 767AB8FC12;
	Fri, 26 Mar 2010 05:13: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 o2Q5DiDx046823;
	Fri, 26 Mar 2010 05:13:44 GMT (envelope-from joerg@svn.freebsd.org)
Received: (from joerg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2Q5Dijp046822;
	Fri, 26 Mar 2010 05:13:44 GMT (envelope-from joerg@svn.freebsd.org)
Message-Id: <201003260513.o2Q5Dijp046822@svn.freebsd.org>
From: Joerg Wunsch 
Date: Fri, 26 Mar 2010 05:13: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: r205667 - stable/8/etc/defaults
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 05:13:44 -0000

Author: joerg
Date: Fri Mar 26 05:13:43 2010
New Revision: 205667
URL: http://svn.freebsd.org/changeset/base/205667

Log:
  r205509:
  
    Add .snap to daily_clean_tmps_ignore; /tmp/.snap ist not supposed to
    be auto-removed (and /tmp is a filesystem of its own now by
    default).

Modified:
  stable/8/etc/defaults/periodic.conf
Directory Properties:
  stable/8/etc/   (props changed)

Modified: stable/8/etc/defaults/periodic.conf
==============================================================================
--- stable/8/etc/defaults/periodic.conf	Fri Mar 26 03:02:31 2010	(r205666)
+++ stable/8/etc/defaults/periodic.conf	Fri Mar 26 05:13:43 2010	(r205667)
@@ -46,7 +46,7 @@ daily_clean_tmps_enable="NO"				# Delete
 daily_clean_tmps_dirs="/tmp"				# Delete under here
 daily_clean_tmps_days="3"				# If not accessed for
 daily_clean_tmps_ignore=".X*-lock .X11-unix .ICE-unix .font-unix .XIM-unix"
-daily_clean_tmps_ignore="$daily_clean_tmps_ignore quota.user quota.group"
+daily_clean_tmps_ignore="$daily_clean_tmps_ignore quota.user quota.group .snap"
 							# Don't delete these
 daily_clean_tmps_verbose="YES"				# Mention files deleted
 

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 12:51:05 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 978921065679;
	Fri, 26 Mar 2010 12:51:05 +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 855268FC1F;
	Fri, 26 Mar 2010 12: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 o2QCp5ZJ049706;
	Fri, 26 Mar 2010 12:51:05 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QCp5MC049705;
	Fri, 26 Mar 2010 12:51:05 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201003261251.o2QCp5MC049705@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 26 Mar 2010 12: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: r205684 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/mii dev/xen/xenpci net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 12:51:05 -0000

Author: jhb
Date: Fri Mar 26 12:51:05 2010
New Revision: 205684
URL: http://svn.freebsd.org/changeset/base/205684

Log:
  Move mergeinfo for dev/mii up to sys.

Modified:
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/mii/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/   (props changed)

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 13:01:30 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 66040106566B;
	Fri, 26 Mar 2010 13:01: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 549528FC16;
	Fri, 26 Mar 2010 13:01: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 o2QD1Uqv052228;
	Fri, 26 Mar 2010 13:01:30 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QD1U7H052225;
	Fri, 26 Mar 2010 13:01:30 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201003261301.o2QD1U7H052225@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 26 Mar 2010 13:01: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: r205687 - in stable/8/sys: amd64/include i386/include
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 13:01:30 -0000

Author: jhb
Date: Fri Mar 26 13:01:30 2010
New Revision: 205687
URL: http://svn.freebsd.org/changeset/base/205687

Log:
  MFC 205210,205448:
  Remove unneeded type specifiers from 64-bit constants.  The compiler
  infers their natural type from the constants' values.

Modified:
  stable/8/sys/amd64/include/specialreg.h
  stable/8/sys/i386/include/specialreg.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)
  stable/8/sys/net/   (props changed)
  stable/8/sys/netinet/ipfw/   (props changed)

Modified: stable/8/sys/amd64/include/specialreg.h
==============================================================================
--- stable/8/sys/amd64/include/specialreg.h	Fri Mar 26 12:59:15 2010	(r205686)
+++ stable/8/sys/amd64/include/specialreg.h	Fri Mar 26 13:01:30 2010	(r205687)
@@ -320,16 +320,16 @@
 #define	MTRR_N64K		8	/* numbers of fixed-size entries */
 #define	MTRR_N16K		16
 #define	MTRR_N4K		64
-#define	MTRR_CAP_WC		0x0000000000000400UL
-#define	MTRR_CAP_FIXED		0x0000000000000100UL
-#define	MTRR_CAP_VCNT		0x00000000000000ffUL
-#define	MTRR_DEF_ENABLE		0x0000000000000800UL
-#define	MTRR_DEF_FIXED_ENABLE	0x0000000000000400UL
-#define	MTRR_DEF_TYPE		0x00000000000000ffUL
-#define	MTRR_PHYSBASE_PHYSBASE	0x000ffffffffff000UL
-#define	MTRR_PHYSBASE_TYPE	0x00000000000000ffUL
-#define	MTRR_PHYSMASK_PHYSMASK	0x000ffffffffff000UL
-#define	MTRR_PHYSMASK_VALID	0x0000000000000800UL
+#define	MTRR_CAP_WC		0x0000000000000400
+#define	MTRR_CAP_FIXED		0x0000000000000100
+#define	MTRR_CAP_VCNT		0x00000000000000ff
+#define	MTRR_DEF_ENABLE		0x0000000000000800
+#define	MTRR_DEF_FIXED_ENABLE	0x0000000000000400
+#define	MTRR_DEF_TYPE		0x00000000000000ff
+#define	MTRR_PHYSBASE_PHYSBASE	0x000ffffffffff000
+#define	MTRR_PHYSBASE_TYPE	0x00000000000000ff
+#define	MTRR_PHYSMASK_PHYSMASK	0x000ffffffffff000
+#define	MTRR_PHYSMASK_VALID	0x0000000000000800
 
 /* Performance Control Register (5x86 only). */
 #define	PCR0			0x20
@@ -357,22 +357,22 @@
 #define	MCG_STATUS_RIPV		0x00000001
 #define	MCG_STATUS_EIPV		0x00000002
 #define	MCG_STATUS_MCIP		0x00000004
-#define	MCG_CTL_ENABLE		0xffffffffffffffffUL
-#define	MCG_CTL_DISABLE		0x0000000000000000UL
+#define	MCG_CTL_ENABLE		0xffffffffffffffff
+#define	MCG_CTL_DISABLE		0x0000000000000000
 #define	MSR_MC_CTL(x)		(MSR_MC0_CTL + (x) * 4)
 #define	MSR_MC_STATUS(x)	(MSR_MC0_STATUS + (x) * 4)
 #define	MSR_MC_ADDR(x)		(MSR_MC0_ADDR + (x) * 4)
 #define	MSR_MC_MISC(x)		(MSR_MC0_MISC + (x) * 4)
-#define	MC_STATUS_MCA_ERROR	0x000000000000ffffUL
-#define	MC_STATUS_MODEL_ERROR	0x00000000ffff0000UL
-#define	MC_STATUS_OTHER_INFO	0x01ffffff00000000UL
-#define	MC_STATUS_PCC		0x0200000000000000UL
-#define	MC_STATUS_ADDRV		0x0400000000000000UL
-#define	MC_STATUS_MISCV		0x0800000000000000UL
-#define	MC_STATUS_EN		0x1000000000000000UL
-#define	MC_STATUS_UC		0x2000000000000000UL
-#define	MC_STATUS_OVER		0x4000000000000000UL
-#define	MC_STATUS_VAL		0x8000000000000000UL
+#define	MC_STATUS_MCA_ERROR	0x000000000000ffff
+#define	MC_STATUS_MODEL_ERROR	0x00000000ffff0000
+#define	MC_STATUS_OTHER_INFO	0x01ffffff00000000
+#define	MC_STATUS_PCC		0x0200000000000000
+#define	MC_STATUS_ADDRV		0x0400000000000000
+#define	MC_STATUS_MISCV		0x0800000000000000
+#define	MC_STATUS_EN		0x1000000000000000
+#define	MC_STATUS_UC		0x2000000000000000
+#define	MC_STATUS_OVER		0x4000000000000000
+#define	MC_STATUS_VAL		0x8000000000000000
 
 /*
  * The following four 3-byte registers control the non-cacheable regions.

Modified: stable/8/sys/i386/include/specialreg.h
==============================================================================
--- stable/8/sys/i386/include/specialreg.h	Fri Mar 26 12:59:15 2010	(r205686)
+++ stable/8/sys/i386/include/specialreg.h	Fri Mar 26 13:01:30 2010	(r205687)
@@ -326,16 +326,16 @@
 #define	MTRR_N64K		8	/* numbers of fixed-size entries */
 #define	MTRR_N16K		16
 #define	MTRR_N4K		64
-#define	MTRR_CAP_WC		0x0000000000000400ULL
-#define	MTRR_CAP_FIXED		0x0000000000000100ULL
-#define	MTRR_CAP_VCNT		0x00000000000000ffULL
-#define	MTRR_DEF_ENABLE		0x0000000000000800ULL
-#define	MTRR_DEF_FIXED_ENABLE	0x0000000000000400ULL
-#define	MTRR_DEF_TYPE		0x00000000000000ffULL
-#define	MTRR_PHYSBASE_PHYSBASE	0x000ffffffffff000ULL
-#define	MTRR_PHYSBASE_TYPE	0x00000000000000ffULL
-#define	MTRR_PHYSMASK_PHYSMASK	0x000ffffffffff000ULL
-#define	MTRR_PHYSMASK_VALID	0x0000000000000800ULL
+#define	MTRR_CAP_WC		0x0000000000000400
+#define	MTRR_CAP_FIXED		0x0000000000000100
+#define	MTRR_CAP_VCNT		0x00000000000000ff
+#define	MTRR_DEF_ENABLE		0x0000000000000800
+#define	MTRR_DEF_FIXED_ENABLE	0x0000000000000400
+#define	MTRR_DEF_TYPE		0x00000000000000ff
+#define	MTRR_PHYSBASE_PHYSBASE	0x000ffffffffff000
+#define	MTRR_PHYSBASE_TYPE	0x00000000000000ff
+#define	MTRR_PHYSMASK_PHYSMASK	0x000ffffffffff000
+#define	MTRR_PHYSMASK_VALID	0x0000000000000800
 
 /*
  * Cyrix configuration registers, accessible as IO ports.
@@ -426,22 +426,22 @@
 #define	MCG_STATUS_RIPV		0x00000001
 #define	MCG_STATUS_EIPV		0x00000002
 #define	MCG_STATUS_MCIP		0x00000004
-#define	MCG_CTL_ENABLE		0xffffffffffffffffUL
-#define	MCG_CTL_DISABLE		0x0000000000000000UL
+#define	MCG_CTL_ENABLE		0xffffffffffffffff
+#define	MCG_CTL_DISABLE		0x0000000000000000
 #define	MSR_MC_CTL(x)		(MSR_MC0_CTL + (x) * 4)
 #define	MSR_MC_STATUS(x)	(MSR_MC0_STATUS + (x) * 4)
 #define	MSR_MC_ADDR(x)		(MSR_MC0_ADDR + (x) * 4)
 #define	MSR_MC_MISC(x)		(MSR_MC0_MISC + (x) * 4)
-#define	MC_STATUS_MCA_ERROR	0x000000000000ffffUL
-#define	MC_STATUS_MODEL_ERROR	0x00000000ffff0000UL
-#define	MC_STATUS_OTHER_INFO	0x01ffffff00000000UL
-#define	MC_STATUS_PCC		0x0200000000000000UL
-#define	MC_STATUS_ADDRV		0x0400000000000000UL
-#define	MC_STATUS_MISCV		0x0800000000000000UL
-#define	MC_STATUS_EN		0x1000000000000000UL
-#define	MC_STATUS_UC		0x2000000000000000UL
-#define	MC_STATUS_OVER		0x4000000000000000UL
-#define	MC_STATUS_VAL		0x8000000000000000UL
+#define	MC_STATUS_MCA_ERROR	0x000000000000ffff
+#define	MC_STATUS_MODEL_ERROR	0x00000000ffff0000
+#define	MC_STATUS_OTHER_INFO	0x01ffffff00000000
+#define	MC_STATUS_PCC		0x0200000000000000
+#define	MC_STATUS_ADDRV		0x0400000000000000
+#define	MC_STATUS_MISCV		0x0800000000000000
+#define	MC_STATUS_EN		0x1000000000000000
+#define	MC_STATUS_UC		0x2000000000000000
+#define	MC_STATUS_OVER		0x4000000000000000
+#define	MC_STATUS_VAL		0x8000000000000000
 
 /*
  * The following four 3-byte registers control the non-cacheable regions.

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 13:49:47 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2AE101065672;
	Fri, 26 Mar 2010 13:49: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 18BCD8FC08;
	Fri, 26 Mar 2010 13:49: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 o2QDnkMb062952;
	Fri, 26 Mar 2010 13:49:46 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QDnkro062945;
	Fri, 26 Mar 2010 13:49:46 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201003261349.o2QDnkro062945@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 26 Mar 2010 13:49: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: r205689 - in stable/8/sys: amd64/amd64 amd64/include
	i386/i386 i386/include
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 13:49:47 -0000

Author: jhb
Date: Fri Mar 26 13:49:46 2010
New Revision: 205689
URL: http://svn.freebsd.org/changeset/base/205689

Log:
  MFC 205214:
  - Extend the machine check record structure to include several fields useful
    for parsing model-specific and other fields in machine check events
    including the global machine check capabilities and status registers,
    CPU identification, and the FreeBSD CPU ID.
  - Report these added fields in the console log of a machine check so that
    a record structure can be reconstituted from the console messages.
  - Parse new architectural errors including memory controller errors.

Modified:
  stable/8/sys/amd64/amd64/mca.c
  stable/8/sys/amd64/include/mca.h
  stable/8/sys/amd64/include/specialreg.h
  stable/8/sys/i386/i386/mca.c
  stable/8/sys/i386/include/mca.h
  stable/8/sys/i386/include/specialreg.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)
  stable/8/sys/net/   (props changed)
  stable/8/sys/netinet/ipfw/   (props changed)

Modified: stable/8/sys/amd64/amd64/mca.c
==============================================================================
--- stable/8/sys/amd64/amd64/mca.c	Fri Mar 26 13:01:53 2010	(r205688)
+++ stable/8/sys/amd64/amd64/mca.c	Fri Mar 26 13:49:46 2010	(r205689)
@@ -177,19 +177,46 @@ mca_error_request(uint16_t mca_error)
 	return ("???");
 }
 
+static const char *
+mca_error_mmtype(uint16_t mca_error)
+{
+
+	switch ((mca_error & 0x70) >> 4) {
+	case 0x0:
+		return ("GEN");
+	case 0x1:
+		return ("RD");
+	case 0x2:
+		return ("WR");
+	case 0x3:
+		return ("AC");
+	case 0x4:
+		return ("MS");
+	}
+	return ("???");
+}
+
 /* Dump details about a single machine check. */
 static void __nonnull(1)
 mca_log(const struct mca_record *rec)
 {
 	uint16_t mca_error;
 
-	printf("MCA: bank %d, status 0x%016llx\n", rec->mr_bank,
+	printf("MCA: Bank %d, Status 0x%016llx\n", rec->mr_bank,
 	    (long long)rec->mr_status);
-	printf("MCA: CPU %d ", rec->mr_apic_id);
+	printf("MCA: Global Cap 0x%016llx, Status 0x%016llx\n",
+	    (long long)rec->mr_mcg_cap, (long long)rec->mr_mcg_status);
+	printf("MCA: Vendor \"%s\", ID 0x%x, APIC ID %d\n", cpu_vendor,
+	    rec->mr_cpu_id, rec->mr_apic_id);
+	printf("MCA: CPU %d ", rec->mr_cpu);
 	if (rec->mr_status & MC_STATUS_UC)
 		printf("UNCOR ");
-	else
+	else {
 		printf("COR ");
+		if (rec->mr_mcg_cap & MCG_CAP_TES_P)
+			printf("(%lld) ", ((long long)rec->mr_status &
+			    MC_STATUS_COR_COUNT) >> 38);
+	}
 	if (rec->mr_status & MC_STATUS_PCC)
 		printf("PCC ");
 	if (rec->mr_status & MC_STATUS_OVER)
@@ -212,6 +239,9 @@ mca_log(const struct mca_record *rec)
 	case 0x0004:
 		printf("FRC error");
 		break;
+	case 0x0005:
+		printf("internal parity error");
+		break;
 	case 0x0400:
 		printf("internal timer error");
 		break;
@@ -236,6 +266,17 @@ mca_log(const struct mca_record *rec)
 			break;
 		}
 
+		/* Memory controller error. */
+		if ((mca_error & 0xef80) == 0x0080) {
+			printf("%s channel ", mca_error_mmtype(mca_error));
+			if ((mca_error & 0x000f) != 0x000f)
+				printf("%d", mca_error & 0x000f);
+			else
+				printf("??");
+			printf(" memory error");
+			break;
+		}
+		
 		/* Cache error. */
 		if ((mca_error & 0xef00) == 0x0100) {
 			printf("%sCACHE %s %s error",
@@ -313,6 +354,11 @@ mca_check_status(int bank, struct mca_re
 		rec->mr_misc = rdmsr(MSR_MC_MISC(bank));
 	rec->mr_tsc = rdtsc();
 	rec->mr_apic_id = PCPU_GET(apic_id);
+	rec->mr_mcg_cap = rdmsr(MSR_MCG_CAP);
+	rec->mr_mcg_status = rdmsr(MSR_MCG_STATUS);
+	rec->mr_cpu_id = cpu_id;
+	rec->mr_cpu_vendor_id = cpu_vendor_id;
+	rec->mr_cpu = PCPU_GET(cpuid);
 
 	/*
 	 * Clear machine check.  Don't do this for uncorrectable

Modified: stable/8/sys/amd64/include/mca.h
==============================================================================
--- stable/8/sys/amd64/include/mca.h	Fri Mar 26 13:01:53 2010	(r205688)
+++ stable/8/sys/amd64/include/mca.h	Fri Mar 26 13:49:46 2010	(r205689)
@@ -37,6 +37,11 @@ struct mca_record {
 	uint64_t	mr_tsc;
 	int		mr_apic_id;
 	int		mr_bank;
+	uint64_t	mr_mcg_cap;
+	uint64_t	mr_mcg_status;
+	int		mr_cpu_id;
+	int		mr_cpu_vendor_id;
+	int		mr_cpu;
 };
 
 #ifdef _KERNEL

Modified: stable/8/sys/amd64/include/specialreg.h
==============================================================================
--- stable/8/sys/amd64/include/specialreg.h	Fri Mar 26 13:01:53 2010	(r205688)
+++ stable/8/sys/amd64/include/specialreg.h	Fri Mar 26 13:49:46 2010	(r205689)
@@ -267,6 +267,7 @@
 #define	MSR_MTRR16kBase		0x258
 #define	MSR_MTRR4kBase		0x268
 #define	MSR_PAT			0x277
+#define	MSR_MC0_CTL2		0x280
 #define	MSR_MTRRdefType		0x2ff
 #define	MSR_MC0_CTL		0x400
 #define	MSR_MC0_STATUS		0x401
@@ -352,8 +353,10 @@
 #define	MCG_CAP_COUNT		0x000000ff
 #define	MCG_CAP_CTL_P		0x00000100
 #define	MCG_CAP_EXT_P		0x00000200
+#define	MCG_CAP_CMCI_P		0x00000400
 #define	MCG_CAP_TES_P		0x00000800
 #define	MCG_CAP_EXT_CNT		0x00ff0000
+#define	MCG_CAP_SER_P		0x01000000
 #define	MCG_STATUS_RIPV		0x00000001
 #define	MCG_STATUS_EIPV		0x00000002
 #define	MCG_STATUS_MCIP		0x00000004
@@ -363,9 +366,14 @@
 #define	MSR_MC_STATUS(x)	(MSR_MC0_STATUS + (x) * 4)
 #define	MSR_MC_ADDR(x)		(MSR_MC0_ADDR + (x) * 4)
 #define	MSR_MC_MISC(x)		(MSR_MC0_MISC + (x) * 4)
+#define	MSR_MC_CTL2(x)		(MSR_MC0_CTL2 + (x))	/* If MCG_CAP_CMCI_P */
 #define	MC_STATUS_MCA_ERROR	0x000000000000ffff
 #define	MC_STATUS_MODEL_ERROR	0x00000000ffff0000
 #define	MC_STATUS_OTHER_INFO	0x01ffffff00000000
+#define	MC_STATUS_COR_COUNT	0x001fffc000000000	/* If MCG_CAP_TES_P */
+#define	MC_STATUS_TES_STATUS	0x0060000000000000	/* If MCG_CAP_TES_P */
+#define	MC_STATUS_AR		0x0080000000000000	/* If MCG_CAP_CMCI_P */
+#define	MC_STATUS_S		0x0100000000000000	/* If MCG_CAP_CMCI_P */
 #define	MC_STATUS_PCC		0x0200000000000000
 #define	MC_STATUS_ADDRV		0x0400000000000000
 #define	MC_STATUS_MISCV		0x0800000000000000
@@ -373,6 +381,10 @@
 #define	MC_STATUS_UC		0x2000000000000000
 #define	MC_STATUS_OVER		0x4000000000000000
 #define	MC_STATUS_VAL		0x8000000000000000
+#define	MC_MISC_RA_LSB		0x000000000000003f	/* If MCG_CAP_SER_P */
+#define	MC_MISC_ADDRESS_MODE	0x00000000000001c0	/* If MCG_CAP_SER_P */
+#define	MC_CTL2_THRESHOLD	0x0000000000003fff
+#define	MC_CTL2_CMCI_EN		0x0000000040000000
 
 /*
  * The following four 3-byte registers control the non-cacheable regions.

Modified: stable/8/sys/i386/i386/mca.c
==============================================================================
--- stable/8/sys/i386/i386/mca.c	Fri Mar 26 13:01:53 2010	(r205688)
+++ stable/8/sys/i386/i386/mca.c	Fri Mar 26 13:49:46 2010	(r205689)
@@ -177,19 +177,46 @@ mca_error_request(uint16_t mca_error)
 	return ("???");
 }
 
+static const char *
+mca_error_mmtype(uint16_t mca_error)
+{
+
+	switch ((mca_error & 0x70) >> 4) {
+	case 0x0:
+		return ("GEN");
+	case 0x1:
+		return ("RD");
+	case 0x2:
+		return ("WR");
+	case 0x3:
+		return ("AC");
+	case 0x4:
+		return ("MS");
+	}
+	return ("???");
+}
+
 /* Dump details about a single machine check. */
 static void __nonnull(1)
 mca_log(const struct mca_record *rec)
 {
 	uint16_t mca_error;
 
-	printf("MCA: bank %d, status 0x%016llx\n", rec->mr_bank,
+	printf("MCA: Bank %d, Status 0x%016llx\n", rec->mr_bank,
 	    (long long)rec->mr_status);
-	printf("MCA: CPU %d ", rec->mr_apic_id);
+	printf("MCA: Global Cap 0x%016llx, Status 0x%016llx\n",
+	    (long long)rec->mr_mcg_cap, (long long)rec->mr_mcg_status);
+	printf("MCA: Vendor \"%s\", ID 0x%x, APIC ID %d\n", cpu_vendor,
+	    rec->mr_cpu_id, rec->mr_apic_id);
+	printf("MCA: CPU %d ", rec->mr_cpu);
 	if (rec->mr_status & MC_STATUS_UC)
 		printf("UNCOR ");
-	else
+	else {
 		printf("COR ");
+		if (rec->mr_mcg_cap & MCG_CAP_TES_P)
+			printf("(%lld) ", ((long long)rec->mr_status &
+			    MC_STATUS_COR_COUNT) >> 38);
+	}
 	if (rec->mr_status & MC_STATUS_PCC)
 		printf("PCC ");
 	if (rec->mr_status & MC_STATUS_OVER)
@@ -212,6 +239,9 @@ mca_log(const struct mca_record *rec)
 	case 0x0004:
 		printf("FRC error");
 		break;
+	case 0x0005:
+		printf("internal parity error");
+		break;
 	case 0x0400:
 		printf("internal timer error");
 		break;
@@ -236,6 +266,17 @@ mca_log(const struct mca_record *rec)
 			break;
 		}
 
+		/* Memory controller error. */
+		if ((mca_error & 0xef80) == 0x0080) {
+			printf("%s channel ", mca_error_mmtype(mca_error));
+			if ((mca_error & 0x000f) != 0x000f)
+				printf("%d", mca_error & 0x000f);
+			else
+				printf("??");
+			printf(" memory error");
+			break;
+		}
+		
 		/* Cache error. */
 		if ((mca_error & 0xef00) == 0x0100) {
 			printf("%sCACHE %s %s error",
@@ -313,6 +354,11 @@ mca_check_status(int bank, struct mca_re
 		rec->mr_misc = rdmsr(MSR_MC_MISC(bank));
 	rec->mr_tsc = rdtsc();
 	rec->mr_apic_id = PCPU_GET(apic_id);
+	rec->mr_mcg_cap = rdmsr(MSR_MCG_CAP);
+	rec->mr_mcg_status = rdmsr(MSR_MCG_STATUS);
+	rec->mr_cpu_id = cpu_id;
+	rec->mr_cpu_vendor_id = cpu_vendor_id;
+	rec->mr_cpu = PCPU_GET(cpuid);
 
 	/*
 	 * Clear machine check.  Don't do this for uncorrectable

Modified: stable/8/sys/i386/include/mca.h
==============================================================================
--- stable/8/sys/i386/include/mca.h	Fri Mar 26 13:01:53 2010	(r205688)
+++ stable/8/sys/i386/include/mca.h	Fri Mar 26 13:49:46 2010	(r205689)
@@ -37,6 +37,11 @@ struct mca_record {
 	uint64_t	mr_tsc;
 	int		mr_apic_id;
 	int		mr_bank;
+	uint64_t	mr_mcg_cap;
+	uint64_t	mr_mcg_status;
+	int		mr_cpu_id;
+	int		mr_cpu_vendor_id;
+	int		mr_cpu;
 };
 
 #ifdef _KERNEL

Modified: stable/8/sys/i386/include/specialreg.h
==============================================================================
--- stable/8/sys/i386/include/specialreg.h	Fri Mar 26 13:01:53 2010	(r205688)
+++ stable/8/sys/i386/include/specialreg.h	Fri Mar 26 13:49:46 2010	(r205689)
@@ -273,6 +273,7 @@
 #define	MSR_MTRR16kBase		0x258
 #define	MSR_MTRR4kBase		0x268
 #define	MSR_PAT			0x277
+#define	MSR_MC0_CTL2		0x280
 #define	MSR_MTRRdefType		0x2ff
 #define	MSR_MC0_CTL		0x400
 #define	MSR_MC0_STATUS		0x401
@@ -421,8 +422,10 @@
 #define	MCG_CAP_COUNT		0x000000ff
 #define	MCG_CAP_CTL_P		0x00000100
 #define	MCG_CAP_EXT_P		0x00000200
+#define	MCG_CAP_CMCI_P		0x00000400
 #define	MCG_CAP_TES_P		0x00000800
 #define	MCG_CAP_EXT_CNT		0x00ff0000
+#define	MCG_CAP_SER_P		0x01000000
 #define	MCG_STATUS_RIPV		0x00000001
 #define	MCG_STATUS_EIPV		0x00000002
 #define	MCG_STATUS_MCIP		0x00000004
@@ -432,9 +435,14 @@
 #define	MSR_MC_STATUS(x)	(MSR_MC0_STATUS + (x) * 4)
 #define	MSR_MC_ADDR(x)		(MSR_MC0_ADDR + (x) * 4)
 #define	MSR_MC_MISC(x)		(MSR_MC0_MISC + (x) * 4)
+#define	MSR_MC_CTL2(x)		(MSR_MC0_CTL2 + (x))	/* If MCG_CAP_CMCI_P */
 #define	MC_STATUS_MCA_ERROR	0x000000000000ffff
 #define	MC_STATUS_MODEL_ERROR	0x00000000ffff0000
 #define	MC_STATUS_OTHER_INFO	0x01ffffff00000000
+#define	MC_STATUS_COR_COUNT	0x001fffc000000000	/* If MCG_CAP_TES_P */
+#define	MC_STATUS_TES_STATUS	0x0060000000000000	/* If MCG_CAP_TES_P */
+#define	MC_STATUS_AR		0x0080000000000000	/* If MCG_CAP_CMCI_P */
+#define	MC_STATUS_S		0x0100000000000000	/* If MCG_CAP_CMCI_P */
 #define	MC_STATUS_PCC		0x0200000000000000
 #define	MC_STATUS_ADDRV		0x0400000000000000
 #define	MC_STATUS_MISCV		0x0800000000000000
@@ -442,6 +450,10 @@
 #define	MC_STATUS_UC		0x2000000000000000
 #define	MC_STATUS_OVER		0x4000000000000000
 #define	MC_STATUS_VAL		0x8000000000000000
+#define	MC_MISC_RA_LSB		0x000000000000003f	/* If MCG_CAP_SER_P */
+#define	MC_MISC_ADDRESS_MODE	0x00000000000001c0	/* If MCG_CAP_SER_P */
+#define	MC_CTL2_THRESHOLD	0x0000000000003fff
+#define	MC_CTL2_CMCI_EN		0x0000000040000000
 
 /*
  * The following four 3-byte registers control the non-cacheable regions.

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 14:03:42 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6F6B0106566B;
	Fri, 26 Mar 2010 14:03:42 +0000 (UTC)
	(envelope-from ivoras@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5E40F8FC1B;
	Fri, 26 Mar 2010 14:03: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 o2QE3gig066181;
	Fri, 26 Mar 2010 14:03:42 GMT (envelope-from ivoras@svn.freebsd.org)
Received: (from ivoras@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QE3gXZ066179;
	Fri, 26 Mar 2010 14:03:42 GMT (envelope-from ivoras@svn.freebsd.org)
Message-Id: <201003261403.o2QE3gXZ066179@svn.freebsd.org>
From: Ivan Voras 
Date: Fri, 26 Mar 2010 14:03:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205691 - stable/8/sys/dev/syscons/snake
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 14:03:42 -0000

Author: ivoras
Date: Fri Mar 26 14:03:42 2010
New Revision: 205691
URL: http://svn.freebsd.org/changeset/base/205691

Log:
  MFC r204248,r204249 - "fancy snake_saver" with color coded load averages

Modified:
  stable/8/sys/dev/syscons/snake/snake_saver.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)
  stable/8/sys/net/   (props changed)

Modified: stable/8/sys/dev/syscons/snake/snake_saver.c
==============================================================================
--- stable/8/sys/dev/syscons/snake/snake_saver.c	Fri Mar 26 13:50:19 2010	(r205690)
+++ stable/8/sys/dev/syscons/snake/snake_saver.c	Fri Mar 26 14:03:42 2010	(r205691)
@@ -36,6 +36,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -48,11 +50,22 @@ static int	*messagep;
 static int	messagelen;
 static int	blanked;
 
+#define MSGBUF_LEN 	70
+
+static int	nofancy = 0;
+TUNABLE_INT("hw.syscons.saver_snake_nofancy", &nofancy);
+
+#define FANCY_SNAKE 	(!nofancy)
+#define LOAD_HIGH(ld) 	(((ld * 100 + FSCALE / 2) >> FSHIFT) / 100)
+#define LOAD_LOW(ld) 	(((ld * 100 + FSCALE / 2) >> FSHIFT) % 100)
+
+static inline void update_msg(void);
+
 static int
 snake_saver(video_adapter_t *adp, int blank)
 {
 	static int	dirx, diry;
-	int		f;
+	int		f, color, load;
 	sc_softc_t	*sc;
 	scr_stat	*scp;
 
@@ -99,22 +112,52 @@ snake_saver(video_adapter_t *adp, int bl
 		    (random() % 20) == 0)
 			diry = -diry;
 		savs[0] += dirx + diry;
+		if (FANCY_SNAKE) {
+			update_msg();
+			load = ((averunnable.ldavg[0] * 100 + FSCALE / 2) >> FSHIFT);
+			if (load == 0)
+				color = FG_LIGHTGREY | BG_BLACK;
+			else if (load / mp_ncpus <= 50)
+				color = FG_LIGHTGREEN | BG_BLACK;
+			else if (load / mp_ncpus <= 75)
+				color = FG_YELLOW | BG_BLACK;
+			else if (load / mp_ncpus <= 99)
+				color = FG_LIGHTRED | BG_BLACK;
+			else
+				color = FG_RED | FG_BLINK | BG_BLACK;
+		} else
+			color = FG_LIGHTGREY | BG_BLACK;
+
 		for (f=messagelen-1; f>=0; f--)
 			sc_vtb_putc(&scp->scr, savs[f], sc->scr_map[save[f]],
-				    (FG_LIGHTGREY | BG_BLACK) << 8);
+				    color << 8);
 	} else
 		blanked = 0;
 
 	return 0;
 }
 
+static inline void
+update_msg(void)
+{
+	if (!FANCY_SNAKE) {
+		messagelen = sprintf(message, "%s %s", ostype, osrelease);
+		return;
+	}
+	messagelen = snprintf(message, MSGBUF_LEN,
+	    "%s %s (%d.%02d %d.%02d, %d.%02d)",
+	    ostype, osrelease,
+	    LOAD_HIGH(averunnable.ldavg[0]), LOAD_LOW(averunnable.ldavg[0]),
+	    LOAD_HIGH(averunnable.ldavg[1]), LOAD_LOW(averunnable.ldavg[1]),
+	    LOAD_HIGH(averunnable.ldavg[2]), LOAD_LOW(averunnable.ldavg[2]));
+}
+
 static int
 snake_init(video_adapter_t *adp)
 {
-	messagelen = strlen(ostype) + 1 + strlen(osrelease);
-	message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
-	sprintf(message, "%s %s", ostype, osrelease);
-	messagep = malloc(messagelen * sizeof *messagep, M_DEVBUF, M_WAITOK);
+	message = malloc(MSGBUF_LEN, M_DEVBUF, M_WAITOK);
+	messagep = malloc(MSGBUF_LEN * sizeof *messagep, M_DEVBUF, M_WAITOK);
+	update_msg();
 	return 0;
 }
 

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 14:08:22 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 06B9E106564A;
	Fri, 26 Mar 2010 14:08:22 +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 E8A108FC23;
	Fri, 26 Mar 2010 14:08: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 o2QE8Lg2067244;
	Fri, 26 Mar 2010 14:08:21 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QE8L6w067243;
	Fri, 26 Mar 2010 14:08:21 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201003261408.o2QE8L6w067243@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 26 Mar 2010 14:08: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: r205692 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net netinet/ipfw
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 14:08:22 -0000

Author: jhb
Date: Fri Mar 26 14:08:21 2010
New Revision: 205692
URL: http://svn.freebsd.org/changeset/base/205692

Log:
  Move mergeinfo for net/ and netinet/ipfw/ up to sys/.

Modified:
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)
  stable/8/sys/net/   (props changed)
  stable/8/sys/netinet/ipfw/   (props changed)

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 14:43:44 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 10E85106566C;
	Fri, 26 Mar 2010 14:43:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F2E388FC18;
	Fri, 26 Mar 2010 14: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 o2QEhhQI075266;
	Fri, 26 Mar 2010 14:43:43 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QEhh6p075265;
	Fri, 26 Mar 2010 14:43:43 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201003261443.o2QEhh6p075265@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 26 Mar 2010 14:43: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: r205696 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci sys
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 14:43:44 -0000

Author: jhb
Date: Fri Mar 26 14:43:43 2010
New Revision: 205696
URL: http://svn.freebsd.org/changeset/base/205696

Log:
  Fixup earlier merge so that svn will ignore glimpse and cscope files on
  all of the kernel source tree rather than sys/sys/.

Modified:
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)
  stable/8/sys/sys/   (props changed)

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 16:45:22 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 392C61065674;
	Fri, 26 Mar 2010 16:45:22 +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 27F2F8FC29;
	Fri, 26 Mar 2010 16:45: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 o2QGjMdZ002474;
	Fri, 26 Mar 2010 16:45:22 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QGjMZe002472;
	Fri, 26 Mar 2010 16:45:22 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201003261645.o2QGjMZe002472@svn.freebsd.org>
From: Xin LI 
Date: Fri, 26 Mar 2010 16:45:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205701 - stable/8/gnu/usr.bin/cpio
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 16:45:22 -0000

Author: delphij
Date: Fri Mar 26 16:45:21 2010
New Revision: 205701
URL: http://svn.freebsd.org/changeset/base/205701

Log:
  MFC r205630 (imp):
  
  This broke when we went to gnu99 as the default standard.  Fix the build
  by reverting to the gnu89 standard.

Modified:
  stable/8/gnu/usr.bin/cpio/Makefile
Directory Properties:
  stable/8/gnu/usr.bin/cpio/   (props changed)

Modified: stable/8/gnu/usr.bin/cpio/Makefile
==============================================================================
--- stable/8/gnu/usr.bin/cpio/Makefile	Fri Mar 26 15:52:32 2010	(r205700)
+++ stable/8/gnu/usr.bin/cpio/Makefile	Fri Mar 26 16:45:21 2010	(r205701)
@@ -58,6 +58,7 @@ SRCS=   copyin.c \
 	xstrndup.c \
 	alloca.h \
 	getopt.h
+CSTD=gnu89
 
 CLEANFILES+= alloca.h getopt.h
 

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 18:25:26 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D9C22106566B;
	Fri, 26 Mar 2010 18:25: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 AE16A8FC08;
	Fri, 26 Mar 2010 18:25: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 o2QIPQvo024669;
	Fri, 26 Mar 2010 18:25:26 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QIPQSZ024668;
	Fri, 26 Mar 2010 18:25:26 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201003261825.o2QIPQSZ024668@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 26 Mar 2010 18:25: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: r205703 - stable/8/sys
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 18:25:27 -0000

Author: jhb
Date: Fri Mar 26 18:25:26 2010
New Revision: 205703
URL: http://svn.freebsd.org/changeset/base/205703

Log:
  Cleanup some busted mergeinfo.

Modified:
Directory Properties:
  stable/8/sys/   (props changed)

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 18:54:25 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C62C4106566B;
	Fri, 26 Mar 2010 18:54:25 +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 998E08FC13;
	Fri, 26 Mar 2010 18:54: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 o2QIsPFT031217;
	Fri, 26 Mar 2010 18:54:25 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QIsPeH031212;
	Fri, 26 Mar 2010 18:54:25 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201003261854.o2QIsPeH031212@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 26 Mar 2010 18:54: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: r205706 - in stable/8/sys: conf i386/conf i386/i386
	i386/xen
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 18:54:25 -0000

Author: jhb
Date: Fri Mar 26 18:54:25 2010
New Revision: 205706
URL: http://svn.freebsd.org/changeset/base/205706

Log:
  MFC 204972:
  Make NKPT a kernel option on i386 so that it can be set to a non-default
  value from kernel config files.

Modified:
  stable/8/sys/conf/options.i386
  stable/8/sys/i386/conf/NOTES
  stable/8/sys/i386/i386/mp_machdep.c
  stable/8/sys/i386/xen/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/conf/options.i386
==============================================================================
--- stable/8/sys/conf/options.i386	Fri Mar 26 18:49:43 2010	(r205705)
+++ stable/8/sys/conf/options.i386	Fri Mar 26 18:54:25 2010	(r205706)
@@ -12,6 +12,7 @@ I586_PMC_GUPROF		opt_i586_guprof.h
 MAXMEM
 MPTABLE_FORCE_HTT
 MP_WATCHDOG
+NKPT			opt_pmap.h
 PERFMON
 PMAP_SHPGPERPROC	opt_pmap.h
 POWERFAIL_NMI		opt_trap.h

Modified: stable/8/sys/i386/conf/NOTES
==============================================================================
--- stable/8/sys/i386/conf/NOTES	Fri Mar 26 18:49:43 2010	(r205705)
+++ stable/8/sys/i386/conf/NOTES	Fri Mar 26 18:54:25 2010	(r205706)
@@ -833,6 +833,15 @@ options 	PMAP_SHPGPERPROC=201
 #
 options 	KVA_PAGES=260
 
+#
+# Number of initial kernel page table pages used for early bootstrap.
+# This number should include enough pages to map the kernel, any
+# modules or other data loaded with the kernel by the loader, and data
+# structures allocated before the VM system is initialized such as the
+# vm_page_t array.  Each page table page maps 4MB (2MB with PAE).
+#
+options 	NKPT=31
+
 
 #####################################################################
 # ABI Emulation

Modified: stable/8/sys/i386/i386/mp_machdep.c
==============================================================================
--- stable/8/sys/i386/i386/mp_machdep.c	Fri Mar 26 18:49:43 2010	(r205705)
+++ stable/8/sys/i386/i386/mp_machdep.c	Fri Mar 26 18:54:25 2010	(r205706)
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_cpu.h"
 #include "opt_kstack_pages.h"
 #include "opt_mp_watchdog.h"
+#include "opt_pmap.h"
 #include "opt_sched.h"
 #include "opt_smp.h"
 

Modified: stable/8/sys/i386/xen/mp_machdep.c
==============================================================================
--- stable/8/sys/i386/xen/mp_machdep.c	Fri Mar 26 18:49:43 2010	(r205705)
+++ stable/8/sys/i386/xen/mp_machdep.c	Fri Mar 26 18:54:25 2010	(r205706)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_cpu.h"
 #include "opt_kstack_pages.h"
 #include "opt_mp_watchdog.h"
+#include "opt_pmap.h"
 #include "opt_sched.h"
 #include "opt_smp.h"
 

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Mar 26 18:58:23 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6A644106566C;
	Fri, 26 Mar 2010 18:58:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E1A28FC12;
	Fri, 26 Mar 2010 18:58: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 o2QIwNwn032293;
	Fri, 26 Mar 2010 18:58:23 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2QIwNQJ032290;
	Fri, 26 Mar 2010 18:58:23 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201003261858.o2QIwNQJ032290@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 26 Mar 2010 18:58: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: r205708 - in stable/8/sys: amd64/acpica i386/acpica
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 26 Mar 2010 18:58:23 -0000

Author: jhb
Date: Fri Mar 26 18:58:22 2010
New Revision: 205708
URL: http://svn.freebsd.org/changeset/base/205708

Log:
  MFC 205332:
  Use the same policy for rejecting / not-reject ACPI tables with incorrect
  checksums as the base acpi(4) driver.  This fixes a problem where the MADT
  parser would reject the MADT table during early boot causing the MP Table
  to be, but then the acpi(4) driver would attach and use non-SMP interrupt
  routing.

Modified:
  stable/8/sys/amd64/acpica/acpi_machdep.c
  stable/8/sys/i386/acpica/acpi_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/acpica/acpi_machdep.c
==============================================================================
--- stable/8/sys/amd64/acpica/acpi_machdep.c	Fri Mar 26 18:54:46 2010	(r205707)
+++ stable/8/sys/amd64/acpica/acpi_machdep.c	Fri Mar 26 18:58:22 2010	(r205708)
@@ -187,8 +187,10 @@ map_table(vm_paddr_t pa, int offset, con
 	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
 		if (bootverbose)
 			printf("ACPI: Failed checksum for table %s\n", sig);
+#if (ACPI_CHECKSUM_ABORT)
 		table_unmap(table, length);
 		return (NULL);
+#endif
 	}
 	return (table);
 }

Modified: stable/8/sys/i386/acpica/acpi_machdep.c
==============================================================================
--- stable/8/sys/i386/acpica/acpi_machdep.c	Fri Mar 26 18:54:46 2010	(r205707)
+++ stable/8/sys/i386/acpica/acpi_machdep.c	Fri Mar 26 18:58:22 2010	(r205708)
@@ -638,8 +638,10 @@ map_table(vm_paddr_t pa, int offset, con
 	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
 		if (bootverbose)
 			printf("ACPI: Failed checksum for table %s\n", sig);
+#if (ACPI_CHECKSUM_ABORT)
 		table_unmap(table, length);
 		return (NULL);
+#endif
 	}
 	return (table);
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 14:43:40 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A7C0E106566B;
	Sat, 27 Mar 2010 14:43:40 +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 966068FC18;
	Sat, 27 Mar 2010 14:43: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 o2REheoL014099;
	Sat, 27 Mar 2010 14:43:40 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2REhejI014097;
	Sat, 27 Mar 2010 14:43:40 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271443.o2REhejI014097@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 14:43: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: r205730 - stable/8/sys/dev/md
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 14:43:40 -0000

Author: trasz
Date: Sat Mar 27 14:43:40 2010
New Revision: 205730
URL: http://svn.freebsd.org/changeset/base/205730

Log:
  MFC r204408:
  
  Fix panic on invalid 'mdconfig -at preload' usage.
  
  PR:		kern/80136

Modified:
  stable/8/sys/dev/md/md.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/md/md.c
==============================================================================
--- stable/8/sys/dev/md/md.c	Sat Mar 27 13:43:18 2010	(r205729)
+++ stable/8/sys/dev/md/md.c	Sat Mar 27 14:43:40 2010	(r205730)
@@ -814,6 +814,8 @@ mdcreate_preload(struct md_s *sc, struct
 
 	if (mdio->md_options & ~(MD_AUTOUNIT | MD_FORCE))
 		return (EINVAL);
+	if (mdio->md_base == 0)
+		return (EINVAL);
 	sc->flags = mdio->md_options & MD_FORCE;
 	/* Cast to pointer size, then to pointer to avoid warning */
 	sc->pl_ptr = (u_char *)(uintptr_t)mdio->md_base;

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 14:58:29 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 220FF106564A;
	Sat, 27 Mar 2010 14:58:29 +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 10A918FC0C;
	Sat, 27 Mar 2010 14:58: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 o2REwSec017401;
	Sat, 27 Mar 2010 14:58:28 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2REwSra017399;
	Sat, 27 Mar 2010 14:58:28 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271458.o2REwSra017399@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 14:58: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: r205731 - stable/8/sys/amd64/ia32
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 14:58:29 -0000

Author: trasz
Date: Sat Mar 27 14:58:28 2010
New Revision: 205731
URL: http://svn.freebsd.org/changeset/base/205731

Log:
  MFC r202919:
  
  Fix array overflow.  This routine is only called from procfs,
  which is not mounted by default, and I've been unable to trigger
  a panic without this fix applied anyway.
  
  Reviewed by:	kib, cperciva

Modified:
  stable/8/sys/amd64/ia32/ia32_reg.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/ia32/ia32_reg.c
==============================================================================
--- stable/8/sys/amd64/ia32/ia32_reg.c	Sat Mar 27 14:43:40 2010	(r205730)
+++ stable/8/sys/amd64/ia32/ia32_reg.c	Sat Mar 27 14:58:28 2010	(r205731)
@@ -213,8 +213,6 @@ fill_dbregs32(struct thread *td, struct 
 	err = fill_dbregs(td, &dr);
 	for (i = 0; i < 8; i++)
 		regs->dr[i] = dr.dr[i];
-	for (i = 8; i < 16; i++)
-		regs->dr[i] = 0;
 	return (err);
 }
 

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 15:02:29 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6B0A01065674;
	Sat, 27 Mar 2010 15:02:29 +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 5921A8FC1B;
	Sat, 27 Mar 2010 15:02: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 o2RF2TxR018343;
	Sat, 27 Mar 2010 15:02:29 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RF2TPg018341;
	Sat, 27 Mar 2010 15:02:29 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271502.o2RF2TPg018341@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 15:02: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: r205732 - stable/8/sys/contrib/ngatm/netnatm/api
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 15:02:29 -0000

Author: trasz
Date: Sat Mar 27 15:02:28 2010
New Revision: 205732
URL: http://svn.freebsd.org/changeset/base/205732

Log:
  MFC r201818:
  
  Fix array overflow.
  
  Reviewed by:	philip

Modified:
  stable/8/sys/contrib/ngatm/netnatm/api/cc_conn.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/contrib/ngatm/netnatm/api/cc_conn.c
==============================================================================
--- stable/8/sys/contrib/ngatm/netnatm/api/cc_conn.c	Sat Mar 27 14:58:28 2010	(r205731)
+++ stable/8/sys/contrib/ngatm/netnatm/api/cc_conn.c	Sat Mar 27 15:02:28 2010	(r205732)
@@ -768,7 +768,7 @@ cc_party_drop_ack_ind(struct ccconn *con
 	party = cc_party_find(conn, drop->epref.epref);
 	if (party == NULL) {
 		cc_party_log(party, "no party for %s",
-		    ptab[CONN_SIG_DROP_PARTY_ACK_IND]);
+		    cc_conn_sigtab[CONN_SIG_DROP_PARTY_ACK_IND]);
 		return;
 	}
 	switch (party->state) {

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 15:05:08 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 97F81106564A;
	Sat, 27 Mar 2010 15:05:08 +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 864138FC08;
	Sat, 27 Mar 2010 15:05: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 o2RF57ph019004;
	Sat, 27 Mar 2010 15:05:07 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RF57Lr019002;
	Sat, 27 Mar 2010 15:05:07 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271505.o2RF57Lr019002@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 15:05:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205733 - stable/8/sys/security/mac_lomac
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 15:05:08 -0000

Author: trasz
Date: Sat Mar 27 15:05:06 2010
New Revision: 205733
URL: http://svn.freebsd.org/changeset/base/205733

Log:
  MFC r201438:
  
  Make mac_lomac(4) able to interpret NFSv4 access bits.
  
  Reviewed by:	rwatson

Modified:
  stable/8/sys/security/mac_lomac/mac_lomac.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/security/mac_lomac/mac_lomac.c
==============================================================================
--- stable/8/sys/security/mac_lomac/mac_lomac.c	Sat Mar 27 15:02:28 2010	(r205732)
+++ stable/8/sys/security/mac_lomac/mac_lomac.c	Sat Mar 27 15:05:06 2010	(r205733)
@@ -2470,7 +2470,7 @@ lomac_vnode_check_open(struct ucred *cre
 	obj = SLOT(vplabel);
 
 	/* XXX privilege override for admin? */
-	if (accmode & (VWRITE | VAPPEND | VADMIN)) {
+	if (accmode & VMODIFY_PERMS) {
 		if (!lomac_subject_dominate(subj, obj))
 			return (EACCES);
 	}

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 16:31:50 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 42285106564A;
	Sat, 27 Mar 2010 16:31:50 +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 2EDA68FC1E;
	Sat, 27 Mar 2010 16:31: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 o2RGVnkO038239;
	Sat, 27 Mar 2010 16:31:49 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RGVnKY038235;
	Sat, 27 Mar 2010 16:31:49 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271631.o2RGVnKY038235@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 16:31: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: r205737 - in stable/8/sys: conf kern sys
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 16:31:50 -0000

Author: trasz
Date: Sat Mar 27 16:31:49 2010
New Revision: 205737
URL: http://svn.freebsd.org/changeset/base/205737

Log:
  MFC r197405:
  
  Add pieces of infrastructure required for NFSv4 ACL support in UFS.
  
  Reviewed by:	rwatson

Modified:
  stable/8/sys/conf/files
  stable/8/sys/kern/subr_acl_nfs4.c
  stable/8/sys/sys/vnode.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/conf/files
==============================================================================
--- stable/8/sys/conf/files	Sat Mar 27 15:45:11 2010	(r205736)
+++ stable/8/sys/conf/files	Sat Mar 27 16:31:49 2010	(r205737)
@@ -2098,6 +2098,7 @@ kern/sched_ule.c		optional sched_ule
 kern/serdev_if.m		standard
 kern/stack_protector.c		standard \
 	compile-with "${NORMAL_C:N-fstack-protector*}"
+kern/subr_acl_nfs4.c		standard
 kern/subr_acl_posix1e.c		standard
 kern/subr_autoconf.c		standard
 kern/subr_blist.c		standard

Modified: stable/8/sys/kern/subr_acl_nfs4.c
==============================================================================
--- stable/8/sys/kern/subr_acl_nfs4.c	Sat Mar 27 15:45:11 2010	(r205736)
+++ stable/8/sys/kern/subr_acl_nfs4.c	Sat Mar 27 16:31:49 2010	(r205737)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2008 Edward Tomasz Napierała 
+ * Copyright (c) 2008-2009 Edward Tomasz Napierała 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -49,7 +49,213 @@ __FBSDID("$FreeBSD$");
 #include 
 #define KASSERT(a, b) assert(a)
 #define CTASSERT(a)
-#endif
+#endif /* _KERNEL */
+
+#ifdef _KERNEL
+
+static struct {
+	accmode_t accmode;
+	int mask;
+} accmode2mask[] = {{VREAD, ACL_READ_DATA},
+		    {VWRITE, ACL_WRITE_DATA},
+		    {VAPPEND, ACL_APPEND_DATA},
+		    {VEXEC, ACL_EXECUTE},
+		    {VREAD_NAMED_ATTRS, ACL_READ_NAMED_ATTRS},
+		    {VWRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS},
+		    {VDELETE_CHILD, ACL_DELETE_CHILD},
+		    {VREAD_ATTRIBUTES, ACL_READ_ATTRIBUTES},
+		    {VWRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES},
+		    {VDELETE, ACL_DELETE},
+		    {VREAD_ACL, ACL_READ_ACL},
+		    {VWRITE_ACL, ACL_WRITE_ACL},
+		    {VWRITE_OWNER, ACL_WRITE_OWNER},
+		    {VSYNCHRONIZE, ACL_SYNCHRONIZE},
+		    {0, 0}};
+
+static int
+_access_mask_from_accmode(accmode_t accmode)
+{
+	int access_mask = 0, i;
+
+	for (i = 0; accmode2mask[i].accmode != 0; i++) {
+		if (accmode & accmode2mask[i].accmode)
+			access_mask |= accmode2mask[i].mask;
+	}
+
+	return (access_mask);
+}
+
+/*
+ * Return 0, iff access is allowed, 1 otherwise.
+ */
+static int
+_acl_denies(const struct acl *aclp, int access_mask, struct ucred *cred,
+    int file_uid, int file_gid, int *denied_explicitly)
+{
+	int i;
+	const struct acl_entry *entry;
+
+	if (denied_explicitly != NULL)
+		*denied_explicitly = 0;
+
+	KASSERT(aclp->acl_cnt > 0, ("aclp->acl_cnt > 0"));
+	KASSERT(aclp->acl_cnt <= ACL_MAX_ENTRIES,
+	    ("aclp->acl_cnt <= ACL_MAX_ENTRIES"));
+
+	for (i = 0; i < aclp->acl_cnt; i++) {
+		entry = &(aclp->acl_entry[i]);
+
+		if (entry->ae_entry_type != ACL_ENTRY_TYPE_ALLOW &&
+		    entry->ae_entry_type != ACL_ENTRY_TYPE_DENY)
+			continue;
+		if (entry->ae_flags & ACL_ENTRY_INHERIT_ONLY)
+			continue;
+		switch (entry->ae_tag) {
+		case ACL_USER_OBJ:
+			if (file_uid != cred->cr_uid)
+				continue;
+			break;
+		case ACL_USER:
+			if (entry->ae_id != cred->cr_uid)
+				continue;
+			break;
+		case ACL_GROUP_OBJ:
+			if (!groupmember(file_gid, cred))
+				continue;
+			break;
+		case ACL_GROUP:
+			if (!groupmember(entry->ae_id, cred))
+				continue;
+			break;
+		default:
+			KASSERT(entry->ae_tag == ACL_EVERYONE,
+			    ("entry->ae_tag == ACL_EVERYONE"));
+		}
+
+		if (entry->ae_entry_type == ACL_ENTRY_TYPE_DENY) {
+			if (entry->ae_perm & access_mask) {
+				if (denied_explicitly != NULL)
+					*denied_explicitly = 1;
+				return (1);
+			}
+		}
+
+		access_mask &= ~(entry->ae_perm);
+		if (access_mask == 0)
+			return (0);
+	}
+
+	return (1);
+}
+
+int
+vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid,
+    struct acl *aclp, accmode_t accmode, struct ucred *cred, int *privused)
+{
+	accmode_t priv_granted = 0;
+	int denied, explicitly_denied, access_mask, is_directory,
+	    must_be_owner = 0;
+
+	if (privused != NULL)
+		*privused = 0;
+
+	if (accmode & VADMIN)
+		must_be_owner = 1;
+
+	/*
+	 * Ignore VSYNCHRONIZE permission.
+	 */
+	accmode &= ~VSYNCHRONIZE;
+
+	access_mask = _access_mask_from_accmode(accmode);
+
+	if (type == VDIR)
+		is_directory = 1;
+	else
+		is_directory = 0;
+
+	/*
+	 * File owner is always allowed to read and write the ACL
+	 * and basic attributes.  This is to prevent a situation
+	 * where user would change ACL in a way that prevents him
+	 * from undoing the change.
+	 */
+	if (file_uid == cred->cr_uid)
+		access_mask &= ~(ACL_READ_ACL | ACL_WRITE_ACL |
+		    ACL_READ_ATTRIBUTES | ACL_WRITE_ATTRIBUTES);
+
+	/*
+	 * Ignore append permission for regular files; use write
+	 * permission instead.
+	 */
+	if (!is_directory && (access_mask & ACL_APPEND_DATA)) {
+		access_mask &= ~ACL_APPEND_DATA;
+		access_mask |= ACL_WRITE_DATA;
+	}
+
+	denied = _acl_denies(aclp, access_mask, cred, file_uid, file_gid,
+	    &explicitly_denied);
+
+	if (must_be_owner) {
+		if (file_uid != cred->cr_uid)
+			denied = EPERM;
+	}
+
+	if (!denied)
+		return (0);
+
+	/*
+	 * Access failed.  Iff it was not denied explicitly and
+	 * VEXPLICIT_DENY flag was specified, allow access.
+	 */
+	if ((accmode & VEXPLICIT_DENY) && explicitly_denied == 0)
+		return (0);
+
+	accmode &= ~VEXPLICIT_DENY;
+
+	/*
+	 * No match.  Try to use privileges, if there are any.
+	 */
+	if (is_directory) {
+		if ((accmode & VEXEC) && !priv_check_cred(cred,
+		    PRIV_VFS_LOOKUP, 0))
+			priv_granted |= VEXEC;
+	} else {
+		if ((accmode & VEXEC) && !priv_check_cred(cred,
+		    PRIV_VFS_EXEC, 0))
+			priv_granted |= VEXEC;
+	}
+
+	if ((accmode & VREAD) && !priv_check_cred(cred, PRIV_VFS_READ, 0))
+		priv_granted |= VREAD;
+
+	if ((accmode & (VWRITE | VAPPEND | VDELETE_CHILD)) &&
+	    !priv_check_cred(cred, PRIV_VFS_WRITE, 0))
+		priv_granted |= (VWRITE | VAPPEND | VDELETE_CHILD);
+
+	if ((accmode & VADMIN_PERMS) &&
+	    !priv_check_cred(cred, PRIV_VFS_ADMIN, 0))
+		priv_granted |= VADMIN_PERMS;
+
+	if ((accmode & VSTAT_PERMS) &&
+	    !priv_check_cred(cred, PRIV_VFS_STAT, 0))
+		priv_granted |= VSTAT_PERMS;
+
+	if ((accmode & priv_granted) == accmode) {
+		if (privused != NULL)
+			*privused = 1;
+
+		return (0);
+	}
+
+	if (accmode & (VADMIN_PERMS | VDELETE_CHILD | VDELETE))
+		denied = EPERM;
+	else
+		denied = EACCES;
+
+	return (denied);
+}
+#endif /* _KERNEL */
 
 static int
 _acl_entry_matches(struct acl_entry *entry, acl_tag_t tag, acl_perm_t perm,
@@ -577,3 +783,290 @@ acl_nfs4_sync_mode_from_acl(mode_t *_mod
 
 	*_mode = mode | (old_mode & ACL_PRESERVE_MASK);
 }
+
+void		
+acl_nfs4_compute_inherited_acl(const struct acl *parent_aclp,
+    struct acl *child_aclp, mode_t mode, int file_owner_id,
+    int is_directory)
+{
+	int i, flags;
+	const struct acl_entry *parent_entry;
+	struct acl_entry *entry, *copy;
+
+	KASSERT(child_aclp->acl_cnt == 0, ("child_aclp->acl_cnt == 0"));
+	KASSERT(parent_aclp->acl_cnt > 0, ("parent_aclp->acl_cnt > 0"));
+	KASSERT(parent_aclp->acl_cnt <= ACL_MAX_ENTRIES,
+	    ("parent_aclp->acl_cnt <= ACL_MAX_ENTRIES"));
+
+	/*
+	 * NFSv4 Minor Version 1, draft-ietf-nfsv4-minorversion1-03.txt
+	 *
+	 * 3.16.6.2. Applying the mode given to CREATE or OPEN
+	 *           to an inherited ACL
+	 */
+
+	/*
+	 * 1. Form an ACL that is the concatenation of all inheritable ACEs.
+	 */
+	for (i = 0; i < parent_aclp->acl_cnt; i++) {
+		parent_entry = &(parent_aclp->acl_entry[i]);
+		flags = parent_entry->ae_flags;
+
+		/*
+		 * Entry is not inheritable at all.
+		 */
+		if ((flags & (ACL_ENTRY_DIRECTORY_INHERIT |
+		    ACL_ENTRY_FILE_INHERIT)) == 0)
+			continue;
+
+		/*
+		 * We're creating a file, but entry is not inheritable
+		 * by files.
+		 */
+		if (!is_directory && (flags & ACL_ENTRY_FILE_INHERIT) == 0)
+			continue;
+
+		/*
+		 * Entry is inheritable only by files, but has NO_PROPAGATE
+		 * flag set, and we're creating a directory, so it wouldn't
+		 * propagate to any file in that directory anyway.
+		 */
+		if (is_directory &&
+		    (flags & ACL_ENTRY_DIRECTORY_INHERIT) == 0 &&
+		    (flags & ACL_ENTRY_NO_PROPAGATE_INHERIT))
+			continue;
+
+		KASSERT(child_aclp->acl_cnt + 1 <= ACL_MAX_ENTRIES,
+		    ("child_aclp->acl_cnt + 1 <= ACL_MAX_ENTRIES"));
+		child_aclp->acl_entry[child_aclp->acl_cnt] = *parent_entry;
+		child_aclp->acl_cnt++;
+	}
+
+	/*
+	 * 2. For each entry in the new ACL, adjust its flags, possibly
+	 *    creating two entries in place of one.
+	 */
+	for (i = 0; i < child_aclp->acl_cnt; i++) {
+		entry = &(child_aclp->acl_entry[i]);
+
+		/*
+		 * This is not in the specification, but SunOS
+		 * apparently does that.
+		 */
+		if (((entry->ae_flags & ACL_ENTRY_NO_PROPAGATE_INHERIT) ||
+		    !is_directory) &&
+		    entry->ae_entry_type == ACL_ENTRY_TYPE_ALLOW)
+			entry->ae_perm &= ~(ACL_WRITE_ACL | ACL_WRITE_OWNER);
+
+		/*
+		 * 2.A. If the ACL_ENTRY_NO_PROPAGATE_INHERIT is set, or if the object
+		 *      being created is not a directory, then clear the
+		 *      following flags: ACL_ENTRY_NO_PROPAGATE_INHERIT,
+		 *      ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT,
+		 *      ACL_ENTRY_INHERIT_ONLY.
+		 */
+		if (entry->ae_flags & ACL_ENTRY_NO_PROPAGATE_INHERIT ||
+		    !is_directory) {
+			entry->ae_flags &= ~(ACL_ENTRY_NO_PROPAGATE_INHERIT |
+			ACL_ENTRY_FILE_INHERIT | ACL_ENTRY_DIRECTORY_INHERIT |
+			ACL_ENTRY_INHERIT_ONLY);
+
+			/*
+			 * Continue on to the next ACE.
+			 */
+			continue;
+		}
+
+		/*
+		 * 2.B. If the object is a directory and ACL_ENTRY_FILE_INHERIT
+		 *      is set, but ACL_ENTRY_NO_PROPAGATE_INHERIT is not set, ensure
+		 *      that ACL_ENTRY_INHERIT_ONLY is set.  Continue to the
+		 *      next ACE.  Otherwise...
+		 */
+		/*
+		 * XXX: Read it again and make sure what does the "otherwise"
+		 *      apply to.
+		 */
+		if (is_directory &&
+		    (entry->ae_flags & ACL_ENTRY_FILE_INHERIT) &&
+		    ((entry->ae_flags & ACL_ENTRY_DIRECTORY_INHERIT) == 0)) {
+			entry->ae_flags |= ACL_ENTRY_INHERIT_ONLY;
+			continue;
+		}
+
+		/*
+		 * 2.C. If the type of the ACE is neither ALLOW nor deny,
+		 *      then continue.
+		 */
+		if (entry->ae_entry_type != ACL_ENTRY_TYPE_ALLOW &&
+		    entry->ae_entry_type != ACL_ENTRY_TYPE_DENY)
+			continue;
+
+		/*
+		 * 2.D. Copy the original ACE into a second, adjacent ACE.
+		 */
+		copy = _acl_duplicate_entry(child_aclp, i);
+
+		/*
+		 * 2.E. On the first ACE, ensure that ACL_ENTRY_INHERIT_ONLY
+		 *      is set.
+		 */
+		entry->ae_flags |= ACL_ENTRY_INHERIT_ONLY;
+
+		/*
+		 * 2.F. On the second ACE, clear the following flags:
+		 *      ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_FILE_INHERIT,
+		 *      ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_INHERIT_ONLY.
+		 */
+		copy->ae_flags &= ~(ACL_ENTRY_NO_PROPAGATE_INHERIT |
+		    ACL_ENTRY_FILE_INHERIT | ACL_ENTRY_DIRECTORY_INHERIT |
+		    ACL_ENTRY_INHERIT_ONLY);
+
+		/*
+		 * 2.G. On the second ACE, if the type is ALLOW,
+		 *      an implementation MAY clear the following
+		 *      mask bits: ACL_WRITE_ACL, ACL_WRITE_OWNER.
+		 */
+		if (copy->ae_entry_type == ACL_ENTRY_TYPE_ALLOW)
+			copy->ae_perm &= ~(ACL_WRITE_ACL | ACL_WRITE_OWNER);
+
+		/*
+		 * Increment the counter to skip the copied entry.
+		 */
+		i++;
+	}
+
+	/*
+	 * 3. To ensure that the mode is honored, apply the algorithm describe
+	 *    in Section 2.16.6.3, using the mode that is to be used for file
+	 *    creation.
+	 */
+	acl_nfs4_sync_acl_from_mode(child_aclp, mode, file_owner_id);
+}
+
+#ifdef _KERNEL
+static int
+_acls_are_equal(const struct acl *a, const struct acl *b)
+{
+	int i;
+	const struct acl_entry *entrya, *entryb;
+
+	if (a->acl_cnt != b->acl_cnt)
+		return (0);
+
+	for (i = 0; i < b->acl_cnt; i++) {
+		entrya = &(a->acl_entry[i]);
+		entryb = &(b->acl_entry[i]);
+
+		if (entrya->ae_tag != entryb->ae_tag ||
+		    entrya->ae_id != entryb->ae_id ||
+		    entrya->ae_perm != entryb->ae_perm ||
+		    entrya->ae_entry_type != entryb->ae_entry_type ||
+		    entrya->ae_flags != entryb->ae_flags)
+			return (0);
+	}
+
+	return (1);
+}
+
+/*
+ * This routine is used to determine whether to remove entry_type attribute
+ * that stores ACL contents.
+ */
+int
+acl_nfs4_is_trivial(const struct acl *aclp, int file_owner_id)
+{
+	int trivial;
+	mode_t tmpmode = 0;
+	struct acl *tmpaclp;
+
+	if (aclp->acl_cnt != 6)
+		return (0);
+
+	/*
+	 * Compute the mode from the ACL, then compute new ACL from that mode.
+	 * If the ACLs are identical, then the ACL is trivial.
+	 *
+	 * XXX: I guess there is a faster way to do this.  However, even
+	 *      this slow implementation significantly speeds things up
+	 *      for files that don't have any entry_type ACL entries - it's
+	 *      critical for performance to not use EA when they are not
+	 *      needed.
+	 */
+	tmpaclp = acl_alloc(M_WAITOK | M_ZERO);
+	acl_nfs4_sync_mode_from_acl(&tmpmode, aclp);
+	acl_nfs4_sync_acl_from_mode(tmpaclp, tmpmode, file_owner_id);
+	trivial = _acls_are_equal(aclp, tmpaclp);
+	acl_free(tmpaclp);
+
+	return (trivial);
+}
+#endif /* _KERNEL */
+
+int
+acl_nfs4_check(const struct acl *aclp, int is_directory)
+{
+	int i;
+	const struct acl_entry *entry;
+
+	/*
+	 * The spec doesn't seem to say anything about ACL validity.
+	 * It seems there is not much to do here.  There is even no need
+	 * to count "owner@" or "everyone@" (ACL_USER_OBJ and ACL_EVERYONE)
+	 * entries, as there can be several of them and that's perfectly
+	 * valid.  There can be none of them too.  Really.
+	 */
+
+	if (aclp->acl_cnt > ACL_MAX_ENTRIES || aclp->acl_cnt <= 0)
+		return (EINVAL);
+
+	for (i = 0; i < aclp->acl_cnt; i++) {
+		entry = &(aclp->acl_entry[i]);
+
+		switch (entry->ae_tag) {
+		case ACL_USER_OBJ:
+		case ACL_GROUP_OBJ:
+		case ACL_EVERYONE:
+			if (entry->ae_id != ACL_UNDEFINED_ID)
+				return (EINVAL);
+			break;
+
+		case ACL_USER:
+		case ACL_GROUP:
+			if (entry->ae_id == ACL_UNDEFINED_ID)
+				return (EINVAL);
+			break;
+
+		default:
+			return (EINVAL);
+		}
+
+		if ((entry->ae_perm | ACL_NFS4_PERM_BITS) != ACL_NFS4_PERM_BITS)
+			return (EINVAL);
+
+		/*
+		 * Disallow ACL_ENTRY_TYPE_AUDIT and ACL_ENTRY_TYPE_ALARM for now.
+		 */
+		if (entry->ae_entry_type != ACL_ENTRY_TYPE_ALLOW &&
+		    entry->ae_entry_type != ACL_ENTRY_TYPE_DENY)
+			return (EINVAL);
+
+		if ((entry->ae_flags | ACL_FLAGS_BITS) != ACL_FLAGS_BITS)
+			return (EINVAL);
+
+		/* Disallow unimplemented flags. */
+		if (entry->ae_flags & (ACL_ENTRY_SUCCESSFUL_ACCESS |
+		    ACL_ENTRY_FAILED_ACCESS))
+			return (EINVAL);
+
+		/* Disallow flags not allowed for ordinary files. */
+		if (!is_directory) {
+			if (entry->ae_flags & (ACL_ENTRY_FILE_INHERIT |
+			    ACL_ENTRY_DIRECTORY_INHERIT |
+			    ACL_ENTRY_NO_PROPAGATE_INHERIT | ACL_ENTRY_INHERIT_ONLY))
+				return (EINVAL);
+		}
+	}
+
+	return (0);
+}

Modified: stable/8/sys/sys/vnode.h
==============================================================================
--- stable/8/sys/sys/vnode.h	Sat Mar 27 15:45:11 2010	(r205736)
+++ stable/8/sys/sys/vnode.h	Sat Mar 27 16:31:49 2010	(r205737)
@@ -613,6 +613,9 @@ int	vn_commname(struct vnode *vn, char *
 int	vaccess(enum vtype type, mode_t file_mode, uid_t file_uid,
 	    gid_t file_gid, accmode_t accmode, struct ucred *cred,
 	    int *privused);
+int	vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid,
+	    struct acl *aclp, accmode_t accmode, struct ucred *cred,
+	    int *privused);
 int	vaccess_acl_posix1e(enum vtype type, uid_t file_uid,
 	    gid_t file_gid, struct acl *acl, accmode_t accmode,
 	    struct ucred *cred, int *privused);

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 16:35:25 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EA3C61065686;
	Sat, 27 Mar 2010 16:35:25 +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 D8BC88FC0A;
	Sat, 27 Mar 2010 16:35: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 o2RGZPlj039147;
	Sat, 27 Mar 2010 16:35:25 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RGZPtD039145;
	Sat, 27 Mar 2010 16:35:25 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271635.o2RGZPtD039145@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 16:35: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: r205739 - stable/8/sys/fs/nfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 16:35:26 -0000

Author: trasz
Date: Sat Mar 27 16:35:25 2010
New Revision: 205739
URL: http://svn.freebsd.org/changeset/base/205739

Log:
  MFC r197650:
  
  Fix typo in the comment.

Modified:
  stable/8/sys/fs/nfs/nfs_commonacl.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_commonacl.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonacl.c	Sat Mar 27 16:35:07 2010	(r205738)
+++ stable/8/sys/fs/nfs/nfs_commonacl.c	Sat Mar 27 16:35:25 2010	(r205739)
@@ -631,7 +631,7 @@ nfsrv_setacl(vnode_t vp, NFSACL_T *aclp,
 	if (nfsrv_useacl == 0 || !NFSHASNFS4ACL(vnode_mount(vp)))
 		return (NFSERR_ATTRNOTSUPP);
 	/*
-	 * With NFS4 ACLs, chmod(2) may need to add additional entries.
+	 * With NFSv4 ACLs, chmod(2) may need to add additional entries.
 	 * Make sure it has enough room for that - splitting every entry
 	 * into two and appending "canonical six" entries at the end.
 	 * Cribbed out of kern/vfs_acl.c - Rick M.

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 16:41:23 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 770731065672;
	Sat, 27 Mar 2010 16:41:23 +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 63E048FC16;
	Sat, 27 Mar 2010 16:41: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 o2RGfN8v040517;
	Sat, 27 Mar 2010 16:41:23 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RGfNA4040511;
	Sat, 27 Mar 2010 16:41:23 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271641.o2RGfNA4040511@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 16:41: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: r205740 - stable/8/share/man/man9
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 16:41:23 -0000

Author: trasz
Date: Sat Mar 27 16:41:23 2010
New Revision: 205740
URL: http://svn.freebsd.org/changeset/base/205740

Log:
  MFC r197405, missing part:
  
  Add pieces of infrastructure required for NFSv4 ACL support in UFS.
  
  Reviewed by:	rwatson

Added:
  stable/8/share/man/man9/vaccess_acl_nfs4.9
     - copied unchanged from r197405, head/share/man/man9/vaccess_acl_nfs4.9
Modified:
  stable/8/share/man/man9/Makefile
  stable/8/share/man/man9/VOP_ACCESS.9
  stable/8/share/man/man9/acl.9
  stable/8/share/man/man9/vaccess.9
Directory Properties:
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/Makefile
==============================================================================
--- stable/8/share/man/man9/Makefile	Sat Mar 27 16:35:25 2010	(r205739)
+++ stable/8/share/man/man9/Makefile	Sat Mar 27 16:41:23 2010	(r205740)
@@ -255,6 +255,7 @@ MAN=	accept_filter.9 \
 	usbdi.9 \
 	utopia.9 \
 	vaccess.9 \
+	vaccess_acl_nfs4.9 \
 	vaccess_acl_posix1e.9 \
 	vcount.9 \
 	vflush.9 \

Modified: stable/8/share/man/man9/VOP_ACCESS.9
==============================================================================
--- stable/8/share/man/man9/VOP_ACCESS.9	Sat Mar 27 16:35:25 2010	(r205739)
+++ stable/8/share/man/man9/VOP_ACCESS.9	Sat Mar 27 16:41:23 2010	(r205740)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 1, 2009
+.Dd September 18, 2009
 .Os
 .Dt VOP_ACCESS 9
 .Sh NAME
@@ -95,6 +95,7 @@ requested access.
 .El
 .Sh SEE ALSO
 .Xr vaccess 9 ,
+.Xr vaccess_acl_nfs4 9 ,
 .Xr vaccess_acl_posix1e 9 ,
 .Xr vnode 9
 .Sh AUTHORS

Modified: stable/8/share/man/man9/acl.9
==============================================================================
--- stable/8/share/man/man9/acl.9	Sat Mar 27 16:35:25 2010	(r205739)
+++ stable/8/share/man/man9/acl.9	Sat Mar 27 16:41:23 2010	(r205740)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 23, 1999
+.Dd September 18, 2009
 .Os
 .Dt ACL 9
 .Sh NAME
@@ -207,6 +207,7 @@ The following values are valid:
 .El
 .Sh SEE ALSO
 .Xr acl 3 ,
+.Xr vaccess_acl_nfs4 9 ,
 .Xr vaccess_acl_posix1e 9 ,
 .Xr VFS 9 ,
 .Xr vnaccess 9 ,

Modified: stable/8/share/man/man9/vaccess.9
==============================================================================
--- stable/8/share/man/man9/vaccess.9	Sat Mar 27 16:35:25 2010	(r205739)
+++ stable/8/share/man/man9/vaccess.9	Sat Mar 27 16:41:23 2010	(r205740)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 22, 2001
+.Dd September 18, 2009
 .Os
 .Dt VACCESS 9
 .Sh NAME
@@ -117,6 +117,7 @@ An attempt was made to perform an operat
 appropriate privileges or to the owner of a file or other resource.
 .El
 .Sh SEE ALSO
+.Xr vaccess_acl_nfs4 9 ,
 .Xr vaccess_acl_posix1e 9 ,
 .Xr vnode 9 ,
 .Xr VOP_ACCESS 9

Copied: stable/8/share/man/man9/vaccess_acl_nfs4.9 (from r197405, head/share/man/man9/vaccess_acl_nfs4.9)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/share/man/man9/vaccess_acl_nfs4.9	Sat Mar 27 16:41:23 2010	(r205740, copy of r197405, head/share/man/man9/vaccess_acl_nfs4.9)
@@ -0,0 +1,129 @@
+.\"-
+.\" Copyright (c) 2001 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2009
+.Os
+.Dt VACCESS_ACL_NFS4 9
+.Sh NAME
+.Nm vaccess_acl_nfs4
+.Nd generate a NFSv4 ACL access control decision using vnode parameters
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/acl.h
+.Ft int
+.Fo vaccess_acl_nfs4
+.Fa "enum vtype type"
+.Fa "uid_t file_uid"
+.Fa "gid_t file_gid"
+.Fa "struct acl *acl"
+.Fa "accmode_t accmode"
+.Fa "struct ucred *cred"
+.Fa "int *privused"
+.Fc
+.Sh DESCRIPTION
+This call implements the logic for the
+.Ux
+discretionary file security model
+with NFSv4 ACL extensions.
+It accepts the vnodes type
+.Fa type ,
+owning UID
+.Fa file_uid ,
+owning GID
+.Fa file_gid ,
+access ACL for the file
+.Fa acl ,
+desired access mode
+.Fa accmode ,
+requesting credential
+.Fa cred ,
+and an optional call-by-reference
+.Vt int
+pointer returning whether or not
+privilege was required for successful evaluation of the call; the
+.Fa privused
+pointer may be set to
+.Dv NULL
+by the caller in order not to be informed of
+privilege information, or it may point to an integer that will be set to
+1 if privilege is used, and 0 otherwise.
+.Pp
+This call is intended to support implementations of
+.Xr VOP_ACCESS 9 ,
+which will use their own access methods to retrieve the vnode properties,
+and then invoke
+.Fn vaccess_acl_nfs4
+in order to perform the actual check.
+Implementations of
+.Xr VOP_ACCESS 9
+may choose to implement additional security mechanisms whose results will
+be composed with the return value.
+.Pp
+The algorithm used by
+.Fn vaccess_acl_nfs4
+is based on the NFSv4 ACL evaluation algorithm, as described in
+NFSv4 Minor Version 1, draft-ietf-nfsv4-minorversion1-21.txt.
+The algorithm selects a
+.Em matching
+entry from the access ACL, which may
+then be composed with an available ACL mask entry, providing
+.Ux
+security compatibility.
+.Pp
+Once appropriate protections are selected for the current credential,
+the requested access mode, in combination with the vnode type, will be
+compared with the discretionary rights available for the credential.
+If the rights granted by discretionary protections are insufficient,
+then super-user privilege, if available for the credential, will also be
+considered.
+.Sh RETURN VALUES
+.Fn vaccess_acl_nfs4
+will return 0 on success, or a non-zero error value on failure.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EACCES
+Permission denied.
+An attempt was made to access a file in a way forbidden by its file access
+permissions.
+.It Bq Er EPERM
+Operation not permitted.
+An attempt was made to perform an operation limited to processes with
+appropriate privileges or to the owner of a file or other resource.
+.El
+.Sh SEE ALSO
+.Xr vaccess 9 ,
+.Xr vnode 9 ,
+.Xr VOP_ACCESS 9
+.Sh AUTHORS
+Current implementation of
+.Fn vaccess_acl_nfs4
+was written by
+.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.Sh BUGS
+This manual page should include a full description of the NFSv4 ACL
+evaluation algorithm, or cross reference another page that does.

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:11:07 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6912B106566C;
	Sat, 27 Mar 2010 17:11:07 +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 56E6A8FC0C;
	Sat, 27 Mar 2010 17:11: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 o2RHB763047270;
	Sat, 27 Mar 2010 17:11:07 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHB7oO047268;
	Sat, 27 Mar 2010 17:11:07 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271711.o2RHB7oO047268@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:11:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205744 - stable/8/sys/kern
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:11:07 -0000

Author: bz
Date: Sat Mar 27 17:11:06 2010
New Revision: 205744
URL: http://svn.freebsd.org/changeset/base/205744

Log:
  MFC r202123:
  
    Change DDB show prison:
    - name some columns more closely to the user space variables,
      as we do for host.* or allow.* (in the listing) already.
    - print pr_childmax (children.max).
    - prefix hex values with 0x.

Modified:
  stable/8/sys/kern/kern_jail.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/kern_jail.c
==============================================================================
--- stable/8/sys/kern/kern_jail.c	Sat Mar 27 16:55:48 2010	(r205743)
+++ stable/8/sys/kern/kern_jail.c	Sat Mar 27 17:11:06 2010	(r205744)
@@ -4276,10 +4276,11 @@ db_show_prison(struct prison *pr)
 #endif
 	db_printf(" root            = %p\n", pr->pr_root);
 	db_printf(" securelevel     = %d\n", pr->pr_securelevel);
-	db_printf(" childcount      = %d\n", pr->pr_childcount);
+	db_printf(" children.max    = %d\n", pr->pr_childmax);
+	db_printf(" children.cur    = %d\n", pr->pr_childcount);
 	db_printf(" child           = %p\n", LIST_FIRST(&pr->pr_children));
 	db_printf(" sibling         = %p\n", LIST_NEXT(pr, pr_sibling));
-	db_printf(" flags           = %x", pr->pr_flags);
+	db_printf(" flags           = 0x%x", pr->pr_flags);
 	for (fi = 0; fi < sizeof(pr_flag_names) / sizeof(pr_flag_names[0]);
 	    fi++)
 		if (pr_flag_names[fi] != NULL && (pr->pr_flags & (1 << fi)))
@@ -4294,7 +4295,7 @@ db_show_prison(struct prison *pr)
 		    : (jsf == pr_flag_jailsys[fi].new) ? "new"
 		    : "inherit");
 	}
-	db_printf(" allow           = %x", pr->pr_allow);
+	db_printf(" allow           = 0x%x", pr->pr_allow);
 	for (fi = 0; fi < sizeof(pr_allow_names) / sizeof(pr_allow_names[0]);
 	    fi++)
 		if (pr_allow_names[fi] != NULL && (pr->pr_allow & (1 << fi)))
@@ -4309,14 +4310,14 @@ db_show_prison(struct prison *pr)
 	db_printf(" ip4s            = %d\n", pr->pr_ip4s);
 	for (ii = 0; ii < pr->pr_ip4s; ii++)
 		db_printf(" %s %s\n",
-		    ii == 0 ? "ip4             =" : "                 ",
+		    ii == 0 ? "ip4.addr        =" : "                 ",
 		    inet_ntoa(pr->pr_ip4[ii]));
 #endif
 #ifdef INET6
 	db_printf(" ip6s            = %d\n", pr->pr_ip6s);
 	for (ii = 0; ii < pr->pr_ip6s; ii++)
 		db_printf(" %s %s\n",
-		    ii == 0 ? "ip6             =" : "                 ",
+		    ii == 0 ? "ip6.addr        =" : "                 ",
 		    ip6_sprintf(ip6buf, &pr->pr_ip6[ii]));
 #endif
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:14:55 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C9F8B106566C;
	Sat, 27 Mar 2010 17:14:55 +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 B71358FC0A;
	Sat, 27 Mar 2010 17:14:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2RHEtZJ048146;
	Sat, 27 Mar 2010 17:14:55 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHEtll048138;
	Sat, 27 Mar 2010 17:14:55 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271714.o2RHEtll048138@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:14: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: r205745 - in stable/8/sys: amd64/conf i386/conf
	ia64/conf pc98/conf powerpc/conf sparc64/conf sun4v/conf
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:14:56 -0000

Author: bz
Date: Sat Mar 27 17:14:55 2010
New Revision: 205745
URL: http://svn.freebsd.org/changeset/base/205745

Log:
  MFC r201813:
  
    In sys//conf/Makefile set TARGET to . That allows
    sys/conf/makeLINT.mk to only do certain things for certain
    architectures.
  
    Note that neither arm nor mips have the Makefile there, thus
    essentially not (yet) supporting LINT.  This would enable them
    do add special treatment to sys/conf/makeLINT.mk as well chosing
    one of the many configurations as LINT.

Modified:
  stable/8/sys/amd64/conf/Makefile
  stable/8/sys/i386/conf/Makefile
  stable/8/sys/ia64/conf/Makefile
  stable/8/sys/pc98/conf/Makefile
  stable/8/sys/powerpc/conf/Makefile
  stable/8/sys/sparc64/conf/Makefile
  stable/8/sys/sun4v/conf/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/amd64/conf/Makefile
==============================================================================
--- stable/8/sys/amd64/conf/Makefile	Sat Mar 27 17:11:06 2010	(r205744)
+++ stable/8/sys/amd64/conf/Makefile	Sat Mar 27 17:14:55 2010	(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=amd64
+
 .include "${.CURDIR}/../../conf/makeLINT.mk"

Modified: stable/8/sys/i386/conf/Makefile
==============================================================================
--- stable/8/sys/i386/conf/Makefile	Sat Mar 27 17:11:06 2010	(r205744)
+++ stable/8/sys/i386/conf/Makefile	Sat Mar 27 17:14:55 2010	(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=i386
+
 .include "${.CURDIR}/../../conf/makeLINT.mk"

Modified: stable/8/sys/ia64/conf/Makefile
==============================================================================
--- stable/8/sys/ia64/conf/Makefile	Sat Mar 27 17:11:06 2010	(r205744)
+++ stable/8/sys/ia64/conf/Makefile	Sat Mar 27 17:14:55 2010	(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=ia64
+
 .include "${.CURDIR}/../../conf/makeLINT.mk"

Modified: stable/8/sys/pc98/conf/Makefile
==============================================================================
--- stable/8/sys/pc98/conf/Makefile	Sat Mar 27 17:11:06 2010	(r205744)
+++ stable/8/sys/pc98/conf/Makefile	Sat Mar 27 17:14:55 2010	(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=pc98
+
 .include "${.CURDIR}/../../conf/makeLINT.mk"

Modified: stable/8/sys/powerpc/conf/Makefile
==============================================================================
--- stable/8/sys/powerpc/conf/Makefile	Sat Mar 27 17:11:06 2010	(r205744)
+++ stable/8/sys/powerpc/conf/Makefile	Sat Mar 27 17:14:55 2010	(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=powerpc
+
 .include "${.CURDIR}/../../conf/makeLINT.mk"

Modified: stable/8/sys/sparc64/conf/Makefile
==============================================================================
--- stable/8/sys/sparc64/conf/Makefile	Sat Mar 27 17:11:06 2010	(r205744)
+++ stable/8/sys/sparc64/conf/Makefile	Sat Mar 27 17:14:55 2010	(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=sparc64
+
 .include "${.CURDIR}/../../conf/makeLINT.mk"

Modified: stable/8/sys/sun4v/conf/Makefile
==============================================================================
--- stable/8/sys/sun4v/conf/Makefile	Sat Mar 27 17:11:06 2010	(r205744)
+++ stable/8/sys/sun4v/conf/Makefile	Sat Mar 27 17:14:55 2010	(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=sun4v
+
 .include "${.CURDIR}/../../conf/makeLINT.mk"

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:17:12 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 34E6B106566B;
	Sat, 27 Mar 2010 17:17:12 +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 2311C8FC13;
	Sat, 27 Mar 2010 17:17: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 o2RHHCO0048742;
	Sat, 27 Mar 2010 17:17:12 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHHCXS048740;
	Sat, 27 Mar 2010 17:17:12 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271717.o2RHHCXS048740@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:17: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: r205746 - stable/8/sys/conf
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:17:12 -0000

Author: bz
Date: Sat Mar 27 17:17:11 2010
New Revision: 205746
URL: http://svn.freebsd.org/changeset/base/205746

Log:
  MFC r201814:
  
    Generate a second LINT configuration for i386 and amd64 in
    sys/conf/makeLINT.mk, which includes LINT and sets options VIMAGE
    so that we will have VIMAGE LINT builds. For now only do it for
    those two architectures to avoid massive universe times for archs,
    where people will less likely use VIMAGE or not at all.

Modified:
  stable/8/sys/conf/makeLINT.mk
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/makeLINT.mk
==============================================================================
--- stable/8/sys/conf/makeLINT.mk	Sat Mar 27 17:14:55 2010	(r205745)
+++ stable/8/sys/conf/makeLINT.mk	Sat Mar 27 17:17:11 2010	(r205746)
@@ -5,7 +5,15 @@ all:
 
 clean:
 	rm -f LINT
+.if ${TARGET} == "amd64" || ${TARGET} == "i386"
+	rm -f LINT-VIMAGE
+.endif
 
 NOTES=	../../conf/NOTES NOTES
 LINT: ${NOTES} ../../conf/makeLINT.sed
 	cat ${NOTES} | sed -E -n -f ../../conf/makeLINT.sed > ${.TARGET}
+.if ${TARGET} == "amd64" || ${TARGET} == "i386"
+	echo "include ${.TARGET}"	>  ${.TARGET}-VIMAGE
+	echo "ident ${.TARGET}-VIMAGE"	>> ${.TARGET}-VIMAGE
+	echo "options VIMAGE"		>> ${.TARGET}-VIMAGE
+.endif

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:22:08 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A52A11065674;
	Sat, 27 Mar 2010 17:22:08 +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 933EB8FC1A;
	Sat, 27 Mar 2010 17:22: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 o2RHM82G049926;
	Sat, 27 Mar 2010 17:22:08 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHM8Bw049924;
	Sat, 27 Mar 2010 17:22:08 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271722.o2RHM8Bw049924@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:22: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: r205747 - stable/8
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:22:08 -0000

Author: bz
Date: Sat Mar 27 17:22:08 2010
New Revision: 205747
URL: http://svn.freebsd.org/changeset/base/205747

Log:
  MFC r201815:
  
    To avoid hardcoding further kernel configuration names for
    make universe, split the logic into two parts:
    - 1st to build worlds and generate kernel configs like LINT.
    - 2nd to build kernels for a given TARGET architecture correctly
      finding all newly generated configs, not knowing anything about
      LINT anymore.
  
  MFC rr201960:
  
    Use uname -m [1] and rename BUILD_ARCH to XMACHINE[2].
  
    Submitted by: nyan[1], imp[2]
  
  MFC r202095:
  
    Rather than using an extra variable, only call uname if really needed and
    then directly assign the result.
  
    Submitted by: jmallett

Modified:
  stable/8/Makefile   (contents, props changed)

Modified: stable/8/Makefile
==============================================================================
--- stable/8/Makefile	Sat Mar 27 17:17:11 2010	(r205746)
+++ stable/8/Makefile	Sat Mar 27 17:22:08 2010	(r205747)
@@ -278,7 +278,7 @@ tinderbox:
 # with a reasonable chance of success, regardless of how old your
 # existing system is.
 #
-.if make(universe) || make(tinderbox)
+.if make(universe) || make(universe_kernels) || make(tinderbox)
 TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v
 
 .if defined(DOING_TINDERBOX)
@@ -297,10 +297,6 @@ universe_prologue:
 	rm -f ${FAILFILE}
 .endif
 .for target in ${TARGETS}
-KERNCONFS!=	cd ${.CURDIR}/sys/${target}/conf && \
-		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
-		! -name DEFAULTS ! -name LINT
-KERNCONFS:=	${KERNCONFS:S/^NOTES$/LINT/}
 universe: universe_${target}
 .ORDER: universe_prologue universe_${target} universe_epilogue
 universe_${target}:
@@ -320,16 +316,26 @@ universe_${target}:
 	    (echo "${target} 'make LINT' failed," \
 	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
 .endif
+	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
+	    universe_kernels
+	@echo ">> ${target} completed on `LC_ALL=C date`"
+.endfor
+universe_kernels: universe_kernconfs
+.if !defined(TARGET)
+TARGET!=	uname -m
+.endif
+KERNCONFS!=	cd ${.CURDIR}/sys/${TARGET}/conf && \
+		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
+		! -name DEFAULTS ! -name NOTES
+universe_kernconfs:
 .for kernel in ${KERNCONFS}
 	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
 	    ${MAKE} ${JFLAG} buildkernel \
-	    TARGET=${target} \
+	    TARGET=${TARGET} \
 	    KERNCONF=${kernel} \
-	    > _.${target}.${kernel} 2>&1 || \
-	    (echo "${target} ${kernel} kernel failed," \
-	    "check _.${target}.${kernel} for details"| ${MAKEFAIL}))
-.endfor
-	@echo ">> ${target} completed on `LC_ALL=C date`"
+	    > _.${TARGET}.${kernel} 2>&1 || \
+	    (echo "${TARGET} ${kernel} kernel failed," \
+	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
 .endfor
 universe: universe_epilogue
 universe_epilogue:

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:22:12 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 39529106564A;
	Sat, 27 Mar 2010 17:22:12 +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 26C338FC16;
	Sat, 27 Mar 2010 17:22: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 o2RHMCR8049996;
	Sat, 27 Mar 2010 17:22:12 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHMB4K049990;
	Sat, 27 Mar 2010 17:22:11 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271722.o2RHMB4K049990@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 17:22: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: r205748 - in stable/8/sys: fs/fifofs kern sys
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:22:12 -0000

Author: trasz
Date: Sat Mar 27 17:22:11 2010
New Revision: 205748
URL: http://svn.freebsd.org/changeset/base/205748

Log:
  MFC r197680:
  
  Provide default implementation for VOP_ACCESS(9), so that filesystems which
  want to provide VOP_ACCESSX(9) don't have to implement both.  Note that
  this commit makes implementation of either of these two mandatory.
  
  Reviewed by:	kib

Modified:
  stable/8/sys/fs/fifofs/fifo_vnops.c
  stable/8/sys/kern/subr_acl_posix1e.c
  stable/8/sys/kern/vfs_default.c
  stable/8/sys/kern/vfs_subr.c
  stable/8/sys/sys/vnode.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/fs/fifofs/fifo_vnops.c
==============================================================================
--- stable/8/sys/fs/fifofs/fifo_vnops.c	Sat Mar 27 17:22:08 2010	(r205747)
+++ stable/8/sys/fs/fifofs/fifo_vnops.c	Sat Mar 27 17:22:11 2010	(r205748)
@@ -114,7 +114,6 @@ static struct filterops fifo_notsup_filt
 struct vop_vector fifo_specops = {
 	.vop_default =		&default_vnodeops,
 
-	.vop_access =		VOP_EBADF,
 	.vop_advlock =		fifo_advlock,
 	.vop_close =		fifo_close,
 	.vop_create =		VOP_PANIC,

Modified: stable/8/sys/kern/subr_acl_posix1e.c
==============================================================================
--- stable/8/sys/kern/subr_acl_posix1e.c	Sat Mar 27 17:22:08 2010	(r205747)
+++ stable/8/sys/kern/subr_acl_posix1e.c	Sat Mar 27 17:22:11 2010	(r205748)
@@ -61,6 +61,9 @@ vaccess_acl_posix1e(enum vtype type, uid
 	accmode_t acl_mask_granted;
 	int group_matched, i;
 
+	KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0,
+	    ("invalid bit in accmode"));
+
 	/*
 	 * Look for a normal, non-privileged way to access the file/directory
 	 * as requested.  If it exists, go with that.  Otherwise, attempt to

Modified: stable/8/sys/kern/vfs_default.c
==============================================================================
--- stable/8/sys/kern/vfs_default.c	Sat Mar 27 17:22:08 2010	(r205747)
+++ stable/8/sys/kern/vfs_default.c	Sat Mar 27 17:22:11 2010	(r205748)
@@ -83,12 +83,17 @@ static int	dirent_exists(struct vnode *v
  *
  * If there is no specific entry here, we will return EOPNOTSUPP.
  *
+ * Note that every filesystem has to implement either vop_access
+ * or vop_accessx; failing to do so will result in immediate crash
+ * due to stack overflow, as vop_stdaccess() calls vop_stdaccessx(),
+ * which calls vop_stdaccess() etc.
  */
 
 struct vop_vector default_vnodeops = {
 	.vop_default =		NULL,
 	.vop_bypass =		VOP_EOPNOTSUPP,
 
+	.vop_access =		vop_stdaccess,
 	.vop_accessx =		vop_stdaccessx,
 	.vop_advlock =		vop_stdadvlock,
 	.vop_advlockasync =	vop_stdadvlockasync,
@@ -326,6 +331,16 @@ out:
 }
 
 int
+vop_stdaccess(struct vop_access_args *ap)
+{
+
+	KASSERT((ap->a_accmode & ~(VEXEC | VWRITE | VREAD | VADMIN |
+	    VAPPEND)) == 0, ("invalid bit in accmode"));
+
+	return (VOP_ACCESSX(ap->a_vp, ap->a_accmode, ap->a_cred, ap->a_td));
+}
+
+int
 vop_stdaccessx(struct vop_accessx_args *ap)
 {
 	int error;

Modified: stable/8/sys/kern/vfs_subr.c
==============================================================================
--- stable/8/sys/kern/vfs_subr.c	Sat Mar 27 17:22:08 2010	(r205747)
+++ stable/8/sys/kern/vfs_subr.c	Sat Mar 27 17:22:11 2010	(r205748)
@@ -3523,6 +3523,9 @@ vaccess(enum vtype type, mode_t file_mod
 	accmode_t dac_granted;
 	accmode_t priv_granted;
 
+	KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0,
+	    ("invalid bit in accmode"));
+
 	/*
 	 * Look for a normal, non-privileged way to access the file/directory
 	 * as requested.  If it exists, go with that.

Modified: stable/8/sys/sys/vnode.h
==============================================================================
--- stable/8/sys/sys/vnode.h	Sat Mar 27 17:22:08 2010	(r205747)
+++ stable/8/sys/sys/vnode.h	Sat Mar 27 17:22:11 2010	(r205748)
@@ -685,6 +685,7 @@ int	vop_stdlock(struct vop_lock1_args *)
 int	vop_stdputpages(struct vop_putpages_args *);
 int	vop_stdunlock(struct vop_unlock_args *);
 int	vop_nopoll(struct vop_poll_args *);
+int	vop_stdaccess(struct vop_access_args *ap);
 int	vop_stdaccessx(struct vop_accessx_args *ap);
 int	vop_stdadvlock(struct vop_advlock_args *ap);
 int	vop_stdadvlockasync(struct vop_advlockasync_args *ap);

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:25:17 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7C845106564A;
	Sat, 27 Mar 2010 17:25:17 +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 69E468FC0A;
	Sat, 27 Mar 2010 17:25: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 o2RHPHPM050745;
	Sat, 27 Mar 2010 17:25:17 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHPHQw050741;
	Sat, 27 Mar 2010 17:25:17 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271725.o2RHPHQw050741@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 17:25:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205749 - stable/8/share/man/man9
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:25:17 -0000

Author: trasz
Date: Sat Mar 27 17:25:17 2010
New Revision: 205749
URL: http://svn.freebsd.org/changeset/base/205749

Log:
  MFC r197780:
  
  Make fetch(9) and store(9) manual pages closer to reality.

Modified:
  stable/8/share/man/man9/Makefile
  stable/8/share/man/man9/fetch.9
  stable/8/share/man/man9/store.9
Directory Properties:
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/Makefile
==============================================================================
--- stable/8/share/man/man9/Makefile	Sat Mar 27 17:22:11 2010	(r205748)
+++ stable/8/share/man/man9/Makefile	Sat Mar 27 17:25:17 2010	(r205749)
@@ -610,8 +610,10 @@ MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECL
 	EVENTHANDLER.9 eventhandler_register.9
 MLINKS+=fetch.9 fubyte.9 \
 	fetch.9 fuswintr.9 \
-	fetch.9 fusword.9 \
-	fetch.9 fuword.9
+	fetch.9 fuword.9 \
+	fetch.9 fuword16.9 \
+	fetch.9 fuword32.9 \
+	fetch.9 fuword64.9
 MLINKS+=g_attach.9 g_detach.9
 MLINKS+=g_bio.9 g_clone_bio.9 \
 	g_bio.9 g_destroy_bio.9 \
@@ -1147,8 +1149,10 @@ MLINKS+=stack.9 stack_copy.9 \
 	stack.9 stack_zero.9
 MLINKS+=store.9 subyte.9 \
 	store.9 suswintr.9 \
-	store.9 susword.9 \
-	store.9 suword.9
+	store.9 suword.9 \
+	store.9 suword16.9 \
+	store.9 suword32.9 \
+	store.9 suword64.9
 MLINKS+=swi.9 swi_add.9 \
 	swi.9 swi_sched.9
 MLINKS+=sx.9 sx_assert.9 \

Modified: stable/8/share/man/man9/fetch.9
==============================================================================
--- stable/8/share/man/man9/fetch.9	Sat Mar 27 17:22:11 2010	(r205748)
+++ stable/8/share/man/man9/fetch.9	Sat Mar 27 17:25:17 2010	(r205749)
@@ -34,29 +34,35 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 7, 1996
+.Dd October 5, 2009
 .Dt FETCH 9
 .Os
 .Sh NAME
 .Nm fetch ,
 .Nm fubyte ,
-.Nm fusword ,
 .Nm fuswintr ,
-.Nm fuword
+.Nm fuword ,
+.Nm fuword16 ,
+.Nm fuword32 ,
+.Nm fuword64
 .Nd fetch data from user-space
 .Sh SYNOPSIS
 .In sys/types.h
 .In sys/time.h
 .In sys/systm.h
-.In sys/resourcevar.h
 .Ft int
 .Fn fubyte "const void *base"
+.Ft long
+.Fn fuword "const void *base"
 .Ft int
-.Fn fusword "void *base"
+.Fn fuword16 "void *base"
+.Ft int32_t
+.Fn fuword32 "const void *base"
+.Ft int64_t
+.Fn fuword64 "const void *base"
+.In sys/resourcevar.h
 .Ft int
 .Fn fuswintr "void *base"
-.Ft long
-.Fn fuword "const void *base"
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,16 +75,22 @@ routines provide the following functiona
 .It Fn fubyte
 Fetches a byte of data from the user-space address
 .Pa base .
-.It Fn fusword
-Fetches a short word of data from the user-space address
+.It Fn fuword
+Fetches a word of data from the user-space address
+.Pa base .
+.It Fn fuword16
+Fetches 16 bits of data from the user-space address
+.Pa base .
+.It Fn fuword32
+Fetches 32 bits of data from the user-space address
+.Pa base .
+.It Fn fuword64
+Fetches 64 bits of data from the user-space address
 .Pa base .
 .It Fn fuswintr
 Fetches a short word of data from the user-space address
 .Pa base .
 This function is safe to call during an interrupt context.
-.It Fn fuword
-Fetches a word of data from the user-space address
-.Pa base .
 .El
 .Sh RETURN VALUES
 The

Modified: stable/8/share/man/man9/store.9
==============================================================================
--- stable/8/share/man/man9/store.9	Sat Mar 27 17:22:11 2010	(r205748)
+++ stable/8/share/man/man9/store.9	Sat Mar 27 17:25:17 2010	(r205749)
@@ -34,13 +34,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 7, 1996
+.Dd October 5, 2009
 .Dt STORE 9
 .Os
 .Sh NAME
 .Nm store ,
 .Nm subyte ,
-.Nm susword ,
 .Nm suswintr ,
 .Nm suword
 .Nd store data to user-space
@@ -48,15 +47,19 @@
 .In sys/types.h
 .In sys/time.h
 .In sys/systm.h
-.In sys/resourcevar.h
 .Ft int
 .Fn subyte "void *base" "int byte"
 .Ft int
-.Fn susword "void *base" "int word"
+.Fn suword "void *base" "long word"
 .Ft int
-.Fn suswintr "void *base" "int word"
+.Fn suword16 "void *base" "int word"
 .Ft int
-.Fn suword "void *base" "long word"
+.Fn suword32 "void *base" "int32_t word"
+.Ft int
+.Fn suword64 "void *base" "int64_t word"
+.In sys/resourcevar.h
+.Ft int
+.Fn suswintr "void *base" "int word"
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,16 +72,22 @@ routines provide the following functiona
 .It Fn subyte
 Stores a byte of data to the user-space address
 .Pa base .
-.It Fn susword
-Stores a short word of data to the user-space address
+.It Fn suword
+Stores a word of data to the user-space address
+.Pa base .
+.It Fn suword16
+Stores 16 bits of of data to the user-space address
+.Pa base .
+.It Fn suword32
+Stores 32 bits of of data to the user-space address
+.Pa base .
+.It Fn suword64
+Stores 64 bits of of data to the user-space address
 .Pa base .
 .It Fn suswintr
 Stores a short word of data to the user-space address
 .Pa base .
 This function is safe to call during an interrupt context.
-.It Fn suword
-Stores a word of data to the user-space address
-.Pa base .
 .El
 .Sh RETURN VALUES
 The

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:26:31 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9EFB9106566C;
	Sat, 27 Mar 2010 17:26:31 +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 82A588FC1B;
	Sat, 27 Mar 2010 17:26: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 o2RHQVeW051060;
	Sat, 27 Mar 2010 17:26:31 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHQVmJ051058;
	Sat, 27 Mar 2010 17:26:31 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271726.o2RHQVmJ051058@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:26:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205750 - stable/8/sys/netinet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:26:31 -0000

Author: bz
Date: Sat Mar 27 17:26:31 2010
New Revision: 205750
URL: http://svn.freebsd.org/changeset/base/205750

Log:
  MFC r203724:
  
    Properly free resources when destroying the TCP hostcache while
    tearing down a network stack (in the VIMAGE jail+vnet case).
  
    For that break out the logic from tcp_hc_purge() into an internal
    function we can call from both, the sysctl handler and the
    tcp_hc_destroy().
  
    Reviewed by:  silby, lstewart

Modified:
  stable/8/sys/netinet/tcp_hostcache.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_hostcache.c
==============================================================================
--- stable/8/sys/netinet/tcp_hostcache.c	Sat Mar 27 17:25:17 2010	(r205749)
+++ stable/8/sys/netinet/tcp_hostcache.c	Sat Mar 27 17:26:31 2010	(r205750)
@@ -115,6 +115,7 @@ static VNET_DEFINE(struct callout, tcp_h
 static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *);
 static struct hc_metrics *tcp_hc_insert(struct in_conninfo *);
 static int sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS);
+static void tcp_hc_purge_internal(int);
 static void tcp_hc_purge(void *);
 
 SYSCTL_NODE(_net_inet_tcp, OID_AUTO, hostcache, CTLFLAG_RW, 0,
@@ -235,10 +236,19 @@ tcp_hc_init(void)
 void
 tcp_hc_destroy(void)
 {
-
-	/* XXX TODO walk the hashtable and free all entries  */
+	int i;
 
 	callout_drain(&V_tcp_hc_callout);
+
+	/* Purge all hc entries. */
+	tcp_hc_purge_internal(1);
+
+	/* Free the uma zone and the allocated hash table. */
+	uma_zdestroy(V_tcp_hostcache.zone);
+
+	for (i = 0; i < V_tcp_hostcache.hashsize; i++)
+		mtx_destroy(&V_tcp_hostcache.hashbase[i].hch_mtx);
+	free(V_tcp_hostcache.hashbase, M_HOSTCACHE);
 }
 #endif
 
@@ -633,22 +643,14 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS)
 }
 
 /*
- * Expire and purge (old|all) entries in the tcp_hostcache.  Runs
- * periodically from the callout.
+ * Caller has to make sure the curvnet is set properly.
  */
 static void
-tcp_hc_purge(void *arg)
+tcp_hc_purge_internal(int all)
 {
-	CURVNET_SET((struct vnet *) arg);
 	struct hc_metrics *hc_entry, *hc_next;
-	int all = 0;
 	int i;
 
-	if (V_tcp_hostcache.purgeall) {
-		all = 1;
-		V_tcp_hostcache.purgeall = 0;
-	}
-
 	for (i = 0; i < V_tcp_hostcache.hashsize; i++) {
 		THC_LOCK(&V_tcp_hostcache.hashbase[i].hch_mtx);
 		TAILQ_FOREACH_SAFE(hc_entry,
@@ -664,6 +666,24 @@ tcp_hc_purge(void *arg)
 		}
 		THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx);
 	}
+}
+
+/*
+ * Expire and purge (old|all) entries in the tcp_hostcache.  Runs
+ * periodically from the callout.
+ */
+static void
+tcp_hc_purge(void *arg)
+{
+	CURVNET_SET((struct vnet *) arg);
+	int all = 0;
+
+	if (V_tcp_hostcache.purgeall) {
+		all = 1;
+		V_tcp_hostcache.purgeall = 0;
+	}
+
+	tcp_hc_purge_internal(all);
 
 	callout_reset(&V_tcp_hc_callout, V_tcp_hostcache.prune * hz,
 	    tcp_hc_purge, arg);

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:29:51 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EFF31106564A;
	Sat, 27 Mar 2010 17:29: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 D4B188FC0A;
	Sat, 27 Mar 2010 17:29: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 o2RHToxP051906;
	Sat, 27 Mar 2010 17:29:50 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHToC4051904;
	Sat, 27 Mar 2010 17:29:50 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271729.o2RHToC4051904@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:29: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: r205751 - stable/8/sys/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:29:51 -0000

Author: bz
Date: Sat Mar 27 17:29:50 2010
New Revision: 205751
URL: http://svn.freebsd.org/changeset/base/205751

Log:
  MFC r203727:
  
    Add an SDT provider for "vnet"s along with probes for vnet_alloc
    and vnet_destroy.
    Use the line number rather than NULL as dummy argument.
  
    Note: the fbt provider does not reliably provide :return probes
    (depending on optimization levels used at compile time) making
    it unusable for scripts to generate complete call-traces with
    well defined boundaries over allocations or destructions of
    virtual network stacks.

Modified:
  stable/8/sys/net/vnet.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/net/vnet.c
==============================================================================
--- stable/8/sys/net/vnet.c	Sat Mar 27 17:26:31 2010	(r205750)
+++ stable/8/sys/net/vnet.c	Sat Mar 27 17:29:50 2010	(r205751)
@@ -38,11 +38,13 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_ddb.h"
 #include "opt_kdb.h"
+#include "opt_kdtrace.h"
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -210,6 +212,13 @@ static TAILQ_HEAD(, vnet_data_free) vnet
 	    TAILQ_HEAD_INITIALIZER(vnet_data_free_head);
 static struct sx vnet_data_free_lock;
 
+SDT_PROVIDER_DEFINE(vnet);
+SDT_PROBE_DEFINE1(vnet, functions, vnet_alloc, entry, "int");
+SDT_PROBE_DEFINE2(vnet, functions, vnet_alloc, alloc, "int", "struct vnet *");
+SDT_PROBE_DEFINE2(vnet, functions, vnet_alloc, return, "int", "struct vnet *");
+SDT_PROBE_DEFINE2(vnet, functions, vnet_destroy, entry, "int", "struct vnet *");
+SDT_PROBE_DEFINE1(vnet, functions, vnet_destroy, return, "int");
+
 /*
  * Allocate a virtual network stack.
  */
@@ -218,8 +227,10 @@ vnet_alloc(void)
 {
 	struct vnet *vnet;
 
+	SDT_PROBE1(vnet, functions, vnet_alloc, entry, __LINE__);
 	vnet = malloc(sizeof(struct vnet), M_VNET, M_WAITOK | M_ZERO);
 	vnet->vnet_magic_n = VNET_MAGIC_N;
+	SDT_PROBE2(vnet, functions, vnet_alloc, alloc, __LINE__, vnet);
 
 	/*
 	 * Allocate storage for virtualized global variables and copy in
@@ -244,6 +255,7 @@ vnet_alloc(void)
 	LIST_INSERT_HEAD(&vnet_head, vnet, vnet_le);
 	VNET_LIST_WUNLOCK();
 
+	SDT_PROBE2(vnet, functions, vnet_alloc, return, __LINE__, vnet);
 	return (vnet);
 }
 
@@ -255,6 +267,7 @@ vnet_destroy(struct vnet *vnet)
 {
 	struct ifnet *ifp, *nifp;
 
+	SDT_PROBE2(vnet, functions, vnet_destroy, entry, __LINE__, vnet);
 	KASSERT(vnet->vnet_sockcnt == 0,
 	    ("%s: vnet still has sockets", __func__));
 
@@ -281,6 +294,7 @@ vnet_destroy(struct vnet *vnet)
 	vnet->vnet_data_base = 0;
 	vnet->vnet_magic_n = 0xdeadbeef;
 	free(vnet, M_VNET);
+	SDT_PROBE1(vnet, functions, vnet_destroy, return, __LINE__);
 }
 
 /*

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:31:55 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E36901065672;
	Sat, 27 Mar 2010 17:31:54 +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 C67B68FC08;
	Sat, 27 Mar 2010 17:31: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 o2RHVsQW052395;
	Sat, 27 Mar 2010 17:31:54 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHVsMx052393;
	Sat, 27 Mar 2010 17:31:54 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271731.o2RHVsMx052393@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:31:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205752 - stable/8/sys/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:31:55 -0000

Author: bz
Date: Sat Mar 27 17:31:54 2010
New Revision: 205752
URL: http://svn.freebsd.org/changeset/base/205752

Log:
  MFC r203729:
  
    Add DDB support for printing vnet_sysinit and vnet_sysuninit
    ordered call lists. Try to lookup function/symbol names and print
    those in addition to the pointers, along with the constants for
    subsystem and order.
    This is useful for debugging vnet teardown ordering issues.
  
    Make it possible to call the actual printing frunction from normal
    code at runtime, ie. from vnet_sysuninit(), if DDB support is there.

Modified:
  stable/8/sys/net/vnet.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/net/vnet.c
==============================================================================
--- stable/8/sys/net/vnet.c	Sat Mar 27 17:29:50 2010	(r205751)
+++ stable/8/sys/net/vnet.c	Sat Mar 27 17:31:54 2010	(r205752)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef DDB
 #include 
+#include 
 #endif
 
 #include 
@@ -219,6 +220,10 @@ SDT_PROBE_DEFINE2(vnet, functions, vnet_
 SDT_PROBE_DEFINE2(vnet, functions, vnet_destroy, entry, "int", "struct vnet *");
 SDT_PROBE_DEFINE1(vnet, functions, vnet_destroy, return, "int");
 
+#ifdef DDB
+static void db_show_vnet_print_vs(struct vnet_sysinit *, int);
+#endif
+
 /*
  * Allocate a virtual network stack.
  */
@@ -713,6 +718,64 @@ DB_SHOW_COMMAND(vnets, db_show_vnets)
 	}
 }
 
+static void
+db_show_vnet_print_vs(struct vnet_sysinit *vs, int ddb)
+{
+	const char *vsname, *funcname;
+	c_db_sym_t sym;
+	db_expr_t  offset;
+
+#define xprint(...)							\
+	if (ddb)							\
+		db_printf(__VA_ARGS__);					\
+	else								\
+		printf(__VA_ARGS__)
+
+	if (vs == NULL) {
+		xprint("%s: no vnet_sysinit * given\n", __func__);
+		return;
+	}
+
+	sym = db_search_symbol((vm_offset_t)vs, DB_STGY_ANY, &offset);
+	db_symbol_values(sym, &vsname, NULL);
+	sym = db_search_symbol((vm_offset_t)vs->func, DB_STGY_PROC, &offset);
+	db_symbol_values(sym, &funcname, NULL);
+	xprint("%s(%p)\n", (vsname != NULL) ? vsname : "", vs);
+	xprint("  0x%08x 0x%08x\n", vs->subsystem, vs->order);
+	xprint("  %p(%s)(%p)\n",
+	    vs->func, (funcname != NULL) ? funcname : "", vs->arg);
+#undef xprint
+}
+
+DB_SHOW_COMMAND(vnet_sysinit, db_show_vnet_sysinit)
+{
+	struct vnet_sysinit *vs;
+
+	db_printf("VNET_SYSINIT vs Name(Ptr)\n");
+	db_printf("  Subsystem  Order\n");
+	db_printf("  Function(Name)(Arg)\n");
+	TAILQ_FOREACH(vs, &vnet_constructors, link) {
+		db_show_vnet_print_vs(vs, 1);
+		if (db_pager_quit)
+			break;
+	}
+}
+
+DB_SHOW_COMMAND(vnet_sysuninit, db_show_vnet_sysuninit)
+{
+	struct vnet_sysinit *vs;
+
+	db_printf("VNET_SYSUNINIT vs Name(Ptr)\n");
+	db_printf("  Subsystem  Order\n");
+	db_printf("  Function(Name)(Arg)\n");
+	TAILQ_FOREACH_REVERSE(vs, &vnet_destructors, vnet_sysuninit_head,
+	    link) {
+		db_show_vnet_print_vs(vs, 1);
+		if (db_pager_quit)
+			break;
+	}
+}
+
 #ifdef VNET_DEBUG
 DB_SHOW_COMMAND(vnetrcrs, db_show_vnetrcrs)
 {

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:33:19 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 826921065672;
	Sat, 27 Mar 2010 17:33: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 7101F8FC16;
	Sat, 27 Mar 2010 17:33: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 o2RHXJNY052794;
	Sat, 27 Mar 2010 17:33:19 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHXJ0m052792;
	Sat, 27 Mar 2010 17:33:19 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271733.o2RHXJ0m052792@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:33: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: r205753 - stable/8/sys/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:33:19 -0000

Author: bz
Date: Sat Mar 27 17:33:19 2010
New Revision: 205753
URL: http://svn.freebsd.org/changeset/base/205753

Log:
  MFC r204142:
  
    Enhance a panic string to contain more useful debugging information.

Modified:
  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/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Sat Mar 27 17:31:54 2010	(r205752)
+++ stable/8/sys/net/if.c	Sat Mar 27 17:33:19 2010	(r205753)
@@ -842,7 +842,8 @@ if_detach_internal(struct ifnet *ifp, in
 	IFNET_WUNLOCK();
 	if (!found) {
 		if (vmove)
-			panic("interface not in it's own ifnet list");
+			panic("%s: ifp=%p not on the ifnet tailq %p",
+			    __func__, ifp, &V_ifnet);
 		else
 			return; /* XXX this should panic as well? */
 	}

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:34:57 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 60BB41065670;
	Sat, 27 Mar 2010 17:34:57 +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 4F3C08FC08;
	Sat, 27 Mar 2010 17:34: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 o2RHYvw0053182;
	Sat, 27 Mar 2010 17:34:57 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHYvQ4053178;
	Sat, 27 Mar 2010 17:34:57 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271734.o2RHYvQ4053178@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:34: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: r205754 - stable/8/sys/netinet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:34:57 -0000

Author: bz
Date: Sat Mar 27 17:34:57 2010
New Revision: 205754
URL: http://svn.freebsd.org/changeset/base/205754

Log:
  MFC r204140:
  
    Split up ip_drain() into an outer lock and iterator part and
    a "locked" version that will only handle a single network stack
    instance. The latter is called directly from ip_destroy().
  
    Hook up an ip_destroy() function to release resources from the
    legacy IP network layer upon virtual network stack teardown.
  
    Reviewed by:  rwatson

Modified:
  stable/8/sys/netinet/in_proto.c
  stable/8/sys/netinet/ip_input.c
  stable/8/sys/netinet/ip_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/in_proto.c
==============================================================================
--- stable/8/sys/netinet/in_proto.c	Sat Mar 27 17:33:19 2010	(r205753)
+++ stable/8/sys/netinet/in_proto.c	Sat Mar 27 17:34:57 2010	(r205754)
@@ -114,6 +114,9 @@ struct protosw inetsw[] = {
 	.pr_domain =		&inetdomain,
 	.pr_protocol =		IPPROTO_IP,
 	.pr_init =		ip_init,
+#ifdef VIMAGE
+	.pr_destroy =		ip_destroy,
+#endif
 	.pr_slowtimo =		ip_slowtimo,
 	.pr_drain =		ip_drain,
 	.pr_usrreqs =		&nousrreqs

Modified: stable/8/sys/netinet/ip_input.c
==============================================================================
--- stable/8/sys/netinet/ip_input.c	Sat Mar 27 17:33:19 2010	(r205753)
+++ stable/8/sys/netinet/ip_input.c	Sat Mar 27 17:34:57 2010	(r205754)
@@ -199,6 +199,7 @@ static struct mtx ipqlock;
 
 static void	maxnipq_update(void);
 static void	ipq_zone_change(void *);
+static void	ip_drain_locked(void);
 
 SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, fragpackets, CTLFLAG_RD,
     &VNET_NAME(nipq), 0,
@@ -368,6 +369,22 @@ ip_init(void)
 	netisr_register(&ip_nh);
 }
 
+#ifdef VIMAGE
+void
+ip_destroy(void)
+{
+
+	/* Cleanup in_ifaddr hash table; should be empty. */
+	hashdestroy(V_in_ifaddrhashtbl, M_IFADDR, V_in_ifaddrhmask);
+
+	IPQ_LOCK();
+	ip_drain_locked();
+	IPQ_UNLOCK();
+
+	uma_zdestroy(V_ipq_zone);
+}
+#endif
+
 void
 ip_fini(void *xtp)
 {
@@ -1237,23 +1254,32 @@ ip_slowtimo(void)
 /*
  * Drain off all datagram fragments.
  */
+static void
+ip_drain_locked(void)
+{
+	int     i;
+
+	IPQ_LOCK_ASSERT();
+
+	for (i = 0; i < IPREASS_NHASH; i++) {
+		while(!TAILQ_EMPTY(&V_ipq[i])) {
+			IPSTAT_ADD(ips_fragdropped,
+			    TAILQ_FIRST(&V_ipq[i])->ipq_nfrags);
+			ip_freef(&V_ipq[i], TAILQ_FIRST(&V_ipq[i]));
+		}
+	}
+}
+
 void
 ip_drain(void)
 {
 	VNET_ITERATOR_DECL(vnet_iter);
-	int     i;
 
 	VNET_LIST_RLOCK_NOSLEEP();
 	IPQ_LOCK();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
-		for (i = 0; i < IPREASS_NHASH; i++) {
-			while(!TAILQ_EMPTY(&V_ipq[i])) {
-				IPSTAT_ADD(ips_fragdropped,
-				    TAILQ_FIRST(&V_ipq[i])->ipq_nfrags);
-				ip_freef(&V_ipq[i], TAILQ_FIRST(&V_ipq[i]));
-			}
-		}
+		ip_drain_locked();
 		CURVNET_RESTORE();
 	}
 	IPQ_UNLOCK();

Modified: stable/8/sys/netinet/ip_var.h
==============================================================================
--- stable/8/sys/netinet/ip_var.h	Sat Mar 27 17:33:19 2010	(r205753)
+++ stable/8/sys/netinet/ip_var.h	Sat Mar 27 17:34:57 2010	(r205754)
@@ -212,6 +212,9 @@ int	ip_fragment(struct ip *ip, struct mb
 	    u_long if_hwassist_flags, int sw_csum);
 void	ip_forward(struct mbuf *m, int srcrt);
 void	ip_init(void);
+#ifdef VIMAGE
+void	ip_destroy(void);
+#endif
 extern int
 	(*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
 	    struct ip_moptions *);

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:36:53 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6F85D106564A;
	Sat, 27 Mar 2010 17:36:53 +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 5DB448FC14;
	Sat, 27 Mar 2010 17:36: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 o2RHarRN053664;
	Sat, 27 Mar 2010 17:36:53 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHarO3053662;
	Sat, 27 Mar 2010 17:36:53 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271736.o2RHarO3053662@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:36:53 +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: r205755 - stable/8/sys/netinet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:36:53 -0000

Author: bz
Date: Sat Mar 27 17:36:52 2010
New Revision: 205755
URL: http://svn.freebsd.org/changeset/base/205755

Log:
  MFC r204143:
  
    Upon virtual network stack teardown properly release the TCP syncache
    resources.
  
    Reviewed by:  rwatson

Modified:
  stable/8/sys/netinet/tcp_syncache.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_syncache.c
==============================================================================
--- stable/8/sys/netinet/tcp_syncache.c	Sat Mar 27 17:34:57 2010	(r205754)
+++ stable/8/sys/netinet/tcp_syncache.c	Sat Mar 27 17:36:52 2010	(r205755)
@@ -278,11 +278,33 @@ syncache_init(void)
 void
 syncache_destroy(void)
 {
+	struct syncache_head *sch;
+	struct syncache *sc, *nsc;
+	int i;
+
+	/* Cleanup hash buckets: stop timers, free entries, destroy locks. */
+	for (i = 0; i < V_tcp_syncache.hashsize; i++) {
+
+		sch = &V_tcp_syncache.hashbase[i];
+		callout_drain(&sch->sch_timer);
+
+		SCH_LOCK(sch);
+		TAILQ_FOREACH_SAFE(sc, &sch->sch_bucket, sc_hash, nsc)
+			syncache_drop(sc, sch);
+		SCH_UNLOCK(sch);
+		KASSERT(TAILQ_EMPTY(&sch->sch_bucket),
+		    ("%s: sch->sch_bucket not empty", __func__));
+		KASSERT(sch->sch_length == 0, ("%s: sch->sch_length %d not 0",
+		    __func__, sch->sch_length));
+		mtx_destroy(&sch->sch_mtx);
+	}
 
-	/* XXX walk the cache, free remaining objects, stop timers */
+	KASSERT(V_tcp_syncache.cache_count == 0, ("%s: cache_count %d not 0",
+	    __func__, V_tcp_syncache.cache_count));
 
+	/* Free the allocated global resources. */
 	uma_zdestroy(V_tcp_syncache.zone);
-	FREE(V_tcp_syncache.hashbase, M_SYNCACHE);
+	free(V_tcp_syncache.hashbase, M_SYNCACHE);
 }
 #endif
 

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:39:02 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C01DF1065670;
	Sat, 27 Mar 2010 17:39:02 +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 AE10D8FC0C;
	Sat, 27 Mar 2010 17:39: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 o2RHd2I7054212;
	Sat, 27 Mar 2010 17:39:02 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHd2hg054210;
	Sat, 27 Mar 2010 17:39:02 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271739.o2RHd2hg054210@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:39: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: r205756 - stable/8/sys/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:39:03 -0000

Author: bz
Date: Sat Mar 27 17:39:02 2010
New Revision: 205756
URL: http://svn.freebsd.org/changeset/base/205756

Log:
  MFC r204145:
  
    Start to implement ifnet DDB support:
    - 'show ifnets' prints a list of ifnet *s per virtual network stack,
    - 'show ifnet ' prints fields matching the given ifp.
  
    We do not yet print the complete set of fields and might want to
    factor this out to an extra if_debug.c file in case this grows
    a lot[1]. We may also want to grow 'show ifnet ' support[1].
  
    Suggested by: rwatson [1]
    Reviewed by:  rwatson

Modified:
  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/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Sat Mar 27 17:36:52 2010	(r205755)
+++ stable/8/sys/net/if.c	Sat Mar 27 17:39:02 2010	(r205756)
@@ -34,6 +34,7 @@
 #include "opt_inet6.h"
 #include "opt_inet.h"
 #include "opt_carp.h"
+#include "opt_ddb.h"
 
 #include 
 #include 
@@ -62,6 +63,10 @@
 #include 
 #include 
 
+#ifdef DDB
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -3396,3 +3401,78 @@ 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_COMMAND(ifnets, db_show_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-stable-8@FreeBSD.ORG  Sat Mar 27 17:40:29 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 07B681065701;
	Sat, 27 Mar 2010 17:40:29 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EA8868FC17;
	Sat, 27 Mar 2010 17:40: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 o2RHeSMJ054565;
	Sat, 27 Mar 2010 17:40:28 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHeSXk054563;
	Sat, 27 Mar 2010 17:40:28 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271740.o2RHeSXk054563@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:40: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: r205757 - stable/8/sys/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:40:29 -0000

Author: bz
Date: Sat Mar 27 17:40:28 2010
New Revision: 205757
URL: http://svn.freebsd.org/changeset/base/205757

Log:
  MFC r204279:
  
    Use the DB_SHOW_ALL_COMMAND() macro to register the formerly 'show ifnets'
    in the db_show_all_table as 'show all ifnets' and with that follow the
    convention for showing complete lists.
  
    Submitted by: thompsa

Modified:
  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/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Sat Mar 27 17:39:02 2010	(r205756)
+++ stable/8/sys/net/if.c	Sat Mar 27 17:40:28 2010	(r205757)
@@ -3453,7 +3453,7 @@ DB_SHOW_COMMAND(ifnet, db_show_ifnet)
 	if_show_ifnet((struct ifnet *)addr);
 }
 
-DB_SHOW_COMMAND(ifnets, db_show_ifnets)
+DB_SHOW_ALL_COMMAND(ifnets, db_show_all_ifnets)
 {
 	VNET_ITERATOR_DECL(vnet_iter);
 	struct ifnet *ifp;

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:42:04 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 62858106566B;
	Sat, 27 Mar 2010 17:42:04 +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 50C198FC0A;
	Sat, 27 Mar 2010 17:42: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 o2RHg4Js054976;
	Sat, 27 Mar 2010 17:42:04 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHg4vh054974;
	Sat, 27 Mar 2010 17:42:04 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271742.o2RHg4vh054974@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:42: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: r205758 - stable/8/sys/kern
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:42:04 -0000

Author: bz
Date: Sat Mar 27 17:42:04 2010
New Revision: 205758
URL: http://svn.freebsd.org/changeset/base/205758

Log:
  MFC r204147:
  
    Set curvnet earlier so that it also covers calls to sodisconnect(), which
    before were possibly panicing the system in ULP code in the VIMAGE case.
  
    Submitted by: Igor (igor ispsystem.com)

Modified:
  stable/8/sys/kern/uipc_socket.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/uipc_socket.c
==============================================================================
--- stable/8/sys/kern/uipc_socket.c	Sat Mar 27 17:40:28 2010	(r205757)
+++ stable/8/sys/kern/uipc_socket.c	Sat Mar 27 17:42:04 2010	(r205758)
@@ -764,6 +764,8 @@ soconnect(struct socket *so, struct sock
 
 	if (so->so_options & SO_ACCEPTCONN)
 		return (EOPNOTSUPP);
+
+	CURVNET_SET(so->so_vnet);
 	/*
 	 * If protocol is connection-based, can only connect once.
 	 * Otherwise, if connected, try to disconnect first.  This allows
@@ -779,10 +781,9 @@ soconnect(struct socket *so, struct sock
 		 * biting us.
 		 */
 		so->so_error = 0;
-		CURVNET_SET(so->so_vnet);
 		error = (*so->so_proto->pr_usrreqs->pru_connect)(so, nam, td);
-		CURVNET_RESTORE();
 	}
+	CURVNET_RESTORE();
 
 	return (error);
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:46:07 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 35296106566C;
	Sat, 27 Mar 2010 17:46:07 +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 2381B8FC14;
	Sat, 27 Mar 2010 17:46: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 o2RHk7qF055938;
	Sat, 27 Mar 2010 17:46:07 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHk7hu055936;
	Sat, 27 Mar 2010 17:46:07 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271746.o2RHk7hu055936@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:46:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205759 - stable/8/sys/netinet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:46:07 -0000

Author: bz
Date: Sat Mar 27 17:46:06 2010
New Revision: 205759
URL: http://svn.freebsd.org/changeset/base/205759

Log:
  MFC r204807:
  
    Destroy UDP UMA zones (empty or not) upon network stack teardown
    to not leak them making UMA/vmstat -z unhappy with every stoped vnet.
    We will still leak pages (especially as zones are marked NOFREE).

Modified:
  stable/8/sys/netinet/udp_usrreq.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/udp_usrreq.c
==============================================================================
--- stable/8/sys/netinet/udp_usrreq.c	Sat Mar 27 17:42:04 2010	(r205758)
+++ stable/8/sys/netinet/udp_usrreq.c	Sat Mar 27 17:46:06 2010	(r205759)
@@ -245,6 +245,9 @@ udp_destroy(void)
 	    V_udbinfo.ipi_hashmask);
 	hashdestroy(V_udbinfo.ipi_porthashbase, M_PCB,
 	    V_udbinfo.ipi_porthashmask);
+
+	uma_zdestroy(V_udpcb_zone);
+	uma_zdestroy(V_udbinfo.ipi_zone);
 	INP_INFO_LOCK_DESTROY(&V_udbinfo);
 }
 #endif

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:48:14 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2520D106566C;
	Sat, 27 Mar 2010 17:48:14 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1314C8FC08;
	Sat, 27 Mar 2010 17:48: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 o2RHmD1A056459;
	Sat, 27 Mar 2010 17:48:13 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHmD4s056457;
	Sat, 27 Mar 2010 17:48:13 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271748.o2RHmD4s056457@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:48: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: r205760 - stable/8/sys/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:48:14 -0000

Author: bz
Date: Sat Mar 27 17:48:13 2010
New Revision: 205760
URL: http://svn.freebsd.org/changeset/base/205760

Log:
  MFC r204805:
  
    Rework reference counting in case we queue into the netisr,
    or overflow the netisr queue and fall back to the interface
    queue so that we can garuantee that the ifnet pointer stays
    valid.   Formerly we ended up with reference counts <= 0 in
    case the netisr had returned ENOBUFS.  The idea is to track
    any packet in the netisr queue and only change the refount
    on edge operations for the fallback interface queue. This
    also avoids problems in case the if_snd.ifq_len lies to us.
  
    Also rework refount assertions to make sure they trigger if
    we go below 1. Formerly a negative refence count did not
    trigger the assert as the refcount variable is u_int.

Modified:
  stable/8/sys/net/if_epair.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/net/if_epair.c
==============================================================================
--- stable/8/sys/net/if_epair.c	Sat Mar 27 17:46:06 2010	(r205759)
+++ stable/8/sys/net/if_epair.c	Sat Mar 27 17:48:13 2010	(r205760)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2008 The FreeBSD Foundation
- * Copyright (c) 2009 Bjoern A. Zeeb 
+ * Copyright (c) 2009-2010 Bjoern A. Zeeb 
  * All rights reserved.
  *
  * This software was developed by CK Software GmbH under sponsorship
@@ -256,6 +256,9 @@ epair_nh_sintr(struct mbuf *m)
 	(*ifp->if_input)(ifp, m);
 	sc = ifp->if_softc;
 	EPAIR_REFCOUNT_RELEASE(&sc->refcount);
+	EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1,
+	    ("%s: ifp=%p sc->refcount not >= 1: %d",
+	    __func__, ifp, sc->refcount));
 	DPRINTF("ifp=%p refcount=%u\n", ifp, sc->refcount);
 }
 
@@ -292,8 +295,16 @@ epair_nh_drainedcpu(u_int cpuid)
 
 		IFQ_LOCK(&ifp->if_snd);
 		if (IFQ_IS_EMPTY(&ifp->if_snd)) {
+			struct epair_softc *sc;
+
 			STAILQ_REMOVE(&epair_dpcpu->epair_ifp_drain_list,
 			    elm, epair_ifp_drain, ifp_next);
+			/* The cached ifp goes off the list. */
+			sc = ifp->if_softc;
+			EPAIR_REFCOUNT_RELEASE(&sc->refcount);
+			EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1,
+			    ("%s: ifp=%p sc->refcount not >= 1: %d",
+			    __func__, ifp, sc->refcount));
 			free(elm, M_EPAIR);
 		}
 		IFQ_UNLOCK(&ifp->if_snd);
@@ -312,14 +323,50 @@ epair_nh_drainedcpu(u_int cpuid)
 /*
  * Network interface (`if') related functions.
  */
+static void
+epair_remove_ifp_from_draining(struct ifnet *ifp)
+{
+	struct epair_dpcpu *epair_dpcpu;
+	struct epair_ifp_drain *elm, *tvar;
+	u_int cpuid;
+
+	for (cpuid = 0; cpuid <= mp_maxid; cpuid++) {
+		if (CPU_ABSENT(cpuid))
+			continue;
+
+		epair_dpcpu = DPCPU_ID_PTR(cpuid, epair_dpcpu);
+		EPAIR_LOCK(epair_dpcpu);
+		STAILQ_FOREACH_SAFE(elm, &epair_dpcpu->epair_ifp_drain_list,
+		    ifp_next, tvar) {
+			if (ifp == elm->ifp) {
+				struct epair_softc *sc;
+
+				STAILQ_REMOVE(
+				    &epair_dpcpu->epair_ifp_drain_list, elm,
+				    epair_ifp_drain, ifp_next);
+				/* The cached ifp goes off the list. */
+				sc = ifp->if_softc;
+				EPAIR_REFCOUNT_RELEASE(&sc->refcount);
+				EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1,
+				    ("%s: ifp=%p sc->refcount not >= 1: %d",
+				    __func__, ifp, sc->refcount));
+				free(elm, M_EPAIR);
+			}
+		}
+		EPAIR_UNLOCK(epair_dpcpu);
+	}
+}
+
 static int
 epair_add_ifp_for_draining(struct ifnet *ifp)
 {
 	struct epair_dpcpu *epair_dpcpu;
-	struct epair_softc *sc = sc = ifp->if_softc;
+	struct epair_softc *sc;
 	struct epair_ifp_drain *elm = NULL;
 
+	sc = ifp->if_softc;
 	epair_dpcpu = DPCPU_ID_PTR(sc->cpuid, epair_dpcpu);
+	EPAIR_LOCK_ASSERT(epair_dpcpu);
 	STAILQ_FOREACH(elm, &epair_dpcpu->epair_ifp_drain_list, ifp_next)
 		if (elm->ifp == ifp)
 			break;
@@ -332,6 +379,8 @@ epair_add_ifp_for_draining(struct ifnet 
 		return (ENOMEM);
 
 	elm->ifp = ifp;
+	/* Add a reference for the ifp pointer on the list. */
+	EPAIR_REFCOUNT_AQUIRE(&sc->refcount);
 	STAILQ_INSERT_TAIL(&epair_dpcpu->epair_ifp_drain_list, elm, ifp_next);
 
 	return (0);
@@ -395,13 +444,15 @@ epair_start_locked(struct ifnet *ifp)
 			/* Someone else received the packet. */
 			oifp->if_ipackets++;
 		} else {
+			/* The packet was freed already. */
 			epair_dpcpu->epair_drv_flags |= IFF_DRV_OACTIVE;
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-			if (epair_add_ifp_for_draining(ifp)) {
-				ifp->if_oerrors++;
-				m_freem(m);
-			}
+			(void) epair_add_ifp_for_draining(ifp);
+			ifp->if_oerrors++;
 			EPAIR_REFCOUNT_RELEASE(&sc->refcount);
+			EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1,
+			    ("%s: ifp=%p sc->refcount not >= 1: %d",
+			    __func__, oifp, sc->refcount));
 		}
 	}
 }
@@ -524,9 +575,13 @@ epair_transmit_locked(struct ifnet *ifp,
 		oifp->if_ipackets++;
 	} else {
 		/* The packet was freed already. */
-		EPAIR_REFCOUNT_RELEASE(&sc->refcount);
 		epair_dpcpu->epair_drv_flags |= IFF_DRV_OACTIVE;
 		ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+		ifp->if_oerrors++;
+		EPAIR_REFCOUNT_RELEASE(&sc->refcount);
+		EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1,
+		    ("%s: ifp=%p sc->refcount not >= 1: %d",
+		    __func__, oifp, sc->refcount));
 	}
 
 	return (error);
@@ -548,22 +603,18 @@ epair_transmit(struct ifnet *ifp, struct
 static void
 epair_qflush(struct ifnet *ifp)
 {
-	struct epair_dpcpu *epair_dpcpu;
 	struct epair_softc *sc;
-	struct ifaltq *ifq;
 	
 	sc = ifp->if_softc;
-	epair_dpcpu = DPCPU_ID_PTR(sc->cpuid, epair_dpcpu);
-	EPAIR_LOCK(epair_dpcpu);
-	ifq = &ifp->if_snd;
-	DPRINTF("ifp=%p sc refcnt=%u ifq_len=%u\n",
-	    ifp, sc->refcount, ifq->ifq_len);
+	KASSERT(sc != NULL, ("%s: ifp=%p, epair_softc gone? sc=%p\n",
+	    __func__, ifp, sc));
 	/*
-	 * Instead of calling EPAIR_REFCOUNT_RELEASE(&sc->refcount);
-	 * n times, just subtract for the cleanup.
+	 * Remove this ifp from all backpointer lists. The interface will not
+	 * usable for flushing anyway nor should it have anything to flush
+	 * after if_qflush().
 	 */
-	sc->refcount -= ifq->ifq_len;
-	EPAIR_UNLOCK(epair_dpcpu);
+	epair_remove_ifp_from_draining(ifp);
+
 	if (sc->if_qflush)
 		sc->if_qflush(ifp);
 }
@@ -828,8 +879,8 @@ epair_clone_destroy(struct if_clone *ifc
 	 */
 	DPRINTF("sca refcnt=%u scb refcnt=%u\n", sca->refcount, scb->refcount);
 	EPAIR_REFCOUNT_ASSERT(sca->refcount == 1 && scb->refcount == 1,
-	    ("%s: sca->refcount!=1: %d || scb->refcount!=1: %d",
-	    __func__, sca->refcount, scb->refcount));
+	    ("%s: ifp=%p sca->refcount!=1: %d || ifp=%p scb->refcount!=1: %d",
+	    __func__, ifp, sca->refcount, oifp, scb->refcount));
 
 	/*
 	 * Get rid of our second half.

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:50:03 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 11F3F106566C;
	Sat, 27 Mar 2010 17:50:03 +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 002508FC13;
	Sat, 27 Mar 2010 17:50: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 o2RHo2u8056907;
	Sat, 27 Mar 2010 17:50:02 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHo2Tv056902;
	Sat, 27 Mar 2010 17:50:02 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271750.o2RHo2Tv056902@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:50: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: r205761 - stable/8/sys/netinet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:50:03 -0000

Author: bz
Date: Sat Mar 27 17:50:02 2010
New Revision: 205761
URL: http://svn.freebsd.org/changeset/base/205761

Log:
  MFC r204838:
  
    Destroy TCP UMA zones (empty or not) upon network stack teardown
    to not leak them, otherwise making UMA/vmstat unhappy with every
    stoped vnet.
    We will still leak pages (especially for zones marked NOFREE).
  
    Reshuffle cleanup order in tcp_destroy() to get rid of what we can
    easily free first.
  
    Reviewed by:  rwatson

Modified:
  stable/8/sys/netinet/tcp_reass.c
  stable/8/sys/netinet/tcp_subr.c
  stable/8/sys/netinet/tcp_timewait.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 Mar 27 17:48:13 2010	(r205760)
+++ stable/8/sys/netinet/tcp_reass.c	Sat Mar 27 17:50:02 2010	(r205761)
@@ -132,6 +132,15 @@ tcp_reass_init(void)
 	    tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY);
 }
 
+#ifdef VIMAGE
+void
+tcp_reass_destroy(void)
+{
+
+	uma_zdestroy(V_tcp_reass_zone);
+}
+#endif
+
 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 Mar 27 17:48:13 2010	(r205760)
+++ stable/8/sys/netinet/tcp_subr.c	Sat Mar 27 17:50:02 2010	(r205761)
@@ -445,15 +445,21 @@ void
 tcp_destroy(void)
 {
 
-	tcp_tw_destroy();
+	tcp_reass_destroy();
 	tcp_hc_destroy();
 	syncache_destroy();
+	tcp_tw_destroy();
 
 	/* XXX check that hashes are empty! */
 	hashdestroy(V_tcbinfo.ipi_hashbase, M_PCB,
 	    V_tcbinfo.ipi_hashmask);
 	hashdestroy(V_tcbinfo.ipi_porthashbase, M_PCB,
 	    V_tcbinfo.ipi_porthashmask);
+
+	uma_zdestroy(V_sack_hole_zone);
+	uma_zdestroy(V_tcpcb_zone);
+	uma_zdestroy(V_tcbinfo.ipi_zone);
+
 	INP_INFO_LOCK_DESTROY(&V_tcbinfo);
 }
 #endif

Modified: stable/8/sys/netinet/tcp_timewait.c
==============================================================================
--- stable/8/sys/netinet/tcp_timewait.c	Sat Mar 27 17:48:13 2010	(r205760)
+++ stable/8/sys/netinet/tcp_timewait.c	Sat Mar 27 17:50:02 2010	(r205761)
@@ -185,6 +185,8 @@ tcp_tw_destroy(void)
 	while((tw = TAILQ_FIRST(&V_twq_2msl)) != NULL)
 		tcp_twclose(tw, 0);
 	INP_INFO_WUNLOCK(&V_tcbinfo);
+
+	uma_zdestroy(V_tcptw_zone);
 }
 #endif
 

Modified: stable/8/sys/netinet/tcp_var.h
==============================================================================
--- stable/8/sys/netinet/tcp_var.h	Sat Mar 27 17:48:13 2010	(r205760)
+++ stable/8/sys/netinet/tcp_var.h	Sat Mar 27 17:50:02 2010	(r205761)
@@ -648,6 +648,9 @@ char 	*tcp_log_addrs(struct in_conninfo 
 	    const void *);
 int	 tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *);
 void	 tcp_reass_init(void);
+#ifdef VIMAGE
+void	 tcp_reass_destroy(void);
+#endif
 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-stable-8@FreeBSD.ORG  Sat Mar 27 17:51:28 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 08AE2106567B;
	Sat, 27 Mar 2010 17:51:28 +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 EAE288FC1A;
	Sat, 27 Mar 2010 17:51: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 o2RHpRIk057263;
	Sat, 27 Mar 2010 17:51:27 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHpRcl057258;
	Sat, 27 Mar 2010 17:51:27 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271751.o2RHpRcl057258@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:51: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: r205762 - stable/8/sys/netinet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:51:28 -0000

Author: bz
Date: Sat Mar 27 17:51:27 2010
New Revision: 205762
URL: http://svn.freebsd.org/changeset/base/205762

Log:
  MFC r205251:
  
    Add pcb reference counting to the pcblist sysctl handler functions
    to ensure type stability while caching the pcb pointers for the
    copyout.
  
    Reviewed by:  rwatson

Modified:
  stable/8/sys/netinet/ip_divert.c
  stable/8/sys/netinet/raw_ip.c
  stable/8/sys/netinet/tcp_subr.c
  stable/8/sys/netinet/udp_usrreq.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/ip_divert.c
==============================================================================
--- stable/8/sys/netinet/ip_divert.c	Sat Mar 27 17:50:02 2010	(r205761)
+++ stable/8/sys/netinet/ip_divert.c	Sat Mar 27 17:51:27 2010	(r205762)
@@ -653,11 +653,13 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
 	INP_INFO_RLOCK(&V_divcbinfo);
 	for (inp = LIST_FIRST(V_divcbinfo.ipi_listhead), i = 0; inp && i < n;
 	     inp = LIST_NEXT(inp, inp_list)) {
-		INP_RLOCK(inp);
+		INP_WLOCK(inp);
 		if (inp->inp_gencnt <= gencnt &&
-		    cr_canseeinpcb(req->td->td_ucred, inp) == 0)
+		    cr_canseeinpcb(req->td->td_ucred, inp) == 0) {
+			in_pcbref(inp);
 			inp_list[i++] = inp;
-		INP_RUNLOCK(inp);
+		}
+		INP_WUNLOCK(inp);
 	}
 	INP_INFO_RUNLOCK(&V_divcbinfo);
 	n = i;
@@ -679,6 +681,15 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
 		} else
 			INP_RUNLOCK(inp);
 	}
+	INP_INFO_WLOCK(&V_divcbinfo);
+	for (i = 0; i < n; i++) {
+		inp = inp_list[i];
+		INP_WLOCK(inp);
+		if (!in_pcbrele(inp))
+			INP_WUNLOCK(inp);
+	}
+	INP_INFO_WUNLOCK(&V_divcbinfo);
+
 	if (!error) {
 		/*
 		 * Give the user an updated idea of our state.

Modified: stable/8/sys/netinet/raw_ip.c
==============================================================================
--- stable/8/sys/netinet/raw_ip.c	Sat Mar 27 17:50:02 2010	(r205761)
+++ stable/8/sys/netinet/raw_ip.c	Sat Mar 27 17:51:27 2010	(r205762)
@@ -1025,13 +1025,13 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
 	INP_INFO_RLOCK(&V_ripcbinfo);
 	for (inp = LIST_FIRST(V_ripcbinfo.ipi_listhead), i = 0; inp && i < n;
 	     inp = LIST_NEXT(inp, inp_list)) {
-		INP_RLOCK(inp);
+		INP_WLOCK(inp);
 		if (inp->inp_gencnt <= gencnt &&
 		    cr_canseeinpcb(req->td->td_ucred, inp) == 0) {
-			/* XXX held references? */
+			in_pcbref(inp);
 			inp_list[i++] = inp;
 		}
-		INP_RUNLOCK(inp);
+		INP_WUNLOCK(inp);
 	}
 	INP_INFO_RUNLOCK(&V_ripcbinfo);
 	n = i;
@@ -1054,6 +1054,15 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
 		} else
 			INP_RUNLOCK(inp);
 	}
+	INP_INFO_WLOCK(&V_ripcbinfo);
+	for (i = 0; i < n; i++) {
+		inp = inp_list[i];
+		INP_WLOCK(inp);
+		if (!in_pcbrele(inp))
+			INP_WUNLOCK(inp);
+	}
+	INP_INFO_WUNLOCK(&V_ripcbinfo);
+
 	if (!error) {
 		/*
 		 * Give the user an updated idea of our state.  If the

Modified: stable/8/sys/netinet/tcp_subr.c
==============================================================================
--- stable/8/sys/netinet/tcp_subr.c	Sat Mar 27 17:50:02 2010	(r205761)
+++ stable/8/sys/netinet/tcp_subr.c	Sat Mar 27 17:51:27 2010	(r205762)
@@ -1102,7 +1102,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 	INP_INFO_RLOCK(&V_tcbinfo);
 	for (inp = LIST_FIRST(V_tcbinfo.ipi_listhead), i = 0;
 	    inp != NULL && i < n; inp = LIST_NEXT(inp, inp_list)) {
-		INP_RLOCK(inp);
+		INP_WLOCK(inp);
 		if (inp->inp_gencnt <= gencnt) {
 			/*
 			 * XXX: This use of cr_cansee(), introduced with
@@ -1117,10 +1117,12 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 					error = EINVAL;	/* Skip this inp. */
 			} else
 				error = cr_canseeinpcb(req->td->td_ucred, inp);
-			if (error == 0)
+			if (error == 0) {
+				in_pcbref(inp);
 				inp_list[i++] = inp;
+			}
 		}
-		INP_RUNLOCK(inp);
+		INP_WUNLOCK(inp);
 	}
 	INP_INFO_RUNLOCK(&V_tcbinfo);
 	n = i;
@@ -1156,8 +1158,16 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 			error = SYSCTL_OUT(req, &xt, sizeof xt);
 		} else
 			INP_RUNLOCK(inp);
-	
 	}
+	INP_INFO_WLOCK(&V_tcbinfo);
+	for (i = 0; i < n; i++) {
+		inp = inp_list[i];
+		INP_WLOCK(inp);
+		if (!in_pcbrele(inp))
+			INP_WUNLOCK(inp);
+	}
+	INP_INFO_WUNLOCK(&V_tcbinfo);
+
 	if (!error) {
 		/*
 		 * Give the user an updated idea of our state.

Modified: stable/8/sys/netinet/udp_usrreq.c
==============================================================================
--- stable/8/sys/netinet/udp_usrreq.c	Sat Mar 27 17:50:02 2010	(r205761)
+++ stable/8/sys/netinet/udp_usrreq.c	Sat Mar 27 17:51:27 2010	(r205762)
@@ -766,11 +766,13 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
 	INP_INFO_RLOCK(&V_udbinfo);
 	for (inp = LIST_FIRST(V_udbinfo.ipi_listhead), i = 0; inp && i < n;
 	     inp = LIST_NEXT(inp, inp_list)) {
-		INP_RLOCK(inp);
+		INP_WLOCK(inp);
 		if (inp->inp_gencnt <= gencnt &&
-		    cr_canseeinpcb(req->td->td_ucred, inp) == 0)
+		    cr_canseeinpcb(req->td->td_ucred, inp) == 0) {
+			in_pcbref(inp);
 			inp_list[i++] = inp;
-		INP_RUNLOCK(inp);
+		}
+		INP_WUNLOCK(inp);
 	}
 	INP_INFO_RUNLOCK(&V_udbinfo);
 	n = i;
@@ -781,6 +783,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
 		INP_RLOCK(inp);
 		if (inp->inp_gencnt <= gencnt) {
 			struct xinpcb xi;
+
 			bzero(&xi, sizeof(xi));
 			xi.xi_len = sizeof xi;
 			/* XXX should avoid extra copy */
@@ -793,6 +796,15 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
 		} else
 			INP_RUNLOCK(inp);
 	}
+	INP_INFO_WLOCK(&V_udbinfo);
+	for (i = 0; i < n; i++) {
+		inp = inp_list[i];
+		INP_WLOCK(inp);
+		if (!in_pcbrele(inp))
+			INP_WUNLOCK(inp);
+	}
+	INP_INFO_WUNLOCK(&V_udbinfo);
+
 	if (!error) {
 		/*
 		 * Give the user an updated idea of our state.  If the

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:52:56 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A8316106564A;
	Sat, 27 Mar 2010 17:52:56 +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 964E88FC17;
	Sat, 27 Mar 2010 17:52: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 o2RHqu0b057641;
	Sat, 27 Mar 2010 17:52:56 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHquTr057640;
	Sat, 27 Mar 2010 17:52:56 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271752.o2RHquTr057640@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:52:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205763 - stable/8/sys/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:52:56 -0000

Author: bz
Date: Sat Mar 27 17:52:56 2010
New Revision: 205763
URL: http://svn.freebsd.org/changeset/base/205763

Log:
  MFC r205276:
  
    Add ddb support to the "new" link layer code ("new-arp"):
     - show all lltables [1] (optional flag to also show the llentries as well)
     - show lltable 
     - show llentry 

Modified:
  stable/8/sys/net/if_llatbl.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/net/if_llatbl.c
==============================================================================
--- stable/8/sys/net/if_llatbl.c	Sat Mar 27 17:51:27 2010	(r205762)
+++ stable/8/sys/net/if_llatbl.c	Sat Mar 27 17:52:56 2010	(r205763)
@@ -27,6 +27,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_ddb.h"
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
@@ -42,6 +43,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef DDB
+#include 
+#endif
+
 #include 
 
 #include 
@@ -382,3 +387,134 @@ vnet_lltable_init()
 VNET_SYSINIT(vnet_lltable_init, SI_SUB_PSEUDO, SI_ORDER_FIRST,
     vnet_lltable_init, NULL);
 
+#ifdef DDB
+struct llentry_sa {
+	struct llentry		base;
+	struct sockaddr		l3_addr;
+};
+
+static void
+llatbl_lle_show(struct llentry_sa *la)
+{
+	struct llentry *lle;
+	uint8_t octet[6];
+
+	lle = &la->base;
+	db_printf("lle=%p\n", lle);
+	db_printf(" lle_next=%p\n", lle->lle_next.le_next);
+	db_printf(" lle_lock=%p\n", &lle->lle_lock);
+	db_printf(" lle_tbl=%p\n", lle->lle_tbl);
+	db_printf(" lle_head=%p\n", lle->lle_head);
+	db_printf(" la_hold=%p\n", lle->la_hold);
+	db_printf(" la_expire=%ju\n", (uintmax_t)lle->la_expire);
+	db_printf(" la_flags=0x%04x\n", lle->la_flags);
+	db_printf(" la_asked=%u\n", lle->la_asked);
+	db_printf(" la_preempt=%u\n", lle->la_preempt);
+	db_printf(" ln_byhint=%u\n", lle->ln_byhint);
+	db_printf(" ln_state=%d\n", lle->ln_state);
+	db_printf(" ln_router=%u\n", lle->ln_router);
+	db_printf(" ln_ntick=%ju\n", (uintmax_t)lle->ln_ntick);
+	db_printf(" lle_refcnt=%d\n", lle->lle_refcnt);
+	bcopy(&lle->ll_addr.mac16, octet, sizeof(octet));
+	db_printf(" ll_addr=%02x:%02x:%02x:%02x:%02x:%02x\n",
+	    octet[0], octet[1], octet[2], octet[3], octet[4], octet[5]);
+	db_printf(" la_timer=%p\n", &lle->la_timer);
+
+	switch (la->l3_addr.sa_family) {
+#ifdef INET
+	case AF_INET:
+	{
+		struct sockaddr_in *sin;
+		char l3s[INET_ADDRSTRLEN];
+
+		sin = (struct sockaddr_in *)&la->l3_addr;
+		inet_ntoa_r(sin->sin_addr, l3s);
+		db_printf(" l3_addr=%s\n", l3s);	
+		break;
+	}
+#endif
+#ifdef INET6
+	case AF_INET6:
+	{
+		struct sockaddr_in6 *sin6;
+		char l3s[INET6_ADDRSTRLEN];
+
+		sin6 = (struct sockaddr_in6 *)&la->l3_addr;
+		ip6_sprintf(l3s, &sin6->sin6_addr);
+		db_printf(" l3_addr=%s\n", l3s);	
+		break;
+	}
+#endif
+	default:
+		db_printf(" l3_addr=N/A (af=%d)\n", la->l3_addr.sa_family);
+		break;
+	}
+}
+
+DB_SHOW_COMMAND(llentry, db_show_llentry)
+{
+
+	if (!have_addr) {
+		db_printf("usage: show llentry \n");
+		return;
+	}
+
+	llatbl_lle_show((struct llentry_sa *)addr);
+}
+
+static void
+llatbl_llt_show(struct lltable *llt)
+{
+	int i;
+	struct llentry *lle;
+
+	db_printf("llt=%p llt_af=%d llt_ifp=%p\n",
+	    llt, llt->llt_af, llt->llt_ifp);
+
+	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {
+		LIST_FOREACH(lle, &llt->lle_head[i], lle_next) {
+
+			llatbl_lle_show((struct llentry_sa *)lle);
+			if (db_pager_quit)
+				return;
+		}
+	}
+}
+
+DB_SHOW_COMMAND(lltable, db_show_lltable)
+{
+
+	if (!have_addr) {
+		db_printf("usage: show lltable \n");
+		return;
+	}
+
+	llatbl_llt_show((struct lltable *)addr);
+}
+
+DB_SHOW_ALL_COMMAND(lltables, db_show_all_lltables)
+{
+	VNET_ITERATOR_DECL(vnet_iter);
+	struct lltable *llt;
+
+	VNET_FOREACH(vnet_iter) {
+		CURVNET_SET_QUIET(vnet_iter);
+#ifdef VIMAGE
+		db_printf("vnet=%p\n", curvnet);
+#endif
+		SLIST_FOREACH(llt, &V_lltables, llt_link) {
+			db_printf("llt=%p llt_af=%d llt_ifp=%p(%s)\n",
+			    llt, llt->llt_af, llt->llt_ifp,
+			    (llt->llt_ifp != NULL) ?
+				llt->llt_ifp->if_xname : "?");
+			if (have_addr && addr != 0) /* verbose */
+				llatbl_llt_show(llt);
+			if (db_pager_quit) {
+				CURVNET_RESTORE();
+				return;
+			}
+		}
+		CURVNET_RESTORE();
+	}
+}
+#endif

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:54:44 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 725441065673;
	Sat, 27 Mar 2010 17:54: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 6092C8FC19;
	Sat, 27 Mar 2010 17:54: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 o2RHsilp058096;
	Sat, 27 Mar 2010 17:54:44 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHsibu058094;
	Sat, 27 Mar 2010 17:54:44 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271754.o2RHsibu058094@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:54: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: r205764 - stable/8/sys/kern
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:54:44 -0000

Author: bz
Date: Sat Mar 27 17:54:44 2010
New Revision: 205764
URL: http://svn.freebsd.org/changeset/base/205764

Log:
  MFC r205626:
  
    Print the pointer to the lock with the panic message. The previous
          panic: rw lock not unlocked
    was not really helpful for debugging. Now one can at least call
          show lock 
    form ddb to learn more about the lock.

Modified:
  stable/8/sys/kern/kern_rwlock.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/kern_rwlock.c
==============================================================================
--- stable/8/sys/kern/kern_rwlock.c	Sat Mar 27 17:52:56 2010	(r205763)
+++ stable/8/sys/kern/kern_rwlock.c	Sat Mar 27 17:54:44 2010	(r205764)
@@ -196,8 +196,8 @@ void
 rw_destroy(struct rwlock *rw)
 {
 
-	KASSERT(rw->rw_lock == RW_UNLOCKED, ("rw lock not unlocked"));
-	KASSERT(rw->rw_recurse == 0, ("rw lock still recursed"));
+	KASSERT(rw->rw_lock == RW_UNLOCKED, ("rw lock %p not unlocked", rw));
+	KASSERT(rw->rw_recurse == 0, ("rw lock %p still recursed", rw));
 	rw->rw_lock = RW_DESTROYED;
 	lock_destroy(&rw->lock_object);
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:56:46 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5EE251065670;
	Sat, 27 Mar 2010 17:56:46 +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 4D47B8FC19;
	Sat, 27 Mar 2010 17:56: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 o2RHukNN058609;
	Sat, 27 Mar 2010 17:56:46 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHukc9058608;
	Sat, 27 Mar 2010 17:56:46 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271756.o2RHukc9058608@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 17:56: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: r205765 - stable/8/sys/dev/fdc
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:56:46 -0000

Author: trasz
Date: Sat Mar 27 17:56:45 2010
New Revision: 205765
URL: http://svn.freebsd.org/changeset/base/205765

Log:
  MFC r197945:
  
  Orphaning provider with EXDEV seems weird; perhaps the author meant
  ENXIO here?

Modified:
  stable/8/sys/dev/fdc/fdc.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/fdc/fdc.c
==============================================================================
--- stable/8/sys/dev/fdc/fdc.c	Sat Mar 27 17:54:44 2010	(r205764)
+++ stable/8/sys/dev/fdc/fdc.c	Sat Mar 27 17:56:45 2010	(r205765)
@@ -864,7 +864,7 @@ fdc_worker(struct fdc_data *fdc)
 		fd->flags |= FD_NEWDISK;
 		mtx_unlock(&fdc->fdc_mtx);
 		g_topology_lock();
-		g_orphan_provider(fd->fd_provider, EXDEV);
+		g_orphan_provider(fd->fd_provider, ENXIO);
 		fd->fd_provider->flags |= G_PF_WITHER;
 		fd->fd_provider =
 		    g_new_providerf(fd->fd_geom, fd->fd_geom->name);

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 17:57:18 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 54A76106567A;
	Sat, 27 Mar 2010 17:57:18 +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 08F1E8FC26;
	Sat, 27 Mar 2010 17:57: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 o2RHvHws058781;
	Sat, 27 Mar 2010 17:57:17 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RHvHjU058779;
	Sat, 27 Mar 2010 17:57:17 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201003271757.o2RHvHjU058779@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 27 Mar 2010 17:57:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205766 - stable/8/sbin/mount
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 17:57:18 -0000

Author: bz
Date: Sat Mar 27 17:57:17 2010
New Revision: 205766
URL: http://svn.freebsd.org/changeset/base/205766

Log:
  MFC r204840:
  
    As statfs.f_flags are uint64_t the local variables should be as well.
    We'll start noticing this with the next flag introduced as the lower
    32bit are all used.
  
    While here compare to 0 explicitly [1].
  
    Suggested by: kib [1]
    Reviewed by:  kib

Modified:
  stable/8/sbin/mount/mount.c
Directory Properties:
  stable/8/sbin/mount/   (props changed)

Modified: stable/8/sbin/mount/mount.c
==============================================================================
--- stable/8/sbin/mount/mount.c	Sat Mar 27 17:56:45 2010	(r205765)
+++ stable/8/sbin/mount/mount.c	Sat Mar 27 17:57:17 2010	(r205766)
@@ -91,7 +91,7 @@ char   *flags2opts(int);
 
 /* Map from mount options to printable formats. */
 static struct opt {
-	int o_opt;
+	uint64_t o_opt;
 	const char *o_name;
 } optnames[] = {
 	{ MNT_ASYNC,		"asynchronous" },
@@ -611,7 +611,7 @@ mountfs(const char *vfstype, const char 
 void
 prmount(struct statfs *sfp)
 {
-	int flags;
+	uint64_t flags;
 	unsigned int i;
 	struct opt *o;
 	struct passwd *pw;
@@ -620,7 +620,7 @@ prmount(struct statfs *sfp)
 	    sfp->f_fstypename);
 
 	flags = sfp->f_flags & MNT_VISFLAGMASK;
-	for (o = optnames; flags && o->o_opt; o++)
+	for (o = optnames; flags != 0 && o->o_opt != 0; o++)
 		if (flags & o->o_opt) {
 			(void)printf(", %s", o->o_name);
 			flags &= ~o->o_opt;

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 18:01:39 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CD30106567B;
	Sat, 27 Mar 2010 18:01:39 +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 2AF288FC0C;
	Sat, 27 Mar 2010 18:01: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 o2RI1daX059840;
	Sat, 27 Mar 2010 18:01:39 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RI1dwK059838;
	Sat, 27 Mar 2010 18:01:39 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271801.o2RI1dwK059838@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 18:01: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: r205767 - stable/8/sbin/mount
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 18:01:39 -0000

Author: trasz
Date: Sat Mar 27 18:01:38 2010
New Revision: 205767
URL: http://svn.freebsd.org/changeset/base/205767

Log:
  MFC r199182:
  
  Add links to zfs(8) and zpool(8) to mount(8) manual page.

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

Modified: stable/8/sbin/mount/mount.8
==============================================================================
--- stable/8/sbin/mount/mount.8	Sat Mar 27 17:57:17 2010	(r205766)
+++ stable/8/sbin/mount/mount.8	Sat Mar 27 18:01:38 2010	(r205767)
@@ -527,7 +527,9 @@ support for a particular file system mig
 .Xr mount_smbfs 8 ,
 .Xr mount_udf 8 ,
 .Xr mount_unionfs 8 ,
-.Xr umount 8
+.Xr umount 8 ,
+.Xr zfs 8 ,
+.Xr zpool 8
 .Sh CAVEATS
 After a successful
 .Nm ,

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 18:04:33 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DA6971065672;
	Sat, 27 Mar 2010 18:04:33 +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 C73BE8FC0C;
	Sat, 27 Mar 2010 18:04: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 o2RI4Xtd060528;
	Sat, 27 Mar 2010 18:04:33 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RI4Xd8060518;
	Sat, 27 Mar 2010 18:04:33 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271804.o2RI4Xd8060518@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 18:04: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: r205768 - stable/8/sys/geom/label
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 18:04:34 -0000

Author: trasz
Date: Sat Mar 27 18:04:33 2010
New Revision: 205768
URL: http://svn.freebsd.org/changeset/base/205768

Log:
  MFC r199875:
  
  Provide a set of sysctls and tunables to disable device node creation
  for specific "kinds" of disk labels - for example, GPT UUIDs.  Reason
  for this is that sometimes, other GEOM classes attach to these device
  nodes instead of the proper ones - e.g. they attach to /dev/gptid/XXX
  instead of /dev/ada0p2, which is annoying.
  
  Reviewed by:	pjd (earlier version)

Modified:
  stable/8/sys/geom/label/g_label.c
  stable/8/sys/geom/label/g_label.h
  stable/8/sys/geom/label/g_label_ext2fs.c
  stable/8/sys/geom/label/g_label_gpt.c
  stable/8/sys/geom/label/g_label_iso9660.c
  stable/8/sys/geom/label/g_label_msdosfs.c
  stable/8/sys/geom/label/g_label_ntfs.c
  stable/8/sys/geom/label/g_label_reiserfs.c
  stable/8/sys/geom/label/g_label_ufs.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/geom/label/g_label.c
==============================================================================
--- stable/8/sys/geom/label/g_label.c	Sat Mar 27 18:01:38 2010	(r205767)
+++ stable/8/sys/geom/label/g_label.c	Sat Mar 27 18:04:33 2010	(r205768)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -316,6 +315,8 @@ g_label_taste(struct g_class *mp, struct
 	for (i = 0; g_labels[i] != NULL; i++) {
 		char label[64];
 
+		if (g_labels[i]->ld_enabled == 0)
+			continue;
 		g_topology_unlock();
 		g_labels[i]->ld_taste(cp, label, sizeof(label));
 		g_topology_lock();

Modified: stable/8/sys/geom/label/g_label.h
==============================================================================
--- stable/8/sys/geom/label/g_label.h	Sat Mar 27 18:01:38 2010	(r205767)
+++ stable/8/sys/geom/label/g_label.h	Sat Mar 27 18:04:33 2010	(r205768)
@@ -30,6 +30,9 @@
 #define	_G_LABEL_H_
 
 #include 
+#ifdef _KERNEL
+#include 
+#endif
 
 #define	G_LABEL_CLASS_NAME	"LABEL"
 
@@ -56,23 +59,34 @@ extern u_int g_label_debug;
 	}								\
 } while (0)
 
+SYSCTL_DECL(_kern_geom_label);
+
+#define	G_LABEL_INIT(kind, label, descr) 				\
+	SYSCTL_NODE(_kern_geom_label, OID_AUTO, kind, CTLFLAG_RD,	\
+	    NULL, "");							\
+	SYSCTL_INT(_kern_geom_label_##kind, OID_AUTO, enable, 		\
+	    CTLFLAG_RW, &label.ld_enabled, 1, descr);			\
+	TUNABLE_INT("kern.geom.label." __XSTRING(kind) ".enable",	\
+	    &label.ld_enabled)
+
 typedef void g_label_taste_t (struct g_consumer *cp, char *label, size_t size);
 
 struct g_label_desc {
 	g_label_taste_t	*ld_taste;
 	char		*ld_dir;
+	int		 ld_enabled;
 };
 
 /* Supported labels. */
-extern const struct g_label_desc g_label_ufs_id;
-extern const struct g_label_desc g_label_ufs_volume;
-extern const struct g_label_desc g_label_iso9660;
-extern const struct g_label_desc g_label_msdosfs;
-extern const struct g_label_desc g_label_ext2fs;
-extern const struct g_label_desc g_label_reiserfs;
-extern const struct g_label_desc g_label_ntfs;
-extern const struct g_label_desc g_label_gpt;
-extern const struct g_label_desc g_label_gpt_uuid;
+extern struct g_label_desc g_label_ufs_id;
+extern struct g_label_desc g_label_ufs_volume;
+extern struct g_label_desc g_label_iso9660;
+extern struct g_label_desc g_label_msdosfs;
+extern struct g_label_desc g_label_ext2fs;
+extern struct g_label_desc g_label_reiserfs;
+extern struct g_label_desc g_label_ntfs;
+extern struct g_label_desc g_label_gpt;
+extern struct g_label_desc g_label_gpt_uuid;
 #endif	/* _KERNEL */
 
 struct g_label_metadata {

Modified: stable/8/sys/geom/label/g_label_ext2fs.c
==============================================================================
--- stable/8/sys/geom/label/g_label_ext2fs.c	Sat Mar 27 18:01:38 2010	(r205767)
+++ stable/8/sys/geom/label/g_label_ext2fs.c	Sat Mar 27 18:04:33 2010	(r205768)
@@ -86,7 +86,10 @@ exit_free:
 	g_free(fs);
 }
 
-const struct g_label_desc g_label_ext2fs = {
+struct g_label_desc g_label_ext2fs = {
 	.ld_taste = g_label_ext2fs_taste,
-	.ld_dir = "ext2fs"
+	.ld_dir = "ext2fs",
+	.ld_enabled = 1
 };
+
+G_LABEL_INIT(ext2fs, g_label_ext2fs, "Create device nodes for EXT2FS volumes");

Modified: stable/8/sys/geom/label/g_label_gpt.c
==============================================================================
--- stable/8/sys/geom/label/g_label_gpt.c	Sat Mar 27 18:01:38 2010	(r205767)
+++ stable/8/sys/geom/label/g_label_gpt.c	Sat Mar 27 18:04:33 2010	(r205768)
@@ -153,12 +153,17 @@ g_label_gpt_uuid_taste(struct g_consumer
 	snprintf_uuid(label, size, &part_gpt_entry->ent.ent_uuid);
 }
 
-const struct g_label_desc g_label_gpt = {
+struct g_label_desc g_label_gpt = {
 	.ld_taste = g_label_gpt_taste,
-	.ld_dir = G_LABEL_GPT_VOLUME_DIR
+	.ld_dir = G_LABEL_GPT_VOLUME_DIR,
+	.ld_enabled = 1
 };
 
-const struct g_label_desc g_label_gpt_uuid = {
+struct g_label_desc g_label_gpt_uuid = {
 	.ld_taste = g_label_gpt_uuid_taste,
-	.ld_dir = G_LABEL_GPT_ID_DIR
+	.ld_dir = G_LABEL_GPT_ID_DIR,
+	.ld_enabled = 1
 };
+
+G_LABEL_INIT(gpt, g_label_gpt, "Create device nodes for GPT labels");
+G_LABEL_INIT(gptid, g_label_gpt_uuid, "Create device nodes for GPT UUIDs");

Modified: stable/8/sys/geom/label/g_label_iso9660.c
==============================================================================
--- stable/8/sys/geom/label/g_label_iso9660.c	Sat Mar 27 18:01:38 2010	(r205767)
+++ stable/8/sys/geom/label/g_label_iso9660.c	Sat Mar 27 18:04:33 2010	(r205768)
@@ -78,7 +78,10 @@ g_label_iso9660_taste(struct g_consumer 
 	}
 }
 
-const struct g_label_desc g_label_iso9660 = {
+struct g_label_desc g_label_iso9660 = {
 	.ld_taste = g_label_iso9660_taste,
-	.ld_dir = G_LABEL_ISO9660_DIR
+	.ld_dir = G_LABEL_ISO9660_DIR,
+	.ld_enabled = 1
 };
+
+G_LABEL_INIT(iso9660, g_label_iso9660, "Create device nodes for ISO9660 volume names");

Modified: stable/8/sys/geom/label/g_label_msdosfs.c
==============================================================================
--- stable/8/sys/geom/label/g_label_msdosfs.c	Sat Mar 27 18:01:38 2010	(r205767)
+++ stable/8/sys/geom/label/g_label_msdosfs.c	Sat Mar 27 18:04:33 2010	(r205768)
@@ -216,7 +216,10 @@ error:
 		g_free(sector);
 }
 
-const struct g_label_desc g_label_msdosfs = {
+struct g_label_desc g_label_msdosfs = {
 	.ld_taste = g_label_msdosfs_taste,
-	.ld_dir = G_LABEL_MSDOSFS_DIR
+	.ld_dir = G_LABEL_MSDOSFS_DIR,
+	.ld_enabled = 1
 };
+
+G_LABEL_INIT(msdosfs, g_label_msdosfs, "Create device nodes for MSDOSFS volumes");

Modified: stable/8/sys/geom/label/g_label_ntfs.c
==============================================================================
--- stable/8/sys/geom/label/g_label_ntfs.c	Sat Mar 27 18:01:38 2010	(r205767)
+++ stable/8/sys/geom/label/g_label_ntfs.c	Sat Mar 27 18:04:33 2010	(r205768)
@@ -114,7 +114,10 @@ done:
 		g_free(filerecp);
 }
 
-const struct g_label_desc g_label_ntfs = {
+struct g_label_desc g_label_ntfs = {
 	.ld_taste = g_label_ntfs_taste,
-	.ld_dir = G_LABEL_NTFS_DIR
+	.ld_dir = G_LABEL_NTFS_DIR,
+	.ld_enabled = 1
 };
+
+G_LABEL_INIT(ntfs, g_label_ntfs, "Create device nodes for NTFS volumes");

Modified: stable/8/sys/geom/label/g_label_reiserfs.c
==============================================================================
--- stable/8/sys/geom/label/g_label_reiserfs.c	Sat Mar 27 18:01:38 2010	(r205767)
+++ stable/8/sys/geom/label/g_label_reiserfs.c	Sat Mar 27 18:04:33 2010	(r205768)
@@ -111,7 +111,10 @@ exit_free:
 	g_free(fs);
 }
 
-const struct g_label_desc g_label_reiserfs = {
+struct g_label_desc g_label_reiserfs = {
 	.ld_taste = g_label_reiserfs_taste,
-	.ld_dir = "reiserfs"
+	.ld_dir = "reiserfs",
+	.ld_enabled = 1
 };
+
+G_LABEL_INIT(reiserfs, g_label_reiserfs, "Create device nodes for REISERFS volumes");

Modified: stable/8/sys/geom/label/g_label_ufs.c
==============================================================================
--- stable/8/sys/geom/label/g_label_ufs.c	Sat Mar 27 18:01:38 2010	(r205767)
+++ stable/8/sys/geom/label/g_label_ufs.c	Sat Mar 27 18:04:33 2010	(r205768)
@@ -137,13 +137,17 @@ g_label_ufs_id_taste(struct g_consumer *
 	g_label_ufs_taste_common(cp, label, size, G_LABEL_UFS_ID);
 }
 
-
-const struct g_label_desc g_label_ufs_volume = {
+struct g_label_desc g_label_ufs_volume = {
 	.ld_taste = g_label_ufs_volume_taste,
-	.ld_dir = G_LABEL_UFS_VOLUME_DIR
+	.ld_dir = G_LABEL_UFS_VOLUME_DIR,
+	.ld_enabled = 1
 };
 
-const struct g_label_desc g_label_ufs_id = {
+struct g_label_desc g_label_ufs_id = {
 	.ld_taste = g_label_ufs_id_taste,
-	.ld_dir = G_LABEL_UFS_ID_DIR
+	.ld_dir = G_LABEL_UFS_ID_DIR,
+	.ld_enabled = 1
 };
+
+G_LABEL_INIT(ufsid, g_label_ufs_id, "Create device nodes for UFS file system IDs");
+G_LABEL_INIT(ufs, g_label_ufs_volume, "Create device nodes for UFS volume names");

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 18:08:14 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B8F6A1065672;
	Sat, 27 Mar 2010 18:08:14 +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 A71308FC12;
	Sat, 27 Mar 2010 18:08: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 o2RI8EtU061418;
	Sat, 27 Mar 2010 18:08:14 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RI8E1m061416;
	Sat, 27 Mar 2010 18:08:14 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271808.o2RI8E1m061416@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 18:08: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: r205769 - stable/8/sys/kern
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 18:08:14 -0000

Author: trasz
Date: Sat Mar 27 18:08:14 2010
New Revision: 205769
URL: http://svn.freebsd.org/changeset/base/205769

Log:
  MFC r200058:
  
  Add change that was somehow missed in r192586.  It could manifest by
  incorrectly returning EINVAL from acl_valid(3) for applications linked
  against pre-8.0 libc.

Modified:
  stable/8/sys/kern/vfs_acl.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/vfs_acl.c
==============================================================================
--- stable/8/sys/kern/vfs_acl.c	Sat Mar 27 18:04:33 2010	(r205768)
+++ stable/8/sys/kern/vfs_acl.c	Sat Mar 27 18:08:14 2010	(r205769)
@@ -173,7 +173,7 @@ acl_copyout(struct acl *kernel_acl, void
 
 /*
  * Convert "old" type - ACL_TYPE_{ACCESS,DEFAULT}_OLD - into its "new"
- * counterpart.  It's required for old (pre-NFS4 ACLs) libc to work
+ * counterpart.  It's required for old (pre-NFSv4 ACLs) libc to work
  * with new kernel.  Fixing 'type' for old binaries with new libc
  * is being done in lib/libc/posix1e/acl_support.c:_acl_type_unold().
  */
@@ -307,7 +307,8 @@ vacl_aclcheck(struct thread *td, struct 
 	error = acl_copyin(aclp, inkernelacl, type);
 	if (error)
 		goto out;
-	error = VOP_ACLCHECK(vp, type, inkernelacl, td->td_ucred, td);
+	error = VOP_ACLCHECK(vp, acl_type_unold(type), inkernelacl,
+	    td->td_ucred, td);
 out:
 	acl_free(inkernelacl);
 	return (error);

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 18:09:40 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C1AAA106566B;
	Sat, 27 Mar 2010 18:09:40 +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 AFD878FC0C;
	Sat, 27 Mar 2010 18:09: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 o2RI9eOJ061778;
	Sat, 27 Mar 2010 18:09:40 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RI9eZj061775;
	Sat, 27 Mar 2010 18:09:40 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271809.o2RI9eZj061775@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 18:09: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: r205770 - stable/8/sys/kern
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 18:09:40 -0000

Author: trasz
Date: Sat Mar 27 18:09:40 2010
New Revision: 205770
URL: http://svn.freebsd.org/changeset/base/205770

Log:
  MFC r200273:
  
  Don't add VAPPEND if the file is not being opened for writing.  Note that this
  only affects cases where open(2) is being used improperly - i.e. when the user
  specifies O_APPEND without O_WRONLY or O_RDWR.
  
  Reviewed by:	rwatson

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

Modified: stable/8/sys/kern/vfs_syscalls.c
==============================================================================
--- stable/8/sys/kern/vfs_syscalls.c	Sat Mar 27 18:08:14 2010	(r205769)
+++ stable/8/sys/kern/vfs_syscalls.c	Sat Mar 27 18:09:40 2010	(r205770)
@@ -4436,7 +4436,7 @@ fhopen(td, uap)
 	}
 	if (fmode & FREAD)
 		accmode |= VREAD;
-	if (fmode & O_APPEND)
+	if ((fmode & O_APPEND) && (fmode & FWRITE))
 		accmode |= VAPPEND;
 #ifdef MAC
 	error = mac_vnode_check_open(td->td_ucred, vp, accmode);

Modified: stable/8/sys/kern/vfs_vnops.c
==============================================================================
--- stable/8/sys/kern/vfs_vnops.c	Sat Mar 27 18:08:14 2010	(r205769)
+++ stable/8/sys/kern/vfs_vnops.c	Sat Mar 27 18:09:40 2010	(r205770)
@@ -212,7 +212,7 @@ restart:
 		accmode |= VREAD;
 	if (fmode & FEXEC)
 		accmode |= VEXEC;
-	if (fmode & O_APPEND)
+	if ((fmode & O_APPEND) && (fmode & FWRITE))
 		accmode |= VAPPEND;
 #ifdef MAC
 	error = mac_vnode_check_open(cred, vp, accmode);

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 18:12:01 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 759451065670;
	Sat, 27 Mar 2010 18:12:01 +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 638918FC1E;
	Sat, 27 Mar 2010 18:12:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2RIC1oS062362;
	Sat, 27 Mar 2010 18:12:01 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RIC1c3062360;
	Sat, 27 Mar 2010 18:12:01 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271812.o2RIC1c3062360@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 18:12:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r205771 - stable/8/sys/kern
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 18:12:01 -0000

Author: trasz
Date: Sat Mar 27 18:12:00 2010
New Revision: 205771
URL: http://svn.freebsd.org/changeset/base/205771

Log:
  MFC r200723:
  
  Interpret VAPPEND correctly in vaccess_acl_nfs4(9).

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	Sat Mar 27 18:09:40 2010	(r205770)
+++ stable/8/sys/kern/subr_acl_nfs4.c	Sat Mar 27 18:12:00 2010	(r205771)
@@ -82,6 +82,13 @@ _access_mask_from_accmode(accmode_t accm
 			access_mask |= accmode2mask[i].mask;
 	}
 
+	/*
+	 * VAPPEND is just a modifier for VWRITE; if the caller asked
+	 * for 'VAPPEND | VWRITE', we want to check for ACL_APPEND_DATA only.
+	 */
+	if (access_mask & ACL_APPEND_DATA)
+		access_mask &= ~ACL_WRITE_DATA;
+
 	return (access_mask);
 }
 

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 18:15:19 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 673AA106566B;
	Sat, 27 Mar 2010 18:15:19 +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 538DB8FC13;
	Sat, 27 Mar 2010 18:15: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 o2RIFIDo063158;
	Sat, 27 Mar 2010 18:15:18 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RIFIKH063154;
	Sat, 27 Mar 2010 18:15:18 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271815.o2RIFIKH063154@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 18:15: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: r205772 - in stable/8/sbin/geom: class/cache core
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 18:15:19 -0000

Author: trasz
Date: Sat Mar 27 18:15:18 2010
New Revision: 205772
URL: http://svn.freebsd.org/changeset/base/205772

Log:
  MFC r201432:
  
  Add manual page for gcache(8).

Added:
  stable/8/sbin/geom/class/cache/gcache.8
     - copied unchanged from r201432, head/sbin/geom/class/cache/gcache.8
Modified:
  stable/8/sbin/geom/class/cache/Makefile
  stable/8/sbin/geom/core/geom.8
Directory Properties:
  stable/8/sbin/geom/   (props changed)
  stable/8/sbin/geom/class/stripe/   (props changed)

Modified: stable/8/sbin/geom/class/cache/Makefile
==============================================================================
--- stable/8/sbin/geom/class/cache/Makefile	Sat Mar 27 18:12:00 2010	(r205771)
+++ stable/8/sbin/geom/class/cache/Makefile	Sat Mar 27 18:15:18 2010	(r205772)
@@ -3,6 +3,5 @@
 .PATH: ${.CURDIR}/../../misc
 
 CLASS=	cache
-NO_MAN=	# notyet
 
 .include 

Copied: stable/8/sbin/geom/class/cache/gcache.8 (from r201432, head/sbin/geom/class/cache/gcache.8)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/sbin/geom/class/cache/gcache.8	Sat Mar 27 18:15:18 2010	(r205772, copy of r201432, head/sbin/geom/class/cache/gcache.8)
@@ -0,0 +1,192 @@
+.\"-
+.\" Copyright (c) 2010 Edward Tomasz Napierala
+.\" 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 THE VOICES IN HIS HEAD BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 3, 2010
+.Dt GCACHE 8
+.Os
+.Sh NAME
+.Nm gcache
+.Nd "control utility for CACHE GEOM class"
+.Sh SYNOPSIS
+.Nm
+.Cm create
+.Op Fl v
+.Op Fl b Ar blocksize
+.Op Fl s Ar size
+.Ar name
+.Ar prov
+.Nm
+.Cm configure
+.Op Fl v
+.Op Fl b Ar blocksize
+.Op Fl s Ar size
+.Ar name
+.Nm
+.Cm destroy
+.Op Fl fv
+.Ar name
+.Nm
+.Cm label
+.Op Fl v
+.Op Fl b Ar blocksize
+.Op Fl s Ar size
+.Ar name
+.Ar prov
+.Nm
+.Cm stop
+.Op Fl fv
+.Ar name ...
+.Nm
+.Cm clear
+.Op Fl v
+.Ar prov ...
+.Nm
+.Cm dump
+.Ar prov ...
+.Nm
+.Cm list
+.Nm
+.Cm status
+.Op Fl s Ar name
+.Nm
+.Cm load
+.Op Fl v
+.Nm
+.Cm unload
+.Op Fl v
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to control GEOM cache, which can
+speed up read performance by sending fixed size
+read requests to its consumer.  It has been developed to address
+the problem of a horrible read performance of a 64k blocksize FS
+residing on a RAID3 array with 8 data components, where a single
+disk component would only get 8k read requests, thus effectively
+killing disk performance under high load.
+.Pp
+Caching can be configured using two different methods:
+.Dq manual
+or
+.Dq automatic .
+When using the
+.Dq manual
+method, no metadata are stored on the devices, so the cached
+device has to be configured by hand every time it is needed.
+The
+.Dq automatic
+method uses on-disk metadata to detect devices.
+Once devices are labeled, they will be automatically detected and
+configured.
+.Pp
+The first argument to
+.Nm
+indicates an action to be performed:
+.Bl -tag -width ".Cm destroy"
+.It Cm create
+Cache the given devices with specified
+.Ar name .
+This is the
+.Dq manual
+method.
+The kernel module
+.Pa geom_cache.ko
+will be loaded if it is not loaded already.
+.It Cm label
+Cache the given devices with the specified
+.Ar name .
+This is the
+.Dq automatic
+method, where metadata are stored in every device's last sector.
+The kernel module
+.Pa geom_cache.ko
+will be loaded if it is not loaded already.
+.It Cm stop
+Turn off existing cache device by its
+.Ar name .
+This command does not touch on-disk metadata!
+.It Cm destroy
+Same as
+.Cm stop .
+.It Cm clear
+Clear metadata on the given devices.
+.It Cm dump
+Dump metadata stored on the given devices.
+.It Cm list
+See
+.Xr geom 8 .
+.It Cm status
+See
+.Xr geom 8 .
+.It Cm load
+See
+.Xr geom 8 .
+.It Cm unload
+See
+.Xr geom 8 .
+.El
+.Pp
+Additional options:
+.Bl -tag -width indent
+.It Fl f
+Force the removal of the specified cache device.
+.It Fl v
+Be more verbose.
+.El
+.Sh SYSCTL VARIABLES
+The following
+.Xr sysctl 8
+variables can be used to control the behavior of the
+.Nm CACHE
+GEOM class.
+The default value is shown next to each variable.
+.Bl -tag -width indent
+.It Va kern.geom.cache.used_hi : No 20
+.It Va kern.geom.cache.used_lo : No 5
+.It Va kern.geom.cache.idletime : No 5
+.It Va kern.geom.cache.timeout : No 10
+.It Va kern.geom.cache.enable : No 1
+.It Va kern.geom.cache.debug : No 0
+Debug level of the
+.Nm CACHE
+GEOM class.
+This can be set to a number between 0 and 3 inclusive.
+If set to 0 minimal debug information is printed, and if set to 3 the
+maximum amount of debug information is printed.
+.El
+.Sh EXIT STATUS
+Exit status is 0 on success, and 1 if the command fails.
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr geom 8
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An Ruslan Ermilov Aq ru@FreeBSD.org

Modified: stable/8/sbin/geom/core/geom.8
==============================================================================
--- stable/8/sbin/geom/core/geom.8	Sat Mar 27 18:12:00 2010	(r205771)
+++ stable/8/sbin/geom/core/geom.8	Sat Mar 27 18:15:18 2010	(r205772)
@@ -166,7 +166,7 @@ geom md unload
 .Sh SEE ALSO
 .Xr libgeom 3 ,
 .Xr geom 4 ,
-.\" .Xr gcache 8 ,
+.Xr gcache 8 ,
 .Xr gconcat 8 ,
 .Xr geli 8 ,
 .Xr gjournal 8 ,

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Mar 27 18:45:53 2010
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B0B92106566C;
	Sat, 27 Mar 2010 18:45:53 +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 9CCEF8FC18;
	Sat, 27 Mar 2010 18:45: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 o2RIjr5k070158;
	Sat, 27 Mar 2010 18:45:53 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2RIjrPW070156;
	Sat, 27 Mar 2010 18:45:53 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <201003271845.o2RIjrPW070156@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 27 Mar 2010 18:45:53 +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: r205775 - stable/8/share/man/man9
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 27 Mar 2010 18:45:53 -0000

Author: trasz
Date: Sat Mar 27 18:45:53 2010
New Revision: 205775
URL: http://svn.freebsd.org/changeset/base/205775

Log:
  MFC r203122:
  
  Improve descriptions, remove turnstiles (since, from what I understand,
  they are only used to implement other synchronization primitives), tweak
  formatting.
  
  MFC r203127:
  
  Add description of bounded sleep vs unbounded sleep (aka blocking).  Move
  rules into their own section.
  
  MFC r203131:
  
  Cosmetic fixes.
  
  MFC r203759:
  
  Improve description for Giant and mention blocking inside interrupt threads.
  
  MFC r203762:
  
  Start sentences with a new line.
  
  Submitted by:	brueffer
  
  MFC r203825:
  
  Remove list of locking primitives, which is kind of redundant, move
  information about witness(9) to the section about interactions, and
  expand 'contexts' table.
  
  MFC r203929:
  
  Some rewording and language fixes.
  
  PR:		docs/136918, docs/134074
  Submitted by:	Ben Kaduk , Haven Hash 

Modified:
  stable/8/share/man/man9/locking.9
Directory Properties:
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/locking.9
==============================================================================
--- stable/8/share/man/man9/locking.9	Sat Mar 27 18:40:08 2010	(r205774)
+++ stable/8/share/man/man9/locking.9	Sat Mar 27 18:45:53 2010	(r205775)
@@ -24,108 +24,52 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 14, 2007
+.Dd February 15, 2010
 .Dt LOCKING 9
 .Os
 .Sh NAME
 .Nm locking
 .Nd kernel synchronization primitives
-.Sh SYNOPSIS
-All sorts of stuff to go here.
-.Pp
 .Sh DESCRIPTION
 The
 .Em FreeBSD
 kernel is written to run across multiple CPUs and as such requires
 several different synchronization primitives to allow the developers
 to safely access and manipulate the many data types required.
-.Pp
-These include:
-.Bl -enum
-.It
-Spin Mutexes
-.It
-Sleep Mutexes
-.It
-pool Mutexes
-.It
-Shared-Exclusive locks
-.It
-Reader-Writer locks
-.It
-Read-Mostly locks
-.It
-Turnstiles
-.It
-Semaphores
-.It
-Condition variables
-.It
-Sleep/wakeup
-.It
-Giant
-.It
-Lockmanager locks
-.El
-.Pp
-The primitives interact and have a number of rules regarding how
-they can and can not be combined.
-There are too many for the average
-human mind and they keep changing.
-(if you disagree, please write replacement text)  :-)
-.Pp
-Some of these primitives may be used at the low (interrupt) level and
-some may not.
-.Pp
-There are strict ordering requirements and for some of the types this
-is checked using the
-.Xr witness 4
-code.
-.Pp
-.Ss SPIN Mutexes
-Mutexes are the basic primitive.
-You either hold it or you don't.
-If you don't own it then you just spin, waiting for the holder (on
-another CPU) to release it.
-Hopefully they are doing something fast.
-You 
-.Em must not
-do anything that deschedules the thread while you
-are holding a SPIN mutex.
 .Ss Mutexes
-Basically (regular) mutexes will deschedule the thread if the
-mutex can not be acquired.
-A non-spin mutex can be considered to be equivalent
-to getting a write lock on an 
-.Em rw_lock
-(see below), and in fact non-spin mutexes and rw_locks may soon become the same thing.
-As in spin mutexes, you either get it or you don't.
-You may only call the
-.Xr sleep 9
-call via
-.Fn msleep
-or the new
-.Fn mtx_sleep
-variant.
-These will atomically drop the mutex and reacquire it
-as part of waking up.
-This is often however a
-.Em BAD
-idea because it generally relies on you having
-such a good knowledge of all the call graph above you
-and what assumptions it is making that there are a lot
-of ways to make hard-to-find mistakes.
-For example you MUST re-test all the assumptions you made before,
-all the way up the call graph to where you got the lock.
-You can not just assume that mtx_sleep can be inserted anywhere.
-If any caller above you has any mutex or
-rwlock, your sleep, will cause a panic.
-If the sleep only happens rarely it may be years before the 
-bad code path is found.
-.Ss Pool Mutexes
-A variant of regular mutexes where the allocation of the mutex is handled
-more by the system.
-.Ss Rw_locks
+Mutexes (also called "sleep mutexes") are the most commonly used
+synchronization primitive in the kernel.
+Thread acquires (locks) a mutex before accessing data shared with other
+threads (including interrupt threads), and releases (unlocks) it afterwards.
+If the mutex cannot be acquired, the thread requesting it will sleep.
+Mutexes fully support priority propagation.
+.Pp
+See
+.Xr mutex 9
+for details.
+.Ss Spin mutexes
+Spin mutexes are variation of basic mutexes; the main difference between
+the two is that spin mutexes never sleep - instead, they spin, waiting
+for the thread holding the lock, which runs on another CPU, to release it.
+Differently from ordinary mutex, spin mutexes disable interrupts when acquired.
+Since disabling interrupts is expensive, they are also generally slower.
+Spin mutexes should be used only when neccessary, e.g. to protect data shared
+with interrupt filter code (see
+.Xr bus_setup_intr 9
+for details).
+.Ss Pool mutexes
+With most synchronisaton primitives, such as mutexes, programmer must
+provide a piece of allocated memory to hold the primitive.
+For example, a mutex may be embedded inside the structure it protects.
+Pool mutex is a variant of mutex without this requirement - to lock or unlock
+a pool mutex, one uses address of the structure being protected with it,
+not the mutex itself.
+Pool mutexes are seldom used.
+.Pp
+See
+.Xr mtx_pool 9
+for details.
+.Ss Reader/writer locks
 Reader/writer locks allow shared access to protected data by multiple threads,
 or exclusive access by a single thread.
 The threads with shared access are known as
@@ -135,23 +79,12 @@ A thread with exclusive access is known 
 .Em writer
 since it may modify protected data.
 .Pp
-Although reader/writer locks look very similar to
-.Xr sx 9
-(see below) locks, their usage pattern is different.
 Reader/writer locks can be treated as mutexes (see above and
 .Xr mutex 9 )
 with shared/exclusive semantics.
 More specifically, regular mutexes can be 
 considered to be equivalent to a write-lock on an
 .Em rw_lock.
-In the future this may in fact
-become literally the fact.
-An
-.Em rw_lock
-can be locked while holding a regular mutex, but 
-can
-.Em not
-be held while sleeping.
 The
 .Em rw_lock
 locks have priority propagation like mutexes, but priority
@@ -163,54 +96,49 @@ Another important property is that share
 can recurse, but exclusive locks are not allowed to recurse.
 This ability should not be used lightly and 
 .Em may go away.
-Users of recursion in any locks should be prepared to 
-defend their decision against vigorous criticism.
-.Ss Rm_locks
+.Pp
+See
+.Xr rwlock 9
+for details.
+.Ss Read-mostly locks
 Mostly reader locks are similar to
-.Em Reader/write
-locks but optimized for very infrequent 
-.Em writer
-locking.
-.Em rm_lock
+.Em reader/writer
+locks but optimized for very infrequent write locking.
+.Em Read-mostly
 locks implement full priority propagation by tracking shared owners
-using a lock user supplied
+using a caller-supplied
 .Em tracker
 data structure.
-.Ss Sx_locks
-Shared/exclusive locks are used to protect data that are read far more often
-than they are written.
-Mutexes are inherently more efficient than shared/exclusive locks, so
-shared/exclusive locks should be used prudently.
-The main reason for using an
-.Em sx_lock
-is that a thread may hold a shared or exclusive lock on an
-.Em sx_lock
-lock while sleeping.
-As a consequence of this however, an
-.Em sx_lock
-lock may not be acquired while holding a mutex.
-The reason for this is that, if one thread slept while holding an
-.Em sx_lock
-lock while another thread blocked on the same
-.Em sx_lock
-lock after acquiring a mutex, then the second thread would effectively
-end up sleeping while holding a mutex, which is not allowed.
-The
-.Em sx_lock
-should be considered to be closely related to
+.Pp
+See
+.Xr rmlock 9
+for details.
+.Ss Shared/exclusive locks
+Shared/exclusive locks are similar to reader/writer locks; the main difference
+between them is that shared/exclusive locks may be held during unbounded sleep
+(and may thus perform an unbounded sleep).
+They are inherently less efficient than mutexes, reader/writer locks
+and read-mostly locks.
+They don't support priority propagation.
+They should be considered to be closely related to
 .Xr sleep 9 .
 In fact it could in some cases be 
 considered a conditional sleep.
-.Ss Turnstiles
-Turnstiles are used to hold a queue of threads blocked on
-non-sleepable locks.
-Sleepable locks use condition variables to implement their queues.
-Turnstiles differ from a sleep queue in that turnstile queue's
-are assigned to a lock held by an owning thread.
-Thus, when one thread is enqueued onto a turnstile, it can lend its
-priority to the owning thread.
-If this sounds confusing, we need to describe it better.
-.Ss Semaphores
+.Pp
+See
+.Xr sx 9
+for details.
+.Ss Counting semaphores
+Counting semaphores provide a mechanism for synchronizing access
+to a pool of resources.
+Unlike mutexes, semaphores do not have the concept of an owner,
+so they can be useful in situations where one thread needs
+to acquire a resource, and another thread needs to release it.
+They are largely deprecated.
+.Pp
+See
+.Xr sema 9
+for details.
 .Ss Condition variables
 Condition variables are used in conjunction with mutexes to wait for
 conditions to occur.
@@ -220,24 +148,30 @@ functions.
 When a thread waits on a condition, the mutex
 is atomically released before the thread is blocked, then reacquired
 before the function call returns.
+.Pp
+See
+.Xr condvar 9
+for details.
 .Ss Giant
-Giant is a special instance of a sleep lock.
-It has several special characteristics.
+Giant is an instance of a mutex, with some special characteristics:
 .Bl -enum
 .It
 It is recursive.
 .It
-Drivers can request that Giant be locked around them, but this is
-going away.
-.It
-You can sleep while it has recursed, but other recursive locks cannot.
+Drivers and filesystems can request that Giant be locked around them
+by not marking themselves MPSAFE.
+Note that infrastructure to do this is slowly going away as non-MPSAFE
+drivers either became properly locked or disappear.
 .It
 Giant must be locked first before other locks.
 .It
+It is OK to hold Giant while performing unbounded sleep; in such case,
+Giant will be dropped before sleeping and picked up after wakeup.
+.It
 There are places in the kernel that drop Giant and pick it back up
 again.
 Sleep locks will do this before sleeping.
-Parts of the Network or VM code may do this as well, depending on the
+Parts of the network or VM code may do this as well, depending on the
 setting of a sysctl.
 This means that you cannot count on Giant keeping other code from
 running if your code sleeps, even if you want it to.
@@ -298,26 +232,76 @@ while the thread is suspended and will r
 .Va Giant
 mutex before the function returns.
 .Pp
-.Ss lockmanager locks
-Largely deprecated.
-See the
+See
+.Xr sleep 9
+for details.
+.Pp
+.Ss Lockmanager locks
+Shared/exclusive locks, used mostly in
+.Xr VFS 9 ,
+in particular as a
+.Xr vnode 9
+lock.
+They have features other lock types don't have, such as sleep timeout,
+writer starvation avoidance, draining, and interlock mutex, but this makes them
+complicated to implement; for this reason, they are deprecated.
+.Pp
+See
 .Xr lock 9
-page for more information.
-I don't know what the downsides are but I'm sure someone will fill in this part.
-.Sh Usage tables.
-.Ss Interaction table.
-The following table shows what you can and can not do if you hold
-one of the synchronization primitives discussed here:
-(someone who knows what they are talking about should write this table)
-.Bl -column ".Ic xxxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXX" -offset indent
+for details.
+.Sh INTERACTIONS
+The primitives interact and have a number of rules regarding how
+they can and can not be combined.
+Many of these rules are checked using the
+.Xr witness 4
+code.
+.Ss Bounded vs. unbounded sleep
+The following primitives perform bounded sleep: mutexes, pool mutexes,
+reader/writer locks and read-mostly locks.
+.Pp
+The following primitives block (perform unbounded sleep): shared/exclusive locks,
+counting semaphores, condition variables, sleep/wakeup and lockmanager locks.
+.Pp
+It is an error to do any operation that could result in any kind of sleep while
+holding spin mutex.
+.Pp
+As a general rule, it is an error to do any operation that could result
+in unbounded sleep while holding any primitive from the 'bounded sleep' group.
+For example, it is an error to try to acquire shared/exclusive lock while
+holding mutex, or to try to allocate memory with M_WAITOK while holding
+read-write lock.
+.Pp
+As a special case, it is possible to call
+.Fn sleep
+or
+.Fn mtx_sleep
+while holding a single mutex.
+It will atomically drop that mutex and reacquire it as part of waking up.
+This is often a bad idea because it generally relies on the programmer having
+good knowledge of all of the call graph above the place where
+.Fn mtx_sleep
+is being called and assumptions the calling code has made.
+Because the lock gets dropped during sleep, one one must re-test all
+the assumptions that were made before, all the way up the call graph to the
+place where the lock was acquired.
+.Pp
+It is an error to do any operation that could result in any kind of sleep when
+running inside an interrupt filter.
+.Pp
+It is an error to do any operation that could result in unbounded sleep when
+running inside an interrupt thread.
+.Ss Interaction table
+The following table shows what you can and can not do while holding
+one of the synchronization primitives discussed:
+.Bl -column ".Ic xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
 .It Xo
-.Em "You have: You want:" Ta Spin_mtx Ta Slp_mtx Ta sx_lock Ta rw_lock Ta rm_lock Ta sleep
+.Em "You have: You want:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
 .Xc
-.It Ic SPIN mutex  Ta \&ok-1 Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-3
-.It Ic Sleep mutex Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3
-.It Ic sx_lock     Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4
-.It Ic rw_lock     Ta \&ok Ta \&ok Ta \&no Ta \&ok-2 Ta \&ok Ta \&no-3
-.It Ic rm_lock     Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok-2 Ta \&no
+.It spin mtx  Ta \&ok-1 Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-3
+.It mutex     Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3
+.It sx        Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4
+.It rwlock    Ta \&ok Ta \&ok Ta \&no Ta \&ok-2 Ta \&ok Ta \&no-3
+.It rmlock    Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok-2 Ta \&no
 .El
 .Pp
 .Em *1
@@ -325,11 +309,11 @@ Recursion is defined per lock.
 Lock order is important.
 .Pp
 .Em *2
-readers can recurse though writers can not.
+Readers can recurse though writers can not.
 Lock order is important.
 .Pp
 .Em *3
-There are calls atomically release this primitive when going to sleep
+There are calls that atomically release this primitive when going to sleep
 and reacquire it on wakeup (e.g.
 .Fn mtx_sleep ,
 .Fn rw_sleep
@@ -340,19 +324,22 @@ and
 .Em *4
 Though one can sleep holding an sx lock, one can also use
 .Fn sx_sleep
-which atomically release this primitive when going to sleep and
+which will atomically release this primitive when going to sleep and
 reacquire it on wakeup.
-.Ss Context mode table.
+.Ss Context mode table
 The next table shows what can be used in different contexts.
 At this time this is a rather easy to remember table.
-.Bl -column ".Ic Xxxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXX" -offset indent
+.Bl -column ".Ic Xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
 .It Xo
-.Em "Context:" Ta Spin_mtx Ta Slp_mtx Ta sx_lock Ta rw_lock Ta rm_lock Ta sleep
+.Em "Context:"  Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
 .Xc
-.It interrupt:  Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no 
-.It idle:  Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no 
+.It interrupt filter:  Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no 
+.It ithread:    Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok Ta \&no 
+.It callout:    Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&no Ta \&no 
+.It syscall:    Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok 
 .El
 .Sh SEE ALSO
+.Xr witness 4 ,
 .Xr condvar 9 ,
 .Xr lock 9 ,
 .Xr mtx_pool 9 ,
@@ -362,11 +349,12 @@ At this time this is a rather easy to re
 .Xr sema 9 ,
 .Xr sleep 9 ,
 .Xr sx 9 ,
-.Xr LOCK_PROFILING 9 ,
-.Xr WITNESS 9
+.Xr LOCK_PROFILING 9
 .Sh HISTORY
 These
 functions appeared in
 .Bsx 4.1
 through
 .Fx 7.0
+.Sh BUGS
+There are too many locking primitives to choose from.