From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 07:09:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8F8E106566B; Sun, 26 Apr 2009 07:09:39 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C6F18FC14; Sun, 26 Apr 2009 07:09:39 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3Q79dda075150; Sun, 26 Apr 2009 07:09:39 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3Q79doO075148; Sun, 26 Apr 2009 07:09:39 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200904260709.n3Q79doO075148@svn.freebsd.org> From: Marko Zec Date: Sun, 26 Apr 2009 07:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191508 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 07:09:40 -0000 Author: zec Date: Sun Apr 26 07:09:39 2009 New Revision: 191508 URL: http://svn.freebsd.org/changeset/base/191508 Log: Extend the vnet module registration / initialization framework first introduced @ r190909 with a vnet module deregistration service. kldunloadable modules, which are currently using vnet_mod_register() to attach their per-vnet initialization routines to the vnet initialization framework, should call vnet_mod_deregister() before acknowledging MOD_UNLOAD requests in their mod_event handlers. Such changes to the existing code base will follow in subsequent commits. vnet_mod_deregister() does not check whether departing vnet modules are registered as prerequisites for another module(s), so it should be used with care. Currently I'm only aware of vnet modules which are leafs on module dependency graphs that are kldunloadable. This change also introduces per-vnet module destructor handler, which calls vnet's module cleanup function, which (if required) has to be registered in vnet module's vnet_modinfo_t structure .vmi_idetach field. Once options VIMAGE becomes operational, the framework will take care that module's cleanup function become invoked for each active vnet instance, and that the memory allocated for each instance gets freed. Currently calls to destructor handlers must always succeed. Modified: head/sys/kern/kern_vimage.c head/sys/sys/vimage.h Modified: head/sys/kern/kern_vimage.c ============================================================================== --- head/sys/kern/kern_vimage.c Sun Apr 26 03:55:08 2009 (r191507) +++ head/sys/kern/kern_vimage.c Sun Apr 26 07:09:39 2009 (r191508) @@ -47,6 +47,7 @@ static TAILQ_HEAD(vnet_modlink_head, vne static TAILQ_HEAD(vnet_modpending_head, vnet_modlink) vnet_modpending_head; static void vnet_mod_complete_registration(struct vnet_modlink *); static int vnet_mod_constructor(struct vnet_modlink *); +static int vnet_mod_destructor(struct vnet_modlink *); void vnet_mod_register(const struct vnet_modinfo *vmi) @@ -144,6 +145,37 @@ vnet_mod_complete_registration(struct vn } while (vml_iter != NULL); } +void +vnet_mod_deregister(const struct vnet_modinfo *vmi) +{ + + vnet_mod_deregister_multi(vmi, NULL, NULL); +} + +void +vnet_mod_deregister_multi(const struct vnet_modinfo *vmi, void *iarg, + char *iname) +{ + VNET_ITERATOR_DECL(vnet_iter); + struct vnet_modlink *vml; + + TAILQ_FOREACH(vml, &vnet_modlink_head, vml_mod_le) + if (vml->vml_modinfo == vmi && vml->vml_iarg == iarg) + break; + if (vml == NULL) + panic("cannot deregister unregistered vnet module %s", + vmi->vmi_name); + + VNET_FOREACH(vnet_iter) { + CURVNET_SET_QUIET(vnet_iter); + vnet_mod_destructor(vml); + CURVNET_RESTORE(); + } + + TAILQ_REMOVE(&vnet_modlink_head, vml, vml_mod_le); + free(vml, M_VIMAGE); +} + static int vnet_mod_constructor(struct vnet_modlink *vml) { const struct vnet_modinfo *vmi = vml->vml_modinfo; @@ -153,16 +185,18 @@ static int vnet_mod_constructor(struct v if (vml->vml_iarg) printf("/%s", vml->vml_iname); printf(": "); - if (vmi->vmi_struct_size) - printf("malloc(%zu); ", vmi->vmi_struct_size); +#ifdef VIMAGE + if (vmi->vmi_size) + printf("malloc(%zu); ", vmi->vmi_size); +#endif if (vmi->vmi_iattach != NULL) printf("iattach()"); printf("\n"); #endif #ifdef VIMAGE - if (vmi->vmi_struct_size) { - void *mem = malloc(vmi->vmi_struct_size, M_VNET, + if (vmi->vmi_size) { + void *mem = malloc(vmi->vmi_size, M_VNET, M_NOWAIT | M_ZERO); if (mem == NULL) /* XXX should return error, not panic. */ panic("vi_alloc: malloc for %s\n", vmi->vmi_name); @@ -176,6 +210,41 @@ static int vnet_mod_constructor(struct v return (0); } + +static int +vnet_mod_destructor(struct vnet_modlink *vml) +{ + const struct vnet_modinfo *vmi = vml->vml_modinfo; + +#ifdef DEBUG_ORDERING + printf("destroying vnet_%s", vmi->vmi_name); + if (vml->vml_iarg) + printf("/%s", vml->vml_iname); + printf(": "); + if (vmi->vmi_idetach != NULL) + printf("idetach(); "); +#ifdef VIMAGE + if (vmi->vmi_size) + printf("free()"); +#endif + printf("\n"); +#endif + + if (vmi->vmi_idetach) + vmi->vmi_idetach(vml->vml_iarg); + +#ifdef VIMAGE + if (vmi->vmi_size) { + if (curvnet->mod_data[vmi->vmi_id] == NULL) + panic("vi_destroy: %s\n", vmi->vmi_name); + free(curvnet->mod_data[vmi->vmi_id], M_VNET); + curvnet->mod_data[vmi->vmi_id] = NULL; + } +#endif + + return (0); +} + /* * vi_symlookup() attempts to resolve name to address queries for * variables which have been moved from global namespace to virtualization Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Sun Apr 26 03:55:08 2009 (r191507) +++ head/sys/sys/vimage.h Sun Apr 26 07:09:39 2009 (r191508) @@ -121,6 +121,8 @@ struct vnet_modlink { int vi_symlookup(struct kld_sym_lookup *, char *); void vnet_mod_register(const struct vnet_modinfo *); void vnet_mod_register_multi(const struct vnet_modinfo *, void *, char *); +void vnet_mod_deregister(const struct vnet_modinfo *); +void vnet_mod_deregister_multi(const struct vnet_modinfo *, void *, char *); #endif /* !VIMAGE_GLOBALS */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 07:12:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB74F106566B; Sun, 26 Apr 2009 07:12:04 +0000 (UTC) (envelope-from blackend@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9EB08FC12; Sun, 26 Apr 2009 07:12:04 +0000 (UTC) (envelope-from blackend@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3Q7C4tv075253; Sun, 26 Apr 2009 07:12:04 GMT (envelope-from blackend@svn.freebsd.org) Received: (from blackend@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3Q7C4YT075252; Sun, 26 Apr 2009 07:12:04 GMT (envelope-from blackend@svn.freebsd.org) Message-Id: <200904260712.n3Q7C4YT075252@svn.freebsd.org> From: Marc Fonvieille Date: Sun, 26 Apr 2009 07:12:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191509 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 07:12:05 -0000 Author: blackend (doc committer) Date: Sun Apr 26 07:12:04 2009 New Revision: 191509 URL: http://svn.freebsd.org/changeset/base/191509 Log: Unbreak the build of relnotes. Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sun Apr 26 07:09:39 2009 (r191508) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sun Apr 26 07:12:04 2009 (r191509) @@ -523,7 +523,7 @@ The following &ultrasparc; IIIi systems are not tested but - believed to be also supported by &os. + believed to be also supported by &os;: From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 07:14:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF2A31065675; Sun, 26 Apr 2009 07:14:50 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD5B58FC1F; Sun, 26 Apr 2009 07:14:50 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3Q7Eo4G075340; Sun, 26 Apr 2009 07:14:50 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3Q7EoBA075335; Sun, 26 Apr 2009 07:14:50 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200904260714.n3Q7EoBA075335@svn.freebsd.org> From: Marko Zec Date: Sun, 26 Apr 2009 07:14:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191510 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 07:14:51 -0000 Author: zec Date: Sun Apr 26 07:14:50 2009 New Revision: 191510 URL: http://svn.freebsd.org/changeset/base/191510 Log: In preparation to make options VIMAGE operational, where needed, initialize / release netgraph related state in iattach() / idetach() functions called via the vnet module registration / initialization framework, instead of initialization / cleanups being done in mod_event handlers. While here, introduce a crude hack aimed at preventing ng_ether to autoattach to ng_eiface ifnets, which are also netgraph nodes already. Reviewed by: bz Approved by: julian (mentor) Modified: head/sys/netgraph/netgraph.h head/sys/netgraph/ng_base.c head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_ether.c head/sys/netgraph/ng_iface.c Modified: head/sys/netgraph/netgraph.h ============================================================================== --- head/sys/netgraph/netgraph.h Sun Apr 26 07:12:04 2009 (r191509) +++ head/sys/netgraph/netgraph.h Sun Apr 26 07:14:50 2009 (r191510) @@ -1123,6 +1123,7 @@ hook_p ng_findhook(node_p node, const ch struct ng_type *ng_findtype(const char *type); int ng_make_node_common(struct ng_type *typep, node_p *nodep); int ng_name_node(node_p node, const char *name); +node_p ng_name2noderef(node_p node, const char *name); int ng_newtype(struct ng_type *tp); ng_ID_t ng_node2ID(node_p node); item_p ng_package_data(struct mbuf *m, int flags); Modified: head/sys/netgraph/ng_base.c ============================================================================== --- head/sys/netgraph/ng_base.c Sun Apr 26 07:12:04 2009 (r191509) +++ head/sys/netgraph/ng_base.c Sun Apr 26 07:14:50 2009 (r191510) @@ -84,6 +84,8 @@ struct vnet_netgraph vnet_netgraph_0; /* Mutex to protect topology events. */ static struct mtx ng_topo_mtx; +static vnet_attach_fn vnet_netgraph_iattach; + #ifdef NETGRAPH_DEBUG static struct mtx ng_nodelist_mtx; /* protects global node/hook lists */ static struct mtx ngq_mtx; /* protects the queue item list */ @@ -227,7 +229,6 @@ static int ng_mkpeer(node_p node, const /* Imported, these used to be externally visible, some may go back. */ void ng_destroy_hook(hook_p hook); -node_p ng_name2noderef(node_p node, const char *name); int ng_path2noderef(node_p here, const char *path, node_p *dest, hook_p *lasthook); int ng_make_node(const char *type, node_p *nodepp); @@ -3068,6 +3069,27 @@ ng_mod_event(module_t mod, int event, vo return (error); } +#ifndef VIMAGE_GLOBALS +static const vnet_modinfo_t vnet_netgraph_modinfo = { + .vmi_id = VNET_MOD_NETGRAPH, + .vmi_name = "netgraph", +#ifdef VIMAGE + .vmi_size = sizeof(struct vnet_netgraph), +#endif + .vmi_iattach = vnet_netgraph_iattach +}; +#endif + +static int +vnet_netgraph_iattach(const void *arg __unused) +{ + INIT_VNET_NETGRAPH(curvnet); + + V_nextID = 1; + + return (0); +} + /* * Handle loading and unloading for this code. * The only thing we need to link into is the NETISR strucure. @@ -3082,7 +3104,11 @@ ngb_mod_event(module_t mod, int event, v switch (event) { case MOD_LOAD: /* Initialize everything. */ - V_nextID = 1; +#ifndef VIMAGE_GLOBALS + vnet_mod_register(&vnet_netgraph_modinfo); +#else + vnet_netgraph_iattach(NULL); +#endif NG_WORKLIST_LOCK_INIT(); mtx_init(&ng_typelist_mtx, "netgraph types mutex", NULL, MTX_DEF); Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Sun Apr 26 07:12:04 2009 (r191509) +++ head/sys/netgraph/ng_eiface.c Sun Apr 26 07:14:50 2009 (r191510) @@ -113,10 +113,23 @@ static struct ng_type typestruct = { }; NETGRAPH_INIT(eiface, &typestruct); +static vnet_attach_fn ng_eiface_iattach; +static vnet_detach_fn ng_eiface_idetach; + #ifdef VIMAGE_GLOBALS static struct unrhdr *ng_eiface_unit; #endif +#ifndef VIMAGE_GLOBALS +static vnet_modinfo_t vnet_ng_eiface_modinfo = { + .vmi_id = VNET_MOD_NG_EIFACE, + .vmi_name = "ng_eiface", + .vmi_dependson = VNET_MOD_NETGRAPH, + .vmi_iattach = ng_eiface_iattach, + .vmi_idetach = ng_eiface_idetach +}; +#endif + /************************************************************************ INTERFACE STUFF ************************************************************************/ @@ -590,10 +603,18 @@ ng_eiface_mod_event(module_t mod, int ev switch (event) { case MOD_LOAD: - V_ng_eiface_unit = new_unrhdr(0, 0xffff, NULL); +#ifndef VIMAGE_GLOBALS + vnet_mod_register(&vnet_ng_eiface_modinfo); +#else + ng_eiface_iattach(NULL); +#endif break; case MOD_UNLOAD: - delete_unrhdr(V_ng_eiface_unit); +#ifndef VIMAGE_GLOBALS + vnet_mod_deregister(&vnet_ng_eiface_modinfo); +#else + ng_eiface_idetach(NULL); +#endif break; default: error = EOPNOTSUPP; @@ -601,3 +622,21 @@ ng_eiface_mod_event(module_t mod, int ev } return (error); } + +static int ng_eiface_iattach(const void *unused) +{ + INIT_VNET_NETGRAPH(curvnet); + + V_ng_eiface_unit = new_unrhdr(0, 0xffff, NULL); + + return (0); +} + +static int ng_eiface_idetach(const void *unused) +{ + INIT_VNET_NETGRAPH(curvnet); + + delete_unrhdr(V_ng_eiface_unit); + + return (0); +} Modified: head/sys/netgraph/ng_ether.c ============================================================================== --- head/sys/netgraph/ng_ether.c Sun Apr 26 07:12:04 2009 (r191509) +++ head/sys/netgraph/ng_ether.c Sun Apr 26 07:14:50 2009 (r191510) @@ -75,6 +75,17 @@ #define IFP2NG(ifp) (IFP2AC((ifp))->ac_netgraph) +static vnet_attach_fn ng_ether_iattach; + +#ifndef VIMAGE_GLOBALS +static vnet_modinfo_t vnet_ng_ether_modinfo = { + .vmi_id = VNET_MOD_NG_ETHER, + .vmi_name = "ng_ether", + .vmi_dependson = VNET_MOD_NETGRAPH, + .vmi_iattach = ng_ether_iattach, +}; +#endif + /* Per-node private data */ struct private { struct ifnet *ifp; /* associated interface */ @@ -287,6 +298,18 @@ ng_ether_attach(struct ifnet *ifp) priv_p priv; node_p node; + /* + * Do not create / attach an ether node to this ifnet if + * a netgraph node with the same name already exists. + * This should prevent ether nodes to become attached to + * eiface nodes, which may be problematic due to naming + * clashes. + */ + if ((node = ng_name2noderef(NULL, ifp->if_xname)) != NULL) { + NG_NODE_UNREF(node); + return; + } + /* Create node */ KASSERT(!IFP2NG(ifp), ("%s: node already exists?", __func__)); if (ng_make_node_common(&ng_ether_typestruct, &node) != 0) { @@ -741,7 +764,6 @@ ng_ether_disconnect(hook_p hook) static int ng_ether_mod_event(module_t mod, int event, void *data) { - struct ifnet *ifp; int error = 0; int s; @@ -761,14 +783,11 @@ ng_ether_mod_event(module_t mod, int eve ng_ether_input_orphan_p = ng_ether_input_orphan; ng_ether_link_state_p = ng_ether_link_state; - /* Create nodes for any already-existing Ethernet interfaces */ - IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_type == IFT_ETHER - || ifp->if_type == IFT_L2VLAN) - ng_ether_attach(ifp); - } - IFNET_RUNLOCK(); +#ifndef VIMAGE_GLOBALS + vnet_mod_register(&vnet_ng_ether_modinfo); +#else + error = ng_ether_iattach(NULL); +#endif break; case MOD_UNLOAD: @@ -781,6 +800,10 @@ ng_ether_mod_event(module_t mod, int eve * is MOD_UNLOAD, so there's no need to detach any nodes. */ +#ifndef VIMAGE_GLOBALS + vnet_mod_deregister(&vnet_ng_ether_modinfo); +#endif + /* Unregister function hooks */ ng_ether_attach_p = NULL; ng_ether_detach_p = NULL; @@ -798,3 +821,19 @@ ng_ether_mod_event(module_t mod, int eve return (error); } +static int ng_ether_iattach(const void *unused) +{ + INIT_VNET_NET(curvnet); + struct ifnet *ifp; + + /* Create nodes for any already-existing Ethernet interfaces. */ + IFNET_RLOCK(); + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + if (ifp->if_type == IFT_ETHER + || ifp->if_type == IFT_L2VLAN) + ng_ether_attach(ifp); + } + IFNET_RUNLOCK(); + + return (0); +} Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Sun Apr 26 07:12:04 2009 (r191509) +++ head/sys/netgraph/ng_iface.c Sun Apr 26 07:14:50 2009 (r191510) @@ -209,10 +209,23 @@ static struct ng_type typestruct = { }; NETGRAPH_INIT(iface, &typestruct); +static vnet_attach_fn ng_iface_iattach; +static vnet_detach_fn ng_iface_idetach; + #ifdef VIMAGE_GLOBALS static struct unrhdr *ng_iface_unit; #endif +#ifndef VIMAGE_GLOBALS +static vnet_modinfo_t vnet_ng_iface_modinfo = { + .vmi_id = VNET_MOD_NG_IFACE, + .vmi_name = "ng_iface", + .vmi_dependson = VNET_MOD_NETGRAPH, + .vmi_iattach = ng_iface_iattach, + .vmi_idetach = ng_iface_idetach +}; +#endif + /************************************************************************ HELPER STUFF ************************************************************************/ @@ -836,10 +849,18 @@ ng_iface_mod_event(module_t mod, int eve switch (event) { case MOD_LOAD: - V_ng_iface_unit = new_unrhdr(0, 0xffff, NULL); +#ifndef VIMAGE_GLOBALS + vnet_mod_register(&vnet_ng_iface_modinfo); +#else + ng_iface_iattach(NULL); +#endif break; case MOD_UNLOAD: - delete_unrhdr(V_ng_iface_unit); +#ifndef VIMAGE_GLOBALS + vnet_mod_deregister(&vnet_ng_iface_modinfo); +#else + ng_iface_idetach(NULL); +#endif break; default: error = EOPNOTSUPP; @@ -847,3 +868,21 @@ ng_iface_mod_event(module_t mod, int eve } return (error); } + +static int ng_iface_iattach(const void *unused) +{ + INIT_VNET_NETGRAPH(curvnet); + + V_ng_iface_unit = new_unrhdr(0, 0xffff, NULL); + + return (0); +} + +static int ng_iface_idetach(const void *unused) +{ + INIT_VNET_NETGRAPH(curvnet); + + delete_unrhdr(V_ng_iface_unit); + + return (0); +} From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 07:16:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5222106566B; Sun, 26 Apr 2009 07:16:01 +0000 (UTC) (envelope-from blackend@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3B508FC1E; Sun, 26 Apr 2009 07:16:01 +0000 (UTC) (envelope-from blackend@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3Q7G1rK075406; Sun, 26 Apr 2009 07:16:01 GMT (envelope-from blackend@svn.freebsd.org) Received: (from blackend@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3Q7G1RA075405; Sun, 26 Apr 2009 07:16:01 GMT (envelope-from blackend@svn.freebsd.org) Message-Id: <200904260716.n3Q7G1RA075405@svn.freebsd.org> From: Marc Fonvieille Date: Sun, 26 Apr 2009 07:16:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191511 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 07:16:02 -0000 Author: blackend (doc committer) Date: Sun Apr 26 07:16:01 2009 New Revision: 191511 URL: http://svn.freebsd.org/changeset/base/191511 Log: Bump copyright year; Add missing colon and fix broken entity. Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sun Apr 26 07:14:50 2009 (r191510) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sun Apr 26 07:16:01 2009 (r191511) @@ -29,6 +29,7 @@ 2006 2007 2008 + 2009 The &os; Documentation Project @@ -344,7 +345,7 @@ you to try it and send a note to the &a.sparc; with your results, including which devices work and which do not. - The following systems are fully supported by &os;. + The following systems are fully supported by &os;: @@ -485,7 +486,7 @@ Starting with 7.2-RELEASE, &arch.sparc64; systems based on - &ultrasparc; III and beyond are also supported by &os, which includes + &ultrasparc; III and beyond are also supported by &os;, which includes the following known working systems: From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 07:38:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13843106567B; Sun, 26 Apr 2009 07:38:47 +0000 (UTC) (envelope-from zec@icir.org) Received: from labs4.cc.fer.hr (labs4.cc.fer.hr [161.53.72.24]) by mx1.freebsd.org (Postfix) with ESMTP id 900D38FC17; Sun, 26 Apr 2009 07:38:46 +0000 (UTC) (envelope-from zec@icir.org) Received: from sluga.fer.hr (sluga.cc.fer.hr [161.53.72.14]) by labs4.cc.fer.hr (8.14.2/8.14.2) with ESMTP id n3Q7GJCA026905; Sun, 26 Apr 2009 09:16:19 +0200 (CEST) Received: from [192.168.200.111] ([161.53.19.79]) by sluga.fer.hr over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Sun, 26 Apr 2009 09:15:57 +0200 From: Marko Zec To: src-committers@freebsd.org Date: Sun, 26 Apr 2009 09:15:52 +0200 User-Agent: KMail/1.9.10 References: <200904260709.n3Q79doO075148@svn.freebsd.org> In-Reply-To: <200904260709.n3Q79doO075148@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904260915.52830.zec@icir.org> X-OriginalArrivalTime: 26 Apr 2009 07:15:58.0071 (UTC) FILETIME=[D8956070:01C9C63E] X-Scanned-By: MIMEDefang 2.64 on 161.53.72.24 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r191508 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 07:38:47 -0000 On Sunday 26 April 2009 09:09:39 Marko Zec wrote: > Author: zec > Date: Sun Apr 26 07:09:39 2009 > New Revision: 191508 > URL: http://svn.freebsd.org/changeset/base/191508 > > Log: > Extend the vnet module registration / initialization framework > first introduced @ r190909 with a vnet module deregistration > service. > > kldunloadable modules, which are currently using vnet_mod_register() > to attach their per-vnet initialization routines to the vnet > initialization framework, should call vnet_mod_deregister() before > acknowledging MOD_UNLOAD requests in their mod_event handlers. Such > changes to the existing code base will follow in subsequent commits. > > vnet_mod_deregister() does not check whether departing vnet modules > are registered as prerequisites for another module(s), so it should > be used with care. Currently I'm only aware of vnet modules which > are leafs on module dependency graphs that are kldunloadable. > > This change also introduces per-vnet module destructor handler, which > calls vnet's module cleanup function, which (if required) has to be > registered in vnet module's vnet_modinfo_t structure .vmi_idetach > field. Once options VIMAGE becomes operational, the framework will > take care that module's cleanup function become invoked for each > active vnet instance, and that the memory allocated for each instance > gets freed. Currently calls to destructor handlers must always > succeed. Missing in the log: Approved by: julian (mentor) Reviewed by: bz Sorry... Marko > Modified: > head/sys/kern/kern_vimage.c > head/sys/sys/vimage.h > > Modified: head/sys/kern/kern_vimage.c > =========================================================================== >=== --- head/sys/kern/kern_vimage.c Sun Apr 26 03:55:08 2009 (r191507) +++ > head/sys/kern/kern_vimage.c Sun Apr 26 07:09:39 2009 (r191508) @@ -47,6 > +47,7 @@ static TAILQ_HEAD(vnet_modlink_head, vne > static TAILQ_HEAD(vnet_modpending_head, vnet_modlink) > vnet_modpending_head; static void vnet_mod_complete_registration(struct > vnet_modlink *); static int vnet_mod_constructor(struct vnet_modlink *); > +static int vnet_mod_destructor(struct vnet_modlink *); > > void > vnet_mod_register(const struct vnet_modinfo *vmi) > @@ -144,6 +145,37 @@ vnet_mod_complete_registration(struct vn > } while (vml_iter != NULL); > } > > +void > +vnet_mod_deregister(const struct vnet_modinfo *vmi) > +{ > + > + vnet_mod_deregister_multi(vmi, NULL, NULL); > +} > + > +void > +vnet_mod_deregister_multi(const struct vnet_modinfo *vmi, void *iarg, > + char *iname) > +{ > + VNET_ITERATOR_DECL(vnet_iter); > + struct vnet_modlink *vml; > + > + TAILQ_FOREACH(vml, &vnet_modlink_head, vml_mod_le) > + if (vml->vml_modinfo == vmi && vml->vml_iarg == iarg) > + break; > + if (vml == NULL) > + panic("cannot deregister unregistered vnet module %s", > + vmi->vmi_name); > + > + VNET_FOREACH(vnet_iter) { > + CURVNET_SET_QUIET(vnet_iter); > + vnet_mod_destructor(vml); > + CURVNET_RESTORE(); > + } > + > + TAILQ_REMOVE(&vnet_modlink_head, vml, vml_mod_le); > + free(vml, M_VIMAGE); > +} > + > static int vnet_mod_constructor(struct vnet_modlink *vml) > { > const struct vnet_modinfo *vmi = vml->vml_modinfo; > @@ -153,16 +185,18 @@ static int vnet_mod_constructor(struct v > if (vml->vml_iarg) > printf("/%s", vml->vml_iname); > printf(": "); > - if (vmi->vmi_struct_size) > - printf("malloc(%zu); ", vmi->vmi_struct_size); > +#ifdef VIMAGE > + if (vmi->vmi_size) > + printf("malloc(%zu); ", vmi->vmi_size); > +#endif > if (vmi->vmi_iattach != NULL) > printf("iattach()"); > printf("\n"); > #endif > > #ifdef VIMAGE > - if (vmi->vmi_struct_size) { > - void *mem = malloc(vmi->vmi_struct_size, M_VNET, > + if (vmi->vmi_size) { > + void *mem = malloc(vmi->vmi_size, M_VNET, > M_NOWAIT | M_ZERO); > if (mem == NULL) /* XXX should return error, not panic. */ > panic("vi_alloc: malloc for %s\n", vmi->vmi_name); > @@ -176,6 +210,41 @@ static int vnet_mod_constructor(struct v > return (0); > } > > + > +static int > +vnet_mod_destructor(struct vnet_modlink *vml) > +{ > + const struct vnet_modinfo *vmi = vml->vml_modinfo; > + > +#ifdef DEBUG_ORDERING > + printf("destroying vnet_%s", vmi->vmi_name); > + if (vml->vml_iarg) > + printf("/%s", vml->vml_iname); > + printf(": "); > + if (vmi->vmi_idetach != NULL) > + printf("idetach(); "); > +#ifdef VIMAGE > + if (vmi->vmi_size) > + printf("free()"); > +#endif > + printf("\n"); > +#endif > + > + if (vmi->vmi_idetach) > + vmi->vmi_idetach(vml->vml_iarg); > + > +#ifdef VIMAGE > + if (vmi->vmi_size) { > + if (curvnet->mod_data[vmi->vmi_id] == NULL) > + panic("vi_destroy: %s\n", vmi->vmi_name); > + free(curvnet->mod_data[vmi->vmi_id], M_VNET); > + curvnet->mod_data[vmi->vmi_id] = NULL; > + } > +#endif > + > + return (0); > +} > + > /* > * vi_symlookup() attempts to resolve name to address queries for > * variables which have been moved from global namespace to virtualization > > Modified: head/sys/sys/vimage.h > =========================================================================== >=== --- head/sys/sys/vimage.h Sun Apr 26 03:55:08 2009 (r191507) > +++ head/sys/sys/vimage.h Sun Apr 26 07:09:39 2009 (r191508) > @@ -121,6 +121,8 @@ struct vnet_modlink { > int vi_symlookup(struct kld_sym_lookup *, char *); > void vnet_mod_register(const struct vnet_modinfo *); > void vnet_mod_register_multi(const struct vnet_modinfo *, void *, char *); > +void vnet_mod_deregister(const struct vnet_modinfo *); > +void vnet_mod_deregister_multi(const struct vnet_modinfo *, void *, char > *); > > #endif /* !VIMAGE_GLOBALS */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 09:21:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5394F106566C; Sun, 26 Apr 2009 09:21:38 +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 4201E8FC13; Sun, 26 Apr 2009 09:21:38 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3Q9LctY078280; Sun, 26 Apr 2009 09:21:38 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3Q9LcUO078279; Sun, 26 Apr 2009 09:21:38 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904260921.n3Q9LcUO078279@svn.freebsd.org> From: Ed Schouten Date: Sun, 26 Apr 2009 09:21:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191516 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 09:21:38 -0000 Author: ed Date: Sun Apr 26 09:21:37 2009 New Revision: 191516 URL: http://svn.freebsd.org/changeset/base/191516 Log: Remove unneeded device index from unit number. We only use the unit number to determine whether we should rewind the device upon closure. Modified: head/sys/dev/ata/atapi-tape.c Modified: head/sys/dev/ata/atapi-tape.c ============================================================================== --- head/sys/dev/ata/atapi-tape.c Sun Apr 26 08:29:35 2009 (r191515) +++ head/sys/dev/ata/atapi-tape.c Sun Apr 26 09:21:37 2009 (r191516) @@ -138,15 +138,13 @@ ast_attach(device_t dev) DEVSTAT_NO_ORDERED_TAGS, DEVSTAT_TYPE_SEQUENTIAL | DEVSTAT_TYPE_IF_IDE, DEVSTAT_PRIORITY_TAPE); - device = make_dev(&ast_cdevsw, 2 * device_get_unit(dev), - UID_ROOT, GID_OPERATOR, 0640, "ast%d", - device_get_unit(dev)); + device = make_dev(&ast_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0640, + "ast%d", device_get_unit(dev)); device->si_drv1 = dev; device->si_iosize_max = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; stp->dev1 = device; - device = make_dev(&ast_cdevsw, 2 * device_get_unit(dev) + 1, - UID_ROOT, GID_OPERATOR, 0640, "nast%d", - device_get_unit(dev)); + device = make_dev(&ast_cdevsw, 1, UID_ROOT, GID_OPERATOR, 0640, + "nast%d", device_get_unit(dev)); device->si_drv1 = dev; device->si_iosize_max = ch->dma.max_iosize; stp->dev2 = device; @@ -238,8 +236,8 @@ ast_close(struct cdev *cdev, int flags, (stp->flags & (F_DATA_WRITTEN | F_FM_WRITTEN)) == F_DATA_WRITTEN) ast_write_filemark(dev, ATAPI_WF_WRITE); - /* if minor is even rewind on close */ - if (!(dev2unit(cdev) & 0x01)) + /* if unit is zero rewind on close */ + if (dev2unit(cdev) == 0) ast_rewind(dev); if (stp->cap.lock && count_dev(cdev) == 1) From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 09:31:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79EAF1065676; Sun, 26 Apr 2009 09:31:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6616A8FC13; Sun, 26 Apr 2009 09:31:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3Q9VxaY078534; Sun, 26 Apr 2009 09:31:59 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3Q9Vxmo078533; Sun, 26 Apr 2009 09:31:59 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904260931.n3Q9Vxmo078533@svn.freebsd.org> From: Ed Schouten Date: Sun, 26 Apr 2009 09:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191517 - in head: contrib/amd/m4 contrib/bind contrib/bind9/lib/dns/sec contrib/cvs/tools/pcl-cvs contrib/gcc/config/alpha contrib/gcc/config/frv contrib/gcc/config/mpw contrib/gcc/con... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 09:31:59 -0000 Author: ed Date: Sun Apr 26 09:31:58 2009 New Revision: 191517 URL: http://svn.freebsd.org/changeset/base/191517 Log: Remove empty directories from the HEAD. Discussed with: developers, imp Deleted: head/contrib/amd/m4/ head/contrib/bind/ head/contrib/bind9/lib/dns/sec/ head/contrib/cvs/tools/pcl-cvs/ head/contrib/gcc/config/alpha/ head/contrib/gcc/config/frv/ head/contrib/gcc/config/mpw/ head/contrib/gcc/contrib/regression/ head/contrib/gcc/f/ head/contrib/gcc/include/ head/contrib/gdb/gdb/config/none/ head/contrib/gdb/gdb/nlm/ head/contrib/groff/addftinfo/ head/contrib/groff/afmtodit/ head/contrib/groff/eqn/ head/contrib/groff/grn/ head/contrib/groff/grodvi/ head/contrib/groff/groff/ head/contrib/groff/grog/ head/contrib/groff/grohtml/ head/contrib/groff/grolbp/ head/contrib/groff/grolj4/ head/contrib/groff/grops/ head/contrib/groff/grotty/ head/contrib/groff/hpftodit/ head/contrib/groff/include/ head/contrib/groff/indxbib/ head/contrib/groff/libbib/ head/contrib/groff/libdriver/ head/contrib/groff/libgroff/ head/contrib/groff/lkbib/ head/contrib/groff/lookbib/ head/contrib/groff/mm/ head/contrib/groff/nroff/ head/contrib/groff/pfbtops/ head/contrib/groff/pic/ head/contrib/groff/refer/ head/contrib/groff/soelim/ head/contrib/groff/src/xditview/ head/contrib/groff/tbl/ head/contrib/groff/tfmtodit/ head/contrib/groff/troff/ head/contrib/groff/xditview/ head/contrib/libpcap/doc/ head/contrib/libstdc++/config/abi/alpha-freebsd5/ head/contrib/libstdc++/config/abi/alpha-linux-gnu/ head/contrib/libstdc++/config/abi/alphaev67-unknown-linux-gnu/ head/contrib/libstdc++/config/abi/arm-linux-gnu/ head/contrib/libstdc++/config/abi/hppa-linux-gnu/ head/contrib/libstdc++/config/abi/i386-freebsd4/ head/contrib/libstdc++/config/abi/i386-freebsd5/ head/contrib/libstdc++/config/abi/i386-linux-gnu/ head/contrib/libstdc++/config/abi/i486-linux-gnu/ head/contrib/libstdc++/config/abi/i686-pc-linux-gnu/ head/contrib/libstdc++/config/abi/ia64-linux-gnu/ head/contrib/libstdc++/config/abi/ia64-unknown-linux-gnu/ head/contrib/libstdc++/config/abi/m68k-linux-gnu/ head/contrib/libstdc++/config/abi/mips-linux-gnu/ head/contrib/libstdc++/config/abi/powerpc-linux-gnu/ head/contrib/libstdc++/config/abi/s390-linux-gnu/ head/contrib/libstdc++/config/abi/s390x-linux-gnu/ head/contrib/libstdc++/config/abi/sparc-freebsd5/ head/contrib/libstdc++/config/abi/sparc-linux-gnu/ head/contrib/libstdc++/config/abi/x86_64-linux-gnu/32/ head/contrib/libstdc++/config/cpu/alpha/bits/ head/contrib/libstdc++/config/cpu/arm/bits/ head/contrib/libstdc++/config/cpu/cris/bits/ head/contrib/libstdc++/config/cpu/generic/bits/ head/contrib/libstdc++/config/cpu/i386/bits/ head/contrib/libstdc++/config/cpu/i486/bits/ head/contrib/libstdc++/config/cpu/ia64/bits/ head/contrib/libstdc++/config/cpu/m68k/bits/ head/contrib/libstdc++/config/cpu/mips/bits/ head/contrib/libstdc++/config/cpu/mmix/bits/ head/contrib/libstdc++/config/cpu/powerpc/bits/ head/contrib/libstdc++/config/cpu/s390/bits/ head/contrib/libstdc++/config/cpu/sparc/bits/ head/contrib/libstdc++/config/cpu/x86-64/bits/ head/contrib/libstdc++/config/os/aix/bits/ head/contrib/libstdc++/config/os/bsd/freebsd/bits/ head/contrib/libstdc++/config/os/bsd/netbsd/bits/ head/contrib/libstdc++/config/os/djgpp/bits/ head/contrib/libstdc++/config/os/generic/bits/ head/contrib/libstdc++/config/os/gnu-linux/bits/ head/contrib/libstdc++/config/os/hpux/bits/ head/contrib/libstdc++/config/os/irix/irix5.2/bits/ head/contrib/libstdc++/config/os/irix/irix6.5/bits/ head/contrib/libstdc++/config/os/mingw32/bits/ head/contrib/libstdc++/config/os/newlib/bits/ head/contrib/libstdc++/config/os/osf/osf5.0/bits/ head/contrib/libstdc++/config/os/qnx/qnx6.1/bits/ head/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ head/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ head/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ head/contrib/libstdc++/include/c_shadow/bits/ head/contrib/libstdc++/include/c_shadow/sys/ head/contrib/ncurses/tack/ head/contrib/ntp/html/hints/ head/contrib/ntp/scripts/support/ head/contrib/openpam/modules/pam_dummy/ head/crypto/openssl/os2/ head/gnu/usr.bin/perl/ head/gnu/usr.bin/pr/ head/gnu/usr.bin/texinfo/info-files/ head/lib/libftp/ head/libexec/bugfiler/ head/libexec/kpasswdd/ head/sys/cddl/dev/dtnfsclient/ head/sys/modules/ata/ata/ head/tools/tools/nanobsd/rescue/Files/conf/ head/tools/tools/nanobsd/rescue/Pkg/ head/usr.bin/compile_et/test/ head/usr.bin/diff/ head/usr.bin/grep/egrep/ head/usr.bin/timedef/ head/usr.sbin/bootpd/ head/usr.sbin/update/ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 09:36:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCA95106566B; Sun, 26 Apr 2009 09:36:55 +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 C918C8FC0C; Sun, 26 Apr 2009 09:36:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3Q9atGm078666; Sun, 26 Apr 2009 09:36:55 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3Q9atSs078665; Sun, 26 Apr 2009 09:36:55 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904260936.n3Q9atSs078665@svn.freebsd.org> From: Ed Schouten Date: Sun, 26 Apr 2009 09:36:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191518 - in head: contrib/gcc/contrib contrib/libstdc++/config/abi/x86_64-linux-gnu contrib/libstdc++/config/cpu/mmix contrib/libstdc++/config/cpu/s390 contrib/libstdc++/config/cpu/x86... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 09:36:56 -0000 Author: ed Date: Sun Apr 26 09:36:55 2009 New Revision: 191518 URL: http://svn.freebsd.org/changeset/base/191518 Log: Remove even more empty directories. I just used `hidesvn find . -type d -empty' to figure out which directories are empty. This means I couldn't easily figure out which directories only contained empty subdirectories. Deleted: head/contrib/gcc/contrib/ head/contrib/libstdc++/config/abi/x86_64-linux-gnu/ head/contrib/libstdc++/config/cpu/mmix/ head/contrib/libstdc++/config/cpu/s390/ head/contrib/libstdc++/config/cpu/x86-64/ head/contrib/libstdc++/config/os/osf/ head/contrib/libstdc++/include/c_shadow/ head/usr.bin/grep/ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 10:12:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74AD5106564A; Sun, 26 Apr 2009 10:12:20 +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 62B208FC08; Sun, 26 Apr 2009 10:12:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QACKpl079424; Sun, 26 Apr 2009 10:12:20 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QACKVw079423; Sun, 26 Apr 2009 10:12:20 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200904261012.n3QACKVw079423@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 26 Apr 2009 10:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191520 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 10:12:20 -0000 Author: trasz Date: Sun Apr 26 10:12:20 2009 New Revision: 191520 URL: http://svn.freebsd.org/changeset/base/191520 Log: Fix typo. Modified: head/lib/libc/posix1e/acl_set_qualifier.3 Modified: head/lib/libc/posix1e/acl_set_qualifier.3 ============================================================================== --- head/lib/libc/posix1e/acl_set_qualifier.3 Sun Apr 26 09:54:03 2009 (r191519) +++ head/lib/libc/posix1e/acl_set_qualifier.3 Sun Apr 26 10:12:20 2009 (r191520) @@ -42,7 +42,7 @@ The .Fn acl_set_qualifier function -is a POSIX.1e call that sets the qualifier of the tag for the ACl entry +is a POSIX.1e call that sets the qualifier of the tag for the ACL entry .Fa entry_d to the value referred to by .Fa tag_qualifier_p . From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 10:32:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4551106564A; Sun, 26 Apr 2009 10:32:18 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out3.smtp.messagingengine.com (out3.smtp.messagingengine.com [66.111.4.27]) by mx1.freebsd.org (Postfix) with ESMTP id 938218FC14; Sun, 26 Apr 2009 10:32:18 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 21116322AFD; Sun, 26 Apr 2009 06:32:18 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Sun, 26 Apr 2009 06:32:18 -0400 X-Sasl-enc: 1WBoM+ZOKj76ZY9Hb6r7mO7MjwmRp0BhsAz/MIlvAwZO 1240741937 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id B8A7A54501; Sun, 26 Apr 2009 06:32:16 -0400 (EDT) Message-ID: <49F4382E.7030105@incunabulum.net> Date: Sun, 26 Apr 2009 11:32:14 +0100 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Robert Watson References: <200904212243.n3LMhW48027008@svn.freebsd.org> <49EEDB9C.8080409@incunabulum.net> <49EEE63F.2060706@incunabulum.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191367 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 10:32:19 -0000 Robert Watson wrote: > ... >> >> Now that Giant is nuked, the netisr could be eliminated and the ifnet >> rlock taken as it is before dispatching an entire chain. I only >> implemented a netisr to allow the code to be back-ported, however I >> don't care about back-porting any more -- it's too much effort and >> the time/funding budget doesn't justify that amount of work. > > Have you thought about registering a callback with the > ifnet_departure_event event handler to handle interfaces disappearing? The igmp_domifdetach() function will already do an IF_DRAIN() for the link-scope queue, so registering a departure event handler would probably just introduce another point of possible race. ;-) Now that Giant has gone away, and the lock recursion in the lower half of IP to do with IN_MULTI_LOCK() has been eliminated, it might make more sense to ditch the netisr -- I only used it as 7.x was my initial target, but of course time grinds on, as does development. As of today, the MLDv2 code builds in my p4 branch, and I need to rewrite mtest so it can grok IPv6 properly. http://perforce.freebsd.org/depotTreeBrowser.cgi?FSPC=//depot/user/bms/netdev/sys/netinet6&HIDEDEL=NO As things currently stand, I don't plan to back-port the IGMPv3 or MLDv2 code to previous FreeBSD versions, but it would make sense to leave the netisr in SVN history so that I (or someone else) can do that if there's demand for it (probably not, as ABIs get broken, though there are ways around that). Once MLDv2 is in SVN, I'd feel better about eliminating the use of the netisr entirely in 8.x. MLDv1 as implemented in KAME has a little kludge in it to introduce jitter on the link-scope 'solicited multicast' group membership reports -- this exists mostly to support IPv6's Duplicate Address Detection (DAD) mechanism. MLDv2 does not require this jitter -- it's built into the MLDv2 protocol already, as state change reports are deferred to give the local node a chance to merge them, and these ones only get seen when IPv6 is initially attached to an ifnet. BTW: Thanks so much for tackling the ifdead stuff, this is a big help towards streamlining against possible races such as the ones Sam saw with the 802.11 VAP code right after SSM went in. Also, thanks for catching the use-after-free in mainline, I have now patched this in the MLDv2 fork. cheers, BMS From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 18:24:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05F421065670; Sun, 26 Apr 2009 18:24:15 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E94B28FC1A; Sun, 26 Apr 2009 18:24:14 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QIOEmt091043; Sun, 26 Apr 2009 18:24:14 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QIOEh8091042; Sun, 26 Apr 2009 18:24:14 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904261824.n3QIOEh8091042@svn.freebsd.org> From: Tim Kientzle Date: Sun, 26 Apr 2009 18:24:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191524 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 18:24:15 -0000 Author: kientzle Date: Sun Apr 26 18:24:14 2009 New Revision: 191524 URL: http://svn.freebsd.org/changeset/base/191524 Log: Remove an unused variable. Thanks to: Christoph Mallon Modified: head/lib/libarchive/archive_read_support_format_empty.c Modified: head/lib/libarchive/archive_read_support_format_empty.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_empty.c Sun Apr 26 18:10:07 2009 (r191523) +++ head/lib/libarchive/archive_read_support_format_empty.c Sun Apr 26 18:24:14 2009 (r191524) @@ -59,10 +59,9 @@ archive_read_support_format_empty(struct static int archive_read_format_empty_bid(struct archive_read *a) { - const void *h; ssize_t avail; - h = __archive_read_ahead(a, 1, &avail); + (void)__archive_read_ahead(a, 1, &avail); if (avail != 0) return (-1); return (1); From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 18:43:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CC4C106566C; Sun, 26 Apr 2009 18:43:50 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C68E8FC0A; Sun, 26 Apr 2009 18:43:50 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QIhoJq091485; Sun, 26 Apr 2009 18:43:50 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QIhoOe091484; Sun, 26 Apr 2009 18:43:50 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904261843.n3QIhoOe091484@svn.freebsd.org> From: Tim Kientzle Date: Sun, 26 Apr 2009 18:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191525 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 18:43:50 -0000 Author: kientzle Date: Sun Apr 26 18:43:49 2009 New Revision: 191525 URL: http://svn.freebsd.org/changeset/base/191525 Log: Exit with ARCHIVE_FATAL if the ISO image is truncated. Modified: head/lib/libarchive/archive_read_support_format_iso9660.c Modified: head/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_iso9660.c Sun Apr 26 18:24:14 2009 (r191524) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Sun Apr 26 18:43:49 2009 (r191525) @@ -683,7 +683,7 @@ archive_read_format_iso9660_read_data(st if (bytes_read == 0) archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Truncated input file"); - if (buff == NULL) + if (*buff == NULL) return (ARCHIVE_FATAL); if (bytes_read > iso9660->entry_bytes_remaining) bytes_read = iso9660->entry_bytes_remaining; From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 18:46:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F98D1065676; Sun, 26 Apr 2009 18:46:41 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63B118FC23; Sun, 26 Apr 2009 18:46:41 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QIkfVD091587; Sun, 26 Apr 2009 18:46:41 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QIkfMn091586; Sun, 26 Apr 2009 18:46:41 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904261846.n3QIkfMn091586@svn.freebsd.org> From: Tim Kientzle Date: Sun, 26 Apr 2009 18:46:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191526 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 18:46:42 -0000 Author: kientzle Date: Sun Apr 26 18:46:40 2009 New Revision: 191526 URL: http://svn.freebsd.org/changeset/base/191526 Log: Various improvements to the tar.5 manpage, including descriptions of the GNU tar "posix-style" sparse format, clarification of the Solaris tar ACL storage, and a few comments about Mac OS X tar's resource storage. Modified: head/lib/libarchive/tar.5 Modified: head/lib/libarchive/tar.5 ============================================================================== --- head/lib/libarchive/tar.5 Sun Apr 26 18:43:49 2009 (r191525) +++ head/lib/libarchive/tar.5 Sun Apr 26 18:46:40 2009 (r191526) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2003-2007 Tim Kientzle +.\" Copyright (c) 2003-2009 Tim Kientzle .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,8 +24,8 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2004 -.Dt TAR 5 +.Dd April 19, 2009 +.Dt tar 5 .Os .Sh NAME .Nm tar @@ -71,7 +71,7 @@ necessary. This section describes the variant implemented by the tar command included in .At v7 , -which is one of the earliest widely-used versions of the tar program. +which seems to be the earliest widely-used version of the tar program. .Pp The header record for an old-style .Nm @@ -390,6 +390,11 @@ user or group information available (suc are temporarily unavailable). .It Cm SCHILY.devminor , Cm SCHILY.devmajor The full minor and major numbers for device nodes. +.It Cm SCHILY.fflags +The file flags. +.It Cm SCHILY.realsize +The full size of the file on disk. +XXX explain? XXX .It Cm SCHILY.dev, Cm SCHILY.ino , Cm SCHILY.nlinks The device number, inode number, and link count for the entry. In particular, note that a pax interchange format archive using Joerg @@ -560,9 +565,6 @@ plus When extracting, GNU tar checks that the header file name is the one it is expecting, that the header offset is in the correct sequence, and that the sum of offset and size is equal to realsize. -FreeBSD's version of GNU tar does not handle the corner case of an -archive's being continued in the middle of a long name or other -extension header. .It "N" Type "N" records are no longer generated by GNU tar. They contained a @@ -575,6 +577,8 @@ or .Dq Symlink %s to %s\en ; in either case, both filenames are escaped using K&R C syntax. +Due to security concerns, "N" records are now generally ignored +when reading archives. .It "S" This is a .Dq sparse @@ -644,6 +648,66 @@ entry; the .Va realsize field will indicate the total size of the file. .El +.Ss GNU tar pax archives +GNU tar 1.14 (XXX check this XXX) and later will write +pax interchange format archives when you specify the +.Fl -posix +flag. +This format uses custom keywords to store sparse file information. +There have been three iterations of this support, referred to +as +.Dq 0.0 , +.Dq 0.1 , +and +.Dq 1.0 . +.Bl -tag -width indent +.It Cm GNU.sparse.numblocks , Cm GNU.sparse.offset , Cm GNU.sparse.numbytes , Cm GNU.sparse.size +The +.Dq 0.0 +format used an initial +.Cm GNU.sparse.numblocks +attribute to indicate the number of blocks in the file, a pair of +.Cm GNU.sparse.offset +and +.Cm GNU.sparse.numbytes +to indicate the offset and size of each block, +and a single +.Cm GNU.sparse.size +to indicate the full size of the file. +This is not the same as the size in the tar header because the +latter value does not include the size of any holes. +This format required that the order of attributes be preserved and +relied on readers accepting multiple appearances of the same attribute +names, which is not officially permitted by the standards. +.It Cm GNU.sparse.map +The +.Dq 0.1 +format used a single attribute that stored a comma-separated +list of decimal numbers. +Each pair of numbers indicated the offset and size, respectively, +of a block of data. +This does not work well if the archive is extracted by an archiver +that does not recognize this extension, since many pax implementations +simply discard unrecognized attributes. +.It Cm GNU.sparse.major , Cm GNU.sparse.minor , Cm GNU.sparse.name , Cm GNU.sparse.realsize +The +.Dq 1.0 +format stores the sparse block map in one or more 512-byte blocks +prepended to the file data in the entry body. +The pax attributes indicate the existence of this map +(via the +.Cm GNU.sparse.major +and +.Cm GNU.sparse.minor +fields) +and the full size of the file. +The +.Cm GNU.sparse.name +holds the true name of the file. +To avoid confusion, the name stored in the regular tar header +is a modified name so that extraction errors will be apparent +to users. +.El .Ss Solaris Tar XXX More Details Needed XXX .Pp @@ -667,16 +731,42 @@ An additional .Cm A entry is used to store an ACL for the following regular entry. The body of this entry contains a seven-digit octal number -(whose value is 01000000 plus the number of ACL entries) followed by a zero byte, followed by the textual ACL description. +The octal value is the number of ACL entries +plus a constant that indicates the ACL type: 01000000 +for POSIX.1e ACLs and 03000000 for NFSv4 ACLs. .El +.Ss AIX Tar +XXX More details needed XXX +.Ss Mac OS X Tar +The tar distributed with Apple's Mac OS X stores most regular files +as two separate entries in the tar archive. +The two entries have the same name except that the first +one has +.Dq ._ +added to the beginning of the name. +This first entry stores the +.Dq resource fork +with additional attributes for the file. +The Mac OS X +.Fn CopyFile +API is used to separate a file on disk into separate +resource and data streams and to reassemble those separate +streams when the file is restored to disk. .Ss Other Extensions -One common extension, utilized by GNU tar, star, and other newer +One obvious extension to increase the size of files is to +eliminate the terminating characters from the various +numeric fields. +For example, the standard only allows the size field to contain +11 octal digits, reserving the twelfth byte for a trailing +NUL character. +Allowing 12 octal digits allows file sizes up to 64 GB. +.Pp +Another extension, utilized by GNU tar, star, and other newer .Nm -implementations, permits binary numbers in the standard numeric -fields. -This is flagged by setting the high bit of the first character. +implementations, permits binary numbers in the standard numeric fields. +This is flagged by setting the high bit of the first byte. This permits 95-bit values for the length and time fields and 63-bit values for the uid, gid, and device numbers. GNU tar supports this extension for the @@ -686,12 +776,9 @@ all numeric fields. Note that this extension is largely obsoleted by the extended attribute record provided by the pax interchange format. .Pp -Another early GNU extension allowed base-64 values rather -than octal. -This extension was short-lived and such archives are almost never seen. -However, there is still code in GNU tar to support them; this code is -responsible for a very cryptic warning message that is sometimes seen when -GNU tar encounters a damaged archive. +Another early GNU extension allowed base-64 values rather than octal. +This extension was short-lived and is no longer supported by any +implementation. .Sh SEE ALSO .Xr ar 1 , .Xr pax 1 , From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 18:57:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3DEB106564A; Sun, 26 Apr 2009 18:57:50 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B89158FC1E; Sun, 26 Apr 2009 18:57:50 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QIvora091839; Sun, 26 Apr 2009 18:57:50 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QIvo5S091837; Sun, 26 Apr 2009 18:57:50 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904261857.n3QIvo5S091837@svn.freebsd.org> From: Tim Kientzle Date: Sun, 26 Apr 2009 18:57:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191527 - in head/lib/libarchive: . test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 18:57:51 -0000 Author: kientzle Date: Sun Apr 26 18:57:50 2009 New Revision: 191527 URL: http://svn.freebsd.org/changeset/base/191527 Log: Reading an mtree file is supposed to provide access to the file data (if the file exists on disk). This was broken for the first regular file; fix it and add a test so it won't break again. In particular, this fixes the following idiom for creating a tar archive in which every file is owned by root: tar cf - --format=mtree . \ | sed -e 's/uname=[a-z]*/uname=root/' -e 's/uid=[0-9]*/uid=0/' \ | tar cf - @- Modified: head/lib/libarchive/archive_read_support_format_mtree.c head/lib/libarchive/test/test_read_format_mtree.c Modified: head/lib/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_mtree.c Sun Apr 26 18:46:40 2009 (r191526) +++ head/lib/libarchive/archive_read_support_format_mtree.c Sun Apr 26 18:57:50 2009 (r191527) @@ -990,8 +990,8 @@ read_data(struct archive_read *a, const if (mtree->buff == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate memory"); + return (ARCHIVE_FATAL); } - return (ARCHIVE_FATAL); } *buff = mtree->buff; Modified: head/lib/libarchive/test/test_read_format_mtree.c ============================================================================== --- head/lib/libarchive/test/test_read_format_mtree.c Sun Apr 26 18:46:40 2009 (r191526) +++ head/lib/libarchive/test/test_read_format_mtree.c Sun Apr 26 18:57:50 2009 (r191527) @@ -28,7 +28,7 @@ __FBSDID("$FreeBSD$"); /* Single entry with a hardlink. */ static unsigned char archive[] = { "#mtree\n" - "file type=file uid=18 mode=0123\n" + "file type=file uid=18 mode=0123 size=3\n" "dir type=dir\n" " file\\040with\\040space type=file uid=18\n" " ..\n" @@ -49,8 +49,10 @@ static unsigned char archive[] = { DEFINE_TEST(test_read_format_mtree) { + char buff[16]; struct archive_entry *ae; struct archive *a; + int fd; /* * An access error occurred on some platform when mtree @@ -68,12 +70,23 @@ DEFINE_TEST(test_read_format_mtree) archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); + + /* + * Read "file", whose data is available on disk. + */ + fd = open("file", O_WRONLY | O_CREAT, 0777); + assert(fd >= 0); + assertEqualInt(3, write(fd, "hi\n", 3)); + close(fd); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_MTREE); assertEqualString(archive_entry_pathname(ae), "file"); assertEqualInt(archive_entry_uid(ae), 18); assert(S_ISREG(archive_entry_mode(ae))); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0123); + assertEqualInt(archive_entry_size(ae), 3); + assertEqualInt(3, archive_read_data(a, buff, 3)); + assertEqualMem(buff, "hi\n", 3); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir"); From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 19:05:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57FDD1065672; Sun, 26 Apr 2009 19:05:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 476EF8FC1A; Sun, 26 Apr 2009 19:05:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QJ5ei0092035; Sun, 26 Apr 2009 19:05:40 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QJ5eDJ092034; Sun, 26 Apr 2009 19:05:40 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904261905.n3QJ5eDJ092034@svn.freebsd.org> From: Robert Watson Date: Sun, 26 Apr 2009 19:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191528 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 19:05:40 -0000 Author: rwatson Date: Sun Apr 26 19:05:40 2009 New Revision: 191528 URL: http://svn.freebsd.org/changeset/base/191528 Log: Acquire IF_ADDR_LOCK() around most iterations over ifp->if_addrhead (colloquially known as if_addrlist). Currently not acquired around interface address loops that call out to the routing code due to potential lock order issues. MFC after: 3 weeks Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Sun Apr 26 18:57:50 2009 (r191527) +++ head/sys/netinet/ip_carp.c Sun Apr 26 19:05:40 2009 (r191528) @@ -275,6 +275,7 @@ carp_hmac_prepare(struct carp_softc *sc) found = 0; last = cur; cur.s_addr = 0xffffffff; + IF_ADDR_LOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { in.s_addr = ifatoia(ifa)->ia_addr.sin_addr.s_addr; if (ifa->ifa_addr->sa_family == AF_INET && @@ -284,6 +285,7 @@ carp_hmac_prepare(struct carp_softc *sc) found++; } } + IF_ADDR_UNLOCK(SC2IFP(sc)); if (found) SHA1Update(&sc->sc_sha1, (void *)&cur, sizeof(cur)); } while (found); @@ -294,6 +296,7 @@ carp_hmac_prepare(struct carp_softc *sc) found = 0; last6 = cur6; memset(&cur6, 0xff, sizeof(cur6)); + IF_ADDR_LOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { in6 = ifatoia6(ifa)->ia_addr.sin6_addr; if (IN6_IS_SCOPE_EMBED(&in6)) @@ -305,6 +308,7 @@ carp_hmac_prepare(struct carp_softc *sc) found++; } } + IF_ADDR_UNLOCK(SC2IFP(sc)); if (found) SHA1Update(&sc->sc_sha1, (void *)&cur6, sizeof(cur6)); } while (found); @@ -1121,6 +1125,7 @@ carp_addrcount(struct carp_if *cif, stru (SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) || (type == CARP_COUNT_MASTER && vh->sc_state == MASTER)) { + IF_ADDR_LOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family == AF_INET && @@ -1128,6 +1133,7 @@ carp_addrcount(struct carp_if *cif, stru ifatoia(ifa)->ia_addr.sin_addr.s_addr) count++; } + IF_ADDR_UNLOCK(SC2IFP(vh)); } } return (count); @@ -1166,6 +1172,7 @@ carp_iamatch(void *v, struct in_ifaddr * TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { if ((SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) { + IF_ADDR_LOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family == @@ -1176,9 +1183,11 @@ carp_iamatch(void *v, struct in_ifaddr * if (vh->sc_state == MASTER) { *enaddr = IF_LLADDR(vh->sc_ifp); + IF_ADDR_UNLOCK(SC2IFP(vh)); CARP_UNLOCK(cif); return (1); } else { + IF_ADDR_UNLOCK(SC2IFP(vh)); CARP_UNLOCK(cif); return (0); } @@ -1186,6 +1195,7 @@ carp_iamatch(void *v, struct in_ifaddr * count++; } } + IF_ADDR_UNLOCK(SC2IFP(vh)); } } } else { @@ -1214,16 +1224,19 @@ carp_iamatch6(void *v, struct in6_addr * CARP_LOCK(cif); TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { + IF_ADDR_LOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, &ifatoia6(ifa)->ia_addr.sin6_addr) && (SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING) && vh->sc_state == MASTER) { + IF_ADDR_UNLOCK(SC2IFP(vh)); CARP_UNLOCK(cif); return (ifa); } } + IF_ADDR_UNLOCK(SC2IFP(vh)); } CARP_UNLOCK(cif); @@ -1240,6 +1253,7 @@ carp_macmatch6(void *v, struct mbuf *m, CARP_LOCK(cif); TAILQ_FOREACH(sc, &cif->vhif_vrs, sc_list) { + IF_ADDR_LOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, &ifatoia6(ifa)->ia_addr.sin6_addr) && @@ -1250,6 +1264,7 @@ carp_macmatch6(void *v, struct mbuf *m, sizeof(struct ifnet *), M_NOWAIT); if (mtag == NULL) { /* better a bit than nothing */ + IF_ADDR_UNLOCK(SC2IFP(sc)); CARP_UNLOCK(cif); return (IF_LLADDR(sc->sc_ifp)); } @@ -1257,10 +1272,12 @@ carp_macmatch6(void *v, struct mbuf *m, sizeof(struct ifnet *)); m_tag_prepend(m, mtag); + IF_ADDR_UNLOCK(SC2IFP(sc)); CARP_UNLOCK(cif); return (IF_LLADDR(sc->sc_ifp)); } } + IF_ADDR_UNLOCK(SC2IFP(sc)); } CARP_UNLOCK(cif); From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 19:15:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FEA61065670; Sun, 26 Apr 2009 19:15: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 600C68FC1D; Sun, 26 Apr 2009 19:15:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QJFJtA092252; Sun, 26 Apr 2009 19:15:19 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QJFJ4i092251; Sun, 26 Apr 2009 19:15:19 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200904261915.n3QJFJ4i092251@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 26 Apr 2009 19:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191529 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 19:15:20 -0000 Author: bz Date: Sun Apr 26 19:15:19 2009 New Revision: 191529 URL: http://svn.freebsd.org/changeset/base/191529 Log: Whitespace (use tabs like for all other lines). MFC after: 1 month Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sun Apr 26 19:05:40 2009 (r191528) +++ head/sys/sys/mbuf.h Sun Apr 26 19:15:19 2009 (r191529) @@ -867,7 +867,7 @@ struct mbuf *m_unshare(struct mbuf *, in #define PACKET_TAG_PF 21 /* PF + ALTQ information */ #define PACKET_TAG_RTSOCKFAM 25 /* rtsock sa family */ #define PACKET_TAG_IPOPTIONS 27 /* Saved IP options */ -#define PACKET_TAG_CARP 28 /* CARP info */ +#define PACKET_TAG_CARP 28 /* CARP info */ /* Specific cookies and tags. */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 20:54:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E74C106564A; Sun, 26 Apr 2009 20:54:57 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E25A8FC08; Sun, 26 Apr 2009 20:54:57 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QKsvps094234; Sun, 26 Apr 2009 20:54:57 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QKsv2N094233; Sun, 26 Apr 2009 20:54:57 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200904262054.n3QKsv2N094233@svn.freebsd.org> From: Alan Cox Date: Sun, 26 Apr 2009 20:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191531 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 20:54:58 -0000 Author: alc Date: Sun Apr 26 20:54:57 2009 New Revision: 191531 URL: http://svn.freebsd.org/changeset/base/191531 Log: Eliminate an archaic band-aid. The immediately preceding comment already explains why the band-aid is unnecessary. Suggested by: tegge Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Apr 26 19:16:32 2009 (r191530) +++ head/sys/vm/vm_fault.c Sun Apr 26 20:54:57 2009 (r191531) @@ -916,13 +916,11 @@ vnode_locked: KASSERT(fs.m->oflags & VPO_BUSY, ("vm_fault: page %p not busy!", fs.m)); /* - * Sanity check: page must be completely valid or it is not fit to + * Page must be completely valid or it is not fit to * map into user space. vm_pager_get_pages() ensures this. */ - if (fs.m->valid != VM_PAGE_BITS_ALL) { - vm_page_zero_invalid(fs.m, TRUE); - printf("Warning: page %p partially invalid on fault\n", fs.m); - } + KASSERT(fs.m->valid == VM_PAGE_BITS_ALL, + ("vm_fault: page %p partially invalid", fs.m)); VM_OBJECT_UNLOCK(fs.object); /* From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 20:55:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2096E1065670; Sun, 26 Apr 2009 20:55:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 104C58FC1E; Sun, 26 Apr 2009 20:55:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QKtVhx094308; Sun, 26 Apr 2009 20:55:31 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QKtV0c094307; Sun, 26 Apr 2009 20:55:31 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262055.n3QKtV0c094307@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 20:55:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191532 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 20:55:32 -0000 Author: sam Date: Sun Apr 26 20:55:31 2009 New Revision: 191532 URL: http://svn.freebsd.org/changeset/base/191532 Log: correct bssid reporting for wds vaps Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Sun Apr 26 20:54:57 2009 (r191531) +++ head/sys/net80211/ieee80211_ioctl.c Sun Apr 26 20:55:31 2009 (r191532) @@ -915,10 +915,13 @@ ieee80211_ioctl_get80211(struct ieee8021 case IEEE80211_IOC_BSSID: if (ireq->i_len != IEEE80211_ADDR_LEN) return EINVAL; - error = copyout(vap->iv_state == IEEE80211_S_RUN ? - vap->iv_bss->ni_bssid : - vap->iv_des_bssid, - ireq->i_data, ireq->i_len); + if (vap->iv_state == IEEE80211_S_RUN) { + error = copyout(vap->iv_opmode == IEEE80211_M_WDS ? + vap->iv_bss->ni_macaddr : vap->iv_bss->ni_bssid, + ireq->i_data, ireq->i_len); + } else + error = copyout(vap->iv_des_bssid, ireq->i_data, + ireq->i_len); break; case IEEE80211_IOC_WPAIE: error = ieee80211_ioctl_getwpaie(vap, ireq, ireq->i_type); From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:03:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACA361065672; Sun, 26 Apr 2009 21:03:27 +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 9C17B8FC18; Sun, 26 Apr 2009 21:03:27 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QL3RXD094507; Sun, 26 Apr 2009 21:03:27 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QL3RRm094506; Sun, 26 Apr 2009 21:03:27 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904262103.n3QL3RRm094506@svn.freebsd.org> From: Ed Schouten Date: Sun, 26 Apr 2009 21:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191533 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:03:28 -0000 Author: ed Date: Sun Apr 26 21:03:27 2009 New Revision: 191533 URL: http://svn.freebsd.org/changeset/base/191533 Log: Make the SPX code use its own copies of insque()/remque(). Instead of using the antique insque()/remque() functions from sys/queue.h, make this code use its own versions. Eventually the code should just use the regular TAILQ/LIST macros. Modified: head/sys/netipx/spx_usrreq.c Modified: head/sys/netipx/spx_usrreq.c ============================================================================== --- head/sys/netipx/spx_usrreq.c Sun Apr 26 20:55:31 2009 (r191532) +++ head/sys/netipx/spx_usrreq.c Sun Apr 26 21:03:27 2009 (r191533) @@ -180,6 +180,25 @@ struct pr_usrreqs spx_usrreq_sps = { .pru_close = spx_usr_close, }; +static __inline void +spx_insque(struct spx_q *element, struct spx_q *head) +{ + + element->si_next = head->si_next; + element->si_prev = head; + head->si_next = element; + element->si_next->si_prev = element; +} + +static __inline void +spx_remque(struct spx_q *element) +{ + + element->si_next->si_prev = element->si_prev; + element->si_prev->si_next = element->si_next; + element->si_prev = NULL; +} + void spx_init(void) { @@ -649,7 +668,7 @@ update_window: break; } } - insque(si, q->si_prev); + spx_insque((struct spx_q *)si, q->si_prev); /* * If this packet is urgent, inform process @@ -680,7 +699,7 @@ present: so->so_rcv.sb_state |= SBS_RCVATMARK; } q = q->si_prev; - remque(q->si_next); + spx_remque(q->si_next); wakeup = 1; spxstat.spxs_rcvpack++; #ifdef SF_NEWCALL @@ -1458,7 +1477,7 @@ spx_pcbdetach(struct ipxpcb *ipxp) s = cb->s_q.si_next; while (s != &(cb->s_q)) { s = s->si_next; - remque(s); + spx_remque(s); m = dtom(s); m_freem(m); } From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:03:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E5A2106564A; Sun, 26 Apr 2009 21:03:30 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02AE58FC0C; Sun, 26 Apr 2009 21:03:30 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QL3TEJ094547; Sun, 26 Apr 2009 21:03:29 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QL3T4h094544; Sun, 26 Apr 2009 21:03:29 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262103.n3QL3T4h094544@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191534 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:03:30 -0000 Author: sam Date: Sun Apr 26 21:03:29 2009 New Revision: 191534 URL: http://svn.freebsd.org/changeset/base/191534 Log: o use shared code to handle bpf tap and mbuf cleanup o swap conditional order to put the cheapest first Modified: head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Sun Apr 26 21:03:27 2009 (r191533) +++ head/sys/net80211/ieee80211_adhoc.c Sun Apr 26 21:03:29 2009 (r191534) @@ -637,11 +637,8 @@ adhoc_input(struct ieee80211_node *ni, s vap->iv_stats.is_rx_mgtdiscard++; /* XXX */ goto out; } - if (bpf_peers_present(vap->iv_rawbpf)) - bpf_mtap(vap->iv_rawbpf, m); vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp); - m_freem(m); - return IEEE80211_FC0_TYPE_MGT; + goto out; case IEEE80211_FC0_TYPE_CTL: vap->iv_stats.is_rx_ctl++; @@ -657,7 +654,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (bpf_peers_present(vap->iv_rawbpf) && need_tap) + if (need_tap && bpf_peers_present(vap->iv_rawbpf)) bpf_mtap(vap->iv_rawbpf, m); m_freem(m); } Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Sun Apr 26 21:03:27 2009 (r191533) +++ head/sys/net80211/ieee80211_hostap.c Sun Apr 26 21:03:29 2009 (r191534) @@ -831,11 +831,8 @@ hostap_input(struct ieee80211_node *ni, wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_WEP; } - if (bpf_peers_present(vap->iv_rawbpf)) - bpf_mtap(vap->iv_rawbpf, m); vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp); - m_freem(m); - return IEEE80211_FC0_TYPE_MGT; + goto out; case IEEE80211_FC0_TYPE_CTL: vap->iv_stats.is_rx_ctl++; @@ -859,7 +856,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (bpf_peers_present(vap->iv_rawbpf) && need_tap) + if (need_tap && bpf_peers_present(vap->iv_rawbpf)) bpf_mtap(vap->iv_rawbpf, m); m_freem(m); } Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sun Apr 26 21:03:27 2009 (r191533) +++ head/sys/net80211/ieee80211_sta.c Sun Apr 26 21:03:29 2009 (r191534) @@ -866,11 +866,8 @@ sta_input(struct ieee80211_node *ni, str wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_WEP; } - if (bpf_peers_present(vap->iv_rawbpf)) - bpf_mtap(vap->iv_rawbpf, m); vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp); - m_freem(m); - return IEEE80211_FC0_TYPE_MGT; + goto out; case IEEE80211_FC0_TYPE_CTL: vap->iv_stats.is_rx_ctl++; @@ -886,7 +883,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (bpf_peers_present(vap->iv_rawbpf) && need_tap) + if (need_tap && bpf_peers_present(vap->iv_rawbpf)) bpf_mtap(vap->iv_rawbpf, m); m_freem(m); } From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:06:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44192106566B; Sun, 26 Apr 2009 21:06:12 +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 33B388FC0A; Sun, 26 Apr 2009 21:06:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QL6CXW094639; Sun, 26 Apr 2009 21:06:12 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QL6Cux094638; Sun, 26 Apr 2009 21:06:12 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904262106.n3QL6Cux094638@svn.freebsd.org> From: Ed Schouten Date: Sun, 26 Apr 2009 21:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191535 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:06:12 -0000 Author: ed Date: Sun Apr 26 21:06:11 2009 New Revision: 191535 URL: http://svn.freebsd.org/changeset/base/191535 Log: Remove the unused insque() and remque() functions. We have no code in the tree that uses these anymore. New code should just use the regular queue(3) macros. Modified: head/sys/sys/queue.h Modified: head/sys/sys/queue.h ============================================================================== --- head/sys/sys/queue.h Sun Apr 26 21:03:29 2009 (r191534) +++ head/sys/sys/queue.h Sun Apr 26 21:06:11 2009 (r191535) @@ -578,50 +578,4 @@ struct { \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) - -#ifdef _KERNEL - -/* - * XXX insque() and remque() are an old way of handling certain queues. - * They bogusly assumes that all queue heads look alike. - */ - -struct quehead { - struct quehead *qh_link; - struct quehead *qh_rlink; -}; - -#ifdef __CC_SUPPORTS___INLINE - -static __inline void -insque(void *a, void *b) -{ - struct quehead *element = (struct quehead *)a, - *head = (struct quehead *)b; - - element->qh_link = head->qh_link; - element->qh_rlink = head; - head->qh_link = element; - element->qh_link->qh_rlink = element; -} - -static __inline void -remque(void *a) -{ - struct quehead *element = (struct quehead *)a; - - element->qh_link->qh_rlink = element->qh_rlink; - element->qh_rlink->qh_link = element->qh_link; - element->qh_rlink = 0; -} - -#else /* !__CC_SUPPORTS___INLINE */ - -void insque(void *a, void *b); -void remque(void *a); - -#endif /* __CC_SUPPORTS___INLINE */ - -#endif /* _KERNEL */ - #endif /* !_SYS_QUEUE_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:11:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E0E01065672; Sun, 26 Apr 2009 21:11:12 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D61D8FC08; Sun, 26 Apr 2009 21:11:12 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLBC1G094773; Sun, 26 Apr 2009 21:11:12 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLBCGh094772; Sun, 26 Apr 2009 21:11:12 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262111.n3QLBCGh094772@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:11:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191536 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:11:12 -0000 Author: sam Date: Sun Apr 26 21:11:12 2009 New Revision: 191536 URL: http://svn.freebsd.org/changeset/base/191536 Log: fixup ieee80211_output handling: o correct bpf handling, send 'em to the right tap o do accouting o mark mbufs holding multicast frames Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Apr 26 21:06:11 2009 (r191535) +++ head/sys/net80211/ieee80211_output.c Sun Apr 26 21:11:12 2009 (r191536) @@ -384,7 +384,17 @@ ieee80211_output(struct ifnet *ifp, stru if (ieee80211_classify(ni, m)) senderr(EIO); /* XXX */ - BPF_MTAP(ifp, m); + if (bpf_peers_present(vap->iv_rawbpf)) + bpf_mtap(vap->iv_rawbpf, m); + + IEEE80211_NODE_STAT(ni, tx_data); + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { + IEEE80211_NODE_STAT(ni, tx_mcast); + m->m_flags |= M_MCAST; + } else + IEEE80211_NODE_STAT(ni, tx_ucast); + /* NB: ieee80211_encap does not include 802.11 header */ + IEEE80211_NODE_STAT_ADD(ni, tx_bytes, m->m_pkthdr.len); /* * NB: DLT_IEEE802_11_RADIO identifies the parameters are From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:12:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B09A1065674; Sun, 26 Apr 2009 21:12:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A5658FC18; Sun, 26 Apr 2009 21:12:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLCKcn094828; Sun, 26 Apr 2009 21:12:20 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLCKnT094827; Sun, 26 Apr 2009 21:12:20 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262112.n3QLCKnT094827@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191537 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:12:20 -0000 Author: sam Date: Sun Apr 26 21:12:19 2009 New Revision: 191537 URL: http://svn.freebsd.org/changeset/base/191537 Log: add missing DLT_IEEE802_11 bpf tap in ieee80211_start Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Apr 26 21:11:12 2009 (r191536) +++ head/sys/net80211/ieee80211_output.c Sun Apr 26 21:12:19 2009 (r191537) @@ -273,6 +273,10 @@ ieee80211_start(struct ifnet *ifp) */ m->m_pkthdr.rcvif = (void *)ni; + /* XXX fragmented frames not handled */ + if (bpf_peers_present(vap->iv_rawbpf)) + bpf_mtap(vap->iv_rawbpf, m); + error = parent->if_transmit(parent, m); if (error != 0) { /* NB: IFQ_HANDOFF reclaims mbuf */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:13:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1ADB11065680; Sun, 26 Apr 2009 21:13:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A0918FC08; Sun, 26 Apr 2009 21:13:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLDID8094885; Sun, 26 Apr 2009 21:13:18 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLDIS6094884; Sun, 26 Apr 2009 21:13:18 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262113.n3QLDIS6094884@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191538 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:13:20 -0000 Author: sam Date: Sun Apr 26 21:13:18 2009 New Revision: 191538 URL: http://svn.freebsd.org/changeset/base/191538 Log: fix comment Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Apr 26 21:12:19 2009 (r191537) +++ head/sys/net80211/ieee80211_output.c Sun Apr 26 21:13:18 2009 (r191538) @@ -292,9 +292,7 @@ ieee80211_start(struct ifnet *ifp) /* * 802.11 output routine. This is (currently) used only to * connect bpf write calls to the 802.11 layer for injecting - * raw 802.11 frames. Note we locate the ieee80211com from - * the ifnet using a spare field setup at attach time. This - * will go away when the virtual ap support comes in. + * raw 802.11 frames. */ int ieee80211_output(struct ifnet *ifp, struct mbuf *m, From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:16:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36C471065670; Sun, 26 Apr 2009 21:16:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24D4A8FC1A; Sun, 26 Apr 2009 21:16:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLG4h5094990; Sun, 26 Apr 2009 21:16:04 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLG4jM094989; Sun, 26 Apr 2009 21:16:04 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904262116.n3QLG4jM094989@svn.freebsd.org> From: Robert Watson Date: Sun, 26 Apr 2009 21:16:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191539 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:16:04 -0000 Author: rwatson Date: Sun Apr 26 21:16:03 2009 New Revision: 191539 URL: http://svn.freebsd.org/changeset/base/191539 Log: Improve approximation of style(9). Modified: head/sys/kern/kern_rmlock.c Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Sun Apr 26 21:13:18 2009 (r191538) +++ head/sys/kern/kern_rmlock.c Sun Apr 26 21:16:03 2009 (r191539) @@ -55,25 +55,23 @@ __FBSDID("$FreeBSD$"); #ifdef DDB #include #endif - + #define RMPF_ONQUEUE 1 #define RMPF_SIGNAL 2 -/* - * To support usage of rmlock in CVs and msleep - * yet another list for the priority tracker - * would be needed. - * Using this lock for cv and msleep also does - * not seem very useful +/* + * To support usage of rmlock in CVs and msleep yet another list for the + * priority tracker would be needed. Using this lock for cv and msleep also + * does not seem very useful */ static __inline void compiler_memory_barrier(void) { __asm __volatile("":::"memory"); } -static void assert_rm(struct lock_object *lock, int what); -static void lock_rm(struct lock_object *lock, int how); -static int unlock_rm(struct lock_object *lock); +static void assert_rm(struct lock_object *lock, int what); +static void lock_rm(struct lock_object *lock, int how); +static int unlock_rm(struct lock_object *lock); struct lock_class lock_class_rm = { .lc_name = "rm", @@ -96,12 +94,16 @@ assert_rm(struct lock_object *lock, int } static void -lock_rm(struct lock_object *lock, int how) { +lock_rm(struct lock_object *lock, int how) +{ + panic("lock_rm called"); } static int -unlock_rm(struct lock_object *lock) { +unlock_rm(struct lock_object *lock) +{ + panic("unlock_rm called"); } @@ -111,75 +113,79 @@ MTX_SYSINIT(rm_spinlock, &rm_spinlock, " /* * Add or remove tracker from per cpu list. - * The per cpu list can be traversed at any time in forward - * direction from an interrupt on the *local* cpu. + * + * The per cpu list can be traversed at any time in forward direction from an + * interrupt on the *local* cpu. */ - -static void inline -rm_tracker_add(struct pcpu *pc, struct rm_priotracker* tracker) { - struct rm_queue* next; +static void inline +rm_tracker_add(struct pcpu *pc, struct rm_priotracker *tracker) +{ + struct rm_queue *next; + /* Initialize all tracker pointers */ tracker->rmp_cpuQueue.rmq_prev = &pc->pc_rm_queue; next = pc->pc_rm_queue.rmq_next; tracker->rmp_cpuQueue.rmq_next = next; - /* rmq_prev is not used during froward traversal */ + + /* rmq_prev is not used during froward traversal. */ next->rmq_prev = &tracker->rmp_cpuQueue; - /* Update pointer to first element */ + + /* Update pointer to first element. */ pc->pc_rm_queue.rmq_next = &tracker->rmp_cpuQueue; } - -static void inline -rm_tracker_remove(struct pcpu *pc, struct rm_priotracker* tracker) { +static void inline +rm_tracker_remove(struct pcpu *pc, struct rm_priotracker *tracker) +{ struct rm_queue *next, *prev; - next = tracker->rmp_cpuQueue.rmq_next; - prev = tracker->rmp_cpuQueue.rmq_prev; - /* Not used during forward traversal */ - next->rmq_prev = prev; - /* Remove from list */ - prev->rmq_next = next; -} + next = tracker->rmp_cpuQueue.rmq_next; + prev = tracker->rmp_cpuQueue.rmq_prev; + /* Not used during forward traversal. */ + next->rmq_prev = prev; + /* Remove from list. */ + prev->rmq_next = next; +} -static void rm_cleanIPI(void *arg) { +static void +rm_cleanIPI(void *arg) +{ struct pcpu *pc; - struct rmlock* rm = arg; + struct rmlock *rm = arg; struct rm_priotracker *tracker; - struct rm_queue* queue; + struct rm_queue *queue; pc = pcpu_find(curcpu); - for(queue = pc->pc_rm_queue.rmq_next; - queue != &pc->pc_rm_queue; + for (queue = pc->pc_rm_queue.rmq_next; queue != &pc->pc_rm_queue; queue = queue->rmq_next) { - tracker = (struct rm_priotracker *) queue; - if(tracker->rmp_rmlock == rm && tracker->rmp_flags == 0 ) { + tracker = (struct rm_priotracker *)queue; + if (tracker->rmp_rmlock == rm && tracker->rmp_flags == 0) { tracker->rmp_flags = RMPF_ONQUEUE; mtx_lock_spin(&rm_spinlock); - LIST_INSERT_HEAD(&rm->rm_activeReaders,tracker, + LIST_INSERT_HEAD(&rm->rm_activeReaders, tracker, rmp_qentry); mtx_unlock_spin(&rm_spinlock); } } - return; } - - void rm_init(struct rmlock *rm, const char *name, int opts) { + rm->rm_noreadtoken = 1; LIST_INIT(&rm->rm_activeReaders); mtx_init(&rm->rm_lock, name, "RM_MTX",MTX_NOWITNESS); - lock_init(&rm->lock_object, &lock_class_rm, name, NULL, (opts & LO_RECURSABLE)| LO_WITNESS); - + lock_init(&rm->lock_object, &lock_class_rm, name, NULL, + (opts & LO_RECURSABLE)| LO_WITNESS); } void rm_destroy(struct rmlock *rm) { + mtx_destroy(&rm->rm_lock); lock_destroy(&rm->lock_object); } @@ -194,71 +200,64 @@ rm_wowned(struct rmlock *rm) void rm_sysinit(void *arg) { + struct rm_args *args = arg; rm_init(args->ra_rm, args->ra_desc, args->ra_opts); } - static void -_rm_rlock_hard(struct rmlock *rm, struct rm_priotracker* tracker) +_rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker) { struct pcpu *pc; struct rm_queue *queue; - struct rm_priotracker* atracker; + struct rm_priotracker *atracker; critical_enter(); pc = pcpu_find(curcpu); - /* Check if we just need to do a proper critical_exit */ + /* Check if we just need to do a proper critical_exit. */ if (0 == rm->rm_noreadtoken) { critical_exit(); return; } - /* Remove our tracker from the per cpu list */ - rm_tracker_remove(pc,tracker); + /* Remove our tracker from the per cpu list. */ + rm_tracker_remove(pc, tracker); - /* Check to see if the IPI granted us the lock after all */ - if(tracker->rmp_flags) { - /* Just add back tracker - we hold the lock */ - rm_tracker_add(pc,tracker); + /* Check to see if the IPI granted us the lock after all. */ + if (tracker->rmp_flags) { + /* Just add back tracker - we hold the lock. */ + rm_tracker_add(pc, tracker); critical_exit(); return; } - - /* - * We allow readers to aquire a lock even if a writer - * is blocked if the lock is recursive and the reader - * already holds the lock + * We allow readers to aquire a lock even if a writer is blocked if + * the lock is recursive and the reader already holds the lock. */ - if ((rm->lock_object.lo_flags & LO_RECURSABLE) != 0) { /* * Just grand the lock if this thread already have a tracker - * for this lock on the per cpu queue + * for this lock on the per cpu queue. */ - - for(queue = pc->pc_rm_queue.rmq_next; - queue != &pc->pc_rm_queue; - queue = queue->rmq_next) { - atracker = (struct rm_priotracker *) queue; - if (( atracker->rmp_rmlock == rm) && - ( atracker->rmp_thread == tracker->rmp_thread )) { + for (queue = pc->pc_rm_queue.rmq_next; + queue != &pc->pc_rm_queue; queue = queue->rmq_next) { + atracker = (struct rm_priotracker *)queue; + if ((atracker->rmp_rmlock == rm) && + (atracker->rmp_thread == tracker->rmp_thread)) { mtx_lock_spin(&rm_spinlock); - LIST_INSERT_HEAD(&rm->rm_activeReaders,tracker, - rmp_qentry); + LIST_INSERT_HEAD(&rm->rm_activeReaders, + tracker, rmp_qentry); tracker->rmp_flags = RMPF_ONQUEUE; mtx_unlock_spin(&rm_spinlock); - rm_tracker_add(pc,tracker); + rm_tracker_add(pc, tracker); critical_exit(); return; } } } - sched_unpin(); critical_exit(); @@ -267,16 +266,15 @@ _rm_rlock_hard(struct rmlock *rm, struct critical_enter(); pc = pcpu_find(curcpu); - rm_tracker_add(pc,tracker); + rm_tracker_add(pc, tracker); sched_pin(); critical_exit(); - + mtx_unlock(&rm->rm_lock); - return; } void -_rm_rlock(struct rmlock *rm, struct rm_priotracker* tracker) +_rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker) { struct thread *td = curthread; struct pcpu *pc; @@ -291,51 +289,46 @@ _rm_rlock(struct rmlock *rm, struct rm_p pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ - rm_tracker_add(pc,tracker); + rm_tracker_add(pc, tracker); td->td_pinned++; /* sched_pin(); */ compiler_memory_barrier(); td->td_critnest--; - - /* - * Fast path to combine two common conditions - * into a single conditional jump + + /* + * Fast path to combine two common conditions into a single + * conditional jump. */ - - if (0 == (td->td_owepreempt | rm->rm_noreadtoken)) { + if (0 == (td->td_owepreempt | rm->rm_noreadtoken)) return; - } - /* We do not have a read token and need to acquire one */ - _rm_rlock_hard(rm,tracker); + /* We do not have a read token and need to acquire one. */ + _rm_rlock_hard(rm, tracker); } - static void -_rm_unlock_hard(struct thread *td,struct rm_priotracker* tracker) +_rm_unlock_hard(struct thread *td,struct rm_priotracker *tracker) { - + if (td->td_owepreempt) { td->td_critnest++; critical_exit(); } - - if (!tracker->rmp_flags) { + + if (!tracker->rmp_flags) return; - } - mtx_lock_spin(&rm_spinlock); - LIST_REMOVE(tracker,rmp_qentry); + LIST_REMOVE(tracker, rmp_qentry); if (tracker->rmp_flags & RMPF_SIGNAL) { struct rmlock *rm; - struct turnstile* ts; + struct turnstile *ts; rm = tracker->rmp_rmlock; - + turnstile_chain_lock(&rm->lock_object); mtx_unlock_spin(&rm_spinlock); @@ -344,35 +337,28 @@ _rm_unlock_hard(struct thread *td,struct turnstile_signal(ts, TS_EXCLUSIVE_QUEUE); turnstile_unpend(ts, TS_EXCLUSIVE_LOCK); turnstile_chain_unlock(&rm->lock_object); - - } else mtx_unlock_spin(&rm_spinlock); - -} +} void -_rm_runlock(struct rmlock *rm, struct rm_priotracker* tracker) +_rm_runlock(struct rmlock *rm, struct rm_priotracker *tracker) { struct pcpu *pc; struct thread *td = tracker->rmp_thread; td->td_critnest++; /* critical_enter(); */ pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ - rm_tracker_remove(pc,tracker); + rm_tracker_remove(pc, tracker); td->td_critnest--; td->td_pinned--; /* sched_unpin(); */ - if (0 == (td->td_owepreempt | tracker->rmp_flags)) + if (0 == (td->td_owepreempt | tracker->rmp_flags)) return; - - _rm_unlock_hard(td,tracker); - - + _rm_unlock_hard(td, tracker); } - void _rm_wlock(struct rmlock *rm) { @@ -386,53 +372,46 @@ _rm_wlock(struct rmlock *rm) rm->rm_noreadtoken = 1; - /* - * Assumes rm->rm_noreadtoken update is visible - * on other CPUs before rm_cleanIPI is called + /* + * Assumes rm->rm_noreadtoken update is visible on other CPUs + * before rm_cleanIPI is called. */ #ifdef SMP smp_rendezvous(smp_no_rendevous_barrier, rm_cleanIPI, - smp_no_rendevous_barrier - ,rm); + smp_no_rendevous_barrier, + rm); #else rm_cleanIPI(rm); #endif - mtx_lock_spin(&rm_spinlock); - - while((prio = LIST_FIRST(&rm->rm_activeReaders)) != NULL) { + while ((prio = LIST_FIRST(&rm->rm_activeReaders)) != NULL) { ts = turnstile_trywait(&rm->lock_object); prio->rmp_flags = RMPF_ONQUEUE | RMPF_SIGNAL; mtx_unlock_spin(&rm_spinlock); - turnstile_wait(ts,prio->rmp_thread, - TS_EXCLUSIVE_QUEUE); + turnstile_wait(ts, prio->rmp_thread, + TS_EXCLUSIVE_QUEUE); mtx_lock_spin(&rm_spinlock); - } - mtx_unlock_spin(&rm_spinlock); } - } - void _rm_wunlock(struct rmlock *rm) { + mtx_unlock(&rm->rm_lock); } - #ifdef LOCK_DEBUG void _rm_wlock_debug(struct rmlock *rm, const char *file, int line) { - - WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, + WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); _rm_wlock(rm); @@ -445,71 +424,75 @@ void _rm_wlock_debug(struct rmlock *rm, } -void _rm_wunlock_debug(struct rmlock *rm, const char *file, int line) +void +_rm_wunlock_debug(struct rmlock *rm, const char *file, int line) { + curthread->td_locks--; WITNESS_UNLOCK(&rm->lock_object, LOP_EXCLUSIVE, file, line); LOCK_LOG_LOCK("RMWUNLOCK", &rm->lock_object, 0, 0, file, line); _rm_wunlock(rm); -} - +} -void +void _rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, const char *file, int line) { + WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER, file, line, NULL); - WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER , file, line, NULL); - _rm_rlock(rm, tracker); LOCK_LOG_LOCK("RMRLOCK", &rm->lock_object, 0, 0, file, line); - WITNESS_LOCK(&rm->lock_object, 0 , file, line); + WITNESS_LOCK(&rm->lock_object, 0, file, line); - curthread->td_locks++; + curthread->td_locks++; } -void +void _rm_runlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, - const char *file, int line) { + const char *file, int line) +{ + curthread->td_locks--; - WITNESS_UNLOCK(&rm->lock_object, 0 , file, line); + WITNESS_UNLOCK(&rm->lock_object, 0, file, line); LOCK_LOG_LOCK("RMRUNLOCK", &rm->lock_object, 0, 0, file, line); _rm_runlock(rm, tracker); } - - - #else -/* - * Just strip out file and line arguments if no lock debugging is enabled - * in the kernel - we are called from a kernel module. -*/ - -void _rm_wlock_debug(struct rmlock *rm, const char *file, int line) +/* + * Just strip out file and line arguments if no lock debugging is enabled in + * the kernel - we are called from a kernel module. + */ +void +_rm_wlock_debug(struct rmlock *rm, const char *file, int line) { + _rm_wlock(rm); } -void _rm_wunlock_debug(struct rmlock *rm, const char *file, int line) +void +_rm_wunlock_debug(struct rmlock *rm, const char *file, int line) { + _rm_wunlock(rm); -} - -void +} + +void _rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, const char *file, int line) { + _rm_rlock(rm, tracker); } -void +void _rm_runlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, const char *file, int line) { + _rm_runlock(rm, tracker); } From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:16:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0864106566C; Sun, 26 Apr 2009 21:16:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFFB08FC08; Sun, 26 Apr 2009 21:16:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLGTSv095039; Sun, 26 Apr 2009 21:16:29 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLGTih095038; Sun, 26 Apr 2009 21:16:29 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262116.n3QLGTih095038@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:16:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191540 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:16:30 -0000 Author: sam Date: Sun Apr 26 21:16:29 2009 New Revision: 191540 URL: http://svn.freebsd.org/changeset/base/191540 Log: add missing part of r191537 that should have read: hoist DLT_IEEE802_11 bpf tap from ieee80211_encap up to ieee80211_start Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Apr 26 21:16:03 2009 (r191539) +++ head/sys/net80211/ieee80211_output.c Sun Apr 26 21:16:29 2009 (r191540) @@ -1138,10 +1138,6 @@ ieee80211_encap(struct ieee80211vap *vap IEEE80211_NODE_STAT(ni, tx_ucast); IEEE80211_NODE_STAT_ADD(ni, tx_bytes, datalen); - /* XXX fragmented frames not handled */ - if (bpf_peers_present(vap->iv_rawbpf)) - bpf_mtap(vap->iv_rawbpf, m); - return m; bad: if (m != NULL) From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:21:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17D2B1065677; Sun, 26 Apr 2009 21:21:08 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 070CA8FC18; Sun, 26 Apr 2009 21:21:08 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLL76S095183; Sun, 26 Apr 2009 21:21:07 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLL74O095182; Sun, 26 Apr 2009 21:21:07 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262121.n3QLL74O095182@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191541 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:21:08 -0000 Author: sam Date: Sun Apr 26 21:21:07 2009 New Revision: 191541 URL: http://svn.freebsd.org/changeset/base/191541 Log: add missing DLT_IEEE802_11 tap Modified: head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Sun Apr 26 21:16:29 2009 (r191540) +++ head/sys/net80211/ieee80211_superg.c Sun Apr 26 21:21:07 2009 (r191541) @@ -482,6 +482,9 @@ ff_transmit(struct ieee80211_node *ni, s struct ifnet *ifp = vap->iv_ifp; struct ifnet *parent = ni->ni_ic->ic_ifp; + if (bpf_peers_present(vap->iv_rawbpf)) + bpf_mtap(vap->iv_rawbpf, m); + error = parent->if_transmit(parent, m); if (error != 0) { /* NB: IFQ_HANDOFF reclaims mbuf */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:21:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71B2510656C2; Sun, 26 Apr 2009 21:21:48 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 511E68FC2D; Sun, 26 Apr 2009 21:21:48 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLLmVE095228; Sun, 26 Apr 2009 21:21:48 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLLmx0095227; Sun, 26 Apr 2009 21:21:48 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262121.n3QLLmx0095227@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:21:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191542 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:21:58 -0000 Author: sam Date: Sun Apr 26 21:21:48 2009 New Revision: 191542 URL: http://svn.freebsd.org/changeset/base/191542 Log: o add missing 802.3 bpf tap o add 802.11 bpf tap to output path now that it's removed from ieee80211_encap Modified: head/sys/net80211/ieee80211_wds.c Modified: head/sys/net80211/ieee80211_wds.c ============================================================================== --- head/sys/net80211/ieee80211_wds.c Sun Apr 26 21:21:07 2009 (r191541) +++ head/sys/net80211/ieee80211_wds.c Sun Apr 26 21:21:48 2009 (r191542) @@ -277,6 +277,9 @@ ieee80211_dwds_mcast(struct ieee80211vap ieee80211_free_node(ni); continue; } + + BPF_MTAP(ifp, m); /* 802.3 tx */ + /* * Encapsulate the packet in prep for transmission. */ @@ -289,6 +292,9 @@ ieee80211_dwds_mcast(struct ieee80211vap mcopy->m_flags |= M_MCAST; mcopy->m_pkthdr.rcvif = (void *) ni; + if (bpf_peers_present(vap->iv_rawbpf)) + bpf_mtap(vap->iv_rawbpf, m); + err = parent->if_transmit(parent, mcopy); if (err) { /* NB: IFQ_HANDOFF reclaims mbuf */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:24:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22895106564A; Sun, 26 Apr 2009 21:24:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11A258FC08; Sun, 26 Apr 2009 21:24:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLOoZL095342; Sun, 26 Apr 2009 21:24:50 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLOoBR095341; Sun, 26 Apr 2009 21:24:50 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200904262124.n3QLOoBR095341@svn.freebsd.org> From: Alan Cox Date: Sun, 26 Apr 2009 21:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191543 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:24:51 -0000 Author: alc Date: Sun Apr 26 21:24:50 2009 New Revision: 191543 URL: http://svn.freebsd.org/changeset/base/191543 Log: Eliminate an errant comment. Discussed with: tegge Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun Apr 26 21:21:48 2009 (r191542) +++ head/sys/vm/swap_pager.c Sun Apr 26 21:24:50 2009 (r191543) @@ -1420,8 +1420,7 @@ swp_pager_async_iodone(struct buf *bp) * Note that the requested page, reqpage, is left * busied, but we still have to wake it up. The * other pages are released (unbusied) by - * vm_page_wakeup(). We do not set reqpage's - * valid bits here, it is up to the caller. + * vm_page_wakeup(). */ KASSERT(!pmap_page_is_mapped(m), ("swp_pager_async_iodone: page %p is mapped", m)); From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:34:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1578106566C; Sun, 26 Apr 2009 21:34:53 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFCD18FC08; Sun, 26 Apr 2009 21:34:53 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLYr3f095566; Sun, 26 Apr 2009 21:34:53 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLYrOQ095565; Sun, 26 Apr 2009 21:34:53 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262134.n3QLYrOQ095565@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:34:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191544 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:34:54 -0000 Author: sam Date: Sun Apr 26 21:34:53 2009 New Revision: 191544 URL: http://svn.freebsd.org/changeset/base/191544 Log: uniformly mark mbufs that pass through the tx path with M_MCAST; drivers can now use this flag instead of inspecting the contents Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Apr 26 21:24:50 2009 (r191543) +++ head/sys/net80211/ieee80211_output.c Sun Apr 26 21:34:53 2009 (r191544) @@ -424,13 +424,15 @@ bad: static void ieee80211_send_setup( struct ieee80211_node *ni, - struct ieee80211_frame *wh, + struct mbuf *m, int type, int tid, const uint8_t sa[IEEE80211_ADDR_LEN], const uint8_t da[IEEE80211_ADDR_LEN], const uint8_t bssid[IEEE80211_ADDR_LEN]) { #define WH4(wh) ((struct ieee80211_frame_addr4 *)wh) + struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); + ieee80211_seq seqno; wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | type; if ((type & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_DATA) { @@ -473,9 +475,12 @@ ieee80211_send_setup( IEEE80211_ADDR_COPY(wh->i_addr3, bssid); } *(uint16_t *)&wh->i_dur[0] = 0; - *(uint16_t *)&wh->i_seq[0] = - htole16(ni->ni_txseqs[tid] << IEEE80211_SEQ_SEQ_SHIFT); - ni->ni_txseqs[tid]++; + + seqno = ni->ni_txseqs[tid]++; + *(uint16_t *)&wh->i_seq[0] = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); + + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) + m->m_flags |= M_MCAST; #undef WH4 } @@ -516,7 +521,7 @@ ieee80211_mgmt_output(struct ieee80211_n } wh = mtod(m, struct ieee80211_frame *); - ieee80211_send_setup(ni, wh, + ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_MGT | type, IEEE80211_NONQOS_TID, vap->iv_myaddr, ni->ni_macaddr, ni->ni_bssid); if (params->ibp_flags & IEEE80211_BPF_CRYPTO) { @@ -607,7 +612,7 @@ ieee80211_send_nulldata(struct ieee80211 const int tid = WME_AC_TO_TID(WME_AC_BE); uint8_t *qos; - ieee80211_send_setup(ni, wh, + ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS_NULL, tid, vap->iv_myaddr, ni->ni_macaddr, ni->ni_bssid); @@ -620,7 +625,7 @@ ieee80211_send_nulldata(struct ieee80211 qos[0] |= IEEE80211_QOS_ACKPOLICY_NOACK; qos[1] = 0; } else { - ieee80211_send_setup(ni, wh, + ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_NODATA, IEEE80211_NONQOS_TID, vap->iv_myaddr, ni->ni_macaddr, ni->ni_bssid); @@ -879,6 +884,7 @@ ieee80211_encap(struct ieee80211vap *vap struct ieee80211_key *key; struct llc *llc; int hdrsize, hdrspace, datalen, addqos, txfrag, is4addr; + ieee80211_seq seqno; /* * Copy existing Ethernet header to a safe place. The @@ -1091,14 +1097,14 @@ ieee80211_encap(struct ieee80211vap *vap * capability; this may also change when we pull * aggregation up into net80211 */ + seqno = ni->ni_txseqs[tid]++; *(uint16_t *)wh->i_seq = - htole16(ni->ni_txseqs[tid] << IEEE80211_SEQ_SEQ_SHIFT); - ni->ni_txseqs[tid]++; + htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); } } else { + seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; *(uint16_t *)wh->i_seq = - htole16(ni->ni_txseqs[IEEE80211_NONQOS_TID] << IEEE80211_SEQ_SEQ_SHIFT); - ni->ni_txseqs[IEEE80211_NONQOS_TID]++; + htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); } /* check if xmit fragmentation is required */ txfrag = (m->m_pkthdr.len > vap->iv_fragthreshold && @@ -1132,9 +1138,10 @@ ieee80211_encap(struct ieee80211vap *vap m->m_flags |= M_ENCAP; /* mark encapsulated */ IEEE80211_NODE_STAT(ni, tx_data); - if (IEEE80211_IS_MULTICAST(wh->i_addr1)) + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { IEEE80211_NODE_STAT(ni, tx_mcast); - else + m->m_flags |= M_MCAST; + } else IEEE80211_NODE_STAT(ni, tx_ucast); IEEE80211_NODE_STAT_ADD(ni, tx_bytes, datalen); @@ -1591,7 +1598,7 @@ ieee80211_send_probereq(struct ieee80211 } wh = mtod(m, struct ieee80211_frame *); - ieee80211_send_setup(ni, wh, + ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_REQ, IEEE80211_NONQOS_TID, sa, da, bssid); /* XXX power management? */ @@ -2195,7 +2202,7 @@ ieee80211_send_proberesp(struct ieee8021 KASSERT(m != NULL, ("no room for header")); wh = mtod(m, struct ieee80211_frame *); - ieee80211_send_setup(bss, wh, + ieee80211_send_setup(bss, m, IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP, IEEE80211_NONQOS_TID, vap->iv_myaddr, da, bss->ni_bssid); /* XXX power management? */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:37:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81D32106566C; Sun, 26 Apr 2009 21:37:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70AE28FC0C; Sun, 26 Apr 2009 21:37:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLb2gP095643; Sun, 26 Apr 2009 21:37:02 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLb2Vp095642; Sun, 26 Apr 2009 21:37:02 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262137.n3QLb2Vp095642@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:37:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191545 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:37:02 -0000 Author: sam Date: Sun Apr 26 21:37:02 2009 New Revision: 191545 URL: http://svn.freebsd.org/changeset/base/191545 Log: don't fragment ampdu aggregates Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Apr 26 21:34:53 2009 (r191544) +++ head/sys/net80211/ieee80211_output.c Sun Apr 26 21:37:02 2009 (r191545) @@ -1110,7 +1110,7 @@ ieee80211_encap(struct ieee80211vap *vap txfrag = (m->m_pkthdr.len > vap->iv_fragthreshold && !IEEE80211_IS_MULTICAST(wh->i_addr1) && (vap->iv_caps & IEEE80211_C_TXFRAG) && - (m->m_flags & M_FF) == 0); /* NB: don't fragment ff's */ + (m->m_flags & (M_FF | M_AMPDU_MPDU)) == 0); if (key != NULL) { /* * IEEE 802.1X: send EAPOL frames always in the clear. From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:46:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 291981065697; Sun, 26 Apr 2009 21:46:05 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 123F98FC19; Sun, 26 Apr 2009 21:46:05 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLk4Uu095847; Sun, 26 Apr 2009 21:46:04 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLk4hx095843; Sun, 26 Apr 2009 21:46:04 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262146.n3QLk4hx095843@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191546 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:46:06 -0000 Author: sam Date: Sun Apr 26 21:46:04 2009 New Revision: 191546 URL: http://svn.freebsd.org/changeset/base/191546 Log: add iv_recv_ctl method to allow hooking rx ctl frame handling Modified: head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Sun Apr 26 21:37:02 2009 (r191545) +++ head/sys/net80211/ieee80211_adhoc.c Sun Apr 26 21:46:04 2009 (r191546) @@ -74,6 +74,7 @@ static void adhoc_recv_mgmt(struct ieee8 int subtype, int rssi, int noise, uint32_t rstamp); static void ahdemo_recv_mgmt(struct ieee80211_node *, struct mbuf *, int subtype, int rssi, int noise, uint32_t rstamp); +static void adhoc_recv_ctl(struct ieee80211_node *, struct mbuf *, int subtype); void ieee80211_adhoc_attach(struct ieee80211com *ic) @@ -101,6 +102,7 @@ adhoc_vattach(struct ieee80211vap *vap) vap->iv_recv_mgmt = adhoc_recv_mgmt; else vap->iv_recv_mgmt = ahdemo_recv_mgmt; + vap->iv_recv_ctl = adhoc_recv_ctl; vap->iv_opdetach = adhoc_vdetach; #ifdef IEEE80211_SUPPORT_TDMA /* @@ -643,6 +645,7 @@ adhoc_input(struct ieee80211_node *ni, s case IEEE80211_FC0_TYPE_CTL: vap->iv_stats.is_rx_ctl++; IEEE80211_NODE_STAT(ni, rx_ctrl); + vap->iv_recv_ctl(ni, m, subtype); goto out; default: IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY, @@ -921,3 +924,8 @@ ahdemo_recv_mgmt(struct ieee80211_node * else vap->iv_stats.is_rx_mgtdiscard++; } + +static void +adhoc_recv_ctl(struct ieee80211_node *ni, struct mbuf *m0, int subtype) +{ +} Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Sun Apr 26 21:37:02 2009 (r191545) +++ head/sys/net80211/ieee80211_hostap.c Sun Apr 26 21:46:04 2009 (r191546) @@ -72,6 +72,7 @@ static void hostap_deliver_data(struct i struct ieee80211_node *, struct mbuf *); static void hostap_recv_mgmt(struct ieee80211_node *, struct mbuf *, int subtype, int rssi, int noise, uint32_t rstamp); +static void hostap_recv_ctl(struct ieee80211_node *, struct mbuf *, int); static void hostap_recv_pspoll(struct ieee80211_node *, struct mbuf *); void @@ -96,6 +97,7 @@ hostap_vattach(struct ieee80211vap *vap) vap->iv_newstate = hostap_newstate; vap->iv_input = hostap_input; vap->iv_recv_mgmt = hostap_recv_mgmt; + vap->iv_recv_ctl = hostap_recv_ctl; vap->iv_opdetach = hostap_vdetach; vap->iv_deliver_data = hostap_deliver_data; } @@ -837,14 +839,7 @@ hostap_input(struct ieee80211_node *ni, case IEEE80211_FC0_TYPE_CTL: vap->iv_stats.is_rx_ctl++; IEEE80211_NODE_STAT(ni, rx_ctrl); - switch (subtype) { - case IEEE80211_FC0_SUBTYPE_PS_POLL: - hostap_recv_pspoll(ni, m); - break; - case IEEE80211_FC0_SUBTYPE_BAR: - ieee80211_recv_bar(ni, m); - break; - } + vap->iv_recv_ctl(ni, m, subtype); goto out; default: IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY, @@ -2162,6 +2157,19 @@ hostap_recv_mgmt(struct ieee80211_node * } } +static void +hostap_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype) +{ + switch (subtype) { + case IEEE80211_FC0_SUBTYPE_PS_POLL: + hostap_recv_pspoll(ni, m); + break; + case IEEE80211_FC0_SUBTYPE_BAR: + ieee80211_recv_bar(ni, m); + break; + } +} + /* * Process a received ps-poll frame. */ Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sun Apr 26 21:37:02 2009 (r191545) +++ head/sys/net80211/ieee80211_sta.c Sun Apr 26 21:46:04 2009 (r191546) @@ -70,6 +70,7 @@ static int sta_input(struct ieee80211_no int rssi, int noise, uint32_t rstamp); static void sta_recv_mgmt(struct ieee80211_node *, struct mbuf *, int subtype, int rssi, int noise, uint32_t rstamp); +static void sta_recv_ctl(struct ieee80211_node *, struct mbuf *, int subtype); void ieee80211_sta_attach(struct ieee80211com *ic) @@ -93,6 +94,7 @@ sta_vattach(struct ieee80211vap *vap) vap->iv_newstate = sta_newstate; vap->iv_input = sta_input; vap->iv_recv_mgmt = sta_recv_mgmt; + vap->iv_recv_ctl = sta_recv_ctl; vap->iv_opdetach = sta_vdetach; vap->iv_bmiss = sta_beacon_miss; } @@ -872,6 +874,7 @@ sta_input(struct ieee80211_node *ni, str case IEEE80211_FC0_TYPE_CTL: vap->iv_stats.is_rx_ctl++; IEEE80211_NODE_STAT(ni, rx_ctrl); + vap->iv_recv_ctl(ni, m, subtype); goto out; default: IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY, @@ -1597,3 +1600,8 @@ sta_recv_mgmt(struct ieee80211_node *ni, #undef ISREASSOC #undef ISPROBE } + +static void +sta_recv_ctl(struct ieee80211_node *ni, struct mbuf *m0, int subtype) +{ +} Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sun Apr 26 21:37:02 2009 (r191545) +++ head/sys/net80211/ieee80211_var.h Sun Apr 26 21:46:04 2009 (r191546) @@ -416,6 +416,8 @@ struct ieee80211vap { uint32_t rstamp); void (*iv_recv_mgmt)(struct ieee80211_node *, struct mbuf *, int, int, int, uint32_t); + void (*iv_recv_ctl)(struct ieee80211_node *, + struct mbuf *, int); void (*iv_deliver_data)(struct ieee80211vap *, struct ieee80211_node *, struct mbuf *); #if 0 From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 21:50:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1034A106566C; Sun, 26 Apr 2009 21:50:22 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E14D78FC12; Sun, 26 Apr 2009 21:50:21 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QLoLeF095968; Sun, 26 Apr 2009 21:50:21 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QLoLfV095964; Sun, 26 Apr 2009 21:50:21 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262150.n3QLoLfV095964@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 21:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191547 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:50:24 -0000 Author: sam Date: Sun Apr 26 21:50:21 2009 New Revision: 191547 URL: http://svn.freebsd.org/changeset/base/191547 Log: print both fc bytes when hitting a protocol version mismatch Modified: head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_wds.c Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Sun Apr 26 21:46:04 2009 (r191546) +++ head/sys/net80211/ieee80211_adhoc.c Sun Apr 26 21:50:21 2009 (r191547) @@ -341,7 +341,8 @@ adhoc_input(struct ieee80211_node *ni, s if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) != IEEE80211_FC0_VERSION_0) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, NULL, "wrong version %x", wh->i_fc[0]); + ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x", + wh->i_fc[0], wh->i_fc[1]); vap->iv_stats.is_rx_badversion++; goto err; } Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Sun Apr 26 21:46:04 2009 (r191546) +++ head/sys/net80211/ieee80211_hostap.c Sun Apr 26 21:50:21 2009 (r191547) @@ -475,7 +475,8 @@ hostap_input(struct ieee80211_node *ni, if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) != IEEE80211_FC0_VERSION_0) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, NULL, "wrong version %x", wh->i_fc[0]); + ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x", + wh->i_fc[0], wh->i_fc[1]); vap->iv_stats.is_rx_badversion++; goto err; } Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sun Apr 26 21:46:04 2009 (r191546) +++ head/sys/net80211/ieee80211_sta.c Sun Apr 26 21:50:21 2009 (r191547) @@ -547,7 +547,8 @@ sta_input(struct ieee80211_node *ni, str if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) != IEEE80211_FC0_VERSION_0) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, NULL, "wrong version %x", wh->i_fc[0]); + ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x", + wh->i_fc[0], wh->i_fc[1]); vap->iv_stats.is_rx_badversion++; goto err; } Modified: head/sys/net80211/ieee80211_wds.c ============================================================================== --- head/sys/net80211/ieee80211_wds.c Sun Apr 26 21:46:04 2009 (r191546) +++ head/sys/net80211/ieee80211_wds.c Sun Apr 26 21:50:21 2009 (r191547) @@ -525,7 +525,8 @@ wds_input(struct ieee80211_node *ni, str if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) != IEEE80211_FC0_VERSION_0) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, NULL, "wrong version %x", wh->i_fc[0]); + ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x", + wh->i_fc[0], wh->i_fc[1]); vap->iv_stats.is_rx_badversion++; goto err; } From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 22:06:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 140AA1065670; Sun, 26 Apr 2009 22:06:43 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 004518FC08; Sun, 26 Apr 2009 22:06:43 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QM6gxE096317; Sun, 26 Apr 2009 22:06:42 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QM6g4g096299; Sun, 26 Apr 2009 22:06:42 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200904262206.n3QM6g4g096299@svn.freebsd.org> From: Marko Zec Date: Sun, 26 Apr 2009 22:06:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191548 - in head/sys: compat/linux contrib/ipfilter/netinet net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 22:06:43 -0000 Author: zec Date: Sun Apr 26 22:06:42 2009 New Revision: 191548 URL: http://svn.freebsd.org/changeset/base/191548 Log: In preparation for turning on options VIMAGE in next commits, rearrange / replace / adjust several INIT_VNET_* initializer macros, all of which currently resolve to whitespace. Reviewed by: bz (an older version of the patch) Approved by: julian (mentor) Modified: head/sys/compat/linux/linux_socket.c head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/net/if_loop.c head/sys/net/route.c head/sys/net/rtsock.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_mcast.c head/sys/netinet/in_rmx.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_fw2.c head/sys/netinet/ip_mroute.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_timewait.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/nd6_rtr.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/compat/linux/linux_socket.c Sun Apr 26 22:06:42 2009 (r191548) @@ -584,8 +584,10 @@ static int linux_socket(struct thread *td, struct linux_socket_args *args) { #ifdef INET6 +#ifndef KLD_MODULE INIT_VNET_INET6(curvnet); #endif +#endif struct socket_args /* { int domain; int type; Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun Apr 26 22:06:42 2009 (r191548) @@ -213,6 +213,7 @@ char *s; int ipfattach() { + INIT_VNET_INET(curvnet); #ifdef USE_SPL int s; #endif @@ -264,6 +265,7 @@ int ipfattach() */ int ipfdetach() { + INIT_VNET_INET(curvnet); #ifdef USE_SPL int s; #endif @@ -646,6 +648,7 @@ static int fr_send_ip(fin, m, mpp) fr_info_t *fin; mb_t *m, **mpp; { + INIT_VNET_INET(curvnet); fr_info_t fnew; ip_t *ip, *oip; int hlen; Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/net/if_loop.c Sun Apr 26 22:06:42 2009 (r191548) @@ -174,7 +174,6 @@ static int vnet_loif_iattach(const void static int loop_modevent(module_t mod, int type, void *data) { - INIT_VNET_NET(curvnet); switch (type) { case MOD_LOAD: Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/net/route.c Sun Apr 26 22:06:42 2009 (r191548) @@ -178,7 +178,7 @@ route_init(void) static int vnet_route_iattach(const void *unused __unused) { - INIT_VNET_INET(curvnet); + INIT_VNET_NET(curvnet); int table; struct domain *dom; int fam; Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/net/rtsock.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1206,7 +1206,6 @@ rt_ifannouncemsg(struct ifnet *ifp, int static void rt_dispatch(struct mbuf *m, const struct sockaddr *sa) { - INIT_VNET_NET(curvnet); struct m_tag *tag; /* Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/igmp.c Sun Apr 26 22:06:42 2009 (r191548) @@ -141,13 +141,8 @@ static int sysctl_igmp_default_version(S static int sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS); static int sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS); -#ifdef VIMAGE static vnet_attach_fn vnet_igmp_iattach; static vnet_detach_fn vnet_igmp_idetach; -#else -static int vnet_igmp_iattach(const void *); -static int vnet_igmp_idetach(const void *); -#endif /* VIMAGE */ /* * System-wide globals. @@ -333,6 +328,7 @@ igmp_restore_context(struct mbuf *m) static int sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS) { + INIT_VNET_INET(curvnet); int error; int new; @@ -372,6 +368,7 @@ out_locked: static int sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS) { + INIT_VNET_INET(curvnet); int error; int i; @@ -413,6 +410,7 @@ static int sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS) { INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); int *name; int error; u_int namelen; @@ -498,6 +496,7 @@ igmp_dispatch_queue(struct ifqueue *ifq, static __inline int igmp_isgroupreported(const struct in_addr addr) { + INIT_VNET_INET(curvnet); if (in_allhosts(addr) || ((!V_igmp_sendlocal && IN_LOCAL_GROUP(ntohl(addr.s_addr))))) @@ -560,6 +559,7 @@ igmp_domifattach(struct ifnet *ifp) static struct igmp_ifinfo * igi_alloc_locked(/*const*/ struct ifnet *ifp) { + INIT_VNET_INET(ifp->if_vnet); struct igmp_ifinfo *igi; IGMP_LOCK_ASSERT(); @@ -679,6 +679,7 @@ igmp_domifdetach(struct ifnet *ifp) static void igi_delete_locked(const struct ifnet *ifp) { + INIT_VNET_INET(ifp->if_vnet); struct igmp_ifinfo *igi, *tigi; CTR3(KTR_IGMPV3, "%s: freeing igmp_ifinfo for ifp %p(%s)", @@ -803,6 +804,7 @@ static int igmp_input_v2_query(struct ifnet *ifp, const struct ip *ip, const struct igmp *igmp) { + INIT_VNET_INET(ifp->if_vnet); struct ifmultiaddr *ifma; struct igmp_ifinfo *igi; struct in_multi *inm; @@ -895,6 +897,7 @@ out_locked: static void igmp_v2_update_group(struct in_multi *inm, const int timer) { + INIT_VNET_INET(curvnet); CTR4(KTR_IGMPV3, "%s: %s/%s timer=%d", __func__, inet_ntoa(inm->inm_addr), inm->inm_ifp->if_xname, timer); @@ -942,6 +945,7 @@ static int igmp_input_v3_query(struct ifnet *ifp, const struct ip *ip, /*const*/ struct igmpv3 *igmpv3) { + INIT_VNET_INET(ifp->if_vnet); struct igmp_ifinfo *igi; struct in_multi *inm; uint32_t maxresp, nsrc, qqi; @@ -1086,6 +1090,7 @@ static int igmp_input_v3_group_query(struct in_multi *inm, struct igmp_ifinfo *igi, int timer, /*const*/ struct igmpv3 *igmpv3) { + INIT_VNET_INET(curvnet); int retval; uint16_t nsrc; @@ -1188,6 +1193,7 @@ static int igmp_input_v1_report(struct ifnet *ifp, /*const*/ struct ip *ip, /*const*/ struct igmp *igmp) { + INIT_VNET_INET(ifp->if_vnet); struct in_ifaddr *ia; struct in_multi *inm; @@ -1294,6 +1300,7 @@ static int igmp_input_v2_report(struct ifnet *ifp, /*const*/ struct ip *ip, /*const*/ struct igmp *igmp) { + INIT_VNET_INET(ifp->if_vnet); struct in_ifaddr *ia; struct in_multi *inm; @@ -1579,21 +1586,15 @@ igmp_input(struct mbuf *m, int off) void igmp_fasttimo(void) { -#ifdef VIMAGE VNET_ITERATOR_DECL(vnet_iter); VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - INIT_VNET_INET(vnet_iter); igmp_fasttimo_vnet(); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK(); -#else /* !VIMAGE */ - - igmp_fasttimo_vnet(); -#endif /* VIMAGE */ } /* @@ -1605,6 +1606,7 @@ igmp_fasttimo(void) static void igmp_fasttimo_vnet(void) { + INIT_VNET_INET(curvnet); struct ifqueue scq; /* State-change packets */ struct ifqueue qrq; /* Query response packets */ struct ifnet *ifp; @@ -1727,6 +1729,7 @@ out_locked: static void igmp_v1v2_process_group_timer(struct in_multi *inm, const int version) { + INIT_VNET_INET(curvnet); int report_timer_expired; IN_MULTI_LOCK_ASSERT(); @@ -1775,6 +1778,7 @@ igmp_v3_process_group_timers(struct igmp struct ifqueue *qrq, struct ifqueue *scq, struct in_multi *inm, const int uri_fasthz) { + INIT_VNET_INET(curvnet); int query_response_timer_expired; int state_change_retransmit_timer_expired; @@ -1964,6 +1968,7 @@ igmp_set_version(struct igmp_ifinfo *igi static void igmp_v3_cancel_link_timers(struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); struct ifmultiaddr *ifma; struct ifnet *ifp; struct in_multi *inm; @@ -2039,6 +2044,7 @@ igmp_v3_cancel_link_timers(struct igmp_i static void igmp_v1v2_process_querier_timers(struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); IGMP_LOCK_ASSERT(); @@ -2115,20 +2121,15 @@ igmp_v1v2_process_querier_timers(struct void igmp_slowtimo(void) { -#ifdef VIMAGE VNET_ITERATOR_DECL(vnet_iter); VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - INIT_VNET_INET(vnet_iter); igmp_slowtimo_vnet(); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK(); -#else /* !VIMAGE */ - igmp_slowtimo_vnet(); -#endif /* VIMAGE */ } /* @@ -2137,6 +2138,7 @@ igmp_slowtimo(void) static void igmp_slowtimo_vnet(void) { + INIT_VNET_INET(curvnet); struct igmp_ifinfo *igi; IGMP_LOCK(); @@ -2164,9 +2166,6 @@ igmp_v1v2_queue_report(struct in_multi * IGMP_LOCK_ASSERT(); ifp = inm->inm_ifp; - /* XXX are these needed ? */ - INIT_VNET_NET(ifp->if_vnet); - INIT_VNET_INET(ifp->if_vnet); MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) @@ -2304,6 +2303,7 @@ out_locked: static int igmp_initial_join(struct in_multi *inm, struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); struct ifnet *ifp; struct ifqueue *ifq; int error, retval, syncstates; @@ -2432,6 +2432,7 @@ igmp_initial_join(struct in_multi *inm, static int igmp_handle_state_change(struct in_multi *inm, struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); struct ifnet *ifp; int retval; @@ -2491,6 +2492,7 @@ igmp_handle_state_change(struct in_multi static void igmp_final_leave(struct in_multi *inm, struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); int syncstates; syncstates = 1; @@ -3276,6 +3278,7 @@ igmp_v3_merge_state_changes(struct in_mu static void igmp_v3_dispatch_general_query(struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); struct ifmultiaddr *ifma, *tifma; struct ifnet *ifp; struct in_multi *inm; @@ -3357,12 +3360,14 @@ igmp_intr(struct mbuf *m) CTR2(KTR_IGMPV3, "%s: transmit %p", __func__, m); /* - * Restore VNET image pointer from enqueued mbuf chain + * Set VNET image pointer from enqueued mbuf chain * before doing anything else. Whilst we use interface * indexes to guard against interface detach, they are * unique to each VIMAGE and must be retrieved. */ CURVNET_SET(m->m_pkthdr.header); + INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); ifindex = igmp_restore_context(m); /* @@ -3444,7 +3449,6 @@ out: static struct mbuf * igmp_v3_encap_report(struct ifnet *ifp, struct mbuf *m) { - INIT_VNET_NET(curvnet); INIT_VNET_INET(curvnet); struct igmp_report *igmp; struct ip *ip; @@ -3616,15 +3620,15 @@ vnet_igmp_idetach(const void *unused __u return (0); } -#ifdef VIMAGE -static struct vnet_symmap vnet_igmp_symmap[] = { - VNET_SYMMAP(igmp, igi_head), - VNET_SYMMAP(igmp, igmpstat), - VNET_SYMMAP_END +#ifndef VIMAGE_GLOBALS +static vnet_modinfo_t vnet_igmp_modinfo = { + .vmi_id = VNET_MOD_IGMP, + .vmi_name = "igmp", + .vmi_dependson = VNET_MOD_INET, + .vmi_iattach = vnet_igmp_iattach, + .vmi_idetach = vnet_igmp_idetach }; -VNET_MOD_DECLARE(IGMP, igmp, vnet_igmp_iattach, vnet_igmp_idetach, - vnet_igmp_symmap); -#endif /* VIMAGE */ +#endif static int igmp_modevent(module_t mod, int type, void *unused __unused) @@ -3633,22 +3637,20 @@ igmp_modevent(module_t mod, int type, vo switch (type) { case MOD_LOAD: igmp_sysinit(); -#ifdef VIMAGE +#ifndef VIMAGE_GLOBALS vnet_mod_register(&vnet_igmp_modinfo); #else - (void)vnet_igmp_iattach(NULL); -#endif /* VIMAGE */ + vnet_igmp_iattach(NULL); +#endif break; case MOD_UNLOAD: -#ifdef VIMAGE - /* - * TODO: Allow module unload if any VIMAGE instances - * are using this module. - */ - return (EBUSY); +#ifndef VIMAGE_GLOBALS +#ifdef NOTYET + vnet_mod_deregister(&vnet_igmp_modinfo); +#endif #else - (void)vnet_igmp_idetach(NULL); -#endif /* VIMAGE */ + vnet_igmp_idetach(NULL); +#endif igmp_sysuninit(); break; default: Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/in.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1100,7 +1100,6 @@ in_ifdetach(struct ifnet *ifp) static void in_purgemaddrs(struct ifnet *ifp) { - INIT_VNET_INET(ifp->if_vnet); LIST_HEAD(,in_multi) purgeinms; struct in_multi *inm, *tinm; struct ifmultiaddr *ifma; Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/in_mcast.c Sun Apr 26 22:06:42 2009 (r191548) @@ -392,7 +392,6 @@ static int in_getmulti(struct ifnet *ifp, const struct in_addr *group, struct in_multi **pinm) { - INIT_VNET_INET(ifp->if_vnet); struct sockaddr_in gsin; struct ifmultiaddr *ifma; struct in_ifinfo *ii; @@ -1808,6 +1807,7 @@ static struct ifnet * inp_lookup_mcast_ifp(const struct inpcb *inp, const struct sockaddr_in *gsin, const struct in_addr ina) { + INIT_VNET_INET(curvnet); struct ifnet *ifp; KASSERT(gsin->sin_family == AF_INET, ("%s: not AF_INET", __func__)); @@ -1853,7 +1853,6 @@ static int inp_join_group(struct inpcb *inp, struct sockopt *sopt) { INIT_VNET_NET(curvnet); - INIT_VNET_INET(curvnet); struct group_source_req gsr; sockunion_t *gsa, *ssa; struct ifnet *ifp; @@ -2306,6 +2305,7 @@ static int inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt) { INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); struct in_addr addr; struct ip_mreqn mreqn; struct ifnet *ifp; Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/in_rmx.c Sun Apr 26 22:06:42 2009 (r191548) @@ -250,6 +250,8 @@ static void in_rtqtimo_one(void *rock); static void in_rtqtimo(void *rock) { + INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); int fibnum; void *newrock; struct timeval atv; Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/ip_divert.c Sun Apr 26 22:06:42 2009 (r191548) @@ -132,6 +132,7 @@ static u_long div_recvspace = DIVRCVQ; / static void div_zone_change(void *tag) { + INIT_VNET_INET(curvnet); uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets); } @@ -723,6 +724,7 @@ struct protosw div_protosw = { static int div_modevent(module_t mod, int type, void *unused) { + INIT_VNET_INET(curvnet); /* XXX move to iattach - revisit!!! */ int err = 0; int n; Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/ip_fw2.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1818,7 +1818,6 @@ static int add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, uint8_t mlen, uint32_t value) { - INIT_VNET_IPFW(curvnet); struct radix_node_head *rnh; struct table_entry *ent; struct radix_node *rn; @@ -4535,6 +4534,7 @@ struct ip_fw *ip_fw_default_rule; static void ipfw_tick(void * __unused unused) { + INIT_VNET_IPFW(curvnet); struct mbuf *m0, *m, *mnext, **mtailp; int i; ipfw_dyn_rule *q; @@ -4718,6 +4718,7 @@ ipfw_init(void) void ipfw_destroy(void) { + INIT_VNET_IPFW(curvnet); struct ip_fw *reap; ip_fw_chk_ptr = NULL; Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/ip_mroute.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1709,6 +1709,7 @@ X_ip_rsvp_force_done(struct socket *so _ static void X_rsvp_input(struct mbuf *m, int off __unused) { + INIT_VNET_INET(curvnet); if (!V_rsvp_on) m_freem(m); Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/tcp_subr.c Sun Apr 26 22:06:42 2009 (r191548) @@ -288,6 +288,7 @@ static struct mtx isn_mtx; static void tcp_zone_change(void *tag) { + INIT_VNET_INET(curvnet); uma_zone_set_max(V_tcbinfo.ipi_zone, maxsockets); uma_zone_set_max(V_tcpcb_zone, maxsockets); Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/tcp_timewait.c Sun Apr 26 22:06:42 2009 (r191548) @@ -132,6 +132,7 @@ tcptw_auto_size(void) static int sysctl_maxtcptw(SYSCTL_HANDLER_ARGS) { + INIT_VNET_INET(curvnet); int error, new; if (maxtcptw == 0) @@ -158,6 +159,7 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet void tcp_tw_zone_change(void) { + INIT_VNET_INET(curvnet); if (maxtcptw == 0) uma_zone_set_max(V_tcptw_zone, tcptw_auto_size()); Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/udp_usrreq.c Sun Apr 26 22:06:42 2009 (r191548) @@ -155,6 +155,7 @@ static int udp_output(struct inpcb *, st static void udp_zone_change(void *tag) { + INIT_VNET_INET(curvnet); uma_zone_set_max(V_udbinfo.ipi_zone, maxsockets); } Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet6/in6_rmx.c Sun Apr 26 22:06:42 2009 (r191548) @@ -289,8 +289,7 @@ static void in6_rtqtimo(void *rock) { CURVNET_SET_QUIET((struct vnet *) rock); - INIT_VNET_NET((struct vnet *) rock); - INIT_VNET_INET6((struct vnet *) rock); + INIT_VNET_INET6(curvnet); struct radix_node_head *rnh = rock; struct rtqk_arg arg; struct timeval atv; @@ -377,8 +376,7 @@ static void in6_mtutimo(void *rock) { CURVNET_SET_QUIET((struct vnet *) rock); - INIT_VNET_NET((struct vnet *) rock); - INIT_VNET_INET6((struct vnet *) rock); + INIT_VNET_INET6(curvnet); struct radix_node_head *rnh = rock; struct mtuex_arg arg; struct timeval atv; Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet6/nd6_rtr.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1549,6 +1549,7 @@ pfxlist_onlink_check() int nd6_prefix_onlink(struct nd_prefix *pr) { + INIT_VNET_NET(curvnet); INIT_VNET_INET6(curvnet); struct ifaddr *ifa; struct ifnet *ifp = pr->ndpr_ifp; From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 22:44:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C4301065674; Sun, 26 Apr 2009 22:44:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69F658FC17; Sun, 26 Apr 2009 22:44:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QMiNX3097078; Sun, 26 Apr 2009 22:44:23 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QMiNV8097077; Sun, 26 Apr 2009 22:44:23 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262244.n3QMiNV8097077@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 22:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191549 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 22:44:23 -0000 Author: sam Date: Sun Apr 26 22:44:23 2009 New Revision: 191549 URL: http://svn.freebsd.org/changeset/base/191549 Log: whitespace Modified: head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sun Apr 26 22:06:42 2009 (r191548) +++ head/sys/net80211/ieee80211_sta.c Sun Apr 26 22:44:23 2009 (r191549) @@ -877,6 +877,7 @@ sta_input(struct ieee80211_node *ni, str IEEE80211_NODE_STAT(ni, rx_ctrl); vap->iv_recv_ctl(ni, m, subtype); goto out; + default: IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY, wh, NULL, "bad frame type 0x%x", type); From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 22:45:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B32310656C2; Sun, 26 Apr 2009 22:45:22 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27E6C8FC13; Sun, 26 Apr 2009 22:45:22 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QMjMHs097143; Sun, 26 Apr 2009 22:45:22 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QMjMEs097141; Sun, 26 Apr 2009 22:45:22 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262245.n3QMjMEs097141@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 22:45:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191550 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 22:45:24 -0000 Author: sam Date: Sun Apr 26 22:45:21 2009 New Revision: 191550 URL: http://svn.freebsd.org/changeset/base/191550 Log: stash the node pointer in the mbuf before doing ff aggregration so this is done in only one place Modified: head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Apr 26 22:44:23 2009 (r191549) +++ head/sys/net80211/ieee80211_output.c Sun Apr 26 22:45:21 2009 (r191550) @@ -241,6 +241,13 @@ ieee80211_start(struct ifnet *ifp) ieee80211_free_node(ni); continue; } + /* + * Stash the node pointer. Note that we do this after + * any call to ieee80211_dwds_mcast because that code + * uses any existing value for rcvif to identify the + * interface it (might have been) received on. + */ + m->m_pkthdr.rcvif = (void *)ni; BPF_MTAP(ifp, m); /* 802.3 tx */ @@ -265,14 +272,6 @@ ieee80211_start(struct ifnet *ifp) } } - /* - * Stash the node pointer and hand the frame off to - * the underlying device. Note that we do this after - * any call to ieee80211_dwds_mcast because that code - * uses any existing value for rcvif. - */ - m->m_pkthdr.rcvif = (void *)ni; - /* XXX fragmented frames not handled */ if (bpf_peers_present(vap->iv_rawbpf)) bpf_mtap(vap->iv_rawbpf, m); Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Sun Apr 26 22:44:23 2009 (r191549) +++ head/sys/net80211/ieee80211_superg.c Sun Apr 26 22:45:21 2009 (r191550) @@ -725,8 +725,6 @@ ieee80211_ff_check(struct ieee80211_node mstaged->m_nextpkt = m; mstaged->m_flags |= M_FF; /* NB: mark for encap work */ } else { - m->m_pkthdr.rcvif = (void *)ni; /* NB: hold node reference */ - KASSERT(tap->txa_private == NULL, ("txa_private %p", tap->txa_private)); tap->txa_private = m; From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 22:49:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40846106566B; Sun, 26 Apr 2009 22:49:26 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C12C8FC15; Sun, 26 Apr 2009 22:49:26 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QMnQxT097240; Sun, 26 Apr 2009 22:49:26 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QMnQW3097239; Sun, 26 Apr 2009 22:49:26 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262249.n3QMnQW3097239@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 22:49:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191551 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 22:49:26 -0000 Author: sam Date: Sun Apr 26 22:49:25 2009 New Revision: 191551 URL: http://svn.freebsd.org/changeset/base/191551 Log: improvements: o formatting o more rx ampdu state o tdma state o show ifnet names o show auth policy name Modified: head/sys/net80211/ieee80211_ddb.c Modified: head/sys/net80211/ieee80211_ddb.c ============================================================================== --- head/sys/net80211/ieee80211_ddb.c Sun Apr 26 22:45:21 2009 (r191550) +++ head/sys/net80211/ieee80211_ddb.c Sun Apr 26 22:49:25 2009 (r191551) @@ -49,14 +49,18 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef IEEE80211_SUPPORT_TDMA +#include +#endif #include #include -#define DB_PRINTSYM(prefix, addr) \ - db_printf(prefix " "); \ +#define DB_PRINTSYM(prefix, name, addr) do { \ + db_printf("%s%-25s : ", prefix, name); \ db_printsym((db_addr_t) addr, DB_STGY_ANY); \ - db_printf("\n"); + db_printf("\n"); \ +} while (0) static void _db_show_sta(const struct ieee80211_node *); static void _db_show_vap(const struct ieee80211vap *, int); @@ -179,26 +183,35 @@ DB_SHOW_ALL_COMMAND(vaps, db_show_all_va static void _db_show_txampdu(const char *sep, int ix, const struct ieee80211_tx_ampdu *tap) { - db_printf("%stxampdu[%d]: %p flags %b ac %u\n", - sep, ix, tap, tap->txa_flags, IEEE80211_AGGR_BITS, tap->txa_ac); - db_printf("%s token %u qbytes %d qframes %d start %u wnd %u\n", - sep, tap->txa_token, tap->txa_qbytes, tap->txa_qframes, - tap->txa_start, tap->txa_wnd); - db_printf("%s attempts %d nextrequest %d\n", - sep, tap->txa_attempts, tap->txa_nextrequest); - /* XXX packet q + timer */ + db_printf("%stxampdu[%d]: %p flags %b ac %s\n", + sep, ix, tap, tap->txa_flags, IEEE80211_AGGR_BITS, + ieee80211_wme_acnames[tap->txa_ac]); + db_printf("%s token %u lastsample %d pkts %d avgpps %d qbytes %d qframes %d\n", + sep, tap->txa_token, tap->txa_lastsample, tap->txa_pkts, + tap->txa_avgpps, tap->txa_qbytes, tap->txa_qframes); + db_printf("%s start %u seqpending %u wnd %u attempts %d nextrequest %d\n", + sep, tap->txa_start, tap->txa_seqpending, tap->txa_wnd, + tap->txa_attempts, tap->txa_nextrequest); + /* XXX timer */ } static void _db_show_rxampdu(const char *sep, int ix, const struct ieee80211_rx_ampdu *rap) { + int i; + db_printf("%srxampdu[%d]: %p flags 0x%x tid %u\n", sep, ix, rap, rap->rxa_flags, ix /*XXX */); db_printf("%s qbytes %d qframes %d seqstart %u start %u wnd %u\n", sep, rap->rxa_qbytes, rap->rxa_qframes, rap->rxa_seqstart, rap->rxa_start, rap->rxa_wnd); - db_printf("%s age %d nframes %d\n", - sep, rap->rxa_age, rap->rxa_nframes); + db_printf("%s age %d nframes %d\n", sep, + rap->rxa_age, rap->rxa_nframes); + for (i = 0; i < IEEE80211_AGGR_BAWMAX; i++) + if (rap->rxa_m[i] != NULL) + db_printf("%s m[%2u:%4u] %p\n", sep, i, + IEEE80211_SEQ_ADD(rap->rxa_start, i), + rap->rxa_m[i]); } static void @@ -258,15 +271,43 @@ _db_show_sta(const struct ieee80211_node if (ni->ni_tx_ampdu[i].txa_flags & IEEE80211_AGGR_SETUP) _db_show_txampdu("\t", i, &ni->ni_tx_ampdu[i]); for (i = 0; i < WME_NUM_TID; i++) - if (ni->ni_rx_ampdu[i].rxa_nframes) + if (ni->ni_rx_ampdu[i].rxa_nframes || + ni->ni_rx_ampdu[i].rxa_qframes) _db_show_rxampdu("\t", i, &ni->ni_rx_ampdu[i]); db_printf("\tinact %u inact_reload %u txrate %u\n", ni->ni_inact, ni->ni_inact_reload, ni->ni_txrate); - /* XXX savedq */ /* XXX wdsq */ } +#ifdef IEEE80211_SUPPORT_TDMA +static void +_db_show_tdma(const char *sep, const struct ieee80211_tdma_state *ts, int showprocs) +{ + const char *cp; + int i; + + db_printf("%stdma %p:\n", sep, ts); + db_printf("%s features %b version %u slot %u txrate %u bintval %u peer %p\n", sep, + ts->tdma_features, TDMA_F_BITS, ts->tdma_version, ts->tdma_slot, + ts->tdma_txrate, ts->tdma_bintval, ts->tdma_peer); + db_printf("%s slotlen %u slotcnt %u bw[", sep, + ts->tdma_slotlen, ts->tdma_slotcnt); + cp = ""; + for (i = 0; i < TDMA_MAXSLOTS; i++) { + db_printf("%s%u", cp, ts->tdma_bw[i]); + cp = ":"; + } + db_printf("] inuse 0x%x active 0x%x count %d\n", + ts->tdma_inuse[0], ts->tdma_active[0], ts->tdma_count); + if (showprocs) { + DB_PRINTSYM(sep, " tdma_newstate", ts->tdma_newstate); + DB_PRINTSYM(sep, " tdma_recv_mgmt", ts->tdma_recv_mgmt); + DB_PRINTSYM(sep, " tdma_opdetach", ts->tdma_opdetach); + } +} +#endif /* IEEE80211_SUPPORT_TDMA */ + static void _db_show_vap(const struct ieee80211vap *vap, int showprocs) { @@ -280,7 +321,7 @@ _db_show_vap(const struct ieee80211vap * db_printf("\topmode %s", ieee80211_opmode_name[vap->iv_opmode]); db_printf(" state %s", ieee80211_state_name[vap->iv_state]); - db_printf(" ifp %p", vap->iv_ifp); + db_printf(" ifp %p(%s)", vap->iv_ifp, vap->iv_ifp->if_xname); db_printf("\n"); db_printf("\tic %p", vap->iv_ic); @@ -328,8 +369,8 @@ _db_show_vap(const struct ieee80211vap * db_printf(" scanreq_mindwell %u", vap->iv_scanreq_mindwell); db_printf(" scanreq_maxdwell %u", vap->iv_scanreq_maxdwell); db_printf("\n"); - db_printf(" scanreq_flags 0x%x", vap->iv_scanreq_flags); - db_printf("\tscanreq_nssid %d", vap->iv_scanreq_nssid); + db_printf("\tscanreq_flags 0x%x", vap->iv_scanreq_flags); + db_printf(" scanreq_nssid %d", vap->iv_scanreq_nssid); for (i = 0; i < vap->iv_scanreq_nssid; i++) _db_show_ssid(" scanreq_ssid[%u]", i, vap->iv_scanreq_ssid[i].len, vap->iv_scanreq_ssid[i].ssid); @@ -403,28 +444,31 @@ _db_show_vap(const struct ieee80211vap * for (i = 0; i < IEEE80211_WEP_NKID; i++) _db_show_key("\tnw_keys[%u]", i, &vap->iv_nw_keys[i]); - db_printf("\tauth %p", vap->iv_auth); + db_printf("\tauth %p(%s)", vap->iv_auth, vap->iv_auth->ia_name); db_printf(" ec %p", vap->iv_ec); db_printf(" acl %p", vap->iv_acl); db_printf(" as %p", vap->iv_as); db_printf("\n"); - +#ifdef IEEE80211_SUPPORT_TDMA + if (vap->iv_tdma != NULL) + _db_show_tdma("\t", vap->iv_tdma, showprocs); +#endif /* IEEE80211_SUPPORT_TDMA */ if (showprocs) { - DB_PRINTSYM("\tiv_key_alloc", vap->iv_key_alloc); - DB_PRINTSYM("\tiv_key_delete", vap->iv_key_delete); - DB_PRINTSYM("\tiv_key_set", vap->iv_key_set); - DB_PRINTSYM("\tiv_key_update_begin", vap->iv_key_update_begin); - DB_PRINTSYM("\tiv_key_update_end", vap->iv_key_update_end); - DB_PRINTSYM("\tiv_opdetach", vap->iv_opdetach); - DB_PRINTSYM("\tiv_input", vap->iv_input); - DB_PRINTSYM("\tiv_recv_mgmt", vap->iv_recv_mgmt); - DB_PRINTSYM("\tiv_deliver_data", vap->iv_deliver_data); - DB_PRINTSYM("\tiv_bmiss", vap->iv_bmiss); - DB_PRINTSYM("\tiv_reset", vap->iv_reset); - DB_PRINTSYM("\tiv_update_beacon", vap->iv_update_beacon); - DB_PRINTSYM("\tiv_newstate", vap->iv_newstate); - DB_PRINTSYM("\tiv_output", vap->iv_output); + DB_PRINTSYM("\t", "iv_key_alloc", vap->iv_key_alloc); + DB_PRINTSYM("\t", "iv_key_delete", vap->iv_key_delete); + DB_PRINTSYM("\t", "iv_key_set", vap->iv_key_set); + DB_PRINTSYM("\t", "iv_key_update_begin", vap->iv_key_update_begin); + DB_PRINTSYM("\t", "iv_key_update_end", vap->iv_key_update_end); + DB_PRINTSYM("\t", "iv_opdetach", vap->iv_opdetach); + DB_PRINTSYM("\t", "iv_input", vap->iv_input); + DB_PRINTSYM("\t", "iv_recv_mgmt", vap->iv_recv_mgmt); + DB_PRINTSYM("\t", "iv_deliver_data", vap->iv_deliver_data); + DB_PRINTSYM("\t", "iv_bmiss", vap->iv_bmiss); + DB_PRINTSYM("\t", "iv_reset", vap->iv_reset); + DB_PRINTSYM("\t", "iv_update_beacon", vap->iv_update_beacon); + DB_PRINTSYM("\t", "iv_newstate", vap->iv_newstate); + DB_PRINTSYM("\t", "iv_output", vap->iv_output); } } @@ -437,7 +481,7 @@ _db_show_com(const struct ieee80211com * TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) db_printf(" %s(%p)", vap->iv_ifp->if_xname, vap); db_printf("\n"); - db_printf("\tifp %p", ic->ic_ifp); + db_printf("\tifp %p(%s)", ic->ic_ifp, ic->ic_ifp->if_xname); db_printf(" comlock %p", &ic->ic_comlock); db_printf("\n"); db_printf("\theadroom %d", ic->ic_headroom); @@ -542,36 +586,36 @@ _db_show_com(const struct ieee80211com * db_printf("\n"); if (showprocs) { - DB_PRINTSYM("\tic_vap_create", ic->ic_vap_create); - DB_PRINTSYM("\tic_vap_delete", ic->ic_vap_delete); + DB_PRINTSYM("\t", "ic_vap_create", ic->ic_vap_create); + DB_PRINTSYM("\t", "ic_vap_delete", ic->ic_vap_delete); #if 0 /* operating mode attachment */ ieee80211vap_attach ic_vattach[IEEE80211_OPMODE_MAX]; #endif - DB_PRINTSYM("\tic_newassoc", ic->ic_newassoc); - DB_PRINTSYM("\tic_getradiocaps", ic->ic_getradiocaps); - DB_PRINTSYM("\tic_setregdomain", ic->ic_setregdomain); - DB_PRINTSYM("\tic_send_mgmt", ic->ic_send_mgmt); - DB_PRINTSYM("\tic_raw_xmit", ic->ic_raw_xmit); - DB_PRINTSYM("\tic_updateslot", ic->ic_updateslot); - DB_PRINTSYM("\tic_update_mcast", ic->ic_update_mcast); - DB_PRINTSYM("\tic_update_promisc", ic->ic_update_promisc); - DB_PRINTSYM("\tic_node_alloc", ic->ic_node_alloc); - DB_PRINTSYM("\tic_node_free", ic->ic_node_free); - DB_PRINTSYM("\tic_node_cleanup", ic->ic_node_cleanup); - DB_PRINTSYM("\tic_node_getrssi", ic->ic_node_getrssi); - DB_PRINTSYM("\tic_node_getsignal", ic->ic_node_getsignal); - DB_PRINTSYM("\tic_node_getmimoinfo", ic->ic_node_getmimoinfo); - DB_PRINTSYM("\tic_scan_start", ic->ic_scan_start); - DB_PRINTSYM("\tic_scan_end", ic->ic_scan_end); - DB_PRINTSYM("\tic_set_channel", ic->ic_set_channel); - DB_PRINTSYM("\tic_scan_curchan", ic->ic_scan_curchan); - DB_PRINTSYM("\tic_scan_mindwell", ic->ic_scan_mindwell); - DB_PRINTSYM("\tic_recv_action", ic->ic_recv_action); - DB_PRINTSYM("\tic_send_action", ic->ic_send_action); - DB_PRINTSYM("\tic_addba_request", ic->ic_addba_request); - DB_PRINTSYM("\tic_addba_response", ic->ic_addba_response); - DB_PRINTSYM("\tic_addba_stop", ic->ic_addba_stop); + DB_PRINTSYM("\t", "ic_newassoc", ic->ic_newassoc); + DB_PRINTSYM("\t", "ic_getradiocaps", ic->ic_getradiocaps); + DB_PRINTSYM("\t", "ic_setregdomain", ic->ic_setregdomain); + DB_PRINTSYM("\t", "ic_send_mgmt", ic->ic_send_mgmt); + DB_PRINTSYM("\t", "ic_raw_xmit", ic->ic_raw_xmit); + DB_PRINTSYM("\t", "ic_updateslot", ic->ic_updateslot); + DB_PRINTSYM("\t", "ic_update_mcast", ic->ic_update_mcast); + DB_PRINTSYM("\t", "ic_update_promisc", ic->ic_update_promisc); + DB_PRINTSYM("\t", "ic_node_alloc", ic->ic_node_alloc); + DB_PRINTSYM("\t", "ic_node_free", ic->ic_node_free); + DB_PRINTSYM("\t", "ic_node_cleanup", ic->ic_node_cleanup); + DB_PRINTSYM("\t", "ic_node_getrssi", ic->ic_node_getrssi); + DB_PRINTSYM("\t", "ic_node_getsignal", ic->ic_node_getsignal); + DB_PRINTSYM("\t", "ic_node_getmimoinfo", ic->ic_node_getmimoinfo); + DB_PRINTSYM("\t", "ic_scan_start", ic->ic_scan_start); + DB_PRINTSYM("\t", "ic_scan_end", ic->ic_scan_end); + DB_PRINTSYM("\t", "ic_set_channel", ic->ic_set_channel); + DB_PRINTSYM("\t", "ic_scan_curchan", ic->ic_scan_curchan); + DB_PRINTSYM("\t", "ic_scan_mindwell", ic->ic_scan_mindwell); + DB_PRINTSYM("\t", "ic_recv_action", ic->ic_recv_action); + DB_PRINTSYM("\t", "ic_send_action", ic->ic_send_action); + DB_PRINTSYM("\t", "ic_addba_request", ic->ic_addba_request); + DB_PRINTSYM("\t", "ic_addba_response", ic->ic_addba_response); + DB_PRINTSYM("\t", "ic_addba_stop", ic->ic_addba_stop); } if (showvaps && !TAILQ_EMPTY(&ic->ic_vaps)) { db_printf("\n"); From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 22:54:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD088106566B; Sun, 26 Apr 2009 22:54:51 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9F328FC15; Sun, 26 Apr 2009 22:54:51 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QMsp27097369; Sun, 26 Apr 2009 22:54:51 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QMspCb097367; Sun, 26 Apr 2009 22:54:51 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262254.n3QMspCb097367@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 22:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191552 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 22:54:52 -0000 Author: sam Date: Sun Apr 26 22:54:51 2009 New Revision: 191552 URL: http://svn.freebsd.org/changeset/base/191552 Log: allow drivers to hook ampdu rx start/stop Modified: head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sun Apr 26 22:49:25 2009 (r191551) +++ head/sys/net80211/ieee80211_ht.c Sun Apr 26 22:54:51 2009 (r191552) @@ -120,6 +120,9 @@ static void ieee80211_bar_response(struc struct ieee80211_tx_ampdu *tap, int status); static void ampdu_tx_stop(struct ieee80211_tx_ampdu *tap); static void bar_stop_timer(struct ieee80211_tx_ampdu *tap); +static int ampdu_rx_start(struct ieee80211_node *, struct ieee80211_rx_ampdu *, + int baparamset, int batimeout, int baseqctl); +static void ampdu_rx_stop(struct ieee80211_node *, struct ieee80211_rx_ampdu *); void ieee80211_ht_attach(struct ieee80211com *ic) @@ -132,6 +135,8 @@ ieee80211_ht_attach(struct ieee80211com ic->ic_addba_response = ieee80211_addba_response; ic->ic_addba_stop = ieee80211_addba_stop; ic->ic_bar_response = ieee80211_bar_response; + ic->ic_ampdu_rx_start = ampdu_rx_start; + ic->ic_ampdu_rx_stop = ampdu_rx_stop; ic->ic_htprotmode = IEEE80211_PROT_RTSCTS; ic->ic_curhtprotmode = IEEE80211_HTINFO_OPMODE_PURE; @@ -317,9 +322,12 @@ ampdu_rx_purge(struct ieee80211_rx_ampdu /* * Start A-MPDU rx/re-order processing for the specified TID. */ -static void -ampdu_rx_start(struct ieee80211_rx_ampdu *rap, int bufsiz, int start) +static int +ampdu_rx_start(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap, + int baparamset, int batimeout, int baseqctl) { + int bufsiz = MS(baparamset, IEEE80211_BAPS_BUFSIZ); + if (rap->rxa_flags & IEEE80211_AGGR_RUNNING) { /* * AMPDU previously setup and not terminated with a DELBA, @@ -330,15 +338,17 @@ ampdu_rx_start(struct ieee80211_rx_ampdu memset(rap, 0, sizeof(*rap)); rap->rxa_wnd = (bufsiz == 0) ? IEEE80211_AGGR_BAWMAX : min(bufsiz, IEEE80211_AGGR_BAWMAX); - rap->rxa_start = start; + rap->rxa_start = MS(baseqctl, IEEE80211_BASEQ_START); rap->rxa_flags |= IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND; + + return 0; } /* * Stop A-MPDU rx processing for the specified TID. */ static void -ampdu_rx_stop(struct ieee80211_rx_ampdu *rap) +ampdu_rx_stop(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap) { ampdu_rx_purge(rap); rap->rxa_flags &= ~(IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND); @@ -823,6 +833,7 @@ ieee80211_ht_node_init(struct ieee80211_ void ieee80211_ht_node_cleanup(struct ieee80211_node *ni) { + struct ieee80211com *ic = ni->ni_ic; int i; KASSERT(ni->ni_flags & IEEE80211_NODE_HT, ("not an HT node")); @@ -834,7 +845,7 @@ ieee80211_ht_node_cleanup(struct ieee802 ampdu_tx_stop(tap); } for (i = 0; i < WME_NUM_TID; i++) - ampdu_rx_stop(&ni->ni_rx_ampdu[i]); + ic->ic_ampdu_rx_stop(ni, &ni->ni_rx_ampdu[i]); ni->ni_htcap = 0; ni->ni_flags &= ~IEEE80211_NODE_HT_ALL; @@ -1579,14 +1590,15 @@ ieee80211_aggr_recv_action(struct ieee80 baseqctl = LE_READ_2(frm+7); tid = MS(baparamset, IEEE80211_BAPS_TID); - bufsiz = MS(baparamset, IEEE80211_BAPS_BUFSIZ); IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, "recv ADDBA request: dialogtoken %u " "baparamset 0x%x (tid %d bufsiz %d) batimeout %d " "baseqctl %d:%d", - dialogtoken, baparamset, tid, bufsiz, batimeout, + dialogtoken, baparamset, + tid, MS(baparamset, IEEE80211_BAPS_BUFSIZ), + batimeout, MS(baseqctl, IEEE80211_BASEQ_START), MS(baseqctl, IEEE80211_BASEQ_FRAG)); @@ -1601,8 +1613,9 @@ ieee80211_aggr_recv_action(struct ieee80 */ if ((ni->ni_flags & IEEE80211_NODE_AMPDU_RX) && (vap->iv_flags_ext & IEEE80211_FEXT_AMPDU_RX)) { - ampdu_rx_start(rap, bufsiz, - MS(baseqctl, IEEE80211_BASEQ_START)); + /* XXX handle ampdu_rx_start failure */ + ic->ic_ampdu_rx_start(ni, rap, + baparamset, batimeout, baseqctl); args[1] = IEEE80211_STATUS_SUCCESS; } else { @@ -1708,7 +1721,7 @@ ieee80211_aggr_recv_action(struct ieee80 ic->ic_addba_stop(ni, tap); } else { rap = &ni->ni_rx_ampdu[tid]; - ampdu_rx_stop(rap); + ic->ic_ampdu_rx_stop(ni, rap); } return; } Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sun Apr 26 22:49:25 2009 (r191551) +++ head/sys/net80211/ieee80211_var.h Sun Apr 26 22:54:51 2009 (r191552) @@ -292,6 +292,12 @@ struct ieee80211com { /* BAR response received */ void (*ic_bar_response)(struct ieee80211_node *, struct ieee80211_tx_ampdu *, int status); + /* start/stop doing A-MPDU rx processing for a station */ + int (*ic_ampdu_rx_start)(struct ieee80211_node *, + struct ieee80211_rx_ampdu *, int baparamset, + int batimeout, int baseqctl); + void (*ic_ampdu_rx_stop)(struct ieee80211_node *, + struct ieee80211_rx_ampdu *); }; struct ieee80211_aclator; From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 23:02:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D49B1065675; Sun, 26 Apr 2009 23:02:18 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2991F8FC15; Sun, 26 Apr 2009 23:02:18 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QN2IsR097565; Sun, 26 Apr 2009 23:02:18 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QN2IQq097564; Sun, 26 Apr 2009 23:02:18 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262302.n3QN2IQq097564@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 23:02:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191553 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 23:02:18 -0000 Author: sam Date: Sun Apr 26 23:02:17 2009 New Revision: 191553 URL: http://svn.freebsd.org/changeset/base/191553 Log: hoist ampdu tx aggregation setup from ieee80211_encap to ieee80211_start where it was meant all along (the code was in encap because ampdu was implemented pre vaps) Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Apr 26 22:54:51 2009 (r191552) +++ head/sys/net80211/ieee80211_output.c Sun Apr 26 23:02:17 2009 (r191553) @@ -251,8 +251,43 @@ ieee80211_start(struct ifnet *ifp) BPF_MTAP(ifp, m); /* 802.3 tx */ + /* + * Check if A-MPDU tx aggregation is setup or if we + * should try to enable it. The sta must be associated + * with HT and A-MPDU enabled for use. When the policy + * routine decides we should enable A-MPDU we issue an + * ADDBA request and wait for a reply. The frame being + * encapsulated will go out w/o using A-MPDU, or possibly + * it might be collected by the driver and held/retransmit. + * The default ic_ampdu_enable routine handles staggering + * ADDBA requests in case the receiver NAK's us or we are + * otherwise unable to establish a BA stream. + */ + if ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) && + (vap->iv_flags_ext & IEEE80211_FEXT_AMPDU_TX) && + (m->m_flags & M_EAPOL) == 0) { + const int ac = M_WME_GETAC(m); + struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[ac]; + + ieee80211_txampdu_count_packet(tap); + if (IEEE80211_AMPDU_RUNNING(tap)) { + /* + * Operational, mark frame for aggregation. + * + * XXX do tx aggregation here + */ + m->m_flags |= M_AMPDU_MPDU; + } else if (!IEEE80211_AMPDU_REQUESTED(tap) && + ic->ic_ampdu_enable(ni, tap)) { + /* + * Not negotiated yet, request service. + */ + ieee80211_ampdu_request(ni, tap); + /* XXX hold frame for reply? */ + } + } #ifdef IEEE80211_SUPPORT_SUPERG - if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF)) { + else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF)) { m = ieee80211_ff_check(ni, m); if (m == NULL) { /* NB: any ni ref held on stageq */ @@ -1042,42 +1077,6 @@ ieee80211_encap(struct ieee80211vap *vap /* map from access class/queue to 11e header priorty value */ tid = WME_AC_TO_TID(ac); qos[0] = tid & IEEE80211_QOS_TID; - /* - * Check if A-MPDU tx aggregation is setup or if we - * should try to enable it. The sta must be associated - * with HT and A-MPDU enabled for use. When the policy - * routine decides we should enable A-MPDU we issue an - * ADDBA request and wait for a reply. The frame being - * encapsulated will go out w/o using A-MPDU, or possibly - * it might be collected by the driver and held/retransmit. - * The default ic_ampdu_enable routine handles staggering - * ADDBA requests in case the receiver NAK's us or we are - * otherwise unable to establish a BA stream. - */ - if ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) && - (vap->iv_flags_ext & IEEE80211_FEXT_AMPDU_TX)) { - struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[ac]; - - ieee80211_txampdu_count_packet(tap); - if (IEEE80211_AMPDU_RUNNING(tap)) { - /* - * Operational, mark frame for aggregation. - * - * NB: We support only immediate BA's for - * AMPDU which means we set the QoS control - * field to "normal ack" (0) to get "implicit - * block ack" behaviour. - */ - m->m_flags |= M_AMPDU_MPDU; - } else if (!IEEE80211_AMPDU_REQUESTED(tap) && - ic->ic_ampdu_enable(ni, tap)) { - /* - * Not negotiated yet, request service. - */ - ieee80211_ampdu_request(ni, tap); - } - } - /* XXX works even when BA marked above */ if (ic->ic_wme.wme_wmeChanParams.cap_wmeParams[ac].wmep_noackPolicy) qos[0] |= IEEE80211_QOS_ACKPOLICY_NOACK; qos[1] = 0; From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 23:04:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7DA1106564A; Sun, 26 Apr 2009 23:04:35 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4E9C8FC15; Sun, 26 Apr 2009 23:04:35 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QN4Zd3097634; Sun, 26 Apr 2009 23:04:35 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QN4Z19097633; Sun, 26 Apr 2009 23:04:35 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262304.n3QN4Z19097633@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 23:04:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191554 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 23:04:36 -0000 Author: sam Date: Sun Apr 26 23:04:35 2009 New Revision: 191554 URL: http://svn.freebsd.org/changeset/base/191554 Log: don't depend on includes to get definitions of struct ieee80211_tx_ampdu and ieee80211_rx_ampdu; these should've been part of r191552 Modified: head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sun Apr 26 23:02:17 2009 (r191553) +++ head/sys/net80211/ieee80211_var.h Sun Apr 26 23:04:35 2009 (r191554) @@ -108,6 +108,8 @@ struct ieee80211_appie { struct ieee80211_tdma_param; struct ieee80211_rate_table; +struct ieee80211_tx_ampdu; +struct ieee80211_rx_ampdu; struct ieee80211_stageq { struct mbuf *head; /* frames linked w/ m_nextpkt */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 26 23:11:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F83D1065670; Sun, 26 Apr 2009 23:11:22 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CCA58FC14; Sun, 26 Apr 2009 23:11:22 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3QNBMp3097802; Sun, 26 Apr 2009 23:11:22 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3QNBMGE097799; Sun, 26 Apr 2009 23:11:22 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904262311.n3QNBMGE097799@svn.freebsd.org> From: Sam Leffler Date: Sun, 26 Apr 2009 23:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191555 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 23:11:23 -0000 Author: sam Date: Sun Apr 26 23:11:22 2009 New Revision: 191555 URL: http://svn.freebsd.org/changeset/base/191555 Log: add IEEE80211_FEXT_4ADDR to indicate ieee80211_encap should do 4-address encapsulation when relaying frames; this reduces the cost of the test and enables use for situations other than "sta vap + dwds" Modified: head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Sun Apr 26 23:04:35 2009 (r191554) +++ head/sys/net80211/ieee80211_ioctl.c Sun Apr 26 23:11:22 2009 (r191555) @@ -3048,8 +3048,13 @@ ieee80211_ioctl_set80211(struct ieee8021 vap->iv_opmode != IEEE80211_M_STA) return EINVAL; vap->iv_flags |= IEEE80211_F_DWDS; - } else + if (vap->iv_opmode == IEEE80211_M_STA) + vap->iv_flags_ext |= IEEE80211_FEXT_4ADDR; + } else { vap->iv_flags &= ~IEEE80211_F_DWDS; + if (vap->iv_opmode == IEEE80211_M_STA) + vap->iv_flags_ext &= ~IEEE80211_FEXT_4ADDR; + } break; case IEEE80211_IOC_INACTIVITY: if (ireq->i_val) Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Apr 26 23:04:35 2009 (r191554) +++ head/sys/net80211/ieee80211_output.c Sun Apr 26 23:11:22 2009 (r191555) @@ -974,12 +974,11 @@ ieee80211_encap(struct ieee80211vap *vap /* * 4-address frames need to be generated for: * o packets sent through a WDS vap (IEEE80211_M_WDS) - * o packets relayed by a station operating with dynamic WDS - * (IEEE80211_M_STA+IEEE80211_F_DWDS and src address) + * o packets sent through a vap marked for relaying + * (e.g. a station operating with dynamic WDS) */ is4addr = vap->iv_opmode == IEEE80211_M_WDS || - (vap->iv_opmode == IEEE80211_M_STA && - (vap->iv_flags & IEEE80211_F_DWDS) && + ((vap->iv_flags_ext & IEEE80211_FEXT_4ADDR) && !IEEE80211_ADDR_EQ(eh.ether_shost, vap->iv_myaddr)); if (is4addr) hdrsize += IEEE80211_ADDR_LEN; Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sun Apr 26 23:04:35 2009 (r191554) +++ head/sys/net80211/ieee80211_var.h Sun Apr 26 23:11:22 2009 (r191555) @@ -514,6 +514,7 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FEXT_TSN 0x00000020 /* CONF: TSN enabled */ #define IEEE80211_FEXT_SCANREQ 0x00000040 /* STATUS: scan req params */ #define IEEE80211_FEXT_RESUME 0x00000080 /* STATUS: start on resume */ +#define IEEE80211_FEXT_4ADDR 0x00000100 /* CONF: apply 4-addr encap */ #define IEEE80211_FEXT_NONERP_PR 0x00000200 /* STATUS: non-ERP sta present*/ #define IEEE80211_FEXT_SWBMISS 0x00000400 /* CONF: do bmiss in s/w */ #define IEEE80211_FEXT_DFS 0x00000800 /* CONF: DFS enabled */ @@ -535,8 +536,8 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FEXT_BITS \ "\20\1NONHT_PR\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \ - "\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\22WDSLEGACY\23PROBECHAN\24HT" \ - "\25AMDPU_TX\26AMPDU_TX\27AMSDU_TX\30AMSDU_RX\31USEHT40\32PUREN" \ + "\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\22WDSLEGACY\23PROBECHAN" \ + "\24HT\25AMDPU_TX\26AMPDU_TX\27AMSDU_TX\30AMSDU_RX\31USEHT40\32PUREN" \ "\33SHORTGI20\34SHORTGI40\35HTCOMPAT\36RIFS" #define IEEE80211_FVEN_BITS "\20" From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 15:45:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C5D1106566C; Mon, 27 Apr 2009 15:45:54 +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 790608FC1A; Mon, 27 Apr 2009 15:45:54 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RFjs0A018905; Mon, 27 Apr 2009 15:45:54 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RFjsPX018903; Mon, 27 Apr 2009 15:45:54 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200904271545.n3RFjsPX018903@svn.freebsd.org> From: Andrew Gallatin Date: Mon, 27 Apr 2009 15:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191562 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 15:45:55 -0000 Author: gallatin Date: Mon Apr 27 15:45:54 2009 New Revision: 191562 URL: http://svn.freebsd.org/changeset/base/191562 Log: Updates to mxge for multiple tx/rx rings: - Update mxge to use if_transmit(), and the new buf_ring interfaces, so as to enable multiple transmit queues. Use of if_transmit() is conditional on IFNET_BUF_RING, and is enabled by default (as in if_em). - Record a flow id on receive if receive hashing is active. I currently only record the rx ring id (0..8) rather than the 32-bit topelitz hash result, as doing the latter would require shifting the driver to use a larger rx return ring. Sponsored by: Myricom, Inc. Modified: head/sys/dev/mxge/if_mxge.c head/sys/dev/mxge/if_mxge_var.h Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Mon Apr 27 11:51:14 2009 (r191561) +++ head/sys/dev/mxge/if_mxge.c Mon Apr 27 15:45:54 2009 (r191562) @@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. #include __FBSDID("$FreeBSD$"); +#define IFNET_BUF_RING + #include #include #include @@ -66,6 +68,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef IFNET_BUF_RING +#include +#endif #include #include #include @@ -1223,6 +1228,9 @@ mxge_reset(mxge_softc_t *sc, int interru */ cmd.data0 = sc->num_slices; cmd.data1 = MXGEFW_SLICE_INTR_MODE_ONE_PER_SLICE; +#ifdef IFNET_BUF_RING + cmd.data1 |= MXGEFW_SLICE_ENABLE_MULTIPLE_TX_QUEUES; +#endif status = mxge_send_cmd(sc, MXGEFW_CMD_ENABLE_RSS_QUEUES, &cmd); if (status != 0) { @@ -1282,6 +1290,9 @@ mxge_reset(mxge_softc_t *sc, int interru ss->tx.req = 0; ss->tx.done = 0; ss->tx.pkt_done = 0; + ss->tx.queue_active = 0; + ss->tx.activate = 0; + ss->tx.deactivate = 0; ss->tx.wake = 0; ss->tx.defrag = 0; ss->tx.stall = 0; @@ -1614,10 +1625,6 @@ mxge_add_sysctls(mxge_softc_t *sc) "rx_big_cnt", CTLFLAG_RD, &ss->rx_big.cnt, 0, "rx_small_cnt"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "tx_req", - CTLFLAG_RD, &ss->tx.req, - 0, "tx_req"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "lro_flushed", CTLFLAG_RD, &ss->lro_flushed, 0, "number of lro merge queues flushed"); @@ -1627,9 +1634,15 @@ mxge_add_sysctls(mxge_softc_t *sc) 0, "number of frames appended to lro merge" "queues"); +#ifndef IFNET_BUF_RING /* only transmit from slice 0 for now */ if (slice > 0) continue; +#endif + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "tx_req", + CTLFLAG_RD, &ss->tx.req, + 0, "tx_req"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "tx_done", @@ -1651,6 +1664,18 @@ mxge_add_sysctls(mxge_softc_t *sc) "tx_defrag", CTLFLAG_RD, &ss->tx.defrag, 0, "tx_defrag"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "tx_queue_active", + CTLFLAG_RD, &ss->tx.queue_active, + 0, "tx_queue_active"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "tx_activate", + CTLFLAG_RD, &ss->tx.activate, + 0, "tx_activate"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "tx_deactivate", + CTLFLAG_RD, &ss->tx.deactivate, + 0, "tx_deactivate"); } } @@ -1873,12 +1898,21 @@ mxge_encap_tso(struct mxge_slice_state * tx->info[((cnt - 1) + tx->req) & tx->mask].flag = 1; mxge_submit_req(tx, tx->req_list, cnt); +#ifdef IFNET_BUF_RING + if ((ss->sc->num_slices > 1) && tx->queue_active == 0) { + /* tell the NIC to start polling this slice */ + *tx->send_go = 1; + tx->queue_active = 1; + tx->activate++; + wmb(); + } +#endif return; drop: bus_dmamap_unload(tx->dmat, tx->info[tx->req & tx->mask].map); m_freem(m); - ss->sc->ifp->if_oerrors++; + ss->oerrors++; if (!once) { printf("tx->max_desc exceeded via TSO!\n"); printf("mss = %d, %ld, %d!\n", mss, @@ -2075,16 +2109,131 @@ mxge_encap(struct mxge_slice_state *ss, #endif tx->info[((cnt - 1) + tx->req) & tx->mask].flag = 1; mxge_submit_req(tx, tx->req_list, cnt); +#ifdef IFNET_BUF_RING + if ((ss->sc->num_slices > 1) && tx->queue_active == 0) { + /* tell the NIC to start polling this slice */ + *tx->send_go = 1; + tx->queue_active = 1; + tx->activate++; + wmb(); + } +#endif return; drop: m_freem(m); - ifp->if_oerrors++; + ss->oerrors++; return; } +#ifdef IFNET_BUF_RING +static void +mxge_qflush(struct ifnet *ifp) +{ + mxge_softc_t *sc = ifp->if_softc; + mxge_tx_ring_t *tx; + struct mbuf *m; + int slice; + + for (slice = 0; slice < sc->num_slices; slice++) { + tx = &sc->ss[slice].tx; + mtx_lock(&tx->mtx); + while ((m = buf_ring_dequeue_sc(tx->br)) != NULL) + m_freem(m); + mtx_unlock(&tx->mtx); + } + if_qflush(ifp); +} + +static inline void +mxge_start_locked(struct mxge_slice_state *ss) +{ + mxge_softc_t *sc; + struct mbuf *m; + struct ifnet *ifp; + mxge_tx_ring_t *tx; + + sc = ss->sc; + ifp = sc->ifp; + tx = &ss->tx; + + while ((tx->mask - (tx->req - tx->done)) > tx->max_desc) { + m = drbr_dequeue(ifp, tx->br); + if (m == NULL) { + return; + } + /* let BPF see it */ + BPF_MTAP(ifp, m); + + /* give it to the nic */ + mxge_encap(ss, m); + } + /* ran out of transmit slots */ + if (((ss->if_drv_flags & IFF_DRV_OACTIVE) == 0) + && (!drbr_empty(ifp, tx->br))) { + ss->if_drv_flags |= IFF_DRV_OACTIVE; + tx->stall++; + } +} + +static int +mxge_transmit_locked(struct mxge_slice_state *ss, struct mbuf *m) +{ + mxge_softc_t *sc; + struct ifnet *ifp; + mxge_tx_ring_t *tx; + int err; + + sc = ss->sc; + ifp = sc->ifp; + tx = &ss->tx; + + if ((ss->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) { + err = drbr_enqueue(ifp, tx->br, m); + return (err); + } + + if (drbr_empty(ifp, tx->br) && + ((tx->mask - (tx->req - tx->done)) > tx->max_desc)) { + /* let BPF see it */ + BPF_MTAP(ifp, m); + /* give it to the nic */ + mxge_encap(ss, m); + } else if ((err = drbr_enqueue(ifp, tx->br, m)) != 0) { + return (err); + } + if (!drbr_empty(ifp, tx->br)) + mxge_start_locked(ss); + return (0); +} + +static int +mxge_transmit(struct ifnet *ifp, struct mbuf *m) +{ + mxge_softc_t *sc = ifp->if_softc; + struct mxge_slice_state *ss; + mxge_tx_ring_t *tx; + int err = 0; + int slice; + + slice = m->m_pkthdr.flowid; + slice &= (sc->num_slices - 1); /* num_slices always power of 2 */ + + ss = &sc->ss[slice]; + tx = &ss->tx; + + if (mtx_trylock(&tx->mtx)) { + err = mxge_transmit_locked(ss, m); + mtx_unlock(&tx->mtx); + } else { + err = drbr_enqueue(ifp, tx->br, m); + } + return (err); +} +#else static inline void mxge_start_locked(struct mxge_slice_state *ss) @@ -2114,7 +2263,7 @@ mxge_start_locked(struct mxge_slice_stat tx->stall++; } } - +#endif static void mxge_start(struct ifnet *ifp) { @@ -2381,6 +2530,11 @@ mxge_rx_done_big(struct mxge_slice_state m->m_pkthdr.csum_data = 0xffff; m->m_pkthdr.csum_flags = CSUM_PSEUDO_HDR | CSUM_DATA_VALID; } + /* flowid only valid if RSS hashing is enabled */ + if (sc->num_slices > 1) { + m->m_pkthdr.flowid = (ss - sc->ss); + m->m_flags |= M_FLOWID; + } /* pass the frame up the stack */ (*ifp->if_input)(ifp, m); } @@ -2441,6 +2595,11 @@ mxge_rx_done_small(struct mxge_slice_sta m->m_pkthdr.csum_data = 0xffff; m->m_pkthdr.csum_flags = CSUM_PSEUDO_HDR | CSUM_DATA_VALID; } + /* flowid only valid if RSS hashing is enabled */ + if (sc->num_slices > 1) { + m->m_pkthdr.flowid = (ss - sc->ss); + m->m_flags |= M_FLOWID; + } /* pass the frame up the stack */ (*ifp->if_input)(ifp, m); } @@ -2486,6 +2645,7 @@ mxge_tx_done(struct mxge_slice_state *ss struct mbuf *m; bus_dmamap_t map; int idx; + int *flags; tx = &ss->tx; ifp = ss->sc->ifp; @@ -2496,7 +2656,12 @@ mxge_tx_done(struct mxge_slice_state *ss /* mbuf and DMA map only attached to the first segment per-mbuf */ if (m != NULL) { - ifp->if_opackets++; +#ifdef IFNET_BUF_RING + ss->obytes += m->m_pkthdr.len; + if (m->m_flags & M_MCAST) + ss->omcasts++; +#endif + ss->opackets++; tx->info[idx].m = NULL; map = tx->info[idx].map; bus_dmamap_unload(tx->dmat, map); @@ -2510,15 +2675,32 @@ mxge_tx_done(struct mxge_slice_state *ss /* If we have space, clear IFF_OACTIVE to tell the stack that its OK to send packets */ - - if (ifp->if_drv_flags & IFF_DRV_OACTIVE && +#ifdef IFNET_BUF_RING + flags = &ss->if_drv_flags; +#else + flags = &ifp->if_drv_flags; +#endif + mtx_lock(&ss->tx.mtx); + if ((*flags) & IFF_DRV_OACTIVE && tx->req - tx->done < (tx->mask + 1)/4) { - mtx_lock(&ss->tx.mtx); - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + *(flags) &= ~IFF_DRV_OACTIVE; ss->tx.wake++; mxge_start_locked(ss); - mtx_unlock(&ss->tx.mtx); } +#ifdef IFNET_BUF_RING + if ((ss->sc->num_slices > 1) && (tx->req == tx->done)) { + /* let the NIC stop polling this queue, since there + * are no more transmits pending */ + if (tx->req == tx->done) { + *tx->send_stop = 1; + tx->queue_active = 0; + tx->deactivate++; + wmb(); + } + } +#endif + mtx_unlock(&ss->tx.mtx); + } static struct mxge_media_type mxge_xfp_media_types[] = @@ -2701,6 +2883,7 @@ mxge_intr(void *arg) uint8_t valid; +#ifndef IFNET_BUF_RING /* an interrupt on a non-zero slice is implicitly valid since MSI-X irqs are not shared */ if (ss != sc->ss) { @@ -2708,6 +2891,7 @@ mxge_intr(void *arg) *ss->irq_claim = be32toh(3); return; } +#endif /* make sure the DMA has finished */ if (!stats->valid) { @@ -2731,7 +2915,8 @@ mxge_intr(void *arg) send_done_count = be32toh(stats->send_done_count); while ((send_done_count != tx->pkt_done) || (rx_done->entry[rx_done->idx].length != 0)) { - mxge_tx_done(ss, (int)send_done_count); + if (send_done_count != tx->pkt_done) + mxge_tx_done(ss, (int)send_done_count); mxge_clean_rx_done(ss); send_done_count = be32toh(stats->send_done_count); } @@ -2739,7 +2924,8 @@ mxge_intr(void *arg) wmb(); } while (*((volatile uint8_t *) &stats->valid)); - if (__predict_false(stats->stats_updated)) { + /* fw link & error stats meaningful only on the first slice */ + if (__predict_false((ss == sc->ss) && stats->stats_updated)) { if (sc->link_state != stats->link_up) { sc->link_state = stats->link_up; if (sc->link_state) { @@ -3029,9 +3215,11 @@ mxge_alloc_slice_rings(struct mxge_slice /* now allocate TX resouces */ +#ifndef IFNET_BUF_RING /* only use a single TX ring for now */ if (ss != ss->sc->ss) return 0; +#endif ss->tx.mask = tx_ring_entries - 1; ss->tx.max_desc = MIN(MXGE_MAX_SEND_DESC, tx_ring_entries / 4); @@ -3197,13 +3385,21 @@ mxge_slice_open(struct mxge_slice_state /* get the lanai pointers to the send and receive rings */ err = 0; +#ifndef IFNET_BUF_RING /* We currently only send from the first slice */ if (slice == 0) { +#endif cmd.data0 = slice; err = mxge_send_cmd(sc, MXGEFW_CMD_GET_SEND_OFFSET, &cmd); ss->tx.lanai = (volatile mcp_kreq_ether_send_t *)(sc->sram + cmd.data0); + ss->tx.send_go = (volatile uint32_t *) + (sc->sram + MXGEFW_ETH_SEND_GO + 64 * slice); + ss->tx.send_stop = (volatile uint32_t *) + (sc->sram + MXGEFW_ETH_SEND_STOP + 64 * slice); +#ifndef IFNET_BUF_RING } +#endif cmd.data0 = slice; err |= mxge_send_cmd(sc, MXGEFW_CMD_GET_SMALL_RX_OFFSET, &cmd); @@ -3255,6 +3451,7 @@ mxge_open(mxge_softc_t *sc) int err, big_bytes, nbufs, slice, cl_size, i; bus_addr_t bus; volatile uint8_t *itable; + struct mxge_slice_state *ss; /* Copy the MAC address in case it was overridden */ bcopy(IF_LLADDR(sc->ifp), sc->mac_addr, ETHER_ADDR_LEN); @@ -3324,10 +3521,22 @@ mxge_open(mxge_softc_t *sc) } /* Now give him the pointer to the stats block */ - cmd.data0 = MXGE_LOWPART_TO_U32(sc->ss->fw_stats_dma.bus_addr); - cmd.data1 = MXGE_HIGHPART_TO_U32(sc->ss->fw_stats_dma.bus_addr); - cmd.data2 = sizeof(struct mcp_irq_data); - err = mxge_send_cmd(sc, MXGEFW_CMD_SET_STATS_DMA_V2, &cmd); + for (slice = 0; +#ifdef IFNET_BUF_RING + slice < sc->num_slices; +#else + slice < 1; +#endif + slice++) { + ss = &sc->ss[slice]; + cmd.data0 = + MXGE_LOWPART_TO_U32(ss->fw_stats_dma.bus_addr); + cmd.data1 = + MXGE_HIGHPART_TO_U32(ss->fw_stats_dma.bus_addr); + cmd.data2 = sizeof(struct mcp_irq_data); + cmd.data2 |= (slice << 16); + err |= mxge_send_cmd(sc, MXGEFW_CMD_SET_STATS_DMA_V2, &cmd); + } if (err != 0) { bus = sc->ss->fw_stats_dma.bus_addr; @@ -3363,6 +3572,13 @@ mxge_open(mxge_softc_t *sc) device_printf(sc->dev, "Couldn't bring up link\n"); goto abort; } +#ifdef IFNET_BUF_RING + for (slice = 0; slice < sc->num_slices; slice++) { + ss = &sc->ss[slice]; + ss->if_drv_flags |= IFF_DRV_RUNNING; + ss->if_drv_flags &= ~IFF_DRV_OACTIVE; + } +#endif sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc); @@ -3381,8 +3597,18 @@ mxge_close(mxge_softc_t *sc) { mxge_cmd_t cmd; int err, old_down_cnt; +#ifdef IFNET_BUF_RING + struct mxge_slice_state *ss; + int slice; +#endif callout_stop(&sc->co_hdl); +#ifdef IFNET_BUF_RING + for (slice = 0; slice < sc->num_slices; slice++) { + ss = &sc->ss[slice]; + ss->if_drv_flags &= ~IFF_DRV_RUNNING; + } +#endif sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; old_down_cnt = sc->down_cnt; wmb(); @@ -3448,9 +3674,10 @@ mxge_read_reboot(mxge_softc_t *sc) } static int -mxge_watchdog_reset(mxge_softc_t *sc) +mxge_watchdog_reset(mxge_softc_t *sc, int slice) { struct pci_devinfo *dinfo; + mxge_tx_ring_t *tx; int err; uint32_t reboot; uint16_t cmd; @@ -3497,11 +3724,17 @@ mxge_watchdog_reset(mxge_softc_t *sc) err = mxge_open(sc); } } else { - device_printf(sc->dev, "NIC did not reboot, ring state:\n"); - device_printf(sc->dev, "tx.req=%d tx.done=%d\n", - sc->ss->tx.req, sc->ss->tx.done); + tx = &sc->ss[slice].tx; + device_printf(sc->dev, + "NIC did not reboot, slice %d ring state:\n", + slice); + device_printf(sc->dev, + "tx.req=%d tx.done=%d, tx.queue_active=%d\n", + tx->req, tx->done, tx->queue_active); + device_printf(sc->dev, "tx.activate=%d tx.deactivate=%d\n", + tx->activate, tx->deactivate); device_printf(sc->dev, "pkt_done=%d fw=%d\n", - sc->ss->tx.pkt_done, + tx->pkt_done, be32toh(sc->ss->fw_stats->send_done_count)); device_printf(sc->dev, "not resetting\n"); } @@ -3511,26 +3744,35 @@ mxge_watchdog_reset(mxge_softc_t *sc) static int mxge_watchdog(mxge_softc_t *sc) { - mxge_tx_ring_t *tx = &sc->ss->tx; + mxge_tx_ring_t *tx; uint32_t rx_pause = be32toh(sc->ss->fw_stats->dropped_pause); - int err = 0; + int i, err = 0; /* see if we have outstanding transmits, which have been pending for more than mxge_ticks */ - if (tx->req != tx->done && - tx->watchdog_req != tx->watchdog_done && - tx->done == tx->watchdog_done) { - /* check for pause blocking before resetting */ - if (tx->watchdog_rx_pause == rx_pause) - err = mxge_watchdog_reset(sc); - else - device_printf(sc->dev, "Flow control blocking " - "xmits, check link partner\n"); - } + for (i = 0; +#ifdef IFNET_BUF_RING + (i < sc->num_slices) && (err == 0); +#else + (i < 1) && (err == 0); +#endif + i++) { + tx = &sc->ss[i].tx; + if (tx->req != tx->done && + tx->watchdog_req != tx->watchdog_done && + tx->done == tx->watchdog_done) { + /* check for pause blocking before resetting */ + if (tx->watchdog_rx_pause == rx_pause) + err = mxge_watchdog_reset(sc, i); + else + device_printf(sc->dev, "Flow control blocking " + "xmits, check link partner\n"); + } - tx->watchdog_req = tx->req; - tx->watchdog_done = tx->done; - tx->watchdog_rx_pause = rx_pause; + tx->watchdog_req = tx->req; + tx->watchdog_done = tx->done; + tx->watchdog_rx_pause = rx_pause; + } if (sc->need_media_probe) mxge_media_probe(sc); @@ -3542,15 +3784,36 @@ mxge_update_stats(mxge_softc_t *sc) { struct mxge_slice_state *ss; u_long ipackets = 0; + u_long opackets = 0; +#ifdef IFNET_BUF_RING + u_long obytes = 0; + u_long omcasts = 0; + u_long odrops = 0; +#endif + u_long oerrors = 0; int slice; - for(slice = 0; slice < sc->num_slices; slice++) { + for (slice = 0; slice < sc->num_slices; slice++) { ss = &sc->ss[slice]; ipackets += ss->ipackets; + opackets += ss->opackets; +#ifdef IFNET_BUF_RING + obytes += ss->obytes; + omcasts += ss->omcasts; + odrops += ss->tx.br->br_drops; +#endif + oerrors += ss->oerrors; } sc->ifp->if_ipackets = ipackets; - + sc->ifp->if_opackets = opackets; +#ifdef IFNET_BUF_RING + sc->ifp->if_obytes = obytes; + sc->ifp->if_omcasts = omcasts; + sc->ifp->if_snd.ifq_drops = odrops; +#endif + sc->ifp->if_oerrors = oerrors; } + static void mxge_tick(void *arg) { @@ -3772,6 +4035,12 @@ mxge_free_slices(mxge_softc_t *sc) if (ss->fw_stats != NULL) { mxge_dma_free(&ss->fw_stats_dma); ss->fw_stats = NULL; +#ifdef IFNET_BUF_RING + if (ss->tx.br != NULL) { + drbr_free(ss->tx.br, M_DEVBUF); + ss->tx.br = NULL; + } +#endif mtx_destroy(&ss->tx.mtx); } if (ss->rx_done.entry != NULL) { @@ -3822,8 +4091,10 @@ mxge_alloc_slices(mxge_softc_t *sc) * (including tx) are used used only on the first * slice for now */ +#ifndef IFNET_BUF_RING if (i > 0) continue; +#endif bytes = sizeof (*ss->fw_stats); err = mxge_dma_alloc(sc, &ss->fw_stats_dma, @@ -3834,6 +4105,10 @@ mxge_alloc_slices(mxge_softc_t *sc) snprintf(ss->tx.mtx_name, sizeof(ss->tx.mtx_name), "%s:tx(%d)", device_get_nameunit(sc->dev), i); mtx_init(&ss->tx.mtx, ss->tx.mtx_name, NULL, MTX_DEF); +#ifdef IFNET_BUF_RING + ss->tx.br = buf_ring_alloc(2048, M_DEVBUF, M_WAITOK, + &ss->tx.mtx); +#endif } return (0); @@ -4307,6 +4582,10 @@ mxge_attach(device_t dev) ifp->if_mtu = 9000; mxge_add_sysctls(sc); +#ifdef IFNET_BUF_RING + ifp->if_transmit = mxge_transmit; + ifp->if_qflush = mxge_qflush; +#endif return 0; abort_with_rings: Modified: head/sys/dev/mxge/if_mxge_var.h ============================================================================== --- head/sys/dev/mxge/if_mxge_var.h Mon Apr 27 11:51:14 2009 (r191561) +++ head/sys/dev/mxge/if_mxge_var.h Mon Apr 27 15:45:54 2009 (r191562) @@ -125,7 +125,12 @@ typedef struct typedef struct { struct mtx mtx; +#ifdef IFNET_MULTIQUEUE + struct buf_ring *br; +#endif volatile mcp_kreq_ether_send_t *lanai; /* lanai ptr for sendq */ + volatile uint32_t *send_go; /* doorbell for sendq */ + volatile uint32_t *send_stop; /* doorbell for sendq */ mcp_kreq_ether_send_t *req_list; /* host shadow of sendq */ char *req_bytes; bus_dma_segment_t *seg_list; @@ -136,6 +141,9 @@ typedef struct int done; /* transmits completed */ int pkt_done; /* packets completed */ int max_desc; /* max descriptors per xmit */ + int queue_active; /* fw currently polling this queue*/ + int activate; + int deactivate; int stall; /* #times hw queue exhausted */ int wake; /* #times irq re-enabled xmit */ int watchdog_req; /* cache of req */ @@ -182,6 +190,11 @@ struct mxge_slice_state { mcp_irq_data_t *fw_stats; volatile uint32_t *irq_claim; u_long ipackets; + u_long opackets; + u_long obytes; + u_long omcasts; + u_long oerrors; + int if_drv_flags; struct lro_head lro_active; struct lro_head lro_free; int lro_queued; From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 15:58:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DEC9106564A; Mon, 27 Apr 2009 15:58:38 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A9F58FC1E; Mon, 27 Apr 2009 15:58:38 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RFwcCT019158; Mon, 27 Apr 2009 15:58:38 GMT (envelope-from ambrisko@svn.freebsd.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RFwcKr019155; Mon, 27 Apr 2009 15:58:38 GMT (envelope-from ambrisko@svn.freebsd.org) Message-Id: <200904271558.n3RFwcKr019155@svn.freebsd.org> From: Doug Ambrisko Date: Mon, 27 Apr 2009 15:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191563 - head/sys/dev/rp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 15:58:39 -0000 Author: ambrisko Date: Mon Apr 27 15:58:38 2009 New Revision: 191563 URL: http://svn.freebsd.org/changeset/base/191563 Log: Start to convert this over to the new tty layer. These changes allow this driver to compile and limp along with the new layer. These changes do not deal with proper locking around access to the HW. This is only a starting point. I have not tested modem control but tip seems to work okay and I can send and receive characters which I needed for one of my -current boxes. I have not tied this driver back up to the build since I don't want people to think it is ready for prime time. If anyone else has some cycles to work on this feel free to! Also add support for a 16 port PCI interface I have at work. Glanced at by: ed Modified: head/sys/dev/rp/rp.c head/sys/dev/rp/rp_pci.c head/sys/dev/rp/rpreg.h Modified: head/sys/dev/rp/rp.c ============================================================================== --- head/sys/dev/rp/rp.c Mon Apr 27 15:45:54 2009 (r191562) +++ head/sys/dev/rp/rp.c Mon Apr 27 15:58:38 2009 (r191563) @@ -117,6 +117,8 @@ Byte_t rp_sBitMapSetTbl[8] = 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80 }; +static void rpfree(void *); + /*************************************************************************** Function: sReadAiopID Purpose: Read the AIOP idenfication number directly from an AIOP. @@ -572,21 +574,19 @@ static struct rp_port *p_rp_table[MAX_RP * The top-level routines begin here */ -static void rpbreak(struct tty *, int); static void rpclose(struct tty *tp); static void rphardclose(struct tty *tp); static int rpmodem(struct tty *, int, int); static int rpparam(struct tty *, struct termios *); static void rpstart(struct tty *); -static void rpstop(struct tty *, int); -static t_open_t rpopen; +static int rpioctl(struct tty *, u_long, caddr_t, struct thread *); +static int rpopen(struct tty *); static void rp_do_receive(struct rp_port *rp, struct tty *tp, CHANNEL_t *cp, unsigned int ChanStatus) { - int spl; unsigned int CharNStat; - int i, ToRecv, wRecv, ch, ttynocopy; + int ToRecv, ch, err = 0; ToRecv = sGetRxCnt(cp); if(ToRecv == 0) @@ -608,22 +608,22 @@ static void rp_do_receive(struct rp_port FIFO one word at a time, pulling apart the character and the status. Update error counters depending on status. */ + tty_lock(tp); if(ChanStatus & STATMODE) { while(ToRecv) { - if(tp->t_state & TS_TBLOCK) { - break; - } CharNStat = rp_readch2(cp,sGetTxRxDataIO(cp)); ch = CharNStat & 0xff; if((CharNStat & STMBREAK) || (CharNStat & STMFRAMEH)) - ch |= TTY_FE; + err |= TRE_FRAMING; else if (CharNStat & STMPARITYH) - ch |= TTY_PE; - else if (CharNStat & STMRCVROVRH) + err |= TRE_PARITY; + else if (CharNStat & STMRCVROVRH) { rp->rp_overflows++; + err |= TRE_OVERRUN; + } - ttyld_rint(tp, ch); + ttydisc_rint(tp, ch, err); ToRecv--; } /* @@ -634,42 +634,15 @@ static void rp_do_receive(struct rp_port sDisRxStatusMode(cp); } } else { - /* - * Avoid the grotesquely inefficient lineswitch routine - * (ttyinput) in "raw" mode. It usually takes about 450 - * instructions (that's without canonical processing or echo!). - * slinput is reasonably fast (usually 40 instructions plus - * call overhead). - */ ToRecv = sGetRxCnt(cp); - if ( tp->t_state & TS_CAN_BYPASS_L_RINT ) { - if ( ToRecv > RXFIFO_SIZE ) { - ToRecv = RXFIFO_SIZE; - } - for ( i = 0, wRecv = ToRecv >> 1; wRecv > 0; i += 2, wRecv-- ) { - le16enc(rp->RxBuf + i,rp_readch2(cp,sGetTxRxDataIO(cp))); - } - if ( ToRecv & 1 ) { - rp->RxBuf[(ToRecv-1)] = rp_readch1(cp,sGetTxRxDataIO(cp)); - } - tk_nin += ToRecv; - tk_rawcc += ToRecv; - tp->t_rawcc += ToRecv; - ttynocopy = b_to_q(rp->RxBuf, ToRecv, &tp->t_rawq); - ttwakeup(tp); - } else { - while (ToRecv) { - if(tp->t_state & TS_TBLOCK) { - break; - } - ch = (u_char) rp_readch1(cp,sGetTxRxDataIO(cp)); - spl = spltty(); - ttyld_rint(tp, ch); - splx(spl); - ToRecv--; - } + while (ToRecv) { + ch = rp_readch1(cp,sGetTxRxDataIO(cp)); + ttydisc_rint(tp, ch & 0xff, err); + ToRecv--; } } + ttydisc_rint_done(tp); + tty_unlock(tp); } static void rp_handle_port(struct rp_port *rp) @@ -687,21 +660,12 @@ static void rp_handle_port(struct rp_por IntMask = IntMask & rp->rp_intmask; ChanStatus = sGetChanStatus(cp); if(IntMask & RXF_TRIG) - if(!(tp->t_state & TS_TBLOCK) && (tp->t_state & TS_CARR_ON) && (tp->t_state & TS_ISOPEN)) { - rp_do_receive(rp, tp, cp, ChanStatus); - } + rp_do_receive(rp, tp, cp, ChanStatus); if(IntMask & DELTA_CD) { if(ChanStatus & CD_ACT) { - if(!(tp->t_state & TS_CARR_ON) ) { - (void)ttyld_modem(tp, 1); - } + (void)ttydisc_modem(tp, 1); } else { - if((tp->t_state & TS_CARR_ON)) { - (void)ttyld_modem(tp, 0); - if(ttyld_modem(tp, 0) == 0) { - rphardclose(tp); - } - } + (void)ttydisc_modem(tp, 0); } } /* oldcts = rp->rp_cts; @@ -740,15 +704,13 @@ static void rp_do_poll(void *not_used) for(line = 0, rp = rp_addr(unit); line < rp_num_ports[unit]; line++, rp++) { tp = rp->rp_tty; - if((tp->t_state & TS_BUSY) && (tp->t_state & TS_ISOPEN)) { - count = sGetTxCnt(&rp->rp_channel); - if(count == 0) - tp->t_state &= ~(TS_BUSY); - if(!(tp->t_state & TS_TTSTOP) && - (count <= rp->rp_restart)) { - ttyld_start(tp); - } + tty_lock(tp); + count = sGetTxCnt(&rp->rp_channel); + if (count >= 0 && + (count <= rp->rp_restart)) { + rpstart(tp); } + tty_unlock(tp); } } if(rp_num_ports_open) @@ -756,10 +718,31 @@ static void rp_do_poll(void *not_used) (void *)NULL, POLL_INTERVAL); } +static struct ttydevsw rp_tty_class = { + .tsw_flags = TF_INITLOCK|TF_CALLOUT, + .tsw_open = rpopen, + .tsw_close = rpclose, + .tsw_outwakeup = rpstart, + .tsw_ioctl = rpioctl, + .tsw_param = rpparam, + .tsw_modem = rpmodem, + .tsw_free = rpfree, +}; + + +static void +rpfree(void *softc) +{ + struct rp_port *rp = softc; + CONTROLLER_t *ctlp = rp->rp_ctlp; + + atomic_subtract_32(&ctlp->free, 1); +} + int rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int num_ports) { - int oldspl, unit; + int unit; int num_chan; int aiop, chan, port; int ChanStatus, line, count; @@ -775,7 +758,7 @@ rp_attachcommon(CONTROLLER_T *ctlp, int callout_handle_init(&rp_callout_handle); ctlp->rp = rp = (struct rp_port *) - malloc(sizeof(struct rp_port) * num_ports, M_TTYS, M_NOWAIT | M_ZERO); + malloc(sizeof(struct rp_port) * num_ports, M_DEVBUF, M_NOWAIT | M_ZERO); if (rp == NULL) { device_printf(ctlp->dev, "rp_attachcommon: Could not malloc rp_ports structures.\n"); retval = ENOMEM; @@ -785,26 +768,13 @@ rp_attachcommon(CONTROLLER_T *ctlp, int count = unit * 32; /* board times max ports per card SG */ bzero(rp, sizeof(struct rp_port) * num_ports); - oldspl = spltty(); rp_addr(unit) = rp; - splx(oldspl); port = 0; for(aiop=0; aiop < num_aiops; aiop++) { num_chan = sGetAiopNumChan(ctlp, aiop); for(chan=0; chan < num_chan; chan++, port++, rp++) { - tp = rp->rp_tty = ttyalloc(); - tp->t_sc = rp; - tp->t_param = rpparam; - tp->t_oproc = rpstart; - tp->t_stop = rpstop; - tp->t_break = rpbreak; - tp->t_modem = rpmodem; - tp->t_close = rpclose; - tp->t_open = rpopen; - tp->t_ififosize = 512; - tp->t_ispeedwat = (speed_t)-1; - tp->t_ospeedwat = (speed_t)-1; + rp->rp_tty = tp = tty_alloc(&rp_tty_class, rp, NULL); rp->rp_port = port; rp->rp_ctlp = ctlp; rp->rp_unit = unit; @@ -826,11 +796,13 @@ rp_attachcommon(CONTROLLER_T *ctlp, int rp->rp_cts = (ChanStatus & CTS_ACT) != 0; line = (unit << 5) | (aiop << 3) | chan; rp_table(line) = rp; - ttycreate(tp, TS_CALLOUT, "R%r%r", unit, port); + tty_makedev(tp, NULL, "R%r%r", unit, port); } } rp_ndevs++; + mtx_init(&ctlp->hwmtx, "rp_hwmtx", NULL, MTX_DEF); + ctlp->hwmtx_init = 1; return (0); nogo: @@ -842,7 +814,7 @@ nogo: void rp_releaseresource(CONTROLLER_t *ctlp) { - int i, s, unit; + int i, unit; struct rp_port *rp; @@ -850,21 +822,25 @@ rp_releaseresource(CONTROLLER_t *ctlp) if (rp_addr(unit) != NULL) { for (i = 0; i < rp_num_ports[unit]; i++) { rp = rp_addr(unit) + i; - ttyfree(rp->rp_tty); + atomic_add_32(&ctlp->free, 1); + tty_lock(rp->rp_tty); + tty_rel_gone(rp->rp_tty); } } + while (ctlp->free != 0) { + pause("rpwt", hz / 10); + } + if (ctlp->rp != NULL) { - s = spltty(); for (i = 0 ; i < sizeof(p_rp_addr) / sizeof(*p_rp_addr) ; i++) if (p_rp_addr[i] == ctlp->rp) p_rp_addr[i] = NULL; for (i = 0 ; i < sizeof(p_rp_table) / sizeof(*p_rp_table) ; i++) if (p_rp_table[i] == ctlp->rp) p_rp_table[i] = NULL; - splx(s); - free(ctlp->rp, M_DEVBUF); - ctlp->rp = NULL; + free(ctlp->rp, M_DEVBUF); + ctlp->rp = NULL; } } @@ -875,15 +851,13 @@ rp_untimeout(void) } static int -rpopen(struct tty *tp, struct cdev *dev) +rpopen(struct tty *tp) { struct rp_port *rp; - int oldspl, flags; + int flags; unsigned int IntMask, ChanStatus; - rp = dev->si_drv1; - - oldspl = spltty(); + rp = tty_softc(tp); flags = 0; flags |= SET_RTS; @@ -938,7 +912,7 @@ rpclose(struct tty *tp) { struct rp_port *rp; - rp = tp->t_sc; + rp = tty_softc(tp); rphardclose(tp); device_unbusy(rp->rp_ctlp->dev); } @@ -949,7 +923,7 @@ rphardclose(struct tty *tp) struct rp_port *rp; CHANNEL_t *cp; - rp = tp->t_sc; + rp = tty_softc(tp); cp = &rp->rp_channel; sFlushRxFIFO(cp); @@ -961,6 +935,7 @@ rphardclose(struct tty *tp) sDisTxSoftFlowCtl(cp); sClrTxXOFF(cp); +#ifdef DJA if(tp->t_cflag&HUPCL || !(tp->t_state&TS_ISOPEN) || !tp->t_actout) { sClrDTR(cp); } @@ -970,18 +945,24 @@ rphardclose(struct tty *tp) tp->t_actout = FALSE; wakeup(&tp->t_actout); wakeup(TSA_CARR_ON(tp)); +#endif /* DJA */ } -static void -rpbreak(struct tty *tp, int sig) +static int +rpioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) { struct rp_port *rp; - rp = tp->t_sc; - if (sig) { + rp = tty_softc(tp); + switch (cmd) { + case TIOCSBRK: sSendBreak(&rp->rp_channel); - } else { + return (0); + case TIOCCBRK: sClrBreak(&rp->rp_channel); + return (0); + default: + return ENOIOCTL; } } @@ -991,7 +972,7 @@ rpmodem(struct tty *tp, int sigon, int s struct rp_port *rp; int i, j, k; - rp = tp->t_sc; + rp = tty_softc(tp); if (sigon != 0 || sigoff != 0) { i = j = 0; if (sigon & SER_DTR) @@ -1025,7 +1006,11 @@ rpmodem(struct tty *tp, int sigon, int s return (0); } -static struct speedtab baud_table[] = { +static struct +{ + int baud; + int conversion; +} baud_table[] = { {B0, 0}, {B50, BRD50}, {B75, BRD75}, {B110, BRD110}, {B134, BRD134}, {B150, BRD150}, {B200, BRD200}, {B300, BRD300}, {B600, BRD600}, @@ -1037,6 +1022,17 @@ static struct speedtab baud_table[] = { {-1, -1} }; +static int rp_convert_baud(int baud) { + int i; + + for (i = 0; baud_table[i].baud >= 0; i++) { + if (baud_table[i].baud == baud) + break; + } + + return baud_table[i].conversion; +} + static int rpparam(tp, t) struct tty *tp; @@ -1044,16 +1040,14 @@ rpparam(tp, t) { struct rp_port *rp; CHANNEL_t *cp; - int oldspl, cflag, iflag, oflag, lflag; + int cflag, iflag, oflag, lflag; int ospeed; #ifdef RPCLOCAL int devshift; #endif - - rp = tp->t_sc; + rp = tty_softc(tp); cp = &rp->rp_channel; - oldspl = spltty(); cflag = t->c_cflag; #ifdef RPCLOCAL @@ -1067,17 +1061,10 @@ rpparam(tp, t) oflag = t->c_oflag; lflag = t->c_lflag; - ospeed = ttspeedtab(t->c_ispeed, baud_table); + ospeed = rp_convert_baud(t->c_ispeed); if(ospeed < 0 || t->c_ispeed != t->c_ospeed) return(EINVAL); - tp->t_ispeed = t->c_ispeed; - tp->t_ospeed = t->c_ospeed; - tp->t_cflag = cflag; - tp->t_iflag = iflag; - tp->t_oflag = oflag; - tp->t_lflag = lflag; - if(t->c_ospeed == 0) { sClrDTR(cp); return(0); @@ -1143,104 +1130,36 @@ rpparam(tp, t) } else { sDisRTSFlowCtl(cp); } - ttyldoptim(tp); - - if((cflag & CLOCAL) || (sGetChanStatusLo(cp) & CD_ACT)) { - tp->t_state |= TS_CARR_ON; - wakeup(TSA_CARR_ON(tp)); - } - -/* tp->t_state |= TS_CAN_BYPASS_L_RINT; - flags = rp->rp_channel.TxControl[3]; - if(flags & SET_DTR) - else - if(flags & SET_RTS) - else -*/ - splx(oldspl); return(0); } static void -rpstart(tp) - struct tty *tp; +rpstart(struct tty *tp) { struct rp_port *rp; CHANNEL_t *cp; - struct clist *qp; char flags; - int spl, xmit_fifo_room; + int xmit_fifo_room; int i, count, wcount; - - rp = tp->t_sc; + rp = tty_softc(tp); cp = &rp->rp_channel; flags = rp->rp_channel.TxControl[3]; - spl = spltty(); - if(tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { - ttwwakeup(tp); - splx(spl); - return; - } if(rp->rp_xmit_stopped) { sEnTransmit(cp); rp->rp_xmit_stopped = 0; } - count = sGetTxCnt(cp); - if(tp->t_outq.c_cc == 0) { - if((tp->t_state & TS_BUSY) && (count == 0)) { - tp->t_state &= ~TS_BUSY; - } - ttwwakeup(tp); - splx(spl); - return; - } xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp); - qp = &tp->t_outq; - if(xmit_fifo_room > 0 && qp->c_cc > 0) { - tp->t_state |= TS_BUSY; - count = q_to_b( qp, rp->TxBuf, xmit_fifo_room ); + count = ttydisc_getc(tp, &rp->TxBuf, xmit_fifo_room); + if(xmit_fifo_room > 0) { for( i = 0, wcount = count >> 1; wcount > 0; i += 2, wcount-- ) { - rp_writech2(cp, sGetTxRxDataIO(cp), le16dec(rp->TxBuf + i)); + rp_writech2(cp, sGetTxRxDataIO(cp), le16dec(&rp->TxBuf[i])); } if ( count & 1 ) { rp_writech1(cp, sGetTxRxDataIO(cp), rp->TxBuf[(count-1)]); } } - rp->rp_restart = (qp->c_cc > 0) ? rp->rp_fifo_lw : 0; - - ttwwakeup(tp); - splx(spl); -} - -static -void -rpstop(tp, flag) - register struct tty *tp; - int flag; -{ - struct rp_port *rp; - CHANNEL_t *cp; - int spl; - - rp = tp->t_sc; - cp = &rp->rp_channel; - - spl = spltty(); - - if(tp->t_state & TS_BUSY) { - if((tp->t_state&TS_TTSTOP) == 0) { - sFlushTxFIFO(cp); - } else { - if(rp->rp_xmit_stopped == 0) { - sDisTransmit(cp); - rp->rp_xmit_stopped = 1; - } - } - } - splx(spl); - rpstart(tp); } Modified: head/sys/dev/rp/rp_pci.c ============================================================================== --- head/sys/dev/rp/rp_pci.c Mon Apr 27 15:45:54 2009 (r191562) +++ head/sys/dev/rp/rp_pci.c Mon Apr 27 15:58:38 2009 (r191563) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #define RP_DEVICE_ID_6M 0x000C #define RP_DEVICE_ID_4M 0x000D #define RP_DEVICE_ID_UPCI_32 0x0801 +#define RP_DEVICE_ID_UPCI_16 0x0803 #define RP_DEVICE_ID_UPCI_8O 0x0805 /************************************************************************** @@ -180,6 +181,7 @@ rp_pciattach(device_t dev) ctlp->bus_ctlp = NULL; switch (pci_get_device(dev)) { + case RP_DEVICE_ID_UPCI_16: case RP_DEVICE_ID_UPCI_32: case RP_DEVICE_ID_UPCI_8O: ctlp->io_rid[0] = PCIR_BAR(2); Modified: head/sys/dev/rp/rpreg.h ============================================================================== --- head/sys/dev/rp/rpreg.h Mon Apr 27 15:45:54 2009 (r191562) +++ head/sys/dev/rp/rpreg.h Mon Apr 27 15:58:38 2009 (r191563) @@ -361,6 +361,10 @@ struct CONTROLLER_str int AiopID[AIOP_CTL_SIZE]; int AiopNumChan[AIOP_CTL_SIZE]; + struct mtx hwmtx; /* Spinlock protecting hardware. */ + int hwmtx_init; + int free; + /* Device and resource management */ device_t dev; /* device */ int io_num; /* Number of IO resources */ @@ -1005,6 +1009,18 @@ void sDisInterrupts(CHANNEL_T *ChP,Word_ int rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int num_ports); void rp_releaseresource(CONTROLLER_t *ctlp); void rp_untimeout(void); +static __inline void +rp_lock(CONTROLLER_T *CtlP) +{ + if (CtlP->hwmtx_init != 0) + mtx_lock_spin(&CtlP->hwmtx); +} +static __inline void +rp_unlock(CONTROLLER_T *CtlP) +{ + if (CtlP->hwmtx_init != 0) + mtx_unlock_spin(&CtlP->hwmtx); +} #ifndef ROCKET_C extern Byte_t R[RDATASIZE]; From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 16:46:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B12B106568E; Mon, 27 Apr 2009 16:46:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 780C88FC24; Mon, 27 Apr 2009 16:46:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RGkHJP020159; Mon, 27 Apr 2009 16:46:17 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RGkHX1020156; Mon, 27 Apr 2009 16:46:17 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200904271646.n3RGkHX1020156@svn.freebsd.org> From: Rick Macklem Date: Mon, 27 Apr 2009 16:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191564 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 16:46:18 -0000 Author: rmacklem Date: Mon Apr 27 16:46:16 2009 New Revision: 191564 URL: http://svn.freebsd.org/changeset/base/191564 Log: Change the semantics of i_modrev/va_filerev to what is required for the nfsv4 Change attribute. There are 2 changes: 1 - The value now changes on metadata changes as well as data modifications (incremented for IN_CHANGE instead of IN_UPDATE). 2 - It is now saved in spare space in the on-disk i-node so that it survives a crash. Since va_filerev is not passed out into user space, the only current use of va_filerev is in the nfs server, which uses it as the directory cookie verifier. Since this verifier is only passed back to the server by a client verbatim and then the server doesn't check it, changing the semantics should not break anything currently in FreeBSD. Reviewed by: bde Approved by: kib (mentor) Modified: head/sys/ufs/ufs/dinode.h head/sys/ufs/ufs/inode.h head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/dinode.h ============================================================================== --- head/sys/ufs/ufs/dinode.h Mon Apr 27 15:58:38 2009 (r191563) +++ head/sys/ufs/ufs/dinode.h Mon Apr 27 16:46:16 2009 (r191564) @@ -145,7 +145,8 @@ struct ufs2_dinode { ufs2_daddr_t di_extb[NXADDR];/* 96: External attributes block. */ ufs2_daddr_t di_db[NDADDR]; /* 112: Direct disk blocks. */ ufs2_daddr_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */ - int64_t di_spare[3]; /* 232: Reserved; currently unused */ + u_int64_t di_modrev; /* 232: i_modrev for NFSv4 */ + int64_t di_spare[2]; /* 240: Reserved; currently unused */ }; /* @@ -183,7 +184,7 @@ struct ufs1_dinode { int32_t di_gen; /* 108: Generation number. */ u_int32_t di_uid; /* 112: File owner. */ u_int32_t di_gid; /* 116: File group. */ - int32_t di_spare[2]; /* 120: Reserved; currently unused */ + u_int64_t di_modrev; /* 120: i_modrev for NFSv4 */ }; #define di_ogid di_u.oldids[1] #define di_ouid di_u.oldids[0] Modified: head/sys/ufs/ufs/inode.h ============================================================================== --- head/sys/ufs/ufs/inode.h Mon Apr 27 15:58:38 2009 (r191563) +++ head/sys/ufs/ufs/inode.h Mon Apr 27 16:46:16 2009 (r191564) @@ -74,7 +74,6 @@ struct inode { struct fs *i_fs; /* Associated filesystem superblock. */ struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */ - u_quad_t i_modrev; /* Revision level for NFS lease. */ /* * Side effects; used during directory lookup. */ Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Mon Apr 27 15:58:38 2009 (r191563) +++ head/sys/ufs/ufs/ufs_vnops.c Mon Apr 27 16:46:16 2009 (r191564) @@ -157,11 +157,11 @@ ufs_itimes_locked(struct vnode *vp) if (ip->i_flag & IN_UPDATE) { DIP_SET(ip, i_mtime, ts.tv_sec); DIP_SET(ip, i_mtimensec, ts.tv_nsec); - ip->i_modrev++; } if (ip->i_flag & IN_CHANGE) { DIP_SET(ip, i_ctime, ts.tv_sec); DIP_SET(ip, i_ctimensec, ts.tv_nsec); + DIP_SET(ip, i_modrev, DIP(ip, i_modrev) + 1); } out: @@ -446,6 +446,7 @@ ufs_getattr(ap) vap->va_ctime.tv_sec = ip->i_din1->di_ctime; vap->va_ctime.tv_nsec = ip->i_din1->di_ctimensec; vap->va_bytes = dbtob((u_quad_t)ip->i_din1->di_blocks); + vap->va_filerev = ip->i_din1->di_modrev; } else { vap->va_rdev = ip->i_din2->di_rdev; vap->va_size = ip->i_din2->di_size; @@ -456,12 +457,12 @@ ufs_getattr(ap) vap->va_birthtime.tv_sec = ip->i_din2->di_birthtime; vap->va_birthtime.tv_nsec = ip->i_din2->di_birthnsec; vap->va_bytes = dbtob((u_quad_t)ip->i_din2->di_blocks); + vap->va_filerev = ip->i_din2->di_modrev; } vap->va_flags = ip->i_flags; vap->va_gen = ip->i_gen; vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize; vap->va_type = IFTOVT(ip->i_mode); - vap->va_filerev = ip->i_modrev; return (0); } @@ -2225,7 +2226,6 @@ ufs_vinit(mntp, fifoops, vpp) ASSERT_VOP_LOCKED(vp, "ufs_vinit"); if (ip->i_number == ROOTINO) vp->v_vflag |= VV_ROOT; - ip->i_modrev = init_va_filerev(); *vpp = vp; return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 16:57:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36384106566C; Mon, 27 Apr 2009 16:57:20 +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 2373F8FC1B; Mon, 27 Apr 2009 16:57:20 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RGvK3p020408; Mon, 27 Apr 2009 16:57:20 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RGvKZ9020407; Mon, 27 Apr 2009 16:57:20 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200904271657.n3RGvKZ9020407@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 27 Apr 2009 16:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191565 - head/release/picobsd/tinyware/ns X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 16:57:20 -0000 Author: luigi Date: Mon Apr 27 16:57:19 2009 New Revision: 191565 URL: http://svn.freebsd.org/changeset/base/191565 Log: fix various build errors (missing or wrong return types for various functions returning void, missing headers, and so on). MFC after: 4 weeks (not before 7.3 is out, anyways) Modified: head/release/picobsd/tinyware/ns/ns.c Modified: head/release/picobsd/tinyware/ns/ns.c ============================================================================== --- head/release/picobsd/tinyware/ns/ns.c Mon Apr 27 16:46:16 2009 (r191564) +++ head/release/picobsd/tinyware/ns/ns.c Mon Apr 27 16:57:19 2009 (r191565) @@ -51,11 +51,14 @@ #include #include #include +#include #include #include #include #include +#include +#include #include char *progname; @@ -70,6 +73,8 @@ int delta = 0 ; extern char *optarg; extern int optind; +void print_load_stats(void); + void usage() { @@ -228,7 +233,7 @@ get_flags(char *buf, int flags) #endif /*NEVER*/ } -int +void print_routing(char *proto) { int mib[6]; @@ -414,18 +419,17 @@ print_routing(char *proto) get_rtaddrs(ifam->ifam_addrs, sa, rti_info); printf(" %s", Sock_ntop(sa, sa->sa_len)); } - printf(" %u", rtm->rtm_use); + /* printf(" %u", rtm->rtm_use); */ printf("\n"); } free(rt_buf); free(if_buf); free(if_table); free(ifm_table); - return; - } -print_ip_stats() +void +print_ip_stats(void) { int mib[4]; int len; @@ -442,7 +446,7 @@ print_ip_stats() len = sizeof(struct ipstat); if (sysctl(mib, 4, &s, &len, NULL, 0) < 0) { perror("sysctl"); - return (-1); + return; } printf("\nIP statistics:\n"); printf("--------------\n"); @@ -486,7 +490,8 @@ print_ip_stats() #endif } -print_tcp_stats() +void +print_tcp_stats(void) { int mib[4]; int len; @@ -497,13 +502,13 @@ print_tcp_stats() mib[2] = IPPROTO_TCP; #ifndef TCPCTL_STATS printf("sorry, tcp stats not available\n"); - return -1; + return; #else mib[3] = TCPCTL_STATS; len = sizeof(struct tcpstat); if (sysctl(mib, 4, &s, &len, NULL, 0) < 0) { perror("sysctl"); - return (-1); + return; } printf("\nTCP statistics:\n"); printf("---------------\n"); @@ -584,7 +589,8 @@ print_tcp_stats() #endif } -print_udp_stats() +void +print_udp_stats(void) { int mib[4]; int len; @@ -597,7 +603,7 @@ print_udp_stats() len = sizeof(struct udpstat); if (sysctl(mib, 4, &s, &len, NULL, 0) < 0) { perror("sysctl"); - return (-1); + return; } printf("\nUDP statistics:\n"); printf("---------------\n"); @@ -785,7 +791,7 @@ again: exit(0); } -int +void print_load_stats(void) { static u_int32_t cp_time[5]; @@ -795,12 +801,12 @@ print_load_stats(void) static int stathz ; if (!lflag || !wflag) - return 0; + return; l = sizeof(new_cp_time) ; bzero(new_cp_time, l); if (sysctlbyname("kern.cp_time", new_cp_time, &l, NULL, 0) < 0) { warn("sysctl: retrieving cp_time length"); - return 0; + return; } if (stathz == 0) { struct clockinfo ci; @@ -809,7 +815,7 @@ print_load_stats(void) l = sizeof(ci) ; if (sysctlbyname("kern.clockrate", &ci, &l, NULL, 0) < 0) { warn("sysctl: retrieving clockinfo length"); - return 0; + return; } stathz = ci.stathz ; bcopy(new_cp_time, cp_time, sizeof(cp_time)); @@ -822,4 +828,4 @@ print_load_stats(void) "INTR %5.2f%% IDLE %5.2f%%\n", X(0), X(1), X(2), X(3), X(4) ); bcopy(new_cp_time, cp_time, sizeof(cp_time)); -} +} From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 17:22:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4650E10656F8; Mon, 27 Apr 2009 17:22:15 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2950A8FC18; Mon, 27 Apr 2009 17:22:15 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RHMFss020952; Mon, 27 Apr 2009 17:22:15 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RHMF53020951; Mon, 27 Apr 2009 17:22:15 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200904271722.n3RHMF53020951@svn.freebsd.org> From: Jack F Vogel Date: Mon, 27 Apr 2009 17:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191566 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 17:22:16 -0000 Author: jfv Date: Mon Apr 27 17:22:14 2009 New Revision: 191566 URL: http://svn.freebsd.org/changeset/base/191566 Log: Thanks for Michael Tuexen for tracking down a path where the watchdog timer was not being rearmed in txeof, and also a missing case in the new code. MFC after: 2 weeks Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Apr 27 16:57:19 2009 (r191565) +++ head/sys/dev/e1000/if_em.c Mon Apr 27 17:22:14 2009 (r191566) @@ -1013,12 +1013,15 @@ em_transmit_locked(struct ifnet *ifp, st if (ADAPTER_RING_EMPTY(adapter) && (adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD)) { if (em_xmit(adapter, &m)) { - if (m && (error = drbr_enqueue(ifp, adapter->br, m)) != 0) { + if (m && (error = drbr_enqueue(ifp, adapter->br, m)) != 0) return (error); - } - } else{ - /* Send a copy of the frame to the BPF listener */ + } else { + /* + ** Send a copy of the frame to the BPF + ** listener and set the watchdog on. + */ ETHER_BPF_MTAP(ifp, m); + addapter->watchdog_timer = EM_TX_TIMEOUT; } } else if ((error = drbr_enqueue(ifp, adapter->br, m)) != 0) return (error); @@ -1086,6 +1089,8 @@ em_start_locked(struct ifnet *ifp) if (em_xmit(adapter, &m_head)) { if (m_head == NULL) break; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); break; } @@ -4029,6 +4034,7 @@ static void em_txeof(struct adapter *adapter) { int first, last, done, num_avail; + u32 cleaned = 0; struct em_buffer *tx_buffer; struct e1000_tx_desc *tx_desc, *eop_desc; struct ifnet *ifp = adapter->ifp; @@ -4064,7 +4070,7 @@ em_txeof(struct adapter *adapter) tx_desc->upper.data = 0; tx_desc->lower.data = 0; tx_desc->buffer_addr = 0; - num_avail++; + ++num_avail; ++cleaned; if (tx_buffer->m_head) { ifp->if_opackets++; @@ -4101,21 +4107,22 @@ em_txeof(struct adapter *adapter) adapter->next_tx_to_clean = first; /* - * If we have enough room, clear IFF_DRV_OACTIVE to tell the stack - * that it is OK to send packets. - * If there are no pending descriptors, clear the timeout. Otherwise, - * if some descriptors have been freed, restart the timeout. + * If we have enough room, clear IFF_DRV_OACTIVE to + * tell the stack that it is OK to send packets. + * If there are no pending descriptors, clear the timeout. */ if (num_avail > EM_TX_CLEANUP_THRESHOLD) { ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - /* All clean, turn off the timer */ if (num_avail == adapter->num_tx_desc) { adapter->watchdog_timer = 0; - } else - /* Some cleaned, reset the timer */ - if (num_avail != adapter->num_tx_desc_avail) - adapter->watchdog_timer = EM_TX_TIMEOUT; + adapter->num_tx_desc_avail = num_avail; + return; + } } + + /* If any descriptors cleaned, reset the watchdog */ + if (cleaned) + adapter->watchdog_timer = EM_TX_TIMEOUT; adapter->num_tx_desc_avail = num_avail; return; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 17:24:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B0781065689; Mon, 27 Apr 2009 17:24:48 +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 E6FB48FC14; Mon, 27 Apr 2009 17:24:47 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RHOlaD021028; Mon, 27 Apr 2009 17:24:47 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RHOl8d021027; Mon, 27 Apr 2009 17:24:47 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200904271724.n3RHOl8d021027@svn.freebsd.org> From: Andrew Gallatin Date: Mon, 27 Apr 2009 17:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191567 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 17:24:50 -0000 Author: gallatin Date: Mon Apr 27 17:24:47 2009 New Revision: 191567 URL: http://svn.freebsd.org/changeset/base/191567 Log: Fix build: Make forgotten IFNET_MULTIQUEUE to IFNET_BUF_RING ifdef change. Modified: head/sys/dev/mxge/if_mxge_var.h Modified: head/sys/dev/mxge/if_mxge_var.h ============================================================================== --- head/sys/dev/mxge/if_mxge_var.h Mon Apr 27 17:22:14 2009 (r191566) +++ head/sys/dev/mxge/if_mxge_var.h Mon Apr 27 17:24:47 2009 (r191567) @@ -125,7 +125,7 @@ typedef struct typedef struct { struct mtx mtx; -#ifdef IFNET_MULTIQUEUE +#ifdef IFNET_BUF_RING struct buf_ring *br; #endif volatile mcp_kreq_ether_send_t *lanai; /* lanai ptr for sendq */ From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 17:29:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EF3D1065674; Mon, 27 Apr 2009 17:29:52 +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 2A09F8FC1B; Mon, 27 Apr 2009 17:29:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RHTqTx021149; Mon, 27 Apr 2009 17:29:52 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RHTpDQ021146; Mon, 27 Apr 2009 17:29:51 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200904271729.n3RHTpDQ021146@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 27 Apr 2009 17:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191568 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 17:29:53 -0000 Author: jkim Date: Mon Apr 27 17:29:51 2009 New Revision: 191568 URL: http://svn.freebsd.org/changeset/base/191568 Log: - Always force AHCI mode on a ATI/AMD SB600/700/800 SATA controller. These controllers may be configured as legacy IDE mode by modifying subclass and progif without actually changing PCI device IDs. Instead of complicating code, we always force AHCI mode while probing. Also we restore AHCI mode while resuming per ATI/AMD register programming/requirement guides. - Fix SB700/800 "combined" mode. Unlike SB600, this PATA controller can combine two SATA ports and emulate one PATA channel as primary or secondary depending on BIOS configuration. When the combined mode is disabled, this channel disappears and it works just like SB600 PATA controller, however. - Add more PCI device IDs for SB700/800 and adjust device descriptions. SB800 shares the same PCI device IDs and added two more SATA IDs. Modified: head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-ahci.c head/sys/dev/ata/chipsets/ata-ati.c Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Mon Apr 27 17:24:47 2009 (r191567) +++ head/sys/dev/ata/ata-pci.h Mon Apr 27 17:29:51 2009 (r191568) @@ -108,6 +108,11 @@ struct ata_pci_controller { #define ATA_ATI_IXP600_S1 0x43801002 #define ATA_ATI_IXP700 0x439c1002 #define ATA_ATI_IXP700_S1 0x43901002 +#define ATA_ATI_IXP700_S2 0x43911002 +#define ATA_ATI_IXP700_S3 0x43921002 +#define ATA_ATI_IXP700_S4 0x43931002 +#define ATA_ATI_IXP800_S1 0x43941002 +#define ATA_ATI_IXP800_S2 0x43951002 #define ATA_CENATEK_ID 0x16ca #define ATA_CENATEK_ROCKET 0x000116ca @@ -458,6 +463,7 @@ int ata_ahci_ch_attach(device_t dev); int ata_ahci_ch_detach(device_t dev); int ata_ahci_ch_suspend(device_t dev); int ata_ahci_ch_resume(device_t dev); +int ata_ahci_ctlr_reset(device_t dev); void ata_ahci_reset(device_t dev); int ata_marvell_edma_chipinit(device_t); int ata_sii_chipinit(device_t); Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Mon Apr 27 17:24:47 2009 (r191567) +++ head/sys/dev/ata/chipsets/ata-ahci.c Mon Apr 27 17:29:51 2009 (r191568) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include /* local prototypes */ -static int ata_ahci_ctlr_reset(device_t dev); static int ata_ahci_suspend(device_t dev); static int ata_ahci_status(device_t dev); static int ata_ahci_begin_transaction(struct ata_request *request); @@ -155,7 +154,7 @@ ata_ahci_chipinit(device_t dev) return 0; } -static int +int ata_ahci_ctlr_reset(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); Modified: head/sys/dev/ata/chipsets/ata-ati.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ati.c Mon Apr 27 17:24:47 2009 (r191567) +++ head/sys/dev/ata/chipsets/ata-ati.c Mon Apr 27 17:29:51 2009 (r191568) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -54,6 +55,9 @@ __FBSDID("$FreeBSD$"); /* local prototypes */ static int ata_ati_chipinit(device_t dev); static void ata_ati_setmode(device_t dev, int mode); +static void ata_ati_ahci_enable(device_t dev); +static int ata_ati_ahci_chipinit(device_t dev); +static int ata_ati_ahci_resume(device_t dev); /* misc defines */ #define ATI_PATA 0x01 @@ -62,6 +66,13 @@ static void ata_ati_setmode(device_t dev #define SII_MEMIO 1 #define SII_BUG 0x04 +/* Misc Control Register */ +#define ATI_PCI_MISC_CTRL 0x40 +#define ATI_PCI_MISCCTRL_ENABLE_WR 0x00000001 + +/* Watchdog Control/Status Register */ +#define ATI_PCI_WD_CTRL 0x44 +#define ATI_PCI_WDCTRL_ENABLE 0x0001 /* * ATI chipset support functions @@ -79,8 +90,13 @@ ata_ati_probe(device_t dev) { ATA_ATI_IXP400_S2, 0x00, ATI_SATA, 0, ATA_SA150, "IXP400" }, { ATA_ATI_IXP600, 0x00, ATI_PATA, 0, ATA_UDMA6, "IXP600" }, { ATA_ATI_IXP600_S1, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP600" }, - { ATA_ATI_IXP700, 0x00, ATI_PATA, 0, ATA_UDMA6, "IXP700" }, - { ATA_ATI_IXP700_S1, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP700" }, + { ATA_ATI_IXP700, 0x00, ATI_PATA, 0, ATA_UDMA6, "IXP700/800" }, + { ATA_ATI_IXP700_S1, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP700/800" }, + { ATA_ATI_IXP700_S2, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP700/800" }, + { ATA_ATI_IXP700_S3, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP700/800" }, + { ATA_ATI_IXP700_S4, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP700/800" }, + { ATA_ATI_IXP800_S1, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP800" }, + { ATA_ATI_IXP800_S2, 0x00, ATI_AHCI, 0, ATA_SA300, "IXP800" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_ATI_ID) @@ -105,7 +121,19 @@ ata_ati_probe(device_t dev) ctlr->chipinit = ata_sii_chipinit; break; case ATI_AHCI: - ctlr->chipinit = ata_ahci_chipinit; + /* + * Force AHCI mode if IDE mode is set from BIOS. + */ + if ((ctlr->chip->chipid == ATA_ATI_IXP600_S1 || + ctlr->chip->chipid == ATA_ATI_IXP700_S1) && + pci_get_subclass(dev) == PCIS_STORAGE_IDE) { + struct pci_devinfo *dinfo = device_get_ivars(dev); + pcicfgregs *cfg = &dinfo->cfg; + cfg->subclass = PCIS_STORAGE_SATA; + cfg->progif = PCIP_STORAGE_SATA_AHCI_1_0; + ata_ati_ahci_enable(dev); + } + ctlr->chipinit = ata_ati_ahci_chipinit; break; } return 0; @@ -119,9 +147,8 @@ ata_ati_chipinit(device_t dev) if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; - /* IXP600 & IXP700 only have 1 PATA channel */ - if ((ctlr->chip->chipid == ATA_ATI_IXP600) || - (ctlr->chip->chipid == ATA_ATI_IXP700)) + /* IXP600 only has 1 PATA channel */ + if (ctlr->chip->chipid == ATA_ATI_IXP600) ctlr->channels = 1; ctlr->setmode = ata_ati_setmode; @@ -192,6 +219,43 @@ ata_ati_setmode(device_t dev, int mode) } } +static void +ata_ati_ahci_enable(device_t dev) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + pcicfgregs *cfg = &dinfo->cfg; + uint32_t ctrl; + + ctrl = pci_read_config(dev, ATI_PCI_MISC_CTRL, 4); + pci_write_config(dev, ATI_PCI_MISC_CTRL, + ctrl | ATI_PCI_MISCCTRL_ENABLE_WR, 4); + pci_write_config(dev, PCIR_SUBCLASS, cfg->subclass, 1); + pci_write_config(dev, PCIR_PROGIF, cfg->progif, 1); + pci_write_config(dev, ATI_PCI_WD_CTRL, + pci_read_config(dev, ATI_PCI_WD_CTRL, 2) | ATI_PCI_WDCTRL_ENABLE, 2); + pci_write_config(dev, ATI_PCI_MISC_CTRL, + ctrl & ~ATI_PCI_MISCCTRL_ENABLE_WR, 4); +} + +static int +ata_ati_ahci_chipinit(device_t dev) +{ + struct ata_pci_controller *ctlr = device_get_softc(dev); + int error; + + error = ata_ahci_chipinit(dev); + ctlr->resume = ata_ati_ahci_resume; + return (error); +} + +static int +ata_ati_ahci_resume(device_t dev) +{ + + ata_ati_ahci_enable(dev); + return (ata_ahci_ctlr_reset(dev)); +} + ATA_DECLARE_DRIVER(ata_ati); MODULE_DEPEND(ata_ati, ata_ahci, 1, 1, 1); MODULE_DEPEND(ata_ati, ata_sii, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 17:36:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABF88106564A; Mon, 27 Apr 2009 17:36:41 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F5908FC19; Mon, 27 Apr 2009 17:36:41 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RHafe0021322; Mon, 27 Apr 2009 17:36:41 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RHafVq021321; Mon, 27 Apr 2009 17:36:41 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200904271736.n3RHafVq021321@svn.freebsd.org> From: Jack F Vogel Date: Mon, 27 Apr 2009 17:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191569 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 17:36:42 -0000 Author: jfv Date: Mon Apr 27 17:36:41 2009 New Revision: 191569 URL: http://svn.freebsd.org/changeset/base/191569 Log: igb_txeof also has a case where the watchdog may not get reset when it should be MFC after: 2 weeks Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Apr 27 17:29:51 2009 (r191568) +++ head/sys/dev/e1000/if_igb.c Mon Apr 27 17:36:41 2009 (r191569) @@ -3308,6 +3308,7 @@ igb_txeof(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; int first, last, done, num_avail; + u32 cleaned = 0; struct igb_tx_buffer *tx_buffer; struct e1000_tx_desc *tx_desc, *eop_desc; struct ifnet *ifp = adapter->ifp; @@ -3343,7 +3344,7 @@ igb_txeof(struct tx_ring *txr) tx_desc->upper.data = 0; tx_desc->lower.data = 0; tx_desc->buffer_addr = 0; - num_avail++; + ++num_avail; ++cleaned; if (tx_buffer->m_head) { ifp->if_opackets++; @@ -3380,23 +3381,21 @@ igb_txeof(struct tx_ring *txr) txr->next_to_clean = first; /* - * If we have enough room, clear IFF_DRV_OACTIVE to tell the stack - * that it is OK to send packets. - * If there are no pending descriptors, clear the timeout. Otherwise, - * if some descriptors have been freed, restart the timeout. + * If we have enough room, clear IFF_DRV_OACTIVE to + * tell the stack that it is OK to send packets. + * If there are no pending descriptors, clear the timeout. */ if (num_avail > IGB_TX_CLEANUP_THRESHOLD) { ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - /* All clean, turn off the timer */ if (num_avail == adapter->num_tx_desc) { txr->watchdog_timer = 0; txr->tx_avail = num_avail; return FALSE; } - /* Some cleaned, reset the timer */ - else if (num_avail != txr->tx_avail) - txr->watchdog_timer = IGB_TX_TIMEOUT; } + /* Some descriptors cleaned, reset the watchdog */ + if (cleaned) + txr->watchdog_timer = IGB_TX_TIMEOUT; txr->tx_avail = num_avail; return TRUE; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 17:37:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA56B1065676; Mon, 27 Apr 2009 17:37:36 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDD4A8FC19; Mon, 27 Apr 2009 17:37:36 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RHba9G021375; Mon, 27 Apr 2009 17:37:36 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RHbaLL021373; Mon, 27 Apr 2009 17:37:36 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <200904271737.n3RHbaLL021373@svn.freebsd.org> From: Oleg Bulyzhin Date: Mon, 27 Apr 2009 17:37:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191570 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 17:37:37 -0000 Author: oleg Date: Mon Apr 27 17:37:36 2009 New Revision: 191570 URL: http://svn.freebsd.org/changeset/base/191570 Log: Optimize packet flow: if net.inet.ip.fw.one_pass != 0 and packet was processed by ipfw once - avoid second ipfw_chk() call. This saves us from unnecessary IPFW_RLOCK(), m_tag_find() calls and ip/tcp/udp header parsing. MFC after: 2 month Modified: head/sys/netinet/ip_fw2.c head/sys/netinet/ip_fw_pfil.c Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Mon Apr 27 17:36:41 2009 (r191569) +++ head/sys/netinet/ip_fw2.c Mon Apr 27 17:37:36 2009 (r191570) @@ -2515,16 +2515,7 @@ do { \ /* * Packet has already been tagged. Look for the next rule * to restart processing. - * - * If fw_one_pass != 0 then just accept it. - * XXX should not happen here, but optimized out in - * the caller. */ - if (V_fw_one_pass) { - IPFW_RUNLOCK(chain); - return (IP_FW_PASS); - } - f = args->rule->next_rule; if (f == NULL) f = lookup_next_rule(args->rule, 0); Modified: head/sys/netinet/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ip_fw_pfil.c Mon Apr 27 17:36:41 2009 (r191569) +++ head/sys/netinet/ip_fw_pfil.c Mon Apr 27 17:37:36 2009 (r191570) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define _NET_IF_VAR_H_ /* we don't want if_var.h, only if.h */ #include #include #include @@ -63,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -131,10 +131,14 @@ again: args.m = *m0; args.inp = inp; - ipfw = ipfw_chk(&args); - *m0 = args.m; tee = 0; + if (V_fw_one_pass == 0 || args.rule == NULL) { + ipfw = ipfw_chk(&args); + *m0 = args.m; + } else + ipfw = IP_FW_PASS; + KASSERT(*m0 != NULL || ipfw == IP_FW_DENY, ("%s: m0 is NULL", __func__)); @@ -257,10 +261,14 @@ again: args.m = *m0; args.oif = ifp; args.inp = inp; - ipfw = ipfw_chk(&args); - *m0 = args.m; tee = 0; + if (V_fw_one_pass == 0 || args.rule == NULL) { + ipfw = ipfw_chk(&args); + *m0 = args.m; + } else + ipfw = IP_FW_PASS; + KASSERT(*m0 != NULL || ipfw == IP_FW_DENY, ("%s: m0 is NULL", __func__)); From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 17:39:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 997CE1065687; Mon, 27 Apr 2009 17:39:41 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C44A8FC1F; Mon, 27 Apr 2009 17:39:41 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RHdflr021452; Mon, 27 Apr 2009 17:39:41 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RHdfl0021450; Mon, 27 Apr 2009 17:39:41 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904271739.n3RHdfl0021450@svn.freebsd.org> From: Sam Leffler Date: Mon, 27 Apr 2009 17:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191571 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 17:39:42 -0000 Author: sam Date: Mon Apr 27 17:39:41 2009 New Revision: 191571 URL: http://svn.freebsd.org/changeset/base/191571 Log: Store the tx seq# of an 802.11 frame in the mbuf pkthdr; this will be used for s/w retransmit schemes that want to access this information w/o the overhead of decoding the raw frame. Note this also allows drivers to record this information w/o writing the frame when the seq# is obtained through an out-of-band mechanism (e.g. when a h/w assigned seq# is reported in a descriptor on tx done notification). Reviewed by: sephe, avatar Modified: head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Mon Apr 27 17:37:36 2009 (r191570) +++ head/sys/net80211/ieee80211_freebsd.h Mon Apr 27 17:39:41 2009 (r191571) @@ -248,6 +248,13 @@ struct mbuf *ieee80211_getmgtframe(uint8 #define M_AGE_GET(m) (m->m_pkthdr.csum_data) #define M_AGE_SUB(m,adj) (m->m_pkthdr.csum_data -= adj) +/* + * Store the sequence number. + */ +#define M_SEQNO_SET(m, seqno) \ + ((m)->m_pkthdr.tso_segsz = (seqno)) +#define M_SEQNO_GET(m) ((m)->m_pkthdr.tso_segsz) + #define MTAG_ABI_NET80211 1132948340 /* net80211 ABI */ struct ieee80211_cb { Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Mon Apr 27 17:37:36 2009 (r191570) +++ head/sys/net80211/ieee80211_output.c Mon Apr 27 17:39:41 2009 (r191571) @@ -512,6 +512,7 @@ ieee80211_send_setup( seqno = ni->ni_txseqs[tid]++; *(uint16_t *)&wh->i_seq[0] = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); + M_SEQNO_SET(m, seqno); if (IEEE80211_IS_MULTICAST(wh->i_addr1)) m->m_flags |= M_MCAST; @@ -1097,12 +1098,15 @@ ieee80211_encap(struct ieee80211vap *vap seqno = ni->ni_txseqs[tid]++; *(uint16_t *)wh->i_seq = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); + M_SEQNO_SET(m, seqno); } } else { seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; *(uint16_t *)wh->i_seq = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); + M_SEQNO_SET(m, seqno); } + /* check if xmit fragmentation is required */ txfrag = (m->m_pkthdr.len > vap->iv_fragthreshold && !IEEE80211_IS_MULTICAST(wh->i_addr1) && From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 17:39:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31E5110656A9; Mon, 27 Apr 2009 17:39:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 25D4F8FC35; Mon, 27 Apr 2009 17:39:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 241394681; Mon, 27 Apr 2009 20:39:46 +0300 Message-ID: <49F5EDDD.80103@FreeBSD.org> Date: Mon, 27 Apr 2009 20:39:41 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: Jung-uk Kim References: <200904271729.n3RHTpDQ021146@svn.freebsd.org> In-Reply-To: <200904271729.n3RHTpDQ021146@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191568 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 17:39:51 -0000 Jung-uk Kim wrote: > Author: jkim > Date: Mon Apr 27 17:29:51 2009 > New Revision: 191568 > URL: http://svn.freebsd.org/changeset/base/191568 > > Log: > - Always force AHCI mode on a ATI/AMD SB600/700/800 SATA controller. These > controllers may be configured as legacy IDE mode by modifying subclass and > progif without actually changing PCI device IDs. Instead of complicating > code, we always force AHCI mode while probing. Also we restore AHCI mode > while resuming per ATI/AMD register programming/requirement guides. > - Fix SB700/800 "combined" mode. Unlike SB600, this PATA controller can > combine two SATA ports and emulate one PATA channel as primary or secondary > depending on BIOS configuration. When the combined mode is disabled, this > channel disappears and it works just like SB600 PATA controller, however. > - Add more PCI device IDs for SB700/800 and adjust device descriptions. > SB800 shares the same PCI device IDs and added two more SATA IDs. Thanks. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 17:42:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9BC0106568B; Mon, 27 Apr 2009 17:42:02 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C57908FC20; Mon, 27 Apr 2009 17:42:02 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RHg2PM021539; Mon, 27 Apr 2009 17:42:02 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RHg2E7021537; Mon, 27 Apr 2009 17:42:02 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271742.n3RHg2E7021537@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 17:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191572 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 17:42:04 -0000 Author: kientzle Date: Mon Apr 27 17:42:02 2009 New Revision: 191572 URL: http://svn.freebsd.org/changeset/base/191572 Log: Merge r988,r1064 from libarchive.googlecode.com: * Split whiny skip function to create a new best-effort skip_lenient() * Correctly increment the top-level file position only for the top filter * Simulate skip by reading against the current filter, not the top filter The latter two bugs aren't currently visible because no existing filter delegates skip operations. Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/archive_read_private.h Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Mon Apr 27 17:39:41 2009 (r191571) +++ head/lib/libarchive/archive_read.c Mon Apr 27 17:42:02 2009 (r191572) @@ -1112,7 +1112,24 @@ __archive_read_filter_consume(struct arc int64_t __archive_read_skip(struct archive_read *a, int64_t request) { - return (__archive_read_filter_skip(a->filter, request)); + int64_t skipped = __archive_read_skip_lenient(a, request); + if (skipped == request) + return (skipped); + /* We hit EOF before we satisfied the skip request. */ + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Truncated input file (needed %jd bytes, only %jd available)", + (intmax_t)request, (intmax_t)skipped); + return (ARCHIVE_FATAL); +} + +int64_t +__archive_read_skip_lenient(struct archive_read *a, int64_t request) +{ + int64_t skipped = __archive_read_filter_skip(a->filter, request); + if (skipped > 0) + a->archive.file_position += skipped; + return (skipped); } int64_t @@ -1128,13 +1145,13 @@ __archive_read_filter_skip(struct archiv */ if (filter->avail > 0) { min = minimum(request, (off_t)filter->avail); - bytes_skipped = __archive_read_consume(filter->archive, min); + bytes_skipped = __archive_read_filter_consume(filter, min); request -= bytes_skipped; total_bytes_skipped += bytes_skipped; } if (filter->client_avail > 0) { min = minimum(request, (off_t)filter->client_avail); - bytes_skipped = __archive_read_consume(filter->archive, min); + bytes_skipped = __archive_read_filter_consume(filter, min); request -= bytes_skipped; total_bytes_skipped += bytes_skipped; } @@ -1155,7 +1172,6 @@ __archive_read_filter_skip(struct archiv filter->fatal = 1; return (bytes_skipped); } - filter->archive->archive.file_position += bytes_skipped; total_bytes_skipped += bytes_skipped; request -= bytes_skipped; filter->client_next = filter->client_buff; @@ -1170,20 +1186,15 @@ __archive_read_filter_skip(struct archiv while (request > 0) { const void* dummy_buffer; ssize_t bytes_read; - dummy_buffer = __archive_read_ahead(filter->archive, + dummy_buffer = __archive_read_filter_ahead(filter, 1, &bytes_read); if (bytes_read < 0) return (bytes_read); if (bytes_read == 0) { - /* We hit EOF before we satisfied the skip request. */ - archive_set_error(&filter->archive->archive, - ARCHIVE_ERRNO_MISC, - "Truncated input file (need to skip %jd bytes)", - (intmax_t)request); - return (ARCHIVE_FATAL); + return (total_bytes_skipped); } min = (size_t)(minimum(bytes_read, request)); - bytes_read = __archive_read_consume(filter->archive, min); + bytes_read = __archive_read_filter_consume(filter, min); total_bytes_skipped += bytes_read; request -= bytes_read; } Modified: head/lib/libarchive/archive_read_private.h ============================================================================== --- head/lib/libarchive/archive_read_private.h Mon Apr 27 17:39:41 2009 (r191571) +++ head/lib/libarchive/archive_read_private.h Mon Apr 27 17:42:02 2009 (r191572) @@ -189,6 +189,7 @@ const void *__archive_read_filter_ahead( ssize_t __archive_read_consume(struct archive_read *, size_t); ssize_t __archive_read_filter_consume(struct archive_read_filter *, size_t); int64_t __archive_read_skip(struct archive_read *, int64_t); +int64_t __archive_read_skip_lenient(struct archive_read *, int64_t); int64_t __archive_read_filter_skip(struct archive_read_filter *, int64_t); int __archive_read_program(struct archive_read_filter *, const char *); #endif From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 17:55:57 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 6AC02106566B; Mon, 27 Apr 2009 17:55:56 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Alexander Motin Date: Mon, 27 Apr 2009 13:55:26 -0400 User-Agent: KMail/1.6.2 References: <200904271729.n3RHTpDQ021146@svn.freebsd.org> <49F5EDDD.80103@FreeBSD.org> In-Reply-To: <49F5EDDD.80103@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200904271355.43947.jkim@FreeBSD.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191568 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 17:55:57 -0000 On Monday 27 April 2009 01:39 pm, Alexander Motin wrote: > Jung-uk Kim wrote: > > Author: jkim > > Date: Mon Apr 27 17:29:51 2009 > > New Revision: 191568 > > URL: http://svn.freebsd.org/changeset/base/191568 > > > > Log: > > - Always force AHCI mode on a ATI/AMD SB600/700/800 SATA > > controller. These controllers may be configured as legacy IDE > > mode by modifying subclass and progif without actually changing > > PCI device IDs. Instead of complicating code, we always force > > AHCI mode while probing. Also we restore AHCI mode while > > resuming per ATI/AMD register programming/requirement guides. - > > Fix SB700/800 "combined" mode. Unlike SB600, this PATA > > controller can combine two SATA ports and emulate one PATA > > channel as primary or secondary depending on BIOS configuration. > > When the combined mode is disabled, this channel disappears and > > it works just like SB600 PATA controller, however. - Add more PCI > > device IDs for SB700/800 and adjust device descriptions. SB800 > > shares the same PCI device IDs and added two more SATA IDs. > > Thanks. Thank you for answering my stupid questions! BTW, ATI SATA phy reset/resume requires slightly different sequence from generic AHCI one but it just works (with little annoying timeout message). :-) Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:10:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFD1E106566B; Mon, 27 Apr 2009 18:10:42 +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 DCD408FC0A; Mon, 27 Apr 2009 18:10:42 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RIAgvG022135; Mon, 27 Apr 2009 18:10:42 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RIAgoM022134; Mon, 27 Apr 2009 18:10:42 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200904271810.n3RIAgoM022134@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 27 Apr 2009 18:10:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191573 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:10:43 -0000 Author: jkim Date: Mon Apr 27 18:10:42 2009 New Revision: 191573 URL: http://svn.freebsd.org/changeset/base/191573 Log: Reduce excessive pci_get_devid() and pci_get_revid() calls on the same PCI device while device probing. Modified: head/sys/dev/ata/ata-pci.c Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Mon Apr 27 17:42:02 2009 (r191572) +++ head/sys/dev/ata/ata-pci.c Mon Apr 27 18:10:42 2009 (r191573) @@ -759,13 +759,17 @@ ata_set_desc(device_t dev) struct ata_chip_id * ata_match_chip(device_t dev, struct ata_chip_id *index) { + uint32_t devid; + uint8_t revid; + + devid = pci_get_devid(dev); + revid = pci_get_revid(dev); while (index->chipid != 0) { - if (pci_get_devid(dev) == index->chipid && - pci_get_revid(dev) >= index->chiprev) - return index; + if (devid == index->chipid && revid >= index->chiprev) + return (index); index++; } - return NULL; + return (NULL); } struct ata_chip_id * From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:27:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF854106568C; Mon, 27 Apr 2009 18:27:54 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DADB78FC15; Mon, 27 Apr 2009 18:27:54 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RIRsYB022581; Mon, 27 Apr 2009 18:27:54 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RIRsGW022575; Mon, 27 Apr 2009 18:27:54 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271827.n3RIRsGW022575@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 18:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191576 - in head/lib/libarchive: . test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:27:56 -0000 Author: kientzle Date: Mon Apr 27 18:27:54 2009 New Revision: 191576 URL: http://svn.freebsd.org/changeset/base/191576 Log: Merge r1053,r1055,r1056,r1057,r1065 from libarchive.googlecode.com: * Fix parsing of POSIX.1e ACLs from Solaris tar archives * Test the above * Preserve the order of POSIX.1e ACL entries * Update tests whose results depended on the order of ACL entries * Identify NFSv4 ACLs in Solaris tar archives and warn that they're not yet supported. (In particular, don't try to parse them as POSIX.1e ACLs.) Thanks to: Edward Napierala sent me some Solaris 10 tar archives to test Added: head/lib/libarchive/test/test_compat_solaris_tar_acl.c (contents, props changed) head/lib/libarchive/test/test_compat_solaris_tar_acl.tar.uu (contents, props changed) Modified: head/lib/libarchive/archive_entry.c head/lib/libarchive/archive_read_support_format_tar.c head/lib/libarchive/test/Makefile head/lib/libarchive/test/test_acl_pax.c Modified: head/lib/libarchive/archive_entry.c ============================================================================== --- head/lib/libarchive/archive_entry.c Mon Apr 27 18:17:32 2009 (r191575) +++ head/lib/libarchive/archive_entry.c Mon Apr 27 18:27:54 2009 (r191576) @@ -115,6 +115,7 @@ static int acl_special(struct archive_en static struct ae_acl *acl_new_entry(struct archive_entry *entry, int type, int permset, int tag, int id); static int isint_w(const wchar_t *start, const wchar_t *end, int *result); +static int ismode_w(const wchar_t *start, const wchar_t *end, int *result); static void next_field_w(const wchar_t **wp, const wchar_t **start, const wchar_t **end, wchar_t *sep); static int prefix_w(const wchar_t *start, const wchar_t *end, @@ -1238,7 +1239,7 @@ static struct ae_acl * acl_new_entry(struct archive_entry *entry, int type, int permset, int tag, int id) { - struct ae_acl *ap; + struct ae_acl *ap, *aq; if (type != ARCHIVE_ENTRY_ACL_TYPE_ACCESS && type != ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) @@ -1251,20 +1252,26 @@ acl_new_entry(struct archive_entry *entr /* XXX TODO: More sanity-checks on the arguments XXX */ /* If there's a matching entry already in the list, overwrite it. */ - for (ap = entry->acl_head; ap != NULL; ap = ap->next) { + ap = entry->acl_head; + aq = NULL; + while (ap != NULL) { if (ap->type == type && ap->tag == tag && ap->id == id) { ap->permset = permset; return (ap); } + aq = ap; + ap = ap->next; } - /* Add a new entry to the list. */ + /* Add a new entry to the end of the list. */ ap = (struct ae_acl *)malloc(sizeof(*ap)); if (ap == NULL) return (NULL); memset(ap, 0, sizeof(*ap)); - ap->next = entry->acl_head; - entry->acl_head = ap; + if (aq == NULL) + entry->acl_head = ap; + else + aq->next = ap; ap->type = type; ap->tag = tag; ap->id = id; @@ -1586,11 +1593,10 @@ __archive_entry_acl_parse_w(struct archi struct { const wchar_t *start; const wchar_t *end; - } field[4]; + } field[4], name; int fields; int type, tag, permset, id; - const wchar_t *p; wchar_t sep; while (text != NULL && *text != L'\0') { @@ -1609,9 +1615,6 @@ __archive_entry_acl_parse_w(struct archi ++fields; } while (sep == L':'); - if (fields < 3) - return (ARCHIVE_WARN); - /* Check for a numeric ID in field 1 or 3. */ id = -1; isint_w(field[1].start, field[1].end, &id); @@ -1619,27 +1622,6 @@ __archive_entry_acl_parse_w(struct archi if (id == -1 && fields > 3) isint_w(field[3].start, field[3].end, &id); - /* Parse the permissions from field 2. */ - permset = 0; - p = field[2].start; - while (p < field[2].end) { - switch (*p++) { - case 'r': case 'R': - permset |= ARCHIVE_ENTRY_ACL_READ; - break; - case 'w': case 'W': - permset |= ARCHIVE_ENTRY_ACL_WRITE; - break; - case 'x': case 'X': - permset |= ARCHIVE_ENTRY_ACL_EXECUTE; - break; - case '-': - break; - default: - return (ARCHIVE_WARN); - } - } - /* * Solaris extension: "defaultuser::rwx" is the * default ACL corresponding to "user::rwx", etc. @@ -1651,22 +1633,47 @@ __archive_entry_acl_parse_w(struct archi } else type = default_type; + name.start = name.end = NULL; if (prefix_w(field[0].start, field[0].end, L"user")) { - if (id != -1 || field[1].start < field[1].end) + if (!ismode_w(field[2].start, field[2].end, &permset)) + return (ARCHIVE_WARN); + if (id != -1 || field[1].start < field[1].end) { tag = ARCHIVE_ENTRY_ACL_USER; - else + name = field[1]; + } else tag = ARCHIVE_ENTRY_ACL_USER_OBJ; } else if (prefix_w(field[0].start, field[0].end, L"group")) { - if (id != -1 || field[1].start < field[1].end) + if (!ismode_w(field[2].start, field[2].end, &permset)) + return (ARCHIVE_WARN); + if (id != -1 || field[1].start < field[1].end) { tag = ARCHIVE_ENTRY_ACL_GROUP; - else + name = field[1]; + } else tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ; } else if (prefix_w(field[0].start, field[0].end, L"other")) { - if (id != -1 || field[1].start < field[1].end) + if (fields == 2 + && field[1].start < field[1].end + && ismode_w(field[1].start, field[2].end, &permset)) { + /* This is Solaris-style "other:rwx" */ + } else if (fields == 3 + && field[1].start == field[1].end + && field[2].start < field[2].end + && ismode_w(field[2].start, field[2].end, &permset)) { + /* This is FreeBSD-style "other::rwx" */ + } else return (ARCHIVE_WARN); tag = ARCHIVE_ENTRY_ACL_OTHER; } else if (prefix_w(field[0].start, field[0].end, L"mask")) { - if (id != -1 || field[1].start < field[1].end) + if (fields == 2 + && field[1].start < field[1].end + && ismode_w(field[1].start, field[1].end, &permset)) { + /* This is Solaris-style "mask:rwx" */ + } else if (fields == 3 + && field[1].start == field[1].end + && field[2].start < field[2].end + && ismode_w(field[2].start, field[2].end, &permset)) { + /* This is FreeBSD-style "mask::rwx" */ + } else return (ARCHIVE_WARN); tag = ARCHIVE_ENTRY_ACL_MASK; } else @@ -1674,7 +1681,7 @@ __archive_entry_acl_parse_w(struct archi /* Add entry to the internal list. */ archive_entry_acl_add_entry_w_len(entry, type, permset, - tag, id, field[1].start, field[1].end - field[1].start); + tag, id, name.start, name.end - name.start); } return (ARCHIVE_OK); } @@ -1798,6 +1805,38 @@ isint_w(const wchar_t *start, const wcha } /* + * Parse a string as a mode field. Returns true if + * the string is non-empty and consists only of mode characters, + * false otherwise. + */ +static int +ismode_w(const wchar_t *start, const wchar_t *end, int *permset) +{ + const wchar_t *p; + + p = start; + *permset = 0; + while (p < end) { + switch (*p++) { + case 'r': case 'R': + *permset |= ARCHIVE_ENTRY_ACL_READ; + break; + case 'w': case 'W': + *permset |= ARCHIVE_ENTRY_ACL_WRITE; + break; + case 'x': case 'X': + *permset |= ARCHIVE_ENTRY_ACL_EXECUTE; + break; + case '-': + break; + default: + return (0); + } + } + return (1); +} + +/* * Match "[:whitespace:]*(.*)[:whitespace:]*[:,\n]". *wp is updated * to point to just after the separator. *start points to the first * character of the matched text and *end just after the last Modified: head/lib/libarchive/archive_read_support_format_tar.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_tar.c Mon Apr 27 18:17:32 2009 (r191575) +++ head/lib/libarchive/archive_read_support_format_tar.c Mon Apr 27 18:27:54 2009 (r191576) @@ -732,6 +732,7 @@ header_Solaris_ACL(struct archive_read * const struct archive_entry_header_ustar *header; size_t size; int err; + int64_t type; char *acl, *p; wchar_t *wp; @@ -744,24 +745,57 @@ header_Solaris_ACL(struct archive_read * err = read_body_to_string(a, tar, &(tar->acl_text), h); if (err != ARCHIVE_OK) return (err); + /* Recursively read next header */ err = tar_read_header(a, tar, entry); if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN)) return (err); - /* Skip leading octal number. */ - /* XXX TODO: Parse the octal number and sanity-check it. */ + /* TODO: Examine the first characters to see if this + * is an AIX ACL descriptor. We'll likely never support + * them, but it would be polite to recognize and warn when + * we do see them. */ + + /* Leading octal number indicates ACL type and number of entries. */ p = acl = tar->acl_text.s; - while (*p != '\0' && p < acl + size) + type = 0; + while (*p != '\0' && p < acl + size) { + if (*p < '0' || *p > '7') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Malformed Solaris ACL attribute (invalid digit)"); + return(ARCHIVE_WARN); + } + type <<= 3; + type += *p - '0'; + if (type > 077777777) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Malformed Solaris ACL attribute (count too large)"); + return (ARCHIVE_WARN); + } p++; + } + switch (type & ~0777777) { + case 01000000: + /* POSIX.1e ACL */ + break; + case 03000000: + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Solaris NFSv4 ACLs not supported"); + return (ARCHIVE_WARN); + default: + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Malformed Solaris ACL attribute (unsupported type %o)", + (int)type); + return (ARCHIVE_WARN); + } p++; if (p >= acl + size) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Malformed Solaris ACL attribute"); + "Malformed Solaris ACL attribute (body overflow)"); return(ARCHIVE_WARN); } - /* Skip leading octal number. */ + /* ACL text is null-terminated; find the end. */ size -= (p - acl); acl = p; @@ -771,6 +805,9 @@ header_Solaris_ACL(struct archive_read * wp = utf8_decode(tar, acl, p - acl); err = __archive_entry_acl_parse_w(entry, wp, ARCHIVE_ENTRY_ACL_TYPE_ACCESS); + if (err != ARCHIVE_OK) + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Malformed Solaris ACL attribute (unparsable)"); return (err); } Modified: head/lib/libarchive/test/Makefile ============================================================================== --- head/lib/libarchive/test/Makefile Mon Apr 27 18:17:32 2009 (r191575) +++ head/lib/libarchive/test/Makefile Mon Apr 27 18:27:54 2009 (r191576) @@ -16,6 +16,7 @@ TESTS= \ test_compat_bzip2.c \ test_compat_gtar.c \ test_compat_gzip.c \ + test_compat_solaris_tar_acl.c \ test_compat_tar_hardlink.c \ test_compat_xz.c \ test_compat_zip.c \ Modified: head/lib/libarchive/test/test_acl_pax.c ============================================================================== --- head/lib/libarchive/test/test_acl_pax.c Mon Apr 27 18:17:32 2009 (r191575) +++ head/lib/libarchive/test/test_acl_pax.c Mon Apr 27 18:27:54 2009 (r191576) @@ -151,10 +151,10 @@ static unsigned char reference[] = { 0,0,0,0,0,0,0,0,0,0,'1','1','3',' ','S','C','H','I','L','Y','.','a','c','l', '.','a','c','c','e','s','s','=','u','s','e','r',':',':','r','-','x',',','g', 'r','o','u','p',':',':','r','-','-',',','o','t','h','e','r',':',':','-','w', -'x',',','g','r','o','u','p',':','g','r','o','u','p','7','8',':','r','w','x', -':','7','8',',','u','s','e','r',':','u','s','e','r','7','8',':','-','-','-', -':','7','8',',','u','s','e','r',':','u','s','e','r','7','7',':','r','-','-', -':','7','7',10,'1','6',' ','S','C','H','I','L','Y','.','d','e','v','=','0', +'x',',','u','s','e','r',':','u','s','e','r','7','7',':','r','-','-',':','7', +'7',',','u','s','e','r',':','u','s','e','r','7','8',':','-','-','-',':','7', +'8',',','g','r','o','u','p',':','g','r','o','u','p','7','8',':','r','w','x', +':','7','8',10,'1','6',' ','S','C','H','I','L','Y','.','d','e','v','=','0', 10,'1','6',' ','S','C','H','I','L','Y','.','i','n','o','=','0',10,'1','8', ' ','S','C','H','I','L','Y','.','n','l','i','n','k','=','0',10,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -464,7 +464,7 @@ DEFINE_TEST(test_acl_pax) /* Assert that the generated data matches the built-in reference data.*/ failure("Generated pax archive does not match reference; check 'testout' and 'reference' files."); - assert(0 == memcmp(buff, reference, sizeof(reference))); + assertEqualMem(buff, reference, sizeof(reference)); failure("Generated pax archive does not match reference; check 'testout' and 'reference' files."); assertEqualInt((int)used, sizeof(reference)); Added: head/lib/libarchive/test/test_compat_solaris_tar_acl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_compat_solaris_tar_acl.c Mon Apr 27 18:27:54 2009 (r191576) @@ -0,0 +1,128 @@ +/*- + * Copyright (c) 2003-2009 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * Exercise support for reading Solaris-style ACL data + * from tar archives. + * + * This should work on all systems, regardless of whether local + * filesystems support ACLs or not. + */ + +DEFINE_TEST(test_compat_solaris_tar_acl) +{ + struct archive *a; + struct archive_entry *ae; + const char *reference1 = "test_compat_solaris_tar_acl.tar"; + int type, permset, tag, qual; + const char *name; + + /* Sample file generated on Solaris 10 */ + extract_reference_file(reference1); + assert(NULL != (a = archive_read_new())); + assertA(0 == archive_read_support_format_all(a)); + assertA(0 == archive_read_support_compression_all(a)); + assertA(0 == archive_read_open_filename(a, reference1, 512)); + + /* Archive has 1 entry with some ACLs set on it. */ + assertA(0 == archive_read_next_header(a, &ae)); + failure("Basic ACLs should set mode to 0640, not %04o", + archive_entry_mode(ae)&0777); + assertEqualInt((archive_entry_mode(ae) & 0777), 0640); + assertEqualInt(7, archive_entry_acl_reset(ae, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); + assertEqualInt(ARCHIVE_OK, archive_entry_acl_next(ae, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + &type, &permset, &tag, &qual, &name)); + assertEqualInt(ARCHIVE_ENTRY_ACL_TYPE_ACCESS, type); + assertEqualInt(006, permset); + assertEqualInt(ARCHIVE_ENTRY_ACL_USER_OBJ, tag); + assertEqualInt(-1, qual); + assert(name == NULL); + + assertEqualInt(ARCHIVE_OK, archive_entry_acl_next(ae, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + &type, &permset, &tag, &qual, &name)); + assertEqualInt(ARCHIVE_ENTRY_ACL_TYPE_ACCESS, type); + assertEqualInt(004, permset); + assertEqualInt(ARCHIVE_ENTRY_ACL_GROUP_OBJ, tag); + assertEqualInt(-1, qual); + assert(name == NULL); + + assertEqualInt(ARCHIVE_OK, archive_entry_acl_next(ae, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + &type, &permset, &tag, &qual, &name)); + assertEqualInt(ARCHIVE_ENTRY_ACL_TYPE_ACCESS, type); + assertEqualInt(000, permset); + assertEqualInt(ARCHIVE_ENTRY_ACL_OTHER, tag); + assertEqualInt(-1, qual); + assert(name == NULL); + + assertEqualInt(ARCHIVE_OK, archive_entry_acl_next(ae, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + &type, &permset, &tag, &qual, &name)); + assertEqualInt(ARCHIVE_ENTRY_ACL_TYPE_ACCESS, type); + assertEqualInt(001, permset); + assertEqualInt(ARCHIVE_ENTRY_ACL_USER, tag); + assertEqualInt(71, qual); + assertEqualString(name, "lp"); + + assertEqualInt(ARCHIVE_OK, archive_entry_acl_next(ae, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + &type, &permset, &tag, &qual, &name)); + assertEqualInt(ARCHIVE_ENTRY_ACL_TYPE_ACCESS, type); + assertEqualInt(004, permset); + assertEqualInt(ARCHIVE_ENTRY_ACL_USER, tag); + assertEqualInt(666, qual); + assertEqualString(name, "666"); + + assertEqualInt(ARCHIVE_OK, archive_entry_acl_next(ae, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + &type, &permset, &tag, &qual, &name)); + assertEqualInt(ARCHIVE_ENTRY_ACL_TYPE_ACCESS, type); + assertEqualInt(007, permset); + assertEqualInt(ARCHIVE_ENTRY_ACL_USER, tag); + assertEqualInt(1000, qual); + assertEqualString(name, "trasz"); + + assertEqualInt(ARCHIVE_OK, archive_entry_acl_next(ae, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + &type, &permset, &tag, &qual, &name)); + assertEqualInt(ARCHIVE_ENTRY_ACL_TYPE_ACCESS, type); + assertEqualInt(004, permset); + assertEqualInt(ARCHIVE_ENTRY_ACL_MASK, tag); + assertEqualInt(-1, qual); + assertEqualString(name, NULL); + + assertEqualInt(ARCHIVE_EOF, archive_entry_acl_next(ae, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + &type, &permset, &tag, &qual, &name)); + + /* Close the archive. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); +} Added: head/lib/libarchive/test/test_compat_solaris_tar_acl.tar.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_compat_solaris_tar_acl.tar.uu Mon Apr 27 18:27:54 2009 (r191576) @@ -0,0 +1,61 @@ +$FreeBSD$ +begin 644 test_acl_solaris.tar +M9FEL92UW:71H+7!O#HW,2QU#HQ,#`P+&=R;W5P.CIR+2TL;6%S:SIR+69I;&4M=VET:"UP +M;W-I>"UA8VQS```````````````````````````````````````````````` +M```````````````````````````````````````````````````````````P +M,#`P-C0T`#`P,#$W-3``,#`P,#`P,``P,#`P,#`P,#`P,``Q,3$W-#8P-#$U +M-P`P,#$U,30T`#`````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````=7-T87(`,#!T@`````````````` +M`````````````````````')O;W0````````````````````````````````` +M````,#`P,#(Q,``P,#`P,#$P```````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +H```````````````````````````````````````````````````````` +` +end From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:33:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DD20106566B; Mon, 27 Apr 2009 18:33:05 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id CA2488FC13; Mon, 27 Apr 2009 18:33:04 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from wolfram.andreas.nets ([91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id n3RIX15b060037; Mon, 27 Apr 2009 20:33:02 +0200 (CEST) (envelope-from andreast-list@fgznet.ch) Message-ID: <49F5FA5D.8060905@fgznet.ch> Date: Mon, 27 Apr 2009 20:33:01 +0200 From: Andreas Tobler User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Jack F Vogel References: <200904271722.n3RHMF53020951@svn.freebsd.org> In-Reply-To: <200904271722.n3RHMF53020951@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191566 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:33:05 -0000 Jack F Vogel wrote: > Author: jfv > Date: Mon Apr 27 17:22:14 2009 > New Revision: 191566 > URL: http://svn.freebsd.org/changeset/base/191566 > > Log: > Thanks for Michael Tuexen for tracking down a path where > the watchdog timer was not being rearmed in txeof, and also > a missing case in the new code. > > MFC after: 2 weeks > > Modified: > head/sys/dev/e1000/if_em.c > > Modified: head/sys/dev/e1000/if_em.c > ============================================================================== > --- head/sys/dev/e1000/if_em.c Mon Apr 27 16:57:19 2009 (r191565) > +++ head/sys/dev/e1000/if_em.c Mon Apr 27 17:22:14 2009 (r191566) > @@ -1013,12 +1013,15 @@ em_transmit_locked(struct ifnet *ifp, st > if (ADAPTER_RING_EMPTY(adapter) && > (adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD)) { > if (em_xmit(adapter, &m)) { > - if (m && (error = drbr_enqueue(ifp, adapter->br, m)) != 0) { > + if (m && (error = drbr_enqueue(ifp, adapter->br, m)) != 0) > return (error); > - } > - } else{ > - /* Send a copy of the frame to the BPF listener */ > + } else { > + /* > + ** Send a copy of the frame to the BPF > + ** listener and set the watchdog on. > + */ > ETHER_BPF_MTAP(ifp, m); > + addapter->watchdog_timer = EM_TX_TIMEOUT; [deuterium_fbsd:sys/dev/e1000] andreast% svn diff if_em.c Index: if_em.c =================================================================== --- if_em.c (revision 191575) +++ if_em.c (working copy) @@ -1021,7 +1021,7 @@ ** listener and set the watchdog on. */ ETHER_BPF_MTAP(ifp, m); - addapter->watchdog_timer = EM_TX_TIMEOUT; + adapter->watchdog_timer = EM_TX_TIMEOUT; } } else if ((error = drbr_enqueue(ifp, adapter->br, m)) != 0) return (error); Should fix the build. Andreas From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:33:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD27B106564A; Mon, 27 Apr 2009 18:33:08 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B00228FC15; Mon, 27 Apr 2009 18:33:08 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RIX80Y022765; Mon, 27 Apr 2009 18:33:08 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RIX8MA022761; Mon, 27 Apr 2009 18:33:08 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271833.n3RIX8MA022761@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 18:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191578 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:33:09 -0000 Author: kientzle Date: Mon Apr 27 18:33:08 2009 New Revision: 191578 URL: http://svn.freebsd.org/changeset/base/191578 Log: Merge r1052,r1055 from libarchive.googlecode.com: Clear the error flag on entry to a few more API functions. Modified: head/lib/libarchive/archive_read_open_fd.c head/lib/libarchive/archive_read_open_file.c head/lib/libarchive/archive_read_open_filename.c head/lib/libarchive/archive_read_support_compression_xz.c Modified: head/lib/libarchive/archive_read_open_fd.c ============================================================================== --- head/lib/libarchive/archive_read_open_fd.c Mon Apr 27 18:29:59 2009 (r191577) +++ head/lib/libarchive/archive_read_open_fd.c Mon Apr 27 18:33:08 2009 (r191578) @@ -66,6 +66,7 @@ archive_read_open_fd(struct archive *a, struct read_fd_data *mine; void *b; + archive_clear_error(a); if (fstat(fd, &st) != 0) { archive_set_error(a, errno, "Can't stat fd %d", fd); return (ARCHIVE_FATAL); Modified: head/lib/libarchive/archive_read_open_file.c ============================================================================== --- head/lib/libarchive/archive_read_open_file.c Mon Apr 27 18:29:59 2009 (r191577) +++ head/lib/libarchive/archive_read_open_file.c Mon Apr 27 18:33:08 2009 (r191578) @@ -70,6 +70,7 @@ archive_read_open_FILE(struct archive *a size_t block_size = 128 * 1024; void *b; + archive_clear_error(a); mine = (struct read_FILE_data *)malloc(sizeof(*mine)); b = malloc(block_size); if (mine == NULL || b == NULL) { Modified: head/lib/libarchive/archive_read_open_filename.c ============================================================================== --- head/lib/libarchive/archive_read_open_filename.c Mon Apr 27 18:29:59 2009 (r191577) +++ head/lib/libarchive/archive_read_open_filename.c Mon Apr 27 18:33:08 2009 (r191578) @@ -84,6 +84,7 @@ archive_read_open_filename(struct archiv void *b; int fd; + archive_clear_error(a); if (filename == NULL || filename[0] == '\0') return (archive_read_open_fd(a, 0, block_size)); Modified: head/lib/libarchive/archive_read_support_compression_xz.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_xz.c Mon Apr 27 18:29:59 2009 (r191577) +++ head/lib/libarchive/archive_read_support_compression_xz.c Mon Apr 27 18:33:08 2009 (r191578) @@ -100,6 +100,7 @@ archive_read_support_compression_xz(stru struct archive_read *a = (struct archive_read *)_a; struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a); + archive_clear_error(_a); if (bidder == NULL) return (ARCHIVE_FATAL); @@ -123,6 +124,7 @@ archive_read_support_compression_lzma(st struct archive_read *a = (struct archive_read *)_a; struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a); + archive_clear_error(_a); if (bidder == NULL) return (ARCHIVE_FATAL); From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:35:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E361106566B; Mon, 27 Apr 2009 18:35:03 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60E668FC12; Mon, 27 Apr 2009 18:35:03 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RIZ34g022848; Mon, 27 Apr 2009 18:35:03 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RIZ3JF022846; Mon, 27 Apr 2009 18:35:03 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271835.n3RIZ3JF022846@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 18:35:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191579 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:35:04 -0000 Author: kientzle Date: Mon Apr 27 18:35:03 2009 New Revision: 191579 URL: http://svn.freebsd.org/changeset/base/191579 Log: Merge r1021 from libarchive.googlecode.com: If we know it's a socket, say so. Modified: head/lib/libarchive/archive_write_set_format_pax.c head/lib/libarchive/archive_write_set_format_ustar.c Modified: head/lib/libarchive/archive_write_set_format_pax.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_pax.c Mon Apr 27 18:33:08 2009 (r191578) +++ head/lib/libarchive/archive_write_set_format_pax.c Mon Apr 27 18:35:03 2009 (r191579) @@ -452,8 +452,14 @@ archive_write_pax_header(struct archive_ free(t); } break; + case AE_IFSOCK: + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "tar format cannot archive socket"); + return (ARCHIVE_WARN); default: - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, "tar format cannot archive this (type=0%lo)", (unsigned long)archive_entry_filetype(entry_original)); return (ARCHIVE_WARN); Modified: head/lib/libarchive/archive_write_set_format_ustar.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_ustar.c Mon Apr 27 18:33:08 2009 (r191578) +++ head/lib/libarchive/archive_write_set_format_ustar.c Mon Apr 27 18:35:03 2009 (r191579) @@ -414,8 +414,14 @@ __archive_write_format_header_ustar(stru case AE_IFBLK: h[USTAR_typeflag_offset] = '4' ; break; case AE_IFDIR: h[USTAR_typeflag_offset] = '5' ; break; case AE_IFIFO: h[USTAR_typeflag_offset] = '6' ; break; + case AE_IFSOCK: + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "tar format cannot archive socket"); + return (ARCHIVE_FAILED); default: - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, "tar format cannot archive this (mode=0%lo)", (unsigned long)archive_entry_mode(entry)); ret = ARCHIVE_FAILED; From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:35:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEC511065679; Mon, 27 Apr 2009 18:35:06 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCB268FC26; Mon, 27 Apr 2009 18:35:06 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RIZ6Cb022884; Mon, 27 Apr 2009 18:35:06 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RIZ63X022883; Mon, 27 Apr 2009 18:35:06 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200904271835.n3RIZ63X022883@svn.freebsd.org> From: Jack F Vogel Date: Mon, 27 Apr 2009 18:35:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191580 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:35:07 -0000 Author: jfv Date: Mon Apr 27 18:35:06 2009 New Revision: 191580 URL: http://svn.freebsd.org/changeset/base/191580 Log: Correct fat finger mistake Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Apr 27 18:35:03 2009 (r191579) +++ head/sys/dev/e1000/if_em.c Mon Apr 27 18:35:06 2009 (r191580) @@ -1021,7 +1021,7 @@ em_transmit_locked(struct ifnet *ifp, st ** listener and set the watchdog on. */ ETHER_BPF_MTAP(ifp, m); - addapter->watchdog_timer = EM_TX_TIMEOUT; + adapter->watchdog_timer = EM_TX_TIMEOUT; } } else if ((error = drbr_enqueue(ifp, adapter->br, m)) != 0) return (error); From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:35:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31DEF1065865; Mon, 27 Apr 2009 18:35:40 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-qy0-f105.google.com (mail-qy0-f105.google.com [209.85.221.105]) by mx1.freebsd.org (Postfix) with ESMTP id 760AE8FC13; Mon, 27 Apr 2009 18:35:39 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: by qyk3 with SMTP id 3so180571qyk.3 for ; Mon, 27 Apr 2009 11:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=7WCYrHJAZFao1G4HTpxeewGKw8XRTy2oC16kB1DpQRE=; b=phW+Fnsz/jWwlrreU66rpnik/1m5zuLGH14uQagCSaUsxIhAOJUQWwTrHJKZqdEAPy kBwnaJlyjwthPzI46s+pR+rzc/4xQtr7cobZpB6/G0xyQGaXvJ0ZBZb0fYpFSX4GXQws oYOHz17JC/ErvlQI/N4RnSZy/vzoJdY7p2imI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=qY7gQp1/PQkGdRkwX+fsQNiaJsViff6MdAZ9unJ4uP2bkPAtK0ruAxa2aNdMmPuIHA lVcIfn1JNhvjN8gWPcLvVsPOxDcKW7k2jhLGjL0oxbVN6ipMDypwXCBYjGjzgw1bJXn/ Hb4MKqOAMBQppEvVEMzQ7c0tF7badHqH6TKK4= MIME-Version: 1.0 Received: by 10.224.37.19 with SMTP id v19mr6433910qad.70.1240857338406; Mon, 27 Apr 2009 11:35:38 -0700 (PDT) In-Reply-To: <49F5FA5D.8060905@fgznet.ch> References: <200904271722.n3RHMF53020951@svn.freebsd.org> <49F5FA5D.8060905@fgznet.ch> Date: Mon, 27 Apr 2009 11:35:38 -0700 Message-ID: <2a41acea0904271135m2d5f1e6av5fc2b0b7e86d10ea@mail.gmail.com> From: Jack Vogel To: Andreas Tobler Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Jack F Vogel , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191566 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:35:41 -0000 DUH, thanks for catching it quickly, the build breaking would have sooner or later though :) Jack On Mon, Apr 27, 2009 at 11:33 AM, Andreas Tobler wrote: > Jack F Vogel wrote: > >> Author: jfv >> Date: Mon Apr 27 17:22:14 2009 >> New Revision: 191566 >> URL: http://svn.freebsd.org/changeset/base/191566 >> >> Log: >> Thanks for Michael Tuexen for tracking down a path where >> the watchdog timer was not being rearmed in txeof, and also >> a missing case in the new code. >> MFC after: 2 weeks >> >> Modified: >> head/sys/dev/e1000/if_em.c >> >> Modified: head/sys/dev/e1000/if_em.c >> >> ============================================================================== >> --- head/sys/dev/e1000/if_em.c Mon Apr 27 16:57:19 2009 (r191565) >> +++ head/sys/dev/e1000/if_em.c Mon Apr 27 17:22:14 2009 (r191566) >> @@ -1013,12 +1013,15 @@ em_transmit_locked(struct ifnet *ifp, st >> if (ADAPTER_RING_EMPTY(adapter) && >> (adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD)) { >> if (em_xmit(adapter, &m)) { >> - if (m && (error = drbr_enqueue(ifp, adapter->br, >> m)) != 0) { >> + if (m && (error = drbr_enqueue(ifp, adapter->br, >> m)) != 0) >> return (error); >> - } >> - } else{ >> - /* Send a copy of the frame to the BPF listener */ >> + } else { >> + /* >> + ** Send a copy of the frame to the BPF >> + ** listener and set the watchdog on. >> + */ >> ETHER_BPF_MTAP(ifp, m); >> + addapter->watchdog_timer = EM_TX_TIMEOUT; >> > > [deuterium_fbsd:sys/dev/e1000] andreast% svn diff if_em.c > Index: if_em.c > =================================================================== > --- if_em.c (revision 191575) > +++ if_em.c (working copy) > @@ -1021,7 +1021,7 @@ > ** listener and set the watchdog on. > */ > ETHER_BPF_MTAP(ifp, m); > - addapter->watchdog_timer = EM_TX_TIMEOUT; > + adapter->watchdog_timer = EM_TX_TIMEOUT; > } > } else if ((error = drbr_enqueue(ifp, adapter->br, m)) != 0) > return (error); > > > Should fix the build. > > Andreas > > From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:38:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7186910656D2; Mon, 27 Apr 2009 18:38:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 2DD848FC1C; Mon, 27 Apr 2009 18:38:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 241397294; Mon, 27 Apr 2009 21:38:53 +0300 Message-ID: <49F5FBB8.4060607@FreeBSD.org> Date: Mon, 27 Apr 2009 21:38:48 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: Jung-uk Kim References: <200904271729.n3RHTpDQ021146@svn.freebsd.org> <49F5EDDD.80103@FreeBSD.org> <200904271355.43947.jkim@FreeBSD.org> In-Reply-To: <200904271355.43947.jkim@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191568 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:38:56 -0000 Jung-uk Kim wrote: > On Monday 27 April 2009 01:39 pm, Alexander Motin wrote: >> Jung-uk Kim wrote: >>> Author: jkim >>> Date: Mon Apr 27 17:29:51 2009 >>> New Revision: 191568 >>> URL: http://svn.freebsd.org/changeset/base/191568 >>> >>> Log: >>> - Always force AHCI mode on a ATI/AMD SB600/700/800 SATA >>> controller. These controllers may be configured as legacy IDE >>> mode by modifying subclass and progif without actually changing >>> PCI device IDs. Instead of complicating code, we always force >>> AHCI mode while probing. Also we restore AHCI mode while >>> resuming per ATI/AMD register programming/requirement guides. - >>> Fix SB700/800 "combined" mode. Unlike SB600, this PATA >>> controller can combine two SATA ports and emulate one PATA >>> channel as primary or secondary depending on BIOS configuration. >>> When the combined mode is disabled, this channel disappears and >>> it works just like SB600 PATA controller, however. - Add more PCI >>> device IDs for SB700/800 and adjust device descriptions. SB800 >>> shares the same PCI device IDs and added two more SATA IDs. >> Thanks. > > Thank you for answering my stupid questions! > > BTW, ATI SATA phy reset/resume requires slightly different sequence > from generic AHCI one but it just works (with little annoying timeout > message). :-) If you are talking about port 15 soft-reset timeout when port multiplier is absent, then this is known ATI controllers bug/feature. I have even added some comments in ata-ahci.c about it, but as soon as it is nonstandard and I have no respective hardware, I have left it for later. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:39:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 038BA10656A6; Mon, 27 Apr 2009 18:39:56 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBC788FC20; Mon, 27 Apr 2009 18:39:55 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RIdt60023008; Mon, 27 Apr 2009 18:39:55 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RIdtng023006; Mon, 27 Apr 2009 18:39:55 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271839.n3RIdtng023006@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 18:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191581 - head/lib/libarchive/test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:39:56 -0000 Author: kientzle Date: Mon Apr 27 18:39:55 2009 New Revision: 191581 URL: http://svn.freebsd.org/changeset/base/191581 Log: Merge r1054,r1060 from libarchive.googlecode.com: * assertEqualMem() now takes void * arguments * Be a little smarter about what we hexdump when assertEqualMem() fails Modified: head/lib/libarchive/test/main.c head/lib/libarchive/test/test.h Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Mon Apr 27 18:35:06 2009 (r191580) +++ head/lib/libarchive/test/main.c Mon Apr 27 18:39:55 2009 (r191581) @@ -463,13 +463,16 @@ hexdump(const char *p, const char *ref, } /* assertEqualMem() displays the values of the two memory blocks. */ -/* TODO: For long blocks, hexdump the first bytes that actually differ. */ int test_assert_equal_mem(const char *file, int line, - const char *v1, const char *e1, - const char *v2, const char *e2, + const void *_v1, const char *e1, + const void *_v2, const char *e2, size_t l, const char *ld, void *extra) { + const char *v1 = (const char *)_v1; + const char *v2 = (const char *)_v2; + size_t offset; + count_assertion(file, line); if (v1 == NULL || v2 == NULL) { if (v1 == v2) { @@ -486,10 +489,20 @@ test_assert_equal_mem(const char *file, fprintf(stderr, "%s:%d: Assertion failed: memory not equal\n", file, line); fprintf(stderr, " size %s = %d\n", ld, (int)l); + /* Dump 48 bytes (3 lines) so that the first difference is + * in the second line. */ + offset = 0; + while (l > 64 && memcmp(v1, v2, 32) == 0) { + /* The first two lines agree, so step forward one line. */ + v1 += 16; + v2 += 16; + l -= 16; + offset += 16; + } fprintf(stderr, " Dump of %s\n", e1); - hexdump(v1, v2, l < 32 ? l : 32, 0); + hexdump(v1, v2, l < 64 ? l : 64, offset); fprintf(stderr, " Dump of %s\n", e2); - hexdump(v2, v1, l < 32 ? l : 32, 0); + hexdump(v2, v1, l < 64 ? l : 64, offset); fprintf(stderr, "\n"); report_failure(extra); return (0); Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Mon Apr 27 18:35:06 2009 (r191580) +++ head/lib/libarchive/test/test.h Mon Apr 27 18:39:55 2009 (r191581) @@ -147,7 +147,7 @@ int test_assert_equal_file(const char *, int test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *); int test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *); int test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); -int test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *); +int test_assert_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *); int test_assert_file_contents(const void *, int, const char *, ...); int test_assert_file_exists(const char *, ...); int test_assert_file_not_exists(const char *, ...); From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 18:55:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C71110656F2; Mon, 27 Apr 2009 18:55:23 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F2008FC0A; Mon, 27 Apr 2009 18:55:23 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RItNRA023515; Mon, 27 Apr 2009 18:55:23 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RItMMo023513; Mon, 27 Apr 2009 18:55:22 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271855.n3RItMMo023513@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 18:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191584 - head/lib/libarchive/test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:55:24 -0000 Author: kientzle Date: Mon Apr 27 18:55:22 2009 New Revision: 191584 URL: http://svn.freebsd.org/changeset/base/191584 Log: Merge r1032 from libarchive.googlecode.com: Make test_fuzz a bit more sensitive by actually reading the body of each entry instead of skipping it. While I'm here, move the "UnsupportedCompress" macro into the only file that still uses it. Modified: head/lib/libarchive/test/test.h head/lib/libarchive/test/test_fuzz.c Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Mon Apr 27 18:46:57 2009 (r191583) +++ head/lib/libarchive/test/test.h Mon Apr 27 18:55:22 2009 (r191584) @@ -194,14 +194,3 @@ int read_open_memory2(struct archive *, test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) #define assertEqualStringA(a,v1,v2) \ test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) - -/* - * A compression is not supported - * Use this define after archive_read_next_header() is called - */ -#define UnsupportedCompress(r, a) \ - (r != ARCHIVE_OK && \ - (strcmp(archive_error_string(a), \ - "Unrecognized archive format") == 0 && \ - archive_compression(a) == ARCHIVE_COMPRESSION_NONE)) - Modified: head/lib/libarchive/test/test_fuzz.c ============================================================================== --- head/lib/libarchive/test/test_fuzz.c Mon Apr 27 18:46:57 2009 (r191583) +++ head/lib/libarchive/test/test_fuzz.c Mon Apr 27 18:55:22 2009 (r191584) @@ -61,9 +61,18 @@ files[] = { NULL }; +#define UnsupportedCompress(r, a) \ + (r != ARCHIVE_OK && \ + (strcmp(archive_error_string(a), \ + "Unrecognized archive format") == 0 && \ + archive_compression(a) == ARCHIVE_COMPRESSION_NONE)) + DEFINE_TEST(test_fuzz) { const char **filep; + const void *blk; + size_t blk_size; + off_t blk_offset; for (filep = files; *filep != NULL; ++filep) { struct archive_entry *ae; @@ -105,6 +114,10 @@ DEFINE_TEST(test_fuzz) assert(0 == archive_read_finish(a)); continue; } + while (0 == archive_read_data_block(a, &blk, + &blk_size, &blk_offset)) + continue; + } assert(0 == archive_read_close(a)); assert(0 == archive_read_finish(a)); @@ -134,7 +147,9 @@ DEFINE_TEST(test_fuzz) if (0 == archive_read_open_memory(a, image, size)) { while(0 == archive_read_next_header(a, &ae)) { - archive_read_data_skip(a); + while (0 == archive_read_data_block(a, + &blk, &blk_size, &blk_offset)) + continue; } archive_read_close(a); archive_read_finish(a); From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 19:14:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1F00106568C; Mon, 27 Apr 2009 19:14:43 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF7118FC0A; Mon, 27 Apr 2009 19:14:43 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RJEhAr024042; Mon, 27 Apr 2009 19:14:43 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RJEhBn024041; Mon, 27 Apr 2009 19:14:43 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271914.n3RJEhBn024041@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 19:14:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191586 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 19:14:44 -0000 Author: kientzle Date: Mon Apr 27 19:14:43 2009 New Revision: 191586 URL: http://svn.freebsd.org/changeset/base/191586 Log: ino_t varies across platforms; casting (int) here avoids various pointless complaints. Modified: head/lib/libarchive/archive_write_set_format_cpio.c Modified: head/lib/libarchive/archive_write_set_format_cpio.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_cpio.c Mon Apr 27 18:59:40 2009 (r191585) +++ head/lib/libarchive/archive_write_set_format_cpio.c Mon Apr 27 19:14:43 2009 (r191586) @@ -125,8 +125,9 @@ archive_write_cpio_header(struct archive * re-using the ones off the disk. That way, the 18-bit c_ino * field only limits the number of files in the archive. */ - if (archive_entry_ino(entry) > 0777777) { - archive_set_error(&a->archive, ERANGE, "large inode number truncated"); + if ((int)archive_entry_ino(entry) > 0777777) { + archive_set_error(&a->archive, ERANGE, + "large inode number truncated"); ret = ARCHIVE_WARN; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 19:20:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D79E10656CE; Mon, 27 Apr 2009 19:20:26 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FCB18FC29; Mon, 27 Apr 2009 19:20:26 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RJKQFX024322; Mon, 27 Apr 2009 19:20:26 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RJKQnr024320; Mon, 27 Apr 2009 19:20:26 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271920.n3RJKQnr024320@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 19:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191590 - head/lib/libarchive/test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 19:20:28 -0000 Author: kientzle Date: Mon Apr 27 19:20:25 2009 New Revision: 191590 URL: http://svn.freebsd.org/changeset/base/191590 Log: Merge r1058 from libarchive.googlecode.com: Require that each test source file has exactly one DEFINE_TEST(). Modified: head/lib/libarchive/test/test_pax_filename_encoding.c head/lib/libarchive/test/test_read_format_isojoliet_bz2.c Modified: head/lib/libarchive/test/test_pax_filename_encoding.c ============================================================================== --- head/lib/libarchive/test/test_pax_filename_encoding.c Mon Apr 27 19:18:55 2009 (r191589) +++ head/lib/libarchive/test/test_pax_filename_encoding.c Mon Apr 27 19:20:25 2009 (r191590) @@ -40,7 +40,8 @@ __FBSDID("$FreeBSD$"); * the right filename returned and that we get a warning only * if the header isn't marked as binary. */ -DEFINE_TEST(test_pax_filename_encoding_1) +static void +test_pax_filename_encoding_1(void) { static const char testname[] = "test_pax_filename_encoding.tar"; /* @@ -84,7 +85,8 @@ DEFINE_TEST(test_pax_filename_encoding_1 * This should work; the underlying implementation should automatically * fall back to storing the pathname in binary. */ -DEFINE_TEST(test_pax_filename_encoding_2) +static void +test_pax_filename_encoding_2(void) { char filename[] = "abc\314\214mno\374xyz"; struct archive *a; @@ -191,7 +193,8 @@ DEFINE_TEST(test_pax_filename_encoding_2 * read it back into "C" locale, which doesn't support the name. * TODO: Figure out the "right" behavior here. */ -DEFINE_TEST(test_pax_filename_encoding_3) +static void +test_pax_filename_encoding_3(void) { wchar_t badname[] = L"xxxAyyyBzzz"; const char badname_utf8[] = "xxx\xE1\x88\xB4yyy\xE5\x99\xB8zzz"; @@ -325,3 +328,10 @@ DEFINE_TEST(test_pax_filename_encoding_3 assertEqualInt(0, archive_read_finish(a)); #endif } + +DEFINE_TEST(test_pax_filename_encoding) +{ + test_pax_filename_encoding_1(); + test_pax_filename_encoding_2(); + test_pax_filename_encoding_3(); +} Modified: head/lib/libarchive/test/test_read_format_isojoliet_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_isojoliet_bz2.c Mon Apr 27 19:18:55 2009 (r191589) +++ head/lib/libarchive/test/test_read_format_isojoliet_bz2.c Mon Apr 27 19:20:25 2009 (r191590) @@ -177,11 +177,7 @@ joliettest(int withrr) DEFINE_TEST(test_read_format_isojoliet_bz2) { joliettest(0); -} - -DEFINE_TEST(test_read_format_isojolietrr_bz2) -{ /* XXXX This doesn't work today; can it be made to work? */ #if 0 joliettest(1); From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 19:23:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22E6B1065789; Mon, 27 Apr 2009 19:23:54 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E62C8FC0C; Mon, 27 Apr 2009 19:23:54 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RJNr1C024439; Mon, 27 Apr 2009 19:23:53 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RJNrUR024437; Mon, 27 Apr 2009 19:23:53 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271923.n3RJNrUR024437@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 19:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191591 - head/lib/libarchive/test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 19:23:55 -0000 Author: kientzle Date: Mon Apr 27 19:23:53 2009 New Revision: 191591 URL: http://svn.freebsd.org/changeset/base/191591 Log: Merge r1034 from libarchive.googlecode.com: Put a much larger file on the reference ISO for this test. Modified: head/lib/libarchive/test/test_read_format_isorr_bz2.c head/lib/libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu Modified: head/lib/libarchive/test/test_read_format_isorr_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_isorr_bz2.c Mon Apr 27 19:20:25 2009 (r191590) +++ head/lib/libarchive/test/test_read_format_isorr_bz2.c Mon Apr 27 19:23:53 2009 (r191591) @@ -26,13 +26,14 @@ __FBSDID("$FreeBSD$"); /* -Execute the following to rebuild the data for this program: +Execute the following command to rebuild the data for this program: tail -n +32 test_read_format_isorr_bz2.c | /bin/sh rm -rf /tmp/iso mkdir /tmp/iso mkdir /tmp/iso/dir echo "hello" >/tmp/iso/file +dd if=/dev/zero bs=1 count=12345678 >>/tmp/iso/file ln /tmp/iso/file /tmp/iso/hardlink (cd /tmp/iso; ln -s file symlink) TZ=utc touch -afhm -t 197001020000.01 /tmp/iso /tmp/iso/file /tmp/iso/dir @@ -95,11 +96,10 @@ DEFINE_TEST(test_read_format_isorr_bz2) assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("file", archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); - assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(12345684, archive_entry_size(ae)); assertEqualInt(0, archive_read_data_block(a, &p, &size, &offset)); - assertEqualInt(6, (int)size); assertEqualInt(0, offset); - assertEqualInt(0, memcmp(p, "hello\n", 6)); + assertEqualMem(p, "hello\n", 6); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); assertEqualInt(2, archive_entry_stat(ae)->st_nlink); @@ -111,7 +111,7 @@ DEFINE_TEST(test_read_format_isorr_bz2) assertEqualString("hardlink", archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); assertEqualString("file", archive_entry_hardlink(ae)); - assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(12345684, archive_entry_size(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); assertEqualInt(2, archive_entry_stat(ae)->st_nlink); Modified: head/lib/libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu ============================================================================== --- head/lib/libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu Mon Apr 27 19:20:25 2009 (r191590) +++ head/lib/libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu Mon Apr 27 19:23:53 2009 (r191591) @@ -1,24 +1,24 @@ $FreeBSD$ - begin 644 test_read_format_isorr_bz2.iso.bz2 -M0EIH.3%!629361M#:2D``,?_W?__6_Y58_GX/__?X*?OWB8AZB0`,`$@`$0" -M@0C``QP`U:!,&J>FJ>2:CR)^I'ZB#3U/4-`!H:#(:``]0P@`!H9!D!II-$,A -M&BGFJ>34]0T!IHT&AHT:#0:``!ZC$`#0T.`!H&@&AH``!IB&C30```!H9``! -MA(D0DTQ3T3$TVA-!IIZAA-'J:!H!H#0:#30:#30T;1*PHGAZ"/F;E""L"I6" -M8W&#'./D%S=_T4T96&+@94X&AL;:`Y+0C?:%=B#:8`:PP`2WF"20!EXL)6=] -M8=A)!0Q)($C&$U#8AI(&QL2!"10P4^8D$"0,8$I-.!3R8YWZ]Q1./IDR^VYN -MRJ&76*,$3PG?U(,=C;I20`D<&9/%5ILJIGI0(SWP3KRID6=#1MV*A>)(*B0$ -M$E:>B944( -MO-&.8&:1K;>[K$?O7R-FWA;%5+E]WBVT9PR7J -MNU2C2G2>5**"XH4HD`PF+(*DTT&47'A+)B";NS-UH>(]7G^\/G_343KU\17< -M<*""-SM"%>BVIJL8SF]7L-1.-LSRP2%=KX&C56*FC&#C$XNMGL)]3X&^$V4Z -MY`()G`%`KUR!HU8Z'"HWNE&P6MI:KZ^Q"H0L7.OV8ZJW409[QO=`&&D%=5&@RP`MO%R/J#Q -M-KJ*6D;EH7:DK0.48@8HF*IP(>*YMR$>!+A,)X+;`$94@@?U]B/=2T0CY-2= -M*_1FPF<-G\\@Z-_,Q>06='5:(B#3`W$8Y!:C-CE22SM9*S$00,XXJTIZ!GA( -LGTMN:F\J-,D9>?.38*!I7T>--*B_=T44HJ?#@``"1;7#_Q=R13A0D!M#:2D` +M0EIH.3%!629363S[0-4``,?_W?__R_158__Z/__?8*?OWB8AZB2```4@`,0" +M@0C0`SX`6UH$P:F@32FCU-D1Z@#U'J!HT>H#0`!H`T9`#U-#33(-`-3TFA#1 +MJ933TFR%#(&@`#0-````'J`T``,.-#1HT&C0-``````R````-`9``8<:&C1H +M-&@:`````!D````:`R``P1*(1$]3U,C(--``T!H:9``````:``&F)?&F1;DY +M&:FB?6\AB@WG9X@8AM,HTK/Q9EXPZD#E2A$D)(@;F(G^B.92GLB`=H@`+I1! +M1$`';Y%%P_YU^!0+8BJ(@#DC&D@D4"1D4?Z1!$1`&Z`V[]0H($(!6L90;:>A0V<))XH7BH%"KAF8!:H8\].K:4`Y`,4,!RN:#SL[!;-"!6%0F?`H +M2_2AM@*%/%<\*!XL/C2%A1AI$8/AF(#SZ;]:>$5^/NKNO<+EH@_CS4XUI(Q* +M123&G=9T]QQR?"=WMV(,&60`1D0:U043)E&22GWA);Z:"9R.A@,4,IL+O=L7 +MACF:V5C!L"HB&,82/[./'>PAEG-"PA,D6T1+ +M2<\S]-*$,]X-XF%:_)1,W,=`,^+.N0""6@"85=H@<2FZ=HI-GDHK&)>/T74Y +M+5>[4:S`Z`M87AHD`H6BE*8R%X=9AS$7&+Z?F%A.`AX!"XZRR@C5_?4^P".90`*]#[D(PA*&MPV7U2 +M;.]7.&/5!?P@C:J)S&T%=%,KJ@X0[""E8G!I!/I%`KSMA<#^!%C+Y*")'1]( +MJ06:CXD^5K*:`$E`B`0$P5;&R;BF<5/Y7&(5A`?:!J@`` ` end From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 19:30:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C012106564A; Mon, 27 Apr 2009 19:30:10 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28B3E8FC23; Mon, 27 Apr 2009 19:30:10 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RJUAfm024614; Mon, 27 Apr 2009 19:30:10 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RJU9D7024610; Mon, 27 Apr 2009 19:30:09 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271930.n3RJU9D7024610@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 19:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191592 - in head/lib/libarchive: . test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 19:30:10 -0000 Author: kientzle Date: Mon Apr 27 19:30:09 2009 New Revision: 191592 URL: http://svn.freebsd.org/changeset/base/191592 Log: Merge r1061,r1062,r1063 from libarchive.googlecode.com: Fix reading big-endian binary cpio archives, and add a test. While I'm here, add a note about Solaris ACL extension for cpio, which should be relatively straightforward to support. Thanks to: Edward Napierala, who sent me a big-endian cpio archive from a Solaris system he's been playing with. Pointy hat: me Added: head/lib/libarchive/test/test_read_format_cpio_bin_be.c (contents, props changed) head/lib/libarchive/test/test_read_format_cpio_bin_be.cpio.uu (contents, props changed) Modified: head/lib/libarchive/archive_read_support_format_cpio.c head/lib/libarchive/test/Makefile Modified: head/lib/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_cpio.c Mon Apr 27 19:23:53 2009 (r191591) +++ head/lib/libarchive/archive_read_support_format_cpio.c Mon Apr 27 19:30:09 2009 (r191592) @@ -257,6 +257,11 @@ archive_read_format_cpio_read_header(str cpio->entry_bytes_remaining = 0; } + /* XXX TODO: If the full mode is 0160200, then this is a Solaris + * ACL description for the following entry. Read this body + * and parse it as a Solaris-style ACL, then read the next + * header. XXX */ + /* Compare name to "TRAILER!!!" to test for end-of-archive. */ if (namelength == 11 && strcmp((const char *)h, "TRAILER!!!") == 0) { /* TODO: Store file location of start of block. */ @@ -669,7 +674,7 @@ le4(const unsigned char *p) static int be4(const unsigned char *p) { - return (p[0] + (p[1]<<8) + (p[2]<<16) + (p[3]<<24)); + return ((p[0]<<24) + (p[1]<<16) + (p[2]<<8) + (p[3])); } /* Modified: head/lib/libarchive/test/Makefile ============================================================================== --- head/lib/libarchive/test/Makefile Mon Apr 27 19:23:53 2009 (r191591) +++ head/lib/libarchive/test/Makefile Mon Apr 27 19:30:09 2009 (r191592) @@ -39,6 +39,7 @@ TESTS= \ test_read_format_ar.c \ test_read_format_cpio_bin.c \ test_read_format_cpio_bin_Z.c \ + test_read_format_cpio_bin_be.c \ test_read_format_cpio_bin_bz2.c \ test_read_format_cpio_bin_gz.c \ test_read_format_cpio_bin_xz.c \ Added: head/lib/libarchive/test/test_read_format_cpio_bin_be.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_read_format_cpio_bin_be.c Mon Apr 27 19:30:09 2009 (r191592) @@ -0,0 +1,55 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_cpio_bin_be) +{ + struct archive_entry *ae; + struct archive *a; + const char *reference = "test_read_format_cpio_bin_be.cpio"; + + extract_reference_file(reference); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, reference, 10)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(archive_entry_pathname(ae), "file1111222233334444"); + assertEqualInt(archive_entry_size(ae), 5); + assertEqualInt(archive_entry_mtime(ae), 1240664175); + assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); + assertEqualInt(archive_entry_uid(ae), 1000); + assertEqualInt(archive_entry_gid(ae), 0); + + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_BE); + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); +} + + Added: head/lib/libarchive/test/test_read_format_cpio_bin_be.cpio.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_read_format_cpio_bin_be.cpio.uu Mon Apr 27 19:30:09 2009 (r191592) @@ -0,0 +1,8 @@ +$FreeBSD$ +begin 644 test_read_format_cpio_bin_be.cpio +M<<<`"#P\@:0#Z`````$``$GS"&\`%0````5F:6QE,3$Q,3(R,C(S,S,S-#0T +M-```86)C9&4`<<<```````````````$`````````"P````!44D%)3$52(2$A +M```````````````````````````````````````````````````````````` +3```````````````````````````` +` +end From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 19:39:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 840F01065674; Mon, 27 Apr 2009 19:39:18 +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 723348FC0C; Mon, 27 Apr 2009 19:39:18 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RJdIFi024834; Mon, 27 Apr 2009 19:39:18 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RJdIds024833; Mon, 27 Apr 2009 19:39:18 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200904271939.n3RJdIds024833@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 27 Apr 2009 19:39:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191593 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 19:39:19 -0000 Author: jkim Date: Mon Apr 27 19:39:18 2009 New Revision: 191593 URL: http://svn.freebsd.org/changeset/base/191593 Log: Reduce code duplication and excessive pci_get_slot() calls. Reviewed by: mav Modified: head/sys/dev/ata/ata-pci.c Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Mon Apr 27 19:30:09 2009 (r191592) +++ head/sys/dev/ata/ata-pci.c Mon Apr 27 19:39:18 2009 (r191593) @@ -775,26 +775,26 @@ ata_match_chip(device_t dev, struct ata_ struct ata_chip_id * ata_find_chip(device_t dev, struct ata_chip_id *index, int slot) { + struct ata_chip_id *idx; device_t *children; int nchildren, i; + uint8_t s; if (device_get_children(device_get_parent(dev), &children, &nchildren)) - return 0; + return (NULL); - while (index->chipid != 0) { - for (i = 0; i < nchildren; i++) { - if (((slot >= 0 && pci_get_slot(children[i]) == slot) || - (slot < 0 && pci_get_slot(children[i]) <= -slot)) && - pci_get_devid(children[i]) == index->chipid && - pci_get_revid(children[i]) >= index->chiprev) { + for (i = 0; i < nchildren; i++) { + s = pci_get_slot(children[i]); + if ((slot >= 0 && s == slot) || (slot < 0 && s <= -slot)) { + idx = ata_match_chip(children[i], index); + if (idx != NULL) { free(children, M_TEMP); - return index; + return (idx); } } - index++; } free(children, M_TEMP); - return NULL; + return (NULL); } void From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 20:09:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5E961065697; Mon, 27 Apr 2009 20:09:05 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 702C88FC08; Mon, 27 Apr 2009 20:09:05 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RK95Df025492; Mon, 27 Apr 2009 20:09:05 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RK956w025485; Mon, 27 Apr 2009 20:09:05 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904272009.n3RK956w025485@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 20:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191594 - in head/lib/libarchive: . test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 20:09:06 -0000 Author: kientzle Date: Mon Apr 27 20:09:05 2009 New Revision: 191594 URL: http://svn.freebsd.org/changeset/base/191594 Log: Merge r990,r1044 from libarchive.googlecode.com: read_support_format_raw() allows people to exploit libarchive's automatic decompression support by simply stubbing out the archive format handler. The raw handler is not enabled by support_format_all(), of course. It bids 1 on any non-empty input and always returns a single entry named "data" with no properties set. Added: head/lib/libarchive/archive_read_support_format_raw.c (contents, props changed) head/lib/libarchive/test/test_read_format_raw.c (contents, props changed) head/lib/libarchive/test/test_read_format_raw.data.Z.uu (contents, props changed) head/lib/libarchive/test/test_read_format_raw.data.uu (contents, props changed) Modified: head/lib/libarchive/Makefile head/lib/libarchive/archive.h head/lib/libarchive/test/Makefile Modified: head/lib/libarchive/Makefile ============================================================================== --- head/lib/libarchive/Makefile Mon Apr 27 19:39:18 2009 (r191593) +++ head/lib/libarchive/Makefile Mon Apr 27 20:09:05 2009 (r191594) @@ -52,6 +52,7 @@ SRCS= archive_check_magic.c \ archive_read_support_format_empty.c \ archive_read_support_format_iso9660.c \ archive_read_support_format_mtree.c \ + archive_read_support_format_raw.c \ archive_read_support_format_tar.c \ archive_read_support_format_zip.c \ archive_string.c \ Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Mon Apr 27 19:39:18 2009 (r191593) +++ head/lib/libarchive/archive.h Mon Apr 27 20:09:05 2009 (r191594) @@ -272,6 +272,7 @@ typedef int archive_close_callback(struc #define ARCHIVE_FORMAT_AR_GNU (ARCHIVE_FORMAT_AR | 1) #define ARCHIVE_FORMAT_AR_BSD (ARCHIVE_FORMAT_AR | 2) #define ARCHIVE_FORMAT_MTREE 0x80000 +#define ARCHIVE_FORMAT_RAW 0x90000 /*- * Basic outline for reading an archive: @@ -315,6 +316,7 @@ __LA_DECL int archive_read_support_for __LA_DECL int archive_read_support_format_gnutar(struct archive *); __LA_DECL int archive_read_support_format_iso9660(struct archive *); __LA_DECL int archive_read_support_format_mtree(struct archive *); +__LA_DECL int archive_read_support_format_raw(struct archive *); __LA_DECL int archive_read_support_format_tar(struct archive *); __LA_DECL int archive_read_support_format_zip(struct archive *); Added: head/lib/libarchive/archive_read_support_format_raw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/archive_read_support_format_raw.c Mon Apr 27 20:09:05 2009 (r191594) @@ -0,0 +1,187 @@ +/*- + * Copyright (c) 2003-2009 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_ERRNO_H +#include +#endif +#include +#ifdef HAVE_STDLIB_H +#include +#endif + +#include "archive.h" +#include "archive_entry.h" +#include "archive_private.h" +#include "archive_read_private.h" + +struct raw_info { + int64_t offset; /* Current position in the file. */ + int end_of_file; +}; + +static int archive_read_format_raw_bid(struct archive_read *); +static int archive_read_format_raw_cleanup(struct archive_read *); +static int archive_read_format_raw_read_data(struct archive_read *, + const void **, size_t *, off_t *); +static int archive_read_format_raw_read_data_skip(struct archive_read *); +static int archive_read_format_raw_read_header(struct archive_read *, + struct archive_entry *); + +int +archive_read_support_format_raw(struct archive *_a) +{ + struct raw_info *info; + struct archive_read *a = (struct archive_read *)_a; + int r; + + info = (struct raw_info *)calloc(1, sizeof(*info)); + if (info == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate raw_info data"); + return (ARCHIVE_FATAL); + } + + r = __archive_read_register_format(a, + info, + "raw", + archive_read_format_raw_bid, + NULL, + archive_read_format_raw_read_header, + archive_read_format_raw_read_data, + archive_read_format_raw_read_data_skip, + archive_read_format_raw_cleanup); + if (r != ARCHIVE_OK) + free(info); + return (r); +} + +/* + * Bid 1 if this is a non-empty file. Anyone who can really support + * this should outbid us, so it should generally be safe to use "raw" + * in conjunction with other formats. But, this could really confuse + * folks if there are bid errors or minor file damage, so we don't + * include "raw" as part of support_format_all(). + */ +static int +archive_read_format_raw_bid(struct archive_read *a) +{ + const char *p; + + if ((p = __archive_read_ahead(a, 1, NULL)) == NULL) + return (-1); + return (1); +} + +/* + * Mock up a fake header. + */ +static int +archive_read_format_raw_read_header(struct archive_read *a, + struct archive_entry *entry) +{ + struct raw_info *info; + + info = (struct raw_info *)(a->format->data); + if (info->end_of_file) + return (ARCHIVE_EOF); + + a->archive.archive_format = ARCHIVE_FORMAT_RAW; + a->archive.archive_format_name = "Raw data"; + archive_entry_set_pathname(entry, "data"); + /* XXX should we set mode to mimic a regular file? XXX */ + /* I'm deliberately leaving most fields unset here. */ + return (ARCHIVE_OK); +} + +static int +archive_read_format_raw_read_data(struct archive_read *a, + const void **buff, size_t *size, off_t *offset) +{ + struct raw_info *info; + ssize_t avail; + + info = (struct raw_info *)(a->format->data); + if (info->end_of_file) + return (ARCHIVE_EOF); + + /* Get whatever bytes are immediately available. */ + *buff = __archive_read_ahead(a, 1, &avail); + if (avail > 0) { + /* Consume and return the bytes we just read */ + __archive_read_consume(a, avail); + *size = avail; + *offset = info->offset; + info->offset += *size; + return (ARCHIVE_OK); + } else if (0 == avail) { + /* Record and return end-of-file. */ + info->end_of_file = 1; + *size = 0; + *offset = info->offset; + return (ARCHIVE_EOF); + } else { + /* Record and return an error. */ + *size = 0; + *offset = info->offset; + return (avail); + } + return (ARCHIVE_OK); +} + +static int +archive_read_format_raw_read_data_skip(struct archive_read *a) +{ + struct raw_info *info; + off_t bytes_skipped; + int64_t request = 1024 * 1024 * 1024UL; /* Skip 1 GB at a time. */ + + info = (struct raw_info *)(a->format->data); + if (info->end_of_file) + return (ARCHIVE_EOF); + info->end_of_file = 1; + + for (;;) { + bytes_skipped = __archive_read_skip_lenient(a, request); + if (bytes_skipped < 0) + return (ARCHIVE_FATAL); + if (bytes_skipped < request) + return (ARCHIVE_OK); + /* We skipped all the bytes we asked for. There might + * be more, so try again. */ + } +} + +static int +archive_read_format_raw_cleanup(struct archive_read *a) +{ + struct raw_info *info; + + info = (struct raw_info *)(a->format->data); + free(info); + a->format->data = NULL; + return (ARCHIVE_OK); +} Modified: head/lib/libarchive/test/Makefile ============================================================================== --- head/lib/libarchive/test/Makefile Mon Apr 27 19:39:18 2009 (r191593) +++ head/lib/libarchive/test/Makefile Mon Apr 27 20:09:05 2009 (r191594) @@ -55,6 +55,7 @@ TESTS= \ test_read_format_isorr_bz2.c \ test_read_format_mtree.c \ test_read_format_pax_bz2.c \ + test_read_format_raw.c \ test_read_format_tar.c \ test_read_format_tar_empty_filename.c \ test_read_format_tbz.c \ @@ -118,8 +119,8 @@ CFLAGS+= -I${LA_SRCDIR} -I. #LDADD+= -L/usr/local/lib -llzmadec # Uncomment to build and test lzma and xz support via liblzma -CFLAGS+= -I/usr/local/include -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 -LDADD+= -L/usr/local/lib -llzma +#CFLAGS+= -I/usr/local/include -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 +#LDADD+= -L/usr/local/lib -llzma # Uncomment to link against dmalloc #LDADD+= -L/usr/local/lib -ldmalloc Added: head/lib/libarchive/test/test_read_format_raw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_read_format_raw.c Mon Apr 27 20:09:05 2009 (r191594) @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 2007 Kai Wang + * Copyright (c) 2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_raw) +{ + char buff[512]; + struct archive_entry *ae; + struct archive *a; + const char *reffile1 = "test_read_format_raw.data"; + const char *reffile2 = "test_read_format_raw.data.Z"; + + /* First, try pulling data out of an uninterpretable file. */ + extract_reference_file(reffile1); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_raw(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, reffile1, 512)); + + /* First (and only!) Entry */ + assertA(0 == archive_read_next_header(a, &ae)); + assertEqualString("data", archive_entry_pathname(ae)); + /* Most fields should be unset (unknown) */ + assert(!archive_entry_size_is_set(ae)); + assert(!archive_entry_atime_is_set(ae)); + assert(!archive_entry_ctime_is_set(ae)); + assert(!archive_entry_mtime_is_set(ae)); + assertEqualInt(4, archive_read_data(a, buff, 32)); + assertEqualMem(buff, "foo\n", 4); + + /* Test EOF */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + + + /* Second, try the same with a compressed file. */ + extract_reference_file(reffile2); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_raw(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, reffile2, 1)); + + /* First (and only!) Entry */ + assertA(0 == archive_read_next_header(a, &ae)); + assertEqualString("data", archive_entry_pathname(ae)); + /* Most fields should be unset (unknown) */ + assert(!archive_entry_size_is_set(ae)); + assert(!archive_entry_atime_is_set(ae)); + assert(!archive_entry_ctime_is_set(ae)); + assert(!archive_entry_mtime_is_set(ae)); + assertEqualInt(4, archive_read_data(a, buff, 32)); + assertEqualMem(buff, "foo\n", 4); + + /* Test EOF */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); +} Added: head/lib/libarchive/test/test_read_format_raw.data.Z.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_read_format_raw.data.Z.uu Mon Apr 27 20:09:05 2009 (r191594) @@ -0,0 +1,5 @@ +$FreeBSD$ +begin 644 test_read_format_raw.data.Z +('YV09MZ\40`` +` +end Added: head/lib/libarchive/test/test_read_format_raw.data.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_read_format_raw.data.uu Mon Apr 27 20:09:05 2009 (r191594) @@ -0,0 +1,5 @@ +$FreeBSD$ +begin 644 test_read_format_raw.data +$9F]O"@`` +` +end From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 20:13:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EA7D1065670; Mon, 27 Apr 2009 20:13:13 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C5108FC28; Mon, 27 Apr 2009 20:13:13 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RKDD1E025636; Mon, 27 Apr 2009 20:13:13 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RKDDtV025635; Mon, 27 Apr 2009 20:13:13 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904272013.n3RKDDtV025635@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 20:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191595 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 20:13:13 -0000 Author: kientzle Date: Mon Apr 27 20:13:13 2009 New Revision: 191595 URL: http://svn.freebsd.org/changeset/base/191595 Log: Merge r991 from libarchive.googlecode.com: Various updates to archive_read.3 manpage, including documentation for the new "raw" handler. Modified: head/lib/libarchive/archive_read.3 Modified: head/lib/libarchive/archive_read.3 ============================================================================== --- head/lib/libarchive/archive_read.3 Mon Apr 27 20:09:05 2009 (r191594) +++ head/lib/libarchive/archive_read.3 Mon Apr 27 20:13:13 2009 (r191595) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 19, 2006 +.Dd April 13, 2009 .Dt archive_read 3 .Os .Sh NAME @@ -36,12 +36,18 @@ .Nm archive_read_support_compression_bzip2 , .Nm archive_read_support_compression_compress , .Nm archive_read_support_compression_gzip , +.Nm archive_read_support_compression_lzma , .Nm archive_read_support_compression_none , +.Nm archive_read_support_compression_xz , .Nm archive_read_support_compression_program , +.Nm archive_read_support_compression_program_signature , .Nm archive_read_support_format_all , +.Nm archive_read_support_format_ar , .Nm archive_read_support_format_cpio , .Nm archive_read_support_format_empty , .Nm archive_read_support_format_iso9660 , +.Nm archive_read_support_format_mtree, +.Nm archive_read_support_format_raw, .Nm archive_read_support_format_tar , .Nm archive_read_support_format_zip , .Nm archive_read_open , @@ -78,21 +84,38 @@ .Ft int .Fn archive_read_support_compression_gzip "struct archive *" .Ft int +.Fn archive_read_support_compression_lzma "struct archive *" +.Ft int .Fn archive_read_support_compression_none "struct archive *" .Ft int +.Fn archive_read_support_compression_xz "struct archive *" +.Ft int .Fo archive_read_support_compression_program .Fa "struct archive *" .Fa "const char *cmd" .Fc .Ft int +.Fo archive_read_support_compression_program_signature +.Fa "struct archive *" +.Fa "const char *cmd" +.Fa "const void *signature" +.Fa "size_t signature_length" +.Fc +.Ft int .Fn archive_read_support_format_all "struct archive *" .Ft int +.Fn archive_read_support_format_ar "struct archive *" +.Ft int .Fn archive_read_support_format_cpio "struct archive *" .Ft int .Fn archive_read_support_format_empty "struct archive *" .Ft int .Fn archive_read_support_format_iso9660 "struct archive *" .Ft int +.Fn archive_read_support_format_mtree "struct archive *" +.Ft int +.Fn archive_read_support_format_raw "struct archive *" +.Ft int .Fn archive_read_support_format_tar "struct archive *" .Ft int .Fn archive_read_support_format_zip "struct archive *" @@ -189,30 +212,43 @@ Allocates and initializes a .Tn struct archive object suitable for reading from an archive. .It Xo -.Fn archive_read_support_compression_all , .Fn archive_read_support_compression_bzip2 , .Fn archive_read_support_compression_compress , .Fn archive_read_support_compression_gzip , -.Fn archive_read_support_compression_none +.Fn archive_read_support_compression_lzma , +.Fn archive_read_support_compression_none , +.Fn archive_read_support_compression_xz .Xc Enables auto-detection code and decompression support for the specified compression. +Returns +.Cm ARCHIVE_OK +if the compression is fully supported, or +.Cm ARCHIVE_WARN +if the compression is supported only through an external program. +Note that decompression using an external program is usually slower than +decompression through built-in libraries. Note that .Dq none is always enabled by default. -For convenience, -.Fn archive_read_support_compression_all -enables all available decompression code. +.It Fn archive_read_support_compression_all +Enables all available decompression filters. .It Fn archive_read_support_compression_program Data is fed through the specified external program before being dearchived. Note that this disables automatic detection of the compression format, so it makes no sense to specify this in conjunction with any other decompression option. +.It Fn archive_read_support_compression_program_signature +This feeds data through the specified external program +but only if the initial bytes of the data match the specified +signature value. .It Xo .Fn archive_read_support_format_all , +.Fn archive_read_support_format_ar , .Fn archive_read_support_format_cpio , .Fn archive_read_support_format_empty , .Fn archive_read_support_format_iso9660 , +.Fn archive_read_support_format_mtree , .Fn archive_read_support_format_tar , .Fn archive_read_support_format_zip .Xc @@ -226,6 +262,17 @@ For convenience, .Fn archive_read_support_format_all enables support for all available formats. Only empty archives are supported by default. +.It Fn archive_read_support_format_raw +The +.Dq raw +format handler allows libarchive to be used to read arbitrary data. +It treats any data stream as an archive with a single entry. +The pathname of this entry is +.Dq data ; +all other entry fields are unset. +This is not enabled by +.Fn archive_read_support_format_all +in order to avoid erroneous handling of damaged archives. .It Xo .Fn archive_read_set_filter_options , .Fn archive_read_set_format_options , @@ -322,9 +369,9 @@ a .Tn struct archive_entry . This is a convenience wrapper around .Fn archive_read_next_header2 -that uses an internal +that reuses an internal .Tn struct archive_entry -object. +object for each request. .It Fn archive_read_next_header2 Read the header for the next entry and populate the provided .Tn struct archive_entry . From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 20:23:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04EC2106566B; Mon, 27 Apr 2009 20:23:23 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6EC18FC19; Mon, 27 Apr 2009 20:23:22 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RKNM8a025956; Mon, 27 Apr 2009 20:23:22 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RKNMsL025955; Mon, 27 Apr 2009 20:23:22 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904272023.n3RKNMsL025955@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 20:23:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191597 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 20:23:23 -0000 Author: kientzle Date: Mon Apr 27 20:23:22 2009 New Revision: 191597 URL: http://svn.freebsd.org/changeset/base/191597 Log: Symlink some additional man page entries. Modified: head/lib/libarchive/Makefile Modified: head/lib/libarchive/Makefile ============================================================================== --- head/lib/libarchive/Makefile Mon Apr 27 20:18:01 2009 (r191596) +++ head/lib/libarchive/Makefile Mon Apr 27 20:23:22 2009 (r191597) @@ -178,6 +178,7 @@ MLINKS+= archive_read.3 archive_read_ext MLINKS+= archive_read.3 archive_read_finish.3 MLINKS+= archive_read.3 archive_read_new.3 MLINKS+= archive_read.3 archive_read_next_header.3 +MLINKS+= archive_read.3 archive_read_next_header2.3 MLINKS+= archive_read.3 archive_read_open.3 MLINKS+= archive_read.3 archive_read_open2.3 MLINKS+= archive_read.3 archive_read_open_FILE.3 @@ -189,11 +190,17 @@ MLINKS+= archive_read.3 archive_read_sup MLINKS+= archive_read.3 archive_read_support_compression_bzip2.3 MLINKS+= archive_read.3 archive_read_support_compression_compress.3 MLINKS+= archive_read.3 archive_read_support_compression_gzip.3 +MLINKS+= archive_read.3 archive_read_support_compression_lzma.3 MLINKS+= archive_read.3 archive_read_support_compression_none.3 MLINKS+= archive_read.3 archive_read_support_compression_program.3 +MLINKS+= archive_read.3 archive_read_support_compression_program_signature.3 +MLINKS+= archive_read.3 archive_read_support_compression_xz.3 MLINKS+= archive_read.3 archive_read_support_format_all.3 +MLINKS+= archive_read.3 archive_read_support_format_ar.3 MLINKS+= archive_read.3 archive_read_support_format_cpio.3 +MLINKS+= archive_read.3 archive_read_support_format_empty.3 MLINKS+= archive_read.3 archive_read_support_format_iso9660.3 +MLINKS+= archive_read.3 archive_read_support_format_raw.3 MLINKS+= archive_read.3 archive_read_support_format_tar.3 MLINKS+= archive_read.3 archive_read_support_format_zip.3 MLINKS+= archive_read_disk.3 archive_read_disk_entry_from_file.3 From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 21:04:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE798106566B; Mon, 27 Apr 2009 21:04:16 +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 B279F8FC20; Mon, 27 Apr 2009 21:04:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RL4GZQ026802; Mon, 27 Apr 2009 21:04:16 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RL4GjJ026800; Mon, 27 Apr 2009 21:04:16 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200904272104.n3RL4GjJ026800@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 27 Apr 2009 21:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191599 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 21:04:18 -0000 Author: bz Date: Mon Apr 27 21:04:16 2009 New Revision: 191599 URL: http://svn.freebsd.org/changeset/base/191599 Log: key_gettunnel() has been unsued with FAST_IPSEC (now IPSEC). KAME had explicit checks at one point using it, so just hide it behind #if 0 for now until we are sure if we can completely dump it or not. MFC after: 1 month Modified: head/sys/netipsec/key.c head/sys/netipsec/key.h Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Mon Apr 27 20:38:27 2009 (r191598) +++ head/sys/netipsec/key.c Mon Apr 27 21:04:16 2009 (r191599) @@ -684,6 +684,7 @@ found: return sp; } +#if 0 /* * return a policy that matches this particular inbound packet. * XXX slow @@ -760,6 +761,7 @@ done: sp, sp ? sp->id : 0, sp ? sp->refcnt : 0)); return sp; } +#endif /* * allocating an SA entry for an *OUTBOUND* packet. Modified: head/sys/netipsec/key.h ============================================================================== --- head/sys/netipsec/key.h Mon Apr 27 20:38:27 2009 (r191598) +++ head/sys/netipsec/key.h Mon Apr 27 21:04:16 2009 (r191599) @@ -53,9 +53,11 @@ extern struct secpolicy *key_allocsp(str extern struct secpolicy *key_allocsp2(u_int32_t spi, union sockaddr_union *dst, u_int8_t proto, u_int dir, const char*, int); extern struct secpolicy *key_newsp(const char*, int); +#if 0 extern struct secpolicy *key_gettunnel(const struct sockaddr *, const struct sockaddr *, const struct sockaddr *, const struct sockaddr *, const char*, int); +#endif /* NB: prepend with _ for KAME IPv6 compatbility */ extern void _key_freesp(struct secpolicy **, const char*, int); @@ -65,8 +67,10 @@ extern void _key_freesp(struct secpolicy key_allocsp2(spi, dst, proto, dir, __FILE__, __LINE__) #define KEY_NEWSP() \ key_newsp(__FILE__, __LINE__) +#if 0 #define KEY_GETTUNNEL(osrc, odst, isrc, idst) \ key_gettunnel(osrc, odst, isrc, idst, __FILE__, __LINE__) +#endif #define KEY_FREESP(spp) \ _key_freesp(spp, __FILE__, __LINE__) From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 21:34:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7244106564A; Mon, 27 Apr 2009 21:34:15 +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 D58D78FC13; Mon, 27 Apr 2009 21:34:15 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RLYFYS027484; Mon, 27 Apr 2009 21:34:15 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RLYFGr027482; Mon, 27 Apr 2009 21:34:15 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200904272134.n3RLYFGr027482@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 27 Apr 2009 21:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191600 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 21:34:16 -0000 Author: jkim Date: Mon Apr 27 21:34:15 2009 New Revision: 191600 URL: http://svn.freebsd.org/changeset/base/191600 Log: - Give generic AHCI driver lower priority than device-specific drivers. - Consistently use BUS_PROBE_GENERIC instead of -100. Modified: head/sys/dev/ata/ata-pci.c head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Mon Apr 27 21:04:16 2009 (r191599) +++ head/sys/dev/ata/ata-pci.c Mon Apr 27 21:34:15 2009 (r191600) @@ -70,18 +70,18 @@ ata_pci_probe(device_t dev) /* is this a storage class device ? */ if (pci_get_class(dev) != PCIC_STORAGE) - return ENXIO; + return (ENXIO); /* is this an IDE/ATA type device ? */ if (pci_get_subclass(dev) != PCIS_STORAGE_IDE) - return ENXIO; + return (ENXIO); sprintf(buffer, "%s ATA controller", ata_pcivendor2str(dev)); device_set_desc_copy(dev, buffer); ctlr->chipinit = ata_generic_chipinit; /* we are a low priority handler */ - return -100; + return (BUS_PROBE_GENERIC); } int Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Mon Apr 27 21:04:16 2009 (r191599) +++ head/sys/dev/ata/chipsets/ata-ahci.c Mon Apr 27 21:34:15 2009 (r191600) @@ -85,7 +85,7 @@ ata_ahci_probe(device_t dev) /* is this PCI device flagged as an AHCI compliant chip ? */ if (pci_read_config(dev, PCIR_PROGIF, 1) != PCIP_STORAGE_SATA_AHCI_1_0) - return ENXIO; + return (ENXIO); if (bootverbose) sprintf(buffer, "%s (ID=%08x) AHCI controller", @@ -94,7 +94,7 @@ ata_ahci_probe(device_t dev) sprintf(buffer, "%s AHCI controller", ata_pcivendor2str(dev)); device_set_desc_copy(dev, buffer); ctlr->chipinit = ata_ahci_chipinit; - return 0; + return (BUS_PROBE_GENERIC); } int From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 21:45:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66D941065678; Mon, 27 Apr 2009 21:45:05 +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 5542B8FC25; Mon, 27 Apr 2009 21:45:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RLj5IS027734; Mon, 27 Apr 2009 21:45:05 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RLj50c027733; Mon, 27 Apr 2009 21:45:05 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200904272145.n3RLj50c027733@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 27 Apr 2009 21:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191601 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 21:45:06 -0000 Author: jkim Date: Mon Apr 27 21:45:05 2009 New Revision: 191601 URL: http://svn.freebsd.org/changeset/base/191601 Log: Use cached progif instead of reading it again. Modified: head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Mon Apr 27 21:34:15 2009 (r191600) +++ head/sys/dev/ata/chipsets/ata-ahci.c Mon Apr 27 21:45:05 2009 (r191601) @@ -84,7 +84,7 @@ ata_ahci_probe(device_t dev) return (ENXIO); /* is this PCI device flagged as an AHCI compliant chip ? */ - if (pci_read_config(dev, PCIR_PROGIF, 1) != PCIP_STORAGE_SATA_AHCI_1_0) + if (pci_get_progif(dev) != PCIP_STORAGE_SATA_AHCI_1_0) return (ENXIO); if (bootverbose) From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 22:06:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 448D91065670; Mon, 27 Apr 2009 22:06:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 333EE8FC18; Mon, 27 Apr 2009 22:06:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RM6nxo028236; Mon, 27 Apr 2009 22:06:49 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RM6n0h028235; Mon, 27 Apr 2009 22:06:49 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200904272206.n3RM6n0h028235@svn.freebsd.org> From: Sam Leffler Date: Mon, 27 Apr 2009 22:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191603 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:06:50 -0000 Author: sam Date: Mon Apr 27 22:06:49 2009 New Revision: 191603 URL: http://svn.freebsd.org/changeset/base/191603 Log: use if_transmit intead of direct frobbing of the if_snd q; this is no longer allowed Identified by: rwatson Reviewed by: kmacy Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Mon Apr 27 21:53:44 2009 (r191602) +++ head/sys/net/if_bridge.c Mon Apr 27 22:06:49 2009 (r191603) @@ -1761,24 +1761,15 @@ bridge_enqueue(struct bridge_softc *sc, } if (err == 0) - IFQ_ENQUEUE(&dst_ifp->if_snd, m, err); + dst_ifp->if_transmit(dst_ifp, m); } if (err == 0) { - sc->sc_ifp->if_opackets++; sc->sc_ifp->if_obytes += len; - - dst_ifp->if_obytes += len; - - if (mflags & M_MCAST) { + if (mflags & M_MCAST) sc->sc_ifp->if_omcasts++; - dst_ifp->if_omcasts++; - } } - - if ((dst_ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) - (*dst_ifp->if_start)(dst_ifp); } /* From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 22:39:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2973106564A; Mon, 27 Apr 2009 22:39:43 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0EB98FC18; Mon, 27 Apr 2009 22:39:43 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RMdhFi029184; Mon, 27 Apr 2009 22:39:43 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RMdhwU029183; Mon, 27 Apr 2009 22:39:43 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904272239.n3RMdhwU029183@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 22:39:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191604 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:39:44 -0000 Author: kientzle Date: Mon Apr 27 22:39:43 2009 New Revision: 191604 URL: http://svn.freebsd.org/changeset/base/191604 Log: Document the liblzma support. Unfortunately, liblzma itself is GPLed, so unlikely to become part of the FreeBSD base system. However, the core lzma compression/decompression code is public domain, so it should be feasible for someone to create a compatible library without the GPL strings. Modified: head/lib/libarchive/Makefile Modified: head/lib/libarchive/Makefile ============================================================================== --- head/lib/libarchive/Makefile Mon Apr 27 22:06:49 2009 (r191603) +++ head/lib/libarchive/Makefile Mon Apr 27 22:39:43 2009 (r191604) @@ -11,6 +11,9 @@ SHLIB_MAJOR= 4 CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" CFLAGS+= -I${.OBJDIR} +#Uncomment to build with full lzma/xz support via liblzma +#CFLAGS+= -I/usr/local/include -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 +#LDADD+= -L/usr/local/lib -llzma .if ${MK_OPENSSL} != "no" CFLAGS+= -DWITH_OPENSSL From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 22:44:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E030106566B; Mon, 27 Apr 2009 22:44:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CD178FC0C; Mon, 27 Apr 2009 22:44:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RMiQbP029378; Mon, 27 Apr 2009 22:44:26 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RMiQR6029377; Mon, 27 Apr 2009 22:44:26 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904272244.n3RMiQR6029377@svn.freebsd.org> From: Kip Macy Date: Mon, 27 Apr 2009 22:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191605 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:44:27 -0000 Author: kmacy Date: Mon Apr 27 22:44:26 2009 New Revision: 191605 URL: http://svn.freebsd.org/changeset/base/191605 Log: remove call to IFQ_HANDOFF is it called by if_transmit in the default case and doing so allows the ifnet driver to define its own queueing mechanism Modified: head/sys/net/if_arcsubr.c Modified: head/sys/net/if_arcsubr.c ============================================================================== --- head/sys/net/if_arcsubr.c Mon Apr 27 22:39:43 2009 (r191604) +++ head/sys/net/if_arcsubr.c Mon Apr 27 22:44:26 2009 (r191605) @@ -237,7 +237,7 @@ arc_output(struct ifnet *ifp, struct mbu BPF_MTAP(ifp, m); - IFQ_HANDOFF(ifp, m, error); + error = ifp->if_transmit(ifp, m); return (error); From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 22:45:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98013106566B; Mon, 27 Apr 2009 22:45:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B4918FC0C; Mon, 27 Apr 2009 22:45:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RMjJo8029443; Mon, 27 Apr 2009 22:45:19 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RMjJU6029442; Mon, 27 Apr 2009 22:45:19 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904272245.n3RMjJU6029442@svn.freebsd.org> From: Kip Macy Date: Mon, 27 Apr 2009 22:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191606 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:45:21 -0000 Author: kmacy Date: Mon Apr 27 22:45:19 2009 New Revision: 191606 URL: http://svn.freebsd.org/changeset/base/191606 Log: remove gratuitous memory barrier, a remnant of unified L2 / L3 Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Mon Apr 27 22:44:26 2009 (r191605) +++ head/sys/net/flowtable.c Mon Apr 27 22:45:19 2009 (r191606) @@ -438,7 +438,6 @@ static void flowtable_pcpu_unlock(struct flowtable *table, uint32_t hash) { - mb(); critical_exit(); } From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 22:45:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F4C0106567E; Mon, 27 Apr 2009 22:45:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7CB08FC1E; Mon, 27 Apr 2009 22:45:56 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RMjunt029489; Mon, 27 Apr 2009 22:45:56 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RMju9N029488; Mon, 27 Apr 2009 22:45:56 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904272245.n3RMju9N029488@svn.freebsd.org> From: Kip Macy Date: Mon, 27 Apr 2009 22:45:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191607 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:45:57 -0000 Author: kmacy Date: Mon Apr 27 22:45:56 2009 New Revision: 191607 URL: http://svn.freebsd.org/changeset/base/191607 Log: replace IFQ_HANDOFF with if_transmit Modified: head/sys/net/if_ef.c Modified: head/sys/net/if_ef.c ============================================================================== --- head/sys/net/if_ef.c Mon Apr 27 22:45:19 2009 (r191606) +++ head/sys/net/if_ef.c Mon Apr 27 22:45:56 2009 (r191607) @@ -222,7 +222,7 @@ ef_start(struct ifnet *ifp) if (m == 0) break; BPF_MTAP(ifp, m); - IFQ_HANDOFF(p, m, error); + error = p->if_transmit(p, m); if (error) { ifp->if_oerrors++; continue; From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 22:46:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DE0E1065690; Mon, 27 Apr 2009 22:46:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C83F8FC21; Mon, 27 Apr 2009 22:46:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RMkQJw029537; Mon, 27 Apr 2009 22:46:26 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RMkQTI029536; Mon, 27 Apr 2009 22:46:26 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904272246.n3RMkQTI029536@svn.freebsd.org> From: Kip Macy Date: Mon, 27 Apr 2009 22:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191608 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:46:27 -0000 Author: kmacy Date: Mon Apr 27 22:46:26 2009 New Revision: 191608 URL: http://svn.freebsd.org/changeset/base/191608 Log: replace IFQ_ENQUEUE + if_start with if_transmit Modified: head/sys/net/bridgestp.c Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Mon Apr 27 22:45:56 2009 (r191607) +++ head/sys/net/bridgestp.c Mon Apr 27 22:46:26 2009 (r191608) @@ -98,7 +98,6 @@ static void bstp_decode_bpdu(struct bstp struct bstp_config_unit *); static void bstp_send_bpdu(struct bstp_state *, struct bstp_port *, struct bstp_cbpdu *); -static void bstp_enqueue(struct ifnet *, struct mbuf *); static int bstp_pdu_flags(struct bstp_port *); static void bstp_received_stp(struct bstp_state *, struct bstp_port *, struct mbuf **, struct bstp_tbpdu *); @@ -262,7 +261,7 @@ bstp_transmit_tcn(struct bstp_state *bs, memcpy(mtod(m, caddr_t) + sizeof(*eh), &bpdu, sizeof(bpdu)); bp->bp_txcount++; - bstp_enqueue(ifp, m); + ifp->if_transmit(ifp, m); } static void @@ -391,18 +390,7 @@ bstp_send_bpdu(struct bstp_state *bs, st m->m_len = m->m_pkthdr.len; bp->bp_txcount++; - bstp_enqueue(ifp, m); -} - -static void -bstp_enqueue(struct ifnet *dst_ifp, struct mbuf *m) -{ - int err = 0; - - IFQ_ENQUEUE(&dst_ifp->if_snd, m, err); - - if ((dst_ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) - (*dst_ifp->if_start)(dst_ifp); + ifp->if_transmit(ifp, m); } static int From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 22:53:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A6BE106566C; Mon, 27 Apr 2009 22:53:36 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 291638FC14; Mon, 27 Apr 2009 22:53:36 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RMraog029702; Mon, 27 Apr 2009 22:53:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RMrarq029701; Mon, 27 Apr 2009 22:53:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904272253.n3RMrarq029701@svn.freebsd.org> From: Kip Macy Date: Mon, 27 Apr 2009 22:53:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191609 - head/sys/dev/xl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:53:36 -0000 Author: kmacy Date: Mon Apr 27 22:53:35 2009 New Revision: 191609 URL: http://svn.freebsd.org/changeset/base/191609 Log: remove dead code with reference to IFQ_HANDOFF Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Mon Apr 27 22:46:26 2009 (r191608) +++ head/sys/dev/xl/if_xl.c Mon Apr 27 22:53:35 2009 (r191609) @@ -798,32 +798,6 @@ xl_setmulti_hash(struct xl_softc *sc) CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT); } -#ifdef notdef -static void -xl_testpacket(struct xl_softc *sc) -{ - struct mbuf *m; - struct ifnet *ifp = sc->xl_ifp; - - MGETHDR(m, M_DONTWAIT, MT_DATA); - - if (m == NULL) - return; - - bcopy(IF_LLADDR(sc->xl_ifp), - mtod(m, struct ether_header *)->ether_dhost, ETHER_ADDR_LEN); - bcopy(IF_LLADDR(sc->xl_ifp), - mtod(m, struct ether_header *)->ether_shost, ETHER_ADDR_LEN); - mtod(m, struct ether_header *)->ether_type = htons(3); - mtod(m, unsigned char *)[14] = 0; - mtod(m, unsigned char *)[15] = 0; - mtod(m, unsigned char *)[16] = 0xE3; - m->m_len = m->m_pkthdr.len = sizeof(struct ether_header) + 3; - IFQ_ENQUEUE(&ifp->if_snd, m); - xl_start(ifp); -} -#endif - static void xl_setcfg(struct xl_softc *sc) { From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 22:54:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1AD01065670; Mon, 27 Apr 2009 22:54:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95D8F8FC1A; Mon, 27 Apr 2009 22:54:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RMsUeT029755; Mon, 27 Apr 2009 22:54:30 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RMsUwf029754; Mon, 27 Apr 2009 22:54:30 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904272254.n3RMsUwf029754@svn.freebsd.org> From: Kip Macy Date: Mon, 27 Apr 2009 22:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191610 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:54:31 -0000 Author: kmacy Date: Mon Apr 27 22:54:30 2009 New Revision: 191610 URL: http://svn.freebsd.org/changeset/base/191610 Log: simplify by removing dead code Modified: head/sys/dev/cxgb/cxgb_multiq.c Modified: head/sys/dev/cxgb/cxgb_multiq.c ============================================================================== --- head/sys/dev/cxgb/cxgb_multiq.c Mon Apr 27 22:53:35 2009 (r191609) +++ head/sys/dev/cxgb/cxgb_multiq.c Mon Apr 27 22:54:30 2009 (r191610) @@ -135,29 +135,6 @@ cxgb_pcpu_enqueue_packet_(struct sge_qse return (err); } -int -cxgb_pcpu_enqueue_packet(struct ifnet *ifp, struct mbuf *m) -{ - struct port_info *pi = ifp->if_softc; - struct sge_qset *qs; - int err = 0, qidx; -#ifdef IFNET_MULTIQUEUE - int32_t calc_cookie; - - calc_cookie = m->m_pkthdr.flowid; - qidx = cxgb_pcpu_cookie_to_qidx(pi, calc_cookie); -#else - qidx = 0; -#endif - qs = &pi->adapter->sge.qs[qidx]; - if (ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_ENQUEUE(qs->txq[0].txq_ifq, m, err); - } else { - err = cxgb_pcpu_enqueue_packet_(qs, m); - } - return (err); -} - static int cxgb_dequeue_packet(struct sge_txq *txq, struct mbuf **m_vec) { @@ -166,20 +143,7 @@ cxgb_dequeue_packet(struct sge_txq *txq, int count, size, coalesced; struct adapter *sc; -#ifndef IFNET_MULTIQUEUE - struct port_info *pi = txq->port; - - mtx_assert(&txq->lock, MA_OWNED); - if (txq->immpkt != NULL) - panic("immediate packet set"); - - IFQ_DRV_DEQUEUE(&pi->ifp->if_snd, m); - if (m == NULL) - return (0); - - m_vec[0] = m; - return (1); -#endif +#ifdef ALTQ if (ALTQ_IS_ENABLED(txq->txq_ifq)) { IFQ_DRV_DEQUEUE(txq->txq_ifq, m); if (m == NULL) @@ -188,7 +152,7 @@ cxgb_dequeue_packet(struct sge_txq *txq, m_vec[0] = m; return (1); } - +#endif mtx_assert(&txq->lock, MA_OWNED); coalesced = count = size = 0; qs = txq_to_qset(txq, TXQ_ETH); @@ -332,20 +296,14 @@ cxgb_pcpu_start_(struct sge_qset *qs, st } stopped = isset(&qs->txq_stopped, TXQ_ETH); - flush = (( -#ifdef IFNET_MULTIQUEUE - !buf_ring_empty(txq->txq_mr) -#else - !IFQ_DRV_IS_EMPTY(&pi->ifp->if_snd) -#endif + flush = ((drbr_empty(pi->ifp, txq->txq_mr) && !stopped) || txq->immpkt); max_desc = tx_flush ? TX_ETH_Q_SIZE : TX_START_MAX_DESC; err = flush ? cxgb_tx(qs, max_desc) : 0; if ((tx_flush && flush && err == 0) && - (!buf_ring_empty(txq->txq_mr) || - !IFQ_DRV_IS_EMPTY(&pi->ifp->if_snd))) { + !drbr_empty(pi->ifp, txq->txq_mr)) { struct thread *td = curthread; if (++i > 1) { @@ -408,9 +366,6 @@ cxgb_start(struct ifnet *ifp) if (!p->link_config.link_ok) return; - if (IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - return; - cxgb_pcpu_transmit(ifp, NULL); } From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 22:55:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 152D7106567F; Mon, 27 Apr 2009 22:55:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 035928FC08; Mon, 27 Apr 2009 22:55:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RMtmIR029836; Mon, 27 Apr 2009 22:55:48 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RMtmA1029834; Mon, 27 Apr 2009 22:55:48 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904272255.n3RMtmA1029834@svn.freebsd.org> From: Kip Macy Date: Mon, 27 Apr 2009 22:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191611 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:55:49 -0000 Author: kmacy Date: Mon Apr 27 22:55:48 2009 New Revision: 191611 URL: http://svn.freebsd.org/changeset/base/191611 Log: collapse the two em_start_locked routines in to one Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Apr 27 22:54:30 2009 (r191610) +++ head/sys/dev/e1000/if_em.c Mon Apr 27 22:55:48 2009 (r191611) @@ -898,9 +898,7 @@ em_detach(device_t dev) bus_generic_detach(dev); if_free(ifp); -#ifdef IFNET_BUF_RING drbr_free(adapter->br, M_DEVBUF); -#endif em_free_transmit_structures(adapter); em_free_receive_structures(adapter); @@ -1061,6 +1059,7 @@ em_qflush(struct ifnet *ifp) if_qflush(ifp); EM_TX_UNLOCK(adapter); } +#endif static void em_start_locked(struct ifnet *ifp) @@ -1079,7 +1078,7 @@ em_start_locked(struct ifnet *ifp) while ((adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD) && (!ADAPTER_RING_EMPTY(adapter))) { - m_head = drbr_dequeue(ifp, adapter->br); + m_head = em_dequeue(ifp, adapter->br); if (m_head == NULL) break; /* @@ -1089,8 +1088,10 @@ em_start_locked(struct ifnet *ifp) if (em_xmit(adapter, &m_head)) { if (m_head == NULL) break; +#ifndef IFNET_BUFRING ifp->if_drv_flags |= IFF_DRV_OACTIVE; IFQ_DRV_PREPEND(&ifp->if_snd, m_head); +#endif break; } @@ -1104,47 +1105,6 @@ em_start_locked(struct ifnet *ifp) ifp->if_drv_flags |= IFF_DRV_OACTIVE; } -#else -static void -em_start_locked(struct ifnet *ifp) -{ - struct adapter *adapter = ifp->if_softc; - struct mbuf *m_head; - - EM_TX_LOCK_ASSERT(adapter); - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) - return; - if (!adapter->link_active) - return; - - while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - - IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); - if (m_head == NULL) - break; - /* - * Encapsulation can modify our pointer, and or make it - * NULL on failure. In that event, we can't requeue. - */ - if (em_xmit(adapter, &m_head)) { - if (m_head == NULL) - break; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - IFQ_DRV_PREPEND(&ifp->if_snd, m_head); - break; - } - - /* Send a copy of the frame to the BPF listener */ - ETHER_BPF_MTAP(ifp, m_head); - - /* Set timeout in case hardware has problems transmitting. */ - adapter->watchdog_timer = EM_TX_TIMEOUT; - } -} - -#endif static void em_start(struct ifnet *ifp) @@ -1969,12 +1929,8 @@ em_handle_tx(void *context, int pending) struct ifnet *ifp = adapter->ifp; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { -#ifdef IFNET_BUF_RING if (!EM_TX_TRYLOCK(adapter)) return; -#else - EM_TX_LOCK(adapter); -#endif em_txeof(adapter); if (!ADAPTER_RING_EMPTY(adapter)) Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Mon Apr 27 22:54:30 2009 (r191610) +++ head/sys/dev/e1000/if_em.h Mon Apr 27 22:55:48 2009 (r191611) @@ -304,6 +304,8 @@ struct adapter { struct ifnet *ifp; #ifdef IFNET_BUF_RING struct buf_ring *br; +#else + void *br; #endif struct e1000_hw hw; @@ -496,7 +498,25 @@ typedef struct _DESCRIPTOR_PAIR #ifdef IFNET_BUF_RING #define ADAPTER_RING_EMPTY(adapter) drbr_empty((adapter)->ifp, (adapter)->br) +#define em_dequeue drbr_dequeue + #else #define ADAPTER_RING_EMPTY(adapter) IFQ_DRV_IS_EMPTY(&((adapter)->ifp->if_snd)) +#define drbr_free(br, type) +static __inline struct mbuf * +em_dequeue(struct ifnet *ifp, struct buf_ring *br) +{ + struct mbuf *m; + + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + return (m); +} +#ifdef BUF_RING_UNDEFINED + +struct buf_ring { +}; + #endif +#endif + #endif /* _EM_H_DEFINED_ */ From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 23:37:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DAE8106566B; Mon, 27 Apr 2009 23:37:51 +0000 (UTC) (envelope-from richard@tector.org.uk) Received: from mx0.thekeelecentre.com (mx0.thekeelecentre.com [IPv6:2001:470:1f09:16f:2::3]) by mx1.freebsd.org (Postfix) with ESMTP id 72F038FC14; Mon, 27 Apr 2009 23:37:49 +0000 (UTC) (envelope-from richard@tector.org.uk) Received: from localhost (filter.mx0.thekeelecentre.com [217.206.238.165]) by mx0.thekeelecentre.com (Postfix) with ESMTP id E21D8452F3; Tue, 28 Apr 2009 00:37:47 +0100 (BST) X-Virus-Scanned: amavisd-new at thekeelecentre.com Received: from mx0.thekeelecentre.com ([217.206.238.167]) by localhost (filter.mx0.thekeelecentre.com [217.206.238.165]) (amavisd-new, port 10024) with ESMTP id ZnTV7jBCcnNe; Mon, 27 Apr 2009 23:37:47 +0000 (UTC) Received: from [10.0.2.11] (daffy.tector.org.uk [82.71.32.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx0.thekeelecentre.com (Postfix) with ESMTPSA id 13246452E3; Tue, 28 Apr 2009 00:37:46 +0100 (BST) Message-ID: <49F641C2.7090802@tector.org.uk> Date: Tue, 28 Apr 2009 00:37:38 +0100 From: Richard Tector User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Kip Macy References: <200904272255.n3RMtmA1029834@svn.freebsd.org> In-Reply-To: <200904272255.n3RMtmA1029834@svn.freebsd.org> Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms000804030603070305060801" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191611 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 23:37:51 -0000 This is a cryptographically signed message in MIME format. --------------ms000804030603070305060801 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Kip Macy wrote: > Modified: > head/sys/dev/e1000/if_em.c > head/sys/dev/e1000/if_em.h > > Modified: head/sys/dev/e1000/if_em.c > ============================================================================== > @@ -1089,8 +1088,10 @@ em_start_locked(struct ifnet *ifp) > if (em_xmit(adapter, &m_head)) { > if (m_head == NULL) > break; > +#ifndef IFNET_BUFRING Should that be IFNET_BUF_RING? Richard --------------ms000804030603070305060801 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIHMDCC A5QwggL9oAMCAQICAQYwDQYJKoZIhvcNAQEEBQAwgYExCzAJBgNVBAYTAlVLMRYwFAYDVQQI Ew1TdGFmZm9yZHNoaXJlMQ4wDAYDVQQHEwVLZWVsZTEZMBcGA1UEChMQVGhlIEtlZWxlIENl bnRyZTEvMC0GA1UEAxMmVGhlIEtlZWxlIENlbnRyZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkw HhcNMDYwOTI5MTQxNzE1WhcNMTAwOTI5MTQxNzE1WjCBhDELMAkGA1UEBhMCVUsxFjAUBgNV BAgTDVN0YWZmb3Jkc2hpcmUxEjAQBgNVBAcTCU5ld2Nhc3RsZTEKMAgGA1UEChMBIDEXMBUG A1UEAxMOUmljaGFyZCBUZWN0b3IxJDAiBgkqhkiG9w0BCQEWFXJpY2hhcmRAdGVjdG9yLm9y Zy51azCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAqadxU4apjUusNPQIUTvEbH0DMoYD 0S1e8A/06cibkDaJfz7iLWqMTXhYbkq3FM7Ujjxx2Jw0JHUKo2uhrqjR0SjFhTzW1KvmhPCO MAfYht/NYjWCZzGcR3YdfNiWwBsWgCNxK3MonO8avT5CXT/NweMtZrDHhX2VquxD8v3/TlMC AwEAAaOCARUwggERMAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJh dGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRzml/pUyA2Fw1CX1b2sikniz6NhzCBtgYDVR0j BIGuMIGrgBSNCaM0QC1N5Hiyb/MPAVd/ouQEEqGBh6SBhDCBgTELMAkGA1UEBhMCVUsxFjAU BgNVBAgTDVN0YWZmb3Jkc2hpcmUxDjAMBgNVBAcTBUtlZWxlMRkwFwYDVQQKExBUaGUgS2Vl bGUgQ2VudHJlMS8wLQYDVQQDEyZUaGUgS2VlbGUgQ2VudHJlIENlcnRpZmljYXRlIEF1dGhv cml0eYIJAJZYbH4e6XXnMA0GCSqGSIb3DQEBBAUAA4GBAHObxzoGANKR90eLQMS6q/yfcJMu pHLoZT/UajG8cFdxzGxXNhuQhmYAfzUOqaJL/fMBznnNoRC7IHS+iCWCI2v2Rp9cDkoFw0m1 lvp5boNpYMPGPGNfemedVGzY4vDxI4o6bBCut47KGr3+wNA/+oHtHmCBQ6WdP/WEDjsSnmeM MIIDlDCCAv2gAwIBAgIBBjANBgkqhkiG9w0BAQQFADCBgTELMAkGA1UEBhMCVUsxFjAUBgNV BAgTDVN0YWZmb3Jkc2hpcmUxDjAMBgNVBAcTBUtlZWxlMRkwFwYDVQQKExBUaGUgS2VlbGUg Q2VudHJlMS8wLQYDVQQDEyZUaGUgS2VlbGUgQ2VudHJlIENlcnRpZmljYXRlIEF1dGhvcml0 eTAeFw0wNjA5MjkxNDE3MTVaFw0xMDA5MjkxNDE3MTVaMIGEMQswCQYDVQQGEwJVSzEWMBQG A1UECBMNU3RhZmZvcmRzaGlyZTESMBAGA1UEBxMJTmV3Y2FzdGxlMQowCAYDVQQKEwEgMRcw FQYDVQQDEw5SaWNoYXJkIFRlY3RvcjEkMCIGCSqGSIb3DQEJARYVcmljaGFyZEB0ZWN0b3Iu b3JnLnVrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpp3FThqmNS6w09AhRO8RsfQMy hgPRLV7wD/TpyJuQNol/PuItaoxNeFhuSrcUztSOPHHYnDQkdQqja6GuqNHRKMWFPNbUq+aE 8I4wB9iG381iNYJnMZxHdh182JbAGxaAI3Ercyic7xq9PkJdP83B4y1msMeFfZWq7EPy/f9O UwIDAQABo4IBFTCCAREwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5l cmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFHOaX+lTIDYXDUJfVvayKSeLPo2HMIG2BgNV HSMEga4wgauAFI0JozRALU3keLJv8w8BV3+i5AQSoYGHpIGEMIGBMQswCQYDVQQGEwJVSzEW MBQGA1UECBMNU3RhZmZvcmRzaGlyZTEOMAwGA1UEBxMFS2VlbGUxGTAXBgNVBAoTEFRoZSBL ZWVsZSBDZW50cmUxLzAtBgNVBAMTJlRoZSBLZWVsZSBDZW50cmUgQ2VydGlmaWNhdGUgQXV0 aG9yaXR5ggkAllhsfh7pdecwDQYJKoZIhvcNAQEEBQADgYEAc5vHOgYA0pH3R4tAxLqr/J9w ky6kcuhlP9RqMbxwV3HMbFc2G5CGZgB/NQ6pokv98wHOec2hELsgdL6IJYIja/ZGn1wOSgXD SbWW+nlug2lgw8Y8Y196Z51UbNji8PEjijpsEK63jsoavf7A0D/6ge0eYIFDpZ0/9YQOOxKe Z4wxggMbMIIDFwIBATCBhzCBgTELMAkGA1UEBhMCVUsxFjAUBgNVBAgTDVN0YWZmb3Jkc2hp cmUxDjAMBgNVBAcTBUtlZWxlMRkwFwYDVQQKExBUaGUgS2VlbGUgQ2VudHJlMS8wLQYDVQQD EyZUaGUgS2VlbGUgQ2VudHJlIENlcnRpZmljYXRlIEF1dGhvcml0eQIBBjAJBgUrDgMCGgUA oIIB6TAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wOTA0Mjcy MzM3MzhaMCMGCSqGSIb3DQEJBDEWBBQr8wH6fiCNB6alYpxTzw560lBM5TBSBgkqhkiG9w0B CQ8xRTBDMAoGCCqGSIb3DQMHMA4GCCqGSIb3DQMCAgIAgDANBggqhkiG9w0DAgIBQDAHBgUr DgMCBzANBggqhkiG9w0DAgIBKDCBmAYJKwYBBAGCNxAEMYGKMIGHMIGBMQswCQYDVQQGEwJV SzEWMBQGA1UECBMNU3RhZmZvcmRzaGlyZTEOMAwGA1UEBxMFS2VlbGUxGTAXBgNVBAoTEFRo ZSBLZWVsZSBDZW50cmUxLzAtBgNVBAMTJlRoZSBLZWVsZSBDZW50cmUgQ2VydGlmaWNhdGUg QXV0aG9yaXR5AgEGMIGaBgsqhkiG9w0BCRACCzGBiqCBhzCBgTELMAkGA1UEBhMCVUsxFjAU BgNVBAgTDVN0YWZmb3Jkc2hpcmUxDjAMBgNVBAcTBUtlZWxlMRkwFwYDVQQKExBUaGUgS2Vl bGUgQ2VudHJlMS8wLQYDVQQDEyZUaGUgS2VlbGUgQ2VudHJlIENlcnRpZmljYXRlIEF1dGhv cml0eQIBBjANBgkqhkiG9w0BAQEFAASBgJ56anf8HMIIMrxYpYvpEqBBA8cZl6eDiy7iJeSx gc44/108WMz8li/vACvETtT/6YweBN5pm2cNaRccl9Pnu0o8L/TArZJdBBtQx62gKSVvCy0Y tmhi6zjicaEATlBQ4CCdmiQHcxDud3JzYLs3xmykndlzqrhdj+MmOzBzll1pAAAAAAAA --------------ms000804030603070305060801-- From owner-svn-src-head@FreeBSD.ORG Mon Apr 27 23:43:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 065BB106566B; Mon, 27 Apr 2009 23:43:29 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E974C8FC19; Mon, 27 Apr 2009 23:43:28 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RNhSgY030686; Mon, 27 Apr 2009 23:43:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RNhSmI030685; Mon, 27 Apr 2009 23:43:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904272343.n3RNhSmI030685@svn.freebsd.org> From: Kip Macy Date: Mon, 27 Apr 2009 23:43:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191612 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 23:43:29 -0000 Author: kmacy Date: Mon Apr 27 23:43:28 2009 New Revision: 191612 URL: http://svn.freebsd.org/changeset/base/191612 Log: fix typo in conditional Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Apr 27 22:55:48 2009 (r191611) +++ head/sys/dev/e1000/if_em.c Mon Apr 27 23:43:28 2009 (r191612) @@ -1088,7 +1088,7 @@ em_start_locked(struct ifnet *ifp) if (em_xmit(adapter, &m_head)) { if (m_head == NULL) break; -#ifndef IFNET_BUFRING +#ifndef IFNET_BUF_RING ifp->if_drv_flags |= IFF_DRV_OACTIVE; IFQ_DRV_PREPEND(&ifp->if_snd, m_head); #endif From owner-svn-src-head@FreeBSD.ORG Tue Apr 28 08:20:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F3731065670; Tue, 28 Apr 2009 08:20:32 +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 531FF8FC18; Tue, 28 Apr 2009 08:20:32 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3S8KW1e042690; Tue, 28 Apr 2009 08:20:32 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3S8KWEk042689; Tue, 28 Apr 2009 08:20:32 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200904280820.n3S8KWEk042689@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 28 Apr 2009 08:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191618 - head/share/zoneinfo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2009 08:20:32 -0000 Author: edwin Date: Tue Apr 28 08:20:32 2009 New Revision: 191618 URL: http://svn.freebsd.org/changeset/base/191618 Log: MFC of tzdata2009g: Egypt will have DST till the end of September the coming years. Modified: head/share/zoneinfo/ (props changed) head/share/zoneinfo/africa Modified: head/share/zoneinfo/africa ============================================================================== --- head/share/zoneinfo/africa Tue Apr 28 08:11:42 2009 (r191617) +++ head/share/zoneinfo/africa Tue Apr 28 08:20:32 2009 (r191618) @@ -1,4 +1,4 @@ -# @(#)africa 8.18 +# @(#)africa 8.19 #
 
 # This data is by no means authoritative; if you think you know better,
@@ -236,7 +236,46 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # unless discontinued, next DST may end Thursday 28 August 2008.
 # From Paul Eggert (2007-08-17):
 # For lack of better info, assume the new rule is last Thursday in August.
-Rule	Egypt	2008	max	-	Aug	lastThu	23:00s	0	-
+
+# From Petr Machata (2009-04-06):
+# The following appeared in Red Hat bugzilla[1] (edited):
+#
+# > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 21:59:59 2009 UTC =3D Thu =
+# Apr 23
+# > 23:59:59 2009 EET isdst=3D0 gmtoff=3D7200
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 22:00:00 2009 UTC =3D Fri =
+# Apr 24
+# > 01:00:00 2009 EEST isdst=3D1 gmtoff=3D10800
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 20:59:59 2009 UTC =3D Thu =
+# Aug 27
+# > 23:59:59 2009 EEST isdst=3D1 gmtoff=3D10800
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 21:00:00 2009 UTC =3D Thu =
+# Aug 27
+# > 23:00:00 2009 EET isdst=3D0 gmtoff=3D7200
+#
+# > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
+# :59)
+# > http://support.microsoft.com/kb/958729/
+#
+# timeanddate[2] and another site I've found[3] also support that.
+#
+# [1] 
+# https://bugzilla.redhat.com/show_bug.cgi?id=3D492263
+# 
+# [2] 
+# http://www.timeanddate.com/worldclock/clockchange.html?n=3D53
+# 
+# [3] 
+# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
+# 
+
+# From Arthur David Olson (2009-04-20):
+# In 2009 (and for the next several years), Ramadan ends before the fourth
+# Thursday in September; Egypt is expected to revert to the last Thursday
+# in September.
+Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
+Rule	Egypt	2009	max	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 09:45:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 883FE106566C;
	Tue, 28 Apr 2009 09:45:32 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 756088FC13;
	Tue, 28 Apr 2009 09:45:32 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3S9jWbh044361;
	Tue, 28 Apr 2009 09:45:32 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3S9jW4V044359;
	Tue, 28 Apr 2009 09:45:32 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200904280945.n3S9jW4V044359@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Tue, 28 Apr 2009 09:45:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191620 - in head: etc/rc.d share/man/man5
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 09:45:32 -0000

Author: ru
Date: Tue Apr 28 09:45:32 2009
New Revision: 191620
URL: http://svn.freebsd.org/changeset/base/191620

Log:
  Added (pre|post)(start|stop) jail hooks.  These can be used to run
  arbitrary commands (outside the jail) associated with said events,
  e.g. to bring up/down CARP interfaces representing services run in
  jails.
  
  Reviewed by:	simon

Modified:
  head/etc/rc.d/jail
  head/share/man/man5/rc.conf.5

Modified: head/etc/rc.d/jail
==============================================================================
--- head/etc/rc.d/jail	Tue Apr 28 08:24:15 2009	(r191619)
+++ head/etc/rc.d/jail	Tue Apr 28 09:45:32 2009	(r191620)
@@ -41,6 +41,14 @@ init_variables()
 	eval _ip=\"\$jail_${_j}_ip\"
 	eval _interface=\"\${jail_${_j}_interface:-${jail_interface}}\"
 	eval _exec=\"\$jail_${_j}_exec\"
+
+	i=0
+	while : ; do
+		eval _exec_prestart${i}=\"\${jail_${_j}_exec_prestart${i}:-\${jail_exec_prestart${i}}}\"
+		[ -z "$(eval echo \"\$_exec_prestart${i}\")" ] && break
+		i=$((i + 1))
+	done
+
 	eval _exec_start=\"\${jail_${_j}_exec_start:-${jail_exec_start}}\"
 
 	i=1
@@ -49,8 +57,30 @@ init_variables()
 		[ -z "$(eval echo \"\$_exec_afterstart${i}\")" ] &&  break
 		i=$((i + 1))
 	done
-	
+
+	i=0
+	while : ; do
+		eval _exec_poststart${i}=\"\${jail_${_j}_exec_poststart${i}:-\${jail_exec_poststart${i}}}\"
+		[ -z "$(eval echo \"\$_exec_poststart${i}\")" ] && break
+		i=$((i + 1))
+	done
+
+	i=0
+	while : ; do
+		eval _exec_prestop${i}=\"\${jail_${_j}_exec_prestop${i}:-\${jail_exec_prestop${i}}}\"
+		[ -z "$(eval echo \"\$_exec_prestop${i}\")" ] && break
+		i=$((i + 1))
+	done
+
 	eval _exec_stop=\"\${jail_${_j}_exec_stop:-${jail_exec_stop}}\"
+
+	i=0
+	while : ; do
+		eval _exec_poststop${i}=\"\${jail_${_j}_exec_poststop${i}:-\${jail_exec_poststop${i}}}\"
+		[ -z "$(eval echo \"\$_exec_poststop${i}\")" ] && break
+		i=$((i + 1))
+	done
+
 	if [ -n "${_exec}" ]; then
 		#   simple/backward-compatible execution
 		_exec_start="${_exec}"
@@ -102,9 +132,20 @@ init_variables()
 	debug "$_j procdir: $_procdir"
 	debug "$_j ruleset: $_ruleset"
 	debug "$_j fstab: $_fstab"
-	debug "$_j exec start: $_exec_start"
 	debug "$_j consolelog: $_consolelog"
 
+	i=0
+	while : ; do
+		eval out=\"\${_exec_prestart${i}:-''}\"
+		if [ -z "$out" ]; then
+			break
+		fi
+		debug "$_j exec pre-start #${i}: ${out}"
+		i=$((i + 1))
+	done
+
+	debug "$_j exec start: $_exec_start"
+
 	i=1
 	while [ true ]; do
 		eval out=\"\${_exec_afterstart${i}:-''}\"
@@ -117,7 +158,38 @@ init_variables()
 		i=$((i + 1))
 	done
 
+	i=0
+	while : ; do
+		eval out=\"\${_exec_poststart${i}:-''}\"
+		if [ -z "$out" ]; then
+			break
+		fi
+		debug "$_j exec post-start #${i}: ${out}"
+		i=$((i + 1))
+	done
+
+	i=0
+	while : ; do
+		eval out=\"\${_exec_prestop${i}:-''}\"
+		if [ -z "$out" ]; then
+			break
+		fi
+		debug "$_j exec pre-stop #${i}: ${out}"
+		i=$((i + 1))
+	done
+
 	debug "$_j exec stop: $_exec_stop"
+
+	i=0
+	while : ; do
+		eval out=\"\${_exec_poststop${i}:-''}\"
+		if [ -z "$out" ]; then
+			break
+		fi
+		debug "$_j exec post-stop #${i}: ${out}"
+		i=$((i + 1))
+	done
+
 	debug "$_j flags: $_flags"
 	debug "$_j consolelog: $_consolelog"
 
@@ -555,6 +627,15 @@ jail_start()
 			fi
 		fi
 		_tmp_jail=${_tmp_dir}/jail.$$
+
+		i=0
+		while : ; do
+			eval out=\"\${_exec_prestart${i}:-''}\"
+			[ -z "$out" ] && break
+			${out}
+			i=$((i + 1))
+		done
+
 		eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
 			\"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1
 
@@ -575,6 +656,14 @@ jail_start()
 			echo -n " $_hostname"
 			tail +2 ${_tmp_jail} >${_consolelog}
 			echo ${_jail_id} > /var/run/jail_${_jail}.id
+
+			i=0
+			while : ; do
+				eval out=\"\${_exec_poststart${i}:-''}\"
+				[ -z "$out" ] && break
+				${out}
+				i=$((i + 1))
+			done
 		else
 			jail_umount_fs
 			jail_ips "del"
@@ -596,6 +685,15 @@ jail_stop()
 			_jail_id=$(cat /var/run/jail_${_jail}.id)
 			if [ ! -z "${_jail_id}" ]; then
 				init_variables $_jail
+
+				i=0
+				while : ; do
+					eval out=\"\${_exec_prestop${i}:-''}\"
+					[ -z "$out" ] && break
+					${out}
+					i=$((i + 1))
+				done
+
 				if [ -n "${_exec_stop}" ]; then
 					eval env -i /usr/sbin/jexec ${_jail_id} ${_exec_stop} \
 						>> ${_consolelog} 2>&1
@@ -605,6 +703,14 @@ jail_stop()
 				killall -j ${_jail_id} -KILL > /dev/null 2>&1
 				jail_umount_fs
 				echo -n " $_hostname"
+
+				i=0
+				while : ; do
+					eval out=\"\${_exec_poststop${i}:-''}\"
+					[ -z "$out" ] && break
+					${out}
+					i=$((i + 1))
+				done
 			fi
 			jail_ips "del"
 			rm /var/run/jail_${_jail}.id

Modified: head/share/man/man5/rc.conf.5
==============================================================================
--- head/share/man/man5/rc.conf.5	Tue Apr 28 08:24:15 2009	(r191619)
+++ head/share/man/man5/rc.conf.5	Tue Apr 28 09:45:32 2009	(r191620)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 27, 2009
+.Dd April 10, 2009
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -3402,6 +3402,13 @@ to
 .Dq Li YES
 by default for every jail in
 .Va jail_list .
+.It Va jail_exec_prestart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestart Ns Aq Ar N
+for every jail in
+.Va jail_list .
 .It Va jail_exec_start
 .Pq Vt str
 Unset by default.
@@ -3416,12 +3423,33 @@ When set, use as default value for
 .Va jail_ Ns Ao Ar jname Ac Ns Va _exec_afterstart Ns Aq Ar N
 for every jail in
 .Va jail_list .
+.It Va jail_exec_poststart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststart Ns Aq Ar N
+for every jail in
+.Va jail_list .
+.It Va jail_exec_prestop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestop Ns Aq Ar N
+for every jail in
+.Va jail_list .
 .It Va jail_exec_stop
 Unset by default.
 When set, use as default value for
 .Va jail_ Ns Ao Ar jname Ac Ns Va _exec_stop
 for every jail in
 .Va jail_list .
+.It Va jail_exec_poststop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststop Ns Aq Ar N
+for every jail in
+.Va jail_list .
 .It Va jail_ Ns Ao Ar jname Ac Ns Va _rootdir
 .Pq Vt str
 Unset by default.
@@ -3537,27 +3565,68 @@ When set to
 mount the process file system inside jail
 .Ar jname
 at jail startup.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+before jail startup, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
 .It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_start
 .Pq Vt str
 Set to
 .Dq Li /bin/sh /etc/rc
 by default.
-This is the command executed at jail startup.
+This is the command executed in a jail at jail startup.
 .It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_afterstart Ns Aq Ar N
 .Pq Vt str
 Unset by default.
 This is the command run as
 .Ar N Ns
 th command
+in a jail
 after jail startup, where
 .Ar N
 is 1, 2, and so on.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+after jail startup, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+before jail shutdown, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
 .It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_stop
 .Pq Vt str
 Set to
 .Dq Li /bin/sh /etc/rc.shutdown
 by default.
-This is the command executed at jail shutdown.
+This is the command executed in a jail at jail shutdown.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+after jail shutdown, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
 .It Va jail_set_hostname_allow
 .Pq Vt bool
 If set to

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 11:10:33 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BEB8F106564A;
	Tue, 28 Apr 2009 11:10: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 925478FC21;
	Tue, 28 Apr 2009 11:10:33 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3SBAXYb047845;
	Tue, 28 Apr 2009 11:10:33 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3SBAXIb047843;
	Tue, 28 Apr 2009 11:10:33 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200904281110.n3SBAXIb047843@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Tue, 28 Apr 2009 11:10:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191621 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 11:10:34 -0000

Author: trasz
Date: Tue Apr 28 11:10:33 2009
New Revision: 191621
URL: http://svn.freebsd.org/changeset/base/191621

Log:
  Don't require packet to match a route (any route; this information wasn't
  used anyway, so a typical workaround was to add a dummy route) if it's going
  to be sent through IPSec tunnel.
  
  Reviewed by:	bz

Modified:
  head/sys/netinet/ip_ipsec.c
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_ipsec.c
==============================================================================
--- head/sys/netinet/ip_ipsec.c	Tue Apr 28 09:45:32 2009	(r191620)
+++ head/sys/netinet/ip_ipsec.c	Tue Apr 28 11:10:33 2009	(r191621)
@@ -385,7 +385,8 @@ ip_ipsec_output(struct mbuf **m, struct 
 		 * the interface supports it.
 		 */ 
 		mtag = m_tag_find(*m, PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED, NULL);
-		if (mtag != NULL && ((*ifp)->if_capenable & IFCAP_IPSEC) == 0) {
+		if (mtag != NULL && ifp != NULL &&
+		    ((*ifp)->if_capenable & IFCAP_IPSEC) == 0) {
 			/* notify IPsec to do its own crypto */
 			ipsp_skipcrypto_unmark((struct tdb_ident *)(mtag + 1));
 			*error = EHOSTUNREACH;

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c	Tue Apr 28 09:45:32 2009	(r191620)
+++ head/sys/netinet/ip_output.c	Tue Apr 28 11:10:33 2009	(r191621)
@@ -145,6 +145,9 @@ ip_output(struct mbuf *m, struct mbuf *o
 #ifdef IPFIREWALL_FORWARD
 	struct m_tag *fwd_tag = NULL;
 #endif
+#ifdef IPSEC
+	int no_route_but_check_spd = 0;
+#endif
 	M_ASSERTPKTHDR(m);
 
 	if (ro == NULL) {
@@ -272,6 +275,15 @@ again:
 			    inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m));
 #endif
 		if (ro->ro_rt == NULL) {
+#ifdef IPSEC
+			/*
+			 * There is no route for this packet, but it is
+			 * possible that a matching SPD entry exists.
+			 */
+			no_route_but_check_spd = 1;
+			mtu = 0; /* Silence GCC warning. */
+			goto sendit;
+#endif
 			IPSTAT_INC(ips_noroute);
 			error = EHOSTUNREACH;
 			goto bad;
@@ -467,6 +479,14 @@ sendit:
 	default:
 		break;	/* Continue with packet processing. */
 	}
+	/*
+	 * Check if there was a route for this packet; return error if not.
+	 */
+	if (no_route_but_check_spd) {
+		IPSTAT_INC(ips_noroute);
+		error = EHOSTUNREACH;
+		goto bad;
+	}
 	/* Update variables that are affected by ipsec4_output(). */
 	ip = mtod(m, struct ip *);
 	hlen = ip->ip_hl << 2;

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 11:43:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 17612106567D;
	Tue, 28 Apr 2009 11:43:36 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 05AF68FC2E;
	Tue, 28 Apr 2009 11:43:36 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3SBhZjr048630;
	Tue, 28 Apr 2009 11:43:35 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3SBhZxS048629;
	Tue, 28 Apr 2009 11:43:35 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200904281143.n3SBhZxS048629@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 28 Apr 2009 11:43:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191625 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 11:43:36 -0000

Author: kib
Date: Tue Apr 28 11:43:35 2009
New Revision: 191625
URL: http://svn.freebsd.org/changeset/base/191625

Log:
  Fix typo.

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==============================================================================
--- head/sys/vm/swap_pager.c	Tue Apr 28 11:36:12 2009	(r191624)
+++ head/sys/vm/swap_pager.c	Tue Apr 28 11:43:35 2009	(r191625)
@@ -2255,12 +2255,12 @@ SYSCTL_NODE(_vm, OID_AUTO, swap_info, CT
     "Swap statistics by device");
 
 /*
- * vmspace_swap_count() - count the approximate swap useage in pages for a
+ * vmspace_swap_count() - count the approximate swap usage in pages for a
  *			  vmspace.
  *
  *	The map must be locked.
  *
- *	Swap useage is determined by taking the proportional swap used by
+ *	Swap usage is determined by taking the proportional swap used by
  *	VM objects backing the VM map.  To make up for fractional losses,
  *	if the VM object has any swap use at all the associated map entries
  *	count for at least 1 swap page.

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 11:45:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 942E71065675;
	Tue, 28 Apr 2009 11:45:36 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 81E648FC12;
	Tue, 28 Apr 2009 11:45:36 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3SBjars048727;
	Tue, 28 Apr 2009 11:45:36 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3SBja4w048726;
	Tue, 28 Apr 2009 11:45:36 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200904281145.n3SBja4w048726@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 28 Apr 2009 11:45:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191626 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 11:45:37 -0000

Author: kib
Date: Tue Apr 28 11:45:36 2009
New Revision: 191626
URL: http://svn.freebsd.org/changeset/base/191626

Log:
  Use the acquired reference to the vmspace instead of direct dereferencing
  of p->p_vmspace in a place where it was missed in r191277.
  
  Noted by:  pluknet gmail com

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Tue Apr 28 11:43:35 2009	(r191625)
+++ head/sys/vm/vm_pageout.c	Tue Apr 28 11:45:36 2009	(r191626)
@@ -1243,7 +1243,7 @@ vm_pageout_oom(int shortage)
 			PROC_UNLOCK(p);
 			continue;
 		}
-		size = vmspace_swap_count(p->p_vmspace);
+		size = vmspace_swap_count(vm);
 		vm_map_unlock_read(&vm->vm_map);
 		if (shortage == VM_OOM_MEM)
 			size += vmspace_resident_count(vm);

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 11:56:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 61DEF106564A;
	Tue, 28 Apr 2009 11:56:56 +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 4FD728FC1C;
	Tue, 28 Apr 2009 11:56:56 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3SBusFV048950;
	Tue, 28 Apr 2009 11:56:54 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3SBusAb048949;
	Tue, 28 Apr 2009 11:56:54 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <200904281156.n3SBusAb048949@svn.freebsd.org>
From: Andriy Gapon 
Date: Tue, 28 Apr 2009 11:56:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191627 - head/sys/dev/acpica
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 11:56:56 -0000

Author: avg
Date: Tue Apr 28 11:56:54 2009
New Revision: 191627
URL: http://svn.freebsd.org/changeset/base/191627

Log:
  acpi: do not run resume/backout code when entering S0/S5 states
  
  This change adds (possibly redundant) early check for invalid
  state input parameter (including S0). Handling of S5 request
  is reduced to simply calling shutdown_nice(). As a result
  control flow of acpi_EnterSleepState is somewhat simplified
  and resume/backout half of the function is not executed
  for S5 (soft poweroff) request and invalid state requests.
  
  Note: it seems that shutdown_nice may act as nop when initproc
  is already initialized (to grab pid of 1), but init process is in
  "pre-natal" state.
  
  Tested by:	Fabian Keil 
  Reviewed by:	njl, jkim
  Approved by:	rpaulo

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

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Tue Apr 28 11:45:36 2009	(r191626)
+++ head/sys/dev/acpica/acpi.c	Tue Apr 28 11:56:54 2009	(r191627)
@@ -2482,6 +2482,18 @@ acpi_EnterSleepState(struct acpi_softc *
 
     ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state);
 
+    if (state < ACPI_STATE_S1 || state > ACPI_STATE_S5)
+	return_ACPI_STATUS (AE_BAD_PARAMETER);
+
+    if (state == ACPI_STATE_S5) {
+	/*
+	 * Shut down cleanly and power off.  This will call us back through the
+	 * shutdown handlers.
+	 */
+	shutdown_nice(RB_POWEROFF);
+	return_ACPI_STATUS (AE_OK);
+    }
+
     /* Re-entry once we're suspending is not allowed. */
     status = acpi_sleep_disable(sc);
     if (ACPI_FAILURE(status)) {
@@ -2502,92 +2514,74 @@ acpi_EnterSleepState(struct acpi_softc *
     mtx_lock(&Giant);
 
     slp_state = ACPI_SS_NONE;
-    switch (state) {
-    case ACPI_STATE_S1:
-    case ACPI_STATE_S2:
-    case ACPI_STATE_S3:
-    case ACPI_STATE_S4:
-	status = AcpiGetSleepTypeData(state, &TypeA, &TypeB);
-	if (status == AE_NOT_FOUND) {
-	    device_printf(sc->acpi_dev,
-			  "Sleep state S%d not supported by BIOS\n", state);
-	    break;
-	} else if (ACPI_FAILURE(status)) {
-	    device_printf(sc->acpi_dev, "AcpiGetSleepTypeData failed - %s\n",
-			  AcpiFormatException(status));
-	    break;
-	}
+    status = AcpiGetSleepTypeData(state, &TypeA, &TypeB);
+    if (status == AE_NOT_FOUND) {
+	device_printf(sc->acpi_dev,
+		      "Sleep state S%d not supported by BIOS\n", state);
+	goto backout;
+    } else if (ACPI_FAILURE(status)) {
+	device_printf(sc->acpi_dev, "AcpiGetSleepTypeData failed - %s\n",
+		      AcpiFormatException(status));
+	goto backout;
+    }
+
+    sc->acpi_sstate = state;
+
+    /* Enable any GPEs as appropriate and requested by the user. */
+    acpi_wake_prep_walk(state);
+    slp_state = ACPI_SS_GPE_SET;
 
-	sc->acpi_sstate = state;
+    /*
+     * Inform all devices that we are going to sleep.  If at least one
+     * device fails, DEVICE_SUSPEND() automatically resumes the tree.
+     *
+     * XXX Note that a better two-pass approach with a 'veto' pass
+     * followed by a "real thing" pass would be better, but the current
+     * bus interface does not provide for this.
+     */
+    if (DEVICE_SUSPEND(root_bus) != 0) {
+	device_printf(sc->acpi_dev, "device_suspend failed\n");
+	goto backout;
+    }
+    slp_state = ACPI_SS_DEV_SUSPEND;
 
-	/* Enable any GPEs as appropriate and requested by the user. */
-	acpi_wake_prep_walk(state);
-	slp_state = ACPI_SS_GPE_SET;
+    /* If testing device suspend only, back out of everything here. */
+    if (acpi_susp_bounce)
+	goto backout;
 
-	/*
-	 * Inform all devices that we are going to sleep.  If at least one
-	 * device fails, DEVICE_SUSPEND() automatically resumes the tree.
-	 *
-	 * XXX Note that a better two-pass approach with a 'veto' pass
-	 * followed by a "real thing" pass would be better, but the current
-	 * bus interface does not provide for this.
-	 */
-	if (DEVICE_SUSPEND(root_bus) != 0) {
-	    device_printf(sc->acpi_dev, "device_suspend failed\n");
-	    break;
-	}
-	slp_state = ACPI_SS_DEV_SUSPEND;
+    status = AcpiEnterSleepStatePrep(state);
+    if (ACPI_FAILURE(status)) {
+	device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n",
+		      AcpiFormatException(status));
+	goto backout;
+    }
+    slp_state = ACPI_SS_SLP_PREP;
 
-	/* If testing device suspend only, back out of everything here. */
-	if (acpi_susp_bounce)
-	    break;
+    if (sc->acpi_sleep_delay > 0)
+	DELAY(sc->acpi_sleep_delay * 1000000);
+
+    if (state != ACPI_STATE_S1) {
+	acpi_sleep_machdep(sc, state);
 
-	status = AcpiEnterSleepStatePrep(state);
+	/* Re-enable ACPI hardware on wakeup from sleep state 4. */
+	if (state == ACPI_STATE_S4)
+	    AcpiEnable();
+    } else {
+	ACPI_DISABLE_IRQS();
+	status = AcpiEnterSleepState(state);
 	if (ACPI_FAILURE(status)) {
-	    device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n",
+	    device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n",
 			  AcpiFormatException(status));
-	    break;
+	    goto backout;
 	}
-	slp_state = ACPI_SS_SLP_PREP;
-
-	if (sc->acpi_sleep_delay > 0)
-	    DELAY(sc->acpi_sleep_delay * 1000000);
-
-	if (state != ACPI_STATE_S1) {
-	    acpi_sleep_machdep(sc, state);
-
-	    /* Re-enable ACPI hardware on wakeup from sleep state 4. */
-	    if (state == ACPI_STATE_S4)
-		AcpiEnable();
-	} else {
-	    ACPI_DISABLE_IRQS();
-	    status = AcpiEnterSleepState(state);
-	    if (ACPI_FAILURE(status)) {
-		device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n",
-			      AcpiFormatException(status));
-		break;
-	    }
-	}
-	slp_state = ACPI_SS_SLEPT;
-	break;
-    case ACPI_STATE_S5:
-	/*
-	 * Shut down cleanly and power off.  This will call us back through the
-	 * shutdown handlers.
-	 */
-	shutdown_nice(RB_POWEROFF);
-	status = AE_OK;
-	break;
-    case ACPI_STATE_S0:
-    default:
-	status = AE_BAD_PARAMETER;
-	break;
     }
+    slp_state = ACPI_SS_SLEPT;
 
     /*
      * Back out state according to how far along we got in the suspend
      * process.  This handles both the error and success cases.
      */
+backout:
     sc->acpi_next_sstate = 0;
     if (slp_state >= ACPI_SS_GPE_SET) {
 	acpi_wake_prep_walk(state);
@@ -2609,8 +2603,7 @@ acpi_EnterSleepState(struct acpi_softc *
 #endif
 
     /* Allow another sleep request after a while. */
-    if (state != ACPI_STATE_S5)
-	timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME);
+    timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME);
 
     /* Run /etc/rc.resume after we are back. */
     if (devctl_process_running())

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 19:20:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C1ECF106564A;
	Tue, 28 Apr 2009 19:20:13 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B02E08FC1D;
	Tue, 28 Apr 2009 19:20:13 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3SJKDm0057703;
	Tue, 28 Apr 2009 19:20:13 GMT (envelope-from cognet@svn.freebsd.org)
Received: (from cognet@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3SJKDMZ057702;
	Tue, 28 Apr 2009 19:20:13 GMT (envelope-from cognet@svn.freebsd.org)
Message-Id: <200904281920.n3SJKDMZ057702@svn.freebsd.org>
From: Olivier Houchard 
Date: Tue, 28 Apr 2009 19:20:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191633 - head/lib/libc/arm/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 19:20:14 -0000

Author: cognet
Date: Tue Apr 28 19:20:13 2009
New Revision: 191633
URL: http://svn.freebsd.org/changeset/base/191633

Log:
  Change the test at the beginning of strncmp(), from being if (len - 1) < 0
  to if (len == 0).
  The length is supposed to be unsigned, so len - 1 < 0 won't happen except
  if len == 0 anyway, and it would return 0 when it shouldn't, if len was
  > INT_MAX.
  
  Spotted out by:	Channa 

Modified:
  head/lib/libc/arm/string/strncmp.S

Modified: head/lib/libc/arm/string/strncmp.S
==============================================================================
--- head/lib/libc/arm/string/strncmp.S	Tue Apr 28 17:41:52 2009	(r191632)
+++ head/lib/libc/arm/string/strncmp.S	Tue Apr 28 19:20:13 2009	(r191633)
@@ -33,10 +33,10 @@
 __FBSDID("$FreeBSD$");
 
 ENTRY(strncmp)
-/* if ((len - 1) < 0) return 0 */
-	subs	r2, r2, #1
-	movmi	r0, #0
-	movmi	pc, lr
+/* if (len == 0) return 0 */
+	cmp	r2, #0
+	moveq	r0, #0
+	RETeq
 
 /* ip == last src address to compare */
 	add	ip, r0, r2

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 20:20:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7BF50106566C;
	Tue, 28 Apr 2009 20:20:13 +0000 (UTC)
	(envelope-from danger@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6A65A8FC16;
	Tue, 28 Apr 2009 20:20:13 +0000 (UTC)
	(envelope-from danger@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3SKKDuC058808;
	Tue, 28 Apr 2009 20:20:13 GMT (envelope-from danger@svn.freebsd.org)
Received: (from danger@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3SKKDRo058807;
	Tue, 28 Apr 2009 20:20:13 GMT (envelope-from danger@svn.freebsd.org)
Message-Id: <200904282020.n3SKKDRo058807@svn.freebsd.org>
From: Daniel Gerzo 
Date: Tue, 28 Apr 2009 20:20:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191634 - head/usr.sbin/kbdmap
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 20:20:13 -0000

Author: danger (doc committer)
Date: Tue Apr 28 20:20:13 2009
New Revision: 191634
URL: http://svn.freebsd.org/changeset/base/191634

Log:
  - fix path for locale.alias
  
  PR:		docs/134070
  Submitted by:	Frank Shute 
  MFC after:	1 week

Modified:
  head/usr.sbin/kbdmap/kbdmap.1

Modified: head/usr.sbin/kbdmap/kbdmap.1
==============================================================================
--- head/usr.sbin/kbdmap/kbdmap.1	Tue Apr 28 19:20:13 2009	(r191633)
+++ head/usr.sbin/kbdmap/kbdmap.1	Tue Apr 28 20:20:13 2009	(r191634)
@@ -111,7 +111,7 @@ database for keymaps
 database for fonts
 .It Pa /etc/rc.conf
 default font
-.It Pa /usr/X11/lib/X11/locale/locale.alias
+.It Pa /usr/local/share/locale/locale.alias
 describe common
 .Ev LANG
 values

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 20:23:58 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EA86A1065670;
	Tue, 28 Apr 2009 20:23:58 +0000 (UTC)
	(envelope-from danger@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D94E98FC14;
	Tue, 28 Apr 2009 20:23:58 +0000 (UTC)
	(envelope-from danger@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3SKNwnj058926;
	Tue, 28 Apr 2009 20:23:58 GMT (envelope-from danger@svn.freebsd.org)
Received: (from danger@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3SKNwJO058925;
	Tue, 28 Apr 2009 20:23:58 GMT (envelope-from danger@svn.freebsd.org)
Message-Id: <200904282023.n3SKNwJO058925@svn.freebsd.org>
From: Daniel Gerzo 
Date: Tue, 28 Apr 2009 20:23:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191635 - head/usr.sbin/arp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 20:23:59 -0000

Author: danger (doc committer)
Date: Tue Apr 28 20:23:58 2009
New Revision: 191635
URL: http://svn.freebsd.org/changeset/base/191635

Log:
  - xref ndp(8)
  
  PR:		docs/134053
  Submitted by:	Bob Van Zant 
  MFC after:	1 week

Modified:
  head/usr.sbin/arp/arp.8

Modified: head/usr.sbin/arp/arp.8
==============================================================================
--- head/usr.sbin/arp/arp.8	Tue Apr 28 20:20:13 2009	(r191634)
+++ head/usr.sbin/arp/arp.8	Tue Apr 28 20:23:58 2009	(r191635)
@@ -193,7 +193,8 @@ character will mark the rest of the line
 .Sh SEE ALSO
 .Xr inet 3 ,
 .Xr arp 4 ,
-.Xr ifconfig 8
+.Xr ifconfig 8 ,
+.Xr ndp 8
 .Sh HISTORY
 The
 .Nm

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 20:49:48 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 262F8106566B;
	Tue, 28 Apr 2009 20:49:48 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 13EF18FC0C;
	Tue, 28 Apr 2009 20:49:48 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3SKnlUF059587;
	Tue, 28 Apr 2009 20:49:47 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3SKnlO6059586;
	Tue, 28 Apr 2009 20:49:47 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200904282049.n3SKnlO6059586@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 28 Apr 2009 20:49:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191638 - head/sys/dev/fb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 20:49:48 -0000

Author: marius
Date: Tue Apr 28 20:49:47 2009
New Revision: 191638
URL: http://svn.freebsd.org/changeset/base/191638

Log:
  - Change some softc members to be unsigned where more appropriate.
  - Add some missing const.
  - Move the size of the window spun by the registers to the softc
    as neither using va_mem_size for this nor va_mem_base for the
    start of the bus addresses is appropriate.
  
  MFC after:	1 week

Modified:
  head/sys/dev/fb/creator.c

Modified: head/sys/dev/fb/creator.c
==============================================================================
--- head/sys/dev/fb/creator.c	Tue Apr 28 20:39:21 2009	(r191637)
+++ head/sys/dev/fb/creator.c	Tue Apr 28 20:49:47 2009	(r191638)
@@ -66,12 +66,13 @@ struct creator_softc {
 	struct resource		*sc_reg[FFB_NREG];
 	bus_space_tag_t		sc_bt[FFB_NREG];
 	bus_space_handle_t	sc_bh[FFB_NREG];
+	u_long			sc_reg_size;
 
-	int			sc_height;
-	int			sc_width;
+	u_int			sc_height;
+	u_int			sc_width;
 
-	int			sc_xmargin;
-	int			sc_ymargin;
+	u_int			sc_xmargin;
+	u_int			sc_ymargin;
 
 	const u_char		*sc_font;
 
@@ -82,7 +83,7 @@ struct creator_softc {
 	int			sc_fontw_cache;
 	int			sc_pmask_cache;
 
-	int			sc_flags;
+	u_int			sc_flags;
 #define	CREATOR_AFB		(1 << 0)
 #define	CREATOR_CONSOLE		(1 << 1)
 #define	CREATOR_CUREN		(1 << 2)
@@ -96,7 +97,7 @@ struct creator_softc {
 	bus_space_write_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val))
 
 #define	C(r, g, b)	((b << 16) | (g << 8) | (r))
-static const uint32_t creator_cmap[] = {
+static const uint32_t const creator_cmap[] = {
 	C(0x00, 0x00, 0x00),		/* black */
 	C(0x00, 0x00, 0xff),		/* blue */
 	C(0x00, 0xff, 0x00),		/* green */
@@ -120,7 +121,7 @@ static const struct {
 	vm_offset_t virt;
 	vm_paddr_t phys;
 	vm_size_t size;
-} creator_fb_map[] = {
+} const creator_fb_map[] = {
 	{ FFB_VIRT_SFB8R,	FFB_PHYS_SFB8R,		FFB_SIZE_SFB8R },
 	{ FFB_VIRT_SFB8G,	FFB_PHYS_SFB8G,		FFB_SIZE_SFB8G },
 	{ FFB_VIRT_SFB8B,	FFB_PHYS_SFB8B,		FFB_SIZE_SFB8B },
@@ -252,8 +253,6 @@ static video_switch_t creatorvidsw = {
 	.clear			= creator_clear,
 	.fill_rect		= creator_fill_rect,
 	.bitblt			= creator_bitblt,
-	NULL,						/* XXX brain damage */
-	NULL,						/* XXX brain damage */
 	.diag			= creator_diag,
 	.save_cursor_palette	= creator_save_cursor_palette,
 	.load_cursor_palette	= creator_load_cursor_palette,
@@ -271,7 +270,7 @@ RENDERER(creator, 0, txtrndrsw, gfb_set)
 
 RENDERER_MODULE(creator, gfb_set);
 
-static const u_char creator_mouse_pointer[64][8] __aligned(8) = {
+static const u_char const creator_mouse_pointer[64][8] __aligned(8) = {
 	{ 0x00, 0x00, },	/* ............ */
 	{ 0x80, 0x00, },	/* *........... */
 	{ 0xc0, 0x00, },	/* **.......... */
@@ -953,20 +952,19 @@ creator_bus_attach(device_t dev)
 		sc->sc_bh[i] = rman_get_bushandle(sc->sc_reg[i]);
 	}
 	/*
-	 * The XFree86/Xorg sunffb(4) expects to be able to access the
+	 * The XFree86/X.Org sunffb(4) expects to be able to access the
 	 * memory spanned by the first and the last resource as one chunk
 	 * via creator_fb_mmap(), using offsets from the first resource,
 	 * even though the backing resources are actually non-continuous.
 	 * So make sure that the memory we provide is at least backed by
 	 * increasing resources.
 	 */
-	adp->va_mem_base = rman_get_start(sc->sc_reg[0]);
 	for (i = 1; i < FFB_NREG && sc->sc_reg[i] != NULL &&
 	    rman_get_start(sc->sc_reg[i]) > rman_get_start(sc->sc_reg[i - 1]);
 	    i++)
 		;
-	adp->va_mem_size = rman_get_end(sc->sc_reg[i - 1]) -
-	    adp->va_mem_base + 1;
+	sc->sc_reg_size = rman_get_end(sc->sc_reg[i - 1]) -
+	    rman_get_start(sc->sc_reg[0]) + 1;
 
 	if (!(sc->sc_flags & CREATOR_CONSOLE)) {
 		if ((sw = vid_get_switch(CREATOR_DRIVER_NAME)) == NULL) {
@@ -1058,7 +1056,7 @@ creator_fb_mmap(struct cdev *dev, vm_off
 
 	/*
 	 * NB: This is a special implementation based on the /dev/fb
-	 * requirements of the XFree86/Xorg sunffb(4).
+	 * requirements of the XFree86/X.Org sunffb(4).
 	 */
 	sc = dev->si_drv1;
 	for (i = 0; i < CREATOR_FB_MAP_SIZE; i++) {
@@ -1066,7 +1064,7 @@ creator_fb_mmap(struct cdev *dev, vm_off
 		    offset < creator_fb_map[i].virt + creator_fb_map[i].size) {
 			offset += creator_fb_map[i].phys -
 			    creator_fb_map[i].virt;
-			if (offset >= sc->sc_va.va_mem_size)
+			if (offset >= sc->sc_reg_size)
 				return (EINVAL);
 			*paddr = sc->sc_bh[0] + offset;
 			return (0);

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 28 21:00:50 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ED1431065735;
	Tue, 28 Apr 2009 21:00: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 DB8478FC1F;
	Tue, 28 Apr 2009 21:00:50 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3SL0oCH059845;
	Tue, 28 Apr 2009 21:00:50 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3SL0ohI059844;
	Tue, 28 Apr 2009 21:00:50 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200904282100.n3SL0ohI059844@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Tue, 28 Apr 2009 21:00:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191639 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 28 Apr 2009 21:00:51 -0000

Author: bz
Date: Tue Apr 28 21:00:50 2009
New Revision: 191639
URL: http://svn.freebsd.org/changeset/base/191639

Log:
  Prevent a superuser inside a jail from modifying the dedicated
  root cpuset of that jail.
  Processes inside the jail will still be able to change child sets.
  A superuser outside of a jail will still be able to change the jail cpuset
  and thus limit the number of cpus available to the jail.
  
  Problem reported by: 000.fbsd@quip.cz (Miroslav Lachman)
  PR:		kern/134050
  Reviewed by:	jeff
  MFC after:	3 weeks
  X-MFC:		backout r191596

Modified:
  head/sys/kern/kern_cpuset.c

Modified: head/sys/kern/kern_cpuset.c
==============================================================================
--- head/sys/kern/kern_cpuset.c	Tue Apr 28 20:49:47 2009	(r191638)
+++ head/sys/kern/kern_cpuset.c	Tue Apr 28 21:00:50 2009	(r191639)
@@ -357,6 +357,15 @@ cpuset_modify(struct cpuset *set, cpuset
 	if (error)
 		return (error);
 	/*
+	 * In case we are called from within the jail
+	 * we do not allow modifying the dedicated root
+	 * cpuset of the jail but may still allow to
+	 * change child sets.
+	 */
+	if (jailed(curthread->td_ucred) &&
+	    set->cs_flags & CPU_SET_ROOT)
+		return (EPERM);
+	/*
 	 * Verify that we have access to this set of
 	 * cpus.
 	 */

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 03:15:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7D17D106564A;
	Wed, 29 Apr 2009 03:15:44 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 618408FC12;
	Wed, 29 Apr 2009 03:15:44 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3T3Fit8067561;
	Wed, 29 Apr 2009 03:15:44 GMT (envelope-from jeff@svn.freebsd.org)
Received: (from jeff@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3T3FiJW067558;
	Wed, 29 Apr 2009 03:15:44 GMT (envelope-from jeff@svn.freebsd.org)
Message-Id: <200904290315.n3T3FiJW067558@svn.freebsd.org>
From: Jeff Roberson 
Date: Wed, 29 Apr 2009 03:15:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191643 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 03:15:44 -0000

Author: jeff
Date: Wed Apr 29 03:15:43 2009
New Revision: 191643
URL: http://svn.freebsd.org/changeset/base/191643

Log:
   - Remove the bogus idle thread state code.  This may have a race in it
     and it only optimized out an ipi or mwait in very few cases.
   - Skip the adaptive idle code when running on SMT or HTT cores.  This
     just wastes cpu time that could be used on a busy thread on the same
     core.
   - Rename CG_FLAG_THREAD to CG_FLAG_SMT to be more descriptive.  Re-use
     CG_FLAG_THREAD to mean SMT or HTT.
  
  Sponsored by:   Nokia

Modified:
  head/sys/kern/sched_ule.c
  head/sys/kern/subr_smp.c
  head/sys/sys/smp.h

Modified: head/sys/kern/sched_ule.c
==============================================================================
--- head/sys/kern/sched_ule.c	Tue Apr 28 23:36:29 2009	(r191642)
+++ head/sys/kern/sched_ule.c	Wed Apr 29 03:15:43 2009	(r191643)
@@ -36,7 +36,7 @@
  */
 
 #include 
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD$);
 
 #include "opt_hwpmc_hooks.h"
 #include "opt_kdtrace.h"
@@ -213,7 +213,6 @@ struct tdq {
 	volatile int	tdq_load;		/* Aggregate load. */
 	int		tdq_sysload;		/* For loadavg, !ITHD load. */
 	int		tdq_transferable;	/* Transferable thread count. */
-	volatile int	tdq_idlestate;		/* State of the idle thread. */
 	short		tdq_switchcnt;		/* Switches this tick. */
 	short		tdq_oldswitchcnt;	/* Switches last tick. */
 	u_char		tdq_lowpri;		/* Lowest priority thread. */
@@ -360,7 +359,6 @@ tdq_print(int cpu)
 	printf("\tload:           %d\n", tdq->tdq_load);
 	printf("\tswitch cnt:     %d\n", tdq->tdq_switchcnt);
 	printf("\told switch cnt: %d\n", tdq->tdq_oldswitchcnt);
-	printf("\tidle state:     %d\n", tdq->tdq_idlestate);
 	printf("\ttimeshare idx:  %d\n", tdq->tdq_idx);
 	printf("\ttimeshare ridx: %d\n", tdq->tdq_ridx);
 	printf("\tload transferable: %d\n", tdq->tdq_transferable);
@@ -913,7 +911,7 @@ tdq_idled(struct tdq *tdq)
 	/* We don't want to be preempted while we're iterating. */
 	spinlock_enter();
 	for (cg = tdq->tdq_cg; cg != NULL; ) {
-		if ((cg->cg_flags & (CG_FLAG_HTT | CG_FLAG_THREAD)) == 0)
+		if ((cg->cg_flags & CG_FLAG_THREAD) == 0)
 			thresh = steal_thresh;
 		else
 			thresh = 1;
@@ -969,13 +967,6 @@ tdq_notify(struct tdq *tdq, struct threa
 		return;
 	if (TD_IS_IDLETHREAD(ctd)) {
 		/*
-		 * If the idle thread is still 'running' it's probably
-		 * waiting on us to release the tdq spinlock already.  No
-		 * need to ipi.
-		 */
-		if (tdq->tdq_idlestate == TDQ_RUNNING)
-			return;
-		/*
 		 * If the MD code has an idle wakeup routine try that before
 		 * falling back to IPI.
 		 */
@@ -2536,12 +2527,10 @@ sched_idletd(void *dummy)
 	int switchcnt;
 	int i;
 
+	mtx_assert(&Giant, MA_NOTOWNED);
 	td = curthread;
 	tdq = TDQ_SELF();
-	mtx_assert(&Giant, MA_NOTOWNED);
-	/* ULE relies on preemption for idle interruption. */
 	for (;;) {
-		tdq->tdq_idlestate = TDQ_RUNNING;
 #ifdef SMP
 		if (tdq_idled(tdq) == 0)
 			continue;
@@ -2550,26 +2539,21 @@ sched_idletd(void *dummy)
 		/*
 		 * If we're switching very frequently, spin while checking
 		 * for load rather than entering a low power state that 
-		 * requires an IPI.
+		 * may require an IPI.  However, don't do any busy
+		 * loops while on SMT machines as this simply steals
+		 * cycles from cores doing useful work.
 		 */
-		if (switchcnt > sched_idlespinthresh) {
+		if ((tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) == 0 &&
+		    switchcnt > sched_idlespinthresh) {
 			for (i = 0; i < sched_idlespins; i++) {
 				if (tdq->tdq_load)
 					break;
 				cpu_spinwait();
 			}
 		}
-		/*
-		 * We must set our state to IDLE before checking
-		 * tdq_load for the last time to avoid a race with
-		 * tdq_notify().
-		 */
-		if (tdq->tdq_load == 0) {
-			switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt;
-			tdq->tdq_idlestate = TDQ_IDLE;
-			if (tdq->tdq_load == 0)
-				cpu_idle(switchcnt > 1);
-		}
+		switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt;
+		if (tdq->tdq_load == 0)
+			cpu_idle(switchcnt > 1);
 		if (tdq->tdq_load) {
 			thread_lock(td);
 			mi_switch(SW_VOL | SWT_IDLE, NULL);
@@ -2683,7 +2667,7 @@ sysctl_kern_sched_topology_spec_internal
 	if (cg->cg_flags != 0) {
 		if ((cg->cg_flags & CG_FLAG_HTT) != 0)
 			sbuf_printf(sb, "HTT group\n");
-		if ((cg->cg_flags & CG_FLAG_THREAD) != 0)
+		if ((cg->cg_flags & CG_FLAG_SMT) != 0)
 			sbuf_printf(sb, "SMT group\n");
 	}
 	sbuf_printf(sb, "\n");

Modified: head/sys/kern/subr_smp.c
==============================================================================
--- head/sys/kern/subr_smp.c	Tue Apr 28 23:36:29 2009	(r191642)
+++ head/sys/kern/subr_smp.c	Wed Apr 29 03:15:43 2009	(r191643)
@@ -491,7 +491,7 @@ smp_topo(void)
 	case 7:
 		/* quad core with a shared l3, 8 threads sharing L2.  */
 		top = smp_topo_2level(CG_SHARE_L3, 4, CG_SHARE_L2, 8,
-		    CG_FLAG_THREAD);
+		    CG_FLAG_SMT);
 		break;
 	default:
 		/* Default, ask the system what it wants. */

Modified: head/sys/sys/smp.h
==============================================================================
--- head/sys/sys/smp.h	Tue Apr 28 23:36:29 2009	(r191642)
+++ head/sys/sys/smp.h	Wed Apr 29 03:15:43 2009	(r191643)
@@ -54,7 +54,8 @@ struct cpu_group {
  * Behavior modifiers for load balancing and affinity.
  */
 #define	CG_FLAG_HTT	0x01		/* Schedule the alternate core last. */
-#define	CG_FLAG_THREAD	0x02		/* New age htt, less crippled. */
+#define	CG_FLAG_SMT	0x02		/* New age htt, less crippled. */
+#define	CG_FLAG_THREAD	(CG_FLAG_HTT | CG_FLAG_SMT)	/* Any threading. */
 
 /*
  * Convenience routines for building topologies.

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 03:26:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2C712106566C;
	Wed, 29 Apr 2009 03:26:31 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0083C8FC0A;
	Wed, 29 Apr 2009 03:26:31 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3T3QUWB067840;
	Wed, 29 Apr 2009 03:26:30 GMT (envelope-from jeff@svn.freebsd.org)
Received: (from jeff@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3T3QUQM067839;
	Wed, 29 Apr 2009 03:26:30 GMT (envelope-from jeff@svn.freebsd.org)
Message-Id: <200904290326.n3T3QUQM067839@svn.freebsd.org>
From: Jeff Roberson 
Date: Wed, 29 Apr 2009 03:26:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191645 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 03:26:31 -0000

Author: jeff
Date: Wed Apr 29 03:26:30 2009
New Revision: 191645
URL: http://svn.freebsd.org/changeset/base/191645

Log:
   - Fix the FBSDID line.

Modified:
  head/sys/kern/sched_ule.c

Modified: head/sys/kern/sched_ule.c
==============================================================================
--- head/sys/kern/sched_ule.c	Wed Apr 29 03:21:53 2009	(r191644)
+++ head/sys/kern/sched_ule.c	Wed Apr 29 03:26:30 2009	(r191645)
@@ -36,7 +36,7 @@
  */
 
 #include 
-__FBSDID("$FreeBSD$);
+__FBSDID("$FreeBSD$");
 
 #include "opt_hwpmc_hooks.h"
 #include "opt_kdtrace.h"

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 06:54:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 28C54106564A;
	Wed, 29 Apr 2009 06:54:41 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 15B928FC08;
	Wed, 29 Apr 2009 06:54:41 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3T6sftl071946;
	Wed, 29 Apr 2009 06:54:41 GMT (envelope-from jeff@svn.freebsd.org)
Received: (from jeff@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3T6seLQ071937;
	Wed, 29 Apr 2009 06:54:40 GMT (envelope-from jeff@svn.freebsd.org)
Message-Id: <200904290654.n3T6seLQ071937@svn.freebsd.org>
From: Jeff Roberson 
Date: Wed, 29 Apr 2009 06:54:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191648 - in head/sys: amd64/amd64 amd64/include
	i386/i386 i386/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 06:54:41 -0000

Author: jeff
Date: Wed Apr 29 06:54:40 2009
New Revision: 191648
URL: http://svn.freebsd.org/changeset/base/191648

Log:
   - Add support for cpuid leaf 0xb.  This allows us to determine the
     topology of nehalem/corei7 based systems.
   - Remove the cpu_cores/cpu_logical detection from identcpu.
   - Describe the layout of the system in cpu_mp_announce().
  
  Sponsored by:   Nokia

Modified:
  head/sys/amd64/amd64/identcpu.c
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/amd64/include/smp.h
  head/sys/amd64/include/specialreg.h
  head/sys/i386/i386/identcpu.c
  head/sys/i386/i386/mp_machdep.c
  head/sys/i386/include/smp.h
  head/sys/i386/include/specialreg.h

Modified: head/sys/amd64/amd64/identcpu.c
==============================================================================
--- head/sys/amd64/amd64/identcpu.c	Wed Apr 29 06:52:04 2009	(r191647)
+++ head/sys/amd64/amd64/identcpu.c	Wed Apr 29 06:54:40 2009	(r191648)
@@ -106,9 +106,6 @@ static struct {
 	{ CENTAUR_VENDOR_ID,	CPU_VENDOR_CENTAUR },	/* CentaurHauls */
 };
 
-int cpu_cores;
-int cpu_logical;
-
 
 extern int pq_l2size;
 extern int pq_l2nways;
@@ -195,7 +192,6 @@ printcpuinfo(void)
 	    cpu_vendor_id == CPU_VENDOR_CENTAUR) {
 		printf("  Stepping = %u", cpu_id & 0xf);
 		if (cpu_high > 0) {
-			u_int cmp = 1, htt = 1;
 
 			/*
 			 * Here we should probably set up flags indicating
@@ -400,28 +396,6 @@ printcpuinfo(void)
 			if (tsc_is_invariant)
 				printf("\n  TSC: P-state invariant");
 
-			/*
-			 * If this CPU supports HTT or CMP then mention the
-			 * number of physical/logical cores it contains.
-			 */
-			if (cpu_feature & CPUID_HTT)
-				htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-			if (cpu_vendor_id == CPU_VENDOR_AMD &&
-			    (amd_feature2 & AMDID2_CMP))
-				cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
-			else if (cpu_vendor_id == CPU_VENDOR_INTEL &&
-			    (cpu_high >= 4)) {
-				cpuid_count(4, 0, regs);
-				if ((regs[0] & 0x1f) != 0)
-					cmp = ((regs[0] >> 26) & 0x3f) + 1;
-			}
-			cpu_cores = cmp;
-			cpu_logical = htt / cmp;
-			if (cmp > 1)
-				printf("\n  Cores per package: %d", cmp);
-			if ((htt / cmp) > 1)
-				printf("\n  Logical CPUs per core: %d",
-				    cpu_logical);
 		}
 	}
 	/* Avoid ugly blank lines: only print newline when we have to. */

Modified: head/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- head/sys/amd64/amd64/mp_machdep.c	Wed Apr 29 06:52:04 2009	(r191647)
+++ head/sys/amd64/amd64/mp_machdep.c	Wed Apr 29 06:54:40 2009	(r191648)
@@ -160,6 +160,8 @@ int apic_cpuids[MAX_APIC_ID + 1];
 static volatile u_int cpu_ipi_pending[MAXCPU];
 
 static u_int boot_address;
+static int cpu_logical;
+static int cpu_cores;
 
 static void	assign_cpu_ids(void);
 static void	set_interrupt_apic_ids(void);
@@ -181,13 +183,142 @@ mem_range_AP_init(void)
 		mem_range_softc.mr_op->initAP(&mem_range_softc);
 }
 
-struct cpu_group *
-cpu_topo(void)
+static void
+topo_probe_0xb(void)
+{
+	int logical;
+	int p[4];
+	int bits;
+	int type;
+	int cnt;
+	int i;
+	int x;
+
+	/* We only support two levels for now. */
+	for (i = 0; i < 3; i++) {
+		cpuid_count(0x0B, i, p);
+		bits = p[0] & 0x1f;
+		logical = p[1] &= 0xffff;
+		type = (p[2] >> 8) & 0xff;
+		if (type == 0 || logical == 0)
+			break;
+		for (cnt = 0, x = 0; x <= MAX_APIC_ID; x++) {
+			if (!cpu_info[x].cpu_present ||
+			    cpu_info[x].cpu_disabled)
+				continue;
+			if (x >> bits == boot_cpu_id >> bits)
+				cnt++;
+		}
+		if (type == CPUID_TYPE_SMT)
+			cpu_logical = cnt;
+		else if (type == CPUID_TYPE_CORE)
+			cpu_cores = cnt;
+	}
+	if (cpu_logical == 0)
+		cpu_logical = 1;
+	cpu_cores /= cpu_logical;
+}
+
+static void
+topo_probe_0x4(void)
+{
+	u_int threads_per_cache, p[4];
+	u_int htt, cmp;
+	int i;
+
+	htt = cmp = 1;
+	/*
+	 * If this CPU supports HTT or CMP then mention the
+	 * number of physical/logical cores it contains.
+	 */
+	if (cpu_feature & CPUID_HTT)
+		htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
+	if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP))
+		cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
+	else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) {
+		cpuid_count(4, 0, p);
+		if ((p[0] & 0x1f) != 0)
+			cmp = ((p[0] >> 26) & 0x3f) + 1;
+	}
+	cpu_cores = cmp;
+	cpu_logical = htt / cmp;
+
+	/* Setup the initial logical CPUs info. */
+	if (cpu_feature & CPUID_HTT)
+		logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
+
+	/*
+	 * Work out if hyperthreading is *really* enabled.  This
+	 * is made really ugly by the fact that processors lie: Dual
+	 * core processors claim to be hyperthreaded even when they're
+	 * not, presumably because they want to be treated the same
+	 * way as HTT with respect to per-cpu software licensing.
+	 * At the time of writing (May 12, 2005) the only hyperthreaded
+	 * cpus are from Intel, and Intel's dual-core processors can be
+	 * identified via the "deterministic cache parameters" cpuid
+	 * calls.
+	 */
+	/*
+	 * First determine if this is an Intel processor which claims
+	 * to have hyperthreading support.
+	 */
+	if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) {
+		/*
+		 * If the "deterministic cache parameters" cpuid calls
+		 * are available, use them.
+		 */
+		if (cpu_high >= 4) {
+			/* Ask the processor about the L1 cache. */
+			for (i = 0; i < 1; i++) {
+				cpuid_count(4, i, p);
+				threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1;
+				if (hyperthreading_cpus < threads_per_cache)
+					hyperthreading_cpus = threads_per_cache;
+				if ((p[0] & 0x1f) == 0)
+					break;
+			}
+		}
+
+		/*
+		 * If the deterministic cache parameters are not
+		 * available, or if no caches were reported to exist,
+		 * just accept what the HTT flag indicated.
+		 */
+		if (hyperthreading_cpus == 0)
+			hyperthreading_cpus = logical_cpus;
+	}
+}
+
+static void
+topo_probe(void)
 {
+
+	logical_cpus = logical_cpus_mask = 0;
+	if (cpu_high >= 0xb)
+		topo_probe_0xb();
+	else if (cpu_high)
+		topo_probe_0x4();
 	if (cpu_cores == 0)
-		cpu_cores = 1;
+		cpu_cores = mp_ncpus;
 	if (cpu_logical == 0)
 		cpu_logical = 1;
+}
+
+struct cpu_group *
+cpu_topo(void)
+{
+	int cg_flags;
+
+	/*
+	 * Determine whether any threading flags are
+	 * necessry.
+	 */
+	if (cpu_logical > 1 && hyperthreading_cpus)
+		cg_flags = CG_FLAG_HTT;
+	else if (cpu_logical > 1)
+		cg_flags = CG_FLAG_SMT;
+	else
+		cg_flags = 0;
 	if (mp_ncpus % (cpu_cores * cpu_logical) != 0) {
 		printf("WARNING: Non-uniform processors.\n");
 		printf("WARNING: Using suboptimal topology.\n");
@@ -202,17 +333,17 @@ cpu_topo(void)
 	 * Only HTT no multi-core.
 	 */
 	if (cpu_logical > 1 && cpu_cores == 1)
-		return (smp_topo_1level(CG_SHARE_L1, cpu_logical, CG_FLAG_HTT));
+		return (smp_topo_1level(CG_SHARE_L1, cpu_logical, cg_flags));
 	/*
 	 * Only multi-core no HTT.
 	 */
 	if (cpu_cores > 1 && cpu_logical == 1)
-		return (smp_topo_1level(CG_SHARE_NONE, cpu_cores, 0));
+		return (smp_topo_1level(CG_SHARE_L2, cpu_cores, cg_flags));
 	/*
 	 * Both HTT and multi-core.
 	 */
-	return (smp_topo_2level(CG_SHARE_NONE, cpu_cores,
-	    CG_SHARE_L1, cpu_logical, CG_FLAG_HTT));
+	return (smp_topo_2level(CG_SHARE_L2, cpu_cores,
+	    CG_SHARE_L1, cpu_logical, cg_flags));
 }
 
 /*
@@ -318,7 +449,6 @@ void
 cpu_mp_start(void)
 {
 	int i;
-	u_int threads_per_cache, p[4];
 
 	/* Initialize the logical ID to APIC ID table. */
 	for (i = 0; i < MAXCPU; i++) {
@@ -355,51 +485,8 @@ cpu_mp_start(void)
 		KASSERT(boot_cpu_id == PCPU_GET(apic_id),
 		    ("BSP's APIC ID doesn't match boot_cpu_id"));
 
-	/* Setup the initial logical CPUs info. */
-	logical_cpus = logical_cpus_mask = 0;
-	if (cpu_feature & CPUID_HTT)
-		logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-
-	/*
-	 * Work out if hyperthreading is *really* enabled.  This
-	 * is made really ugly by the fact that processors lie: Dual
-	 * core processors claim to be hyperthreaded even when they're
-	 * not, presumably because they want to be treated the same
-	 * way as HTT with respect to per-cpu software licensing.
-	 * At the time of writing (May 12, 2005) the only hyperthreaded
-	 * cpus are from Intel, and Intel's dual-core processors can be
-	 * identified via the "deterministic cache parameters" cpuid
-	 * calls.
-	 */
-	/*
-	 * First determine if this is an Intel processor which claims
-	 * to have hyperthreading support.
-	 */
-	if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) {
-		/*
-		 * If the "deterministic cache parameters" cpuid calls
-		 * are available, use them.
-		 */
-		if (cpu_high >= 4) {
-			/* Ask the processor about the L1 cache. */
-			for (i = 0; i < 1; i++) {
-				cpuid_count(4, i, p);
-				threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1;
-				if (hyperthreading_cpus < threads_per_cache)
-					hyperthreading_cpus = threads_per_cache;
-				if ((p[0] & 0x1f) == 0)
-					break;
-			}
-		}
-
-		/*
-		 * If the deterministic cache parameters are not
-		 * available, or if no caches were reported to exist,
-		 * just accept what the HTT flag indicated.
-		 */
-		if (hyperthreading_cpus == 0)
-			hyperthreading_cpus = logical_cpus;
-	}
+	/* Probe logical/physical core configuration. */
+	topo_probe();
 
 	assign_cpu_ids();
 
@@ -419,6 +506,14 @@ cpu_mp_announce(void)
 	const char *hyperthread;
 	int i;
 
+	printf("FreeBSD/SMP: %d package(s) x %d core(s)",
+	    mp_ncpus / (cpu_cores * cpu_logical), cpu_cores);
+	if (hyperthreading_cpus > 1)
+	    printf(" x %d HTT threads", cpu_logical);
+	else if (cpu_logical > 1)
+	    printf(" x %d SMT threads", cpu_logical);
+	printf("\n");
+
 	/* List active CPUs first. */
 	printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id);
 	for (i = 1; i < mp_ncpus; i++) {

Modified: head/sys/amd64/include/smp.h
==============================================================================
--- head/sys/amd64/include/smp.h	Wed Apr 29 06:52:04 2009	(r191647)
+++ head/sys/amd64/include/smp.h	Wed Apr 29 06:54:40 2009	(r191648)
@@ -36,10 +36,6 @@ extern int			boot_cpu_id;
 extern struct pcb		stoppcbs[];
 extern int			cpu_apic_ids[];
 
-/* global data in identcpu.c */
-extern int			cpu_cores;
-extern int			cpu_logical;
-
 /* IPI handlers */
 inthand_t
 	IDTVEC(invltlb),	/* TLB shootdowns - global */

Modified: head/sys/amd64/include/specialreg.h
==============================================================================
--- head/sys/amd64/include/specialreg.h	Wed Apr 29 06:52:04 2009	(r191647)
+++ head/sys/amd64/include/specialreg.h	Wed Apr 29 06:54:40 2009	(r191648)
@@ -183,6 +183,13 @@
 #define	CPUID_HTT_CORES		0x00ff0000
 #define	CPUID_LOCAL_APIC_ID	0xff000000
 
+/* 
+ * CPUID instruction 0xb ebx info.
+ */
+#define	CPUID_TYPE_INVAL	0
+#define	CPUID_TYPE_SMT		1
+#define	CPUID_TYPE_CORE		2
+
 /*
  * AMD extended function 8000_0007h edx info
  */

Modified: head/sys/i386/i386/identcpu.c
==============================================================================
--- head/sys/i386/i386/identcpu.c	Wed Apr 29 06:52:04 2009	(r191647)
+++ head/sys/i386/i386/identcpu.c	Wed Apr 29 06:54:40 2009	(r191648)
@@ -159,9 +159,6 @@ static struct {
 #endif
 };
 
-int cpu_cores;
-int cpu_logical;
-
 #if defined(I586_CPU) && !defined(NO_F00F_HACK)
 int has_f00f_bug = 0;		/* Initialized so that it can be patched. */
 #endif
@@ -690,7 +687,6 @@ printcpuinfo(void)
 		if (cpu_vendor_id == CPU_VENDOR_CYRIX)
 			printf("  DIR=0x%04x", cyrix_did);
 		if (cpu_high > 0) {
-			u_int cmp = 1, htt = 1;
 
 			/*
 			 * Here we should probably set up flags indicating
@@ -895,28 +891,6 @@ printcpuinfo(void)
 			if (tsc_is_invariant)
 				printf("\n  TSC: P-state invariant");
 
-			/*
-			 * If this CPU supports HTT or CMP then mention the
-			 * number of physical/logical cores it contains.
-			 */
-			if (cpu_feature & CPUID_HTT)
-				htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-			if (cpu_vendor_id == CPU_VENDOR_AMD &&
-			    (amd_feature2 & AMDID2_CMP))
-				cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
-			else if (cpu_vendor_id == CPU_VENDOR_INTEL &&
-			    (cpu_high >= 4)) {
-				cpuid_count(4, 0, regs);
-				if ((regs[0] & 0x1f) != 0)
-					cmp = ((regs[0] >> 26) & 0x3f) + 1;
-			}
-			cpu_cores = cmp;
-			cpu_logical = htt / cmp;
-			if (cmp > 1)
-				printf("\n  Cores per package: %d", cmp);
-			if ((htt / cmp) > 1)
-				printf("\n  Logical CPUs per core: %d",
-				    cpu_logical);
 		}
 	} else if (cpu_vendor_id == CPU_VENDOR_CYRIX) {
 		printf("  DIR=0x%04x", cyrix_did);

Modified: head/sys/i386/i386/mp_machdep.c
==============================================================================
--- head/sys/i386/i386/mp_machdep.c	Wed Apr 29 06:52:04 2009	(r191647)
+++ head/sys/i386/i386/mp_machdep.c	Wed Apr 29 06:54:40 2009	(r191648)
@@ -213,6 +213,8 @@ int apic_cpuids[MAX_APIC_ID + 1];
 static volatile u_int cpu_ipi_pending[MAXCPU];
 
 static u_int boot_address;
+static int cpu_logical;
+static int cpu_cores;
 
 static void	assign_cpu_ids(void);
 static void	install_ap_tramp(void);
@@ -234,13 +236,142 @@ mem_range_AP_init(void)
 		mem_range_softc.mr_op->initAP(&mem_range_softc);
 }
 
-struct cpu_group *
-cpu_topo(void)
+static void
+topo_probe_0xb(void)
+{
+	int logical;
+	int p[4];
+	int bits;
+	int type;
+	int cnt;
+	int i;
+	int x;
+
+	/* We only support two levels for now. */
+	for (i = 0; i < 3; i++) {
+		cpuid_count(0x0B, i, p);
+		bits = p[0] & 0x1f;
+		logical = p[1] &= 0xffff;
+		type = (p[2] >> 8) & 0xff;
+		if (type == 0 || logical == 0)
+			break;
+		for (cnt = 0, x = 0; x <= MAX_APIC_ID; x++) {
+			if (!cpu_info[x].cpu_present ||
+			    cpu_info[x].cpu_disabled)
+				continue;
+			if (x >> bits == boot_cpu_id >> bits)
+				cnt++;
+		}
+		if (type == CPUID_TYPE_SMT)
+			cpu_logical = cnt;
+		else if (type == CPUID_TYPE_CORE)
+			cpu_cores = cnt;
+	}
+	if (cpu_logical == 0)
+		cpu_logical = 1;
+	cpu_cores /= cpu_logical;
+}
+
+static void
+topo_probe_0x4(void)
+{
+	u_int threads_per_cache, p[4];
+	u_int htt, cmp;
+	int i;
+
+	htt = cmp = 1;
+	/*
+	 * If this CPU supports HTT or CMP then mention the
+	 * number of physical/logical cores it contains.
+	 */
+	if (cpu_feature & CPUID_HTT)
+		htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
+	if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP))
+		cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
+	else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) {
+		cpuid_count(4, 0, p);
+		if ((p[0] & 0x1f) != 0)
+			cmp = ((p[0] >> 26) & 0x3f) + 1;
+	}
+	cpu_cores = cmp;
+	cpu_logical = htt / cmp;
+
+	/* Setup the initial logical CPUs info. */
+	if (cpu_feature & CPUID_HTT)
+		logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
+
+	/*
+	 * Work out if hyperthreading is *really* enabled.  This
+	 * is made really ugly by the fact that processors lie: Dual
+	 * core processors claim to be hyperthreaded even when they're
+	 * not, presumably because they want to be treated the same
+	 * way as HTT with respect to per-cpu software licensing.
+	 * At the time of writing (May 12, 2005) the only hyperthreaded
+	 * cpus are from Intel, and Intel's dual-core processors can be
+	 * identified via the "deterministic cache parameters" cpuid
+	 * calls.
+	 */
+	/*
+	 * First determine if this is an Intel processor which claims
+	 * to have hyperthreading support.
+	 */
+	if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) {
+		/*
+		 * If the "deterministic cache parameters" cpuid calls
+		 * are available, use them.
+		 */
+		if (cpu_high >= 4) {
+			/* Ask the processor about the L1 cache. */
+			for (i = 0; i < 1; i++) {
+				cpuid_count(4, i, p);
+				threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1;
+				if (hyperthreading_cpus < threads_per_cache)
+					hyperthreading_cpus = threads_per_cache;
+				if ((p[0] & 0x1f) == 0)
+					break;
+			}
+		}
+
+		/*
+		 * If the deterministic cache parameters are not
+		 * available, or if no caches were reported to exist,
+		 * just accept what the HTT flag indicated.
+		 */
+		if (hyperthreading_cpus == 0)
+			hyperthreading_cpus = logical_cpus;
+	}
+}
+
+static void
+topo_probe(void)
 {
+
+	logical_cpus = logical_cpus_mask = 0;
+	if (cpu_high >= 0xb)
+		topo_probe_0xb();
+	else if (cpu_high)
+		topo_probe_0x4();
 	if (cpu_cores == 0)
-		cpu_cores = 1;
+		cpu_cores = mp_ncpus;
 	if (cpu_logical == 0)
 		cpu_logical = 1;
+}
+
+struct cpu_group *
+cpu_topo(void)
+{
+	int cg_flags;
+
+	/*
+	 * Determine whether any threading flags are
+	 * necessry.
+	 */
+	if (cpu_logical > 1 && hyperthreading_cpus)
+		cg_flags = CG_FLAG_HTT;
+	else if (cpu_logical > 1)
+		cg_flags = CG_FLAG_SMT;
+	else
+		cg_flags = 0;
 	if (mp_ncpus % (cpu_cores * cpu_logical) != 0) {
 		printf("WARNING: Non-uniform processors.\n");
 		printf("WARNING: Using suboptimal topology.\n");
@@ -255,17 +386,17 @@ cpu_topo(void)
 	 * Only HTT no multi-core.
 	 */
 	if (cpu_logical > 1 && cpu_cores == 1)
-		return (smp_topo_1level(CG_SHARE_L1, cpu_logical, CG_FLAG_HTT));
+		return (smp_topo_1level(CG_SHARE_L1, cpu_logical, cg_flags));
 	/*
 	 * Only multi-core no HTT.
 	 */
 	if (cpu_cores > 1 && cpu_logical == 1)
-		return (smp_topo_1level(CG_SHARE_NONE, cpu_cores, 0));
+		return (smp_topo_1level(CG_SHARE_L2, cpu_cores, cg_flags));
 	/*
 	 * Both HTT and multi-core.
 	 */
-	return (smp_topo_2level(CG_SHARE_NONE, cpu_cores,
-	    CG_SHARE_L1, cpu_logical, CG_FLAG_HTT));
+	return (smp_topo_2level(CG_SHARE_L2, cpu_cores,
+	    CG_SHARE_L1, cpu_logical, cg_flags));
 }
 
 
@@ -354,7 +485,6 @@ void
 cpu_mp_start(void)
 {
 	int i;
-	u_int threads_per_cache, p[4];
 
 	/* Initialize the logical ID to APIC ID table. */
 	for (i = 0; i < MAXCPU; i++) {
@@ -399,51 +529,8 @@ cpu_mp_start(void)
 		KASSERT(boot_cpu_id == PCPU_GET(apic_id),
 		    ("BSP's APIC ID doesn't match boot_cpu_id"));
 
-	/* Setup the initial logical CPUs info. */
-	logical_cpus = logical_cpus_mask = 0;
-	if (cpu_feature & CPUID_HTT)
-		logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-
-	/*
-	 * Work out if hyperthreading is *really* enabled.  This
-	 * is made really ugly by the fact that processors lie: Dual
-	 * core processors claim to be hyperthreaded even when they're
-	 * not, presumably because they want to be treated the same
-	 * way as HTT with respect to per-cpu software licensing.
-	 * At the time of writing (May 12, 2005) the only hyperthreaded
-	 * cpus are from Intel, and Intel's dual-core processors can be
-	 * identified via the "deterministic cache parameters" cpuid
-	 * calls.
-	 */
-	/*
-	 * First determine if this is an Intel processor which claims
-	 * to have hyperthreading support.
-	 */
-	if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) {
-		/*
-		 * If the "deterministic cache parameters" cpuid calls
-		 * are available, use them.
-		 */
-		if (cpu_high >= 4) {
-			/* Ask the processor about the L1 cache. */
-			for (i = 0; i < 1; i++) {
-				cpuid_count(4, i, p);
-				threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1;
-				if (hyperthreading_cpus < threads_per_cache)
-					hyperthreading_cpus = threads_per_cache;
-				if ((p[0] & 0x1f) == 0)
-					break;
-			}
-		}
-
-		/*
-		 * If the deterministic cache parameters are not
-		 * available, or if no caches were reported to exist,
-		 * just accept what the HTT flag indicated.
-		 */
-		if (hyperthreading_cpus == 0)
-			hyperthreading_cpus = logical_cpus;
-	}
+	/* Probe logical/physical core configuration. */
+	topo_probe();
 
 	assign_cpu_ids();
 
@@ -463,6 +550,14 @@ cpu_mp_announce(void)
 	const char *hyperthread;
 	int i;
 
+	printf("FreeBSD/SMP: %d package(s) x %d core(s)",
+	    mp_ncpus / (cpu_cores * cpu_logical), cpu_cores);
+	if (hyperthreading_cpus > 1)
+	    printf(" x %d HTT threads", cpu_logical);
+	else if (cpu_logical > 1)
+	    printf(" x %d SMT threads", cpu_logical);
+	printf("\n");
+
 	/* List active CPUs first. */
 	printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id);
 	for (i = 1; i < mp_ncpus; i++) {

Modified: head/sys/i386/include/smp.h
==============================================================================
--- head/sys/i386/include/smp.h	Wed Apr 29 06:52:04 2009	(r191647)
+++ head/sys/i386/include/smp.h	Wed Apr 29 06:54:40 2009	(r191648)
@@ -45,10 +45,6 @@ extern u_long *ipi_rendezvous_counts[MAX
 extern u_long *ipi_lazypmap_counts[MAXCPU];
 #endif
 
-/* global data in identcpu.c */
-extern int			cpu_cores;
-extern int			cpu_logical;
-
 /* IPI handlers */
 inthand_t
 	IDTVEC(invltlb),	/* TLB shootdowns - global */

Modified: head/sys/i386/include/specialreg.h
==============================================================================
--- head/sys/i386/include/specialreg.h	Wed Apr 29 06:52:04 2009	(r191647)
+++ head/sys/i386/include/specialreg.h	Wed Apr 29 06:54:40 2009	(r191648)
@@ -182,6 +182,13 @@
 #define	CPUID_HTT_CORES		0x00ff0000
 #define	CPUID_LOCAL_APIC_ID	0xff000000
 
+/* 
+ * CPUID instruction 0xb ebx info.
+ */
+#define	CPUID_TYPE_INVAL	0
+#define	CPUID_TYPE_SMT		1
+#define	CPUID_TYPE_CORE		2
+
 /*
  * AMD extended function 8000_0007h edx info
  */

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 09:50:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5FF8F1065672;
	Wed, 29 Apr 2009 09:50:04 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4C9598FC1C;
	Wed, 29 Apr 2009 09:50:04 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3T9o4X4075353;
	Wed, 29 Apr 2009 09:50:04 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3T9o46f075350;
	Wed, 29 Apr 2009 09:50:04 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904290950.n3T9o46f075350@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 09:50:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191651 - head/usr.sbin/mtest
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 09:50:05 -0000

Author: bms
Date: Wed Apr 29 09:50:04 2009
New Revision: 191651
URL: http://svn.freebsd.org/changeset/base/191651

Log:
  Merge IPv6-capable mtest(8) from MLDv2 branch.

Modified:
  head/usr.sbin/mtest/Makefile
  head/usr.sbin/mtest/mtest.8
  head/usr.sbin/mtest/mtest.c

Modified: head/usr.sbin/mtest/Makefile
==============================================================================
--- head/usr.sbin/mtest/Makefile	Wed Apr 29 08:46:50 2009	(r191650)
+++ head/usr.sbin/mtest/Makefile	Wed Apr 29 09:50:04 2009	(r191651)
@@ -1,6 +1,18 @@
 # $FreeBSD$
 
+.include 
+
 PROG=	mtest
 MAN=	mtest.8
 
+BINMODE= 555
+WARNS?=	2
+
+# XXX This assumes INET support in the base system.
+CFLAGS+=-DINET
+
+.if ${MK_INET6_SUPPORT} != "no"
+CFLAGS+=-DINET6
+.endif
+
 .include 

Modified: head/usr.sbin/mtest/mtest.8
==============================================================================
--- head/usr.sbin/mtest/mtest.8	Wed Apr 29 08:46:50 2009	(r191650)
+++ head/usr.sbin/mtest/mtest.8	Wed Apr 29 09:50:04 2009	(r191651)
@@ -26,111 +26,116 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 3, 2009
+.Dd April 29, 2009
 .Os
 .Dt MTEST 8
 .Sh NAME
 .Nm mtest
-.Nd test multicast membership socket operations and ioctls
+.Nd test multicast socket operations
 .Sh SYNOPSIS
 .Nm
 .Sh DESCRIPTION
 The
 .Nm
 utility
-is a small program for testing the multicast membership socket operations
-and ioctls.
-It accepts the following commands, interactively:
-.Bl -tag -width "a ifname e.e.e.e e.e.e.e" -compact -offset indent
-.It Ic j Ar g.g.g.g Ar i.i.i.i Op Ar s.s.s.s
-Join the IP group address
-.Ar g.g.g.g
-on the interface with address
-.Ar i.i.i.i .
+is a small program for testing multicast socket operations.
 .Pp
-If an optional source
-.Ar s.s.s.s
-is specified, a source-specific join will be performed;
-if
-.Nm
-is already a member of the group, the source
-will be added to its filter list.
+It accepts the following commands, interactively, or as part of a scripted
+input file (useful for automated testing):
+.Bl -tag -width "a ifname e.e.e.e e.e.e.e" -compact -offset indent
 .Pp
-.Ar i.i.i.i
-may be specified as 0.0.0.0 to use the default interface,
-although this is legacy behaviour and is not recommended,
-as group memberships are keyed to each individual link.
-.It Ic l Ar g.g.g.g Ar i.i.i.i Op Ar s.s.s.s
-Leave the IP group address
-.Ar g.g.g.g
-on the interface with address
-.Ar i.i.i.i .
-If a source
-.Ar s.s.s.s
-is specified, only that source will be left.
-.It Ic a Ar ifname Ar e.e.e.e.e.e
-Join the Ethernet group address
-.Ar e.e.e.e.e.e
+.\"
+.It Ic a Ar ifname Ar mac-addr
+Join the link-layer group address
+.Ar mac-addr
 on interface
 .Ar ifname .
-.It Ic d Ar ifname Ar e.e.e.e.e.e
-Leave the Ethernet group address
-.Ar e.e.e.e.e.e
+The group address should be in IEEE 802 MAC format,
+delimited by colon (':') characters.
+.It Ic d Ar ifname Ar mac-addr
+Leave the link-layer group address
+.Ar mac-addr
 on interface
 .Ar ifname .
 .It Ic m Ar ifname Ar 1/0
 Set or reset ALLMULTI mode on interface
 .Ar ifname .
+This option is deprecated and is now a no-op.
 .It Ic p Ar ifname Ar 1/0
 Set or reset promiscuous mode on interface
 .Ar ifname .
+.Pp
+.It Ic j Ar mcast-addr Ar ifname Op Ar source-addr
+Join the multicast address
+.Ar mcast-addr
+on the interface with name
+.Ar ifname .
+.Pp
+If an optional source
+.Ar source-addr
+is specified, a source-specific join will be performed;
+if
+.Nm
+is already joined to the multicast address, the source
+will be added to its filter list.
+.Pp
+.It Ic l Ar mcast-addr Ar ifname Op Ar source-addr
+Leave the multicast address
+.Ar mcast-addr
+on the interface with address
+.Ar ifname .
+If a source
+.Ar source-addr
+is specified, only that source will be left.
 .\"
-.It Ic i Ar g.g.g.g Ar i.i.i.i Ar n Ar x.x.x.x ...
-Set the socket with group membership of
-.Ar g.g.g.g
-on IPv4 address
-.Ar i.i.i.i
+.It Ic i Ar mcast-addr Ar ifname Ar n Ar source-addr ...
+Set the socket with membership of
+.Ar mcast-addr
+on interface
+.Ar ifname
 to include filter mode, and add
 .Ar n
 sources beginning with
-.Ar x.x.x.x
+.Ar source-addr
 to the inclusion filter list.
 .\"
-.It Ic e Ar g.g.g.g Ar i.i.i.i Ar n Ar x.x.x.x ...
-Set the socket with group membership of
-.Ar g.g.g.g
-on IPv4 address
-.Ar i.i.i.i
+.It Ic e Ar mcast-addr Ar ifname Ar n Ar source-addr ...
+Set the socket with membership of
+.Ar mcast-addr
+on interface
+.Ar ifname
 to exclude filter mode, and add
 .Ar n
 sources beginning with
-.Ar x.x.x.x
+.Ar source-addr
 to the exclusion filter list.
 .\"
-.It Ic t Ar g.g.g.g Ar i.i.i.i Ar s.s.s.s
-Set the socket with group membership of
-.Ar g.g.g.g
-on IPv4 address
-.Ar i.i.i.i
+.It Ic t Ar mcast-addr Ar ifname Ar source-addr
+Set the socket with membership of
+.Ar mcast-addr
+on interface
+.Ar ifname
 to block traffic from source
-.Ar s.s.s.s .
+.Ar source-addr .
 .\"
-.It Ic b Ar g.g.g.g Ar i.i.i.i Ar s.s.s.s
-Set the socket with group membership of
-.Ar g.g.g.g
-on IPv4 address
-.Ar i.i.i.i
+.It Ic b Ar mcast-addr Ar ifname Ar source-addr
+Set the socket with membership of
+.Ar mcast-addr
+on interface
+.Ar ifname
 to allow traffic from source
-.Ar s.s.s.s .
+.Ar source-addr .
 .\"
-.It Ic g Ar g.g.g.g Ar i.i.i.i Ar n
+.Pp
+.It Ic g Ar mcast-addr Ar ifname Ar n
 Print
 .Ar n
-source filter entries for group
-.An g.g.g.g
-on IPv4 address
-.An i.i.i.i .
+source filter entries for
+.An mcast-addr
+on interface
+.An ifname .
 .\"
+.Pp
 .It Ic f Ar filename
 Read commands from the file
 .Ar filename .
@@ -143,6 +148,18 @@ List legal commands.
 .It Ic q
 Quit the program.
 .El
+.Sh IMPLEMENTATION NOTES
+For each command implemented by
+.Nm ,
+the address family of each argument must be identical; it is not possible
+to mix IPv4 multicast memberships with IPv6, for example.
+.Pp
+To support IPv6, all commands have now changed to accept an interface
+name rather than an interface address.
+For IPv4, the program will perform
+a lookup of the primary IP address based on the interface name.
+This may fail if no primary IP address is assigned.
+.Pp
 .Sh SEE ALSO
 .Rs
 .%A D. Thaler

Modified: head/usr.sbin/mtest/mtest.c
==============================================================================
--- head/usr.sbin/mtest/mtest.c	Wed Apr 29 08:46:50 2009	(r191650)
+++ head/usr.sbin/mtest/mtest.c	Wed Apr 29 09:50:04 2009	(r191651)
@@ -29,13 +29,18 @@
  */
 
 /*
- * Diagnostic and test utility for IPv4 multicast sockets.
+ * Diagnostic and test utility for multicast sockets.
+ * XXX: This file currently assumes INET support in the base system.
+ * TODO: Support embedded KAME Scope ID in IPv6 group addresses.
+ * TODO: Use IPv4 link-local address when source address selection
+ * is implemented; use MCAST_JOIN_SOURCE for IPv4.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -44,42 +49,169 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef INET
 #include 
+#include 
+#include 
+#include 
+#endif
+#ifdef INET6
+#include 
+#include 
+#endif
 
-#include 
-
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-static void	process_file(char *, int);
-static void	process_cmd(char*, int, FILE *fp);
-static void	usage(void);
+#include 
+#include 
+#include 
+
+union sockunion {
+	struct sockaddr_storage	ss;
+	struct sockaddr		sa;
+	struct sockaddr_dl	sdl;
+#ifdef INET
+	struct sockaddr_in	sin;
+#endif
+#ifdef INET6
+	struct sockaddr_in6	sin6;
+#endif
+};
+typedef union sockunion sockunion_t;
+
+union mrequnion {
+#ifdef INET
+	struct ip_mreq	 	 mr;
+	struct ip_mreq_source	 mrs;
+#endif
+#ifdef INET6
+	struct ipv6_mreq	 mr6;
+	struct group_source_req	 gr;
+#endif
+};
+typedef union mrequnion mrequnion_t;
 
 #define	MAX_ADDRS	20
 #define	STR_SIZE	20
 #define	LINE_LENGTH	80
 
+#ifdef INET
+static int	__ifindex_to_primary_ip(const uint32_t, struct in_addr *);
+#endif
+static uint32_t	parse_cmd_args(sockunion_t *, sockunion_t *,
+		    const char *, const char *, const char *);
+static void	process_file(char *, int, int);
+static void	process_cmd(char*, int, int, FILE *);
+static int	su_cmp(const void *, const void *);
+static void	usage(void);
+
+/*
+ * Ordering predicate for qsort().
+ */
+static int
+su_cmp(const void *a, const void *b)
+{
+	const sockunion_t	*sua = (const sockunion_t *)a;
+	const sockunion_t	*sub = (const sockunion_t *)b;
+
+	assert(sua->sa.sa_family == sub->sa.sa_family);
+
+	switch (sua->sa.sa_family) {
+#ifdef INET
+	case AF_INET:
+		return ((int)(sua->sin.sin_addr.s_addr -
+		    sub->sin.sin_addr.s_addr));
+		break;
+#endif
+#ifdef INET6
+	case AF_INET6:
+		return (memcmp(&sua->sin6.sin6_addr, &sub->sin6.sin6_addr,
+		    sizeof(struct in6_addr)));
+		break;
+#endif
+	default:
+		break;
+	}
+
+	assert(sua->sa.sa_len == sub->sa.sa_len);
+	return (memcmp(sua, sub, sua->sa.sa_len));
+}
+
+#ifdef INET
+/*
+ * Internal: Map an interface index to primary IPv4 address.
+ * This is somewhat inefficient. This is a useful enough operation
+ * that it probably belongs in the C library.
+ * Return zero if found, -1 on error, 1 on not found.
+ */
 static int
-inaddr_cmp(const void *a, const void *b)
+__ifindex_to_primary_ip(const uint32_t ifindex, struct in_addr *pina)
 {
-	return ((int)((const struct in_addr *)a)->s_addr -
-	    ((const struct in_addr *)b)->s_addr);
+	char		 ifname[IFNAMSIZ];
+	struct ifaddrs	*ifa;
+	struct ifaddrs	*ifaddrs;
+	sockunion_t	*psu;
+	int		 retval;
+
+	assert(ifindex != 0);
+
+	retval = -1;
+	if (if_indextoname(ifindex, ifname) == NULL)
+		return (retval);
+	if (getifaddrs(&ifaddrs) < 0)
+		return (retval);
+
+	/*
+	 * Find the ifaddr entry corresponding to the interface name,
+	 * and return the first matching IPv4 address.
+	 */
+	retval = 1;
+	for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
+		if (strcmp(ifa->ifa_name, ifname) != 0)
+			continue;
+		psu = (sockunion_t *)ifa->ifa_addr;
+		if (psu && psu->sa.sa_family == AF_INET) {
+			retval = 0;
+			memcpy(pina, &psu->sin.sin_addr,
+			    sizeof(struct in_addr));
+			break;
+		}
+	}
+
+	if (retval != 0)
+		errno = EADDRNOTAVAIL;	/* XXX */
+
+	freeifaddrs(ifaddrs);
+	return (retval);
 }
+#endif /* INET */
 
 int
 main(int argc, char **argv)
 {
 	char	 line[LINE_LENGTH];
 	char	*p;
-	int	 i, s;
+	int	 i, s, s6;
 
+	s = -1;
+	s6 = -1;
+#ifdef INET
 	s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
 	if (s == -1)
-		err(1, "can't open socket");
+		err(1, "can't open IPv4 socket");
+#endif
+#ifdef INET6
+	s6 = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
+	if (s6 == -1)
+		err(1, "can't open IPv6 socket");
+#endif
 
 	if (argc < 2) {
 		if (isatty(STDIN_FILENO)) {
@@ -89,28 +221,33 @@ main(int argc, char **argv)
 		do {
 			if (fgets(line, sizeof(line), stdin) != NULL) {
 				if (line[0] != 'f')
-					process_cmd(line, s, stdin);
+					process_cmd(line, s, s6, stdin);
 				else {
 					/* Get the filename */
 					for (i = 1; isblank(line[i]); i++);
 					if ((p = (char*)strchr(line, '\n'))
 					    != NULL)
 						*p = '\0';
-					process_file(&line[i], s);
+					process_file(&line[i], s, s6);
 				}
 			}
 		} while (!feof(stdin));
 	} else {
 		for (i = 1; i < argc; i++) {
-			process_file(argv[i], s);
+			process_file(argv[i], s, s6);
 		}
 	}
 
+	if (s != -1)
+		close(s);
+	if (s6 != -1)
+		close(s6);
+
 	exit (0);
 }
 
 static void
-process_file(char *fname, int s)
+process_file(char *fname, int s, int s6)
 {
 	char line[80];
 	FILE *fp;
@@ -128,25 +265,130 @@ process_file(char *fname, int s)
 		while (isblank(*lineptr))
 			lineptr++;
 		if (*lineptr != '#' && *lineptr != '\n')
-			process_cmd(lineptr, s, fp);
+			process_cmd(lineptr, s, s6, fp);
 	}
 
 	fclose(fp);
 }
 
+/*
+ * Parse join/leave/allow/block arguments, given:
+ *  str1: group (as AF_INET or AF_INET6 printable)
+ *  str2: ifname
+ *  str3: optional source address (may be NULL).
+ *   This argument must have the same parsed address family as str1.
+ * Return the ifindex of ifname, or 0 if any parse element failed.
+ */
+static uint32_t
+parse_cmd_args(sockunion_t *psu, sockunion_t *psu2,
+    const char *str1, const char *str2, const char *str3)
+{
+	struct addrinfo		 hints;
+	struct addrinfo		*res;
+	uint32_t		 ifindex;
+	int			 af, error;
+
+	assert(psu != NULL);
+	assert(str1 != NULL);
+	assert(str2 != NULL);
+
+	af = AF_UNSPEC;
+
+	ifindex = if_nametoindex(str2);
+	if (ifindex == 0)
+		return (0);
+
+	memset(&hints, 0, sizeof(struct addrinfo));
+	hints.ai_flags = AI_NUMERICHOST;
+	hints.ai_family = PF_UNSPEC;
+	hints.ai_socktype = SOCK_DGRAM;
+
+	memset(psu, 0, sizeof(sockunion_t));
+	psu->sa.sa_family = AF_UNSPEC;
+
+	error = getaddrinfo(str1, "0", &hints, &res);
+	if (error) {
+		warnx("getaddrinfo: %s", gai_strerror(error));
+		return (0);
+	}
+	assert(res != NULL);
+	af = res->ai_family;
+	memcpy(psu, res->ai_addr, res->ai_addrlen);
+	freeaddrinfo(res);
+
+	/* sscanf() may pass the empty string. */
+	if (psu2 != NULL && str3 != NULL && *str3 != '\0') {
+		memset(psu2, 0, sizeof(sockunion_t));
+		psu2->sa.sa_family = AF_UNSPEC;
+
+		/* look for following address family; str3 is *optional*. */
+		hints.ai_family = af;
+		error = getaddrinfo(str3, "0", &hints, &res);
+		if (error) {
+			warnx("getaddrinfo: %s", gai_strerror(error));
+			ifindex = 0;
+		} else {
+			if (af != res->ai_family) {
+				errno = EINVAL; /* XXX */
+				ifindex = 0;
+			}
+			memcpy(psu2, res->ai_addr, res->ai_addrlen);
+			freeaddrinfo(res);
+		}
+	}
+
+	return (ifindex);
+}
+
+static __inline int
+af2sock(const int af, int s, int s6)
+{
+
+#ifdef INET
+	if (af == AF_INET)
+		return (s);
+#endif
+#ifdef INET6
+	if (af == AF_INET6)
+		return (s6);
+#endif
+	return (-1);
+}
+
+static __inline int
+af2socklen(const int af)
+{
+
+#ifdef INET
+	if (af == AF_INET)
+		return (sizeof(struct sockaddr_in));
+#endif
+#ifdef INET6
+	if (af == AF_INET6)
+		return (sizeof(struct sockaddr_in6));
+#endif
+	return (-1);
+}
+
 static void
-process_cmd(char *cmd, int s, FILE *fp __unused)
+process_cmd(char *cmd, int s, int s6 __unused, FILE *fp __unused)
 {
 	char			 str1[STR_SIZE];
 	char			 str2[STR_SIZE];
 	char			 str3[STR_SIZE];
-	struct in_addr		 sources[MAX_ADDRS];
+	mrequnion_t		 mr;
+	sockunion_t		 su, su2;
 	struct ifreq		 ifr;
-	struct ip_mreq		 imr;
-	struct ip_mreq_source	 imrs;
 	char			*line;
-	uint32_t		 fmode;
-	int			 i, n, opt, f, flags;
+	char			*toptname;
+	void			*optval;
+	uint32_t		 fmode, ifindex;
+	socklen_t		 optlen;
+	int			 af, error, f, flags, i, level, n, optname;
+
+	af = AF_UNSPEC;
+	su.sa.sa_family = AF_UNSPEC;
+	su2.sa.sa_family = AF_UNSPEC;
 
 	line = cmd;
 	while (isblank(*++line))
@@ -173,51 +415,326 @@ process_cmd(char *cmd, int s, FILE *fp _
 	case 'j':
 	case 'l':
 		str3[0] = '\0';
+		toptname = "";
 		sscanf(line, "%s %s %s", str1, str2, str3);
-		if ((imrs.imr_sourceaddr.s_addr = inet_addr(str3)) !=
-		    INADDR_NONE) {
-			/*
-			 * inclusive mode join with source, possibly
-			 * on existing membership.
-			 */
-			if (((imrs.imr_multiaddr.s_addr = inet_addr(str1)) ==
-			    INADDR_NONE) ||
-			    ((imrs.imr_interface.s_addr = inet_addr(str2)) ==
-			    INADDR_NONE)) {
+		ifindex = parse_cmd_args(&su, &su2, str1, str2, str3);
+		if (ifindex == 0) {
+			printf("-1\n");
+			break;
+		}
+		af = su.sa.sa_family;
+#ifdef INET
+		if (af == AF_INET) {
+			struct in_addr ina;
+
+			error = __ifindex_to_primary_ip(ifindex, &ina);
+			if (error != 0) {
+				warn("primary_ip_lookup %s", str2);
 				printf("-1\n");
 				break;
 			}
-			opt = (*cmd == 'j') ? IP_ADD_SOURCE_MEMBERSHIP :
-			    IP_DROP_SOURCE_MEMBERSHIP;
-			if (setsockopt( s, IPPROTO_IP, opt, &imrs,
-			    sizeof(imrs)) != 0) {
-				warn("setsockopt %s", (*cmd == 'j') ?
+			level = IPPROTO_IP;
+
+			if (su2.sa.sa_family != AF_UNSPEC) {
+				mr.mrs.imr_multiaddr = su.sin.sin_addr;
+				mr.mrs.imr_sourceaddr = su2.sin.sin_addr;
+				mr.mrs.imr_interface = ina;
+				optname = (*cmd == 'j') ?
+				    IP_ADD_SOURCE_MEMBERSHIP :
+				    IP_DROP_SOURCE_MEMBERSHIP;
+				toptname = (*cmd == 'j') ?
 				    "IP_ADD_SOURCE_MEMBERSHIP" :
-				    "IP_DROP_SOURCE_MEMBERSHIP");
+				    "IP_DROP_SOURCE_MEMBERSHIP";
+				optval = (void *)&mr.mrs;
+				optlen = sizeof(mr.mrs);
 			} else {
+				mr.mr.imr_multiaddr = su.sin.sin_addr;
+				mr.mr.imr_interface = ina;
+				optname = (*cmd == 'j') ?
+				    IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP;
+				toptname = (*cmd == 'j') ?
+				    "IP_ADD_MEMBERSHIP" : "IP_DROP_MEMBERSHIP";
+				optval = (void *)&mr.mr;
+				optlen = sizeof(mr.mr);
+			}
+			if (setsockopt(s, level, optname, optval,
+			    optlen) == 0) {
 				printf("ok\n");
+				break;
+			} else {
+				warn("setsockopt %s", toptname);
 			}
-		} else {
-			/* exclusive mode join w/o source. */
-			if (((imr.imr_multiaddr.s_addr = inet_addr(str1)) ==
-			    INADDR_NONE) ||
-			    ((imr.imr_interface.s_addr = inet_addr(str2)) ==
-			    INADDR_NONE)) {
+		}
+#ifdef INET6
+		else
+#endif /* INET with INET6 */
+#endif /* INET */
+#ifdef INET6
+		if (af == AF_INET6) {
+			level = IPPROTO_IPV6;
+			if (su2.sa.sa_family != AF_UNSPEC) {
+				mr.gr.gsr_interface = ifindex;
+				mr.gr.gsr_group = su.ss;
+				mr.gr.gsr_source = su2.ss;
+				optname = (*cmd == 'j') ?
+				    MCAST_JOIN_SOURCE_GROUP:
+				    MCAST_LEAVE_SOURCE_GROUP;
+				toptname = (*cmd == 'j') ?
+				    "MCAST_JOIN_SOURCE_GROUP":
+				    "MCAST_LEAVE_SOURCE_GROUP";
+				optval = (void *)&mr.gr;
+				optlen = sizeof(mr.gr);
+			} else {
+				mr.mr6.ipv6mr_multiaddr = su.sin6.sin6_addr;
+				mr.mr6.ipv6mr_interface = ifindex;
+				optname = (*cmd == 'j') ?
+				    IPV6_JOIN_GROUP :
+				    IPV6_LEAVE_GROUP;
+				toptname = (*cmd == 'j') ?
+				    "IPV6_JOIN_GROUP" :
+				    "IPV6_LEAVE_GROUP";
+				optval = (void *)&mr.mr6;
+				optlen = sizeof(mr.mr6);
+			}
+			if (setsockopt(s6, level, optname, optval,
+			    optlen) == 0) {
+				printf("ok\n");
+				break;
+			} else {
+				warn("setsockopt %s", toptname);
+			}
+		}
+#endif /* INET6 */
+		/* FALLTHROUGH */
+		printf("-1\n");
+		break;
+
+	/*
+	 * Set the socket to include or exclude filter mode, and
+	 * add some sources to the filterlist, using the full-state API.
+	 */
+	case 'i':
+	case 'e': {
+		sockunion_t	 sources[MAX_ADDRS];
+		struct addrinfo	 hints;
+		struct addrinfo	*res;
+		char		*cp;
+		int		 af1;
+
+		n = 0;
+		fmode = (*cmd == 'i') ? MCAST_INCLUDE : MCAST_EXCLUDE;
+		if ((sscanf(line, "%s %s %d", str1, str2, &n)) != 3) {
+			printf("-1\n");
+			break;
+		}
+
+		ifindex = parse_cmd_args(&su, NULL, str1, str2, NULL);
+		if (ifindex == 0 || n < 0 || n > MAX_ADDRS) {
+			printf("-1\n");
+			break;
+		}
+		af = su.sa.sa_family;
+
+		memset(&hints, 0, sizeof(struct addrinfo));
+		hints.ai_flags = AI_NUMERICHOST;
+		hints.ai_family = af;
+		hints.ai_socktype = SOCK_DGRAM;
+
+		for (i = 0; i < n; i++) {
+			sockunion_t *psu = (sockunion_t *)&sources[i];
+			/*
+			 * Trim trailing whitespace, as getaddrinfo()
+			 * can't cope with it.
+			 */
+			fgets(str1, sizeof(str1), fp);
+			cp = strchr(str1, '\n');
+			if (cp != NULL)
+				*cp = '\0';
+
+			res = NULL;
+			error = getaddrinfo(str1, "0", &hints, &res);
+			if (error)
+				break;
+			assert(res != NULL);
+
+			memset(psu, 0, sizeof(sockunion_t));
+			af1 = res->ai_family;
+			if (af1 == af)
+				memcpy(psu, res->ai_addr, res->ai_addrlen);
+			freeaddrinfo(res);
+			if (af1 != af)
+				break;
+		}
+		if (i < n) {
+			if (error)
+				warnx("getaddrinfo: %s", gai_strerror(error));
+			printf("-1\n");
+			break;
+		}
+		if (setsourcefilter(af2sock(af, s, s6), ifindex,
+		    &su.sa, su.sa.sa_len, fmode, n, &sources[0].ss) != 0)
+			warn("setsourcefilter");
+		else
+			printf("ok\n");
+	} break;
+
+	/*
+	 * Allow or block traffic from a source, using the
+	 * delta based api.
+	 */
+	case 't':
+	case 'b': {
+		str3[0] = '\0';
+		toptname = "";
+		sscanf(line, "%s %s %s", str1, str2, str3);
+		ifindex = parse_cmd_args(&su, &su2, str1, str2, str3);
+		if (ifindex == 0 || su2.sa.sa_family == AF_UNSPEC) {
+			printf("-1\n");
+			break;
+		}
+		af = su.sa.sa_family;
+
+		/* First determine our current filter mode. */
+		n = 0;
+		if (getsourcefilter(af2sock(af, s, s6), ifindex,
+		    &su.sa, su.sa.sa_len, &fmode, &n, NULL) != 0) {
+			warn("getsourcefilter");
+			break;
+		}
+#ifdef INET
+		if (af == AF_INET) {
+			struct in_addr ina;
+
+			error = __ifindex_to_primary_ip(ifindex, &ina);
+			if (error != 0) {
+				warn("primary_ip_lookup %s", str2);
 				printf("-1\n");
 				break;
 			}
-			opt = (*cmd == 'j') ? IP_ADD_MEMBERSHIP :
-			    IP_DROP_MEMBERSHIP;
-			if (setsockopt( s, IPPROTO_IP, opt, &imr,
-			    sizeof(imr)) != 0) {
-				warn("setsockopt %s", (*cmd == 'j') ?
-				    "IP_ADD_MEMBERSHIP" :
-				    "IP_DROP_MEMBERSHIP");
+			level = IPPROTO_IP;
+			optval = (void *)&mr.mrs;
+			optlen = sizeof(mr.mrs);
+			mr.mrs.imr_multiaddr = su.sin.sin_addr;
+			mr.mrs.imr_sourceaddr = su2.sin.sin_addr;
+			mr.mrs.imr_interface = ina;
+			if (fmode == MCAST_EXCLUDE) {
+				/* Any-source mode socket membership. */
+				optname = (*cmd == 't') ?
+				    IP_UNBLOCK_SOURCE :
+				    IP_BLOCK_SOURCE;
+				toptname = (*cmd == 't') ?
+				    "IP_UNBLOCK_SOURCE" :
+				    "IP_BLOCK_SOURCE";
 			} else {
+				/* Source-specific mode socket membership. */
+				optname = (*cmd == 't') ?
+				    IP_ADD_SOURCE_MEMBERSHIP :
+				    IP_DROP_SOURCE_MEMBERSHIP;
+				toptname = (*cmd == 't') ?
+				    "IP_ADD_SOURCE_MEMBERSHIP" :
+				    "IP_DROP_SOURCE_MEMBERSHIP";
+			}
+			if (setsockopt(s, level, optname, optval,
+			    optlen) == 0) {
 				printf("ok\n");
+				break;
+			} else {
+				warn("setsockopt %s", toptname);
 			}
 		}
-		break;
+#ifdef INET6
+		else
+#endif /* INET with INET6 */
+#endif /* INET */
+#ifdef INET6
+		if (af == AF_INET6) {
+			level = IPPROTO_IPV6;
+			mr.gr.gsr_interface = ifindex;
+			mr.gr.gsr_group = su.ss;
+			mr.gr.gsr_source = su2.ss;
+			if (fmode == MCAST_EXCLUDE) {
+				/* Any-source mode socket membership. */
+				optname = (*cmd == 't') ?
+				    MCAST_UNBLOCK_SOURCE :
+				    MCAST_BLOCK_SOURCE;
+				toptname = (*cmd == 't') ?
+				    "MCAST_UNBLOCK_SOURCE" :
+				    "MCAST_BLOCK_SOURCE";
+			} else {
+				/* Source-specific mode socket membership. */
+				optname = (*cmd == 't') ?
+				    MCAST_JOIN_SOURCE_GROUP :
+				    MCAST_LEAVE_SOURCE_GROUP;
+				toptname = (*cmd == 't') ?
+				    "MCAST_JOIN_SOURCE_GROUP":
+				    "MCAST_LEAVE_SOURCE_GROUP";
+			}
+			optval = (void *)&mr.gr;
+			optlen = sizeof(mr.gr);
+			if (setsockopt(s6, level, optname, optval,
+			    optlen) == 0) {
+				printf("ok\n");
+				break;
+			} else {
+				warn("setsockopt %s", toptname);
+			}
+		}
+#endif /* INET6 */
+		/* FALLTHROUGH */
+		printf("-1\n");
+	} break;
+
+	case 'g': {
+		sockunion_t	 sources[MAX_ADDRS];
+		char		 addrbuf[NI_MAXHOST];
+		int		 nreqsrc, nsrc;
+
+		if ((sscanf(line, "%s %s %d", str1, str2, &nreqsrc)) != 3) {
+			printf("-1\n");
+			break;
+		}
+		ifindex = parse_cmd_args(&su, NULL, str1, str2, NULL);
+		if (ifindex == 0 || (n < 0 || n > MAX_ADDRS)) {
+			printf("-1\n");
+			break;
+		}
+
+		af = su.sa.sa_family;
+		nsrc = nreqsrc;
+		if (getsourcefilter(af2sock(af, s, s6), ifindex, &su.sa,
+		    su.sa.sa_len, &fmode, &nsrc, &sources[0].ss) != 0) {
+			warn("getsourcefilter");
+			printf("-1\n");
+			break;
+		}
+		printf("%s\n", (fmode == MCAST_INCLUDE) ? "include" :
+		    "exclude");
+		printf("%d\n", nsrc);
+
+		nsrc = MIN(nreqsrc, nsrc);
+		fprintf(stderr, "hexdump of sources:\n");
+		uint8_t *bp = (uint8_t *)&sources[0];
+		for (i = 0; i < (nsrc * sizeof(sources[0])); i++) {
+			fprintf(stderr, "%02x", bp[i]);
+		}
+		fprintf(stderr, "\nend hexdump\n");
+
+		qsort(sources, nsrc, af2socklen(af), su_cmp);
+		for (i = 0; i < nsrc; i++) {
+			sockunion_t *psu = (sockunion_t *)&sources[i];
+			addrbuf[0] = '\0';
+			error = getnameinfo(&psu->sa, psu->sa.sa_len,
+			    addrbuf, sizeof(addrbuf), NULL, 0,
+			    NI_NUMERICHOST);
+			if (error)
+				warnx("getnameinfo: %s", gai_strerror(error));
+			else
+				printf("%s\n", addrbuf);
+		}
+		printf("ok\n");
+	} break;
+
+	/* link-layer stuff follows. */
 
 	case 'a':
 	case 'd': {
@@ -244,16 +761,19 @@ process_cmd(char *cmd, int s, FILE *fp _
 		strlcpy(ifr.ifr_name, str1, IF_NAMESIZE);
 		memcpy(LLADDR(dlp), ep, ETHER_ADDR_LEN);
 		if (ioctl(s, (*cmd == 'a') ? SIOCADDMULTI : SIOCDELMULTI,
-		    &ifr) == -1)
+		    &ifr) == -1) {
 			warn("ioctl SIOCADDMULTI/SIOCDELMULTI");
-		else
+			printf("-1\n");
+		} else
 			printf("ok\n");
 		break;
 	}
 
 	case 'm':
-		printf("warning: IFF_ALLMULTI cannot be set from userland "
+		fprintf(stderr,
+		    "warning: IFF_ALLMULTI cannot be set from userland "
 		    "in FreeBSD; command ignored.\n");
+		printf("-1\n");
 		break;
 
 	case 'p':
@@ -266,11 +786,10 @@ process_cmd(char *cmd, int s, FILE *fp _
 			break;
 		}
 		flags = (ifr.ifr_flags & 0xffff) | (ifr.ifr_flagshigh << 16);
-		opt = IFF_PPROMISC;
 		if (f == 0) {
-			flags &= ~opt;
+			flags &= ~IFF_PPROMISC;
 		} else {
-			flags |= opt;
+			flags |= IFF_PPROMISC;
 		}
 		ifr.ifr_flags = flags & 0xffff;
 		ifr.ifr_flagshigh = flags >> 16;
@@ -280,106 +799,6 @@ process_cmd(char *cmd, int s, FILE *fp _
 			printf( "changed to 0x%08x\n", flags );
 		break;
 

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

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 09:52:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6F64F1065676;
	Wed, 29 Apr 2009 09:52:04 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5E3CE8FC19;
	Wed, 29 Apr 2009 09:52:04 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3T9q4Aq075422;
	Wed, 29 Apr 2009 09:52:04 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3T9q4jn075421;
	Wed, 29 Apr 2009 09:52:04 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904290952.n3T9q4jn075421@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 09:52:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191652 - head/usr.bin/netstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 09:52:05 -0000

Author: bms
Date: Wed Apr 29 09:52:04 2009
New Revision: 191652
URL: http://svn.freebsd.org/changeset/base/191652

Log:
  Add MLDv2 statistic IDs to netstat for IPv6 stack.

Modified:
  head/usr.bin/netstat/inet6.c

Modified: head/usr.bin/netstat/inet6.c
==============================================================================
--- head/usr.bin/netstat/inet6.c	Wed Apr 29 09:50:04 2009	(r191651)
+++ head/usr.bin/netstat/inet6.c	Wed Apr 29 09:52:04 2009	(r191652)
@@ -711,8 +711,8 @@ static	const char *icmp6names[] = {
 	"echo",
 	"echo reply",
 	"multicast listener query",
-	"multicast listener report",
-	"multicast listener done",
+	"MLDv1 listener report",
+	"MLDv1 listener done",
 	"router solicitation",
 	"router advertisement",
 	"neighbor solicitation",
@@ -723,7 +723,7 @@ static	const char *icmp6names[] = {
 	"node information reply",
 	"inverse neighbor solicitation",
 	"inverse neighbor advertisement",
-	"#143",
+	"MLDv2 listener report",
 	"#144",
 	"#145",
 	"#146",

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 09:54:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 44456106566C;
	Wed, 29 Apr 2009 09:54:34 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 198418FC1A;
	Wed, 29 Apr 2009 09:54:34 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3T9sX21075499;
	Wed, 29 Apr 2009 09:54:33 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3T9sXK6075498;
	Wed, 29 Apr 2009 09:54:33 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904290954.n3T9sXK6075498@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 09:54:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191653 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 09:54:34 -0000

Author: bms
Date: Wed Apr 29 09:54:33 2009
New Revision: 191653
URL: http://svn.freebsd.org/changeset/base/191653

Log:
  Grab KTR_SPARE1 and KTR_SPARE5 for KTR_INET and KTR_INET6
  respectively, as placeholder for future use of CTR() by
  the networking code (MLDv2 will be going in shortly).
  Mark KTR_SPARE* as being used in fact by cxgb (picked up
  on a 'make universe' run).

Modified:
  head/sys/sys/ktr.h

Modified: head/sys/sys/ktr.h
==============================================================================
--- head/sys/sys/ktr.h	Wed Apr 29 09:52:04 2009	(r191652)
+++ head/sys/sys/ktr.h	Wed Apr 29 09:54:33 2009	(r191653)
@@ -55,24 +55,24 @@
 #define	KTR_TRAP	0x00000100		/* Trap processing */
 #define	KTR_INTR	0x00000200		/* Interrupt tracing */
 #define	KTR_SIG		0x00000400		/* Signal processing */
-#define	KTR_SPARE2	0x00000800		/* Unused */
+#define	KTR_SPARE2	0x00000800		/* XXX Used by cxgb */
 #define	KTR_PROC	0x00001000		/* Process scheduling */
 #define	KTR_SYSC	0x00002000		/* System call */
 #define	KTR_INIT	0x00004000		/* System initialization */
-#define	KTR_SPARE3	0x00008000		/* Unused */
-#define	KTR_SPARE4	0x00010000		/* Unused */
+#define	KTR_SPARE3	0x00008000		/* XXX Used by cxgb */
+#define	KTR_SPARE4	0x00010000		/* XXX Used by cxgb */
 #define	KTR_EVH		0x00020000		/* Eventhandler */
 #define	KTR_VFS		0x00040000		/* VFS events */
 #define	KTR_VOP		0x00080000		/* Auto-generated vop events */
 #define	KTR_VM		0x00100000		/* The virtual memory system */
-#define	KTR_SPARE1	0x00200000		/* Unused */
+#define	KTR_INET	0x00200000		/* IPv4 stack */
 #define	KTR_RUNQ	0x00400000		/* Run queue */
 #define	KTR_CONTENTION	0x00800000		/* Lock contention */
 #define	KTR_UMA		0x01000000		/* UMA slab allocator */
 #define	KTR_CALLOUT	0x02000000		/* Callouts and timeouts */
 #define	KTR_GEOM	0x04000000		/* GEOM I/O events */
 #define	KTR_BUSDMA	0x08000000		/* busdma(9) events */
-#define	KTR_SPARE5	0x10000000		/* Unused */
+#define	KTR_INET6	0x10000000		/* IPv6 stack */
 #define	KTR_SCHED	0x20000000		/* Machine parsed sched info. */
 #define	KTR_BUF		0x40000000		/* Buffer cache */
 #define	KTR_ALL		0x7fffffff

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 09:58:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5C3DE106564A;
	Wed, 29 Apr 2009 09:58:31 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4AB758FC1B;
	Wed, 29 Apr 2009 09:58:31 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3T9wV4n075617;
	Wed, 29 Apr 2009 09:58:31 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3T9wVdI075616;
	Wed, 29 Apr 2009 09:58:31 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904290958.n3T9wVdI075616@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 09:58:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191654 - head/lib/libc/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 09:58:31 -0000

Author: bms
Date: Wed Apr 29 09:58:31 2009
New Revision: 191654
URL: http://svn.freebsd.org/changeset/base/191654

Log:
  Fix an obvious bug in getsourcefilter()'s use of struct __msfilterreq;
  the kernel will return in msfr_nsrcs the number of source filters
  in-mode for a given multicast group.
  However, the filters themselves were never copied out, as the libc
  function clobbers this field with zero, causing the kernel to assume
  the provided vector of struct sockaddr_storage has zero length.
  This bug would only affect users of SSM multicast, which is shimmed
  in 7.x.
  Picked up during mtest(8) refactoring.
  
  MFC after:	1 day

Modified:
  head/lib/libc/net/sourcefilter.c

Modified: head/lib/libc/net/sourcefilter.c
==============================================================================
--- head/lib/libc/net/sourcefilter.c	Wed Apr 29 09:54:33 2009	(r191653)
+++ head/lib/libc/net/sourcefilter.c	Wed Apr 29 09:58:31 2009	(r191654)
@@ -337,7 +337,7 @@ getsourcefilter(int s, uint32_t interfac
 {
 	struct __msfilterreq	 msfr;
 	sockunion_t		*psu;
-	int			 err, level, optlen, optname;
+	int			 err, level, nsrcs, optlen, optname;
 
 	if (interface == 0 || group == NULL || numsrc == NULL ||
 	    fmode == NULL) {
@@ -345,6 +345,7 @@ getsourcefilter(int s, uint32_t interfac
 		return (-1);
 	}
 
+	nsrcs = *numsrc;
 	*numsrc = 0;
 	*fmode = 0;
 
@@ -382,7 +383,7 @@ getsourcefilter(int s, uint32_t interfac
 	memset(&msfr, 0, optlen);
 	msfr.msfr_ifindex = interface;
 	msfr.msfr_fmode = 0;
-	msfr.msfr_nsrcs = *numsrc;
+	msfr.msfr_nsrcs = nsrcs;
 	memcpy(&msfr.msfr_group, &psu->ss, psu->ss.ss_len);
 
 	/*

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 09:59:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 92F3E106566C;
	Wed, 29 Apr 2009 09:59:34 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 67CE48FC15;
	Wed, 29 Apr 2009 09:59:34 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3T9xYod075672;
	Wed, 29 Apr 2009 09:59:34 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3T9xYMS075671;
	Wed, 29 Apr 2009 09:59:34 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904290959.n3T9xYMS075671@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 09:59:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191655 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 09:59:35 -0000

Author: bms
Date: Wed Apr 29 09:59:34 2009
New Revision: 191655
URL: http://svn.freebsd.org/changeset/base/191655

Log:
  Grab a VIMAGE module ID for MLDv2.

Modified:
  head/sys/sys/vimage.h

Modified: head/sys/sys/vimage.h
==============================================================================
--- head/sys/sys/vimage.h	Wed Apr 29 09:58:31 2009	(r191654)
+++ head/sys/sys/vimage.h	Wed Apr 29 09:59:34 2009	(r191655)
@@ -91,6 +91,7 @@ struct vnet_modlink {
 #define	VNET_MOD_ATALK		10
 #define	VNET_MOD_ACCF_HTTP	11
 #define	VNET_MOD_IGMP		12
+#define	VNET_MOD_MLD		13
 
 /* stateless modules */
 #define	VNET_MOD_NG_ETHER	20

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 10:02:50 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BC4BB1065689;
	Wed, 29 Apr 2009 10:02: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 9017A8FC18;
	Wed, 29 Apr 2009 10:02:50 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TA2o3O075831;
	Wed, 29 Apr 2009 10:02:50 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TA2orn075828;
	Wed, 29 Apr 2009 10:02:50 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200904291002.n3TA2orn075828@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Wed, 29 Apr 2009 10:02:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191656 - in head/sbin: geom/class/journal newfs tunefs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 10:02:51 -0000

Author: trasz
Date: Wed Apr 29 10:02:50 2009
New Revision: 191656
URL: http://svn.freebsd.org/changeset/base/191656

Log:
  Slightly improve gjournal documentation.
  
  Reviewed by:	pjd

Modified:
  head/sbin/geom/class/journal/gjournal.8
  head/sbin/newfs/newfs.8
  head/sbin/tunefs/tunefs.8

Modified: head/sbin/geom/class/journal/gjournal.8
==============================================================================
--- head/sbin/geom/class/journal/gjournal.8	Wed Apr 29 09:59:34 2009	(r191655)
+++ head/sbin/geom/class/journal/gjournal.8	Wed Apr 29 10:02:50 2009	(r191656)
@@ -162,7 +162,8 @@ Hardcode provider names in metadata.
 Specifies size of the journal if only one provider is used for both data and
 journal.
 The default is one gigabyte.
-Size should be chosen based on provider's load, and not on its size.
+Size should be chosen based on provider's load, and not on its size;
+recommended minimum is twice the size of the physical memory installed.
 It is not recommended to use
 .Nm
 for small file systems (e.g.: only few gigabytes big).

Modified: head/sbin/newfs/newfs.8
==============================================================================
--- head/sbin/newfs/newfs.8	Wed Apr 29 09:59:34 2009	(r191655)
+++ head/sbin/newfs/newfs.8	Wed Apr 29 10:02:50 2009	(r191656)
@@ -85,6 +85,9 @@ wear levelling algorithms.
 NB: Erasing may take as long time as writing every sector on the disk.
 .It Fl J
 Enable journaling on the new file system via gjournal.
+See
+.Xr gjournal 8
+for details.
 .It Fl L Ar volname
 Add a volume label to the new file system.
 .It Fl N
@@ -278,6 +281,7 @@ on file systems that contain many small 
 .Xr dump 8 ,
 .Xr dumpfs 8 ,
 .Xr fsck 8 ,
+.Xr gjournal 8 ,
 .Xr mount 8 ,
 .Xr tunefs 8 ,
 .Xr gvinum 8

Modified: head/sbin/tunefs/tunefs.8
==============================================================================
--- head/sbin/tunefs/tunefs.8	Wed Apr 29 09:59:34 2009	(r191655)
+++ head/sbin/tunefs/tunefs.8	Wed Apr 29 10:02:50 2009	(r191656)
@@ -89,7 +89,7 @@ this parameter should be set higher.
 .It Fl f Ar avgfilesize
 Specify the expected average file size.
 .It Fl J Cm enable | disable
-Turn on/off GJournal flag.
+Turn on/off gjournal flag.
 .It Fl L Ar volname
 Add/modify an optional file system volume label.
 .It Fl l Cm enable | disable
@@ -145,6 +145,7 @@ specified mount point.
 .Sh SEE ALSO
 .Xr fs 5 ,
 .Xr dumpfs 8 ,
+.Xr gjournal 8 ,
 .Xr newfs 8
 .Rs
 .%A M. McKusick

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 10:12:01 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF3E2106564A;
	Wed, 29 Apr 2009 10:12:01 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CDA0C8FC20;
	Wed, 29 Apr 2009 10:12:01 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TAC1B2076042;
	Wed, 29 Apr 2009 10:12:01 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TAC1rd076041;
	Wed, 29 Apr 2009 10:12:01 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291012.n3TAC1rd076041@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 10:12:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191657 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 10:12:02 -0000

Author: bms
Date: Wed Apr 29 10:12:01 2009
New Revision: 191657
URL: http://svn.freebsd.org/changeset/base/191657

Log:
  Fix a problem whereby enqueued IGMPv3 filter list changes would be
  incorrectly output, if the RB-tree enumeration happened to reuse the
  same chain for a mode switch: that is, both ALLOW and BLOCK records
  were appended for the same group, in the same mbuf packet chain.
  
  This was introduced during an mbuf chain layout bug fix involving
  m_getptr(), which obviously cannot count from offset 0 on the
  second pass through the RB-tree when serializing the IGMPv3
  group records into the pending mbuf chain.
  
  Cut over to KTR_INET for IGMPv3 CTR usage.

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==============================================================================
--- head/sys/netinet/igmp.c	Wed Apr 29 10:02:50 2009	(r191656)
+++ head/sys/netinet/igmp.c	Wed Apr 29 10:12:01 2009	(r191657)
@@ -86,7 +86,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #ifndef KTR_IGMPV3
-#define KTR_IGMPV3 KTR_SUBSYS
+#define KTR_IGMPV3 KTR_INET
 #endif
 
 static struct igmp_ifinfo *
@@ -2983,7 +2983,7 @@ igmp_v3_enqueue_filter_change(struct ifq
 	struct ip_msource	*ims, *nims;
 	struct mbuf		*m, *m0, *md;
 	in_addr_t		 naddr;
-	int			 m0srcs, nbytes, off, rsrcs, schanged;
+	int			 m0srcs, nbytes, npbytes, off, rsrcs, schanged;
 	int			 nallow, nblock;
 	uint8_t			 mode, now, then;
 	rectype_t		 crt, drt, nrt;
@@ -3001,6 +3001,7 @@ igmp_v3_enqueue_filter_change(struct ifq
 	nrt = REC_NONE;	/* record type for current node */
 	m0srcs = 0;	/* # source which will fit in current mbuf chain */
 	nbytes = 0;	/* # of bytes appended to group's state-change queue */
+	npbytes = 0;	/* # of bytes appended this packet */
 	rsrcs = 0;	/* # sources encoded in current record */
 	schanged = 0;	/* # nodes encoded in overall filter change */
 	nallow = 0;	/* # of source entries in ALLOW_NEW */
@@ -3047,6 +3048,7 @@ igmp_v3_enqueue_filter_change(struct ifq
 				m0srcs = (ifp->if_mtu - IGMP_LEADINGSPACE -
 				    sizeof(struct igmp_grouprec)) /
 				    sizeof(in_addr_t);
+				npbytes = 0;
 				CTR1(KTR_IGMPV3,
 				    "%s: allocated new packet", __func__);
 			}
@@ -3066,15 +3068,19 @@ igmp_v3_enqueue_filter_change(struct ifq
 				    "%s: m_append() failed", __func__);
 				return (-ENOMEM);
 			}
-			nbytes += sizeof(struct igmp_grouprec);
-			if (m == m0) {
-				md = m_last(m);
+			npbytes += sizeof(struct igmp_grouprec);
+			if (m != m0) {
+				/* new packet; offset in c hain */
+				md = m_getptr(m, npbytes -
+				    sizeof(struct igmp_grouprec), &off);
 				pig = (struct igmp_grouprec *)(mtod(md,
-				    uint8_t *) + md->m_len - nbytes);
+				    uint8_t *) + off);
 			} else {
-				md = m_getptr(m, 0, &off);
+				/* current packet; offset from last append */
+				md = m_last(m);
 				pig = (struct igmp_grouprec *)(mtod(md,
-				    uint8_t *) + off);
+				    uint8_t *) + md->m_len -
+				    sizeof(struct igmp_grouprec));
 			}
 			/*
 			 * Begin walking the tree for this record type
@@ -3133,7 +3139,7 @@ igmp_v3_enqueue_filter_change(struct ifq
 			 * pass, back out of allocations.
 			 */
 			if (rsrcs == 0) {
-				nbytes -= sizeof(struct igmp_grouprec);
+				npbytes -= sizeof(struct igmp_grouprec);
 				if (m != m0) {
 					CTR1(KTR_IGMPV3,
 					    "%s: m_free(m)", __func__);
@@ -3146,7 +3152,7 @@ igmp_v3_enqueue_filter_change(struct ifq
 				}
 				continue;
 			}
-			nbytes += (rsrcs * sizeof(in_addr_t));
+			npbytes += (rsrcs * sizeof(in_addr_t));
 			if (crt == REC_ALLOW)
 				pig->ig_type = IGMP_ALLOW_NEW_SOURCES;
 			else if (crt == REC_BLOCK)
@@ -3159,6 +3165,7 @@ igmp_v3_enqueue_filter_change(struct ifq
 			m->m_pkthdr.PH_vt.vt_nrecs++;
 			if (m != m0)
 				_IF_ENQUEUE(ifq, m);
+			nbytes += npbytes;
 		} while (nims != NULL);
 		drt |= crt;
 		crt = (~crt & REC_FULL);

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 10:13:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2FA7C1065670;
	Wed, 29 Apr 2009 10:13:23 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1E74E8FC0C;
	Wed, 29 Apr 2009 10:13:23 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TADN31076099;
	Wed, 29 Apr 2009 10:13:23 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TADNHi076098;
	Wed, 29 Apr 2009 10:13:23 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291013.n3TADNHi076098@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 10:13:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191658 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 10:13:23 -0000

Author: bms
Date: Wed Apr 29 10:13:22 2009
New Revision: 191658
URL: http://svn.freebsd.org/changeset/base/191658

Log:
  Do not assume that ip6_moptions is always set, it is
  a lazy-allocated structure.

Modified:
  head/sys/netinet/in_pcb.c

Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c	Wed Apr 29 10:12:01 2009	(r191657)
+++ head/sys/netinet/in_pcb.c	Wed Apr 29 10:13:22 2009	(r191658)
@@ -927,7 +927,8 @@ in_pcbfree_internal(struct inpcb *inp)
 #ifdef INET6
 	if (inp->inp_vflag & INP_IPV6PROTO) {
 		ip6_freepcbopts(inp->in6p_outputopts);
-		ip6_freemoptions(inp->in6p_moptions);
+		if (inp->in6p_moptions != NULL)
+			ip6_freemoptions(inp->in6p_moptions);
 	}
 #endif
 	if (inp->inp_options)

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 10:14:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A03C71065677;
	Wed, 29 Apr 2009 10:14:16 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8EDB48FC1F;
	Wed, 29 Apr 2009 10:14:16 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TAEGE0076149;
	Wed, 29 Apr 2009 10:14:16 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TAEGeh076148;
	Wed, 29 Apr 2009 10:14:16 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291014.n3TAEGeh076148@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 10:14:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191659 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 10:14:17 -0000

Author: bms
Date: Wed Apr 29 10:14:16 2009
New Revision: 191659
URL: http://svn.freebsd.org/changeset/base/191659

Log:
  Cut over to KTR_INET for CTR.
  For clarity, put pointer incremement/size decrement on own line
  when copying out in-mode source filters to userland.

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c	Wed Apr 29 10:13:22 2009	(r191658)
+++ head/sys/netinet/in_mcast.c	Wed Apr 29 10:14:16 2009	(r191659)
@@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #ifndef KTR_IGMPV3
-#define KTR_IGMPV3 KTR_SUBSYS
+#define KTR_IGMPV3 KTR_INET
 #endif
 
 #ifndef __SOCKUNION_DECLARED
@@ -1647,11 +1647,14 @@ inp_get_source_filters(struct inpcb *inp
 		    lims->imsl_st[0] != imf->imf_st[0])
 			continue;
 		++ncsrcs;
-		if (tss != NULL && nsrcs-- > 0) {
-			psin = (struct sockaddr_in *)ptss++;
+		if (tss != NULL && nsrcs > 0) {
+			psin = (struct sockaddr_in *)ptss;
 			psin->sin_family = AF_INET;
 			psin->sin_len = sizeof(struct sockaddr_in);
 			psin->sin_addr.s_addr = htonl(lims->ims_haddr);
+			psin->sin_port = 0;
+			++ptss;
+			--nsrcs;
 		}
 	}
 

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 10:17:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46DB9106566B;
	Wed, 29 Apr 2009 10:17:09 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 35A548FC12;
	Wed, 29 Apr 2009 10:17:09 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TAH92w076247;
	Wed, 29 Apr 2009 10:17:09 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TAH986076246;
	Wed, 29 Apr 2009 10:17:09 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291017.n3TAH986076246@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 10:17:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191660 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 10:17:09 -0000

Author: bms
Date: Wed Apr 29 10:17:08 2009
New Revision: 191660
URL: http://svn.freebsd.org/changeset/base/191660

Log:
  Use KTR_INET for MROUTING CTRs.

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==============================================================================
--- head/sys/netinet/ip_mroute.c	Wed Apr 29 10:14:16 2009	(r191659)
+++ head/sys/netinet/ip_mroute.c	Wed Apr 29 10:17:08 2009	(r191660)
@@ -119,7 +119,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #ifndef KTR_IPMF
-#define KTR_IPMF KTR_SUBSYS
+#define KTR_IPMF KTR_INET
 #endif
 
 #define		VIFI_INVALID	((vifi_t) -1)

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 10:20:18 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 54201106564A;
	Wed, 29 Apr 2009 10:20:18 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 42EA18FC15;
	Wed, 29 Apr 2009 10:20:18 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TAKI2q076340;
	Wed, 29 Apr 2009 10:20:18 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TAKIVx076339;
	Wed, 29 Apr 2009 10:20:18 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291020.n3TAKIVx076339@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 10:20:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191661 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 10:20:18 -0000

Author: bms
Date: Wed Apr 29 10:20:17 2009
New Revision: 191661
URL: http://svn.freebsd.org/changeset/base/191661

Log:
  Add MLDv2 prototypes and defines.

Modified:
  head/sys/netinet/icmp6.h

Modified: head/sys/netinet/icmp6.h
==============================================================================
--- head/sys/netinet/icmp6.h	Wed Apr 29 10:17:08 2009	(r191660)
+++ head/sys/netinet/icmp6.h	Wed Apr 29 10:20:17 2009	(r191661)
@@ -125,6 +125,7 @@ struct icmp6_hdr {
 #define ICMP6_FQDN_REPLY		140	/* FQDN reply */
 #define ICMP6_NI_QUERY			139	/* node information request */
 #define ICMP6_NI_REPLY			140	/* node information reply */
+#define MLDV2_LISTENER_REPORT		143	/* RFC3810 listener report */
 
 /* The definitions below are experimental. TBA */
 #define MLD_MTRACE_RESP			200	/* mtrace resp (to sender) */
@@ -194,6 +195,8 @@ struct mld_hdr {
 #define mld_cksum	mld_icmp6_hdr.icmp6_cksum
 #define mld_maxdelay	mld_icmp6_hdr.icmp6_data16[0]
 #define mld_reserved	mld_icmp6_hdr.icmp6_data16[1]
+#define mld_v2_reserved	mld_icmp6_hdr.icmp6_data16[0]
+#define mld_v2_numrecs	mld_icmp6_hdr.icmp6_data16[1]
 
 /*
  * Neighbor Discovery
@@ -644,6 +647,7 @@ void	icmp6_error(struct mbuf *, int, int
 void	icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
 int	icmp6_input(struct mbuf **, int *, int);
 void	icmp6_fasttimo(void);
+void	icmp6_slowtimo(void);
 void	icmp6_reflect(struct mbuf *, size_t);
 void	icmp6_prepare(struct mbuf *);
 void	icmp6_redirect_input(struct mbuf *, int);

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 10:22:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CDD2C1065674;
	Wed, 29 Apr 2009 10:22:44 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A37808FC1C;
	Wed, 29 Apr 2009 10:22:44 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TAMi20076429;
	Wed, 29 Apr 2009 10:22:44 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TAMi3V076428;
	Wed, 29 Apr 2009 10:22:44 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291022.n3TAMi3V076428@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 10:22:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191662 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 10:22:45 -0000

Author: bms
Date: Wed Apr 29 10:22:44 2009
New Revision: 191662
URL: http://svn.freebsd.org/changeset/base/191662

Log:
  Add IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT, in6addr_linklocal_allv2routers
  for use by MLDv2.
  Add IPv6 SSM socket layer membership vector size constants and
  tree bounds.
  Remove unreferenced struct ipv6_mreq_source; SSM for IPv6 goes
  straight to the RFC 3678 socket options.

Modified:
  head/sys/netinet6/in6.h

Modified: head/sys/netinet6/in6.h
==============================================================================
--- head/sys/netinet6/in6.h	Wed Apr 29 10:20:17 2009	(r191661)
+++ head/sys/netinet6/in6.h	Wed Apr 29 10:22:44 2009	(r191662)
@@ -201,6 +201,9 @@ extern const struct in6_addr in6mask128;
 #define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
 	{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
 	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
+#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \
+	{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}
 #endif
 
 extern const struct in6_addr in6addr_any;
@@ -209,6 +212,7 @@ extern const struct in6_addr in6addr_loo
 extern const struct in6_addr in6addr_nodelocal_allnodes;
 extern const struct in6_addr in6addr_linklocal_allnodes;
 extern const struct in6_addr in6addr_linklocal_allrouters;
+extern const struct in6_addr in6addr_linklocal_allv2routers;
 #endif
 
 /*
@@ -494,24 +498,27 @@ struct route_in6 {
 #define IPV6_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member */
 
 /*
- * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
+ * The im6o_membership vector for each socket is now dynamically allocated at
+ * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
+ * according to a power-of-two increment.
  */
-struct ipv6_mreq {
-	struct in6_addr	ipv6mr_multiaddr;
-	unsigned int	ipv6mr_interface;
-};
+#define	IPV6_MIN_MEMBERSHIPS	31
+#define	IPV6_MAX_MEMBERSHIPS	4095
 
-#ifdef notyet
 /*
- * Argument structure for IPV6_ADD_SOURCE_MEMBERSHIP,
- * IPV6_DROP_SOURCE_MEMBERSHIP, IPV6_BLOCK_SOURCE, and IPV6_UNBLOCK_SOURCE.
+ * Default resource limits for IPv6 multicast source filtering.
+ * These may be modified by sysctl.
  */
-struct ipv6_mreq_source {
+#define	IPV6_MAX_GROUP_SRC_FILTER	512	/* sources per group */
+#define	IPV6_MAX_SOCK_SRC_FILTER	128	/* sources per socket/group */
+
+/*
+ * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
+ */
+struct ipv6_mreq {
 	struct in6_addr	ipv6mr_multiaddr;
-	struct in6_addr	ipv6mr_sourceaddr;
-	uint32_t	ipv6mr_interface;
+	unsigned int	ipv6mr_interface;
 };
-#endif
 
 /*
  * IPV6_PKTINFO: Packet information(RFC2292 sec 5)

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 10:42:58 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A5D32106566C;
	Wed, 29 Apr 2009 10:42:58 +0000 (UTC)
	(envelope-from bms@incunabulum.net)
Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com
	[66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 774878FC1E;
	Wed, 29 Apr 2009 10:42:58 +0000 (UTC)
	(envelope-from bms@incunabulum.net)
Received: from compute1.internal (compute1.internal [10.202.2.41])
	by out1.messagingengine.com (Postfix) with ESMTP id 36DF63359E1;
	Wed, 29 Apr 2009 06:40:49 -0400 (EDT)
Received: from heartbeat1.messagingengine.com ([10.202.2.160])
	by compute1.internal (MEProxy); Wed, 29 Apr 2009 06:40:49 -0400
X-Sasl-enc: DvsZAE2ul1mCcPcJv/19xCYDOaiaIK6HC6Tv2wdAsxgC 1241001648
Received: from [192.168.123.18]
	(82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254])
	by mail.messagingengine.com (Postfix) with ESMTPSA id 60AA62CB6A;
	Wed, 29 Apr 2009 06:40:48 -0400 (EDT)
Message-ID: <49F82EAE.6040406@incunabulum.net>
Date: Wed, 29 Apr 2009 11:40:46 +0100
From: Bruce Simpson 
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
MIME-Version: 1.0
To: Daniel Gerzo 
References: <200904282023.n3SKNwJO058925@svn.freebsd.org>
In-Reply-To: <200904282023.n3SKNwJO058925@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r191635 - head/usr.sbin/arp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 10:42:59 -0000

Hi,

We're missing a man page for ndp(4).
It seems reasonable that we should have one (we have one for arp(4), 
after all).
Any plans to write one? Would be very nice to have.

I raided GNATS but didn't see anything in the bin.

Daniel Gerzo wrote:
> Log:
>   - xref ndp(8)
>  
>   

thanks,
BMS


From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 11:15:58 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B9F71106564A;
	Wed, 29 Apr 2009 11:15:58 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A86938FC08;
	Wed, 29 Apr 2009 11:15:58 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TBFwqb079043;
	Wed, 29 Apr 2009 11:15:58 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TBFwQj079042;
	Wed, 29 Apr 2009 11:15:58 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291115.n3TBFwQj079042@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 11:15:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191663 - head/sys/netipsec
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 11:15:59 -0000

Author: bms
Date: Wed Apr 29 11:15:58 2009
New Revision: 191663
URL: http://svn.freebsd.org/changeset/base/191663

Log:
  Stub out IN6_LOOKUP_MULTI() for GETSPI requests, for now.
  
  This has the effect that IPv6 multicast traffic won't trigger
  an SPI allocation when IPSEC is in use, however, this obviously
  needs to stomp on locks, and IN6_LOOKUP_MULTI() is about to go away.
  
  This definitely needs to be revisited before 8.x is branched as
  a release branch.

Modified:
  head/sys/netipsec/key.c

Modified: head/sys/netipsec/key.c
==============================================================================
--- head/sys/netipsec/key.c	Wed Apr 29 10:22:44 2009	(r191662)
+++ head/sys/netipsec/key.c	Wed Apr 29 11:15:58 2009	(r191663)
@@ -3765,13 +3765,16 @@ key_ismyaddr6(sin6)
 {
 	INIT_VNET_INET6(curvnet);
 	struct in6_ifaddr *ia;
+#if 0
 	struct in6_multi *in6m;
+#endif
 
 	for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) {
 		if (key_sockaddrcmp((struct sockaddr *)&sin6,
 		    (struct sockaddr *)&ia->ia_addr, 0) == 0)
 			return 1;
 
+#if 0
 		/*
 		 * XXX Multicast
 		 * XXX why do we care about multlicast here while we don't care
@@ -3782,6 +3785,7 @@ key_ismyaddr6(sin6)
 		IN6_LOOKUP_MULTI(sin6->sin6_addr, ia->ia_ifp, in6m);
 		if (in6m)
 			return 1;
+#endif
 	}
 
 	/* loopback, just for safety */

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 11:26:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 10BAB1065674;
	Wed, 29 Apr 2009 11:26:46 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F16EF8FC19;
	Wed, 29 Apr 2009 11:26:45 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TBQjVu079334;
	Wed, 29 Apr 2009 11:26:45 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TBQjVg079333;
	Wed, 29 Apr 2009 11:26:45 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291126.n3TBQjVg079333@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 11:26:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191665 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 11:26:46 -0000

Author: bms
Date: Wed Apr 29 11:26:45 2009
New Revision: 191665
URL: http://svn.freebsd.org/changeset/base/191665

Log:
  Import IPv6 SSM module but do not connect it to the build.

Added:
  head/sys/netinet6/in6_mcast.c   (contents, props changed)

Added: head/sys/netinet6/in6_mcast.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/netinet6/in6_mcast.c	Wed Apr 29 11:26:45 2009	(r191665)
@@ -0,0 +1,2625 @@
+/*
+ * Copyright (c) 2009 Bruce Simpson.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * IPv6 multicast socket, group, and socket option processing module.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_inet6.h"
+#include "opt_route.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifndef KTR_MLD
+#define KTR_MLD KTR_INET6
+#endif
+
+#ifndef __SOCKUNION_DECLARED
+union sockunion {
+	struct sockaddr_storage	ss;
+	struct sockaddr		sa;
+	struct sockaddr_dl	sdl;
+	struct sockaddr_in6	sin6;
+};
+typedef union sockunion sockunion_t;
+#define __SOCKUNION_DECLARED
+#endif /* __SOCKUNION_DECLARED */
+
+static MALLOC_DEFINE(M_IN6MFILTER, "in6_mfilter",
+    "IPv6 multicast PCB-layer source filter");
+static MALLOC_DEFINE(M_IP6MADDR, "in6_multi", "IPv6 multicast group");
+static MALLOC_DEFINE(M_IP6MOPTS, "ip6_moptions", "IPv6 multicast options");
+static MALLOC_DEFINE(M_IP6MSOURCE, "ip6_msource",
+    "IPv6 multicast MLD-layer source filter");
+
+RB_GENERATE(ip6_msource_tree, ip6_msource, im6s_link, ip6_msource_cmp);
+
+/*
+ * Locking:
+ * - Lock order is: Giant, INP_WLOCK, IN6_MULTI_LOCK, MLD_LOCK, IF_ADDR_LOCK.
+ * - The IF_ADDR_LOCK is implicitly taken by in6m_lookup() earlier, however
+ *   it can be taken by code in net/if.c also.
+ * - ip6_moptions and in6_mfilter are covered by the INP_WLOCK.
+ *
+ * struct in6_multi is covered by IN6_MULTI_LOCK. There isn't strictly
+ * any need for in6_multi itself to be virtualized -- it is bound to an ifp
+ * anyway no matter what happens.
+ */
+struct mtx in6_multi_mtx;
+MTX_SYSINIT(in6_multi_mtx, &in6_multi_mtx, "in6_multi_mtx", MTX_DEF);
+
+static void	im6f_commit(struct in6_mfilter *);
+static int	im6f_get_source(struct in6_mfilter *imf,
+		    const struct sockaddr_in6 *psin,
+		    struct in6_msource **);
+static struct in6_msource *
+		im6f_graft(struct in6_mfilter *, const uint8_t,
+		    const struct sockaddr_in6 *);
+static void	im6f_leave(struct in6_mfilter *);
+static int	im6f_prune(struct in6_mfilter *, const struct sockaddr_in6 *);
+static void	im6f_purge(struct in6_mfilter *);
+static void	im6f_rollback(struct in6_mfilter *);
+static void	im6f_reap(struct in6_mfilter *);
+static int	im6o_grow(struct ip6_moptions *);
+static size_t	im6o_match_group(const struct ip6_moptions *,
+		    const struct ifnet *, const struct sockaddr *);
+static struct in6_msource *
+		im6o_match_source(const struct ip6_moptions *, const size_t,
+		    const struct sockaddr *);
+static void	im6s_merge(struct ip6_msource *ims,
+		    const struct in6_msource *lims, const int rollback);
+static int	in6_mc_get(struct ifnet *, const struct in6_addr *,
+		    struct in6_multi **);
+static int	in6m_get_source(struct in6_multi *inm,
+		    const struct in6_addr *addr, const int noalloc,
+		    struct ip6_msource **pims);
+static int	in6m_is_ifp_detached(const struct in6_multi *);
+static int	in6m_merge(struct in6_multi *, /*const*/ struct in6_mfilter *);
+static void	in6m_purge(struct in6_multi *);
+static void	in6m_reap(struct in6_multi *);
+static struct ip6_moptions *
+		in6p_findmoptions(struct inpcb *);
+static int	in6p_get_source_filters(struct inpcb *, struct sockopt *);
+static int	in6p_join_group(struct inpcb *, struct sockopt *);
+static int	in6p_leave_group(struct inpcb *, struct sockopt *);
+static int	in6p_block_unblock_source(struct inpcb *, struct sockopt *);
+static int	in6p_set_multicast_if(struct inpcb *, struct sockopt *);
+static int	in6p_set_source_filters(struct inpcb *, struct sockopt *);
+static int	sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS);
+
+SYSCTL_DECL(_net_inet6_ip6);	/* XXX Not in any common header. */
+
+SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, mcast, CTLFLAG_RW, 0, "IPv6 multicast");
+
+static u_long in6_mcast_maxgrpsrc = IPV6_MAX_GROUP_SRC_FILTER;
+SYSCTL_ULONG(_net_inet6_ip6_mcast, OID_AUTO, maxgrpsrc,
+    CTLFLAG_RW | CTLFLAG_TUN, &in6_mcast_maxgrpsrc, 0,
+    "Max source filters per group");
+TUNABLE_ULONG("net.inet6.ip6.mcast.maxgrpsrc", &in6_mcast_maxgrpsrc);
+
+static u_long in6_mcast_maxsocksrc = IPV6_MAX_SOCK_SRC_FILTER;
+SYSCTL_ULONG(_net_inet6_ip6_mcast, OID_AUTO, maxsocksrc,
+    CTLFLAG_RW | CTLFLAG_TUN, &in6_mcast_maxsocksrc, 0,
+    "Max source filters per socket");
+TUNABLE_ULONG("net.inet6.ip6.mcast.maxsocksrc", &in6_mcast_maxsocksrc);
+
+/* TODO Virtualize this switch. */
+int in6_mcast_loop = IPV6_DEFAULT_MULTICAST_LOOP;
+SYSCTL_INT(_net_inet6_ip6_mcast, OID_AUTO, loop, CTLFLAG_RW | CTLFLAG_TUN,
+    &in6_mcast_loop, 0, "Loopback multicast datagrams by default");
+TUNABLE_INT("net.inet6.ip6.mcast.loop", &in6_mcast_loop);
+
+SYSCTL_NODE(_net_inet6_ip6_mcast, OID_AUTO, filters,
+    CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_ip6_mcast_filters,
+    "Per-interface stack-wide source filters");
+
+/*
+ * Inline function which wraps assertions for a valid ifp.
+ * The ifnet layer will set the ifma's ifp pointer to NULL if the ifp
+ * is detached.
+ */
+static int __inline
+in6m_is_ifp_detached(const struct in6_multi *inm)
+{
+	struct ifnet *ifp;
+
+	KASSERT(inm->in6m_ifma != NULL, ("%s: no ifma", __func__));
+	ifp = inm->in6m_ifma->ifma_ifp;
+	if (ifp != NULL) {
+		/*
+		 * Sanity check that network-layer notion of ifp is the
+		 * same as that of link-layer.
+		 */
+		KASSERT(inm->in6m_ifp == ifp, ("%s: bad ifp", __func__));
+	}
+
+	return (ifp == NULL);
+}
+
+/*
+ * Initialize an in6_mfilter structure to a known state at t0, t1
+ * with an empty source filter list.
+ */
+static __inline void
+im6f_init(struct in6_mfilter *imf, const int st0, const int st1)
+{
+	memset(imf, 0, sizeof(struct in6_mfilter));
+	RB_INIT(&imf->im6f_sources);
+	imf->im6f_st[0] = st0;
+	imf->im6f_st[1] = st1;
+}
+
+/*
+ * Resize the ip6_moptions vector to the next power-of-two minus 1.
+ * May be called with locks held; do not sleep.
+ */
+static int
+im6o_grow(struct ip6_moptions *imo)
+{
+	struct in6_multi	**nmships;
+	struct in6_multi	**omships;
+	struct in6_mfilter	 *nmfilters;
+	struct in6_mfilter	 *omfilters;
+	size_t			  idx;
+	size_t			  newmax;
+	size_t			  oldmax;
+
+	nmships = NULL;
+	nmfilters = NULL;
+	omships = imo->im6o_membership;
+	omfilters = imo->im6o_mfilters;
+	oldmax = imo->im6o_max_memberships;
+	newmax = ((oldmax + 1) * 2) - 1;
+
+	if (newmax <= IPV6_MAX_MEMBERSHIPS) {
+		nmships = (struct in6_multi **)realloc(omships,
+		    sizeof(struct in6_multi *) * newmax, M_IP6MOPTS, M_NOWAIT);
+		nmfilters = (struct in6_mfilter *)realloc(omfilters,
+		    sizeof(struct in6_mfilter) * newmax, M_IN6MFILTER,
+		    M_NOWAIT);
+		if (nmships != NULL && nmfilters != NULL) {
+			/* Initialize newly allocated source filter heads. */
+			for (idx = oldmax; idx < newmax; idx++) {
+				im6f_init(&nmfilters[idx], MCAST_UNDEFINED,
+				    MCAST_EXCLUDE);
+			}
+			imo->im6o_max_memberships = newmax;
+			imo->im6o_membership = nmships;
+			imo->im6o_mfilters = nmfilters;
+		}
+	}
+
+	if (nmships == NULL || nmfilters == NULL) {
+		if (nmships != NULL)
+			free(nmships, M_IP6MOPTS);
+		if (nmfilters != NULL)
+			free(nmfilters, M_IN6MFILTER);
+		return (ETOOMANYREFS);
+	}
+
+	return (0);
+}
+
+/*
+ * Find an IPv6 multicast group entry for this ip6_moptions instance
+ * which matches the specified group, and optionally an interface.
+ * Return its index into the array, or -1 if not found.
+ */
+static size_t
+im6o_match_group(const struct ip6_moptions *imo, const struct ifnet *ifp,
+    const struct sockaddr *group)
+{
+	const struct sockaddr_in6 *gsin6;
+	struct in6_multi	**pinm;
+	int		  idx;
+	int		  nmships;
+
+	gsin6 = (const struct sockaddr_in6 *)group;
+
+	/* The im6o_membership array may be lazy allocated. */
+	if (imo->im6o_membership == NULL || imo->im6o_num_memberships == 0)
+		return (-1);
+
+	nmships = imo->im6o_num_memberships;
+	pinm = &imo->im6o_membership[0];
+	for (idx = 0; idx < nmships; idx++, pinm++) {
+		if (*pinm == NULL)
+			continue;
+		if ((ifp == NULL || ((*pinm)->in6m_ifp == ifp)) &&
+		    IN6_ARE_ADDR_EQUAL(&(*pinm)->in6m_addr,
+		    &gsin6->sin6_addr)) {
+			break;
+		}
+	}
+	if (idx >= nmships)
+		idx = -1;
+
+	return (idx);
+}
+
+/*
+ * Find an IPv6 multicast source entry for this imo which matches
+ * the given group index for this socket, and source address.
+ *
+ * NOTE: This does not check if the entry is in-mode, merely if
+ * it exists, which may not be the desired behaviour.
+ */
+static struct in6_msource *
+im6o_match_source(const struct ip6_moptions *imo, const size_t gidx,
+    const struct sockaddr *src)
+{
+	struct ip6_msource	 find;
+	struct in6_mfilter	*imf;
+	struct ip6_msource	*ims;
+	const sockunion_t	*psa;
+
+	KASSERT(src->sa_family == AF_INET6, ("%s: !AF_INET6", __func__));
+	KASSERT(gidx != -1 && gidx < imo->im6o_num_memberships,
+	    ("%s: invalid index %d\n", __func__, (int)gidx));
+
+	/* The im6o_mfilters array may be lazy allocated. */
+	if (imo->im6o_mfilters == NULL)
+		return (NULL);
+	imf = &imo->im6o_mfilters[gidx];
+
+	psa = (const sockunion_t *)src;
+	find.im6s_addr = psa->sin6.sin6_addr;
+	ims = RB_FIND(ip6_msource_tree, &imf->im6f_sources, &find);
+
+	return ((struct in6_msource *)ims);
+}
+
+/*
+ * Perform filtering for multicast datagrams on a socket by group and source.
+ *
+ * Returns 0 if a datagram should be allowed through, or various error codes
+ * if the socket was not a member of the group, or the source was muted, etc.
+ */
+int
+im6o_mc_filter(const struct ip6_moptions *imo, const struct ifnet *ifp,
+    const struct sockaddr *group, const struct sockaddr *src)
+{
+	size_t gidx;
+	struct in6_msource *ims;
+	int mode;
+
+	KASSERT(ifp != NULL, ("%s: null ifp", __func__));
+
+	gidx = im6o_match_group(imo, ifp, group);
+	if (gidx == -1)
+		return (MCAST_NOTGMEMBER);
+
+	/*
+	 * Check if the source was included in an (S,G) join.
+	 * Allow reception on exclusive memberships by default,
+	 * reject reception on inclusive memberships by default.
+	 * Exclude source only if an in-mode exclude filter exists.
+	 * Include source only if an in-mode include filter exists.
+	 * NOTE: We are comparing group state here at MLD t1 (now)
+	 * with socket-layer t0 (since last downcall).
+	 */
+	mode = imo->im6o_mfilters[gidx].im6f_st[1];
+	ims = im6o_match_source(imo, gidx, src);
+
+	if ((ims == NULL && mode == MCAST_INCLUDE) ||
+	    (ims != NULL && ims->im6sl_st[0] != mode))
+		return (MCAST_NOTSMEMBER);
+
+	return (MCAST_PASS);
+}
+
+/*
+ * Find and return a reference to an in6_multi record for (ifp, group),
+ * and bump its reference count.
+ * If one does not exist, try to allocate it, and update link-layer multicast
+ * filters on ifp to listen for group.
+ * Assumes the IN6_MULTI lock is held across the call.
+ * Return 0 if successful, otherwise return an appropriate error code.
+ */
+static int
+in6_mc_get(struct ifnet *ifp, const struct in6_addr *group,
+    struct in6_multi **pinm)
+{
+	struct sockaddr_in6	 gsin6;
+	struct ifmultiaddr	*ifma;
+	struct in6_multi	*inm;
+	int			 error;
+
+	error = 0;
+
+	/*
+	 * XXX: Accesses to ifma_protospec must be covered by IF_ADDR_LOCK;
+	 * if_addmulti() takes this mutex itself, so we must drop and
+	 * re-acquire around the call.
+	 */
+	IN6_MULTI_LOCK_ASSERT();
+	IF_ADDR_LOCK(ifp);
+
+	inm = in6m_lookup_locked(ifp, group);
+	if (inm != NULL) {
+		/*
+		 * If we already joined this group, just bump the
+		 * refcount and return it.
+		 */
+		KASSERT(inm->in6m_refcount >= 1,
+		    ("%s: bad refcount %d", __func__, inm->in6m_refcount));
+		++inm->in6m_refcount;
+		*pinm = inm;
+		goto out_locked;
+	}
+
+	memset(&gsin6, 0, sizeof(gsin6));
+	gsin6.sin6_family = AF_INET6;
+	gsin6.sin6_len = sizeof(struct sockaddr_in6);
+	gsin6.sin6_addr = *group;
+
+	/*
+	 * Check if a link-layer group is already associated
+	 * with this network-layer group on the given ifnet.
+	 */
+	IF_ADDR_UNLOCK(ifp);
+	error = if_addmulti(ifp, (struct sockaddr *)&gsin6, &ifma);
+	if (error != 0)
+		return (error);
+	IF_ADDR_LOCK(ifp);
+
+	/*
+	 * If something other than netinet6 is occupying the link-layer
+	 * group, print a meaningful error message and back out of
+	 * the allocation.
+	 * Otherwise, bump the refcount on the existing network-layer
+	 * group association and return it.
+	 */
+	if (ifma->ifma_protospec != NULL) {
+		inm = (struct in6_multi *)ifma->ifma_protospec;
+#ifdef INVARIANTS
+		KASSERT(ifma->ifma_addr != NULL, ("%s: no ifma_addr",
+		    __func__));
+		KASSERT(ifma->ifma_addr->sa_family == AF_INET6,
+		    ("%s: ifma not AF_INET6", __func__));
+		KASSERT(inm != NULL, ("%s: no ifma_protospec", __func__));
+		if (inm->in6m_ifma != ifma || inm->in6m_ifp != ifp ||
+		    !IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, group))
+			panic("%s: ifma %p is inconsistent with %p (%p)",
+			    __func__, ifma, inm, group);
+#endif
+		++inm->in6m_refcount;
+		*pinm = inm;
+		goto out_locked;
+	}
+
+	IF_ADDR_LOCK_ASSERT(ifp);
+
+	/*
+	 * A new in6_multi record is needed; allocate and initialize it.
+	 * We DO NOT perform an MLD join as the in6_ layer may need to
+	 * push an initial source list down to MLD to support SSM.
+	 *
+	 * The initial source filter state is INCLUDE, {} as per the RFC.
+	 * Pending state-changes per group are subject to a bounds check.
+	 */
+	inm = malloc(sizeof(*inm), M_IP6MADDR, M_NOWAIT | M_ZERO);
+	if (inm == NULL) {
+		if_delmulti_ifma(ifma);
+		error = ENOMEM;
+		goto out_locked;
+	}
+	inm->in6m_addr = *group;
+	inm->in6m_ifp = ifp;
+	inm->in6m_mli = MLD_IFINFO(ifp);
+	inm->in6m_ifma = ifma;
+	inm->in6m_refcount = 1;
+	inm->in6m_state = MLD_NOT_MEMBER;
+	IFQ_SET_MAXLEN(&inm->in6m_scq, MLD_MAX_STATE_CHANGES);
+
+	inm->in6m_st[0].iss_fmode = MCAST_UNDEFINED;
+	inm->in6m_st[1].iss_fmode = MCAST_UNDEFINED;
+	RB_INIT(&inm->in6m_srcs);
+
+	ifma->ifma_protospec = inm;
+	*pinm = inm;
+
+out_locked:
+	IF_ADDR_UNLOCK(ifp);
+	return (error);
+}
+
+/*
+ * Drop a reference to an in6_multi record.
+ *
+ * If the refcount drops to 0, free the in6_multi record and
+ * delete the underlying link-layer membership.
+ */
+void
+in6m_release_locked(struct in6_multi *inm)
+{
+	struct ifmultiaddr *ifma;
+
+	IN6_MULTI_LOCK_ASSERT();
+
+	CTR2(KTR_MLD, "%s: refcount is %d", __func__, inm->in6m_refcount);
+
+	if (--inm->in6m_refcount > 0) {
+		CTR2(KTR_MLD, "%s: refcount is now %d", __func__,
+		    inm->in6m_refcount);
+		return;
+	}
+
+	CTR2(KTR_MLD, "%s: freeing inm %p", __func__, inm);
+
+	ifma = inm->in6m_ifma;
+
+	/* XXX this access is not covered by IF_ADDR_LOCK */
+	CTR2(KTR_MLD, "%s: purging ifma %p", __func__, ifma);
+	KASSERT(ifma->ifma_protospec == inm,
+	    ("%s: ifma_protospec != inm", __func__));
+	ifma->ifma_protospec = NULL;
+
+	in6m_purge(inm);
+
+	free(inm, M_IP6MADDR);
+
+	if_delmulti_ifma(ifma);
+}
+
+/*
+ * Clear recorded source entries for a group.
+ * Used by the MLD code. Caller must hold the IN6_MULTI lock.
+ * FIXME: Should reap.
+ */
+void
+in6m_clear_recorded(struct in6_multi *inm)
+{
+	struct ip6_msource	*ims;
+
+	IN6_MULTI_LOCK_ASSERT();
+
+	RB_FOREACH(ims, ip6_msource_tree, &inm->in6m_srcs) {
+		if (ims->im6s_stp) {
+			ims->im6s_stp = 0;
+			--inm->in6m_st[1].iss_rec;
+		}
+	}
+	KASSERT(inm->in6m_st[1].iss_rec == 0,
+	    ("%s: iss_rec %d not 0", __func__, inm->in6m_st[1].iss_rec));
+}
+
+/*
+ * Record a source as pending for a Source-Group MLDv2 query.
+ * This lives here as it modifies the shared tree.
+ *
+ * inm is the group descriptor.
+ * naddr is the address of the source to record in network-byte order.
+ *
+ * If the net.inet6.mld.sgalloc sysctl is non-zero, we will
+ * lazy-allocate a source node in response to an SG query.
+ * Otherwise, no allocation is performed. This saves some memory
+ * with the trade-off that the source will not be reported to the
+ * router if joined in the window between the query response and
+ * the group actually being joined on the local host.
+ *
+ * VIMAGE: XXX: Currently the mld_sgalloc feature has been removed.
+ * This turns off the allocation of a recorded source entry if
+ * the group has not been joined.
+ *
+ * Return 0 if the source didn't exist or was already marked as recorded.
+ * Return 1 if the source was marked as recorded by this function.
+ * Return <0 if any error occured (negated errno code).
+ */
+int
+in6m_record_source(struct in6_multi *inm, const struct in6_addr *addr)
+{
+	struct ip6_msource	 find;
+	struct ip6_msource	*ims, *nims;
+
+	IN6_MULTI_LOCK_ASSERT();
+
+	find.im6s_addr = *addr;
+	ims = RB_FIND(ip6_msource_tree, &inm->in6m_srcs, &find);
+	if (ims && ims->im6s_stp)
+		return (0);
+	if (ims == NULL) {
+		if (inm->in6m_nsrc == in6_mcast_maxgrpsrc)
+			return (-ENOSPC);
+		nims = malloc(sizeof(struct ip6_msource), M_IP6MSOURCE,
+		    M_NOWAIT | M_ZERO);
+		if (nims == NULL)
+			return (-ENOMEM);
+		nims->im6s_addr = find.im6s_addr;
+		RB_INSERT(ip6_msource_tree, &inm->in6m_srcs, nims);
+		++inm->in6m_nsrc;
+		ims = nims;
+	}
+
+	/*
+	 * Mark the source as recorded and update the recorded
+	 * source count.
+	 */
+	++ims->im6s_stp;
+	++inm->in6m_st[1].iss_rec;
+
+	return (1);
+}
+
+/*
+ * Return a pointer to an in6_msource owned by an in6_mfilter,
+ * given its source address.
+ * Lazy-allocate if needed. If this is a new entry its filter state is
+ * undefined at t0.
+ *
+ * imf is the filter set being modified.
+ * addr is the source address.
+ *
+ * SMPng: May be called with locks held; malloc must not block.
+ */
+static int
+im6f_get_source(struct in6_mfilter *imf, const struct sockaddr_in6 *psin,
+    struct in6_msource **plims)
+{
+	struct ip6_msource	 find;
+	struct ip6_msource	*ims, *nims;
+	struct in6_msource	*lims;
+	int			 error;
+
+	error = 0;
+	ims = NULL;
+	lims = NULL;
+
+	find.im6s_addr = psin->sin6_addr;
+	ims = RB_FIND(ip6_msource_tree, &imf->im6f_sources, &find);
+	lims = (struct in6_msource *)ims;
+	if (lims == NULL) {
+		if (imf->im6f_nsrc == in6_mcast_maxsocksrc)
+			return (ENOSPC);
+		nims = malloc(sizeof(struct in6_msource), M_IN6MFILTER,
+		    M_NOWAIT | M_ZERO);
+		if (nims == NULL)
+			return (ENOMEM);
+		lims = (struct in6_msource *)nims;
+		lims->im6s_addr = find.im6s_addr;
+		lims->im6sl_st[0] = MCAST_UNDEFINED;
+		RB_INSERT(ip6_msource_tree, &imf->im6f_sources, nims);
+		++imf->im6f_nsrc;
+	}
+
+	*plims = lims;
+
+	return (error);
+}
+
+/*
+ * Graft a source entry into an existing socket-layer filter set,
+ * maintaining any required invariants and checking allocations.
+ *
+ * The source is marked as being in the new filter mode at t1.
+ *
+ * Return the pointer to the new node, otherwise return NULL.
+ */
+static struct in6_msource *
+im6f_graft(struct in6_mfilter *imf, const uint8_t st1,
+    const struct sockaddr_in6 *psin)
+{
+	struct ip6_msource	*nims;
+	struct in6_msource	*lims;
+
+	nims = malloc(sizeof(struct in6_msource), M_IN6MFILTER,
+	    M_NOWAIT | M_ZERO);
+	if (nims == NULL)
+		return (NULL);
+	lims = (struct in6_msource *)nims;
+	lims->im6s_addr = psin->sin6_addr;
+	lims->im6sl_st[0] = MCAST_UNDEFINED;
+	lims->im6sl_st[1] = st1;
+	RB_INSERT(ip6_msource_tree, &imf->im6f_sources, nims);
+	++imf->im6f_nsrc;
+
+	return (lims);
+}
+
+/*
+ * Prune a source entry from an existing socket-layer filter set,
+ * maintaining any required invariants and checking allocations.
+ *
+ * The source is marked as being left at t1, it is not freed.
+ *
+ * Return 0 if no error occurred, otherwise return an errno value.
+ */
+static int
+im6f_prune(struct in6_mfilter *imf, const struct sockaddr_in6 *psin)
+{
+	struct ip6_msource	 find;
+	struct ip6_msource	*ims;
+	struct in6_msource	*lims;
+
+	find.im6s_addr = psin->sin6_addr;
+	ims = RB_FIND(ip6_msource_tree, &imf->im6f_sources, &find);
+	if (ims == NULL)
+		return (ENOENT);
+	lims = (struct in6_msource *)ims;
+	lims->im6sl_st[1] = MCAST_UNDEFINED;
+	return (0);
+}
+
+/*
+ * Revert socket-layer filter set deltas at t1 to t0 state.
+ */
+static void
+im6f_rollback(struct in6_mfilter *imf)
+{
+	struct ip6_msource	*ims, *tims;
+	struct in6_msource	*lims;
+
+	RB_FOREACH_SAFE(ims, ip6_msource_tree, &imf->im6f_sources, tims) {
+		lims = (struct in6_msource *)ims;
+		if (lims->im6sl_st[0] == lims->im6sl_st[1]) {
+			/* no change at t1 */
+			continue;
+		} else if (lims->im6sl_st[0] != MCAST_UNDEFINED) {
+			/* revert change to existing source at t1 */
+			lims->im6sl_st[1] = lims->im6sl_st[0];
+		} else {
+			/* revert source added t1 */
+			CTR2(KTR_MLD, "%s: free ims %p", __func__, ims);
+			RB_REMOVE(ip6_msource_tree, &imf->im6f_sources, ims);
+			free(ims, M_IN6MFILTER);
+			imf->im6f_nsrc--;
+		}
+	}
+	imf->im6f_st[1] = imf->im6f_st[0];
+}
+
+/*
+ * Mark socket-layer filter set as INCLUDE {} at t1.
+ */
+static void
+im6f_leave(struct in6_mfilter *imf)
+{
+	struct ip6_msource	*ims;
+	struct in6_msource	*lims;
+
+	RB_FOREACH(ims, ip6_msource_tree, &imf->im6f_sources) {
+		lims = (struct in6_msource *)ims;
+		lims->im6sl_st[1] = MCAST_UNDEFINED;
+	}
+	imf->im6f_st[1] = MCAST_INCLUDE;
+}
+
+/*
+ * Mark socket-layer filter set deltas as committed.
+ */
+static void
+im6f_commit(struct in6_mfilter *imf)
+{
+	struct ip6_msource	*ims;
+	struct in6_msource	*lims;
+
+	RB_FOREACH(ims, ip6_msource_tree, &imf->im6f_sources) {
+		lims = (struct in6_msource *)ims;
+		lims->im6sl_st[0] = lims->im6sl_st[1];
+	}
+	imf->im6f_st[0] = imf->im6f_st[1];
+}
+
+/*
+ * Reap unreferenced sources from socket-layer filter set.
+ */
+static void
+im6f_reap(struct in6_mfilter *imf)
+{
+	struct ip6_msource	*ims, *tims;
+	struct in6_msource	*lims;
+
+	RB_FOREACH_SAFE(ims, ip6_msource_tree, &imf->im6f_sources, tims) {
+		lims = (struct in6_msource *)ims;
+		if ((lims->im6sl_st[0] == MCAST_UNDEFINED) &&
+		    (lims->im6sl_st[1] == MCAST_UNDEFINED)) {
+			CTR2(KTR_MLD, "%s: free lims %p", __func__, ims);
+			RB_REMOVE(ip6_msource_tree, &imf->im6f_sources, ims);
+			free(ims, M_IN6MFILTER);
+			imf->im6f_nsrc--;
+		}
+	}
+}
+
+/*
+ * Purge socket-layer filter set.
+ */
+static void
+im6f_purge(struct in6_mfilter *imf)
+{
+	struct ip6_msource	*ims, *tims;
+
+	RB_FOREACH_SAFE(ims, ip6_msource_tree, &imf->im6f_sources, tims) {
+		CTR2(KTR_MLD, "%s: free ims %p", __func__, ims);
+		RB_REMOVE(ip6_msource_tree, &imf->im6f_sources, ims);
+		free(ims, M_IN6MFILTER);
+		imf->im6f_nsrc--;
+	}
+	imf->im6f_st[0] = imf->im6f_st[1] = MCAST_UNDEFINED;
+	KASSERT(RB_EMPTY(&imf->im6f_sources),
+	    ("%s: im6f_sources not empty", __func__));
+}
+
+/*
+ * Look up a source filter entry for a multicast group.
+ *
+ * inm is the group descriptor to work with.
+ * addr is the IPv6 address to look up.
+ * noalloc may be non-zero to suppress allocation of sources.
+ * *pims will be set to the address of the retrieved or allocated source.
+ *
+ * SMPng: NOTE: may be called with locks held.
+ * Return 0 if successful, otherwise return a non-zero error code.
+ */
+static int
+in6m_get_source(struct in6_multi *inm, const struct in6_addr *addr,
+    const int noalloc, struct ip6_msource **pims)
+{
+	struct ip6_msource	 find;
+	struct ip6_msource	*ims, *nims;
+#ifdef KTR
+	char			 ip6tbuf[INET6_ADDRSTRLEN];
+#endif
+
+	find.im6s_addr = *addr;
+	ims = RB_FIND(ip6_msource_tree, &inm->in6m_srcs, &find);
+	if (ims == NULL && !noalloc) {
+		if (inm->in6m_nsrc == in6_mcast_maxgrpsrc)
+			return (ENOSPC);
+		nims = malloc(sizeof(struct ip6_msource), M_IP6MSOURCE,
+		    M_NOWAIT | M_ZERO);
+		if (nims == NULL)
+			return (ENOMEM);
+		nims->im6s_addr = *addr;
+		RB_INSERT(ip6_msource_tree, &inm->in6m_srcs, nims);
+		++inm->in6m_nsrc;
+		ims = nims;
+		CTR3(KTR_MLD, "%s: allocated %s as %p", __func__,
+		    ip6_sprintf(ip6tbuf, addr), ims);
+	}
+
+	*pims = ims;
+	return (0);
+}
+
+/*
+ * Merge socket-layer source into MLD-layer source.
+ * If rollback is non-zero, perform the inverse of the merge.
+ */
+static void
+im6s_merge(struct ip6_msource *ims, const struct in6_msource *lims,
+    const int rollback)
+{
+	int n = rollback ? -1 : 1;
+#ifdef KTR
+	char ip6tbuf[INET6_ADDRSTRLEN];
+
+	ip6_sprintf(ip6tbuf, &lims->im6s_addr);
+#endif
+
+	if (lims->im6sl_st[0] == MCAST_EXCLUDE) {
+		CTR3(KTR_MLD, "%s: t1 ex -= %d on %s", __func__, n, ip6tbuf);
+		ims->im6s_st[1].ex -= n;
+	} else if (lims->im6sl_st[0] == MCAST_INCLUDE) {
+		CTR3(KTR_MLD, "%s: t1 in -= %d on %s", __func__, n, ip6tbuf);
+		ims->im6s_st[1].in -= n;
+	}
+
+	if (lims->im6sl_st[1] == MCAST_EXCLUDE) {
+		CTR3(KTR_MLD, "%s: t1 ex += %d on %s", __func__, n, ip6tbuf);
+		ims->im6s_st[1].ex += n;
+	} else if (lims->im6sl_st[1] == MCAST_INCLUDE) {
+		CTR3(KTR_MLD, "%s: t1 in += %d on %s", __func__, n, ip6tbuf);
+		ims->im6s_st[1].in += n;
+	}
+}
+
+/*
+ * Atomically update the global in6_multi state, when a membership's
+ * filter list is being updated in any way.
+ *
+ * imf is the per-inpcb-membership group filter pointer.
+ * A fake imf may be passed for in-kernel consumers.
+ *
+ * XXX This is a candidate for a set-symmetric-difference style loop
+ * which would eliminate the repeated lookup from root of ims nodes,
+ * as they share the same key space.
+ *
+ * If any error occurred this function will back out of refcounts
+ * and return a non-zero value.
+ */
+static int
+in6m_merge(struct in6_multi *inm, /*const*/ struct in6_mfilter *imf)
+{
+	struct ip6_msource	*ims, *nims;
+	struct in6_msource	*lims;
+	int			 schanged, error;
+	int			 nsrc0, nsrc1;
+
+	schanged = 0;
+	error = 0;
+	nsrc1 = nsrc0 = 0;
+
+	/*
+	 * Update the source filters first, as this may fail.
+	 * Maintain count of in-mode filters at t0, t1. These are
+	 * used to work out if we transition into ASM mode or not.
+	 * Maintain a count of source filters whose state was
+	 * actually modified by this operation.
+	 */
+	RB_FOREACH(ims, ip6_msource_tree, &imf->im6f_sources) {
+		lims = (struct in6_msource *)ims;
+		if (lims->im6sl_st[0] == imf->im6f_st[0]) nsrc0++;
+		if (lims->im6sl_st[1] == imf->im6f_st[1]) nsrc1++;
+		if (lims->im6sl_st[0] == lims->im6sl_st[1]) continue;
+		error = in6m_get_source(inm, &lims->im6s_addr, 0, &nims);
+		++schanged;
+		if (error)
+			break;
+		im6s_merge(nims, lims, 0);
+	}
+	if (error) {
+		struct ip6_msource *bims;
+
+		RB_FOREACH_REVERSE_FROM(ims, ip6_msource_tree, nims) {
+			lims = (struct in6_msource *)ims;
+			if (lims->im6sl_st[0] == lims->im6sl_st[1])
+				continue;
+			(void)in6m_get_source(inm, &lims->im6s_addr, 1, &bims);
+			if (bims == NULL)
+				continue;
+			im6s_merge(bims, lims, 1);
+		}
+		goto out_reap;
+	}
+
+	CTR3(KTR_MLD, "%s: imf filters in-mode: %d at t0, %d at t1",
+	    __func__, nsrc0, nsrc1);
+
+	/* Handle transition between INCLUDE {n} and INCLUDE {} on socket. */
+	if (imf->im6f_st[0] == imf->im6f_st[1] &&
+	    imf->im6f_st[1] == MCAST_INCLUDE) {
+		if (nsrc1 == 0) {
+			CTR1(KTR_MLD, "%s: --in on inm at t1", __func__);
+			--inm->in6m_st[1].iss_in;
+		}
+	}
+
+	/* Handle filter mode transition on socket. */
+	if (imf->im6f_st[0] != imf->im6f_st[1]) {
+		CTR3(KTR_MLD, "%s: imf transition %d to %d",
+		    __func__, imf->im6f_st[0], imf->im6f_st[1]);
+
+		if (imf->im6f_st[0] == MCAST_EXCLUDE) {
+			CTR1(KTR_MLD, "%s: --ex on inm at t1", __func__);
+			--inm->in6m_st[1].iss_ex;
+		} else if (imf->im6f_st[0] == MCAST_INCLUDE) {
+			CTR1(KTR_MLD, "%s: --in on inm at t1", __func__);
+			--inm->in6m_st[1].iss_in;
+		}
+
+		if (imf->im6f_st[1] == MCAST_EXCLUDE) {
+			CTR1(KTR_MLD, "%s: ex++ on inm at t1", __func__);
+			inm->in6m_st[1].iss_ex++;
+		} else if (imf->im6f_st[1] == MCAST_INCLUDE && nsrc1 > 0) {
+			CTR1(KTR_MLD, "%s: in++ on inm at t1", __func__);
+			inm->in6m_st[1].iss_in++;
+		}
+	}
+
+	/*
+	 * Track inm filter state in terms of listener counts.
+	 * If there are any exclusive listeners, stack-wide
+	 * membership is exclusive.
+	 * Otherwise, if only inclusive listeners, stack-wide is inclusive.
+	 * If no listeners remain, state is undefined at t1,
+	 * and the MLD lifecycle for this group should finish.
+	 */
+	if (inm->in6m_st[1].iss_ex > 0) {
+		CTR1(KTR_MLD, "%s: transition to EX", __func__);
+		inm->in6m_st[1].iss_fmode = MCAST_EXCLUDE;
+	} else if (inm->in6m_st[1].iss_in > 0) {
+		CTR1(KTR_MLD, "%s: transition to IN", __func__);
+		inm->in6m_st[1].iss_fmode = MCAST_INCLUDE;
+	} else {
+		CTR1(KTR_MLD, "%s: transition to UNDEF", __func__);
+		inm->in6m_st[1].iss_fmode = MCAST_UNDEFINED;
+	}
+
+	/* Decrement ASM listener count on transition out of ASM mode. */
+	if (imf->im6f_st[0] == MCAST_EXCLUDE && nsrc0 == 0) {
+		if ((imf->im6f_st[1] != MCAST_EXCLUDE) ||
+		    (imf->im6f_st[1] == MCAST_EXCLUDE && nsrc1 > 0))
+			CTR1(KTR_MLD, "%s: --asm on inm at t1", __func__);
+			--inm->in6m_st[1].iss_asm;
+	}
+
+	/* Increment ASM listener count on transition to ASM mode. */

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

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 11:31:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E998106564A;
	Wed, 29 Apr 2009 11:31:24 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2C8188FC16;
	Wed, 29 Apr 2009 11:31:24 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TBVO8i079465;
	Wed, 29 Apr 2009 11:31:24 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TBVOY0079464;
	Wed, 29 Apr 2009 11:31:24 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291131.n3TBVOY0079464@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 11:31:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191666 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 11:31:24 -0000

Author: bms
Date: Wed Apr 29 11:31:23 2009
New Revision: 191666
URL: http://svn.freebsd.org/changeset/base/191666

Log:
  Add MLDv2 protocol header, but do not connect it to the build.

Added:
  head/sys/netinet6/mld6.h   (contents, props changed)

Added: head/sys/netinet6/mld6.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/netinet6/mld6.h	Wed Apr 29 11:31:23 2009	(r191666)
@@ -0,0 +1,112 @@
+/*-
+ * Copyright (c) 2009 Bruce Simpson.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _NETINET6_MLD6_H_
+#define _NETINET6_MLD6_H_
+
+/*
+ * Multicast Listener Discovery (MLD) definitions.
+ */
+
+/* Minimum length of any MLD protocol message. */
+#define MLD_MINLEN	sizeof(struct icmp6_hdr)
+
+/*
+ * MLD v2 query format.
+ * See  for struct mld_hdr
+ * (MLDv1 query and host report format).
+ */
+struct mldv2_query {
+	struct icmp6_hdr	mld_icmp6_hdr;	/* ICMPv6 header */
+	struct in6_addr		mld_addr;	/* address being queried */
+	uint8_t		mld_misc;	/* reserved/suppress/robustness   */
+	uint8_t		mld_qqi;	/* querier's query interval       */
+	uint16_t	mld_numsrc;	/* number of sources              */
+	/* followed by 1..numsrc source addresses */
+} __packed;
+#define MLD_V2_QUERY_MINLEN		sizeof(struct mldv2_query)
+#define MLD_MRC_EXP(x)			((ntohs((x)) >> 12) & 0x0007)
+#define MLD_MRC_MANT(x)			(ntohs((x)) & 0x0fff)
+#define MLD_QQIC_EXP(x)			(((x) >> 4) & 0x07)
+#define MLD_QQIC_MANT(x)		((x) & 0x0f)
+#define MLD_QRESV(x)			(((x) >> 4) & 0x0f)
+#define MLD_SFLAG(x)			(((x) >> 3) & 0x01)
+#define MLD_QRV(x)			((x) & 0x07)
+
+/*
+ * MLDv2 host membership report header.
+ * mld_type: MLDV2_LISTENER_REPORT
+ */
+struct mldv2_report {
+	struct icmp6_hdr	mld_icmp6_hdr;
+	/* followed by 1..numgrps records */
+} __packed;
+/* overlaid on struct icmp6_hdr. */
+#define mld_numrecs	mld_icmp6_hdr.icmp6_data16[1]
+
+struct mldv2_record {
+	uint8_t			mr_type;	/* record type */
+	uint8_t			mr_datalen;	/* length of auxiliary data */
+	uint16_t		mr_numsrc;	/* number of sources */
+	struct in6_addr		mr_addr;	/* address being reported */
+	/* followed by 1..numsrc source addresses */
+} __packed;
+#define MLD_V2_REPORT_MAXRECS		65535
+
+/*
+ * MLDv2 report modes.
+ */
+#define MLD_DO_NOTHING			0	/* don't send a record */
+#define MLD_MODE_IS_INCLUDE		1	/* MODE_IN */
+#define MLD_MODE_IS_EXCLUDE		2	/* MODE_EX */
+#define MLD_CHANGE_TO_INCLUDE_MODE	3	/* TO_IN */
+#define MLD_CHANGE_TO_EXCLUDE_MODE	4	/* TO_EX */
+#define MLD_ALLOW_NEW_SOURCES		5	/* ALLOW_NEW */
+#define MLD_BLOCK_OLD_SOURCES		6	/* BLOCK_OLD */
+
+/*
+ * MLDv2 query types.
+ */
+#define MLD_V2_GENERAL_QUERY		1
+#define MLD_V2_GROUP_QUERY		2
+#define MLD_V2_GROUP_SOURCE_QUERY	3
+
+/*
+ * Maximum report interval for MLDv1 host membership reports.
+ */
+#define MLD_V1_MAX_RI			10
+
+/*
+ * MLD_TIMER_SCALE denotes that the MLD code field specifies
+ * time in milliseconds.
+ */
+#define MLD_TIMER_SCALE			1000
+
+#endif /* _NETINET6_MLD6_H_ */

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 16:02:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1C601065670;
	Wed, 29 Apr 2009 16:02:52 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B3E5B8FC15;
	Wed, 29 Apr 2009 16:02:52 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TG2qX9084546;
	Wed, 29 Apr 2009 16:02:52 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TG2qqT084543;
	Wed, 29 Apr 2009 16:02:52 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200904291602.n3TG2qqT084543@svn.freebsd.org>
From: Jamie Gritton 
Date: Wed, 29 Apr 2009 16:02:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191668 - in head: lib/libc/sys sys/sys usr.sbin/jail
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 16:02:53 -0000

Author: jamie
Date: Wed Apr 29 16:02:52 2009
New Revision: 191668
URL: http://svn.freebsd.org/changeset/base/191668

Log:
  With the permission of phk@ change the license on remaining jail code
  to a 2 clause BSD license.
  
  Approved by:	phk
  Approved by:	bz (mentor)

Modified:
  head/lib/libc/sys/jail.2
  head/sys/sys/jail.h
  head/usr.sbin/jail/jail.c

Modified: head/lib/libc/sys/jail.2
==============================================================================
--- head/lib/libc/sys/jail.2	Wed Apr 29 15:22:58 2009	(r191667)
+++ head/lib/libc/sys/jail.2	Wed Apr 29 16:02:52 2009	(r191668)
@@ -1,10 +1,26 @@
+.\" Copyright (c) 1999 Poul-Henning Kamp.
+.\" All rights reserved.
 .\"
-.\" ----------------------------------------------------------------------------
-.\" "THE BEER-WARE LICENSE" (Revision 42):
-.\"  wrote this file.  As long as you retain this notice you
-.\" can do whatever you want with this stuff. If we meet some day, and you think
-.\" this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
-.\" ----------------------------------------------------------------------------
+.\" 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$
 .\"

Modified: head/sys/sys/jail.h
==============================================================================
--- head/sys/sys/jail.h	Wed Apr 29 15:22:58 2009	(r191667)
+++ head/sys/sys/jail.h	Wed Apr 29 16:02:52 2009	(r191668)
@@ -1,10 +1,27 @@
 /*-
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- *  wrote this file.  As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
- * ----------------------------------------------------------------------------
+ * Copyright (c) 1999 Poul-Henning Kamp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  *
  * $FreeBSD$
  */

Modified: head/usr.sbin/jail/jail.c
==============================================================================
--- head/usr.sbin/jail/jail.c	Wed Apr 29 15:22:58 2009	(r191667)
+++ head/usr.sbin/jail/jail.c	Wed Apr 29 16:02:52 2009	(r191668)
@@ -1,10 +1,27 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- *  wrote this file.  As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
- * ----------------------------------------------------------------------------
+/*-
+ * Copyright (c) 1999 Poul-Henning Kamp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #include 

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 16:54:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E056A106564A;
	Wed, 29 Apr 2009 16:54:26 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A2308FC18;
	Wed, 29 Apr 2009 16:54:26 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua)
	by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256)
	(Exim 4.63 (FreeBSD)) (envelope-from )
	id 1LzD39-000OKN-0p; Wed, 29 Apr 2009 19:54:23 +0300
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n3TGsHkV063398
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 29 Apr 2009 19:54:17 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id
	n3TGsHYO086267; Wed, 29 Apr 2009 19:54:17 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n3TGsHkX086266; 
	Wed, 29 Apr 2009 19:54:17 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Wed, 29 Apr 2009 19:54:17 +0300
From: Kostik Belousov 
To: Jeff Roberson 
Message-ID: <20090429165417.GG40751@deviant.kiev.zoral.com.ua>
References: <200904290315.n3T3FiJW067558@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="7fVr/IRGAG9sAW4J"
Content-Disposition: inline
In-Reply-To: <200904290315.n3T3FiJW067558@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: ClamAV version 0.94.2,
	clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
X-Virus-Scanned: mail.terabit.net.ua 1LzD39-000OKN-0p
	8121c4aa6e171d12d2c3816b10cfc230
X-Terabit: YES
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r191643 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 16:54:27 -0000


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

On Wed, Apr 29, 2009 at 03:15:44AM +0000, Jeff Roberson wrote:
> Author: jeff
> Date: Wed Apr 29 03:15:43 2009
> New Revision: 191643
> URL: http://svn.freebsd.org/changeset/base/191643
>=20
> Log:
>    - Remove the bogus idle thread state code.  This may have a race in it
>      and it only optimized out an ipi or mwait in very few cases.
>    - Skip the adaptive idle code when running on SMT or HTT cores.  This
>      just wastes cpu time that could be used on a busy thread on the same
>      core.
>    - Rename CG_FLAG_THREAD to CG_FLAG_SMT to be more descriptive.  Re-use
>      CG_FLAG_THREAD to mean SMT or HTT.
>  =20
>   Sponsored by:   Nokia
>=20
> Modified:
>   head/sys/kern/sched_ule.c
>   head/sys/kern/subr_smp.c
>   head/sys/sys/smp.h

Now I see a reason why it is better #ifdef SMP the code that uses CG_FLAG_*.
Also, we should check for tdq_cg !=3D NULL in one more place.

See the patch below, instead of exposing CG_FLAG_* for !SMP configs.

diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 680572d..fe3a119 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -891,6 +891,7 @@ tdq_move(struct tdq *from, struct tdq *to)
 	return (1);
 }
=20
+#ifdef SMP
 /*
  * This tdq has idled.  Try to steal a thread from another cpu and switch
  * to it.
@@ -947,6 +948,7 @@ tdq_idled(struct tdq *tdq)
 	spinlock_exit();
 	return (1);
 }
+#endif
=20
 /*
  * Notify a remote cpu of new work.  Sends an IPI if criteria are met.
@@ -2525,7 +2527,9 @@ sched_idletd(void *dummy)
 	struct thread *td;
 	struct tdq *tdq;
 	int switchcnt;
+#ifdef SMP
 	int i;
+#endif
=20
 	mtx_assert(&Giant, MA_NOTOWNED);
 	td =3D curthread;
@@ -2543,7 +2547,9 @@ sched_idletd(void *dummy)
 		 * loops while on SMT machines as this simply steals
 		 * cycles from cores doing useful work.
 		 */
-		if ((tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) =3D=3D 0 &&
+#ifdef SMP
+		if (tdq->tdq_cg !=3D NULL &&
+		    (tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) =3D=3D 0 &&
 		    switchcnt > sched_idlespinthresh) {
 			for (i =3D 0; i < sched_idlespins; i++) {
 				if (tdq->tdq_load)
@@ -2551,6 +2557,7 @@ sched_idletd(void *dummy)
 				cpu_spinwait();
 			}
 		}
+#endif
 		switchcnt =3D tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt;
 		if (tdq->tdq_load =3D=3D 0)
 			cpu_idle(switchcnt > 1);

--7fVr/IRGAG9sAW4J
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iEYEARECAAYFAkn4hjgACgkQC3+MBN1Mb4hsoACfVDIzV4KqZR5Zi/scpiolmWf6
L/UAn0dGosIBRmlW16kn/07cNChsla6g
=MG++
-----END PGP SIGNATURE-----

--7fVr/IRGAG9sAW4J--

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 17:02:02 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EC1D91065672;
	Wed, 29 Apr 2009 17:02:02 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3])
	by mx1.freebsd.org (Postfix) with ESMTP id A15588FC2A;
	Wed, 29 Apr 2009 17:02:02 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from localhost (amavis.fra.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id ADA1A41C75D;
	Wed, 29 Apr 2009 18:45:06 +0200 (CEST)
X-Virus-Scanned: amavisd-new at cksoft.de
Received: from mail.cksoft.de ([195.88.108.3])
	by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new,
	port 10024)
	with ESMTP id OCL2qAIQg6hd; Wed, 29 Apr 2009 18:45:06 +0200 (CEST)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id 3D4C441C75B; Wed, 29 Apr 2009 18:45:06 +0200 (CEST)
Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net
	[10.111.66.10])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.int.zabbadoz.net (Postfix) with ESMTP id AAFBA4448E6;
	Wed, 29 Apr 2009 16:43:50 +0000 (UTC)
Date: Wed, 29 Apr 2009 16:43:50 +0000 (UTC)
From: "Bjoern A. Zeeb" 
X-X-Sender: bz@maildrop.int.zabbadoz.net
To: Jeff Roberson 
In-Reply-To: <200904290315.n3T3FiJW067558@svn.freebsd.org>
Message-ID: <20090429164314.F15361@maildrop.int.zabbadoz.net>
References: <200904290315.n3T3FiJW067558@svn.freebsd.org>
X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r191643 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 17:02:03 -0000

On Wed, 29 Apr 2009, Jeff Roberson wrote:

> Author: jeff
> Date: Wed Apr 29 03:15:43 2009
> New Revision: 191643
> URL: http://svn.freebsd.org/changeset/base/191643
>
> Log:
>   - Remove the bogus idle thread state code.  This may have a race in it
>     and it only optimized out an ipi or mwait in very few cases.
>   - Skip the adaptive idle code when running on SMT or HTT cores.  This
>     just wastes cpu time that could be used on a busy thread on the same
>     core.
>   - Rename CG_FLAG_THREAD to CG_FLAG_SMT to be more descriptive.  Re-use
>     CG_FLAG_THREAD to mean SMT or HTT.
>
>  Sponsored by:   Nokia

I think it was this of your commits that broke various kernels on
ia64, arm, powerpc, ..


-- 
Bjoern A. Zeeb                      The greatest risk is not taking one.

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 18:08:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 243C8106566C;
	Wed, 29 Apr 2009 18:08:19 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EC6C08FC1A;
	Wed, 29 Apr 2009 18:08:18 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TI8IxK087080;
	Wed, 29 Apr 2009 18:08:18 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TI8IJ0087079;
	Wed, 29 Apr 2009 18:08:18 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200904291808.n3TI8IJ0087079@svn.freebsd.org>
From: Warner Losh 
Date: Wed, 29 Apr 2009 18:08:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191670 - head/bin/rm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 18:08:19 -0000

Author: imp
Date: Wed Apr 29 18:08:18 2009
New Revision: 191670
URL: http://svn.freebsd.org/changeset/base/191670

Log:
  Implement ^T support for rm: now it will report the next file it
  removes when you hit ^T.  This is similar to what's done for cp.  The
  signal handler and type definitions for "info" were borrowed directly
  from cp.

Modified:
  head/bin/rm/rm.c

Modified: head/bin/rm/rm.c
==============================================================================
--- head/bin/rm/rm.c	Wed Apr 29 17:50:48 2009	(r191669)
+++ head/bin/rm/rm.c	Wed Apr 29 18:08:18 2009	(r191670)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
 int rflag, Iflag;
 uid_t uid;
+volatile sig_atomic_t info;
 
 int	check(char *, char *, struct stat *);
 int	check2(char **);
@@ -68,6 +69,7 @@ void	checkslash(char **);
 void	rm_file(char **);
 int	rm_overwrite(char *, struct stat *);
 void	rm_tree(char **);
+static void siginfo(int __unused);
 void	usage(void);
 
 /*
@@ -150,6 +152,7 @@ main(int argc, char *argv[])
 		checkslash(argv);
 	uid = geteuid();
 
+	(void)signal(SIGINFO, siginfo);
 	if (*argv) {
 		stdin_ok = isatty(STDIN_FILENO);
 
@@ -266,6 +269,11 @@ rm_tree(char **argv)
 					if (rval == 0 && vflag)
 						(void)printf("%s\n",
 						    p->fts_path);
+					if (rval == 0 && info) {
+						info = 0;
+						(void)printf("%s\n",
+						    p->fts_path);
+					}
 					continue;
 				}
 				break;
@@ -276,6 +284,11 @@ rm_tree(char **argv)
 					if (vflag)
 						(void)printf("%s\n",
 						    p->fts_path);
+					if (info) {
+						info = 0;
+						(void)printf("%s\n",
+						    p->fts_path);
+					}
 					continue;
 				}
 				break;
@@ -297,6 +310,11 @@ rm_tree(char **argv)
 					if (rval == 0 && vflag)
 						(void)printf("%s\n",
 						    p->fts_path);
+					if (rval == 0 && info) {
+						info = 0;
+						(void)printf("%s\n",
+						    p->fts_path);
+					}
 					continue;
 				}
 			}
@@ -369,6 +387,10 @@ rm_file(char **argv)
 		}
 		if (vflag && rval == 0)
 			(void)printf("%s\n", f);
+		if (info && rval == 0) {
+			info = 0;
+			(void)printf("%s\n", f);
+		}
 	}
 }
 
@@ -592,3 +614,10 @@ usage(void)
 	    "       unlink file");
 	exit(EX_USAGE);
 }
+
+static void
+siginfo(int sig __unused)
+{
+
+	info = 1;
+}

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 18:41:08 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8E2C91065675;
	Wed, 29 Apr 2009 18:41:08 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 63C548FC20;
	Wed, 29 Apr 2009 18:41:08 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TIf8i6088077;
	Wed, 29 Apr 2009 18:41:08 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TIf8c2088076;
	Wed, 29 Apr 2009 18:41:08 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200904291841.n3TIf8c2088076@svn.freebsd.org>
From: Jamie Gritton 
Date: Wed, 29 Apr 2009 18:41:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191671 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 18:41:09 -0000

Author: jamie
Date: Wed Apr 29 18:41:08 2009
New Revision: 191671
URL: http://svn.freebsd.org/changeset/base/191671

Log:
  Some non-functional changes: whitespace, KASSERT strings, declaration order.
  
  Approved by:	bz (mentor)

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Wed Apr 29 18:08:18 2009	(r191670)
+++ head/sys/kern/kern_jail.c	Wed Apr 29 18:41:08 2009	(r191671)
@@ -121,13 +121,13 @@ int	prisoncount = 0;
 
 static void init_prison(void *);
 static void prison_complete(void *context, int pending);
-static int sysctl_jail_list(SYSCTL_HANDLER_ARGS);
 #ifdef INET
 static int _prison_check_ip4(struct prison *pr, struct in_addr *ia);
 #endif
 #ifdef INET6
 static int _prison_check_ip6(struct prison *pr, struct in6_addr *ia6);
 #endif
+static int sysctl_jail_list(SYSCTL_HANDLER_ARGS);
 
 static void
 init_prison(void *data __unused)
@@ -765,7 +765,7 @@ prison_hold_locked(struct prison *pr)
 
 	mtx_assert(&pr->pr_mtx, MA_OWNED);
 	KASSERT(pr->pr_ref > 0,
-	    ("Trying to hold dead prison (id=%d).", pr->pr_id));
+	    ("Trying to hold dead prison (jid=%d).", pr->pr_id));
 	pr->pr_ref++;
 }
 
@@ -784,7 +784,8 @@ prison_proc_hold(struct prison *pr)
 
 	mtx_lock(&pr->pr_mtx);
 	KASSERT(pr->pr_state == PRISON_STATE_ALIVE,
-	    ("Cannot add a process to a non-alive prison (id=%d).", pr->pr_id));
+	    ("Cannot add a process to a non-alive prison (jid=%d).",
+	    pr->pr_id));
 	pr->pr_nprocs++;
 	mtx_unlock(&pr->pr_mtx);
 }
@@ -795,7 +796,7 @@ prison_proc_free(struct prison *pr)
 
 	mtx_lock(&pr->pr_mtx);
 	KASSERT(pr->pr_state == PRISON_STATE_ALIVE && pr->pr_nprocs > 0,
-	    ("Trying to kill a process in a dead prison (id=%d).", pr->pr_id));
+	    ("Trying to kill a process in a dead prison (jid=%d).", pr->pr_id));
 	pr->pr_nprocs--;
 	if (pr->pr_nprocs == 0)
 		pr->pr_state = PRISON_STATE_DYING;
@@ -821,7 +822,6 @@ prison_get_ip4(struct ucred *cred, struc
 	KASSERT(ia != NULL, ("%s: ia is NULL", __func__));
 
 	if (!jailed(cred))
-		/* Do not change address passed in. */
 		return (0);
 	if (cred->cr_prison->pr_ip4 == NULL)
 		return (EAFNOSUPPORT);

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 19:01:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 79D5210656BD;
	Wed, 29 Apr 2009 19:01:27 +0000 (UTC)
	(envelope-from andreast-list@fgznet.ch)
Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47])
	by mx1.freebsd.org (Postfix) with ESMTP id 1227A8FC17;
	Wed, 29 Apr 2009 19:01:26 +0000 (UTC)
	(envelope-from andreast-list@fgznet.ch)
Received: from wolfram.andreas.nets ([91.190.8.131])
	by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id
	n3TJ1Nk0015236; Wed, 29 Apr 2009 21:01:23 +0200 (CEST)
	(envelope-from andreast-list@fgznet.ch)
Message-ID: <49F8A403.6070209@fgznet.ch>
Date: Wed, 29 Apr 2009 21:01:23 +0200
From: Andreas Tobler 
User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302)
MIME-Version: 1.0
To: Kostik Belousov 
References: <200904290315.n3T3FiJW067558@svn.freebsd.org>
	<20090429165417.GG40751@deviant.kiev.zoral.com.ua>
In-Reply-To: <20090429165417.GG40751@deviant.kiev.zoral.com.ua>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47
Cc: svn-src-head@freebsd.org, Jeff Roberson ,
	src-committers@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r191643 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 19:01:28 -0000

Kostik Belousov wrote:
> On Wed, Apr 29, 2009 at 03:15:44AM +0000, Jeff Roberson wrote:
>> Author: jeff
>> Date: Wed Apr 29 03:15:43 2009
>> New Revision: 191643
>> URL: http://svn.freebsd.org/changeset/base/191643
>>
>> Log:
>>    - Remove the bogus idle thread state code.  This may have a race in it
>>      and it only optimized out an ipi or mwait in very few cases.
>>    - Skip the adaptive idle code when running on SMT or HTT cores.  This
>>      just wastes cpu time that could be used on a busy thread on the same
>>      core.
>>    - Rename CG_FLAG_THREAD to CG_FLAG_SMT to be more descriptive.  Re-use
>>      CG_FLAG_THREAD to mean SMT or HTT.
>>   
>>   Sponsored by:   Nokia
>>
>> Modified:
>>   head/sys/kern/sched_ule.c
>>   head/sys/kern/subr_smp.c
>>   head/sys/sys/smp.h
> 
> Now I see a reason why it is better #ifdef SMP the code that uses CG_FLAG_*.
> Also, we should check for tdq_cg != NULL in one more place.
> 
> See the patch below, instead of exposing CG_FLAG_* for !SMP configs.
> 
> diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
> index 680572d..fe3a119 100644
> --- a/sys/kern/sched_ule.c
> +++ b/sys/kern/sched_ule.c
> @@ -891,6 +891,7 @@ tdq_move(struct tdq *from, struct tdq *to)
>  	return (1);
>  }
>  
> +#ifdef SMP
>  /*
>   * This tdq has idled.  Try to steal a thread from another cpu and switch
>   * to it.
> @@ -947,6 +948,7 @@ tdq_idled(struct tdq *tdq)
>  	spinlock_exit();
>  	return (1);
>  }
> +#endif
>  
>  /*
>   * Notify a remote cpu of new work.  Sends an IPI if criteria are met.
> @@ -2525,7 +2527,9 @@ sched_idletd(void *dummy)
>  	struct thread *td;
>  	struct tdq *tdq;
>  	int switchcnt;
> +#ifdef SMP
>  	int i;
> +#endif
>  
>  	mtx_assert(&Giant, MA_NOTOWNED);
>  	td = curthread;
> @@ -2543,7 +2547,9 @@ sched_idletd(void *dummy)
>  		 * loops while on SMT machines as this simply steals
>  		 * cycles from cores doing useful work.
>  		 */
> -		if ((tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) == 0 &&
> +#ifdef SMP
> +		if (tdq->tdq_cg != NULL &&
> +		    (tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) == 0 &&
>  		    switchcnt > sched_idlespinthresh) {
>  			for (i = 0; i < sched_idlespins; i++) {
>  				if (tdq->tdq_load)
> @@ -2551,6 +2557,7 @@ sched_idletd(void *dummy)
>  				cpu_spinwait();
>  			}
>  		}
> +#endif
>  		switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt;
>  		if (tdq->tdq_load == 0)
>  			cpu_idle(switchcnt > 1);



Fyi, with the above patch I can build amd64, sparc64 and powerpc kernel.

Andreas

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 19:19:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 37B241065672;
	Wed, 29 Apr 2009 19:19:14 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 235228FC17;
	Wed, 29 Apr 2009 19:19:14 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TJJEhW088942;
	Wed, 29 Apr 2009 19:19:14 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TJJDIs088930;
	Wed, 29 Apr 2009 19:19:13 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200904291919.n3TJJDIs088930@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 29 Apr 2009 19:19:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191672 - in head: . sys/conf sys/kern sys/netinet
	sys/netinet6 sys/sys usr.sbin/ifmcstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 19:19:14 -0000

Author: bms
Date: Wed Apr 29 19:19:13 2009
New Revision: 191672
URL: http://svn.freebsd.org/changeset/base/191672

Log:
  Bite the bullet, and make the IPv6 SSM and MLDv2 mega-commit:
  import from p4 bms_netdev.  Summary of changes:
  
   * Connect netinet6/in6_mcast.c to build.
     The legacy KAME KPIs are mostly preserved.
   * Eliminate now dead code from ip6_output.c.
     Don't do mbuf bingo, we are not going to do RFC 2292 style
     CMSG tricks for multicast options as they are not required
     by any current IPv6 normative reference.
   * Refactor transports (UDP, raw_ip6) to do own mcast filtering.
     SCTP, TCP unaffected by this change.
   * Add ip6_msource, in6_msource structs to in6_var.h.
   * Hookup mld_ifinfo state to in6_ifextra, allocate from
     domifattach path.
   * Eliminate IN6_LOOKUP_MULTI(), it is no longer referenced.
     Kernel consumers which need this should use in6m_lookup().
   * Refactor IPv6 socket group memberships to use a vector (like IPv4).
   * Update ifmcstat(8) for IPv6 SSM.
   * Add witness lock order for IN6_MULTI_LOCK.
   * Move IN6_MULTI_LOCK out of lower ip6_output()/ip6_input() paths.
   * Introduce IP6STAT_ADD/SUB/INC/DEC as per rwatson's IPv4 cleanup.
   * Update carp(4) for new IPv6 SSM KPIs.
   * Virtualize ip6_mrouter socket.
     Changes mostly localized to IPv6 MROUTING.
   * Don't do a local group lookup in MROUTING.
   * Kill unused KAME prototypes in6_purgemkludge(), in6_restoremkludge().
   * Preserve KAME DAD timer jitter behaviour in MLDv1 compatibility mode.
   * Bump __FreeBSD_version to 800084.
   * Update UPDATING.
  
  NOTE WELL:
   * This code hasn't been tested against real MLDv2 queriers
     (yet), although the on-wire protocol has been verified in Wireshark.
   * There are a few unresolved issues in the socket layer APIs to
     do with scope ID propagation.
   * There is a LOR present in ip6_output()'s use of
     in6_setscope() which needs to be resolved. See comments in mld6.c.
     This is believed to be benign and can't be avoided for the moment
     without re-introducing an indirect netisr.
  
  This work was mostly derived from the IGMPv3 implementation, and
  has been sponsored by a third party.

Modified:
  head/UPDATING
  head/sys/conf/files
  head/sys/kern/subr_witness.c
  head/sys/netinet/ip_carp.c
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_ifattach.c
  head/sys/netinet6/in6_mcast.c
  head/sys/netinet6/in6_pcb.c
  head/sys/netinet6/in6_proto.c
  head/sys/netinet6/in6_var.h
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_mroute.c
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/ip6_var.h
  head/sys/netinet6/mld6.c
  head/sys/netinet6/mld6_var.h
  head/sys/netinet6/raw_ip6.c
  head/sys/netinet6/udp6_usrreq.c
  head/sys/netinet6/vinet6.h
  head/sys/sys/param.h
  head/usr.sbin/ifmcstat/ifmcstat.c

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/UPDATING	Wed Apr 29 19:19:13 2009	(r191672)
@@ -22,6 +22,92 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20090429:
+	MLDv2 and Source-Specific Multicast (SSM) have been merged
+	to the IPv6 stack. VIMAGE hooks are in but not yet used.
+	The implementation of SSM within FreeBSD's IPv6 stack closely
+	follows the IPv4 implementation.
+
+	For kernel developers:
+
+	* The most important changes are that the ip6_output() and
+	  ip6_input() paths no longer take the IN6_MULTI_LOCK,
+	  and this lock has been downgraded to a non-recursive mutex.
+
+	* As with the changes to the IPv4 stack to support SSM, filtering
+	  of inbound multicast traffic must now be performed by transport
+	  protocols within the IPv6 stack. This does not apply to TCP and
+	  SCTP, however, it does apply to UDP in IPv6 and raw IPv6.
+
+	* The KPIs used by IPv6 multicast are similar to those used by
+	  the IPv4 stack, with the following differences:
+	   * im6o_mc_filter() is analogous to imo_multicast_filter().
+	   * The legacy KAME entry points in6_joingroup and in6_leavegroup()
+	     are shimmed to in6_mc_join() and in6_mc_leave() respectively.
+	   * IN6_LOOKUP_MULTI() has been deprecated and removed.
+	   * IPv6 relies on MLD for the DAD mechanism. KAME's internal KPIs
+	     for MLDv1 have an additional 'timer' argument which is used to
+	     jitter the initial membership report for the solicited-node
+	     multicast membership on-link.
+	   * This is not strictly needed for MLDv2, which already jitters
+	     its report transmissions.  However, the 'timer' argument is
+	     preserved in case MLDv1 is active on the interface.
+
+	* The KAME linked-list based IPv6 membership implementation has
+	  been refactored to use a vector similar to that used by the IPv4
+	  stack.
+	  Code which maintains a list of its own multicast memberships
+	  internally, e.g. carp, has been updated to reflect the new
+	  semantics.
+
+	* There is a known Lock Order Reversal (LOR) due to in6_setscope()
+	  acquiring the IF_AFDATA_LOCK and being called within ip6_output().
+	  Whilst MLDv2 tries to avoid this otherwise benign LOR, it is an
+	  implementation constraint which needs to be addressed in HEAD.
+
+	For application developers:
+
+	* The changes are broadly similar to those made for the IPv4
+	  stack.
+
+	* The use of IPv4 and IPv6 multicast socket options on the same
+	  socket, using mapped addresses, HAS NOT been tested or supported.
+
+	* There are a number of issues with the implementation of various
+	  IPv6 multicast APIs which need to be resolved in the API surface
+	  before the implementation is fully compatible with KAME userland
+	  use, and these are mostly to do with interface index treatment.
+
+	* The literature available discusses the use of either the delta / ASM
+	  API with setsockopt(2)/getsockopt(2), or the full-state / ASM API
+	  using setsourcefilter(3)/getsourcefilter(3). For more information
+	  please refer to RFC 3768, 'Socket Interface Extensions for
+	  Multicast Source Filters'.
+
+	* Applications which use the published RFC 3678 APIs should be fine.
+
+	For systems administrators:
+
+	* The mtest(8) utility has been refactored to support IPv6, in
+	  addition to IPv4. Interface addresses are no longer accepted
+	  as arguments, their names must be used instead. The utility
+	  will map the interface name to its first IPv4 address as
+	  returned by getifaddrs(3).
+
+	* The ifmcstat(8) utility has also been updated to print the MLDv2
+	  endpoint state and source filter lists via sysctl(3).
+
+	* The net.inet6.ip6.mcast.loop sysctl may be tuned to 0 to disable
+	  loopback of IPv6 multicast datagrams by default; it defaults to 1
+	  to preserve the existing behaviour. Disabling multicast loopback is
+	  recommended for optimal system performance.
+
+	* The IPv6 MROUTING code has been changed to examine this sysctl
+	  instead of attempting to perform a group lookup before looping
+	  back forwarded datagrams.
+
+	Bump __FreeBSD_version to 800084.
+
 20090422:
 	Implement low-level Bluetooth HCI API.
 	Bump __FreeBSD_version to 800083.

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/conf/files	Wed Apr 29 19:19:13 2009	(r191672)
@@ -2381,6 +2381,7 @@ netinet6/in6.c			optional inet6
 netinet6/in6_cksum.c		optional inet6
 netinet6/in6_gif.c		optional gif inet6
 netinet6/in6_ifattach.c		optional inet6
+netinet6/in6_mcast.c		optional inet6
 netinet6/in6_pcb.c		optional inet6
 netinet6/in6_proto.c		optional inet6
 netinet6/in6_rmx.c		optional inet6

Modified: head/sys/kern/subr_witness.c
==============================================================================
--- head/sys/kern/subr_witness.c	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/kern/subr_witness.c	Wed Apr 29 19:19:13 2009	(r191672)
@@ -512,7 +512,8 @@ static struct witness_order_list_entry o
 	{ "ifaddr", &lock_class_mtx_sleep },
 	{ NULL, NULL },
 	/*
-	 * Multicast - protocol locks before interface locks, after UDP locks.
+	 * IPv4 multicast:
+	 * protocol locks before interface locks, after UDP locks.
 	 */
 	{ "udpinp", &lock_class_rw },
 	{ "in_multi_mtx", &lock_class_mtx_sleep },
@@ -520,6 +521,15 @@ static struct witness_order_list_entry o
 	{ "if_addr_mtx", &lock_class_mtx_sleep },
 	{ NULL, NULL },
 	/*
+	 * IPv6 multicast:
+	 * protocol locks before interface locks, after UDP locks.
+	 */
+	{ "udpinp", &lock_class_rw },
+	{ "in6_multi_mtx", &lock_class_mtx_sleep },
+	{ "mld_mtx", &lock_class_mtx_sleep },
+	{ "if_addr_mtx", &lock_class_mtx_sleep },
+	{ NULL, NULL },
+	/*
 	 * UNIX Domain Sockets
 	 */
 	{ "unp_global_rwlock", &lock_class_rw },

Modified: head/sys/netinet/ip_carp.c
==============================================================================
--- head/sys/netinet/ip_carp.c	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/netinet/ip_carp.c	Wed Apr 29 19:19:13 2009	(r191672)
@@ -400,15 +400,20 @@ carp_clone_create(struct if_clone *ifc, 
 	sc->sc_advskew = 0;
 	sc->sc_init_counter = 1;
 	sc->sc_naddrs = sc->sc_naddrs6 = 0; /* M_ZERO? */
-#ifdef INET6
-	sc->sc_im6o.im6o_multicast_hlim = CARP_DFLTTL;
-#endif
 	sc->sc_imo.imo_membership = (struct in_multi **)malloc(
 	    (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_CARP,
 	    M_WAITOK);
 	sc->sc_imo.imo_mfilters = NULL;
 	sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS;
 	sc->sc_imo.imo_multicast_vif = -1;
+#ifdef INET6
+	sc->sc_im6o.im6o_membership = (struct in6_multi **)malloc(
+	    (sizeof(struct in6_multi *) * IPV6_MIN_MEMBERSHIPS), M_CARP,
+	    M_WAITOK);
+	sc->sc_im6o.im6o_mfilters = NULL;
+	sc->sc_im6o.im6o_max_memberships = IPV6_MIN_MEMBERSHIPS;
+	sc->sc_im6o.im6o_multicast_hlim = CARP_DFLTTL;
+#endif
 
 	callout_init(&sc->sc_ad_tmo, CALLOUT_MPSAFE);
 	callout_init(&sc->sc_md_tmo, CALLOUT_MPSAFE);
@@ -448,6 +453,9 @@ carp_clone_destroy(struct ifnet *ifp)
 	if_detach(ifp);
 	if_free_type(ifp, IFT_ETHER);
 	free(sc->sc_imo.imo_membership, M_CARP);
+#ifdef INET6
+	free(sc->sc_im6o.im6o_membership, M_CARP);
+#endif
 	free(sc, M_CARP);
 }
 
@@ -1449,14 +1457,17 @@ static void
 carp_multicast6_cleanup(struct carp_softc *sc)
 {
 	struct ip6_moptions *im6o = &sc->sc_im6o;
+	u_int16_t n = im6o->im6o_num_memberships;
 
-	while (!LIST_EMPTY(&im6o->im6o_memberships)) {
-		struct in6_multi_mship *imm =
-		    LIST_FIRST(&im6o->im6o_memberships);
-
-		LIST_REMOVE(imm, i6mm_chain);
-		in6_leavegroup(imm);
+	while (n-- > 0) {
+		if (im6o->im6o_membership[n] != NULL) {
+			in6_mc_leave(im6o->im6o_membership[n], NULL);
+			im6o->im6o_membership[n] = NULL;
+		}
 	}
+	KASSERT(im6o->im6o_mfilters == NULL,
+	   ("%s: im6o_mfilters != NULL", __func__));
+	im6o->im6o_num_memberships = 0;
 	im6o->im6o_multicast_ifp = NULL;
 }
 #endif
@@ -1635,10 +1646,11 @@ carp_set_addr6(struct carp_softc *sc, st
 	struct carp_if *cif;
 	struct in6_ifaddr *ia, *ia_if;
 	struct ip6_moptions *im6o = &sc->sc_im6o;
-	struct in6_multi_mship *imm;
 	struct in6_addr in6;
 	int own, error;
 
+	error = 0;
+
 	if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
 		if (!(SC2IFP(sc)->if_flags & IFF_UP))
 			carp_set_state(sc, INIT);
@@ -1686,6 +1698,8 @@ carp_set_addr6(struct carp_softc *sc, st
 		return (EADDRNOTAVAIL);
 
 	if (!sc->sc_naddrs6) {
+		struct in6_multi *in6m;
+
 		im6o->im6o_multicast_ifp = ifp;
 
 		/* join CARP multicast address */
@@ -1694,9 +1708,12 @@ carp_set_addr6(struct carp_softc *sc, st
 		in6.s6_addr8[15] = 0x12;
 		if (in6_setscope(&in6, ifp, NULL) != 0)
 			goto cleanup;
-		if ((imm = in6_joingroup(ifp, &in6, &error, 0)) == NULL)
+		in6m = NULL;
+		error = in6_mc_join(ifp, &in6, NULL, &in6m, 0);
+		if (error)
 			goto cleanup;
-		LIST_INSERT_HEAD(&im6o->im6o_memberships, imm, i6mm_chain);
+		im6o->im6o_membership[0] = in6m;
+		im6o->im6o_num_memberships++;
 
 		/* join solicited multicast address */
 		bzero(&in6, sizeof(in6));
@@ -1707,9 +1724,12 @@ carp_set_addr6(struct carp_softc *sc, st
 		in6.s6_addr8[12] = 0xff;
 		if (in6_setscope(&in6, ifp, NULL) != 0)
 			goto cleanup;
-		if ((imm = in6_joingroup(ifp, &in6, &error, 0)) == NULL)
+		in6m = NULL;
+		error = in6_mc_join(ifp, &in6, NULL, &in6m, 0);
+		if (error)
 			goto cleanup;
-		LIST_INSERT_HEAD(&im6o->im6o_memberships, imm, i6mm_chain);
+		im6o->im6o_membership[1] = in6m;
+		im6o->im6o_num_memberships++;
 	}
 
 	if (!ifp->if_carp) {
@@ -1781,14 +1801,8 @@ carp_set_addr6(struct carp_softc *sc, st
 	return (0);
 
 cleanup:
-	/* clean up multicast memberships */
-	if (!sc->sc_naddrs6) {
-		while (!LIST_EMPTY(&im6o->im6o_memberships)) {
-			imm = LIST_FIRST(&im6o->im6o_memberships);
-			LIST_REMOVE(imm, i6mm_chain);
-			in6_leavegroup(imm);
-		}
-	}
+	if (!sc->sc_naddrs6)
+		carp_multicast6_cleanup(sc);
 	return (error);
 }
 
@@ -1799,21 +1813,13 @@ carp_del_addr6(struct carp_softc *sc, st
 
 	if (!--sc->sc_naddrs6) {
 		struct carp_if *cif = (struct carp_if *)sc->sc_carpdev->if_carp;
-		struct ip6_moptions *im6o = &sc->sc_im6o;
 
 		CARP_LOCK(cif);
 		callout_stop(&sc->sc_ad_tmo);
 		SC2IFP(sc)->if_flags &= ~IFF_UP;
 		SC2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING;
 		sc->sc_vhid = -1;
-		while (!LIST_EMPTY(&im6o->im6o_memberships)) {
-			struct in6_multi_mship *imm =
-			    LIST_FIRST(&im6o->im6o_memberships);
-
-			LIST_REMOVE(imm, i6mm_chain);
-			in6_leavegroup(imm);
-		}
-		im6o->im6o_multicast_ifp = NULL;
+		carp_multicast6_cleanup(sc);
 		TAILQ_REMOVE(&cif->vhif_vrs, sc, sc_list);
 		if (!--cif->vhif_nvrs) {
 			CARP_LOCK_DESTROY(cif);

Modified: head/sys/netinet6/icmp6.c
==============================================================================
--- head/sys/netinet6/icmp6.c	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/netinet6/icmp6.c	Wed Apr 29 19:19:13 2009	(r191672)
@@ -147,8 +147,6 @@ icmp6_init(void)
 	INIT_VNET_INET6(curvnet);
 
 	V_icmp6errpps_count = 0;
-
-	mld6_init();
 }
 
 static void
@@ -429,6 +427,23 @@ icmp6_input(struct mbuf **mp, int *offp,
 	}
 
 	/*
+	 * Check multicast group membership.
+	 * Note: SSM filters are not applied for ICMPv6 traffic.
+	 */
+	if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
+		struct ifnet *ifp;
+		struct in6_multi *inm;
+
+		ifp = m->m_pkthdr.rcvif;
+		inm = in6m_lookup(ifp, &ip6->ip6_dst);
+		if (inm == NULL) {
+			IP6STAT_INC(ip6s_notmember);
+			in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard);
+			goto freeit;
+		}
+	}
+
+	/*
 	 * calculate the checksum
 	 */
 #ifndef PULLDOWN_TEST
@@ -615,34 +630,20 @@ icmp6_input(struct mbuf **mp, int *offp,
 
 	case MLD_LISTENER_QUERY:
 	case MLD_LISTENER_REPORT:
-		if (icmp6len < sizeof(struct mld_hdr))
-			goto badlen;
-		if (icmp6->icmp6_type == MLD_LISTENER_QUERY) /* XXX: ugly... */
-			icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mldquery);
-		else
-			icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mldreport);
-		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
-			/* give up local */
-			mld6_input(m, off);
-			m = NULL;
+	case MLD_LISTENER_DONE:
+	case MLDV2_LISTENER_REPORT:
+		/*
+		 * Drop MLD traffic which is not link-local.
+		 * XXX Should we also sanity check that these messages
+		 * were directed to a link-local multicast prefix?
+		 */
+		if (ip6->ip6_hlim != 1)
 			goto freeit;
-		}
-		mld6_input(n, off);
+		if (mld_input(m, off, icmp6len) != 0)
+			return (IPPROTO_DONE);
 		/* m stays. */
 		break;
 
-	case MLD_LISTENER_DONE:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mlddone);
-		if (icmp6len < sizeof(struct mld_hdr))	/* necessary? */
-			goto badlen;
-		break;		/* nothing to be done in kernel */
-
-	case MLD_MTRACE_RESP:
-	case MLD_MTRACE:
-		/* XXX: these two are experimental.  not officially defined. */
-		/* XXX: per-interface statistics? */
-		break;		/* just pass it to applications */
-
 	case ICMP6_WRUREQUEST:	/* ICMP6_FQDN_QUERY */
 	    {
 		enum { WRU, FQDN } mode;
@@ -2050,7 +2051,7 @@ icmp6_rip6_input(struct mbuf **mp, int o
 		INP_RUNLOCK(last);
 	} else {
 		m_freem(m);
-		V_ip6stat.ip6s_delivered--;
+		IP6STAT_DEC(ip6s_delivered);
 	}
 	return IPPROTO_DONE;
 }
@@ -2222,7 +2223,14 @@ void
 icmp6_fasttimo(void)
 {
 
-	return;
+	mld_fasttimo();
+}
+
+void
+icmp6_slowtimo(void)
+{
+
+	mld_slowtimo();
 }
 
 static const char *

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/netinet6/in6.c	Wed Apr 29 19:19:13 2009	(r191672)
@@ -106,8 +106,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-MALLOC_DEFINE(M_IP6MADDR, "in6_multi", "internet multicast address");
-
 /*
  * Definitions of some costant IP6 addresses.
  */
@@ -119,6 +117,8 @@ const struct in6_addr in6addr_linklocal_
 	IN6ADDR_LINKLOCAL_ALLNODES_INIT;
 const struct in6_addr in6addr_linklocal_allrouters =
 	IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
+const struct in6_addr in6addr_linklocal_allv2routers =
+	IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT;
 
 const struct in6_addr in6mask0 = IN6MASK0;
 const struct in6_addr in6mask32 = IN6MASK32;
@@ -135,7 +135,6 @@ static int in6_ifinit __P((struct ifnet 
 	struct sockaddr_in6 *, int));
 static void in6_unlink_ifa(struct in6_ifaddr *, struct ifnet *);
 
-struct in6_multihead in6_multihead;	/* XXX BSS initialization */
 int	(*faithprefix_p)(struct in6_addr *);
 
 
@@ -1110,10 +1109,12 @@ in6_update_ifa(struct ifnet *ifp, struct
 			 * should be larger than the MLD delay (this could be
 			 * relaxed a bit, but this simple logic is at least
 			 * safe).
+			 * XXX: Break data hiding guidelines and look at
+			 * state for the solicited multicast group.
 			 */
 			mindelay = 0;
 			if (in6m_sol != NULL &&
-			    in6m_sol->in6m_state == MLD_REPORTPENDING) {
+			    in6m_sol->in6m_state == MLD_REPORTING_MEMBER) {
 				mindelay = in6m_sol->in6m_timer;
 			}
 			maxdelay = MAX_RTR_SOLICITATION_DELAY * hz;
@@ -1590,36 +1591,6 @@ in6_ifinit(struct ifnet *ifp, struct in6
 	return (error);
 }
 
-struct in6_multi_mship *
-in6_joingroup(struct ifnet *ifp, struct in6_addr *addr,
-    int *errorp, int delay)
-{
-	struct in6_multi_mship *imm;
-
-	imm = malloc(sizeof(*imm), M_IP6MADDR, M_NOWAIT);
-	if (!imm) {
-		*errorp = ENOBUFS;
-		return NULL;
-	}
-	imm->i6mm_maddr = in6_addmulti(addr, ifp, errorp, delay);
-	if (!imm->i6mm_maddr) {
-		/* *errorp is alrady set */
-		free(imm, M_IP6MADDR);
-		return NULL;
-	}
-	return imm;
-}
-
-int
-in6_leavegroup(struct in6_multi_mship *imm)
-{
-
-	if (imm->i6mm_maddr)
-		in6_delmulti(imm->i6mm_maddr);
-	free(imm,  M_IP6MADDR);
-	return 0;
-}
-
 /*
  * Find an IPv6 interface link-local address specific to an interface.
  */
@@ -2328,6 +2299,9 @@ in6_domifattach(struct ifnet *ifp)
 		ext->lltable->llt_lookup = in6_lltable_lookup;
 		ext->lltable->llt_dump = in6_lltable_dump;
 	}
+
+	ext->mld_ifinfo = mld_domifattach(ifp);
+
 	return ext;
 }
 
@@ -2336,6 +2310,7 @@ in6_domifdetach(struct ifnet *ifp, void 
 {
 	struct in6_ifextra *ext = (struct in6_ifextra *)aux;
 
+	mld_domifdetach(ifp);
 	scope6_ifdetach(ext->scope6_id);
 	nd6_ifdetach(ext->nd_ifinfo);
 	lltable_free(ext->lltable);

Modified: head/sys/netinet6/in6_ifattach.c
==============================================================================
--- head/sys/netinet6/in6_ifattach.c	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/netinet6/in6_ifattach.c	Wed Apr 29 19:19:13 2009	(r191672)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -918,11 +919,35 @@ in6_tmpaddrtimer(void *ignored_arg)
 static void
 in6_purgemaddrs(struct ifnet *ifp)
 {
-	struct in6_multi *in6m;
-	struct in6_multi *oin6m;
+	INIT_VNET_INET6(ifp->if_vnet);
+	LIST_HEAD(,in6_multi)	 purgeinms;
+	struct in6_multi	*inm, *tinm;
+	struct ifmultiaddr	*ifma;
+
+	LIST_INIT(&purgeinms);
+	IN6_MULTI_LOCK();
 
-	LIST_FOREACH_SAFE(in6m, &in6_multihead, in6m_entry, oin6m) {
-		if (in6m->in6m_ifp == ifp)
-			in6_delmulti(in6m);
+	/*
+	 * Extract list of in6_multi associated with the detaching ifp
+	 * which the PF_INET6 layer is about to release.
+	 * We need to do this as IF_ADDR_LOCK() may be re-acquired
+	 * by code further down.
+	 */
+	IF_ADDR_LOCK(ifp);
+	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+		if (ifma->ifma_addr->sa_family != AF_INET6 ||
+		    ifma->ifma_protospec == NULL)
+			continue;
+		inm = (struct in6_multi *)ifma->ifma_protospec;
+		LIST_INSERT_HEAD(&purgeinms, inm, in6m_entry);
 	}
+	IF_ADDR_UNLOCK(ifp);
+
+	LIST_FOREACH_SAFE(inm, &purgeinms, in6m_entry, tinm) {
+		LIST_REMOVE(inm, in6m_entry);
+		in6m_release_locked(inm);
+	}
+	mld_ifdetach(ifp);
+
+	IN6_MULTI_UNLOCK();
 }

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/netinet6/in6_mcast.c	Wed Apr 29 19:19:13 2009	(r191672)
@@ -29,6 +29,7 @@
 
 /*
  * IPv6 multicast socket, group, and socket option processing module.
+ * Normative references: RFC 2292, RFC 3492, RFC 3542, RFC 3678, RFC 3810.
  */
 
 #include 
@@ -142,6 +143,9 @@ static struct ip6_moptions *
 static int	in6p_get_source_filters(struct inpcb *, struct sockopt *);
 static int	in6p_join_group(struct inpcb *, struct sockopt *);
 static int	in6p_leave_group(struct inpcb *, struct sockopt *);
+static struct ifnet *
+		in6p_lookup_mcast_ifp(const struct inpcb *,
+		    const struct sockaddr_in6 *);
 static int	in6p_block_unblock_source(struct inpcb *, struct sockopt *);
 static int	in6p_set_multicast_if(struct inpcb *, struct sockopt *);
 static int	in6p_set_source_filters(struct inpcb *, struct sockopt *);
@@ -1655,12 +1659,12 @@ int
 ip6_getmoptions(struct inpcb *inp, struct sockopt *sopt)
 {
 	INIT_VNET_INET6(curvnet);
-	struct ip6_moptions	*imo;
-	int			 error, optval;
-	u_char			 coptval;
+	struct ip6_moptions	*im6o;
+	int			 error;
+	u_int			 optval;
 
 	INP_WLOCK(inp);
-	imo = inp->in6p_moptions;
+	im6o = inp->in6p_moptions;
 	/*
 	 * If socket is neither of type SOCK_RAW or SOCK_DGRAM,
 	 * or is a divert socket, reject it.
@@ -1674,38 +1678,36 @@ ip6_getmoptions(struct inpcb *inp, struc
 
 	error = 0;
 	switch (sopt->sopt_name) {
-#if 0 /* XXX FIXME */
 	case IPV6_MULTICAST_IF:
-		if (imo == NULL || imo->im6o_multicast_ifp == NULL) {
+		if (im6o == NULL || im6o->im6o_multicast_ifp == NULL) {
 			optval = 0;
 		} else {
-			optval = imo->im6o_multicast_ifp->if_index;
+			optval = im6o->im6o_multicast_ifp->if_index;
 		}
 		INP_WUNLOCK(inp);
-		error = sooptcopyout(sopt, &ifindex, sizeof(u_int));
+		error = sooptcopyout(sopt, &optval, sizeof(u_int));
 		break;
-#endif
 
 	case IPV6_MULTICAST_HOPS:
-		if (imo == 0)
-			optval = coptval = V_ip6_defmcasthlim;
+		if (im6o == NULL)
+			optval = V_ip6_defmcasthlim;
 		else
-			optval = coptval = imo->im6o_multicast_loop;
+			optval = im6o->im6o_multicast_loop;
 		INP_WUNLOCK(inp);
 		error = sooptcopyout(sopt, &optval, sizeof(u_int));
 		break;
 
 	case IPV6_MULTICAST_LOOP:
-		if (imo == 0)
-			optval = coptval = IPV6_DEFAULT_MULTICAST_LOOP;
+		if (im6o == NULL)
+			optval = in6_mcast_loop; /* XXX VIMAGE */
 		else
-			optval = coptval = imo->im6o_multicast_loop;
+			optval = im6o->im6o_multicast_loop;
 		INP_WUNLOCK(inp);
 		error = sooptcopyout(sopt, &optval, sizeof(u_int));
 		break;
 
 	case IPV6_MSFILTER:
-		if (imo == NULL) {
+		if (im6o == NULL) {
 			error = EADDRNOTAVAIL;
 			INP_WUNLOCK(inp);
 		} else {
@@ -1725,7 +1727,57 @@ ip6_getmoptions(struct inpcb *inp, struc
 }
 
 /*
+ * Look up the ifnet to use for a multicast group membership,
+ * given the address of an IPv6 group.
+ *
+ * This routine exists to support legacy IPv6 multicast applications.
+ *
+ * If inp is non-NULL, use this socket's current FIB number for any
+ * required FIB lookup. Look up the group address in the unicast FIB,
+ * and use its ifp; usually, this points to the default next-hop.
+ * If the FIB lookup fails, return NULL.
+ *
+ * FUTURE: Support multiple forwarding tables for IPv6.
+ *
+ * Returns NULL if no ifp could be found.
+ */
+static struct ifnet *
+in6p_lookup_mcast_ifp(const struct inpcb *in6p __unused,
+    const struct sockaddr_in6 *gsin6)
+{
+	INIT_VNET_INET6(curvnet);
+	struct route_in6	 ro6;
+	struct ifnet		*ifp;
+
+	KASSERT(in6p->inp_vflag & INP_IPV6,
+	    ("%s: not INP_IPV6 inpcb", __func__));
+	KASSERT(gsin6->sin6_family == AF_INET6,
+	    ("%s: not AF_INET6 group", __func__));
+	KASSERT(IN6_IS_ADDR_MULTICAST(&gsin6->sin6_addr),
+	    ("%s: not multicast", __func__));
+
+	ifp = NULL;
+	memset(&ro6, 0, sizeof(struct route_in6));
+	memcpy(&ro6.ro_dst, gsin6, sizeof(struct sockaddr_in6));
+#ifdef notyet
+	rtalloc_ign_fib(&ro6, 0, inp ? inp->inp_inc.inc_fibnum : 0);
+#else
+	rtalloc_ign((struct route *)&ro6, 0);
+#endif
+	if (ro6.ro_rt != NULL) {
+		ifp = ro6.ro_rt->rt_ifp;
+		KASSERT(ifp != NULL, ("%s: null ifp", __func__));
+		RTFREE(ro6.ro_rt);
+	}
+
+	return (ifp);
+}
+
+/*
  * Join an IPv6 multicast group, possibly with a source.
+ *
+ * FIXME: The KAME use of the unspecified address (::)
+ * to join *all* multicast groups is currently unsupported.
  */
 static int
 in6p_join_group(struct inpcb *inp, struct sockopt *sopt)
@@ -1765,8 +1817,14 @@ in6p_join_group(struct inpcb *inp, struc
 		gsa->sin6.sin6_len = sizeof(struct sockaddr_in6);
 		gsa->sin6.sin6_addr = mreq.ipv6mr_multiaddr;
 
-		ifp = ifnet_byindex(mreq.ipv6mr_interface);
-
+		if (mreq.ipv6mr_interface == 0) {
+			ifp = in6p_lookup_mcast_ifp(inp, &gsa->sin6);
+		} else {
+			if (mreq.ipv6mr_interface < 0 ||
+			    V_if_index < mreq.ipv6mr_interface)
+				return (EADDRNOTAVAIL);
+			ifp = ifnet_byindex(mreq.ipv6mr_interface);
+		}
 		CTR3(KTR_MLD, "%s: ipv6mr_interface = %d, ifp = %p",
 		    __func__, mreq.ipv6mr_interface, ifp);
 	} break;
@@ -1813,12 +1871,35 @@ in6p_join_group(struct inpcb *inp, struc
 		break;
 	}
 
+#ifdef notyet
+	/*
+	 * FIXME: Check for unspecified address (all groups).
+	 * Do we have a normative reference for this 'feature'?
+	 *
+	 * We use the unspecified address to specify to accept
+	 * all multicast addresses. Only super user is allowed
+	 * to do this.
+	 * XXX-BZ might need a better PRIV_NETINET_x for this
+	 */
+	if (IN6_IS_ADDR_UNSPECIFIED(&gsa->sin6.sin6_addr)) {
+		error = priv_check(curthread, PRIV_NETINET_MROUTE);
+		if (error)
+		break;
+	} else
+#endif
 	if (!IN6_IS_ADDR_MULTICAST(&gsa->sin6.sin6_addr))
 		return (EINVAL);
 
 	if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0)
 		return (EADDRNOTAVAIL);
 
+#ifdef notyet
+	/*
+	 * FIXME: Set interface scope in group address.
+	 */
+	(void)in6_setscope(&gsa->sin6.sin_addr, ifp, NULL);
+#endif
+
 	/*
 	 * MCAST_JOIN_SOURCE on an exclusive membership is an error.
 	 * On an existing inclusive membership, it just adds the
@@ -1987,7 +2068,23 @@ in6p_leave_group(struct inpcb *inp, stru
 		gsa->sin6.sin6_family = AF_INET6;
 		gsa->sin6.sin6_len = sizeof(struct sockaddr_in6);
 		gsa->sin6.sin6_addr = mreq.ipv6mr_multiaddr;
-		ifp = ifnet_byindex(mreq.ipv6mr_interface);
+
+		if (mreq.ipv6mr_interface == 0) {
+#ifdef notyet
+			/*
+			 * FIXME: Resolve scope ambiguity when interface
+			 * index is unspecified.
+			 */
+			ifp = in6p_lookup_mcast_ifp(inp, &gsa->sin6);
+#else
+			return (EADDRNOTAVAIL);
+#endif
+		} else {
+			if (mreq.ipv6mr_interface < 0 ||
+			    V_if_index < mreq.ipv6mr_interface)
+				return (EADDRNOTAVAIL);
+			ifp = ifnet_byindex(mreq.ipv6mr_interface);
+		}
 
 		CTR3(KTR_MLD, "%s: ipv6mr_interface = %d, ifp = %p",
 		    __func__, mreq.ipv6mr_interface, ifp);
@@ -2033,6 +2130,15 @@ in6p_leave_group(struct inpcb *inp, stru
 	if (!IN6_IS_ADDR_MULTICAST(&gsa->sin6.sin6_addr))
 		return (EINVAL);
 
+#ifdef notyet
+	/*
+	 * FIXME: Need to embed ifp's scope ID in the address
+	 * handed down to MLD.
+	 * See KAME IPV6_LEAVE_GROUP implementation.
+	 */
+	(void)in6_setscope(&mreq->ipv6mr_multiaddr, ifp, NULL);
+#endif
+
 	/*
 	 * Find the membership in the membership array.
 	 */
@@ -2348,7 +2454,7 @@ out_in6p_locked:
 int
 ip6_setmoptions(struct inpcb *inp, struct sockopt *sopt)
 {
-	struct ip6_moptions	*imo;
+	struct ip6_moptions	*im6o;
 	int			 error;
 
 	error = 0;
@@ -2364,7 +2470,6 @@ ip6_setmoptions(struct inpcb *inp, struc
 
 	switch (sopt->sopt_name) {
 	case IPV6_MULTICAST_IF:
-		/* XXX in v6 this one is far more involved */
 		error = in6p_set_multicast_if(inp, sopt);
 		break;
 
@@ -2381,9 +2486,11 @@ ip6_setmoptions(struct inpcb *inp, struc
 		if (hlim < -1 || hlim > 255) {
 			error = EINVAL;
 			break;
+		} else if (hlim == -1) {
+			hlim = V_ip6_defmcasthlim;
 		}
-		imo = in6p_findmoptions(inp);
-		imo->im6o_multicast_hlim = hlim;
+		im6o = in6p_findmoptions(inp);
+		im6o->im6o_multicast_hlim = hlim;
 		INP_WUNLOCK(inp);
 		break;
 	}
@@ -2393,9 +2500,7 @@ ip6_setmoptions(struct inpcb *inp, struc
 
 		/*
 		 * Set the loopback flag for outgoing multicast packets.
-		 * Must be zero or one.  The orimcaddrl multicast API required a
-		 * char argument, which is inconsistent with the rest
-		 * of the socket API.  We allow either a char or an int.
+		 * Must be zero or one.
 		 */
 		if (sopt->sopt_valsize != sizeof(u_int)) {
 			error = EINVAL;
@@ -2404,8 +2509,12 @@ ip6_setmoptions(struct inpcb *inp, struc
 		error = sooptcopyin(sopt, &loop, sizeof(u_int), sizeof(u_int));
 		if (error)
 			break;
-		imo = in6p_findmoptions(inp);
-		imo->im6o_multicast_loop = loop;
+		if (loop > 1) {
+			error = EINVAL;
+			break;
+		}
+		im6o = in6p_findmoptions(inp);
+		im6o->im6o_multicast_loop = loop;
 		INP_WUNLOCK(inp);
 		break;
 	}

Modified: head/sys/netinet6/in6_pcb.c
==============================================================================
--- head/sys/netinet6/in6_pcb.c	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/netinet6/in6_pcb.c	Wed Apr 29 19:19:13 2009	(r191672)
@@ -733,36 +733,36 @@ in6_pcbpurgeif0(struct inpcbinfo *pcbinf
 {
 	struct inpcb *in6p;
 	struct ip6_moptions *im6o;
-	struct in6_multi_mship *imm, *nimm;
+	int i, gap;
 
 	INP_INFO_RLOCK(pcbinfo);
 	LIST_FOREACH(in6p, pcbinfo->ipi_listhead, inp_list) {
 		INP_WLOCK(in6p);
 		im6o = in6p->in6p_moptions;
-		if ((in6p->inp_vflag & INP_IPV6) &&
-		    im6o) {
+		if ((in6p->inp_vflag & INP_IPV6) && im6o != NULL) {
 			/*
-			 * Unselect the outgoing interface if it is being
-			 * detached.
+			 * Unselect the outgoing ifp for multicast if it
+			 * is being detached.
 			 */
 			if (im6o->im6o_multicast_ifp == ifp)
 				im6o->im6o_multicast_ifp = NULL;
-
 			/*
 			 * Drop multicast group membership if we joined
 			 * through the interface being detached.
-			 * XXX controversial - is it really legal for kernel
-			 * to force this?
 			 */
-			for (imm = im6o->im6o_memberships.lh_first;
-			     imm != NULL; imm = nimm) {
-				nimm = imm->i6mm_chain.le_next;
-				if (imm->i6mm_maddr->in6m_ifp == ifp) {
-					LIST_REMOVE(imm, i6mm_chain);
-					in6_delmulti(imm->i6mm_maddr);
-					free(imm, M_IP6MADDR);
+			gap = 0;
+			for (i = 0; i < im6o->im6o_num_memberships; i++) {
+				if (im6o->im6o_membership[i]->in6m_ifp ==
+				    ifp) {
+					in6_mc_leave(im6o->im6o_membership[i],
+					    NULL);
+					gap++;
+				} else if (gap != 0) {
+					im6o->im6o_membership[i - gap] =
+					    im6o->im6o_membership[i];
 				}
 			}
+			im6o->im6o_num_memberships -= gap;
 		}
 		INP_WUNLOCK(in6p);
 	}

Modified: head/sys/netinet6/in6_proto.c
==============================================================================
--- head/sys/netinet6/in6_proto.c	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/netinet6/in6_proto.c	Wed Apr 29 19:19:13 2009	(r191672)
@@ -236,6 +236,7 @@ struct ip6protosw inet6sw[] = {
 	.pr_ctloutput =		rip6_ctloutput,
 	.pr_init =		icmp6_init,
 	.pr_fasttimo =		icmp6_fasttimo,
+	.pr_slowtimo =		icmp6_slowtimo,
 	.pr_usrreqs =		&rip6_usrreqs
 },
 {

Modified: head/sys/netinet6/in6_var.h
==============================================================================
--- head/sys/netinet6/in6_var.h	Wed Apr 29 18:41:08 2009	(r191671)
+++ head/sys/netinet6/in6_var.h	Wed Apr 29 19:19:13 2009	(r191672)
@@ -64,6 +64,12 @@
 #ifndef _NETINET6_IN6_VAR_H_
 #define _NETINET6_IN6_VAR_H_
 
+#include 
+
+#ifdef _KERNEL
+#include 
+#endif
+
 /*
  * Interface address, Internet version.  One of these structures
  * is allocated for each interface with an Internet address.
@@ -89,12 +95,15 @@ struct in6_addrlifetime {
 struct nd_ifinfo;
 struct scope6_id;
 struct lltable;
+struct mld_ifinfo;
+
 struct in6_ifextra {
 	struct in6_ifstat *in6_ifstat;
 	struct icmp6_ifstat *icmp6_ifstat;
 	struct nd_ifinfo *nd_ifinfo;
 	struct scope6_id *scope6_id;
 	struct lltable *lltable;
+	struct mld_ifinfo *mld_ifinfo;
 };
 
 #define	LLTABLE6(ifp)	(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->lltable)
@@ -489,9 +498,6 @@ do {								\
 
 extern struct in6_addr zeroin6_addr;
 extern u_char inet6ctlerrmap[];
-#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_IP6MADDR);
-#endif /* MALLOC_DECLARE */
 
 /*
  * Macro for finding the internet address structure (in6_ifaddr) corresponding
@@ -514,94 +520,243 @@ do {									\
 #endif /* _KERNEL */
 
 /*
- * Multi-cast membership entry.  One for each group/ifp that a PCB
- * belongs to.
+ * IPv6 multicast MLD-layer source entry.
+ */
+struct ip6_msource {
+	RB_ENTRY(ip6_msource)	im6s_link;	/* RB tree links */
+	struct in6_addr		im6s_addr;
+	struct im6s_st {
+		uint16_t	ex;		/* # of exclusive members */
+		uint16_t	in;		/* # of inclusive members */
+	}			im6s_st[2];	/* state at t0, t1 */
+	uint8_t			im6s_stp;	/* pending query */
+};
+RB_HEAD(ip6_msource_tree, ip6_msource);
+
+/*
+ * IPv6 multicast PCB-layer source entry.
+ *
+ * NOTE: overlapping use of struct ip6_msource fields at start.
+ */
+struct in6_msource {
+	RB_ENTRY(ip6_msource)	im6s_link;	/* Common field */
+	struct in6_addr		im6s_addr;	/* Common field */
+	uint8_t			im6sl_st[2];	/* state before/at commit */
+};
+
+#ifdef _KERNEL
+/*
+ * IPv6 source tree comparison function.
+ *
+ * An ordered predicate is necessary; bcmp() is not documented to return
+ * an indication of order, memcmp() is, and is an ISO C99 requirement.
+ */
+static __inline int
+ip6_msource_cmp(const struct ip6_msource *a, const struct ip6_msource *b)
+{
+
+	return (memcmp(&a->im6s_addr, &b->im6s_addr, sizeof(struct in6_addr)));
+}
+RB_PROTOTYPE(ip6_msource_tree, ip6_msource, im6s_link, ip6_msource_cmp);
+#endif /* _KERNEL */
+
+/*
+ * IPv6 multicast PCB-layer group filter descriptor.
+ */
+struct in6_mfilter {
+	struct ip6_msource_tree	im6f_sources; /* source list for (S,G) */
+	u_long			im6f_nsrc;    /* # of source entries */
+	uint8_t			im6f_st[2];   /* state before/at commit */
+};
+
+/*
+ * Legacy KAME IPv6 multicast membership descriptor.
  */
 struct in6_multi_mship {
-	struct	in6_multi *i6mm_maddr;	/* Multicast address pointer */
-	LIST_ENTRY(in6_multi_mship) i6mm_chain;  /* multicast options chain */
+	struct	in6_multi *i6mm_maddr;

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

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 19:27:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8FB5C1065674;
	Wed, 29 Apr 2009 19:27:56 +0000 (UTC)
	(envelope-from bms@incunabulum.net)
Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com
	[66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 612518FC14;
	Wed, 29 Apr 2009 19:27:56 +0000 (UTC)
	(envelope-from bms@incunabulum.net)
Received: from compute2.internal (compute2.internal [10.202.2.42])
	by out1.messagingengine.com (Postfix) with ESMTP id 68B3B333F9E;
	Wed, 29 Apr 2009 15:27:55 -0400 (EDT)
Received: from heartbeat1.messagingengine.com ([10.202.2.160])
	by compute2.internal (MEProxy); Wed, 29 Apr 2009 15:27:55 -0400
X-Sasl-enc: NKCFatKQN/2PK851ZFzhzAUZ6VftEf9Xz2iCFwi60mD4 1241033275
Received: from [192.168.123.18]
	(82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254])
	by mail.messagingengine.com (Postfix) with ESMTPSA id 9B145B1DB;
	Wed, 29 Apr 2009 15:27:54 -0400 (EDT)
Message-ID: <49F8AA38.7090206@incunabulum.net>
Date: Wed, 29 Apr 2009 20:27:52 +0100
From: Bruce Simpson 
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
MIME-Version: 1.0
To: Bruce M Simpson 
References: <200904291919.n3TJJDIs088930@svn.freebsd.org>
In-Reply-To: <200904291919.n3TJJDIs088930@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r191672 - in head: . sys/conf sys/kern sys/netinet
 sys/netinet6 sys/sys usr.sbin/ifmcstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 19:27:57 -0000

Bruce M Simpson wrote:
> Log:
>   Bite the bullet, and make the IPv6 SSM and MLDv2 mega-commit:
>   import from p4 bms_netdev.  Summary of changes:
>   

Let me know if this makes anything explode.

cheers,
BMS

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 19:54:54 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8BA14106564A;
	Wed, 29 Apr 2009 19:54:54 +0000 (UTC)
	(envelope-from peterjeremy@optushome.com.au)
Received: from mail36.syd.optusnet.com.au (mail36.syd.optusnet.com.au
	[211.29.133.76])
	by mx1.freebsd.org (Postfix) with ESMTP id F25718FC1E;
	Wed, 29 Apr 2009 19:54:53 +0000 (UTC)
	(envelope-from peterjeremy@optushome.com.au)
Received: from server.vk2pj.dyndns.org
	(c122-106-216-167.belrs3.nsw.optusnet.com.au [122.106.216.167])
	by mail36.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n3TJsnYo014716
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 30 Apr 2009 05:54:51 +1000
X-Bogosity: Ham, spamicity=0.000000
Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1])
	by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n3TJsnIL006759;
	Thu, 30 Apr 2009 05:54:49 +1000 (EST)
	(envelope-from peter@server.vk2pj.dyndns.org)
Received: (from peter@localhost)
	by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n3TJsnj0006758;
	Thu, 30 Apr 2009 05:54:49 +1000 (EST) (envelope-from peter)
Date: Thu, 30 Apr 2009 05:54:49 +1000
From: peterjeremy@optushome.com.au
To: Tim Kientzle 
Message-ID: <20090429195449.GA6715@server.vk2pj.dyndns.org>
References: <200904271914.n3RJEhBn024041@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="UlVJffcvxoiEqYs2"
Content-Disposition: inline
In-Reply-To: <200904271914.n3RJEhBn024041@svn.freebsd.org>
X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc
User-Agent: Mutt/1.5.19 (2009-01-05)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r191586 - head/lib/libarchive
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 19:55:00 -0000


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

On 2009-Apr-27 19:14:43 +0000, Tim Kientzle  wrote:
>  ino_t varies across platforms; casting (int) here avoids
>  various pointless complaints.
=2E..
>+	if ((int)archive_entry_ino(entry) > 0777777) {

But if ino_t is larger than int then truncating it to int will lead
to false negatives here.  I don't believe there are any systems where
ino_t is smaller than int so maybe cast the constant to (ino_t) instead.

--=20
Peter Jeremy

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

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

iEYEARECAAYFAkn4sIkACgkQ/opHv/APuIe96ACgoMy68F8/DiBh2JG93270o76K
z/0AnRPx8kJVUvHEphNTpUWiVuXId5LZ
=9u62
-----END PGP SIGNATURE-----

--UlVJffcvxoiEqYs2--

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 20:33:50 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ECF491065676
	for ; Wed, 29 Apr 2009 20:33:50 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from mx0.deglitch.com (backbone.deglitch.com
	[IPv6:2001:16d8:fffb:4::abba])
	by mx1.freebsd.org (Postfix) with ESMTP id 9F74A8FC0C
	for ; Wed, 29 Apr 2009 20:33:50 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from DSPAM-Daemon (localhost [127.0.0.1])
	by mx0.deglitch.com (Postfix) with SMTP id A72488FC51
	for ; Thu, 30 Apr 2009 00:33:49 +0400 (MSD)
Received: from orion.SpringDaemons.com (unknown [77.232.3.143])
	by mx0.deglitch.com (Postfix) with ESMTPA id E2D1A8FC18;
	Thu, 30 Apr 2009 00:33:45 +0400 (MSD)
Received: from orion (localhost [127.0.0.1])
	by orion.SpringDaemons.com (Postfix) with SMTP id 5D27939832;
	Thu, 30 Apr 2009 00:33:56 +0400 (MSD)
Date: Thu, 30 Apr 2009 00:33:56 +0400
From: Stanislav Sedov 
To: Warner Losh 
Message-Id: <20090430003356.90c74c4e.stas@FreeBSD.org>
In-Reply-To: <200904291808.n3TI8IJ0087079@svn.freebsd.org>
References: <200904291808.n3TI8IJ0087079@svn.freebsd.org>
Organization: The FreeBSD Project
X-XMPP: ssedov@jabber.ru
X-Voice: +7 916 849 20 23
X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2  A385 2BF5 5993 EB26 9581
X-Mailer: carrier-pigeon
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-DSPAM-Result: Whitelisted
X-DSPAM-Processed: Thu Apr 30 00:33:49 2009
X-DSPAM-Confidence: 0.9899
X-DSPAM-Improbability: 1 in 9809 chance of being spam
X-DSPAM-Probability: 0.0000
X-DSPAM-Signature: 49f8b9ad967001933616370
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r191670 - head/bin/rm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 20:33:51 -0000

On Wed, 29 Apr 2009 18:08:18 +0000 (UTC)
Warner Losh  mentioned:

> Author: imp
> Date: Wed Apr 29 18:08:18 2009
> New Revision: 191670
> URL: http://svn.freebsd.org/changeset/base/191670
> 
> Log:
>   Implement ^T support for rm: now it will report the next file it
>   removes when you hit ^T.  This is similar to what's done for cp.  The
>   signal handler and type definitions for "info" were borrowed directly
>   from cp.
> 

Cool, thanks!

-- 
Stanislav Sedov
ST4096-RIPE

!DSPAM:49f8b9ad967001933616370!



From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 21:14:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9D25C106564A;
	Wed, 29 Apr 2009 21:14:16 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 885118FC15;
	Wed, 29 Apr 2009 21:14:16 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TLEGsS093016;
	Wed, 29 Apr 2009 21:14:16 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TLEGTW093008;
	Wed, 29 Apr 2009 21:14:16 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200904292114.n3TLEGTW093008@svn.freebsd.org>
From: Jamie Gritton 
Date: Wed, 29 Apr 2009 21:14:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191673 - in head: lib/libc/sys
	sys/cddl/compat/opensolaris/kern sys/compat/freebsd32
	sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 21:14:17 -0000

Author: jamie
Date: Wed Apr 29 21:14:15 2009
New Revision: 191673
URL: http://svn.freebsd.org/changeset/base/191673

Log:
  Introduce the extensible jail framework, using the same "name=value"
  interface as nmount(2).  Three new system calls are added:
  * jail_set, to create jails and change the parameters of existing jails.
    This replaces jail(2).
  * jail_get, to read the parameters of existing jails.  This replaces the
    security.jail.list sysctl.
  * jail_remove to kill off a jail's processes and remove the jail.
  Most jail parameters may now be changed after creation, and jails may be
  set to exist without any attached processes.  The current jail(2) system
  call still exists, though it is now a stub to jail_set(2).
  
  Approved by:	bz (mentor)

Modified:
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/Symbol.map
  head/lib/libc/sys/jail.2
  head/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/kern_jail.c
  head/sys/kern/kern_osd.c
  head/sys/kern/syscalls.master
  head/sys/sys/jail.h
  head/sys/sys/osd.h
  head/sys/sys/priv.h
  head/sys/sys/syscallsubr.h

Modified: head/lib/libc/sys/Makefile.inc
==============================================================================
--- head/lib/libc/sys/Makefile.inc	Wed Apr 29 19:19:13 2009	(r191672)
+++ head/lib/libc/sys/Makefile.inc	Wed Apr 29 21:14:15 2009	(r191673)
@@ -137,7 +137,10 @@ MLINKS+=getsockopt.2 setsockopt.2
 MLINKS+=gettimeofday.2 settimeofday.2
 MLINKS+=getuid.2 geteuid.2
 MLINKS+=intro.2 errno.2
-MLINKS+=jail.2 jail_attach.2
+MLINKS+=jail.2 jail_attach.2 \
+	jail.2 jail_get.2 \
+	jail.2 jail_remove.2 \
+	jail.2 jail_set.2
 MLINKS+=kldunload.2 kldunloadf.2
 MLINKS+=kqueue.2 kevent.2
 MLINKS+=link.2 linkat.2

Modified: head/lib/libc/sys/Symbol.map
==============================================================================
--- head/lib/libc/sys/Symbol.map	Wed Apr 29 19:19:13 2009	(r191672)
+++ head/lib/libc/sys/Symbol.map	Wed Apr 29 21:14:15 2009	(r191673)
@@ -344,6 +344,9 @@ FBSD_1.1 {
 	fexecve;
 	fstatat;
 	futimesat;
+	jail_get;
+	jail_set;
+	jail_remove;
 	linkat;
 	mkdirat;
 	mkfifoat;

Modified: head/lib/libc/sys/jail.2
==============================================================================
--- head/lib/libc/sys/jail.2	Wed Apr 29 19:19:13 2009	(r191672)
+++ head/lib/libc/sys/jail.2	Wed Apr 29 21:14:15 2009	(r191673)
@@ -1,4 +1,5 @@
 .\" Copyright (c) 1999 Poul-Henning Kamp.
+.\" Copyright (c) 2009 James Gritton.
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,12 +25,16 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 6, 2009
+.Dd April 29, 2009
 .Dt JAIL 2
 .Os
 .Sh NAME
-.Nm jail , jail_attach
-.Nd imprison current process and future descendants
+.Nm jail ,
+.Nm jail_get ,
+.Nm jail_set ,
+.Nm jail_remove ,
+.Nm jail_attach
+.Nd create and manage system jails
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -39,6 +44,13 @@
 .Fn jail "struct jail *jail"
 .Ft int
 .Fn jail_attach "int jid"
+.Ft int
+.Fn jail_remove "int jid"
+.In sys/uio.h
+.Ft int
+.Fn jail_get "struct iovec *iov" "u_int niov" "int flags"
+.Ft int
+.Fn jail_set "struct iovec *iov" "u_int niov" "int flags"
 .Sh DESCRIPTION
 The
 .Fn jail
@@ -94,20 +106,147 @@ pointers can be set to an arrays of IPv4
 the prison, or NULL if none.
 IPv4 addresses must be in network byte order.
 .Pp
+This is equivalent to the
+.Fn jail_set
+system call (see below), with the parameters
+.Va path ,
+.Va host.hostname ,
+.Va name ,
+.Va ip4.addr ,
+and
+.Va ip6.addr ,
+and with the
+.Dv JAIL_ATTACH
+flag.
+.Pp
+The
+.Fn jail_set
+system call creates a new jail, or modifies an existing one, and optionally
+locks the current process in it.
+Jail parameters are passed as an array of name-value pairs in the array
+.Fa iov ,
+containing
+.Fa niov
+elements.
+Parameter names are a null-terminated string, and values may be strings,
+integers, or other arbitrary data.
+Some parameters are boolean, and do not have a value (their length is zero)
+but are set by the name alone with or without a
+.Dq no
+prefix, e.g.
+.Va persist
+or
+.Va nopersist .
+Any parameters not set will be given default values, generally based on
+the current environment.
+.Pp
+Jails have a set of core parameters, and modules can add their own jail
+parameters.
+The current set of available parameters, and their formats, can be
+retrieved via the
+.Va security.jail.param
+sysctl MIB entry.
+Notable parameters include those mentioned in the
+.Fn jail
+description above, as well as
+.Va jid
+and
+.Va name ,
+which identify the jail being created or modified.
+See
+.Xr jail 8
+for more information on the core jail parameters.
+.Pp
+The
+.Fa flags
+arguments consists of one or more of the following flags:
+.Bl -tag -width indent
+.It Dv JAIL_CREATE
+Create a new jail.
+If a
+.Va jid
+or
+.Va name
+parameters exists, they must not refer to an existing jail.
+.It Dv JAIL_UPDATE
+Modify an existing jail.
+One of the
+.Va jid
+or
+.Va name
+parameters must exist, and must refer to an existing jail.
+If both
+.Dv JAIL_CREATE
+and
+.Dv JAIL_UPDATE
+are set, a jail will be created if it does not yet exist, and modified if it
+does exist.
+.It Dv JAIL_ATTACH
+In addition to creating or modifying the jail, attach the current process to
+it, as with the
+.Fn jail_attach
+system call.
+.It Dv JAIL_DYING
+Allow setting a jail that is in the process of being removed.
+.El
+.Pp
+The
+.Fn jail_get
+system call retrieves jail parameters, using the same name-value list as
+.Fn jail_set
+in the
+.Fa iov
+and
+.Fa niov
+arguments.
+The jail to read can be specified by either
+.Va jid
+or
+.Va name
+by including those parameters in the list.
+If they are included but are not intended to be the search key, they
+should be cleared (zero and the empty string respectively).
+.Pp
+The special parameter
+.Va lastjid
+can be used to retrieve a list of all jails.
+It will fetch the jail with the jid above and closest to the passed value.
+The first jail (usually but not always jid 1) can be found by passing a
+.Va lastjid
+of zero.
+.Pp
+The
+.Fa flags
+arguments consists of one or more following flags:
+.Bl -tag -width indent
+.It Dv JAIL_DYING
+Allow getting a jail that is in the process of being removed.
+.El
+.Pp
 The
 .Fn jail_attach
 system call attaches the current process to an existing jail,
 identified by
 .Fa jid .
+.Pp
+The
+.Fn jail_remove
+system call removes the jail identified by
+.Fa jid .
+It will kill all processes belonging to the jail, and remove any children
+of that jail.
 .Sh RETURN VALUES
 If successful,
-.Fn jail
-returns a non-negative integer, termed the jail identifier (JID).
-It returns \-1 on failure, and sets
+.Fn jail ,
+.Fn jail_set ,
+and
+.Fn jail_get
+return a non-negative integer, termed the jail identifier (JID).
+They return \-1 on failure, and set
 .Va errno
 to indicate the error.
 .Pp
-.Rv -std jail_attach
+.Rv -std jail_attach jail_remove
 .Sh PRISON?
 Once a process has been put in a prison, it and its descendants cannot escape
 the prison.
@@ -152,15 +291,111 @@ The
 system call
 will fail if:
 .Bl -tag -width Er
+.It Bq Er EPERM
+This process is not allowed to create a jail.
+.It Bq Er EFAULT
+.Fa jail
+points to an address outside the allocated address space of the process.
 .It Bq Er EINVAL
 The version number of the argument is not correct.
 .It Bq Er EAGAIN
 No free JID could be found.
 .El
 .Pp
+The
+.Fn jail_set
+system call
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EPERM
+This process is not allowed to create a jail.
+.It Bq Er EPERM
+A jail parameter was set to a less restrictive value then the current
+environment.
+.It Bq Er EFAULT
+.Fa Iov ,
+or one of the addresses contained within it,
+points to an address outside the allocated address space of the process.
+.It Bq Er ENOENT
+The jail referred to by a
+.Va jid
+or
+.Va name
+parameter does not exist, and the
+.Dv JAIL_CREATE
+flag is not set.
+.It Bq Er EEXIST
+The jail referred to by a
+.Va jid
+or
+.Va name
+parameter exists, and the
+.Dv JAIL_UPDATE
+flag is not set.
+.It Bq Er EINVAL
+A supplied parameter is the wrong size.
+.It Bq Er EINVAL
+A supplied parameter is out of range.
+.It Bq Er EINVAL
+A supplied string parameter is not null-terminated.
+.It Bq Er EINVAL
+A supplied parameter name does not match any known parameters.
+.It Bq Er EINVAL
+One of the
+.Dv JAIL_CREATE
+or
+.Dv JAIL_UPDATE
+flags is not set.
+.It Bq Er ENAMETOOLONG
+A supplied string parameter is longer than allowed.
+.It Bq Er EAGAIN
+There are no jail IDs left.
+.El
+.Pp
+The
+.Fn jail_get
+system call
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+.Fa Iov ,
+or one of the addresses contained within it,
+points to an address outside the allocated address space of the process.
+.It Bq Er ENOENT
+The jail referred to by a
+.Va jid
+or
+.Va name
+parameter does not exist.
+.It Bq Er ENOENT
+The
+.Va lastjid
+parameter is greater than the highest current jail ID.
+.It Bq Er EINVAL
+A supplied parameter is the wrong size.
+.It Bq Er EINVAL
+A supplied parameter name does not match any known parameters.
+.El
+.Pp
+The
+.Fn jail_attach
+and
+.Fn jail_remove
+system calls
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The jail specified by
+.Fa jid
+does not exist.
+.El
+.Pp
 Further
-.Fn jail
-calls
+.Fn jail ,
+.Fn jail_set ,
+and
+.Fn jail_attach
+call
 .Xr chroot 2
 internally, so it can fail for all the same reasons.
 Please consult the
@@ -168,7 +403,8 @@ Please consult the
 manual page for details.
 .Sh SEE ALSO
 .Xr chdir 2 ,
-.Xr chroot 2
+.Xr chroot 2 ,
+.Xr jail 8
 .Sh HISTORY
 The
 .Fn jail
@@ -178,6 +414,13 @@ The
 .Fn jail_attach
 system call appeared in
 .Fx 5.1 .
+The
+.Fn jail_set ,
+.Fn jail_get ,
+and
+.Fn jail_remove
+system calls appeared in
+.Fx 8.0 .
 .Sh AUTHORS
 The jail feature was written by
 .An Poul-Henning Kamp
@@ -185,3 +428,5 @@ for R&D Associates
 .Dq Li http://www.rndassociates.com/
 who contributed it to
 .Fx .
+.An James Gritton
+added the extensible jail parameters.

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c
==============================================================================
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c	Wed Apr 29 19:19:13 2009	(r191672)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c	Wed Apr 29 21:14:15 2009	(r191673)
@@ -233,7 +233,7 @@ static void
 zone_sysinit(void *arg __unused)
 {
 
-	zone_slot = osd_jail_register(zone_destroy);
+	zone_slot = osd_jail_register(zone_destroy, NULL);
 }
 
 static void

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c	Wed Apr 29 19:19:13 2009	(r191672)
+++ head/sys/compat/freebsd32/freebsd32_misc.c	Wed Apr 29 21:14:15 2009	(r191673)
@@ -28,6 +28,8 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_compat.h"
+#include "opt_inet.h"
+#include "opt_inet6.h"
 
 #include 
 #include 
@@ -76,6 +78,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef INET
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -106,6 +112,8 @@ CTASSERT(sizeof(struct msghdr32) == 28);
 CTASSERT(sizeof(struct stat32) == 96);
 CTASSERT(sizeof(struct sigaction32) == 24);
 
+extern int jail_max_af_ips;
+
 static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count);
 static int freebsd32_kevent_copyin(void *arg, struct kevent *kevp, int count);
 
@@ -2036,9 +2044,17 @@ freebsd32_sysctl(struct thread *td, stru
 int
 freebsd32_jail(struct thread *td, struct freebsd32_jail_args *uap)
 {
+	struct iovec optiov[10];
+	struct uio opt;
+	char *u_path, *u_hostname, *u_name;
+#ifdef INET
+	struct in_addr *u_ip4;
+#endif
+#ifdef INET6
+	struct in6_addr *u_ip6;
+#endif
 	uint32_t version;
 	int error;
-	struct jail j;
 
 	error = copyin(uap->jail, &version, sizeof(uint32_t));
 	if (error)
@@ -2050,14 +2066,45 @@ freebsd32_jail(struct thread *td, struct
 		/* FreeBSD single IPv4 jails. */
 		struct jail32_v0 j32_v0;
 
-		bzero(&j, sizeof(struct jail));
 		error = copyin(uap->jail, &j32_v0, sizeof(struct jail32_v0));
 		if (error)
 			return (error);
-		CP(j32_v0, j, version);
-		PTRIN_CP(j32_v0, j, path);
-		PTRIN_CP(j32_v0, j, hostname);
-		j.ip4s = j32_v0.ip_number;
+		u_path = malloc(MAXPATHLEN + MAXHOSTNAMELEN, M_TEMP, M_WAITOK);
+		u_hostname = u_path + MAXPATHLEN;
+		opt.uio_iov = optiov;
+		opt.uio_iovcnt = 4;
+		opt.uio_offset = -1;
+		opt.uio_resid = -1;
+		opt.uio_segflg = UIO_SYSSPACE;
+		opt.uio_rw = UIO_READ;
+		opt.uio_td = td;
+		optiov[0].iov_base = "path";
+		optiov[0].iov_len = sizeof("path");
+		optiov[1].iov_base = u_path;
+		error = copyinstr(PTRIN(j32_v0.path), u_path, MAXPATHLEN,
+		    &optiov[1].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		optiov[2].iov_base = "host.hostname";
+		optiov[2].iov_len = sizeof("host.hostname");
+		optiov[3].iov_base = u_hostname;
+		error = copyinstr(PTRIN(j32_v0.hostname), u_hostname,
+		    MAXHOSTNAMELEN, &optiov[3].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+#ifdef INET
+		optiov[opt.uio_iovcnt].iov_base = "ip4.addr";
+		optiov[opt.uio_iovcnt].iov_len = sizeof("ip4.addr");
+		opt.uio_iovcnt++;
+		optiov[opt.uio_iovcnt].iov_base = &j32_v0.ip_number;
+		j32_v0.ip_number = htonl(j32_v0.ip_number);
+		optiov[opt.uio_iovcnt].iov_len = sizeof(j32_v0.ip_number);
+		opt.uio_iovcnt++;
+#endif
 		break;
 	}
 
@@ -2072,18 +2119,109 @@ freebsd32_jail(struct thread *td, struct
 	{
 		/* FreeBSD multi-IPv4/IPv6,noIP jails. */
 		struct jail32 j32;
+		size_t tmplen;
 
 		error = copyin(uap->jail, &j32, sizeof(struct jail32));
 		if (error)
 			return (error);
-		CP(j32, j, version);
-		PTRIN_CP(j32, j, path);
-		PTRIN_CP(j32, j, hostname);
-		PTRIN_CP(j32, j, jailname);
-		CP(j32, j, ip4s);
-		CP(j32, j, ip6s);
-		PTRIN_CP(j32, j, ip4);
-		PTRIN_CP(j32, j, ip6);
+		tmplen = MAXPATHLEN + MAXHOSTNAMELEN + MAXHOSTNAMELEN;
+#ifdef INET
+		if (j32.ip4s > jail_max_af_ips)
+			return (EINVAL);
+		tmplen += j32.ip4s * sizeof(struct in_addr);
+#else
+		if (j32.ip4s > 0)
+			return (EINVAL);
+#endif
+#ifdef INET6
+		if (j32.ip6s > jail_max_af_ips)
+			return (EINVAL);
+		tmplen += j32.ip6s * sizeof(struct in6_addr);
+#else
+		if (j32.ip6s > 0)
+			return (EINVAL);
+#endif
+		u_path = malloc(tmplen, M_TEMP, M_WAITOK);
+		u_hostname = u_path + MAXPATHLEN;
+		u_name = u_hostname + MAXHOSTNAMELEN;
+#ifdef INET
+		u_ip4 =  (struct in_addr *)(u_name + MAXHOSTNAMELEN);
+#endif
+#ifdef INET6
+#ifdef INET
+		u_ip6 = (struct in6_addr *)(u_ip4 + j32.ip4s);
+#else
+		u_ip6 = (struct in6_addr *)(u_name + MAXHOSTNAMELEN);
+#endif
+#endif
+		opt.uio_iov = optiov;
+		opt.uio_iovcnt = 4;
+		opt.uio_offset = -1;
+		opt.uio_resid = -1;
+		opt.uio_segflg = UIO_SYSSPACE;
+		opt.uio_rw = UIO_READ;
+		opt.uio_td = td;
+		optiov[0].iov_base = "path";
+		optiov[0].iov_len = sizeof("path");
+		optiov[1].iov_base = u_path;
+		error = copyinstr(PTRIN(j32.path), u_path, MAXPATHLEN,
+		    &optiov[1].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		optiov[2].iov_base = "host.hostname";
+		optiov[2].iov_len = sizeof("host.hostname");
+		optiov[3].iov_base = u_hostname;
+		error = copyinstr(PTRIN(j32.hostname), u_hostname,
+		    MAXHOSTNAMELEN, &optiov[3].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		if (PTRIN(j32.jailname) != NULL) {
+			optiov[opt.uio_iovcnt].iov_base = "name";
+			optiov[opt.uio_iovcnt].iov_len = sizeof("name");
+			opt.uio_iovcnt++;
+			optiov[opt.uio_iovcnt].iov_base = u_name;
+			error = copyinstr(PTRIN(j32.jailname), u_name,
+			    MAXHOSTNAMELEN, &optiov[opt.uio_iovcnt].iov_len);
+			if (error) {
+				free(u_path, M_TEMP);
+				return (error);
+			}
+			opt.uio_iovcnt++;
+		}
+#ifdef INET
+		optiov[opt.uio_iovcnt].iov_base = "ip4.addr";
+		optiov[opt.uio_iovcnt].iov_len = sizeof("ip4.addr");
+		opt.uio_iovcnt++;
+		optiov[opt.uio_iovcnt].iov_base = u_ip4;
+		optiov[opt.uio_iovcnt].iov_len =
+		    j32.ip4s * sizeof(struct in_addr);
+		error = copyin(PTRIN(j32.ip4), u_ip4,
+		    optiov[opt.uio_iovcnt].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		opt.uio_iovcnt++;
+#endif
+#ifdef INET6
+		optiov[opt.uio_iovcnt].iov_base = "ip6.addr";
+		optiov[opt.uio_iovcnt].iov_len = sizeof("ip6.addr");
+		opt.uio_iovcnt++;
+		optiov[opt.uio_iovcnt].iov_base = u_ip6;
+		optiov[opt.uio_iovcnt].iov_len =
+		    j32.ip6s * sizeof(struct in6_addr);
+		error = copyin(PTRIN(j32.ip6), u_ip6,
+		    optiov[opt.uio_iovcnt].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		opt.uio_iovcnt++;
+#endif
 		break;
 	}
 
@@ -2091,7 +2229,54 @@ freebsd32_jail(struct thread *td, struct
 		/* Sci-Fi jails are not supported, sorry. */
 		return (EINVAL);
 	}
-	return (kern_jail(td, &j));
+	error = kern_jail_set(td, &opt, JAIL_CREATE | JAIL_ATTACH);
+	free(u_path, M_TEMP);
+	return (error);
+}
+
+int
+freebsd32_jail_set(struct thread *td, struct freebsd32_jail_set_args *uap)
+{
+	struct uio *auio;
+	int error;
+
+	/* Check that we have an even number of iovecs. */
+	if (uap->iovcnt & 1)
+		return (EINVAL);
+
+	error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
+	if (error)
+		return (error);
+	error = kern_jail_set(td, auio, uap->flags);
+	free(auio, M_IOV);
+	return (error);
+}
+
+int
+freebsd32_jail_get(struct thread *td, struct freebsd32_jail_get_args *uap)
+{
+	struct iovec32 iov32;
+	struct uio *auio;
+	int error, i;
+
+	/* Check that we have an even number of iovecs. */
+	if (uap->iovcnt & 1)
+		return (EINVAL);
+
+	error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
+	if (error)
+		return (error);
+	error = kern_jail_get(td, auio, uap->flags);
+	if (error == 0)
+		for (i = 0; i < uap->iovcnt; i++) {
+			PTROUT_CP(auio->uio_iov[i], iov32, iov_base);
+			CP(auio->uio_iov[i], iov32, iov_len);
+			error = copyout(&iov32, uap->iovp + i, sizeof(iov32));
+			if (error != 0)
+				break;
+		}
+	free(auio, M_IOV);
+	return (error);
 }
 
 int

Modified: head/sys/compat/freebsd32/syscalls.master
==============================================================================
--- head/sys/compat/freebsd32/syscalls.master	Wed Apr 29 19:19:13 2009	(r191672)
+++ head/sys/compat/freebsd32/syscalls.master	Wed Apr 29 21:14:15 2009	(r191673)
@@ -870,3 +870,8 @@
 504	AUE_POSIX_OPENPT	NOPROTO	{ int posix_openpt(int flags); }
 ; 505 is initialised by the kgssapi code, if present.
 505	AUE_NULL	UNIMPL	gssd_syscall
+506	AUE_NULL	STD	{ int freebsd32_jail_get(struct iovec32 *iovp, \
+				    unsigned int iovcnt, int flags); }
+507	AUE_NULL	STD	{ int freebsd32_jail_set(struct iovec32 *iovp, \
+				    unsigned int iovcnt, int flags); }
+508	AUE_NULL	NOPROTO	{ int jail_remove(int jid); }

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Wed Apr 29 19:19:13 2009	(r191672)
+++ head/sys/kern/kern_jail.c	Wed Apr 29 21:14:15 2009	(r191673)
@@ -1,6 +1,7 @@
 /*-
  * Copyright (c) 1999 Poul-Henning Kamp.
  * Copyright (c) 2008 Bjoern A. Zeeb.
+ * Copyright (c) 2009 James Gritton.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -47,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -56,7 +58,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #ifdef DDB
@@ -114,13 +115,15 @@ SYSCTL_INT(_security_jail, OID_AUTO, jai
     "Number of IP addresses a jail may have at most per address family");
 
 /* allprison, lastprid, and prisoncount are protected by allprison_lock. */
-struct	prisonlist allprison;
 struct	sx allprison_lock;
+SX_SYSINIT(allprison_lock, &allprison_lock, "allprison");
+struct	prisonlist allprison = TAILQ_HEAD_INITIALIZER(allprison);
 int	lastprid = 0;
 int	prisoncount = 0;
 
-static void init_prison(void *);
+static int do_jail_attach(struct thread *td, struct prison *pr);
 static void prison_complete(void *context, int pending);
+static void prison_deref(struct prison *pr, int flags);
 #ifdef INET
 static int _prison_check_ip4(struct prison *pr, struct in_addr *ia);
 #endif
@@ -129,15 +132,12 @@ static int _prison_check_ip6(struct pris
 #endif
 static int sysctl_jail_list(SYSCTL_HANDLER_ARGS);
 
-static void
-init_prison(void *data __unused)
-{
-
-	sx_init(&allprison_lock, "allprison");
-	LIST_INIT(&allprison);
-}
-
-SYSINIT(prison, SI_SUB_INTRINSIC, SI_ORDER_ANY, init_prison, NULL);
+/* Flags for prison_deref */
+#define	PD_DEREF	0x01
+#define	PD_DEUREF	0x02
+#define	PD_LOCKED	0x04
+#define	PD_LIST_SLOCKED	0x08
+#define	PD_LIST_XLOCKED	0x10
 
 #ifdef INET
 static int
@@ -187,411 +187,1279 @@ qcmp_v6(const void *ip1, const void *ip2
 }
 #endif
 
-#if defined(INET) || defined(INET6)
-static int
-prison_check_conflicting_ips(struct prison *p)
+/*
+ * struct jail_args {
+ *	struct jail *jail;
+ * };
+ */
+int
+jail(struct thread *td, struct jail_args *uap)
 {
-	struct prison *pr;
-	int i;
+	struct iovec optiov[10];
+	struct uio opt;
+	char *u_path, *u_hostname, *u_name;
+#ifdef INET
+	struct in_addr *u_ip4;
+#endif
+#ifdef INET6
+	struct in6_addr *u_ip6;
+#endif
+	uint32_t version;
+	int error;
 
-	sx_assert(&allprison_lock, SX_LOCKED);
+	error = copyin(uap->jail, &version, sizeof(uint32_t));
+	if (error)
+		return (error);
 
-	if (p->pr_ip4s == 0 && p->pr_ip6s == 0)
-		return (0);
+	switch (version) {
+	case 0:
+	{
+		/* FreeBSD single IPv4 jails. */
+		struct jail_v0 j0;
 
-	LIST_FOREACH(pr, &allprison, pr_list) {
-		/*
-		 * Skip 'dying' prisons to avoid problems when
-		 * restarting multi-IP jails.
-		 */
-		if (pr->pr_state == PRISON_STATE_DYING)
-			continue;
+		error = copyin(uap->jail, &j0, sizeof(struct jail_v0));
+		if (error)
+			return (error);
+		u_path = malloc(MAXPATHLEN + MAXHOSTNAMELEN, M_TEMP, M_WAITOK);
+		u_hostname = u_path + MAXPATHLEN;
+		opt.uio_iov = optiov;
+		opt.uio_iovcnt = 4;
+		opt.uio_offset = -1;
+		opt.uio_resid = -1;
+		opt.uio_segflg = UIO_SYSSPACE;
+		opt.uio_rw = UIO_READ;
+		opt.uio_td = td;
+		optiov[0].iov_base = "path";
+		optiov[0].iov_len = sizeof("path");
+		optiov[1].iov_base = u_path;
+		error =
+		    copyinstr(j0.path, u_path, MAXPATHLEN, &optiov[1].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		optiov[2].iov_base = "host.hostname";
+		optiov[2].iov_len = sizeof("host.hostname");
+		optiov[3].iov_base = u_hostname;
+		error = copyinstr(j0.hostname, u_hostname, MAXHOSTNAMELEN,
+		    &optiov[3].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+#ifdef INET
+		optiov[opt.uio_iovcnt].iov_base = "ip4.addr";
+		optiov[opt.uio_iovcnt].iov_len = sizeof("ip4.addr");
+		opt.uio_iovcnt++;
+		optiov[opt.uio_iovcnt].iov_base = &j0.ip_number;
+		j0.ip_number = htonl(j0.ip_number);
+		optiov[opt.uio_iovcnt].iov_len = sizeof(j0.ip_number);
+		opt.uio_iovcnt++;
+#endif
+		break;
+	}
 
+	case 1:
 		/*
-		 * We permit conflicting IPs if there is no
-		 * more than 1 IP on eeach jail.
-		 * In case there is one duplicate on a jail with
-		 * more than one IP stop checking and return error.
+		 * Version 1 was used by multi-IPv4 jail implementations
+		 * that never made it into the official kernel.
 		 */
+		return (EINVAL);
+
+	case 2:	/* JAIL_API_VERSION */
+	{
+		/* FreeBSD multi-IPv4/IPv6,noIP jails. */
+		struct jail j;
+		size_t tmplen;
+
+		error = copyin(uap->jail, &j, sizeof(struct jail));
+		if (error)
+			return (error);
+		tmplen = MAXPATHLEN + MAXHOSTNAMELEN + MAXHOSTNAMELEN;
+#ifdef INET
+		if (j.ip4s > jail_max_af_ips)
+			return (EINVAL);
+		tmplen += j.ip4s * sizeof(struct in_addr);
+#else
+		if (j.ip4s > 0)
+			return (EINVAL);
+#endif
+#ifdef INET6
+		if (j.ip6s > jail_max_af_ips)
+			return (EINVAL);
+		tmplen += j.ip6s * sizeof(struct in6_addr);
+#else
+		if (j.ip6s > 0)
+			return (EINVAL);
+#endif
+		u_path = malloc(tmplen, M_TEMP, M_WAITOK);
+		u_hostname = u_path + MAXPATHLEN;
+		u_name = u_hostname + MAXHOSTNAMELEN;
+#ifdef INET
+		u_ip4 = (struct in_addr *)(u_name + MAXHOSTNAMELEN);
+#endif
+#ifdef INET6
 #ifdef INET
-		if ((p->pr_ip4s >= 1 && pr->pr_ip4s > 1) ||
-		    (p->pr_ip4s > 1 && pr->pr_ip4s >= 1)) {
-			for (i = 0; i < p->pr_ip4s; i++) {
-				if (_prison_check_ip4(pr, &p->pr_ip4[i]) == 0)
-					return (EINVAL);
+		u_ip6 = (struct in6_addr *)(u_ip4 + j.ip4s);
+#else
+		u_ip6 = (struct in6_addr *)(u_name + MAXHOSTNAMELEN);
+#endif
+#endif
+		opt.uio_iov = optiov;
+		opt.uio_iovcnt = 4;
+		opt.uio_offset = -1;
+		opt.uio_resid = -1;
+		opt.uio_segflg = UIO_SYSSPACE;
+		opt.uio_rw = UIO_READ;
+		opt.uio_td = td;
+		optiov[0].iov_base = "path";
+		optiov[0].iov_len = sizeof("path");
+		optiov[1].iov_base = u_path;
+		error =
+		    copyinstr(j.path, u_path, MAXPATHLEN, &optiov[1].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		optiov[2].iov_base = "host.hostname";
+		optiov[2].iov_len = sizeof("host.hostname");
+		optiov[3].iov_base = u_hostname;
+		error = copyinstr(j.hostname, u_hostname, MAXHOSTNAMELEN,
+		    &optiov[3].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		if (j.jailname != NULL) {
+			optiov[opt.uio_iovcnt].iov_base = "name";
+			optiov[opt.uio_iovcnt].iov_len = sizeof("name");
+			opt.uio_iovcnt++;
+			optiov[opt.uio_iovcnt].iov_base = u_name;
+			error = copyinstr(j.jailname, u_name, MAXHOSTNAMELEN,
+			    &optiov[opt.uio_iovcnt].iov_len);
+			if (error) {
+				free(u_path, M_TEMP);
+				return (error);
 			}
+			opt.uio_iovcnt++;
+		}
+#ifdef INET
+		optiov[opt.uio_iovcnt].iov_base = "ip4.addr";
+		optiov[opt.uio_iovcnt].iov_len = sizeof("ip4.addr");
+		opt.uio_iovcnt++;
+		optiov[opt.uio_iovcnt].iov_base = u_ip4;
+		optiov[opt.uio_iovcnt].iov_len =
+		    j.ip4s * sizeof(struct in_addr);
+		error = copyin(j.ip4, u_ip4, optiov[opt.uio_iovcnt].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
 		}
+		opt.uio_iovcnt++;
 #endif
 #ifdef INET6
-		if ((p->pr_ip6s >= 1 && pr->pr_ip6s > 1) ||
-		    (p->pr_ip6s > 1 && pr->pr_ip6s >= 1)) {
-			for (i = 0; i < p->pr_ip6s; i++) {
-				if (_prison_check_ip6(pr, &p->pr_ip6[i]) == 0)
-					return (EINVAL);
-			}
+		optiov[opt.uio_iovcnt].iov_base = "ip6.addr";
+		optiov[opt.uio_iovcnt].iov_len = sizeof("ip6.addr");
+		opt.uio_iovcnt++;
+		optiov[opt.uio_iovcnt].iov_base = u_ip6;
+		optiov[opt.uio_iovcnt].iov_len =
+		    j.ip6s * sizeof(struct in6_addr);
+		error = copyin(j.ip6, u_ip6, optiov[opt.uio_iovcnt].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
 		}
+		opt.uio_iovcnt++;
 #endif
+		break;
 	}
 
-	return (0);
+	default:
+		/* Sci-Fi jails are not supported, sorry. */
+		return (EINVAL);
+	}
+	error = kern_jail_set(td, &opt, JAIL_CREATE | JAIL_ATTACH);
+	free(u_path, M_TEMP);
+	return (error);
 }
 
-static int
-jail_copyin_ips(struct jail *j)
+/*
+ * struct jail_set_args {
+ *	struct iovec *iovp;
+ *	unsigned int iovcnt;
+ *	int flags;
+ * };
+ */
+int
+jail_set(struct thread *td, struct jail_set_args *uap)
 {
+	struct uio *auio;
+	int error;
+
+	/* Check that we have an even number of iovecs. */
+	if (uap->iovcnt & 1)
+		return (EINVAL);
+
+	error = copyinuio(uap->iovp, uap->iovcnt, &auio);
+	if (error)
+		return (error);
+	error = kern_jail_set(td, auio, uap->flags);
+	free(auio, M_IOV);
+	return (error);
+}
+
+int
+kern_jail_set(struct thread *td, struct uio *optuio, int flags)
+{
+	struct nameidata nd;
 #ifdef INET
 	struct in_addr *ip4;
 #endif
 #ifdef INET6
 	struct in6_addr *ip6;
 #endif
-	int error, i;
+	struct vfsopt *opt;
+	struct vfsoptlist *opts;
+	struct prison *pr, *deadpr, *tpr;
+	struct vnode *root;

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

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 21:17:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CD11106564A;
	Wed, 29 Apr 2009 21:17:19 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2A2FD8FC27;
	Wed, 29 Apr 2009 21:17:19 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TLHJCV093114;
	Wed, 29 Apr 2009 21:17:19 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TLHIpt093110;
	Wed, 29 Apr 2009 21:17:18 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200904292117.n3TLHIpt093110@svn.freebsd.org>
From: Alexander Motin 
Date: Wed, 29 Apr 2009 21:17:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191674 - in head/sys/dev/ata: . chipsets
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 21:17:20 -0000

Author: mav
Date: Wed Apr 29 21:17:18 2009
New Revision: 191674
URL: http://svn.freebsd.org/changeset/base/191674

Log:
  Add experimental support for SATA interface power management.
  Feature is controlled by hint.ata.X.pm_level tunable:
   0 - PM disabled, old behaviour, default.
   1 - device is allowed to initiate PM state change, host is passive.
   2 - host initiates PARTIAL state transition every time port is idle.
   3 - host initiates SLUMBER state transition every time port is idle.
  
  PARTIAL state has up to 100us (50us for me) wakeup latency, but for my
  ICH8M saves 0.5W of power per drive. SLUMBER state has up to 10ms (3.5ms
  for me) wakeup latency, but saves 0.8W of power.
  
  Modes 2 and 3 are implemented only for AHCI driver now.
  
  Interface power management is incompatible with device presence detection
  (host receives no signal from drive, so unable to monitor it), so later is
  disabled when PM is used.

Modified:
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-pci.c
  head/sys/dev/ata/ata-sata.c
  head/sys/dev/ata/chipsets/ata-ahci.c

Modified: head/sys/dev/ata/ata-all.h
==============================================================================
--- head/sys/dev/ata/ata-all.h	Wed Apr 29 21:14:15 2009	(r191673)
+++ head/sys/dev/ata/ata-all.h	Wed Apr 29 21:17:18 2009	(r191674)
@@ -148,9 +148,12 @@
 
 /* SATA AHCI v1.0 register defines */
 #define ATA_AHCI_CAP                    0x00
-#define         ATA_AHCI_NPMASK         0x1f
+#define		ATA_AHCI_CAP_NPMASK	0x0000001f
+#define		ATA_AHCI_CAP_PSC	0x00002000
+#define		ATA_AHCI_CAP_SSC	0x00004000
 #define		ATA_AHCI_CAP_SPM	0x00020000
 #define		ATA_AHCI_CAP_CLO	0x01000000
+#define		ATA_AHCI_CAP_SALP	0x04000000
 #define		ATA_AHCI_CAP_64BIT	0x80000000
 
 #define ATA_AHCI_GHC                    0x04
@@ -513,6 +516,7 @@ struct ata_channel {
 #define         ATA_NO_48BIT_DMA        0x08
 #define         ATA_ALWAYS_DMASTAT      0x10
 
+    int				pm_level;	/* power management level */
     int                         devices;        /* what is present */
 #define         ATA_ATA_MASTER          0x00000001
 #define         ATA_ATA_SLAVE           0x00000002

Modified: head/sys/dev/ata/ata-pci.c
==============================================================================
--- head/sys/dev/ata/ata-pci.c	Wed Apr 29 21:14:15 2009	(r191673)
+++ head/sys/dev/ata/ata-pci.c	Wed Apr 29 21:17:18 2009	(r191674)
@@ -556,6 +556,9 @@ ata_pcichannel_attach(device_t dev)
 
     ch->unit = (intptr_t)device_get_ivars(dev);
 
+    resource_int_value(device_get_name(dev),
+	device_get_unit(dev), "pm_level", &ch->pm_level);
+
     if ((error = ctlr->ch_attach(dev)))
 	return error;
 

Modified: head/sys/dev/ata/ata-sata.c
==============================================================================
--- head/sys/dev/ata/ata-sata.c	Wed Apr 29 21:14:15 2009	(r191673)
+++ head/sys/dev/ata/ata-sata.c	Wed Apr 29 21:17:18 2009	(r191674)
@@ -60,7 +60,7 @@ ata_sata_phy_check_events(device_t dev)
     ATA_IDX_OUTL(ch, ATA_SERROR, error);
 
     /* if we have a connection event deal with it */
-    if (error & ATA_SE_PHY_CHANGED) {
+    if ((error & ATA_SE_PHY_CHANGED) && (ch->pm_level == 0)) {
 	if (bootverbose) {
 	    u_int32_t status = ATA_IDX_INL(ch, ATA_SSTATUS);
 	    if (((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN1) ||
@@ -199,9 +199,8 @@ ata_sata_phy_reset(device_t dev, int por
 	ata_udelay(5000);
 	for (loop = 0; loop < 10; loop++) {
 	    if (ata_sata_scr_write(ch, port, ATA_SCONTROL,
-					ATA_SC_DET_IDLE |
-					ATA_SC_IPM_DIS_PARTIAL |
-					ATA_SC_IPM_DIS_SLUMBER))
+		    ATA_SC_DET_IDLE | ((ch->pm_level > 0) ? 0 :
+		    ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER)))
 		return (0);
 	    ata_udelay(100);
 	    if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))

Modified: head/sys/dev/ata/chipsets/ata-ahci.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-ahci.c	Wed Apr 29 21:14:15 2009	(r191673)
+++ head/sys/dev/ata/chipsets/ata-ahci.c	Wed Apr 29 21:17:18 2009	(r191674)
@@ -131,7 +131,7 @@ ata_ahci_chipinit(device_t dev)
     ctlr->ichannels = ATA_INL(ctlr->r_res2, ATA_AHCI_PI);
     ctlr->channels =
 	MAX(flsl(ctlr->ichannels),
-	    (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_NPMASK) + 1);
+	    (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_NPMASK) + 1);
 
     ctlr->reset = ata_ahci_reset;
     ctlr->ch_attach = ata_ahci_ch_attach;
@@ -148,7 +148,7 @@ ata_ahci_chipinit(device_t dev)
 		  "AHCI Version %x%x.%x%x controller with %d ports PM %s\n",
 		  (version >> 24) & 0xff, (version >> 16) & 0xff,
 		  (version >> 8) & 0xff, version & 0xff,
-		  (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_NPMASK) + 1,
+		  (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_NPMASK) + 1,
 		  (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_SPM) ?
 		  "supported" : "not supported");
     return 0;
@@ -286,7 +286,9 @@ ata_ahci_ch_resume(device_t dev)
 
     /* activate the channel and power/spin up device */
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
-	     (ATA_AHCI_P_CMD_ACTIVE | ATA_AHCI_P_CMD_POD | ATA_AHCI_P_CMD_SUD));
+	     (ATA_AHCI_P_CMD_ACTIVE | ATA_AHCI_P_CMD_POD | ATA_AHCI_P_CMD_SUD |
+	     ((ch->pm_level > 1) ? ATA_AHCI_P_CMD_ALPE : 0) |
+	     ((ch->pm_level > 2) ? ATA_AHCI_P_CMD_ASP : 0 )));
     ata_ahci_start_fr(dev);
     ata_ahci_start(dev);
 
@@ -818,9 +820,9 @@ ata_ahci_reset(device_t dev)
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset,
 	     (ATA_AHCI_P_IX_CPD | ATA_AHCI_P_IX_TFE | ATA_AHCI_P_IX_HBF |
 	      ATA_AHCI_P_IX_HBD | ATA_AHCI_P_IX_IF | ATA_AHCI_P_IX_OF |
-	      ATA_AHCI_P_IX_PRC | ATA_AHCI_P_IX_PC | ATA_AHCI_P_IX_DP |
-	      ATA_AHCI_P_IX_UF | ATA_AHCI_P_IX_SDB | ATA_AHCI_P_IX_DS |
-	      ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DHR));
+	      ((ch->pm_level == 0) ? ATA_AHCI_P_IX_PRC | ATA_AHCI_P_IX_PC : 0) |
+	      ATA_AHCI_P_IX_DP | ATA_AHCI_P_IX_UF | ATA_AHCI_P_IX_SDB |
+	      ATA_AHCI_P_IX_DS | ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DHR));
 
     /* only probe for PortMultiplier if HW has support */
     if (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_SPM) {

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 21:50:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B5852106567E;
	Wed, 29 Apr 2009 21:50:13 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A171C8FC18;
	Wed, 29 Apr 2009 21:50:13 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TLoD1a093812;
	Wed, 29 Apr 2009 21:50:13 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TLoD3O093802;
	Wed, 29 Apr 2009 21:50:13 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200904292150.n3TLoD3O093802@svn.freebsd.org>
From: Jamie Gritton 
Date: Wed, 29 Apr 2009 21:50:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191675 - in head/sys: compat/freebsd32 kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 21:50:14 -0000

Author: jamie
Date: Wed Apr 29 21:50:13 2009
New Revision: 191675
URL: http://svn.freebsd.org/changeset/base/191675

Log:
  Regen for new jail system calls in r191673.
  
  Approved by:	bz (mentor)

Modified:
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/kern/init_sysent.c
  head/sys/kern/syscalls.c
  head/sys/kern/systrace_args.c
  head/sys/sys/syscall.h
  head/sys/sys/syscall.mk
  head/sys/sys/sysproto.h

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_proto.h	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/compat/freebsd32/freebsd32_proto.h	Wed Apr 29 21:50:13 2009	(r191675)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 190621 2009-04-01 13:11:50Z kib 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
  */
 
 #ifndef _FREEBSD32_SYSPROTO_H_
@@ -443,6 +443,16 @@ struct freebsd32_futimesat_args {
 	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
 	char times_l_[PADL_(struct timeval *)]; struct timeval * times; char times_r_[PADR_(struct timeval *)];
 };
+struct freebsd32_jail_get_args {
+	char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)];
+	char iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+};
+struct freebsd32_jail_set_args {
+	char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)];
+	char iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+};
 int	freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *);
 int	freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *);
 int	freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *);
@@ -524,6 +534,8 @@ int	freebsd32_cpuset_setaffinity(struct 
 int	freebsd32_fexecve(struct thread *, struct freebsd32_fexecve_args *);
 int	freebsd32_fstatat(struct thread *, struct freebsd32_fstatat_args *);
 int	freebsd32_futimesat(struct thread *, struct freebsd32_futimesat_args *);
+int	freebsd32_jail_get(struct thread *, struct freebsd32_jail_get_args *);
+int	freebsd32_jail_set(struct thread *, struct freebsd32_jail_set_args *);
 
 #ifdef COMPAT_43
 
@@ -751,6 +763,8 @@ int	freebsd6_freebsd32_ftruncate(struct 
 #define	FREEBSD32_SYS_AUE_freebsd32_fexecve	AUE_FEXECVE
 #define	FREEBSD32_SYS_AUE_freebsd32_fstatat	AUE_FSTATAT
 #define	FREEBSD32_SYS_AUE_freebsd32_futimesat	AUE_FUTIMESAT
+#define	FREEBSD32_SYS_AUE_freebsd32_jail_get	AUE_NULL
+#define	FREEBSD32_SYS_AUE_freebsd32_jail_set	AUE_NULL
 
 #undef PAD_
 #undef PADL_

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_syscall.h	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h	Wed Apr 29 21:50:13 2009	(r191675)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 190621 2009-04-01 13:11:50Z kib 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
  */
 
 #define	FREEBSD32_SYS_syscall	0
@@ -368,4 +368,7 @@
 #define	FREEBSD32_SYS_symlinkat	502
 #define	FREEBSD32_SYS_unlinkat	503
 #define	FREEBSD32_SYS_posix_openpt	504
-#define	FREEBSD32_SYS_MAXSYSCALL	506
+#define	FREEBSD32_SYS_freebsd32_jail_get	506
+#define	FREEBSD32_SYS_freebsd32_jail_set	507
+#define	FREEBSD32_SYS_jail_remove	508
+#define	FREEBSD32_SYS_MAXSYSCALL	509

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_syscalls.c	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c	Wed Apr 29 21:50:13 2009	(r191675)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 190621 2009-04-01 13:11:50Z kib 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
  */
 
 const char *freebsd32_syscallnames[] = {
@@ -513,4 +513,7 @@ const char *freebsd32_syscallnames[] = {
 	"unlinkat",			/* 503 = unlinkat */
 	"posix_openpt",			/* 504 = posix_openpt */
 	"#505",			/* 505 = gssd_syscall */
+	"freebsd32_jail_get",			/* 506 = freebsd32_jail_get */
+	"freebsd32_jail_set",			/* 507 = freebsd32_jail_set */
+	"jail_remove",			/* 508 = jail_remove */
 };

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_sysent.c	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/compat/freebsd32/freebsd32_sysent.c	Wed Apr 29 21:50:13 2009	(r191675)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 190621 2009-04-01 13:11:50Z kib 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
  */
 
 #include "opt_compat.h"
@@ -544,4 +544,7 @@ struct sysent freebsd32_sysent[] = {
 	{ AS(unlinkat_args), (sy_call_t *)unlinkat, AUE_UNLINKAT, NULL, 0, 0 },	/* 503 = unlinkat */
 	{ AS(posix_openpt_args), (sy_call_t *)posix_openpt, AUE_POSIX_OPENPT, NULL, 0, 0 },	/* 504 = posix_openpt */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 505 = gssd_syscall */
+	{ AS(freebsd32_jail_get_args), (sy_call_t *)freebsd32_jail_get, AUE_NULL, NULL, 0, 0 },	/* 506 = freebsd32_jail_get */
+	{ AS(freebsd32_jail_set_args), (sy_call_t *)freebsd32_jail_set, AUE_NULL, NULL, 0, 0 },	/* 507 = freebsd32_jail_set */
+	{ AS(jail_remove_args), (sy_call_t *)jail_remove, AUE_NULL, NULL, 0, 0 },	/* 508 = jail_remove */
 };

Modified: head/sys/kern/init_sysent.c
==============================================================================
--- head/sys/kern/init_sysent.c	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/kern/init_sysent.c	Wed Apr 29 21:50:13 2009	(r191675)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 184789 2008-11-09 10:45:13Z ed 
+ * created from FreeBSD: head/sys/kern/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
  */
 
 #include "opt_compat.h"
@@ -534,4 +534,7 @@ struct sysent sysent[] = {
 	{ AS(unlinkat_args), (sy_call_t *)unlinkat, AUE_UNLINKAT, NULL, 0, 0 },	/* 503 = unlinkat */
 	{ AS(posix_openpt_args), (sy_call_t *)posix_openpt, AUE_POSIX_OPENPT, NULL, 0, 0 },	/* 504 = posix_openpt */
 	{ AS(gssd_syscall_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 },	/* 505 = gssd_syscall */
+	{ AS(jail_get_args), (sy_call_t *)jail_get, AUE_NULL, NULL, 0, 0 },	/* 506 = jail_get */
+	{ AS(jail_set_args), (sy_call_t *)jail_set, AUE_NULL, NULL, 0, 0 },	/* 507 = jail_set */
+	{ AS(jail_remove_args), (sy_call_t *)jail_remove, AUE_NULL, NULL, 0, 0 },	/* 508 = jail_remove */
 };

Modified: head/sys/kern/syscalls.c
==============================================================================
--- head/sys/kern/syscalls.c	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/kern/syscalls.c	Wed Apr 29 21:50:13 2009	(r191675)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 184789 2008-11-09 10:45:13Z ed 
+ * created from FreeBSD: head/sys/kern/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
  */
 
 const char *syscallnames[] = {
@@ -513,4 +513,7 @@ const char *syscallnames[] = {
 	"unlinkat",			/* 503 = unlinkat */
 	"posix_openpt",			/* 504 = posix_openpt */
 	"gssd_syscall",			/* 505 = gssd_syscall */
+	"jail_get",			/* 506 = jail_get */
+	"jail_set",			/* 507 = jail_set */
+	"jail_remove",			/* 508 = jail_remove */
 };

Modified: head/sys/kern/systrace_args.c
==============================================================================
--- head/sys/kern/systrace_args.c	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/kern/systrace_args.c	Wed Apr 29 21:50:13 2009	(r191675)
@@ -3040,6 +3040,31 @@ systrace_args(int sysnum, void *params, 
 		*n_args = 1;
 		break;
 	}
+	/* jail_get */
+	case 506: {
+		struct jail_get_args *p = params;
+		uarg[0] = (intptr_t) p->iovp; /* struct iovec * */
+		uarg[1] = p->iovcnt; /* unsigned int */
+		iarg[2] = p->flags; /* int */
+		*n_args = 3;
+		break;
+	}
+	/* jail_set */
+	case 507: {
+		struct jail_set_args *p = params;
+		uarg[0] = (intptr_t) p->iovp; /* struct iovec * */
+		uarg[1] = p->iovcnt; /* unsigned int */
+		iarg[2] = p->flags; /* int */
+		*n_args = 3;
+		break;
+	}
+	/* jail_remove */
+	case 508: {
+		struct jail_remove_args *p = params;
+		iarg[0] = p->jid; /* int */
+		*n_args = 1;
+		break;
+	}
 	default:
 		*n_args = 0;
 		break;
@@ -8070,6 +8095,48 @@ systrace_setargdesc(int sysnum, int ndx,
 			break;
 		};
 		break;
+	/* jail_get */
+	case 506:
+		switch(ndx) {
+		case 0:
+			p = "struct iovec *";
+			break;
+		case 1:
+			p = "unsigned int";
+			break;
+		case 2:
+			p = "int";
+			break;
+		default:
+			break;
+		};
+		break;
+	/* jail_set */
+	case 507:
+		switch(ndx) {
+		case 0:
+			p = "struct iovec *";
+			break;
+		case 1:
+			p = "unsigned int";
+			break;
+		case 2:
+			p = "int";
+			break;
+		default:
+			break;
+		};
+		break;
+	/* jail_remove */
+	case 508:
+		switch(ndx) {
+		case 0:
+			p = "int";
+			break;
+		default:
+			break;
+		};
+		break;
 	default:
 		break;
 	};

Modified: head/sys/sys/syscall.h
==============================================================================
--- head/sys/sys/syscall.h	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/sys/syscall.h	Wed Apr 29 21:50:13 2009	(r191675)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 184789 2008-11-09 10:45:13Z ed 
+ * created from FreeBSD: head/sys/kern/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
  */
 
 #define	SYS_syscall	0
@@ -421,4 +421,7 @@
 #define	SYS_unlinkat	503
 #define	SYS_posix_openpt	504
 #define	SYS_gssd_syscall	505
-#define	SYS_MAXSYSCALL	506
+#define	SYS_jail_get	506
+#define	SYS_jail_set	507
+#define	SYS_jail_remove	508
+#define	SYS_MAXSYSCALL	509

Modified: head/sys/sys/syscall.mk
==============================================================================
--- head/sys/sys/syscall.mk	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/sys/syscall.mk	Wed Apr 29 21:50:13 2009	(r191675)
@@ -1,7 +1,7 @@
 # FreeBSD system call names.
 # DO NOT EDIT-- this file is automatically generated.
 # $FreeBSD$
-# created from FreeBSD: head/sys/kern/syscalls.master 184789 2008-11-09 10:45:13Z ed 
+# created from FreeBSD: head/sys/kern/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
 MIASM =  \
 	syscall.o \
 	exit.o \
@@ -369,4 +369,7 @@ MIASM =  \
 	symlinkat.o \
 	unlinkat.o \
 	posix_openpt.o \
-	gssd_syscall.o
+	gssd_syscall.o \
+	jail_get.o \
+	jail_set.o \
+	jail_remove.o

Modified: head/sys/sys/sysproto.h
==============================================================================
--- head/sys/sys/sysproto.h	Wed Apr 29 21:17:18 2009	(r191674)
+++ head/sys/sys/sysproto.h	Wed Apr 29 21:50:13 2009	(r191675)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 184789 2008-11-09 10:45:13Z ed 
+ * created from FreeBSD: head/sys/kern/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
  */
 
 #ifndef _SYS_SYSPROTO_H_
@@ -1625,6 +1625,19 @@ struct posix_openpt_args {
 struct gssd_syscall_args {
 	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
 };
+struct jail_get_args {
+	char iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)];
+	char iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+};
+struct jail_set_args {
+	char iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)];
+	char iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+};
+struct jail_remove_args {
+	char jid_l_[PADL_(int)]; int jid; char jid_r_[PADR_(int)];
+};
 int	nosys(struct thread *, struct nosys_args *);
 void	sys_exit(struct thread *, struct sys_exit_args *);
 int	fork(struct thread *, struct fork_args *);
@@ -1979,6 +1992,9 @@ int	symlinkat(struct thread *, struct sy
 int	unlinkat(struct thread *, struct unlinkat_args *);
 int	posix_openpt(struct thread *, struct posix_openpt_args *);
 int	gssd_syscall(struct thread *, struct gssd_syscall_args *);
+int	jail_get(struct thread *, struct jail_get_args *);
+int	jail_set(struct thread *, struct jail_set_args *);
+int	jail_remove(struct thread *, struct jail_remove_args *);
 
 #ifdef COMPAT_43
 
@@ -2572,6 +2588,9 @@ int	freebsd4_sigreturn(struct thread *, 
 #define	SYS_AUE_unlinkat	AUE_UNLINKAT
 #define	SYS_AUE_posix_openpt	AUE_POSIX_OPENPT
 #define	SYS_AUE_gssd_syscall	AUE_NULL
+#define	SYS_AUE_jail_get	AUE_NULL
+#define	SYS_AUE_jail_set	AUE_NULL
+#define	SYS_AUE_jail_remove	AUE_NULL
 
 #undef PAD_
 #undef PADL_

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 23:04:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F59C1065670;
	Wed, 29 Apr 2009 23:04:32 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1D6338FC0C;
	Wed, 29 Apr 2009 23:04:32 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TN4Wb9095280;
	Wed, 29 Apr 2009 23:04:32 GMT (envelope-from jeff@svn.freebsd.org)
Received: (from jeff@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TN4WbH095279;
	Wed, 29 Apr 2009 23:04:32 GMT (envelope-from jeff@svn.freebsd.org)
Message-Id: <200904292304.n3TN4WbH095279@svn.freebsd.org>
From: Jeff Roberson 
Date: Wed, 29 Apr 2009 23:04:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191676 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 23:04:32 -0000

Author: jeff
Date: Wed Apr 29 23:04:31 2009
New Revision: 191676
URL: http://svn.freebsd.org/changeset/base/191676

Log:
   - Fix non-SMP build by encapsulating idle spin logic in a macro.
  
  Pointy hat to:	me

Modified:
  head/sys/kern/sched_ule.c

Modified: head/sys/kern/sched_ule.c
==============================================================================
--- head/sys/kern/sched_ule.c	Wed Apr 29 21:50:13 2009	(r191675)
+++ head/sys/kern/sched_ule.c	Wed Apr 29 23:04:31 2009	(r191676)
@@ -2516,6 +2516,13 @@ sched_sizeof_thread(void)
 	return (sizeof(struct thread) + sizeof(struct td_sched));
 }
 
+#ifdef SMP
+#define	TDQ_IDLESPIN(tdq)						\
+    ((tdq)->tdq_cg != NULL && ((tdq)->tdq_cg->cg_flags & CG_FLAG_THREAD) == 0)
+#else
+#define	TDQ_IDLESPIN(tdq)	1
+#endif
+
 /*
  * The actual idle process.
  */
@@ -2543,8 +2550,7 @@ sched_idletd(void *dummy)
 		 * loops while on SMT machines as this simply steals
 		 * cycles from cores doing useful work.
 		 */
-		if ((tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) == 0 &&
-		    switchcnt > sched_idlespinthresh) {
+		if (TDQ_IDLESPIN(tdq) && switchcnt > sched_idlespinthresh) {
 			for (i = 0; i < sched_idlespins; i++) {
 				if (tdq->tdq_load)
 					break;

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 29 23:31:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 26973106566C;
	Wed, 29 Apr 2009 23:31:04 +0000 (UTC)
	(envelope-from jroberson@jroberson.net)
Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.239])
	by mx1.freebsd.org (Postfix) with ESMTP id D87508FC1E;
	Wed, 29 Apr 2009 23:31:03 +0000 (UTC)
	(envelope-from jroberson@jroberson.net)
Received: by rv-out-0506.google.com with SMTP id k40so1205292rvb.43
	for ; Wed, 29 Apr 2009 16:31:03 -0700 (PDT)
Received: by 10.140.144.1 with SMTP id r1mr235619rvd.131.1241046338502;
	Wed, 29 Apr 2009 16:05:38 -0700 (PDT)
Received: from ?10.0.1.198? (udp016664uds.hawaiiantel.net [72.235.41.117])
	by mx.google.com with ESMTPS id f21sm3380529rvb.25.2009.04.29.16.05.35
	(version=SSLv3 cipher=RC4-MD5); Wed, 29 Apr 2009 16:05:37 -0700 (PDT)
Date: Wed, 29 Apr 2009 13:07:40 -1000 (HST)
From: Jeff Roberson 
X-X-Sender: jroberson@desktop
To: Kostik Belousov 
In-Reply-To: <20090429165417.GG40751@deviant.kiev.zoral.com.ua>
Message-ID: 
References: <200904290315.n3T3FiJW067558@svn.freebsd.org>
	<20090429165417.GG40751@deviant.kiev.zoral.com.ua>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, Jeff Roberson ,
	src-committers@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r191643 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 29 Apr 2009 23:31:04 -0000

On Wed, 29 Apr 2009, Kostik Belousov wrote:

> On Wed, Apr 29, 2009 at 03:15:44AM +0000, Jeff Roberson wrote:
>> Author: jeff
>> Date: Wed Apr 29 03:15:43 2009
>> New Revision: 191643
>> URL: http://svn.freebsd.org/changeset/base/191643
>>
>> Log:
>>    - Remove the bogus idle thread state code.  This may have a race in it
>>      and it only optimized out an ipi or mwait in very few cases.
>>    - Skip the adaptive idle code when running on SMT or HTT cores.  This
>>      just wastes cpu time that could be used on a busy thread on the same
>>      core.
>>    - Rename CG_FLAG_THREAD to CG_FLAG_SMT to be more descriptive.  Re-use
>>      CG_FLAG_THREAD to mean SMT or HTT.
>>
>>   Sponsored by:   Nokia
>>
>> Modified:
>>   head/sys/kern/sched_ule.c
>>   head/sys/kern/subr_smp.c
>>   head/sys/sys/smp.h
>
> Now I see a reason why it is better #ifdef SMP the code that uses CG_FLAG_*.
> Also, we should check for tdq_cg != NULL in one more place.
>
> See the patch below, instead of exposing CG_FLAG_* for !SMP configs.

Thank you kan.  I did something slightly different so we can retain the 
adaptive idling on UP.

Thanks,
Jeff

>
> diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
> index 680572d..fe3a119 100644
> --- a/sys/kern/sched_ule.c
> +++ b/sys/kern/sched_ule.c
> @@ -891,6 +891,7 @@ tdq_move(struct tdq *from, struct tdq *to)
> 	return (1);
> }
>
> +#ifdef SMP
> /*
>  * This tdq has idled.  Try to steal a thread from another cpu and switch
>  * to it.
> @@ -947,6 +948,7 @@ tdq_idled(struct tdq *tdq)
> 	spinlock_exit();
> 	return (1);
> }
> +#endif
>
> /*
>  * Notify a remote cpu of new work.  Sends an IPI if criteria are met.
> @@ -2525,7 +2527,9 @@ sched_idletd(void *dummy)
> 	struct thread *td;
> 	struct tdq *tdq;
> 	int switchcnt;
> +#ifdef SMP
> 	int i;
> +#endif
>
> 	mtx_assert(&Giant, MA_NOTOWNED);
> 	td = curthread;
> @@ -2543,7 +2547,9 @@ sched_idletd(void *dummy)
> 		 * loops while on SMT machines as this simply steals
> 		 * cycles from cores doing useful work.
> 		 */
> -		if ((tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) == 0 &&
> +#ifdef SMP
> +		if (tdq->tdq_cg != NULL &&
> +		    (tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) == 0 &&
> 		    switchcnt > sched_idlespinthresh) {
> 			for (i = 0; i < sched_idlespins; i++) {
> 				if (tdq->tdq_load)
> @@ -2551,6 +2557,7 @@ sched_idletd(void *dummy)
> 				cpu_spinwait();
> 			}
> 		}
> +#endif
> 		switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt;
> 		if (tdq->tdq_load == 0)
> 			cpu_idle(switchcnt > 1);
>

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 01:24:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EA3B51065676;
	Thu, 30 Apr 2009 01:24:53 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D79CD8FC0A;
	Thu, 30 Apr 2009 01:24:53 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3U1Orxn097928;
	Thu, 30 Apr 2009 01:24:53 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3U1Or1w097927;
	Thu, 30 Apr 2009 01:24:53 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200904300124.n3U1Or1w097927@svn.freebsd.org>
From: Warner Losh 
Date: Thu, 30 Apr 2009 01:24:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191677 - head/usr.bin/du
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 01:24:54 -0000

Author: imp
Date: Thu Apr 30 01:24:53 2009
New Revision: 191677
URL: http://svn.freebsd.org/changeset/base/191677

Log:
  Report the next directory being scanned when a ^T is pressed (or any
  SIGINFO).  Provides some progress report for the impatient.  This
  won't report that we're blocking in our walk due to disk/network
  problems, however.  There's no really good way to report that
  condition that I'm aware of...

Modified:
  head/usr.bin/du/du.c

Modified: head/usr.bin/du/du.c
==============================================================================
--- head/usr.bin/du/du.c	Wed Apr 29 23:04:31 2009	(r191676)
+++ head/usr.bin/du/du.c	Thu Apr 30 01:24:53 2009	(r191677)
@@ -77,10 +77,12 @@ static void	prthumanval(int64_t);
 static void	ignoreadd(const char *);
 static void	ignoreclean(void);
 static int	ignorep(FTSENT *);
+static void	siginfo(int __unused);
 
 static int	nodumpflag = 0;
 static int	Aflag;
 static long	blocksize, cblocksize;
+static volatile sig_atomic_t info;
 
 int
 main(int argc, char *argv[])
@@ -248,6 +250,8 @@ main(int argc, char *argv[])
 
 	rval = 0;
 
+	(void)signal(SIGINFO, siginfo);
+
 	if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL)
 		err(1, "fts_open");
 
@@ -278,6 +282,10 @@ main(int argc, char *argv[])
 					    p->fts_path);
 				}
 			}
+			if (info) {
+				info = 0;
+				(void)printf("\t%s\n", p->fts_path);
+			}
 			break;
 		case FTS_DC:			/* Ignore. */
 			break;
@@ -531,3 +539,10 @@ ignorep(FTSENT *ent)
 			return 1;
 	return 0;
 }
+
+static void
+siginfo(int sig __unused)
+{
+
+	info = 1;
+}

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 06:36:44 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5C4A410656BD;
	Thu, 30 Apr 2009 06:36:44 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au
	[211.29.132.189])
	by mx1.freebsd.org (Postfix) with ESMTP id CF7E48FC1A;
	Thu, 30 Apr 2009 06:36:43 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from c122-107-120-227.carlnfd1.nsw.optusnet.com.au
	(c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227])
	by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n3U6acfe021164
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 30 Apr 2009 16:36:39 +1000
Date: Thu, 30 Apr 2009 16:36:38 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Warner Losh 
In-Reply-To: <200904300124.n3U1Or1w097927@svn.freebsd.org>
Message-ID: <20090430162311.T2904@delplex.bde.org>
References: <200904300124.n3U1Or1w097927@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r191677 - head/usr.bin/du
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 06:36:45 -0000

On Thu, 30 Apr 2009, Warner Losh wrote:

> Log:
>  Report the next directory being scanned when a ^T is pressed (or any
>  SIGINFO).  Provides some progress report for the impatient.

The impatient should use a tracing utility instead of encrufting
individual utilities.

>  This
>  won't report that we're blocking in our walk due to disk/network
>  problems, however.  There's no really good way to report that
>  condition that I'm aware of...

Tracing utilities coulld be extended to report kernel info.  E.g.,
the current [blocked] syscall can be found and reported in the same
way and detail that ddb does for backtrace and ps.  Names would be
harder to find, but a full backtrace normally locates what is blocking.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 07:07:32 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BEED810656C9
	for ; Thu, 30 Apr 2009 07:07:32 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from mx0.deglitch.com (backbone.deglitch.com
	[IPv6:2001:16d8:fffb:4::abba])
	by mx1.freebsd.org (Postfix) with ESMTP id 70D918FC1C
	for ; Thu, 30 Apr 2009 07:07:32 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from DSPAM-Daemon (localhost [127.0.0.1])
	by mx0.deglitch.com (Postfix) with SMTP id 76D838FC52
	for ; Thu, 30 Apr 2009 11:07:31 +0400 (MSD)
Received: from orion.SpringDaemons.com (unknown [77.232.3.143])
	by mx0.deglitch.com (Postfix) with ESMTPA id BC89D8FC18;
	Thu, 30 Apr 2009 11:07:28 +0400 (MSD)
Received: from orion (localhost [127.0.0.1])
	by orion.SpringDaemons.com (Postfix) with SMTP id C3DC539827;
	Thu, 30 Apr 2009 11:07:39 +0400 (MSD)
Date: Thu, 30 Apr 2009 11:07:39 +0400
From: Stanislav Sedov 
To: Bruce Evans 
Message-Id: <20090430110739.682cc989.stas@FreeBSD.org>
In-Reply-To: <20090430162311.T2904@delplex.bde.org>
References: <200904300124.n3U1Or1w097927@svn.freebsd.org>
	<20090430162311.T2904@delplex.bde.org>
Organization: The FreeBSD Project
X-XMPP: ssedov@jabber.ru
X-Voice: +7 916 849 20 23
X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2  A385 2BF5 5993 EB26 9581
X-Mailer: carrier-pigeon
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-DSPAM-Result: Innocent
X-DSPAM-Processed: Thu Apr 30 11:07:31 2009
X-DSPAM-Confidence: 0.9899
X-DSPAM-Improbability: 1 in 9809 chance of being spam
X-DSPAM-Probability: 0.0000
X-DSPAM-Signature: 49f94e33967001591919171
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, Warner Losh 
Subject: Re: svn commit: r191677 - head/usr.bin/du
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 07:07:33 -0000

On Thu, 30 Apr 2009 16:36:38 +1000 (EST)
Bruce Evans  mentioned:

> On Thu, 30 Apr 2009, Warner Losh wrote:
> 
> > Log:
> >  Report the next directory being scanned when a ^T is pressed (or any
> >  SIGINFO).  Provides some progress report for the impatient.
> 
> The impatient should use a tracing utility instead of encrufting
> individual utilities.
> 

On the other hand, using tracing utilities is not the best way to retireve
status information in all cases.

-- 
Stanislav Sedov
ST4096-RIPE

!DSPAM:49f94e33967001591919171!



From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 07:22:14 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1A05A106566B;
	Thu, 30 Apr 2009 07:22:14 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id CEAD08FC14;
	Thu, 30 Apr 2009 07:22:13 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3U7JBVw004495;
	Thu, 30 Apr 2009 01:19:11 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Thu, 30 Apr 2009 01:19:13 -0600 (MDT)
Message-Id: <20090430.011913.-1023162474.imp@bsdimp.com>
To: stas@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <20090430110739.682cc989.stas@FreeBSD.org>
References: <200904300124.n3U1Or1w097927@svn.freebsd.org>
	<20090430162311.T2904@delplex.bde.org>
	<20090430110739.682cc989.stas@FreeBSD.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, brde@optusnet.com.au
Subject: Re: svn commit: r191677 - head/usr.bin/du
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 07:22:14 -0000

In message: <20090430110739.682cc989.stas@FreeBSD.org>
            Stanislav Sedov  writes:
: On Thu, 30 Apr 2009 16:36:38 +1000 (EST)
: Bruce Evans  mentioned:
: 
: > On Thu, 30 Apr 2009, Warner Losh wrote:
: > 
: > > Log:
: > >  Report the next directory being scanned when a ^T is pressed (or any
: > >  SIGINFO).  Provides some progress report for the impatient.
: > 
: > The impatient should use a tracing utility instead of encrufting
: > individual utilities.
: > 
: 
: On the other hand, using tracing utilities is not the best way to retireve
: status information in all cases.

Especially if one started the job and then it seems to be "stuck".
It is most efficient to know if something is going on, and ^T gives
that with a very minimal set of code.

Tracing utilities produce way too much output...

Warner

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 07:48:49 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C6224106566B;
	Thu, 30 Apr 2009 07:48:49 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B4DB68FC17;
	Thu, 30 Apr 2009 07:48:49 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3U7mn9c005509;
	Thu, 30 Apr 2009 07:48:49 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3U7mnje005508;
	Thu, 30 Apr 2009 07:48:49 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <200904300748.n3U7mnje005508@svn.freebsd.org>
From: Maxim Konovalov 
Date: Thu, 30 Apr 2009 07:48:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191681 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 07:48:50 -0000

Author: maxim
Date: Thu Apr 30 07:48:49 2009
New Revision: 191681
URL: http://svn.freebsd.org/changeset/base/191681

Log:
  o NetBSD 5.0 added.
  > Description of fields to fill in above:                     76 columns --|
  > PR:            If a GNATS PR is affected by the change.
  > Submitted by:  If someone else sent in the change.
  > Reviewed by:   If someone else reviewed your modification.
  > Approved by:   If you needed approval for this commit.
  > Obtained from: If the change is from a third party.
  > MFC after:     N [day[s]|week[s]|month[s]].  Request a reminder email.
  > Security:      Vulnerability reference (one per line) or description.
  > Empty fields above will be automatically removed.
  
  M    bsd-family-tree

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==============================================================================
--- head/share/misc/bsd-family-tree	Thu Apr 30 06:17:56 2009	(r191680)
+++ head/share/misc/bsd-family-tree	Thu Apr 30 07:48:49 2009	(r191681)
@@ -227,7 +227,7 @@ FreeBSD 5.2           |      |          
  |     |              |      |                 |                       |
  |  FreeBSD 7.1       |      |                 |                       |
  |     |              |      |                 |                DragonFly 2.2.0
- |     V              |      |                 |                       |
+ |     V              |   NetBSD 5.0           |                       |
  |                    |      |                 |                       |
 FreeBSD 8 -current    |  NetBSD -current  OpenBSD -current             |
  |                    |      |                 |                       |
@@ -496,6 +496,7 @@ OpenBSD 4.4		2008-11-01 [OBD]
 FreeBSD 6.4		2008-11-28 [FBD]
 FreeBSD 7.1		2009-01-04 [FBD]
 DragonFly 2.2.0		2009-02-17 [DFB]
+NetBSD 5.0		2009-04-29 [NBD]
 
 Bibliography
 ------------------------

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 07:58:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A60E2106566B;
	Thu, 30 Apr 2009 07:58:46 +0000 (UTC)
	(envelope-from alexander@leidinger.net)
Received: from redbull.bpaserver.net (redbullneu.bpaserver.net
	[213.198.78.217])
	by mx1.freebsd.org (Postfix) with ESMTP id 48E658FC26;
	Thu, 30 Apr 2009 07:58:46 +0000 (UTC)
	(envelope-from alexander@leidinger.net)
Received: from outgoing.leidinger.net (pD9E2DF1A.dip.t-dialin.net
	[217.226.223.26])
	by redbull.bpaserver.net (Postfix) with ESMTP id 9789F2E1FE;
	Thu, 30 Apr 2009 09:58:40 +0200 (CEST)
Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102])
	by outgoing.leidinger.net (Postfix) with ESMTP id 006E111479B;
	Thu, 30 Apr 2009 09:58:36 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net;
	s=outgoing-alex; t=1241078317; bh=TyYr7VRVwxXUunhCaoLMpai6UC9wxENVh
	j/XCvY0yYY=; h=Message-ID:Date:From:To:Cc:Subject:References:
	In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding;
	b=OMmsjQ2sGPeW4djAw4AkZWvzgtBTzKspZuyybvLW68QbvFrW5E9/EihO+faXqPuFj
	JB2PGdVuIv2iGrSNzw/duoxo84mQ3a3PZOAKcKTHqtW585Zm0gst0RuDctilhCFXYTm
	cvEA4N26cN7cwZ41LKrTrws16DXAlI97y4ZeKTaquW8X/GuLHMA9koYafRnNLR+G50T
	FoOP6N3xPVYQZC+9oJJkg050r4szxeXT9ASwNotcOgdy7h2gYuFf/9eaMtwOaThPfiV
	qvXTnfOGReXrA6TbNrYmUUTuQLYGKvPsLCmdaeDxYRutqZE2t0JFoSy6rFBBQMBdMlz
	TrgJfIBlw==
Received: (from www@localhost)
	by webmail.leidinger.net (8.14.3/8.13.8/Submit) id n3U7wa3i000886;
	Thu, 30 Apr 2009 09:58:36 +0200 (CEST)
	(envelope-from Alexander@Leidinger.net)
Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by
	webmail.leidinger.net (Horde Framework) with HTTP; Thu, 30 Apr 2009
	09:58:35 +0200
Message-ID: <20090430095835.14265d5oog5a4pwk@webmail.leidinger.net>
X-Priority: 3 (Normal)
Date: Thu, 30 Apr 2009 09:58:35 +0200
From: Alexander Leidinger 
To: Jamie Gritton 
References: <200904292114.n3TLEGTW093008@svn.freebsd.org>
In-Reply-To: <200904292114.n3TLEGTW093008@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8;
 DelSp="Yes";
 format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
User-Agent: Internet Messaging Program (IMP) 4.3.3 / FreeBSD-8.0
X-BPAnet-MailScanner-Information: Please contact the ISP for more information
X-MailScanner-ID: 9789F2E1FE.6358E
X-BPAnet-MailScanner: Found to be clean
X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, 
	score=-14.823, required 6, BAYES_00 -15.00,
	DKIM_SIGNED 0.00, 
	DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10, TW_SV 0.08)
X-BPAnet-MailScanner-From: alexander@leidinger.net
X-Spam-Status: No
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r191673 - in head: lib/libc/sys
 sys/cddl/compat/opensolaris/kern sys/compat/freebsd32 sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 07:58:47 -0000

Quoting Jamie Gritton  (from Wed, 29 Apr 2009  
21:14:16 +0000 (UTC)):

> Author: jamie
> Date: Wed Apr 29 21:14:15 2009
> New Revision: 191673
> URL: http://svn.freebsd.org/changeset/base/191673
>
> Log:
>   Introduce the extensible jail framework, using the same "name=value"
>   interface as nmount(2).  Three new system calls are added:
>   * jail_set, to create jails and change the parameters of existing jails.
>     This replaces jail(2).
>   * jail_get, to read the parameters of existing jails.  This replaces the
>     security.jail.list sysctl.
>   * jail_remove to kill off a jail's processes and remove the jail.
>   Most jail parameters may now be changed after creation, and jails may be
>   set to exist without any attached processes.  The current jail(2) system
>   call still exists, though it is now a stub to jail_set(2).

Does this mean it is theoretically possible now to add/remove IP  
addresses to/from a running jail? If yes, are you going to implement  
the corresponding ifconfig feature? I would expect this in ifconfig,  
as on Solaris ifconfig is able to do this with zones, I haven't looked  
if the jail utility is able to do it.

Bye,
Alexander.

-- 
In these matters the only certainty is that there is nothing certain.
		-- Pliny the Elder

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 08:31:17 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 13274106566B;
	Thu, 30 Apr 2009 08:31:17 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail11.syd.optusnet.com.au (mail11.syd.optusnet.com.au
	[211.29.132.192])
	by mx1.freebsd.org (Postfix) with ESMTP id 982108FC19;
	Thu, 30 Apr 2009 08:31:16 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from besplex.bde.org (c122-107-120-227.carlnfd1.nsw.optusnet.com.au
	[122.107.120.227])
	by mail11.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n3U8V6Do017844
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 30 Apr 2009 18:31:10 +1000
Date: Thu, 30 Apr 2009 18:31:06 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: "M. Warner Losh" 
In-Reply-To: <20090430.011913.-1023162474.imp@bsdimp.com>
Message-ID: <20090430172939.M1225@besplex.bde.org>
References: <200904300124.n3U1Or1w097927@svn.freebsd.org>
	<20090430162311.T2904@delplex.bde.org>
	<20090430110739.682cc989.stas@FreeBSD.org>
	<20090430.011913.-1023162474.imp@bsdimp.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: stas@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, brde@optusnet.com.au
Subject: Re: svn commit: r191677 - head/usr.bin/du
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 08:31:17 -0000

On Thu, 30 Apr 2009, M. Warner Losh wrote:

> In message: <20090430110739.682cc989.stas@FreeBSD.org>
>            Stanislav Sedov  writes:
> : On Thu, 30 Apr 2009 16:36:38 +1000 (EST)
> : Bruce Evans  mentioned:
> :
> : > On Thu, 30 Apr 2009, Warner Losh wrote:
> : >
> : > > Log:
> : > >  Report the next directory being scanned when a ^T is pressed (or any
> : > >  SIGINFO).  Provides some progress report for the impatient.
> : >
> : > The impatient should use a tracing utility instead of encrufting
> : > individual utilities.
> :
> : On the other hand, using tracing utilities is not the best way to retireve
> : status information in all cases.

It just handles many more cases better than encrufting utilities does.

> Especially if one started the job and then it seems to be "stuck".
> It is most efficient to know if something is going on, and ^T gives
> that with a very minimal set of code.

No, this case is handled almost identically for utilities (like all the
encrufted ones starting with cp) whose activity consists mainly of making
syscalls -- both will report no output.  The tracing utilities should be
able to better when started with -p pid by determining if the process
is in a syscall (blocked or not) on startup.

Testing processes blocked in sleep(100) shows some bugs in truss(1):
- under ~5.2, truss without -p doesn't report the nanosleep() syscall
   until after 100 seconds, while ktrace without -p (plus kdump to watch)
   reports the syscall as soon as it is made followed by syscall return
   100 seconds later.  I think truss only reports syscall completion,
   so it works less well than ktrace for watching blocked syscalls.
- under ~5.2, both truss and ktrace/kdump with -p report the completion
   of the syscall after 100 seconds.
- under -current, truss with -p is broken.  It now aborts the nanosleep()
   immediately with EINTR.  ktrace with -p still works correctly.

> Tracing utilities produce way too much output...

This is a feature.  Instead of being restricted to the output that has
been encrufted, you can get fairly complete details of non-internal
(i.e., syscall) activity and filter out the parts that you don't want
to see.

Of course, large utilities with lots of internal state that might be
interesting to follow cannot be handled well by either ^T or tracing
utilities.

I hestitate to point out that your patch could be made less encrufted
and more useful by making it toggle the -v flag.  It could be made
more encrufted and more useful by subverting ^T further to cycle through
various combinations of flags, in particular -i for cp and rm.  Toggling
-i would fix the missing interaction of turning off -i in -i mode itself
Full encruftion would add GUI interaction to all the little utilities,
making them perfectly large and un-unixlike.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 09:00:04 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12D3D106564A;
	Thu, 30 Apr 2009 09:00:04 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au
	[211.29.132.189])
	by mx1.freebsd.org (Postfix) with ESMTP id 7DCB28FC12;
	Thu, 30 Apr 2009 09:00:03 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from besplex.bde.org (c122-107-120-227.carlnfd1.nsw.optusnet.com.au
	[122.107.120.227])
	by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n3U8xsII021378
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 30 Apr 2009 18:59:56 +1000
Date: Thu, 30 Apr 2009 18:59:49 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: Bruce Evans 
In-Reply-To: <20090430172939.M1225@besplex.bde.org>
Message-ID: <20090430184028.N1605@besplex.bde.org>
References: <200904300124.n3U1Or1w097927@svn.freebsd.org>
	<20090430162311.T2904@delplex.bde.org>
	<20090430110739.682cc989.stas@FreeBSD.org>
	<20090430.011913.-1023162474.imp@bsdimp.com>
	<20090430172939.M1225@besplex.bde.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: stas@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, "M. Warner Losh" 
Subject: Re: svn commit: r191677 - head/usr.bin/du
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 09:00:04 -0000

On Thu, 30 Apr 2009, Bruce Evans wrote:

> Testing processes blocked in sleep(100) shows some bugs in truss(1):
> ...
> - under -current, truss with -p is broken.  It now aborts the nanosleep()
>  immediately with EINTR.  ktrace with -p still works correctly.

This seems to be because truss now uses ptrace() instead of procfs, and
ptrace() (PT_ATTACH?) generally aborts sleeps so that debuggers can get
control.

Another bug is that gdb -p is now broken on ref8-{amd64,i386}.freebsd.org:

% GNU gdb 6.1.1 [FreeBSD]
% ...
% Attaching to process 19123
% /scratch/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/solib-svr4.c:1443: internal-error: legacy_fetch_link_map_offsets called without legacy link_map support enabled.
% A problem internal to GDB has been detected,
% further debugging may prove unreliable.
% Quit this debugging session? (y or n)
   [y] [kills process 19123?]
% /scratch/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/solib-svr4.c:1443: internal-error: legacy_fetch_link_map_offsets called without legacy link_map support enabled.
% A problem internal to GDB has been detected,
% further debugging may prove unreliable.
% Create a core file of GDB? (y or n)
   [n]

Bruce

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 10:01:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 57B241065670;
	Thu, 30 Apr 2009 10:01:14 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 452108FC1F;
	Thu, 30 Apr 2009 10:01:14 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UA1Eqq008201;
	Thu, 30 Apr 2009 10:01:14 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UA1ESC008200;
	Thu, 30 Apr 2009 10:01:14 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <200904301001.n3UA1ESC008200@svn.freebsd.org>
From: Maxim Konovalov 
Date: Thu, 30 Apr 2009 10:01:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191682 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 10:01:15 -0000

Author: maxim
Date: Thu Apr 30 10:01:13 2009
New Revision: 191682
URL: http://svn.freebsd.org/changeset/base/191682

Log:
  o Correct ng_hole(4) control messages names.
  
  PR:		docs/134100
  Submitted by:	Eugene Mychlo
  MFC after:	1 week

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

Modified: head/share/man/man4/ng_hole.4
==============================================================================
--- head/share/man/man4/ng_hole.4	Thu Apr 30 07:48:49 2009	(r191681)
+++ head/share/man/man4/ng_hole.4	Thu Apr 30 10:01:13 2009	(r191682)
@@ -58,20 +58,20 @@ as long as the name is unique.
 This node type supports the generic control messages, plus the
 following:
 .Bl -tag -width indent
-.It Dv NGM_BPF_GET_STATS
+.It Dv NGM_HOLE_GET_STATS
 This command takes an
 .Tn ASCII
 string argument, the hook name, and returns the statistics
 associated with the hook as a
 .Vt "struct ng_hole_hookstat" .
-.It Dv NGM_BPF_CLR_STATS
+.It Dv NGM_HOLE_CLR_STATS
 This command takes an
 .Tn ASCII
 string argument, the hook name, and clears the statistics
 associated with the hook.
-.It Dv NGM_BPF_GETCLR_STATS
+.It Dv NGM_HOLE_GETCLR_STATS
 This command is identical to
-.Dv NGM_BPF_GET_STATS ,
+.Dv NGM_HOLE_GET_STATS ,
 except that the statistics are also atomically cleared.
 .El
 .Sh SHUTDOWN

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 12:22:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4965F106566C;
	Thu, 30 Apr 2009 12:22:04 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from mail.vega.ru (mail.vega.ru [90.156.167.5])
	by mx1.freebsd.org (Postfix) with ESMTP id 00FC88FC1A;
	Thu, 30 Apr 2009 12:22:03 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from [10.100.124.99] (port=56523 helo=edoofus.dev.vega.ru)
	by mail.vega.ru with esmtpsa (TLSv1:AES256-SHA:256)
	(Exim 4.69 (FreeBSD)) (envelope-from )
	id 1LzVH6-0009pS-Lp; Thu, 30 Apr 2009 16:22:00 +0400
Date: Thu, 30 Apr 2009 16:21:53 +0400
From: Ruslan Ermilov 
To: Maxim Konovalov 
Message-ID: <20090430122153.GA46372@edoofus.dev.vega.ru>
References: <200904300748.n3U7mnje005508@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200904300748.n3U7mnje005508@svn.freebsd.org>
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r191681 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 12:22:04 -0000

On Thu, Apr 30, 2009 at 07:48:49AM +0000, Maxim Konovalov wrote:
> Author: maxim
> Date: Thu Apr 30 07:48:49 2009
> New Revision: 191681
> URL: http://svn.freebsd.org/changeset/base/191681
> 
> Log:
>   o NetBSD 5.0 added.
>   > Description of fields to fill in above:                     76 columns --|
>   > PR:            If a GNATS PR is affected by the change.
>   > Submitted by:  If someone else sent in the change.
>   > Reviewed by:   If someone else reviewed your modification.
>   > Approved by:   If you needed approval for this commit.
>   > Obtained from: If the change is from a third party.
>   > MFC after:     N [day[s]|week[s]|month[s]].  Request a reminder email.
>   > Security:      Vulnerability reference (one per line) or description.
>   > Empty fields above will be automatically removed.
>   
>   M    bsd-family-tree
> 
Picking up a random example...

How about enabling the ability to edit svn:log revision property, to
allow to fix commit logs?

: svn: Revprop change blocked by pre-revprop-change hook (exit code 1) with output:
: Changing revision properties is prohibited


Cheers,
-- 
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 13:30:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8B583106564A;
	Thu, 30 Apr 2009 13:30:27 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 602668FC14;
	Thu, 30 Apr 2009 13:30:27 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UDURqj013386;
	Thu, 30 Apr 2009 13:30:27 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UDUR9t013385;
	Thu, 30 Apr 2009 13:30:27 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200904301330.n3UDUR9t013385@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Thu, 30 Apr 2009 13:30:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191687 - head/usr.bin/ncal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 13:30:28 -0000

Author: ru
Date: Thu Apr 30 13:30:27 2009
New Revision: 191687
URL: http://svn.freebsd.org/changeset/base/191687

Log:
  Fixed missing dependency.

Modified:
  head/usr.bin/ncal/Makefile

Modified: head/usr.bin/ncal/Makefile
==============================================================================
--- head/usr.bin/ncal/Makefile	Thu Apr 30 12:18:46 2009	(r191686)
+++ head/usr.bin/ncal/Makefile	Thu Apr 30 13:30:27 2009	(r191687)
@@ -2,7 +2,7 @@
 
 PROG=	ncal
 
-DPADD=	${LIBCALENDAR}
+DPADD=	${LIBCALENDAR} ${LIBTERMCAP}
 LDADD=	-lcalendar -ltermcap
 WARNS?=	1
 

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 13:36:28 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 624681065672;
	Thu, 30 Apr 2009 13:36:28 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4D64B8FC17;
	Thu, 30 Apr 2009 13:36:28 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UDaSgR013594;
	Thu, 30 Apr 2009 13:36:28 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UDaQYW013558;
	Thu, 30 Apr 2009 13:36:26 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200904301336.n3UDaQYW013558@svn.freebsd.org>
From: Marko Zec 
Date: Thu, 30 Apr 2009 13:36:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191688 - in head: . sys/kern sys/net sys/netinet
	sys/netinet6 sys/netipsec sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 13:36:29 -0000

Author: zec
Date: Thu Apr 30 13:36:26 2009
New Revision: 191688
URL: http://svn.freebsd.org/changeset/base/191688

Log:
  Permit buiding kernels with options VIMAGE, restricted to only a single
  active network stack instance.  Turning on options VIMAGE at compile
  time yields the following changes relative to default kernel build:
  
  1) V_ accessor macros for virtualized variables resolve to structure
  fields via base pointers, instead of being resolved as fields in global
  structs or plain global variables.  As an example, V_ifnet becomes:
  
      options VIMAGE:          ((struct vnet_net *) vnet_net)->_ifnet
      default build:           vnet_net_0._ifnet
      options VIMAGE_GLOBALS:  ifnet
  
  2) INIT_VNET_* macros will declare and set up base pointers to be used
  by V_ accessor macros, instead of resolving to whitespace:
  
      INIT_VNET_NET(ifp->if_vnet); becomes
  
      struct vnet_net *vnet_net = (ifp->if_vnet)->mod_data[VNET_MOD_NET];
  
  3) Memory for vnet modules registered via vnet_mod_register() is now
  allocated at run time in sys/kern/kern_vimage.c, instead of per vnet
  module structs being declared as globals.  If required, vnet modules
  can now request the framework to provide them with allocated bzeroed
  memory by filling in the vmi_size field in their vmi_modinfo structures.
  
  4) structs socket, ifnet, inpcbinfo, tcpcb and syncache_head are
  extended to hold a pointer to the parent vnet.  options VIMAGE builds
  will fill in those fields as required.
  
  5) curvnet is introduced as a new global variable in options VIMAGE
  builds, always pointing to the default and only struct vnet.
  
  6) struct sysctl_oid has been extended with additional two fields to
  store major and minor virtualization module identifiers, oid_v_subs and
  oid_v_mod.  SYSCTL_V_* family of macros will fill in those fields
  accordingly, and store the offset in the appropriate vnet container
  struct in oid_arg1.
  In sysctl handlers dealing with virtualized sysctls, the
  SYSCTL_RESOLVE_V_ARG1() macro will compute the address of the target
  variable and make it available in arg1 variable for further processing.
  
  Unused fields in structs vnet_inet, vnet_inet6 and vnet_ipfw have
  been deleted.
  
  Reviewed by:	bz, rwatson
  Approved by:	julian (mentor)

Modified:
  head/UPDATING
  head/sys/kern/kern_mib.c
  head/sys/kern/kern_sysctl.c
  head/sys/kern/kern_vimage.c
  head/sys/kern/uipc_socket.c
  head/sys/net/if.c
  head/sys/net/if_gif.c
  head/sys/net/if_mib.c
  head/sys/net/if_var.h
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/ip_divert.c
  head/sys/netinet/ip_fw.h
  head/sys/netinet/ip_fw_pfil.c
  head/sys/netinet/ip_input.c
  head/sys/netinet/raw_ip.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_syncache.h
  head/sys/netinet/tcp_var.h
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet/vinet.h
  head/sys/netinet6/in6_ifattach.c
  head/sys/netinet6/in6_mcast.c
  head/sys/netinet6/in6_proto.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/mld6.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/raw_ip6.c
  head/sys/netinet6/vinet6.h
  head/sys/netipsec/ipsec.c
  head/sys/sys/param.h
  head/sys/sys/socketvar.h
  head/sys/sys/sysctl.h
  head/sys/sys/vimage.h

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/UPDATING	Thu Apr 30 13:36:26 2009	(r191688)
@@ -22,6 +22,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20090430:
+	The layout of the following structs has changed: sysctl_oid,
+	socket, ifnet, inpcbinfo, tcpcb, syncache_head, vnet_inet,
+	vnet_inet6 and vnet_ipfw.  Most modules need to be rebuild or
+	panics may be experienced.  World rebuild is required for
+	correctly checking networking state from userland.
+	Bump __FreeBSD_version to 800085.
+
 20090429:
 	MLDv2 and Source-Specific Multicast (SSM) have been merged
 	to the IPv6 stack. VIMAGE hooks are in but not yet used.

Modified: head/sys/kern/kern_mib.c
==============================================================================
--- head/sys/kern/kern_mib.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/kern/kern_mib.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -208,9 +208,8 @@ static char	machine_arch[] = MACHINE_ARC
 SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
     machine_arch, 0, "System architecture");
 
-#ifndef VIMAGE
+/* should become #ifndef VIMAGE */
 char hostname[MAXHOSTNAMELEN];
-#endif
 
 /*
  * This mutex is used to protect the hostname and domainname variables, and
@@ -349,9 +348,8 @@ SYSCTL_PROC(_kern, OID_AUTO, conftxt, CT
     0, 0, sysctl_kern_config, "", "Kernel configuration file");
 #endif
 
-#ifndef VIMAGE
+/* should become #ifndef VIMAGE */
 char domainname[MAXHOSTNAMELEN];	/* Protected by hostname_mtx. */
-#endif
 
 static int
 sysctl_domainname(SYSCTL_HANDLER_ARGS)

Modified: head/sys/kern/kern_sysctl.c
==============================================================================
--- head/sys/kern/kern_sysctl.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/kern/kern_sysctl.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -934,6 +934,30 @@ sysctl_handle_int(SYSCTL_HANDLER_ARGS)
 	return (error);
 }
 
+#ifdef VIMAGE
+int
+sysctl_handle_v_int(SYSCTL_HANDLER_ARGS)
+{
+	int tmpout, error = 0;
+ 
+	SYSCTL_RESOLVE_V_ARG1();
+ 
+	/*
+	 * Attempt to get a coherent snapshot by making a copy of the data.
+	 */
+	tmpout = *(int *)arg1;
+	error = SYSCTL_OUT(req, &tmpout, sizeof(int));
+
+	if (error || !req->newptr)
+		return (error);
+
+	if (!arg1)
+		error = EPERM;
+	else
+		error = SYSCTL_IN(req, arg1, sizeof(int));
+	return (error);
+}
+#endif
 
 /*
  * Based on on sysctl_handle_int() convert milliseconds into ticks.
@@ -944,7 +968,9 @@ sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS
 {
 	int error, s, tt;
 
-	tt = *(int *)oidp->oid_arg1;
+	SYSCTL_RESOLVE_V_ARG1();
+
+	tt = *(int *)arg1;
 	s = (int)((int64_t)tt * 1000 / hz);
 
 	error = sysctl_handle_int(oidp, &s, 0, req);
@@ -955,7 +981,7 @@ sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS
 	if (tt < 1)
 		return (EINVAL);
 
-	*(int *)oidp->oid_arg1 = tt;
+	*(int *)arg1 = tt;
 	return (0);
 }
 
@@ -1069,6 +1095,47 @@ retry:
 	return (error);
 }
 
+#ifdef VIMAGE
+int
+sysctl_handle_v_string(SYSCTL_HANDLER_ARGS)
+{
+	int error=0;
+	char *tmparg;
+	size_t outlen;
+
+	SYSCTL_RESOLVE_V_ARG1();
+
+	/*
+	 * Attempt to get a coherent snapshot by copying to a
+	 * temporary kernel buffer.
+	 */
+retry:
+	outlen = strlen((char *)arg1)+1;
+	tmparg = malloc(outlen, M_SYSCTLTMP, M_WAITOK);
+
+	if (strlcpy(tmparg, (char *)arg1, outlen) >= outlen) {
+		free(tmparg, M_SYSCTLTMP);
+		goto retry;
+	}
+
+	error = SYSCTL_OUT(req, tmparg, outlen);
+	free(tmparg, M_SYSCTLTMP);
+
+	if (error || !req->newptr)
+		return (error);
+
+	if ((req->newlen - req->newidx) >= arg2) {
+		error = EINVAL;
+	} else {
+		arg2 = (req->newlen - req->newidx);
+		error = SYSCTL_IN(req, arg1, arg2);
+		((char *)arg1)[arg2] = '\0';
+	}
+
+	return (error);
+}
+#endif
+
 /*
  * Handle any kind of opaque data.
  * arg1 points to it, arg2 is the size.
@@ -1106,6 +1173,35 @@ retry:
 	return (error);
 }
 
+#ifdef VIMAGE
+int
+sysctl_handle_v_opaque(SYSCTL_HANDLER_ARGS)
+{
+	int error, tries;
+	u_int generation;
+	struct sysctl_req req2;
+
+	SYSCTL_RESOLVE_V_ARG1();
+
+	tries = 0;
+	req2 = *req;
+retry:
+	generation = curthread->td_generation;
+	error = SYSCTL_OUT(req, arg1, arg2);
+	if (error)
+		return (error);
+	tries++;
+	if (generation != curthread->td_generation && tries < 3) {
+		*req = req2;
+		goto retry;
+	}
+
+	error = SYSCTL_IN(req, arg1, arg2);
+
+	return (error);
+}
+#endif
+
 /*
  * Transfer functions to/from kernel space.
  * XXX: rather untested at this point

Modified: head/sys/kern/kern_vimage.c
==============================================================================
--- head/sys/kern/kern_vimage.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/kern/kern_vimage.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #ifndef VIMAGE_GLOBALS
 
 MALLOC_DEFINE(M_VIMAGE, "vimage", "vimage resource container");
+MALLOC_DEFINE(M_VNET, "vnet", "network stack control block");
 
 static TAILQ_HEAD(vnet_modlink_head, vnet_modlink) vnet_modlink_head;
 static TAILQ_HEAD(vnet_modpending_head, vnet_modlink) vnet_modpending_head;
@@ -49,6 +50,12 @@ static void vnet_mod_complete_registrati
 static int vnet_mod_constructor(struct vnet_modlink *);
 static int vnet_mod_destructor(struct vnet_modlink *);
 
+#ifdef VIMAGE
+/* curvnet should be thread-local - this is only a temporary step. */
+struct vnet *curvnet;
+struct vnet_list_head vnet_head;
+#endif
+
 void
 vnet_mod_register(const struct vnet_modinfo *vmi)
 {
@@ -263,7 +270,14 @@ vi_symlookup(struct kld_sym_lookup *look
 		for (mapentry = vml->vml_modinfo->vmi_symmap;
 		    mapentry->name != NULL; mapentry++) {
 			if (strcmp(symstr, mapentry->name) == 0) {
-				lookup->symvalue = (u_long) mapentry->base;
+#ifdef VIMAGE
+				lookup->symvalue =
+				    (u_long) curvnet->mod_data[
+				    vml->vml_modinfo->vmi_id];
+				lookup->symvalue += mapentry->offset;
+#else
+				lookup->symvalue = (u_long) mapentry->offset;
+#endif
 				lookup->symsize = mapentry->size;
 				return (0);
 			}
@@ -275,9 +289,23 @@ vi_symlookup(struct kld_sym_lookup *look
 static void
 vi_init(void *unused)
 {
+#ifdef VIMAGE
+	struct vnet *vnet;
+#endif
 
 	TAILQ_INIT(&vnet_modlink_head);
 	TAILQ_INIT(&vnet_modpending_head);
+
+#ifdef VIMAGE
+	LIST_INIT(&vnet_head);
+
+	vnet = malloc(sizeof(struct vnet), M_VNET, M_NOWAIT | M_ZERO);
+	if (vnet == NULL)
+		panic("vi_alloc: malloc failed");
+	LIST_INSERT_HEAD(&vnet_head, vnet, vnet_le);
+
+	curvnet = LIST_FIRST(&vnet_head);
+#endif
 }
 
 static void

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/kern/uipc_socket.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -130,6 +130,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -284,6 +285,9 @@ soalloc(void)
 	mtx_lock(&so_global_mtx);
 	so->so_gencnt = ++so_gencnt;
 	++numopensockets;
+#ifdef VIMAGE
+	so->so_vnet = curvnet;
+#endif
 	mtx_unlock(&so_global_mtx);
 	return (so);
 }

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/net/if.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -186,6 +186,7 @@ static struct vnet_symmap vnet_net_symma
 static const vnet_modinfo_t vnet_net_modinfo = {
 	.vmi_id		= VNET_MOD_NET,
 	.vmi_name	= "net",
+	.vmi_size	= sizeof(struct vnet_net),
 	.vmi_symmap	= vnet_net_symmap,
 	.vmi_iattach	= vnet_net_iattach
 };
@@ -545,6 +546,7 @@ if_alloc(u_char type)
 static void
 if_free_internal(struct ifnet *ifp)
 {
+	INIT_VNET_NET(ifp->if_vnet);
 
 	KASSERT((ifp->if_flags & IFF_DYING),
 	    ("if_free_internal: interface not dying"));
@@ -582,7 +584,6 @@ if_free_internal(struct ifnet *ifp)
 void
 if_free_type(struct ifnet *ifp, u_char type)
 {
-	INIT_VNET_NET(curvnet); /* ifp->if_vnet can be NULL here ! */
 
 	KASSERT(ifp->if_alloctype == type,
 	    ("if_free_type: type (%d) != alloctype (%d)", type,
@@ -673,6 +674,10 @@ if_attach(struct ifnet *ifp)
 		panic ("%s: BUG: if_attach called without if_alloc'd input()\n",
 		    ifp->if_xname);
 
+#ifdef VIMAGE
+	ifp->if_vnet = curvnet;
+#endif
+
 	if_addgroup(ifp, IFG_ALL);
 
 	getmicrotime(&ifp->if_lastchange);
@@ -978,6 +983,9 @@ if_detach(struct ifnet *ifp)
 	}
 	IF_AFDATA_UNLOCK(ifp);
 	ifq_detach(&ifp->if_snd);
+#ifdef VIMAGE
+	ifp->if_vnet = NULL;
+#endif
 	splx(s);
 }
 

Modified: head/sys/net/if_gif.c
==============================================================================
--- head/sys/net/if_gif.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/net/if_gif.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -127,6 +127,7 @@ static int	vnet_gif_iattach(const void *
 static const vnet_modinfo_t vnet_gif_modinfo = {
 	.vmi_id		= VNET_MOD_GIF,
 	.vmi_name	= "gif",
+	.vmi_size	= sizeof(struct vnet_gif),
 	.vmi_dependson	= VNET_MOD_NET,
 	.vmi_iattach	= vnet_gif_iattach
 };
@@ -303,8 +304,10 @@ gifmodevent(mod, type, data)
 		if_clone_detach(&gif_cloner);
 		mtx_destroy(&gif_mtx);
 #ifdef INET6
+#ifndef VIMAGE
 		V_ip6_gif_hlim = 0;	/* XXX -> vnet_gif_idetach() */
 #endif
+#endif
 		break;
 	default:
 		return EOPNOTSUPP;

Modified: head/sys/net/if_mib.c
==============================================================================
--- head/sys/net/if_mib.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/net/if_mib.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -77,7 +77,6 @@ SYSCTL_V_INT(V_NET, vnet_net, _net_link_
 static int
 sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */
 {
-	INIT_VNET_NET(curvnet);
 	int *name = (int *)arg1;
 	int error;
 	u_int namelen = arg2;

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/net/if_var.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -117,6 +117,7 @@ struct	ifqueue {
 struct ifnet {
 	void	*if_softc;		/* pointer to driver state */
 	void	*if_l2com;		/* pointer to protocol bits */
+	struct vnet *if_vnet;		/* pointer to network stack instance */
 	TAILQ_ENTRY(ifnet) if_link; 	/* all struct ifnets are chained */
 	char	if_xname[IFNAMSIZ];	/* external name (name + unit) */
 	const char *if_dname;		/* driver name */

Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/in_pcb.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -126,7 +126,9 @@ sysctl_net_ipport_check(SYSCTL_HANDLER_A
 	INIT_VNET_INET(curvnet);
 	int error;
 
-	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
+	SYSCTL_RESOLVE_V_ARG1();
+
+	error = sysctl_handle_int(oidp, arg1, arg2, req);
 	if (error == 0) {
 		RANGECHK(V_ipport_lowfirstauto, 1, IPPORT_RESERVED - 1);
 		RANGECHK(V_ipport_lowlastauto, 1, IPPORT_RESERVED - 1);

Modified: head/sys/netinet/in_pcb.h
==============================================================================
--- head/sys/netinet/in_pcb.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/in_pcb.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -224,6 +224,8 @@ struct inpcb {
 #define	in6p_icmp6filt	inp_depend6.inp6_icmp6filt
 #define	in6p_cksum	inp_depend6.inp6_cksum
 
+#define	inp_vnet	inp_pcbinfo->ipi_vnet
+
 /*
  * The range of the generation count, as used in this implementation, is 9e19.
  * We would have to create 300 billion connections per second for this number
@@ -301,8 +303,12 @@ struct inpcbinfo {
 	struct rwlock		 ipi_lock;
 
 	/*
-	 * vimage 1
-	 * general use 1
+	 * Pointer to network stack instance
+	 */
+	struct vnet		*ipi_vnet;
+
+	/*
+	 * general use 2
 	 */
 	void 			*ipi_pspare[2];
 };

Modified: head/sys/netinet/ip_divert.c
==============================================================================
--- head/sys/netinet/ip_divert.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/ip_divert.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -162,6 +162,9 @@ div_init(void)
 	INP_INFO_LOCK_INIT(&V_divcbinfo, "div");
 	LIST_INIT(&V_divcb);
 	V_divcbinfo.ipi_listhead = &V_divcb;
+#ifdef VIMAGE
+	V_divcbinfo.ipi_vnet = curvnet;
+#endif
 	/*
 	 * XXX We don't use the hash list for divert IP, but it's easier
 	 * to allocate a one entry hash list than it is to check all

Modified: head/sys/netinet/ip_fw.h
==============================================================================
--- head/sys/netinet/ip_fw.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/ip_fw.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -695,7 +695,6 @@ struct vnet_ipfw {
 	int	_fw_deny_unknown_exthdrs;
 	int	_fw_verbose;
 	int	_verbose_limit;
-	int	_fw_debug;		/* actually unused */
 	int	_autoinc_step;
 	ipfw_dyn_rule **_ipfw_dyn_v;
 	uma_zone_t _ipfw_dyn_rule_zone;
@@ -740,7 +739,6 @@ extern struct vnet_ipfw vnet_ipfw_0;
 #define	V_fw_deny_unknown_exthdrs VNET_IPFW(fw_deny_unknown_exthdrs)
 #define	V_fw_verbose		VNET_IPFW(fw_verbose)
 #define	V_verbose_limit		VNET_IPFW(verbose_limit)
-#define	V_fw_debug		VNET_IPFW(fw_debug)
 #define	V_autoinc_step		VNET_IPFW(autoinc_step)
 #define	V_ipfw_dyn_v		VNET_IPFW(ipfw_dyn_v)
 #define	V_ipfw_dyn_rule_zone	VNET_IPFW(ipfw_dyn_rule_zone)

Modified: head/sys/netinet/ip_fw_pfil.c
==============================================================================
--- head/sys/netinet/ip_fw_pfil.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/ip_fw_pfil.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -95,6 +95,7 @@ int
 ipfw_check_in(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir,
     struct inpcb *inp)
 {
+	INIT_VNET_INET(curvnet);
 	struct ip_fw_args args;
 	struct ng_ipfw_tag *ng_tag;
 	struct m_tag *dn_tag;
@@ -224,6 +225,7 @@ int
 ipfw_check_out(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir,
     struct inpcb *inp)
 {
+	INIT_VNET_INET(curvnet);
 	struct ip_fw_args args;
 	struct ng_ipfw_tag *ng_tag;
 	struct m_tag *dn_tag;

Modified: head/sys/netinet/ip_input.c
==============================================================================
--- head/sys/netinet/ip_input.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/ip_input.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -237,6 +237,7 @@ static void vnet_inet_register(void);
 static const vnet_modinfo_t vnet_inet_modinfo = {
 	.vmi_id		= VNET_MOD_INET,
 	.vmi_name	= "inet",
+	.vmi_size	= sizeof(struct vnet_inet)
 };
  
 static void vnet_inet_register()

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/raw_ip.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -187,6 +187,9 @@ rip_init(void)
 
 	INP_INFO_LOCK_INIT(&V_ripcbinfo, "rip");
 	LIST_INIT(&V_ripcb);
+#ifdef VIMAGE
+	V_ripcbinfo.ipi_vnet = curvnet;
+#endif
 	V_ripcbinfo.ipi_listhead = &V_ripcb;
 	V_ripcbinfo.ipi_hashbase =
 	    hashinit(INP_PCBHASH_RAW_SIZE, M_PCB, &V_ripcbinfo.ipi_hashmask);

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/tcp_subr.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -359,6 +359,9 @@ tcp_init(void)
 
 	INP_INFO_LOCK_INIT(&V_tcbinfo, "tcp");
 	LIST_INIT(&V_tcb);
+#ifdef VIMAGE
+	V_tcbinfo.ipi_vnet = curvnet;
+#endif
 	V_tcbinfo.ipi_listhead = &V_tcb;
 	hashsize = TCBHASHSIZE;
 	TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize);
@@ -703,6 +706,9 @@ tcp_newtcpcb(struct inpcb *inp)
 	if (tm == NULL)
 		return (NULL);
 	tp = &tm->tcb;
+#ifdef VIMAGE
+	tp->t_vnet = inp->inp_vnet;
+#endif
 	tp->t_timers = &tm->tt;
 	/*	LIST_INIT(&tp->t_segq); */	/* XXX covered by M_ZERO */
 	tp->t_maxseg = tp->t_maxopd =

Modified: head/sys/netinet/tcp_syncache.c
==============================================================================
--- head/sys/netinet/tcp_syncache.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/tcp_syncache.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -259,6 +259,9 @@ syncache_init(void)
 
 	/* Initialize the hash buckets. */
 	for (i = 0; i < V_tcp_syncache.hashsize; i++) {
+#ifdef VIMAGE
+		V_tcp_syncache.hashbase[i].sch_vnet = curvnet;
+#endif
 		TAILQ_INIT(&V_tcp_syncache.hashbase[i].sch_bucket);
 		mtx_init(&V_tcp_syncache.hashbase[i].sch_mtx, "tcp_sc_head",
 			 NULL, MTX_DEF);

Modified: head/sys/netinet/tcp_syncache.h
==============================================================================
--- head/sys/netinet/tcp_syncache.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/tcp_syncache.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -96,6 +96,7 @@ struct syncache {
 #define	SYNCOOKIE_LIFETIME	16	/* seconds */
 
 struct syncache_head {
+	struct vnet	*sch_vnet;
 	struct mtx	sch_mtx;
 	TAILQ_HEAD(sch_head, syncache)	sch_bucket;
 	struct callout	sch_timer;

Modified: head/sys/netinet/tcp_var.h
==============================================================================
--- head/sys/netinet/tcp_var.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/tcp_var.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -35,6 +35,8 @@
 
 #include 
 
+struct vnet;
+
 /*
  * Kernel variables for tcp.
  */
@@ -106,6 +108,8 @@ struct tcpcb {
 	int	t_state;		/* state of this connection */
 	u_int	t_flags;
 
+	struct	vnet *t_vnet;		/* back pointer to parent vnet */
+
 	tcp_seq	snd_una;		/* send unacknowledged */
 	tcp_seq	snd_max;		/* highest sequence number sent;
 					 * used to recognize retransmits
@@ -186,8 +190,8 @@ struct tcpcb {
 	int	t_rttlow;		/* smallest observerved RTT */
 	u_int32_t	rfbuf_ts;	/* recv buffer autoscaling timestamp */
 	int	rfbuf_cnt;		/* recv buffer autoscaling byte count */
-	void	*t_pspare[3];		/* toe usrreqs / toepcb * / congestion algo / vimage / 1 general use */
-	struct toe_usrreqs *t_tu;       /* offload operations vector */
+	void	*t_pspare[3];		/* toe usrreqs / toepcb * / congestion algo / 1 general use */
+	struct toe_usrreqs *t_tu;	/* offload operations vector */
 	void	*t_toe;			/* TOE pcb pointer */
 	int	t_bytes_acked;		/* # bytes acked during current RTT */
 };

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/udp_usrreq.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -179,6 +179,9 @@ udp_init(void)
 
 	INP_INFO_LOCK_INIT(&V_udbinfo, "udp");
 	LIST_INIT(&V_udb);
+#ifdef VIMAGE
+	V_udbinfo.ipi_vnet = curvnet;
+#endif
 	V_udbinfo.ipi_listhead = &V_udb;
 	V_udbinfo.ipi_hashbase = hashinit(UDBHASHSIZE, M_PCB,
 	    &V_udbinfo.ipi_hashmask);

Modified: head/sys/netinet/vinet.h
==============================================================================
--- head/sys/netinet/vinet.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet/vinet.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -54,7 +54,6 @@ struct vnet_inet {
 	struct	in_ifaddrhashhead *_in_ifaddrhashtbl;
 	struct	in_ifaddrhead _in_ifaddrhead;
 	u_long	_in_ifaddrhmask;
-	struct	in_multihead _in_multihead;	/* XXX unused */
 
 	int	_arpt_keep;
 	int	_arp_maxtries;
@@ -269,7 +268,6 @@ extern struct vnet_inet vnet_inet_0;
 #define	V_in_ifaddrhashtbl	VNET_INET(in_ifaddrhashtbl)
 #define	V_in_ifaddrhead		VNET_INET(in_ifaddrhead)
 #define	V_in_ifaddrhmask	VNET_INET(in_ifaddrhmask)
-#define	V_in_multihead		VNET_INET(in_multihead)
 #define	V_ip_checkinterface	VNET_INET(ip_checkinterface)
 #define	V_ip_defttl		VNET_INET(ip_defttl)
 #define	V_ip_do_randomid	VNET_INET(ip_do_randomid)

Modified: head/sys/netinet6/in6_ifattach.c
==============================================================================
--- head/sys/netinet6/in6_ifattach.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet6/in6_ifattach.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -888,8 +888,9 @@ in6_get_tmpifid(struct ifnet *ifp, u_int
 }
 
 void
-in6_tmpaddrtimer(void *ignored_arg)
+in6_tmpaddrtimer(void *arg)
 {
+	CURVNET_SET((struct vnet *) arg);
 	INIT_VNET_NET(curvnet);
 	INIT_VNET_INET6(curvnet);
 	struct nd_ifinfo *ndi;
@@ -898,7 +899,7 @@ in6_tmpaddrtimer(void *ignored_arg)
 
 	callout_reset(&V_in6_tmpaddrtimer_ch,
 	    (V_ip6_temp_preferred_lifetime - V_ip6_desync_factor -
-	    V_ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, NULL);
+	    V_ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, curvnet);
 
 	bzero(nullbuf, sizeof(nullbuf));
 	for (ifp = TAILQ_FIRST(&V_ifnet); ifp;
@@ -914,12 +915,12 @@ in6_tmpaddrtimer(void *ignored_arg)
 		}
 	}
 
+	CURVNET_RESTORE();
 }
 
 static void
 in6_purgemaddrs(struct ifnet *ifp)
 {
-	INIT_VNET_INET6(ifp->if_vnet);
 	LIST_HEAD(,in6_multi)	 purgeinms;
 	struct in6_multi	*inm, *tinm;
 	struct ifmultiaddr	*ifma;

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet6/in6_mcast.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -1302,7 +1302,6 @@ static int
 in6p_block_unblock_source(struct inpcb *inp, struct sockopt *sopt)
 {
 	INIT_VNET_NET(curvnet);
-	INIT_VNET_INET6(curvnet);
 	struct group_source_req		 gsr;
 	sockunion_t			*gsa, *ssa;
 	struct ifnet			*ifp;
@@ -1463,6 +1462,7 @@ out_in6p_locked:
 static struct ip6_moptions *
 in6p_findmoptions(struct inpcb *inp)
 {
+	INIT_VNET_INET6(curvnet);
 	struct ip6_moptions	 *imo;
 	struct in6_multi		**immp;
 	struct in6_mfilter	 *imfp;
@@ -1745,7 +1745,6 @@ static struct ifnet *
 in6p_lookup_mcast_ifp(const struct inpcb *in6p __unused,
     const struct sockaddr_in6 *gsin6)
 {
-	INIT_VNET_INET6(curvnet);
 	struct route_in6	 ro6;
 	struct ifnet		*ifp;
 
@@ -2032,7 +2031,6 @@ static int
 in6p_leave_group(struct inpcb *inp, struct sockopt *sopt)
 {
 	INIT_VNET_NET(curvnet);
-	INIT_VNET_INET(curvnet);
 	struct group_source_req		 gsr;
 	sockunion_t			*gsa, *ssa;
 	struct ifnet			*ifp;
@@ -2249,7 +2247,6 @@ static int
 in6p_set_multicast_if(struct inpcb *inp, struct sockopt *sopt)
 {
 	INIT_VNET_NET(curvnet);
-	INIT_VNET_INET6(curvnet);
 	struct ifnet		*ifp;
 	struct ip6_moptions	*imo;
 	u_int			 ifindex;
@@ -2454,6 +2451,7 @@ out_in6p_locked:
 int
 ip6_setmoptions(struct inpcb *inp, struct sockopt *sopt)
 {
+	INIT_VNET_INET6(curvnet);
 	struct ip6_moptions	*im6o;
 	int			 error;
 

Modified: head/sys/netinet6/in6_proto.c
==============================================================================
--- head/sys/netinet6/in6_proto.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet6/in6_proto.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -447,6 +447,8 @@ sysctl_ip6_temppltime(SYSCTL_HANDLER_ARG
 	int error = 0;
 	int old;
 
+	SYSCTL_RESOLVE_V_ARG1();
+
 	error = SYSCTL_OUT(req, arg1, sizeof(int));
 	if (error || !req->newptr)
 		return (error);
@@ -467,6 +469,8 @@ sysctl_ip6_tempvltime(SYSCTL_HANDLER_ARG
 	int error = 0;
 	int old;
 
+	SYSCTL_RESOLVE_V_ARG1();
+
 	error = SYSCTL_OUT(req, arg1, sizeof(int));
 	if (error || !req->newptr)
 		return (error);

Modified: head/sys/netinet6/ip6_input.c
==============================================================================
--- head/sys/netinet6/ip6_input.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet6/ip6_input.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -161,6 +161,7 @@ static void vnet_inet6_register(void);
 static const vnet_modinfo_t vnet_inet6_modinfo = {
 	.vmi_id		= VNET_MOD_INET6,
 	.vmi_name	= "inet6",
+	.vmi_size	= sizeof(struct vnet_inet6),
 	.vmi_dependson	= VNET_MOD_INET	/* XXX revisit - TCP/UDP needs this? */
 };
  
@@ -307,14 +308,14 @@ ip6_init2_vnet(const void *unused __unus
 
 	/* nd6_timer_init */
 	callout_init(&V_nd6_timer_ch, 0);
-	callout_reset(&V_nd6_timer_ch, hz, nd6_timer, NULL);
+	callout_reset(&V_nd6_timer_ch, hz, nd6_timer, curvnet);
 
 	/* timer for regeneranation of temporary addresses randomize ID */
 	callout_init(&V_in6_tmpaddrtimer_ch, 0);
 	callout_reset(&V_in6_tmpaddrtimer_ch,
 		      (V_ip6_temp_preferred_lifetime - V_ip6_desync_factor -
 		       V_ip6_temp_regen_advance) * hz,
-		      in6_tmpaddrtimer, NULL);
+		      in6_tmpaddrtimer, curvnet);
 
 	return (0);
 }

Modified: head/sys/netinet6/mld6.c
==============================================================================
--- head/sys/netinet6/mld6.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet6/mld6.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -435,7 +435,6 @@ mld_dispatch_queue(struct ifqueue *ifq, 
 static __inline int
 mld_is_addr_reported(const struct in6_addr *addr)
 {
-	INIT_VNET_INET6(curvnet);
 
 	KASSERT(IN6_IS_ADDR_MULTICAST(addr), ("%s: not multicast", __func__));
 
@@ -639,7 +638,6 @@ static int
 mld_v1_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6,
     const struct mld_hdr *mld)
 {
-	INIT_VNET_INET6(ifp->if_vnet);
 	struct ifmultiaddr	*ifma;
 	struct mld_ifinfo	*mli;
 	struct in6_multi	*inm;
@@ -1034,7 +1032,6 @@ static int
 mld_v1_input_report(struct ifnet *ifp, const struct ip6_hdr *ip6,
     const struct mld_hdr *mld)
 {
-	INIT_VNET_INET6(curvnet);
 	struct in6_ifaddr	*ia;
 	struct in6_multi	*inm;
 #ifdef KTR
@@ -1646,7 +1643,6 @@ mld_slowtimo_vnet(void)
 static void
 mld_v1_process_querier_timers(struct mld_ifinfo *mli)
 {
-	INIT_VNET_INET6(curvnet);
 
 	MLD_LOCK_ASSERT();
 
@@ -3009,7 +3005,6 @@ out:
 static struct mbuf *
 mld_v2_encap_report(struct ifnet *ifp, struct mbuf *m)
 {
-	INIT_VNET_INET6(curvnet);
 	struct mbuf		*mh;
 	struct mldv2_report	*mld;
 	struct ip6_hdr		*ip6;

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet6/nd6.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -191,7 +191,7 @@ nd6_init(void)
 	/* start timer */
 	callout_init(&V_nd6_slowtimo_ch, 0);
 	callout_reset(&V_nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz,
-	    nd6_slowtimo, NULL);
+	    nd6_slowtimo, curvnet);
 
 	nd6_init_done = 1;
 
@@ -593,7 +593,7 @@ void
 nd6_timer(void *arg)
 {
 	CURVNET_SET_QUIET((struct vnet *) arg);
-	INIT_VNET_INET6((struct vnet *) arg);
+	INIT_VNET_INET6(curvnet);
 	int s;
 	struct nd_defrouter *dr;
 	struct nd_prefix *pr;
@@ -601,7 +601,7 @@ nd6_timer(void *arg)
 	struct in6_addrlifetime *lt6;
 
 	callout_reset(&V_nd6_timer_ch, V_nd6_prune * hz,
-	    nd6_timer, NULL);
+	    nd6_timer, curvnet);
 
 	/* expire default router list */
 	s = splnet();
@@ -872,7 +872,6 @@ nd6_purge(struct ifnet *ifp)
 struct llentry *
 nd6_lookup(struct in6_addr *addr6, int flags, struct ifnet *ifp)
 {
-	INIT_VNET_INET6(curvnet);
 	struct sockaddr_in6 sin6;
 	struct llentry *ln;
 	int llflags = 0;
@@ -1669,7 +1668,7 @@ nd6_slowtimo(void *arg)
 	struct ifnet *ifp;
 
 	callout_reset(&V_nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz,
-	    nd6_slowtimo, NULL);
+	    nd6_slowtimo, curvnet);
 	IFNET_RLOCK();
 	for (ifp = TAILQ_FIRST(&V_ifnet); ifp;
 	    ifp = TAILQ_NEXT(ifp, if_list)) {

Modified: head/sys/netinet6/raw_ip6.c
==============================================================================
--- head/sys/netinet6/raw_ip6.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet6/raw_ip6.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -651,6 +651,7 @@ rip6_attach(struct socket *so, int proto
 static void
 rip6_detach(struct socket *so)
 {
+	INIT_VNET_INET(so->so_vnet);
 	INIT_VNET_INET6(so->so_vnet);
 	struct inpcb *inp;
 

Modified: head/sys/netinet6/vinet6.h
==============================================================================
--- head/sys/netinet6/vinet6.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netinet6/vinet6.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -54,8 +54,6 @@ struct vnet_inet6 {
 	u_int				_frag6_nfrags;
 	struct ip6q			_ip6q;
 
-	struct route_in6 		_ip6_forward_rt;	/* XXX remove */
-
 	struct in6_addrpolicy 		_defaultaddrpolicy;
 	TAILQ_HEAD(, addrsel_policyent) _addrsel_policytab;
 	u_int				_in6_maxmtu;
@@ -122,10 +120,6 @@ struct vnet_inet6 {
 	int				_udp6_recvspace;
 	int				_ip6qmaxlen;
 	int				_ip6_prefer_tempaddr;
-	int				_ip6_forward_srcrt;	/* XXX remove */
-	int				_ip6_sourcecheck;	/* XXX remove */
-	int				_ip6_sourcecheck_interval; /* XXX remove */
-	int				_ip6_ours_check_algorithm; /* XXX remove */
 
 	int				_nd6_prune;
 	int				_nd6_delay;

Modified: head/sys/netipsec/ipsec.c
==============================================================================
--- head/sys/netipsec/ipsec.c	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/netipsec/ipsec.c	Thu Apr 30 13:36:26 2009	(r191688)
@@ -248,6 +248,7 @@ MALLOC_DEFINE(M_IPSEC_INPCB, "inpcbpolic
 static const vnet_modinfo_t vnet_ipsec_modinfo = {
 	.vmi_id		= VNET_MOD_IPSEC,
 	.vmi_name	= "ipsec",
+	.vmi_size	= sizeof(struct vnet_ipsec),
 	.vmi_dependson	= VNET_MOD_INET,	/* XXX revisit - INET6 ? */
 	.vmi_iattach	= ipsec_iattach
 };

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/sys/param.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -57,7 +57,7 @@
  *		is created, otherwise 1.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 800084	/* Master, propagated to newvers */
+#define __FreeBSD_version 800085	/* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 

Modified: head/sys/sys/socketvar.h
==============================================================================
--- head/sys/sys/socketvar.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/sys/socketvar.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -45,6 +45,8 @@
 #include 
 #endif
 
+struct vnet;
+
 /*
  * Kernel structure per socket.
  * Contains send and receive buffer queues,
@@ -72,6 +74,7 @@ struct socket {
 	short	so_state;		/* (b) internal state flags SS_* */
 	int	so_qstate;		/* (e) internal state flags SQ_* */
 	void	*so_pcb;		/* protocol control block */
+	struct	vnet *so_vnet;		/* network stack instance */
 	struct	protosw *so_proto;	/* (a) protocol handle */
 /*
  * Variables for connection queuing.

Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/sys/sysctl.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -163,6 +163,8 @@ struct sysctl_oid {
 	const char	*oid_fmt;
 	int		oid_refcnt;
 	const char	*oid_descr;
+	short		oid_v_subs;
+	short		oid_v_mod;
 };
 
 #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
@@ -292,7 +294,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 
 #ifdef VIMAGE
 #define	SYSCTL_V_INT(subs, mod, parent, nbr, name, access, sym, val, descr) \
-	SYSCTL_V_OID(subs, mod, parent, nbr, name, CTLTYPE_INT|(access), \
+	SYSCTL_V_OID(subs, mod, parent, nbr, name,			    \
+		CTLTYPE_INT|CTLFLAG_MPSAFE|(access),			    \
 		sym, val, sysctl_handle_v_int, "I", descr)
 #else
 #ifdef VIMAGE_GLOBALS
@@ -317,7 +320,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 
 #ifdef VIMAGE
 #define	SYSCTL_V_UINT(subs, mod, parent, nbr, name, access, sym, val, descr) \
-	SYSCTL_V_OID(subs, mod, parent, nbr, name, CTLTYPE_UINT|(access), \
+	SYSCTL_V_OID(subs, mod, parent, nbr, name, 			     \
+		CTLTYPE_UINT|CTLFLAG_MPSAFE|(access),			     \
 		sym, val, sysctl_handle_v_int, "IU", descr)
 #else
 #ifdef VIMAGE_GLOBALS
@@ -440,6 +444,29 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 #define	FEATURE(name, desc)						\
 	SYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD, 0, 1, desc)
 	
+/*
+ * Resolve void *arg1 in a proper virtualization container.
+ */
+#ifdef VIMAGE
+#define SYSCTL_RESOLVE_V_ARG1() do {					\
+	char *cp;							\
+	switch (oidp->oid_v_subs) {					\
+	case V_GLOBAL:							\
+		/* do nothing - this is NOT a virtualized variable! */	\
+		break;							\
+	case V_NET:							\
+		cp = (char *)						\
+		    TD_TO_VNET(curthread)->mod_data[oidp->oid_v_mod];	\
+		arg1 = cp + (size_t) arg1;				\
+		break;							\
+	default:							\
+		panic("unsupported module id %d", oidp->oid_v_subs);	\
+	}								\
+} while (0)
+#else
+#define SYSCTL_RESOLVE_V_ARG1()
+#endif
+
 #endif /* _KERNEL */
 
 /*

Modified: head/sys/sys/vimage.h
==============================================================================
--- head/sys/sys/vimage.h	Thu Apr 30 13:30:27 2009	(r191687)
+++ head/sys/sys/vimage.h	Thu Apr 30 13:36:26 2009	(r191688)
@@ -39,6 +39,10 @@
 #error "You cannot have both option VIMAGE and option VIMAGE_GLOBALS!"
 #endif
 
+#ifdef INVARIANTS
+#define	VNET_DEBUG
+#endif
+
 typedef int vnet_attach_fn(const void *);
 typedef int vnet_detach_fn(const void *);
 
@@ -48,8 +52,8 @@ struct kld_sym_lookup;
 
 struct vnet_symmap {
 	char	*name;
-	void	*base;
-	size_t	size;
+	size_t	 offset;
+	size_t	 size;
 };
 typedef struct vnet_symmap vnet_symmap_t;
 
@@ -59,7 +63,7 @@ struct vnet_modinfo {
 	char				*vmi_name;
 	vnet_attach_fn			*vmi_iattach;
 	vnet_detach_fn			*vmi_idetach;
-	size_t				 vmi_struct_size;
+	size_t				 vmi_size;
 	struct vnet_symmap		*vmi_symmap;
 };
 typedef struct vnet_modinfo vnet_modinfo_t;
@@ -71,13 +75,7 @@ struct vnet_modlink {
 	const char			*vml_iname;
 };
 
-#define	VNET_SYMMAP(mod, name)						\
-	{ #name, &(vnet_ ## mod ## _0._ ## name),			\
-	sizeof(vnet_ ## mod ## _0._ ## name) }
-
-#define	VNET_SYMMAP_END		{ NULL, 0 }
-
-/* stateful modules */
+/* Stateful modules. */
 #define	VNET_MOD_NET		 0	/* MUST be 0 - implicit dependency */
 #define	VNET_MOD_NETGRAPH	 1
 #define	VNET_MOD_INET		 2
@@ -93,7 +91,7 @@ struct vnet_modlink {
 #define	VNET_MOD_IGMP		12
 #define	VNET_MOD_MLD		13
 
-/* stateless modules */
+/* Stateless modules. */
 #define	VNET_MOD_NG_ETHER	20
 #define	VNET_MOD_NG_IFACE	21
 #define	VNET_MOD_NG_EIFACE	22
@@ -109,7 +107,11 @@ struct vnet_modlink {
 #define	VNET_MOD_DYNAMIC_START	32
 #define	VNET_MOD_MAX		64
 
-/* Sysctl virtualization macros need these name mappings bellow */
+/* Major module IDs for vimage sysctl virtualization. */
+#define	V_GLOBAL		0	/* global variable - no indirection */
+#define	V_NET			1
+
+/* Name mappings for minor module IDs in vimage sysctl virtualization. */
 #define	V_MOD_vnet_net		VNET_MOD_NET
 #define	V_MOD_vnet_netgraph	VNET_MOD_NETGRAPH
 #define	V_MOD_vnet_inet		VNET_MOD_INET
@@ -131,27 +133,82 @@ void	vnet_mod_deregister_multi(const str
 #define	VSYM(base, sym) (sym)
 #else
 #ifdef VIMAGE
-#error "No option VIMAGE yet!"
+#define	VSYM(base, sym) ((base)->_ ## sym)
 #else
 #define	VSYM(base, sym) (base ## _0._ ## sym)
 #endif
 #endif
 
+#ifndef VIMAGE_GLOBALS
+#ifdef VIMAGE

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

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 13:47:37 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C6B281065672;
	Thu, 30 Apr 2009 13:47:37 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from gritton.org (gritton.org [161.58.222.4])
	by mx1.freebsd.org (Postfix) with ESMTP id 8908A8FC1B;
	Thu, 30 Apr 2009 13:47:36 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from glorfindel.gritton.org (c-76-27-80-223.hsd1.ut.comcast.net
	[76.27.80.223]) (authenticated bits=0)
	by gritton.org (8.13.6.20060614/8.13.6) with ESMTP id n3UDJsPA085426;
	Thu, 30 Apr 2009 07:19:55 -0600 (MDT)
Message-ID: <49F9A578.2070108@FreeBSD.org>
Date: Thu, 30 Apr 2009 07:19:52 -0600
From: Jamie Gritton 
User-Agent: Thunderbird 2.0.0.19 (X11/20090220)
MIME-Version: 1.0
To: Alexander Leidinger 
References: <200904292114.n3TLEGTW093008@svn.freebsd.org>
	<20090430095835.14265d5oog5a4pwk@webmail.leidinger.net>
In-Reply-To: <20090430095835.14265d5oog5a4pwk@webmail.leidinger.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV 0.94.2/9307/Thu Apr 30 05:49:56 2009 on gritton.org
X-Virus-Status: Clean
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r191673 - in head: lib/libc/sys
 sys/cddl/compat/opensolaris/kern
 sys/compat/freebsd32 sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 13:47:38 -0000

Alexander Leidinger wrote:

 > Quoting Jamie Gritton  (from Wed, 29 Apr 2009
 > 21:14:16 +0000 (UTC)):
 >
 >> Author: jamie
 >> Date: Wed Apr 29 21:14:15 2009
 >> New Revision: 191673
 >> URL: http://svn.freebsd.org/changeset/base/191673
 >>
 >> Log:
 >>   Introduce the extensible jail framework, using the same "name=value"
 >>   interface as nmount(2).  Three new system calls are added:
 >>   * jail_set, to create jails and change the parameters of existing
 >> jails.
 >>     This replaces jail(2).
 >>   * jail_get, to read the parameters of existing jails.  This replaces
 >> the
 >>     security.jail.list sysctl.
 >>   * jail_remove to kill off a jail's processes and remove the jail.
 >>   Most jail parameters may now be changed after creation, and jails
 >> may be
 >>   set to exist without any attached processes.  The current jail(2)
 >> system
 >>   call still exists, though it is now a stub to jail_set(2).
 >
 > Does this mean it is theoretically possible now to add/remove IP
 > addresses to/from a running jail? If yes, are you going to implement the
 > corresponding ifconfig feature? I would expect this in ifconfig, as on
 > Solaris ifconfig is able to do this with zones, I haven't looked if the
 > jail utility is able to do it.

Yes and maybe.  Jails can get IP addresses added and removed midstream.
But the userland interface remains to be done.  I had no plans to
specify a jail in ifconfig but I could do that at some point.  There's
no specific tie between interfaces and jails like there appears to be
for zones, so it would be something different than Solaris has.  For now
I'll just be modifying jail(8) to assign existing addresses to jails,
the way they're done now upon creation.

- Jamie

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 13:53:00 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 70D0910656C9;
	Thu, 30 Apr 2009 13:53:00 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5F56E8FC1B;
	Thu, 30 Apr 2009 13:53:00 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UDr0bl013997;
	Thu, 30 Apr 2009 13:53:00 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UDr0QQ013996;
	Thu, 30 Apr 2009 13:53:00 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200904301353.n3UDr0QQ013996@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Thu, 30 Apr 2009 13:53:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191690 - head/usr.bin/ncal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 13:53:01 -0000

Author: ru
Date: Thu Apr 30 13:53:00 2009
New Revision: 191690
URL: http://svn.freebsd.org/changeset/base/191690

Log:
  Fixed multi-byte character support to actually work.

Modified:
  head/usr.bin/ncal/ncal.c

Modified: head/usr.bin/ncal/ncal.c
==============================================================================
--- head/usr.bin/ncal/ncal.c	Thu Apr 30 13:44:59 2009	(r191689)
+++ head/usr.bin/ncal/ncal.c	Thu Apr 30 13:53:00 2009	(r191690)
@@ -452,7 +452,7 @@ printmonth(int y, int m, int jd_flag)
 	mkweekdays(&wds);
 	printf("    %ls %d\n", month.name, y);
 	for (i = 0; i != 7; i++)
-		printf("%.2ls%s\n", wds.names[i], month.lines[i]);
+		wprintf(L"%.2ls%s\n", wds.names[i], month.lines[i]);
 	if (flag_weeks)
 		printf("  %s\n", month.weeks);
 }
@@ -508,17 +508,17 @@ printyear(int y, int jd_flag)
 	printf("%s\n", center(t, s, mpl * mw));
 
 	for (j = 0; j != 12; j += mpl) {
-		printf("    %-*ls%-*ls",
+		wprintf(L"    %-*ls%-*ls",
 		    mw, year[j].name,
 		    mw, year[j + 1].name);
 		if (mpl == 3)
 			printf("%ls\n", year[j + 2].name);
 		else
-			printf("%-*ls%ls\n",
+			wprintf(L"%-*ls%ls\n",
 		    	    mw, year[j + 2].name,
 		    	    year[j + 3].name);
 		for (i = 0; i != 7; i++) {
-			printf("%.2ls%-*s%-*s",
+			wprintf(L"%.2ls%-*s%-*s",
 			    wds.names[i],
 			    mw, year[j].lines[i],
 			    mw, year[j + 1].lines[i]);
@@ -566,11 +566,11 @@ printyearb(int y, int jd_flag)
 	printf("%s\n\n", center(t, s, mw * mpl + mpl));
 
 	for (j = 0; j != 12; j += mpl) {
-		printf("%-*ls  ", mw, wcenter(ws, year[j].name, mw));
+		wprintf(L"%-*ls  ", mw, wcenter(ws, year[j].name, mw));
 		if (mpl == 2)
 			printf("%ls\n", wcenter(ws, year[j + 1].name, mw));
 		else
-			printf("%-*ls  %ls\n", mw,
+			wprintf(L"%-*ls  %ls\n", mw,
 			    wcenter(ws, year[j + 1].name, mw),
 			    wcenter(wt, year[j + 2].name, mw));
 

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 14:25:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A665910656DD;
	Thu, 30 Apr 2009 14:25:44 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8B8638FC30;
	Thu, 30 Apr 2009 14:25:44 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UEPiSM014750;
	Thu, 30 Apr 2009 14:25:44 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UEPi5U014748;
	Thu, 30 Apr 2009 14:25:44 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200904301425.n3UEPi5U014748@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 30 Apr 2009 14:25:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191692 - head/sys/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 14:25:49 -0000

Author: thompsa
Date: Thu Apr 30 14:25:44 2009
New Revision: 191692
URL: http://svn.freebsd.org/changeset/base/191692

Log:
  Use the flowid if its available for selecting the tx port.

Modified:
  head/sys/net/ieee8023ad_lacp.c
  head/sys/net/if_lagg.c

Modified: head/sys/net/ieee8023ad_lacp.c
==============================================================================
--- head/sys/net/ieee8023ad_lacp.c	Thu Apr 30 14:21:50 2009	(r191691)
+++ head/sys/net/ieee8023ad_lacp.c	Thu Apr 30 14:25:44 2009	(r191692)
@@ -812,7 +812,10 @@ lacp_select_tx_port(struct lagg_softc *s
 		return (NULL);
 	}
 
-	hash = lagg_hashmbuf(m, lsc->lsc_hashkey);
+	if (m->m_flags & M_FLOWID)
+		hash = m->m_pkthdr.flowid;
+	else
+		hash = lagg_hashmbuf(m, lsc->lsc_hashkey);
 	hash %= pm->pm_count;
 	lp = pm->pm_map[hash];
 

Modified: head/sys/net/if_lagg.c
==============================================================================
--- head/sys/net/if_lagg.c	Thu Apr 30 14:21:50 2009	(r191691)
+++ head/sys/net/if_lagg.c	Thu Apr 30 14:25:44 2009	(r191692)
@@ -1604,7 +1604,10 @@ lagg_lb_start(struct lagg_softc *sc, str
 	struct lagg_port *lp = NULL;
 	uint32_t p = 0;
 
-	p = lagg_hashmbuf(m, lb->lb_key);
+	if (m->m_flags & M_FLOWID)
+		p = m->m_pkthdr.flowid;
+	else
+		p = lagg_hashmbuf(m, lb->lb_key);
 	p %= sc->sc_count;
 	lp = lb->lb_ports[p];
 

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 14:31:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0F552106566C;
	Thu, 30 Apr 2009 14:31:53 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F20E38FC0C;
	Thu, 30 Apr 2009 14:31:52 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UEVqta014900;
	Thu, 30 Apr 2009 14:31:52 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UEVqRN014899;
	Thu, 30 Apr 2009 14:31:52 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200904301431.n3UEVqRN014899@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 30 Apr 2009 14:31:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191693 - head/sbin/ifconfig
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 14:31:53 -0000

Author: thompsa
Date: Thu Apr 30 14:31:52 2009
New Revision: 191693
URL: http://svn.freebsd.org/changeset/base/191693

Log:
  Do no spam the ifconfig output for the aggregated interface with 'laggdev laggX'.

Modified:
  head/sbin/ifconfig/iflagg.c

Modified: head/sbin/ifconfig/iflagg.c
==============================================================================
--- head/sbin/ifconfig/iflagg.c	Thu Apr 30 14:25:44 2009	(r191692)
+++ head/sbin/ifconfig/iflagg.c	Thu Apr 30 14:31:52 2009	(r191693)
@@ -167,8 +167,7 @@ lagg_status(int s)
 			for (i = 0; i < (sizeof(lpr) / sizeof(lpr[0])); i++)
 				printf("\t\tlaggproto %s\n", lpr[i].lpr_name);
 		}
-	} else if (isport)
-		printf("\tlagg: laggdev %s\n", rp.rp_ifname);
+	}
 }
 
 static struct cmd lagg_cmds[] = {

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 17:00:17 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1033)
	id A90CC1065672; Thu, 30 Apr 2009 17:00:17 +0000 (UTC)
Date: Thu, 30 Apr 2009 17:00:17 +0000
From: Alexey Dokuchaev 
To: Ruslan Ermilov 
Message-ID: <20090430170017.GA47438@FreeBSD.org>
References: <200904300748.n3U7mnje005508@svn.freebsd.org>
	<20090430122153.GA46372@edoofus.dev.vega.ru>
Mime-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <20090430122153.GA46372@edoofus.dev.vega.ru>
User-Agent: Mutt/1.4.2.1i
Cc: Maxim Konovalov , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r191681 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 17:00:18 -0000

On Thu, Apr 30, 2009 at 04:21:53PM +0400, Ruslan Ermilov wrote:
> 
> How about enabling the ability to edit svn:log revision property, to
> allow to fix commit logs?
> 
> : svn: Revprop change blocked by pre-revprop-change hook (exit code 1) with output:
> : Changing revision properties is prohibited

This would also remedy quite a number of mistakes that were previously
"fixed" with now defunct force commits.

./danfe

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 17:35:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7157E106566C;
	Thu, 30 Apr 2009 17:35:44 +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 5F0278FC1D;
	Thu, 30 Apr 2009 17:35:44 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UHZiMN018470;
	Thu, 30 Apr 2009 17:35:44 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UHZi0s018469;
	Thu, 30 Apr 2009 17:35:44 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200904301735.n3UHZi0s018469@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 30 Apr 2009 17:35:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191695 - head/sys/dev/acpica
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 17:35:45 -0000

Author: jkim
Date: Thu Apr 30 17:35:44 2009
New Revision: 191695
URL: http://svn.freebsd.org/changeset/base/191695

Log:
  General sleep state change clean up.
  
  - Probe supported sleep states from acpi_attach() just once and do not
  call AcpiGetSleepTypeData() again.  It is redundant because
  AcpiEnterSleepStatePrep() does it any way.
  - Treat UNKNOWN sleep state as NONE, i.e., "do nothing", and remove obscure
  NONE state (ACPI_S_STATES_MAX + 1) to avoid confusions.
  - Do not set unsupported sleep states as default button/switch events.
  If the default sleep state is not supported, just set it as UNKNOWN/NONE.
  - Do not allow sleep state change if the system is not fully up and running.
  This should prevent entering S5 state multiple times, which causes strange
  behaviours later.
  - Make sleep states case-insensitive when they are used with sysctl(8).
  For example,
  
  	sysctl hw.acpi.lid_switch_state=s1
  	sysctl hw.acpi.sleep_button_state=none
  
  are now legal and equivalent to the uppercase ones.

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

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Thu Apr 30 15:38:35 2009	(r191694)
+++ head/sys/dev/acpica/acpi.c	Thu Apr 30 17:35:44 2009	(r191695)
@@ -97,6 +97,9 @@ struct mtx	acpi_mutex;
 /* Bitmap of device quirks. */
 int		acpi_quirks;
 
+/* Supported sleep states. */
+static BOOLEAN	acpi_sleep_states[ACPI_S_STATE_COUNT];
+
 static int	acpi_modevent(struct module *mod, int event, void *junk);
 static int	acpi_probe(device_t dev);
 static int	acpi_attach(device_t dev);
@@ -142,6 +145,8 @@ static void	acpi_probe_order(ACPI_HANDLE
 static ACPI_STATUS acpi_probe_child(ACPI_HANDLE handle, UINT32 level,
 		    void *context, void **status);
 static BOOLEAN	acpi_MatchHid(ACPI_HANDLE h, const char *hid);
+static void	acpi_sleep_enable(void *arg);
+static ACPI_STATUS acpi_sleep_disable(struct acpi_softc *sc);
 static ACPI_STATUS acpi_EnterSleepState(struct acpi_softc *sc, int state);
 static void	acpi_shutdown_final(void *arg, int howto);
 static void	acpi_enable_fixed_events(struct acpi_softc *sc);
@@ -152,6 +157,8 @@ static int	acpi_wake_sysctl_walk(device_
 static int	acpi_wake_set_sysctl(SYSCTL_HANDLER_ARGS);
 static void	acpi_system_eventhandler_sleep(void *arg, int state);
 static void	acpi_system_eventhandler_wakeup(void *arg, int state);
+static int	acpi_sname2sstate(const char *sname);
+static const char* acpi_sstate2sname(int sstate);
 static int	acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS);
 static int	acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS);
 static int	acpi_pm_func(u_long cmd, void *arg, ...);
@@ -227,9 +234,6 @@ static struct rman acpi_rman_io, acpi_rm
 
 #define ACPI_MINIMUM_AWAKETIME	5
 
-static const char* sleep_state_names[] = {
-    "S0", "S1", "S2", "S3", "S4", "S5", "NONE"};
-
 /* Holds the description of the acpi0 device. */
 static char acpi_desc[ACPI_OEM_ID_SIZE + ACPI_OEM_TABLE_ID_SIZE + 2];
 
@@ -599,19 +603,28 @@ acpi_attach(device_t dev)
     if (facs->Flags & ACPI_FACS_S4_BIOS_PRESENT)
 	sc->acpi_s4bios = 1;
 
+    /* Probe all supported sleep states. */
+    acpi_sleep_states[ACPI_STATE_S0] = TRUE;
+    for (state = ACPI_STATE_S1; state < ACPI_S_STATE_COUNT; state++)
+	if (ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB)))
+	    acpi_sleep_states[state] = TRUE;
+
     /*
      * Dispatch the default sleep state to devices.  The lid switch is set
-     * to NONE by default to avoid surprising users.
+     * to UNKNOWN by default to avoid surprising users.
      */
-    sc->acpi_power_button_sx = ACPI_STATE_S5;
-    sc->acpi_lid_switch_sx = ACPI_S_STATES_MAX + 1;
-    sc->acpi_standby_sx = ACPI_STATE_S1;
-    sc->acpi_suspend_sx = ACPI_STATE_S3;
+    sc->acpi_power_button_sx = acpi_sleep_states[ACPI_STATE_S5] ?
+	ACPI_STATE_S5 : ACPI_STATE_UNKNOWN;
+    sc->acpi_lid_switch_sx = ACPI_STATE_UNKNOWN;
+    sc->acpi_standby_sx = acpi_sleep_states[ACPI_STATE_S1] ?
+	ACPI_STATE_S1 : ACPI_STATE_UNKNOWN;
+    sc->acpi_suspend_sx = acpi_sleep_states[ACPI_STATE_S3] ?
+	ACPI_STATE_S3 : ACPI_STATE_UNKNOWN;
 
     /* Pick the first valid sleep state for the sleep button default. */
-    sc->acpi_sleep_button_sx = ACPI_S_STATES_MAX + 1;
+    sc->acpi_sleep_button_sx = ACPI_STATE_UNKNOWN;
     for (state = ACPI_STATE_S1; state <= ACPI_STATE_S4; state++)
-	if (ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) {
+	if (acpi_sleep_states[state]) {
 	    sc->acpi_sleep_button_sx = state;
 	    break;
 	}
@@ -636,9 +649,9 @@ acpi_attach(device_t dev)
 	sc, ACPI_EVENT_PRI_LAST);
 
     /* Flag our initial states. */
-    sc->acpi_enabled = 1;
+    sc->acpi_enabled = TRUE;
     sc->acpi_sstate = ACPI_STATE_S0;
-    sc->acpi_sleep_disabled = 0;
+    sc->acpi_sleep_disabled = TRUE;
 
     /* Create the control device */
     sc->acpi_dev_t = make_dev(&acpi_cdevsw, 0, UID_ROOT, GID_WHEEL, 0644,
@@ -654,6 +667,9 @@ acpi_attach(device_t dev)
     if (!acpi_disabled("bus"))
 	acpi_probe_children(dev);
 
+    /* Allow sleep request after a while. */
+    timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME);
+
     error = 0;
 
  out:
@@ -1529,7 +1545,7 @@ acpi_set_powerstate_method(device_t bus,
 
     error = 0;
     h = acpi_get_handle(child);
-    if (state < ACPI_STATE_D0 || state > ACPI_STATE_D3)
+    if (state < ACPI_STATE_D0 || state > ACPI_D_STATES_MAX)
 	return (EINVAL);
     if (h == NULL)
 	return (0);
@@ -2310,8 +2326,10 @@ acpi_ReqSleepState(struct acpi_softc *sc
     struct apm_clone_data *clone;
 #endif
 
-    if (state < ACPI_STATE_S1 || state > ACPI_STATE_S5)
+    if (state < ACPI_STATE_S1 || state > ACPI_S_STATES_MAX)
 	return (EINVAL);
+    if (!acpi_sleep_states[state])
+	return (EOPNOTSUPP);
 
     /* S5 (soft-off) should be entered directly with no waiting. */
     if (state == ACPI_STATE_S5) {
@@ -2441,8 +2459,14 @@ acpi_sleep_enable(void *arg)
 {
     struct acpi_softc	*sc = (struct acpi_softc *)arg;
 
+    /* Reschedule if the system is not fully up and running. */
+    if (!AcpiGbl_SystemAwakeAndRunning) {
+	timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME);
+	return;
+    }
+
     ACPI_LOCK(acpi);
-    sc->acpi_sleep_disabled = 0;
+    sc->acpi_sleep_disabled = FALSE;
     ACPI_UNLOCK(acpi);
 }
 
@@ -2451,9 +2475,13 @@ acpi_sleep_disable(struct acpi_softc *sc
 {
     ACPI_STATUS		status;
 
+    /* Fail if the system is not fully up and running. */
+    if (!AcpiGbl_SystemAwakeAndRunning)
+	return (AE_ERROR);
+
     ACPI_LOCK(acpi);
     status = sc->acpi_sleep_disabled ? AE_ERROR : AE_OK;
-    sc->acpi_sleep_disabled = 1;
+    sc->acpi_sleep_disabled = TRUE;
     ACPI_UNLOCK(acpi);
 
     return (status);
@@ -2476,14 +2504,25 @@ static ACPI_STATUS
 acpi_EnterSleepState(struct acpi_softc *sc, int state)
 {
     ACPI_STATUS	status;
-    UINT8	TypeA;
-    UINT8	TypeB;
     enum acpi_sleep_state slp_state;
 
     ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state);
 
-    if (state < ACPI_STATE_S1 || state > ACPI_STATE_S5)
+    if (state < ACPI_STATE_S1 || state > ACPI_S_STATES_MAX)
 	return_ACPI_STATUS (AE_BAD_PARAMETER);
+    if (!acpi_sleep_states[state]) {
+	device_printf(sc->acpi_dev, "Sleep state S%d not supported by BIOS\n",
+	    state);
+	return (AE_SUPPORT);
+    }
+
+    /* Re-entry once we're suspending is not allowed. */
+    status = acpi_sleep_disable(sc);
+    if (ACPI_FAILURE(status)) {
+	device_printf(sc->acpi_dev,
+	    "suspend request ignored (not ready yet)\n");
+	return (status);
+    }
 
     if (state == ACPI_STATE_S5) {
 	/*
@@ -2494,13 +2533,6 @@ acpi_EnterSleepState(struct acpi_softc *
 	return_ACPI_STATUS (AE_OK);
     }
 
-    /* Re-entry once we're suspending is not allowed. */
-    status = acpi_sleep_disable(sc);
-    if (ACPI_FAILURE(status)) {
-	printf("acpi: suspend request ignored (not ready yet)\n");
-	return (status);
-    }
-
 #ifdef SMP
     thread_lock(curthread);
     sched_bind(curthread, 0);
@@ -2514,16 +2546,6 @@ acpi_EnterSleepState(struct acpi_softc *
     mtx_lock(&Giant);
 
     slp_state = ACPI_SS_NONE;
-    status = AcpiGetSleepTypeData(state, &TypeA, &TypeB);
-    if (status == AE_NOT_FOUND) {
-	device_printf(sc->acpi_dev,
-		      "Sleep state S%d not supported by BIOS\n", state);
-	goto backout;
-    } else if (ACPI_FAILURE(status)) {
-	device_printf(sc->acpi_dev, "AcpiGetSleepTypeData failed - %s\n",
-		      AcpiFormatException(status));
-	goto backout;
-    }
 
     sc->acpi_sstate = state;
 
@@ -2935,8 +2957,8 @@ acpi_system_eventhandler_sleep(void *arg
 
     ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state);
 
-    /* Check if button action is disabled. */
-    if (state == ACPI_S_STATES_MAX + 1)
+    /* Check if button action is disabled or unknown. */
+    if (state == ACPI_STATE_UNKNOWN)
 	return;
 
     /* Request that the system prepare to enter the given suspend state. */
@@ -3208,22 +3230,22 @@ acpiioctl(struct cdev *dev, u_long cmd, 
     case ACPIIO_REQSLPSTATE:
 	state = *(int *)addr;
 	if (state != ACPI_STATE_S5)
-	    error = acpi_ReqSleepState(sc, state);
-	else {
-	    printf("power off via acpi ioctl not supported\n");
-	    error = ENXIO;
-	}
+	    return (acpi_ReqSleepState(sc, state));
+	device_printf(sc->acpi_dev, "power off via acpi ioctl not supported\n");
+	error = EOPNOTSUPP;
 	break;
     case ACPIIO_ACKSLPSTATE:
 	error = *(int *)addr;
 	error = acpi_AckSleepState(sc->acpi_clone, error);
 	break;
     case ACPIIO_SETSLPSTATE:	/* DEPRECATED */
-	error = EINVAL;
 	state = *(int *)addr;
-	if (state >= ACPI_STATE_S0 && state <= ACPI_S_STATES_MAX)
-	    if (ACPI_SUCCESS(acpi_SetSleepState(sc, state)))
-		error = 0;
+	if (state < ACPI_STATE_S0 || state > ACPI_S_STATES_MAX)
+	    return (EINVAL);
+	if (!acpi_sleep_states[state])
+	    return (EOPNOTSUPP);
+	if (ACPI_FAILURE(acpi_SetSleepState(sc, state)))
+	    error = ENXIO;
 	break;
     default:
 	error = ENXIO;
@@ -3234,16 +3256,43 @@ acpiioctl(struct cdev *dev, u_long cmd, 
 }
 
 static int
+acpi_sname2sstate(const char *sname)
+{
+    int sstate;
+
+    if (toupper(sname[0]) == 'S') {
+	sstate = sname[1] - '0';
+	if (sstate >= ACPI_STATE_S0 && sstate <= ACPI_STATE_S5 &&
+	    sname[2] == '\0')
+	    return (sstate);
+    } else if (strcasecmp(sname, "NONE") == 0)
+	return (ACPI_STATE_UNKNOWN);
+    return (-1);
+}
+
+static const char*
+acpi_sstate2sname(int sstate)
+{
+    static const char *snames[] = { "S0", "S1", "S2", "S3", "S4", "S5" };
+
+    if (sstate >= ACPI_STATE_S0 && sstate <= ACPI_STATE_S5)
+	return (snames[sstate]);
+    else if (sstate == ACPI_STATE_UNKNOWN)
+	return ("NONE");
+    return (NULL);
+}
+
+static int
 acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS)
 {
     int error;
     struct sbuf sb;
-    UINT8 state, TypeA, TypeB;
+    UINT8 state;
 
     sbuf_new(&sb, NULL, 32, SBUF_AUTOEXTEND);
-    for (state = ACPI_STATE_S1; state < ACPI_S_STATES_MAX + 1; state++)
-	if (ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB)))
-	    sbuf_printf(&sb, "S%d ", state);
+    for (state = ACPI_STATE_S1; state < ACPI_S_STATE_COUNT; state++)
+	if (acpi_sleep_states[state])
+	    sbuf_printf(&sb, "%s ", acpi_sstate2sname(state));
     sbuf_trim(&sb);
     sbuf_finish(&sb);
     error = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req);
@@ -3255,27 +3304,20 @@ static int
 acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS)
 {
     char sleep_state[10];
-    int error;
-    u_int new_state, old_state;
+    int error, new_state, old_state;
 
-    old_state = *(u_int *)oidp->oid_arg1;
-    if (old_state > ACPI_S_STATES_MAX + 1)
-	strlcpy(sleep_state, "unknown", sizeof(sleep_state));
-    else
-	strlcpy(sleep_state, sleep_state_names[old_state], sizeof(sleep_state));
+    old_state = *(int *)oidp->oid_arg1;
+    strlcpy(sleep_state, acpi_sstate2sname(old_state), sizeof(sleep_state));
     error = sysctl_handle_string(oidp, sleep_state, sizeof(sleep_state), req);
     if (error == 0 && req->newptr != NULL) {
-	new_state = ACPI_STATE_S0;
-	for (; new_state <= ACPI_S_STATES_MAX + 1; new_state++)
-	    if (strcmp(sleep_state, sleep_state_names[new_state]) == 0)
-		break;
-	if (new_state <= ACPI_S_STATES_MAX + 1) {
-	    if (new_state != old_state)
-		*(u_int *)oidp->oid_arg1 = new_state;
-	} else
-	    error = EINVAL;
+	new_state = acpi_sname2sstate(sleep_state);
+	if (new_state < ACPI_STATE_S1)
+	    return (EINVAL);
+	if (new_state < ACPI_S_STATES_MAX && !acpi_sleep_states[new_state])
+	    return (EOPNOTSUPP);
+	if (new_state != old_state)
+	    *(int *)oidp->oid_arg1 = new_state;
     }
-
     return (error);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 17:42:11 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D6E831065677;
	Thu, 30 Apr 2009 17:42:11 +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 C4C388FC1A;
	Thu, 30 Apr 2009 17:42:11 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UHgBSj018621;
	Thu, 30 Apr 2009 17:42:11 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UHgB5C018620;
	Thu, 30 Apr 2009 17:42:11 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200904301742.n3UHgB5C018620@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 30 Apr 2009 17:42:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191696 - head/sys/dev/acpica
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 17:42:12 -0000

Author: jkim
Date: Thu Apr 30 17:42:11 2009
New Revision: 191696
URL: http://svn.freebsd.org/changeset/base/191696

Log:
  Prefer device_printf() over printf() where ever possible.

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

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Thu Apr 30 17:35:44 2009	(r191695)
+++ head/sys/dev/acpica/acpi.c	Thu Apr 30 17:42:11 2009	(r191696)
@@ -902,7 +902,7 @@ acpi_read_ivar(device_t dev, device_t ch
     struct acpi_device	*ad;
 
     if ((ad = device_get_ivars(child)) == NULL) {
-	printf("device has no ivars\n");
+	device_printf(child, "device has no ivars\n");
 	return (ENOENT);
     }
 
@@ -941,7 +941,7 @@ acpi_write_ivar(device_t dev, device_t c
     struct acpi_device	*ad;
 
     if ((ad = device_get_ivars(child)) == NULL) {
-	printf("device has no ivars\n");
+	device_printf(child, "device has no ivars\n");
 	return (ENOENT);
     }
 
@@ -1819,7 +1819,7 @@ acpi_fake_objhandler(ACPI_HANDLE h, UINT
 static void
 acpi_shutdown_final(void *arg, int howto)
 {
-    struct acpi_softc *sc;
+    struct acpi_softc *sc = (struct acpi_softc *)arg;
     ACPI_STATUS status;
 
     /*
@@ -1827,22 +1827,22 @@ acpi_shutdown_final(void *arg, int howto
      * Some chipsets do not power off the system correctly if called from
      * an AP.
      */
-    sc = arg;
     if ((howto & RB_POWEROFF) != 0) {
 	status = AcpiEnterSleepStatePrep(ACPI_STATE_S5);
 	if (ACPI_FAILURE(status)) {
-	    printf("AcpiEnterSleepStatePrep failed - %s\n",
-		   AcpiFormatException(status));
+	    device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n",
+		AcpiFormatException(status));
 	    return;
 	}
-	printf("Powering system off using ACPI\n");
+	device_printf(sc->acpi_dev, "Powering system off\n");
 	ACPI_DISABLE_IRQS();
 	status = AcpiEnterSleepState(ACPI_STATE_S5);
-	if (ACPI_FAILURE(status)) {
-	    printf("ACPI power-off failed - %s\n", AcpiFormatException(status));
-	} else {
+	if (ACPI_FAILURE(status))
+	    device_printf(sc->acpi_dev, "power-off failed - %s\n",
+		AcpiFormatException(status));
+	else {
 	    DELAY(1000000);
-	    printf("ACPI power-off failed - timeout\n");
+	    device_printf(sc->acpi_dev, "power-off failed - timeout\n");
 	}
     } else if ((howto & RB_HALT) == 0 &&
 	(AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) &&
@@ -1851,18 +1851,19 @@ acpi_shutdown_final(void *arg, int howto
 	status = AcpiHwLowLevelWrite(
 	    AcpiGbl_FADT.ResetRegister.BitWidth,
 	    AcpiGbl_FADT.ResetValue, &AcpiGbl_FADT.ResetRegister);
-	if (ACPI_FAILURE(status)) {
-	    printf("ACPI reset failed - %s\n", AcpiFormatException(status));
-	} else {
+	if (ACPI_FAILURE(status))
+	    device_printf(sc->acpi_dev, "reset failed - %s\n",
+		AcpiFormatException(status));
+	else {
 	    DELAY(1000000);
-	    printf("ACPI reset failed - timeout\n");
+	    device_printf(sc->acpi_dev, "reset failed - timeout\n");
 	}
     } else if (sc->acpi_do_disable && panicstr == NULL) {
 	/*
 	 * Only disable ACPI if the user requested.  On some systems, writing
 	 * the disable value to SMI_CMD hangs the system.
 	 */
-	printf("Shutting down ACPI\n");
+	device_printf(sc->acpi_dev, "Shutting down\n");
 	AcpiTerminate();
     }
 }
@@ -2293,7 +2294,7 @@ acpi_SetSleepState(struct acpi_softc *sc
     static int once;
 
     if (!once) {
-	printf(
+	device_printf(sc->acpi_dev,
 "warning: acpi_SetSleepState() deprecated, need to update your software\n");
 	once = 1;
     }
@@ -2304,12 +2305,13 @@ acpi_SetSleepState(struct acpi_softc *sc
 static void
 acpi_sleep_force(void *arg)
 {
-    struct acpi_softc *sc;
+    struct acpi_softc *sc = (struct acpi_softc *)arg;
 
-    printf("acpi: suspend request timed out, forcing sleep now\n");
-    sc = arg;
+    device_printf(sc->acpi_dev,
+	"suspend request timed out, forcing sleep now\n");
     if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_sstate)))
-	printf("acpi: force sleep state S%d failed\n", sc->acpi_next_sstate);
+	device_printf(sc->acpi_dev, "force sleep state S%d failed\n",
+	    sc->acpi_next_sstate);
 }
 #endif
 
@@ -2415,7 +2417,8 @@ acpi_AckSleepState(struct apm_clone_data
     if (error) {
 	sc->acpi_next_sstate = 0;
 	callout_stop(&sc->susp_force_to);
-	printf("acpi: listener on %s cancelled the pending suspend\n",
+	device_printf(sc->acpi_dev,
+	    "listener on %s cancelled the pending suspend\n",
 	    devtoname(clone->cdev));
     	ACPI_UNLOCK(acpi);
 	return (0);
@@ -2953,6 +2956,7 @@ out:
 static void
 acpi_system_eventhandler_sleep(void *arg, int state)
 {
+    struct acpi_softc *sc = (struct acpi_softc *)arg;
     int ret;
 
     ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state);
@@ -2962,10 +2966,10 @@ acpi_system_eventhandler_sleep(void *arg
 	return;
 
     /* Request that the system prepare to enter the given suspend state. */
-    ret = acpi_ReqSleepState((struct acpi_softc *)arg, state);
+    ret = acpi_ReqSleepState(sc, state);
     if (ret != 0)
-	printf("acpi: request to enter state S%d failed (err %d)\n",
-	    state, ret);
+	device_printf(sc->acpi_dev,
+	    "request to enter state S%d failed (err %d)\n", state, ret);
 
     return_VOID;
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 17:45:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 35923106566B;
	Thu, 30 Apr 2009 17:45:44 +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 243038FC08;
	Thu, 30 Apr 2009 17:45:44 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UHji3P018743;
	Thu, 30 Apr 2009 17:45:44 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UHjirr018742;
	Thu, 30 Apr 2009 17:45:44 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200904301745.n3UHjirr018742@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 30 Apr 2009 17:45:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191697 - head/sys/dev/acpica
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 17:45:44 -0000

Author: jkim
Date: Thu Apr 30 17:45:43 2009
New Revision: 191697
URL: http://svn.freebsd.org/changeset/base/191697

Log:
  Fix style(9).

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

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Thu Apr 30 17:42:11 2009	(r191696)
+++ head/sys/dev/acpica/acpi.c	Thu Apr 30 17:45:43 2009	(r191697)
@@ -158,7 +158,7 @@ static int	acpi_wake_set_sysctl(SYSCTL_H
 static void	acpi_system_eventhandler_sleep(void *arg, int state);
 static void	acpi_system_eventhandler_wakeup(void *arg, int state);
 static int	acpi_sname2sstate(const char *sname);
-static const char* acpi_sstate2sname(int sstate);
+static const char *acpi_sstate2sname(int sstate);
 static int	acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS);
 static int	acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS);
 static int	acpi_pm_func(u_long cmd, void *arg, ...);
@@ -3274,7 +3274,7 @@ acpi_sname2sstate(const char *sname)
     return (-1);
 }
 
-static const char*
+static const char *
 acpi_sstate2sname(int sstate)
 {
     static const char *snames[] = { "S0", "S1", "S2", "S3", "S4", "S5" };

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 17:47:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D859B1065674;
	Thu, 30 Apr 2009 17:47:52 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C72378FC08;
	Thu, 30 Apr 2009 17:47:52 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UHlq7Z018815;
	Thu, 30 Apr 2009 17:47:52 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UHlqMr018814;
	Thu, 30 Apr 2009 17:47:52 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <200904301747.n3UHlqMr018814@svn.freebsd.org>
From: Maxim Konovalov 
Date: Thu, 30 Apr 2009 17:47:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191698 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 17:47:53 -0000

Author: maxim
Date: Thu Apr 30 17:47:52 2009
New Revision: 191698
URL: http://svn.freebsd.org/changeset/base/191698

Log:
  o OpenBSD 4.5 added.

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==============================================================================
--- head/share/misc/bsd-family-tree	Thu Apr 30 17:45:43 2009	(r191697)
+++ head/share/misc/bsd-family-tree	Thu Apr 30 17:47:52 2009	(r191698)
@@ -227,7 +227,7 @@ FreeBSD 5.2           |      |          
  |     |              |      |                 |                       |
  |  FreeBSD 7.1       |      |                 |                       |
  |     |              |      |                 |                DragonFly 2.2.0
- |     V              |   NetBSD 5.0           |                       |
+ |     V              |   NetBSD 5.0       OpenBSD 4.5                 |
  |                    |      |                 |                       |
 FreeBSD 8 -current    |  NetBSD -current  OpenBSD -current             |
  |                    |      |                 |                       |
@@ -497,6 +497,7 @@ FreeBSD 6.4		2008-11-28 [FBD]
 FreeBSD 7.1		2009-01-04 [FBD]
 DragonFly 2.2.0		2009-02-17 [DFB]
 NetBSD 5.0		2009-04-29 [NBD]
+OpenBSD 4.5		2009-05-01 [OBD]
 
 Bibliography
 ------------------------

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 18:00:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EFBD1106566C;
	Thu, 30 Apr 2009 18:00:53 +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 DDB3A8FC08;
	Thu, 30 Apr 2009 18:00:53 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UI0rCp019119;
	Thu, 30 Apr 2009 18:00:53 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UI0rU9019118;
	Thu, 30 Apr 2009 18:00:53 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200904301800.n3UI0rU9019118@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 30 Apr 2009 18:00:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191699 - head/sys/dev/acpica
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 18:00:54 -0000

Author: jkim
Date: Thu Apr 30 18:00:53 2009
New Revision: 191699
URL: http://svn.freebsd.org/changeset/base/191699

Log:
  Fix off-by-one bug.  S5 state must be checked as well.

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

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Thu Apr 30 17:47:52 2009	(r191698)
+++ head/sys/dev/acpica/acpi.c	Thu Apr 30 18:00:53 2009	(r191699)
@@ -3317,7 +3317,7 @@ acpi_sleep_state_sysctl(SYSCTL_HANDLER_A
 	new_state = acpi_sname2sstate(sleep_state);
 	if (new_state < ACPI_STATE_S1)
 	    return (EINVAL);
-	if (new_state < ACPI_S_STATES_MAX && !acpi_sleep_states[new_state])
+	if (new_state < ACPI_S_STATE_COUNT && !acpi_sleep_states[new_state])
 	    return (EOPNOTSUPP);
 	if (new_state != old_state)
 	    *(int *)oidp->oid_arg1 = new_state;

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 18:56:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A65EE1065672;
	Thu, 30 Apr 2009 18:56:23 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147])
	by mx1.freebsd.org (Postfix) with ESMTP id 40DE38FC12;
	Thu, 30 Apr 2009 18:56:23 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua)
	by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256)
	(Exim 4.63 (FreeBSD)) (envelope-from )
	id 1LzbQi-000GIa-SA; Thu, 30 Apr 2009 21:56:21 +0300
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n3UIuHFW009177
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 30 Apr 2009 21:56:17 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id
	n3UIuHgT002022; Thu, 30 Apr 2009 21:56:17 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n3UIuHRE002021; 
	Thu, 30 Apr 2009 21:56:17 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Thu, 30 Apr 2009 21:56:17 +0300
From: Kostik Belousov 
To: Alexey Dokuchaev 
Message-ID: <20090430185617.GA1836@deviant.kiev.zoral.com.ua>
References: <200904300748.n3U7mnje005508@svn.freebsd.org>
	<20090430122153.GA46372@edoofus.dev.vega.ru>
	<20090430170017.GA47438@FreeBSD.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="y0ulUmNC+osPPQO6"
Content-Disposition: inline
In-Reply-To: <20090430170017.GA47438@FreeBSD.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: ClamAV version 0.94.2,
	clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
X-Virus-Scanned: mail.terabit.net.ua 1LzbQi-000GIa-SA
	1492893e0e3fef415a55e8df170b8bc9
X-Terabit: YES
Cc: Maxim Konovalov , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Ruslan Ermilov 
Subject: Re: svn commit: r191681 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 18:56:24 -0000


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

On Thu, Apr 30, 2009 at 05:00:17PM +0000, Alexey Dokuchaev wrote:
> On Thu, Apr 30, 2009 at 04:21:53PM +0400, Ruslan Ermilov wrote:
> >=20
> > How about enabling the ability to edit svn:log revision property, to
> > allow to fix commit logs?
> >=20
> > : svn: Revprop change blocked by pre-revprop-change hook (exit code 1) =
with output:
> > : Changing revision properties is prohibited
>=20
> This would also remedy quite a number of mistakes that were previously
> "fixed" with now defunct force commits.

I think the main argument against is that allowing the editing of
the unversioned properties breaks svnsync.

--y0ulUmNC+osPPQO6
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iEYEARECAAYFAkn59FAACgkQC3+MBN1Mb4hpHQCgxOlPZ1zdR5sn0spedQGU/JBE
SqwAoNTwLk/TlWQ7yJnaz+aSEVkdsHAN
=j0yj
-----END PGP SIGNATURE-----

--y0ulUmNC+osPPQO6--

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 21:41:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 996FD106566B;
	Thu, 30 Apr 2009 21:41:24 +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 6BA1A8FC14;
	Thu, 30 Apr 2009 21:41:24 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 2044E46B5C;
	Thu, 30 Apr 2009 17:41:24 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 0E8798A024;
	Thu, 30 Apr 2009 17:41:23 -0400 (EDT)
From: John Baldwin 
To: Bruce M Simpson 
Date: Thu, 30 Apr 2009 10:28:22 -0400
User-Agent: KMail/1.9.7
References: <200904290954.n3T9sXK6075498@svn.freebsd.org>
In-Reply-To: <200904290954.n3T9sXK6075498@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200904301028.22484.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 30 Apr 2009 17:41:23 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-0.6 required=4.2 tests=AWL,BAYES_00,
	DATE_IN_PAST_06_12,RDNS_NONE autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r191653 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 21:41:25 -0000

On Wednesday 29 April 2009 5:54:33 am Bruce M Simpson wrote:
> Author: bms
> Date: Wed Apr 29 09:54:33 2009
> New Revision: 191653
> URL: http://svn.freebsd.org/changeset/base/191653
> 
> Log:
>   Grab KTR_SPARE1 and KTR_SPARE5 for KTR_INET and KTR_INET6
>   respectively, as placeholder for future use of CTR() by
>   the networking code (MLDv2 will be going in shortly).
>   Mark KTR_SPARE* as being used in fact by cxgb (picked up
>   on a 'make universe' run).

cxgb should conditionally use KTR_DRIVER instead of grabbing a spare mask.

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 22:10:05 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D0511065689;
	Thu, 30 Apr 2009 22:10:05 +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 20F888FC1E;
	Thu, 30 Apr 2009 22:10:05 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UMA54X024214;
	Thu, 30 Apr 2009 22:10:05 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UMA4Zq024212;
	Thu, 30 Apr 2009 22:10:04 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200904302210.n3UMA4Zq024212@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 30 Apr 2009 22:10:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191708 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 22:10:05 -0000

Author: jkim
Date: Thu Apr 30 22:10:04 2009
New Revision: 191708
URL: http://svn.freebsd.org/changeset/base/191708

Log:
  - Fix divide-by-zero panic when SMP kernel is used on UP system[1].
  - Avoid possible divide-by-zero panic on SMP system when the CPUID is
  disabled, unsupported, or buggy.
  
  Submitted by:	pluknet (pluknet at gmail dot com)[1]

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

Modified: head/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- head/sys/amd64/amd64/mp_machdep.c	Thu Apr 30 21:48:31 2009	(r191707)
+++ head/sys/amd64/amd64/mp_machdep.c	Thu Apr 30 22:10:04 2009	(r191708)
@@ -292,6 +292,10 @@ topo_probe_0x4(void)
 static void
 topo_probe(void)
 {
+	static int cpu_topo_probed = 0;
+
+	if (cpu_topo_probed)
+		return;
 
 	logical_cpus = logical_cpus_mask = 0;
 	if (cpu_high >= 0xb)
@@ -299,9 +303,10 @@ topo_probe(void)
 	else if (cpu_high)
 		topo_probe_0x4();
 	if (cpu_cores == 0)
-		cpu_cores = mp_ncpus;
+		cpu_cores = mp_ncpus > 0 ? mp_ncpus : 1;
 	if (cpu_logical == 0)
 		cpu_logical = 1;
+	cpu_topo_probed = 1;
 }
 
 struct cpu_group *
@@ -313,6 +318,7 @@ cpu_topo(void)
 	 * Determine whether any threading flags are
 	 * necessry.
 	 */
+	topo_probe();
 	if (cpu_logical > 1 && hyperthreading_cpus)
 		cg_flags = CG_FLAG_HTT;
 	else if (cpu_logical > 1)

Modified: head/sys/i386/i386/mp_machdep.c
==============================================================================
--- head/sys/i386/i386/mp_machdep.c	Thu Apr 30 21:48:31 2009	(r191707)
+++ head/sys/i386/i386/mp_machdep.c	Thu Apr 30 22:10:04 2009	(r191708)
@@ -345,6 +345,10 @@ topo_probe_0x4(void)
 static void
 topo_probe(void)
 {
+	static int cpu_topo_probed = 0;
+
+	if (cpu_topo_probed)
+		return;
 
 	logical_cpus = logical_cpus_mask = 0;
 	if (cpu_high >= 0xb)
@@ -352,9 +356,10 @@ topo_probe(void)
 	else if (cpu_high)
 		topo_probe_0x4();
 	if (cpu_cores == 0)
-		cpu_cores = mp_ncpus;
+		cpu_cores = mp_ncpus > 0 ? mp_ncpus : 1;
 	if (cpu_logical == 0)
 		cpu_logical = 1;
+	cpu_topo_probed = 1;
 }
 
 struct cpu_group *
@@ -366,6 +371,7 @@ cpu_topo(void)
 	 * Determine whether any threading flags are
 	 * necessry.
 	 */
+	topo_probe();
 	if (cpu_logical > 1 && hyperthreading_cpus)
 		cg_flags = CG_FLAG_HTT;
 	else if (cpu_logical > 1)

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 22:30:02 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E9E71065674;
	Thu, 30 Apr 2009 22:30:02 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D06A8FC08;
	Thu, 30 Apr 2009 22:30:02 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UMU2SQ024657;
	Thu, 30 Apr 2009 22:30:02 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UMU2oY024656;
	Thu, 30 Apr 2009 22:30:02 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200904302230.n3UMU2oY024656@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 30 Apr 2009 22:30:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191710 - head/sys/dev/usb/wlan
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 22:30:02 -0000

Author: thompsa
Date: Thu Apr 30 22:30:01 2009
New Revision: 191710
URL: http://svn.freebsd.org/changeset/base/191710

Log:
  We need to ref the bss node when sending the beacon since it goes through the
  normal tx path and will be decremented on the mbuf free.

Modified:
  head/sys/dev/usb/wlan/if_ural.c

Modified: head/sys/dev/usb/wlan/if_ural.c
==============================================================================
--- head/sys/dev/usb/wlan/if_ural.c	Thu Apr 30 22:16:29 2009	(r191709)
+++ head/sys/dev/usb/wlan/if_ural.c	Thu Apr 30 22:30:01 2009	(r191710)
@@ -760,7 +760,7 @@ ural_task(struct usb2_proc_msg *pm)
 				    "could not allocate beacon\n");
 				return;
 			}
-
+			ieee80211_ref_node(ni);
 			if (ural_tx_bcn(sc, m, ni) != 0) {
 				device_printf(sc->sc_dev,
 				    "could not send beacon\n");

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 30 22:43:21 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D499D1065670;
	Thu, 30 Apr 2009 22:43:21 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C38268FC14;
	Thu, 30 Apr 2009 22:43:21 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UMhLEB024947;
	Thu, 30 Apr 2009 22:43:21 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3UMhLeq024946;
	Thu, 30 Apr 2009 22:43:21 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200904302243.n3UMhLeq024946@svn.freebsd.org>
From: Jamie Gritton 
Date: Thu, 30 Apr 2009 22:43:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191711 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 30 Apr 2009 22:43:22 -0000

Author: jamie
Date: Thu Apr 30 22:43:21 2009
New Revision: 191711
URL: http://svn.freebsd.org/changeset/base/191711

Log:
  Don't call the OSD destructor if the data slot is NULL
  (since it's already not done on unused slots, which are indistinguishable
  to the caller).
  
  Approved by:	bz (mentor)

Modified:
  head/sys/kern/kern_osd.c

Modified: head/sys/kern/kern_osd.c
==============================================================================
--- head/sys/kern/kern_osd.c	Thu Apr 30 22:30:01 2009	(r191710)
+++ head/sys/kern/kern_osd.c	Thu Apr 30 22:43:21 2009	(r191711)
@@ -297,8 +297,10 @@ do_osd_del(u_int type, struct osd *osd, 
 		OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot);
 		return;
 	}
-	osd_destructors[type][slot - 1](osd->osd_slots[slot - 1]);
-	osd->osd_slots[slot - 1] = NULL;
+	if (osd->osd_slots[slot - 1] != NULL) {
+		osd_destructors[type][slot - 1](osd->osd_slots[slot - 1]);
+		osd->osd_slots[slot - 1] = NULL;
+	}
 	for (i = osd->osd_nslots - 1; i >= 0; i--) {
 		if (osd->osd_slots[i] != NULL) {
 			OSD_DEBUG("Slot still has a value (type=%u, slot=%u).",

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 03:24:03 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 76BD8106566C;
	Fri,  1 May 2009 03:24:03 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 63C458FC0C;
	Fri,  1 May 2009 03:24:03 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n413O3Qx030669;
	Fri, 1 May 2009 03:24:03 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n413O3o0030668;
	Fri, 1 May 2009 03:24:03 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200905010324.n413O3o0030668@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 1 May 2009 03:24:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191716 - head/sys/dev/sk
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 03:24:03 -0000

Author: yongari
Date: Fri May  1 03:24:03 2009
New Revision: 191716
URL: http://svn.freebsd.org/changeset/base/191716

Log:
  Separate multicast filtering of SysKonnect GENESIS and Marvell
  Yukon from common multicast handling code. Yukon uses hash-based
  multicast filtering(big endian form) but GENESIS uses perfect
  multicast filtering as well as hash-based one(little endian form).
  Due to the differences of multicast filtering there is no much
  sense to have a common code.
   o Remove sk_setmulti() and introduce sk_rxfilter_yukon(),
     sk_rxfilter_yukon() that handles multicast filtering setup.
   o Have sk_rxfilter_{yukon, genesis} handle promiscuous mode and
     nuke sk_setpromisc(). This simplifies ioctl handler as well as
     giving a chance to check validity of Rx control register of
     Yukon.
   o Don't reinitialize controller when IFF_ALLMULTI flags is changed.
   o Nuke sk_gmchash(), it's not needed anymore.
   o Always reconfigure Rx control register whenever a new multicast
     filtering condition is changed. This fixes multicast filtering
     setup on Yukon.
  
  PR:	kern/134051

Modified:
  head/sys/dev/sk/if_sk.c

Modified: head/sys/dev/sk/if_sk.c
==============================================================================
--- head/sys/dev/sk/if_sk.c	Fri May  1 02:51:58 2009	(r191715)
+++ head/sys/dev/sk/if_sk.c	Fri May  1 03:24:03 2009	(r191716)
@@ -255,10 +255,10 @@ static int sk_marv_miibus_writereg(struc
 static void sk_marv_miibus_statchg(struct sk_if_softc *);
 
 static uint32_t sk_xmchash(const uint8_t *);
-static uint32_t sk_gmchash(const uint8_t *);
 static void sk_setfilt(struct sk_if_softc *, u_int16_t *, int);
-static void sk_setmulti(struct sk_if_softc *);
-static void sk_setpromisc(struct sk_if_softc *);
+static void sk_rxfilter(struct sk_if_softc *);
+static void sk_rxfilter_genesis(struct sk_if_softc *);
+static void sk_rxfilter_yukon(struct sk_if_softc *);
 
 static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int low, int high);
 static int sysctl_hw_sk_int_mod(SYSCTL_HANDLER_ARGS);
@@ -697,19 +697,6 @@ sk_xmchash(addr)
 	return (~crc & ((1 << HASH_BITS) - 1));
 }
 
-/* gmchash is just a big endian crc */
-static u_int32_t
-sk_gmchash(addr)
-	const uint8_t *addr;
-{
-	uint32_t crc;
-
-	/* Compute CRC for the address value. */
-	crc = ether_crc32_be(addr, ETHER_ADDR_LEN);
-
-	return (crc & ((1 << HASH_BITS) - 1));
-}
-
 static void
 sk_setfilt(sc_if, addr, slot)
 	struct sk_if_softc	*sc_if;
@@ -728,12 +715,26 @@ sk_setfilt(sc_if, addr, slot)
 }
 
 static void
-sk_setmulti(sc_if)
+sk_rxfilter(sc_if)
+	struct sk_if_softc	*sc_if;
+{
+	struct sk_softc		*sc;
+
+	SK_IF_LOCK_ASSERT(sc_if);
+
+	sc = sc_if->sk_softc;
+	if (sc->sk_type == SK_GENESIS)
+		sk_rxfilter_genesis(sc_if);
+	else
+		sk_rxfilter_yukon(sc_if);
+}
+
+static void
+sk_rxfilter_genesis(sc_if)
 	struct sk_if_softc	*sc_if;
 {
-	struct sk_softc		*sc = sc_if->sk_softc;
 	struct ifnet		*ifp = sc_if->sk_ifp;
-	u_int32_t		hashes[2] = { 0, 0 };
+	u_int32_t		hashes[2] = { 0, 0 }, mode;
 	int			h = 0, i;
 	struct ifmultiaddr	*ifma;
 	u_int16_t		dummy[] = { 0, 0, 0 };
@@ -741,124 +742,96 @@ sk_setmulti(sc_if)
 
 	SK_IF_LOCK_ASSERT(sc_if);
 
-	/* First, zot all the existing filters. */
-	switch(sc->sk_type) {
-	case SK_GENESIS:
-		for (i = 1; i < XM_RXFILT_MAX; i++)
-			sk_setfilt(sc_if, dummy, i);
-
-		SK_XM_WRITE_4(sc_if, XM_MAR0, 0);
-		SK_XM_WRITE_4(sc_if, XM_MAR2, 0);
-		break;
-	case SK_YUKON:
-	case SK_YUKON_LITE:
-	case SK_YUKON_LP:
-		SK_YU_WRITE_2(sc_if, YUKON_MCAH1, 0);
-		SK_YU_WRITE_2(sc_if, YUKON_MCAH2, 0);
-		SK_YU_WRITE_2(sc_if, YUKON_MCAH3, 0);
-		SK_YU_WRITE_2(sc_if, YUKON_MCAH4, 0);
-		break;
-	}
+	mode = SK_XM_READ_4(sc_if, XM_MODE);
+	mode &= ~(XM_MODE_RX_PROMISC | XM_MODE_RX_USE_HASH |
+	    XM_MODE_RX_USE_PERFECT);
+	/* First, zot all the existing perfect filters. */
+	for (i = 1; i < XM_RXFILT_MAX; i++)
+		sk_setfilt(sc_if, dummy, i);
 
 	/* Now program new ones. */
 	if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
+		if (ifp->if_flags & IFF_ALLMULTI)
+			mode |= XM_MODE_RX_USE_HASH;
+		if (ifp->if_flags & IFF_PROMISC)
+			mode |= XM_MODE_RX_PROMISC;
 		hashes[0] = 0xFFFFFFFF;
 		hashes[1] = 0xFFFFFFFF;
 	} else {
 		i = 1;
 		IF_ADDR_LOCK(ifp);
-		TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) {
+		TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead,
+		    ifma_link) {
 			if (ifma->ifma_addr->sa_family != AF_LINK)
 				continue;
 			/*
 			 * Program the first XM_RXFILT_MAX multicast groups
-			 * into the perfect filter. For all others,
-			 * use the hash table.
+			 * into the perfect filter.
 			 */
-			if (sc->sk_type == SK_GENESIS && i < XM_RXFILT_MAX) {
-				bcopy(LLADDR(
-				    (struct sockaddr_dl *)ifma->ifma_addr),
-				    maddr, ETHER_ADDR_LEN);
+			bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
+			    maddr, ETHER_ADDR_LEN);
+			if (i < XM_RXFILT_MAX) {
 				sk_setfilt(sc_if, maddr, i);
+				mode |= XM_MODE_RX_USE_PERFECT;
 				i++;
 				continue;
 			}
-
-			switch(sc->sk_type) {
-			case SK_GENESIS:
-				bcopy(LLADDR(
-				    (struct sockaddr_dl *)ifma->ifma_addr),
-				    maddr, ETHER_ADDR_LEN);
-				h = sk_xmchash((const uint8_t *)maddr);
-				break;
-			case SK_YUKON:
-			case SK_YUKON_LITE:
-			case SK_YUKON_LP:
-				bcopy(LLADDR(
-				    (struct sockaddr_dl *)ifma->ifma_addr),
-				    maddr, ETHER_ADDR_LEN);
-				h = sk_gmchash((const uint8_t *)maddr);
-				break;
-			}
+			h = sk_xmchash((const uint8_t *)maddr);
 			if (h < 32)
 				hashes[0] |= (1 << h);
 			else
 				hashes[1] |= (1 << (h - 32));
+			mode |= XM_MODE_RX_USE_HASH;
 		}
 		IF_ADDR_UNLOCK(ifp);
 	}
 
-	switch(sc->sk_type) {
-	case SK_GENESIS:
-		SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_USE_HASH|
-			       XM_MODE_RX_USE_PERFECT);
-		SK_XM_WRITE_4(sc_if, XM_MAR0, hashes[0]);
-		SK_XM_WRITE_4(sc_if, XM_MAR2, hashes[1]);
-		break;
-	case SK_YUKON:
-	case SK_YUKON_LITE:
-	case SK_YUKON_LP:
-		SK_YU_WRITE_2(sc_if, YUKON_MCAH1, hashes[0] & 0xffff);
-		SK_YU_WRITE_2(sc_if, YUKON_MCAH2, (hashes[0] >> 16) & 0xffff);
-		SK_YU_WRITE_2(sc_if, YUKON_MCAH3, hashes[1] & 0xffff);
-		SK_YU_WRITE_2(sc_if, YUKON_MCAH4, (hashes[1] >> 16) & 0xffff);
-		break;
-	}
-
-	return;
+	SK_XM_WRITE_4(sc_if, XM_MODE, mode);
+	SK_XM_WRITE_4(sc_if, XM_MAR0, hashes[0]);
+	SK_XM_WRITE_4(sc_if, XM_MAR2, hashes[1]);
 }
 
 static void
-sk_setpromisc(sc_if)
+sk_rxfilter_yukon(sc_if)
 	struct sk_if_softc	*sc_if;
 {
-	struct sk_softc		*sc = sc_if->sk_softc;
-	struct ifnet		*ifp = sc_if->sk_ifp;
+	struct ifnet		*ifp;
+	u_int32_t		crc, hashes[2] = { 0, 0 }, mode;
+	struct ifmultiaddr	*ifma;
 
 	SK_IF_LOCK_ASSERT(sc_if);
 
-	switch(sc->sk_type) {
-	case SK_GENESIS:
-		if (ifp->if_flags & IFF_PROMISC) {
-			SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_PROMISC);
-		} else {
-			SK_XM_CLRBIT_4(sc_if, XM_MODE, XM_MODE_RX_PROMISC);
-		}
-		break;
-	case SK_YUKON:
-	case SK_YUKON_LITE:
-	case SK_YUKON_LP:
-		if (ifp->if_flags & IFF_PROMISC) {
-			SK_YU_CLRBIT_2(sc_if, YUKON_RCR,
-			    YU_RCR_UFLEN | YU_RCR_MUFLEN);
-		} else {
-			SK_YU_SETBIT_2(sc_if, YUKON_RCR,
-			    YU_RCR_UFLEN | YU_RCR_MUFLEN);
+	ifp = sc_if->sk_ifp;
+	mode = SK_YU_READ_2(sc_if, YUKON_RCR);
+	if (ifp->if_flags & IFF_PROMISC)
+		mode &= ~(YU_RCR_UFLEN | YU_RCR_MUFLEN); 
+	else if (ifp->if_flags & IFF_ALLMULTI) {
+		mode |= YU_RCR_UFLEN | YU_RCR_MUFLEN; 
+		hashes[0] = 0xFFFFFFFF;
+		hashes[1] = 0xFFFFFFFF;
+	} else {
+		mode |= YU_RCR_UFLEN;
+		IF_ADDR_LOCK(ifp);
+		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+			if (ifma->ifma_addr->sa_family != AF_LINK)
+				continue;
+			crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
+			    ifma->ifma_addr), ETHER_ADDR_LEN);
+			/* Just want the 6 least significant bits. */
+			crc &= 0x3f;
+			/* Set the corresponding bit in the hash table. */
+			hashes[crc >> 5] |= 1 << (crc & 0x1f);
 		}
-		break;
+		IF_ADDR_UNLOCK(ifp);
+		if (hashes[0] != 0 || hashes[1] != 0)
+			mode |= YU_RCR_MUFLEN;
 	}
 
-	return;
+	SK_YU_WRITE_2(sc_if, YUKON_MCAH1, hashes[0] & 0xffff);
+	SK_YU_WRITE_2(sc_if, YUKON_MCAH2, (hashes[0] >> 16) & 0xffff);
+	SK_YU_WRITE_2(sc_if, YUKON_MCAH3, hashes[1] & 0xffff);
+	SK_YU_WRITE_2(sc_if, YUKON_MCAH4, (hashes[1] >> 16) & 0xffff);
+	SK_YU_WRITE_2(sc_if, YUKON_RCR, mode);
 }
 
 static int
@@ -1166,10 +1139,8 @@ sk_ioctl(ifp, command, data)
 		if (ifp->if_flags & IFF_UP) {
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 				if ((ifp->if_flags ^ sc_if->sk_if_flags)
-				    & IFF_PROMISC) {
-					sk_setpromisc(sc_if);
-					sk_setmulti(sc_if);
-				}
+				    & (IFF_PROMISC | IFF_ALLMULTI))
+					sk_rxfilter(sc_if);
 			} else
 				sk_init_locked(sc_if);
 		} else {
@@ -1183,7 +1154,7 @@ sk_ioctl(ifp, command, data)
 	case SIOCDELMULTI:
 		SK_IF_LOCK(sc_if);
 		if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-			sk_setmulti(sc_if);
+			sk_rxfilter(sc_if);
 		SK_IF_UNLOCK(sc_if);
 		break;
 	case SIOCGIFMEDIA:
@@ -3302,11 +3273,8 @@ sk_init_xmac(sc_if)
 	 */
 	SK_XM_WRITE_2(sc_if, XM_TX_REQTHRESH, SK_XM_TX_FIFOTHRESH);
 
-	/* Set promiscuous mode */
-	sk_setpromisc(sc_if);
-
-	/* Set multicast filter */
-	sk_setmulti(sc_if);
+	/* Set Rx filter */
+	sk_rxfilter_genesis(sc_if);
 
 	/* Clear and enable interrupts */
 	SK_XM_READ_2(sc_if, XM_ISR);
@@ -3447,11 +3415,8 @@ sk_init_yukon(sc_if)
 		SK_YU_WRITE_2(sc_if, YUKON_SAL2 + i * 4, reg);
 	}
 
-	/* Set promiscuous mode */
-	sk_setpromisc(sc_if);
-
-	/* Set multicast filter */
-	sk_setmulti(sc_if);
+	/* Set Rx filter */
+	sk_rxfilter_yukon(sc_if);
 
 	/* enable interrupt mask for counter overflows */
 	SK_YU_WRITE_2(sc_if, YUKON_TIMR, 0);

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 08:03:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3EB6A1065679;
	Fri,  1 May 2009 08:03:47 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2BB0A8FC16;
	Fri,  1 May 2009 08:03:47 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4183lUH036019;
	Fri, 1 May 2009 08:03:47 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4183kGE036016;
	Fri, 1 May 2009 08:03:46 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200905010803.n4183kGE036016@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 1 May 2009 08:03:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191717 - head/sys/dev/ata
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 08:03:47 -0000

Author: mav
Date: Fri May  1 08:03:46 2009
New Revision: 191717
URL: http://svn.freebsd.org/changeset/base/191717

Log:
  Improve kernel dumping reliability for busy ATA channels:
   - Generate fake channel interrupts even if channel busy with previous
  request to let it finish. Without this, dumping requests were just queued
  and never processed.
   - Drop pre-dump requests queue on dumping. ATA code, working in dumping
  (interruptless) mode, unable to handle long request queue. Actually, to get
  coherent dump we anyway should do as few unrelated actions as possible.

Modified:
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-disk.c
  head/sys/dev/ata/ata-queue.c

Modified: head/sys/dev/ata/ata-all.h
==============================================================================
--- head/sys/dev/ata/ata-all.h	Fri May  1 03:24:03 2009	(r191716)
+++ head/sys/dev/ata/ata-all.h	Fri May  1 08:03:46 2009	(r191717)
@@ -584,6 +584,7 @@ void ata_finish(struct ata_request *requ
 void ata_timeout(struct ata_request *);
 void ata_catch_inflight(device_t dev);
 void ata_fail_requests(device_t dev);
+void ata_drop_requests(device_t dev);
 char *ata_cmd2str(struct ata_request *request);
 
 /* ata-lowlevel.c: */

Modified: head/sys/dev/ata/ata-disk.c
==============================================================================
--- head/sys/dev/ata/ata-disk.c	Fri May  1 03:24:03 2009	(r191716)
+++ head/sys/dev/ata/ata-disk.c	Fri May  1 08:03:46 2009	(r191717)
@@ -346,15 +346,23 @@ ad_dump(void *arg, void *virtual, vm_off
 	off_t offset, size_t length)
 {
     struct disk *dp = arg;
+    device_t dev = dp->d_drv1;
     struct bio bp;
 
+    /* XXX: Drop pre-dump request queue. Long request queue processing
+     * causes stack overflow in ATA working in dumping (interruptless) mode.
+     * Conter-XXX: To make dump coherent we should avoid doing anything
+     * else while dumping.
+     */
+    ata_drop_requests(dev);
+
     /* length zero is special and really means flush buffers to media */
     if (!length) {
-        struct ata_device *atadev = device_get_softc(dp->d_drv1);
+        struct ata_device *atadev = device_get_softc(dev);
 	int error = 0;
 
 	if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE)
-	    error = ata_controlcmd(dp->d_drv1, ATA_FLUSHCACHE, 0, 0, 0);
+	    error = ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0);
 	return error;
     }
 

Modified: head/sys/dev/ata/ata-queue.c
==============================================================================
--- head/sys/dev/ata/ata-queue.c	Fri May  1 03:24:03 2009	(r191716)
+++ head/sys/dev/ata/ata-queue.c	Fri May  1 08:03:46 2009	(r191717)
@@ -218,20 +218,17 @@ ata_start(device_t dev)
 		    ata_finish(request);
 		    return;
 		}
-		if (dumping) {
-		    mtx_unlock(&ch->state_mtx);
-		    mtx_unlock(&ch->queue_mtx);
-		    while (ch->running) {
-			ata_interrupt(ch);
-			DELAY(10);
-		    }
-		    return;
-		}       
 	    }
 	    mtx_unlock(&ch->state_mtx);
 	}
     }
     mtx_unlock(&ch->queue_mtx);
+    if (dumping) {
+	while (ch->running) {
+	    ata_interrupt(ch);
+	    DELAY(10);
+	}
+    }
 }
 
 void
@@ -560,6 +557,24 @@ ata_fail_requests(device_t dev)
     }
 }
 
+/*
+ * Rudely drop all requests queued to the channel of specified device.
+ * XXX: The requests are leaked, use only in fatal case.
+ */
+void
+ata_drop_requests(device_t dev)
+{
+    struct ata_channel *ch = device_get_softc(device_get_parent(dev));
+    struct ata_request *request, *tmp;
+
+    mtx_lock(&ch->queue_mtx);
+    TAILQ_FOREACH_SAFE(request, &ch->ata_queue, chain, tmp) {
+	TAILQ_REMOVE(&ch->ata_queue, request, chain);
+	request->result = ENXIO;
+    }
+    mtx_unlock(&ch->queue_mtx);
+}
+
 static u_int64_t
 ata_get_lba(struct ata_request *request)
 {

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 08:15:38 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 223A8106564A;
	Fri,  1 May 2009 08:15:38 +0000 (UTC)
	(envelope-from phk@critter.freebsd.dk)
Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222])
	by mx1.freebsd.org (Postfix) with ESMTP id 774A38FC1E;
	Fri,  1 May 2009 08:15:34 +0000 (UTC)
	(envelope-from phk@critter.freebsd.dk)
Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3])
	by phk.freebsd.dk (Postfix) with ESMTP id 4280578CCF;
	Fri,  1 May 2009 08:15:33 +0000 (UTC)
Received: from critter.freebsd.dk (localhost [127.0.0.1])
	by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id n418FWbE048417;
	Fri, 1 May 2009 08:15:32 GMT (envelope-from phk@critter.freebsd.dk)
To: Alexander Motin 
From: "Poul-Henning Kamp" 
In-Reply-To: Your message of "Fri, 01 May 2009 08:03:46 GMT."
	<200905010803.n4183kGE036016@svn.freebsd.org> 
Date: Fri, 01 May 2009 08:15:32 +0000
Message-ID: <48416.1241165732@critter.freebsd.dk>
Sender: phk@critter.freebsd.dk
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r191717 - head/sys/dev/ata 
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 08:15:38 -0000

In message <200905010803.n4183kGE036016@svn.freebsd.org>, Alexander Motin write
s:

>   - Drop pre-dump requests queue on dumping. ATA code, working in dumping
>  (interruptless) mode, unable to handle long request queue. Actually, to get
>  coherent dump we anyway should do as few unrelated actions as possible.

It seems a wrong tradeoff to me, to favour dump fidelity over filesystem
coherence.

Poul-Henning

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 08:32:07 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 411561065675;
	Fri,  1 May 2009 08:32:07 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 545CC8FC19;
	Fri,  1 May 2009 08:32:05 +0000 (UTC) (envelope-from mav@FreeBSD.org)
X-Spam-Flag: SKIP
X-Spam-Yversion: Spamooborona-2.1.0
Received: from [212.86.226.226] (account mav@alkar.net HELO
	mavbook.mavhome.dp.ua)
	by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9)
	with ESMTPSA id 241749955; Fri, 01 May 2009 11:32:05 +0300
Message-ID: <49FAB383.2010904@FreeBSD.org>
Date: Fri, 01 May 2009 11:32:03 +0300
From: Alexander Motin 
User-Agent: Thunderbird 2.0.0.21 (X11/20090405)
MIME-Version: 1.0
To: Poul-Henning Kamp 
References: <48416.1241165732@critter.freebsd.dk>
In-Reply-To: <48416.1241165732@critter.freebsd.dk>
Content-Type: text/plain; charset=KOI8-R; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r191717 - head/sys/dev/ata
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 08:32:08 -0000

Poul-Henning Kamp wrote:
> In message <200905010803.n4183kGE036016@svn.freebsd.org>, Alexander Motin write
> s:
> 
>>   - Drop pre-dump requests queue on dumping. ATA code, working in dumping
>>  (interruptless) mode, unable to handle long request queue. Actually, to get
>>  coherent dump we anyway should do as few unrelated actions as possible.
> 
> It seems a wrong tradeoff to me, to favour dump fidelity over filesystem
> coherence.

When dump is disabled, queued requests are trashed anyway. Dump does not 
make the things worse then they are. It just does it's duty as good as 
possible and as simple as possible.

There is no any warranty that completing all queued requests will make 
filesystem more coherent, it easily can happen opposite. Also, as soon 
as current system state is known to be invalid (as kernel has just 
panicked), it could be safer do not try to make any excessive movements.

-- 
Alexander Motin

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 11:05:25 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1BC3F106567A;
	Fri,  1 May 2009 11:05:25 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 086E58FC1C;
	Fri,  1 May 2009 11:05:25 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41B5O28041308;
	Fri, 1 May 2009 11:05:24 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41B5OUY041307;
	Fri, 1 May 2009 11:05:24 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200905011105.n41B5OUY041307@svn.freebsd.org>
From: Bruce M Simpson 
Date: Fri, 1 May 2009 11:05:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191718 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 11:05:26 -0000

Author: bms
Date: Fri May  1 11:05:24 2009
New Revision: 191718
URL: http://svn.freebsd.org/changeset/base/191718

Log:
  Limit scope of acquisition of INP_RLOCK for multicast input filter
  to the scope of its use, even though this may thrash the lock if
  the INP is referenced for other purposes.
  
  Tested by:	David Wolfskill

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c	Fri May  1 08:03:46 2009	(r191717)
+++ head/sys/netinet6/udp6_usrreq.c	Fri May  1 11:05:24 2009	(r191718)
@@ -279,8 +279,6 @@ udp6_input(struct mbuf **mp, int *offp, 
 					continue;
 			}
 
-			INP_RLOCK(inp);
-
 			/*
 			 * Handle socket delivery policy for any-source
 			 * and source-specific multicast. [RFC3678]
@@ -290,6 +288,8 @@ udp6_input(struct mbuf **mp, int *offp, 
 				struct sockaddr_in6	 mcaddr;
 				int			 blocked;
 
+				INP_RLOCK(inp);
+
 				bzero(&mcaddr, sizeof(struct sockaddr_in6));
 				mcaddr.sin6_len = sizeof(struct sockaddr_in6);
 				mcaddr.sin6_family = AF_INET6;
@@ -304,9 +304,11 @@ udp6_input(struct mbuf **mp, int *offp, 
 					if (blocked == MCAST_NOTSMEMBER ||
 					    blocked == MCAST_MUTED)
 						UDPSTAT_INC(udps_filtermcast);
-					INP_RUNLOCK(inp);
+					INP_RUNLOCK(inp); /* XXX */
 					continue;
 				}
+
+				INP_RUNLOCK(inp);
 			}
 			if (last != NULL) {
 				struct mbuf *n;
@@ -423,8 +425,6 @@ udp6_input(struct mbuf **mp, int *offp, 
 	return (IPPROTO_DONE);
 
 badheadlocked:
-	if (inp)
-		INP_RUNLOCK(inp);
 	INP_INFO_RUNLOCK(&V_udbinfo);
 badunlocked:
 	if (m)

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 15:36:02 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A99641065674;
	Fri,  1 May 2009 15:36:02 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 957B88FC21;
	Fri,  1 May 2009 15:36:02 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41Fa2wd046455;
	Fri, 1 May 2009 15:36:02 GMT (envelope-from dchagin@svn.freebsd.org)
Received: (from dchagin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41Fa2fY046452;
	Fri, 1 May 2009 15:36:02 GMT (envelope-from dchagin@svn.freebsd.org)
Message-Id: <200905011536.n41Fa2fY046452@svn.freebsd.org>
From: Dmitry Chagin 
Date: Fri, 1 May 2009 15:36:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191719 - in head/sys: amd64/linux32 compat/linux
	i386/linux
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 15:36:04 -0000

Author: dchagin
Date: Fri May  1 15:36:02 2009
New Revision: 191719
URL: http://svn.freebsd.org/changeset/base/191719

Log:
  Reimplement futexes.
  Old implemention used Giant to protect the kernel data structures,
  but at the same time called malloc(M_WAITOK), that could cause the
  calling thread to sleep and lost Giant protection. User-visible
  result was the missed wakeup.
  
  New implementation uses one sx lock per futex. The sx protects
  the futex structures and allows to sleep while copyin or copyout
  are performed.
  
  Unlike linux, we return EINVAL when FUTEX_CMP_REQUEUE operation
  is requested and either caller specified futexes are equial or
  second futex already exists. This is acceptable since the situation
  can only occur from the application error, and glibc falls back to
  old FUTEX_WAKE operation when FUTEX_CMP_REQUEUE returns an error.
  
  Approved by:	kib (mentor)
  MFC after:	1 month

Modified:
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/compat/linux/linux_futex.c
  head/sys/i386/linux/linux_sysvec.c

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- head/sys/amd64/linux32/linux32_sysvec.c	Fri May  1 11:05:24 2009	(r191718)
+++ head/sys/amd64/linux32/linux32_sysvec.c	Fri May  1 15:36:02 2009	(r191719)
@@ -128,7 +128,7 @@ static void	exec_linux_setregs(struct th
 static void	linux32_fixlimit(struct rlimit *rl, int which);
 
 extern LIST_HEAD(futex_list, futex) futex_list;
-extern struct sx futex_sx;
+extern struct mtx futex_mtx;
 
 static eventhandler_tag linux_exit_tag;
 static eventhandler_tag linux_schedtail_tag;
@@ -1117,7 +1117,7 @@ linux_elf_modevent(module_t mod, int typ
 			mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF);
 			sx_init(&emul_shared_lock, "emuldata->shared lock");
 			LIST_INIT(&futex_list);
-			sx_init(&futex_sx, "futex protection lock");
+			mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
 			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
 			    linux_proc_exit, NULL, 1000);
 			linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail,
@@ -1149,7 +1149,7 @@ linux_elf_modevent(module_t mod, int typ
 				linux_device_unregister_handler(*ldhp);
 			mtx_destroy(&emul_lock);
 			sx_destroy(&emul_shared_lock);
-			sx_destroy(&futex_sx);
+			mtx_destroy(&futex_mtx);
 			EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
 			EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag);
 			EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);

Modified: head/sys/compat/linux/linux_futex.c
==============================================================================
--- head/sys/compat/linux/linux_futex.c	Fri May  1 11:05:24 2009	(r191718)
+++ head/sys/compat/linux/linux_futex.c	Fri May  1 15:36:02 2009	(r191719)
@@ -62,419 +62,284 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
 #include 
 #include 
 
+MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes");
+MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futexes wp");
+
 struct futex;
 
 struct waiting_proc {
-	struct thread *wp_t;
-	struct futex *wp_new_futex;
+	uint32_t	wp_flags;
+	struct futex	*wp_futex;
 	TAILQ_ENTRY(waiting_proc) wp_list;
 };
+
 struct futex {
-	void   *f_uaddr;
-	int	f_refcount;
+	struct sx	f_lck;
+	uint32_t	*f_uaddr;
+	uint32_t	f_refcount;
 	LIST_ENTRY(futex) f_list;
 	TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc;
 };
 
 LIST_HEAD(futex_list, futex) futex_list;
-struct sx futex_sx;		/* this protects the LIST of futexes */
-
-#define FUTEX_LOCK sx_xlock(&futex_sx)
-#define FUTEX_UNLOCK sx_xunlock(&futex_sx)
 
-#define FUTEX_LOCKED	1
-#define FUTEX_UNLOCKED	0
-
-#define FUTEX_SYSTEM_LOCK mtx_lock(&Giant)
-#define FUTEX_SYSTEM_UNLOCK mtx_unlock(&Giant)
-
-static struct futex	*futex_get(void *, int);
-static void futex_put(struct futex *);
-static int futex_sleep(struct futex *, struct thread *, unsigned long);
-static int futex_wake(struct futex *, int, struct futex *, int);
-static int futex_atomic_op(struct thread *td, int encoded_op, caddr_t uaddr);
+#define FUTEX_LOCK(f)		sx_xlock(&(f)->f_lck)
+#define FUTEX_UNLOCK(f)		sx_xunlock(&(f)->f_lck)
+#define FUTEX_INIT(f)		sx_init_flags(&(f)->f_lck, "ftlk", 0)
+#define FUTEX_DESTROY(f)	sx_destroy(&(f)->f_lck)
+#define FUTEX_ASSERT_LOCKED(f)	sx_assert(&(f)->f_lck, SA_XLOCKED)
+
+struct mtx futex_mtx;			/* protects the futex list */
+#define FUTEXES_LOCK		mtx_lock(&futex_mtx)
+#define FUTEXES_UNLOCK		mtx_unlock(&futex_mtx)
+
+/* flags for futex_get() */
+#define FUTEX_CREATE_WP		0x1	/* create waiting_proc */
+#define FUTEX_DONTCREATE	0x2	/* don't create futex if not exists */
+#define FUTEX_DONTEXISTS	0x4	/* return EINVAL if futex exists */
+
+/* wp_flags */
+#define FUTEX_WP_REQUEUED	0x1	/* wp requeued - wp moved from wp_list
+					 * of futex where thread sleep to wp_list
+					 * of another futex.
+					 */
+#define FUTEX_WP_REMOVED	0x2	/* wp is woken up and removed from futex
+					 * wp_list to prevent double wakeup.
+					 */
 
 /* support.s */
-int futex_xchgl(int oparg, caddr_t uaddr, int *oldval);
-int futex_addl(int oparg, caddr_t uaddr, int *oldval);
-int futex_orl(int oparg, caddr_t uaddr, int *oldval);
-int futex_andl(int oparg, caddr_t uaddr, int *oldval);
-int futex_xorl(int oparg, caddr_t uaddr, int *oldval);
+int futex_xchgl(int oparg, uint32_t *uaddr, int *oldval);
+int futex_addl(int oparg, uint32_t *uaddr, int *oldval);
+int futex_orl(int oparg, uint32_t *uaddr, int *oldval);
+int futex_andl(int oparg, uint32_t *uaddr, int *oldval);
+int futex_xorl(int oparg, uint32_t *uaddr, int *oldval);
 
-int
-linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
+static void
+futex_put(struct futex *f, struct waiting_proc *wp)
 {
-	int val;
-	int ret;
-	struct l_timespec timeout = {0, 0};
-	int error = 0;
-	struct futex *f;
-	struct futex *newf;
-	int timeout_hz;
-	struct timeval tv = {0, 0};
-	struct futex *f2;
-	int op_ret;
-	struct linux_emuldata *em;
-
-#ifdef	DEBUG
-	if (ldebug(sys_futex))
-		printf(ARGS(futex, "%p, %i, %i, *, %p, %i"), args->uaddr, args->op,
-		    args->val, args->uaddr2, args->val3);
-#endif
-
-	/* 
-	 * Our implementation provides only privates futexes. Most of the apps
-	 * should use private futexes but don't claim so. Therefore we treat
-	 * all futexes as private by clearing the FUTEX_PRIVATE_FLAG. It works
-	 * in most cases (ie. when futexes are not shared on file descriptor
-	 * or between different processes.).
-	 */
-	args->op = (args->op & ~LINUX_FUTEX_PRIVATE_FLAG);
 
-	switch (args->op) {
-	case LINUX_FUTEX_WAIT:
-		FUTEX_SYSTEM_LOCK;
-
-		if ((error = copyin(args->uaddr,
-		    &val, sizeof(val))) != 0) {
-			FUTEX_SYSTEM_UNLOCK;
-			return error;
-		}
-
-		if (val != args->val) {
-			FUTEX_SYSTEM_UNLOCK;
-			return EWOULDBLOCK;
-		}
-
-		if (args->timeout != NULL) {
-			if ((error = copyin(args->timeout,
-			    &timeout, sizeof(timeout))) != 0) {
-				FUTEX_SYSTEM_UNLOCK;
-				return error;
-			}
-		}
-
-#ifdef DEBUG
-		if (ldebug(sys_futex))
-			printf("FUTEX_WAIT %d: val = %d, uaddr = %p, "
-			    "*uaddr = %d, timeout = %d.%09lu\n",
-			    td->td_proc->p_pid, args->val,
-			    args->uaddr, val, timeout.tv_sec,
-			    (unsigned long)timeout.tv_nsec);
-#endif
-		tv.tv_usec = timeout.tv_sec * 1000000 + timeout.tv_nsec / 1000;
-		timeout_hz = tvtohz(&tv);
-
-		if (timeout.tv_sec == 0 && timeout.tv_nsec == 0)
-			timeout_hz = 0;
-		/*
-		 * If the user process requests a non null timeout,
-		 * make sure we do not turn it into an infinite
-		 * timeout because timeout_hz gets null.
-		 *
-		 * We use a minimal timeout of 1/hz. Maybe it would
-		 * make sense to just return ETIMEDOUT without sleeping.
-		 */
-		if (((timeout.tv_sec != 0) || (timeout.tv_nsec != 0)) &&
-		    (timeout_hz == 0))
-			timeout_hz = 1;
-
-
-		f = futex_get(args->uaddr, FUTEX_UNLOCKED);
-		ret = futex_sleep(f, td, timeout_hz);
-		futex_put(f);
-
-#ifdef DEBUG
-		if (ldebug(sys_futex))
-			printf("FUTEX_WAIT %d: uaddr = %p, "
-			    "ret = %d\n", td->td_proc->p_pid, args->uaddr, ret);
-#endif
-
-		FUTEX_SYSTEM_UNLOCK;
-		switch (ret) {
-		case EWOULDBLOCK:	/* timeout */
-			return ETIMEDOUT;
-			break;
-		case EINTR:		/* signal */
-			return EINTR;
-			break;
-		case 0:		/* FUTEX_WAKE received */
-#ifdef DEBUG
-			if (ldebug(sys_futex))
-				printf("FUTEX_WAIT %d: uaddr = %p, "
-				    "got FUTEX_WAKE\n",
-				    td->td_proc->p_pid, args->uaddr);
-#endif
-			return 0;
-			break;
-		default:
-#ifdef DEBUG
-			if (ldebug(sys_futex))
-				printf("FUTEX_WAIT: unexpected ret = %d\n",
-				    ret);
-#endif
-			break;
-		}
-
-		/* NOTREACHED */
-		break;
-
-	case LINUX_FUTEX_WAKE:
-		FUTEX_SYSTEM_LOCK;
-
-		/*
-		 * XXX: Linux is able to cope with different addresses
-		 * corresponding to the same mapped memory in the sleeping
-		 * and waker process(es).
-		 */
-#ifdef DEBUG
-		if (ldebug(sys_futex))
-			printf("FUTEX_WAKE %d: uaddr = %p, val = %d\n",
-			    td->td_proc->p_pid, args->uaddr, args->val);
-#endif
-		f = futex_get(args->uaddr, FUTEX_UNLOCKED);
-		td->td_retval[0] = futex_wake(f, args->val, NULL, 0);
-		futex_put(f);
-
-		FUTEX_SYSTEM_UNLOCK;
-		break;
-
-	case LINUX_FUTEX_CMP_REQUEUE:
-		FUTEX_SYSTEM_LOCK;
+	FUTEX_ASSERT_LOCKED(f);
+	if (wp != NULL) {
+		if ((wp->wp_flags & FUTEX_WP_REMOVED) == 0)
+			TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
+		free(wp, M_FUTEX_WP);
+	}
 
-		if ((error = copyin(args->uaddr,
-		    &val, sizeof(val))) != 0) {
-			FUTEX_SYSTEM_UNLOCK;
-			return error;
-		}
+	FUTEXES_LOCK;
+	if (--f->f_refcount == 0) {
+		LIST_REMOVE(f, f_list);
+		FUTEXES_UNLOCK;
+		FUTEX_UNLOCK(f);
 
-		if (val != args->val3) {
-			FUTEX_SYSTEM_UNLOCK;
-			return EAGAIN;
-		}
+		FUTEX_DESTROY(f);
+		free(f, M_FUTEX);
+		return;
+	}
 
-		f = futex_get(args->uaddr, FUTEX_UNLOCKED);
-		newf = futex_get(args->uaddr2, FUTEX_UNLOCKED);
-		td->td_retval[0] = futex_wake(f, args->val, newf,
-		    (int)(unsigned long)args->timeout);
-		futex_put(f);
-		futex_put(newf);
+	FUTEXES_UNLOCK;
+	FUTEX_UNLOCK(f);
+}
 
-		FUTEX_SYSTEM_UNLOCK;
-		break;
+static int
+futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags)
+{
+	struct futex *f, *tmpf;
 
-	case LINUX_FUTEX_WAKE_OP:
-		FUTEX_SYSTEM_LOCK;
-#ifdef DEBUG
-		if (ldebug(sys_futex))
-			printf("FUTEX_WAKE_OP: %d: uaddr = %p, op = %d, "
-			    "val = %x, uaddr2 = %p, val3 = %x\n",
-			    td->td_proc->p_pid, args->uaddr, args->op,
-			    args->val, args->uaddr2, args->val3);
-#endif
-		f = futex_get(args->uaddr, FUTEX_UNLOCKED);
-		f2 = futex_get(args->uaddr2, FUTEX_UNLOCKED);
+	*newf = tmpf = NULL;
 
-		/*
-		 * This function returns positive number as results and
-		 * negative as errors
-		 */
-		op_ret = futex_atomic_op(td, args->val3, args->uaddr2);
-#ifdef DEBUG
-		if (ldebug(sys_futex))
-			printf("futex_atomic_op ret %d\n", op_ret);
-#endif
-		if (op_ret < 0) {
-			/* XXX: We don't handle the EFAULT yet. */
-			if (op_ret != -EFAULT) {
-				futex_put(f);
-				futex_put(f2);
-				FUTEX_SYSTEM_UNLOCK;
-				return (-op_ret);
+retry:
+	FUTEXES_LOCK;
+	LIST_FOREACH(f, &futex_list, f_list) {
+		if (f->f_uaddr == uaddr) {
+			if (tmpf != NULL) {
+				FUTEX_UNLOCK(tmpf);
+				FUTEX_DESTROY(tmpf);
+				free(tmpf, M_FUTEX);
+			}
+			if (flags & FUTEX_DONTEXISTS) {
+				FUTEXES_UNLOCK;
+				return (EINVAL);
 			}
 
-			futex_put(f);
-			futex_put(f2);
-
-			FUTEX_SYSTEM_UNLOCK;
-			return (EFAULT);
-		}
-
-		ret = futex_wake(f, args->val, NULL, 0);
-		futex_put(f);
-		if (op_ret > 0) {
-			op_ret = 0;
 			/*
-			 * Linux abuses the address of the timespec parameter
-			 * as the number of retries.
+			 * Increment refcount of the found futex to
+			 * prevent it from deallocation before FUTEX_LOCK()
 			 */
-			op_ret += futex_wake(f2,
-			    (int)(unsigned long)args->timeout, NULL, 0);
-			ret += op_ret;
-		}
-		futex_put(f2);
-		td->td_retval[0] = ret;
-
-		FUTEX_SYSTEM_UNLOCK;
-		break;
-
-	case LINUX_FUTEX_LOCK_PI:
-		/* not yet implemented */
-		return (ENOSYS);
+			++f->f_refcount;
+			FUTEXES_UNLOCK;
 
-	case LINUX_FUTEX_UNLOCK_PI:
-		/* not yet implemented */
-		return (ENOSYS);
+			FUTEX_LOCK(f);
+			*newf = f;
+			return (0);
+		}
+	}
 
-	case LINUX_FUTEX_TRYLOCK_PI:
-		/* not yet implemented */
-		return (ENOSYS);
+	if (flags & FUTEX_DONTCREATE) {
+		FUTEXES_UNLOCK;
+		return (0);
+	}
 
-	case LINUX_FUTEX_REQUEUE:
+	if (tmpf == NULL) {
+		FUTEXES_UNLOCK;
+		tmpf = malloc(sizeof(*tmpf), M_FUTEX, M_WAITOK | M_ZERO);
+		tmpf->f_uaddr = uaddr;
+		tmpf->f_refcount = 1;
+		FUTEX_INIT(tmpf);
+		TAILQ_INIT(&tmpf->f_waiting_proc);
 
 		/*
-		 * Glibc does not use this operation since Jun 2004 (2.3.3),
-		 * as it is racy and replaced by FUTEX_CMP_REQUEUE operation.
-		 * Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when
-		 * FUTEX_REQUEUE returned EINVAL.
+		 * Lock the new futex before an insert into the futex_list
+		 * to prevent futex usage by other.
 		 */
-		em = em_find(td->td_proc, EMUL_DONTLOCK);
-		if (em->used_requeue == 0) {
-			printf("linux(%s (%d)) sys_futex: "
-			    "unsupported futex_requeue op\n",
-			    td->td_proc->p_comm, td->td_proc->p_pid);
-			em->used_requeue = 1;
-		}
-		return (EINVAL);
-
-	default:
-		printf("linux_sys_futex: unknown op %d\n",
-		    args->op);
-		return (ENOSYS);
+		FUTEX_LOCK(tmpf);
+		goto retry;
 	}
+
+	LIST_INSERT_HEAD(&futex_list, tmpf, f_list);
+	FUTEXES_UNLOCK;
+
+	*newf = tmpf;
 	return (0);
 }
 
-static struct futex *
-futex_get(void *uaddr, int locked)
+static int
+futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f,
+    uint32_t flags)
 {
-	struct futex *f;
+	int error;
 
-	if (locked == FUTEX_UNLOCKED)
-		FUTEX_LOCK;
-	LIST_FOREACH(f, &futex_list, f_list) {
-		if (f->f_uaddr == uaddr) {
-			f->f_refcount++;
-			if (locked == FUTEX_UNLOCKED)
-				FUTEX_UNLOCK;
-			return f;
-		}
+	if (flags & FUTEX_CREATE_WP) {
+		*wp = malloc(sizeof(struct waiting_proc), M_FUTEX_WP, M_WAITOK);
+		(*wp)->wp_flags = 0;
+	}
+	error = futex_get0(uaddr, f, flags);
+	if (error) {
+		if (flags & FUTEX_CREATE_WP)
+			free(*wp, M_FUTEX_WP);
+		return (error);
+	}
+	if (flags & FUTEX_CREATE_WP) {
+		TAILQ_INSERT_HEAD(&(*f)->f_waiting_proc, *wp, wp_list);
+		(*wp)->wp_futex = *f;
 	}
 
-	f = malloc(sizeof(*f), M_LINUX, M_WAITOK);
-	f->f_uaddr = uaddr;
-	f->f_refcount = 1;
-	TAILQ_INIT(&f->f_waiting_proc);
-	LIST_INSERT_HEAD(&futex_list, f, f_list);
-	if (locked == FUTEX_UNLOCKED)
-		FUTEX_UNLOCK;
-
-	return f;
+	return (error);
 }
 
-static void
-futex_put(f)
-	struct futex *f;
+static int
+futex_sleep(struct futex *f, struct waiting_proc *wp, unsigned long timeout)
 {
-	FUTEX_LOCK;
-	f->f_refcount--;
-	if (f->f_refcount == 0) {
-		LIST_REMOVE(f, f_list);
-		free(f, M_LINUX);
+	int error;
+
+	FUTEX_ASSERT_LOCKED(f);
+	error = sx_sleep(wp, &f->f_lck, PCATCH, "futex", timeout);
+	if (wp->wp_flags & FUTEX_WP_REQUEUED) {
+		KASSERT(f != wp->wp_futex, ("futex != wp_futex"));
+		futex_put(f, NULL);
+		f = wp->wp_futex;
+		FUTEX_LOCK(f);
 	}
-	FUTEX_UNLOCK;
 
-	return;
+	futex_put(f, wp);
+	return (error);
 }
 
 static int
-futex_sleep(struct futex *f, struct thread *td, unsigned long timeout)
+futex_wake(struct futex *f, int n)
 {
-	struct waiting_proc *wp;
-	int ret;
-
-	wp = malloc(sizeof(*wp), M_LINUX, M_WAITOK);
-	wp->wp_t = td;
-	wp->wp_new_futex = NULL;
-	FUTEX_LOCK;
-	TAILQ_INSERT_TAIL(&f->f_waiting_proc, wp, wp_list);
-	FUTEX_UNLOCK;
-
-#ifdef DEBUG
-	if (ldebug(sys_futex))
-		printf("FUTEX --> %d tlseep timeout = %ld\n",
-		    td->td_proc->p_pid, timeout);
-#endif
-	ret = tsleep(wp, PCATCH | PZERO, "linuxfutex", timeout);
-#ifdef DEBUG
-	if (ldebug(sys_futex))
-		printf("FUTEX -> %d tsleep returns %d\n",
-		    td->td_proc->p_pid, ret);
-#endif
+	struct waiting_proc *wp, *wpt;
+	int count = 0;
 
-	FUTEX_LOCK;
-	TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
-	FUTEX_UNLOCK;
-
-	/* if we got woken up in futex_wake */
-	if ((ret == 0) && (wp->wp_new_futex != NULL)) {
-		/* suspend us on the new futex */
-		ret = futex_sleep(wp->wp_new_futex, td, timeout);
-		/* and release the old one */
-		futex_put(wp->wp_new_futex);
+	FUTEX_ASSERT_LOCKED(f);
+	TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) {
+		wp->wp_flags |= FUTEX_WP_REMOVED;
+		TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
+		wakeup_one(wp);
+		if (++count == n)
+			break;
 	}
 
-	free(wp, M_LINUX);
-
-	return ret;
+	return (count);
 }
 
 static int
-futex_wake(struct futex *f, int n, struct futex *newf, int n2)
+futex_requeue(struct futex *f, int n, struct futex *f2, int n2)
 {
-	struct waiting_proc *wp;
-	int count;
+	struct waiting_proc *wp, *wpt;
+	int count = 0;
 
-	/*
-	 * Linux is very strange it wakes up N threads for
-	 * all operations BUT requeue ones where its N+1
-	 * mimic this.
-	 */
-	count = newf ? 0 : 1;
+	FUTEX_ASSERT_LOCKED(f);
+	FUTEX_ASSERT_LOCKED(f2);
 
-	FUTEX_LOCK;
-	TAILQ_FOREACH(wp, &f->f_waiting_proc, wp_list) {
-		if (count <= n) {
+	TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) {
+		if (++count <= n) {
+			wp->wp_flags |= FUTEX_WP_REMOVED;
+			TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
 			wakeup_one(wp);
-			count++;
 		} else {
-			if (newf != NULL) {
-				/* futex_put called after tsleep */
-				wp->wp_new_futex = futex_get(newf->f_uaddr,
-				    FUTEX_LOCKED);
-				wakeup_one(wp);
-				if (count - n >= n2)
-					break;
-			}
+			wp->wp_flags |= FUTEX_WP_REQUEUED;
+			/* Move wp to wp_list of f2 futex */
+			TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
+			TAILQ_INSERT_HEAD(&f2->f_waiting_proc, wp, wp_list);
+
+			/*
+			 * Thread which sleeps on wp after waking should
+			 * acquire f2 lock, so increment refcount of f2 to
+			 * prevent it from premature deallocation.
+			 */
+			wp->wp_futex = f2;
+			FUTEXES_LOCK;
+			++f2->f_refcount;
+			FUTEXES_UNLOCK;
+			if (count - n >= n2)
+				break;
 		}
 	}
-	FUTEX_UNLOCK;
 
-	return count;
+	return (count);
+}
+
+static int
+futex_wait(struct futex *f, struct waiting_proc *wp, struct l_timespec *ts)
+{
+	struct l_timespec timeout = {0, 0};
+	struct timeval tv = {0, 0};
+	int timeout_hz;
+	int error;
+
+	if (ts != NULL) {
+		error = copyin(ts, &timeout, sizeof(timeout));
+		if (error)
+			return (error);
+	}
+
+	tv.tv_usec = timeout.tv_sec * 1000000 + timeout.tv_nsec / 1000;
+	timeout_hz = tvtohz(&tv);
+
+	if (timeout.tv_sec == 0 && timeout.tv_nsec == 0)
+		timeout_hz = 0;
+
+	/*
+	 * If the user process requests a non null timeout,
+	 * make sure we do not turn it into an infinite
+	 * timeout because timeout_hz gets null.
+	 *
+	 * We use a minimal timeout of 1/hz. Maybe it would
+	 * make sense to just return ETIMEDOUT without sleeping.
+	 */
+	if (((timeout.tv_sec != 0) || (timeout.tv_nsec != 0)) &&
+	    (timeout_hz == 0))
+		timeout_hz = 1;
+
+	error = futex_sleep(f, wp, timeout_hz);
+	if (error == EWOULDBLOCK)
+		error = ETIMEDOUT;
+
+	return (error);
 }
 
 static int
-futex_atomic_op(struct thread *td, int encoded_op, caddr_t uaddr)
+futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr)
 {
 	int op = (encoded_op >> 28) & 7;
 	int cmp = (encoded_op >> 24) & 15;
@@ -536,14 +401,237 @@ futex_atomic_op(struct thread *td, int e
 }
 
 int
+linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
+{
+	int op_ret, val, ret, nrwake;
+	struct linux_emuldata *em;
+	struct waiting_proc *wp;
+	struct futex *f, *f2;
+	int error = 0;
+
+	/*
+	 * Our implementation provides only privates futexes. Most of the apps
+	 * should use private futexes but don't claim so. Therefore we treat
+	 * all futexes as private by clearing the FUTEX_PRIVATE_FLAG. It works
+	 * in most cases (ie. when futexes are not shared on file descriptor
+	 * or between different processes.).
+	 */
+	args->op = (args->op & ~LINUX_FUTEX_PRIVATE_FLAG);
+
+	switch (args->op) {
+	case LINUX_FUTEX_WAIT:
+
+#ifdef DEBUG
+		if (ldebug(sys_futex))
+			printf(ARGS(sys_futex, "futex_wait val %d uaddr %p"),
+			    args->val, args->uaddr);
+#endif
+		error = futex_get(args->uaddr, &wp, &f, FUTEX_CREATE_WP);
+		if (error)
+			return (error);
+		error = copyin(args->uaddr, &val, sizeof(val));
+		if (error) {
+			futex_put(f, wp);
+			return (error);
+		}
+		if (val != args->val) {
+#ifdef DEBUG
+			if (ldebug(sys_futex))
+				printf(ARGS(sys_futex, "futex_wait uaddr %p WHOOPS %d != %d"),
+				    args->uaddr, args->val, val);
+#endif
+			futex_put(f, wp);
+			return (EWOULDBLOCK);
+		}
+
+		error = futex_wait(f, wp, args->timeout);
+		break;
+
+	case LINUX_FUTEX_WAKE:
+
+		/*
+		 * XXX: Linux is able to cope with different addresses
+		 * corresponding to the same mapped memory in the sleeping
+		 * and waker process(es).
+		 */
+#ifdef DEBUG
+		if (ldebug(sys_futex))
+			printf(ARGS(sys_futex, "futex_wake val %d uaddr %p"),
+			    args->val, args->uaddr);
+#endif
+		error = futex_get(args->uaddr, NULL, &f, FUTEX_DONTCREATE);
+		if (error)
+			return (error);
+		if (f == NULL) {
+			td->td_retval[0] = 0;
+			return (error);;
+		}
+		td->td_retval[0] = futex_wake(f, args->val);
+		futex_put(f, NULL);
+		break;
+
+	case LINUX_FUTEX_CMP_REQUEUE:
+
+#ifdef DEBUG
+		if (ldebug(sys_futex))
+			printf(ARGS(sys_futex, "futex_cmp_requeue uaddr %p "
+			    "val %d val3 %d uaddr2 %p val2 %d"),
+			    args->uaddr, args->val, args->val3, args->uaddr2,
+			    (int)(unsigned long)args->timeout);
+#endif
+
+		/*
+		 * Linux allows this, we would not, it is an incorrect
+		 * usage of declared ABI, so return EINVAL.
+		 */
+		if (args->uaddr == args->uaddr2)
+			return (EINVAL);
+		error = futex_get0(args->uaddr, &f, 0);
+		if (error)
+			return (error);
+
+		/*
+		 * To avoid deadlocks return EINVAL if second futex
+		 * exists at this time. Otherwise create the new futex
+		 * and ignore false positive LOR which thus happens.
+		 *
+		 * Glibc fall back to FUTEX_WAKE in case of any error
+		 * returned by FUTEX_CMP_REQUEUE.
+		 */
+		error = futex_get0(args->uaddr2, &f2, FUTEX_DONTEXISTS);
+		if (error) {
+			futex_put(f, NULL);
+			return (error);
+		}
+		error = copyin(args->uaddr, &val, sizeof(val));
+		if (error) {
+			futex_put(f2, NULL);
+			futex_put(f, NULL);
+			return (error);
+		}
+		if (val != args->val3) {
+#ifdef DEBUG
+			if (ldebug(sys_futex))
+				printf(ARGS(sys_futex, "futex_cmp_requeue WHOOPS"
+				    " VAL %d != UVAL %d"), args->val, val);
+#endif
+			futex_put(f2, NULL);
+			futex_put(f, NULL);
+			return (EAGAIN);
+		}
+
+		nrwake = (int)(unsigned long)args->timeout;
+		td->td_retval[0] = futex_requeue(f, args->val, f2, nrwake);
+		futex_put(f2, NULL);
+		futex_put(f, NULL);
+		break;
+
+	case LINUX_FUTEX_WAKE_OP:
+
+#ifdef DEBUG
+		if (ldebug(sys_futex))
+			printf(ARGS(sys_futex, "futex_wake_op "
+			    "uaddr %p op %d val %x uaddr2 %p val3 %x"),
+			    args->uaddr, args->op, args->val,
+			    args->uaddr2, args->val3);
+#endif
+		error = futex_get0(args->uaddr, &f, 0);
+		if (error)
+			return (error);
+		if (args->uaddr != args->uaddr2)
+			error = futex_get0(args->uaddr2, &f2, 0);
+		if (error) {
+			futex_put(f, NULL);
+			return (error);
+		}
+
+		/*
+		 * This function returns positive number as results and
+		 * negative as errors
+		 */
+		op_ret = futex_atomic_op(td, args->val3, args->uaddr2);
+
+		if (op_ret < 0) {
+			/* XXX: We don't handle the EFAULT yet. */
+			if (op_ret != -EFAULT) {
+				if (f2 != NULL)
+					futex_put(f2, NULL);
+				futex_put(f, NULL);
+				return (-op_ret);
+			}
+			if (f2 != NULL)
+				futex_put(f2, NULL);
+			futex_put(f, NULL);
+			return (EFAULT);
+		}
+
+		ret = futex_wake(f, args->val);
+
+		if (op_ret > 0) {
+			op_ret = 0;
+			nrwake = (int)(unsigned long)args->timeout;
+
+			if (f2 != NULL)
+				op_ret += futex_wake(f2, nrwake);
+			else
+				op_ret += futex_wake(f, nrwake);
+			ret += op_ret;
+
+		}
+		if (f2 != NULL)
+			futex_put(f2, NULL);
+		futex_put(f, NULL);
+		td->td_retval[0] = ret;
+		break;
+
+	case LINUX_FUTEX_LOCK_PI:
+		/* not yet implemented */
+		return (ENOSYS);
+
+	case LINUX_FUTEX_UNLOCK_PI:
+		/* not yet implemented */
+		return (ENOSYS);
+
+	case LINUX_FUTEX_TRYLOCK_PI:
+		/* not yet implemented */
+		return (ENOSYS);
+
+	case LINUX_FUTEX_REQUEUE:
+
+		/*
+		 * Glibc does not use this operation since version 2.3.3,
+		 * as it is racy and replaced by FUTEX_CMP_REQUEUE operation.
+		 * Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when
+		 * FUTEX_REQUEUE returned EINVAL.
+		 */
+		em = em_find(td->td_proc, EMUL_DONTLOCK);
+		if (em->used_requeue == 0) {
+			printf("linux(%s (%d)) sys_futex: "
+			"unsupported futex_requeue op\n",
+			td->td_proc->p_comm, td->td_proc->p_pid);
+				em->used_requeue = 1;
+		}
+		return (EINVAL);
+
+	default:
+		printf("linux_sys_futex: unknown op %d\n", args->op);
+		return (ENOSYS);
+	}
+
+	return (error);
+}
+
+int
 linux_set_robust_list(struct thread *td, struct linux_set_robust_list_args *args)
 {
 	struct linux_emuldata *em;
 
-#ifdef	DEBUG
+#ifdef DEBUG
 	if (ldebug(set_robust_list))
-		printf(ARGS(set_robust_list, ""));
+		printf(ARGS(set_robust_list, "head %p len %d"),
+		    args->head, args->len);
 #endif
+
 	if (args->len != sizeof(struct linux_robust_list_head))
 		return (EINVAL);
 
@@ -598,16 +686,16 @@ linux_get_robust_list(struct thread *td,
 }
 
 static int
-handle_futex_death(void *uaddr, pid_t pid, int pi)
+handle_futex_death(struct proc *p, uint32_t *uaddr, int pi)
 {
-	int uval, nval, mval;
+	uint32_t uval, nval, mval;
 	struct futex *f;
+	int error;
 
 retry:
 	if (copyin(uaddr, &uval, 4))
 		return (EFAULT);
-
-	if ((uval & FUTEX_TID_MASK) == pid) {
+	if ((uval & FUTEX_TID_MASK) == p->p_pid) {
 		mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED;
 		nval = casuword32(uaddr, uval, mval);
 
@@ -618,8 +706,14 @@ retry:
 			goto retry;
 
 		if (!pi && (uval & FUTEX_WAITERS)) {
-			f = futex_get(uaddr, FUTEX_UNLOCKED);
-			futex_wake(f, 1, NULL, 0);
+			error = futex_get(uaddr, NULL, &f,
+			    FUTEX_DONTCREATE);
+			if (error)
+				return (error);
+			if (f != NULL) {
+				futex_wake(f, 1);
+				futex_put(f, NULL);
+			}
 		}
 	}
 
@@ -671,10 +765,8 @@ release_futexes(struct proc *p)
 		rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi);
 
 		if (entry != pending)
-			if (handle_futex_death((char *)entry + futex_offset,
-			    p->p_pid, pi))
+			if (handle_futex_death(p, (uint32_t *)entry + futex_offset, pi))
 				return;
-
 		if (rc)
 			return;
 
@@ -688,6 +780,5 @@ release_futexes(struct proc *p)
 	}
 
 	if (pending)
-		handle_futex_death((char *) pending + futex_offset,
-		    p->p_pid, pip);
+		handle_futex_death(p, (uint32_t *)pending + futex_offset, pip);
 }

Modified: head/sys/i386/linux/linux_sysvec.c
==============================================================================
--- head/sys/i386/linux/linux_sysvec.c	Fri May  1 11:05:24 2009	(r191718)
+++ head/sys/i386/linux/linux_sysvec.c	Fri May  1 15:36:02 2009	(r191719)
@@ -112,7 +112,7 @@ static int linux_szplatform;
 const char *linux_platform;
 
 extern LIST_HEAD(futex_list, futex) futex_list;
-extern struct sx futex_sx;
+extern struct mtx futex_mtx;
 
 static eventhandler_tag linux_exit_tag;
 static eventhandler_tag linux_schedtail_tag;
@@ -1083,7 +1083,7 @@ linux_elf_modevent(module_t mod, int typ
 			mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF);
 			sx_init(&emul_shared_lock, "emuldata->shared lock");
 			LIST_INIT(&futex_list);
-			sx_init(&futex_sx, "futex protection lock");
+			mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
 			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit,
 			      NULL, 1000);
 			linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, linux_schedtail,
@@ -1116,7 +1116,7 @@ linux_elf_modevent(module_t mod, int typ
 				linux_device_unregister_handler(*ldhp);
 			mtx_destroy(&emul_lock);
 			sx_destroy(&emul_shared_lock);
-			sx_destroy(&futex_sx);
+			mtx_destroy(&futex_mtx);
 			EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
 			EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag);
 			EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 17:05:49 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 912321065672;
	Fri,  1 May 2009 17:05:49 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 73C8C8FC16;
	Fri,  1 May 2009 17:05:49 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41H5nW7048232;
	Fri, 1 May 2009 17:05:49 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41H5nVm048230;
	Fri, 1 May 2009 17:05:49 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200905011705.n41H5nVm048230@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 1 May 2009 17:05:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191720 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 17:05:50 -0000

Author: mav
Date: Fri May  1 17:05:49 2009
New Revision: 191720
URL: http://svn.freebsd.org/changeset/base/191720

Log:
  Use value -1 instead of 0 for marking unused APIC vectors. This fixes
  IRQ0 routing on LAPIC-enabled systems.
  
  Add hint.apic.0.clock tunable. Setting it 0 disables using LAPIC timers
  as hard-/stat-/profclock sources falling back to using i8254 and rtc timers.
  
  On modern CPUs LAPIC is a part of CPU core which is shutting down when CPU
  enters C3 or deeper power state. It makes no problems for interrupt
  processing, as chipset wakes up CPU on interrupt triggering. But entering
  C3 state kills LAPIC timer and freezes system time, making C3 and deeper
  states practically unusable. Using i8254 timer allows to avoid this
  problem.
  
  By using i8254 timer my T7700 C2D CPU with UP kernel successfully enters
  C3 state, saving more then a Watt of total idle power (>10%) in addition to
  all other power-saving techniques.
  
  This technique is not working for SMP yet, as only one CPU receives
  timer interrupts. But I think that problem could be fixed by forwarding
  interrupts to other CPUs with IPI.

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

Modified: head/sys/amd64/amd64/local_apic.c
==============================================================================
--- head/sys/amd64/amd64/local_apic.c	Fri May  1 15:36:02 2009	(r191719)
+++ head/sys/amd64/amd64/local_apic.c	Fri May  1 17:05:49 2009	(r191720)
@@ -112,7 +112,7 @@ struct lapic {
 	u_long la_stat_ticks;
 	u_long la_prof_ticks;
 	/* Include IDT_SYSCALL to make indexing easier. */
-	u_int la_ioint_irqs[APIC_NUM_IOINTS + 1];
+	int la_ioint_irqs[APIC_NUM_IOINTS + 1];
 } static lapics[MAX_APIC_ID + 1];
 
 /* XXX: should thermal be an NMI? */
@@ -254,6 +254,8 @@ lapic_create(u_int apic_id, int boot_cpu
 		lapics[apic_id].la_lvts[i] = lvts[i];
 		lapics[apic_id].la_lvts[i].lvt_active = 0;
 	}
+	for (i = 0; i <= APIC_NUM_IOINTS; i++)
+	    lapics[apic_id].la_ioint_irqs[i] = -1;
 	lapics[apic_id].la_ioint_irqs[IDT_SYSCALL - APIC_IO_INTS] = IRQ_SYSCALL;
 	lapics[apic_id].la_ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] =
 	    IRQ_TIMER;
@@ -363,11 +365,15 @@ int
 lapic_setup_clock(void)
 {
 	u_long value;
+	int i;
 
 	/* Can't drive the timer without a local APIC. */
 	if (lapic == NULL)
 		return (0);
 
+	if (resource_int_value("apic", 0, "clock", &i) == 0 && i == 0)
+		return (0);
+
 	/* Start off with a divisor of 2 (power on reset default). */
 	lapic_timer_divisor = 2;
 
@@ -807,7 +813,7 @@ apic_alloc_vector(u_int apic_id, u_int i
 	 */
 	mtx_lock_spin(&icu_lock);
 	for (vector = 0; vector < APIC_NUM_IOINTS; vector++) {
-		if (lapics[apic_id].la_ioint_irqs[vector] != 0)
+		if (lapics[apic_id].la_ioint_irqs[vector] != -1)
 			continue;
 		lapics[apic_id].la_ioint_irqs[vector] = irq;
 		mtx_unlock_spin(&icu_lock);
@@ -847,7 +853,7 @@ apic_alloc_vectors(u_int apic_id, u_int 
 	for (vector = 0; vector < APIC_NUM_IOINTS; vector++) {
 
 		/* Vector is in use, end run. */
-		if (lapics[apic_id].la_ioint_irqs[vector] != 0) {
+		if (lapics[apic_id].la_ioint_irqs[vector] != -1) {
 			run = 0;
 			first = 0;
 			continue;
@@ -932,7 +938,7 @@ apic_free_vector(u_int apic_id, u_int ve
 	sched_bind(td, apic_cpuid(apic_id));
 	thread_unlock(td);
 	mtx_lock_spin(&icu_lock);
-	lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = 0;
+	lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1;
 	mtx_unlock_spin(&icu_lock);
 	thread_lock(td);
 	sched_unbind(td);
@@ -974,7 +980,7 @@ DB_SHOW_COMMAND(apic, db_show_apic)
 		db_printf("Interrupts bound to lapic %u\n", apic_id);
 		for (i = 0; i < APIC_NUM_IOINTS + 1 && !db_pager_quit; i++) {
 			irq = lapics[apic_id].la_ioint_irqs[i];
-			if (irq == 0 || irq == IRQ_SYSCALL)
+			if (irq == -1 || irq == IRQ_SYSCALL)
 				continue;
 			db_printf("vec 0x%2x -> ", i + APIC_IO_INTS);
 			if (irq == IRQ_TIMER)

Modified: head/sys/i386/i386/local_apic.c
==============================================================================
--- head/sys/i386/i386/local_apic.c	Fri May  1 15:36:02 2009	(r191719)
+++ head/sys/i386/i386/local_apic.c	Fri May  1 17:05:49 2009	(r191720)
@@ -112,7 +112,7 @@ struct lapic {
 	u_long la_stat_ticks;
 	u_long la_prof_ticks;
 	/* Include IDT_SYSCALL to make indexing easier. */
-	u_int la_ioint_irqs[APIC_NUM_IOINTS + 1];
+	int la_ioint_irqs[APIC_NUM_IOINTS + 1];
 } static lapics[MAX_APIC_ID + 1];
 
 /* XXX: should thermal be an NMI? */
@@ -256,6 +256,8 @@ lapic_create(u_int apic_id, int boot_cpu
 		lapics[apic_id].la_lvts[i] = lvts[i];
 		lapics[apic_id].la_lvts[i].lvt_active = 0;
 	}
+	for (i = 0; i <= APIC_NUM_IOINTS; i++)
+	    lapics[apic_id].la_ioint_irqs[i] = -1;
 	lapics[apic_id].la_ioint_irqs[IDT_SYSCALL - APIC_IO_INTS] = IRQ_SYSCALL;
 	lapics[apic_id].la_ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] =
 	    IRQ_TIMER;
@@ -365,11 +367,15 @@ int
 lapic_setup_clock(void)
 {
 	u_long value;
+	int i;
 
 	/* Can't drive the timer without a local APIC. */
 	if (lapic == NULL)
 		return (0);
 
+	if (resource_int_value("apic", 0, "clock", &i) == 0 && i == 0)
+		return (0);
+
 	/* Start off with a divisor of 2 (power on reset default). */
 	lapic_timer_divisor = 2;
 
@@ -809,7 +815,7 @@ apic_alloc_vector(u_int apic_id, u_int i
 	 */
 	mtx_lock_spin(&icu_lock);
 	for (vector = 0; vector < APIC_NUM_IOINTS; vector++) {
-		if (lapics[apic_id].la_ioint_irqs[vector] != 0)
+		if (lapics[apic_id].la_ioint_irqs[vector] != -1)
 			continue;
 		lapics[apic_id].la_ioint_irqs[vector] = irq;
 		mtx_unlock_spin(&icu_lock);
@@ -849,7 +855,7 @@ apic_alloc_vectors(u_int apic_id, u_int 
 	for (vector = 0; vector < APIC_NUM_IOINTS; vector++) {
 
 		/* Vector is in use, end run. */
-		if (lapics[apic_id].la_ioint_irqs[vector] != 0) {
+		if (lapics[apic_id].la_ioint_irqs[vector] != -1) {
 			run = 0;
 			first = 0;
 			continue;
@@ -936,7 +942,7 @@ apic_free_vector(u_int apic_id, u_int ve
 	sched_bind(td, apic_cpuid(apic_id));
 	thread_unlock(td);
 	mtx_lock_spin(&icu_lock);
-	lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = 0;
+	lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1;
 	mtx_unlock_spin(&icu_lock);
 	thread_lock(td);
 	sched_unbind(td);
@@ -978,7 +984,7 @@ DB_SHOW_COMMAND(apic, db_show_apic)
 		db_printf("Interrupts bound to lapic %u\n", apic_id);
 		for (i = 0; i < APIC_NUM_IOINTS + 1 && !db_pager_quit; i++) {
 			irq = lapics[apic_id].la_ioint_irqs[i];
-			if (irq == 0 || irq == IRQ_SYSCALL)
+			if (irq == -1 || irq == IRQ_SYSCALL)
 				continue;
 			db_printf("vec 0x%2x -> ", i + APIC_IO_INTS);
 			if (irq == IRQ_TIMER)

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 17:15:30 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 104C41065670;
	Fri,  1 May 2009 17:15:30 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D8DC68FC14;
	Fri,  1 May 2009 17:15:29 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41HFTL2048515;
	Fri, 1 May 2009 17:15:29 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41HFTRK048514;
	Fri, 1 May 2009 17:15:29 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905011715.n41HFTRK048514@svn.freebsd.org>
From: Sam Leffler 
Date: Fri, 1 May 2009 17:15:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191722 - head/sys/modules
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 17:15:30 -0000

Author: sam
Date: Fri May  1 17:15:29 2009
New Revision: 191722
URL: http://svn.freebsd.org/changeset/base/191722

Log:
  add ralfw

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile	Fri May  1 17:12:10 2009	(r191721)
+++ head/sys/modules/Makefile	Fri May  1 17:15:29 2009	(r191722)
@@ -218,6 +218,7 @@ SUBDIR=	${_3dfx} \
 	${_pst} \
 	puc \
 	ral \
+	ralfw \
 	${_random} \
 	rc4 \
 	${_rdma} \

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 17:16:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0F9BE106564A;
	Fri,  1 May 2009 17:16:34 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D857C8FC1D;
	Fri,  1 May 2009 17:16:33 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41HGX0q048580;
	Fri, 1 May 2009 17:16:33 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41HGXNj048579;
	Fri, 1 May 2009 17:16:33 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905011716.n41HGXNj048579@svn.freebsd.org>
From: Sam Leffler 
Date: Fri, 1 May 2009 17:16:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191723 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 17:16:34 -0000

Author: sam
Date: Fri May  1 17:16:33 2009
New Revision: 191723
URL: http://svn.freebsd.org/changeset/base/191723

Log:
  add uath

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Fri May  1 17:15:29 2009	(r191722)
+++ head/sys/conf/files	Fri May  1 17:16:33 2009	(r191723)
@@ -1604,6 +1604,7 @@ dev/usb/net/usb_ethernet.c \
 # USB WLAN drivers
 #
 dev/usb/wlan/if_rum.c		optional rum
+dev/usb/wlan/if_uath.c		optional uath
 dev/usb/wlan/if_ural.c		optional ural
 dev/usb/wlan/if_zyd.c		optional zyd
 #

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 17:17:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7FF59106566C;
	Fri,  1 May 2009 17:17:06 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6ECF98FC1E;
	Fri,  1 May 2009 17:17:06 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41HH6L7048629;
	Fri, 1 May 2009 17:17:06 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41HH6qG048628;
	Fri, 1 May 2009 17:17:06 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905011717.n41HH6qG048628@svn.freebsd.org>
From: Sam Leffler 
Date: Fri, 1 May 2009 17:17:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191724 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 17:17:07 -0000

Author: sam
Date: Fri May  1 17:17:06 2009
New Revision: 191724
URL: http://svn.freebsd.org/changeset/base/191724

Log:
  add uath; sort usb wireless drivers

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Fri May  1 17:16:33 2009	(r191723)
+++ head/sys/conf/NOTES	Fri May  1 17:17:06 2009	(r191724)
@@ -2474,14 +2474,17 @@ device		rue
 device		udav
 
 #
-# ZyDas ZD1211/ZD1211B wireless ethernet driver
-device		zyd
+# Ralink Technology RT2501USB/RT2601USB wireless driver
+device		rum
+#
+# Atheros AR5523 wireless driver
+device		uath
 #
-# Ralink Technology RT2500USB chispet driver
+# Ralink Technology RT2500USB wireless driver
 device		ural
 #
-# Ralink Technology RT2501USB/RT2601USB chispet driver
-device		rum
+# ZyDas ZD1211/ZD1211B wireless driver
+device		zyd
 
 # 
 # debugging options for the USB subsystem

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 17:18:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 30D12106566B;
	Fri,  1 May 2009 17:18:46 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1FABC8FC08;
	Fri,  1 May 2009 17:18:46 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41HIkEU048693;
	Fri, 1 May 2009 17:18:46 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41HIkRI048692;
	Fri, 1 May 2009 17:18:46 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905011718.n41HIkRI048692@svn.freebsd.org>
From: Sam Leffler 
Date: Fri, 1 May 2009 17:18:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191725 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 17:18:46 -0000

Author: sam
Date: Fri May  1 17:18:45 2009
New Revision: 191725
URL: http://svn.freebsd.org/changeset/base/191725

Log:
  add more tdma fixed rate defaults

Modified:
  head/sys/conf/options

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Fri May  1 17:17:06 2009	(r191724)
+++ head/sys/conf/options	Fri May  1 17:18:45 2009	(r191725)
@@ -800,6 +800,11 @@ TDMA_BINTVAL_DEFAULT	opt_tdma.h
 TDMA_TXRATE_11B_DEFAULT	opt_tdma.h
 TDMA_TXRATE_11G_DEFAULT	opt_tdma.h
 TDMA_TXRATE_11A_DEFAULT	opt_tdma.h
+TDMA_TXRATE_TURBO_DEFAULT	opt_tdma.h
+TDMA_TXRATE_HALF_DEFAULT	opt_tdma.h
+TDMA_TXRATE_QUARTER_DEFAULT	opt_tdma.h
+TDMA_TXRATE_11NA_DEFAULT	opt_tdma.h
+TDMA_TXRATE_11NG_DEFAULT	opt_tdma.h
 
 # Virtualize the network stack
 VIMAGE			opt_global.h

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 17:20:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CB28B1065674;
	Fri,  1 May 2009 17:20:16 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9F0ED8FC0A;
	Fri,  1 May 2009 17:20:16 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41HKGxZ048783;
	Fri, 1 May 2009 17:20:16 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41HKG0p048780;
	Fri, 1 May 2009 17:20:16 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905011720.n41HKG0p048780@svn.freebsd.org>
From: Sam Leffler 
Date: Fri, 1 May 2009 17:20:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191726 - in head/sys: amd64/conf i386/conf pc98/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 17:20:17 -0000

Author: sam
Date: Fri May  1 17:20:16 2009
New Revision: 191726
URL: http://svn.freebsd.org/changeset/base/191726

Log:
  o add uath
  o sort usb wireless drivers

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/i386/conf/GENERIC
  head/sys/pc98/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==============================================================================
--- head/sys/amd64/conf/GENERIC	Fri May  1 17:18:45 2009	(r191725)
+++ head/sys/amd64/conf/GENERIC	Fri May  1 17:20:16 2009	(r191726)
@@ -292,8 +292,10 @@ device		ukbd		# Keyboard
 device		ulpt		# Printer
 device		umass		# Disks/Mass storage - Requires scbus and da
 device		ums		# Mouse
-device		ural		# Ralink Technology RT2500USB wireless NICs
 device		rum		# Ralink Technology RT2501USB wireless NICs
+device		uath		# Atheros AR5523 wireless NICs
+device		ural		# Ralink Technology RT2500USB wireless NICs
+device		zyd		# ZyDAS zb1211/zb1211b wireless NICs
 device		urio		# Diamond Rio 500 MP3 player
 # USB Serial devices
 device		uark		# Technologies ARK3116 based serial adapters

Modified: head/sys/i386/conf/GENERIC
==============================================================================
--- head/sys/i386/conf/GENERIC	Fri May  1 17:18:45 2009	(r191725)
+++ head/sys/i386/conf/GENERIC	Fri May  1 17:20:16 2009	(r191726)
@@ -305,8 +305,9 @@ device		ukbd		# Keyboard
 device		ulpt		# Printer
 device		umass		# Disks/Mass storage - Requires scbus and da
 device		ums		# Mouse
-device		ural		# Ralink Technology RT2500USB wireless NICs
 device		rum		# Ralink Technology RT2501USB wireless NICs
+device		ural		# Ralink Technology RT2500USB wireless NICs
+device		uath		# Atheros AR5523 wireless NICs
 device		zyd		# ZyDAS zb1211/zb1211b wireless NICs
 device		urio		# Diamond Rio 500 MP3 player
 # USB Serial devices

Modified: head/sys/pc98/conf/GENERIC
==============================================================================
--- head/sys/pc98/conf/GENERIC	Fri May  1 17:18:45 2009	(r191725)
+++ head/sys/pc98/conf/GENERIC	Fri May  1 17:20:16 2009	(r191726)
@@ -261,8 +261,9 @@ device		bpf		# Berkeley packet filter
 #device		ulpt		# Printer
 #device		umass		# Disks/Mass storage - Requires scbus and da
 #device		ums		# Mouse
-#device		ural		# Ralink Technology RT2500USB wireless NICs
 #device		rum		# Ralink Technology RT2501USB wireless NICs
+#device		uath		# Atheros AR5523 wireless NICs
+#device		ural		# Ralink Technology RT2500USB wireless NICs
 #device		zyd		# ZyDAS zb1211/zb1211b wireless NICs
 #device		urio		# Diamond Rio 500 MP3 player
 # USB Serial devices

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 19:46:43 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E151106566B;
	Fri,  1 May 2009 19:46:43 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 421B58FC14;
	Fri,  1 May 2009 19:46:43 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41JkhAn051687;
	Fri, 1 May 2009 19:46:43 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41Jkhpu051686;
	Fri, 1 May 2009 19:46:43 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905011946.n41Jkhpu051686@svn.freebsd.org>
From: Andrew Thompson 
Date: Fri, 1 May 2009 19:46:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191729 - head/sys/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 19:46:43 -0000

Author: thompsa
Date: Fri May  1 19:46:42 2009
New Revision: 191729
URL: http://svn.freebsd.org/changeset/base/191729

Log:
  Reorder the bridge add and delete routines to avoid calling ifpromisc() with
  the bridge lock held.

Modified:
  head/sys/net/if_bridge.c

Modified: head/sys/net/if_bridge.c
==============================================================================
--- head/sys/net/if_bridge.c	Fri May  1 19:05:07 2009	(r191728)
+++ head/sys/net/if_bridge.c	Fri May  1 19:46:42 2009	(r191729)
@@ -893,29 +893,6 @@ bridge_delete_member(struct bridge_softc
 
 	BRIDGE_LOCK_ASSERT(sc);
 
-	if (!gone) {
-		switch (ifs->if_type) {
-		case IFT_ETHER:
-		case IFT_L2VLAN:
-			/*
-			 * Take the interface out of promiscuous mode.
-			 */
-			(void) ifpromisc(ifs, 0);
-			break;
-
-		case IFT_GIF:
-			break;
-
-		default:
-#ifdef DIAGNOSTIC
-			panic("bridge_delete_member: impossible");
-#endif
-			break;
-		}
-		/* reneable any interface capabilities */
-		bridge_set_ifcap(sc, bif, bif->bif_savedcaps);
-	}
-
 	if (bif->bif_flags & IFBIF_STP)
 		bstp_disable(&bif->bif_stp);
 
@@ -948,6 +925,28 @@ bridge_delete_member(struct bridge_softc
 	    ("%s: %d bridge routes referenced", __func__, bif->bif_addrcnt));
 
 	BRIDGE_UNLOCK(sc);
+	if (!gone) {
+		switch (ifs->if_type) {
+		case IFT_ETHER:
+		case IFT_L2VLAN:
+			/*
+			 * Take the interface out of promiscuous mode.
+			 */
+			(void) ifpromisc(ifs, 0);
+			break;
+
+		case IFT_GIF:
+			break;
+
+		default:
+#ifdef DIAGNOSTIC
+			panic("bridge_delete_member: impossible");
+#endif
+			break;
+		}
+		/* reneable any interface capabilities */
+		bridge_set_ifcap(sc, bif, bif->bif_savedcaps);
+	}
 	bstp_destroy(&bif->bif_stp);	/* prepare to free */
 	BRIDGE_LOCK(sc);
 	free(bif, M_DEVBUF);
@@ -1017,17 +1016,9 @@ bridge_ioctl_add(struct bridge_softc *sc
 	switch (ifs->if_type) {
 	case IFT_ETHER:
 	case IFT_L2VLAN:
-		/*
-		 * Place the interface into promiscuous mode.
-		 */
-		error = ifpromisc(ifs, 1);
-		if (error)
-			goto out;
-		break;
-
 	case IFT_GIF:
+		/* permitted interface types */
 		break;
-
 	default:
 		error = EINVAL;
 		goto out;
@@ -1055,6 +1046,20 @@ bridge_ioctl_add(struct bridge_softc *sc
 
 	/* Set interface capabilities to the intersection set of all members */
 	bridge_mutecaps(sc);
+
+	switch (ifs->if_type) {
+	case IFT_ETHER:
+	case IFT_L2VLAN:
+		/*
+		 * Place the interface into promiscuous mode.
+		 */
+		BRIDGE_UNLOCK(sc);
+		error = ifpromisc(ifs, 1);
+		BRIDGE_LOCK(sc);
+		break;
+	}
+	if (error)
+		bridge_delete_member(sc, bif, 0);
 out:
 	if (error) {
 		if (bif != NULL)

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 20:53:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6167A1065842;
	Fri,  1 May 2009 20:53:38 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4F2228FC13;
	Fri,  1 May 2009 20:53:38 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41KrcEF052978;
	Fri, 1 May 2009 20:53:38 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41KrcdL052976;
	Fri, 1 May 2009 20:53:38 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200905012053.n41KrcdL052976@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 1 May 2009 20:53:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191730 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 20:53:39 -0000

Author: mav
Date: Fri May  1 20:53:37 2009
New Revision: 191730
URL: http://svn.freebsd.org/changeset/base/191730

Log:
  Small addition to r191720.
  
  Restore previous behaviour for the case of unknown interrupt. Invocation
  of IRQ -1 crashes my system on resume. Returning 0, as it was, is not
  perfect also, but at least not so dangerous.

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

Modified: head/sys/amd64/amd64/local_apic.c
==============================================================================
--- head/sys/amd64/amd64/local_apic.c	Fri May  1 19:46:42 2009	(r191729)
+++ head/sys/amd64/amd64/local_apic.c	Fri May  1 20:53:37 2009	(r191730)
@@ -950,11 +950,15 @@ apic_free_vector(u_int apic_id, u_int ve
 u_int
 apic_idt_to_irq(u_int apic_id, u_int vector)
 {
+	int irq;
 
 	KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL &&
 	    vector <= APIC_IO_INTS + APIC_NUM_IOINTS,
 	    ("Vector %u does not map to an IRQ line", vector));
-	return (lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS]);
+	irq = lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS];
+	if (irq < 0)
+		irq = 0;
+	return (irq);
 }
 
 #ifdef DDB

Modified: head/sys/i386/i386/local_apic.c
==============================================================================
--- head/sys/i386/i386/local_apic.c	Fri May  1 19:46:42 2009	(r191729)
+++ head/sys/i386/i386/local_apic.c	Fri May  1 20:53:37 2009	(r191730)
@@ -954,11 +954,15 @@ apic_free_vector(u_int apic_id, u_int ve
 u_int
 apic_idt_to_irq(u_int apic_id, u_int vector)
 {
+	int irq;
 
 	KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL &&
 	    vector <= APIC_IO_INTS + APIC_NUM_IOINTS,
 	    ("Vector %u does not map to an IRQ line", vector));
-	return (lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS]);
+	irq = lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS];
+	if (irq < 0)
+		irq = 0;
+	return (irq);
 }
 
 #ifdef DDB

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 21:05:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5988410656D5;
	Fri,  1 May 2009 21:05:41 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 460F88FC15;
	Fri,  1 May 2009 21:05:41 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41L5fRV053282;
	Fri, 1 May 2009 21:05:41 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41L5eAP053273;
	Fri, 1 May 2009 21:05:40 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200905012105.n41L5eAP053273@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 1 May 2009 21:05:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191731 - head/sys/security/mac
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 21:05:42 -0000

Author: rwatson
Date: Fri May  1 21:05:40 2009
New Revision: 191731
URL: http://svn.freebsd.org/changeset/base/191731

Log:
  Rename MAC Framework-internal macros used to invoke policy entry points:
  
    MAC_BOOLEAN           -> MAC_POLICY_BOOLEAN
    MAC_BOOLEAN_NOSLEEP   -> MAC_POLICY_BOOLEANN_NOSLEEP
    MAC_CHECK             -> MAC_POLICY_CHECK
    MAC_CHECK_NOSLEEP     -> MAC_POLICY_CHECK_NOSLEEP
    MAC_EXTERNALIZE       -> MAC_POLICY_EXTERNALIZE
    MAC_GRANT             -> MAC_POLICY_GRANT
    MAC_GRANT_NOSLEEP     -> MAC_POLICY_GRANT_NOSLEEP
    MAC_INTERNALIZE       -> MAC_POLICY_INTERNALIZE
    MAC_PERFORM           -> MAC_POLICY_PERFORM_CHECK
    MAC_PERFORM_NOSLEEP   -> MAC_POLICY_PERFORM_NOSLEEP
  
  This frees up those macro names for use in wrapping calls into the MAC
  Framework from the remainder of the kernel.
  
  Obtained from:	TrustedBSD Project

Modified:
  head/sys/security/mac/mac_atalk.c
  head/sys/security/mac/mac_audit.c
  head/sys/security/mac/mac_cred.c
  head/sys/security/mac/mac_inet.c
  head/sys/security/mac/mac_inet6.c
  head/sys/security/mac/mac_internal.h
  head/sys/security/mac/mac_net.c
  head/sys/security/mac/mac_pipe.c
  head/sys/security/mac/mac_posix_sem.c
  head/sys/security/mac/mac_posix_shm.c
  head/sys/security/mac/mac_priv.c
  head/sys/security/mac/mac_process.c
  head/sys/security/mac/mac_socket.c
  head/sys/security/mac/mac_system.c
  head/sys/security/mac/mac_sysv_msg.c
  head/sys/security/mac/mac_sysv_sem.c
  head/sys/security/mac/mac_sysv_shm.c
  head/sys/security/mac/mac_vfs.c

Modified: head/sys/security/mac/mac_atalk.c
==============================================================================
--- head/sys/security/mac/mac_atalk.c	Fri May  1 20:53:37 2009	(r191730)
+++ head/sys/security/mac/mac_atalk.c	Fri May  1 21:05:40 2009	(r191731)
@@ -64,7 +64,7 @@ mac_netatalk_aarp_send(struct ifnet *ifp
 	mlabel = mac_mbuf_to_label(m);
 
 	MAC_IFNET_LOCK(ifp);
-	MAC_PERFORM_NOSLEEP(netatalk_aarp_send, ifp, ifp->if_label, m,
+	MAC_POLICY_PERFORM_NOSLEEP(netatalk_aarp_send, ifp, ifp->if_label, m,
 	    mlabel);
 	MAC_IFNET_UNLOCK(ifp);
 }

Modified: head/sys/security/mac/mac_audit.c
==============================================================================
--- head/sys/security/mac/mac_audit.c	Fri May  1 20:53:37 2009	(r191730)
+++ head/sys/security/mac/mac_audit.c	Fri May  1 21:05:40 2009	(r191731)
@@ -66,7 +66,7 @@ mac_cred_check_setaudit(struct ucred *cr
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setaudit, cred, ai);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setaudit, cred, ai);
 	MAC_CHECK_PROBE2(cred_check_setaudit, error, cred, ai);
 
 	return (error);
@@ -80,7 +80,7 @@ mac_cred_check_setaudit_addr(struct ucre
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setaudit_addr, cred, aia);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setaudit_addr, cred, aia);
 	MAC_CHECK_PROBE2(cred_check_setaudit_addr, error, cred, aia);
 
 	return (error);
@@ -93,7 +93,7 @@ mac_cred_check_setauid(struct ucred *cre
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setauid, cred, auid);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setauid, cred, auid);
 	MAC_CHECK_PROBE2(cred_check_setauid, error, cred, auid);
 
 	return (error);
@@ -107,7 +107,7 @@ mac_system_check_audit(struct ucred *cre
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(system_check_audit, cred, record, length);
+	MAC_POLICY_CHECK_NOSLEEP(system_check_audit, cred, record, length);
 	MAC_CHECK_PROBE3(system_check_audit, error, cred, record, length);
 
 	return (error);
@@ -125,7 +125,7 @@ mac_system_check_auditctl(struct ucred *
 	ASSERT_VOP_LOCKED(vp, "mac_system_check_auditctl");
 
 	vl = (vp != NULL) ? vp->v_label : NULL;
-	MAC_CHECK(system_check_auditctl, cred, vp, vl);
+	MAC_POLICY_CHECK(system_check_auditctl, cred, vp, vl);
 	MAC_CHECK_PROBE2(system_check_auditctl, error, cred, vp);
 
 	return (error);
@@ -138,7 +138,7 @@ mac_system_check_auditon(struct ucred *c
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(system_check_auditon, cred, cmd);
+	MAC_POLICY_CHECK_NOSLEEP(system_check_auditon, cred, cmd);
 	MAC_CHECK_PROBE2(system_check_auditon, error, cred, cmd);
 
 	return (error);

Modified: head/sys/security/mac/mac_cred.c
==============================================================================
--- head/sys/security/mac/mac_cred.c	Fri May  1 20:53:37 2009	(r191730)
+++ head/sys/security/mac/mac_cred.c	Fri May  1 21:05:40 2009	(r191731)
@@ -82,7 +82,7 @@ mac_cred_label_alloc(void)
 	struct label *label;
 
 	label = mac_labelzone_alloc(M_WAITOK);
-	MAC_PERFORM(cred_init_label, label);
+	MAC_POLICY_PERFORM(cred_init_label, label);
 	return (label);
 }
 
@@ -100,7 +100,7 @@ void
 mac_cred_label_free(struct label *label)
 {
 
-	MAC_PERFORM_NOSLEEP(cred_destroy_label, label);
+	MAC_POLICY_PERFORM_NOSLEEP(cred_destroy_label, label);
 	mac_labelzone_free(label);
 }
 
@@ -127,7 +127,7 @@ void
 mac_cred_associate_nfsd(struct ucred *cred)
 {
 
-	MAC_PERFORM_NOSLEEP(cred_associate_nfsd, cred);
+	MAC_POLICY_PERFORM_NOSLEEP(cred_associate_nfsd, cred);
 }
 
 /*
@@ -138,7 +138,7 @@ void
 mac_cred_create_swapper(struct ucred *cred)
 {
 
-	MAC_PERFORM_NOSLEEP(cred_create_swapper, cred);
+	MAC_POLICY_PERFORM_NOSLEEP(cred_create_swapper, cred);
 }
 
 /*
@@ -149,7 +149,7 @@ void
 mac_cred_create_init(struct ucred *cred)
 {
 
-	MAC_PERFORM_NOSLEEP(cred_create_init, cred);
+	MAC_POLICY_PERFORM_NOSLEEP(cred_create_init, cred);
 }
 
 int
@@ -158,7 +158,7 @@ mac_cred_externalize_label(struct label 
 {
 	int error;
 
-	MAC_EXTERNALIZE(cred, label, elements, outbuf, outbuflen);
+	MAC_POLICY_EXTERNALIZE(cred, label, elements, outbuf, outbuflen);
 
 	return (error);
 }
@@ -168,7 +168,7 @@ mac_cred_internalize_label(struct label 
 {
 	int error;
 
-	MAC_INTERNALIZE(cred, label, string);
+	MAC_POLICY_INTERNALIZE(cred, label, string);
 
 	return (error);
 }
@@ -182,7 +182,8 @@ void
 mac_cred_copy(struct ucred *src, struct ucred *dest)
 {
 
-	MAC_PERFORM_NOSLEEP(cred_copy_label, src->cr_label, dest->cr_label);
+	MAC_POLICY_PERFORM_NOSLEEP(cred_copy_label, src->cr_label,
+	    dest->cr_label);
 }
 
 /*
@@ -194,7 +195,7 @@ void
 mac_cred_relabel(struct ucred *cred, struct label *newlabel)
 {
 
-	MAC_PERFORM_NOSLEEP(cred_relabel, cred, newlabel);
+	MAC_POLICY_PERFORM_NOSLEEP(cred_relabel, cred, newlabel);
 }
 
 MAC_CHECK_PROBE_DEFINE2(cred_check_relabel, "struct ucred *",
@@ -205,7 +206,7 @@ mac_cred_check_relabel(struct ucred *cre
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_relabel, cred, newlabel);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_relabel, cred, newlabel);
 	MAC_CHECK_PROBE2(cred_check_relabel, error, cred, newlabel);
 
 	return (error);
@@ -218,7 +219,7 @@ mac_cred_check_setuid(struct ucred *cred
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setuid, cred, uid);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setuid, cred, uid);
 	MAC_CHECK_PROBE2(cred_check_setuid, error, cred, uid);
 
 	return (error);
@@ -231,7 +232,7 @@ mac_cred_check_seteuid(struct ucred *cre
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_seteuid, cred, euid);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_seteuid, cred, euid);
 	MAC_CHECK_PROBE2(cred_check_seteuid, error, cred, euid);
 
 	return (error);
@@ -244,7 +245,7 @@ mac_cred_check_setgid(struct ucred *cred
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setgid, cred, gid);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setgid, cred, gid);
 	MAC_CHECK_PROBE2(cred_check_setgid, error, cred, gid);
 
 	return (error);
@@ -257,7 +258,7 @@ mac_cred_check_setegid(struct ucred *cre
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setegid, cred, egid);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setegid, cred, egid);
 	MAC_CHECK_PROBE2(cred_check_setegid, error, cred, egid);
 
 	return (error);
@@ -271,7 +272,7 @@ mac_cred_check_setgroups(struct ucred *c
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setgroups, cred, ngroups, gidset);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setgroups, cred, ngroups, gidset);
 	MAC_CHECK_PROBE3(cred_check_setgroups, error, cred, ngroups, gidset);
 
 	return (error);
@@ -285,7 +286,7 @@ mac_cred_check_setreuid(struct ucred *cr
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setreuid, cred, ruid, euid);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setreuid, cred, ruid, euid);
 	MAC_CHECK_PROBE3(cred_check_setreuid, error, cred, ruid, euid);
 
 	return (error);
@@ -299,7 +300,7 @@ mac_cred_check_setregid(struct ucred *cr
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setregid, cred, rgid, egid);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setregid, cred, rgid, egid);
 	MAC_CHECK_PROBE3(cred_check_setregid, error, cred, rgid, egid);
 
 	return (error);
@@ -314,7 +315,7 @@ mac_cred_check_setresuid(struct ucred *c
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setresuid, cred, ruid, euid, suid);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setresuid, cred, ruid, euid, suid);
 	MAC_CHECK_PROBE4(cred_check_setresuid, error, cred, ruid, euid,
 	    suid);
 
@@ -330,7 +331,7 @@ mac_cred_check_setresgid(struct ucred *c
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_setresgid, cred, rgid, egid, sgid);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_setresgid, cred, rgid, egid, sgid);
 	MAC_CHECK_PROBE4(cred_check_setresgid, error, cred, rgid, egid,
 	    sgid);
 
@@ -345,7 +346,7 @@ mac_cred_check_visible(struct ucred *cr1
 {
 	int error;
 
-	MAC_CHECK_NOSLEEP(cred_check_visible, cr1, cr2);
+	MAC_POLICY_CHECK_NOSLEEP(cred_check_visible, cr1, cr2);
 	MAC_CHECK_PROBE2(cred_check_visible, error, cr1, cr2);
 
 	return (error);

Modified: head/sys/security/mac/mac_inet.c
==============================================================================
--- head/sys/security/mac/mac_inet.c	Fri May  1 20:53:37 2009	(r191730)
+++ head/sys/security/mac/mac_inet.c	Fri May  1 21:05:40 2009	(r191731)
@@ -85,11 +85,11 @@ mac_inpcb_label_alloc(int flag)
 	if (label == NULL)
 		return (NULL);
 	if (flag & M_WAITOK)
-		MAC_CHECK(inpcb_init_label, label, flag);
+		MAC_POLICY_CHECK(inpcb_init_label, label, flag);
 	else
-		MAC_CHECK_NOSLEEP(inpcb_init_label, label, flag);
+		MAC_POLICY_CHECK_NOSLEEP(inpcb_init_label, label, flag);
 	if (error) {
-		MAC_PERFORM_NOSLEEP(inpcb_destroy_label, label);
+		MAC_POLICY_PERFORM_NOSLEEP(inpcb_destroy_label, label);
 		mac_labelzone_free(label);
 		return (NULL);
 	}
@@ -120,11 +120,11 @@ mac_ipq_label_alloc(int flag)
 		return (NULL);
 
 	if (flag & M_WAITOK)
-		MAC_CHECK(ipq_init_label, label, flag);
+		MAC_POLICY_CHECK(ipq_init_label, label, flag);
 	else
-		MAC_CHECK_NOSLEEP(ipq_init_label, label, flag);
+		MAC_POLICY_CHECK_NOSLEEP(ipq_init_label, label, flag);
 	if (error) {
-		MAC_PERFORM_NOSLEEP(ipq_destroy_label, label);
+		MAC_POLICY_PERFORM_NOSLEEP(ipq_destroy_label, label);
 		mac_labelzone_free(label);
 		return (NULL);
 	}
@@ -148,7 +148,7 @@ static void
 mac_inpcb_label_free(struct label *label)
 {
 
-	MAC_PERFORM_NOSLEEP(inpcb_destroy_label, label);
+	MAC_POLICY_PERFORM_NOSLEEP(inpcb_destroy_label, label);
 	mac_labelzone_free(label);
 }
 
@@ -166,7 +166,7 @@ static void
 mac_ipq_label_free(struct label *label)
 {
 
-	MAC_PERFORM_NOSLEEP(ipq_destroy_label, label);
+	MAC_POLICY_PERFORM_NOSLEEP(ipq_destroy_label, label);
 	mac_labelzone_free(label);
 }
 
@@ -184,7 +184,7 @@ void
 mac_inpcb_create(struct socket *so, struct inpcb *inp)
 {
 
-	MAC_PERFORM_NOSLEEP(inpcb_create, so, so->so_label, inp,
+	MAC_POLICY_PERFORM_NOSLEEP(inpcb_create, so, so->so_label, inp,
 	    inp->inp_label);
 }
 
@@ -195,7 +195,8 @@ mac_ipq_reassemble(struct ipq *q, struct
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(ipq_reassemble, q, q->ipq_label, m, label);
+	MAC_POLICY_PERFORM_NOSLEEP(ipq_reassemble, q, q->ipq_label, m,
+	    label);
 }
 
 void
@@ -206,7 +207,8 @@ mac_netinet_fragment(struct mbuf *m, str
 	mlabel = mac_mbuf_to_label(m);
 	fraglabel = mac_mbuf_to_label(frag);
 
-	MAC_PERFORM_NOSLEEP(netinet_fragment, m, mlabel, frag, fraglabel);
+	MAC_POLICY_PERFORM_NOSLEEP(netinet_fragment, m, mlabel, frag,
+	    fraglabel);
 }
 
 void
@@ -216,7 +218,7 @@ mac_ipq_create(struct mbuf *m, struct ip
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(ipq_create, m, label, q, q->ipq_label);
+	MAC_POLICY_PERFORM_NOSLEEP(ipq_create, m, label, q, q->ipq_label);
 }
 
 void
@@ -227,7 +229,7 @@ mac_inpcb_create_mbuf(struct inpcb *inp,
 	INP_LOCK_ASSERT(inp);
 	mlabel = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(inpcb_create_mbuf, inp, inp->inp_label, m,
+	MAC_POLICY_PERFORM_NOSLEEP(inpcb_create_mbuf, inp, inp->inp_label, m,
 	    mlabel);
 }
 
@@ -240,7 +242,7 @@ mac_ipq_match(struct mbuf *m, struct ipq
 	label = mac_mbuf_to_label(m);
 
 	result = 1;
-	MAC_BOOLEAN_NOSLEEP(ipq_match, &&, m, label, q, q->ipq_label);
+	MAC_POLICY_BOOLEAN_NOSLEEP(ipq_match, &&, m, label, q, q->ipq_label);
 
 	return (result);
 }
@@ -253,7 +255,8 @@ mac_netinet_arp_send(struct ifnet *ifp, 
 	mlabel = mac_mbuf_to_label(m);
 
 	MAC_IFNET_LOCK(ifp);
-	MAC_PERFORM_NOSLEEP(netinet_arp_send, ifp, ifp->if_label, m, mlabel);
+	MAC_POLICY_PERFORM_NOSLEEP(netinet_arp_send, ifp, ifp->if_label, m,
+	    mlabel);
 	MAC_IFNET_UNLOCK(ifp);
 }
 
@@ -265,8 +268,8 @@ mac_netinet_icmp_reply(struct mbuf *mrec
 	mrecvlabel = mac_mbuf_to_label(mrecv);
 	msendlabel = mac_mbuf_to_label(msend);
 
-	MAC_PERFORM_NOSLEEP(netinet_icmp_reply, mrecv, mrecvlabel, msend,
-	    msendlabel);
+	MAC_POLICY_PERFORM_NOSLEEP(netinet_icmp_reply, mrecv, mrecvlabel,
+	    msend, msendlabel);
 }
 
 void
@@ -276,7 +279,7 @@ mac_netinet_icmp_replyinplace(struct mbu
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(netinet_icmp_replyinplace, m, label);
+	MAC_POLICY_PERFORM_NOSLEEP(netinet_icmp_replyinplace, m, label);
 }
 
 void
@@ -287,7 +290,7 @@ mac_netinet_igmp_send(struct ifnet *ifp,
 	mlabel = mac_mbuf_to_label(m);
 
 	MAC_IFNET_LOCK(ifp);
-	MAC_PERFORM_NOSLEEP(netinet_igmp_send, ifp, ifp->if_label, m,
+	MAC_POLICY_PERFORM_NOSLEEP(netinet_igmp_send, ifp, ifp->if_label, m,
 	    mlabel);
 	MAC_IFNET_UNLOCK(ifp);
 }
@@ -299,7 +302,7 @@ mac_netinet_tcp_reply(struct mbuf *m)
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(netinet_tcp_reply, m, label);
+	MAC_POLICY_PERFORM_NOSLEEP(netinet_tcp_reply, m, label);
 }
 
 void
@@ -309,7 +312,7 @@ mac_ipq_update(struct mbuf *m, struct ip
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(ipq_update, m, label, q, q->ipq_label);
+	MAC_POLICY_PERFORM_NOSLEEP(ipq_update, m, label, q, q->ipq_label);
 }
 
 MAC_CHECK_PROBE_DEFINE2(inpcb_check_deliver, "struct inpcb *",
@@ -325,7 +328,7 @@ mac_inpcb_check_deliver(struct inpcb *in
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_CHECK_NOSLEEP(inpcb_check_deliver, inp, inp->inp_label, m,
+	MAC_POLICY_CHECK_NOSLEEP(inpcb_check_deliver, inp, inp->inp_label, m,
 	    label);
 	MAC_CHECK_PROBE2(inpcb_check_deliver, error, inp, m);
 
@@ -342,7 +345,8 @@ mac_inpcb_check_visible(struct ucred *cr
 
 	INP_LOCK_ASSERT(inp);
 
-	MAC_CHECK_NOSLEEP(inpcb_check_visible, cred, inp, inp->inp_label);
+	MAC_POLICY_CHECK_NOSLEEP(inpcb_check_visible, cred, inp,
+	    inp->inp_label);
 	MAC_CHECK_PROBE2(inpcb_check_visible, error, cred, inp);
 
 	return (error);
@@ -355,7 +359,7 @@ mac_inpcb_sosetlabel(struct socket *so, 
 	INP_WLOCK_ASSERT(inp);
 	SOCK_LOCK_ASSERT(so);
 
-	MAC_PERFORM_NOSLEEP(inpcb_sosetlabel, so, so->so_label, inp,
+	MAC_POLICY_PERFORM_NOSLEEP(inpcb_sosetlabel, so, so->so_label, inp,
 	    inp->inp_label);
 }
 
@@ -370,8 +374,8 @@ mac_netinet_firewall_reply(struct mbuf *
 	mrecvlabel = mac_mbuf_to_label(mrecv);
 	msendlabel = mac_mbuf_to_label(msend);
 
-	MAC_PERFORM_NOSLEEP(netinet_firewall_reply, mrecv, mrecvlabel, msend,
-	    msendlabel);
+	MAC_POLICY_PERFORM_NOSLEEP(netinet_firewall_reply, mrecv, mrecvlabel,
+	    msend, msendlabel);
 }
 
 void
@@ -383,7 +387,7 @@ mac_netinet_firewall_send(struct mbuf *m
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(netinet_firewall_send, m, label);
+	MAC_POLICY_PERFORM_NOSLEEP(netinet_firewall_send, m, label);
 }
 
 /*
@@ -400,7 +404,7 @@ mac_syncache_destroy(struct label **labe
 {
 
 	if (*label != NULL) {
-		MAC_PERFORM_NOSLEEP(syncache_destroy_label, *label);
+		MAC_POLICY_PERFORM_NOSLEEP(syncache_destroy_label, *label);
 		mac_labelzone_free(*label);
 		*label = NULL;
 	}
@@ -422,9 +426,11 @@ mac_syncache_init(struct label **label)
 		 * MAC_PERFORM so we can propagate allocation failures back
 		 * to the syncache code.
 		 */
-		MAC_CHECK_NOSLEEP(syncache_init_label, *label, M_NOWAIT);
+		MAC_POLICY_CHECK_NOSLEEP(syncache_init_label, *label,
+		    M_NOWAIT);
 		if (error) {
-			MAC_PERFORM_NOSLEEP(syncache_destroy_label, *label);
+			MAC_POLICY_PERFORM_NOSLEEP(syncache_destroy_label,
+			    *label);
 			mac_labelzone_free(*label);
 		}
 		return (error);
@@ -439,7 +445,7 @@ mac_syncache_create(struct label *label,
 
 	INP_WLOCK_ASSERT(inp);
 
-	MAC_PERFORM_NOSLEEP(syncache_create, label, inp);
+	MAC_POLICY_PERFORM_NOSLEEP(syncache_create, label, inp);
 }
 
 void
@@ -451,5 +457,6 @@ mac_syncache_create_mbuf(struct label *s
 
 	mlabel = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(syncache_create_mbuf, sc_label, m, mlabel);
+	MAC_POLICY_PERFORM_NOSLEEP(syncache_create_mbuf, sc_label, m,
+	    mlabel);
 }

Modified: head/sys/security/mac/mac_inet6.c
==============================================================================
--- head/sys/security/mac/mac_inet6.c	Fri May  1 20:53:37 2009	(r191730)
+++ head/sys/security/mac/mac_inet6.c	Fri May  1 21:05:40 2009	(r191731)
@@ -71,11 +71,11 @@ mac_ip6q_label_alloc(int flag)
 		return (NULL);
 
 	if (flag & M_WAITOK)
-		MAC_CHECK(ip6q_init_label, label, flag);
+		MAC_POLICY_CHECK(ip6q_init_label, label, flag);
 	else
-		MAC_CHECK_NOSLEEP(ip6q_init_label, label, flag);
+		MAC_POLICY_CHECK_NOSLEEP(ip6q_init_label, label, flag);
 	if (error) {
-		MAC_PERFORM_NOSLEEP(ip6q_destroy_label, label);
+		MAC_POLICY_PERFORM_NOSLEEP(ip6q_destroy_label, label);
 		mac_labelzone_free(label);
 		return (NULL);
 	}
@@ -99,7 +99,7 @@ static void
 mac_ip6q_label_free(struct label *label)
 {
 
-	MAC_PERFORM_NOSLEEP(ip6q_destroy_label, label);
+	MAC_POLICY_PERFORM_NOSLEEP(ip6q_destroy_label, label);
 	mac_labelzone_free(label);
 }
 
@@ -120,7 +120,8 @@ mac_ip6q_reassemble(struct ip6q *q6, str
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(ip6q_reassemble, q6, q6->ip6q_label, m, label);
+	MAC_POLICY_PERFORM_NOSLEEP(ip6q_reassemble, q6, q6->ip6q_label, m,
+	    label);
 }
 
 void
@@ -130,7 +131,8 @@ mac_ip6q_create(struct mbuf *m, struct i
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(ip6q_create, m, label, q6, q6->ip6q_label);
+	MAC_POLICY_PERFORM_NOSLEEP(ip6q_create, m, label, q6,
+	    q6->ip6q_label);
 }
 
 int
@@ -142,7 +144,8 @@ mac_ip6q_match(struct mbuf *m, struct ip
 	label = mac_mbuf_to_label(m);
 
 	result = 1;
-	MAC_BOOLEAN_NOSLEEP(ip6q_match, &&, m, label, q6, q6->ip6q_label);
+	MAC_POLICY_BOOLEAN_NOSLEEP(ip6q_match, &&, m, label, q6,
+	    q6->ip6q_label);
 
 	return (result);
 }
@@ -154,7 +157,8 @@ mac_ip6q_update(struct mbuf *m, struct i
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(ip6q_update, m, label, q6, q6->ip6q_label);
+	MAC_POLICY_PERFORM_NOSLEEP(ip6q_update, m, label, q6,
+	    q6->ip6q_label);
 }
 
 void
@@ -164,6 +168,6 @@ mac_netinet6_nd6_send(struct ifnet *ifp,
 
 	mlabel = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(netinet6_nd6_send, ifp, ifp->if_label, m,
+	MAC_POLICY_PERFORM_NOSLEEP(netinet6_nd6_send, ifp, ifp->if_label, m,
 	    mlabel);
 }

Modified: head/sys/security/mac/mac_internal.h
==============================================================================
--- head/sys/security/mac/mac_internal.h	Fri May  1 20:53:37 2009	(r191730)
+++ head/sys/security/mac/mac_internal.h	Fri May  1 21:05:40 2009	(r191731)
@@ -257,11 +257,11 @@ int	vn_setlabel(struct vnode *vp, struct
  * specific entry point.  They come in two forms: one which permits policies
  * to sleep/block, and another that does not.
  *
- * MAC_CHECK performs the designated check by walking the policy module list
- * and checking with each as to how it feels about the request.  Note that it
- * returns its value via 'error' in the scope of the caller.
+ * MAC_POLICY_CHECK performs the designated check by walking the policy
+ * module list and checking with each as to how it feels about the request.
+ * Note that it returns its value via 'error' in the scope of the caller.
  */
-#define	MAC_CHECK(check, args...) do {					\
+#define	MAC_POLICY_CHECK(check, args...) do {				\
 	struct mac_policy_conf *mpc;					\
 									\
 	error = 0;							\
@@ -283,7 +283,7 @@ int	vn_setlabel(struct vnode *vp, struct
 	}								\
 } while (0)
 
-#define	MAC_CHECK_NOSLEEP(check, args...) do {				\
+#define	MAC_POLICY_CHECK_NOSLEEP(check, args...) do {			\
 	struct mac_policy_conf *mpc;					\
 									\
 	error = 0;							\
@@ -306,13 +306,13 @@ int	vn_setlabel(struct vnode *vp, struct
 } while (0)
 
 /*
- * MAC_GRANT performs the designated check by walking the policy module list
- * and checking with each as to how it feels about the request.  Unlike
- * MAC_CHECK, it grants if any policies return '0', and otherwise returns
- * EPERM.  Note that it returns its value via 'error' in the scope of the
- * caller.
+ * MAC_POLICY_GRANT performs the designated check by walking the policy
+ * module list and checking with each as to how it feels about the request.
+ * Unlike MAC_POLICY_CHECK, it grants if any policies return '0', and
+ * otherwise returns EPERM.  Note that it returns its value via 'error' in
+ * the scope of the caller.
  */
-#define	MAC_GRANT_NOSLEEP(check, args...) do {				\
+#define	MAC_POLICY_GRANT_NOSLEEP(check, args...) do {			\
 	struct mac_policy_conf *mpc;					\
 									\
 	error = EPERM;							\
@@ -336,13 +336,13 @@ int	vn_setlabel(struct vnode *vp, struct
 } while (0)
 
 /*
- * MAC_BOOLEAN performs the designated boolean composition by walking the
- * module list, invoking each instance of the operation, and combining the
- * results using the passed C operator.  Note that it returns its value via
- * 'result' in the scope of the caller, which should be initialized by the
- * caller in a meaningful way to get a meaningful result.
+ * MAC_POLICY_BOOLEAN performs the designated boolean composition by walking
+ * the module list, invoking each instance of the operation, and combining
+ * the results using the passed C operator.  Note that it returns its value
+ * via 'result' in the scope of the caller, which should be initialized by
+ * the caller in a meaningful way to get a meaningful result.
  */
-#define	MAC_BOOLEAN(operation, composition, args...) do {		\
+#define	MAC_POLICY_BOOLEAN(operation, composition, args...) do {	\
 	struct mac_policy_conf *mpc;					\
 									\
 	LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) {		\
@@ -362,7 +362,7 @@ int	vn_setlabel(struct vnode *vp, struct
 	}								\
 } while (0)
 
-#define	MAC_BOOLEAN_NOSLEEP(operation, composition, args...) do {	\
+#define	MAC_POLICY_BOOLEAN_NOSLEEP(operation, composition, args...) do {\
 	struct mac_policy_conf *mpc;					\
 									\
 	LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) {		\
@@ -383,13 +383,13 @@ int	vn_setlabel(struct vnode *vp, struct
 } while (0)
 
 /*
- * MAC_EXTERNALIZE queries each policy to see if it can generate an
+ * MAC_POLICY_EXTERNALIZE queries each policy to see if it can generate an
  * externalized version of a label element by name.  Policies declare whether
  * they have matched a particular element name, parsed from the string by
- * MAC_EXTERNALIZE, and an error is returned if any element is matched by no
- * policy.
+ * MAC_POLICY_EXTERNALIZE, and an error is returned if any element is matched
+ * by no policy.
  */
-#define	MAC_EXTERNALIZE(type, label, elementlist, outbuf, 		\
+#define	MAC_POLICY_EXTERNALIZE(type, label, elementlist, outbuf, 	\
     outbuflen) do {							\
 	int claimed, first, ignorenotfound, savedlen;			\
 	char *element_name, *element_temp;				\
@@ -415,7 +415,7 @@ int	vn_setlabel(struct vnode *vp, struct
 			break;						\
 		}							\
 		claimed = 0;						\
-		MAC_CHECK(type ## _externalize_label, label,		\
+		MAC_POLICY_CHECK(type ## _externalize_label, label,	\
 		    element_name, &sb, &claimed);			\
 		if (error)						\
 			break;						\
@@ -433,11 +433,11 @@ int	vn_setlabel(struct vnode *vp, struct
 } while (0)
 
 /*
- * MAC_INTERNALIZE presents parsed element names and data to each policy to
- * see if any is willing to claim it and internalize the label data.  If no
- * policies match, an error is returned.
+ * MAC_POLICY_INTERNALIZE presents parsed element names and data to each
+ * policy to see if any is willing to claim it and internalize the label
+ * data.  If no policies match, an error is returned.
  */
-#define	MAC_INTERNALIZE(type, label, instring) do {			\
+#define	MAC_POLICY_INTERNALIZE(type, label, instring) do {		\
 	char *element, *element_name, *element_data;			\
 	int claimed;							\
 									\
@@ -451,7 +451,7 @@ int	vn_setlabel(struct vnode *vp, struct
 			break;						\
 		}							\
 		claimed = 0;						\
-		MAC_CHECK(type ## _internalize_label, label,		\
+		MAC_POLICY_CHECK(type ## _internalize_label, label,	\
 		    element_name, element_data, &claimed);		\
 		if (error)						\
 			break;						\
@@ -464,10 +464,10 @@ int	vn_setlabel(struct vnode *vp, struct
 } while (0)
 
 /*
- * MAC_PERFORM performs the designated operation by walking the policy module
- * list and invoking that operation for each policy.
+ * MAC_POLICY_PERFORM performs the designated operation by walking the policy
+ * module list and invoking that operation for each policy.
  */
-#define	MAC_PERFORM(operation, args...) do {				\
+#define	MAC_POLICY_PERFORM(operation, args...) do {			\
 	struct mac_policy_conf *mpc;					\
 									\
 	LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) {		\
@@ -484,7 +484,7 @@ int	vn_setlabel(struct vnode *vp, struct
 	}								\
 } while (0)
 
-#define	MAC_PERFORM_NOSLEEP(operation, args...) do {			\
+#define	MAC_POLICY_PERFORM_NOSLEEP(operation, args...) do {		\
 	struct mac_policy_conf *mpc;					\
 									\
 	LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) {		\

Modified: head/sys/security/mac/mac_net.c
==============================================================================
--- head/sys/security/mac/mac_net.c	Fri May  1 20:53:37 2009	(r191730)
+++ head/sys/security/mac/mac_net.c	Fri May  1 21:05:40 2009	(r191731)
@@ -110,7 +110,7 @@ mac_bpfdesc_label_alloc(void)
 	struct label *label;
 
 	label = mac_labelzone_alloc(M_WAITOK);
-	MAC_PERFORM(bpfdesc_init_label, label);
+	MAC_POLICY_PERFORM(bpfdesc_init_label, label);
 	return (label);
 }
 
@@ -130,7 +130,7 @@ mac_ifnet_label_alloc(void)
 	struct label *label;
 
 	label = mac_labelzone_alloc(M_WAITOK);
-	MAC_PERFORM(ifnet_init_label, label);
+	MAC_POLICY_PERFORM(ifnet_init_label, label);
 	return (label);
 }
 
@@ -154,11 +154,11 @@ mac_mbuf_tag_init(struct m_tag *tag, int
 	mac_init_label(label);
 
 	if (flag & M_WAITOK)
-		MAC_CHECK(mbuf_init_label, label, flag);
+		MAC_POLICY_CHECK(mbuf_init_label, label, flag);
 	else
-		MAC_CHECK_NOSLEEP(mbuf_init_label, label, flag);
+		MAC_POLICY_CHECK_NOSLEEP(mbuf_init_label, label, flag);
 	if (error) {
-		MAC_PERFORM_NOSLEEP(mbuf_destroy_label, label);
+		MAC_POLICY_PERFORM_NOSLEEP(mbuf_destroy_label, label);
 		mac_destroy_label(label);
 	}
 	return (error);
@@ -191,7 +191,7 @@ static void
 mac_bpfdesc_label_free(struct label *label)
 {
 
-	MAC_PERFORM_NOSLEEP(bpfdesc_destroy_label, label);
+	MAC_POLICY_PERFORM_NOSLEEP(bpfdesc_destroy_label, label);
 	mac_labelzone_free(label);
 }
 
@@ -209,7 +209,7 @@ static void
 mac_ifnet_label_free(struct label *label)
 {
 
-	MAC_PERFORM_NOSLEEP(ifnet_destroy_label, label);
+	MAC_POLICY_PERFORM_NOSLEEP(ifnet_destroy_label, label);
 	mac_labelzone_free(label);
 }
 
@@ -230,7 +230,7 @@ mac_mbuf_tag_destroy(struct m_tag *tag)
 
 	label = (struct label *)(tag+1);
 
-	MAC_PERFORM_NOSLEEP(mbuf_destroy_label, label);
+	MAC_POLICY_PERFORM_NOSLEEP(mbuf_destroy_label, label);
 	mac_destroy_label(label);
 }
 
@@ -250,7 +250,7 @@ mac_mbuf_tag_copy(struct m_tag *src, str
 	 * mac_mbuf_tag_init() is called on the target tag in m_tag_copy(),
 	 * so we don't need to call it here.
 	 */
-	MAC_PERFORM_NOSLEEP(mbuf_copy_label, src_label, dest_label);
+	MAC_POLICY_PERFORM_NOSLEEP(mbuf_copy_label, src_label, dest_label);
 }
 
 void
@@ -261,14 +261,14 @@ mac_mbuf_copy(struct mbuf *m_from, struc
 	src_label = mac_mbuf_to_label(m_from);
 	dest_label = mac_mbuf_to_label(m_to);
 
-	MAC_PERFORM_NOSLEEP(mbuf_copy_label, src_label, dest_label);
+	MAC_POLICY_PERFORM_NOSLEEP(mbuf_copy_label, src_label, dest_label);
 }
 
 static void
 mac_ifnet_copy_label(struct label *src, struct label *dest)
 {
 
-	MAC_PERFORM_NOSLEEP(ifnet_copy_label, src, dest);
+	MAC_POLICY_PERFORM_NOSLEEP(ifnet_copy_label, src, dest);
 }
 
 static int
@@ -277,7 +277,7 @@ mac_ifnet_externalize_label(struct label
 {
 	int error;
 
-	MAC_EXTERNALIZE(ifnet, label, elements, outbuf, outbuflen);
+	MAC_POLICY_EXTERNALIZE(ifnet, label, elements, outbuf, outbuflen);
 
 	return (error);
 }
@@ -287,7 +287,7 @@ mac_ifnet_internalize_label(struct label
 {
 	int error;
 
-	MAC_INTERNALIZE(ifnet, label, string);
+	MAC_POLICY_INTERNALIZE(ifnet, label, string);
 
 	return (error);
 }
@@ -297,7 +297,7 @@ mac_ifnet_create(struct ifnet *ifp)
 {
 
 	MAC_IFNET_LOCK(ifp);
-	MAC_PERFORM_NOSLEEP(ifnet_create, ifp, ifp->if_label);
+	MAC_POLICY_PERFORM_NOSLEEP(ifnet_create, ifp, ifp->if_label);
 	MAC_IFNET_UNLOCK(ifp);
 }
 
@@ -305,7 +305,7 @@ void
 mac_bpfdesc_create(struct ucred *cred, struct bpf_d *d)
 {
 
-	MAC_PERFORM_NOSLEEP(bpfdesc_create, cred, d, d->bd_label);
+	MAC_POLICY_PERFORM_NOSLEEP(bpfdesc_create, cred, d, d->bd_label);
 }
 
 void
@@ -317,7 +317,8 @@ mac_bpfdesc_create_mbuf(struct bpf_d *d,
 
 	label = mac_mbuf_to_label(m);
 
-	MAC_PERFORM_NOSLEEP(bpfdesc_create_mbuf, d, d->bd_label, m, label);
+	MAC_POLICY_PERFORM_NOSLEEP(bpfdesc_create_mbuf, d, d->bd_label, m,
+	    label);
 }
 
 void
@@ -328,7 +329,8 @@ mac_ifnet_create_mbuf(struct ifnet *ifp,
 	label = mac_mbuf_to_label(m);
 
 	MAC_IFNET_LOCK(ifp);
-	MAC_PERFORM_NOSLEEP(ifnet_create_mbuf, ifp, ifp->if_label, m, label);
+	MAC_POLICY_PERFORM_NOSLEEP(ifnet_create_mbuf, ifp, ifp->if_label, m,
+	    label);
 	MAC_IFNET_UNLOCK(ifp);
 }
 
@@ -343,7 +345,7 @@ mac_bpfdesc_check_receive(struct bpf_d *
 	BPFD_LOCK_ASSERT(d);
 
 	MAC_IFNET_LOCK(ifp);
-	MAC_CHECK_NOSLEEP(bpfdesc_check_receive, d, d->bd_label, ifp,
+	MAC_POLICY_CHECK_NOSLEEP(bpfdesc_check_receive, d, d->bd_label, ifp,
 	    ifp->if_label);
 	MAC_CHECK_PROBE2(bpfdesc_check_receive, error, d, ifp);
 	MAC_IFNET_UNLOCK(ifp);
@@ -365,7 +367,7 @@ mac_ifnet_check_transmit(struct ifnet *i
 	label = mac_mbuf_to_label(m);
 
 	MAC_IFNET_LOCK(ifp);
-	MAC_CHECK_NOSLEEP(ifnet_check_transmit, ifp, ifp->if_label, m,
+	MAC_POLICY_CHECK_NOSLEEP(ifnet_check_transmit, ifp, ifp->if_label, m,
 	    label);
 	MAC_CHECK_PROBE2(ifnet_check_transmit, error, ifp, m);
 	MAC_IFNET_UNLOCK(ifp);
@@ -463,15 +465,15 @@ mac_ifnet_ioctl_set(struct ucred *cred, 
 	}
 
 	MAC_IFNET_LOCK(ifp);
-	MAC_CHECK_NOSLEEP(ifnet_check_relabel, cred, ifp, ifp->if_label,
-	    intlabel);
+	MAC_POLICY_CHECK_NOSLEEP(ifnet_check_relabel, cred, ifp,
+	    ifp->if_label, intlabel);
 	if (error) {
 		MAC_IFNET_UNLOCK(ifp);
 		mac_ifnet_label_free(intlabel);
 		return (error);
 	}
 
-	MAC_PERFORM_NOSLEEP(ifnet_relabel, cred, ifp, ifp->if_label,
+	MAC_POLICY_PERFORM_NOSLEEP(ifnet_relabel, cred, ifp, ifp->if_label,
 	    intlabel);
 	MAC_IFNET_UNLOCK(ifp);
 

Modified: head/sys/security/mac/mac_pipe.c
==============================================================================
--- head/sys/security/mac/mac_pipe.c	Fri May  1 20:53:37 2009	(r191730)
+++ head/sys/security/mac/mac_pipe.c	Fri May  1 21:05:40 2009	(r191731)
@@ -66,7 +66,7 @@ mac_pipe_label_alloc(void)
 	struct label *label;
 
 	label = mac_labelzone_alloc(M_WAITOK);
-	MAC_PERFORM(pipe_init_label, label);
+	MAC_POLICY_PERFORM(pipe_init_label, label);
 	return (label);
 }
 
@@ -84,7 +84,7 @@ void
 mac_pipe_label_free(struct label *label)
 {
 
-	MAC_PERFORM_NOSLEEP(pipe_destroy_label, label);
+	MAC_POLICY_PERFORM_NOSLEEP(pipe_destroy_label, label);
 	mac_labelzone_free(label);
 }
 
@@ -102,7 +102,7 @@ void
 mac_pipe_copy_label(struct label *src, struct label *dest)
 {
 
-	MAC_PERFORM_NOSLEEP(pipe_copy_label, src, dest);
+	MAC_POLICY_PERFORM_NOSLEEP(pipe_copy_label, src, dest);
 }
 
 int
@@ -111,7 +111,7 @@ mac_pipe_externalize_label(struct label 
 {
 	int error;
 
-	MAC_EXTERNALIZE(pipe, label, elements, outbuf, outbuflen);
+	MAC_POLICY_EXTERNALIZE(pipe, label, elements, outbuf, outbuflen);
 
 	return (error);
 }
@@ -121,7 +121,7 @@ mac_pipe_internalize_label(struct label 
 {
 	int error;
 
-	MAC_INTERNALIZE(pipe, label, string);
+	MAC_POLICY_INTERNALIZE(pipe, label, string);
 
 	return (error);
 }
@@ -130,7 +130,7 @@ void
 mac_pipe_create(struct ucred *cred, struct pipepair *pp)
 {
 
-	MAC_PERFORM_NOSLEEP(pipe_create, cred, pp, pp->pp_label);
+	MAC_POLICY_PERFORM_NOSLEEP(pipe_create, cred, pp, pp->pp_label);
 }
 
 static void
@@ -138,7 +138,8 @@ mac_pipe_relabel(struct ucred *cred, str
     struct label *newlabel)
 {
 
-	MAC_PERFORM_NOSLEEP(pipe_relabel, cred, pp, pp->pp_label, newlabel);
+	MAC_POLICY_PERFORM_NOSLEEP(pipe_relabel, cred, pp, pp->pp_label,
+	    newlabel);
 }
 
 MAC_CHECK_PROBE_DEFINE4(pipe_check_ioctl, "struct ucred *",
@@ -152,8 +153,8 @@ mac_pipe_check_ioctl(struct ucred *cred,
 
 	mtx_assert(&pp->pp_mtx, MA_OWNED);
 
-	MAC_CHECK_NOSLEEP(pipe_check_ioctl, cred, pp, pp->pp_label, cmd,
-	    data);
+	MAC_POLICY_CHECK_NOSLEEP(pipe_check_ioctl, cred, pp, pp->pp_label,
+	    cmd, data);
 	MAC_CHECK_PROBE4(pipe_check_ioctl, error, cred, pp, cmd, data);
 
 	return (error);
@@ -169,7 +170,7 @@ mac_pipe_check_poll(struct ucred *cred, 
 
 	mtx_assert(&pp->pp_mtx, MA_OWNED);
 
-	MAC_CHECK_NOSLEEP(pipe_check_poll, cred, pp, pp->pp_label);
+	MAC_POLICY_CHECK_NOSLEEP(pipe_check_poll, cred, pp, pp->pp_label);
 	MAC_CHECK_PROBE2(pipe_check_poll, error, cred, pp);
 
 	return (error);
@@ -185,7 +186,7 @@ mac_pipe_check_read(struct ucred *cred, 
 
 	mtx_assert(&pp->pp_mtx, MA_OWNED);
 
-	MAC_CHECK_NOSLEEP(pipe_check_read, cred, pp, pp->pp_label);
+	MAC_POLICY_CHECK_NOSLEEP(pipe_check_read, cred, pp, pp->pp_label);
 	MAC_CHECK_PROBE2(pipe_check_read, error, cred, pp);

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

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 21:31:39 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D059B1065674;
	Fri,  1 May 2009 21:31:39 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BF19D8FC1B;
	Fri,  1 May 2009 21:31:39 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41LVd7i053830;
	Fri, 1 May 2009 21:31:39 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41LVdTo053829;
	Fri, 1 May 2009 21:31:39 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905012131.n41LVdTo053829@svn.freebsd.org>
From: Sam Leffler 
Date: Fri, 1 May 2009 21:31:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191732 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 21:31:40 -0000

Author: sam
Date: Fri May  1 21:31:39 2009
New Revision: 191732
URL: http://svn.freebsd.org/changeset/base/191732

Log:
  revert wip

Modified:
  head/sys/net80211/ieee80211_ddb.c

Modified: head/sys/net80211/ieee80211_ddb.c
==============================================================================
--- head/sys/net80211/ieee80211_ddb.c	Fri May  1 21:05:40 2009	(r191731)
+++ head/sys/net80211/ieee80211_ddb.c	Fri May  1 21:31:39 2009	(r191732)
@@ -284,21 +284,12 @@ _db_show_sta(const struct ieee80211_node
 static void
 _db_show_tdma(const char *sep, const struct ieee80211_tdma_state *ts, int showprocs)
 {
-	const char *cp;
-	int i;
-
 	db_printf("%stdma %p:\n", sep, ts);
-	db_printf("%s  features %b version %u slot %u txrate %u bintval %u peer %p\n", sep,
-	    ts->tdma_features, TDMA_F_BITS, ts->tdma_version, ts->tdma_slot,
-	    ts->tdma_txrate, ts->tdma_bintval, ts->tdma_peer);
-	db_printf("%s  slotlen %u slotcnt %u bw[", sep,
+	db_printf("%s  version %u slot %u bintval %u peer %p\n", sep,
+	    ts->tdma_version, ts->tdma_slot, ts->tdma_bintval, ts->tdma_peer);
+	db_printf("%s  slotlen %u slotcnt %u", sep,
 	    ts->tdma_slotlen, ts->tdma_slotcnt);
-	cp = "";
-	for (i = 0; i < TDMA_MAXSLOTS; i++) {
-		db_printf("%s%u", cp, ts->tdma_bw[i]);
-		cp = ":";
-	}
-	db_printf("] inuse 0x%x active 0x%x count %d\n",
+	db_printf(" inuse 0x%x active 0x%x count %d\n",
 	    ts->tdma_inuse[0], ts->tdma_active[0], ts->tdma_count);
 	if (showprocs) {
 		DB_PRINTSYM(sep, "  tdma_newstate", ts->tdma_newstate);

From owner-svn-src-head@FreeBSD.ORG  Fri May  1 21:43:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 96F1C106571A;
	Fri,  1 May 2009 21:43:04 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 69C248FC15;
	Fri,  1 May 2009 21:43:04 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n41Lh4Hm054075;
	Fri, 1 May 2009 21:43:04 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n41Lh4uS054073;
	Fri, 1 May 2009 21:43:04 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200905012143.n41Lh4uS054073@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 1 May 2009 21:43:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191733 - in head/sys: amd64/isa isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 01 May 2009 21:43:06 -0000

Author: mav
Date: Fri May  1 21:43:04 2009
New Revision: 191733
URL: http://svn.freebsd.org/changeset/base/191733

Log:
  Add resume methods to i8254 and atrtc devices.

Modified:
  head/sys/amd64/isa/clock.c
  head/sys/isa/atrtc.c

Modified: head/sys/amd64/isa/clock.c
==============================================================================
--- head/sys/amd64/isa/clock.c	Fri May  1 21:31:39 2009	(r191732)
+++ head/sys/amd64/isa/clock.c	Fri May  1 21:43:04 2009	(r191733)
@@ -376,6 +376,17 @@ set_i8254_freq(u_int freq, int intr_freq
 	mtx_unlock_spin(&clock_lock);
 }
 
+static void
+i8254_restore(void)
+{
+
+	mtx_lock_spin(&clock_lock);
+	outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
+	outb(TIMER_CNTR0, i8254_real_max_count & 0xff);
+	outb(TIMER_CNTR0, i8254_real_max_count >> 8);
+	mtx_unlock_spin(&clock_lock);
+}
+
 /* This is separate from startrtclock() so that it can be called early. */
 void
 i8254_init(void)
@@ -558,6 +569,14 @@ attimer_attach(device_t dev)
 	return(0);
 }
 
+static int
+attimer_resume(device_t dev)
+{
+
+	i8254_restore();
+	return(0);
+}
+
 static device_method_t attimer_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		attimer_probe),
@@ -565,7 +584,7 @@ static device_method_t attimer_methods[]
 	DEVMETHOD(device_detach,	bus_generic_detach),
 	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
 	DEVMETHOD(device_suspend,	bus_generic_suspend),
-	DEVMETHOD(device_resume,	bus_generic_resume),
+	DEVMETHOD(device_resume,	attimer_resume),
 	{ 0, 0 }
 };
 

Modified: head/sys/isa/atrtc.c
==============================================================================
--- head/sys/isa/atrtc.c	Fri May  1 21:31:39 2009	(r191732)
+++ head/sys/isa/atrtc.c	Fri May  1 21:43:04 2009	(r191733)
@@ -190,6 +190,13 @@ atrtc_attach(device_t dev)
 	return(0);
 }
 
+static int
+atrtc_resume(device_t dev)
+{
+
+	atrtc_restore();
+	return(0);
+}
 
 static int
 atrtc_settime(device_t dev __unused, struct timespec *ts)
@@ -264,8 +271,7 @@ static device_method_t atrtc_methods[] =
 	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
 	DEVMETHOD(device_suspend,	bus_generic_suspend),
 		/* XXX stop statclock? */
-	DEVMETHOD(device_resume,	bus_generic_resume),
-		/* XXX restart statclock? */
+	DEVMETHOD(device_resume,	atrtc_resume),
 
 	/* clock interface */
 	DEVMETHOD(clock_gettime,	atrtc_gettime),

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 05:02:30 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DEE261065674;
	Sat,  2 May 2009 05:02:29 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CCD4C8FC08;
	Sat,  2 May 2009 05:02:29 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4252SAD070233;
	Sat, 2 May 2009 05:02:28 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4252Ssc070230;
	Sat, 2 May 2009 05:02:28 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200905020502.n4252Ssc070230@svn.freebsd.org>
From: Marko Zec 
Date: Sat, 2 May 2009 05:02:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191734 - in head/sys: net netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 05:02:31 -0000

Author: zec
Date: Sat May  2 05:02:28 2009
New Revision: 191734
URL: http://svn.freebsd.org/changeset/base/191734

Log:
  Unbreak options VIMAGE + nooptions INVARIANTS kernel builds.
  
  Submitted by:	julian
  Approved by:	julian (mentor)

Modified:
  head/sys/net/route.c
  head/sys/netinet/igmp.c
  head/sys/netinet/tcp_timewait.c

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c	Fri May  1 21:43:04 2009	(r191733)
+++ head/sys/net/route.c	Sat May  2 05:02:28 2009	(r191734)
@@ -1131,10 +1131,10 @@ bad:
 int
 rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate)
 {
-	INIT_VNET_NET(curvnet);
 	/* XXX dst may be overwritten, can we move this to below */
 	int dlen = SA_SIZE(dst), glen = SA_SIZE(gate);
 #ifdef INVARIANTS
+	INIT_VNET_NET(curvnet);
 	struct radix_node_head *rnh =
 	    V_rt_tables[rt->rt_fibnum][dst->sa_family];
 #endif

Modified: head/sys/netinet/igmp.c
==============================================================================
--- head/sys/netinet/igmp.c	Fri May  1 21:43:04 2009	(r191733)
+++ head/sys/netinet/igmp.c	Sat May  2 05:02:28 2009	(r191734)
@@ -3617,7 +3617,9 @@ vnet_igmp_iattach(const void *unused __u
 static int
 vnet_igmp_idetach(const void *unused __unused)
 {
+#ifdef INVARIANTS
 	INIT_VNET_INET(curvnet);
+#endif
 
 	CTR1(KTR_IGMPV3, "%s: tearing down", __func__);
 

Modified: head/sys/netinet/tcp_timewait.c
==============================================================================
--- head/sys/netinet/tcp_timewait.c	Fri May  1 21:43:04 2009	(r191733)
+++ head/sys/netinet/tcp_timewait.c	Sat May  2 05:02:28 2009	(r191734)
@@ -188,9 +188,7 @@ tcp_tw_init(void)
 void
 tcp_twstart(struct tcpcb *tp)
 {
-#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
 	INIT_VNET_INET(tp->t_vnet);
-#endif
 	struct tcptw *tw;
 	struct inpcb *inp = tp->t_inpcb;
 	int acknow;

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 06:12:39 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 081B4106566B;
	Sat,  2 May 2009 06:12:39 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E8AF28FC16;
	Sat,  2 May 2009 06:12:38 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n426CcCL074329;
	Sat, 2 May 2009 06:12:38 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n426Cc27074327;
	Sat, 2 May 2009 06:12:38 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200905020612.n426Cc27074327@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 2 May 2009 06:12:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191735 - in head/sys/mips: include mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 06:12:39 -0000

Author: alc
Date: Sat May  2 06:12:38 2009
New Revision: 191735
URL: http://svn.freebsd.org/changeset/base/191735

Log:
  A variety of changes:
  
  Reimplement "kernel_pmap" in the standard way.
  
  Eliminate unused variables.  (These are mostly variables that were
  discarded by the machine-independent layer after FreeBSD 4.x.)
  
  Properly handle a vm_page_alloc() failure in pmap_init().
  
  Eliminate dead or legacy (FreeBSD 4.x) code.
  
  Eliminate unnecessary page queues locking.
  
  Eliminate some excess white space.
  
  Correct the synchronization of pmap_page_exists_quick().
  
  Tested by: gonzo

Modified:
  head/sys/mips/include/pmap.h
  head/sys/mips/mips/pmap.c

Modified: head/sys/mips/include/pmap.h
==============================================================================
--- head/sys/mips/include/pmap.h	Sat May  2 05:02:28 2009	(r191734)
+++ head/sys/mips/include/pmap.h	Sat May  2 06:12:38 2009	(r191735)
@@ -74,7 +74,7 @@ struct pv_entry;
 struct md_page {
 	int pv_list_count;
 	int pv_flags;
-	    TAILQ_HEAD(, pv_entry)pv_list;
+	TAILQ_HEAD(, pv_entry) pv_list;
 };
 
 #define	PV_TABLE_MOD		0x01	/* modified */
@@ -86,8 +86,8 @@ struct md_page {
 
 struct pmap {
 	pd_entry_t *pm_segtab;	/* KVA of segment table */
-	           TAILQ_HEAD(, pv_entry)pm_pvlist;	/* list of mappings in
-							 * pmap */
+	TAILQ_HEAD(, pv_entry) pm_pvlist;	/* list of mappings in
+						 * pmap */
 	int pm_active;		/* active on cpus */
 	struct {
 		u_int32_t asid:ASID_BITS;	/* TLB address space tag */
@@ -105,10 +105,12 @@ typedef struct pmap *pmap_t;
 pt_entry_t *pmap_pte(pmap_t, vm_offset_t);
 pd_entry_t pmap_segmap(pmap_t pmap, vm_offset_t va);
 vm_offset_t pmap_kextract(vm_offset_t va);
-extern pmap_t kernel_pmap;
 
 #define	vtophys(va)	pmap_kextract(((vm_offset_t) (va)))
 
+extern struct pmap	kernel_pmap_store;
+#define kernel_pmap	(&kernel_pmap_store)
+
 #define	PMAP_LOCK(pmap)		mtx_lock(&(pmap)->pm_mtx)
 #define	PMAP_LOCK_ASSERT(pmap, type)	mtx_assert(&(pmap)->pm_mtx, (type))
 #define	PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx)
@@ -132,8 +134,8 @@ extern pmap_t kernel_pmap;
 typedef struct pv_entry {
 	pmap_t pv_pmap;		/* pmap where mapping lies */
 	vm_offset_t pv_va;	/* virtual address for mapping */
-	            TAILQ_ENTRY(pv_entry)pv_list;
-	            TAILQ_ENTRY(pv_entry)pv_plist;
+	TAILQ_ENTRY(pv_entry) pv_list;
+	TAILQ_ENTRY(pv_entry) pv_plist;
 	vm_page_t pv_ptem;	/* VM page for pte */
 	boolean_t pv_wired;	/* whether this entry is wired */
 }       *pv_entry_t;
@@ -143,8 +145,6 @@ typedef struct pv_entry {
 #define	PMAP_DIAGNOSTIC
 #endif
 
-extern vm_offset_t avail_end;
-extern vm_offset_t avail_start;
 extern vm_offset_t phys_avail[];
 extern char *ptvmmap;		/* poor name! */
 extern vm_offset_t virtual_avail;

Modified: head/sys/mips/mips/pmap.c
==============================================================================
--- head/sys/mips/mips/pmap.c	Sat May  2 05:02:28 2009	(r191734)
+++ head/sys/mips/mips/pmap.c	Sat May  2 06:12:38 2009	(r191735)
@@ -135,12 +135,9 @@ __FBSDID("$FreeBSD$");
 #define	pmap_va_asid(pmap, va)	((va) | ((pmap)->pm_asid[PCPU_GET(cpuid)].asid << VMTLB_PID_SHIFT))
 #define	is_kernel_pmap(x)	((x) == kernel_pmap)
 
-static struct pmap kernel_pmap_store;
-pmap_t kernel_pmap;
+struct pmap kernel_pmap_store;
 pd_entry_t *kernel_segmap;
 
-vm_offset_t avail_start;	/* PA of first available physical page */
-vm_offset_t avail_end;		/* PA of last available physical page */
 vm_offset_t virtual_avail;	/* VA of first avail page (after kernel bss) */
 vm_offset_t virtual_end;	/* VA of last avail page (end of kernel AS) */
 
@@ -161,7 +158,6 @@ static void pmap_asid_alloc(pmap_t pmap)
 static uma_zone_t pvzone;
 static struct vm_object pvzone_obj;
 static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
-int pmap_pagedaemon_waken = 0;
 
 struct fpage fpages_shared[FPAGES_SHARED];
 
@@ -412,25 +408,20 @@ again:
 	for (i = 0, j = (virtual_avail >> SEGSHIFT); i < nkpt; i++, j++)
 		kernel_segmap[j] = (pd_entry_t)(pgtab + (i * NPTEPG));
 
-	avail_start = phys_avail[0];
 	for (i = 0; phys_avail[i + 2]; i += 2)
 		continue;
-	avail_end = phys_avail[i + 1];
+	printf("avail_start:0x%x avail_end:0x%x\n",
+	    phys_avail[0], phys_avail[i + 1]);
 
 	/*
 	 * The kernel's pmap is statically allocated so we don't have to use
 	 * pmap_create, which is unlikely to work correctly at this part of
 	 * the boot sequence (XXX and which no longer exists).
 	 */
-	kernel_pmap = &kernel_pmap_store;
-
 	PMAP_LOCK_INIT(kernel_pmap);
 	kernel_pmap->pm_segtab = kernel_segmap;
 	kernel_pmap->pm_active = ~0;
 	TAILQ_INIT(&kernel_pmap->pm_pvlist);
-	printf("avail_start:0x%x avail_end:0x%x\n",
-	    avail_start, avail_end);
-
 	kernel_pmap->pm_asid[PCPU_GET(cpuid)].asid = PMAP_ASID_RESERVED;
 	kernel_pmap->pm_asid[PCPU_GET(cpuid)].gen = 0;
 	pmap_max_asid = VMNUM_PIDS;
@@ -1011,19 +1002,11 @@ pmap_pinit(pmap_t pmap)
 	/*
 	 * allocate the page directory page
 	 */
-	ptdpg = vm_page_alloc(NULL, NUSERPGTBLS, req);
+	while ((ptdpg = vm_page_alloc(NULL, NUSERPGTBLS, req)) == NULL)
+		VM_WAIT;
 
-#if 0
-	/* I think we can just delete these, now that PG_BUSY is gone */
-	vm_page_lock_queues();
-	vm_page_flag_clear(ptdpg, PTE_BUSY);	/* not usually mapped */
-#endif
 	ptdpg->valid = VM_PAGE_BITS_ALL;
 
-#if 0
-	vm_page_unlock_queues();
-#endif
-
 	pmap->pm_segtab = (pd_entry_t *)
 	    MIPS_PHYS_TO_CACHED(VM_PAGE_TO_PHYS(ptdpg));
 	if ((ptdpg->flags & PG_ZERO) == 0)
@@ -1193,12 +1176,9 @@ pmap_release(pmap_t pmap)
 	    pmap->pm_stats.resident_count));
 
 	ptdpg = PHYS_TO_VM_PAGE(MIPS_CACHED_TO_PHYS(pmap->pm_segtab));
-
-	vm_page_lock_queues();
 	ptdpg->wire_count--;
 	atomic_subtract_int(&cnt.v_wire_count, 1);
 	vm_page_free_zero(ptdpg);
-	vm_page_unlock_queues();
 }
 
 /*
@@ -1447,7 +1427,6 @@ static void
 pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, vm_page_t m,
     boolean_t wired)
 {
-
 	pv_entry_t pv;
 
 	pv = get_pv_entry(pmap);
@@ -1461,7 +1440,6 @@ pmap_insert_entry(pmap_t pmap, vm_offset
 	TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist);
 	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 	m->md.pv_list_count++;
-
 }
 
 /*
@@ -1532,7 +1510,6 @@ pmap_remove_pte(struct pmap *pmap, pt_en
 		pmap_remove_entry(pmap, m, va);
 	}
 	return pmap_unuse_pt(pmap, va, NULL);
-
 }
 
 /*
@@ -1623,14 +1600,8 @@ pmap_remove_all(vm_page_t m)
 	register pv_entry_t pv;
 	register pt_entry_t *pte, tpte;
 
-#if defined(PMAP_DEBUG)
-	/*
-	 * XXX This makes pmap_remove_all() illegal for non-managed pages!
-	 */
-	if (m->flags & PG_FICTITIOUS) {
-		panic("pmap_page_protect: illegal for unmanaged page, va: 0x%x", VM_PAGE_TO_PHYS(m));
-	}
-#endif
+	KASSERT((m->flags & PG_FICTITIOUS) == 0,
+	    ("pmap_remove_all: page %p is fictitious", m));
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 
 	if (m->md.pv_flags & PV_TABLE_REF)
@@ -2484,28 +2455,18 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
 	if (m->flags & PG_FICTITIOUS)
 		return FALSE;
 
-	vm_page_lock_queues();
-	PMAP_LOCK(pmap);
-
-	/*
-	 * Not found, check current mappings returning immediately if found.
-	 */
+	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
 		if (pv->pv_pmap == pmap) {
-			PMAP_UNLOCK(pmap);
-			vm_page_unlock_queues();
 			return TRUE;
 		}
 		loops++;
 		if (loops >= 16)
 			break;
 	}
-	PMAP_UNLOCK(pmap);
-	vm_page_unlock_queues();
 	return (FALSE);
 }
 
-#define	PMAP_REMOVE_PAGES_CURPROC_ONLY
 /*
  * Remove all pages from specified address space
  * this aids process exit speeds.  Also, this code
@@ -2521,13 +2482,10 @@ pmap_remove_pages(pmap_t pmap)
 	pv_entry_t pv, npv;
 	vm_page_t m;
 
-#ifdef PMAP_REMOVE_PAGES_CURPROC_ONLY
 	if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) {
 		printf("warning: pmap_remove_pages called with non-current pmap\n");
 		return;
 	}
-#endif
-
 	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
 	sched_pin();
@@ -3272,7 +3230,8 @@ pmap_kextract(vm_offset_t va)
 	else if (va >= MIPS_KSEG2_START && va < VM_MAX_KERNEL_ADDRESS) {
 		pt_entry_t *ptep;
 
-		if (kernel_pmap) {
+		/* Is the kernel pmap initialized? */
+		if (kernel_pmap->pm_active) {
 			if (va >= (vm_offset_t)virtual_sys_start) {
 				/* Its inside the virtual address range */
 				ptep = pmap_pte(kernel_pmap, va);

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 07:02:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CBC32106564A;
	Sat,  2 May 2009 07:02:31 +0000 (UTC)
	(envelope-from rdivacky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B89448FC14;
	Sat,  2 May 2009 07:02:31 +0000 (UTC)
	(envelope-from rdivacky@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4272VFD075499;
	Sat, 2 May 2009 07:02:31 GMT (envelope-from rdivacky@svn.freebsd.org)
Received: (from rdivacky@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4272VGS075497;
	Sat, 2 May 2009 07:02:31 GMT (envelope-from rdivacky@svn.freebsd.org)
Message-Id: <200905020702.n4272VGS075497@svn.freebsd.org>
From: Roman Divacky 
Date: Sat, 2 May 2009 07:02:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191737 - head/usr.bin/ncal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 07:02:32 -0000

Author: rdivacky
Date: Sat May  2 07:02:31 2009
New Revision: 191737
URL: http://svn.freebsd.org/changeset/base/191737

Log:
  Mention -h in usage() and manpage. Rename term_{r,e} to term_{so,se}.
  
  Suggested by:	ru
  Approved by:	ed (mentor)

Modified:
  head/usr.bin/ncal/ncal.1
  head/usr.bin/ncal/ncal.c

Modified: head/usr.bin/ncal/ncal.1
==============================================================================
--- head/usr.bin/ncal/ncal.1	Sat May  2 06:25:51 2009	(r191736)
+++ head/usr.bin/ncal/ncal.1	Sat May  2 07:02:31 2009	(r191737)
@@ -33,24 +33,24 @@
 .Nd displays a calendar and the date of Easter
 .Sh SYNOPSIS
 .Nm
-.Op Fl jy
+.Op Fl hjy
 .Oo
 .Op Ar month
 .Ar year
 .Oc
 .Nm
-.Op Fl j
+.Op Fl hj
 .Fl m Ar month
 .Op Ar year
 .Nm ncal
-.Op Fl jJpwy
+.Op Fl hjJpwy
 .Op Fl s Ar country_code
 .Oo
 .Op Ar month
 .Ar year
 .Oc
 .Nm ncal
-.Op Fl Jeo
+.Op Fl hJeo
 .Op Ar year
 .Sh DESCRIPTION
 The
@@ -65,6 +65,8 @@ the current month is displayed.
 .Pp
 The options are as follows:
 .Bl -tag -width indent
+.It Fl h
+Turns off highlighting of today.
 .It Fl J
 Display Julian Calendar, if combined with the
 .Fl e

Modified: head/usr.bin/ncal/ncal.c
==============================================================================
--- head/usr.bin/ncal/ncal.c	Sat May  2 06:25:51 2009	(r191736)
+++ head/usr.bin/ncal/ncal.c	Sat May  2 07:02:31 2009	(r191737)
@@ -161,7 +161,7 @@ char jdaystr[] = "       1   2   3   4  
 int     flag_weeks;		/* user wants number of week */
 int     nswitch;		/* user defined switch date */
 int	nswitchb;		/* switch date for backward compatibility */
-const char	*term_r, *term_e;
+const char	*term_so, *term_se;
 int	today;
 
 char   *center(char *s, char *t, int w);
@@ -207,14 +207,14 @@ main(int argc, char *argv[])
 	time_t t;
 	struct tm *tm1;
 
-	term_e = term_r = NULL;
+	term_se = term_so = NULL;
 	today = 0;
 	if (isatty(STDOUT_FILENO) && tgetent(tbuf, NULL) == 1) {
 		date	dt;		/* handy date */
 
 		b = cbuf;
-		term_r = tgetstr("so", &b);
-		term_e = tgetstr("se", &b);
+		term_so = tgetstr("so", &b);
+		term_se = tgetstr("se", &b);
 		t = time(NULL);
 		tm1 = localtime(&t);
 		dt.y = tm1->tm_year + 1900;
@@ -272,7 +272,7 @@ main(int argc, char *argv[])
 			flag_julian_cal = 1;
 			break;
 		case 'h':
-			term_r = term_e = NULL;
+			term_so = term_se = NULL;
 			break;
 		case 'e':
 			if (flag_backward)
@@ -382,10 +382,10 @@ usage(void)
 {
 
 	fputs(
-	    "usage: cal [-jy] [[month] year]\n"
-	    "       cal [-j] [-m month] [year]\n"
-	    "       ncal [-Jjpwy] [-s country_code] [[month] year]\n"
-	    "       ncal [-Jeo] [year]\n", stderr);
+	    "usage: cal [-hjy] [[month] year]\n"
+	    "       cal [-hj] [-m month] [year]\n"
+	    "       ncal [-hJjpwy] [-s country_code] [[month] year]\n"
+	    "       ncal [-hJeo] [year]\n", stderr);
 	exit(EX_USAGE);
 }
 
@@ -671,8 +671,8 @@ mkmonth(int y, int m, int jd_flag, struc
 	for (i = 0; i != 7; i++) {
 		l = 0;
 		for (j = firstm + i, k = 0; j < last; j += 7, k += dw) {
-			if (j == today && (term_r != NULL && term_e != NULL)) {
-				l = strlen(term_r);
+			if (j == today && (term_so != NULL && term_se != NULL)) {
+				l = strlen(term_so);
 				if (jd_flag)
 					dt.d = j - jan1 + 1;
 				else
@@ -683,11 +683,11 @@ mkmonth(int y, int m, int jd_flag, struc
 				memcpy(mlines->lines[i] + k + l,
 				    ds + dt.d * dw, dw);
 				/* highlight on */
-				memcpy(mlines->lines[i] + k + 1, term_r, l);
+				memcpy(mlines->lines[i] + k + 1, term_so, l);
 				/* highlight off */
-				memcpy(mlines->lines[i] + k + l + dw, term_e,
-				    strlen(term_e));
-				l = strlen(term_e) + strlen(term_r);
+				memcpy(mlines->lines[i] + k + l + dw, term_se,
+				    strlen(term_se));
+				l = strlen(term_se) + strlen(term_so);
 				continue;
 			}
 			if (j >= first) {
@@ -790,8 +790,8 @@ mkmonthb(int y, int m, int jd_flag, stru
 		l = 0;
 		for (j = firsts + 7 * i, k = 0; j < last && k != dw * 7;
 		    j++, k += dw) { 
-			if (j == today && (term_r != NULL && term_e != NULL)) {
-				l = strlen(term_r);
+			if (j == today && (term_so != NULL && term_se != NULL)) {
+				l = strlen(term_so);
 				if (jd_flag)
 					dt.d = j - jan1 + 1;
 				else
@@ -802,11 +802,11 @@ mkmonthb(int y, int m, int jd_flag, stru
 				memcpy(mlines->lines[i] + k + l,
 				    ds + dt.d * dw, dw);
 				/* highlight on */
-				memcpy(mlines->lines[i] + k + 1, term_r, l);
+				memcpy(mlines->lines[i] + k + 1, term_so, l);
 				/* highlight off */
-				memcpy(mlines->lines[i] + k + l + dw, term_e,
-				    strlen(term_e));
-				l = strlen(term_e) + strlen(term_r);
+				memcpy(mlines->lines[i] + k + l + dw, term_se,
+				    strlen(term_se));
+				l = strlen(term_se) + strlen(term_so);
 				continue;
 			}
 			if (j >= first) {

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 08:16:26 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C26E2106566C;
	Sat,  2 May 2009 08:16:26 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AF05F8FC0A;
	Sat,  2 May 2009 08:16:26 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n428GQvB076929;
	Sat, 2 May 2009 08:16:26 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n428GQ6B076923;
	Sat, 2 May 2009 08:16:26 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200905020816.n428GQ6B076923@svn.freebsd.org>
From: Marko Zec 
Date: Sat, 2 May 2009 08:16:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191738 - in head/sys: net netinet netinet6 netipsec
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 08:16:27 -0000

Author: zec
Date: Sat May  2 08:16:26 2009
New Revision: 191738
URL: http://svn.freebsd.org/changeset/base/191738

Log:
  Make indentation more uniform accross vnet container structs.
  
  This is a purely cosmetic / NOP change.
  
  Reviewed by:	bz
  Approved by:	julian (mentor)
  Verified by:	svn diff -x -w producing no output

Modified:
  head/sys/net/if_gif.h
  head/sys/net/vnet.h
  head/sys/netinet/ip_fw.h
  head/sys/netinet/vinet.h
  head/sys/netinet6/vinet6.h
  head/sys/netipsec/vipsec.h

Modified: head/sys/net/if_gif.h
==============================================================================
--- head/sys/net/if_gif.h	Sat May  2 07:02:31 2009	(r191737)
+++ head/sys/net/if_gif.h	Sat May  2 08:16:26 2009	(r191738)
@@ -117,11 +117,11 @@ int gif_encapcheck(const struct mbuf *, 
  */
 
 struct vnet_gif {
-	LIST_HEAD(, gif_softc) _gif_softc_list;
-	int	_max_gif_nesting;
-	int	_parallel_tunnels;
-	int	_ip_gif_ttl;
-	int	_ip6_gif_hlim;
+	LIST_HEAD(, gif_softc)	_gif_softc_list;
+	int			_max_gif_nesting;
+	int			_parallel_tunnels;
+	int			_ip_gif_ttl;
+	int			_ip6_gif_hlim;
 };
 
 #ifndef VIMAGE

Modified: head/sys/net/vnet.h
==============================================================================
--- head/sys/net/vnet.h	Sat May  2 07:02:31 2009	(r191737)
+++ head/sys/net/vnet.h	Sat May  2 08:16:26 2009	(r191738)
@@ -36,25 +36,25 @@
 #include 
 
 struct vnet_net {
-	int	_if_index;
-	struct	ifindex_entry *_ifindex_table;
-	struct	ifnethead _ifnet;
-	struct	ifgrouphead _ifg_head;
+	int			_if_index;
+	struct ifindex_entry *	_ifindex_table;
+	struct ifnethead	_ifnet;
+	struct ifgrouphead	_ifg_head;
 
-	int	_if_indexlim;
-	struct	knlist _ifklist;
+	int			_if_indexlim;
+	struct knlist		_ifklist;
 
-	struct	rtstat _rtstat;
-	struct	radix_node_head *_rt_tables[RT_MAXFIBS][AF_MAX+1];
-	int	_rttrash;
-	uma_zone_t _rtzone;
+	struct rtstat		_rtstat;
+	struct radix_node_head *_rt_tables[RT_MAXFIBS][AF_MAX+1];
+	int			_rttrash;
+	uma_zone_t		_rtzone;
 
-	struct	ifnet *_loif;
-	LIST_HEAD(, lo_softc) _lo_list;
+	struct ifnet *		_loif;
+	LIST_HEAD(, lo_softc)	_lo_list;
 
-	LIST_HEAD(, rawcb) _rawcb_list;
+	LIST_HEAD(, rawcb)	_rawcb_list;
 
-	int	_ether_ipfw;
+	int			_ether_ipfw;
 };
 
 /* Size guard. See sys/vimage.h. */

Modified: head/sys/netinet/ip_fw.h
==============================================================================
--- head/sys/netinet/ip_fw.h	Sat May  2 07:02:31 2009	(r191737)
+++ head/sys/netinet/ip_fw.h	Sat May  2 08:16:26 2009	(r191738)
@@ -689,33 +689,33 @@ struct eventhandler_entry;
  * Stack virtualization support.
  */
 struct vnet_ipfw {
-	int	_fw_enable;
-	int	_fw6_enable;
-	u_int32_t _set_disable;
-	int	_fw_deny_unknown_exthdrs;
-	int	_fw_verbose;
-	int	_verbose_limit;
-	int	_autoinc_step;
-	ipfw_dyn_rule **_ipfw_dyn_v;
-	uma_zone_t _ipfw_dyn_rule_zone;
-	struct ip_fw_chain _layer3_chain;
-	u_int32_t _dyn_buckets;
-	u_int32_t _curr_dyn_buckets;
-	u_int32_t _dyn_ack_lifetime;
-	u_int32_t _dyn_syn_lifetime;
-	u_int32_t _dyn_fin_lifetime;
-	u_int32_t _dyn_rst_lifetime;
-	u_int32_t _dyn_udp_lifetime;
-	u_int32_t _dyn_short_lifetime;
-	u_int32_t _dyn_keepalive_interval;
-	u_int32_t _dyn_keepalive_period;
-	u_int32_t _dyn_keepalive;
-	u_int32_t _static_count;
-	u_int32_t _static_len;
-	u_int32_t _dyn_count;
-	u_int32_t _dyn_max;
-	u_int64_t _norule_counter;
-	struct callout _ipfw_timeout;
+	int			_fw_enable;
+	int			_fw6_enable;
+	u_int32_t		_set_disable;
+	int			_fw_deny_unknown_exthdrs;
+	int			_fw_verbose;
+	int			_verbose_limit;
+	int			_autoinc_step;
+	ipfw_dyn_rule **	_ipfw_dyn_v;
+	uma_zone_t 		_ipfw_dyn_rule_zone;
+	struct ip_fw_chain	_layer3_chain;
+	u_int32_t		_dyn_buckets;
+	u_int32_t		_curr_dyn_buckets;
+	u_int32_t		_dyn_ack_lifetime;
+	u_int32_t		_dyn_syn_lifetime;
+	u_int32_t		_dyn_fin_lifetime;
+	u_int32_t		_dyn_rst_lifetime;
+	u_int32_t		_dyn_udp_lifetime;
+	u_int32_t		_dyn_short_lifetime;
+	u_int32_t		_dyn_keepalive_interval;
+	u_int32_t		_dyn_keepalive_period;
+	u_int32_t		_dyn_keepalive;
+	u_int32_t		_static_count;
+	u_int32_t		_static_len;
+	u_int32_t		_dyn_count;
+	u_int32_t		_dyn_max;
+	u_int64_t		_norule_counter;
+	struct callout		_ipfw_timeout;
 	struct eventhandler_entry *_ifaddr_event_tag;
 };
 

Modified: head/sys/netinet/vinet.h
==============================================================================
--- head/sys/netinet/vinet.h	Sat May  2 07:02:31 2009	(r191737)
+++ head/sys/netinet/vinet.h	Sat May  2 08:16:26 2009	(r191738)
@@ -51,166 +51,166 @@
 #include 
 
 struct vnet_inet {
-	struct	in_ifaddrhashhead *_in_ifaddrhashtbl;
-	struct	in_ifaddrhead _in_ifaddrhead;
-	u_long	_in_ifaddrhmask;
-
-	int	_arpt_keep;
-	int	_arp_maxtries;
-	int	_useloopback;
-	int	_arp_proxyall;
-	int	_subnetsarelocal;
-	int	_sameprefixcarponly;
-
-	int	_ipforwarding;
-	int	_ipstealth;
-	int	_ipfastforward_active;
-	int	_ipsendredirects;
-	int	_ip_defttl;
-	int	_ip_keepfaith;
-	int	_ip_sendsourcequench;
-	int	_ip_do_randomid;
-	int	_ip_checkinterface;
-	int	_ip_output_flowtable_size;
-	u_short	_ip_id;
-
-	uma_zone_t _ipq_zone;
-	int	_nipq;			/* Total # of reass queues */
-	int	_maxnipq;		/* Admin. limit on # reass queues. */
-	int	_maxfragsperpacket;
+	struct in_ifaddrhashhead *_in_ifaddrhashtbl;
+	struct in_ifaddrhead	_in_ifaddrhead;
+	u_long			_in_ifaddrhmask;
+
+	int			_arpt_keep;
+	int			_arp_maxtries;
+	int			_useloopback;
+	int			_arp_proxyall;
+	int			_subnetsarelocal;
+	int			_sameprefixcarponly;
+
+	int			_ipforwarding;
+	int			_ipstealth;
+	int			_ipfastforward_active;
+	int			_ipsendredirects;
+	int			_ip_defttl;
+	int			_ip_keepfaith;
+	int			_ip_sendsourcequench;
+	int			_ip_do_randomid;
+	int			_ip_checkinterface;
+	int			_ip_output_flowtable_size;
+	u_short			_ip_id;
+
+	uma_zone_t 		_ipq_zone;
+	int			_nipq;	  /* Total # of reass queues */
+	int			_maxnipq; /* Admin. limit on # reass queues. */
+	int			_maxfragsperpacket;
 	TAILQ_HEAD(ipqhead, ipq) _ipq[IPREASS_NHASH];
 
-	struct	inpcbhead _tcb;		/* head of queue of active tcpcb's */
-	struct	inpcbinfo _tcbinfo;
-	struct	tcpstat _tcpstat;	/* tcp statistics */
-	struct	tcp_hostcache _tcp_hostcache;
-	struct  callout _tcp_hc_callout;
-
-	uma_zone_t _tcp_reass_zone;
-	uma_zone_t _tcpcb_zone;
-	uma_zone_t _tcptw_zone;
-	uma_zone_t _sack_hole_zone;
-
-	struct	tcp_syncache _tcp_syncache;
-	int	_tcp_syncookies;
-	int	_tcp_syncookiesonly;
-	int	_tcp_sc_rst_sock_fail;
-
-	struct	inpcbhead _divcb;
-	struct	inpcbinfo _divcbinfo;
-	TAILQ_HEAD(, tcptw) _twq_2msl;
-
-	int	_tcp_mssdflt;
-	int	_tcp_v6mssdflt;
-	int	_tcp_minmss;
-	int	_tcp_do_rfc1323;
-	int	_icmp_may_rst;
-	int	_tcp_isn_reseed_interval;
-	int	_tcp_inflight_enable;
-	int	_tcp_inflight_rttthresh;
-	int	_tcp_inflight_min;
-	int	_tcp_inflight_max;
-	int	_tcp_inflight_stab;
-	int	_nolocaltimewait;
-	int	_path_mtu_discovery;
-	int	_ss_fltsz;
-	int	_ss_fltsz_local;
-	int	_tcp_do_newreno;
-	int	_tcp_do_tso;
-	int	_tcp_do_autosndbuf;
-	int	_tcp_autosndbuf_inc;
-	int	_tcp_autosndbuf_max;
-	int	_tcp_do_sack;
-	int	_tcp_sack_maxholes;
-	int	_tcp_sack_globalmaxholes;
-	int	_tcp_sack_globalholes;
-	int	_blackhole;
-	int	_tcp_delack_enabled;
-	int	_drop_synfin;
-	int	_tcp_do_rfc3042;
-	int	_tcp_do_rfc3390;
-	int	_tcp_do_rfc3465;
-	int	_tcp_abc_l_var;
-	int	_tcp_do_ecn;
-	int	_tcp_ecn_maxretries;
-	int	_tcp_insecure_rst;
-	int	_tcp_do_autorcvbuf;
-	int	_tcp_autorcvbuf_inc;
-	int	_tcp_autorcvbuf_max;
-	int	_tcp_reass_maxseg;
-	int	_tcp_reass_qsize;
-	int	_tcp_reass_maxqlen;
-	int	_tcp_reass_overflows;
-
-	u_char	_isn_secret[32];
-	int	_isn_last_reseed;
-	u_int32_t _isn_offset;
-	u_int32_t _isn_offset_old;
-
-	struct	inpcbhead _udb;
-	struct	inpcbinfo _udbinfo;
-	struct	udpstat	_udpstat;
-	int	_udp_blackhole;
-
-	struct	inpcbhead _ripcb;
-	struct	inpcbinfo _ripcbinfo;
-	struct	socket *_ip_mrouter;
-
-	struct	socket *_ip_rsvpd;
-	int	_ip_rsvp_on;
-	int	_rsvp_on;
-
-	struct	icmpstat _icmpstat;
-	struct	ipstat _ipstat;
-
-	LIST_HEAD(, igmp_ifinfo)	 _igi_head;
-	struct igmpstat	 _igmpstat;
-	int		 _interface_timers_running;
-	int		 _state_change_timers_running;
-	int		 _current_state_timers_running;
-	int		 _igmp_recvifkludge;
-	int		 _igmp_sendra;
-	int		 _igmp_sendlocal;
-	int		 _igmp_v1enable;
-	int		 _igmp_v2enable;
-	int		 _igmp_legacysupp;
-	int		 _igmp_sgalloc;
-	int		 _igmp_default_version;
-	struct timeval	 _igmp_gsrdelay;
-
-	int	_rtq_timeout;
-	int	_rtq_reallyold;
-	int	_rtq_minreallyold;
-	int	_rtq_toomany;
-	struct	callout _rtq_timer;
-
-	int	_ipport_lowfirstauto;
-	int	_ipport_lowlastauto;
-	int	_ipport_firstauto;
-	int	_ipport_lastauto;
-	int	_ipport_hifirstauto;
-	int	_ipport_hilastauto;
-	int	_ipport_reservedhigh;
-	int	_ipport_reservedlow;
-	int	_ipport_randomized;
-	int	_ipport_randomcps;
-	int	_ipport_randomtime;
-	int	_ipport_stoprandom;
-	int	_ipport_tcpallocs;
-	int	_ipport_tcplastcount;
-
-	int	_icmpmaskrepl;
-	u_int	_icmpmaskfake;
-	int	_drop_redirect;
-	int	_log_redirect;
-	int	_icmplim;
-	int	_icmplim_output;
-	char	_reply_src[IFNAMSIZ];
-	int	_icmp_rfi;
-	int	_icmp_quotelen;
-	int	_icmpbmcastecho;
+	struct inpcbhead	_tcb;	/* head of queue of active tcpcb's */
+	struct inpcbinfo	_tcbinfo;
+	struct tcpstat		_tcpstat; /* tcp statistics */
+	struct tcp_hostcache	_tcp_hostcache;
+	struct callout		_tcp_hc_callout;
+
+	uma_zone_t		_tcp_reass_zone;
+	uma_zone_t		_tcpcb_zone;
+	uma_zone_t		_tcptw_zone;
+	uma_zone_t		_sack_hole_zone;
+
+	struct tcp_syncache	_tcp_syncache;
+	int			_tcp_syncookies;
+	int			_tcp_syncookiesonly;
+	int			_tcp_sc_rst_sock_fail;
+
+	struct inpcbhead	_divcb;
+	struct inpcbinfo	_divcbinfo;
+	TAILQ_HEAD(, tcptw)	_twq_2msl;
+
+	int			_tcp_mssdflt;
+	int			_tcp_v6mssdflt;
+	int			_tcp_minmss;
+	int			_tcp_do_rfc1323;
+	int			_icmp_may_rst;
+	int			_tcp_isn_reseed_interval;
+	int			_tcp_inflight_enable;
+	int			_tcp_inflight_rttthresh;
+	int			_tcp_inflight_min;
+	int			_tcp_inflight_max;
+	int			_tcp_inflight_stab;
+	int			_nolocaltimewait;
+	int			_path_mtu_discovery;
+	int			_ss_fltsz;
+	int			_ss_fltsz_local;
+	int			_tcp_do_newreno;
+	int			_tcp_do_tso;
+	int			_tcp_do_autosndbuf;
+	int			_tcp_autosndbuf_inc;
+	int			_tcp_autosndbuf_max;
+	int			_tcp_do_sack;
+	int			_tcp_sack_maxholes;
+	int			_tcp_sack_globalmaxholes;
+	int			_tcp_sack_globalholes;
+	int			_blackhole;
+	int			_tcp_delack_enabled;
+	int			_drop_synfin;
+	int			_tcp_do_rfc3042;
+	int			_tcp_do_rfc3390;
+	int			_tcp_do_rfc3465;
+	int			_tcp_abc_l_var;
+	int			_tcp_do_ecn;
+	int			_tcp_ecn_maxretries;
+	int			_tcp_insecure_rst;
+	int			_tcp_do_autorcvbuf;
+	int			_tcp_autorcvbuf_inc;
+	int			_tcp_autorcvbuf_max;
+	int			_tcp_reass_maxseg;
+	int			_tcp_reass_qsize;
+	int			_tcp_reass_maxqlen;
+	int			_tcp_reass_overflows;
+
+	u_char			_isn_secret[32];
+	int			_isn_last_reseed;
+	u_int32_t		_isn_offset;
+	u_int32_t		_isn_offset_old;
+
+	struct inpcbhead	_udb;
+	struct inpcbinfo	_udbinfo;
+	struct udpstat		_udpstat;
+	int			_udp_blackhole;
+
+	struct inpcbhead	_ripcb;
+	struct inpcbinfo	_ripcbinfo;
+	struct socket *		_ip_mrouter;
+
+	struct socket *		_ip_rsvpd;
+	int			_ip_rsvp_on;
+	int			_rsvp_on;
+
+	struct icmpstat		_icmpstat;
+	struct ipstat		_ipstat;
+
+	LIST_HEAD(, igmp_ifinfo) _igi_head;
+	struct igmpstat		_igmpstat;
+	int			_interface_timers_running;
+	int			_state_change_timers_running;
+	int			_current_state_timers_running;
+	int			_igmp_recvifkludge;
+	int			_igmp_sendra;
+	int			_igmp_sendlocal;
+	int			_igmp_v1enable;
+	int			_igmp_v2enable;
+	int			_igmp_legacysupp;
+	int			_igmp_sgalloc;
+	int			_igmp_default_version;
+	struct timeval		_igmp_gsrdelay;
+
+	int			_rtq_timeout;
+	int			_rtq_reallyold;
+	int			_rtq_minreallyold;
+	int			_rtq_toomany;
+	struct callout		_rtq_timer;
+
+	int			_ipport_lowfirstauto;
+	int			_ipport_lowlastauto;
+	int			_ipport_firstauto;
+	int			_ipport_lastauto;
+	int			_ipport_hifirstauto;
+	int			_ipport_hilastauto;
+	int			_ipport_reservedhigh;
+	int			_ipport_reservedlow;
+	int			_ipport_randomized;
+	int			_ipport_randomcps;
+	int			_ipport_randomtime;
+	int			_ipport_stoprandom;
+	int			_ipport_tcpallocs;
+	int			_ipport_tcplastcount;
+
+	int			_icmpmaskrepl;
+	u_int			_icmpmaskfake;
+	int			_drop_redirect;
+	int			_log_redirect;
+	int			_icmplim;
+	int			_icmplim_output;
+	char			_reply_src[IFNAMSIZ];
+	int			_icmp_rfi;
+	int			_icmp_quotelen;
+	int			_icmpbmcastecho;
 
-	int	_fw_one_pass;
+	int			_fw_one_pass;
 };
 
 /* Size guard. See sys/vimage.h. */

Modified: head/sys/netinet6/vinet6.h
==============================================================================
--- head/sys/netinet6/vinet6.h	Sat May  2 07:02:31 2009	(r191737)
+++ head/sys/netinet6/vinet6.h	Sat May  2 08:16:26 2009	(r191738)
@@ -48,112 +48,112 @@
 #include 
 
 struct vnet_inet6 {
-	struct in6_ifaddr *		_in6_ifaddr;
+	struct in6_ifaddr *	_in6_ifaddr;
 
-	u_int				_frag6_nfragpackets;
-	u_int				_frag6_nfrags;
-	struct ip6q			_ip6q;
+	u_int			_frag6_nfragpackets;
+	u_int			_frag6_nfrags;
+	struct ip6q		_ip6q;
 
-	struct in6_addrpolicy 		_defaultaddrpolicy;
+	struct in6_addrpolicy 	_defaultaddrpolicy;
 	TAILQ_HEAD(, addrsel_policyent) _addrsel_policytab;
-	u_int				_in6_maxmtu;
-	int				_ip6_auto_linklocal;
-	int				_rtq_minreallyold6;
-	int				_rtq_reallyold6;
-	int				_rtq_toomany6;
-
-	struct ip6stat 			_ip6stat;
-	struct rip6stat 		_rip6stat;
-	struct icmp6stat 		_icmp6stat;
-
-	int				_rtq_timeout6;  
-	struct callout 			_rtq_timer6;
-	struct callout 			_rtq_mtutimer;
-	struct callout 			_nd6_slowtimo_ch;
-	struct callout 			_nd6_timer_ch;
-	struct callout 			_in6_tmpaddrtimer_ch;
-
-	int				_nd6_inuse;
-	int				_nd6_allocated;
-	int				_nd6_onlink_ns_rfc4861;
-	struct nd_drhead		_nd_defrouter;
-	struct nd_prhead 		_nd_prefix;
-	struct ifnet *			_nd6_defifp;
-	int				_nd6_defifindex;
-
-	struct scope6_id 		_sid_default;
-
-	TAILQ_HEAD(, dadq) 		_dadq;
-	int				_dad_init;
-
-	int				_icmp6errpps_count;
-	struct timeval			_icmp6errppslim_last;
-
-	int 				_ip6_forwarding;
-	int				_ip6_sendredirects;
-	int				_ip6_defhlim;
-	int				_ip6_defmcasthlim;
-	int				_ip6_accept_rtadv;
-	int				_ip6_maxfragpackets;
-	int				_ip6_maxfrags;
-	int				_ip6_log_interval;
-	int				_ip6_hdrnestlimit;
-	int				_ip6_dad_count;
-	int				_ip6_auto_flowlabel;
-	int				_ip6_use_deprecated;
-	int				_ip6_rr_prune;
-	int				_ip6_mcast_pmtu;
-	int				_ip6_v6only;
-	int				_ip6_keepfaith;
-	int				_ip6stealth;
-	time_t				_ip6_log_time;
-
-	int				_pmtu_expire;
-	int				_pmtu_probe;
-	u_long				_rip6_sendspace;
-	u_long				_rip6_recvspace;
-	int				_icmp6_rediraccept;
-	int				_icmp6_redirtimeout;
-	int				_icmp6errppslim;
-	int				_icmp6_nodeinfo;
-	int				_udp6_sendspace;
-	int				_udp6_recvspace;
-	int				_ip6qmaxlen;
-	int				_ip6_prefer_tempaddr;
-
-	int				_nd6_prune;
-	int				_nd6_delay;
-	int				_nd6_umaxtries;
-	int				_nd6_mmaxtries;
-	int				_nd6_useloopback;
-	int				_nd6_gctimer;
-	int				_nd6_maxndopt;
-	int				_nd6_maxnudhint;
-	int				_nd6_maxqueuelen;
-	int				_nd6_debug;
-	int				_nd6_recalc_reachtm_interval;
-	int				_dad_ignore_ns;
-	int				_dad_maxtry;
-	int				_ip6_use_tempaddr;
-	int				_ip6_desync_factor;
-	u_int32_t			_ip6_temp_preferred_lifetime;
-	u_int32_t			_ip6_temp_valid_lifetime;
-
-	struct socket *			_ip6_mrouter;
-	int				_ip6_mrouter_ver;
-	int				_pim6;
-	u_int				_mrt6debug;
-
-	int				_ip6_temp_regen_advance;
-	int				_ip6_use_defzone;
-
-	struct ip6_pktopts		_ip6_opts;
-
-	struct timeval			_mld_gsrdelay;
-	LIST_HEAD(, mld_ifinfo)		_mli_head;
-	int				_interface_timers_running6;
-	int				_state_change_timers_running6;
-	int				_current_state_timers_running6;
+	u_int			_in6_maxmtu;
+	int			_ip6_auto_linklocal;
+	int			_rtq_minreallyold6;
+	int			_rtq_reallyold6;
+	int			_rtq_toomany6;
+
+	struct ip6stat 		_ip6stat;
+	struct rip6stat 	_rip6stat;
+	struct icmp6stat 	_icmp6stat;
+
+	int			_rtq_timeout6;  
+	struct callout 		_rtq_timer6;
+	struct callout 		_rtq_mtutimer;
+	struct callout 		_nd6_slowtimo_ch;
+	struct callout 		_nd6_timer_ch;
+	struct callout 		_in6_tmpaddrtimer_ch;
+
+	int			_nd6_inuse;
+	int			_nd6_allocated;
+	int			_nd6_onlink_ns_rfc4861;
+	struct nd_drhead	_nd_defrouter;
+	struct nd_prhead 	_nd_prefix;
+	struct ifnet *		_nd6_defifp;
+	int			_nd6_defifindex;
+
+	struct scope6_id 	_sid_default;
+
+	TAILQ_HEAD(, dadq) 	_dadq;
+	int			_dad_init;
+
+	int			_icmp6errpps_count;
+	struct timeval		_icmp6errppslim_last;
+
+	int 			_ip6_forwarding;
+	int			_ip6_sendredirects;
+	int			_ip6_defhlim;
+	int			_ip6_defmcasthlim;
+	int			_ip6_accept_rtadv;
+	int			_ip6_maxfragpackets;
+	int			_ip6_maxfrags;
+	int			_ip6_log_interval;
+	int			_ip6_hdrnestlimit;
+	int			_ip6_dad_count;
+	int			_ip6_auto_flowlabel;
+	int			_ip6_use_deprecated;
+	int			_ip6_rr_prune;
+	int			_ip6_mcast_pmtu;
+	int			_ip6_v6only;
+	int			_ip6_keepfaith;
+	int			_ip6stealth;
+	time_t			_ip6_log_time;
+
+	int			_pmtu_expire;
+	int			_pmtu_probe;
+	u_long			_rip6_sendspace;
+	u_long			_rip6_recvspace;
+	int			_icmp6_rediraccept;
+	int			_icmp6_redirtimeout;
+	int			_icmp6errppslim;
+	int			_icmp6_nodeinfo;
+	int			_udp6_sendspace;
+	int			_udp6_recvspace;
+	int			_ip6qmaxlen;
+	int			_ip6_prefer_tempaddr;
+
+	int			_nd6_prune;
+	int			_nd6_delay;
+	int			_nd6_umaxtries;
+	int			_nd6_mmaxtries;
+	int			_nd6_useloopback;
+	int			_nd6_gctimer;
+	int			_nd6_maxndopt;
+	int			_nd6_maxnudhint;
+	int			_nd6_maxqueuelen;
+	int			_nd6_debug;
+	int			_nd6_recalc_reachtm_interval;
+	int			_dad_ignore_ns;
+	int			_dad_maxtry;
+	int			_ip6_use_tempaddr;
+	int			_ip6_desync_factor;
+	u_int32_t		_ip6_temp_preferred_lifetime;
+	u_int32_t		_ip6_temp_valid_lifetime;
+
+	struct socket *		_ip6_mrouter;
+	int			_ip6_mrouter_ver;
+	int			_pim6;
+	u_int			_mrt6debug;
+
+	int			_ip6_temp_regen_advance;
+	int			_ip6_use_defzone;
+
+	struct ip6_pktopts	_ip6_opts;
+
+	struct timeval		_mld_gsrdelay;
+	LIST_HEAD(, mld_ifinfo)	_mli_head;
+	int			_interface_timers_running6;
+	int			_state_change_timers_running6;
+	int			_current_state_timers_running6;
 };
 
 /* Size guard. See sys/vimage.h. */

Modified: head/sys/netipsec/vipsec.h
==============================================================================
--- head/sys/netipsec/vipsec.h	Sat May  2 07:02:31 2009	(r191737)
+++ head/sys/netipsec/vipsec.h	Sat May  2 08:16:26 2009	(r191738)
@@ -47,8 +47,8 @@
 
 struct vnet_ipsec {
 	int			_ipsec_debug;
-	struct	ipsecstat	_ipsec4stat;
-	struct	secpolicy 	_ip4_def_policy;
+	struct ipsecstat	_ipsec4stat;
+	struct secpolicy 	_ip4_def_policy;
 
 	int			_ip4_esp_trans_deflev;
 	int			_ip4_esp_net_deflev;

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 10:06:51 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5D90A1065676;
	Sat,  2 May 2009 10:06:51 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4103E8FC0A;
	Sat,  2 May 2009 10:06:51 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42A6nsv079221;
	Sat, 2 May 2009 10:06:49 GMT (envelope-from dchagin@svn.freebsd.org)
Received: (from dchagin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42A6n85079217;
	Sat, 2 May 2009 10:06:49 GMT (envelope-from dchagin@svn.freebsd.org)
Message-Id: <200905021006.n42A6n85079217@svn.freebsd.org>
From: Dmitry Chagin 
Date: Sat, 2 May 2009 10:06:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191741 - in head/sys: amd64/linux32 compat/linux
	i386/linux
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 10:06:51 -0000

Author: dchagin
Date: Sat May  2 10:06:49 2009
New Revision: 191741
URL: http://svn.freebsd.org/changeset/base/191741

Log:
  Move extern variable definitions to the header file.
  
  Approved by:	kib (mentor)
  MFC after:	1 month

Modified:
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/compat/linux/linux_futex.c
  head/sys/compat/linux/linux_futex.h
  head/sys/i386/linux/linux_sysvec.c

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- head/sys/amd64/linux32/linux32_sysvec.c	Sat May  2 09:11:21 2009	(r191740)
+++ head/sys/amd64/linux32/linux32_sysvec.c	Sat May  2 10:06:49 2009	(r191741)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -127,9 +128,6 @@ static void	exec_linux_setregs(struct th
 				   u_long stack, u_long ps_strings);
 static void	linux32_fixlimit(struct rlimit *rl, int which);
 
-extern LIST_HEAD(futex_list, futex) futex_list;
-extern struct mtx futex_mtx;
-
 static eventhandler_tag linux_exit_tag;
 static eventhandler_tag linux_schedtail_tag;
 static eventhandler_tag linux_exec_tag;

Modified: head/sys/compat/linux/linux_futex.c
==============================================================================
--- head/sys/compat/linux/linux_futex.c	Sat May  2 09:11:21 2009	(r191740)
+++ head/sys/compat/linux/linux_futex.c	Sat May  2 10:06:49 2009	(r191741)
@@ -81,7 +81,7 @@ struct futex {
 	TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc;
 };
 
-LIST_HEAD(futex_list, futex) futex_list;
+struct futex_list futex_list;
 
 #define FUTEX_LOCK(f)		sx_xlock(&(f)->f_lck)
 #define FUTEX_UNLOCK(f)		sx_xunlock(&(f)->f_lck)

Modified: head/sys/compat/linux/linux_futex.h
==============================================================================
--- head/sys/compat/linux/linux_futex.h	Sat May  2 09:11:21 2009	(r191740)
+++ head/sys/compat/linux/linux_futex.h	Sat May  2 10:06:49 2009	(r191741)
@@ -36,6 +36,9 @@
 #ifndef _LINUX_FUTEX_H
 #define _LINUX_FUTEX_H
 
+extern LIST_HEAD(futex_list, futex) futex_list;
+extern struct mtx futex_mtx;
+
 #define LINUX_FUTEX_WAIT	0
 #define LINUX_FUTEX_WAKE	1
 #define LINUX_FUTEX_FD		2	/* unused */

Modified: head/sys/i386/linux/linux_sysvec.c
==============================================================================
--- head/sys/i386/linux/linux_sysvec.c	Sat May  2 09:11:21 2009	(r191740)
+++ head/sys/i386/linux/linux_sysvec.c	Sat May  2 10:06:49 2009	(r191741)
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -111,9 +112,6 @@ static register_t *linux_copyout_strings
 static int linux_szplatform;
 const char *linux_platform;
 
-extern LIST_HEAD(futex_list, futex) futex_list;
-extern struct mtx futex_mtx;
-
 static eventhandler_tag linux_exit_tag;
 static eventhandler_tag linux_schedtail_tag;
 static eventhandler_tag linux_exec_tag;

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 10:51:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D049A10656BF;
	Sat,  2 May 2009 10:51:40 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6F4808FC19;
	Sat,  2 May 2009 10:51:40 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42Apef1083034;
	Sat, 2 May 2009 10:51:40 GMT (envelope-from dchagin@svn.freebsd.org)
Received: (from dchagin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42ApetI083033;
	Sat, 2 May 2009 10:51:40 GMT (envelope-from dchagin@svn.freebsd.org)
Message-Id: <200905021051.n42ApetI083033@svn.freebsd.org>
From: Dmitry Chagin 
Date: Sat, 2 May 2009 10:51:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191742 - head/sys/compat/linux
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 10:51:42 -0000

Author: dchagin
Date: Sat May  2 10:51:40 2009
New Revision: 191742
URL: http://svn.freebsd.org/changeset/base/191742

Log:
  Linux socketpair() call expects explicit specified protocol for
  AF_LOCAL domain unlike FreeBSD which expects 0 in this case.
  
  Approved by:	kib (mentor)
  MFC after:	1 month

Modified:
  head/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==============================================================================
--- head/sys/compat/linux/linux_socket.c	Sat May  2 10:06:49 2009	(r191741)
+++ head/sys/compat/linux/linux_socket.c	Sat May  2 10:51:40 2009	(r191742)
@@ -859,7 +859,10 @@ linux_socketpair(struct thread *td, stru
 		return (EINVAL);
 
 	bsd_args.type = args->type;
-	bsd_args.protocol = args->protocol;
+	if (bsd_args.domain == AF_LOCAL && args->protocol == PF_UNIX)
+		bsd_args.protocol = 0;
+	else
+		bsd_args.protocol = args->protocol;
 	bsd_args.rsv = (int *)PTRIN(args->rsv);
 	return (socketpair(td, &bsd_args));
 }

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 11:59:57 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0FC10106564A;
	Sat,  2 May 2009 11:59:57 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F2FBD8FC12;
	Sat,  2 May 2009 11:59:56 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42BxuB6084286;
	Sat, 2 May 2009 11:59:56 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42BxuDF084285;
	Sat, 2 May 2009 11:59:56 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200905021159.n42BxuDF084285@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 2 May 2009 11:59:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191743 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 11:59:57 -0000

Author: hrs
Date: Sat May  2 11:59:56 2009
New Revision: 191743
URL: http://svn.freebsd.org/changeset/base/191743

Log:
  Fix typos:
  	s,Novatal,Novatel,
  	s,/sys/dev/u3g.c,/sys/dev/usb/serial/u3g.c,
  
  MFC after:      3 days

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

Modified: head/share/man/man4/u3g.4
==============================================================================
--- head/share/man/man4/u3g.4	Sat May  2 10:51:40 2009	(r191742)
+++ head/share/man/man4/u3g.4	Sat May  2 11:59:56 2009	(r191743)
@@ -66,13 +66,13 @@ Qualcomm Inc. CDMA MSM
 .It
 Huawei B190, E220 ('')
 .It
-Novatal U740, MC950D, X950D, etc.
+Novatel U740, MC950D, X950D, etc.
 .It
 Sierra MC875U, MC8775U, etc.
 .El
 .Pp
 (See
-.Pa /sys/dev/u3g.c
+.Pa /sys/dev/usb/serial/u3g.c
 for the complete list of supported cards for each vendor
 mentioned above.)
 .Pp

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 12:20:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EFCCE1065670;
	Sat,  2 May 2009 12:20:43 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DE3708FC22;
	Sat,  2 May 2009 12:20:43 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42CKhHT084720;
	Sat, 2 May 2009 12:20:43 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42CKh4A084716;
	Sat, 2 May 2009 12:20:43 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200905021220.n42CKh4A084716@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 2 May 2009 12:20:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191744 - in head/sys/amd64: amd64 include isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 12:20:44 -0000

Author: mav
Date: Sat May  2 12:20:43 2009
New Revision: 191744
URL: http://svn.freebsd.org/changeset/base/191744

Log:
  Add support for using i8254 and rtc timers as event sources for amd64 SMP
  system. Redistribute hard-/stat-/profclock events to other CPUs using IPIs.

Modified:
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/amd64/include/apicvar.h
  head/sys/amd64/include/clock.h
  head/sys/amd64/isa/clock.c

Modified: head/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- head/sys/amd64/amd64/mp_machdep.c	Sat May  2 11:59:56 2009	(r191743)
+++ head/sys/amd64/amd64/mp_machdep.c	Sat May  2 12:20:43 2009	(r191744)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1124,6 +1125,15 @@ ipi_bitmap_handler(struct trapframe fram
 		sched_preempt(curthread);
 
 	/* Nothing to do for AST */
+
+	if (ipi_bitmap & (1 << IPI_HARDCLOCK))
+		hardclockintr(&frame);
+
+	if (ipi_bitmap & (1 << IPI_STATCLOCK))
+		statclockintr(&frame);
+
+	if (ipi_bitmap & (1 << IPI_PROFCLOCK))
+		profclockintr(&frame);
 }
 
 /*

Modified: head/sys/amd64/include/apicvar.h
==============================================================================
--- head/sys/amd64/include/apicvar.h	Sat May  2 11:59:56 2009	(r191743)
+++ head/sys/amd64/include/apicvar.h	Sat May  2 12:20:43 2009	(r191744)
@@ -126,7 +126,10 @@
 /* IPIs handled by IPI_BITMAPED_VECTOR  (XXX ups is there a better place?) */
 #define	IPI_AST		0 	/* Generate software trap. */
 #define IPI_PREEMPT     1
-#define IPI_BITMAP_LAST IPI_PREEMPT
+#define IPI_HARDCLOCK   2
+#define IPI_STATCLOCK   3
+#define IPI_PROFCLOCK   4
+#define IPI_BITMAP_LAST IPI_PROFCLOCK
 #define IPI_IS_BITMAPED(x) ((x) <= IPI_BITMAP_LAST)
 
 #define	IPI_STOP	(APIC_IPI_INTS + 7)	/* Stop CPU until restarted. */

Modified: head/sys/amd64/include/clock.h
==============================================================================
--- head/sys/amd64/include/clock.h	Sat May  2 11:59:56 2009	(r191743)
+++ head/sys/amd64/include/clock.h	Sat May  2 12:20:43 2009	(r191744)
@@ -24,6 +24,12 @@ extern int	tsc_is_invariant;
 
 void	i8254_init(void);
 
+struct trapframe;
+
+int	hardclockintr(struct trapframe *frame);
+int	statclockintr(struct trapframe *frame);
+int	profclockintr(struct trapframe *frame);
+
 /*
  * Driver to clock driver interface.
  */

Modified: head/sys/amd64/isa/clock.c
==============================================================================
--- head/sys/amd64/isa/clock.c	Sat May  2 11:59:56 2009	(r191743)
+++ head/sys/amd64/isa/clock.c	Sat May  2 12:20:43 2009	(r191744)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -62,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #ifdef DEV_ISA
@@ -112,6 +114,35 @@ static struct timecounter i8254_timecoun
 	0			/* quality */
 };
 
+int
+hardclockintr(struct trapframe *frame)
+{
+
+	if (PCPU_GET(cpuid) == 0)
+		hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+	else
+		hardclock_cpu(TRAPF_USERMODE(frame));
+	return (FILTER_HANDLED);
+}
+
+int
+statclockintr(struct trapframe *frame)
+{
+
+	if (profprocs != 0)
+		profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+	statclock(TRAPF_USERMODE(frame));
+	return (FILTER_HANDLED);
+}
+
+int
+profclockintr(struct trapframe *frame)
+{
+
+	profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+	return (FILTER_HANDLED);
+}
+
 static int
 clkintr(struct trapframe *frame)
 {
@@ -128,7 +159,14 @@ clkintr(struct trapframe *frame)
 		mtx_unlock_spin(&clock_lock);
 	}
 	KASSERT(!using_lapic_timer, ("clk interrupt enabled with lapic timer"));
-	hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+#ifdef SMP
+	if (smp_started)
+		ipi_all_but_self(IPI_HARDCLOCK);
+#endif
+	if (PCPU_GET(cpuid) == 0)
+		hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+	else
+		hardclock_cpu(TRAPF_USERMODE(frame));
 	return (FILTER_HANDLED);
 }
 
@@ -209,10 +247,19 @@ rtcintr(struct trapframe *frame)
 		if (profprocs != 0) {
 			if (--pscnt == 0)
 				pscnt = psdiv;
+#ifdef SMP
+			if (pscnt != psdiv && smp_started)
+				ipi_all_but_self(IPI_PROFCLOCK);
+#endif
 			profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
 		}
-		if (pscnt == psdiv)
+		if (pscnt == psdiv) {
+#ifdef SMP
+			if (smp_started)
+				ipi_all_but_self(IPI_STATCLOCK);
+#endif
 			statclock(TRAPF_USERMODE(frame));
+		}
 	}
 	return(flag ? FILTER_HANDLED : FILTER_STRAY);
 }

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 12:59:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 99662106566C;
	Sat,  2 May 2009 12:59:47 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 87C898FC0C;
	Sat,  2 May 2009 12:59:47 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42CxlT1085529;
	Sat, 2 May 2009 12:59:47 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42Cxl0u085525;
	Sat, 2 May 2009 12:59:47 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200905021259.n42Cxl0u085525@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 2 May 2009 12:59:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191745 - in head/sys/i386: i386 include isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 12:59:48 -0000

Author: mav
Date: Sat May  2 12:59:47 2009
New Revision: 191745
URL: http://svn.freebsd.org/changeset/base/191745

Log:
  Add support for using i8254 and rtc timers as event sources for i386 SMP
  system. Redistribute hard-/stat-/profclock events to other CPUs using IPI.

Modified:
  head/sys/i386/i386/mp_machdep.c
  head/sys/i386/include/apicvar.h
  head/sys/i386/include/clock.h
  head/sys/i386/isa/clock.c

Modified: head/sys/i386/i386/mp_machdep.c
==============================================================================
--- head/sys/i386/i386/mp_machdep.c	Sat May  2 12:20:43 2009	(r191744)
+++ head/sys/i386/i386/mp_machdep.c	Sat May  2 12:59:47 2009	(r191745)
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1284,6 +1285,15 @@ ipi_bitmap_handler(struct trapframe fram
 #endif
 		/* Nothing to do for AST */
 	}
+
+	if (ipi_bitmap & (1 << IPI_HARDCLOCK))
+		hardclockintr(&frame); 
+
+	if (ipi_bitmap & (1 << IPI_STATCLOCK))
+		statclockintr(&frame); 
+
+	if (ipi_bitmap & (1 << IPI_PROFCLOCK))
+		profclockintr(&frame);
 }
 
 /*

Modified: head/sys/i386/include/apicvar.h
==============================================================================
--- head/sys/i386/include/apicvar.h	Sat May  2 12:20:43 2009	(r191744)
+++ head/sys/i386/include/apicvar.h	Sat May  2 12:59:47 2009	(r191745)
@@ -137,7 +137,10 @@
 /* IPIs handled by IPI_BITMAPED_VECTOR  (XXX ups is there a better place?) */
 #define	IPI_AST		0 	/* Generate software trap. */
 #define IPI_PREEMPT     1
-#define IPI_BITMAP_LAST IPI_PREEMPT
+#define IPI_HARDCLOCK   2 
+#define IPI_STATCLOCK   3 
+#define IPI_PROFCLOCK   4 
+#define IPI_BITMAP_LAST IPI_PROFCLOCK
 #define IPI_IS_BITMAPED(x) ((x) <= IPI_BITMAP_LAST)
 
 #define	IPI_STOP	(APIC_IPI_INTS + 7)	/* Stop CPU until restarted. */

Modified: head/sys/i386/include/clock.h
==============================================================================
--- head/sys/i386/include/clock.h	Sat May  2 12:20:43 2009	(r191744)
+++ head/sys/i386/include/clock.h	Sat May  2 12:59:47 2009	(r191745)
@@ -24,6 +24,12 @@ extern int	tsc_is_invariant;
 
 void	i8254_init(void);
 
+struct trapframe;
+ 
+int	hardclockintr(struct trapframe *frame);
+int	statclockintr(struct trapframe *frame);
+int	profclockintr(struct trapframe *frame);
+
 /*
  * Driver to clock driver interface.
  */

Modified: head/sys/i386/isa/clock.c
==============================================================================
--- head/sys/i386/isa/clock.c	Sat May  2 12:20:43 2009	(r191744)
+++ head/sys/i386/isa/clock.c	Sat May  2 12:59:47 2009	(r191745)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -69,6 +70,7 @@ __FBSDID("$FreeBSD$");
 #endif
 #include 
 #include 
+#include 
 
 #include 
 #ifdef DEV_ISA
@@ -127,6 +129,35 @@ static struct timecounter i8254_timecoun
 	0			/* quality */
 };
 
+int
+hardclockintr(struct trapframe *frame)
+{
+
+	if (PCPU_GET(cpuid) == 0)
+		hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+	else
+		hardclock_cpu(TRAPF_USERMODE(frame));
+	return (FILTER_HANDLED);
+}
+
+int
+statclockintr(struct trapframe *frame)
+{
+
+	if (profprocs != 0)
+		profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+	statclock(TRAPF_USERMODE(frame));
+	return (FILTER_HANDLED);
+}
+
+int
+profclockintr(struct trapframe *frame)
+{
+
+	profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+	return (FILTER_HANDLED);
+}
+
 static int
 clkintr(struct trapframe *frame)
 {
@@ -155,7 +186,14 @@ clkintr(struct trapframe *frame)
 		(*lapic_cyclic_clock_func[cpu])(frame);
 #endif
 
-	hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+#ifdef SMP
+	if (smp_started)
+		ipi_all_but_self(IPI_HARDCLOCK);
+#endif 
+	if (PCPU_GET(cpuid) == 0)
+		hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+	else
+		hardclock_cpu(TRAPF_USERMODE(frame));
 #ifdef DEV_MCA
 	/* Reset clock interrupt by asserting bit 7 of port 0x61 */
 	if (MCA_system)
@@ -241,10 +279,19 @@ rtcintr(struct trapframe *frame)
 		if (profprocs != 0) {
 			if (--pscnt == 0)
 				pscnt = psdiv;
+#ifdef SMP
+			if (pscnt != psdiv && smp_started)
+				ipi_all_but_self(IPI_PROFCLOCK);
+#endif
 			profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
 		}
-		if (pscnt == psdiv)
+		if (pscnt == psdiv) {
+#ifdef SMP
+			if (smp_started) 
+				ipi_all_but_self(IPI_STATCLOCK); 
+#endif
 			statclock(TRAPF_USERMODE(frame));
+		}
 	}
 	return(flag ? FILTER_HANDLED : FILTER_STRAY);
 }

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 15:14:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E6751065673;
	Sat,  2 May 2009 15:14:19 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 59C5B8FC12;
	Sat,  2 May 2009 15:14:19 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42FEJ9j088110;
	Sat, 2 May 2009 15:14:19 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42FEJ6u088104;
	Sat, 2 May 2009 15:14:19 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905021514.n42FEJ6u088104@svn.freebsd.org>
From: Andrew Thompson 
Date: Sat, 2 May 2009 15:14:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191746 - in head/sys: dev/if_ndis dev/ipw dev/iwi
	dev/iwn dev/usb/wlan dev/wi dev/wpi net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 15:14:20 -0000

Author: thompsa
Date: Sat May  2 15:14:18 2009
New Revision: 191746
URL: http://svn.freebsd.org/changeset/base/191746

Log:
  Create a taskqueue for each wireless interface which provides a serialised
  sleepable context for net80211 driver callbacks. This removes the need for USB
  and firmware based drivers to roll their own code to defer the chip programming
  for state changes, scan requests, channel changes and mcast/promisc updates.
  When a driver callback completes the hardware state is now guaranteed to have
  been updated and is in sync with net80211 layer.
  
  This nukes around 1300 lines of code from the wireless device drivers making
  them more readable and less race prone.
  
  The net80211 layer has been updated as follows
   - all state/channel changes are serialised on the taskqueue.
   - ieee80211_new_state() always queues and can now be called from any context
   - scanning runs from a single taskq function and executes to completion. driver
     callbacks are synchronous so the channel, phy mode and rx filters are
     guaranteed to be set in hardware before probe request frames are
     transmitted.
  
  Help and contributions from Sam Leffler.
  
  Reviewed by:	sam

Deleted:
  head/sys/dev/usb/wlan/usb_wlan.h
Modified:
  head/sys/dev/if_ndis/if_ndis.c
  head/sys/dev/if_ndis/if_ndisvar.h
  head/sys/dev/ipw/if_ipw.c
  head/sys/dev/ipw/if_ipwvar.h
  head/sys/dev/iwi/if_iwi.c
  head/sys/dev/iwi/if_iwivar.h
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnvar.h
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_rumvar.h
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_uathvar.h
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_uralvar.h
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/dev/usb/wlan/if_zydreg.h
  head/sys/dev/wi/if_wi.c
  head/sys/dev/wi/if_wivar.h
  head/sys/dev/wpi/if_wpi.c
  head/sys/dev/wpi/if_wpivar.h
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_freebsd.h
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_node.h
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_scan.c
  head/sys/net80211/ieee80211_scan.h
  head/sys/net80211/ieee80211_scan_sta.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/dev/if_ndis/if_ndis.c
==============================================================================
--- head/sys/dev/if_ndis/if_ndis.c	Sat May  2 12:59:47 2009	(r191745)
+++ head/sys/dev/if_ndis/if_ndis.c	Sat May  2 15:14:18 2009	(r191746)
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 
 #include 
@@ -173,7 +172,7 @@ static int ndis_newstate	(struct ieee802
 	int);
 static int ndis_nettype_chan	(uint32_t);
 static int ndis_nettype_mode	(uint32_t);
-static void ndis_scan		(void *, int);
+static void ndis_scan		(void *);
 static void ndis_scan_results	(struct ndis_softc *);
 static void ndis_scan_start	(struct ieee80211com *);
 static void ndis_scan_end	(struct ieee80211com *);
@@ -184,8 +183,6 @@ static void ndis_init		(void *);
 static void ndis_stop		(struct ndis_softc *);
 static int ndis_ifmedia_upd	(struct ifnet *);
 static void ndis_ifmedia_sts	(struct ifnet *, struct ifmediareq *);
-static void ndis_auth		(void *, int);
-static void ndis_assoc		(void *, int);
 static int ndis_get_assoc	(struct ndis_softc *, ndis_wlan_bssid_ex **);
 static int ndis_probe_offload	(struct ndis_softc *);
 static int ndis_set_offload	(struct ndis_softc *);
@@ -741,13 +738,7 @@ ndis_attach(dev)
 		uint32_t		arg;
 		int			r;
 
-		sc->ndis_tq = taskqueue_create("nids_taskq", M_NOWAIT | M_ZERO,
-		    taskqueue_thread_enqueue, &sc->ndis_tq);
-		taskqueue_start_threads(&sc->ndis_tq, 1, PI_NET, "%s taskq",
-		    device_get_nameunit(dev));
-		TASK_INIT(&sc->ndis_scantask, 0, ndis_scan, sc);
-		TASK_INIT(&sc->ndis_authtask, 0, ndis_auth, sc);
-		TASK_INIT(&sc->ndis_assoctask, 0, ndis_assoc, sc);
+		callout_init(&sc->ndis_scan_callout, CALLOUT_MPSAFE);
 
 		ifp->if_ioctl = ndis_ioctl_80211;
 		ic->ic_ifp = ifp;
@@ -1054,12 +1045,6 @@ ndis_detach(dev)
 	} else
 		NDIS_UNLOCK(sc);
 
-	if (sc->ndis_80211) {
-		taskqueue_drain(sc->ndis_tq, &sc->ndis_scantask);
-		taskqueue_drain(sc->ndis_tq, &sc->ndis_authtask);
-		taskqueue_drain(sc->ndis_tq, &sc->ndis_assoctask);
-	}
-
 	if (sc->ndis_tickitem != NULL)
 		IoFreeWorkItem(sc->ndis_tickitem);
 	if (sc->ndis_startitem != NULL)
@@ -1121,8 +1106,6 @@ ndis_detach(dev)
 	if (sc->ndis_iftype == PCIBus)
 		bus_dma_tag_destroy(sc->ndis_parent_tag);
 
-	if (sc->ndis_80211)
-		taskqueue_free(sc->ndis_tq);
 	return(0);
 }
 
@@ -2419,30 +2402,6 @@ ndis_setstate_80211(sc)
 }
 
 static void
-ndis_auth(void *arg, int npending)
-{
-	struct ndis_softc *sc = arg;
-	struct ifnet *ifp = sc->ifp;
-	struct ieee80211com *ic = ifp->if_l2com;
-	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
-
-	vap->iv_state = IEEE80211_S_AUTH;
-	ndis_auth_and_assoc(sc, vap);
-}
-
-static void
-ndis_assoc(void *arg, int npending)
-{
-	struct ndis_softc *sc = arg;
-	struct ifnet *ifp = sc->ifp;
-	struct ieee80211com *ic = ifp->if_l2com;
-	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
-
-	vap->iv_state = IEEE80211_S_ASSOC;
-	ndis_auth_and_assoc(sc, vap);
-}
-
-static void
 ndis_auth_and_assoc(sc, vap)
 	struct ndis_softc	*sc;
 	struct ieee80211vap	*vap;
@@ -2656,9 +2615,6 @@ ndis_auth_and_assoc(sc, vap)
 	if (rval)
 		device_printf (sc->ndis_dev, "set ssid failed: %d\n", rval);
 
-	if (vap->iv_state == IEEE80211_S_AUTH)
-		ieee80211_new_state(vap, IEEE80211_S_ASSOC, 0);
-
 	return;
 }
 
@@ -3304,13 +3260,18 @@ ndis_newstate(struct ieee80211vap *vap, 
 		return nvp->newstate(vap, nstate, arg);
 	case IEEE80211_S_ASSOC:
 		if (ostate != IEEE80211_S_AUTH) {
-			taskqueue_enqueue(sc->ndis_tq, &sc->ndis_assoctask);
-			return EINPROGRESS;
+			IEEE80211_UNLOCK(ic);
+			ndis_auth_and_assoc(sc, vap);
+			IEEE80211_LOCK(ic);
 		}
 		break;
 	case IEEE80211_S_AUTH:
-		taskqueue_enqueue(sc->ndis_tq, &sc->ndis_authtask);
-		return EINPROGRESS;
+		IEEE80211_UNLOCK(ic);
+		ndis_auth_and_assoc(sc, vap);
+		if (vap->iv_state == IEEE80211_S_AUTH) /* XXX */
+			ieee80211_new_state(vap, IEEE80211_S_ASSOC, 0);
+		IEEE80211_LOCK(ic);
+		break;
 	default:
 		break;
 	}
@@ -3318,54 +3279,18 @@ ndis_newstate(struct ieee80211vap *vap, 
 }
 
 static void
-ndis_scan(void *arg, int npending)
+ndis_scan(void *arg)
 {
 	struct ndis_softc *sc = arg;
 	struct ieee80211com *ic;
 	struct ieee80211vap *vap;
-	struct ieee80211_scan_state *ss;
-	ndis_80211_ssid ssid;
-	int error, len;
 
 	ic = sc->ifp->if_l2com;
-	ss = ic->ic_scan;
 	vap = TAILQ_FIRST(&ic->ic_vaps);
 
-	if (!NDIS_INITIALIZED(sc)) {
-		DPRINTF(("%s: scan aborted\n", __func__));
-		ieee80211_cancel_scan(vap);
-		return;
-	}
-
-	len = sizeof(ssid);
-	bzero((char *)&ssid, len);
-	if (ss->ss_nssid == 0)
-		ssid.ns_ssidlen = 1;
-	else {
-		/* Perform a directed scan */
-		ssid.ns_ssidlen = ss->ss_ssid[0].len;
-		bcopy(ss->ss_ssid[0].ssid, ssid.ns_ssid, ssid.ns_ssidlen);
-	}
-
-	error = ndis_set_info(sc, OID_802_11_SSID, &ssid, &len);
-	if (error)
-		DPRINTF(("%s: set ESSID failed\n", __func__));
-
-	len = 0;
-	error = ndis_set_info(sc, OID_802_11_BSSID_LIST_SCAN,
-	    NULL, &len);
-	if (error) {
-		DPRINTF(("%s: scan command failed\n", __func__));
-		ieee80211_cancel_scan(vap);
-		return;
-	}
-
-	pause("ssidscan", hz * 3);
-	if (!NDIS_INITIALIZED(sc))
-		/* The interface was downed while we were sleeping */
-		return;
-
+	NDIS_LOCK(sc);
 	ndis_scan_results(sc);
+	NDIS_UNLOCK(sc);
 	ieee80211_scan_done(vap);
 }
 
@@ -3496,8 +3421,48 @@ ndis_scan_start(struct ieee80211com *ic)
 {
 	struct ifnet *ifp = ic->ic_ifp;
 	struct ndis_softc *sc = ifp->if_softc;
+	struct ieee80211vap *vap;
+	struct ieee80211_scan_state *ss;
+	ndis_80211_ssid ssid;
+	int error, len;
+
+	ss = ic->ic_scan;
+	vap = TAILQ_FIRST(&ic->ic_vaps);
+
+	NDIS_LOCK(sc);
+	if (!NDIS_INITIALIZED(sc)) {
+		DPRINTF(("%s: scan aborted\n", __func__));
+		NDIS_UNLOCK(sc);
+		ieee80211_cancel_scan(vap);
+		return;
+	}
 
-	taskqueue_enqueue(sc->ndis_tq, &sc->ndis_scantask);
+	len = sizeof(ssid);
+	bzero((char *)&ssid, len);
+	if (ss->ss_nssid == 0)
+		ssid.ns_ssidlen = 1;
+	else {
+		/* Perform a directed scan */
+		ssid.ns_ssidlen = ss->ss_ssid[0].len;
+		bcopy(ss->ss_ssid[0].ssid, ssid.ns_ssid, ssid.ns_ssidlen);
+	}
+
+	error = ndis_set_info(sc, OID_802_11_SSID, &ssid, &len);
+	if (error)
+		DPRINTF(("%s: set ESSID failed\n", __func__));
+
+	len = 0;
+	error = ndis_set_info(sc, OID_802_11_BSSID_LIST_SCAN,
+	    NULL, &len);
+	if (error) {
+		DPRINTF(("%s: scan command failed\n", __func__));
+		NDIS_UNLOCK(sc);
+		ieee80211_cancel_scan(vap);
+		return;
+	}
+	NDIS_UNLOCK(sc);
+	/* Set a timer to collect the results */
+	callout_reset(&sc->ndis_scan_callout, hz * 3, ndis_scan, sc);
 }
 
 static void

Modified: head/sys/dev/if_ndis/if_ndisvar.h
==============================================================================
--- head/sys/dev/if_ndis/if_ndisvar.h	Sat May  2 12:59:47 2009	(r191745)
+++ head/sys/dev/if_ndis/if_ndisvar.h	Sat May  2 15:14:18 2009	(r191746)
@@ -180,6 +180,7 @@ struct ndis_softc {
 	ndis_miniport_block	*ndis_block;
 	ndis_miniport_characteristics	*ndis_chars;
 	interface_type		ndis_type;
+	struct callout		ndis_scan_callout;
 	struct callout		ndis_stat_callout;
 	int			ndis_maxpkts;
 	ndis_oid		*ndis_oids;
@@ -219,10 +220,6 @@ struct ndis_softc {
 	struct ifqueue		ndis_rxqueue;
 	kspin_lock		ndis_rxlock;
 
-	struct taskqueue	*ndis_tq;		/* private task queue */
-	struct task		ndis_scantask;
-	struct task		ndis_authtask;
-	struct task		ndis_assoctask;
 	int			(*ndis_newstate)(struct ieee80211com *,
 				    enum ieee80211_state, int);
 	int			ndis_tx_timer;

Modified: head/sys/dev/ipw/if_ipw.c
==============================================================================
--- head/sys/dev/ipw/if_ipw.c	Sat May  2 12:59:47 2009	(r191745)
+++ head/sys/dev/ipw/if_ipw.c	Sat May  2 15:14:18 2009	(r191746)
@@ -118,10 +118,6 @@ static void	ipw_media_status(struct ifne
 static int	ipw_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static uint16_t	ipw_read_prom_word(struct ipw_softc *, uint8_t);
 static void	ipw_rx_cmd_intr(struct ipw_softc *, struct ipw_soft_buf *);
-static void	ipw_assocsuccess(void *, int);
-static void	ipw_assocfailed(void *, int);
-static void	ipw_scandone(void *, int);
-static void	ipw_bmiss(void *, int);
 static void	ipw_rx_newstate_intr(struct ipw_softc *, struct ipw_soft_buf *);
 static void	ipw_rx_data_intr(struct ipw_softc *, struct ipw_status *,
 		    struct ipw_soft_bd *, struct ipw_soft_buf *);
@@ -147,8 +143,8 @@ static int	ipw_reset(struct ipw_softc *)
 static int	ipw_load_ucode(struct ipw_softc *, const char *, int);
 static int	ipw_load_firmware(struct ipw_softc *, const char *, int);
 static int	ipw_config(struct ipw_softc *);
-static void	ipw_assoc_task(void *, int);
-static void	ipw_disassoc_task(void *, int);
+static void	ipw_assoc(struct ieee80211com *, struct ieee80211vap *);
+static void	ipw_disassoc(struct ieee80211com *, struct ieee80211vap *);
 static void	ipw_init_task(void *, int);
 static void	ipw_init(void *);
 static void	ipw_init_locked(struct ipw_softc *);
@@ -166,7 +162,6 @@ static void	ipw_read_mem_1(struct ipw_so
 #endif
 static void	ipw_write_mem_1(struct ipw_softc *, bus_size_t,
 		    const uint8_t *, bus_size_t);
-static void	ipw_scan_task(void *, int);
 static int	ipw_scan(struct ipw_softc *);
 static void	ipw_scan_start(struct ieee80211com *);
 static void	ipw_scan_end(struct ieee80211com *);
@@ -239,8 +234,6 @@ ipw_attach(device_t dev)
 	    MTX_DEF | MTX_RECURSE);
 
 	TASK_INIT(&sc->sc_init_task, 0, ipw_init_task, sc);
-	TASK_INIT(&sc->sc_scan_task, 0, ipw_scan_task, sc);
-	TASK_INIT(&sc->sc_bmiss_task, 0, ipw_bmiss, sc);
 	callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0);
 
 	if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
@@ -417,9 +410,7 @@ ipw_detach(device_t dev)
 	ieee80211_ifdetach(ic);
 
 	callout_drain(&sc->sc_wdtimer);
-	taskqueue_drain(taskqueue_swi, &sc->sc_init_task);
-	taskqueue_drain(taskqueue_swi, &sc->sc_scan_task);
-	taskqueue_drain(taskqueue_swi, &sc->sc_bmiss_task);
+	ieee80211_draintask(ic, &sc->sc_init_task);
 
 	ipw_release(sc);
 
@@ -511,12 +502,6 @@ ipw_vap_create(struct ieee80211com *ic,
 		return NULL;
 	vap = &ivp->vap;
 
-	TASK_INIT(&ivp->assoc_task, 0, ipw_assoc_task, vap);
-	TASK_INIT(&ivp->disassoc_task, 0, ipw_disassoc_task, vap);
-	TASK_INIT(&ivp->assoc_success_task, 0, ipw_assocsuccess, vap);
-	TASK_INIT(&ivp->assoc_failed_task, 0, ipw_assocfailed, vap);
-	TASK_INIT(&ivp->scandone_task, 0, ipw_scandone, vap);
-
 	ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac);
 	/* override with driver methods */
 	ivp->newstate = vap->iv_newstate;
@@ -894,11 +879,15 @@ ipw_newstate(struct ieee80211vap *vap, e
 	struct ieee80211com *ic = vap->iv_ic;
 	struct ifnet *ifp = ic->ic_ifp;
 	struct ipw_softc *sc = ifp->if_softc;
+	enum ieee80211_state ostate;
 
 	DPRINTF(("%s: %s -> %s flags 0x%x\n", __func__,
 		ieee80211_state_name[vap->iv_state],
 		ieee80211_state_name[nstate], sc->flags));
 
+	ostate = vap->iv_state;
+	IEEE80211_UNLOCK(ic);
+
 	switch (nstate) {
 	case IEEE80211_S_RUN:
 		if (ic->ic_opmode == IEEE80211_M_IBSS) {
@@ -910,39 +899,33 @@ ipw_newstate(struct ieee80211vap *vap, e
 			 * AUTH -> RUN transition and we want to do nothing.
 			 * This is all totally bogus and needs to be redone.
 			 */
-			if (vap->iv_state == IEEE80211_S_SCAN) {
-				taskqueue_enqueue(taskqueue_swi,
-				    &IPW_VAP(vap)->assoc_task);
-				return EINPROGRESS;
-			}
+			if (ostate == IEEE80211_S_SCAN)
+				ipw_assoc(ic, vap);
 		}
 		break;
 
 	case IEEE80211_S_INIT:
 		if (sc->flags & IPW_FLAG_ASSOCIATED)
-			taskqueue_enqueue(taskqueue_swi,
-			    &IPW_VAP(vap)->disassoc_task);
+			ipw_disassoc(ic, vap);
 		break;
 
 	case IEEE80211_S_AUTH:
-		taskqueue_enqueue(taskqueue_swi, &IPW_VAP(vap)->assoc_task);
-		return EINPROGRESS;
+		ipw_assoc(ic, vap);
+		break;
 
 	case IEEE80211_S_ASSOC:
 		/*
 		 * If we are not transitioning from AUTH the resend the
 		 * association request.
 		 */
-		if (vap->iv_state != IEEE80211_S_AUTH) {
-			taskqueue_enqueue(taskqueue_swi,
-			    &IPW_VAP(vap)->assoc_task);
-			return EINPROGRESS;
-		}
+		if (ostate != IEEE80211_S_AUTH)
+			ipw_assoc(ic, vap);
 		break;
 
 	default:
 		break;
 	}
+	IEEE80211_LOCK(ic);
 	return ivp->newstate(vap, nstate, arg);
 }
 
@@ -1020,38 +1003,6 @@ ipw_rx_cmd_intr(struct ipw_softc *sc, st
 }
 
 static void
-ipw_assocsuccess(void *arg, int npending)
-{
-	struct ieee80211vap *vap = arg;
-
-	ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
-}
-
-static void
-ipw_assocfailed(void *arg, int npending)
-{
-	struct ieee80211vap *vap = arg;
-
-	ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
-}
-
-static void
-ipw_scandone(void *arg, int npending)
-{
-	struct ieee80211vap *vap = arg;
-
-	ieee80211_scan_done(vap);
-}
-
-static void
-ipw_bmiss(void *arg, int npending)
-{
-	struct ieee80211com *ic = arg;
-
-	ieee80211_beacon_miss(ic);
-}
-
-static void
 ipw_rx_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf)
 {
 #define	IEEESTATE(vap)	ieee80211_state_name[vap->iv_state]
@@ -1076,8 +1027,7 @@ ipw_rx_newstate_intr(struct ipw_softc *s
 		}
 		sc->flags &= ~IPW_FLAG_ASSOCIATING;
 		sc->flags |= IPW_FLAG_ASSOCIATED;
-		taskqueue_enqueue(taskqueue_swi,
-		    &IPW_VAP(vap)->assoc_success_task);
+		ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
 		break;
 
 	case IPW_STATE_SCANNING:
@@ -1091,7 +1041,7 @@ ipw_rx_newstate_intr(struct ipw_softc *s
 		 */
 		if (sc->flags & IPW_FLAG_ASSOCIATED) {
 			/* XXX probably need to issue disassoc to fw */
-			taskqueue_enqueue(taskqueue_swi, &sc->sc_bmiss_task);
+			ieee80211_beacon_miss(ic);
 		}
 		break;
 
@@ -1110,8 +1060,7 @@ ipw_rx_newstate_intr(struct ipw_softc *s
 			break;
 		}
 		if (sc->flags & IPW_FLAG_SCANNING) {
-			taskqueue_enqueue(taskqueue_swi,
-			    &IPW_VAP(vap)->scandone_task);
+			ieee80211_scan_done(vap);
 			sc->flags &= ~IPW_FLAG_SCANNING;
 			sc->sc_scan_timer = 0;
 		}
@@ -1122,8 +1071,7 @@ ipw_rx_newstate_intr(struct ipw_softc *s
 			IEEESTATE(vap), sc->flags));
 		sc->flags &= ~(IPW_FLAG_ASSOCIATING | IPW_FLAG_ASSOCIATED);
 		if (vap->iv_state == IEEE80211_S_RUN)
-			taskqueue_enqueue(taskqueue_swi,
-			    &IPW_VAP(vap)->assoc_failed_task);
+			ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
 		break;
 
 	case IPW_STATE_DISABLED:
@@ -1432,6 +1380,16 @@ ipw_tx_intr(struct ipw_softc *sc)
 }
 
 static void
+ipw_fatal_error_intr(struct ipw_softc *sc)
+{
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
+
+	device_printf(sc->sc_dev, "firmware error\n");
+	ieee80211_runtask(ic, &sc->sc_init_task);
+}
+
+static void
 ipw_intr(void *arg)
 {
 	struct ipw_softc *sc = arg;
@@ -1440,10 +1398,9 @@ ipw_intr(void *arg)
 
 	IPW_LOCK(sc);
 
-	if ((r = CSR_READ_4(sc, IPW_CSR_INTR)) == 0 || r == 0xffffffff) {
-		IPW_UNLOCK(sc);
-		return;
-	}
+	r = CSR_READ_4(sc, IPW_CSR_INTR);
+	if (r == 0 || r == 0xffffffff)
+		goto done;
 
 	/* disable interrupts */
 	CSR_WRITE_4(sc, IPW_CSR_INTR_MASK, 0);
@@ -1452,9 +1409,8 @@ ipw_intr(void *arg)
 	CSR_WRITE_4(sc, IPW_CSR_INTR, r);
 
 	if (r & (IPW_INTR_FATAL_ERROR | IPW_INTR_PARITY_ERROR)) {
-		device_printf(sc->sc_dev, "firmware error\n");
-		taskqueue_enqueue(taskqueue_swi, &sc->sc_init_task);
-		r = 0;	/* don't process more interrupts */
+		ipw_fatal_error_intr(sc);
+		goto done;
 	}
 
 	if (r & IPW_INTR_FW_INIT_DONE)
@@ -1468,7 +1424,7 @@ ipw_intr(void *arg)
 
 	/* re-enable interrupts */
 	CSR_WRITE_4(sc, IPW_CSR_INTR_MASK, IPW_INTR_MASK);
-
+done:
 	IPW_UNLOCK(sc);
 }
 
@@ -2181,20 +2137,6 @@ ipw_setscanopts(struct ipw_softc *sc, ui
 	return ipw_cmd(sc, IPW_CMD_SET_SCAN_OPTIONS, &opts, sizeof(opts));
 }
 
-/*
- * Handler for sc_scan_task.  This is a simple wrapper around ipw_scan().
- */
-static void
-ipw_scan_task(void *context, int pending)
-{
-	struct ipw_softc *sc = context;
-	IPW_LOCK_DECL;
-
-	IPW_LOCK(sc);
-	ipw_scan(sc);
-	IPW_UNLOCK(sc);
-}
-
 static int
 ipw_scan(struct ipw_softc *sc)
 {
@@ -2258,11 +2200,9 @@ ipw_setchannel(struct ipw_softc *sc, str
 }
 
 static void
-ipw_assoc_task(void *context, int pending)
+ipw_assoc(struct ieee80211com *ic, struct ieee80211vap *vap)
 {
-	struct ieee80211vap *vap = context;
 	struct ifnet *ifp = vap->iv_ic->ic_ifp;
-	struct ieee80211com *ic = ifp->if_l2com;
 	struct ipw_softc *sc = ifp->if_softc;
 	struct ieee80211_node *ni = vap->iv_bss;
 	struct ipw_security security;
@@ -2353,9 +2293,8 @@ done:
 }
 
 static void
-ipw_disassoc_task(void *context, int pending)
+ipw_disassoc(struct ieee80211com *ic, struct ieee80211vap *vap)
 {
-	struct ieee80211vap *vap = context;
 	struct ifnet *ifp = vap->iv_ic->ic_ifp;
 	struct ieee80211_node *ni = vap->iv_bss;
 	struct ipw_softc *sc = ifp->if_softc;
@@ -2729,8 +2668,7 @@ ipw_scan_start(struct ieee80211com *ic)
 	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
-	if (!(sc->flags & IPW_FLAG_SCANNING))
-		taskqueue_enqueue(taskqueue_swi, &sc->sc_scan_task);
+	ipw_scan(sc);
 	IPW_UNLOCK(sc);
 }
 

Modified: head/sys/dev/ipw/if_ipwvar.h
==============================================================================
--- head/sys/dev/ipw/if_ipwvar.h	Sat May  2 12:59:47 2009	(r191745)
+++ head/sys/dev/ipw/if_ipwvar.h	Sat May  2 15:14:18 2009	(r191746)
@@ -78,11 +78,6 @@ struct ipw_tx_radiotap_header {
 
 struct ipw_vap {
 	struct ieee80211vap	vap;
-	struct task		assoc_task;
-	struct task		disassoc_task;
-	struct task		assoc_success_task;
-	struct task		assoc_failed_task;
-	struct task		scandone_task;
 
 	int			(*newstate)(struct ieee80211vap *,
 				    enum ieee80211_state, int);
@@ -95,9 +90,6 @@ struct ipw_softc {
 
 	struct mtx			sc_mtx;
 	struct task			sc_init_task;
-	struct task			sc_scan_task;
-	struct task			sc_chan_task;
-	struct task			sc_bmiss_task;
 	struct callout			sc_wdtimer;	/* watchdog timer */
 
 	uint32_t			flags;

Modified: head/sys/dev/iwi/if_iwi.c
==============================================================================
--- head/sys/dev/iwi/if_iwi.c	Sat May  2 12:59:47 2009	(r191745)
+++ head/sys/dev/iwi/if_iwi.c	Sat May  2 15:14:18 2009	(r191746)
@@ -158,9 +158,6 @@ static int	iwi_wme_update(struct ieee802
 static uint16_t	iwi_read_prom_word(struct iwi_softc *, uint8_t);
 static void	iwi_frame_intr(struct iwi_softc *, struct iwi_rx_data *, int,
 		    struct iwi_frame *);
-static void	iwi_authsuccess(void *, int);
-static void	iwi_assocsuccess(void *, int);
-static void	iwi_assocfailed(void *, int);
 static void	iwi_notification_intr(struct iwi_softc *, struct iwi_notif *);
 static void	iwi_rx_intr(struct iwi_softc *);
 static void	iwi_tx_intr(struct iwi_softc *, struct iwi_tx_ring *);
@@ -186,16 +183,11 @@ static void	iwi_put_firmware(struct iwi_
 static int	iwi_scanchan(struct iwi_softc *, unsigned long, int);
 static void	iwi_scan_start(struct ieee80211com *);
 static void	iwi_scan_end(struct ieee80211com *);
-static void	iwi_scanabort(void *, int);
 static void	iwi_set_channel(struct ieee80211com *);
 static void	iwi_scan_curchan(struct ieee80211_scan_state *, unsigned long maxdwell);
-#if 0
-static void	iwi_scan_allchan(struct ieee80211com *, unsigned long maxdwell);
-#endif
 static void	iwi_scan_mindwell(struct ieee80211_scan_state *);
-static void	iwi_ops(void *, int);
-static int	iwi_queue_cmd(struct iwi_softc *, int, unsigned long);
 static int	iwi_auth_and_assoc(struct iwi_softc *, struct ieee80211vap *);
+static void	iwi_disassoc(void *, int);
 static int	iwi_disassociate(struct iwi_softc *, int quiet);
 static void	iwi_init_locked(struct iwi_softc *);
 static void	iwi_init(void *);
@@ -292,24 +284,14 @@ iwi_attach(device_t dev)
 	ic = ifp->if_l2com;
 
 	IWI_LOCK_INIT(sc);
-	IWI_CMD_LOCK_INIT(sc);
 
 	sc->sc_unr = new_unrhdr(1, IWI_MAX_IBSSNODE-1, &sc->sc_mtx);
 
-	sc->sc_tq = taskqueue_create("iwi_taskq", M_NOWAIT | M_ZERO,
-		taskqueue_thread_enqueue, &sc->sc_tq);
-	taskqueue_start_threads(&sc->sc_tq, 1, PI_NET, "%s taskq",
-		device_get_nameunit(dev));
-	sc->sc_tq2 = taskqueue_create("iwi_taskq2", M_NOWAIT | M_ZERO,
-		taskqueue_thread_enqueue, &sc->sc_tq2);
-	taskqueue_start_threads(&sc->sc_tq2, 1, PI_NET, "%s taskq2",
-		device_get_nameunit(dev));
-
 	TASK_INIT(&sc->sc_radiontask, 0, iwi_radio_on, sc);
 	TASK_INIT(&sc->sc_radiofftask, 0, iwi_radio_off, sc);
 	TASK_INIT(&sc->sc_restarttask, 0, iwi_restart, sc);
-	TASK_INIT(&sc->sc_opstask, 0, iwi_ops, sc);
-	TASK_INIT(&sc->sc_scanaborttask, 0, iwi_scanabort, sc);
+	TASK_INIT(&sc->sc_disassoctask, 0, iwi_disassoc, sc);
+
 	callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0);
 	callout_init_mtx(&sc->sc_rftimer, &sc->sc_mtx, 0);
 
@@ -483,8 +465,10 @@ iwi_detach(device_t dev)
 	ieee80211_ifdetach(ic);
 
 	/* NB: do early to drain any pending tasks */
-	taskqueue_free(sc->sc_tq);
-	taskqueue_free(sc->sc_tq2);
+	ieee80211_draintask(ic, &sc->sc_radiontask);
+	ieee80211_draintask(ic, &sc->sc_radiofftask);
+	ieee80211_draintask(ic, &sc->sc_restarttask);
+	ieee80211_draintask(ic, &sc->sc_disassoctask);
 
 	iwi_put_firmware(sc);
 	iwi_release_fw_dma(sc);
@@ -504,7 +488,6 @@ iwi_detach(device_t dev)
 	delete_unrhdr(sc->sc_unr);
 
 	IWI_LOCK_DESTROY(sc);
-	IWI_CMD_LOCK_DESTROY(sc);
 
 	if_free(ifp);
 
@@ -552,10 +535,6 @@ iwi_vap_create(struct ieee80211com *ic,
 	ivp->iwi_newstate = vap->iv_newstate;
 	vap->iv_newstate = iwi_newstate;
 
-	TASK_INIT(&ivp->iwi_authsuccess_task, 0, iwi_authsuccess, vap);
-	TASK_INIT(&ivp->iwi_assocsuccess_task, 0, iwi_assocsuccess, vap);
-	TASK_INIT(&ivp->iwi_assocfailed_task, 0, iwi_assocfailed, vap);
-
 	/* complete setup */
 	ieee80211_vap_attach(vap, ieee80211_media_change, iwi_media_status);
 	ic->ic_opmode = opmode;
@@ -987,21 +966,21 @@ iwi_newstate(struct ieee80211vap *vap, e
 		ieee80211_state_name[vap->iv_state],
 		ieee80211_state_name[nstate], sc->flags));
 
+	IEEE80211_UNLOCK(ic);
+	IWI_LOCK(sc);
 	switch (nstate) {
 	case IEEE80211_S_INIT:
-		IWI_LOCK(sc);
 		/*
 		 * NB: don't try to do this if iwi_stop_master has
 		 *     shutdown the firmware and disabled interrupts.
 		 */
 		if (vap->iv_state == IEEE80211_S_RUN &&
 		    (sc->flags & IWI_FLAG_FW_INITED))
-			iwi_queue_cmd(sc, IWI_DISASSOC, 1);
-		IWI_UNLOCK(sc);
+			iwi_disassociate(sc, 0);
 		break;
 	case IEEE80211_S_AUTH:
-		iwi_queue_cmd(sc, IWI_AUTH, arg);
-		return EINPROGRESS;
+		iwi_auth_and_assoc(sc, vap);
+		break;
 	case IEEE80211_S_RUN:
 		if (vap->iv_opmode == IEEE80211_M_IBSS &&
 		    vap->iv_state == IEEE80211_S_SCAN) {
@@ -1013,8 +992,7 @@ iwi_newstate(struct ieee80211vap *vap, e
 			 * AUTH -> RUN transition and we want to do nothing.
 			 * This is all totally bogus and needs to be redone.
 			 */
-			iwi_queue_cmd(sc, IWI_ASSOC, 0);
-			return EINPROGRESS;
+			iwi_auth_and_assoc(sc, vap);
 		}
 		break;
 	case IEEE80211_S_ASSOC:
@@ -1025,11 +1003,13 @@ iwi_newstate(struct ieee80211vap *vap, e
 		 */
 		if (vap->iv_state == IEEE80211_S_AUTH)
 			break;
-		iwi_queue_cmd(sc, IWI_ASSOC, arg);
-		return EINPROGRESS;
+		iwi_auth_and_assoc(sc, vap);
+		break;
 	default:
 		break;
 	}
+	IWI_UNLOCK(sc);
+	IEEE80211_LOCK(ic);
 	return ivp->iwi_newstate(vap, nstate, arg);
 }
 
@@ -1106,6 +1086,7 @@ static int
 iwi_wme_update(struct ieee80211com *ic)
 {
 	struct iwi_softc *sc = ic->ic_ifp->if_softc;
+	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 
 	/*
 	 * We may be called to update the WME parameters in
@@ -1115,7 +1096,9 @@ iwi_wme_update(struct ieee80211com *ic)
 	 * will get sent down to the adapter as part of the
 	 * work iwi_auth_and_assoc does.
 	 */
-	return iwi_queue_cmd(sc, IWI_SET_WME, 0);
+	if (vap->iv_state == IEEE80211_S_RUN)
+		(void) iwi_wme_setparams(sc, ic);
+	return (0);
 }
 
 static int
@@ -1389,30 +1372,6 @@ iwi_checkforqos(struct ieee80211vap *vap
  */
 
 static void
-iwi_authsuccess(void *arg, int npending)
-{
-	struct ieee80211vap *vap = arg;
-
-	ieee80211_new_state(vap, IEEE80211_S_ASSOC, -1);
-}
-
-static void
-iwi_assocsuccess(void *arg, int npending)
-{
-	struct ieee80211vap *vap = arg;
-
-	ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
-}
-
-static void
-iwi_assocfailed(void *arg, int npending)
-{
-	struct ieee80211vap *vap = arg;
-
-	ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
-}
-
-static void
 iwi_notification_intr(struct iwi_softc *sc, struct iwi_notif *notif)
 {
 	struct ifnet *ifp = sc->sc_ifp;
@@ -1454,8 +1413,7 @@ iwi_notification_intr(struct iwi_softc *
 		switch (auth->state) {
 		case IWI_AUTH_SUCCESS:
 			DPRINTFN(2, ("Authentication succeeeded\n"));
-			taskqueue_enqueue(taskqueue_swi,
-			    &IWI_VAP(vap)->iwi_authsuccess_task);
+			ieee80211_new_state(vap, IEEE80211_S_ASSOC, -1);
 			break;
 		case IWI_AUTH_FAIL:
 			/*
@@ -1472,8 +1430,7 @@ iwi_notification_intr(struct iwi_softc *
 				DPRINTFN(2, ("Deauthenticated\n"));
 				vap->iv_stats.is_rx_deauth++;
 			}
-			taskqueue_enqueue(taskqueue_swi,
-			    &IWI_VAP(vap)->iwi_assocfailed_task);
+			ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
 			break;
 		case IWI_AUTH_SENT_1:
 		case IWI_AUTH_RECV_2:
@@ -1506,8 +1463,7 @@ iwi_notification_intr(struct iwi_softc *
 			iwi_checkforqos(vap,
 			    (const struct ieee80211_frame *)(assoc+1),
 			    le16toh(notif->len) - sizeof(*assoc));
-			taskqueue_enqueue(taskqueue_swi,
-			    &IWI_VAP(vap)->iwi_assocsuccess_task);
+			ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
 			break;
 		case IWI_ASSOC_INIT:
 			sc->flags &= ~IWI_FLAG_ASSOCIATED;
@@ -1515,16 +1471,14 @@ iwi_notification_intr(struct iwi_softc *
 			case IWI_FW_ASSOCIATING:
 				DPRINTFN(2, ("Association failed\n"));
 				IWI_STATE_END(sc, IWI_FW_ASSOCIATING);
-				taskqueue_enqueue(taskqueue_swi,
-				    &IWI_VAP(vap)->iwi_assocfailed_task);
+				ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
 				break;
 
 			case IWI_FW_DISASSOCIATING:
 				DPRINTFN(2, ("Dissassociated\n"));
 				IWI_STATE_END(sc, IWI_FW_DISASSOCIATING);
 				vap->iv_stats.is_rx_disassoc++;
-				taskqueue_enqueue(taskqueue_swi,
-				    &IWI_VAP(vap)->iwi_assocfailed_task);
+				ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
 				break;
 			}
 			break;
@@ -1563,7 +1517,7 @@ iwi_notification_intr(struct iwi_softc *
 				 * to disassociate and then on completion we'll
 				 * kick the state machine to scan.
 				 */
-				iwi_queue_cmd(sc, IWI_DISASSOC, 1);
+				ieee80211_runtask(ic, &sc->sc_disassoctask);
 			}
 		}
 		break;
@@ -1664,6 +1618,29 @@ iwi_tx_intr(struct iwi_softc *sc, struct
 }
 
 static void
+iwi_fatal_error_intr(struct iwi_softc *sc)
+{
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
+
+	device_printf(sc->sc_dev, "firmware error\n");
+	ieee80211_runtask(ic, &sc->sc_restarttask);
+
+	sc->flags &= ~IWI_FLAG_BUSY;
+	sc->sc_busy_timer = 0;
+	wakeup(sc);
+}
+
+static void
+iwi_radio_off_intr(struct iwi_softc *sc)
+{
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
+
+	ieee80211_runtask(ic, &sc->sc_radiofftask);
+}
+
+static void
 iwi_intr(void *arg)
 {
 	struct iwi_softc *sc = arg;
@@ -1681,12 +1658,8 @@ iwi_intr(void *arg)
 	CSR_WRITE_4(sc, IWI_CSR_INTR, r);
 
 	if (r & IWI_INTR_FATAL_ERROR) {
-		device_printf(sc->sc_dev, "firmware error\n");
-		taskqueue_enqueue(sc->sc_tq2, &sc->sc_restarttask);
-
-		sc->flags &= ~IWI_FLAG_BUSY;
-		sc->sc_busy_timer = 0;
-		wakeup(sc);
+		iwi_fatal_error_intr(sc);
+		goto done;
 	}
 
 	if (r & IWI_INTR_FW_INITED) {
@@ -1695,7 +1668,7 @@ iwi_intr(void *arg)
 	}
 
 	if (r & IWI_INTR_RADIO_OFF)
-		taskqueue_enqueue(sc->sc_tq, &sc->sc_radiofftask);
+		iwi_radio_off_intr(sc);
 
 	if (r & IWI_INTR_CMD_DONE) {
 		sc->flags &= ~IWI_FLAG_BUSY;
@@ -1722,7 +1695,7 @@ iwi_intr(void *arg)
 		/* XXX rate-limit */
 		device_printf(sc->sc_dev, "parity error\n");
 	}
-
+done:
 	IWI_UNLOCK(sc);
 }
 
@@ -2008,6 +1981,7 @@ iwi_watchdog(void *arg)
 {
 	struct iwi_softc *sc = arg;
 	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 
 	IWI_LOCK_ASSERT(sc);
 
@@ -2015,25 +1989,25 @@ iwi_watchdog(void *arg)
 		if (--sc->sc_tx_timer == 0) {
 			if_printf(ifp, "device timeout\n");
 			ifp->if_oerrors++;
-			taskqueue_enqueue(sc->sc_tq2, &sc->sc_restarttask);
+			ieee80211_runtask(ic, &sc->sc_restarttask);
 		}
 	}
 	if (sc->sc_state_timer > 0) {
 		if (--sc->sc_state_timer == 0) {
 			if_printf(ifp, "firmware stuck in state %d, resetting\n",
 			    sc->fw_state);
-			taskqueue_enqueue(sc->sc_tq2, &sc->sc_restarttask);
 			if (sc->fw_state == IWI_FW_SCANNING) {
 				struct ieee80211com *ic = ifp->if_l2com;
 				ieee80211_cancel_scan(TAILQ_FIRST(&ic->ic_vaps));
 			}
+			ieee80211_runtask(ic, &sc->sc_restarttask);
 			sc->sc_state_timer = 3;
 		}
 	}
 	if (sc->sc_busy_timer > 0) {
 		if (--sc->sc_busy_timer == 0) {
 			if_printf(ifp, "firmware command timeout, resetting\n");
-			taskqueue_enqueue(sc->sc_tq2, &sc->sc_restarttask);
+			ieee80211_runtask(ic, &sc->sc_restarttask);
 		}
 	}
 	callout_reset(&sc->sc_wdtimer, hz, iwi_watchdog, sc);
@@ -2665,7 +2639,7 @@ scan_band(const struct ieee80211_channel
  * Start a scan on the current channel or all channels.
  */
 static int
-iwi_scanchan(struct iwi_softc *sc, unsigned long maxdwell, int mode)
+iwi_scanchan(struct iwi_softc *sc, unsigned long maxdwell, int allchan)
 {
 	struct ieee80211com *ic;
 	struct ieee80211_channel *chan;
@@ -2712,7 +2686,7 @@ iwi_scanchan(struct iwi_softc *sc, unsig
 			return (error);
 	}
 
-	if (mode == IWI_SCAN_ALLCHAN) {
+	if (allchan) {
 		int i, next, band, b, bstart;
 		/*
 		 * Convert scan list to run-length encoded channel list
@@ -2781,20 +2755,6 @@ iwi_scanchan(struct iwi_softc *sc, unsig
 	return (iwi_cmd(sc, IWI_CMD_SCAN_EXT, &scan, sizeof scan));
 }
 
-static void
-iwi_scanabort(void *arg, int npending)
-{
-	struct iwi_softc *sc = arg;
-	IWI_LOCK_DECL;
-
-	IWI_LOCK(sc);
-	sc->flags &= ~IWI_FLAG_CHANNEL_SCAN;
-	/* NB: make sure we're still scanning */
-	if (sc->fw_state == IWI_FW_SCANNING)
-		iwi_cmd(sc, IWI_CMD_ABORT_SCAN, NULL, 0);
-	IWI_UNLOCK(sc);
-}
-
 static int
 iwi_set_sensitivity(struct iwi_softc *sc, int8_t rssi_dbm)
 {
@@ -2986,6 +2946,17 @@ done:
 	return (error);
 }
 
+static void
+iwi_disassoc(void *arg, int pending)
+{
+	struct iwi_softc *sc = arg;
+	IWI_LOCK_DECL;
+
+	IWI_LOCK(sc);
+	iwi_disassociate(sc, 0);
+	IWI_UNLOCK(sc);
+}
+

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

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 20:16:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 13452106566B;
	Sat,  2 May 2009 20:16:56 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 00EF88FC0A;
	Sat,  2 May 2009 20:16:56 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42KGtZt094143;
	Sat, 2 May 2009 20:16:55 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42KGtkM094138;
	Sat, 2 May 2009 20:16:55 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905022016.n42KGtkM094138@svn.freebsd.org>
From: Sam Leffler 
Date: Sat, 2 May 2009 20:16:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191753 - in head/sys: dev/ath net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 20:16:56 -0000

Author: sam
Date: Sat May  2 20:16:55 2009
New Revision: 191753
URL: http://svn.freebsd.org/changeset/base/191753

Log:
  make superg/fast-frames state dynamically-allocated (and indirect off
  the com structure instead of embedded); this reduces the overhead when
  not configured and reduces visibility of the contents

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/net80211/ieee80211_superg.c
  head/sys/net80211/ieee80211_superg.h
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Sat May  2 20:13:37 2009	(r191752)
+++ head/sys/dev/ath/if_ath.c	Sat May  2 20:16:55 2009	(r191753)
@@ -3995,12 +3995,7 @@ rx_next:
 
 	if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) {
 #ifdef IEEE80211_SUPPORT_SUPERG
-		if (ic->ic_stageqdepth) {
-			ieee80211_age_stageq(ic, WME_AC_VO, 100);
-			ieee80211_age_stageq(ic, WME_AC_VI, 100);
-			ieee80211_age_stageq(ic, WME_AC_BE, 100);
-			ieee80211_age_stageq(ic, WME_AC_BK, 100);
-		}
+		ieee80211_ff_age_all(ic, 100);
 #endif
 		if (!IFQ_IS_EMPTY(&ifp->if_snd))
 			ath_start(ifp);
@@ -4980,7 +4975,7 @@ ath_tx_processq(struct ath_softc *sc, st
 	 * Flush fast-frame staging queue when traffic slows.
 	 */
 	if (txq->axq_depth <= 1)
-		ieee80211_flush_stageq(ic, txq->axq_ac);
+		ieee80211_ff_flush(ic, txq->axq_ac);
 #endif
 	return nacked;
 }

Modified: head/sys/net80211/ieee80211_superg.c
==============================================================================
--- head/sys/net80211/ieee80211_superg.c	Sat May  2 20:13:37 2009	(r191752)
+++ head/sys/net80211/ieee80211_superg.c	Sat May  2 20:16:55 2009	(r191753)
@@ -90,17 +90,38 @@ int	ieee80211_ffagemax = -1;	/* max time
 void
 ieee80211_superg_attach(struct ieee80211com *ic)
 {
+	struct ieee80211_superg *sg;
+
+	if (ic->ic_caps & IEEE80211_C_FF) {
+		sg = (struct ieee80211_superg *) malloc(
+		     sizeof(struct ieee80211_superg), M_80211_VAP,
+		     M_NOWAIT | M_ZERO);
+		if (sg == NULL) {
+			printf("%s: cannot allocate SuperG state block\n",
+			    __func__);
+			return;
+		}
+		ic->ic_superg = sg;
+	}
 	ieee80211_ffagemax = msecs_to_ticks(150);
 }
 
 void
 ieee80211_superg_detach(struct ieee80211com *ic)
 {
+	if (ic->ic_superg != NULL) {
+		free(ic->ic_superg, M_80211_VAP);
+		ic->ic_superg = NULL;
+	}
 }
 
 void
 ieee80211_superg_vattach(struct ieee80211vap *vap)
 {
+	struct ieee80211com *ic = vap->iv_ic;
+
+	if (ic->ic_superg == NULL)	/* NB: can't do fast-frames w/o state */
+		vap->iv_caps &= ~IEEE80211_C_FF;
 	if (vap->iv_caps & IEEE80211_C_FF)
 		vap->iv_flags |= IEEE80211_F_FF;
 	/* NB: we only implement sta mode */
@@ -527,8 +548,10 @@ ff_flush(struct mbuf *head, struct mbuf 
  * Age frames on the staging queue.
  */
 void
-ieee80211_ff_age(struct ieee80211com *ic, struct ieee80211_stageq *sq, int quanta)
+ieee80211_ff_age(struct ieee80211com *ic, struct ieee80211_stageq *sq,
+    int quanta)
 {
+	struct ieee80211_superg *sg = ic->ic_superg;
 	struct mbuf *m, *head;
 	struct ieee80211_node *ni;
 	struct ieee80211_tx_ampdu *tap;
@@ -546,7 +569,7 @@ ieee80211_ff_age(struct ieee80211com *ic
 
 		sq->head = m->m_nextpkt;
 		sq->depth--;
-		ic->ic_stageqdepth--;
+		sg->ff_stageqdepth--;
 	}
 	if (m == NULL)
 		sq->tail = NULL;
@@ -631,6 +654,7 @@ ieee80211_ff_check(struct ieee80211_node
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = ni->ni_ic;
+	struct ieee80211_superg *sg = ic->ic_superg;
 	const int pri = M_WME_GETAC(m);
 	struct ieee80211_stageq *sq;
 	struct ieee80211_tx_ampdu *tap;
@@ -669,7 +693,7 @@ ieee80211_ff_check(struct ieee80211_node
 		IEEE80211_UNLOCK(ic);
 		return m;
 	}
-	sq = &ic->ic_ff_stageq[pri];
+	sq = &sg->ff_stageq[pri];
 	/*
 	 * Check the txop limit to insure the aggregate fits.
 	 */
@@ -730,7 +754,7 @@ ieee80211_ff_check(struct ieee80211_node
 		tap->txa_private = m;
 
 		stageq_add(sq, m);
-		ic->ic_stageqdepth++;
+		sg->ff_stageqdepth++;
 		IEEE80211_UNLOCK(ic);
 
 		IEEE80211_NOTE(vap, IEEE80211_MSG_SUPERG, ni,
@@ -755,6 +779,7 @@ void
 ieee80211_ff_node_cleanup(struct ieee80211_node *ni)
 {
 	struct ieee80211com *ic = ni->ni_ic;
+	struct ieee80211_superg *sg = ic->ic_superg;
 	struct ieee80211_tx_ampdu *tap;
 	struct mbuf *m, *head;
 	int ac;
@@ -766,7 +791,7 @@ ieee80211_ff_node_cleanup(struct ieee802
 		m = tap->txa_private;
 		if (m != NULL) {
 			tap->txa_private = NULL;
-			stageq_remove(&ic->ic_ff_stageq[ac], m);
+			stageq_remove(&sg->ff_stageq[ac], m);
 			m->m_nextpkt = head;
 			head = m;
 		}

Modified: head/sys/net80211/ieee80211_superg.h
==============================================================================
--- head/sys/net80211/ieee80211_superg.h	Sat May  2 20:13:37 2009	(r191752)
+++ head/sys/net80211/ieee80211_superg.h	Sat May  2 20:16:55 2009	(r191753)
@@ -57,6 +57,18 @@ struct ieee80211_ath_ie {
 #define	ATH_OUI_SUBTYPE		0x01
 
 #ifdef _KERNEL
+struct ieee80211_stageq {
+	struct mbuf		*head;		/* frames linked w/ m_nextpkt */
+	struct mbuf		*tail;		/* last frame in queue */
+	int			depth;		/* # items on head */
+};
+
+struct ieee80211_superg {
+	/* fast-frames staging q */
+	struct ieee80211_stageq	ff_stageq[WME_NUM_AC];
+	int			ff_stageqdepth;	/* cumulative depth */
+};
+
 void	ieee80211_superg_attach(struct ieee80211com *);
 void	ieee80211_superg_detach(struct ieee80211com *);
 void	ieee80211_superg_vattach(struct ieee80211vap *);
@@ -72,20 +84,33 @@ void	ieee80211_ff_node_init(struct ieee8
 void	ieee80211_ff_node_cleanup(struct ieee80211_node *);
 
 struct mbuf *ieee80211_ff_check(struct ieee80211_node *, struct mbuf *);
-void	ieee80211_ff_age(struct ieee80211com *, struct ieee80211_stageq *, int);
+void	ieee80211_ff_age(struct ieee80211com *, struct ieee80211_stageq *,
+	     int quanta);
 
 static __inline void
-ieee80211_flush_stageq(struct ieee80211com *ic, int ac)
+ieee80211_ff_flush(struct ieee80211com *ic, int ac)
 {
-	if (ic->ic_ff_stageq[ac].depth)
-		ieee80211_ff_age(ic, &ic->ic_ff_stageq[ac], 0x7fffffff);
+	struct ieee80211_superg *sg = ic->ic_superg;
+
+	if (sg != NULL && sg->ff_stageq[ac].depth)
+		ieee80211_ff_age(ic, &sg->ff_stageq[ac], 0x7fffffff);
 }
 
 static __inline void
-ieee80211_age_stageq(struct ieee80211com *ic, int ac, int quanta)
+ieee80211_ff_age_all(struct ieee80211com *ic, int quanta)
 {
-	if (ic->ic_ff_stageq[ac].depth)
-		ieee80211_ff_age(ic, &ic->ic_ff_stageq[ac], quanta);
+	struct ieee80211_superg *sg = ic->ic_superg;
+
+	if (sg != NULL && sg->ff_stageqdepth) {
+		if (sg->ff_stageq[WME_AC_VO].depth)
+			ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_VO], quanta);
+		if (sg->ff_stageq[WME_AC_VI].depth)
+			ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_VI], quanta);
+		if (sg->ff_stageq[WME_AC_BE].depth)
+			ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_BE], quanta);
+		if (sg->ff_stageq[WME_AC_BK].depth)
+			ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_BK], quanta);
+	}
 }
 
 struct mbuf *ieee80211_ff_encap(struct ieee80211vap *, struct mbuf *,

Modified: head/sys/net80211/ieee80211_var.h
==============================================================================
--- head/sys/net80211/ieee80211_var.h	Sat May  2 20:13:37 2009	(r191752)
+++ head/sys/net80211/ieee80211_var.h	Sat May  2 20:16:55 2009	(r191753)
@@ -110,12 +110,7 @@ struct ieee80211_tdma_param;
 struct ieee80211_rate_table;
 struct ieee80211_tx_ampdu;
 struct ieee80211_rx_ampdu;
-
-struct ieee80211_stageq {
-	struct mbuf		*head;		/* frames linked w/ m_nextpkt */
-	struct mbuf		*tail;		/* last frame in queue */
-	int			depth;		/* # items on head */
-};
+struct ieee80211_superg;
 
 struct ieee80211com {
 	struct ifnet		*ic_ifp;	/* associated device */
@@ -211,9 +206,8 @@ struct ieee80211com {
 	int			ic_lastnonerp;	/* last time non-ERP sta noted*/
 	int			ic_lastnonht;	/* last time non-HT sta noted */
 
-	/* fast-frames staging q */
-	struct ieee80211_stageq	ic_ff_stageq[WME_NUM_AC];
-	int			ic_stageqdepth;	/* cumulative depth */
+	/* optional state for Atheros SuperG protocol extensions */
+	struct ieee80211_superg	*ic_superg;
 
 	/* virtual ap create/delete */
 	struct ieee80211vap*	(*ic_vap_create)(struct ieee80211com *,

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 20:18:18 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B6154106566B;
	Sat,  2 May 2009 20:18:18 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A40658FC12;
	Sat,  2 May 2009 20:18:18 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42KIIle094214;
	Sat, 2 May 2009 20:18:18 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42KIIJM094213;
	Sat, 2 May 2009 20:18:18 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905022018.n42KIIJM094213@svn.freebsd.org>
From: Sam Leffler 
Date: Sat, 2 May 2009 20:18:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191754 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 20:18:19 -0000

Author: sam
Date: Sat May  2 20:18:18 2009
New Revision: 191754
URL: http://svn.freebsd.org/changeset/base/191754

Log:
  whitespace

Modified:
  head/sys/net80211/ieee80211_adhoc.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==============================================================================
--- head/sys/net80211/ieee80211_adhoc.c	Sat May  2 20:16:55 2009	(r191753)
+++ head/sys/net80211/ieee80211_adhoc.c	Sat May  2 20:18:18 2009	(r191754)
@@ -648,6 +648,7 @@ adhoc_input(struct ieee80211_node *ni, s
 		IEEE80211_NODE_STAT(ni, rx_ctrl);
 		vap->iv_recv_ctl(ni, m, subtype);
 		goto out;
+
 	default:
 		IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
 		    wh, "bad", "frame type 0x%x", type);

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 20:21:21 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C4D76106566C;
	Sat,  2 May 2009 20:21:21 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B35568FC17;
	Sat,  2 May 2009 20:21:21 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42KLLXa094311;
	Sat, 2 May 2009 20:21:21 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42KLLc1094310;
	Sat, 2 May 2009 20:21:21 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905022021.n42KLLc1094310@svn.freebsd.org>
From: Sam Leffler 
Date: Sat, 2 May 2009 20:21:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191755 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 20:21:22 -0000

Author: sam
Date: Sat May  2 20:21:21 2009
New Revision: 191755
URL: http://svn.freebsd.org/changeset/base/191755

Log:
  o dump tx/rx seq#'s for qos tid's
  o improve check for when to dump rx ampdu state

Modified:
  head/sys/net80211/ieee80211_ddb.c

Modified: head/sys/net80211/ieee80211_ddb.c
==============================================================================
--- head/sys/net80211/ieee80211_ddb.c	Sat May  2 20:18:18 2009	(r191754)
+++ head/sys/net80211/ieee80211_ddb.c	Sat May  2 20:21:21 2009	(r191755)
@@ -238,6 +238,15 @@ _db_show_sta(const struct ieee80211_node
 		ni->ni_ies.ath_ie);
 	db_printf("\t htcap_ie %p htinfo_ie %p]\n",
 		ni->ni_ies.htcap_ie, ni->ni_ies.htinfo_ie);
+	if (ni->ni_flags & IEEE80211_NODE_QOS) {
+		for (i = 0; i < WME_NUM_TID; i++) {
+			if (ni->ni_txseqs[i] || ni->ni_rxseqs[i])
+				db_printf("\t[%u] txseq %u rxseq %u fragno %u\n",
+				    i, ni->ni_txseqs[i],
+				    ni->ni_rxseqs[i] >> IEEE80211_SEQ_SEQ_SHIFT,
+				    ni->ni_rxseqs[i] & IEEE80211_SEQ_FRAG_MASK);
+		}
+	}
 	db_printf("\ttxseq %u rxseq %u fragno %u rxfragstamp %u\n",
 		ni->ni_txseqs[IEEE80211_NONQOS_TID],
 		ni->ni_rxseqs[IEEE80211_NONQOS_TID] >> IEEE80211_SEQ_SEQ_SHIFT,
@@ -271,8 +280,7 @@ _db_show_sta(const struct ieee80211_node
 		if (ni->ni_tx_ampdu[i].txa_flags & IEEE80211_AGGR_SETUP)
 			_db_show_txampdu("\t", i, &ni->ni_tx_ampdu[i]);
 	for (i = 0; i < WME_NUM_TID; i++)
-		if (ni->ni_rx_ampdu[i].rxa_nframes ||
-		    ni->ni_rx_ampdu[i].rxa_qframes)
+		if (ni->ni_rx_ampdu[i].rxa_flags)
 			_db_show_rxampdu("\t", i, &ni->ni_rx_ampdu[i]);
 
 	db_printf("\tinact %u inact_reload %u txrate %u\n",

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 20:25:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB1881065670;
	Sat,  2 May 2009 20:25:22 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BF4FC8FC08;
	Sat,  2 May 2009 20:25:22 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42KPMki094434;
	Sat, 2 May 2009 20:25:22 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42KPMqp094431;
	Sat, 2 May 2009 20:25:22 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905022025.n42KPMqp094431@svn.freebsd.org>
From: Sam Leffler 
Date: Sat, 2 May 2009 20:25:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191756 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 20:25:23 -0000

Author: sam
Date: Sat May  2 20:25:22 2009
New Revision: 191756
URL: http://svn.freebsd.org/changeset/base/191756

Log:
  promote ieee80211_seq typedef

Modified:
  head/sys/net80211/ieee80211.h
  head/sys/net80211/ieee80211_ht.h
  head/sys/net80211/ieee80211_node.h

Modified: head/sys/net80211/ieee80211.h
==============================================================================
--- head/sys/net80211/ieee80211.h	Sat May  2 20:21:21 2009	(r191755)
+++ head/sys/net80211/ieee80211.h	Sat May  2 20:25:22 2009	(r191756)
@@ -36,6 +36,8 @@
 /* is 802.11 address multicast/broadcast? */
 #define	IEEE80211_IS_MULTICAST(_a)	(*(_a) & 0x01)
 
+typedef uint16_t ieee80211_seq;
+
 /* IEEE 802.11 PLCP header */
 struct ieee80211_plcp_hdr {
 	uint16_t	i_sfd;

Modified: head/sys/net80211/ieee80211_ht.h
==============================================================================
--- head/sys/net80211/ieee80211_ht.h	Sat May  2 20:21:21 2009	(r191755)
+++ head/sys/net80211/ieee80211_ht.h	Sat May  2 20:25:22 2009	(r191756)
@@ -35,8 +35,6 @@
 /* threshold for aging overlapping non-HT bss */
 #define	IEEE80211_NONHT_PRESENT_AGE	msecs_to_ticks(60*1000)
 
-typedef uint16_t ieee80211_seq;
-
 struct ieee80211_tx_ampdu {
 	struct ieee80211_node *txa_ni;	/* back pointer */
 	u_short		txa_flags;

Modified: head/sys/net80211/ieee80211_node.h
==============================================================================
--- head/sys/net80211/ieee80211_node.h	Sat May  2 20:21:21 2009	(r191755)
+++ head/sys/net80211/ieee80211_node.h	Sat May  2 20:25:22 2009	(r191756)
@@ -137,9 +137,9 @@ struct ieee80211_node {
 	uint32_t		*ni_challenge;	/* shared-key challenge */
 	struct ieee80211_ies	ni_ies;		/* captured ie's */
 						/* tx seq per-tid */
-	uint16_t		ni_txseqs[IEEE80211_TID_SIZE];
+	ieee80211_seq		ni_txseqs[IEEE80211_TID_SIZE];
 						/* rx seq previous per-tid*/
-	uint16_t		ni_rxseqs[IEEE80211_TID_SIZE];
+	ieee80211_seq		ni_rxseqs[IEEE80211_TID_SIZE];
 	uint32_t		ni_rxfragstamp;	/* time stamp of last rx frag */
 	struct mbuf		*ni_rxfrag[3];	/* rx frag reassembly */
 	struct ieee80211_key	ni_ucastkey;	/* unicast key */

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 20:28:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 17FC0106566C;
	Sat,  2 May 2009 20:28:56 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0678D8FC0A;
	Sat,  2 May 2009 20:28:56 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42KStlm094534;
	Sat, 2 May 2009 20:28:55 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42KStE3094533;
	Sat, 2 May 2009 20:28:55 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905022028.n42KStE3094533@svn.freebsd.org>
From: Sam Leffler 
Date: Sat, 2 May 2009 20:28:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191757 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 20:28:56 -0000

Author: sam
Date: Sat May  2 20:28:55 2009
New Revision: 191757
URL: http://svn.freebsd.org/changeset/base/191757

Log:
  don't say "ac WME_AC_BE"; remove "ac"

Modified:
  head/sys/net80211/ieee80211_ddb.c

Modified: head/sys/net80211/ieee80211_ddb.c
==============================================================================
--- head/sys/net80211/ieee80211_ddb.c	Sat May  2 20:25:22 2009	(r191756)
+++ head/sys/net80211/ieee80211_ddb.c	Sat May  2 20:28:55 2009	(r191757)
@@ -183,7 +183,7 @@ DB_SHOW_ALL_COMMAND(vaps, db_show_all_va
 static void
 _db_show_txampdu(const char *sep, int ix, const struct ieee80211_tx_ampdu *tap)
 {
-	db_printf("%stxampdu[%d]: %p flags %b ac %s\n",
+	db_printf("%stxampdu[%d]: %p flags %b %s\n",
 		sep, ix, tap, tap->txa_flags, IEEE80211_AGGR_BITS,
 		ieee80211_wme_acnames[tap->txa_ac]);
 	db_printf("%s  token %u lastsample %d pkts %d avgpps %d qbytes %d qframes %d\n",

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 21:40:03 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 02C57106564A;
	Sat,  2 May 2009 21:40:03 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 8CFA78FC16;
	Sat,  2 May 2009 21:40:02 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n42Lc1s6029173;
	Sat, 2 May 2009 15:38:02 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Sat, 02 May 2009 15:38:08 -0600 (MDT)
Message-Id: <20090502.153808.-896932641.imp@bsdimp.com>
To: mav@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <200905012143.n41Lh4uS054073@svn.freebsd.org>
References: <200905012143.n41Lh4uS054073@svn.freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r191733 - in head/sys: amd64/isa isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 21:40:03 -0000

In message: <200905012143.n41Lh4uS054073@svn.freebsd.org>
            Alexander Motin  writes:
: Author: mav
: Date: Fri May  1 21:43:04 2009
: New Revision: 191733
: URL: http://svn.freebsd.org/changeset/base/191733
: 
: Log:
:   Add resume methods to i8254 and atrtc devices.

This likely obviates the need for pmtimer.c now.  You might want to
investigate...  

: Modified:
:   head/sys/amd64/isa/clock.c
:   head/sys/isa/atrtc.c

Shouldn't there be one for i386 too?

Warner


: Modified: head/sys/amd64/isa/clock.c
: ==============================================================================
: --- head/sys/amd64/isa/clock.c	Fri May  1 21:31:39 2009	(r191732)
: +++ head/sys/amd64/isa/clock.c	Fri May  1 21:43:04 2009	(r191733)
: @@ -376,6 +376,17 @@ set_i8254_freq(u_int freq, int intr_freq
:  	mtx_unlock_spin(&clock_lock);
:  }
:  
: +static void
: +i8254_restore(void)
: +{
: +
: +	mtx_lock_spin(&clock_lock);
: +	outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
: +	outb(TIMER_CNTR0, i8254_real_max_count & 0xff);
: +	outb(TIMER_CNTR0, i8254_real_max_count >> 8);
: +	mtx_unlock_spin(&clock_lock);
: +}
: +
:  /* This is separate from startrtclock() so that it can be called early. */
:  void
:  i8254_init(void)
: @@ -558,6 +569,14 @@ attimer_attach(device_t dev)
:  	return(0);
:  }
:  
: +static int
: +attimer_resume(device_t dev)
: +{
: +
: +	i8254_restore();
: +	return(0);
: +}
: +
:  static device_method_t attimer_methods[] = {
:  	/* Device interface */
:  	DEVMETHOD(device_probe,		attimer_probe),
: @@ -565,7 +584,7 @@ static device_method_t attimer_methods[]
:  	DEVMETHOD(device_detach,	bus_generic_detach),
:  	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
:  	DEVMETHOD(device_suspend,	bus_generic_suspend),
: -	DEVMETHOD(device_resume,	bus_generic_resume),
: +	DEVMETHOD(device_resume,	attimer_resume),
:  	{ 0, 0 }
:  };
:  
: 
: Modified: head/sys/isa/atrtc.c
: ==============================================================================
: --- head/sys/isa/atrtc.c	Fri May  1 21:31:39 2009	(r191732)
: +++ head/sys/isa/atrtc.c	Fri May  1 21:43:04 2009	(r191733)
: @@ -190,6 +190,13 @@ atrtc_attach(device_t dev)
:  	return(0);
:  }
:  
: +static int
: +atrtc_resume(device_t dev)
: +{
: +
: +	atrtc_restore();
: +	return(0);
: +}
:  
:  static int
:  atrtc_settime(device_t dev __unused, struct timespec *ts)
: @@ -264,8 +271,7 @@ static device_method_t atrtc_methods[] =
:  	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
:  	DEVMETHOD(device_suspend,	bus_generic_suspend),
:  		/* XXX stop statclock? */
: -	DEVMETHOD(device_resume,	bus_generic_resume),
: -		/* XXX restart statclock? */
: +	DEVMETHOD(device_resume,	atrtc_resume),
:  
:  	/* clock interface */
:  	DEVMETHOD(clock_gettime,	atrtc_gettime),
: 

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 22:07:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1CD0F106566C;
	Sat,  2 May 2009 22:07:06 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 32DF78FC19;
	Sat,  2 May 2009 22:07:04 +0000 (UTC) (envelope-from mav@FreeBSD.org)
X-Spam-Flag: SKIP
X-Spam-Yversion: Spamooborona-2.1.0
Received: from [212.86.226.226] (account mav@alkar.net HELO
	mavbook.mavhome.dp.ua)
	by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9)
	with ESMTPSA id 241810446; Sun, 03 May 2009 01:07:04 +0300
Message-ID: <49FCC404.6090105@FreeBSD.org>
Date: Sun, 03 May 2009 01:07:00 +0300
From: Alexander Motin 
User-Agent: Thunderbird 2.0.0.21 (X11/20090405)
MIME-Version: 1.0
To: "M. Warner Losh" 
References: <200905012143.n41Lh4uS054073@svn.freebsd.org>
	<20090502.153808.-896932641.imp@bsdimp.com>
In-Reply-To: <20090502.153808.-896932641.imp@bsdimp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r191733 - in head/sys: amd64/isa isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 22:07:06 -0000

M. Warner Losh wrote:
> : Author: mav
> : Date: Fri May  1 21:43:04 2009
> : New Revision: 191733
> : URL: http://svn.freebsd.org/changeset/base/191733
> : 
> : Log:
> :   Add resume methods to i8254 and atrtc devices.
> 
> This likely obviates the need for pmtimer.c now.  You might want to
> investigate...

Yes, I have seen it.

> : Modified:
> :   head/sys/amd64/isa/clock.c
> :   head/sys/isa/atrtc.c
> 
> Shouldn't there be one for i386 too?

For i386 it is done by pmtimer now (that's why I haven't done it there), 
but there is no pmtimer driver for amd64. Actually both ways are not so 
perfect, as both restore timer interrupts quite late on resume process. 
In my case it is not fatal as i8254 is anyway ticking by default, just 
slower. But it seems to increase my system resume time to 10 seconds 
instead of usual 4-5. May be we should somehow enforce order of device 
resuming, or build some special event timers control infrastructure 
alike to PIC one.

Also, except restoring clocks interrupts, pmtimer restores system time 
on wakeup. For amd64 it is implemented in MD resume code now. We should 
decide which way to go. I don't very like pmtimer approach, as there is 
no any newbus relations between it and i8254/atrtc drivers.

-- 
Alexander Motin

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 22:22:00 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E813E106564A;
	Sat,  2 May 2009 22:22:00 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D72168FC17;
	Sat,  2 May 2009 22:22:00 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42MM0eL096961;
	Sat, 2 May 2009 22:22:00 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42MM0QI096960;
	Sat, 2 May 2009 22:22:00 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200905022222.n42MM0QI096960@svn.freebsd.org>
From: Kip Macy 
Date: Sat, 2 May 2009 22:22:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191759 - head/sys/i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 22:22:01 -0000

Author: kmacy
Date: Sat May  2 22:22:00 2009
New Revision: 191759
URL: http://svn.freebsd.org/changeset/base/191759

Log:
  fix XEN compilation

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

Modified: head/sys/i386/xen/mp_machdep.c
==============================================================================
--- head/sys/i386/xen/mp_machdep.c	Sat May  2 20:39:43 2009	(r191758)
+++ head/sys/i386/xen/mp_machdep.c	Sat May  2 22:22:00 2009	(r191759)
@@ -142,6 +142,9 @@ int apic_cpuids[MAX_APIC_ID + 1];
 /* Holds pending bitmap based IPIs per CPU */
 static volatile u_int cpu_ipi_pending[MAXCPU];
 
+static int cpu_logical;
+static int cpu_cores;
+
 static void	assign_cpu_ids(void);
 static void	set_interrupt_apic_ids(void);
 int	start_all_aps(void);

From owner-svn-src-head@FreeBSD.ORG  Sat May  2 22:30:33 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5EB1E106566C;
	Sat,  2 May 2009 22:30:33 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4D6488FC0A;
	Sat,  2 May 2009 22:30:33 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42MUX5a097148;
	Sat, 2 May 2009 22:30:33 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42MUXAs097147;
	Sat, 2 May 2009 22:30:33 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200905022230.n42MUXAs097147@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 2 May 2009 22:30:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r191760 - head/sys/dev/acpica
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 02 May 2009 22:30:33 -0000

Author: mav
Date: Sat May  2 22:30:33 2009
New Revision: 191760
URL: http://svn.freebsd.org/changeset/base/191760

Log:
  Avoid comparing negative signed to positive unsignad values. It was
  leading to a bug, when C-state does not decrease on sleep shorter then
  declared transition latency. Fixing this deprecates workaround for broken
  C-states on some hardware.
  
  By the way, change state selecting logic a bit. Instead of last sleep
  time use short-time average of it. Global interrupts rate in system is a
  quite random value, to corellate subsequent sleeps so directly.

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

Modified: head/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- head/sys/dev/acpica/acpi_cpu.c	Sat May  2 22:22:00 2009	(r191759)
+++ head/sys/dev/acpica/acpi_cpu.c	Sat May  2 22:30:33 2009	(r191760)
@@ -882,43 +882,13 @@ acpi_cpu_idle()
 	return;
     }
 
-    /*
-     * If we slept 100 us or more, use the lowest Cx state.  Otherwise,
-     * find the lowest state that has a latency less than or equal to
-     * the length of our last sleep.
-     */
-    cx_next_idx = sc->cpu_cx_lowest;
-    if (sc->cpu_prev_sleep < 100) {
-	/*
-	 * If we sleep too short all the time, this system may not implement
-	 * C2/3 correctly (i.e. reads return immediately).  In this case,
-	 * back off and use the next higher level.
-	 * It seems that when you have a dual core cpu (like the Intel Core Duo)
-	 * that both cores will get out of C3 state as soon as one of them
-	 * requires it. This breaks the sleep detection logic as the sleep
-	 * counter is local to each cpu. Disable the sleep logic for now as a
-	 * workaround if there's more than one CPU. The right fix would probably
-	 * be to add quirks for system that don't really support C3 state.
-	 */
-	if (mp_ncpus < 2 && sc->cpu_prev_sleep <= 1) {
-	    sc->cpu_short_slp++;
-	    if (sc->cpu_short_slp == 1000 && sc->cpu_cx_lowest != 0) {
-		if (sc->cpu_non_c3 == sc->cpu_cx_lowest && sc->cpu_non_c3 != 0)
-		    sc->cpu_non_c3--;
-		sc->cpu_cx_lowest--;
-		sc->cpu_short_slp = 0;
-		device_printf(sc->cpu_dev,
-		    "too many short sleeps, backing off to C%d\n",
-		    sc->cpu_cx_lowest + 1);
-	    }
-	} else
-	    sc->cpu_short_slp = 0;
-
-	for (i = sc->cpu_cx_lowest; i >= 0; i--)
-	    if (sc->cpu_cx_states[i].trans_lat <= sc->cpu_prev_sleep) {
-		cx_next_idx = i;
-		break;
-	    }
+    /* Find the lowest state that has small enougth latency. */
+    cx_next_idx = 0;
+    for (i = sc->cpu_cx_lowest; i >= 0; i--) {
+	if (sc->cpu_cx_states[i].trans_lat * 3 <= sc->cpu_prev_sleep) {
+	    cx_next_idx = i;
+	    break;
+	}
     }
 
     /*
@@ -943,10 +913,10 @@ acpi_cpu_idle()
     /*
      * Execute HLT (or equivalent) and wait for an interrupt.  We can't
      * calculate the time spent in C1 since the place we wake up is an
-     * ISR.  Assume we slept one quantum and return.
+     * ISR.  Assume we slept half of quantum and return.
      */
     if (cx_next->type == ACPI_STATE_C1) {
-	sc->cpu_prev_sleep = 1000000 / hz;
+	sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + 500000 / hz) / 4;
 	acpi_cpu_c1();
 	return;
     }
@@ -989,9 +959,9 @@ acpi_cpu_idle()
     }
     ACPI_ENABLE_IRQS();
 
-    /* Find the actual time asleep in microseconds, minus overhead. */
+    /* Find the actual time asleep in microseconds. */
     end_time = acpi_TimerDelta(end_time, start_time);
-    sc->cpu_prev_sleep = PM_USEC(end_time) - cx_next->trans_lat;
+    sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + PM_USEC(end_time)) / 4;
 }
 
 /*