Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Nov 2014 21:54:32 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r274762 - in projects/sendfile: lib/libc/posix1e libexec/fingerd sbin/fsck sbin/growfs share/man/man4 share/man/man9 sys/contrib/ipfilter/netinet sys/dev/cxgbe sys/dev/cxgbe/common sys/...
Message-ID:  <201411202154.sAKLsWs8031514@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Thu Nov 20 21:54:32 2014
New Revision: 274762
URL: https://svnweb.freebsd.org/changeset/base/274762

Log:
  Merge head r258543 through r274754.

Added:
  projects/sendfile/share/man/man9/vnet.9
     - copied unchanged from r274754, head/share/man/man9/vnet.9
Deleted:
  projects/sendfile/lib/libc/posix1e/acl_size.c
Modified:
  projects/sendfile/libexec/fingerd/fingerd.8
  projects/sendfile/sbin/fsck/fsck.c
  projects/sendfile/sbin/growfs/growfs.8
  projects/sendfile/share/man/man4/splash.4
  projects/sendfile/share/man/man9/Makefile
  projects/sendfile/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c   (contents, props changed)
  projects/sendfile/sys/dev/cxgbe/common/common.h
  projects/sendfile/sys/dev/cxgbe/t4_main.c
  projects/sendfile/sys/dev/fdt/fdt_common.c
  projects/sendfile/sys/mips/conf/MALTA
  projects/sendfile/sys/mips/conf/MALTA64
  projects/sendfile/sys/mips/include/cache_mipsNN.h
  projects/sendfile/sys/mips/include/cpuinfo.h
  projects/sendfile/sys/mips/include/cpuregs.h
  projects/sendfile/sys/mips/mips/cache.c
  projects/sendfile/sys/mips/mips/cache_mipsNN.c
  projects/sendfile/sys/mips/mips/cpu.c
  projects/sendfile/sys/powerpc/aim/trap_subr32.S
  projects/sendfile/sys/powerpc/aim/trap_subr64.S
  projects/sendfile/sys/powerpc/powermac/pmu.c
  projects/sendfile/sys/powerpc/powermac/pmuvar.h
  projects/sendfile/sys/powerpc/powerpc/db_trace.c
  projects/sendfile/usr.bin/man/man.1
  projects/sendfile/usr.sbin/autofs/auto_master.5
  projects/sendfile/usr.sbin/bhyve/bhyve.8
  projects/sendfile/usr.sbin/pw/tests/helper_functions.shin
  projects/sendfile/usr.sbin/pw/tests/pw_delete.sh
  projects/sendfile/usr.sbin/pw/tests/pw_lock.sh
  projects/sendfile/usr.sbin/pw/tests/pw_modify.sh
Directory Properties:
  projects/sendfile/   (props changed)
  projects/sendfile/lib/libc/   (props changed)
  projects/sendfile/sbin/   (props changed)
  projects/sendfile/share/   (props changed)
  projects/sendfile/share/man/man4/   (props changed)
  projects/sendfile/sys/   (props changed)
  projects/sendfile/sys/contrib/ipfilter/   (props changed)
  projects/sendfile/usr.sbin/bhyve/   (props changed)

Modified: projects/sendfile/libexec/fingerd/fingerd.8
==============================================================================
--- projects/sendfile/libexec/fingerd/fingerd.8	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/libexec/fingerd/fingerd.8	Thu Nov 20 21:54:32 2014	(r274762)
@@ -28,7 +28,7 @@
 .\"     @(#)fingerd.8	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd April 1, 2010
+.Dd November 19, 2014
 .Dt FINGERD 8
 .Os
 .Sh NAME
@@ -86,7 +86,7 @@ returns a
 report that lists all people logged into
 the system at that moment.
 .Pp
-If a user name is specified (e.g.\&
+If a user name is specified (e.g.,\&
 .Pf eric Aq Tn CRLF )
 then the
 response lists more extended information for only that particular user,
@@ -159,19 +159,3 @@ The
 .Nm
 utility appeared in
 .Bx 4.3 .
-.Sh BUGS
-Connecting directly to the server from a
-.Tn TIP
-or an equally narrow-minded
-.Tn TELNET Ns \-protocol
-user program can result
-in meaningless attempts at option negotiation being sent to the
-server, which will foul up the command line interpretation.
-The
-.Nm
-utility should be taught to filter out
-.Tn IAC Ns \'s
-and perhaps even respond
-negatively
-.Pq Tn IAC WON'T
-to all option commands received.

Modified: projects/sendfile/sbin/fsck/fsck.c
==============================================================================
--- projects/sendfile/sbin/fsck/fsck.c	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sbin/fsck/fsck.c	Thu Nov 20 21:54:32 2014	(r274762)
@@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mount.h>
 #include <sys/queue.h>
 #include <sys/wait.h>
-#define FSTYPENAMES
-#include <sys/disklabel.h>
+#include <sys/disk.h>
 #include <sys/ioctl.h>
 
 #include <ctype.h>
@@ -81,10 +80,21 @@ static void addentry(struct fstypelist *
 static void maketypelist(char *);
 static void catopt(char **, const char *);
 static void mangle(char *, int *, const char ** volatile *, int *);
-static const char *getfslab(const char *);
+static const char *getfstype(const char *);
 static void usage(void) __dead2;
 static int isok(struct fstab *);
 
+static struct {
+	const char *ptype;
+	const char *name;
+} ptype_map[] = {
+	{ "ufs",	"ffs" },
+	{ "ffs",	"ffs" },
+	{ "fat",	"msdosfs" },
+	{ "efi",	"msdosfs" },
+	{ NULL,		NULL },
+};
+
 int
 main(int argc, char *argv[])
 {
@@ -203,7 +213,7 @@ main(int argc, char *argv[])
 		if ((fs = getfsfile(spec)) == NULL &&
 		    (fs = getfsspec(spec)) == NULL) {
 			if (vfstype == NULL)
-				vfstype = getfslab(spec);
+				vfstype = getfstype(spec);
 			if (vfstype == NULL)
 				errx(1, "Could not determine filesystem type");
 			type = vfstype;
@@ -535,41 +545,27 @@ mangle(char *opts, int *argcp, const cha
 	*maxargcp = maxargc;
 }
 
-
 static const char *
-getfslab(const char *str)
+getfstype(const char *str)
 {
-	struct disklabel dl;
-	int fd;
-	char p;
-	const char *vfstype;
-	u_char t;
+	struct diocgattr_arg attr;
+	int fd, i;
 
-	/* deduce the file system type from the disk label */
 	if ((fd = open(str, O_RDONLY)) == -1)
 		err(1, "cannot open `%s'", str);
 
-	if (ioctl(fd, DIOCGDINFO, &dl) == -1) {
+	strncpy(attr.name, "PART::type", sizeof(attr.name));
+	memset(&attr.value, 0, sizeof(attr.value));
+	attr.len = sizeof(attr.value);
+	if (ioctl(fd, DIOCGATTR, &attr) == -1) {
 		(void) close(fd);
 		return(NULL);
 	}
-
 	(void) close(fd);
-
-	p = str[strlen(str) - 1];
-
-	if ((p - 'a') >= dl.d_npartitions)
-		errx(1, "partition `%s' is not defined on disk", str);
-
-	if ((t = dl.d_partitions[p - 'a'].p_fstype) >= FSMAXTYPES) 
-		errx(1, "partition `%s' is not of a legal vfstype",
-		    str);
-
-	if ((vfstype = fstypenames[t]) == NULL)
-		errx(1, "vfstype `%s' on partition `%s' is not supported",
-		    fstypenames[t], str);
-
-	return vfstype;
+	for (i = 0; ptype_map[i].ptype != NULL; i++)
+		if (strstr(attr.value.str, ptype_map[i].ptype) != NULL)
+			return (ptype_map[i].name);
+	return (NULL);
 }
 
 

Modified: projects/sendfile/sbin/growfs/growfs.8
==============================================================================
--- projects/sendfile/sbin/growfs/growfs.8	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sbin/growfs/growfs.8	Thu Nov 20 21:54:32 2014	(r274762)
@@ -37,7 +37,7 @@
 .\" $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $
 .\" $FreeBSD$
 .\"
-.Dd November 26, 2013
+.Dd November 20, 2014
 .Dt GROWFS 8
 .Os
 .Sh NAME
@@ -96,12 +96,14 @@ This value defaults to the size of the r
 will enlarge the file system to the size of the entire partition).
 .El
 .Sh EXAMPLES
-.Dl growfs -s 2G /dev/ada0p1
+Expand root file system to fill up available space:
+.Dl growfs /
 .Pp
-will enlarge
+Resize
 .Pa /dev/ada0p1
-up to 2GB if there is enough space in
-.Pa /dev/ada0p1 .
+partition to 2GB and expand the file system:
+.Dl gpart resize -i 1 -s 2G ada0
+.Dl growfs -s 2G /dev/ada0p1
 .Sh SEE ALSO
 .Xr dumpfs 8 ,
 .Xr ffsinfo 8 ,
@@ -115,7 +117,7 @@ The
 .Nm
 utility first appeared in
 .Fx 4.4 .
-The ability to resize mounted filesystems was added in
+The ability to resize mounted file systems was added in
 .Fx 10.0 .
 .Sh AUTHORS
 .An Christoph Herrmann Aq Mt chm@FreeBSD.org

Modified: projects/sendfile/share/man/man4/splash.4
==============================================================================
--- projects/sendfile/share/man/man4/splash.4	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/share/man/man4/splash.4	Thu Nov 20 21:54:32 2014	(r274762)
@@ -66,7 +66,7 @@ Currently the following decoder modules 
 .Pp
 .Bl -tag -width splash_decoder -compact
 .It Pa splash_bmp.ko
-W*ndows BMP file decoder.
+Windows BMP file decoder.
 While the BMP file format allows images of various color depths, this
 decoder currently only handles 256 color bitmaps.
 Bitmaps of other color depths will not be displayed.

Modified: projects/sendfile/share/man/man9/Makefile
==============================================================================
--- projects/sendfile/share/man/man9/Makefile	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/share/man/man9/Makefile	Thu Nov 20 21:54:32 2014	(r274762)
@@ -345,6 +345,7 @@ MAN=	accept_filter.9 \
 	vmem.9 \
 	vn_fullpath.9 \
 	vn_isdisk.9 \
+	vnet.9 \
 	vnode.9 \
 	VOP_ACCESS.9 \
 	VOP_ACLCHECK.9 \

Copied: projects/sendfile/share/man/man9/vnet.9 (from r274754, head/share/man/man9/vnet.9)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/sendfile/share/man/man9/vnet.9	Thu Nov 20 21:54:32 2014	(r274762, copy of r274754, head/share/man/man9/vnet.9)
@@ -0,0 +1,502 @@
+.\"-
+.\" Copyright (c) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written by CK Software GmbH under sponsorship from
+.\" the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2014
+.Dt VNET 9
+.Os
+.Sh NAME
+.Nm VNET
+.Nd "network subsystem virtualization infrastructure"
+.Sh SYNOPSIS
+.Cd "options VIMAGE"
+.Cd "options VNET_DEBUG"
+.Pp
+.In sys/vnet.h
+.Pp
+.\"------------------------------------------------------------
+.Ss "Constants and Global Variables"
+.\"
+.Dv VNET_SETNAME
+.\"	"set_vnet"
+.Dv VNET_SYMPREFIX
+.\"	"vnet_entry_"
+.Vt extern struct vnet *vnet0;
+.\"------------------------------------------------------------
+.Ss "Variable Declaration"
+.Fo VNET
+.Fa "name"
+.Fc
+.\"
+.Fo VNET_NAME
+.Fa "name"
+.Fc
+.\"
+.Fo VNET_DECLARE
+.Fa "type" "name"
+.Fc
+.\"
+.Fo VNET_DEFINE
+.Fa "type" "name"
+.Fc
+.\"
+.Bd -literal
+#define	V_name	VNET(name)
+.Ed
+.\" ------------------------------------------------------------
+.Ss "Virtual Instance Selection"
+.\"
+.Fo CRED_TO_VNET
+.Fa "struct ucred *"
+.Fc
+.\"
+.Fo TD_TO_VNET
+.Fa "struct thread *"
+.Fc
+.\"
+.Fo P_TO_VNET
+.Fa "struct proc *"
+.Fc
+.\"
+.Fo IS_DEFAULT_VNET
+.Fa "struct vnet *"
+.Fc
+.\"
+.Fo VNET_ASSERT
+.Fa exp msg
+.Fc
+.\"
+.Fo CURVNET_SET
+.Fa "struct vnet *"
+.Fc
+.\"
+.Fo CURVNET_SET_QUIET
+.Fa "struct vnet *"
+.Fc
+.\"
+.Fo CURVNET_RESTORE
+.Fc
+.\"
+.Fo VNET_ITERATOR_DECL
+.Fa "struct vnet *"
+.Fc
+.\"
+.Fo VNET_FOREACH
+.Fa "struct vnet *"
+.Fc
+.\" ------------------------------------------------------------
+.Ss "Locking"
+.\"
+.Fo VNET_LIST_RLOCK
+.Fc
+.Fo VNET_LIST_RUNLOCK
+.Fc
+.Fo VNET_LIST_RLOCK_NOSLEEP
+.Fc
+.Fo VNET_LIST_RUNLOCK_NOSLEEP
+.Fc
+.\" ------------------------------------------------------------
+.Ss "Startup and Teardown Functions"
+.\"
+.Ft "struct vnet *"
+.Fo vnet_alloc
+.Fa void
+.Fc
+.\"
+.Ft void
+.Fo vnet_destroy
+.Fa "struct vnet *"
+.Fc
+.\"
+.Fo VNET_SYSINIT
+.Fa ident
+.Fa "enum sysinit_sub_id subsystem"
+.Fa "enum sysinit_elem_order order"
+.Fa "sysinit_cfunc_t func"
+.Fa "const void *arg"
+.Fc
+.\"
+.Fo VNET_SYSUNINIT
+.Fa ident
+.Fa "enum sysinit_sub_id subsystem"
+.Fa "enum sysinit_elem_order order"
+.Fa "sysinit_cfunc_t func"
+.Fa "const void *arg"
+.Fc
+.\" ------------------------------------------------------------
+.Ss "Eventhandlers"
+.\"
+.Fo VNET_GLOBAL_EVENTHANDLER_REGISTER
+.Fa "const char *name"
+.Fa "void *func"
+.Fa "void *arg"
+.Fa "int priority"
+.Fc
+.\"
+.Fo VNET_GLOBAL_EVENTHANDLER_REGISTER_TAG
+.Fa "eventhandler_tag tag"
+.Fa "const char *name"
+.Fa "void *func"
+.Fa "void *arg"
+.Fa "int priority"
+.Fc
+.\" ------------------------------------------------------------
+.Ss "Sysctl Handling"
+.Fo SYSCTL_VNET_INT
+.Fa parent nbr name access ptr val descr
+.Fc
+.Fo SYSCTL_VNET_PROC
+.Fa parent nbr name access ptr arg handler fmt descr
+.Fc
+.Fo SYSCTL_VNET_STRING
+.Fa parent nbr name access arg len descr
+.Fc
+.Fo SYSCTL_VNET_STRUCT
+.Fa parent nbr name access ptr type descr
+.Fc
+.Fo SYSCTL_VNET_UINT
+.Fa parent nbr name access ptr val descr
+.Fc
+.Fo VNET_SYSCTL_ARG
+.Fa req arg1
+.Fc
+.\" ------------------------------------------------------------
+.Sh DESCRIPTION
+.Nm
+is the name of a technique to virtualize the network stack.
+The basic idea is to change global resources most notably variables into
+per network stack resources and have functions, sysctls, eventhandlers,
+etc. access and handle them in the context of the correct instance.
+Each (virtual) network stack is attached to a
+.Em prison ,
+with
+.Vt vnet0
+being the unrestricted default network stack of the base system.
+.Pp
+The global defines for
+.Dv VNET_SETNAME
+and
+.Dv VNET_SYMPREFIX
+are shared with
+.Xr kvm 3
+to access internals for debugging reasons.
+.\" ------------------------------------------------------------
+.Ss "Variable Declaration"
+.\"
+Variables are virtualized by using the
+.Fn VNET_DEFINE
+macro rather than writing them out as
+.Em type name .
+One can still use static initialization or storage class specifiers, e.g.,
+.Pp
+.Dl Li static VNET_DEFINE(int, foo) = 1;
+or
+.Dl Li static VNET_DEFINE(SLIST_HEAD(, bar), bars);
+.Pp
+Static initialization is not possible when the virtualized variable
+would need to be referenced, e.g., with
+.Dq TAILQ_HEAD_INITIALIZER() .
+In that case a
+.Fn VNET_SYSINIT
+based initialization function must be used.
+.Pp
+External variables have to be declared using the
+.Fn VNET_DECLARE
+macro.
+In either case the convention is to define another macro,
+that is then used throughout the implementation to access that variable.
+The variable name is usually prefixed by
+.Em V_
+to express that it is virtualized.
+The
+.Fn VNET
+macro will then translate accesses to that variable to the copy of the
+currently selected instance (see the
+.Sx "Virtual instance selection"
+section):
+.Pp
+.Dl Li #define	V_name	VNET(name)
+.Pp
+.Em NOTE:
+Do not confuse this with the convention used by
+.Xr VFS 9 .
+.Pp
+The
+.Fn VNET_NAME
+macro returns the offset within the memory region of the virtual network
+stack instance.
+It is usually only used with
+.Fn SYSCTL_VNET_*
+macros.
+.\" ------------------------------------------------------------
+.Ss "Virtual Instance Selection"
+.\"
+There are three different places where the current virtual
+network stack pointer is stored and can be taken from:
+.Bl -enum -offset indent
+.It
+a
+.Em prison :
+.Dl "(struct prison *)->pr_vnet"
+.Pp
+For convenience the following macros are provided:
+.Bd -literal -compact -offset indent
+.Fn CRED_TO_VNET "struct ucred *"
+.Fn TD_TO_VNET "struct thread *"
+.Fn P_TO_VNET "struct proc *"
+.Ed
+.It
+a
+.Em socket :
+.Dl "(struct socket *)->so_vnet"
+.It
+an
+.Em interface :
+.Dl "(struct ifnet *)->if_vnet"
+.El
+.Pp
+.\"
+In addition the currently active instance is cached in
+.Dq "curthread->td_vnet"
+which is usually only accessed through the
+.Dv curvnet
+macro.
+.Pp
+.\"
+To set the correct context of the current virtual network instance, use the
+.Fn CURVNET_SET
+or
+.Fn CURVNET_SET_QUIET
+macros.
+The
+.Fn CURVNET_SET_QUIET
+version will not record vnet recursions in case the kernel was compiled
+with
+.Cd "options VNET_DEBUG"
+and should thus only be used in well known cases, where recursion is
+unavoidable.
+Both macros will save the previous state on the stack and it must be restored
+with the
+.Fn CURVNET_RESTORE
+macro.
+.Pp
+.Em NOTE:
+As the previous state is saved on the stack, you cannot have multiple
+.Fn CURVNET_SET
+calls in the same block.
+.Pp
+.Em NOTE:
+As the previous state is saved on the stack, a
+.Fn CURVNET_RESTORE
+call has to be in the same block as the
+.Fn CURVNET_SET
+call or in a subblock with the same idea of the saved instances as the
+outer block.
+.Pp
+.Em NOTE:
+As each macro is a set of operations and, as previously explained, cannot
+be put into its own block when defined, one cannot conditionally set
+the current vnet context.
+The following will
+.Em not
+work:
+.Bd -literal -offset indent
+if (condition)
+	CURVNET_SET(vnet);
+.Ed
+.Pp
+nor would this work:
+.Bd -literal -offset indent
+if (condition) {
+	CURVNET_SET(vnet);
+}
+CURVNET_RESTORE();
+.Ed
+.Pp
+.\"
+Sometimes one needs to loop over all virtual instances, for example to update
+virtual from global state, to run a function from a
+.Xr callout 9
+for each instance, etc.
+For those cases the
+.Fn VNET_ITERATOR_DECL
+and
+.Fn VNET_FOREACH
+macros are provided.
+The former macro defines the variable that iterates over the loop,
+and the latter loops over all of the virtual network stack instances.
+See
+.Sx "Locking"
+for how to savely traverse the list of all virtual instances.
+.Pp
+.\"
+The
+.Fn IS_DEFAULT_VNET
+macro provides a safe way to check whether the currently active instance is the
+unrestricted default network stack of the base system
+.Pq Vt vnet0 .
+.Pp
+.\"
+The
+.Fn VNET_ASSERT
+macro provides a way to conditionally add assertions that are only active with
+.Cd "options VIMAGE"
+compiled in and either
+.Cd "options VNET_DEBUG"
+or
+.Cd "options INVARIANTS"
+enabled as well.
+It uses the same semantics as
+.Xr KASSERT 9 .
+.\" ------------------------------------------------------------
+.Ss "Locking"
+.\"
+For public access to the list of virtual network stack instances
+e.g., by the
+.Fn VNET_FOREACH
+macro, read locks are provided.
+Macros are used to abstract from the actual type of the locks.
+If a caller may sleep while traversing the list, it must use the
+.Fn VNET_LIST_RLOCK
+and
+.Fn VNET_LIST_RUNLOCK
+macros.
+Otherwise, the caller can use
+.Fn VNET_LIST_RLOCK_NOSLEEP
+and
+.Fn VNET_LIST_RUNLOCK_NOSLEEP .
+.\" ------------------------------------------------------------
+.Ss "Startup and Teardown Functions"
+.\"
+To start or tear down a virtual network stack instance the internal
+functions
+.Fn vnet_alloc
+and
+.Fn vnet_destroy
+are provided and called from the jail framework.
+They run the publicly provided methods to handle network stack
+startup and teardown.
+.Pp
+For public control, the system startup interface has been enhanced
+to not only handle a system boot but to also handle a virtual
+network stack startup and teardown.
+To the base system the
+.Fn VNET_SYSINIT
+and
+.Fn VNET_SYSUNINIT
+macros look exactly as if there were no virtual network stack.
+In fact, if
+.Cd "options VIMAGE"
+is not compiled in they are compiled to the standard
+.Fn SYSINIT
+macros.
+In addition to that they are run for each virtual network stack
+when starting or, in reverse order, when shutting down.
+.\" ------------------------------------------------------------
+.Ss "Eventhandlers"
+.\"
+Eventhandlers can be handled in two ways:
+.Pp
+.Bl -enum -offset indent -compact
+.It
+save the
+.Em tags
+returned in each virtual instance and properly free the eventhandlers
+on teardown using those, or
+.It
+use one eventhandler that will iterate over all virtual network
+stack instances.
+.El
+.Pp
+For the first case one can just use the normal
+.Xr EVENTHANDLER 9
+functions, while for the second case the
+.Fn VNET_GLOBAL_EVENTHANDLER_REGISTER
+and
+.Fn VNET_GLOBAL_EVENTHANDLER_REGISTER_TAG
+macros are provided.
+These differ in that
+.Fn VNET_GLOBAL_EVENTHANDLER_REGISTER_TAG
+takes an extra first argument that will carry the
+.Fa "tag"
+upon return.
+Eventhandlers registered with either of these will not run
+.Fa func
+directly but
+.Fa func
+will be called from an internal iterator function for each vnet.
+Both macros can only be used for eventhandlers that do not take
+additional arguments, as the variadic arguments from an
+.Xr EVENTHANDLER_INVOKE 9
+call will be ignored.
+.\" ------------------------------------------------------------
+.Ss "Sysctl Handling"
+.\"
+A
+.Xr sysctl 9
+can be virtualized by using one of the
+.Fn SYSCTL_VNET_*
+macros.
+.Pp
+They take the same arguments as the standard
+.Xr sysctl 9
+functions, with the only difference, that the
+.Fa ptr
+argument has to be passed as
+.Ql &VNET_NAME(foo)
+instead of
+.Ql &foo
+so that the variable can be selected from the correct memory
+region of the virtual network stack instance of the caller.
+.Pp
+For the very rare case a sysctl handler function would want to
+handle
+.Fa arg1
+itself the
+.Fn VNET_SYSCTL_ARG req arg1
+is provided that will translate the
+.Fa arg1
+argument to the correct memory address in the virtual network stack
+context of the caller.
+.\" ------------------------------------------------------------
+.Sh SEE ALSO
+.Xr jail 2 ,
+.Xr kvm 3 ,
+.Xr EVENTHANDLER 9 ,
+.\" .Xr pcpu 9 ,
+.Xr KASSERT 9 ,
+.Xr sysctl 9
+.\" .Xr SYSINIT 9
+.Sh HISTORY
+The virtual network stack implementation first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Bjoern A. Zeeb, CK Software GmbH,
+under sponsorship from the FreeBSD Foundation.

Modified: projects/sendfile/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- projects/sendfile/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Thu Nov 20 21:54:32 2014	(r274762)
@@ -33,6 +33,9 @@ static const char rcsid[] = "@(#)$Id$";
 #include <sys/time.h>
 #include <sys/systm.h>
 # include <sys/dirent.h>
+#if defined(__FreeBSD_version) && (__FreeBSD_version >= 800000)
+#include <sys/jail.h>
+#endif
 # include <sys/mbuf.h>
 # include <sys/sockopt.h>
 #if !defined(__hpux)
@@ -52,6 +55,12 @@ static const char rcsid[] = "@(#)$Id$";
 #include <netinet/ip.h>
 #include <netinet/ip_var.h>
 #include <netinet/tcp.h>
+#if defined(__FreeBSD_version) && (__FreeBSD_version >= 800000)
+#include <net/vnet.h>
+#else
+#define CURVNET_SET(arg)
+#define CURVNET_RESTORE()
+#endif
 #if defined(__osf__)
 # include <netinet/tcp_timer.h>
 #endif
@@ -323,7 +332,9 @@ ipfioctl(dev, cmd, data, mode
 
 	SPL_NET(s);
 
+	CURVNET_SET(TD_TO_VNET(p));
 	error = ipf_ioctlswitch(&ipfmain, unit, data, cmd, mode, p->p_uid, p);
+	CURVNET_RESTORE();
 	if (error != -1) {
 		SPL_X(s);
 		return error;

Modified: projects/sendfile/sys/dev/cxgbe/common/common.h
==============================================================================
--- projects/sendfile/sys/dev/cxgbe/common/common.h	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/dev/cxgbe/common/common.h	Thu Nov 20 21:54:32 2014	(r274762)
@@ -238,6 +238,7 @@ struct vpd_params {
 
 struct pci_params {
 	unsigned int vpd_cap_addr;
+	unsigned int mps;
 	unsigned short speed;
 	unsigned short width;
 };

Modified: projects/sendfile/sys/dev/cxgbe/t4_main.c
==============================================================================
--- projects/sendfile/sys/dev/cxgbe/t4_main.c	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/dev/cxgbe/t4_main.c	Thu Nov 20 21:54:32 2014	(r274762)
@@ -594,6 +594,8 @@ t4_attach(device_t dev)
 		v = pci_read_config(dev, i + PCIER_DEVICE_CTL, 2);
 		v |= PCIEM_CTL_RELAXED_ORD_ENABLE;
 		pci_write_config(dev, i + PCIER_DEVICE_CTL, v, 2);
+
+		sc->params.pci.mps = 128 << ((v & PCIEM_CTL_MAX_PAYLOAD) >> 5);
 	}
 
 	sc->traceq = -1;

Modified: projects/sendfile/sys/dev/fdt/fdt_common.c
==============================================================================
--- projects/sendfile/sys/dev/fdt/fdt_common.c	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/dev/fdt/fdt_common.c	Thu Nov 20 21:54:32 2014	(r274762)
@@ -1,7 +1,9 @@
 /*-
- * Copyright (c) 2009-2010 The FreeBSD Foundation
+ * Copyright (c) 2009-2014 The FreeBSD Foundation
  * All rights reserved.
  *
+ * This software was developed by Andrew Turner under sponsorship from
+ * the FreeBSD Foundation.
  * This software was developed by Semihalf under sponsorship from
  * the FreeBSD Foundation.
  *
@@ -64,12 +66,84 @@ vm_offset_t fdt_immr_size;
 
 struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head);
 
+static int
+fdt_get_range_by_busaddr(phandle_t node, u_long addr, u_long *base,
+    u_long *size)
+{
+	pcell_t ranges[32], *rangesptr;
+	pcell_t addr_cells, size_cells, par_addr_cells;
+	u_long bus_addr, par_bus_addr, pbase, psize;
+	int err, i, len, tuple_size, tuples;
+
+	if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0)
+		return (ENXIO);
+	/*
+	 * Process 'ranges' property.
+	 */
+	par_addr_cells = fdt_parent_addr_cells(node);
+	if (par_addr_cells > 2) {
+		return (ERANGE);
+	}
+
+	len = OF_getproplen(node, "ranges");
+	if (len < 0)
+		return (-1);
+	if (len > sizeof(ranges))
+		return (ENOMEM);
+	if (len == 0) {
+		*base = 0;
+		*size = ULONG_MAX;
+		return (0);
+	}
+
+	if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0)
+		return (EINVAL);
+
+	tuple_size = addr_cells + par_addr_cells + size_cells;
+	tuples = len / (tuple_size * sizeof(cell_t));
+
+	if (fdt_ranges_verify(ranges, tuples, par_addr_cells,
+	    addr_cells, size_cells)) {
+		return (ERANGE);
+	}
+	*base = 0;
+	*size = 0;
+
+	for (i = 0; i < tuples; i++) {
+		rangesptr = &ranges[i * tuple_size];
+
+		bus_addr = fdt_data_get((void *)rangesptr, addr_cells);
+		if (bus_addr != addr)
+			continue;
+		rangesptr += addr_cells;
+
+		par_bus_addr = fdt_data_get((void *)rangesptr, par_addr_cells);
+		rangesptr += par_addr_cells;
+
+		err = fdt_get_range_by_busaddr(OF_parent(node), par_bus_addr,
+		    &pbase, &psize);
+		if (err > 0)
+			return (err);
+		if (err == 0)
+			*base = pbase;
+		else
+			*base = par_bus_addr;
+
+		*size = fdt_data_get((void *)rangesptr, size_cells);
+
+		return (0);
+	}
+
+	return (EINVAL);
+}
+
 int
 fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size)
 {
 	pcell_t ranges[6], *rangesptr;
 	pcell_t addr_cells, size_cells, par_addr_cells;
-	int len, tuple_size, tuples;
+	u_long par_bus_addr, pbase, psize;
+	int err, len, tuple_size, tuples;
 
 	if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0)
 		return (ENXIO);
@@ -109,8 +183,17 @@ fdt_get_range(phandle_t node, int range_
 
 	*base = fdt_data_get((void *)rangesptr, addr_cells);
 	rangesptr += addr_cells;
-	*base += fdt_data_get((void *)rangesptr, par_addr_cells);
+
+	par_bus_addr = fdt_data_get((void *)rangesptr, par_addr_cells);
 	rangesptr += par_addr_cells;
+
+	err = fdt_get_range_by_busaddr(OF_parent(node), par_bus_addr,
+	   &pbase, &psize);
+	if (err == 0)
+		*base += pbase;
+	else
+		*base += par_bus_addr;
+
 	*size = fdt_data_get((void *)rangesptr, size_cells);
 	return (0);
 }
@@ -292,7 +375,7 @@ fdt_parent_addr_cells(phandle_t node)
 	/* Find out #address-cells of the superior bus. */
 	if (OF_searchprop(OF_parent(node), "#address-cells", &addr_cells,
 	    sizeof(addr_cells)) <= 0)
-		addr_cells = 2;
+		return (2);
 
 	return ((int)fdt32_to_cpu(addr_cells));
 }

Modified: projects/sendfile/sys/mips/conf/MALTA
==============================================================================
--- projects/sendfile/sys/mips/conf/MALTA	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/mips/conf/MALTA	Thu Nov 20 21:54:32 2014	(r274762)
@@ -68,3 +68,4 @@ device		miibus
 device		bpf
 device		md
 device		uart
+device		random

Modified: projects/sendfile/sys/mips/conf/MALTA64
==============================================================================
--- projects/sendfile/sys/mips/conf/MALTA64	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/mips/conf/MALTA64	Thu Nov 20 21:54:32 2014	(r274762)
@@ -53,7 +53,7 @@ options 	FFS			#Berkeley Fast Filesystem
 options 	SOFTUPDATES		#Enable FFS soft updates support
 options 	UFS_ACL			#Support for access control lists
 options 	UFS_DIRHASH		#Improve performance on big directories
-options 	ROOTDEVNAME=\"ufs:ada0s1a\"
+options 	ROOTDEVNAME=\"ufs:ada0\"
 
 
 # Debugging for use in -current
@@ -70,3 +70,4 @@ device		miibus
 device		md
 device		bpf
 device		uart
+device		random

Modified: projects/sendfile/sys/mips/include/cache_mipsNN.h
==============================================================================
--- projects/sendfile/sys/mips/include/cache_mipsNN.h	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/mips/include/cache_mipsNN.h	Thu Nov 20 21:54:32 2014	(r274762)
@@ -67,5 +67,15 @@ void	mipsNN_pdcache_wbinv_range_index_12
 void	mipsNN_pdcache_inv_range_128(vm_offset_t, vm_size_t);
 void	mipsNN_pdcache_wb_range_128(vm_offset_t, vm_size_t);
 #endif
+void	mipsNN_sdcache_wbinv_all_32(void);
+void	mipsNN_sdcache_wbinv_range_32(vm_paddr_t, vm_size_t);
+void	mipsNN_sdcache_wbinv_range_index_32(vm_paddr_t, vm_size_t);
+void	mipsNN_sdcache_inv_range_32(vm_paddr_t, vm_size_t);
+void	mipsNN_sdcache_wb_range_32(vm_paddr_t, vm_size_t);
+void	mipsNN_sdcache_wbinv_all_128(void);
+void	mipsNN_sdcache_wbinv_range_128(vm_paddr_t, vm_size_t);
+void	mipsNN_sdcache_wbinv_range_index_128(vm_paddr_t, vm_size_t);
+void	mipsNN_sdcache_inv_range_128(vm_paddr_t, vm_size_t);
+void	mipsNN_sdcache_wb_range_128(vm_paddr_t, vm_size_t);
 
 #endif	/* _MACHINE_CACHE_MIPSNN_H_ */

Modified: projects/sendfile/sys/mips/include/cpuinfo.h
==============================================================================
--- projects/sendfile/sys/mips/include/cpuinfo.h	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/mips/include/cpuinfo.h	Thu Nov 20 21:54:32 2014	(r274762)
@@ -67,6 +67,12 @@ struct mips_cpuinfo {
 		u_int8_t	dc_nways;
 		u_int16_t	dc_nsets;
 	} l1;
+	struct {
+		u_int32_t	dc_size;
+		u_int8_t	dc_linesize;
+		u_int8_t	dc_nways;
+		u_int16_t	dc_nsets;
+	} l2;
 };
 
 extern struct mips_cpuinfo cpuinfo;

Modified: projects/sendfile/sys/mips/include/cpuregs.h
==============================================================================
--- projects/sendfile/sys/mips/include/cpuregs.h	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/mips/include/cpuregs.h	Thu Nov 20 21:54:32 2014	(r274762)
@@ -550,6 +550,13 @@
 #define MIPS_CONFIG1_EP			0x00000002	/* EJTAG implemented */
 #define MIPS_CONFIG1_FP			0x00000001	/* FPU implemented */
 
+#define MIPS_CONFIG2_SA_SHIFT		0		/* Secondary cache associativity */
+#define MIPS_CONFIG2_SA_MASK		0xf
+#define MIPS_CONFIG2_SL_SHIFT		4		/* Secondary cache line size */
+#define MIPS_CONFIG2_SL_MASK		0xf
+#define MIPS_CONFIG2_SS_SHIFT		8		/* Secondary cache sets per way */
+#define MIPS_CONFIG2_SS_MASK		0xf
+
 #define MIPS_CONFIG4_MMUSIZEEXT		0x000000FF	/* bits 7.. 0 MMU Size Extension */
 #define MIPS_CONFIG4_MMUEXTDEF		0x0000C000	/* bits 15.14 MMU Extension Definition */
 #define MIPS_CONFIG4_MMUEXTDEF_MMUSIZEEXT	0x00004000 /* This values denotes CONFIG4 bits  */

Modified: projects/sendfile/sys/mips/mips/cache.c
==============================================================================
--- projects/sendfile/sys/mips/mips/cache.c	Thu Nov 20 21:18:19 2014	(r274761)
+++ projects/sendfile/sys/mips/mips/cache.c	Thu Nov 20 21:54:32 2014	(r274762)
@@ -260,19 +260,42 @@ mips_config_cache(struct mips_cpuinfo * 
 			panic("no pdcache_wb_range");
 	}
 
-	/* XXXMIPS: No secondary cache handlers yet */
-#ifdef notyet
-	if (mips_sdcache_size) {
-		if (!mips_cache_ops.mco_sdcache_wbinv_all)
-			panic("no sdcache_wbinv_all");
-		if (!mips_cache_ops.mco_sdcache_wbinv_range)
-			panic("no sdcache_wbinv_range");
-		if (!mips_cache_ops.mco_sdcache_wbinv_range_index)
-			panic("no sdcache_wbinv_range_index");
-		if (!mips_cache_ops.mco_sdcache_inv_range)
-			panic("no sdcache_inv_range");
-		if (!mips_cache_ops.mco_sdcache_wb_range)
-			panic("no sdcache_wb_range");
+	/* L2 data cache */
+	if (!cpuinfo->l2.dc_size) {
+		/* No L2 found, ignore */
+		return;
 	}
+
+	switch (cpuinfo->l2.dc_linesize) {
+	case 32:
+		mips_cache_ops.mco_sdcache_wbinv_all =
+			mipsNN_sdcache_wbinv_all_32;
+		mips_cache_ops.mco_sdcache_wbinv_range =
+			mipsNN_sdcache_wbinv_range_32;
+		mips_cache_ops.mco_sdcache_wbinv_range_index =
+			mipsNN_sdcache_wbinv_range_index_32;
+		mips_cache_ops.mco_sdcache_inv_range =
+			mipsNN_sdcache_inv_range_32;
+		mips_cache_ops.mco_sdcache_wb_range =
+			mipsNN_sdcache_wb_range_32;
+		break;
+	case 128:
+		mips_cache_ops.mco_sdcache_wbinv_all =
+			mipsNN_sdcache_wbinv_all_128;
+		mips_cache_ops.mco_sdcache_wbinv_range =
+			mipsNN_sdcache_wbinv_range_128;

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411202154.sAKLsWs8031514>