From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 17:01:06 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 842161065677; Mon, 8 Dec 2008 17:01:06 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A0268FC17; Mon, 8 Dec 2008 17:01:06 +0000 (UTC) (envelope-from lulf@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 mB8H16Je065586; Mon, 8 Dec 2008 17:01:06 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB8H16dI065585; Mon, 8 Dec 2008 17:01:06 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812081701.mB8H16dI065585@svn.freebsd.org> From: Ulf Lilleengen Date: Mon, 8 Dec 2008 17:01:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185767 - projects/gvinum X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2008 17:01:06 -0000 Author: lulf Date: Mon Dec 8 17:01:05 2008 New Revision: 185767 URL: http://svn.freebsd.org/changeset/base/185767 Log: - Add project folder for new gvinum. Added: projects/gvinum/ From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 06:23:35 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C405D1065670; Tue, 9 Dec 2008 06:23:35 +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 B36418FC12; Tue, 9 Dec 2008 06:23:35 +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 mB96NZta082215; Tue, 9 Dec 2008 06:23:35 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB96NZ0J082214; Tue, 9 Dec 2008 06:23:35 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812090623.mB96NZ0J082214@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Dec 2008 06:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185787 - projects/releng_7_xen/sys/modules X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 06:23:35 -0000 Author: kmacy Date: Tue Dec 9 06:23:35 2008 New Revision: 185787 URL: http://svn.freebsd.org/changeset/base/185787 Log: temporarily comment out modules that don't build in XEN environment Modified: projects/releng_7_xen/sys/modules/Makefile Modified: projects/releng_7_xen/sys/modules/Makefile ============================================================================== --- projects/releng_7_xen/sys/modules/Makefile Tue Dec 9 05:02:17 2008 (r185786) +++ projects/releng_7_xen/sys/modules/Makefile Tue Dec 9 06:23:35 2008 (r185787) @@ -67,7 +67,7 @@ SUBDIR= ${_3dfx} \ ${_cs} \ ${_ctau} \ cue \ - cxgb \ + ${_cxgb} \ ${_cx} \ ${_cyclic} \ dc \ @@ -328,12 +328,13 @@ SUBDIR= ${_3dfx} \ ${_wpi} \ ${_wpifw} \ ${_xe} \ - xfs \ xl \ ${_zfs} \ zlib \ zyd +#XEN!=grep XEN ${.CURDIR}/opt_xen.h + .if ${MACHINE_ARCH} != "powerpc" _syscons= syscons _vpo= vpo @@ -394,7 +395,7 @@ _cyclic= cyclic .endif _digi= digi _dpms= dpms -_drm= drm +#_drm= drm .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _dtrace= dtrace .endif @@ -465,6 +466,7 @@ _bios= bios _ciss= ciss _cm= cm _cmx= cmx +#_cxgb= cxgb _coretemp= coretemp _ctau= ctau _cx= cx @@ -523,11 +525,12 @@ _cmx= cmx _ciss= ciss _coretemp= coretemp _cpufreq= cpufreq +#_cxgb cxgb .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _cyclic= cyclic .endif _digi= digi -_drm= drm +#_drm= drm .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _dtrace= dtrace .endif From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 06:24:26 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9C741065670; Tue, 9 Dec 2008 06:24: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 D94AB8FC14; Tue, 9 Dec 2008 06:24: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 mB96OQgE082268; Tue, 9 Dec 2008 06:24:26 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB96OQe4082267; Tue, 9 Dec 2008 06:24:26 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812090624.mB96OQe4082267@svn.freebsd.org> From: Kip Macy Date: Tue, 9 Dec 2008 06:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185788 - projects/releng_7_xen/sys/i386/conf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 06:24:27 -0000 Author: kmacy Date: Tue Dec 9 06:24:26 2008 New Revision: 185788 URL: http://svn.freebsd.org/changeset/base/185788 Log: comment out MODULES_OVERRIDE Modified: projects/releng_7_xen/sys/i386/conf/XEN Modified: projects/releng_7_xen/sys/i386/conf/XEN ============================================================================== --- projects/releng_7_xen/sys/i386/conf/XEN Tue Dec 9 06:23:35 2008 (r185787) +++ projects/releng_7_xen/sys/i386/conf/XEN Tue Dec 9 06:24:26 2008 (r185788) @@ -25,7 +25,7 @@ ident GENERIC #hints "GENERIC.hints" # Default places to look for devices. makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="" +#makeoptions MODULES_OVERRIDE="" #options SCHED_ULE # ULE scheduler #options PREEMPTION # Enable kernel thread preemption From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 16:50:37 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBE271065673; Tue, 9 Dec 2008 16:50:37 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B30C98FC1C; Tue, 9 Dec 2008 16:50:37 +0000 (UTC) (envelope-from lulf@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 mB9GobRY096338; Tue, 9 Dec 2008 16:50:37 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9GobGW096337; Tue, 9 Dec 2008 16:50:37 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812091650.mB9GobGW096337@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 9 Dec 2008 16:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185799 - projects/gvinum/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 16:50:37 -0000 Author: lulf Date: Tue Dec 9 16:50:37 2008 New Revision: 185799 URL: http://svn.freebsd.org/changeset/base/185799 Log: - Initial import of HEAD sources. Added: projects/gvinum/sys/ (props changed) - copied from r185798, head/sys/ From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 16:52:02 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B15A106564A; Tue, 9 Dec 2008 16:52:02 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 722D68FC0C; Tue, 9 Dec 2008 16:52:02 +0000 (UTC) (envelope-from lulf@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 mB9Gq2a5096400; Tue, 9 Dec 2008 16:52:02 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9Gq2oi096399; Tue, 9 Dec 2008 16:52:02 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812091652.mB9Gq2oi096399@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 9 Dec 2008 16:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185800 - in projects/gvinum/sbin: . gvinum X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 16:52:02 -0000 Author: lulf Date: Tue Dec 9 16:52:02 2008 New Revision: 185800 URL: http://svn.freebsd.org/changeset/base/185800 Log: - Import initial HEAD sources for userland part. Added: projects/gvinum/sbin/ projects/gvinum/sbin/gvinum/ - copied from r185799, head/sbin/gvinum/ From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 18:27:04 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61B671065672; Tue, 9 Dec 2008 18:27:04 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F7D38FC17; Tue, 9 Dec 2008 18:27:04 +0000 (UTC) (envelope-from lulf@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 mB9IR4M2098286; Tue, 9 Dec 2008 18:27:04 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9IR4Pt098283; Tue, 9 Dec 2008 18:27:04 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812091827.mB9IR4Pt098283@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 9 Dec 2008 18:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185804 - in projects/gvinum: sbin/gvinum sys/geom/vinum sys/modules/geom/geom_vinum X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 18:27:04 -0000 Author: lulf Date: Tue Dec 9 18:27:04 2008 New Revision: 185804 URL: http://svn.freebsd.org/changeset/base/185804 Log: - Import the gvinum work done in p4. Added: projects/gvinum/sys/geom/vinum/geom_vinum_create.c (contents, props changed) projects/gvinum/sys/geom/vinum/geom_vinum_events.c (contents, props changed) Modified: projects/gvinum/sbin/gvinum/gvinum.8 projects/gvinum/sbin/gvinum/gvinum.c projects/gvinum/sys/geom/vinum/geom_vinum.c projects/gvinum/sys/geom/vinum/geom_vinum.h projects/gvinum/sys/geom/vinum/geom_vinum_drive.c projects/gvinum/sys/geom/vinum/geom_vinum_init.c projects/gvinum/sys/geom/vinum/geom_vinum_list.c projects/gvinum/sys/geom/vinum/geom_vinum_move.c projects/gvinum/sys/geom/vinum/geom_vinum_plex.c projects/gvinum/sys/geom/vinum/geom_vinum_raid5.c projects/gvinum/sys/geom/vinum/geom_vinum_raid5.h projects/gvinum/sys/geom/vinum/geom_vinum_rename.c projects/gvinum/sys/geom/vinum/geom_vinum_rm.c projects/gvinum/sys/geom/vinum/geom_vinum_share.c projects/gvinum/sys/geom/vinum/geom_vinum_share.h projects/gvinum/sys/geom/vinum/geom_vinum_state.c projects/gvinum/sys/geom/vinum/geom_vinum_subr.c projects/gvinum/sys/geom/vinum/geom_vinum_var.h projects/gvinum/sys/geom/vinum/geom_vinum_volume.c projects/gvinum/sys/modules/geom/geom_vinum/Makefile Modified: projects/gvinum/sbin/gvinum/gvinum.8 ============================================================================== --- projects/gvinum/sbin/gvinum/gvinum.8 Tue Dec 9 17:47:05 2008 (r185803) +++ projects/gvinum/sbin/gvinum/gvinum.8 Tue Dec 9 18:27:04 2008 (r185804) @@ -40,6 +40,13 @@ .Op Fl options .Sh COMMANDS .Bl -tag -width indent +.It Ic attach Ar plex volume Op Cm rename +.It Ic attach Ar subdisk plex Oo Ar offset Oc Op Cm rename +Attach a plex to a volume, or a subdisk to a plex. +If offset is specified, the subdisk will be attached to the given offset within +the plex. +If rename is specified, the subdisk or plex will change name according to the +object it attaches to. .It Ic checkparity Oo Fl f Oc Ar plex Check the parity blocks of a RAID-5 plex. The parity check will start at the @@ -49,7 +56,10 @@ flag is specified, or otherwise at the l the first location at which plex's parity is incorrect. All subdisks in the plex must be up for a parity check. -.It Ic create Op Ar description-file +.It Ic concat Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives +Create a concatenated volume from the specified drives. +If no name is specified, a unique name will be set by gvinum. +.It Ic create Oo Fl f Oc Op Ar description-file Create a volume as described in .Ar description-file . If no @@ -57,6 +67,18 @@ If no provided, opens an editor and provides the current .Nm configuration for editing. +The +.Fl f +flag will make gvinum ignore any errors regarding creating objects that already +exists. +However, in contrast to vinum, objects that are not properly named in the +.Ar description-file +will not be created when the +.Fl f +flag is given. +.It Ic detach Oo Fl f Oc Op Ar plex | subdisk +Detach a plex or subdisk from the volume or plex to which it is +attached. .It Ic help Provides a synopsis of .Nm @@ -76,6 +98,14 @@ The and .Fl V flags provide progressively more detailed output. +.It Ic mirror Oo Fl fsv Oc Oo Fl n Ar name Oc Ar drives +Create a mirrored volume from the specified drives. +It requires at least a multiple of 2 drives. +If no name is specified, a unique name will be set by gvinum. +If the +.Fl s +flag is specified, a striped mirror will be created, and thus requires a +multiple of 4 drives. .It Ic move | mv Fl f Ar drive subdisk Op Ar ... Move the subdisk(s) to the specified drive. The @@ -85,12 +115,19 @@ part of the move. This can currently only be done when the subdisk is not being accessed. .Pp -If the subdisk(s) form part of a RAID-5 plex, the disk(s) will need to be set -to the +If a single subdisk is moved, and it forms a part of a RAID-5 plex, the moved +subdisks will need to be set to the +.Dq stale +state, and the plex will require a +.Ic start +command. +If multiple subdisk(s) is moved, and form part of a RAID-5 plex, the +moved disk(s) will need to be set to the .Dq up state and the plex will require a .Ic rebuildparity -command; if the subdisk(s) form part of a plex that is mirrored with other +command. +If the subdisk(s) form part of a plex that is mirrored with other plexes, the plex will require restarting and will sync once restarted. Moving more than one subdisk in a RAID-5 plex or subdisks from both sides of a @@ -105,6 +142,11 @@ Exit when running in interactive mode. Normally this would be done by entering the EOF character. +.It Ic raid5 Oo Fl fv Oc Oo Fl s Ar stripesize Oc Oo Fl n Ar name Oc Ar drives +Create a RAID-5 volume from the specified drives. +If no name is specified,a unique name will be set by +.Ic gvinum. +This organization requires at least three drives. .It Ic rename Oo Fl r Oc Ar drive | subdisk | plex | volume newname Change the name of the specified object. The @@ -143,9 +185,21 @@ flag forces state changes regardless of Read configuration from all vinum drives. .It Ic start Oo Fl S Ar size Oc Ar volume | plex | subdisk Allow the system to access the objects. +If necessary, plexes will be synced and rebuilt. +If a subdisk was added to a running RAID-5 or striped plex, gvinum will +expand into this subdisk and grow the whole RAID-5 array. +This can be done without unmounting your filesystem. The .Fl S flag is currently ignored. +.It Ic stop Oo Fl f Oc Op Ar volume | plex | subdisk +Terminate access to the objects, or stop +.Nm +if no parameters are specified. +.It Ic stripe Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives +Create a striped volume from the specified drives. If no name is specified, +a unique name will be set by Ic gvinum. This organization requires at least two +drives. .El .Sh DESCRIPTION The @@ -217,15 +271,90 @@ is invoked. directory with device nodes for .Nm objects -.It Pa /dev/gvinum/plex -directory containing device nodes for -.Nm -plexes -.It Pa /dev/gvinum/sd -directory containing device nodes for -.Nm -subdisks .El +.Sh EXAMPLES +To create a mirror on disks /dev/ad1 and /dev/ad2, create a filesystem, mount, +unmount and then stop Ic gvinum: +.Pp +.Dl "gvinum mirror /dev/ad1 /dev/ad2" +.Dl "newfs /dev/gvinum/gvinumvolume0" +.Dl "mount /dev/gvinum/gvinumvolume0 /mnt" +.Dl "..." +.Dl "unmount /mnt" +.Dl "gvinum stop" +.Pp +To create a striped mirror on disks /dev/ad1 /dev/ad2 /dev/ad3 and /dev/ad4 +named "data" and create a filesystem: +.Pp +.Dl "gvinum mirror -s -n data /dev/ad1 /dev/ad2 /dev/ad3 /dev/ad4" +.Dl "newfs /dev/gvinum/data" +.Pp +To create a raid5 array on disks /dev/ad1 /dev/ad2 and /dev/ad3, with stripesize +493k you can use the raid5 command: +.Pp +.Dl "gvinum raid5 -s 493k /dev/ad1 /dev/ad2 /dev/ad3" +.Pp +Then the volume will be created automatically. +Afterwards, you have to initialize the volume: +.Pp +.Dl "gvinum start myraid5vol" +.Pp +The initialization will start, and the states will be updated when it's +finished. +The list command will give you information about its progress. +.Pp +Imagine that one of the drives fails, and the output of 'printconfig' looks +something like this: +.Pp +.Dl "drive gvinumdrive1 device /dev/ad2" +.Dl "drive gvinumdrive2 device /dev/???" +.Dl "drive gvinumdrive0 device /dev/ad1" +.Dl "volume myraid5vol" +.Dl "plex name myraid5vol.p0 org raid5 986s vol myraid5vol" +.Dl "sd name myraid5vol.p0.s2 drive gvinumdrive2 len 32538s driveoffset 265s" +.Dl "plex myraid5vol.p0 plexoffset 1972s" +.Dl "sd name myraid5vol.p0.s1 drive gvinumdrive1 len 32538s driveoffset 265s" +.Dl "plex myraid5vol.p0 plexoffset 986s" +.Dl "sd name myraid5vol.p0.s0 drive gvinumdrive0 len 32538s driveoffset 265s" +.Dl "plex myraid5vol.p0 plexoffset 0s" +.Pp +Create a new drive with this configuration: +.Pp +.Dl "drive gdrive4 device /dev/ad4" +.Pp +Then move the stale subdisk to the new drive: +.Pp +.Dl "gvinum move gdrive4 myraid5vol.p0.s2" +.Pp +Then, initiate the rebuild: +.Pp +.Dl "gvinum start myraid5vol.p0" +.Pp +The plex will go up form degraded mode after the rebuild is finished. +The plex can still be used while the rebuild is in progress, although requests +might be delayed. +For a more advanced usage and detailed explanation of gvinum, the +handbook is recommended. +.Pp +Given the configuration as in the previous example, growing a RAID-5 or STRIPED +array is accomplished by adding a new subdisk to the plex with a +.Ar description-file +similar to this: +.Pp +.Dl "drive newdrive device /dev/ad4" +.Dl "sd drive newdrive plex myraid5vol.p0" +.Pp +If everything went ok, the plex state should now be set to growable. +You can then start the growing with the +.Ic start +command: +.Pp +.Dl "gvinum start myraid5vol.p0" +.Pp +As with rebuilding, you can watch the progress using the +.Ic list +command. +.Pp .Sh SEE ALSO .Xr geom 4 , .Xr geom 8 @@ -255,9 +384,13 @@ documentation were added by .An "Chris Jones" through the 2005 Google Summer of Code program. +.Ic a partial rewrite of gvinum was done by "Lukas Ertl" and "Ulf Lilleengen" +through the 2007 Google Summer of Code program. +The documentation have been updated to reflect the new functionality. .Sh AUTHORS .An Lukas Ertl Aq le@FreeBSD.org .An Chris Jones Aq soc-cjones@FreeBSD.org +.An Ulf Lilleengen Aq lulf@FreeBSD.org .Sh BUGS Currently, .Nm @@ -271,10 +404,6 @@ initsize flag to .Ic start is ignored. .Pp -The -.Ic stop -command does not work. -.Pp Moving subdisks that are not part of a mirrored or RAID-5 volume will destroy data. It is perhaps a bug to permit this. @@ -291,18 +420,10 @@ Specifically, the following commands fro .Xr vinum 4 are not supported: .Bl -tag -width indent -.It Ic attach Ar plex volume Op Cm rename -.It Ic attach Ar subdisk plex Oo Ar offset Oc Op Cm rename -Attach a plex to a volume, or a subdisk to a plex. -.It Ic concat Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives -Create a concatenated volume from the specified drives. .It Ic debug Cause the volume manager to enter the kernel debugger. .It Ic debug Ar flags Set debugging flags. -.It Ic detach Oo Fl f Oc Op Ar plex | subdisk -Detach a plex or subdisk from the volume or plex to which it is -attached. .It Ic dumpconfig Op Ar drive ... List the configuration information stored on the specified drives, or all drives in the system if no drive names are specified. @@ -310,17 +431,9 @@ drives in the system if no drive names a List information about volume manager state. .It Ic label Ar volume Create a volume label. -.It Ic mirror Oo Fl fsv Oc Oo Fl n Ar name Oc Ar drives -Create a mirrored volume from the specified drives. .It Ic resetstats Oo Fl r Oc Op Ar volume | plex | subdisk Reset statistics counters for the specified objects, or for all objects if none are specified. .It Ic setdaemon Op Ar value Set daemon configuration. -.It Ic stop Oo Fl f Oc Op Ar volume | plex | subdisk -Terminate access to the objects, or stop -.Nm -if no parameters are specified. -.It Ic stripe Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives -Create a striped volume from the specified drives. .El Modified: projects/gvinum/sbin/gvinum/gvinum.c ============================================================================== --- projects/gvinum/sbin/gvinum/gvinum.c Tue Dec 9 17:47:05 2008 (r185803) +++ projects/gvinum/sbin/gvinum/gvinum.c Tue Dec 9 18:27:04 2008 (r185804) @@ -1,5 +1,7 @@ /* - * Copyright (c) 2004 Lukas Ertl, 2005 Chris Jones + * Copyright (c) 2004 Lukas Ertl + * Copyright (c) 2005 Chris Jones + * Copyright (c) 2007 Ulf Lilleengen * All rights reserved. * * Portions of this software were developed for the FreeBSD Project @@ -43,6 +45,7 @@ #include #include +#include #include #include #include @@ -54,12 +57,17 @@ #include "gvinum.h" +void gvinum_attach(int, char **); +void gvinum_concat(int, char **); void gvinum_create(int, char **); +void gvinum_detach(int, char **); void gvinum_help(void); void gvinum_list(int, char **); void gvinum_move(int, char **); +void gvinum_mirror(int, char **); void gvinum_parityop(int, char **, int); void gvinum_printconfig(int, char **); +void gvinum_raid5(int, char **); void gvinum_rename(int, char **); void gvinum_resetconfig(void); void gvinum_rm(int, char **); @@ -67,9 +75,15 @@ void gvinum_saveconfig(void); void gvinum_setstate(int, char **); void gvinum_start(int, char **); void gvinum_stop(int, char **); +void gvinum_stripe(int, char **); void parseline(int, char **); void printconfig(FILE *, char *); +char *create_drive(char *); +void create_volume(int, char **, char *); +char *find_name(const char *, int, int); +char *find_pattern(char *, char *); + int main(int argc, char **argv) { @@ -111,6 +125,44 @@ main(int argc, char **argv) exit(0); } +/* Attach a plex to a volume or a subdisk to a plex. */ +void +gvinum_attach(int argc, char **argv) +{ + struct gctl_req *req; + const char *errstr; + int rename; + off_t offset; + + rename = 0; + offset = -1; + if (argc < 3) { + warnx("usage:\tattach [rename] " + "[]\n" + "\tattach [rename]"); + return; + } + if (argc > 3) { + if (!strcmp(argv[3], "rename")) { + rename = 1; + if (argc == 5) + offset = strtol(argv[4], NULL, 0); + } else + offset = strtol(argv[3], NULL, 0); + } + req = gctl_get_handle(); + gctl_ro_param(req, "class", -1, "VINUM"); + gctl_ro_param(req, "verb", -1, "attach"); + gctl_ro_param(req, "child", -1, argv[1]); + gctl_ro_param(req, "parent", -1, argv[2]); + gctl_ro_param(req, "offset", sizeof(off_t), &offset); + gctl_ro_param(req, "rename", sizeof(int), &rename); + errstr = gctl_issue(req); + if (errstr != NULL) + warnx("attach failed: %s", errstr); + gctl_free(req); +} + void gvinum_create(int argc, char **argv) { @@ -120,19 +172,30 @@ gvinum_create(int argc, char **argv) struct gv_sd *s; struct gv_volume *v; FILE *tmp; - int drives, errors, fd, line, plexes, plex_in_volume; - int sd_in_plex, status, subdisks, tokens, volumes; + int drives, errors, fd, flags, i, line, plexes, plex_in_volume; + int sd_in_plex, status, subdisks, tokens, undeffd, volumes; const char *errstr; - char buf[BUFSIZ], buf1[BUFSIZ], commandline[BUFSIZ], *ed; + char buf[BUFSIZ], buf1[BUFSIZ], commandline[BUFSIZ], *ed, *sdname; char original[BUFSIZ], tmpfile[20], *token[GV_MAXARGS]; char plex[GV_MAXPLEXNAME], volume[GV_MAXVOLNAME]; - if (argc == 2) { - if ((tmp = fopen(argv[1], "r")) == NULL) { - warn("can't open '%s' for reading", argv[1]); - return; - } - } else { + tmp = NULL; + flags = 0; + for (i = 1; i < argc; i++) { + /* Force flag used to ignore already created drives. */ + if (!strcmp(argv[i], "-f")) { + flags |= GV_FLAG_F; + /* Else it must be a file. */ + } else { + if ((tmp = fopen(argv[1], "r")) == NULL) { + warn("can't open '%s' for reading", argv[1]); + return; + } + } + } + + /* We didn't get a file. */ + if (tmp == NULL) { snprintf(tmpfile, sizeof(tmpfile), "/tmp/gvinum.XXXXXX"); if ((fd = mkstemp(tmpfile)) == -1) { @@ -167,9 +230,11 @@ gvinum_create(int argc, char **argv) req = gctl_get_handle(); gctl_ro_param(req, "class", -1, "VINUM"); gctl_ro_param(req, "verb", -1, "create"); + gctl_ro_param(req, "flags", sizeof(int), &flags); drives = volumes = plexes = subdisks = 0; - plex_in_volume = sd_in_plex = 0; + plex_in_volume = sd_in_plex = undeffd = 0; + plex[0] = '\0'; errors = 0; line = 1; while ((fgets(buf, BUFSIZ, tmp)) != NULL) { @@ -187,7 +252,7 @@ gvinum_create(int argc, char **argv) * Copy the original input line in case we need it for error * output. */ - strncpy(original, buf, sizeof(buf)); + strlcpy(original, buf, sizeof(original)); tokens = gv_tokenize(buf, token, GV_MAXARGS); if (tokens <= 0) { @@ -214,7 +279,7 @@ gvinum_create(int argc, char **argv) * Set default volume name for following plex * definitions. */ - strncpy(volume, v->name, sizeof(volume)); + strlcpy(volume, v->name, sizeof(volume)); snprintf(buf1, sizeof(buf1), "volume%d", volumes); gctl_ro_param(req, buf1, sizeof(*v), v); @@ -236,13 +301,13 @@ gvinum_create(int argc, char **argv) /* Default name. */ if (strlen(p->name) == 0) { - snprintf(p->name, GV_MAXPLEXNAME, "%s.p%d", + snprintf(p->name, sizeof(p->name), "%s.p%d", volume, plex_in_volume++); } /* Default volume. */ if (strlen(p->volume) == 0) { - snprintf(p->volume, GV_MAXVOLNAME, "%s", + snprintf(p->volume, sizeof(p->volume), "%s", volume); } @@ -250,7 +315,7 @@ gvinum_create(int argc, char **argv) * Set default plex name for following subdisk * definitions. */ - strncpy(plex, p->name, GV_MAXPLEXNAME); + strlcpy(plex, p->name, sizeof(plex)); snprintf(buf1, sizeof(buf1), "plex%d", plexes); gctl_ro_param(req, buf1, sizeof(*p), p); @@ -270,13 +335,21 @@ gvinum_create(int argc, char **argv) /* Default name. */ if (strlen(s->name) == 0) { - snprintf(s->name, GV_MAXSDNAME, "%s.s%d", - plex, sd_in_plex++); + if (strlen(plex) == 0) { + sdname = find_name("gvinumsubdisk.p", + GV_TYPE_SD, GV_MAXSDNAME); + snprintf(s->name, sizeof(s->name), + "%s.s%d", sdname, undeffd++); + free(sdname); + } else { + snprintf(s->name, sizeof(s->name), + "%s.s%d",plex, sd_in_plex++); + } } /* Default plex. */ if (strlen(s->plex) == 0) - snprintf(s->plex, GV_MAXPLEXNAME, "%s", plex); + snprintf(s->plex, sizeof(s->plex), "%s", plex); snprintf(buf1, sizeof(buf1), "sd%d", subdisks); gctl_ro_param(req, buf1, sizeof(*s), s); @@ -320,7 +393,279 @@ gvinum_create(int argc, char **argv) warnx("create failed: %s", errstr); } gctl_free(req); - gvinum_list(0, NULL); +} + +/* Create a concatenated volume. */ +void +gvinum_concat(int argc, char **argv) +{ + + if (argc < 2) { + warnx("usage:\tconcat [-fv] [-n name] drives\n"); + return; + } + create_volume(argc, argv, "concat"); +} + + +/* Create a drive quick and dirty. */ +char * +create_drive(char *device) +{ + struct gv_drive *d; + struct gctl_req *req; + const char *errstr; + char *drivename, *dname; + int drives, i, flags, volumes, subdisks, plexes; + + flags = plexes = subdisks = volumes = 0; + drives = 1; + dname = NULL; + + /* Strip away eventual /dev/ in front. */ + if (strncmp(device, "/dev/", 5) == 0) + device += 5; + + drivename = find_name("gvinumdrive", GV_TYPE_DRIVE, GV_MAXDRIVENAME); + if (drivename == NULL) + return (NULL); + + req = gctl_get_handle(); + gctl_ro_param(req, "class", -1, "VINUM"); + gctl_ro_param(req, "verb", -1, "create"); + d = malloc(sizeof(struct gv_drive)); + if (d == NULL) + err(1, "unable to allocate for gv_drive object"); + memset(d, 0, sizeof(struct gv_drive)); + + strlcpy(d->name, drivename, sizeof(d->name)); + strlcpy(d->device, device, sizeof(d->device)); + gctl_ro_param(req, "drive0", sizeof(*d), d); + gctl_ro_param(req, "flags", sizeof(int), &flags); + gctl_ro_param(req, "drives", sizeof(int), &drives); + gctl_ro_param(req, "volumes", sizeof(int), &volumes); + gctl_ro_param(req, "plexes", sizeof(int), &plexes); + gctl_ro_param(req, "subdisks", sizeof(int), &subdisks); + errstr = gctl_issue(req); + if (errstr != NULL) { + warnx("error creating drive: %s", errstr); + gctl_free(req); + return (NULL); + } else { + gctl_free(req); + /* XXX: This is needed because we have to make sure the drives + * are created before we return. */ + /* Loop until it's in the config. */ + for (i = 0; i < 100000; i++) { + dname = find_name("gvinumdrive", GV_TYPE_DRIVE, + GV_MAXDRIVENAME); + /* If we got a different name, quit. */ + if (dname == NULL) + continue; + if (strcmp(dname, drivename)) { + free(dname); + return (drivename); + } + free(dname); + dname = NULL; + usleep(100000); /* Sleep for 0.1s */ + } + } + gctl_free(req); + return (drivename); +} + +/* + * General routine for creating a volume. Mainly for use by concat, mirror, + * raid5 and stripe commands. + */ +void +create_volume(int argc, char **argv, char *verb) +{ + struct gctl_req *req; + const char *errstr; + char buf[BUFSIZ], *drivename, *volname; + int drives, flags, i; + off_t stripesize; + + flags = 0; + drives = 0; + volname = NULL; + stripesize = 262144; + + /* XXX: Should we check for argument length? */ + + req = gctl_get_handle(); + gctl_ro_param(req, "class", -1, "VINUM"); + + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-f")) { + flags |= GV_FLAG_F; + } else if (!strcmp(argv[i], "-n")) { + volname = argv[++i]; + } else if (!strcmp(argv[i], "-v")) { + flags |= GV_FLAG_V; + } else if (!strcmp(argv[i], "-s")) { + flags |= GV_FLAG_S; + if (!strcmp(verb, "raid5")) + stripesize = gv_sizespec(argv[++i]); + } else { + /* Assume it's a drive. */ + snprintf(buf, sizeof(buf), "drive%d", drives++); + + /* First we create the drive. */ + drivename = create_drive(argv[i]); + if (drivename == NULL) + goto bad; + /* Then we add it to the request. */ + gctl_ro_param(req, buf, -1, drivename); + } + } + + gctl_ro_param(req, "stripesize", sizeof(off_t), &stripesize); + + /* Find a free volume name. */ + if (volname == NULL) + volname = find_name("gvinumvolume", GV_TYPE_VOL, GV_MAXVOLNAME); + + /* Then we send a request to actually create the volumes. */ + gctl_ro_param(req, "verb", -1, verb); + gctl_ro_param(req, "flags", sizeof(int), &flags); + gctl_ro_param(req, "drives", sizeof(int), &drives); + gctl_ro_param(req, "name", -1, volname); + errstr = gctl_issue(req); + if (errstr != NULL) + warnx("creating %s volume failed: %s", verb, errstr); +bad: + gctl_free(req); +} + +/* Parse a line of the config, return the word after . */ +char * +find_pattern(char *line, char *pattern) +{ + char *ptr; + + ptr = strsep(&line, " "); + while (ptr != NULL) { + if (!strcmp(ptr, pattern)) { + /* Return the next. */ + ptr = strsep(&line, " "); + return (ptr); + } + ptr = strsep(&line, " "); + } + return (NULL); +} + +/* Find a free name for an object given a a prefix. */ +char * +find_name(const char *prefix, int type, int namelen) +{ + struct gctl_req *req; + char comment[1], buf[GV_CFG_LEN - 1], *name, *sname, *ptr; + const char *errstr; + int i, n, begin, len, conflict; + char line[1024]; + + comment[0] = '\0'; + + /* Find a name. Fetch out configuration first. */ + req = gctl_get_handle(); + gctl_ro_param(req, "class", -1, "VINUM"); + gctl_ro_param(req, "verb", -1, "getconfig"); + gctl_ro_param(req, "comment", -1, comment); + gctl_rw_param(req, "config", sizeof(buf), buf); + errstr = gctl_issue(req); + if (errstr != NULL) { + warnx("can't get configuration: %s", errstr); + return (NULL); + } + gctl_free(req); + + begin = 0; + len = strlen(buf); + i = 0; + sname = malloc(namelen + 1); + + /* XXX: Max object setting? */ + for (n = 0; n < 10000; n++) { + snprintf(sname, namelen, "%s%d", prefix, n); + conflict = 0; + begin = 0; + /* Loop through the configuration line by line. */ + for (i = 0; i < len; i++) { + if (buf[i] == '\n' || buf[i] == '\0') { + ptr = buf + begin; + strlcpy(line, ptr, (i - begin) + 1); + begin = i + 1; + switch (type) { + case GV_TYPE_DRIVE: + name = find_pattern(line, "drive"); + break; + case GV_TYPE_VOL: + name = find_pattern(line, "volume"); + break; + case GV_TYPE_PLEX: + case GV_TYPE_SD: + name = find_pattern(line, "name"); + break; + default: + printf("Invalid type given\n"); + continue; + } + if (name == NULL) + continue; + if (!strcmp(sname, name)) { + conflict = 1; + /* XXX: Could quit the loop earlier. */ + } + } + } + if (!conflict) + return (sname); + } + free(sname); + return (NULL); +} + +/* Detach a plex or subdisk from its parent. */ +void +gvinum_detach(int argc, char **argv) +{ + const char *errstr; + struct gctl_req *req; + int flags, i; + + optreset = 1; + optind = 1; + while ((i = getopt(argc, argv, "f")) != -1) { + switch(i) { + case 'f': + flags |= GV_FLAG_F; + break; + default: + warn("invalid flag: %c", i); + return; + } + } + argc -= optind; + argv += optind; + if (argc != 1) { + warnx("usage: detach [-f] | "); + return; + } + + req = gctl_get_handle(); + gctl_ro_param(req, "class", -1, "VINUM"); + gctl_ro_param(req, "verb", -1, "detach"); + gctl_ro_param(req, "object", -1, argv[0]); + gctl_ro_param(req, "flags", sizeof(int), &flags); + + errstr = gctl_issue(req); + if (errstr != NULL) + warnx("detach failed: %s", errstr); + gctl_free(req); } void @@ -329,8 +674,16 @@ gvinum_help(void) printf("COMMANDS\n" "checkparity [-f] plex\n" " Check the parity blocks of a RAID-5 plex.\n" - "create description-file\n" + "create [-f] description-file\n" " Create as per description-file or open editor.\n" + "attach plex volume [rename]\n" + "attach subdisk plex [offset] [rename]\n" + " Attach a plex to a volume, or a subdisk to a plex\n" + "concat [-fv] [-n name] drives\n" + " Create a concatenated volume from the specified drives.\n" + "detach [-f] [plex | subdisk]\n" + " Detach a plex or a subdisk from the volume or plex to\n" + " which it is attached.\n" "l | list [-r] [-v] [-V] [volume | plex | subdisk]\n" " List information about specified objects.\n" "ld [-r] [-v] [-V] [volume]\n" @@ -341,11 +694,15 @@ gvinum_help(void) " List information about plexes.\n" "lv [-r] [-v] [-V] [volume]\n" " List information about volumes.\n" + "mirror [-fsv] [-n name] drives\n" + " Create a mirrored volume from the specified drives.\n" "move | mv -f drive object ...\n" " Move the object(s) to the specified drive.\n" "quit Exit the vinum program when running in interactive mode." " Nor-\n" " mally this would be done by entering the EOF character.\n" + "raid5 [-fv] [-s stripesize] [-n name] drives\n" + " Create a RAID-5 volume from the specified drives.\n" "rename [-r] [drive | subdisk | plex | volume] newname\n" " Change the name of the specified object.\n" "rebuildparity plex [-f]\n" @@ -363,6 +720,8 @@ gvinum_help(void) " poses only.\n" "start [-S size] volume | plex | subdisk\n" " Allow the system to access the objects.\n" + "stripe [-fv] [-n name] drives\n" + " Create a striped volume from the specified drives.\n" ); return; @@ -488,6 +847,18 @@ gvinum_list(int argc, char **argv) return; } +/* Create a mirrored volume. */ +void +gvinum_mirror(int argc, char **argv) +{ + + if (argc < 2) { + warnx("usage\tmirror [-fsv] [-n name] drives\n"); + return; + } + create_volume(argc, argv, "mirror"); +} + /* Note that move is currently of form '[-r] target object [...]' */ void gvinum_move(int argc, char **argv) @@ -553,8 +924,7 @@ void gvinum_parityop(int argc, char **argv, int rebuild) { struct gctl_req *req; - int flags, i, rv; - off_t offset; + int flags, i; const char *errstr; char *op, *msg; @@ -591,47 +961,32 @@ gvinum_parityop(int argc, char **argv, i return; } - do { - rv = 0; - req = gctl_get_handle(); - gctl_ro_param(req, "class", -1, "VINUM"); - gctl_ro_param(req, "verb", -1, "parityop"); - gctl_ro_param(req, "flags", sizeof(int), &flags); - gctl_ro_param(req, "rebuild", sizeof(int), &rebuild); - gctl_rw_param(req, "rv", sizeof(int), &rv); - gctl_rw_param(req, "offset", sizeof(off_t), &offset); - gctl_ro_param(req, "plex", -1, argv[0]); - errstr = gctl_issue(req); - if (errstr) { - warnx("%s\n", errstr); - gctl_free(req); - break; - } - gctl_free(req); - if (flags & GV_FLAG_V) { - printf("\r%s at %s ... ", msg, - gv_roughlength(offset, 1)); - } - if (rv == 1) { - printf("Parity incorrect at offset 0x%jx\n", - (intmax_t)offset); - if (!rebuild) - break; - } - fflush(stdout); + req = gctl_get_handle(); + gctl_ro_param(req, "class", -1, "VINUM"); + gctl_ro_param(req, "verb", -1, op); + gctl_ro_param(req, "rebuild", sizeof(int), &rebuild); + gctl_ro_param(req, "flags", sizeof(int), &flags); + gctl_ro_param(req, "plex", -1, argv[0]); + + errstr = gctl_issue(req); + if (errstr) + warnx("%s\n", errstr); + gctl_free(req); +} + +/* Create a RAID-5 volume. */ +void +gvinum_raid5(int argc, char **argv) +{ - /* Clear the -f flag. */ - flags &= ~GV_FLAG_F; - } while (rv >= 0); - - if ((rv == 2) && (flags & GV_FLAG_V)) { - if (rebuild) - printf("Rebuilt parity on %s\n", argv[0]); - else - printf("%s has correct parity\n", argv[0]); + if (argc < 2) { + warnx("usage:\traid5 [-fv] [-s stripesize] [-n name] drives\n"); + return; } + create_volume(argc, argv, "raid5"); } + void gvinum_rename(int argc, char **argv) { @@ -728,7 +1083,6 @@ gvinum_rm(int argc, char **argv) return; } gctl_free(req); - gvinum_list(0, NULL); } void @@ -763,7 +1117,6 @@ gvinum_resetconfig(void) return; } gctl_free(req); - gvinum_list(0, NULL); printf("gvinum configuration obliterated\n"); } @@ -833,28 +1186,53 @@ gvinum_start(int argc, char **argv) } gctl_free(req); - gvinum_list(0, NULL); } void gvinum_stop(int argc, char **argv) { - int fileid; + int err, fileid; fileid = kldfind(GVINUMMOD); if (fileid == -1) { warn("cannot find " GVINUMMOD); return; } - if (kldunload(fileid) != 0) { + + /* + * This little hack prevents that we end up in an infinite loop in + * g_unload_class(). gv_unload() will return EAGAIN so that the GEOM + * event thread will be free for the g_wither_geom() call from + * gv_unload(). It's silly, but it works. + */ + printf("unloading " GVINUMMOD " kernel module... "); + fflush(stdout); + if ((err = kldunload(fileid)) != 0 && (errno == EAGAIN)) { + sleep(1); + err = kldunload(fileid); + } + if (err != 0) { + printf(" failed!\n"); warn("cannot unload " GVINUMMOD); return; } - warnx(GVINUMMOD " unloaded"); + printf("done\n"); exit(0); } +/* Create a striped volume. */ +void +gvinum_stripe(int argc, char **argv) +{ + + if (argc < 2) { + warnx("usage:\tstripe [-fv] [-n name] drives\n"); + return; + } + create_volume(argc, argv, "stripe"); +} + void parseline(int argc, char **argv) { @@ -865,6 +1243,12 @@ parseline(int argc, char **argv) gvinum_create(argc, argv); else if (!strcmp(argv[0], "exit") || !strcmp(argv[0], "quit")) exit(0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 20:59:55 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D46C61065675; Tue, 9 Dec 2008 20:59:55 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C37FF8FC16; Tue, 9 Dec 2008 20:59:55 +0000 (UTC) (envelope-from lulf@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 mB9KxtCf001583; Tue, 9 Dec 2008 20:59:55 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9Kxtdx001582; Tue, 9 Dec 2008 20:59:55 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812092059.mB9Kxtdx001582@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 9 Dec 2008 20:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185809 - projects/gvinum/sys/geom/vinum X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 20:59:55 -0000 Author: lulf Date: Tue Dec 9 20:59:55 2008 New Revision: 185809 URL: http://svn.freebsd.org/changeset/base/185809 Log: - Simplify renaming of gvinum objects a great deal by using strchr and friends instead of allocating an extra string to be used for tokenizing. Modified: projects/gvinum/sys/geom/vinum/geom_vinum_rename.c Modified: projects/gvinum/sys/geom/vinum/geom_vinum_rename.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_rename.c Tue Dec 9 20:05:58 2008 (r185808) +++ projects/gvinum/sys/geom/vinum/geom_vinum_rename.c Tue Dec 9 20:59:55 2008 (r185809) @@ -146,77 +146,51 @@ gv_rename_drive(struct gv_softc *sc, str int gv_rename_plex(struct gv_softc *sc, struct gv_plex *p, char *newname, int flags) { + char newsd[GV_MAXSDNAME]; struct gv_sd *s; - char *plexnum, *plexnump, *oldplex, *oldplexp; - char *newsd, *oldsd, *oldsdp; + char *ptr; int err; g_topology_assert(); KASSERT(p != NULL, ("gv_rename_plex: NULL p")); - err = 0; - if (gv_object_type(sc, newname) != GV_ERR_NOTFOUND) { G_VINUM_DEBUG(1, "plex name '%s' already in use", newname); return (GV_ERR_NAMETAKEN); } - /* Needed for sanity checking. */ - plexnum = g_malloc(GV_MAXPLEXNAME, M_WAITOK | M_ZERO); - strlcpy(plexnum, newname, GV_MAXPLEXNAME); - plexnump = plexnum; - - oldplex = g_malloc(GV_MAXPLEXNAME, M_WAITOK | M_ZERO); - strlcpy(oldplex, p->name, GV_MAXPLEXNAME); - oldplexp = oldplex; - /* * Locate the plex number part of the plex names. - * - * XXX: can we be sure that the current plex name has the format - * 'foo.pX'? + * XXX: might be a good idea to sanitize input a bit more */ - strsep(&oldplexp, "."); - strsep(&plexnump, "."); - if (plexnump == NULL || *plexnump == '\0') { + ptr = strrchr(newname, '.'); + if (ptr == NULL) { G_VINUM_DEBUG(0, "proposed plex name '%s' is not a valid plex " "name", newname); - err = GV_ERR_INVNAME; - goto failure; + return (GV_ERR_INVNAME); } strlcpy(p->name, newname, sizeof(p->name)); - /* XXX can we rename providers here? */ - /* Fix up references and potentially rename subdisks. */ LIST_FOREACH(s, &p->subdisks, in_plex) { strlcpy(s->plex, p->name, sizeof(s->plex)); if (flags && GV_FLAG_R) { - newsd = g_malloc(GV_MAXSDNAME, M_WAITOK | M_ZERO); - oldsd = g_malloc(GV_MAXSDNAME, M_WAITOK | M_ZERO); - oldsdp = oldsd; - strlcpy(oldsd, s->name, GV_MAXSDNAME); /* - * XXX: can we be sure that the current sd name has the - * format 'foo.pX.sY'? + * Look for the two last dots in the string, and assume + * that the old value was ok. */ - strsep(&oldsdp, "."); - strsep(&oldsdp, "."); - snprintf(newsd, GV_MAXSDNAME, "%s.%s", p->name, oldsdp); + ptr = strrchr(s->name, '.'); + if (ptr == NULL) + return (GV_ERR_INVNAME); + ptr++; + snprintf(newsd, sizeof(newsd), "%s.%s", p->name, ptr); err = gv_rename_sd(sc, s, newsd, flags); - g_free(newsd); - g_free(oldsd); if (err) - goto failure; + return (err); } } - -failure: - g_free(plexnum); - g_free(oldplex); - - return (err); + return (0); } /* @@ -227,70 +201,40 @@ failure: int gv_rename_sd(struct gv_softc *sc, struct gv_sd *s, char *newname, int flags) { - char *new, *newp, *old, *oldp; - int err; + char *dot1, *dot2; g_topology_assert(); KASSERT(s != NULL, ("gv_rename_sd: NULL s")); - err = 0; - if (gv_object_type(sc, newname) != GV_ERR_NOTFOUND) { G_VINUM_DEBUG(1, "subdisk name %s already in use", newname); return (GV_ERR_NAMETAKEN); } - /* Needed for sanity checking. */ - new = g_malloc(GV_MAXSDNAME, M_WAITOK | M_ZERO); - strlcpy(new, newname, GV_MAXSDNAME); - newp = new; - - old = g_malloc(GV_MAXSDNAME, M_WAITOK | M_ZERO); - strlcpy(old, s->name, GV_MAXSDNAME); - oldp = old; - - /* - * Locate the sd number part of the sd names. - * - * XXX: can we be sure that the current sd name has the format - * 'foo.pX.sY'? - */ - strsep(&oldp, "."); - strsep(&oldp, "."); - strsep(&newp, "."); - if (newp == NULL || *newp == '\0') { - G_VINUM_DEBUG(0, "proposed sd name '%s' is not a valid sd name", - newname); - err = GV_ERR_INVNAME; - goto fail; - } - strsep(&newp, "."); - if (newp == NULL || *newp == '\0') { + /* Locate the sd number part of the sd names. */ + dot1 = strchr(newname, '.'); + if (dot1 == NULL || (dot2 = strchr(dot1 + 1, '.')) == NULL) { G_VINUM_DEBUG(0, "proposed sd name '%s' is not a valid sd name", newname); - err = GV_ERR_INVNAME; - goto fail; + return (GV_ERR_INVNAME); } - strlcpy(s->name, newname, sizeof(s->name)); - -fail: - g_free(new); - g_free(old); - - return (err); + return (0); } int gv_rename_vol(struct gv_softc *sc, struct gv_volume *v, char *newname, int flags) { + struct g_provider *pp; struct gv_plex *p; - char *new, *old, *oldp; + char newplex[GV_MAXPLEXNAME], *ptr; int err; g_topology_assert(); KASSERT(v != NULL, ("gv_rename_vol: NULL v")); + pp = v->provider; + KASSERT(pp != NULL, ("gv_rename_vol: NULL pp")); if (gv_object_type(sc, newname) != GV_ERR_NOTFOUND) { G_VINUM_DEBUG(1, "volume name %s already in use", newname); @@ -304,19 +248,14 @@ gv_rename_vol(struct gv_softc *sc, struc LIST_FOREACH(p, &v->plexes, in_volume) { strlcpy(p->volume, v->name, sizeof(p->volume)); if (flags && GV_FLAG_R) { - new = g_malloc(GV_MAXPLEXNAME, M_WAITOK | M_ZERO); - old = g_malloc(GV_MAXPLEXNAME, M_WAITOK | M_ZERO); - oldp = old; - strlcpy(old, p->name, GV_MAXPLEXNAME); /* - * XXX: can we be sure that the current plex name has - * the format 'foo.pX'? + * Look for the last dot in the string, and assume that + * the old value was ok. */ - strsep(&oldp, "."); - snprintf(new, GV_MAXPLEXNAME, "%s.%s", v->name, oldp); - err = gv_rename_plex(sc, p, new, flags); - g_free(new); - g_free(old); + ptr = strrchr(p->name, '.'); + ptr++; + snprintf(newplex, sizeof(newplex), "%s.%s", v->name, ptr); + err = gv_rename_plex(sc, p, newplex, flags); if (err) return (err); } From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 21:10:09 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B63911065670; Tue, 9 Dec 2008 21:10:09 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A64018FC12; Tue, 9 Dec 2008 21:10:09 +0000 (UTC) (envelope-from lulf@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 mB9LA9CY001854; Tue, 9 Dec 2008 21:10:09 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9LA9dt001853; Tue, 9 Dec 2008 21:10:09 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812092110.mB9LA9dt001853@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 9 Dec 2008 21:10:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185811 - projects/csup_cvsmode/contrib/csup X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 21:10:09 -0000 Author: lulf Date: Tue Dec 9 21:10:09 2008 New Revision: 185811 URL: http://svn.freebsd.org/changeset/base/185811 Log: - Check return value of the encoded keyword before using it. Pointed out by: Christian Weisgerber Modified: projects/csup_cvsmode/contrib/csup/rcsfile.c Modified: projects/csup_cvsmode/contrib/csup/rcsfile.c ============================================================================== --- projects/csup_cvsmode/contrib/csup/rcsfile.c Tue Dec 9 21:09:05 2008 (r185810) +++ projects/csup_cvsmode/contrib/csup/rcsfile.c Tue Dec 9 21:10:09 2008 (r185811) @@ -232,6 +232,7 @@ rcsfile_send_details(struct rcsfile *rf, { struct delta *d; struct tag *t; + const char *keyword; int error; assert(rf != NULL); @@ -264,10 +265,13 @@ rcsfile_send_details(struct rcsfile *rf, return(error); /* Write expand. */ if (rf->expand != EXPAND_DEFAULT) { - error = proto_printf(wr, "E %s\n", - keyword_encode_expand(rf->expand)); - if (error) - return(error); + keyword = keyword_encode_expand(rf->expand); + if (keyword != NULL) { + error = proto_printf(wr, "E %s\n", + keyword_encode_expand(rf->expand)); + if (error) + return(error); + } } /* Write tags to server. */ From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 01:16:42 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09C551065676; Wed, 10 Dec 2008 01:16:42 +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 D1A5A8FC25; Wed, 10 Dec 2008 01:16:41 +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 mBA1Gf1K007782; Wed, 10 Dec 2008 01:16:41 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA1GfKu007781; Wed, 10 Dec 2008 01:16:41 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812100116.mBA1GfKu007781@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Dec 2008 01:16:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185816 - projects/arpv2_merge_1 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 01:16:42 -0000 Author: kmacy Date: Wed Dec 10 01:16:41 2008 New Revision: 185816 URL: http://svn.freebsd.org/changeset/base/185816 Log: First pass at merging arpv2 in to HEAD Added: projects/arpv2_merge_1/ - copied from r185815, head/ From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 02:04:47 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E331106564A; Wed, 10 Dec 2008 02:04:47 +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 174F78FC0C; Wed, 10 Dec 2008 02:04:47 +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 mBA24lKq008854; Wed, 10 Dec 2008 02:04:47 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA24k3E008839; Wed, 10 Dec 2008 02:04:46 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812100204.mBA24k3E008839@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Dec 2008 02:04:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185819 - in projects/arpv2_merge_1: lib/libstand sys/conf sys/contrib/rdma sys/dev/cxgb/ulp/tom sys/net sys/netinet sys/netinet6 usr.sbin/arp usr.sbin/ndp X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 02:04:47 -0000 Author: kmacy Date: Wed Dec 10 02:04:46 2008 New Revision: 185819 URL: http://svn.freebsd.org/changeset/base/185819 Log: merge qingli's latest arpv2 patch Modified: projects/arpv2_merge_1/lib/libstand/if_ether.h projects/arpv2_merge_1/sys/conf/files projects/arpv2_merge_1/sys/contrib/rdma/rdma_addr.c projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.c projects/arpv2_merge_1/sys/net/if.c projects/arpv2_merge_1/sys/net/if_arcsubr.c projects/arpv2_merge_1/sys/net/if_ethersubr.c projects/arpv2_merge_1/sys/net/if_fddisubr.c projects/arpv2_merge_1/sys/net/if_fwsubr.c projects/arpv2_merge_1/sys/net/if_iso88025subr.c projects/arpv2_merge_1/sys/net/if_var.h projects/arpv2_merge_1/sys/net/route.c projects/arpv2_merge_1/sys/net/rtsock.c projects/arpv2_merge_1/sys/netinet/if_ether.c projects/arpv2_merge_1/sys/netinet/if_ether.h projects/arpv2_merge_1/sys/netinet/in.c projects/arpv2_merge_1/sys/netinet/in_proto.c projects/arpv2_merge_1/sys/netinet/in_var.h projects/arpv2_merge_1/sys/netinet/ip_output.c projects/arpv2_merge_1/sys/netinet6/icmp6.c projects/arpv2_merge_1/sys/netinet6/in6.c projects/arpv2_merge_1/sys/netinet6/in6_var.h projects/arpv2_merge_1/sys/netinet6/ip6_forward.c projects/arpv2_merge_1/sys/netinet6/ip6_input.c projects/arpv2_merge_1/sys/netinet6/ip6_mroute.c projects/arpv2_merge_1/sys/netinet6/ip6_output.c projects/arpv2_merge_1/sys/netinet6/nd6.c projects/arpv2_merge_1/sys/netinet6/nd6.h projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c projects/arpv2_merge_1/sys/netinet6/vinet6.h projects/arpv2_merge_1/usr.sbin/arp/arp.c projects/arpv2_merge_1/usr.sbin/ndp/ndp.c Modified: projects/arpv2_merge_1/lib/libstand/if_ether.h ============================================================================== --- projects/arpv2_merge_1/lib/libstand/if_ether.h Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/lib/libstand/if_ether.h Wed Dec 10 02:04:46 2008 (r185819) @@ -156,7 +156,7 @@ struct ifqueue arpintrq; void arpwhohas(struct arpcom *, struct in_addr *); void arpintr(void); int arpresolve(struct arpcom *, - struct rtentry *, struct mbuf *, struct sockaddr *, u_char *); + struct rtentry *, struct mbuf *, struct sockaddr *, u_char *, struct llentry **); void arp_ifinit(struct arpcom *, struct ifaddr *); void arp_rtrequest(int, struct rtentry *, struct sockaddr *); @@ -233,7 +233,7 @@ struct ether_multistep { #ifdef _KERNEL void arp_rtrequest(int, struct rtentry *, struct sockaddr *); int arpresolve(struct arpcom *, struct rtentry *, struct mbuf *, - struct sockaddr *, u_char *); + struct sockaddr *, u_char *, struct llentry **); void arpintr(void); int arpioctl(u_long, caddr_t); void arp_ifinit(struct arpcom *, struct ifaddr *); Modified: projects/arpv2_merge_1/sys/conf/files ============================================================================== --- projects/arpv2_merge_1/sys/conf/files Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/conf/files Wed Dec 10 02:04:46 2008 (r185819) @@ -2171,6 +2171,7 @@ net/if_gre.c optional gre net/if_iso88025subr.c optional token net/if_lagg.c optional lagg net/if_loop.c optional loop +net/if_llatbl.c standard net/if_media.c standard net/if_mib.c standard net/if_ppp.c optional ppp Modified: projects/arpv2_merge_1/sys/contrib/rdma/rdma_addr.c ============================================================================== --- projects/arpv2_merge_1/sys/contrib/rdma/rdma_addr.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/contrib/rdma/rdma_addr.c Wed Dec 10 02:04:46 2008 (r185819) @@ -163,6 +163,7 @@ static void addr_send_arp(struct sockadd struct route iproute; struct sockaddr_in *dst = (struct sockaddr_in *)&iproute.ro_dst; char dmac[ETHER_ADDR_LEN]; + struct llentry *lle; bzero(&iproute, sizeof iproute); *dst = *dst_in; @@ -172,7 +173,7 @@ static void addr_send_arp(struct sockadd return; arpresolve(iproute.ro_rt->rt_ifp, iproute.ro_rt, NULL, - rt_key(iproute.ro_rt), dmac); + rt_key(iproute.ro_rt), dmac, &lle); RTFREE(iproute.ro_rt); } @@ -186,6 +187,7 @@ static int addr_resolve_remote(struct so struct route iproute; struct sockaddr_in *dst = (struct sockaddr_in *)&iproute.ro_dst; char dmac[ETHER_ADDR_LEN]; + struct llentry *lle; bzero(&iproute, sizeof iproute); *dst = *dst_in; @@ -202,7 +204,7 @@ static int addr_resolve_remote(struct so goto put; } ret = arpresolve(iproute.ro_rt->rt_ifp, iproute.ro_rt, NULL, - rt_key(iproute.ro_rt), dmac); + rt_key(iproute.ro_rt), dmac, &lle); if (ret) { goto put; } Modified: projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.c Wed Dec 10 02:04:46 2008 (r185819) @@ -166,6 +166,7 @@ t3_l2t_send_slow(struct t3cdev *dev, str { struct rtentry *rt = e->neigh; struct sockaddr_in sin; + struct llentry *lle; bzero(&sin, sizeof(struct sockaddr_in)); sin.sin_family = AF_INET; @@ -177,7 +178,7 @@ again: switch (e->state) { case L2T_STATE_STALE: /* entry is stale, kick off revalidation */ arpresolve(rt->rt_ifp, rt, NULL, - (struct sockaddr *)&sin, e->dmac); + (struct sockaddr *)&sin, e->dmac, &lle); mtx_lock(&e->lock); if (e->state == L2T_STATE_STALE) e->state = L2T_STATE_VALID; @@ -201,7 +202,7 @@ again: * entries when there's no memory. */ if (arpresolve(rt->rt_ifp, rt, NULL, - (struct sockaddr *)&sin, e->dmac) == 0) { + (struct sockaddr *)&sin, e->dmac, &lle) == 0) { CTR6(KTR_CXGB, "mac=%x:%x:%x:%x:%x:%x\n", e->dmac[0], e->dmac[1], e->dmac[2], e->dmac[3], e->dmac[4], e->dmac[5]); @@ -228,6 +229,7 @@ t3_l2t_send_event(struct t3cdev *dev, st sin.sin_family = AF_INET; sin.sin_len = sizeof(struct sockaddr_in); sin.sin_addr.s_addr = e->addr; + struct llentry *lle; if ((m0 = m_gethdr(M_NOWAIT, MT_DATA)) == NULL) return; @@ -237,7 +239,7 @@ again: switch (e->state) { case L2T_STATE_STALE: /* entry is stale, kick off revalidation */ arpresolve(rt->rt_ifp, rt, NULL, - (struct sockaddr *)&sin, e->dmac); + (struct sockaddr *)&sin, e->dmac, &lle); mtx_lock(&e->lock); if (e->state == L2T_STATE_STALE) { e->state = L2T_STATE_VALID; @@ -263,7 +265,7 @@ again: * entries when there's no memory. */ arpresolve(rt->rt_ifp, rt, NULL, - (struct sockaddr *)&sin, e->dmac); + (struct sockaddr *)&sin, e->dmac, &lle); } return; Modified: projects/arpv2_merge_1/sys/net/if.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/net/if.c Wed Dec 10 02:04:46 2008 (r185819) @@ -60,6 +60,7 @@ #include #include #include +#include #include #include @@ -70,6 +71,7 @@ #include #include #include +#include #if defined(INET) || defined(INET6) /*XXX*/ Modified: projects/arpv2_merge_1/sys/net/if_arcsubr.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_arcsubr.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/net/if_arcsubr.c Wed Dec 10 02:04:46 2008 (r185819) @@ -64,6 +64,7 @@ #include #include #include +#include #if defined(INET) || defined(INET6) #include @@ -108,6 +109,7 @@ arc_output(struct ifnet *ifp, struct mbu u_int8_t atype, adst; int loop_copy = 0; int isphds; + struct llentry *lle; if (!((ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING))) @@ -127,7 +129,7 @@ arc_output(struct ifnet *ifp, struct mbu else if (ifp->if_flags & IFF_NOARP) adst = ntohl(SIN(dst)->sin_addr.s_addr) & 0xFF; else { - error = arpresolve(ifp, rt0, m, dst, &adst); + error = arpresolve(ifp, rt0, m, dst, &adst, &lle); if (error) return (error == EWOULDBLOCK ? 0 : error); } @@ -165,7 +167,7 @@ arc_output(struct ifnet *ifp, struct mbu #endif #ifdef INET6 case AF_INET6: - error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)&adst); + error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)&adst, &lle); if (error) return (error); atype = ARCTYPE_INET6; Modified: projects/arpv2_merge_1/sys/net/if_ethersubr.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_ethersubr.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/net/if_ethersubr.c Wed Dec 10 02:04:46 2008 (r185819) @@ -62,6 +62,7 @@ #include #include #include +#include #include #include @@ -148,6 +149,8 @@ static int ether_ipfw; #endif #endif +extern int useloopback; + /* * Ethernet output routine. * Encapsulate a packet of type family for the local net. @@ -161,6 +164,7 @@ ether_output(struct ifnet *ifp, struct m short type; int error, hdrcmplt = 0; u_char esrc[ETHER_ADDR_LEN], edst[ETHER_ADDR_LEN]; + struct llentry *lle = NULL; struct ether_header *eh; struct pf_mtag *t; int loop_copy = 1; @@ -183,7 +187,7 @@ ether_output(struct ifnet *ifp, struct m switch (dst->sa_family) { #ifdef INET case AF_INET: - error = arpresolve(ifp, rt0, m, dst, edst); + error = arpresolve(ifp, rt0, m, dst, edst, &lle); if (error) return (error == EWOULDBLOCK ? 0 : error); type = htons(ETHERTYPE_IP); @@ -218,7 +222,7 @@ ether_output(struct ifnet *ifp, struct m #endif #ifdef INET6 case AF_INET6: - error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst); + error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst, &lle); if (error) return error; type = htons(ETHERTYPE_IPV6); @@ -286,6 +290,17 @@ ether_output(struct ifnet *ifp, struct m senderr(EAFNOSUPPORT); } + if (lle && (lle->la_flags & LLE_IFADDR) && useloopback) { + int csum_flags = 0; + if (m->m_pkthdr.csum_flags & CSUM_IP) + csum_flags |= (CSUM_IP_CHECKED|CSUM_IP_VALID); + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) + csum_flags |= (CSUM_DATA_VALID|CSUM_PSEUDO_HDR); + m->m_pkthdr.csum_flags |= csum_flags; + m->m_pkthdr.csum_data = 0xffff; + return (if_simloop(ifp, m, dst->sa_family, 0)); + } + /* * Add local net header. If no space in first mbuf, * allocate another. Modified: projects/arpv2_merge_1/sys/net/if_fddisubr.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_fddisubr.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/net/if_fddisubr.c Wed Dec 10 02:04:46 2008 (r185819) @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -120,6 +121,7 @@ fddi_output(ifp, m, dst, rt0) int loop_copy = 0, error = 0, hdrcmplt = 0; u_char esrc[FDDI_ADDR_LEN], edst[FDDI_ADDR_LEN]; struct fddi_header *fh; + struct llentry *lle; #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); @@ -137,7 +139,7 @@ fddi_output(ifp, m, dst, rt0) switch (dst->sa_family) { #ifdef INET case AF_INET: { - error = arpresolve(ifp, rt0, m, dst, edst); + error = arpresolve(ifp, rt0, m, dst, edst, &lle); if (error) return (error == EWOULDBLOCK ? 0 : error); type = htons(ETHERTYPE_IP); @@ -173,7 +175,7 @@ fddi_output(ifp, m, dst, rt0) #endif /* INET */ #ifdef INET6 case AF_INET6: - error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst); + error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst, &lle); if (error) return (error); /* Something bad happened */ type = htons(ETHERTYPE_IPV6); Modified: projects/arpv2_merge_1/sys/net/if_fwsubr.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_fwsubr.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/net/if_fwsubr.c Wed Dec 10 02:04:46 2008 (r185819) @@ -51,6 +51,7 @@ #include #include #include +#include #if defined(INET) || defined(INET6) #include @@ -89,6 +90,7 @@ firewire_output(struct ifnet *ifp, struc struct mbuf *mtail; int unicast, dgl, foff; static int next_dgl; + struct llentry *lle; #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); @@ -144,7 +146,7 @@ firewire_output(struct ifnet *ifp, struc * doesn't fit into the arp model. */ if (unicast) { - error = arpresolve(ifp, rt, m, dst, (u_char *) destfw); + error = arpresolve(ifp, rt, m, dst, (u_char *) destfw, &lle); if (error) return (error == EWOULDBLOCK ? 0 : error); } @@ -174,7 +176,7 @@ firewire_output(struct ifnet *ifp, struc case AF_INET6: if (unicast) { error = nd6_storelladdr(fc->fc_ifp, rt, m, dst, - (u_char *) destfw); + (u_char *) destfw, &lle); if (error) return (error); } Modified: projects/arpv2_merge_1/sys/net/if_iso88025subr.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_iso88025subr.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/net/if_iso88025subr.c Wed Dec 10 02:04:46 2008 (r185819) @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -244,6 +245,7 @@ iso88025_output(ifp, m, dst, rt0) struct iso88025_header gen_th; struct sockaddr_dl *sdl = NULL; struct rtentry *rt = NULL; + struct llentry *lle; #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); @@ -289,7 +291,7 @@ iso88025_output(ifp, m, dst, rt0) switch (dst->sa_family) { #ifdef INET case AF_INET: - error = arpresolve(ifp, rt0, m, dst, edst); + error = arpresolve(ifp, rt0, m, dst, edst, &lle); if (error) return (error == EWOULDBLOCK ? 0 : error); snap_type = ETHERTYPE_IP; @@ -324,7 +326,7 @@ iso88025_output(ifp, m, dst, rt0) #endif /* INET */ #ifdef INET6 case AF_INET6: - error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst); + error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst, &lle); if (error) return (error); snap_type = ETHERTYPE_IPV6; Modified: projects/arpv2_merge_1/sys/net/if_var.h ============================================================================== --- projects/arpv2_merge_1/sys/net/if_var.h Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/net/if_var.h Wed Dec 10 02:04:46 2008 (r185819) @@ -68,6 +68,7 @@ struct rtentry; struct rt_addrinfo; struct socket; struct ether_header; +struct lltable; struct carp_if; struct ifvlantrunk; #endif @@ -169,8 +170,6 @@ struct ifnet { void *if_bridge; /* bridge glue */ - struct lltable *lltables; /* list of L3-L2 resolution tables */ - struct label *if_label; /* interface MAC label */ /* these are only used by IPv6 */ @@ -181,6 +180,7 @@ struct ifnet { struct task if_starttask; /* task for IFF_NEEDSGIANT */ struct task if_linktask; /* task for link change events */ struct mtx if_addr_mtx; /* mutex to protect address lists */ + LIST_ENTRY(ifnet) if_clones; /* interfaces of a cloner */ TAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */ /* protected by if_addr_mtx */ @@ -359,7 +359,8 @@ typedef void (*group_change_event_handle EVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t); #define IF_AFDATA_LOCK_INIT(ifp) \ - mtx_init(&(ifp)->if_afdata_mtx, "if_afdata", NULL, MTX_DEF) + mtx_init(&(ifp)->if_afdata_mtx, "if_afdata", NULL, \ + (MTX_DEF | MTX_RECURSE)) #define IF_AFDATA_LOCK(ifp) mtx_lock(&(ifp)->if_afdata_mtx) #define IF_AFDATA_TRYLOCK(ifp) mtx_trylock(&(ifp)->if_afdata_mtx) #define IF_AFDATA_UNLOCK(ifp) mtx_unlock(&(ifp)->if_afdata_mtx) Modified: projects/arpv2_merge_1/sys/net/route.c ============================================================================== --- projects/arpv2_merge_1/sys/net/route.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/net/route.c Wed Dec 10 02:04:46 2008 (r185819) @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -53,6 +54,7 @@ #include #include +#include #include #ifdef RADIX_MPATH @@ -420,7 +422,7 @@ rtfree(struct rtentry *rt) */ RT_REMREF(rt); if (rt->rt_refcnt > 0) { - printf("%s: %p has %lu refs\n", __func__, rt, rt->rt_refcnt); + log(LOG_DEBUG, "%s: %p has %lu refs\t", __func__, rt, rt->rt_refcnt); goto done; } @@ -1500,6 +1502,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int char tempbuf[_SOCKADDR_TMPSIZE]; int didwork = 0; int a_failure = 0; + static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; if (flags & RTF_HOST) { dst = ifa->ifa_dstaddr; @@ -1604,7 +1607,14 @@ rtinit1(struct ifaddr *ifa, int cmd, int info.rti_ifa = ifa; info.rti_flags = flags | ifa->ifa_flags; info.rti_info[RTAX_DST] = dst; - info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr; + /* + * doing this for compatibility reasons + */ + if (cmd == RTM_ADD) + info.rti_info[RTAX_GATEWAY] = + (struct sockaddr *)&null_sdl; + else + info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr; info.rti_info[RTAX_NETMASK] = netmask; error = rtrequest1_fib(cmd, &info, &rt, fibnum); if (error == 0 && rt != NULL) { @@ -1628,6 +1638,15 @@ rtinit1(struct ifaddr *ifa, int cmd, int rt->rt_ifa = ifa; } #endif + /* + * doing this for compatibility reasons + */ + if (cmd == RTM_ADD) { + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = + rt->rt_ifp->if_type; + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = + rt->rt_ifp->if_index; + } rt_newaddrmsg(cmd, ifa, error, rt); if (cmd == RTM_DELETE) { /* Modified: projects/arpv2_merge_1/sys/net/rtsock.c ============================================================================== --- projects/arpv2_merge_1/sys/net/rtsock.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/net/rtsock.c Wed Dec 10 02:04:46 2008 (r185819) @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -526,6 +527,11 @@ route_output(struct mbuf *m, struct sock if (info.rti_info[RTAX_GATEWAY] == NULL) senderr(EINVAL); saved_nrt = NULL; + /* support for new ARP code */ + if (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) { + error = lla_rt_output(rtm, &info); + break; + } error = rtrequest1_fib(RTM_ADD, &info, &saved_nrt, so->so_fibnum); if (error == 0 && saved_nrt) { @@ -541,6 +547,12 @@ route_output(struct mbuf *m, struct sock case RTM_DELETE: saved_nrt = NULL; + /* support for new ARP code */ + if (info.rti_info[RTAX_GATEWAY] && + (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK)) { + error = lla_rt_output(rtm, &info); + break; + } error = rtrequest1_fib(RTM_DELETE, &info, &saved_nrt, so->so_fibnum); if (error == 0) { @@ -1432,6 +1444,11 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) RADIX_NODE_HEAD_UNLOCK(rnh); } else if (af != 0) error = EAFNOSUPPORT; + /* + * take care of llinfo entries + */ + if (w.w_op == NET_RT_FLAGS && (RTF_LLINFO & w.w_arg)) + error = lltable_sysctl_dumparp(af, w.w_req); break; case NET_RT_IFLIST: Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 02:04:45 2008 (r185818) +++ projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 02:04:46 2008 (r185819) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -79,6 +80,7 @@ __FBSDID("$FreeBSD$"); #define SIN(s) ((struct sockaddr_in *)s) #define SDL(s) ((struct sockaddr_dl *)s) +#define LLTABLE(ifp) ((struct lltable *)(ifp)->if_afdata[AF_INET]) SYSCTL_DECL(_net_link_ether); SYSCTL_NODE(_net_link_ether, PF_INET, inet, CTLFLAG_RW, 0, ""); @@ -87,23 +89,13 @@ SYSCTL_NODE(_net_link_ether, PF_INET, in #ifdef VIMAGE_GLOBALS static int arpt_keep; /* once resolved, good for 20 more minutes */ static int arp_maxtries; -static int useloopback; /* use loopback interface for local traffic */ +int useloopback; /* use loopback interface for local traffic */ static int arp_proxyall; #endif SYSCTL_V_INT(V_NET, vnet_inet, _net_link_ether_inet, OID_AUTO, max_age, CTLFLAG_RW, arpt_keep, 0, "ARP entry lifetime in seconds"); -#define rt_expire rt_rmx.rmx_expire - -struct llinfo_arp { - struct callout la_timer; - struct rtentry *la_rt; - struct mbuf *la_hold; /* last packet until resolved/timeout */ - u_short la_preempt; /* countdown for pre-expiry arps */ - u_short la_asked; /* # requests sent */ -}; - static struct ifqueue arpintrq; SYSCTL_V_INT(V_NET, vnet_inet, _net_link_ether_inet, OID_AUTO, maxtries, @@ -117,212 +109,104 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_link "Enable proxy ARP for all suitable requests"); static void arp_init(void); -static void arp_rtrequest(int, struct rtentry *, struct rt_addrinfo *); -static void arprequest(struct ifnet *, +void arprequest(struct ifnet *, struct in_addr *, struct in_addr *, u_char *); static void arpintr(struct mbuf *); static void arptimer(void *); -static struct rtentry - *arplookup(u_long, int, int, int); #ifdef INET static void in_arpinput(struct mbuf *); #endif +#ifdef AF_INET +void arp_ifscrub(struct ifnet *ifp, uint32_t addr); + /* - * Timeout routine. + * called by in_ifscrub to remove entry from the table when + * the interface goes away */ -static void -arptimer(void *arg) +void +arp_ifscrub(struct ifnet *ifp, uint32_t addr) { - struct rtentry *rt = (struct rtentry *)arg; - - RT_LOCK_ASSERT(rt); - /* - * The lock is needed to close a theoretical race - * between spontaneous expiry and intentional removal. - * We still got an extra reference on rtentry, so can - * safely pass pointers to its contents. - */ - RT_UNLOCK(rt); + struct sockaddr_in addr4; + struct llentry *lle; - in_rtrequest(RTM_DELETE, rt_key(rt), NULL, rt_mask(rt), 0, NULL, - rt->rt_fibnum); + bzero((void *)&addr4, sizeof(addr4)); + addr4.sin_len = sizeof(addr4); + addr4.sin_family = AF_INET; + addr4.sin_addr.s_addr = addr; + IF_AFDATA_LOCK(ifp); + lle = lla_lookup(LLTABLE(ifp), (LLE_DELETE | LLE_IFADDR), + (struct sockaddr *)&addr4); + IF_AFDATA_UNLOCK(ifp); +#if 0 + if (lle == NULL) + log(LOG_INFO, "arp_ifscrub: interface address is missing from cache\n"); +#endif } +#endif /* - * Parallel to llc_rtrequest. + * Timeout routine. Age arp_tab entries periodically. */ static void -arp_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) +arptimer(void *arg) { - INIT_VNET_NET(curvnet); - INIT_VNET_INET(curvnet); - struct sockaddr *gate; - struct llinfo_arp *la; - static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; - struct in_ifaddr *ia; - struct ifaddr *ifa; + struct ifnet *ifp; + struct llentry *lle = (struct llentry *)arg; - RT_LOCK_ASSERT(rt); - - if (rt->rt_flags & RTF_GATEWAY) + if (lle == NULL) { + panic("%s: NULL entry!\n", __func__); return; - gate = rt->rt_gateway; - la = (struct llinfo_arp *)rt->rt_llinfo; - switch (req) { - - case RTM_ADD: - /* - * XXX: If this is a manually added route to interface - * such as older version of routed or gated might provide, - * restore cloning bit. - */ - if ((rt->rt_flags & RTF_HOST) == 0 && - rt_mask(rt) != NULL && - SIN(rt_mask(rt))->sin_addr.s_addr != 0xffffffff) - rt->rt_flags |= RTF_CLONING; - if (rt->rt_flags & RTF_CLONING) { - /* - * Case 1: This route should come from a route to iface. - */ - rt_setgate(rt, rt_key(rt), - (struct sockaddr *)&null_sdl); - gate = rt->rt_gateway; - SDL(gate)->sdl_type = rt->rt_ifp->if_type; - SDL(gate)->sdl_index = rt->rt_ifp->if_index; - rt->rt_expire = time_uptime; - break; - } - /* Announce a new entry if requested. */ - if (rt->rt_flags & RTF_ANNOUNCE) - arprequest(rt->rt_ifp, - &SIN(rt_key(rt))->sin_addr, - &SIN(rt_key(rt))->sin_addr, - (u_char *)LLADDR(SDL(gate))); - /*FALLTHROUGH*/ - case RTM_RESOLVE: - if (gate->sa_family != AF_LINK || - gate->sa_len < sizeof(null_sdl)) { - log(LOG_DEBUG, "%s: bad gateway %s%s\n", __func__, - inet_ntoa(SIN(rt_key(rt))->sin_addr), - (gate->sa_family != AF_LINK) ? - " (!AF_LINK)": ""); - break; - } - SDL(gate)->sdl_type = rt->rt_ifp->if_type; - SDL(gate)->sdl_index = rt->rt_ifp->if_index; - if (la != 0) - break; /* This happens on a route change */ - /* - * Case 2: This route may come from cloning, or a manual route - * add with a LL address. - */ - R_Zalloc(la, struct llinfo_arp *, sizeof(*la)); - rt->rt_llinfo = (caddr_t)la; - if (la == 0) { - log(LOG_DEBUG, "%s: malloc failed\n", __func__); - break; - } - /* - * We are storing a route entry outside of radix tree. So, - * it can be found and accessed by other means than radix - * lookup. The routing code assumes that any rtentry detached - * from radix can be destroyed safely. To prevent this, we - * add an additional reference. - */ - RT_ADDREF(rt); - la->la_rt = rt; - rt->rt_flags |= RTF_LLINFO; - callout_init_mtx(&la->la_timer, &rt->rt_mtx, - CALLOUT_RETURNUNLOCKED); - -#ifdef INET - /* - * This keeps the multicast addresses from showing up - * in `arp -a' listings as unresolved. It's not actually - * functional. Then the same for broadcast. - */ - if (IN_MULTICAST(ntohl(SIN(rt_key(rt))->sin_addr.s_addr)) && - rt->rt_ifp->if_type != IFT_ARCNET) { - ETHER_MAP_IP_MULTICAST(&SIN(rt_key(rt))->sin_addr, - LLADDR(SDL(gate))); - SDL(gate)->sdl_alen = 6; - rt->rt_expire = 0; - } - if (in_broadcast(SIN(rt_key(rt))->sin_addr, rt->rt_ifp)) { - memcpy(LLADDR(SDL(gate)), rt->rt_ifp->if_broadcastaddr, - rt->rt_ifp->if_addrlen); - SDL(gate)->sdl_alen = rt->rt_ifp->if_addrlen; - rt->rt_expire = 0; - } -#endif - - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { - if (ia->ia_ifp == rt->rt_ifp && - SIN(rt_key(rt))->sin_addr.s_addr == - (IA_SIN(ia))->sin_addr.s_addr) - break; - } - if (ia) { - /* - * This test used to be - * if (loif.if_flags & IFF_UP) - * It allowed local traffic to be forced - * through the hardware by configuring the loopback down. - * However, it causes problems during network configuration - * for boards that can't receive packets they send. - * It is now necessary to clear "useloopback" and remove - * the route to force traffic out to the hardware. - */ - rt->rt_expire = 0; - bcopy(IF_LLADDR(rt->rt_ifp), LLADDR(SDL(gate)), - SDL(gate)->sdl_alen = rt->rt_ifp->if_addrlen); - if (V_useloopback) { - rt->rt_ifp = V_loif; - rt->rt_rmx.rmx_mtu = V_loif->if_mtu; - } - - /* - * make sure to set rt->rt_ifa to the interface - * address we are using, otherwise we will have trouble - * with source address selection. - */ - ifa = &ia->ia_ifa; - if (ifa != rt->rt_ifa) { - IFAFREE(rt->rt_ifa); - IFAREF(ifa); - rt->rt_ifa = ifa; - } + } + ifp = lle->lle_tbl->llt_ifp; + IF_AFDATA_LOCK(ifp); + if ((lle->la_flags & LLE_DELETED) || + (time_second >= lle->la_expire)) { + if (!callout_pending(&lle->la_timer) && + (callout_active(&lle->la_timer))) { + (void)llentry_free(lle); } - break; - - case RTM_DELETE: - if (la == NULL) /* XXX: at least CARP does this. */ - break; - callout_stop(&la->la_timer); - rt->rt_llinfo = NULL; - rt->rt_flags &= ~RTF_LLINFO; - RT_REMREF(rt); - if (la->la_hold) - m_freem(la->la_hold); - Free((caddr_t)la); } + IF_AFDATA_UNLOCK(ifp); } + /* * Broadcast an ARP request. Caller specifies: * - arp header source ip address * - arp header target ip address * - arp header source ethernet address */ -static void -arprequest(struct ifnet *ifp, struct in_addr *sip, struct in_addr *tip, +void +arprequest(struct ifnet *ifp, struct in_addr *sip, struct in_addr *tip, u_char *enaddr) { struct mbuf *m; struct arphdr *ah; struct sockaddr sa; + if (sip == NULL) { + /* + * The caller did not supply a source address, try to find + * a compatible one among those assigned to this interface. + */ + struct ifaddr *ifa; + + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (!ifa->ifa_addr || + ifa->ifa_addr->sa_family != AF_INET) + continue; + sip = &SIN(ifa->ifa_addr)->sin_addr; + if (0 == ((sip->s_addr ^ tip->s_addr) & + SIN(ifa->ifa_netmask)->sin_addr.s_addr) ) + break; /* found it. */ + } + if (sip == NULL) { + printf("%s: cannot find matching address\n", __func__); + return; + } + } + if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) return; m->m_len = sizeof(*ah) + 2*sizeof(struct in_addr) + @@ -345,8 +229,6 @@ arprequest(struct ifnet *ifp, struct in_ sa.sa_len = 2; m->m_flags |= M_BCAST; (*ifp->if_output)(ifp, m, &sa, (struct rtentry *)0); - - return; } /* @@ -365,16 +247,16 @@ arprequest(struct ifnet *ifp, struct in_ */ int arpresolve(struct ifnet *ifp, struct rtentry *rt0, struct mbuf *m, - struct sockaddr *dst, u_char *desten) + struct sockaddr *dst, u_char *desten, struct llentry **lle) { INIT_VNET_INET(ifp->if_vnet); - struct llinfo_arp *la = NULL; - struct rtentry *rt = NULL; - struct sockaddr_dl *sdl; + struct llentry *la = 0; + u_int flags; int error; - int fibnum = -1; - if (m) { + *lle = NULL; + + if (m != NULL) { if (m->m_flags & M_BCAST) { /* broadcast */ (void)memcpy(desten, @@ -386,95 +268,46 @@ arpresolve(struct ifnet *ifp, struct rte ETHER_MAP_IP_MULTICAST(&SIN(dst)->sin_addr, desten); return (0); } - fibnum = M_GETFIB(m); } - if (rt0 != NULL) { - /* Look for a cached arp (ll) entry. */ - if (m == NULL) - fibnum = rt0->rt_fibnum; - error = rt_check(&rt, &rt0, dst); - if (error) { - m_freem(m); - return error; - } - la = (struct llinfo_arp *)rt->rt_llinfo; - if (la == NULL) - RT_UNLOCK(rt); - } + flags = (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) ? 0 : LLE_CREATE; - /* - * If we had no mbuf and no route, then hope the caller - * has a fib in mind because we are running out of ideas. - * I think this should not happen in current code. - * (kmacy would know). + /* XXXXX + * Since this function returns an llentry, the + * lock is held by the caller. */ - if (fibnum == -1) - fibnum = curthread->td_proc->p_fibnum; /* last gasp */ - + la = lla_lookup(LLTABLE(ifp), flags, dst); if (la == NULL) { - /* - * We enter this block if rt0 was NULL, - * or if rt found by rt_check() didn't have llinfo. - * we should get a cloned route, which since it should - * come from the local interface should have a ll entry. - * It may be incomplete but that's ok. - */ - rt = arplookup(SIN(dst)->sin_addr.s_addr, 1, 0, fibnum); - if (rt == NULL) { - log(LOG_DEBUG, - "arpresolve: can't allocate route for %s\n", - inet_ntoa(SIN(dst)->sin_addr)); - m_freem(m); - return (EINVAL); /* XXX */ - } - la = (struct llinfo_arp *)rt->rt_llinfo; - if (la == NULL) { - RT_UNLOCK(rt); + if (flags & LLE_CREATE) log(LOG_DEBUG, "arpresolve: can't allocate llinfo for %s\n", inet_ntoa(SIN(dst)->sin_addr)); - m_freem(m); - return (EINVAL); /* XXX */ - } - } - sdl = SDL(rt->rt_gateway); - /* - * Check the address family and length is valid, the address - * is resolved; otherwise, try to resolve. - */ - if ((rt->rt_expire == 0 || rt->rt_expire > time_uptime) && - sdl->sdl_family == AF_LINK && sdl->sdl_alen != 0) { - - bcopy(LLADDR(sdl), desten, sdl->sdl_alen); + m_freem(m); + return (EINVAL); + } + if (la->la_flags & LLE_VALID && + (la->la_flags & LLE_STATIC || la->la_expire > time_uptime)) { + bcopy(&la->ll_addr, desten, ifp->if_addrlen); /* * If entry has an expiry time and it is approaching, - * send an ARP request. + * see if we need to send an ARP request within this + * arpt_down interval. */ - if ((rt->rt_expire != 0) && - (time_uptime + la->la_preempt > rt->rt_expire)) { - struct in_addr sin = - SIN(rt->rt_ifa->ifa_addr)->sin_addr; + if (!(la->la_flags & LLE_STATIC) && + time_uptime + la->la_preempt > la->la_expire) { + arprequest(ifp, NULL, + &SIN(dst)->sin_addr, IF_LLADDR(ifp)); la->la_preempt--; - RT_UNLOCK(rt); - arprequest(ifp, &sin, &SIN(dst)->sin_addr, - IF_LLADDR(ifp)); - return (0); } - - RT_UNLOCK(rt); + *lle = la; return (0); } - /* - * If ARP is disabled or static on this interface, stop. - * XXX - * Probably should not allocate empty llinfo struct if we are - * not going to be sending out an arp request. - */ - if (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) { - RT_UNLOCK(rt); + + if (la->la_flags & LLE_STATIC) { /* should not happen! */ + log(LOG_DEBUG, "arpresolve: ouch, empty static llinfo for %s\n", + inet_ntoa(SIN(dst)->sin_addr)); m_freem(m); return (EINVAL); } @@ -488,8 +321,6 @@ arpresolve(struct ifnet *ifp, struct rte m_freem(la->la_hold); la->la_hold = m; } - KASSERT(rt->rt_expire > 0, ("sending ARP request for static entry")); - /* * Return EWOULDBLOCK if we have tried less than arp_maxtries. It * will be masked by ether_output(). Return EHOSTDOWN/EHOSTUNREACH @@ -499,23 +330,19 @@ arpresolve(struct ifnet *ifp, struct rte if (la->la_asked < V_arp_maxtries) error = EWOULDBLOCK; /* First request. */ else - error = (rt == rt0) ? EHOSTDOWN : EHOSTUNREACH; + error = + (rt0->rt_flags & RTF_GATEWAY) ? EHOSTDOWN : EHOSTUNREACH; - if (la->la_asked == 0 || rt->rt_expire != time_uptime) { - struct in_addr sin = - SIN(rt->rt_ifa->ifa_addr)->sin_addr; - - rt->rt_expire = time_uptime; - callout_reset(&la->la_timer, hz, arptimer, rt); + if (la->la_asked == 0 || la->la_expire != time_uptime) { + la->la_expire = time_uptime; + callout_reset(&la->la_timer, hz, arptimer, la); la->la_asked++; - RT_UNLOCK(rt); - arprequest(ifp, &sin, &SIN(dst)->sin_addr, + arprequest(ifp, NULL, &SIN(dst)->sin_addr, IF_LLADDR(ifp)); - } else - RT_UNLOCK(rt); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 02:10:45 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2536210656AD; Wed, 10 Dec 2008 02:10:45 +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 1040B8FC1B; Wed, 10 Dec 2008 02:10:45 +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 mBA2AigP008992; Wed, 10 Dec 2008 02:10:44 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA2Ailg008990; Wed, 10 Dec 2008 02:10:44 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812100210.mBA2Ailg008990@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Dec 2008 02:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185820 - projects/arpv2_merge_1/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 02:10:45 -0000 Author: kmacy Date: Wed Dec 10 02:10:44 2008 New Revision: 185820 URL: http://svn.freebsd.org/changeset/base/185820 Log: add if_llatbl.[ch] Added: projects/arpv2_merge_1/sys/net/if_llatbl.c (contents, props changed) projects/arpv2_merge_1/sys/net/if_llatbl.h (contents, props changed) Added: projects/arpv2_merge_1/sys/net/if_llatbl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/sys/net/if_llatbl.c Wed Dec 10 02:10:44 2008 (r185820) @@ -0,0 +1,298 @@ +/* + * Copyright (c) 2007 Qing Li, Luigi Rizzo, Alessandro Cerri. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MALLOC_DEFINE(M_LLTABLE, "lltable", "link level address tables"); + +static SLIST_HEAD(, lltable) lltables = SLIST_HEAD_INITIALIZER(lltables); + +extern void arprequest(struct ifnet *, struct in_addr *, struct in_addr *, + u_char *); + +/* + * Dump arp state for a specific address family. + */ +int +lltable_sysctl_dumparp(int af, struct sysctl_req *wr) +{ + struct lltable *llt; + int error = 0; + + IFNET_RLOCK(); + SLIST_FOREACH(llt, &lltables, llt_link) { + if (llt->llt_af == af) { + error = llt->llt_dump(llt, wr); + if (error != 0) + goto done; + } + } +done: + IFNET_RUNLOCK(); + return (error); +} + +/* + * Deletes an address from the address table. + * This function is called by the timer functions + * such as arptimer() and nd6_llinfo_timer(), and + * the caller does the locking. + */ +void +llentry_free(struct llentry *lle) +{ + struct lltable *llt = lle->lle_tbl; + + LIST_REMOVE(lle, lle_next); + + if (lle->la_hold != NULL) + m_freem(lle->la_hold); + llt->llt_free(llt, lle); +} + +/* + * Free all entries from given table and free itself. + * Since lltables collects from all of the intefaces, + * the caller of this function must acquire IFNET_WLOCK(). + */ +void +lltable_free(struct lltable *llt) +{ + struct llentry *lle, *next; + int i; + + KASSERT(llt != NULL, ("%s: llt is NULL", __func__)); + + IFNET_WLOCK(); + SLIST_REMOVE(&lltables, llt, lltable, llt_link); + IFNET_WUNLOCK(); + + for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { + callout_drain(&lle->la_timer); + llentry_free(lle); + } + } + + free(llt, M_LLTABLE); +} + +void +lltable_drain(int af) +{ + struct lltable *llt; + struct llentry *lle; + register int i; + + IFNET_RLOCK(); + SLIST_FOREACH(llt, &lltables, llt_link) { + if (llt->llt_af != af) + continue; + + for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + LIST_FOREACH(lle, &llt->lle_head[i], lle_next) { + if (lle->la_hold) { + m_freem(lle->la_hold); + lle->la_hold = NULL; + } + } + } + } + IFNET_RUNLOCK(); +} + +/* + * Create a new lltable. + */ +struct lltable * +lltable_init(struct ifnet *ifp, int af) +{ + struct lltable *llt; + register int i; + + llt = malloc(sizeof(struct lltable), M_LLTABLE, M_WAITOK); + if (llt == NULL) + return (NULL); + + llt->llt_af = af; + llt->llt_ifp = ifp; + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) + LIST_INIT(&llt->lle_head[i]); + + IFNET_WLOCK(); + SLIST_INSERT_HEAD(&lltables, llt, llt_link); + IFNET_WUNLOCK(); + + return (llt); +} + +/* + * Called in route_output when adding/deleting a route to an interface. + */ +int +lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinfo *info) +{ + struct sockaddr_dl *dl = + (struct sockaddr_dl *)info->rti_info[RTAX_GATEWAY]; + struct sockaddr *dst = (struct sockaddr *)info->rti_info[RTAX_DST]; + struct ifnet *ifp; + struct lltable *llt; + struct llentry *lle; + u_int flags = 0; + + if (dl == NULL || dl->sdl_family != AF_LINK) { + log(LOG_INFO, "%s: invalid dl\n", __func__); + return EINVAL; + } + ifp = ifnet_byindex(dl->sdl_index); + if (ifp == NULL) { + log(LOG_INFO, "%s: invalid ifp (sdl_index %d)\n", + __func__, dl->sdl_index); + return EINVAL; + } + + switch (rtm->rtm_type) { + case RTM_ADD: + if (rtm->rtm_flags & RTF_ANNOUNCE) { + flags |= LLE_PUB; +#ifdef INET + if (dst->sa_family == AF_INET && + ((struct sockaddr_inarp *)dst)->sin_other != 0) { + struct rtentry *rt = rtalloc1(dst, 0, 0); + if (rt == NULL || !(rt->rt_flags & RTF_HOST)) { + log(LOG_INFO, "%s: RTM_ADD publish " + "(proxy only) is invalid\n", + __func__); + rtfree(rt); + return EINVAL; + } + rtfree(rt); + + flags |= LLE_PROXY; + } +#endif + } + flags |= LLE_CREATE; + break; + + case RTM_DELETE: + flags |= LLE_DELETE; + break; + + case RTM_CHANGE: + break; + + default: + return EINVAL; /* XXX not implemented yet */ + } + + /* + * XXXXXXXX: + * REVISE this approach if possible. + */ + IFNET_WLOCK(); + SLIST_FOREACH(llt, &lltables, llt_link) { + if (llt->llt_af == dst->sa_family && + llt->llt_ifp == ifp) + break; + } + IFNET_WUNLOCK(); + KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n")); + + IF_AFDATA_LOCK(ifp); + lle = lla_lookup(llt, flags, dst); + if (lle != NULL) { + if (flags & LLE_CREATE) { + /* qing: if we delay the delete, then if a subsequent + * "arp add" on the same host should look up this entry, + * reset the LLE_DELETED flag, and reset the expiration timer + */ + bcopy(LLADDR(dl), &lle->ll_addr, ifp->if_addrlen); + lle->la_flags |= LLE_VALID; + lle->la_flags &= ~LLE_DELETED; +#ifdef INET6 + /* + * ND6 + */ + if (dst->sa_family == AF_INET6) + lle->ln_state = ND6_LLINFO_REACHABLE; +#endif + /* + * "arp" and "ndp" always sets the (RTF_STATIC | RTF_HOST) flags + */ + if (rtm->rtm_rmx.rmx_expire == 0) { + lle->la_flags |= LLE_STATIC; + lle->la_expire = 0; + } else + lle->la_expire = rtm->rtm_rmx.rmx_expire; +#ifdef INET + /* gratuious ARP */ + if ((lle->la_flags & LLE_PUB) && + dst->sa_family == AF_INET) { + arprequest(ifp, + &((struct sockaddr_in *)dst)->sin_addr, + &((struct sockaddr_in *)dst)->sin_addr, + ((lle->la_flags & LLE_PROXY) ? + (u_char *)IF_LLADDR(ifp) : + (u_char *)LLADDR(dl))); + } +#endif + } + } else { + if (flags & LLE_DELETE) { + IF_AFDATA_UNLOCK(ifp); + return EINVAL; + } + } + + IF_AFDATA_UNLOCK(ifp); + return 0; +} Added: projects/arpv2_merge_1/sys/net/if_llatbl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/sys/net/if_llatbl.h Wed Dec 10 02:10:44 2008 (r185820) @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2007 Qing Li, Luigi Rizzo, Alessandro Cerri. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#ifndef _NET_IF_LLATBL_H_ +#define _NET_IF_LLATBL_H_ + +#include + +struct ifnet; +struct sysctl_req; +struct rt_msghdr; +struct rt_addrinfo; + +struct llentry; +LIST_HEAD(llentries, llentry); + +struct llentry { + LIST_ENTRY(llentry) lle_next; + struct lltable *lle_tbl; + struct llentries *lle_head; + struct mbuf *la_hold; + time_t la_expire; + uint16_t la_flags; + uint16_t la_asked; + uint16_t la_preempt; + uint16_t ln_byhint; + int16_t ln_state; /* IPv6 has ND6_LLINFO_NOSTATE == -2 */ + uint16_t ln_router; + time_t ln_ntick; + union { + uint64_t mac_aligned; + uint16_t mac16[3]; + } ll_addr; + + /* XXX af-private? */ + union { + struct callout ln_timer_ch; + struct callout la_timer; + } lle_timer; + /* NB: struct sockaddr must immediately follow */ +}; + +#define ln_timer_ch lle_timer.ln_timer_ch +#define la_timer lle_timer.la_timer + +/* XXX bad name */ +#define L3_ADDR(lle) ((struct sockaddr *)(&lle[1])) +#define L3_ADDR_LEN(lle) (((struct sockaddr *)(&lle[1]))->sa_len) + +#ifndef LLTBL_HASHTBL_SIZE +#define LLTBL_HASHTBL_SIZE 32 /* default 32 ? */ +#endif + +#ifndef LLTBL_HASHMASK +#define LLTBL_HASHMASK (LLTBL_HASHTBL_SIZE - 1) +#endif + +struct lltable { + SLIST_ENTRY(lltable) llt_link; + struct llentries lle_head[LLTBL_HASHTBL_SIZE]; + int llt_af; + struct ifnet *llt_ifp; + + struct llentry * (*llt_new)(const struct sockaddr *, u_int); + void (*llt_free)(struct lltable *, struct llentry *); + struct llentry * (*llt_lookup)(struct lltable *, u_int flags, + const struct sockaddr *l3addr); + int (*llt_rtcheck)(struct ifnet *, + const struct sockaddr *); + int (*llt_dump)(struct lltable *, + struct sysctl_req *); +}; +MALLOC_DECLARE(M_LLTABLE); + +/* + * flags to be passed to arplookup. + */ +#define LLE_DELETED 0x0001 /* entry must be deleted */ +#define LLE_STATIC 0x0002 /* entry is static */ +#define LLE_IFADDR 0x0004 /* entry is interface addr */ +#define LLE_VALID 0x0008 /* ll_addr is valid */ +#define LLE_PROXY 0x0010 /* proxy entry ??? */ +#define LLE_PUB 0x0020 /* publish entry ??? */ +#define LLE_CREATE 0x8000 /* create on a lookup miss */ +#define LLE_DELETE 0x4000 /* delete on a lookup - match LLE_IFADDR */ + +#define LLATBL_HASH(key, mask) \ + (((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask) + +struct lltable *lltable_init(struct ifnet *, int); +void lltable_free(struct lltable *); +void lltable_drain(int); +int lltable_sysctl_dumparp(int, struct sysctl_req *); + +void llentry_free(struct llentry *); + +/* + * Generic link layer address lookup function. + */ +static __inline struct llentry * +lla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) +{ + return llt->llt_lookup(llt, flags, l3addr); +} + +int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *); +#endif /* _NET_IF_LLATBL_H_ */ From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 06:01:28 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 103051065672; Wed, 10 Dec 2008 06:01:28 +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 ED80A8FC1E; Wed, 10 Dec 2008 06:01: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 mBA61RqD020283; Wed, 10 Dec 2008 06:01:27 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA61RqB020268; Wed, 10 Dec 2008 06:01:27 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812100601.mBA61RqB020268@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Dec 2008 06:01:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185839 - in projects/arpv2_merge_1/sys: net netinet netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 06:01:28 -0000 Author: kmacy Date: Wed Dec 10 06:01:27 2008 New Revision: 185839 URL: http://svn.freebsd.org/changeset/base/185839 Log: merge changes from head_arpv2 branch: - substantially reduce the scope of the IF_AFDATA_LOCK - make the IF_AFDATA_LOCK not recursive - add rwlock and refcount to llentry Modified: projects/arpv2_merge_1/sys/net/if.c projects/arpv2_merge_1/sys/net/if_llatbl.c projects/arpv2_merge_1/sys/net/if_llatbl.h projects/arpv2_merge_1/sys/net/if_var.h projects/arpv2_merge_1/sys/netinet/if_ether.c projects/arpv2_merge_1/sys/netinet/in.c projects/arpv2_merge_1/sys/netinet/ip_output.c projects/arpv2_merge_1/sys/netinet6/icmp6.c projects/arpv2_merge_1/sys/netinet6/in6.c projects/arpv2_merge_1/sys/netinet6/in6_rmx.c projects/arpv2_merge_1/sys/netinet6/ip6_input.c projects/arpv2_merge_1/sys/netinet6/ip6_mroute.c projects/arpv2_merge_1/sys/netinet6/ip6_output.c projects/arpv2_merge_1/sys/netinet6/nd6.c projects/arpv2_merge_1/sys/netinet6/nd6.h projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c Modified: projects/arpv2_merge_1/sys/net/if.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/net/if.c Wed Dec 10 06:01:27 2008 (r185839) @@ -71,7 +71,6 @@ #include #include #include -#include #if defined(INET) || defined(INET6) /*XXX*/ @@ -1345,6 +1344,9 @@ done: return (ifa); } +#include +#include + /* * Default action when installing a route with a Link Level gateway. * Lookup an appropriate real ifa to point to. Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/net/if_llatbl.c Wed Dec 10 06:01:27 2008 (r185839) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -89,13 +90,14 @@ done: void llentry_free(struct llentry *lle) { - struct lltable *llt = lle->lle_tbl; + LLE_WLOCK(lle); LIST_REMOVE(lle, lle_next); if (lle->la_hold != NULL) m_freem(lle->la_hold); - llt->llt_free(llt, lle); + + LLE_FREE_LOCKED(lle); } /* @@ -186,7 +188,8 @@ lla_rt_output(struct rt_msghdr *rtm, str struct ifnet *ifp; struct lltable *llt; struct llentry *lle; - u_int flags = 0; + u_int laflags = 0, flags = 0; + int error = 0; if (dl == NULL || dl->sdl_family != AF_LINK) { log(LOG_INFO, "%s: invalid dl\n", __func__); @@ -211,10 +214,10 @@ lla_rt_output(struct rt_msghdr *rtm, str log(LOG_INFO, "%s: RTM_ADD publish " "(proxy only) is invalid\n", __func__); - rtfree(rt); + RTFREE(rt); return EINVAL; } - rtfree(rt); + RTFREE(rt); flags |= LLE_PROXY; } @@ -238,17 +241,21 @@ lla_rt_output(struct rt_msghdr *rtm, str * XXXXXXXX: * REVISE this approach if possible. */ - IFNET_WLOCK(); + IFNET_RLOCK(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af == dst->sa_family && llt->llt_ifp == ifp) break; } - IFNET_WUNLOCK(); + IFNET_RUNLOCK(); KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n")); + if (flags && LLE_CREATE) + flags |= LLE_EXCLUSIVE; + IF_AFDATA_LOCK(ifp); lle = lla_lookup(llt, flags, dst); + IF_AFDATA_UNLOCK(ifp); if (lle != NULL) { if (flags & LLE_CREATE) { /* qing: if we delay the delete, then if a subsequent @@ -268,31 +275,32 @@ lla_rt_output(struct rt_msghdr *rtm, str /* * "arp" and "ndp" always sets the (RTF_STATIC | RTF_HOST) flags */ + if (rtm->rtm_rmx.rmx_expire == 0) { lle->la_flags |= LLE_STATIC; lle->la_expire = 0; } else lle->la_expire = rtm->rtm_rmx.rmx_expire; + laflags = lle->la_flags; + LLE_WUNLOCK(lle); #ifdef INET /* gratuious ARP */ - if ((lle->la_flags & LLE_PUB) && + if ((laflags & LLE_PUB) && dst->sa_family == AF_INET) { arprequest(ifp, &((struct sockaddr_in *)dst)->sin_addr, &((struct sockaddr_in *)dst)->sin_addr, - ((lle->la_flags & LLE_PROXY) ? + ((laflags & LLE_PROXY) ? (u_char *)IF_LLADDR(ifp) : (u_char *)LLADDR(dl))); } #endif - } + } else + LLE_RUNLOCK(lle); } else { - if (flags & LLE_DELETE) { - IF_AFDATA_UNLOCK(ifp); - return EINVAL; - } + if (flags & LLE_DELETE) + error = EINVAL; } - IF_AFDATA_UNLOCK(ifp); - return 0; + return (error); } Modified: projects/arpv2_merge_1/sys/net/if_llatbl.h ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.h Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/net/if_llatbl.h Wed Dec 10 06:01:27 2008 (r185839) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #ifndef _NET_IF_LLATBL_H_ #define _NET_IF_LLATBL_H_ +#include #include struct ifnet; @@ -38,8 +39,13 @@ struct rt_addrinfo; struct llentry; LIST_HEAD(llentries, llentry); +/* + * Code referencing llentry must at least hold + * a shared lock + */ struct llentry { LIST_ENTRY(llentry) lle_next; + struct rwlock lle_lock; struct lltable *lle_tbl; struct llentries *lle_head; struct mbuf *la_hold; @@ -51,6 +57,8 @@ struct llentry { int16_t ln_state; /* IPv6 has ND6_LLINFO_NOSTATE == -2 */ uint16_t ln_router; time_t ln_ntick; + int lle_refcnt; + union { uint64_t mac_aligned; uint16_t mac16[3]; @@ -64,6 +72,53 @@ struct llentry { /* NB: struct sockaddr must immediately follow */ }; +#define LLE_WLOCK(lle) rw_wlock(&(lle)->lle_lock) +#define LLE_RLOCK(lle) rw_rlock(&(lle)->lle_lock) +#define LLE_WUNLOCK(lle) rw_wunlock(&(lle)->lle_lock) +#define LLE_RUNLOCK(lle) rw_runlock(&(lle)->lle_lock) +#define LLE_DOWNGRADE(lle) rw_downgrade(&(lle)->lle_lock) +#define LLE_TRY_UPGRADE(lle) rw_try_upgrade(&(lle)->lle_lock) +#define LLE_LOCK_INIT(lle) rw_init_flags(&(lle)->lle_lock, "lle", RW_DUPOK) +#define LLE_WLOCK_ASSERT(lle) rw_assert(&(lle)->lle_lock, RA_WLOCKED) + +#define LLE_ADDREF(lle) do { \ + LLE_WLOCK_ASSERT(lle); \ + KASSERT((lle)->lle_refcnt >= 0, \ + ("negative refcnt %d", (lle)->lle_refcnt)); \ + (lle)->lle_refcnt++; \ +} while (0) + +#define LLE_REMREF(lle) do { \ + LLE_WLOCK_ASSERT(lle); \ + KASSERT((lle)->rt_refcnt > 0, \ + ("bogus refcnt %ld", (lle)->rt_refcnt)); \ + (lle)->rt_refcnt--; \ +} while (0) + +#define LLE_FREE_LOCKED(lle) do { \ + if ((lle)->lle_refcnt <= 1) \ + (lle)->lle_tbl->llt_free((lle)->lle_tbl, (lle));\ + else { \ + (lle)->lle_refcnt--; \ + LLE_WUNLOCK(lle); \ + } \ + /* guard against invalid refs */ \ + lle = 0; \ +} while (0) + +#define LLE_FREE(lle) do { \ + LLE_WLOCK(lle); \ + if ((lle)->lle_refcnt <= 1) \ + (lle)->lle_tbl->llt_free((lle)->lle_tbl, (lle));\ + else { \ + (lle)->lle_refcnt--; \ + LLE_WUNLOCK(lle); \ + } \ + /* guard against invalid refs */ \ + lle = 0; \ +} while (0) + + #define ln_timer_ch lle_timer.ln_timer_ch #define la_timer lle_timer.la_timer @@ -105,8 +160,9 @@ MALLOC_DECLARE(M_LLTABLE); #define LLE_VALID 0x0008 /* ll_addr is valid */ #define LLE_PROXY 0x0010 /* proxy entry ??? */ #define LLE_PUB 0x0020 /* publish entry ??? */ -#define LLE_CREATE 0x8000 /* create on a lookup miss */ #define LLE_DELETE 0x4000 /* delete on a lookup - match LLE_IFADDR */ +#define LLE_CREATE 0x8000 /* create on a lookup miss */ +#define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */ #define LLATBL_HASH(key, mask) \ (((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask) Modified: projects/arpv2_merge_1/sys/net/if_var.h ============================================================================== --- projects/arpv2_merge_1/sys/net/if_var.h Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/net/if_var.h Wed Dec 10 06:01:27 2008 (r185839) @@ -359,13 +359,15 @@ typedef void (*group_change_event_handle EVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t); #define IF_AFDATA_LOCK_INIT(ifp) \ - mtx_init(&(ifp)->if_afdata_mtx, "if_afdata", NULL, \ - (MTX_DEF | MTX_RECURSE)) + mtx_init(&(ifp)->if_afdata_mtx, "if_afdata", NULL, MTX_DEF) #define IF_AFDATA_LOCK(ifp) mtx_lock(&(ifp)->if_afdata_mtx) #define IF_AFDATA_TRYLOCK(ifp) mtx_trylock(&(ifp)->if_afdata_mtx) #define IF_AFDATA_UNLOCK(ifp) mtx_unlock(&(ifp)->if_afdata_mtx) #define IF_AFDATA_DESTROY(ifp) mtx_destroy(&(ifp)->if_afdata_mtx) +#define IF_AFDATA_LOCK_ASSERT(ifp) mtx_assert(&(ifp)->if_afdata_mtx, MA_OWNED) +#define IF_AFDATA_UNLOCK_ASSERT(ifp) mtx_assert(&(ifp)->if_afdata_mtx, MA_NOTOWNED) + #define IFF_LOCKGIANT(ifp) do { \ if ((ifp)->if_flags & IFF_NEEDSGIANT) \ mtx_lock(&Giant); \ Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 06:01:27 2008 (r185839) @@ -128,20 +128,15 @@ void arp_ifscrub(struct ifnet *ifp, uint32_t addr) { struct sockaddr_in addr4; - struct llentry *lle; bzero((void *)&addr4, sizeof(addr4)); addr4.sin_len = sizeof(addr4); addr4.sin_family = AF_INET; addr4.sin_addr.s_addr = addr; IF_AFDATA_LOCK(ifp); - lle = lla_lookup(LLTABLE(ifp), (LLE_DELETE | LLE_IFADDR), + lla_lookup(LLTABLE(ifp), (LLE_DELETE | LLE_IFADDR), (struct sockaddr *)&addr4); IF_AFDATA_UNLOCK(ifp); -#if 0 - if (lle == NULL) - log(LOG_INFO, "arp_ifscrub: interface address is missing from cache\n"); -#endif } #endif @@ -159,15 +154,22 @@ arptimer(void *arg) return; } ifp = lle->lle_tbl->llt_ifp; - IF_AFDATA_LOCK(ifp); if ((lle->la_flags & LLE_DELETED) || (time_second >= lle->la_expire)) { + printf("deleting entry\n"); + + IF_AFDATA_LOCK(ifp); if (!callout_pending(&lle->la_timer) && (callout_active(&lle->la_timer))) { (void)llentry_free(lle); } + IF_AFDATA_UNLOCK(ifp); + } else { + /* + * Still valid, just drop our reference + */ + LLE_FREE(lle); } - IF_AFDATA_UNLOCK(ifp); } @@ -252,10 +254,10 @@ arpresolve(struct ifnet *ifp, struct rte INIT_VNET_INET(ifp->if_vnet); struct llentry *la = 0; u_int flags; - int error; + int error, renew; + log(LOG_DEBUG, "arpesolve called\n"); *lle = NULL; - if (m != NULL) { if (m->m_flags & M_BCAST) { /* broadcast */ @@ -276,6 +278,7 @@ arpresolve(struct ifnet *ifp, struct rte * Since this function returns an llentry, the * lock is held by the caller. */ +retry: la = lla_lookup(LLTABLE(ifp), flags, dst); if (la == NULL) { if (flags & LLE_CREATE) @@ -283,11 +286,12 @@ arpresolve(struct ifnet *ifp, struct rte "arpresolve: can't allocate llinfo for %s\n", inet_ntoa(SIN(dst)->sin_addr)); m_freem(m); + log(LOG_DEBUG, "arpesolve: lla_lookup fail\n"); return (EINVAL); } - if (la->la_flags & LLE_VALID && - (la->la_flags & LLE_STATIC || la->la_expire > time_uptime)) { + if ((la->la_flags & LLE_VALID) && + ((la->la_flags & LLE_STATIC) || (la->la_expire > time_uptime))) { bcopy(&la->ll_addr, desten, ifp->if_addrlen); /* * If entry has an expiry time and it is approaching, @@ -300,26 +304,46 @@ arpresolve(struct ifnet *ifp, struct rte &SIN(dst)->sin_addr, IF_LLADDR(ifp)); la->la_preempt--; - } + } + log(LOG_DEBUG, "arpresolve: success\n"); + *lle = la; - return (0); - } - + error = 0; + goto done; + } else + log(LOG_DEBUG, + "la=%p valid=%d static=%d expire=%ld uptime=%ld\n", la, + !!(la->la_flags & LLE_VALID), !!(la->la_flags & LLE_STATIC), + la->la_expire, time_uptime); + if (la->la_flags & LLE_STATIC) { /* should not happen! */ log(LOG_DEBUG, "arpresolve: ouch, empty static llinfo for %s\n", inet_ntoa(SIN(dst)->sin_addr)); m_freem(m); - return (EINVAL); + error = EINVAL; + goto done; } + + renew = (la->la_asked == 0 || la->la_expire != time_uptime); /* * There is an arptab entry, but no ethernet address * response yet. Replace the held mbuf with this * latest one. */ if (m) { + if ((flags & LLE_EXCLUSIVE) == 0) { + flags |= LLE_EXCLUSIVE; + LLE_RUNLOCK(la); + goto retry; + } if (la->la_hold) m_freem(la->la_hold); la->la_hold = m; + if (renew == 0 && (flags & LLE_EXCLUSIVE)) { + flags &= ~LLE_EXCLUSIVE; + LLE_DOWNGRADE(la); + } + } /* * Return EWOULDBLOCK if we have tried less than arp_maxtries. It @@ -333,16 +357,26 @@ arpresolve(struct ifnet *ifp, struct rte error = (rt0->rt_flags & RTF_GATEWAY) ? EHOSTDOWN : EHOSTUNREACH; - if (la->la_asked == 0 || la->la_expire != time_uptime) { + if (renew) { + log(LOG_DEBUG, + "arpresolve: kicking off new resolve expire=%ld\n", + la->la_expire); + LLE_ADDREF(la); la->la_expire = time_uptime; callout_reset(&la->la_timer, hz, arptimer, la); la->la_asked++; - + LLE_WUNLOCK(la); arprequest(ifp, NULL, &SIN(dst)->sin_addr, IF_LLADDR(ifp)); + return (error); } - return (EWOULDBLOCK); +done: + if (flags & LLE_EXCLUSIVE) + LLE_WUNLOCK(la); + else + LLE_RUNLOCK(la); + return (error); } /* @@ -432,7 +466,8 @@ in_arpinput(struct mbuf *m) struct sockaddr sa; struct in_addr isaddr, itaddr, myaddr; u_int8_t *enaddr = NULL; - int op, flag, lock_owned = 0; + int op, flags; + struct mbuf *m0; /* , rif_len; */ @@ -527,6 +562,7 @@ in_arpinput(struct mbuf *m) if (!bridged || (ia = TAILQ_FIRST(&V_in_ifaddrhead)) == NULL) goto drop; match: + log(LOG_DEBUG,"in_arpinput: match\n"); if (!enaddr) enaddr = (u_int8_t *)IF_LLADDR(ifp); myaddr = ia->ia_addr.sin_addr; @@ -559,17 +595,19 @@ match: sin.sin_len = sizeof(struct sockaddr_in); sin.sin_family = AF_INET; sin.sin_addr = isaddr; - flag = (itaddr.s_addr == myaddr.s_addr) ? LLE_CREATE : 0; + flags = (itaddr.s_addr == myaddr.s_addr) ? LLE_CREATE : 0; + flags |= LLE_EXCLUSIVE; IF_AFDATA_LOCK(ifp); - lock_owned = 1; - la = lla_lookup(LLTABLE(ifp), flag, (struct sockaddr *)&sin); + la = lla_lookup(LLTABLE(ifp), flags, (struct sockaddr *)&sin); + IF_AFDATA_UNLOCK(ifp); if (la != NULL) { + log(LOG_DEBUG, "in_arpinput: la found\n"); /* the following is not an error when doing bridging */ if (!bridged && la->lle_tbl->llt_ifp != ifp #ifdef DEV_CARP && (ifp->if_type != IFT_CARP || !carp_match) #endif - ) { + ) { if (log_arp_wrong_iface) log(LOG_ERR, "arp: %s is on %s " "but got reply from %*D on %s\n", @@ -579,9 +617,9 @@ match: ifp->if_xname); goto reply; } - - if (la->la_flags & LLE_VALID && + if ((la->la_flags & LLE_VALID) && bcmp(ar_sha(ah), &la->ll_addr, ifp->if_addrlen)) { + log(LOG_DEBUG, "LLE_VALID and match\n"); if (la->la_flags & LLE_STATIC) { log(LOG_ERR, "arp: %*D attempts to modify permanent " @@ -600,6 +638,7 @@ match: ifp->if_xname); } } + if (ifp->if_addrlen != ah->ar_hln) { log(LOG_WARNING, "arp from %*D: addr len: new %d, i/f %d (ignored)", @@ -610,6 +649,7 @@ match: (void)memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen); la->la_flags |= LLE_VALID; + log(LOG_DEBUG, "in_arpinput: la=%p valid set\n", la); if (!(la->la_flags & LLE_STATIC)) { la->la_expire = time_uptime + arpt_keep; callout_reset(&la->la_timer, hz * V_arpt_keep, @@ -618,8 +658,13 @@ match: la->la_asked = 0; la->la_preempt = V_arp_maxtries; if (la->la_hold) { - (*ifp->if_output)(ifp, la->la_hold, L3_ADDR(la), NULL); + m0 = la->la_hold; la->la_hold = 0; + memcpy(&sa, L3_ADDR(la), sizeof(sa)); + LLE_WUNLOCK(la); + + (*ifp->if_output)(ifp, m0, &sa, NULL); + return; } } reply: @@ -636,7 +681,6 @@ reply: goto drop; sin.sin_addr = itaddr; - /* XXX MRT use table 0 for arp reply */ rt = in_rtalloc1((struct sockaddr *)&sin, 0, 0UL, 0); if (!rt) @@ -697,11 +741,8 @@ reply: } } - if (lock_owned != 0) { - IF_AFDATA_UNLOCK(ifp); - lock_owned = 0; - } - + if (la) + LLE_WUNLOCK(la); if (itaddr.s_addr == myaddr.s_addr && IN_LINKLOCAL(ntohl(itaddr.s_addr))) { /* RFC 3927 link-local IPv4; always reply by broadcast. */ @@ -727,8 +768,8 @@ reply: return; drop: - if (lock_owned != 0) - IF_AFDATA_UNLOCK(ifp); + if (la) + LLE_WUNLOCK(la); m_freem(m); } #endif @@ -753,6 +794,7 @@ arp_ifinit(struct ifnet *ifp, struct ifa if (lle == NULL) log(LOG_INFO, "arp_ifinit: cannot create arp " "entry for interface address\n"); + LLE_RUNLOCK(lle); ifa->ifa_rtrequest = NULL; } Modified: projects/arpv2_merge_1/sys/netinet/in.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet/in.c Wed Dec 10 06:01:27 2008 (r185839) @@ -1046,7 +1046,8 @@ in_lltable_new(const struct sockaddr *l3 */ lle->base.la_expire = time_second; /* mark expired */ lle->l3_addr4 = *(const struct sockaddr_in *)l3addr; - + lle->base.lle_refcnt = 1; + LLE_LOCK_INIT(&lle->base); return &lle->base; } @@ -1076,13 +1077,18 @@ in_lltable_rtcheck(struct ifnet *ifp, co log(LOG_INFO, "IPv4 address: \"%s\" is not on the network\n", inet_ntoa(((const struct sockaddr_in *)l3addr)->sin_addr)); if (rt != NULL) - rtfree(rt); - return EINVAL; + RTFREE_LOCKED(rt); + return (EINVAL); } - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } +/* + * Returns NULL if not found or marked for deletion + * if found returns lle read locked + * + */ static struct llentry * in_lltable_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) { @@ -1103,8 +1109,11 @@ in_lltable_lookup(struct lltable *llt, u if (bcmp(L3_ADDR(lle), l3addr, sizeof(struct sockaddr_in)) == 0) break; } - if (lle == NULL) { +#ifdef INVARIANTS + if (flags & LLE_DELETE) + log(LOG_INFO, "interface address is missing from cache = %p in delete\n", lle); +#endif if (!(flags & LLE_CREATE)) return (NULL); /* @@ -1114,12 +1123,12 @@ in_lltable_lookup(struct lltable *llt, u */ if (!(flags & LLE_IFADDR) && in_lltable_rtcheck(ifp, l3addr) != 0) - return NULL; + goto done; lle = in_lltable_new(l3addr, flags); if (lle == NULL) { log(LOG_INFO, "lla_lookup: new lle malloc failed\n"); - return NULL; + goto done; } lle->la_flags = flags & ~LLE_CREATE; if ((flags & (LLE_CREATE | LLE_IFADDR)) == (LLE_CREATE | LLE_IFADDR)) { @@ -1130,11 +1139,23 @@ in_lltable_lookup(struct lltable *llt, u lle->lle_tbl = llt; lle->lle_head = lleh; LIST_INSERT_HEAD(lleh, lle, lle_next); - } else { - if (flags & LLE_DELETE) - lle->la_flags = LLE_DELETED; + } else if (flags & LLE_DELETE) { + LLE_WLOCK(lle); + lle->la_flags = LLE_DELETED; + LLE_WUNLOCK(lle); +#ifdef INVARIANTS + log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); +#endif + lle = NULL; + } + if (lle) { + if (flags & LLE_EXCLUSIVE) + LLE_WLOCK(lle); + else + LLE_RLOCK(lle); } - return lle; +done: + return (lle); } static int Modified: projects/arpv2_merge_1/sys/netinet/ip_output.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/ip_output.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet/ip_output.c Wed Dec 10 06:01:27 2008 (r185839) @@ -567,11 +567,8 @@ passout: * to avoid confusing lower layers. */ m->m_flags &= ~(M_PROTOFLAGS); - - IF_AFDATA_LOCK(ifp); error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, ro->ro_rt); - IF_AFDATA_UNLOCK(ifp); goto done; } @@ -604,10 +601,8 @@ passout: */ m->m_flags &= ~(M_PROTOFLAGS); - IF_AFDATA_LOCK(ifp); error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, ro->ro_rt); - IF_AFDATA_UNLOCK(ifp); } else m_freem(m); } Modified: projects/arpv2_merge_1/sys/netinet6/icmp6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/icmp6.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet6/icmp6.c Wed Dec 10 06:01:27 2008 (r185839) @@ -85,10 +85,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include -#include #include #include @@ -2397,10 +2397,8 @@ icmp6_redirect_input(struct mbuf *m, int } /* RFC 2461 8.3 */ - IF_AFDATA_LOCK(ifp); nd6_cache_lladdr(ifp, &redtgt6, lladdr, lladdrlen, ND_REDIRECT, is_onlink ? ND_REDIRECT_ONLINK : ND_REDIRECT_ROUTER); - IF_AFDATA_UNLOCK(ifp); if (!is_onlink) { /* better router case. perform rtredirect. */ /* perform rtredirect */ @@ -2583,17 +2581,16 @@ icmp6_redirect_output(struct mbuf *m0, s IF_AFDATA_LOCK(ifp); ln = nd6_lookup(router_ll6, 0, ifp); - if (!ln) { - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_UNLOCK(ifp); + if (!ln) goto nolladdropt; - } + len = sizeof(*nd_opt) + ifp->if_addrlen; len = (len + 7) & ~7; /* round by 8 */ /* safety check */ - if (len + (p - (u_char *)ip6) > maxlen) { - IF_AFDATA_UNLOCK(ifp); + if (len + (p - (u_char *)ip6) > maxlen) goto nolladdropt; - } + if (ln->la_flags & LLE_VALID) { nd_opt = (struct nd_opt_hdr *)p; nd_opt->nd_opt_type = ND_OPT_TARGET_LINKADDR; @@ -2602,7 +2599,7 @@ icmp6_redirect_output(struct mbuf *m0, s bcopy(&ln->ll_addr, lladdr, ifp->if_addrlen); p += len; } - IF_AFDATA_UNLOCK(ifp); + LLE_RUNLOCK(ln); } nolladdropt:; Modified: projects/arpv2_merge_1/sys/netinet6/in6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet6/in6.c Wed Dec 10 06:01:27 2008 (r185839) @@ -1143,21 +1143,16 @@ in6_purgeaddr(struct ifaddr *ifa) { struct ifnet *ifp = ifa->ifa_ifp; struct in6_ifaddr *ia = (struct in6_ifaddr *) ifa; - struct llentry *ln = NULL; struct in6_multi_mship *imm; /* stop DAD processing */ nd6_dad_stop(ifa); IF_AFDATA_LOCK(ifp); - ln = lla_lookup(LLTABLE6(ifp), (LLE_DELETE | LLE_IFADDR), + lla_lookup(LLTABLE6(ifp), (LLE_DELETE | LLE_IFADDR), (struct sockaddr *)&ia->ia_addr); - if (ln == NULL) - log(LOG_INFO, "nd6_purgeaddr: interface address is missing from cache\n"); - else - log(LOG_INFO, "nd6_purgeaddr: ifaddr cache = %p is deleted\n", ln); IF_AFDATA_UNLOCK(ifp); - + /* * leave from multicast groups we have joined for the interface */ @@ -1609,13 +1604,14 @@ in6_ifinit(struct ifnet *ifp, struct in6 /* Qing * we need to report rt_newaddrmsg */ - ln = lla_lookup(LLTABLE6(ifp), (LLE_CREATE | LLE_IFADDR), + ln = lla_lookup(LLTABLE6(ifp), (LLE_CREATE | LLE_IFADDR | LLE_EXCLUSIVE), (struct sockaddr *)&ia->ia_addr); + IF_AFDATA_UNLOCK(ifp); if (ln) { ln->la_expire = 0; /* for IPv6 this means permanent */ ln->ln_state = ND6_LLINFO_REACHABLE; + LLE_WUNLOCK(ln); } - IF_AFDATA_UNLOCK(ifp); } return (error); @@ -2119,7 +2115,8 @@ in6_lltable_new(const struct sockaddr *l callout_init(&lle->base.ln_timer_ch, CALLOUT_MPSAFE); lle->l3_addr6 = *(const struct sockaddr_in6 *)l3addr; - + lle->base.lle_refcnt = 1; + LLE_LOCK_INIT(&lle->base); return &lle->base; } @@ -2217,11 +2214,22 @@ in6_lltable_lookup(struct lltable *llt, lle->lle_tbl = llt; lle->lle_head = lleh; LIST_INSERT_HEAD(lleh, lle, lle_next); - } else { - if (flags & LLE_DELETE) - lle->la_flags = LLE_DELETED; + } else if (flags & LLE_DELETE) { + LLE_WLOCK(lle); + lle->la_flags = LLE_DELETED; + LLE_WUNLOCK(lle); +#ifdef INVARIANTS + log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); +#endif + lle = NULL; + } + if (lle) { + if (flags & LLE_EXCLUSIVE) + LLE_WLOCK(lle); + else + LLE_RLOCK(lle); } - return lle; + return (lle); } static int Modified: projects/arpv2_merge_1/sys/netinet6/in6_rmx.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6_rmx.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet6/in6_rmx.c Wed Dec 10 06:01:27 2008 (r185839) @@ -307,7 +307,7 @@ in6_rtqkill(struct radix_node *rn, void err = rtrequest(RTM_DELETE, (struct sockaddr *)rt_key(rt), rt->rt_gateway, rt_mask(rt), - rt->rt_flags, 0); + rt->rt_flags|RTF_RNH_LOCKED, 0); if (err) { log(LOG_WARNING, "in6_rtqkill: error %d", err); } else { Modified: projects/arpv2_merge_1/sys/netinet6/ip6_input.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/ip6_input.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet6/ip6_input.c Wed Dec 10 06:01:27 2008 (r185839) @@ -554,13 +554,14 @@ passin: IF_AFDATA_LOCK(ifp); lle = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&dst6); + IF_AFDATA_UNLOCK(ifp); if ((lle != NULL) && (lle->la_flags & LLE_IFADDR)) { ours = 1; deliverifp = ifp; - IF_AFDATA_UNLOCK(ifp); + LLE_RUNLOCK(lle); goto hbhcheck; } - IF_AFDATA_UNLOCK(ifp); + LLE_RUNLOCK(lle); if (ip6_forward_rt.ro_rt != NULL && (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) != 0 && Modified: projects/arpv2_merge_1/sys/netinet6/ip6_mroute.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/ip6_mroute.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet6/ip6_mroute.c Wed Dec 10 06:01:27 2008 (r185839) @@ -1612,10 +1612,8 @@ phyint_send(struct ip6_hdr *ip6, struct * We just call if_output instead of nd6_output here, since * we need no ND for a multicast forwarded packet...right? */ - IF_AFDATA_LOCK(ifp); error = (*ifp->if_output)(ifp, mb_copy, (struct sockaddr *)&ro.ro_dst, NULL); - IF_AFDATA_UNLOCK(ifp); #ifdef MRT6DEBUG if (V_mrt6debug & DEBUG_XMIT) log(LOG_DEBUG, "phyint_send on mif %d err %d\n", Modified: projects/arpv2_merge_1/sys/netinet6/ip6_output.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/ip6_output.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet6/ip6_output.c Wed Dec 10 06:01:27 2008 (r185839) @@ -949,9 +949,7 @@ passout: ia6->ia_ifa.if_opackets++; ia6->ia_ifa.if_obytes += m->m_pkthdr.len; } - IF_AFDATA_LOCK(ifp); error = nd6_output(ifp, origifp, m, dst, ro->ro_rt); - IF_AFDATA_UNLOCK(ifp); goto done; } @@ -1090,9 +1088,7 @@ sendorfree: ia->ia_ifa.if_opackets++; ia->ia_ifa.if_obytes += m->m_pkthdr.len; } - IF_AFDATA_LOCK(ifp); error = nd6_output(ifp, origifp, m, dst, ro->ro_rt); - IF_AFDATA_UNLOCK(ifp); } else m_freem(m); } Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6.c Wed Dec 10 05:50:07 2008 (r185838) +++ projects/arpv2_merge_1/sys/netinet6/nd6.c Wed Dec 10 06:01:27 2008 (r185839) @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -99,6 +101,11 @@ int nd6_maxqueuelen; int nd6_debug; +/* for debugging? */ +#if 0 +static int nd6_inuse, nd6_allocated; +#endif + struct nd_drhead nd_defrouter; struct nd_prhead nd_prefix; @@ -160,6 +167,13 @@ nd6_init(void) V_dad_ignore_ns = 0; /* ignore NS in DAD - specwise incorrect*/ V_dad_maxtry = 15; /* max # of *tries* to transmit DAD packet */ + /* + * XXX just to get this to compile KMM + */ +#ifdef notyet + V_llinfo_nd6.ln_next = &V_llinfo_nd6; + V_llinfo_nd6.ln_prev = &V_llinfo_nd6; +#endif LIST_INIT(&V_nd_prefix); ip6_use_tempaddr = 0; @@ -422,12 +436,14 @@ skip1: void nd6_llinfo_settimer(struct llentry *ln, long tick) { + LLE_WLOCK(ln); if (tick < 0) { ln->la_expire = 0; ln->ln_ntick = 0; callout_stop(&ln->ln_timer_ch); } else { ln->la_expire = time_second + tick / hz; + LLE_ADDREF(ln); if (tick > INT_MAX) { ln->ln_ntick = tick - INT_MAX; callout_reset(&ln->ln_timer_ch, INT_MAX, @@ -438,6 +454,7 @@ nd6_llinfo_settimer(struct llentry *ln, nd6_llinfo_timer, ln); } } + LLE_WUNLOCK(ln); } static void @@ -460,6 +477,10 @@ nd6_llinfo_timer(void *arg) CURVNET_SET(ifp->if_vnet); INIT_VNET_INET6(curvnet); + /* + * llentry is refcounted - we shouldn't need to protect it + * with IF_AFDATA + */ IF_AFDATA_LOCK(ifp); if (ln->ln_ntick > 0) { @@ -471,7 +492,7 @@ nd6_llinfo_timer(void *arg) nd6_llinfo_settimer(ln, ln->ln_ntick); } IF_AFDATA_UNLOCK(ifp); - return; + goto done; } ndi = ND_IFINFO(ifp); @@ -479,13 +500,13 @@ nd6_llinfo_timer(void *arg) if ((ln->la_flags & LLE_STATIC) || (ln->la_expire > time_second)) { IF_AFDATA_UNLOCK(ifp); - return; + goto done; } if (ln->la_flags & LLE_DELETED) { (void)nd6_free(ln, 0); IF_AFDATA_UNLOCK(ifp); - return; + goto done; } switch (ln->ln_state) { @@ -555,6 +576,8 @@ nd6_llinfo_timer(void *arg) } IF_AFDATA_UNLOCK(ifp); CURVNET_RESTORE(); +done: + LLE_FREE_LOCKED(ln); } @@ -817,8 +840,12 @@ nd6_purge(struct ifnet *ifp) nd6_setdefaultiface(0); if (!V_ip6_forwarding && V_ip6_accept_rtadv) { /* XXX: too restrictive? */ - /* refresh default router list */ + /* refresh default router list + * + * + */ defrouter_select(); + } /* XXXXX @@ -828,44 +855,38 @@ nd6_purge(struct ifnet *ifp) * from if_detach() where everything gets purged. So let * in6_domifdetach() do the actual L2 table purging work. */ -#if 0 - /* - * Nuke neighbor cache entries for the ifp. - * Note that rt->rt_ifp may not be the same as ifp, - * due to KAME goto ours hack. See RTM_RESOLVE case in - * nd6_rtrequest(), and ip6_input(). - */ - IF_AFDATA_LOCK(ifp); - lltable_free(LLTABLE6(ifp)); - IF_AFDATA_UNLOCK(ifp); -#endif } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 07:45:11 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4C271065672; Wed, 10 Dec 2008 07:45:11 +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 AFDB08FC16; Wed, 10 Dec 2008 07:45:11 +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 mBA7jBSj022280; Wed, 10 Dec 2008 07:45:11 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA7jBDd022279; Wed, 10 Dec 2008 07:45:11 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812100745.mBA7jBDd022279@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Dec 2008 07:45:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185841 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 07:45:11 -0000 Author: kmacy Date: Wed Dec 10 07:45:11 2008 New Revision: 185841 URL: http://svn.freebsd.org/changeset/base/185841 Log: we might be renewing the lookup without la_hold set Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 07:14:51 2008 (r185840) +++ projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 07:45:11 2008 (r185841) @@ -325,17 +325,18 @@ retry: } renew = (la->la_asked == 0 || la->la_expire != time_uptime); + + if (renew && ((flags & LLE_EXCLUSIVE) == 0)) { + flags |= LLE_EXCLUSIVE; + LLE_RUNLOCK(la); + goto retry; + } /* * There is an arptab entry, but no ethernet address * response yet. Replace the held mbuf with this * latest one. */ if (m) { - if ((flags & LLE_EXCLUSIVE) == 0) { - flags |= LLE_EXCLUSIVE; - LLE_RUNLOCK(la); - goto retry; - } if (la->la_hold) m_freem(la->la_hold); la->la_hold = m; From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 07:48:28 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93D06106564A; Wed, 10 Dec 2008 07:48:28 +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 7F5DF8FC17; Wed, 10 Dec 2008 07:48: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 mBA7mSC4022368; Wed, 10 Dec 2008 07:48:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA7mSEl022367; Wed, 10 Dec 2008 07:48:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812100748.mBA7mSEl022367@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Dec 2008 07:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185842 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 07:48:28 -0000 Author: kmacy Date: Wed Dec 10 07:48:28 2008 New Revision: 185842 URL: http://svn.freebsd.org/changeset/base/185842 Log: need exclusive for renew OR m Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 07:45:11 2008 (r185841) +++ projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 07:48:28 2008 (r185842) @@ -326,7 +326,7 @@ retry: renew = (la->la_asked == 0 || la->la_expire != time_uptime); - if (renew && ((flags & LLE_EXCLUSIVE) == 0)) { + if ((renew || m) && ((flags & LLE_EXCLUSIVE) == 0)) { flags |= LLE_EXCLUSIVE; LLE_RUNLOCK(la); goto retry; From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 08:01:10 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A83E5106564A; Wed, 10 Dec 2008 08:01:10 +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 93EAA8FC0C; Wed, 10 Dec 2008 08:01:10 +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 mBA81A1g022699; Wed, 10 Dec 2008 08:01:10 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA81AfM022698; Wed, 10 Dec 2008 08:01:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812100801.mBA81AfM022698@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Dec 2008 08:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185843 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 08:01:10 -0000 Author: kmacy Date: Wed Dec 10 08:01:10 2008 New Revision: 185843 URL: http://svn.freebsd.org/changeset/base/185843 Log: remove gratuitous debugging noise Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 07:48:28 2008 (r185842) +++ projects/arpv2_merge_1/sys/netinet/if_ether.c Wed Dec 10 08:01:10 2008 (r185843) @@ -156,7 +156,6 @@ arptimer(void *arg) ifp = lle->lle_tbl->llt_ifp; if ((lle->la_flags & LLE_DELETED) || (time_second >= lle->la_expire)) { - printf("deleting entry\n"); IF_AFDATA_LOCK(ifp); if (!callout_pending(&lle->la_timer) && @@ -256,7 +255,6 @@ arpresolve(struct ifnet *ifp, struct rte u_int flags; int error, renew; - log(LOG_DEBUG, "arpesolve called\n"); *lle = NULL; if (m != NULL) { if (m->m_flags & M_BCAST) { @@ -286,7 +284,6 @@ retry: "arpresolve: can't allocate llinfo for %s\n", inet_ntoa(SIN(dst)->sin_addr)); m_freem(m); - log(LOG_DEBUG, "arpesolve: lla_lookup fail\n"); return (EINVAL); } @@ -305,16 +302,11 @@ retry: la->la_preempt--; } - log(LOG_DEBUG, "arpresolve: success\n"); *lle = la; error = 0; goto done; - } else - log(LOG_DEBUG, - "la=%p valid=%d static=%d expire=%ld uptime=%ld\n", la, - !!(la->la_flags & LLE_VALID), !!(la->la_flags & LLE_STATIC), - la->la_expire, time_uptime); + } if (la->la_flags & LLE_STATIC) { /* should not happen! */ log(LOG_DEBUG, "arpresolve: ouch, empty static llinfo for %s\n", @@ -359,9 +351,6 @@ retry: (rt0->rt_flags & RTF_GATEWAY) ? EHOSTDOWN : EHOSTUNREACH; if (renew) { - log(LOG_DEBUG, - "arpresolve: kicking off new resolve expire=%ld\n", - la->la_expire); LLE_ADDREF(la); la->la_expire = time_uptime; callout_reset(&la->la_timer, hz, arptimer, la); @@ -563,7 +552,6 @@ in_arpinput(struct mbuf *m) if (!bridged || (ia = TAILQ_FIRST(&V_in_ifaddrhead)) == NULL) goto drop; match: - log(LOG_DEBUG,"in_arpinput: match\n"); if (!enaddr) enaddr = (u_int8_t *)IF_LLADDR(ifp); myaddr = ia->ia_addr.sin_addr; @@ -602,7 +590,6 @@ match: la = lla_lookup(LLTABLE(ifp), flags, (struct sockaddr *)&sin); IF_AFDATA_UNLOCK(ifp); if (la != NULL) { - log(LOG_DEBUG, "in_arpinput: la found\n"); /* the following is not an error when doing bridging */ if (!bridged && la->lle_tbl->llt_ifp != ifp #ifdef DEV_CARP @@ -620,7 +607,6 @@ match: } if ((la->la_flags & LLE_VALID) && bcmp(ar_sha(ah), &la->ll_addr, ifp->if_addrlen)) { - log(LOG_DEBUG, "LLE_VALID and match\n"); if (la->la_flags & LLE_STATIC) { log(LOG_ERR, "arp: %*D attempts to modify permanent " @@ -650,7 +636,6 @@ match: (void)memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen); la->la_flags |= LLE_VALID; - log(LOG_DEBUG, "in_arpinput: la=%p valid set\n", la); if (!(la->la_flags & LLE_STATIC)) { la->la_expire = time_uptime + arpt_keep; callout_reset(&la->la_timer, hz * V_arpt_keep, From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 08:28:31 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05EBE1065679; Wed, 10 Dec 2008 08:28:31 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6D858FC24; Wed, 10 Dec 2008 08:28:30 +0000 (UTC) (envelope-from lulf@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 mBA8SUP8023282; Wed, 10 Dec 2008 08:28:30 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA8SUHP023281; Wed, 10 Dec 2008 08:28:30 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812100828.mBA8SUHP023281@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 10 Dec 2008 08:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185846 - projects/gvinum/sys/geom/vinum X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 08:28:31 -0000 Author: lulf Date: Wed Dec 10 08:28:30 2008 New Revision: 185846 URL: http://svn.freebsd.org/changeset/base/185846 Log: - When renaming a gvinum volume, try to destroy and recreate the provider with the new name if the provider is not in use. Suggested by: Rick C. Petty Modified: projects/gvinum/sys/geom/vinum/geom_vinum.c Modified: projects/gvinum/sys/geom/vinum/geom_vinum.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum.c Wed Dec 10 08:23:47 2008 (r185845) +++ projects/gvinum/sys/geom/vinum/geom_vinum.c Wed Dec 10 08:28:30 2008 (r185846) @@ -887,6 +887,17 @@ gv_worker(void *arg) "%s: error code %d", v->name, newname, err); g_free(newname); + /* Destroy and recreate the provider if we can. */ + if (gv_provider_is_open(v->provider)) { + G_VINUM_DEBUG(0, "unable to rename " + "provider to %s: provider in use", + v->name); + break; + } + g_wither_provider(v->provider, ENOENT); + v->provider = NULL; + gv_post_event(sc, GV_EVENT_SETUP_OBJECTS, sc, + NULL, 0, 0); break; case GV_EVENT_RENAME_PLEX: From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 08:29:42 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FEF71065722; Wed, 10 Dec 2008 08:29:42 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CFA38FC14; Wed, 10 Dec 2008 08:29:42 +0000 (UTC) (envelope-from lulf@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 mBA8Tgo6023338; Wed, 10 Dec 2008 08:29:42 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA8TgQx023337; Wed, 10 Dec 2008 08:29:42 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812100829.mBA8TgQx023337@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 10 Dec 2008 08:29:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185847 - projects/gvinum/sys/geom/vinum X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 08:29:42 -0000 Author: lulf Date: Wed Dec 10 08:29:42 2008 New Revision: 185847 URL: http://svn.freebsd.org/changeset/base/185847 Log: - Make style consistent with the rest. Modified: projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Modified: projects/gvinum/sys/geom/vinum/geom_vinum_subr.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Wed Dec 10 08:28:30 2008 (r185846) +++ projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Wed Dec 10 08:29:42 2008 (r185847) @@ -961,7 +961,8 @@ gv_consumer_is_open(struct g_consumer *c } int -gv_provider_is_open(struct g_provider *pp) { +gv_provider_is_open(struct g_provider *pp) +{ if (pp == NULL) return (0); From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 10:12:04 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E91CF1065673; Wed, 10 Dec 2008 10:12:04 +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 D5D288FC13; Wed, 10 Dec 2008 10:12:04 +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 mBAAC4ZI025434; Wed, 10 Dec 2008 10:12:04 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBAAC4iM025422; Wed, 10 Dec 2008 10:12:04 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812101012.mBAAC4iM025422@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Dec 2008 10:12:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185850 - in projects/releng_7_xen: lib/libarchive lib/libc lib/libc/gen lib/libc/i386/sys lib/libc/string lib/libutil share/man/man4 share/man/man5 sys sys/amd64 sys/boot/forth sys/con... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 10:12:05 -0000 Author: kmacy Date: Wed Dec 10 10:12:04 2008 New Revision: 185850 URL: http://svn.freebsd.org/changeset/base/185850 Log: IF_RELENG7 184527:185849 Added: projects/releng_7_xen/lib/libutil/kinfo_getfile.c projects/releng_7_xen/lib/libutil/kinfo_getvmmap.c projects/releng_7_xen/share/man/man5/nullfs.5 Modified: projects/releng_7_xen/lib/libarchive/ (props changed) projects/releng_7_xen/lib/libarchive/archive_read_support_format_iso9660.c projects/releng_7_xen/lib/libarchive/archive_string.c projects/releng_7_xen/lib/libarchive/archive_string.h projects/releng_7_xen/lib/libc/ (props changed) projects/releng_7_xen/lib/libc/gen/times.3 projects/releng_7_xen/lib/libc/i386/sys/pipe.S projects/releng_7_xen/lib/libc/i386/sys/reboot.S projects/releng_7_xen/lib/libc/i386/sys/setlogin.S projects/releng_7_xen/lib/libc/string/ffsll.c (props changed) projects/releng_7_xen/lib/libc/string/flsll.c (props changed) projects/releng_7_xen/lib/libutil/ (props changed) projects/releng_7_xen/lib/libutil/Makefile projects/releng_7_xen/lib/libutil/libutil.h projects/releng_7_xen/share/man/man4/ (props changed) projects/releng_7_xen/share/man/man4/bce.4 projects/releng_7_xen/share/man/man5/ (props changed) projects/releng_7_xen/share/man/man5/Makefile projects/releng_7_xen/share/man/man5/fstab.5 projects/releng_7_xen/sys/ (props changed) projects/releng_7_xen/sys/amd64/Makefile projects/releng_7_xen/sys/boot/forth/loader.conf.5 projects/releng_7_xen/sys/contrib/pf/ (props changed) projects/releng_7_xen/sys/dev/ale/if_ale.c projects/releng_7_xen/sys/dev/bce/if_bce.c projects/releng_7_xen/sys/dev/cxgb/ (props changed) projects/releng_7_xen/sys/dev/cxgb/common/cxgb_ael1002.c projects/releng_7_xen/sys/dev/cxgb/common/cxgb_t3_hw.c projects/releng_7_xen/sys/dev/cxgb/common/cxgb_xgmac.c projects/releng_7_xen/sys/dev/cxgb/cxgb_main.c projects/releng_7_xen/sys/dev/re/if_re.c projects/releng_7_xen/sys/kern/Make.tags.inc projects/releng_7_xen/sys/kern/kern_descrip.c projects/releng_7_xen/sys/kern/kern_proc.c projects/releng_7_xen/sys/kern/vfs_cache.c projects/releng_7_xen/sys/netinet/in_pcb.h projects/releng_7_xen/sys/pci/if_rlreg.h projects/releng_7_xen/sys/sys/sysctl.h projects/releng_7_xen/sys/sys/user.h projects/releng_7_xen/sys/ufs/ufs/ufs_quota.c projects/releng_7_xen/usr.bin/procstat/ (props changed) projects/releng_7_xen/usr.bin/procstat/Makefile projects/releng_7_xen/usr.bin/procstat/procstat_files.c projects/releng_7_xen/usr.bin/procstat/procstat_vm.c projects/releng_7_xen/usr.bin/xargs/ (props changed) projects/releng_7_xen/usr.bin/xargs/xargs.1 projects/releng_7_xen/usr.sbin/ (props changed) projects/releng_7_xen/usr.sbin/mtree/ (props changed) projects/releng_7_xen/usr.sbin/mtree/mtree.c Modified: projects/releng_7_xen/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- projects/releng_7_xen/lib/libarchive/archive_read_support_format_iso9660.c Wed Dec 10 09:21:52 2008 (r185849) +++ projects/releng_7_xen/lib/libarchive/archive_read_support_format_iso9660.c Wed Dec 10 10:12:04 2008 (r185850) @@ -138,6 +138,15 @@ __FBSDID("$FreeBSD$"); #define PVD_reserved4_size 1 #define PVD_application_data_offset (PVD_reserved4_offset + PVD_reserved4_size) #define PVD_application_data_size 512 +#define PVD_reserved5_offset (PVD_application_data_offset + PVD_application_data_size) +#define PVD_reserved5_size (2048 - PVD_reserved5_offset) + +/* TODO: It would make future maintenance easier to just hardcode the + * above values. In particular, ECMA119 states the offsets as part of + * the standard. That would eliminate the need for the following check.*/ +#if PVD_reserved5_offset != 1395 +#error PVD offset and size definitions are wrong. +#endif /* Structure of an on-disk directory record. */ /* Note: ISO9660 stores each multi-byte integer twice, once in @@ -178,17 +187,20 @@ struct file_info { uint64_t size; /* File size in bytes. */ uint64_t ce_offset; /* Offset of CE */ uint64_t ce_size; /* Size of CE */ + time_t birthtime; /* File created time. */ time_t mtime; /* File last modified time. */ time_t atime; /* File last accessed time. */ - time_t ctime; /* File creation time. */ + time_t ctime; /* File attribute change time. */ uint64_t rdev; /* Device number */ mode_t mode; uid_t uid; gid_t gid; ino_t inode; int nlinks; - char *name; /* Null-terminated filename. */ + struct archive_string name; /* Pathname */ + char name_continues; /* Non-zero if name continues */ struct archive_string symlink; + char symlink_continues; /* Non-zero if link continues */ }; @@ -210,6 +222,7 @@ struct iso9660 { uint64_t current_position; ssize_t logical_block_size; + uint64_t volume_size; /* Total size of volume in bytes. */ off_t entry_sparse_offset; int64_t entry_bytes_remaining; @@ -224,7 +237,9 @@ static int archive_read_format_iso9660_r static int archive_read_format_iso9660_read_header(struct archive_read *, struct archive_entry *); static const char *build_pathname(struct archive_string *, struct file_info *); +#if DEBUG static void dump_isodirrec(FILE *, const unsigned char *isodirrec); +#endif static time_t time_from_tm(struct tm *); static time_t isodate17(const unsigned char *); static time_t isodate7(const unsigned char *); @@ -238,6 +253,12 @@ static struct file_info * static void parse_rockridge(struct iso9660 *iso9660, struct file_info *file, const unsigned char *start, const unsigned char *end); +static void parse_rockridge_NM1(struct file_info *, + const unsigned char *, int); +static void parse_rockridge_SL1(struct file_info *, + const unsigned char *, int); +static void parse_rockridge_TF1(struct file_info *, + const unsigned char *, int); static void release_file(struct iso9660 *, struct file_info *); static unsigned toi(const void *p, int n); @@ -314,13 +335,61 @@ static int isPVD(struct iso9660 *iso9660, const unsigned char *h) { struct file_info *file; + int i; - if (h[0] != 1) + /* Type of the Primary Volume Descriptor must be 1. */ + if (h[PVD_type_offset] != 1) return (0); - if (memcmp(h+1, "CD001", 5) != 0) + + /* ID must be "CD001" */ + if (memcmp(h + PVD_id_offset, "CD001", 5) != 0) + return (0); + + /* PVD version must be 1. */ + if (h[PVD_version_offset] != 1) return (0); + /* Reserved field must be 0. */ + if (h[PVD_reserved1_offset] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved2_size; ++i) + if (h[PVD_reserved2_offset + i] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved3_size; ++i) + if (h[PVD_reserved3_offset + i] != 0) + return (0); + + /* Logical block size must be > 0. */ + /* I've looked at Ecma 119 and can't find any stronger + * restriction on this field. */ iso9660->logical_block_size = toi(h + PVD_logical_block_size_offset, 2); + if (iso9660->logical_block_size <= 0) + return (0); + + iso9660->volume_size = iso9660->logical_block_size + * (uint64_t)toi(h + PVD_volume_space_size_offset, 4); + + /* File structure version must be 1 for ISO9660/ECMA119. */ + if (h[PVD_file_structure_version_offset] != 1) + return (0); + + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved4_size; ++i) + if (h[PVD_reserved4_offset + i] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved5_size; ++i) + if (h[PVD_reserved5_offset + i] != 0) + return (0); + + /* XXX TODO: Check other values for sanity; reject more + * malformed PVDs. XXX */ /* Store the root directory in the pending list. */ file = parse_file_info(iso9660, NULL, h + PVD_root_directory_record_offset); @@ -352,12 +421,22 @@ archive_read_format_iso9660_read_header( iso9660->entry_bytes_remaining = file->size; iso9660->entry_sparse_offset = 0; /* Offset for sparse-file-aware clients. */ + if (file->offset + file->size > iso9660->volume_size) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "File is beyond end-of-media: %s", file->name); + iso9660->entry_bytes_remaining = 0; + iso9660->entry_sparse_offset = 0; + release_file(iso9660, file); + return (ARCHIVE_WARN); + } + /* Set up the entry structure with information about this entry. */ archive_entry_set_mode(entry, file->mode); archive_entry_set_uid(entry, file->uid); archive_entry_set_gid(entry, file->gid); archive_entry_set_nlink(entry, file->nlinks); archive_entry_set_ino(entry, file->inode); + /* archive_entry_set_birthtime(entry, file->birthtime, 0); */ archive_entry_set_mtime(entry, file->mtime, 0); archive_entry_set_ctime(entry, file->ctime, 0); archive_entry_set_atime(entry, file->atime, 0); @@ -535,13 +614,7 @@ parse_file_info(struct iso9660 *iso9660, file->mtime = isodate7(isodirrec + DR_date_offset); file->ctime = file->atime = file->mtime; name_len = (size_t)*(const unsigned char *)(isodirrec + DR_name_len_offset); - file->name = (char *)malloc(name_len + 1); - if (file->name == NULL) { - free(file); - return (NULL); - } - memcpy(file->name, isodirrec + DR_name_offset, name_len); - file->name[name_len] = '\0'; + archive_strncpy(&file->name, isodirrec + DR_name_offset, name_len); flags = *(isodirrec + DR_flags_offset); if (flags & 0x02) file->mode = AE_IFDIR | 0700; @@ -561,6 +634,7 @@ parse_file_info(struct iso9660 *iso9660, parse_rockridge(iso9660, file, rr_start, rr_end); } +#if DEBUG /* DEBUGGING: Warn about attributes I don't yet fully support. */ if ((flags & ~0x02) != 0) { fprintf(stderr, "\n ** Unrecognized flag: "); @@ -583,7 +657,7 @@ parse_file_info(struct iso9660 *iso9660, dump_isodirrec(stderr, isodirrec); fprintf(stderr, "\n"); } - +#endif return (file); } @@ -623,6 +697,7 @@ parse_rockridge(struct iso9660 *iso9660, while (p + 4 < end /* Enough space for another entry. */ && p[0] >= 'A' && p[0] <= 'Z' /* Sanity-check 1st char of name. */ && p[1] >= 'A' && p[1] <= 'Z' /* Sanity-check 2nd char of name. */ + && p[2] >= 4 /* Sanity-check length. */ && p + p[2] <= end) { /* Sanity-check length. */ const unsigned char *data = p + 4; int data_length = p[2] - 4; @@ -635,61 +710,54 @@ parse_rockridge(struct iso9660 *iso9660, */ switch(p[0]) { case 'C': - if (p[0] == 'C' && p[1] == 'E' && version == 1) { - /* - * CE extension comprises: - * 8 byte sector containing extension - * 8 byte offset w/in above sector - * 8 byte length of continuation - */ - file->ce_offset = toi(data, 4) - * iso9660->logical_block_size - + toi(data + 8, 4); - file->ce_size = toi(data + 16, 4); + if (p[0] == 'C' && p[1] == 'E') { + if (version == 1 && data_length == 24) { + /* + * CE extension comprises: + * 8 byte sector containing extension + * 8 byte offset w/in above sector + * 8 byte length of continuation + */ + file->ce_offset = (uint64_t)toi(data, 4) + * iso9660->logical_block_size + + toi(data + 8, 4); + file->ce_size = toi(data + 16, 4); + /* If the result is rediculous, + * ignore it. */ + if (file->ce_offset + file->ce_size + > iso9660->volume_size) { + file->ce_offset = 0; + file->ce_size = 0; + } + } break; } /* FALLTHROUGH */ case 'N': - if (p[0] == 'N' && p[1] == 'M' && version == 1 - && *data == 0) { - /* NM extension with flag byte == 0 */ - /* - * NM extension comprises: - * one byte flag - * rest is long name - */ - /* TODO: Obey flags. */ - char *old_name = file->name; - - data++; /* Skip flag byte. */ - data_length--; - file->name = (char *)malloc(data_length + 1); - if (file->name != NULL) { - free(old_name); - memcpy(file->name, data, data_length); - file->name[data_length] = '\0'; - } else - file->name = old_name; + if (p[0] == 'N' && p[1] == 'M') { + if (version == 1) + parse_rockridge_NM1(file, + data, data_length); break; } /* FALLTHROUGH */ case 'P': - if (p[0] == 'P' && p[1] == 'D' && version == 1) { + if (p[0] == 'P' && p[1] == 'D') { /* * PD extension is padding; * contents are always ignored. */ break; } - if (p[0] == 'P' && p[1] == 'N' && version == 1) { - if (data_length == 16) { + if (p[0] == 'P' && p[1] == 'N') { + if (version == 1 && data_length == 16) { file->rdev = toi(data,4); file->rdev <<= 32; file->rdev |= toi(data + 8, 4); } break; } - if (p[0] == 'P' && p[1] == 'X' && version == 1) { + if (p[0] == 'P' && p[1] == 'X') { /* * PX extension comprises: * 8 bytes for mode, @@ -698,12 +766,22 @@ parse_rockridge(struct iso9660 *iso9660, * 8 bytes for gid, * 8 bytes for inode. */ - if (data_length == 32) { - file->mode = toi(data, 4); - file->nlinks = toi(data + 8, 4); - file->uid = toi(data + 16, 4); - file->gid = toi(data + 24, 4); - file->inode = toi(data + 32, 4); + if (version == 1) { + if (data_length >= 8) + file->mode + = toi(data, 4); + if (data_length >= 16) + file->nlinks + = toi(data + 8, 4); + if (data_length >= 24) + file->uid + = toi(data + 16, 4); + if (data_length >= 32) + file->gid + = toi(data + 24, 4); + if (data_length >= 40) + file->inode + = toi(data + 32, 4); } break; } @@ -720,56 +798,14 @@ parse_rockridge(struct iso9660 *iso9660, } /* FALLTHROUGH */ case 'S': - if (p[0] == 'S' && p[1] == 'L' && version == 1 - && *data == 0) { - int cont = 1; - /* SL extension with flags == 0 */ - /* TODO: handle non-zero flag values. */ - data++; /* Skip flag byte. */ - data_length--; - while (data_length > 0) { - unsigned char flag = *data++; - unsigned char nlen = *data++; - data_length -= 2; - - if (cont == 0) - archive_strcat(&file->symlink, "/"); - cont = 0; - - switch(flag) { - case 0x01: /* Continue */ - archive_strncat(&file->symlink, - (const char *)data, nlen); - cont = 1; - break; - case 0x02: /* Current */ - archive_strcat(&file->symlink, "."); - break; - case 0x04: /* Parent */ - archive_strcat(&file->symlink, ".."); - break; - case 0x08: /* Root */ - case 0x10: /* Volume root */ - archive_string_empty(&file->symlink); - break; - case 0x20: /* Hostname */ - archive_strcat(&file->symlink, "hostname"); - break; - case 0: - archive_strncat(&file->symlink, - (const char *)data, nlen); - break; - default: - /* TODO: issue a warning ? */ - break; - } - data += nlen; - data_length -= nlen; - } + if (p[0] == 'S' && p[1] == 'L') { + if (version == 1) + parse_rockridge_SL1(file, + data, data_length); break; } if (p[0] == 'S' && p[1] == 'P' - && version == 1 && data_length == 7 + && version == 1 && data_length == 3 && data[0] == (unsigned char)'\xbe' && data[1] == (unsigned char)'\xef') { /* @@ -805,66 +841,27 @@ parse_rockridge(struct iso9660 *iso9660, return; } case 'T': - if (p[0] == 'T' && p[1] == 'F' && version == 1) { - char flag = data[0]; - /* - * TF extension comprises: - * one byte flag - * create time (optional) - * modify time (optional) - * access time (optional) - * attribute time (optional) - * Time format and presence of fields - * is controlled by flag bits. - */ - data++; - if (flag & 0x80) { - /* Use 17-byte time format. */ - if (flag & 1) /* Create time. */ - data += 17; - if (flag & 2) { /* Modify time. */ - file->mtime = isodate17(data); - data += 17; - } - if (flag & 4) { /* Access time. */ - file->atime = isodate17(data); - data += 17; - } - if (flag & 8) { /* Attribute time. */ - file->ctime = isodate17(data); - data += 17; - } - } else { - /* Use 7-byte time format. */ - if (flag & 1) /* Create time. */ - data += 7; - if (flag & 2) { /* Modify time. */ - file->mtime = isodate7(data); - data += 7; - } - if (flag & 4) { /* Access time. */ - file->atime = isodate7(data); - data += 7; - } - if (flag & 8) { /* Attribute time. */ - file->ctime = isodate7(data); - data += 7; - } - } + if (p[0] == 'T' && p[1] == 'F') { + if (version == 1) + parse_rockridge_TF1(file, + data, data_length); break; } /* FALLTHROUGH */ default: /* The FALLTHROUGHs above leave us here for * any unsupported extension. */ +#if DEBUG { const unsigned char *t; - fprintf(stderr, "\nUnsupported RRIP extension for %s\n", file->name); + fprintf(stderr, "\nUnsupported RRIP extension for %s\n", file->name.s); fprintf(stderr, " %c%c(%d):", p[0], p[1], data_length); for (t = data; t < data + data_length && t < data + 16; t++) fprintf(stderr, " %02x", *t); fprintf(stderr, "\n"); } +#endif + break; } @@ -874,14 +871,222 @@ parse_rockridge(struct iso9660 *iso9660, } static void +parse_rockridge_NM1(struct file_info *file, const unsigned char *data, + int data_length) +{ + if (!file->name_continues) + archive_string_empty(&file->name); + file->name_continues = 0; + if (data_length < 1) + return; + /* + * NM version 1 extension comprises: + * 1 byte flag, value is one of: + * = 0: remainder is name + * = 1: remainder is name, next NM entry continues name + * = 2: "." + * = 4: ".." + * = 32: Implementation specific + * All other values are reserved. + */ + switch(data[0]) { + case 0: + if (data_length < 2) + return; + archive_strncat(&file->name, data + 1, data_length - 1); + break; + case 1: + if (data_length < 2) + return; + archive_strncat(&file->name, data + 1, data_length - 1); + file->name_continues = 1; + break; + case 2: + archive_strcat(&file->name, "."); + break; + case 4: + archive_strcat(&file->name, ".."); + break; + default: + return; + } + +} + +static void +parse_rockridge_TF1(struct file_info *file, const unsigned char *data, + int data_length) +{ + char flag; + /* + * TF extension comprises: + * one byte flag + * create time (optional) + * modify time (optional) + * access time (optional) + * attribute time (optional) + * Time format and presence of fields + * is controlled by flag bits. + */ + if (data_length < 1) + return; + flag = data[0]; + ++data; + --data_length; + if (flag & 0x80) { + /* Use 17-byte time format. */ + if ((flag & 1) && data_length >= 17) { + /* Create time. */ + file->birthtime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 2) && data_length >= 17) { + /* Modify time. */ + file->mtime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 4) && data_length >= 17) { + /* Access time. */ + file->atime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 8) && data_length >= 17) { + /* Attribute change time. */ + file->ctime = isodate17(data); + data += 17; + data_length -= 17; + } + } else { + /* Use 7-byte time format. */ + if ((flag & 1) && data_length >= 7) { + /* Create time. */ + file->birthtime = isodate17(data); + data += 7; + data_length -= 7; + } + if ((flag & 2) && data_length >= 7) { + /* Modify time. */ + file->mtime = isodate7(data); + data += 7; + data_length -= 7; + } + if ((flag & 4) && data_length >= 7) { + /* Access time. */ + file->atime = isodate7(data); + data += 7; + data_length -= 7; + } + if ((flag & 8) && data_length >= 7) { + /* Attribute change time. */ + file->ctime = isodate7(data); + data += 7; + data_length -= 7; + } + } +} + +static void +parse_rockridge_SL1(struct file_info *file, const unsigned char *data, + int data_length) +{ + int component_continues = 1; + + if (!file->symlink_continues) + archive_string_empty(&file->symlink); + else + archive_strcat(&file->symlink, "/"); + file->symlink_continues = 0; + + /* + * Defined flag values: + * 0: This is the last SL record for this symbolic link + * 1: this symbolic link field continues in next SL entry + * All other values are reserved. + */ + if (data_length < 1) + return; + switch(*data) { + case 0: + break; + case 1: + file->symlink_continues = 1; + break; + default: + return; + } + ++data; /* Skip flag byte. */ + --data_length; + + /* + * SL extension body stores "components". + * Basically, this is a complicated way of storing + * a POSIX path. It also interferes with using + * symlinks for storing non-path data. + * + * Each component is 2 bytes (flag and length) + * possibly followed by name data. + */ + while (data_length >= 2) { + unsigned char flag = *data++; + unsigned char nlen = *data++; + data_length -= 2; + + if (!component_continues) + archive_strcat(&file->symlink, "/"); + component_continues = 0; + + switch(flag) { + case 0: /* Usual case, this is text. */ + if (data_length < nlen) + return; + archive_strncat(&file->symlink, + (const char *)data, nlen); + break; + case 0x01: /* Text continues in next component. */ + if (data_length < nlen) + return; + archive_strncat(&file->symlink, + (const char *)data, nlen); + component_continues = 1; + break; + case 0x02: /* Current dir. */ + archive_strcat(&file->symlink, "."); + break; + case 0x04: /* Parent dir. */ + archive_strcat(&file->symlink, ".."); + break; + case 0x08: /* Root of filesystem. */ + archive_string_empty(&file->symlink); + archive_strcat(&file->symlink, "/"); + break; + case 0x10: /* Undefined (historically "volume root" */ + archive_string_empty(&file->symlink); + archive_strcat(&file->symlink, "ROOT"); + break; + case 0x20: /* Undefined (historically "hostname") */ + archive_strcat(&file->symlink, "hostname"); + break; + default: + /* TODO: issue a warning ? */ + return; + } + data += nlen; + data_length -= nlen; + } +} + + +static void release_file(struct iso9660 *iso9660, struct file_info *file) { struct file_info *parent; if (file->refcount == 0) { parent = file->parent; - if (file->name) - free(file->name); + archive_string_free(&file->name); archive_string_free(&file->symlink); free(file); if (parent != NULL) { @@ -906,7 +1111,9 @@ next_entry_seek(struct archive_read *a, /* CE area precedes actual file data? Ignore it. */ if (file->ce_offset > file->offset) { -fprintf(stderr, " *** Discarding CE data.\n"); +#if DEBUG + fprintf(stderr, " *** Discarding CE data.\n"); +#endif file->ce_offset = 0; file->ce_size = 0; } @@ -1071,17 +1278,18 @@ time_from_tm(struct tm *t) static const char * build_pathname(struct archive_string *as, struct file_info *file) { - if (file->parent != NULL && file->parent->name[0] != '\0') { + if (file->parent != NULL && archive_strlen(&file->parent->name) > 0) { build_pathname(as, file->parent); archive_strcat(as, "/"); } - if (file->name[0] == '\0') + if (archive_strlen(&file->name) == 0) archive_strcat(as, "."); else - archive_strcat(as, file->name); + archive_string_concat(as, &file->name); return (as->s); } +#if DEBUG static void dump_isodirrec(FILE *out, const unsigned char *isodirrec) { @@ -1106,3 +1314,4 @@ dump_isodirrec(FILE *out, const unsigned fprintf(out, " `%.*s'", toi(isodirrec + DR_name_len_offset, DR_name_len_size), isodirrec + DR_name_offset); } +#endif Modified: projects/releng_7_xen/lib/libarchive/archive_string.c ============================================================================== --- projects/releng_7_xen/lib/libarchive/archive_string.c Wed Dec 10 09:21:52 2008 (r185849) +++ projects/releng_7_xen/lib/libarchive/archive_string.c Wed Dec 10 10:12:04 2008 (r185850) @@ -70,6 +70,18 @@ __archive_string_copy(struct archive_str } void +__archive_string_concat(struct archive_string *dest, struct archive_string *src) +{ + if (src->length > 0) { + if (__archive_string_ensure(dest, dest->length + src->length + 1) == NULL) + __archive_errx(1, "Out of memory"); + memcpy(dest->s + dest->length, src->s, src->length); + dest->length += src->length; + dest->s[dest->length] = 0; + } +} + +void __archive_string_free(struct archive_string *as) { as->length = 0; Modified: projects/releng_7_xen/lib/libarchive/archive_string.h ============================================================================== --- projects/releng_7_xen/lib/libarchive/archive_string.h Wed Dec 10 09:21:52 2008 (r185849) +++ projects/releng_7_xen/lib/libarchive/archive_string.h Wed Dec 10 10:12:04 2008 (r185850) @@ -92,6 +92,12 @@ __archive_string_copy(struct archive_str #define archive_string_copy(dest, src) \ __archive_string_copy(dest, src) +/* Concatenate one archive_string to another */ +void +__archive_string_concat(struct archive_string *dest, struct archive_string *src); +#define archive_string_concat(dest, src) \ + __archive_string_concat(dest, src) + /* Ensure that the underlying buffer is at least as large as the request. */ struct archive_string * __archive_string_ensure(struct archive_string *, size_t); Modified: projects/releng_7_xen/lib/libc/gen/times.3 ============================================================================== --- projects/releng_7_xen/lib/libc/gen/times.3 Wed Dec 10 09:21:52 2008 (r185849) +++ projects/releng_7_xen/lib/libc/gen/times.3 Wed Dec 10 10:12:04 2008 (r185850) @@ -28,7 +28,7 @@ .\" @(#)times.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 1, 2008 .Dt TIMES 3 .Os .Sh NAME @@ -52,9 +52,13 @@ The .Fn times function returns the value of time in .Dv CLK_TCK Ns 's -of a second since -0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal -Time. +of a second since the system startup time. +The current value of +.Dv CLK_TCK , +the frequency of the statistics clock in ticks per second, may be +obtained through the +.Xr sysconf 3 +interface. .Pp It also fills in the structure pointed to by .Fa tp @@ -131,6 +135,7 @@ and .Xr getrusage 2 , .Xr gettimeofday 2 , .Xr wait 2 , +.Xr sysconf 3 , .Xr clocks 7 .Sh STANDARDS The Modified: projects/releng_7_xen/lib/libc/i386/sys/pipe.S ============================================================================== --- projects/releng_7_xen/lib/libc/i386/sys/pipe.S Wed Dec 10 09:21:52 2008 (r185849) +++ projects/releng_7_xen/lib/libc/i386/sys/pipe.S Wed Dec 10 10:12:04 2008 (r185850) @@ -44,4 +44,5 @@ SYSCALL(pipe) movl %edx,4(%ecx) movl $0,%eax ret -END(pipe) +END(__sys_pipe) + Modified: projects/releng_7_xen/lib/libc/i386/sys/reboot.S ============================================================================== --- projects/releng_7_xen/lib/libc/i386/sys/reboot.S Wed Dec 10 09:21:52 2008 (r185849) +++ projects/releng_7_xen/lib/libc/i386/sys/reboot.S Wed Dec 10 10:12:04 2008 (r185850) @@ -40,4 +40,5 @@ __FBSDID("$FreeBSD$"); SYSCALL(reboot) iret -END(reboot) +END(__sys_reboot) + Modified: projects/releng_7_xen/lib/libc/i386/sys/setlogin.S ============================================================================== --- projects/releng_7_xen/lib/libc/i386/sys/setlogin.S Wed Dec 10 09:21:52 2008 (r185849) +++ projects/releng_7_xen/lib/libc/i386/sys/setlogin.S Wed Dec 10 10:12:04 2008 (r185850) @@ -52,4 +52,4 @@ SYSCALL(setlogin) movl $0,CNAME(_logname_valid) #endif ret /* setlogin(name) */ -END(setlogin) +END(__sys_setlogin) Modified: projects/releng_7_xen/lib/libutil/Makefile ============================================================================== --- projects/releng_7_xen/lib/libutil/Makefile Wed Dec 10 09:21:52 2008 (r185849) +++ projects/releng_7_xen/lib/libutil/Makefile Wed Dec 10 10:12:04 2008 (r185850) @@ -9,7 +9,8 @@ LIB= util SHLIB_MAJOR= 7 SRCS= _secure_path.c auth.c gr_util.c expand_number.c flopen.c fparseln.c \ - humanize_number.c kld.c login.c login_auth.c login_cap.c login_class.c \ + humanize_number.c kinfo_getfile.c kinfo_getvmmap.c kld.c \ + login.c login_auth.c login_cap.c login_class.c \ login_crypt.c login_ok.c login_times.c login_tty.c logout.c \ logwtmp.c pidfile.c property.c pty.c pw_util.c realhostname.c \ stub.c trimdomain.c uucplock.c Added: projects/releng_7_xen/lib/libutil/kinfo_getfile.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/releng_7_xen/lib/libutil/kinfo_getfile.c Wed Dec 10 10:12:04 2008 (r185850) @@ -0,0 +1,72 @@ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "libutil.h" + +struct kinfo_file * +kinfo_getfile(pid_t pid, int *cntp) +{ + int mib[4]; + int error; + int cnt; + size_t len; + char *buf, *bp, *eb; + struct kinfo_file *kif, *kp, *kf; + + len = 0; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_FILEDESC; + mib[3] = pid; + + error = sysctl(mib, 4, NULL, &len, NULL, 0); + if (error) + return (0); + len = len * 4 / 3; + buf = malloc(len); + if (buf == NULL) + return (0); + error = sysctl(mib, 4, buf, &len, NULL, 0); + if (error) { + free(buf); + return (0); + } + /* Pass 1: count items */ + cnt = 0; + bp = buf; + eb = buf + len; + while (bp < eb) { + kf = (struct kinfo_file *)(uintptr_t)bp; + bp += kf->kf_structsize; + cnt++; + } + + kif = calloc(cnt, sizeof(*kif)); + if (kif == NULL) { + free(buf); + return (0); + } + bp = buf; + eb = buf + len; + kp = kif; + /* Pass 2: unpack */ + while (bp < eb) { + kf = (struct kinfo_file *)(uintptr_t)bp; + /* Copy/expand into pre-zeroed buffer */ + memcpy(kp, kf, kf->kf_structsize); + /* Advance to next packed record */ + bp += kf->kf_structsize; + /* Set field size to fixed length, advance */ + kp->kf_structsize = sizeof(*kp); + kp++; + } + free(buf); + *cntp = cnt; + return (kif); /* Caller must free() return value */ +} Added: projects/releng_7_xen/lib/libutil/kinfo_getvmmap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/releng_7_xen/lib/libutil/kinfo_getvmmap.c Wed Dec 10 10:12:04 2008 (r185850) @@ -0,0 +1,72 @@ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "libutil.h" + +struct kinfo_vmentry * +kinfo_getvmmap(pid_t pid, int *cntp) +{ + int mib[4]; + int error; + int cnt; + size_t len; + char *buf, *bp, *eb; + struct kinfo_vmentry *kiv, *kp, *kv; + + len = 0; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_VMMAP; + mib[3] = pid; + + error = sysctl(mib, 4, NULL, &len, NULL, 0); + if (error) + return (0); + len = len * 4 / 3; + buf = malloc(len); + if (buf == NULL) + return (0); + error = sysctl(mib, 4, buf, &len, NULL, 0); + if (error) { + free(buf); + return (0); + } + /* Pass 1: count items */ + cnt = 0; + bp = buf; + eb = buf + len; + while (bp < eb) { + kv = (struct kinfo_vmentry *)(uintptr_t)bp; + bp += kv->kve_structsize; + cnt++; + } + + kiv = calloc(cnt, sizeof(*kiv)); + if (kiv == NULL) { + free(buf); + return (0); + } + bp = buf; + eb = buf + len; + kp = kiv; + /* Pass 2: unpack */ + while (bp < eb) { + kv = (struct kinfo_vmentry *)(uintptr_t)bp; + /* Copy/expand into pre-zeroed buffer */ + memcpy(kp, kv, kv->kve_structsize); + /* Advance to next packed record */ + bp += kv->kve_structsize; + /* Set field size to fixed length, advance */ + kp->kve_structsize = sizeof(*kp); + kp++; + } + free(buf); + *cntp = cnt; + return (kiv); /* Caller must free() return value */ +} Modified: projects/releng_7_xen/lib/libutil/libutil.h ============================================================================== --- projects/releng_7_xen/lib/libutil/libutil.h Wed Dec 10 09:21:52 2008 (r185849) +++ projects/releng_7_xen/lib/libutil/libutil.h Wed Dec 10 10:12:04 2008 (r185850) @@ -64,6 +64,8 @@ struct termios; struct winsize; struct utmp; struct in_addr; +struct kinfo_file; +struct kinfo_vmentry; __BEGIN_DECLS void clean_environment(const char * const *_white, @@ -99,6 +101,10 @@ int realhostname_sa(char *host, size_t h int kld_isloaded(const char *name); int kld_load(const char *name); +struct kinfo_file * + kinfo_getfile(pid_t _pid, int *_cntp); +struct kinfo_vmentry * + kinfo_getvmmap(pid_t _pid, int *_cntp); #ifdef _STDIO_H_ /* avoid adding new includes */ char *fparseln(FILE *, size_t *, size_t *, const char[3], int); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 10:21:54 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88C05106567B; Wed, 10 Dec 2008 10:21:54 +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 76F198FC32; Wed, 10 Dec 2008 10:21:54 +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 mBAALsx6025649; Wed, 10 Dec 2008 10:21:54 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBAALsx5025645; Wed, 10 Dec 2008 10:21:54 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812101021.mBAALsx5025645@svn.freebsd.org> From: Kip Macy Date: Wed, 10 Dec 2008 10:21:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185851 - in projects/releng_7_xen: lib/libarchive/test share/man/man4 sys/dev/ae sys/modules/ae X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 10:21:54 -0000 Author: kmacy Date: Wed Dec 10 10:21:54 2008 New Revision: 185851 URL: http://svn.freebsd.org/changeset/base/185851 Log: push in missed adds Added: projects/releng_7_xen/lib/libarchive/test/test_acl_freebsd.c (contents, props changed) projects/releng_7_xen/share/man/man4/ae.4 (contents, props changed) projects/releng_7_xen/sys/dev/ae/if_ae.c (contents, props changed) projects/releng_7_xen/sys/dev/ae/if_aereg.h (contents, props changed) projects/releng_7_xen/sys/dev/ae/if_aevar.h (contents, props changed) projects/releng_7_xen/sys/modules/ae/Makefile (contents, props changed) Added: projects/releng_7_xen/lib/libarchive/test/test_acl_freebsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/releng_7_xen/lib/libarchive/test/test_acl_freebsd.c Wed Dec 10 10:21:54 2008 (r185851) @@ -0,0 +1,243 @@ +/*- + * Copyright (c) 2003-2008 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$"); + +#if defined(__FreeBSD__) && __FreeBSD__ > 4 +#include + +struct myacl_t { + int type; /* Type of ACL: "access" or "default" */ + int permset; /* Permissions for this class of users. */ + int tag; /* Owner, User, Owning group, group, other, etc. */ + int qual; /* GID or UID of user/group, depending on tag. */ + const char *name; /* Name of user/group, depending on tag. */ +}; + +static struct myacl_t acls2[] = { + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_READ, + ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ, + ARCHIVE_ENTRY_ACL_USER, 77, "user77" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0, + ARCHIVE_ENTRY_ACL_USER, 78, "user78" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ, + ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0007, + ARCHIVE_ENTRY_ACL_GROUP, 78, "group78" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_WRITE | ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_OTHER, -1, "" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_WRITE | ARCHIVE_ENTRY_ACL_READ | ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_MASK, -1, "" }, + { 0, 0, 0, 0, NULL } +}; + +static void +set_acls(struct archive_entry *ae, struct myacl_t *acls) +{ + int i; + + archive_entry_acl_clear(ae); + for (i = 0; acls[i].name != NULL; i++) { + archive_entry_acl_add_entry(ae, + acls[i].type, acls[i].permset, acls[i].tag, acls[i].qual, + acls[i].name); + } +} + +static int +acl_match(acl_entry_t aclent, struct myacl_t *myacl) +{ + acl_tag_t tag_type; + acl_permset_t opaque_ps; + int permset = 0; + + acl_get_tag_type(aclent, &tag_type); + + /* translate the silly opaque permset to a bitmap */ + acl_get_permset(aclent, &opaque_ps); + if (acl_get_perm_np(opaque_ps, ACL_EXECUTE)) + permset |= ARCHIVE_ENTRY_ACL_EXECUTE; + if (acl_get_perm_np(opaque_ps, ACL_WRITE)) + permset |= ARCHIVE_ENTRY_ACL_WRITE; + if (acl_get_perm_np(opaque_ps, ACL_READ)) + permset |= ARCHIVE_ENTRY_ACL_READ; + + if (permset != myacl->permset) + return (0); + + switch (tag_type) { + case ACL_USER_OBJ: + if (myacl->tag != ARCHIVE_ENTRY_ACL_USER_OBJ) return (0); + break; + case ACL_USER: + if (myacl->tag != ARCHIVE_ENTRY_ACL_USER) + return (0); + if ((uid_t)myacl->qual != *(uid_t *)acl_get_qualifier(aclent)) + return (0); + break; + case ACL_GROUP_OBJ: + if (myacl->tag != ARCHIVE_ENTRY_ACL_GROUP_OBJ) return (0); + break; + case ACL_GROUP: + if (myacl->tag != ARCHIVE_ENTRY_ACL_GROUP) + return (0); + if ((gid_t)myacl->qual != *(gid_t *)acl_get_qualifier(aclent)) + return (0); + break; + case ACL_MASK: + if (myacl->tag != ARCHIVE_ENTRY_ACL_MASK) return (0); + break; + case ACL_OTHER: + if (myacl->tag != ARCHIVE_ENTRY_ACL_OTHER) return (0); + break; + } + return (1); +} + +static void +compare_acls(acl_t acl, struct myacl_t *myacls) +{ + int *marker; + int entry_id = ACL_FIRST_ENTRY; + int matched; + int i, n; + acl_entry_t acl_entry; + + /* Count ACL entries in myacls array and allocate an indirect array. */ + for (n = 0; myacls[n].name != NULL; ++n) + continue; + marker = malloc(sizeof(marker[0]) * n); + for (i = 0; i < n; i++) + marker[i] = i; + + /* + * Iterate over acls in system acl object, try to match each + * one with an item in the myacls array. + */ + while (1 == acl_get_entry(acl, entry_id, &acl_entry)) { + /* After the first time... */ + entry_id = ACL_NEXT_ENTRY; + + /* Search for a matching entry (tag and qualifier) */ + for (i = 0, matched = 0; i < n && !matched; i++) { + if (acl_match(acl_entry, &myacls[marker[i]])) { + /* We found a match; remove it. */ + marker[i] = marker[n - 1]; + n--; + matched = 1; + } + } + + /* TODO: Print out more details in this case. */ + failure("ACL entry on file that shouldn't be there"); + assert(matched == 1); + } + + /* Dump entries in the myacls array that weren't in the system acl. */ + for (i = 0; i < n; ++i) { + failure(" ACL entry missing from file: " + "type=%d,permset=%d,tag=%d,qual=%d,name=``%s''\n", + myacls[marker[i]].type, myacls[marker[i]].permset, + myacls[marker[i]].tag, myacls[marker[i]].qual, + myacls[marker[i]].name); + assert(0); /* Record this as a failure. */ + } + free(marker); +} + +#endif + + +/* + * Verify ACL restore-to-disk. This test is FreeBSD-specific. + */ + +DEFINE_TEST(test_acl_freebsd) +{ +#if !defined(__FreeBSD__) + skipping("FreeBSD-specific ACL restore test"); +#elif __FreeBSD__ < 5 + skipping("ACL restore supported only on FreeBSD 5.0 and later"); +#else + struct stat st; + struct archive *a; + struct archive_entry *ae; + int n, fd; + acl_t acl; + + /* + * First, do a quick manual set/read of ACL data to + * verify that the local filesystem does support ACLs. + * If it doesn't, we'll simply skip the remaining tests. + */ + acl = acl_from_text("u::rwx,u:1:rw,g::rwx,g:15:rx,o::rwx,m::rwx"); + assert((void *)acl != NULL); + /* Create a test file and try to set an ACL on it. */ + fd = open("pretest", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + n = -1; + if (assert(fd >= 0)) { + n = acl_set_fd(fd, acl); + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + } + + if (fd < 0 || n != 0) { + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + + /* Create a write-to-disk object. */ + assert(NULL != (a = archive_write_disk_new())); + archive_write_disk_set_options(a, + ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_ACL); + + /* Populate an archive entry with some metadata, including ACL info */ + ae = archive_entry_new(); + assert(ae != NULL); + archive_entry_set_pathname(ae, "test0"); + archive_entry_set_mtime(ae, 123456, 7890); + archive_entry_set_size(ae, 0); + set_acls(ae, acls2); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Close the archive. */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + + /* Verify the data on disk. */ + assertEqualInt(0, stat("test0", &st)); + assertEqualInt(st.st_mtime, 123456); + acl = acl_get_file("test0", ACL_TYPE_ACCESS); + assert(acl != (acl_t)NULL); + compare_acls(acl, acls2); +#endif +} Added: projects/releng_7_xen/share/man/man4/ae.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/releng_7_xen/share/man/man4/ae.4 Wed Dec 10 10:21:54 2008 (r185851) @@ -0,0 +1,153 @@ +.\" Copyright (c) 2008 Stanislav Sedov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 4, 2008 +.Dt AE 4 +.Os +.Sh NAME +.Nm ae +.Nd "Attansic/Atheros L2 FastEthernet controller driver" +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device miibus" +.Cd "device ae" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset -indent +if_ae_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides support for Attansic/Atheros L2 PCIe FastEthernet +controllers. +.Pp +The controller supports hardware Ethernet checksum processing, hardware +VLAN tag stripping/insertion and an interrupt moderation mechanism. +Attansic L2 also features a 64-bit multicast hash filter. +.Pp +The +.Nm +driver supports the following media types: +.Bl -tag -width ".Cm 10baseT/UTP" +.It Cm autoselect +Enable autoselection of the media type and options. +The user can manually override the autoselected mode by +adding media options to +.Xr rc.conf 5 . +.It Cm 10baseT/UTP +Select 10Mbps operation. +.It Cm 100baseTX +Set 100Mbps (FastEthernet) operation. +.El +.Pp +The +.Nm +driver provides support for the following media options: +.Bl -tag -width ".Cm full-duplex" +.It Cm full-duplex +Force full duplex operation. +.It Cm half-duplex +Force half duplex operation. +.El +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports Attansic/Atheros L2 PCIe FastEthernet controllers, and +is known to support the following hardware: +.Pp +.Bl -bullet -compact +.It +ASUS EeePC 701 +.It +ASUS EeePC 900 +.El +.Pp +Other hardware may or may not work with this driver. +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "xxxxxx" +.It Va hw.ae.msi_disable +This tunable disables MSI support on the Ethernet hardware. +The default value is 0. +.El +.Sh SYSCTL VARIABLES +The +.Nm +driver collects a number of useful MAC counter during the work. +The statistics is available via the +.Va dev.ae.%d.stats +.Xr sysctl 8 +tree, where %d corresponds to the controller number. +.Sh DIAGNOSTICS +.Bl -diag +.It "ae%d: watchdog timeout." +The device has stopped responding to the network, or there is a problem with +the network connection (cable). +.It "ae%d: reset timeout." +The card reset operation has been timed out. +.It "ae%d: Generating random ethernet address." +No valid ethernet address was found neither in the controller registers not in +NVRAM. +Random locally administered address with ASUS OUI identifier will be used +instead. +.El +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr miibus 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh BUGS +The Attansic L2 FastEthernet contoller supports DMA but do not use a descriptor +based transfer mechanism via scatter-gather DMA. +Thus the data should be copied to/from the controller memory on each +transmit/receive. +Furthermore, a lot of data alignment restrictions apply. +This may introduce a high CPU load on systems with heavy network activity. +Luckily enough this should not be a problem on modern hardware as L2 does +not support speeds faster than 100Mbps. +.Sh HISTORY +The +.Nm +driver and this manual page was written by +.An Stanislav Sedov +.Aq stas@FreeBSD.org . +It first appeared in +.Fx 7.1 . Added: projects/releng_7_xen/sys/dev/ae/if_ae.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/releng_7_xen/sys/dev/ae/if_ae.c Wed Dec 10 10:21:54 2008 (r185851) @@ -0,0 +1,2223 @@ +/*- + * Copyright (c) 2008 Stanislav Sedov . + * 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 ``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 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. + * + * Driver for Attansic Technology Corp. L2 FastEthernet adapter. + * + * This driver is heavily based on age(4) Attansic L1 driver by Pyun YongHyeon. + */ + +#include +__FBSDID("$FreeBSD$"); + +#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 + +#include + +#include "miibus_if.h" + +#include "if_aereg.h" +#include "if_aevar.h" + +/* + * Devices supported by this driver. + */ +static struct ae_dev { + uint16_t vendorid; + uint16_t deviceid; + const char *name; +} ae_devs[] = { + { VENDORID_ATTANSIC, DEVICEID_ATTANSIC_L2, + "Attansic Technology Corp, L2 FastEthernet" }, +}; +#define AE_DEVS_COUNT (sizeof(ae_devs) / sizeof(*ae_devs)) + +static struct resource_spec ae_res_spec_mem[] = { + { SYS_RES_MEMORY, PCIR_BAR(0), RF_ACTIVE }, + { -1, 0, 0 } +}; +static struct resource_spec ae_res_spec_irq[] = { + { SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0, 0 } +}; +static struct resource_spec ae_res_spec_msi[] = { + { SYS_RES_IRQ, 1, RF_ACTIVE }, + { -1, 0, 0 } +}; + +static int ae_probe(device_t dev); +static int ae_attach(device_t dev); +static void ae_pcie_init(ae_softc_t *sc); +static void ae_phy_reset(ae_softc_t *sc); +static void ae_phy_init(ae_softc_t *sc); +static int ae_reset(ae_softc_t *sc); +static void ae_init(void *arg); +static int ae_init_locked(ae_softc_t *sc); +static unsigned int ae_detach(device_t dev); +static int ae_miibus_readreg(device_t dev, int phy, int reg); +static int ae_miibus_writereg(device_t dev, int phy, int reg, int val); +static void ae_miibus_statchg(device_t dev); +static void ae_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr); +static int ae_mediachange(struct ifnet *ifp); +static void ae_retrieve_address(ae_softc_t *sc); +static void ae_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nsegs, + int error); +static int ae_alloc_rings(ae_softc_t *sc); +static void ae_dma_free(ae_softc_t *sc); +static int ae_shutdown(device_t dev); +static int ae_suspend(device_t dev); +static void ae_powersave_disable(ae_softc_t *sc); +static void ae_powersave_enable(ae_softc_t *sc); +static int ae_resume(device_t dev); +static unsigned int ae_tx_avail_size(ae_softc_t *sc); +static int ae_encap(ae_softc_t *sc, struct mbuf **m_head); +static void ae_start(struct ifnet *ifp); +static void ae_link_task(void *arg, int pending); +static void ae_stop_rxmac(ae_softc_t *sc); +static void ae_stop_txmac(ae_softc_t *sc); +static void ae_tx_task(void *arg, int pending); +static void ae_mac_config(ae_softc_t *sc); +static int ae_intr(void *arg); +static void ae_int_task(void *arg, int pending); +static void ae_tx_intr(ae_softc_t *sc); +static int ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd); +static void ae_rx_intr(ae_softc_t *sc); +static void ae_watchdog(ae_softc_t *sc); +static void ae_tick(void *arg); +static void ae_rxfilter(ae_softc_t *sc); +static void ae_rxvlan(ae_softc_t *sc); +static int ae_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); +static void ae_stop(ae_softc_t *sc); +static int ae_check_eeprom_present(ae_softc_t *sc, int *vpdc); +static int ae_vpd_read_word(ae_softc_t *sc, int reg, uint32_t *word); +static int ae_get_vpd_eaddr(ae_softc_t *sc, uint32_t *eaddr); +static int ae_get_reg_eaddr(ae_softc_t *sc, uint32_t *eaddr); +static void ae_update_stats_rx(uint16_t flags, ae_stats_t *stats); +static void ae_update_stats_tx(uint16_t flags, ae_stats_t *stats); +static void ae_init_tunables(ae_softc_t *sc); + +static device_method_t ae_methods[] = { + /* Device interface. */ + DEVMETHOD(device_probe, ae_probe), + DEVMETHOD(device_attach, ae_attach), + DEVMETHOD(device_detach, ae_detach), + DEVMETHOD(device_shutdown, ae_shutdown), + DEVMETHOD(device_suspend, ae_suspend), + DEVMETHOD(device_resume, ae_resume), + + /* MII interface. */ + DEVMETHOD(miibus_readreg, ae_miibus_readreg), + DEVMETHOD(miibus_writereg, ae_miibus_writereg), + DEVMETHOD(miibus_statchg, ae_miibus_statchg), + + { NULL, NULL } +}; +static driver_t ae_driver = { + "ae", + ae_methods, + sizeof(ae_softc_t) +}; +static devclass_t ae_devclass; + +DRIVER_MODULE(ae, pci, ae_driver, ae_devclass, 0, 0); +DRIVER_MODULE(miibus, ae, miibus_driver, miibus_devclass, 0, 0); +MODULE_DEPEND(ae, pci, 1, 1, 1); +MODULE_DEPEND(ae, ether, 1, 1, 1); +MODULE_DEPEND(ae, miibus, 1, 1, 1); + +/* + * Tunables. + */ +static int msi_disable = 0; +TUNABLE_INT("hw.ae.msi_disable", &msi_disable); + +#define AE_READ_4(sc, reg) \ + bus_read_4((sc)->mem[0], (reg)) +#define AE_READ_2(sc, reg) \ + bus_read_2((sc)->mem[0], (reg)) +#define AE_READ_1(sc, reg) \ + bus_read_1((sc)->mem[0], (reg)) +#define AE_WRITE_4(sc, reg, val) \ + bus_write_4((sc)->mem[0], (reg), (val)) +#define AE_WRITE_2(sc, reg, val) \ + bus_write_2((sc)->mem[0], (reg), (val)) +#define AE_WRITE_1(sc, reg, val) \ + bus_write_1((sc)->mem[0], (reg), (val)) +#define AE_PHY_READ(sc, reg) \ + ae_miibus_readreg(sc->dev, 0, reg) +#define AE_PHY_WRITE(sc, reg, val) \ + ae_miibus_writereg(sc->dev, 0, reg, val) +#define AE_CHECK_EADDR_VALID(eaddr) \ + ((eaddr[0] == 0 && eaddr[1] == 0) || \ + (eaddr[0] == 0xffffffff && eaddr[1] == 0xffff)) +#define AE_RXD_VLAN(vtag) \ + (((vtag) >> 4) | (((vtag) & 0x07) << 13) | (((vtag) & 0x08) << 9)) +#define AE_TXD_VLAN(vtag) \ + (((vtag) << 4) | (((vtag) >> 13) & 0x07) | (((vtag) >> 9) & 0x08)) + +/* + * ae statistics. + */ +#define STATS_ENTRY(node, desc, field) \ + { node, desc, offsetof(struct ae_stats, field) } +struct { + const char *node; + const char *desc; + intptr_t offset; +} ae_stats_tx[] = { + STATS_ENTRY("bcast", "broadcast frames", tx_bcast), + STATS_ENTRY("mcast", "multicast frames", tx_mcast), + STATS_ENTRY("pause", "PAUSE frames", tx_pause), + STATS_ENTRY("control", "control frames", tx_ctrl), + STATS_ENTRY("defers", "deferrals occuried", tx_defer), + STATS_ENTRY("exc_defers", "excessive deferrals occuried", tx_excdefer), + STATS_ENTRY("singlecols", "single collisions occuried", tx_singlecol), + STATS_ENTRY("multicols", "multiple collisions occuried", tx_multicol), + STATS_ENTRY("latecols", "late collisions occuried", tx_latecol), + STATS_ENTRY("aborts", "transmit aborts due collisions", tx_abortcol), + STATS_ENTRY("underruns", "Tx FIFO underruns", tx_underrun) +}, ae_stats_rx[] = { + STATS_ENTRY("bcast", "broadcast frames", rx_bcast), + STATS_ENTRY("mcast", "multicast frames", rx_mcast), + STATS_ENTRY("pause", "PAUSE frames", rx_pause), + STATS_ENTRY("control", "control frames", rx_ctrl), + STATS_ENTRY("crc_errors", "frames with CRC errors", rx_crcerr), + STATS_ENTRY("code_errors", "frames with invalid opcode", rx_codeerr), + STATS_ENTRY("runt", "runt frames", rx_runt), + STATS_ENTRY("frag", "fragmented frames", rx_frag), + STATS_ENTRY("align_errors", "frames with alignment errors", rx_align), + STATS_ENTRY("truncated", "frames truncated due to Rx FIFO inderrun", + rx_trunc) +}; +#define AE_STATS_RX_LEN (sizeof(ae_stats_rx) / sizeof(*ae_stats_rx)) +#define AE_STATS_TX_LEN (sizeof(ae_stats_tx) / sizeof(*ae_stats_tx)) + +static int +ae_probe(device_t dev) +{ + uint16_t deviceid, vendorid; + int i; + + vendorid = pci_get_vendor(dev); + deviceid = pci_get_device(dev); + + /* + * Search through the list of supported devs for matching one. + */ + for (i = 0; i < AE_DEVS_COUNT; i++) { + if (vendorid == ae_devs[i].vendorid && + deviceid == ae_devs[i].deviceid) { + device_set_desc(dev, ae_devs[i].name); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); +} + +static int +ae_attach(device_t dev) +{ + ae_softc_t *sc; + struct ifnet *ifp; + uint8_t chiprev; + uint32_t pcirev; + int nmsi, pmc; + int error; + + sc = device_get_softc(dev); /* Automatically allocated and zeroed + on attach. */ + KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); + sc->dev = dev; + + /* + * Initialize mutexes and tasks. + */ + mtx_init(&sc->mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); + callout_init_mtx(&sc->tick_ch, &sc->mtx, 0); + TASK_INIT(&sc->int_task, 0, ae_int_task, sc); + TASK_INIT(&sc->link_task, 0, ae_link_task, sc); + + pci_enable_busmaster(dev); /* Enable bus mastering. */ + + sc->spec_mem = ae_res_spec_mem; + + /* + * Allocate memory-mapped registers. + */ + error = bus_alloc_resources(dev, sc->spec_mem, sc->mem); + if (error != 0) { + device_printf(dev, "could not allocate memory resources.\n"); + sc->spec_mem = NULL; + goto fail; + } + + /* + * Retrieve PCI and chip revisions. + */ + pcirev = pci_get_revid(dev); + chiprev = (AE_READ_4(sc, AE_MASTER_REG) >> AE_MASTER_REVNUM_SHIFT) & + AE_MASTER_REVNUM_MASK; + if (bootverbose) { + device_printf(dev, "pci device revision: %#04x\n", pcirev); + device_printf(dev, "chip id: %#02x\n", chiprev); + } + nmsi = pci_msi_count(dev); + if (bootverbose) + device_printf(dev, "MSI count: %d.\n", nmsi); + + /* + * Allocate interrupt resources. + */ + if (msi_disable == 0 && nmsi == 1) { + error = pci_alloc_msi(dev, &nmsi); + if (error == 0) { + device_printf(dev, "Using MSI messages.\n"); + sc->spec_irq = ae_res_spec_msi; + error = bus_alloc_resources(dev, sc->spec_irq, sc->irq); + if (error != 0) { + device_printf(dev, "MSI allocation failed.\n"); + sc->spec_irq = NULL; + pci_release_msi(dev); + } else { + sc->flags |= AE_FLAG_MSI; + } + } + } + if (sc->spec_irq == NULL) { + sc->spec_irq = ae_res_spec_irq; + error = bus_alloc_resources(dev, sc->spec_irq, sc->irq); + if (error != 0) { + device_printf(dev, "could not allocate IRQ resources.\n"); + sc->spec_irq = NULL; + goto fail; + } + } + + ae_init_tunables(sc); + + ae_phy_reset(sc); /* Reset PHY. */ + error = ae_reset(sc); /* Reset the controller itself. */ + if (error != 0) + goto fail; + + ae_pcie_init(sc); + + ae_retrieve_address(sc); /* Load MAC address. */ + + error = ae_alloc_rings(sc); /* Allocate ring buffers. */ + if (error != 0) + goto fail; + + /* Set default PHY address. */ + sc->phyaddr = AE_PHYADDR_DEFAULT; + + ifp = sc->ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "could not allocate ifnet structure.\n"); + error = ENXIO; + } + + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = ae_ioctl; + ifp->if_start = ae_start; + ifp->if_init = ae_init; + ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING; + ifp->if_hwassist = 0; + ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); + IFQ_SET_READY(&ifp->if_snd); + if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0) + sc->flags |= AE_FLAG_PMG; + ifp->if_capenable = ifp->if_capabilities; + + /* + * Configure and attach MII bus. + */ + error = mii_phy_probe(dev, &sc->miibus, ae_mediachange, + ae_mediastatus); + if (error != 0) { + device_printf(dev, "no PHY found.\n"); + goto fail; + } + + ether_ifattach(ifp, sc->eaddr); + /* Tell the upper layer(s) we support long frames. */ + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); + + /* + * Create and run all helper tasks. + */ + TASK_INIT(&sc->tx_task, 1, ae_tx_task, ifp); + sc->tq = taskqueue_create_fast("ae_taskq", M_WAITOK, + taskqueue_thread_enqueue, &sc->tq); + if (sc->tq == NULL) { + device_printf(dev, "could not create taskqueue.\n"); + ether_ifdetach(ifp); + error = ENXIO; + goto fail; + } + taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq", + device_get_nameunit(sc->dev)); + + /* + * Configure interrupt handlers. + */ + error = bus_setup_intr(dev, sc->irq[0], INTR_TYPE_NET | INTR_MPSAFE, + ae_intr, NULL, sc, &sc->intrhand); + if (error != 0) { + device_printf(dev, "could not set up interrupt handler.\n"); + taskqueue_free(sc->tq); + sc->tq = NULL; + ether_ifdetach(ifp); + goto fail; + } + +fail: + if (error != 0) + ae_detach(dev); + + return (error); +} + +static void +ae_init_tunables(ae_softc_t *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid *root, *stats, *stats_rx, *stats_tx; + struct ae_stats *ae_stats; + unsigned int i; + + KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); + ae_stats = &sc->stats; + + ctx = device_get_sysctl_ctx(sc->dev); + root = device_get_sysctl_tree(sc->dev); + stats = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(root), OID_AUTO, "stats", + CTLFLAG_RD, NULL, "ae statistics"); + + /* + * Receiver statistcics. + */ + stats_rx = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "rx", + CTLFLAG_RD, NULL, "Rx MAC statistics"); + for (i = 0; i < AE_STATS_RX_LEN; i++) + SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(stats_rx), OID_AUTO, + ae_stats_rx[i].node, CTLFLAG_RD, (char *)ae_stats + + ae_stats_rx[i].offset, 0, ae_stats_rx[i].desc); + + /* + * Receiver statistcics. + */ + stats_tx = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(stats), OID_AUTO, "tx", + CTLFLAG_RD, NULL, "Tx MAC statistics"); + for (i = 0; i < AE_STATS_TX_LEN; i++) + SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(stats_tx), OID_AUTO, + ae_stats_tx[i].node, CTLFLAG_RD, (char *)ae_stats + + ae_stats_tx[i].offset, 0, ae_stats_tx[i].desc); +} + +static void +ae_pcie_init(ae_softc_t *sc) +{ + + AE_WRITE_4(sc, AE_PCIE_LTSSM_TESTMODE_REG, AE_PCIE_LTSSM_TESTMODE_DEFAULT); + AE_WRITE_4(sc, AE_PCIE_DLL_TX_CTRL_REG, AE_PCIE_DLL_TX_CTRL_DEFAULT); +} + +static void +ae_phy_reset(ae_softc_t *sc) +{ + + AE_WRITE_4(sc, AE_PHY_ENABLE_REG, AE_PHY_ENABLE); + DELAY(1000); /* XXX: pause(9) ? */ +} + +static int +ae_reset(ae_softc_t *sc) +{ + int i; + + /* + * Issue a soft reset. + */ + AE_WRITE_4(sc, AE_MASTER_REG, AE_MASTER_SOFT_RESET); + bus_barrier(sc->mem[0], AE_MASTER_REG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + + /* + * Wait for reset to complete. + */ + for (i = 0; i < AE_RESET_TIMEOUT; i++) { + if ((AE_READ_4(sc, AE_MASTER_REG) & AE_MASTER_SOFT_RESET) == 0) + break; + DELAY(10); + } + if (i == AE_RESET_TIMEOUT) { + device_printf(sc->dev, "reset timeout.\n"); + return (ENXIO); + } + + /* + * Wait for everything to enter idle state. + */ + for (i = 0; i < AE_IDLE_TIMEOUT; i++) { + if (AE_READ_4(sc, AE_IDLE_REG) == 0) + break; + DELAY(100); + } + if (i == AE_IDLE_TIMEOUT) { + device_printf(sc->dev, "could not enter idle state.\n"); + return (ENXIO); + } + return (0); +} + +static void +ae_init(void *arg) +{ + ae_softc_t *sc; + + sc = (ae_softc_t *)arg; + AE_LOCK(sc); + ae_init_locked(sc); + AE_UNLOCK(sc); +} + +static void +ae_phy_init(ae_softc_t *sc) +{ + + /* + * Enable link status change interrupt. + * XXX magic numbers. + */ +#ifdef notyet + AE_PHY_WRITE(sc, 18, 0xc00); +#endif +} + +static int +ae_init_locked(ae_softc_t *sc) +{ + struct ifnet *ifp; + struct mii_data *mii; + uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t val; + bus_addr_t addr; + + AE_LOCK_ASSERT(sc); + + ifp = sc->ifp; + mii = device_get_softc(sc->miibus); + + ae_stop(sc); + ae_reset(sc); + ae_pcie_init(sc); /* Initialize PCIE stuff. */ + ae_phy_init(sc); + ae_powersave_disable(sc); + + /* + * Clear and disable interrupts. + */ + AE_WRITE_4(sc, AE_ISR_REG, 0xffffffff); + + /* + * Set the MAC address. + */ + bcopy(IF_LLADDR(ifp), eaddr, ETHER_ADDR_LEN); + val = eaddr[2] << 24 | eaddr[3] << 16 | eaddr[4] << 8 | eaddr[5]; + AE_WRITE_4(sc, AE_EADDR0_REG, val); + val = eaddr[0] << 8 | eaddr[1]; + AE_WRITE_4(sc, AE_EADDR1_REG, val); + + /* + * Set ring buffers base addresses. + */ + addr = sc->dma_rxd_busaddr; + AE_WRITE_4(sc, AE_DESC_ADDR_HI_REG, BUS_ADDR_HI(addr)); + AE_WRITE_4(sc, AE_RXD_ADDR_LO_REG, BUS_ADDR_LO(addr)); + addr = sc->dma_txd_busaddr; + AE_WRITE_4(sc, AE_TXD_ADDR_LO_REG, BUS_ADDR_LO(addr)); + addr = sc->dma_txs_busaddr; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 14:06:09 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D9B81065673; Wed, 10 Dec 2008 14:06:09 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1438B8FC13; Wed, 10 Dec 2008 14:06:09 +0000 (UTC) (envelope-from lulf@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 mBAE692R032216; Wed, 10 Dec 2008 14:06:09 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBAE69EP032215; Wed, 10 Dec 2008 14:06:09 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812101406.mBAE69EP032215@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 10 Dec 2008 14:06:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185859 - projects/gvinum/sys/geom/vinum X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 14:06:09 -0000 Author: lulf Date: Wed Dec 10 14:06:08 2008 New Revision: 185859 URL: http://svn.freebsd.org/changeset/base/185859 Log: - Make it possible to detach a subdisk from a RAID5 plex as long as the plex is not dependant on the subdisk. - While here, make error messages consistent and remove stale comments. Modified: projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Modified: projects/gvinum/sys/geom/vinum/geom_vinum_subr.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Wed Dec 10 13:24:38 2008 (r185858) +++ projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Wed Dec 10 14:06:08 2008 (r185859) @@ -1128,7 +1128,8 @@ gv_attach_plex(struct gv_plex *p, struct g_topology_assert(); if (p->vol_sc != NULL) { - G_VINUM_DEBUG(1, "plex %s already attached", p->name); + G_VINUM_DEBUG(1, "unable to attach %s: already attached to %s", + p->name, p->volume); return (GV_ERR_ISATTACHED); } @@ -1139,20 +1140,16 @@ gv_attach_plex(struct gv_plex *p, struct } /* Attach to volume. Make sure volume is not up and running. */ if (gv_provider_is_open(v->provider)) { - G_VINUM_DEBUG(1, "volume %s is busy, cannot attach %s", - v->name, p->name); + G_VINUM_DEBUG(1, "unable to attach %s: volume %s is busy", + p->name, v->name); return (GV_ERR_ISBUSY); } p->vol_sc = v; strlcpy(p->volume, v->name, sizeof(p->volume)); v->plexcount++; if (rename) { - /* XXX: Check if taken?. */ snprintf(p->name, sizeof(p->name), "%s.p%d", v->name, - v->plexcount - 1); - /* XXX: Rename subdisks? Original vinum does not. */ -/* LIST_FOREACH(s, &p->subdisks, in_plex) - strlcpy(s->plex, newplexname, GV_MAXPLEXNAME);*/ + v->plexcount); } LIST_INSERT_HEAD(&v->plexes, p, in_volume); @@ -1173,7 +1170,8 @@ gv_attach_sd(struct gv_sd *s, struct gv_ /* If subdisk is attached, don't do it. */ if (s->plex_sc != NULL) { - G_VINUM_DEBUG(1, "subdisk %s already attached", s->name); + G_VINUM_DEBUG(1, "unable to attach %s: already attached to %s", + s->name, s->plex); return (GV_ERR_ISATTACHED); } @@ -1199,7 +1197,7 @@ gv_attach_sd(struct gv_sd *s, struct gv_ if (rename) { snprintf(s->name, sizeof(s->name), "%s.s%d", s->plex, - p->sdcount - 1); + p->sdcount); } if (p->vol_sc != NULL) gv_update_vol_size(p->vol_sc, gv_vol_size(p->vol_sc)); @@ -1219,17 +1217,18 @@ gv_detach_plex(struct gv_plex *p, int fl v = p->vol_sc; if (v == NULL) { - G_VINUM_DEBUG(1, "plex %s already detached", p->name); + G_VINUM_DEBUG(1, "unable to detach %s: already detached", + p->name); return (0); /* Not an error. */ } /* * Only proceed if forced or volume inactive. - * XXX: Safe dropout if we're mirrored. */ if (!(flags & GV_FLAG_F) && (gv_provider_is_open(v->provider) || p->state == GV_PLEX_UP)) { - G_VINUM_DEBUG(1, "volume busy"); + G_VINUM_DEBUG(1, "unable to detach %s: volume %s is busy", + p->name, p->volume); return (GV_ERR_ISBUSY); } v->plexcount--; @@ -1253,7 +1252,8 @@ gv_detach_sd(struct gv_sd *s, int flags) p = s->plex_sc; if (p == NULL) { - G_VINUM_DEBUG(1, "subdisk %s already detached", s->name); + G_VINUM_DEBUG(1, "unable to detach %s: already detached", + s->name); return (0); /* Not an error. */ } @@ -1261,9 +1261,12 @@ gv_detach_sd(struct gv_sd *s, int flags) * Don't proceed if we're not forcing, and the plex is up, or degraded * with this subdisk up. */ - if (!(flags & GV_FLAG_F) && ((p->state != GV_PLEX_DOWN) || - ((p->state == GV_PLEX_DEGRADED) && (s->state == GV_SD_UP)))) + if (!(flags & GV_FLAG_F) && ((p->state > GV_PLEX_DEGRADED) || + ((p->state == GV_PLEX_DEGRADED) && (s->state == GV_SD_UP)))) { + G_VINUM_DEBUG(1, "unable to detach %s: plex %s is busy", + s->name, s->plex); return (GV_ERR_ISBUSY); + } LIST_REMOVE(s, in_plex); s->plex_sc = NULL; From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 18:13:30 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C59A1065670; Wed, 10 Dec 2008 18:13:30 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E2408FC1C; Wed, 10 Dec 2008 18:13:30 +0000 (UTC) (envelope-from lulf@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 mBAIDUPr038981; Wed, 10 Dec 2008 18:13:30 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBAIDUfU038980; Wed, 10 Dec 2008 18:13:30 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812101813.mBAIDUfU038980@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 10 Dec 2008 18:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185870 - projects/csup_cvsmode/contrib/csup X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 18:13:30 -0000 Author: lulf Date: Wed Dec 10 18:13:30 2008 New Revision: 185870 URL: http://svn.freebsd.org/changeset/base/185870 Log: - Add missing printout information when appending file. Submitted by: naddy Modified: projects/csup_cvsmode/contrib/csup/updater.c Modified: projects/csup_cvsmode/contrib/csup/updater.c ============================================================================== --- projects/csup_cvsmode/contrib/csup/updater.c Wed Dec 10 17:20:39 2008 (r185869) +++ projects/csup_cvsmode/contrib/csup/updater.c Wed Dec 10 18:13:30 2008 (r185870) @@ -813,6 +813,7 @@ updater_docoll(struct updater *up, struc if (sr->sr_serverattr == NULL) return (UPDATER_ERR_PROTO); position = strtol(pos, NULL, 10); + lprintf(1, " Append to %s\n", name); error = updater_append_file(up, fup, position); if (error) return (error); From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 02:47:43 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E7121065672; Thu, 11 Dec 2008 02:47:43 +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 297518FC08; Thu, 11 Dec 2008 02:47:43 +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 mBB2lgbZ051221; Thu, 11 Dec 2008 02:47:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBB2lgJP051204; Thu, 11 Dec 2008 02:47:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812110247.mBB2lgJP051204@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 02:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185905 - in projects/arpv2_merge_1/sys: net netinet netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 02:47:43 -0000 Author: kmacy Date: Thu Dec 11 02:47:41 2008 New Revision: 185905 URL: http://svn.freebsd.org/changeset/base/185905 Log: Remove all vestiges of cloning: - the flags: RTF_CLONING, RTF_LLINFO, RTF_WASCLONED - routines only used to cleanup children of a cloning route Modified: projects/arpv2_merge_1/sys/net/radix_mpath.c projects/arpv2_merge_1/sys/net/route.c projects/arpv2_merge_1/sys/net/route.h projects/arpv2_merge_1/sys/net/rtsock.c projects/arpv2_merge_1/sys/netinet/in.c projects/arpv2_merge_1/sys/netinet/in_mcast.c projects/arpv2_merge_1/sys/netinet/in_pcb.c projects/arpv2_merge_1/sys/netinet/in_rmx.c projects/arpv2_merge_1/sys/netinet/ip_fastfwd.c projects/arpv2_merge_1/sys/netinet/ip_input.c projects/arpv2_merge_1/sys/netinet/tcp_subr.c projects/arpv2_merge_1/sys/netinet6/in6.c projects/arpv2_merge_1/sys/netinet6/in6_rmx.c projects/arpv2_merge_1/sys/netinet6/in6_src.c projects/arpv2_merge_1/sys/netinet6/ip6_output.c projects/arpv2_merge_1/sys/netinet6/ip6_var.h projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c Modified: projects/arpv2_merge_1/sys/net/radix_mpath.c ============================================================================== --- projects/arpv2_merge_1/sys/net/radix_mpath.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/net/radix_mpath.c Thu Dec 11 02:47:41 2008 (r185905) @@ -266,8 +266,8 @@ rtalloc_mpath_fib(struct route *ro, u_in * be done for sendto(3) case? */ if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP)) - return; /* XXX */ - ro->ro_rt = rtalloc1_fib(&ro->ro_dst, 1, RTF_CLONING, fibnum); + return; + ro->ro_rt = rtalloc1_fib(&ro->ro_dst, 1, 0, fibnum); /* if the route does not exist or it is not multipath, don't care */ if (ro->ro_rt == NULL) Modified: projects/arpv2_merge_1/sys/net/route.c ============================================================================== --- projects/arpv2_merge_1/sys/net/route.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/net/route.c Thu Dec 11 02:47:41 2008 (r185905) @@ -271,8 +271,7 @@ rtalloc1_fib(struct sockaddr *dst, int r struct radix_node *rn; struct rtentry *newrt; struct rt_addrinfo info; - u_long nflags; - int needresolve = 0, err = 0, msgtype = RTM_MISS; + int err = 0, msgtype = RTM_MISS; int needlock; KASSERT((fibnum < rt_numfibs), ("rtalloc1_fib: bad fibnum")); @@ -285,10 +284,9 @@ rtalloc1_fib(struct sockaddr *dst, int r */ if (rnh == NULL) { V_rtstat.rts_unreach++; - goto miss2; + goto miss; } needlock = !(ignflags & RTF_RNH_LOCKED); -retry: if (needlock) RADIX_NODE_HEAD_RLOCK(rnh); #ifdef INVARIANTS @@ -297,103 +295,33 @@ retry: #endif rn = rnh->rnh_matchaddr(dst, rnh); if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { - newrt = rt = RNTORT(rn); - nflags = rt->rt_flags & ~ignflags; - if (report && (nflags & RTF_CLONING)) { - if (needlock && !RADIX_NODE_HEAD_LOCK_TRY_UPGRADE(rnh)) { - RADIX_NODE_HEAD_RUNLOCK(rnh); - RADIX_NODE_HEAD_LOCK(rnh); - /* - * lookup again to make sure it wasn't changed - */ - rn = rnh->rnh_matchaddr(dst, rnh); - if (!(rn && ((rn->rn_flags & RNF_ROOT) == 0))) { - RADIX_NODE_HEAD_UNLOCK(rnh); - needresolve = 0; - log(LOG_INFO, "retrying route lookup ...\n"); - goto retry; - } - } - needresolve = 1; - } else { - RT_LOCK(newrt); - RT_ADDREF(newrt); - if (needlock) - RADIX_NODE_HEAD_RUNLOCK(rnh); - goto done; - } - } - /* - * if needresolve is set then we have the exclusive lock - * and we need to keep it held for the benefit of rtrequest_fib - */ - if (!needresolve && needlock) - RADIX_NODE_HEAD_RUNLOCK(rnh); - - if (needresolve) { - RADIX_NODE_HEAD_WLOCK_ASSERT(rnh); - /* - * We are apparently adding (report = 0 in delete). - * If it requires that it be cloned, do so. - * (This implies it wasn't a HOST route.) - */ - err = rtrequest_fib(RTM_RESOLVE, dst, NULL, - NULL, RTF_RNH_LOCKED, &newrt, fibnum); - if (err) { - /* - * If the cloning didn't succeed, maybe - * what we have will do. Return that. - */ - newrt = rt; /* existing route */ - RT_LOCK(newrt); - RT_ADDREF(newrt); - goto miss; - } - KASSERT(newrt, ("no route and no error")); RT_LOCK(newrt); - if (newrt->rt_flags & RTF_XRESOLVE) { - /* - * If the new route specifies it be - * externally resolved, then go do that. - */ - msgtype = RTM_RESOLVE; - goto miss; - } - /* Inform listeners of the new route. */ - bzero(&info, sizeof(info)); - info.rti_info[RTAX_DST] = rt_key(newrt); - info.rti_info[RTAX_NETMASK] = rt_mask(newrt); - info.rti_info[RTAX_GATEWAY] = newrt->rt_gateway; - if (newrt->rt_ifp != NULL) { - info.rti_info[RTAX_IFP] = - newrt->rt_ifp->if_addr->ifa_addr; - info.rti_info[RTAX_IFA] = newrt->rt_ifa->ifa_addr; - } - rt_missmsg(RTM_ADD, &info, newrt->rt_flags, 0); + RT_ADDREF(newrt); if (needlock) - RADIX_NODE_HEAD_UNLOCK(rnh); - } else { - /* - * Either we hit the root or couldn't find any match, - * Which basically means - * "caint get there frm here" + RADIX_NODE_HEAD_RUNLOCK(rnh); + goto done; + + } else if (needlock) + RADIX_NODE_HEAD_RUNLOCK(rnh); + + /* + * Either we hit the root or couldn't find any match, + * Which basically means + * "caint get there frm here" + */ + V_rtstat.rts_unreach++; +miss: + if (report) { + /* + * If required, report the failure to the supervising + * Authorities. + * For a delete, this is not an error. (report == 0) */ - V_rtstat.rts_unreach++; - miss: - if (needlock && needresolve) - RADIX_NODE_HEAD_UNLOCK(rnh); - miss2: if (report) { - /* - * If required, report the failure to the supervising - * Authorities. - * For a delete, this is not an error. (report == 0) - */ - bzero(&info, sizeof(info)); - info.rti_info[RTAX_DST] = dst; - rt_missmsg(msgtype, &info, 0, err); - } - } + bzero(&info, sizeof(info)); + info.rti_info[RTAX_DST] = dst; + rt_missmsg(msgtype, &info, 0, err); + } done: if (newrt) RT_LOCK_ASSERT(newrt); @@ -717,14 +645,6 @@ ifa_ifwithroute_fib(int flags, struct so return (ifa); } -static walktree_f_t rt_fixdelete; -static walktree_f_t rt_fixchange; - -struct rtfc_arg { - struct rtentry *rt0; - struct radix_node_head *rnh; -}; - /* * Do appropriate manipulations of a routing tree given * all the bits of info needed @@ -865,14 +785,6 @@ rtexpunge(struct rtentry *rt) rt->rt_flags &= ~RTF_UP; /* - * Now search what's left of the subtree for any cloned - * routes which might have been formed from this node. - */ - if ((rt->rt_flags & RTF_CLONING) && rt_mask(rt)) - rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), - rt_fixdelete, rt); - - /* * Remove any external references we may have. * This might result in another rtentry being freed if * we held its last reference. @@ -943,10 +855,9 @@ rtrequest1_fib(int req, struct rt_addrin * If we are adding a host route then we don't want to put * a netmask in the tree, nor do we want to clone it. */ - if (flags & RTF_HOST) { + if (flags & RTF_HOST) netmask = NULL; - flags &= ~RTF_CLONING; - } + switch (req) { case RTM_DELETE: #ifdef RADIX_MPATH @@ -1025,16 +936,6 @@ normal_rtdel: rt->rt_flags &= ~RTF_UP; /* - * Now search what's left of the subtree for any cloned - * routes which might have been formed from this node. - */ - if ((rt->rt_flags & RTF_CLONING) && - rt_mask(rt)) { - rnh->rnh_walktree_from(rnh, dst, rt_mask(rt), - rt_fixdelete, rt); - } - - /* * Remove any external references we may have. * This might result in another rtentry being freed if * we held its last reference. @@ -1071,20 +972,12 @@ deldone: } else RTFREE_LOCKED(rt); break; - case RTM_RESOLVE: - if (ret_nrt == NULL || (rt = *ret_nrt) == NULL) - senderr(EINVAL); - ifa = rt->rt_ifa; - /* XXX locking? */ - flags = rt->rt_flags & - ~(RTF_CLONING | RTF_STATIC); - flags |= RTF_WASCLONED; - gateway = rt->rt_gateway; - if ((netmask = rt->rt_genmask) == NULL) - flags |= RTF_HOST; - goto makeroute; - + /* + * resolve is only used for route cloning + * + */ + senderr(EINVAL); case RTM_ADD: if ((flags & RTF_GATEWAY) && !gateway) senderr(EINVAL); @@ -1095,8 +988,6 @@ deldone: if (info->rti_ifa == NULL && (error = rt_getifa_fib(info, fibnum))) senderr(error); ifa = info->rti_ifa; - - makeroute: rt = uma_zalloc(rtzone, M_NOWAIT | M_ZERO); if (rt == NULL) senderr(ENOBUFS); @@ -1154,26 +1045,6 @@ deldone: /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); - if (rn == NULL) { - struct rtentry *rt2; - /* - * Uh-oh, we already have one of these in the tree. - * We do a special hack: if the route that's already - * there was generated by the cloning mechanism - * then we just blow it away and retry the insertion - * of the new one. - */ - rt2 = rtalloc1_fib(dst, 0, 0, fibnum); - if (rt2 && rt2->rt_parent) { - rtexpunge(rt2); - RT_UNLOCK(rt2); - rn = rnh->rnh_addaddr(ndst, netmask, - rnh, rt->rt_nodes); - } else if (rt2) { - /* undo the extra ref we got */ - RTFREE_LOCKED(rt2); - } - } /* * If it still failed to go into the tree, @@ -1191,32 +1062,6 @@ deldone: } rt->rt_parent = NULL; - - /* - * If we got here from RESOLVE, then we are cloning - * so clone the rest, and note that we - * are a clone (and increment the parent's references) - */ - if (req == RTM_RESOLVE) { - KASSERT(ret_nrt && *ret_nrt, - ("no route to clone from")); - rt->rt_rmx = (*ret_nrt)->rt_rmx; /* copy metrics */ - rt->rt_rmx.rmx_pksent = 0; /* reset packet counter */ - if ((*ret_nrt)->rt_flags & RTF_CLONING) { - /* - * NB: We do not bump the refcnt on the parent - * entry under the assumption that it will - * remain so long as we do. This is - * important when deleting the parent route - * as this operation requires traversing - * the tree to delete all clones and futzing - * with refcnts requires us to double-lock - * parent through this back reference. - */ - rt->rt_parent = *ret_nrt; - } - } - /* * If this protocol has something to add to this then * allow it to do that as well. @@ -1225,20 +1070,6 @@ deldone: ifa->ifa_rtrequest(req, rt, info); /* - * We repeat the same procedure from rt_setgate() here because - * it doesn't fire when we call it there because the node - * hasn't been added to the tree yet. - */ - if (req == RTM_ADD && - !(rt->rt_flags & RTF_HOST) && rt_mask(rt) != NULL) { - struct rtfc_arg arg; - arg.rnh = rnh; - arg.rt0 = rt; - rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), - rt_fixchange, &arg); - } - - /* * actually return a resultant rtentry and * give the caller a single reference. */ @@ -1265,90 +1096,6 @@ bad: #undef ifpaddr #undef flags -/* - * Called from rtrequest(RTM_DELETE, ...) to fix up the route's ``family'' - * (i.e., the routes related to it by the operation of cloning). This - * routine is iterated over all potential former-child-routes by way of - * rnh->rnh_walktree_from() above, and those that actually are children of - * the late parent (passed in as VP here) are themselves deleted. - */ -static int -rt_fixdelete(struct radix_node *rn, void *vp) -{ - struct rtentry *rt = RNTORT(rn); - struct rtentry *rt0 = vp; - - if (rt->rt_parent == rt0 && - !(rt->rt_flags & (RTF_PINNED | RTF_CLONING))) { - return rtrequest_fib(RTM_DELETE, rt_key(rt), NULL, rt_mask(rt), - rt->rt_flags|RTF_RNH_LOCKED, NULL, rt->rt_fibnum); - } - return 0; -} - -/* - * This routine is called from rt_setgate() to do the analogous thing for - * adds and changes. There is the added complication in this case of a - * middle insert; i.e., insertion of a new network route between an older - * network route and (cloned) host routes. For this reason, a simple check - * of rt->rt_parent is insufficient; each candidate route must be tested - * against the (mask, value) of the new route (passed as before in vp) - * to see if the new route matches it. - * - * XXX - it may be possible to do fixdelete() for changes and reserve this - * routine just for adds. I'm not sure why I thought it was necessary to do - * changes this way. - */ - -static int -rt_fixchange(struct radix_node *rn, void *vp) -{ - struct rtentry *rt = RNTORT(rn); - struct rtfc_arg *ap = vp; - struct rtentry *rt0 = ap->rt0; - struct radix_node_head *rnh = ap->rnh; - u_char *xk1, *xm1, *xk2, *xmp; - int i, len, mlen; - - /* make sure we have a parent, and route is not pinned or cloning */ - if (!rt->rt_parent || - (rt->rt_flags & (RTF_PINNED | RTF_CLONING))) - return 0; - - if (rt->rt_parent == rt0) /* parent match */ - goto delete_rt; - /* - * There probably is a function somewhere which does this... - * if not, there should be. - */ - len = imin(rt_key(rt0)->sa_len, rt_key(rt)->sa_len); - - xk1 = (u_char *)rt_key(rt0); - xm1 = (u_char *)rt_mask(rt0); - xk2 = (u_char *)rt_key(rt); - - /* avoid applying a less specific route */ - xmp = (u_char *)rt_mask(rt->rt_parent); - mlen = rt_key(rt->rt_parent)->sa_len; - if (mlen > rt_key(rt0)->sa_len) /* less specific route */ - return 0; - for (i = rnh->rnh_treetop->rn_offset; i < mlen; i++) - if ((xmp[i] & ~(xmp[i] ^ xm1[i])) != xmp[i]) - return 0; /* less specific route */ - - for (i = rnh->rnh_treetop->rn_offset; i < len; i++) - if ((xk2[i] & xm1[i]) != xk1[i]) - return 0; /* no match */ - - /* - * OK, this node is a clone, and matches the node currently being - * changed/added under the node's mask. So, get rid of it. - */ -delete_rt: - return rtrequest_fib(RTM_DELETE, rt_key(rt), NULL, - rt_mask(rt), rt->rt_flags, NULL, rt->rt_fibnum); -} - int rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate) { @@ -1363,24 +1110,6 @@ again: RADIX_NODE_HEAD_LOCK_ASSERT(rnh); /* - * A host route with the destination equal to the gateway - * will interfere with keeping LLINFO in the routing - * table, so disallow it. - */ - if (((rt->rt_flags & (RTF_HOST|RTF_GATEWAY|RTF_LLINFO)) == - (RTF_HOST|RTF_GATEWAY)) && - dst->sa_len == gate->sa_len && - bcmp(dst, gate, dst->sa_len) == 0) { - /* - * The route might already exist if this is an RTM_CHANGE - * or a routing redirect, so try to delete it. - */ - if (rt_key(rt)) - rtexpunge(rt); - return EADDRNOTAVAIL; - } - - /* * Cloning loop avoidance in case of bad configuration. */ if (rt->rt_flags & RTF_GATEWAY) { @@ -1448,21 +1177,7 @@ again: */ bcopy(gate, rt->rt_gateway, glen); - /* - * This isn't going to do anything useful for host routes, so - * don't bother. Also make sure we have a reasonable mask - * (we don't yet have one during adds). - */ - if (!(rt->rt_flags & RTF_HOST) && rt_mask(rt) != 0) { - struct rtfc_arg arg; - - arg.rnh = rnh; - arg.rt0 = rt; - rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), - rt_fixchange, &arg); - } - - return 0; + return (0); } static void Modified: projects/arpv2_merge_1/sys/net/route.h ============================================================================== --- projects/arpv2_merge_1/sys/net/route.h Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/net/route.h Thu Dec 11 02:47:41 2008 (r185905) @@ -143,7 +143,7 @@ struct rtentry { struct sockaddr *rt_genmask; /* for generation of cloned routes */ caddr_t rt_llinfo; /* pointer to link level info cache */ struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ - struct rtentry *rt_parent; /* cloning parent of this route */ + struct rtentry *rt_parent; /* cloning parent - UNUSED */ u_int rt_fibnum; /* which FIB */ #ifdef _KERNEL /* XXX ugly, user apps use this definition but don't have a mtx def */ @@ -175,9 +175,9 @@ struct ortentry { #define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ #define RTF_DONE 0x40 /* message confirmed */ /* 0x80 unused, was RTF_DELCLONE */ -#define RTF_CLONING 0x100 /* generate new routes on use */ +/* 0x100 unused, was RTF_CLONING */ #define RTF_XRESOLVE 0x200 /* external daemon resolves name */ -#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */ +/* 0x400 unused, was RTF_LLINFO */ #define RTF_STATIC 0x800 /* manually added */ #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ #define RTF_PROTO2 0x4000 /* protocol specific routing flag */ @@ -188,7 +188,7 @@ struct ortentry { #define RTF_PRCLONING 0x10000 /* unused, for compatibility */ #endif -#define RTF_WASCLONED 0x20000 /* route generated through cloning */ +/* 0x20000 unused, was RTF_WASCLONED */ #define RTF_PROTO3 0x40000 /* protocol specific routing flag */ /* 0x80000 unused */ #define RTF_PINNED 0x100000 /* future use */ Modified: projects/arpv2_merge_1/sys/net/rtsock.c ============================================================================== --- projects/arpv2_merge_1/sys/net/rtsock.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/net/rtsock.c Thu Dec 11 02:47:41 2008 (r185905) @@ -703,8 +703,7 @@ route_output(struct mbuf *m, struct sock RT_UNLOCK(rt); senderr(error); } - if (!(rt->rt_flags & RTF_LLINFO)) - rt->rt_flags |= RTF_GATEWAY; + rt->rt_flags |= RTF_GATEWAY; } if (info.rti_ifa != NULL && info.rti_ifa != rt->rt_ifa) { @@ -1447,7 +1446,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) /* * take care of llinfo entries */ - if (w.w_op == NET_RT_FLAGS && (RTF_LLINFO & w.w_arg)) + if (w.w_op == NET_RT_FLAGS) error = lltable_sysctl_dumparp(af, w.w_req); break; Modified: projects/arpv2_merge_1/sys/netinet/in.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/in.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1218,7 +1218,7 @@ in_lltable_dump(struct lltable *llt, str } arpc.rtm.rtm_rmx.rmx_expire = lle->la_flags & LLE_STATIC ? 0 : lle->la_expire; - arpc.rtm.rtm_flags |= RTF_LLINFO | RTF_HOST; + arpc.rtm.rtm_flags |= RTF_HOST; if (lle->la_flags & LLE_STATIC) arpc.rtm.rtm_flags |= RTF_STATIC; arpc.rtm.rtm_index = ifp->if_index; Modified: projects/arpv2_merge_1/sys/netinet/in_mcast.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in_mcast.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/in_mcast.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1036,7 +1036,7 @@ inp_join_group(struct inpcb *inp, struct ro.ro_rt = NULL; *(struct sockaddr_in *)&ro.ro_dst = gsa->sin; - in_rtalloc_ign(&ro, RTF_CLONING, + in_rtalloc_ign(&ro, 0, inp->inp_inc.inc_fibnum); if (ro.ro_rt != NULL) { ifp = ro.ro_rt->rt_ifp; Modified: projects/arpv2_merge_1/sys/netinet/in_pcb.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in_pcb.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/in_pcb.c Thu Dec 11 02:47:41 2008 (r185905) @@ -572,7 +572,7 @@ in_pcbladdr(struct inpcb *inp, struct in * Find out route to destination. */ if ((inp->inp_socket->so_options & SO_DONTROUTE) == 0) - in_rtalloc_ign(&sro, RTF_CLONING, inp->inp_inc.inc_fibnum); + in_rtalloc_ign(&sro, 0, inp->inp_inc.inc_fibnum); /* * If we found a route, use the address corresponding to Modified: projects/arpv2_merge_1/sys/netinet/in_rmx.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in_rmx.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/in_rmx.c Thu Dec 11 02:47:41 2008 (r185905) @@ -75,7 +75,6 @@ in_addroute(void *v_arg, void *n_arg, st { struct rtentry *rt = (struct rtentry *)treenodes; struct sockaddr_in *sin = (struct sockaddr_in *)rt_key(rt); - struct radix_node *ret; /* * A little bit of help for both IP output and input: @@ -106,31 +105,7 @@ in_addroute(void *v_arg, void *n_arg, st if (!rt->rt_rmx.rmx_mtu && rt->rt_ifp) rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; - ret = rn_addroute(v_arg, n_arg, head, treenodes); - if (ret == NULL && rt->rt_flags & RTF_HOST) { - struct rtentry *rt2; - /* - * We are trying to add a host route, but can't. - * Find out if it is because of an - * ARP entry and delete it if so. - */ - rt2 = in_rtalloc1((struct sockaddr *)sin, 0, - RTF_CLONING, rt->rt_fibnum); - if (rt2) { - if (rt2->rt_flags & RTF_LLINFO && - rt2->rt_flags & RTF_HOST && - rt2->rt_gateway && - rt2->rt_gateway->sa_family == AF_LINK) { - rtexpunge(rt2); - RTFREE_LOCKED(rt2); - ret = rn_addroute(v_arg, n_arg, head, - treenodes); - } else - RTFREE_LOCKED(rt2); - } - } - - return ret; + return (rn_addroute(v_arg, n_arg, head, treenodes)); } /* @@ -187,13 +162,10 @@ in_clsroute(struct radix_node *rn, struc if (!(rt->rt_flags & RTF_UP)) return; /* prophylactic measures */ - if ((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST) - return; - if (rt->rt_flags & RTPRF_OURS) return; - if (!(rt->rt_flags & (RTF_WASCLONED | RTF_DYNAMIC))) + if (!(rt->rt_flags & RTF_DYNAMIC)) return; /* @@ -434,7 +406,6 @@ in_ifadownkill(struct radix_node *rn, vo * the routes that rtrequest() would have in any case, * so that behavior is not needed there. */ - rt->rt_flags &= ~RTF_CLONING; rtexpunge(rt); } RT_UNLOCK(rt); Modified: projects/arpv2_merge_1/sys/netinet/ip_fastfwd.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/ip_fastfwd.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/ip_fastfwd.c Thu Dec 11 02:47:41 2008 (r185905) @@ -128,7 +128,7 @@ ip_findroute(struct route *ro, struct in dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr.s_addr = dest.s_addr; - in_rtalloc_ign(ro, RTF_CLONING, M_GETFIB(m)); + in_rtalloc_ign(ro, 0, M_GETFIB(m)); /* * Route there and interface still up? Modified: projects/arpv2_merge_1/sys/netinet/ip_input.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/ip_input.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/ip_input.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1272,7 +1272,7 @@ ip_rtaddr(struct in_addr dst, u_int fibn sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); sin->sin_addr = dst; - in_rtalloc_ign(&sro, RTF_CLONING, fibnum); + in_rtalloc_ign(&sro, 0, fibnum); if (sro.ro_rt == NULL) return (NULL); @@ -1398,7 +1398,7 @@ ip_forward(struct mbuf *m, int srcrt) sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); sin->sin_addr = ip->ip_dst; - in_rtalloc_ign(&ro, RTF_CLONING, M_GETFIB(m)); + in_rtalloc_ign(&ro, 0, M_GETFIB(m)); rt = ro.ro_rt; Modified: projects/arpv2_merge_1/sys/netinet/tcp_subr.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/tcp_subr.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet/tcp_subr.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1657,7 +1657,7 @@ tcp_maxmtu(struct in_conninfo *inc, int dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = inc->inc_faddr; - in_rtalloc_ign(&sro, RTF_CLONING, inc->inc_fibnum); + in_rtalloc_ign(&sro, 0, inc->inc_fibnum); } if (sro.ro_rt != NULL) { ifp = sro.ro_rt->rt_ifp; @@ -1692,7 +1692,7 @@ tcp_maxmtu6(struct in_conninfo *inc, int sro6.ro_dst.sin6_family = AF_INET6; sro6.ro_dst.sin6_len = sizeof(struct sockaddr_in6); sro6.ro_dst.sin6_addr = inc->inc6_faddr; - rtalloc_ign((struct route *)&sro6, RTF_CLONING); + rtalloc_ign((struct route *)&sro6, 0); } if (sro6.ro_rt != NULL) { ifp = sro6.ro_rt->rt_ifp; Modified: projects/arpv2_merge_1/sys/netinet6/in6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/in6.c Thu Dec 11 02:47:41 2008 (r185905) @@ -987,10 +987,9 @@ in6_update_ifa(struct ifnet *ifp, struct } } if (!rt) { - /* XXX: we need RTF_CLONING to fake nd6_rtrequest */ error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP | RTF_CLONING, + (struct sockaddr *)&mltmask, RTF_UP, (struct rtentry **)0); if (error) goto cleanup; @@ -1064,7 +1063,7 @@ in6_update_ifa(struct ifnet *ifp, struct if (!rt) { error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP | RTF_CLONING, + (struct sockaddr *)&mltmask, RTF_UP, (struct rtentry **)0); if (error) goto cleanup; @@ -1542,7 +1541,6 @@ in6_ifinit(struct ifnet *ifp, struct in6 struct rtentry *rt = NULL, **rtp = NULL; if (nd6_need_cache(ifp) != 0) { - rtflags |= RTF_LLINFO; rtp = &rt; } @@ -1571,12 +1569,6 @@ in6_ifinit(struct ifnet *ifp, struct in6 } ia->ia_flags |= IFA_ROUTE; } - if (plen < 128) { - /* - * The RTF_CLONING flag is necessary for in6_is_ifloop_auto(). - */ - ia->ia_ifa.ifa_flags |= RTF_CLONING; - } #else plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ if (!(ia->ia_flags & IFA_ROUTE) && plen == 128 && @@ -1586,12 +1578,6 @@ in6_ifinit(struct ifnet *ifp, struct in6 return (error); ia->ia_flags |= IFA_ROUTE; } - if (plen < 128) { - /* - * The RTF_CLONING flag is necessary for in6_is_ifloop_auto(). - */ - ia->ia_ifa.ifa_flags |= RTF_CLONING; - } #endif /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */ @@ -2287,7 +2273,7 @@ in6_lltable_dump(struct lltable *llt, st } ndpc.rtm.rtm_rmx.rmx_expire = lle->la_flags & LLE_STATIC ? 0 : lle->la_expire; - ndpc.rtm.rtm_flags |= RTF_LLINFO | RTF_HOST; + ndpc.rtm.rtm_flags |= RTF_HOST; if (lle->la_flags & LLE_STATIC) ndpc.rtm.rtm_flags |= RTF_STATIC; ndpc.rtm.rtm_index = ifp->if_index; Modified: projects/arpv2_merge_1/sys/netinet6/in6_rmx.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6_rmx.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/in6_rmx.c Thu Dec 11 02:47:41 2008 (r185905) @@ -153,27 +153,7 @@ in6_addroute(void *v_arg, void *n_arg, s rt->rt_rmx.rmx_mtu = IN6_LINKMTU(rt->rt_ifp); ret = rn_addroute(v_arg, n_arg, head, treenodes); - if (ret == NULL && rt->rt_flags & RTF_HOST) { - struct rtentry *rt2; - /* - * We are trying to add a host route, but can't. - * Find out if it is because of an - * ARP entry and delete it if so. - */ - rt2 = rtalloc1((struct sockaddr *)sin6, 0, RTF_CLONING); - if (rt2) { - if (rt2->rt_flags & RTF_LLINFO && - rt2->rt_flags & RTF_HOST && - rt2->rt_gateway && - rt2->rt_gateway->sa_family == AF_LINK) { - rtexpunge(rt2); - RTFREE_LOCKED(rt2); - ret = rn_addroute(v_arg, n_arg, head, - treenodes); - } else - RTFREE_LOCKED(rt2); - } - } else if (ret == NULL && rt->rt_flags & RTF_CLONING) { + if (ret == NULL) { struct rtentry *rt2; /* * We are trying to add a net route, but can't. @@ -187,10 +167,9 @@ in6_addroute(void *v_arg, void *n_arg, s * net route entry, 3ffe:0501:: -> if0. * This case should not raise an error. */ - rt2 = rtalloc1((struct sockaddr *)sin6, 0, RTF_CLONING); + rt2 = rtalloc1((struct sockaddr *)sin6, 0, 0); if (rt2) { - if ((rt2->rt_flags & (RTF_CLONING|RTF_HOST|RTF_GATEWAY)) - == RTF_CLONING + if (((rt2->rt_flags & (RTF_HOST|RTF_GATEWAY)) == 0) && rt2->rt_gateway && rt2->rt_gateway->sa_family == AF_LINK && rt2->rt_ifp == rt->rt_ifp) { @@ -199,7 +178,7 @@ in6_addroute(void *v_arg, void *n_arg, s RTFREE_LOCKED(rt2); } } - return ret; + return (ret); } /* @@ -255,12 +234,6 @@ in6_clsroute(struct radix_node *rn, stru if (!(rt->rt_flags & RTF_UP)) return; /* prophylactic measures */ - if ((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST) - return; - - if ((rt->rt_flags & (RTF_WASCLONED | RTPRF_OURS)) != RTF_WASCLONED) - return; - /* * As requested by David Greenman: * If rtq_reallyold6 is 0, just delete the route without Modified: projects/arpv2_merge_1/sys/netinet6/in6_src.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6_src.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/in6_src.c Thu Dec 11 02:47:41 2008 (r185905) @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef RADIX_MPATH #include #endif @@ -131,7 +132,7 @@ int ip6_prefer_tempaddr; static int selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, - struct rtentry **, int, int)); + struct rtentry **, int)); static int in6_selectif __P((struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *ro, struct ifnet **)); @@ -479,8 +480,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso static int selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, struct ip6_moptions *mopts, struct route_in6 *ro, - struct ifnet **retifp, struct rtentry **retrt, int clone, - int norouteok) + struct ifnet **retifp, struct rtentry **retrt, int norouteok) { INIT_VNET_INET6(curvnet); int error = 0; @@ -536,9 +536,10 @@ selectroute(struct sockaddr_in6 *dstsock */ if (opts && opts->ip6po_nexthop) { struct route_in6 *ron; - + struct llentry *la; + sin6_next = satosin6(opts->ip6po_nexthop); - + /* at this moment, we only support AF_INET6 next hops */ if (sin6_next->sin6_family != AF_INET6) { error = EAFNOSUPPORT; /* or should we proceed? */ @@ -550,6 +551,36 @@ selectroute(struct sockaddr_in6 *dstsock * by that address must be a neighbor of the sending host. */ ron = &opts->ip6po_nextroute; + /* + * XXX what do we do here? + * PLZ to be fixing + */ + + + if (ron->ro_rt == NULL) { + rtalloc((struct route *)ron); /* multi path case? */ + if (ron->ro_rt == NULL) { + if (ron->ro_rt) { + RTFREE(ron->ro_rt); + ron->ro_rt = NULL; + } + error = EHOSTUNREACH; + goto done; + } + } + + rt = ron->ro_rt; + ifp = rt->rt_ifp; + IF_AFDATA_LOCK(ifp); + la = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&sin6_next->sin6_addr); + IF_AFDATA_UNLOCK(ifp); + if (la) + LLE_RUNLOCK(la); + else { + error = EHOSTUNREACH; + goto done; + } +#if 0 if ((ron->ro_rt && (ron->ro_rt->rt_flags & (RTF_UP | RTF_LLINFO)) != (RTF_UP | RTF_LLINFO)) || @@ -573,16 +604,14 @@ selectroute(struct sockaddr_in6 *dstsock goto done; } } - rt = ron->ro_rt; - ifp = rt->rt_ifp; +#endif /* * When cloning is required, try to allocate a route to the * destination so that the caller can store path MTU * information. */ - if (!clone) - goto done; + goto done; } /* @@ -608,21 +637,17 @@ selectroute(struct sockaddr_in6 *dstsock *sa6 = *dstsock; sa6->sin6_scope_id = 0; - if (clone) { #ifdef RADIX_MPATH rtalloc_mpath((struct route *)ro, ntohl(sa6->sin6_addr.s6_addr32[3])); -#else - rtalloc((struct route *)ro); -#endif - } else { +#else ro->ro_rt = rtalloc1(&((struct route *)ro) - ->ro_dst, 0, 0UL); + ->ro_dst, 0, 0UL); if (ro->ro_rt) RT_UNLOCK(ro->ro_rt); - } +#endif } - + /* * do not care about the result if we have the nexthop * explicitly specified. @@ -693,7 +718,7 @@ in6_selectif(struct sockaddr_in6 *dstsoc } if ((error = selectroute(dstsock, opts, mopts, ro, retifp, - &rt, 0, 1)) != 0) { + &rt, 1)) != 0) { if (ro == &sro && rt && rt == sro.ro_rt) RTFREE(rt); return (error); @@ -745,11 +770,11 @@ in6_selectif(struct sockaddr_in6 *dstsoc int in6_selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, struct ip6_moptions *mopts, struct route_in6 *ro, - struct ifnet **retifp, struct rtentry **retrt, int clone) + struct ifnet **retifp, struct rtentry **retrt) { return (selectroute(dstsock, opts, mopts, ro, retifp, - retrt, clone, 0)); + retrt, 0)); } /* Modified: projects/arpv2_merge_1/sys/netinet6/ip6_output.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/ip6_output.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/ip6_output.c Thu Dec 11 02:47:41 2008 (r185905) @@ -615,7 +615,7 @@ again: dst_sa.sin6_len = sizeof(dst_sa); dst_sa.sin6_addr = ip6->ip6_dst; if ((error = in6_selectroute(&dst_sa, opt, im6o, ro, - &ifp, &rt, 0)) != 0) { + &ifp, &rt)) != 0) { switch (error) { case EHOSTUNREACH: V_ip6stat.ip6s_noroute++; Modified: projects/arpv2_merge_1/sys/netinet6/ip6_var.h ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/ip6_var.h Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/ip6_var.h Thu Dec 11 02:47:41 2008 (r185905) @@ -398,7 +398,7 @@ struct in6_addr *in6_selectsrc __P((stru struct ifnet **, int *)); int in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, - struct rtentry **, int)); + struct rtentry **)); u_int32_t ip6_randomid __P((void)); u_int32_t ip6_randomflowlabel __P((void)); #endif /* _KERNEL */ Modified: projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c Thu Dec 11 02:39:27 2008 (r185904) +++ projects/arpv2_merge_1/sys/netinet6/nd6_rtr.c Thu Dec 11 02:47:41 2008 (r185905) @@ -1613,16 +1613,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) bzero(&mask6, sizeof(mask6)); mask6.sin6_len = sizeof(mask6); mask6.sin6_addr = pr->ndpr_mask; - rtflags = ifa->ifa_flags | RTF_CLONING | RTF_UP; - if (nd6_need_cache(ifp)) { - /* explicitly set in case ifa_flags does not set the flag. */ - rtflags |= RTF_CLONING; - } else { - /* - * explicitly clear the cloning bit in case ifa_flags sets it. - */ - rtflags &= ~RTF_CLONING; - } + rtflags = ifa->ifa_flags | RTF_UP; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 06:57:28 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EE641065673; Thu, 11 Dec 2008 06:57:28 +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 2C9A38FC13; Thu, 11 Dec 2008 06:57: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 mBB6vRq6057172; Thu, 11 Dec 2008 06:57:27 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBB6vRq6057163; Thu, 11 Dec 2008 06:57:27 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812110657.mBB6vRq6057163@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 06:57:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185914 - in projects/arpv2_merge_1: contrib/ipfilter/ipsend libexec/bootpd sbin/route sbin/routed usr.bin/netstat usr.sbin/arp usr.sbin/ndp usr.sbin/ppp usr.sbin/route6d X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 06:57:28 -0000 Author: kmacy Date: Thu Dec 11 06:57:27 2008 New Revision: 185914 URL: http://svn.freebsd.org/changeset/base/185914 Log: remove references to RTF_{LLINFO,CLONING,WASCLONED} in all user tools except bsnmpd with questions where appropriate Modified: projects/arpv2_merge_1/contrib/ipfilter/ipsend/44arp.c projects/arpv2_merge_1/libexec/bootpd/rtmsg.c projects/arpv2_merge_1/sbin/route/route.c projects/arpv2_merge_1/sbin/routed/table.c projects/arpv2_merge_1/usr.bin/netstat/route.c projects/arpv2_merge_1/usr.sbin/arp/arp.c projects/arpv2_merge_1/usr.sbin/ndp/ndp.c projects/arpv2_merge_1/usr.sbin/ppp/route.c projects/arpv2_merge_1/usr.sbin/route6d/route6d.c Modified: projects/arpv2_merge_1/contrib/ipfilter/ipsend/44arp.c ============================================================================== --- projects/arpv2_merge_1/contrib/ipfilter/ipsend/44arp.c Thu Dec 11 06:55:01 2008 (r185913) +++ projects/arpv2_merge_1/contrib/ipfilter/ipsend/44arp.c Thu Dec 11 06:57:27 2008 (r185914) @@ -88,7 +88,12 @@ char *addr, *eaddr; mib[2] = 0; mib[3] = AF_INET; mib[4] = NET_RT_FLAGS; +#ifdef RTF_LLINFO mib[5] = RTF_LLINFO; +#else + mib[5] = 0; +#endif + if (sysctl(mib, 6, NULL, &needed, NULL, 0) == -1) { perror("route-sysctl-estimate"); Modified: projects/arpv2_merge_1/libexec/bootpd/rtmsg.c ============================================================================== --- projects/arpv2_merge_1/libexec/bootpd/rtmsg.c Thu Dec 11 06:55:01 2008 (r185913) +++ projects/arpv2_merge_1/libexec/bootpd/rtmsg.c Thu Dec 11 06:57:27 2008 (r185914) @@ -152,7 +152,13 @@ tryagain: sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin); if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { if (sdl->sdl_family == AF_LINK && +#if 0 + /* + * XXX Qing - what should be here? + * + */ (rtm->rtm_flags & RTF_LLINFO) && +#endif !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023: case IFT_ISO88024: case IFT_ISO88025: Modified: projects/arpv2_merge_1/sbin/route/route.c ============================================================================== --- projects/arpv2_merge_1/sbin/route/route.c Thu Dec 11 06:55:01 2008 (r185913) +++ projects/arpv2_merge_1/sbin/route/route.c Thu Dec 11 06:57:27 2008 (r185914) @@ -605,9 +605,6 @@ newroute(argc, argv) case K_NOSTATIC: flags &= ~RTF_STATIC; break; - case K_LLINFO: - flags |= RTF_LLINFO; - break; case K_LOCK: locking = 1; break; @@ -632,9 +629,6 @@ newroute(argc, argv) case K_PROXY: proxy = 1; break; - case K_CLONING: - flags |= RTF_CLONING; - break; case K_XRESOLVE: flags |= RTF_XRESOLVE; break; Modified: projects/arpv2_merge_1/sbin/routed/table.c ============================================================================== --- projects/arpv2_merge_1/sbin/routed/table.c Thu Dec 11 06:55:01 2008 (r185913) +++ projects/arpv2_merge_1/sbin/routed/table.c Thu Dec 11 06:57:27 2008 (r185914) @@ -1106,9 +1106,11 @@ flush_kern(void) /* ignore ARP table entries on systems with a merged route * and ARP table. */ +#if defined(RTF_LLINFO) if (rtm->rtm_flags & RTF_LLINFO) continue; - +#endif + #if defined(RTF_WASCLONED) && defined(__FreeBSD__) /* ignore cloned routes */ @@ -1260,12 +1262,12 @@ read_rt(void) trace_act("ignore multicast %s", str); continue; } - +#if defined(RTF_LLINFO) if (m.r.rtm.rtm_flags & RTF_LLINFO) { trace_act("ignore ARP %s", str); continue; } - +#endif #if defined(RTF_WASCLONED) && defined(__FreeBSD__) if (m.r.rtm.rtm_flags & RTF_WASCLONED) { trace_act("ignore cloned %s", str); Modified: projects/arpv2_merge_1/usr.bin/netstat/route.c ============================================================================== --- projects/arpv2_merge_1/usr.bin/netstat/route.c Thu Dec 11 06:55:01 2008 (r185913) +++ projects/arpv2_merge_1/usr.bin/netstat/route.c Thu Dec 11 06:57:27 2008 (r185914) @@ -89,17 +89,23 @@ struct bits { { RTF_DYNAMIC, 'D' }, { RTF_MODIFIED, 'M' }, { RTF_DONE, 'd' }, /* Completed -- for routing messages only */ - { RTF_CLONING, 'C' }, { RTF_XRESOLVE, 'X' }, - { RTF_LLINFO, 'L' }, { RTF_STATIC, 'S' }, { RTF_PROTO1, '1' }, { RTF_PROTO2, '2' }, - { RTF_WASCLONED,'W' }, { RTF_PRCLONING,'c' }, { RTF_PROTO3, '3' }, { RTF_BLACKHOLE,'B' }, { RTF_BROADCAST,'b' }, +#ifdef RTF_LLINFO + { RTF_LLINFO, 'L' }, +#endif +#ifdef RTF_WASCLONED + { RTF_WASCLONED,'W' }, +#endif +#ifdef RTF_CLONING + { RTF_CLONING, 'C' }, +#endif { 0 , 0 } }; @@ -316,23 +322,12 @@ static void size_cols_rtentry(struct rtentry *rt) { static struct ifnet ifnet, *lastif; - struct rtentry parent; static char buffer[100]; const char *bp; struct sockaddr *sa; sa_u addr, mask; int len; - /* - * Don't print protocol-cloned routes unless -a. - */ - if (rt->rt_flags & RTF_WASCLONED && !aflag) { - if (kget(rt->rt_parent, parent) != 0) - return; - if (parent.rt_flags & RTF_PRCLONING) - return; - } - bzero(&addr, sizeof(addr)); if ((sa = kgetsa(rt_key(rt)))) bcopy(sa, &addr, sa->sa_len); @@ -761,22 +756,11 @@ static void p_rtentry(struct rtentry *rt) { static struct ifnet ifnet, *lastif; - struct rtentry parent; static char buffer[128]; static char prettyname[128]; struct sockaddr *sa; sa_u addr, mask; - /* - * Don't print protocol-cloned routes unless -a. - */ - if (rt->rt_flags & RTF_WASCLONED && !aflag) { - if (kget(rt->rt_parent, parent) != 0) - return; - if (parent.rt_flags & RTF_PRCLONING) - return; - } - bzero(&addr, sizeof(addr)); if ((sa = kgetsa(rt_key(rt)))) bcopy(sa, &addr, sa->sa_len); Modified: projects/arpv2_merge_1/usr.sbin/arp/arp.c ============================================================================== --- projects/arpv2_merge_1/usr.sbin/arp/arp.c Thu Dec 11 06:55:01 2008 (r185913) +++ projects/arpv2_merge_1/usr.sbin/arp/arp.c Thu Dec 11 06:57:27 2008 (r185914) @@ -370,7 +370,13 @@ set(int argc, char **argv) if (addr->sin_addr.s_addr != dst->sin_addr.s_addr) break; if (sdl->sdl_family == AF_LINK && +#if 0 + /* + * XXX Qing - how should this be handled? + * + */ (rtm->rtm_flags & RTF_LLINFO) && +#endif !(rtm->rtm_flags & RTF_GATEWAY) && valid_type(sdl->sdl_type) ) break; @@ -441,7 +447,13 @@ delete(char *host, int do_proxy) sdl = (struct sockaddr_dl *)(SA_SIZE(addr) + (char *)addr); if (addr->sin_addr.s_addr == dst->sin_addr.s_addr && sdl->sdl_family == AF_LINK && +#if 0 + /* + * XXX Qing - how should this be handled? + * + */ (rtm->rtm_flags & RTF_LLINFO) && +#endif !(rtm->rtm_flags & RTF_GATEWAY) && valid_type(sdl->sdl_type) ) break; /* found it */ @@ -490,7 +502,11 @@ search(u_long addr, action_fn *action) mib[2] = 0; mib[3] = AF_INET; mib[4] = NET_RT_FLAGS; +#ifdef RTF_LLINFO mib[5] = RTF_LLINFO; +#else + mib[5] = 0; +#endif if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) err(1, "route-sysctl-estimate"); if (needed == 0) /* empty table */ Modified: projects/arpv2_merge_1/usr.sbin/ndp/ndp.c ============================================================================== --- projects/arpv2_merge_1/usr.sbin/ndp/ndp.c Thu Dec 11 06:55:01 2008 (r185913) +++ projects/arpv2_merge_1/usr.sbin/ndp/ndp.c Thu Dec 11 06:57:27 2008 (r185914) @@ -612,7 +612,11 @@ again:; mib[2] = 0; mib[3] = AF_INET6; mib[4] = NET_RT_FLAGS; +#ifdef RTF_LLINFO mib[5] = RTF_LLINFO; +#else + mib[5] = 0; +#endif if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) err(1, "sysctl(PF_ROUTE estimate)"); if (needed > 0) { Modified: projects/arpv2_merge_1/usr.sbin/ppp/route.c ============================================================================== --- projects/arpv2_merge_1/usr.sbin/ppp/route.c Thu Dec 11 06:55:01 2008 (r185913) +++ projects/arpv2_merge_1/usr.sbin/ppp/route.c Thu Dec 11 06:57:27 2008 (r185914) @@ -157,13 +157,18 @@ static struct bits { { RTF_DYNAMIC, 'D' }, { RTF_MODIFIED, 'M' }, { RTF_DONE, 'd' }, - { RTF_CLONING, 'C' }, { RTF_XRESOLVE, 'X' }, - { RTF_LLINFO, 'L' }, - { RTF_STATIC, 'S' }, + { RTF_STATIC, 'S' }, { RTF_PROTO1, '1' }, { RTF_PROTO2, '2' }, { RTF_BLACKHOLE, 'B' }, + +#ifdef RTF_LLINFO + { RTF_LLINFO, 'L' }, +#endif +#ifdef RTF_CLONING + { RTF_CLONING, 'C' }, +#endif #ifdef RTF_WASCLONED { RTF_WASCLONED, 'W' }, #endif Modified: projects/arpv2_merge_1/usr.sbin/route6d/route6d.c ============================================================================== --- projects/arpv2_merge_1/usr.sbin/route6d/route6d.c Thu Dec 11 06:55:01 2008 (r185913) +++ projects/arpv2_merge_1/usr.sbin/route6d/route6d.c Thu Dec 11 06:57:27 2008 (r185914) @@ -1752,7 +1752,6 @@ rtrecv() continue; case RTM_LOSING: case RTM_MISS: - case RTM_RESOLVE: case RTM_GET: case RTM_LOCK: /* nothing to be done here */ @@ -1790,7 +1789,6 @@ rtrecv() case RTM_ADD: case RTM_LOSING: case RTM_MISS: - case RTM_RESOLVE: case RTM_GET: case RTM_LOCK: /* should already be handled */ @@ -2141,10 +2139,7 @@ ifrt(ifcp, again) rrt->rrt_info.rip6_tag = htons(routetag & 0xffff); rrt->rrt_info.rip6_metric = 1 + ifcp->ifc_metric; rrt->rrt_info.rip6_plen = ifa->ifa_plen; - if (ifa->ifa_plen == 128) - rrt->rrt_flags = RTF_HOST; - else - rrt->rrt_flags = RTF_CLONING; + rrt->rrt_flags = RTF_HOST; rrt->rrt_rflags |= RRTF_CHANGED; applyplen(&rrt->rrt_info.rip6_dest, ifa->ifa_plen); memset(&rrt->rrt_gw, 0, sizeof(struct in6_addr)); @@ -2433,7 +2428,6 @@ do { \ RTTYPE("LOCK", RTM_LOCK); RTTYPE("OLDADD", RTM_OLDADD); RTTYPE("OLDDEL", RTM_OLDDEL); - RTTYPE("RESOLVE", RTM_RESOLVE); RTTYPE("NEWADDR", RTM_NEWADDR); RTTYPE("DELADDR", RTM_DELADDR); RTTYPE("IFINFO", RTM_IFINFO); @@ -2484,7 +2478,9 @@ do { \ #ifdef RTF_MASK RTFLAG("m", RTF_MASK); #endif +#ifdef RTF_CLONING RTFLAG("C", RTF_CLONING); +#endif #ifdef RTF_CLONED RTFLAG("c", RTF_CLONED); #endif @@ -2495,7 +2491,9 @@ do { \ RTFLAG("W", RTF_WASCLONED); #endif RTFLAG("X", RTF_XRESOLVE); +#ifdef RTF_LLINFO RTFLAG("L", RTF_LLINFO); +#endif RTFLAG("S", RTF_STATIC); RTFLAG("B", RTF_BLACKHOLE); #ifdef RTF_PROTO3 @@ -2631,7 +2629,7 @@ rt_entry(rtm, again) sin6_dst = sin6_gw = sin6_mask = sin6_genmask = sin6_ifp = 0; if ((rtm->rtm_flags & RTF_UP) == 0 || rtm->rtm_flags & - (RTF_CLONING|RTF_XRESOLVE|RTF_LLINFO|RTF_BLACKHOLE)) { + (RTF_XRESOLVE|RTF_BLACKHOLE)) { return; /* not interested in the link route */ } /* do not look at cloned routes */ From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 07:39:07 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E89901065670; Thu, 11 Dec 2008 07:39:06 +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 D21BA8FC27; Thu, 11 Dec 2008 07:39:06 +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 mBB7d6Xm058074; Thu, 11 Dec 2008 07:39:06 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBB7d6KQ058070; Thu, 11 Dec 2008 07:39:06 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812110739.mBB7d6KQ058070@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 07:39:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185918 - in projects/arpv2_merge_1/sys: contrib/pf/net netgraph/netflow netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 07:39:07 -0000 Author: kmacy Date: Thu Dec 11 07:39:06 2008 New Revision: 185918 URL: http://svn.freebsd.org/changeset/base/185918 Log: remove references to RTF_CLONING from modules Modified: projects/arpv2_merge_1/sys/contrib/pf/net/pf.c projects/arpv2_merge_1/sys/netgraph/netflow/netflow.c projects/arpv2_merge_1/sys/netinet/if_atm.c projects/arpv2_merge_1/sys/netinet/ip_fw2.c Modified: projects/arpv2_merge_1/sys/contrib/pf/net/pf.c ============================================================================== --- projects/arpv2_merge_1/sys/contrib/pf/net/pf.c Thu Dec 11 07:02:30 2008 (r185917) +++ projects/arpv2_merge_1/sys/contrib/pf/net/pf.c Thu Dec 11 07:39:06 2008 (r185918) @@ -3162,7 +3162,7 @@ pf_calc_mss(struct pf_addr *addr, sa_fam #ifdef RTF_PRCLONING rtalloc_ign(&ro, (RTF_CLONING | RTF_PRCLONING)); #else /* !RTF_PRCLONING */ - in_rtalloc_ign(&ro, RTF_CLONING, 0); + in_rtalloc_ign(&ro, 0, 0); #endif #else /* ! __FreeBSD__ */ rtalloc_noclone(&ro, NO_CLONING); @@ -3183,7 +3183,7 @@ pf_calc_mss(struct pf_addr *addr, sa_fam rtalloc_ign((struct route *)&ro6, (RTF_CLONING | RTF_PRCLONING)); #else /* !RTF_PRCLONING */ - rtalloc_ign((struct route *)&ro6, RTF_CLONING); + rtalloc_ign((struct route *)&ro6, 0); #endif #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro6, NO_CLONING); @@ -5986,9 +5986,9 @@ pf_routable(struct pf_addr *addr, sa_fam #ifdef __FreeBSD__ /* XXX MRT not always INET */ /* stick with table 0 though */ if (af == AF_INET) - in_rtalloc_ign((struct route *)&ro, RTF_CLONING, 0); + in_rtalloc_ign((struct route *)&ro, 0, 0); else - rtalloc_ign((struct route *)&ro, RTF_CLONING); + rtalloc_ign((struct route *)&ro, 0); #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro, NO_CLONING); #endif @@ -6068,9 +6068,9 @@ pf_rtlabel_match(struct pf_addr *addr, s rtalloc_ign((struct route *)&ro, (RTF_CLONING|RTF_PRCLONING)); # else /* !RTF_PRCLONING */ if (af == AF_INET) - in_rtalloc_ign((struct route *)&ro, RTF_CLONING, 0); + in_rtalloc_ign((struct route *)&ro, 0, 0); else - rtalloc_ign((struct route *)&ro, RTF_CLONING); + rtalloc_ign((struct route *)&ro, 0); # endif #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro, NO_CLONING); Modified: projects/arpv2_merge_1/sys/netgraph/netflow/netflow.c ============================================================================== --- projects/arpv2_merge_1/sys/netgraph/netflow/netflow.c Thu Dec 11 07:02:30 2008 (r185917) +++ projects/arpv2_merge_1/sys/netgraph/netflow/netflow.c Thu Dec 11 07:39:06 2008 (r185918) @@ -270,7 +270,7 @@ hash_insert(priv_p priv, struct flow_has sin.sin_family = AF_INET; sin.sin_addr = fle->f.r.r_dst; /* XXX MRT 0 as a default.. need the m here to get fib */ - rt = rtalloc1_fib((struct sockaddr *)&sin, 0, RTF_CLONING, 0); + rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, 0); if (rt != NULL) { fle->f.fle_o_ifx = rt->rt_ifp->if_index; @@ -295,7 +295,7 @@ hash_insert(priv_p priv, struct flow_has sin.sin_family = AF_INET; sin.sin_addr = fle->f.r.r_src; /* XXX MRT 0 as a default revisit. need the mbuf for fib*/ - rt = rtalloc1_fib((struct sockaddr *)&sin, 0, RTF_CLONING, 0); + rt = rtalloc1_fib((struct sockaddr *)&sin, 0, 0, 0); if (rt != NULL) { if (rt_mask(rt)) fle->f.src_mask = bitcount32(((struct sockaddr_in *) Modified: projects/arpv2_merge_1/sys/netinet/if_atm.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_atm.c Thu Dec 11 07:02:30 2008 (r185917) +++ projects/arpv2_merge_1/sys/netinet/if_atm.c Thu Dec 11 07:39:06 2008 (r185918) @@ -127,10 +127,6 @@ atm_rtrequest(int req, struct rtentry *r break; } - if ((rt->rt_flags & RTF_CLONING) != 0) { - printf("atm_rtrequest: cloning route detected?\n"); - break; - } if (gate->sa_family != AF_LINK || gate->sa_len < sizeof(null_sdl)) { log(LOG_DEBUG, "atm_rtrequest: bad gateway value"); Modified: projects/arpv2_merge_1/sys/netinet/ip_fw2.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/ip_fw2.c Thu Dec 11 07:02:30 2008 (r185917) +++ projects/arpv2_merge_1/sys/netinet/ip_fw2.c Thu Dec 11 07:39:06 2008 (r185918) @@ -511,7 +511,7 @@ verify_path(struct in_addr src, struct i dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = src; - in_rtalloc_ign(&ro, RTF_CLONING, fib); + in_rtalloc_ign(&ro, 0, fib); if (ro.ro_rt == NULL) return 0; @@ -603,7 +603,7 @@ verify_path6(struct in6_addr *src, struc dst->sin6_len = sizeof(*dst); dst->sin6_addr = *src; /* XXX MRT 0 for ipv6 at this time */ - rtalloc_ign((struct route *)&ro, RTF_CLONING); + rtalloc_ign((struct route *)&ro, 0); if (ro.ro_rt == NULL) return 0; From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 07:51:09 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C55AF106564A; Thu, 11 Dec 2008 07:51:09 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6BE78FC08; Thu, 11 Dec 2008 07:51:09 +0000 (UTC) (envelope-from qingli@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 mBB7p9af058396; Thu, 11 Dec 2008 07:51:09 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBB7p9Mq058395; Thu, 11 Dec 2008 07:51:09 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200812110751.mBB7p9Mq058395@svn.freebsd.org> From: Qing Li Date: Thu, 11 Dec 2008 07:51:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185920 - projects/arpv2_merge_1/usr.sbin/arp X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 07:51:09 -0000 Author: qingli Date: Thu Dec 11 07:51:09 2008 New Revision: 185920 URL: http://svn.freebsd.org/changeset/base/185920 Log: Simply remove the references to RTF_LLINFO. This flag is no longer set in the kernel so don't bother checking in userland app. Modified: projects/arpv2_merge_1/usr.sbin/arp/arp.c Modified: projects/arpv2_merge_1/usr.sbin/arp/arp.c ============================================================================== --- projects/arpv2_merge_1/usr.sbin/arp/arp.c Thu Dec 11 07:43:02 2008 (r185919) +++ projects/arpv2_merge_1/usr.sbin/arp/arp.c Thu Dec 11 07:51:09 2008 (r185920) @@ -370,13 +370,6 @@ set(int argc, char **argv) if (addr->sin_addr.s_addr != dst->sin_addr.s_addr) break; if (sdl->sdl_family == AF_LINK && -#if 0 - /* - * XXX Qing - how should this be handled? - * - */ - (rtm->rtm_flags & RTF_LLINFO) && -#endif !(rtm->rtm_flags & RTF_GATEWAY) && valid_type(sdl->sdl_type) ) break; @@ -447,21 +440,10 @@ delete(char *host, int do_proxy) sdl = (struct sockaddr_dl *)(SA_SIZE(addr) + (char *)addr); if (addr->sin_addr.s_addr == dst->sin_addr.s_addr && sdl->sdl_family == AF_LINK && -#if 0 - /* - * XXX Qing - how should this be handled? - * - */ - (rtm->rtm_flags & RTF_LLINFO) && -#endif !(rtm->rtm_flags & RTF_GATEWAY) && valid_type(sdl->sdl_type) ) break; /* found it */ - /* Qing - * why not just remove the RTF_LLINFO in the above - * code instead of another "if", works - */ if (sdl->sdl_family == AF_LINK && !(rtm->rtm_flags & RTF_GATEWAY) && valid_type(sdl->sdl_type) ) { From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 08:08:29 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D12AA106564A; Thu, 11 Dec 2008 08:08: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 BEA2F8FC08; Thu, 11 Dec 2008 08:08:29 +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 mBB88TG3058847; Thu, 11 Dec 2008 08:08:29 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBB88ShV058827; Thu, 11 Dec 2008 08:08:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812110808.mBB88ShV058827@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 08:08:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185921 - in projects/arpv2_merge_1: contrib/pf lib/libc/stdio sys/boot/zfs sys/compat/freebsd32 sys/compat/linprocfs sys/conf sys/contrib/pf/net sys/dev/ath/ath_hal sys/dev/ath/ath_hal... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 08:08:30 -0000 Author: kmacy Date: Thu Dec 11 08:08:28 2008 New Revision: 185921 URL: http://svn.freebsd.org/changeset/base/185921 Log: IFC 185817:185918 merge latest from HEAD Added: projects/arpv2_merge_1/sys/kern/kern_vimage.c Modified: projects/arpv2_merge_1/contrib/pf/ (props changed) projects/arpv2_merge_1/lib/libc/stdio/vfprintf.c projects/arpv2_merge_1/lib/libc/stdio/vfwprintf.c projects/arpv2_merge_1/sys/boot/zfs/zfs.c projects/arpv2_merge_1/sys/boot/zfs/zfsimpl.c projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_proto.h projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_signal.h projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_syscall.h projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_syscalls.c projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_sysent.c projects/arpv2_merge_1/sys/compat/freebsd32/syscalls.master projects/arpv2_merge_1/sys/compat/linprocfs/linprocfs.c projects/arpv2_merge_1/sys/conf/files projects/arpv2_merge_1/sys/conf/options projects/arpv2_merge_1/sys/contrib/pf/net/pf_subr.c projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v14.c (contents, props changed) projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c (contents, props changed) projects/arpv2_merge_1/sys/dev/pccbb/pccbb_pci.c projects/arpv2_merge_1/sys/dev/re/if_re.c projects/arpv2_merge_1/sys/fs/procfs/procfs_map.c projects/arpv2_merge_1/sys/kern/kern_jail.c projects/arpv2_merge_1/sys/kern/kern_linker.c projects/arpv2_merge_1/sys/kern/kern_mbuf.c projects/arpv2_merge_1/sys/kern/subr_prf.c projects/arpv2_merge_1/sys/kern/uipc_socket.c projects/arpv2_merge_1/sys/kern/vfs_aio.c projects/arpv2_merge_1/sys/mips/adm5120/adm5120_machdep.c projects/arpv2_merge_1/sys/modules/aio/Makefile projects/arpv2_merge_1/sys/net/if.c projects/arpv2_merge_1/sys/net/if_bridge.c projects/arpv2_merge_1/sys/net/if_ethersubr.c projects/arpv2_merge_1/sys/net/if_gif.c projects/arpv2_merge_1/sys/net/if_gif.h projects/arpv2_merge_1/sys/net/route.c projects/arpv2_merge_1/sys/net/rtsock.c projects/arpv2_merge_1/sys/net/vnet.h projects/arpv2_merge_1/sys/netgraph/netgraph.h projects/arpv2_merge_1/sys/netgraph/ng_base.c projects/arpv2_merge_1/sys/netgraph/ng_bridge.c projects/arpv2_merge_1/sys/netgraph/ng_eiface.c projects/arpv2_merge_1/sys/netgraph/ng_iface.c projects/arpv2_merge_1/sys/netgraph/ng_ipfw.c projects/arpv2_merge_1/sys/netinet/if_ether.c projects/arpv2_merge_1/sys/netinet/in_pcb.c projects/arpv2_merge_1/sys/netinet/in_proto.c projects/arpv2_merge_1/sys/netinet/ip_divert.c projects/arpv2_merge_1/sys/netinet/ip_dummynet.c projects/arpv2_merge_1/sys/netinet/ip_fw.h projects/arpv2_merge_1/sys/netinet/ip_fw2.c projects/arpv2_merge_1/sys/netinet/ip_fw_nat.c projects/arpv2_merge_1/sys/netinet/ip_fw_pfil.c projects/arpv2_merge_1/sys/netinet/ip_input.c projects/arpv2_merge_1/sys/netinet/ip_output.c projects/arpv2_merge_1/sys/netinet/ip_var.h projects/arpv2_merge_1/sys/netinet/libalias/alias_db.c projects/arpv2_merge_1/sys/netinet/raw_ip.c projects/arpv2_merge_1/sys/netinet/sctp_os_bsd.h projects/arpv2_merge_1/sys/netinet/sctp_pcb.c projects/arpv2_merge_1/sys/netinet/tcp_sack.c projects/arpv2_merge_1/sys/netinet/tcp_subr.c projects/arpv2_merge_1/sys/netinet/tcp_syncache.h projects/arpv2_merge_1/sys/netinet/tcp_var.h projects/arpv2_merge_1/sys/netinet/udp_usrreq.c projects/arpv2_merge_1/sys/netinet/vinet.h projects/arpv2_merge_1/sys/netinet6/in6_proto.c projects/arpv2_merge_1/sys/netinet6/ip6_input.c projects/arpv2_merge_1/sys/netinet6/nd6.c projects/arpv2_merge_1/sys/netinet6/vinet6.h projects/arpv2_merge_1/sys/netipsec/ipsec.c projects/arpv2_merge_1/sys/netipsec/vipsec.h projects/arpv2_merge_1/sys/nfsserver/nfs_fha.c projects/arpv2_merge_1/sys/pci/if_rlreg.h projects/arpv2_merge_1/sys/sys/aio.h projects/arpv2_merge_1/sys/sys/kernel.h projects/arpv2_merge_1/sys/sys/sysctl.h projects/arpv2_merge_1/sys/sys/vimage.h projects/arpv2_merge_1/usr.bin/fetch/fetch.c projects/arpv2_merge_1/usr.sbin/jexec/jexec.c projects/arpv2_merge_1/usr.sbin/jls/jls.c Modified: projects/arpv2_merge_1/lib/libc/stdio/vfprintf.c ============================================================================== --- projects/arpv2_merge_1/lib/libc/stdio/vfprintf.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/lib/libc/stdio/vfprintf.c Thu Dec 11 08:08:28 2008 (r185921) @@ -396,12 +396,6 @@ __vfprintf(FILE *fp, const char *fmt0, v char sign; /* sign prefix (' ', '+', '-', or \0) */ char thousands_sep; /* locale specific thousands separator */ const char *grouping; /* locale specific numeric grouping rules */ - - if (__use_xprintf == 0 && getenv("USE_XPRINTF")) - __use_xprintf = 1; - if (__use_xprintf > 0) - return (__xvprintf(fp, fmt0, ap)); - #ifndef NO_FLOATING_POINT /* * We can decompose the printed representation of floating @@ -568,14 +562,11 @@ __vfprintf(FILE *fp, const char *fmt0, v val = GETARG (int); \ } + if (__use_xprintf == 0 && getenv("USE_XPRINTF")) + __use_xprintf = 1; + if (__use_xprintf > 0) + return (__xvprintf(fp, fmt0, ap)); - thousands_sep = '\0'; - grouping = NULL; - convbuf = NULL; -#ifndef NO_FLOATING_POINT - dtoaresult = NULL; - decimal_point = localeconv()->decimal_point; -#endif /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */ if (prepwrite(fp) != 0) return (EOF); @@ -585,6 +576,9 @@ __vfprintf(FILE *fp, const char *fmt0, v fp->_file >= 0) return (__sbprintf(fp, fmt0, ap)); + thousands_sep = '\0'; + grouping = NULL; + convbuf = NULL; fmt = (char *)fmt0; argtable = NULL; nextarg = 1; @@ -593,6 +587,10 @@ __vfprintf(FILE *fp, const char *fmt0, v uio.uio_resid = 0; uio.uio_iovcnt = 0; ret = 0; +#ifndef NO_FLOATING_POINT + dtoaresult = NULL; + decimal_point = localeconv()->decimal_point; +#endif /* * Scan the format for conversions (`%' character). Modified: projects/arpv2_merge_1/lib/libc/stdio/vfwprintf.c ============================================================================== --- projects/arpv2_merge_1/lib/libc/stdio/vfwprintf.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/lib/libc/stdio/vfwprintf.c Thu Dec 11 08:08:28 2008 (r185921) @@ -575,12 +575,6 @@ __vfwprintf(FILE *fp, const wchar_t *fmt } - thousands_sep = '\0'; - grouping = NULL; -#ifndef NO_FLOATING_POINT - decimal_point = localeconv()->decimal_point; -#endif - convbuf = NULL; /* sorry, fwprintf(read_only_file, L"") returns WEOF, not 0 */ if (prepwrite(fp) != 0) return (EOF); @@ -590,11 +584,17 @@ __vfwprintf(FILE *fp, const wchar_t *fmt fp->_file >= 0) return (__sbprintf(fp, fmt0, ap)); + thousands_sep = '\0'; + grouping = NULL; + convbuf = NULL; fmt = (wchar_t *)fmt0; argtable = NULL; nextarg = 1; va_copy(orgap, ap); ret = 0; +#ifndef NO_FLOATING_POINT + decimal_point = localeconv()->decimal_point; +#endif /* * Scan the format for conversions (`%' character). Modified: projects/arpv2_merge_1/sys/boot/zfs/zfs.c ============================================================================== --- projects/arpv2_merge_1/sys/boot/zfs/zfs.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/boot/zfs/zfs.c Thu Dec 11 08:08:28 2008 (r185921) @@ -474,7 +474,6 @@ zfs_dev_open(struct open_file *f, ...) * the pool. */ unit = dev->d_unit; - free(dev); i = 0; STAILQ_FOREACH(spa, &zfs_pools, spa_link) { Modified: projects/arpv2_merge_1/sys/boot/zfs/zfsimpl.c ============================================================================== --- projects/arpv2_merge_1/sys/boot/zfs/zfsimpl.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/boot/zfs/zfsimpl.c Thu Dec 11 08:08:28 2008 (r185921) @@ -623,7 +623,7 @@ vdev_probe(vdev_read_t *read, void *read uint64_t pool_txg, pool_guid; const char *pool_name; const unsigned char *vdevs; - int i; + int i, rc; char upbuf[1024]; const struct uberblock *up; @@ -723,7 +723,9 @@ vdev_probe(vdev_read_t *read, void *read DATA_TYPE_NVLIST, 0, &vdevs)) { return (EIO); } - vdev_init_from_nvlist(vdevs, &top_vdev); + rc = vdev_init_from_nvlist(vdevs, &top_vdev); + if (rc) + return (rc); /* * Add the toplevel vdev to the pool if its not already there. Modified: projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_proto.h Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_proto.h Thu Dec 11 08:08:28 2008 (r185921) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185435 2008-11-29 14:32:14Z bz + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185878 2008-12-10 20:56:19Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -215,6 +215,18 @@ struct freebsd32_nanosleep_args { char rqtp_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * rqtp; char rqtp_r_[PADR_(const struct timespec32 *)]; char rmtp_l_[PADL_(struct timespec32 *)]; struct timespec32 * rmtp; char rmtp_r_[PADR_(struct timespec32 *)]; }; +struct freebsd32_aio_read_args { + char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; +}; +struct freebsd32_aio_write_args { + char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; +}; +struct freebsd32_lio_listio_args { + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; + char acb_list_l_[PADL_(struct aiocb32 *const *)]; struct aiocb32 *const * acb_list; char acb_list_r_[PADR_(struct aiocb32 *const *)]; + char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; + char sig_l_[PADL_(struct sigevent *)]; struct sigevent * sig; char sig_r_[PADR_(struct sigevent *)]; +}; struct freebsd32_lutimes_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; char tptr_l_[PADL_(struct timeval32 *)]; struct timeval32 * tptr; char tptr_r_[PADR_(struct timeval32 *)]; @@ -235,6 +247,33 @@ struct freebsd32_modstat_args { char modid_l_[PADL_(int)]; int modid; char modid_r_[PADR_(int)]; char stat_l_[PADL_(struct module_stat32 *)]; struct module_stat32 * stat; char stat_r_[PADR_(struct module_stat32 *)]; }; +struct freebsd32_aio_return_args { + char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; +}; +struct freebsd32_aio_suspend_args { + char aiocbp_l_[PADL_(struct aiocb32 *const *)]; struct aiocb32 *const * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *const *)]; + char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; + char timeout_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * timeout; char timeout_r_[PADR_(const struct timespec32 *)]; +}; +struct freebsd32_aio_cancel_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; +}; +struct freebsd32_aio_error_args { + char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; +}; +struct freebsd32_oaio_read_args { + char aiocbp_l_[PADL_(struct oaiocb32 *)]; struct oaiocb32 * aiocbp; char aiocbp_r_[PADR_(struct oaiocb32 *)]; +}; +struct freebsd32_oaio_write_args { + char aiocbp_l_[PADL_(struct oaiocb32 *)]; struct oaiocb32 * aiocbp; char aiocbp_r_[PADR_(struct oaiocb32 *)]; +}; +struct freebsd32_olio_listio_args { + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; + char acb_list_l_[PADL_(struct oaiocb32 *const *)]; struct oaiocb32 *const * acb_list; char acb_list_r_[PADR_(struct oaiocb32 *const *)]; + char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; + char sig_l_[PADL_(struct osigevent32 *)]; struct osigevent32 * sig; char sig_r_[PADR_(struct osigevent32 *)]; +}; struct freebsd32_jail_args { char jail_l_[PADL_(struct jail32 *)]; struct jail32 * jail; char jail_r_[PADR_(struct jail32 *)]; }; @@ -247,6 +286,10 @@ struct freebsd32_sigwaitinfo_args { char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)]; char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)]; }; +struct freebsd32_aio_waitcomplete_args { + char aiocbp_l_[PADL_(struct aiocb32 **)]; struct aiocb32 ** aiocbp; char aiocbp_r_[PADR_(struct aiocb32 **)]; + char timeout_l_[PADL_(struct timespec32 *)]; struct timespec32 * timeout; char timeout_r_[PADR_(struct timespec32 *)]; +}; struct freebsd32_kevent_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char changelist_l_[PADL_(const struct kevent32 *)]; const struct kevent32 * changelist; char changelist_r_[PADR_(const struct kevent32 *)]; @@ -308,6 +351,10 @@ struct freebsd32_thr_new_args { char param_l_[PADL_(struct thr_param32 *)]; struct thr_param32 * param; char param_r_[PADR_(struct thr_param32 *)]; char param_size_l_[PADL_(int)]; int param_size; char param_size_r_[PADR_(int)]; }; +struct freebsd32_aio_fsync_args { + char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)]; + char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; +}; struct freebsd32_pread_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; @@ -427,13 +474,24 @@ int freebsd32_clock_gettime(struct threa int freebsd32_clock_settime(struct thread *, struct freebsd32_clock_settime_args *); int freebsd32_clock_getres(struct thread *, struct freebsd32_clock_getres_args *); int freebsd32_nanosleep(struct thread *, struct freebsd32_nanosleep_args *); +int freebsd32_aio_read(struct thread *, struct freebsd32_aio_read_args *); +int freebsd32_aio_write(struct thread *, struct freebsd32_aio_write_args *); +int freebsd32_lio_listio(struct thread *, struct freebsd32_lio_listio_args *); int freebsd32_lutimes(struct thread *, struct freebsd32_lutimes_args *); int freebsd32_preadv(struct thread *, struct freebsd32_preadv_args *); int freebsd32_pwritev(struct thread *, struct freebsd32_pwritev_args *); int freebsd32_modstat(struct thread *, struct freebsd32_modstat_args *); +int freebsd32_aio_return(struct thread *, struct freebsd32_aio_return_args *); +int freebsd32_aio_suspend(struct thread *, struct freebsd32_aio_suspend_args *); +int freebsd32_aio_cancel(struct thread *, struct freebsd32_aio_cancel_args *); +int freebsd32_aio_error(struct thread *, struct freebsd32_aio_error_args *); +int freebsd32_oaio_read(struct thread *, struct freebsd32_oaio_read_args *); +int freebsd32_oaio_write(struct thread *, struct freebsd32_oaio_write_args *); +int freebsd32_olio_listio(struct thread *, struct freebsd32_olio_listio_args *); int freebsd32_jail(struct thread *, struct freebsd32_jail_args *); int freebsd32_sigtimedwait(struct thread *, struct freebsd32_sigtimedwait_args *); int freebsd32_sigwaitinfo(struct thread *, struct freebsd32_sigwaitinfo_args *); +int freebsd32_aio_waitcomplete(struct thread *, struct freebsd32_aio_waitcomplete_args *); int freebsd32_kevent(struct thread *, struct freebsd32_kevent_args *); int freebsd32_nmount(struct thread *, struct freebsd32_nmount_args *); int freebsd32_sendfile(struct thread *, struct freebsd32_sendfile_args *); @@ -447,6 +505,7 @@ int freebsd32_umtx_unlock(struct thread int freebsd32_thr_suspend(struct thread *, struct freebsd32_thr_suspend_args *); int freebsd32_umtx_op(struct thread *, struct freebsd32_umtx_op_args *); int freebsd32_thr_new(struct thread *, struct freebsd32_thr_new_args *); +int freebsd32_aio_fsync(struct thread *, struct freebsd32_aio_fsync_args *); int freebsd32_pread(struct thread *, struct freebsd32_pread_args *); int freebsd32_pwrite(struct thread *, struct freebsd32_pwrite_args *); int freebsd32_mmap(struct thread *, struct freebsd32_mmap_args *); @@ -641,13 +700,24 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_clock_settime AUE_CLOCK_SETTIME #define FREEBSD32_SYS_AUE_freebsd32_clock_getres AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_nanosleep AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_aio_read AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_aio_write AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_lio_listio AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_lutimes AUE_LUTIMES #define FREEBSD32_SYS_AUE_freebsd32_preadv AUE_PREADV #define FREEBSD32_SYS_AUE_freebsd32_pwritev AUE_PWRITEV #define FREEBSD32_SYS_AUE_freebsd32_modstat AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_aio_return AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_aio_suspend AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_aio_cancel AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_aio_error AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_oaio_read AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_oaio_write AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_olio_listio AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_jail AUE_JAIL #define FREEBSD32_SYS_AUE_freebsd32_sigtimedwait AUE_SIGWAIT #define FREEBSD32_SYS_AUE_freebsd32_sigwaitinfo AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_aio_waitcomplete AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_kevent AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_nmount AUE_NMOUNT #define FREEBSD32_SYS_AUE_freebsd32_sendfile AUE_SENDFILE @@ -661,6 +731,7 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_thr_suspend AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_umtx_op AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_thr_new AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_aio_fsync AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_pread AUE_PREAD #define FREEBSD32_SYS_AUE_freebsd32_pwrite AUE_PWRITE #define FREEBSD32_SYS_AUE_freebsd32_mmap AUE_MMAP Modified: projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_signal.h ============================================================================== --- projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_signal.h Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_signal.h Thu Dec 11 08:08:28 2008 (r185921) @@ -36,6 +36,9 @@ struct sigaltstack32 { }; union sigval32 { + int sival_int; + u_int32_t sival_ptr; + /* 6.0 compatibility */ int sigval_int; u_int32_t sigval_ptr; }; @@ -70,6 +73,29 @@ struct siginfo32 { } _reason; }; +struct osigevent32 { + int sigev_notify; /* Notification type */ + union { + int __sigev_signo; /* Signal number */ + int __sigev_notify_kqueue; + } __sigev_u; + union sigval32 sigev_value; /* Signal value */ +}; + +struct sigevent32 { + int sigev_notify; /* Notification type */ + int sigev_signo; /* Signal number */ + union sigval32 sigev_value; /* Signal value */ + union { + __lwpid_t _threadid; + struct { + uint32_t _function; + uint32_t _attribute; + } _sigev_thread; + uint32_t __spare__[8]; + } _sigev_un; +}; + void siginfo_to_siginfo32(siginfo_t *src, struct siginfo32 *dst); #endif /* !_COMPAT_FREEBSD32_SIGNAL_H_ */ Modified: projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_syscall.h Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_syscall.h Thu Dec 11 08:08:28 2008 (r185921) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185435 2008-11-29 14:32:14Z bz + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185878 2008-12-10 20:56:19Z jhb */ #define FREEBSD32_SYS_syscall 0 @@ -210,6 +210,9 @@ #define FREEBSD32_SYS_openbsd_poll 252 #define FREEBSD32_SYS_issetugid 253 #define FREEBSD32_SYS_lchown 254 +#define FREEBSD32_SYS_freebsd32_aio_read 255 +#define FREEBSD32_SYS_freebsd32_aio_write 256 +#define FREEBSD32_SYS_freebsd32_lio_listio 257 #define FREEBSD32_SYS_getdents 272 #define FREEBSD32_SYS_lchmod 274 #define FREEBSD32_SYS_netbsd_lchown 275 @@ -237,6 +240,13 @@ #define FREEBSD32_SYS_setresuid 311 #define FREEBSD32_SYS_setresgid 312 /* 313 is obsolete signanosleep */ +#define FREEBSD32_SYS_freebsd32_aio_return 314 +#define FREEBSD32_SYS_freebsd32_aio_suspend 315 +#define FREEBSD32_SYS_freebsd32_aio_cancel 316 +#define FREEBSD32_SYS_freebsd32_aio_error 317 +#define FREEBSD32_SYS_freebsd32_oaio_read 318 +#define FREEBSD32_SYS_freebsd32_oaio_write 319 +#define FREEBSD32_SYS_freebsd32_olio_listio 320 #define FREEBSD32_SYS_yield 321 /* 322 is obsolete thr_sleep */ /* 323 is obsolete thr_wakeup */ @@ -274,6 +284,7 @@ #define FREEBSD32_SYS_extattr_set_file 356 #define FREEBSD32_SYS_extattr_get_file 357 #define FREEBSD32_SYS_extattr_delete_file 358 +#define FREEBSD32_SYS_freebsd32_aio_waitcomplete 359 #define FREEBSD32_SYS_getresuid 360 #define FREEBSD32_SYS_getresgid 361 #define FREEBSD32_SYS_kqueue 362 @@ -321,6 +332,7 @@ #define FREEBSD32_SYS_sigqueue 456 #define FREEBSD32_SYS_abort2 463 #define FREEBSD32_SYS_thr_set_name 464 +#define FREEBSD32_SYS_freebsd32_aio_fsync 465 #define FREEBSD32_SYS_rtprio_thread 466 #define FREEBSD32_SYS_sctp_peeloff 471 #define FREEBSD32_SYS_sctp_generic_sendmsg 472 Modified: projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_syscalls.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_syscalls.c Thu Dec 11 08:08:28 2008 (r185921) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185435 2008-11-29 14:32:14Z bz + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185878 2008-12-10 20:56:19Z jhb */ const char *freebsd32_syscallnames[] = { @@ -262,9 +262,9 @@ const char *freebsd32_syscallnames[] = { "openbsd_poll", /* 252 = openbsd_poll */ "issetugid", /* 253 = issetugid */ "lchown", /* 254 = lchown */ - "#255", /* 255 = nosys */ - "#256", /* 256 = nosys */ - "#257", /* 257 = nosys */ + "freebsd32_aio_read", /* 255 = freebsd32_aio_read */ + "freebsd32_aio_write", /* 256 = freebsd32_aio_write */ + "freebsd32_lio_listio", /* 257 = freebsd32_lio_listio */ "#258", /* 258 = nosys */ "#259", /* 259 = nosys */ "#260", /* 260 = nosys */ @@ -321,13 +321,13 @@ const char *freebsd32_syscallnames[] = { "setresuid", /* 311 = setresuid */ "setresgid", /* 312 = setresgid */ "obs_signanosleep", /* 313 = obsolete signanosleep */ - "#314", /* 314 = aio_return */ - "#315", /* 315 = aio_suspend */ - "#316", /* 316 = aio_cancel */ - "#317", /* 317 = aio_error */ - "#318", /* 318 = aio_read */ - "#319", /* 319 = aio_write */ - "#320", /* 320 = lio_listio */ + "freebsd32_aio_return", /* 314 = freebsd32_aio_return */ + "freebsd32_aio_suspend", /* 315 = freebsd32_aio_suspend */ + "freebsd32_aio_cancel", /* 316 = freebsd32_aio_cancel */ + "freebsd32_aio_error", /* 317 = freebsd32_aio_error */ + "freebsd32_oaio_read", /* 318 = freebsd32_oaio_read */ + "freebsd32_oaio_write", /* 319 = freebsd32_oaio_write */ + "freebsd32_olio_listio", /* 320 = freebsd32_olio_listio */ "yield", /* 321 = yield */ "obs_thr_sleep", /* 322 = obsolete thr_sleep */ "obs_thr_wakeup", /* 323 = obsolete thr_wakeup */ @@ -366,7 +366,7 @@ const char *freebsd32_syscallnames[] = { "extattr_set_file", /* 356 = extattr_set_file */ "extattr_get_file", /* 357 = extattr_get_file */ "extattr_delete_file", /* 358 = extattr_delete_file */ - "#359", /* 359 = aio_waitcomplete */ + "freebsd32_aio_waitcomplete", /* 359 = freebsd32_aio_waitcomplete */ "getresuid", /* 360 = getresuid */ "getresgid", /* 361 = getresgid */ "kqueue", /* 362 = kqueue */ @@ -472,7 +472,7 @@ const char *freebsd32_syscallnames[] = { "#462", /* 462 = kmq_unlink */ "abort2", /* 463 = abort2 */ "thr_set_name", /* 464 = thr_set_name */ - "#465", /* 465 = aio_fsync */ + "freebsd32_aio_fsync", /* 465 = freebsd32_aio_fsync */ "rtprio_thread", /* 466 = rtprio_thread */ "#467", /* 467 = nosys */ "#468", /* 468 = nosys */ Modified: projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_sysent.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/compat/freebsd32/freebsd32_sysent.c Thu Dec 11 08:08:28 2008 (r185921) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185435 2008-11-29 14:32:14Z bz + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185878 2008-12-10 20:56:19Z jhb */ #include "opt_compat.h" @@ -293,9 +293,9 @@ struct sysent freebsd32_sysent[] = { { AS(openbsd_poll_args), (sy_call_t *)openbsd_poll, AUE_POLL, NULL, 0, 0 }, /* 252 = openbsd_poll */ { 0, (sy_call_t *)issetugid, AUE_ISSETUGID, NULL, 0, 0 }, /* 253 = issetugid */ { AS(lchown_args), (sy_call_t *)lchown, AUE_LCHOWN, NULL, 0, 0 }, /* 254 = lchown */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 255 = nosys */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 256 = nosys */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 257 = nosys */ + { AS(freebsd32_aio_read_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 255 = freebsd32_aio_read */ + { AS(freebsd32_aio_write_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 256 = freebsd32_aio_write */ + { AS(freebsd32_lio_listio_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 257 = freebsd32_lio_listio */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 258 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 259 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 260 = nosys */ @@ -352,13 +352,13 @@ struct sysent freebsd32_sysent[] = { { AS(setresuid_args), (sy_call_t *)setresuid, AUE_SETRESUID, NULL, 0, 0 }, /* 311 = setresuid */ { AS(setresgid_args), (sy_call_t *)setresgid, AUE_SETRESGID, NULL, 0, 0 }, /* 312 = setresgid */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 313 = obsolete signanosleep */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 314 = aio_return */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 315 = aio_suspend */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 316 = aio_cancel */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 317 = aio_error */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 318 = aio_read */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 319 = aio_write */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 320 = lio_listio */ + { AS(freebsd32_aio_return_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 314 = freebsd32_aio_return */ + { AS(freebsd32_aio_suspend_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 315 = freebsd32_aio_suspend */ + { AS(freebsd32_aio_cancel_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 316 = freebsd32_aio_cancel */ + { AS(freebsd32_aio_error_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 317 = freebsd32_aio_error */ + { AS(freebsd32_oaio_read_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 318 = freebsd32_oaio_read */ + { AS(freebsd32_oaio_write_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 319 = freebsd32_oaio_write */ + { AS(freebsd32_olio_listio_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 320 = freebsd32_olio_listio */ { 0, (sy_call_t *)yield, AUE_NULL, NULL, 0, 0 }, /* 321 = yield */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 322 = obsolete thr_sleep */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 323 = obsolete thr_wakeup */ @@ -397,7 +397,7 @@ struct sysent freebsd32_sysent[] = { { AS(extattr_set_file_args), (sy_call_t *)extattr_set_file, AUE_EXTATTR_SET_FILE, NULL, 0, 0 }, /* 356 = extattr_set_file */ { AS(extattr_get_file_args), (sy_call_t *)extattr_get_file, AUE_EXTATTR_GET_FILE, NULL, 0, 0 }, /* 357 = extattr_get_file */ { AS(extattr_delete_file_args), (sy_call_t *)extattr_delete_file, AUE_EXTATTR_DELETE_FILE, NULL, 0, 0 }, /* 358 = extattr_delete_file */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 359 = aio_waitcomplete */ + { AS(freebsd32_aio_waitcomplete_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 359 = freebsd32_aio_waitcomplete */ { AS(getresuid_args), (sy_call_t *)getresuid, AUE_GETRESUID, NULL, 0, 0 }, /* 360 = getresuid */ { AS(getresgid_args), (sy_call_t *)getresgid, AUE_GETRESGID, NULL, 0, 0 }, /* 361 = getresgid */ { 0, (sy_call_t *)kqueue, AUE_KQUEUE, NULL, 0, 0 }, /* 362 = kqueue */ @@ -503,7 +503,7 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 462 = kmq_unlink */ { AS(abort2_args), (sy_call_t *)abort2, AUE_NULL, NULL, 0, 0 }, /* 463 = abort2 */ { AS(thr_set_name_args), (sy_call_t *)thr_set_name, AUE_NULL, NULL, 0, 0 }, /* 464 = thr_set_name */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 465 = aio_fsync */ + { AS(freebsd32_aio_fsync_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0 }, /* 465 = freebsd32_aio_fsync */ { AS(rtprio_thread_args), (sy_call_t *)rtprio_thread, AUE_RTPRIO, NULL, 0, 0 }, /* 466 = rtprio_thread */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 467 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 468 = nosys */ Modified: projects/arpv2_merge_1/sys/compat/freebsd32/syscalls.master ============================================================================== --- projects/arpv2_merge_1/sys/compat/freebsd32/syscalls.master Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/compat/freebsd32/syscalls.master Thu Dec 11 08:08:28 2008 (r185921) @@ -454,9 +454,13 @@ u_int nfds, int timeout); } 253 AUE_ISSETUGID NOPROTO { int issetugid(void); } 254 AUE_LCHOWN NOPROTO { int lchown(char *path, int uid, int gid); } -255 AUE_NULL UNIMPL nosys -256 AUE_NULL UNIMPL nosys -257 AUE_NULL UNIMPL nosys +255 AUE_NULL NOSTD { int freebsd32_aio_read( \ + struct aiocb32 *aiocbp); } +256 AUE_NULL NOSTD { int freebsd32_aio_write( \ + struct aiocb32 *aiocbp); } +257 AUE_NULL NOSTD { int freebsd32_lio_listio(int mode, \ + struct aiocb32 * const *acb_list, \ + int nent, struct sigevent *sig); } 258 AUE_NULL UNIMPL nosys 259 AUE_NULL UNIMPL nosys 260 AUE_NULL UNIMPL nosys @@ -535,13 +539,22 @@ 312 AUE_SETRESGID NOPROTO { int setresgid(gid_t rgid, gid_t egid, \ gid_t sgid); } 313 AUE_NULL OBSOL signanosleep -314 AUE_NULL UNIMPL aio_return -315 AUE_NULL UNIMPL aio_suspend -316 AUE_NULL UNIMPL aio_cancel -317 AUE_NULL UNIMPL aio_error -318 AUE_NULL UNIMPL aio_read -319 AUE_NULL UNIMPL aio_write -320 AUE_NULL UNIMPL lio_listio +314 AUE_NULL NOSTD { int freebsd32_aio_return( \ + struct aiocb32 *aiocbp); } +315 AUE_NULL NOSTD { int freebsd32_aio_suspend( \ + struct aiocb32 * const * aiocbp, int nent, \ + const struct timespec32 *timeout); } +316 AUE_NULL NOSTD { int freebsd32_aio_cancel(int fd, \ + struct aiocb32 *aiocbp); } +317 AUE_NULL NOSTD { int freebsd32_aio_error( \ + struct aiocb32 *aiocbp); } +318 AUE_NULL NOSTD { int freebsd32_oaio_read( \ + struct oaiocb32 *aiocbp); } +319 AUE_NULL NOSTD { int freebsd32_oaio_write( \ + struct oaiocb32 *aiocbp); } +320 AUE_NULL NOSTD { int freebsd32_olio_listio(int mode, \ + struct oaiocb32 * const *acb_list, \ + int nent, struct osigevent32 *sig); } 321 AUE_NULL NOPROTO { int yield(void); } 322 AUE_NULL OBSOL thr_sleep 323 AUE_NULL OBSOL thr_wakeup @@ -618,7 +631,9 @@ 358 AUE_EXTATTR_DELETE_FILE NOPROTO { int extattr_delete_file( \ const char *path, int attrnamespace, \ const char *attrname); } -359 AUE_NULL UNIMPL aio_waitcomplete +359 AUE_NULL NOSTD { int freebsd32_aio_waitcomplete( \ + struct aiocb32 **aiocbp, \ + struct timespec32 *timeout); } 360 AUE_GETRESUID NOPROTO { int getresuid(uid_t *ruid, uid_t *euid, \ uid_t *suid); } 361 AUE_GETRESGID NOPROTO { int getresgid(gid_t *rgid, gid_t *egid, \ @@ -766,7 +781,8 @@ 462 AUE_NULL UNIMPL kmq_unlink 463 AUE_NULL NOPROTO { int abort2(const char *why, int nargs, void **args); } 464 AUE_NULL NOPROTO { int thr_set_name(long id, const char *name); } -465 AUE_NULL UNIMPL aio_fsync +465 AUE_NULL NOSTD { int freebsd32_aio_fsync(int op, \ + struct aiocb32 *aiocbp); } 466 AUE_RTPRIO NOPROTO { int rtprio_thread(int function, \ lwpid_t lwpid, struct rtprio *rtp); } 467 AUE_NULL UNIMPL nosys Modified: projects/arpv2_merge_1/sys/compat/linprocfs/linprocfs.c ============================================================================== --- projects/arpv2_merge_1/sys/compat/linprocfs/linprocfs.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/compat/linprocfs/linprocfs.c Thu Dec 11 08:08:28 2008 (r185921) @@ -969,11 +969,11 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) ); if (freename) free(freename, M_TEMP); + vm_map_lock_read(map); if (error == -1) { error = 0; break; } - vm_map_lock_read(map); if (last_timestamp + 1 != map->timestamp) { /* * Look again for the entry because the map was Modified: projects/arpv2_merge_1/sys/conf/files ============================================================================== --- projects/arpv2_merge_1/sys/conf/files Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/conf/files Thu Dec 11 08:08:28 2008 (r185921) @@ -1953,6 +1953,7 @@ kern/kern_timeout.c standard kern/kern_umtx.c standard kern/kern_uuid.c standard kern/kern_xxx.c standard +kern/kern_vimage.c standard kern/link_elf.c standard kern/linker_if.m standard kern/md4c.c optional netsmb Modified: projects/arpv2_merge_1/sys/conf/options ============================================================================== --- projects/arpv2_merge_1/sys/conf/options Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/conf/options Thu Dec 11 08:08:28 2008 (r185921) @@ -415,6 +415,7 @@ TCPDEBUG TCP_OFFLOAD_DISABLE opt_inet.h #Disable code to dispatch tcp offloading TCP_SIGNATURE opt_inet.h VLAN_ARRAY opt_vlan.h +VIMAGE_GLOBALS opt_global.h XBONEHACK # Modified: projects/arpv2_merge_1/sys/contrib/pf/net/pf_subr.c ============================================================================== --- projects/arpv2_merge_1/sys/contrib/pf/net/pf_subr.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/contrib/pf/net/pf_subr.c Thu Dec 11 08:08:28 2008 (r185921) @@ -124,15 +124,14 @@ static MD5_CTX isn_ctx; u_int32_t pf_new_isn(struct pf_state *s) { - INIT_VNET_INET(curvnet); u_int32_t md5_buffer[4]; u_int32_t new_isn; struct pf_state_host *src, *dst; /* Seed if this is the first use, reseed if requested. */ - if (V_isn_last_reseed == 0) { - read_random(&V_isn_secret, sizeof(V_isn_secret)); - V_isn_last_reseed = ticks; + if (isn_last_reseed == 0) { + read_random(&isn_secret, sizeof(isn_secret)); + isn_last_reseed = ticks; } if (s->direction == PF_IN) { @@ -144,28 +143,28 @@ pf_new_isn(struct pf_state *s) } /* Compute the md5 hash and return the ISN. */ - MD5Init(&V_isn_ctx); - MD5Update(&V_isn_ctx, (u_char *) &dst->port, sizeof(u_short)); - MD5Update(&V_isn_ctx, (u_char *) &src->port, sizeof(u_short)); + MD5Init(&isn_ctx); + MD5Update(&isn_ctx, (u_char *) &dst->port, sizeof(u_short)); + MD5Update(&isn_ctx, (u_char *) &src->port, sizeof(u_short)); #ifdef INET6 if (s->af == AF_INET6) { - MD5Update(&V_isn_ctx, (u_char *) &dst->addr, + MD5Update(&isn_ctx, (u_char *) &dst->addr, sizeof(struct in6_addr)); - MD5Update(&V_isn_ctx, (u_char *) &src->addr, + MD5Update(&isn_ctx, (u_char *) &src->addr, sizeof(struct in6_addr)); } else #endif { - MD5Update(&V_isn_ctx, (u_char *) &dst->addr, + MD5Update(&isn_ctx, (u_char *) &dst->addr, sizeof(struct in_addr)); - MD5Update(&V_isn_ctx, (u_char *) &src->addr, + MD5Update(&isn_ctx, (u_char *) &src->addr, sizeof(struct in_addr)); } - MD5Update(&V_isn_ctx, (u_char *) &V_isn_secret, sizeof(V_isn_secret)); - MD5Final((u_char *) &md5_buffer, &V_isn_ctx); + MD5Update(&isn_ctx, (u_char *) &isn_secret, sizeof(isn_secret)); + MD5Final((u_char *) &md5_buffer, &isn_ctx); new_isn = (tcp_seq) md5_buffer[0]; - V_isn_offset += ISN_STATIC_INCREMENT + + isn_offset += ISN_STATIC_INCREMENT + (arc4random() & ISN_RANDOM_INCREMENT); - new_isn += V_isn_offset; + new_isn += isn_offset; return (new_isn); } Modified: projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v14.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v14.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v14.c Thu Dec 11 08:08:28 2008 (r185921) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ah_eeprom_v14.c,v 1.4 2008/11/10 19:04:26 sam Exp $ + * $FreeBSD$ */ #include "opt_ah.h" @@ -54,6 +54,7 @@ v14EepromGet(struct ath_hal *ah, int par __func__, ath_hal_ether_sprintf(macaddr)); return HAL_EEBADMAC; } + return HAL_OK; case AR_EEP_REGDMN_0: return pBase->regDmn[0]; case AR_EEP_REGDMN_1: Modified: projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Thu Dec 11 08:08:28 2008 (r185921) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ar5212_misc.c,v 1.12 2008/11/27 22:30:00 sam Exp $ + * $FreeBSD$ */ #include "opt_ah.h" @@ -803,6 +803,7 @@ ar5212GetCapability(struct ath_hal *ah, return (ahp->ah_staId1Defaults & AR_STA_ID1_CRPT_MIC_ENABLE) ? HAL_OK : HAL_ENXIO; } + return HAL_EINVAL; case HAL_CAP_TKIP_SPLIT: /* hardware TKIP uses split keys */ switch (capability) { case 0: /* hardware capability */ Modified: projects/arpv2_merge_1/sys/dev/pccbb/pccbb_pci.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/pccbb/pccbb_pci.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/dev/pccbb/pccbb_pci.c Thu Dec 11 08:08:28 2008 (r185921) @@ -682,40 +682,67 @@ cbb_pci_shutdown(device_t brdev) return (0); } -#define DELTA (CBB_SOCKET_MASK_CD) static int cbb_pci_filt(void *arg) { struct cbb_softc *sc = arg; uint32_t sockevent; + uint8_t csc; int retval = FILTER_STRAY; /* - * Read the socket event. Sometimes, the theory goes, the PCI - * bus is so loaded that it cannot satisfy the read request, so - * we get garbage back from the following read. We have to filter - * out the garbage so that we don't spontaneously reset the card - * under high load. PCI isn't supposed to act like this. No doubt - * this is a bug in the PCI bridge chipset (or cbb brige) that's being - * used in certain amd64 laptops today. Work around the issue by - * assuming that any bits we don't know about being set means that - * we got garbage. + * Some chips also require us to read the old ExCA registe for card + * status change when we route CSC vis PCI. This isn't supposed to be + * required, but it clears the interrupt state on some chipsets. + * Maybe there's a setting that would obviate its need. Maybe we + * should test the status bits and deal with them, but so far we've + * not found any machines that don't also give us the socket status + * indication above. + * + * This call used to be unconditional. However, further research + * suggests that we hit this condition when the card READY interrupt + * fired. So now we only read it for 16-bit cards, and we only claim + * the interrupt if READY is set. If this still causes problems, then + * the next step would be to read this if we have a 16-bit card *OR* + * we have no card. We treat the READY signal as if it were the power + * completion signal. Some bridges may double signal things here, bit + * signalling twice should be OK since we only sleep on the powerintr + * in one place and a double wakeup would be benign there. + */ + if (sc->flags & CBB_16BIT_CARD) { + csc = exca_getb(&sc->exca[0], EXCA_CSC); + if (csc & EXCA_CSC_READY) { + atomic_add_int(&sc->powerintr, 1); + wakeup((void *)&sc->powerintr); + retval = FILTER_HANDLED; + } + } + + /* + * Read the socket event. Sometimes, the theory goes, the PCI bus is + * so loaded that it cannot satisfy the read request, so we get + * garbage back from the following read. We have to filter out the + * garbage so that we don't spontaneously reset the card under high + * load. PCI isn't supposed to act like this. No doubt this is a bug + * in the PCI bridge chipset (or cbb brige) that's being used in + * certain amd64 laptops today. Work around the issue by assuming + * that any bits we don't know about being set means that we got + * garbage. */ sockevent = cbb_get(sc, CBB_SOCKET_EVENT); if (sockevent != 0 && (sockevent & ~CBB_SOCKET_EVENT_VALID_MASK) == 0) { /* - * If anything has happened to the socket, we assume that - * the card is no longer OK, and we shouldn't call its - * ISR. We set cardok as soon as we've attached the - * card. This helps in a noisy eject, which happens - * all too often when users are ejecting their PC Cards. + * If anything has happened to the socket, we assume that the + * card is no longer OK, and we shouldn't call its ISR. We + * set cardok as soon as we've attached the card. This helps + * in a noisy eject, which happens all too often when users + * are ejecting their PC Cards. * - * We use this method in preference to checking to see if - * the card is still there because the check suffers from - * a race condition in the bouncing case. Prior versions - * of the pccard software used a similar trick and achieved - * excellent results. + * We use this method in preference to checking to see if the + * card is still there because the check suffers from a race + * condition in the bouncing case. */ +#define DELTA (CBB_SOCKET_MASK_CD) if (sockevent & DELTA) { cbb_clrb(sc, CBB_SOCKET_MASK, DELTA); cbb_set(sc, CBB_SOCKET_EVENT, DELTA); @@ -723,9 +750,11 @@ cbb_pci_filt(void *arg) cbb_disable_func_intr(sc); wakeup(&sc->intrhand); } +#undef DELTA + /* - * If we get a power interrupt, wakeup anybody that might - * be waiting for one. + * Wakeup anybody waiting for a power interrupt. We have to + * use atomic_add_int for wakups on other cores. */ if (sockevent & CBB_SOCKET_EVENT_POWER) { cbb_clrb(sc, CBB_SOCKET_MASK, CBB_SOCKET_EVENT_POWER); @@ -733,21 +762,15 @@ cbb_pci_filt(void *arg) atomic_add_int(&sc->powerintr, 1); wakeup((void *)&sc->powerintr); } + + /* + * Status change interrupts aren't presently used in the + * rest of the driver. For now, just ACK them. + */ + if (sockevent & CBB_SOCKET_EVENT_CSTS) + cbb_set(sc, CBB_SOCKET_EVENT, CBB_SOCKET_EVENT_CSTS); retval = FILTER_HANDLED; } - /* - * Some chips also require us to read the old ExCA registe for - * card status change when we route CSC vis PCI. This isn't supposed - * to be required, but it clears the interrupt state on some chipsets. - * Maybe there's a setting that would obviate its need. Maybe we - * should test the status bits and deal with them, but so far we've - * not found any machines that don't also give us the socket status - * indication above. - * - * We have to call this unconditionally because some bridges deliver - * the event independent of the CBB_SOCKET_EVENT_CD above. - */ - exca_getb(&sc->exca[0], EXCA_CSC); return retval; } Modified: projects/arpv2_merge_1/sys/dev/re/if_re.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/re/if_re.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/dev/re/if_re.c Thu Dec 11 08:08:28 2008 (r185921) @@ -419,10 +419,10 @@ re_gmii_readreg(device_t dev, int phy, i CSR_WRITE_4(sc, RL_PHYAR, reg << 16); for (i = 0; i < RL_TIMEOUT; i++) { - DELAY(30); rval = CSR_READ_4(sc, RL_PHYAR); if (rval & RL_PHYAR_BUSY) break; + DELAY(100); } if (i == RL_TIMEOUT) { @@ -446,10 +446,10 @@ re_gmii_writereg(device_t dev, int phy, (data & RL_PHYAR_PHYDATA) | RL_PHYAR_BUSY); for (i = 0; i < RL_TIMEOUT; i++) { - DELAY(30); rval = CSR_READ_4(sc, RL_PHYAR); if (!(rval & RL_PHYAR_BUSY)) break; + DELAY(100); } if (i == RL_TIMEOUT) { @@ -700,7 +700,12 @@ re_reset(struct rl_softc *sc) if (i == RL_TIMEOUT) device_printf(sc->rl_dev, "reset never completed!\n"); - CSR_WRITE_1(sc, 0x82, 1); + if ((sc->rl_flags & RL_FLAG_PHY8169) != 0) + CSR_WRITE_1(sc, 0x82, 1); + if ((sc->rl_flags & RL_FLAG_PHY8110S) != 0) { + CSR_WRITE_1(sc, 0x82, 1); + re_gmii_writereg(sc->rl_dev, 1, 0x0B, 0); + } } #ifdef RE_DIAG @@ -756,7 +761,6 @@ re_diag(struct rl_softc *sc) ifp->if_flags |= IFF_PROMISC; sc->rl_testmode = 1; - re_reset(sc); re_init_locked(sc); sc->rl_flags |= RL_FLAG_LINK; if (sc->rl_type == RL_8169) @@ -1236,6 +1240,9 @@ re_attach(device_t dev) case RL_HWREV_8139CPLUS: sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_FASTETHER; break; + case RL_HWREV_8110S: + sc->rl_flags |= RL_FLAG_PHY8110S; + break; case RL_HWREV_8100E: case RL_HWREV_8101E: sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_INVMAR | @@ -1245,10 +1252,12 @@ re_attach(device_t dev) case RL_HWREV_8102EL: sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_INVMAR | RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | - RL_FLAG_MACSTAT | RL_FLAG_FASTETHER; + RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP; break; case RL_HWREV_8168_SPIN1: case RL_HWREV_8168_SPIN2: + sc->rl_flags |= RL_FLAG_WOLRXENB; + /* FALLTHROUGH */ case RL_HWREV_8168_SPIN3: sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE | RL_FLAG_MACSTAT; @@ -1258,7 +1267,8 @@ re_attach(device_t dev) case RL_HWREV_8168CP: case RL_HWREV_8168D: sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE | - RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT; + RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | + RL_FLAG_CMDSTOP; /* * These controllers support jumbo frame but it seems * that enabling it requires touching additional magic @@ -1271,10 +1281,14 @@ re_attach(device_t dev) */ sc->rl_flags |= RL_FLAG_NOJUMBO; break; + case RL_HWREV_8169: + case RL_HWREV_8169S: + sc->rl_flags |= RL_FLAG_PHY8169; + break; case RL_HWREV_8169_8110SB: case RL_HWREV_8169_8110SC: case RL_HWREV_8169_8110SBL: - sc->rl_flags |= RL_FLAG_PHYWAKE; + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHY8169; break; default: break; @@ -2091,10 +2105,8 @@ re_poll_locked(struct ifnet *ifp, enum p * XXX check behaviour on receiver stalls. */ - if (status & RL_ISR_SYSTEM_ERR) { - re_reset(sc); + if (status & RL_ISR_SYSTEM_ERR) re_init_locked(sc); - } } } #endif /* DEVICE_POLLING */ @@ -2158,10 +2170,8 @@ re_int_task(void *arg, int npending) RL_ISR_TX_ERR|RL_ISR_TX_DESC_UNAVAIL)) re_txeof(sc); - if (status & RL_ISR_SYSTEM_ERR) { - re_reset(sc); + if (status & RL_ISR_SYSTEM_ERR) re_init_locked(sc); - } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) taskqueue_enqueue_fast(taskqueue_fast, &sc->rl_txtask); @@ -2482,6 +2492,9 @@ re_init_locked(struct rl_softc *sc) */ re_stop(sc); + /* Put controller into known state. */ + re_reset(sc); + /* * Enable C+ RX and TX mode, as well as VLAN stripping and * RX checksum offload. We must configure the C+ register @@ -2870,7 +2883,12 @@ re_stop(struct rl_softc *sc) callout_stop(&sc->rl_stat_callout); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - CSR_WRITE_1(sc, RL_COMMAND, 0x00); + if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_STOPREQ | RL_CMD_TX_ENB | + RL_CMD_RX_ENB); + else + CSR_WRITE_1(sc, RL_COMMAND, 0x00); + DELAY(1000); CSR_WRITE_2(sc, RL_IMR, 0x0000); CSR_WRITE_2(sc, RL_ISR, 0xFFFF); @@ -3000,6 +3018,9 @@ re_setwol(struct rl_softc *sc) return; ifp = sc->rl_ifp; + if ((ifp->if_capenable & IFCAP_WOL) != 0 && + (sc->rl_flags & RL_FLAG_WOLRXENB) != 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); /* Enable config register write. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); Modified: projects/arpv2_merge_1/sys/fs/procfs/procfs_map.c ============================================================================== --- projects/arpv2_merge_1/sys/fs/procfs/procfs_map.c Thu Dec 11 07:51:09 2008 (r185920) +++ projects/arpv2_merge_1/sys/fs/procfs/procfs_map.c Thu Dec 11 08:08:28 2008 (r185921) @@ -219,12 +219,11 @@ procfs_doprocmap(PFS_FILL_ARGS) if (freepath != NULL) free(freepath, M_TEMP); - + vm_map_lock_read(map); if (error == -1) { error = 0; break; } - vm_map_lock_read(map); if (last_timestamp + 1 != map->timestamp) { /* * Look again for the entry because the map was *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 09:52:45 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3800106564A; Thu, 11 Dec 2008 09:52:45 +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 B54588FC13; Thu, 11 Dec 2008 09:52:45 +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 mBB9qjxu061084; Thu, 11 Dec 2008 09:52:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBB9qjgg061083; Thu, 11 Dec 2008 09:52:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812110952.mBB9qjgg061083@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 09:52:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185927 - projects/arpv2_merge_1/share/man/man9 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 09:52:45 -0000 Author: kmacy Date: Thu Dec 11 09:52:45 2008 New Revision: 185927 URL: http://svn.freebsd.org/changeset/base/185927 Log: remove stale cloning references Modified: projects/arpv2_merge_1/share/man/man9/rtentry.9 Modified: projects/arpv2_merge_1/share/man/man9/rtentry.9 ============================================================================== --- projects/arpv2_merge_1/share/man/man9/rtentry.9 Thu Dec 11 09:13:30 2008 (r185926) +++ projects/arpv2_merge_1/share/man/man9/rtentry.9 Thu Dec 11 09:52:45 2008 (r185927) @@ -97,39 +97,12 @@ flag is not present, the .Fn rtfree function will delete the route from the radix tree when the last reference drops. -.It Vt "struct sockaddr *rt_genmask" ; -When the -.Fn rtalloc -family of functions performs a cloning operation as requested by the -.Dv RTF_CLONING -flag, this field is used as the mask for the new route which is -inserted into the table. -If this field is a null pointer, then a host -route is generated. -.It Vt "caddr_t rt_llinfo" ; -When the -.Dv RTF_LLINFO -flag is set, this field contains information specific to the link -layer represented by the named interface address. -(It is normally managed by the -.Va rt_ifa->ifa_rtrequest -routine.) -Protocols such as -.Xr arp 4 -use this field to reference per-destination state internal to that -protocol. .It Vt "struct rtentry *rt_gwroute" ; This member is a reference to a route whose destination is .Va rt_gateway . It is only used for .Dv RTF_GATEWAY routes. -.It Vt "struct rtentry *rt_parent" ; -A reference to the route from which this route was cloned, or a null -pointer if this route was not generated by cloning. -See also the -.Dv RTF_WASCLONED -flag. .It Vt "struct mtx rt_mtx" ; Mutex to lock this routing entry. .El @@ -162,23 +135,12 @@ This route was modified by Used only in the .Xr route 4 protocol, indicating that the request was executed. -.It Dv RTF_CLONING -When this route is returned as a result of a lookup, automatically -create a new route using this one as a template and -.Va rt_genmask -(if present) as a mask. .It Dv RTF_XRESOLVE When this route is returned as a result of a lookup, send a report on the .Xr route 4 interface requesting that an external process perform resolution for this route. -(Used in conjunction with -.Dv RTF_CLONING . ) -.It Dv RTF_LLINFO -Indicates that this route represents information being managed by a -link layer's adaptation layer (e.g., -.Tn ARP ) . .It Dv RTF_STATIC Indicates that this route was manually added by means of the .Xr route 8 @@ -191,14 +153,6 @@ Requests that output sent via this route Protocol-specific. .It Dv RTF_PRCLONING This flag is obsolete and simply ignored by facility. -.It Dv RTF_WASCLONED -Indicates that this route was generated as a result of cloning -requested by the -.Dv RTF_CLONING -flag. -When set, the -.Va rt_parent -field indicates the route from which this one was generated. .It Dv RTF_PINNED (Reserved for future use to indicate routes which are not to be modified by a routing protocol.) @@ -297,7 +251,4 @@ and .Va rmx_filler fields could be named better. .Pp -There is some disagreement over whether it is legitimate for -.Dv RTF_LLINFO -to be set by any process other than -.Va rt_ifa->ifa_rtrequest . + From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 22:20:37 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 401CE1065672; Thu, 11 Dec 2008 22:20:37 +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 2FB638FC2A; Thu, 11 Dec 2008 22:20:37 +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 mBBMKbqM078146; Thu, 11 Dec 2008 22:20:37 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBMKbUj078145; Thu, 11 Dec 2008 22:20:37 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812112220.mBBMKbUj078145@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 22:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185943 - projects/arpv2_merge_1/sys/modules/cxgb X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 22:20:37 -0000 Author: kmacy Date: Thu Dec 11 22:20:36 2008 New Revision: 185943 URL: http://svn.freebsd.org/changeset/base/185943 Log: L2 handling needs to be re-written - disable TOE for the moment Modified: projects/arpv2_merge_1/sys/modules/cxgb/Makefile Modified: projects/arpv2_merge_1/sys/modules/cxgb/Makefile ============================================================================== --- projects/arpv2_merge_1/sys/modules/cxgb/Makefile Thu Dec 11 21:44:02 2008 (r185942) +++ projects/arpv2_merge_1/sys/modules/cxgb/Makefile Thu Dec 11 22:20:36 2008 (r185943) @@ -25,7 +25,7 @@ _toe_header = ${_sysdir}/netinet/toedev. .if exists(${_toe_header}) _toecore = toecore -_tom = tom +#_tom = tom .endif .if ${MACHINE_ARCH} == "i386" && exists(${_toe_header}) From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 23:01:58 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95CF2106564A; Thu, 11 Dec 2008 23:01:58 +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 84FA78FC0C; Thu, 11 Dec 2008 23:01:58 +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 mBBN1wV9079071; Thu, 11 Dec 2008 23:01:58 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBN1w9R079070; Thu, 11 Dec 2008 23:01:58 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812112301.mBBN1w9R079070@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 23:01:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185946 - projects/arpv2_merge_1/share/man/man9 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 23:01:58 -0000 Author: kmacy Date: Thu Dec 11 23:01:58 2008 New Revision: 185946 URL: http://svn.freebsd.org/changeset/base/185946 Log: update to reflect absence of RTF_CLONING Modified: projects/arpv2_merge_1/share/man/man9/rtalloc.9 Modified: projects/arpv2_merge_1/share/man/man9/rtalloc.9 ============================================================================== --- projects/arpv2_merge_1/share/man/man9/rtalloc.9 Thu Dec 11 22:51:11 2008 (r185945) +++ projects/arpv2_merge_1/share/man/man9/rtalloc.9 Thu Dec 11 23:01:58 2008 (r185946) @@ -64,21 +64,6 @@ certain protocol\- and interface-specifi .\" XXX - -mdoc should contain a standard request for getting em and .\" en dashes. .Pp -When a route with the flag -.Dv RTF_CLONING -is retrieved, and the action of this flag is not masked, the -.Nm -facility automatically generates a new route using information in the -old route as a template, and -sends an -.Dv RTM_RESOLVE -message to the appropriate interface-address route-management routine -.Pq Fn ifa->ifa_rtrequest . -This generated route is called -.Em cloned , -and has -.Dv RTF_WASCLONED -flag set. .Dv RTF_PRCLONING flag is obsolete and thus ignored by facility. If the @@ -123,22 +108,19 @@ field. .Pp The .Fn rtalloc_ign -interface can be used when the default actions of -.Fn rtalloc -in the presence of the -.Dv RTF_CLONING -flag is undesired. +interface can be used when the caller does not want to receive +the returned +.Fa rtentry +locked. The .Fa ro argument is the same as .Fn rtalloc , but there is additionally a .Fa flags -argument, which lists the flags in the route which are to be -.Em ignored -(in most cases this is -.Dv RTF_CLONING -flag). +argument, which is now only used to pass +.Dv RTF_RNH_LOCKED +indicating that the radix tree lock is already held. Both .Fn rtalloc and @@ -163,16 +145,7 @@ directly as the argument. The second argument, .Fa report , -controls whether -.Dv RTM_RESOLVE -requests are sent to the lower layers when an -.Dv RTF_CLONING -or -.Dv RTF_PRCLONING -route is cloned. -Ordinarily a value of one should be passed, except -in the processing of those lower layers which use the cloning -facility. +controls whether the lower layers are notifed when a lookup fails. The third argument, .Fa flags , is a set of flags to ignore, as in From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 23:04:34 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1F8B1065672; Thu, 11 Dec 2008 23:04:34 +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 E16918FC1C; Thu, 11 Dec 2008 23:04:34 +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 mBBN4YWT079154; Thu, 11 Dec 2008 23:04:34 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBN4YBM079153; Thu, 11 Dec 2008 23:04:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812112304.mBBN4YBM079153@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 23:04:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185947 - projects/arpv2_merge_1/share/man/man4 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 23:04:35 -0000 Author: kmacy Date: Thu Dec 11 23:04:34 2008 New Revision: 185947 URL: http://svn.freebsd.org/changeset/base/185947 Log: update to reflect absence of cloning Modified: projects/arpv2_merge_1/share/man/man4/route.4 Modified: projects/arpv2_merge_1/share/man/man4/route.4 ============================================================================== --- projects/arpv2_merge_1/share/man/man4/route.4 Thu Dec 11 23:01:58 2008 (r185946) +++ projects/arpv2_merge_1/share/man/man4/route.4 Thu Dec 11 23:04:34 2008 (r185947) @@ -196,7 +196,7 @@ Messages include: #define RTM_REDIRECT 0x6 /* Told to use different route */ #define RTM_MISS 0x7 /* Lookup failed on this address */ #define RTM_LOCK 0x8 /* fix specified metrics */ -#define RTM_RESOLVE 0xb /* request to resolve dst to LL addr */ +#define RTM_RESOLVE 0xb /* request to resolve dst to LL addr - unused */ #define RTM_NEWADDR 0xc /* address being added to iface */ #define RTM_DELADDR 0xd /* address being removed from iface */ #define RTM_IFINFO 0xe /* iface going up/down etc. */ @@ -308,7 +308,7 @@ Specifiers for which addresses are prese #define RTA_DST 0x1 /* destination sockaddr present */ #define RTA_GATEWAY 0x2 /* gateway sockaddr present */ #define RTA_NETMASK 0x4 /* netmask sockaddr present */ -#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ +#define RTA_GENMASK 0x8 /* cloning mask sockaddr present - unused */ #define RTA_IFP 0x10 /* interface name sockaddr present */ #define RTA_IFA 0x20 /* interface addr sockaddr present */ #define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 23:15:15 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD412106564A; Thu, 11 Dec 2008 23:15:15 +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 ACDFB8FC24; Thu, 11 Dec 2008 23:15:15 +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 mBBNFFn7079459; Thu, 11 Dec 2008 23:15:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBNFFSm079458; Thu, 11 Dec 2008 23:15:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812112315.mBBNFFSm079458@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 23:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185949 - projects/arpv2_merge_1/share/man/man9 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 23:15:15 -0000 Author: kmacy Date: Thu Dec 11 23:15:15 2008 New Revision: 185949 URL: http://svn.freebsd.org/changeset/base/185949 Log: - update types of refcnt and flags - fix dangling sentence Modified: projects/arpv2_merge_1/share/man/man9/rtentry.9 Modified: projects/arpv2_merge_1/share/man/man9/rtentry.9 ============================================================================== --- projects/arpv2_merge_1/share/man/man9/rtentry.9 Thu Dec 11 23:13:02 2008 (r185948) +++ projects/arpv2_merge_1/share/man/man9/rtentry.9 Thu Dec 11 23:15:15 2008 (r185949) @@ -76,8 +76,11 @@ right (some protocols will put a link-la intermediate stop on the way to that destination (if the .Dv RTF_GATEWAY flag is set). -.It Vt "u_long rt_flags" ; +.It Vt "int rt_flags" ; See below. +.It Vt "int rt_refcnt" ; +Route entries are reference-counted; this field indicates the number +of external (to the radix tree) references. .It Vt "struct ifnet *rt_ifp" ; .It Vt "struct ifaddr *rt_ifa" ; These two fields represent the @@ -88,10 +91,6 @@ packet to the destination or set of dest represents. .It Vt "struct rt_metrics_lite rt_rmx" ; See below. -.It Vt "long rt_refcnt" ; -Route entries are reference-counted; this field indicates the number -of external (to the radix tree) references. -If the .Dv RTF_UP flag is not present, the .Fn rtfree @@ -251,4 +250,3 @@ and .Va rmx_filler fields could be named better. .Pp - From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 23:41:50 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CDC61065672; Thu, 11 Dec 2008 23:41:50 +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 0CE5F8FC16; Thu, 11 Dec 2008 23:41:50 +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 mBBNfneh079998; Thu, 11 Dec 2008 23:41:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBNfnGv079997; Thu, 11 Dec 2008 23:41:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812112341.mBBNfnGv079997@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 23:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185951 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 23:41:50 -0000 Author: kmacy Date: Thu Dec 11 23:41:49 2008 New Revision: 185951 URL: http://svn.freebsd.org/changeset/base/185951 Log: remove reference to RTF_LLINFO in non-netatm code Modified: projects/arpv2_merge_1/sys/netinet/if_atm.c Modified: projects/arpv2_merge_1/sys/netinet/if_atm.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_atm.c Thu Dec 11 23:17:48 2008 (r185950) +++ projects/arpv2_merge_1/sys/netinet/if_atm.c Thu Dec 11 23:41:49 2008 (r185951) @@ -328,8 +328,6 @@ atmresolve(struct rtentry *rt, struct mb goto bad; /* failed */ RT_REMREF(rt); /* don't keep LL references */ if ((rt->rt_flags & RTF_GATEWAY) != 0 || - (rt->rt_flags & RTF_LLINFO) == 0 || - /* XXX: are we using LLINFO? */ rt->rt_gateway->sa_family != AF_LINK) { RT_UNLOCK(rt); goto bad; From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 23:59:32 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA8EC1065687; Thu, 11 Dec 2008 23:59:32 +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 DAAEB8FC18; Thu, 11 Dec 2008 23:59:32 +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 mBBNxWMe080355; Thu, 11 Dec 2008 23:59:32 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBNxWUN080354; Thu, 11 Dec 2008 23:59:32 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812112359.mBBNxWUN080354@svn.freebsd.org> From: Kip Macy Date: Thu, 11 Dec 2008 23:59:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185952 - projects/arpv2_merge_1/sys/conf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 23:59:33 -0000 Author: kmacy Date: Thu Dec 11 23:59:32 2008 New Revision: 185952 URL: http://svn.freebsd.org/changeset/base/185952 Log: remove NATM until it is updated to handle virtual circuit management without route cloning Modified: projects/arpv2_merge_1/sys/conf/NOTES Modified: projects/arpv2_merge_1/sys/conf/NOTES ============================================================================== --- projects/arpv2_merge_1/sys/conf/NOTES Thu Dec 11 23:41:49 2008 (r185951) +++ projects/arpv2_merge_1/sys/conf/NOTES Thu Dec 11 23:59:32 2008 (r185952) @@ -1958,7 +1958,7 @@ device fatm #Fore PCA200E device hatm #Fore/Marconi HE155/622 device patm #IDT77252 cards (ProATM and IDT) device utopia #ATM PHY driver -options NATM #native ATM +#options NATM #native ATM options LIBMBPOOL #needed by patm, iatm From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 00:02:35 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 500AF106567B; Fri, 12 Dec 2008 00:02:35 +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 3FBBE8FC2E; Fri, 12 Dec 2008 00:02:35 +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 mBC02ZJi080470; Fri, 12 Dec 2008 00:02:35 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC02ZWo080469; Fri, 12 Dec 2008 00:02:35 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812120002.mBC02ZWo080469@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 00:02:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185953 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 00:02:35 -0000 Author: kmacy Date: Fri Dec 12 00:02:34 2008 New Revision: 185953 URL: http://svn.freebsd.org/changeset/base/185953 Log: remove use of addloop / remloop Modified: projects/arpv2_merge_1/sys/netinet/ip_carp.c Modified: projects/arpv2_merge_1/sys/netinet/ip_carp.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/ip_carp.c Thu Dec 11 23:59:32 2008 (r185952) +++ projects/arpv2_merge_1/sys/netinet/ip_carp.c Fri Dec 12 00:02:34 2008 (r185953) @@ -371,14 +371,6 @@ carp_setroute(struct carp_softc *sc, int (cmd == RTM_DELETE && count == 0)) rtinit(ifa, cmd, RTF_UP | RTF_HOST); } -#ifdef INET6 - if (ifa->ifa_addr->sa_family == AF_INET6) { - if (cmd == RTM_ADD) - in6_ifaddloop(ifa); - else - in6_ifremloop(ifa); - } -#endif /* INET6 */ } splx(s); } From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 00:44:20 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ADA2106564A; Fri, 12 Dec 2008 00:44:20 +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 1ABDD8FC08; Fri, 12 Dec 2008 00:44:20 +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 mBC0iJJ3081318; Fri, 12 Dec 2008 00:44:19 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC0iJUA081317; Fri, 12 Dec 2008 00:44:19 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812120044.mBC0iJUA081317@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 00:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185954 - projects/arpv2_merge_1/release/picobsd/tinyware/ns X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 00:44:20 -0000 Author: kmacy Date: Fri Dec 12 00:44:19 2008 New Revision: 185954 URL: http://svn.freebsd.org/changeset/base/185954 Log: remove reference to obsolete LLINFO and WASCLONED flags Modified: projects/arpv2_merge_1/release/picobsd/tinyware/ns/ns.c Modified: projects/arpv2_merge_1/release/picobsd/tinyware/ns/ns.c ============================================================================== --- projects/arpv2_merge_1/release/picobsd/tinyware/ns/ns.c Fri Dec 12 00:02:34 2008 (r185953) +++ projects/arpv2_merge_1/release/picobsd/tinyware/ns/ns.c Fri Dec 12 00:44:19 2008 (r185954) @@ -382,10 +382,6 @@ print_routing(char *proto) rtm = (struct rt_msghdr *)next; sa = (struct sockaddr *)(rtm + 1); get_rtaddrs(rtm->rtm_addrs, sa, rti_info); - if (rtm->rtm_flags & RTF_WASCLONED) { - if ((rtm->rtm_flags & RTF_LLINFO) == 0) - continue; - } if ((sa = rti_info[RTAX_DST]) != NULL) { sprintf(fbuf, "%s", sock_ntop(sa, sa->sa_len)); if (((sa1 = rti_info[RTAX_NETMASK]) != NULL) From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 00:56:01 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D51D1065673; Fri, 12 Dec 2008 00:56:01 +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 0C01A8FC1C; Fri, 12 Dec 2008 00:56:01 +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 mBC0u0mh081588; Fri, 12 Dec 2008 00:56:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC0u02W081582; Fri, 12 Dec 2008 00:56:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812120056.mBC0u02W081582@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 00:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185955 - in projects/arpv2_merge_1/sys: dev/cxgb/ulp/tom net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 00:56:01 -0000 Author: kmacy Date: Fri Dec 12 00:56:00 2008 New Revision: 185955 URL: http://svn.freebsd.org/changeset/base/185955 Log: - remove cloning related fields from rtentry (genmask, parent, llinfo) - move refcnt and flags together and convert both to int Modified: projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.c projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.h projects/arpv2_merge_1/sys/net/route.c projects/arpv2_merge_1/sys/net/route.h projects/arpv2_merge_1/sys/net/rtsock.c Modified: projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.c Fri Dec 12 00:44:19 2008 (r185954) +++ projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.c Fri Dec 12 00:56:00 2008 (r185955) @@ -93,15 +93,15 @@ arp_hash(u32 key, int ifindex, const str } static inline void -neigh_replace(struct l2t_entry *e, struct rtentry *rt) +neigh_replace(struct l2t_entry *e, struct llentry *neigh) { - RT_LOCK(rt); - RT_ADDREF(rt); - RT_UNLOCK(rt); + LLE_WLOCK(neigh); + LLE_ADDREF(neigh); + LLE_WUNLOCK(neigh); if (e->neigh) - RTFREE(e->neigh); - e->neigh = rt; + LLE_FREE(e->neigh); + e->neigh = neigh; } /* @@ -164,9 +164,8 @@ arpq_enqueue(struct l2t_entry *e, struct int t3_l2t_send_slow(struct t3cdev *dev, struct mbuf *m, struct l2t_entry *e) { - struct rtentry *rt = e->neigh; + struct llentry *lle = e->neigh; struct sockaddr_in sin; - struct llentry *lle; bzero(&sin, sizeof(struct sockaddr_in)); sin.sin_family = AF_INET; @@ -223,7 +222,6 @@ again: void t3_l2t_send_event(struct t3cdev *dev, struct l2t_entry *e) { - struct rtentry *rt; struct mbuf *m0; struct sockaddr_in sin; sin.sin_family = AF_INET; @@ -323,18 +321,18 @@ found: void t3_l2e_free(struct l2t_data *d, struct l2t_entry *e) { - struct rtentry *rt = NULL; - + struct llentry *lle; + mtx_lock(&e->lock); if (atomic_load_acq_int(&e->refcnt) == 0) { /* hasn't been recycled */ - rt = e->neigh; + lle = e->neigh; e->neigh = NULL; } mtx_unlock(&e->lock); atomic_add_int(&d->nfree, 1); - if (rt) - RTFREE(rt); + if (lle) + LLE_FREE(lle); } @@ -343,11 +341,8 @@ t3_l2e_free(struct l2t_data *d, struct l * Must be called with softirqs disabled. */ static inline void -reuse_entry(struct l2t_entry *e, struct rtentry *neigh) +reuse_entry(struct l2t_entry *e, struct llentry *neigh) { - struct llinfo_arp *la; - - la = (struct llinfo_arp *)neigh->rt_llinfo; mtx_lock(&e->lock); /* avoid race with t3_l2t_free */ if (neigh != e->neigh) @@ -364,13 +359,13 @@ reuse_entry(struct l2t_entry *e, struct } struct l2t_entry * -t3_l2t_get(struct t3cdev *dev, struct rtentry *neigh, struct ifnet *ifp, +t3_l2t_get(struct t3cdev *dev, struct llentry *neigh, struct ifnet *ifp, struct sockaddr *sa) { struct l2t_entry *e; struct l2t_data *d = L2DATA(dev); u32 addr = ((struct sockaddr_in *)sa)->sin_addr.s_addr; - int ifidx = neigh->rt_ifp->if_index; + int ifidx = ifp->if_index; int hash = arp_hash(addr, ifidx, d); unsigned int smt_idx = ((struct port_info *)ifp->if_softc)->port_id; @@ -450,20 +445,19 @@ handle_failed_resolution(struct t3cdev * } void -t3_l2t_update(struct t3cdev *dev, struct rtentry *neigh, +t3_l2t_update(struct t3cdev *dev, struct llentry *neigh, uint8_t *enaddr, struct sockaddr *sa) { struct l2t_entry *e; struct mbuf *arpq = NULL; struct l2t_data *d = L2DATA(dev); u32 addr = *(u32 *) &((struct sockaddr_in *)sa)->sin_addr; - int ifidx = neigh->rt_ifp->if_index; int hash = arp_hash(addr, ifidx, d); struct llinfo_arp *la; rw_rlock(&d->lock); for (e = d->l2tab[hash].first; e; e = e->next) - if (e->addr == addr && e->ifindex == ifidx) { + if (e->addr == addr) { mtx_lock(&e->lock); goto found; } Modified: projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.h ============================================================================== --- projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.h Fri Dec 12 00:44:19 2008 (r185954) +++ projects/arpv2_merge_1/sys/dev/cxgb/ulp/tom/cxgb_l2t.h Fri Dec 12 00:56:00 2008 (r185955) @@ -68,7 +68,7 @@ struct l2t_entry { int ifindex; /* neighbor's net_device's ifindex */ uint16_t smt_idx; /* SMT index */ uint16_t vlan; /* VLAN TCI (id: bits 0-11, prio: 13-15 */ - struct rtentry *neigh; /* associated neighbour */ + struct llentry *neigh; /* associated neighbour */ struct l2t_entry *first; /* start of hash chain */ struct l2t_entry *next; /* next l2t_entry on chain */ struct mbuf *arpq_head; /* queue of packets awaiting resolution */ Modified: projects/arpv2_merge_1/sys/net/route.c ============================================================================== --- projects/arpv2_merge_1/sys/net/route.c Fri Dec 12 00:44:19 2008 (r185954) +++ projects/arpv2_merge_1/sys/net/route.c Fri Dec 12 00:56:00 2008 (r185955) @@ -350,7 +350,7 @@ rtfree(struct rtentry *rt) */ RT_REMREF(rt); if (rt->rt_refcnt > 0) { - log(LOG_DEBUG, "%s: %p has %lu refs\t", __func__, rt, rt->rt_refcnt); + log(LOG_DEBUG, "%s: %p has %d refs\t", __func__, rt, rt->rt_refcnt); goto done; } @@ -391,8 +391,6 @@ rtfree(struct rtentry *rt) */ if (rt->rt_ifa) IFAFREE(rt->rt_ifa); - rt->rt_parent = NULL; /* NB: no refcnt on parent */ - /* * The key is separatly alloc'd so free it (see rt_setgate()). * This also frees the gateway, as they are always malloc'd @@ -1045,27 +1043,6 @@ deldone: /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); - if (rn == NULL) { - struct rtentry *rt2; - /* - * Uh-oh, we already have one of these in the tree. - * We do a special hack: if the route that's already - * there was generated by the cloning mechanism - * then we just blow it away and retry the insertion - * of the new one. - */ - rt2 = rtalloc1_fib(dst, 0, RTF_RNH_LOCKED, fibnum); - if (rt2 && rt2->rt_parent) { - rtexpunge(rt2); - RT_UNLOCK(rt2); - rn = rnh->rnh_addaddr(ndst, netmask, - rnh, rt->rt_nodes); - } else if (rt2) { - /* undo the extra ref we got */ - RTFREE_LOCKED(rt2); - } - } - /* * If it still failed to go into the tree, * then un-make it (this should be a function) @@ -1081,7 +1058,6 @@ deldone: senderr(EEXIST); } - rt->rt_parent = NULL; /* * If this protocol has something to add to this then * allow it to do that as well. Modified: projects/arpv2_merge_1/sys/net/route.h ============================================================================== --- projects/arpv2_merge_1/sys/net/route.h Fri Dec 12 00:44:19 2008 (r185954) +++ projects/arpv2_merge_1/sys/net/route.h Fri Dec 12 00:56:00 2008 (r185955) @@ -135,15 +135,12 @@ struct rtentry { #define rt_key(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_key))) #define rt_mask(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_mask))) struct sockaddr *rt_gateway; /* value */ - u_long rt_flags; /* up/down?, host/net */ + int rt_flags; /* up/down?, host/net */ + int rt_refcnt; /* # held references */ struct ifnet *rt_ifp; /* the answer: interface to use */ struct ifaddr *rt_ifa; /* the answer: interface address to use */ struct rt_metrics_lite rt_rmx; /* metrics used by rx'ing protocols */ - long rt_refcnt; /* # held references */ - struct sockaddr *rt_genmask; /* for generation of cloned routes */ - caddr_t rt_llinfo; /* pointer to link level info cache */ struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ - struct rtentry *rt_parent; /* cloning parent - UNUSED */ u_int rt_fibnum; /* which FIB */ #ifdef _KERNEL /* XXX ugly, user apps use this definition but don't have a mtx def */ @@ -326,14 +323,14 @@ struct rt_addrinfo { #define RT_ADDREF(_rt) do { \ RT_LOCK_ASSERT(_rt); \ KASSERT((_rt)->rt_refcnt >= 0, \ - ("negative refcnt %ld", (_rt)->rt_refcnt)); \ + ("negative refcnt %d", (_rt)->rt_refcnt)); \ (_rt)->rt_refcnt++; \ } while (0) #define RT_REMREF(_rt) do { \ RT_LOCK_ASSERT(_rt); \ KASSERT((_rt)->rt_refcnt > 0, \ - ("bogus refcnt %ld", (_rt)->rt_refcnt)); \ + ("bogus refcnt %d", (_rt)->rt_refcnt)); \ (_rt)->rt_refcnt--; \ } while (0) Modified: projects/arpv2_merge_1/sys/net/rtsock.c ============================================================================== --- projects/arpv2_merge_1/sys/net/rtsock.c Fri Dec 12 00:44:19 2008 (r185954) +++ projects/arpv2_merge_1/sys/net/rtsock.c Fri Dec 12 00:56:00 2008 (r185955) @@ -497,19 +497,6 @@ route_output(struct mbuf *m, struct sock (info.rti_info[RTAX_GATEWAY] != NULL && info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) senderr(EINVAL); - if (info.rti_info[RTAX_GENMASK]) { - struct radix_node *t; - t = rn_addmask((caddr_t) info.rti_info[RTAX_GENMASK], 0, 1); - if (t != NULL && - bcmp((char *)(void *)info.rti_info[RTAX_GENMASK] + 1, - (char *)(void *)t->rn_key + 1, - ((struct sockaddr *)t->rn_key)->sa_len - 1) == 0) - info.rti_info[RTAX_GENMASK] = - (struct sockaddr *)t->rn_key; - else - senderr(ENOBUFS); - } - /* * Verify that the caller has the appropriate privilege; RTM_GET * is the only operation the non-superuser is allowed. @@ -540,7 +527,6 @@ route_output(struct mbuf *m, struct sock &rtm->rtm_rmx, &saved_nrt->rt_rmx); rtm->rtm_index = saved_nrt->rt_ifp->if_index; RT_REMREF(saved_nrt); - saved_nrt->rt_genmask = info.rti_info[RTAX_GENMASK]; RT_UNLOCK(saved_nrt); } break; @@ -624,7 +610,7 @@ route_output(struct mbuf *m, struct sock info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; info.rti_info[RTAX_NETMASK] = rt_mask(rt); - info.rti_info[RTAX_GENMASK] = rt->rt_genmask; + info.rti_info[RTAX_GENMASK] = 0; if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { ifp = rt->rt_ifp; if (ifp) { @@ -729,8 +715,6 @@ route_output(struct mbuf *m, struct sock rtm->rtm_index = rt->rt_ifp->if_index; if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest) rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, &info); - if (info.rti_info[RTAX_GENMASK]) - rt->rt_genmask = info.rti_info[RTAX_GENMASK]; /* FALLTHROUGH */ case RTM_LOCK: /* We don't support locks anymore */ @@ -1272,7 +1256,7 @@ sysctl_dumpentry(struct radix_node *rn, info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; info.rti_info[RTAX_NETMASK] = rt_mask(rt); - info.rti_info[RTAX_GENMASK] = rt->rt_genmask; + info.rti_info[RTAX_GENMASK] = 0; if (rt->rt_ifp) { info.rti_info[RTAX_IFP] = rt->rt_ifp->if_addr->ifa_addr; info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 01:01:03 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC21A1065675; Fri, 12 Dec 2008 01:01:03 +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 AA1B28FC13; Fri, 12 Dec 2008 01:01:03 +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 mBC11351081899; Fri, 12 Dec 2008 01:01:03 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC113ii081891; Fri, 12 Dec 2008 01:01:03 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812120101.mBC113ii081891@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 01:01:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185960 - in projects/arpv2_merge_1: contrib/bsnmp/snmp_mibII libexec/bootpd sbin/route sbin/routed usr.bin/netstat usr.sbin/ppp X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 01:01:03 -0000 Author: kmacy Date: Fri Dec 12 01:01:03 2008 New Revision: 185960 URL: http://svn.freebsd.org/changeset/base/185960 Log: - remove or hide cloning related flags from world compile - refcnt is now an int - update netstat/route.c Modified: projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII.c projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII_route.c projects/arpv2_merge_1/libexec/bootpd/rtmsg.c projects/arpv2_merge_1/sbin/route/route.c projects/arpv2_merge_1/sbin/routed/table.c projects/arpv2_merge_1/usr.bin/netstat/route.c projects/arpv2_merge_1/usr.sbin/ppp/route.c Modified: projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII.c Fri Dec 12 01:00:38 2008 (r185959) +++ projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII.c Fri Dec 12 01:01:03 2008 (r185960) @@ -48,9 +48,15 @@ static void *route_fd; /* if-index allocator */ static uint32_t next_if_index = 1; +#if 0 +/* + * XXX - Qing + * + */ /* re-fetch arp table */ static int update_arp; static int in_update_arp; +#endif /* OR registrations */ static u_int ifmib_reg; @@ -910,9 +916,12 @@ mib_find_ifa(struct in_addr addr) return (NULL); } +#if 0 /* + * Qing -- fix * Process a new ARP entry */ + static void process_arp(const struct rt_msghdr *rtm, const struct sockaddr_dl *sdl, const struct sockaddr_in *sa) @@ -939,7 +948,7 @@ process_arp(const struct rt_msghdr *rtm, at->flags &= ~MIBARP_PERM; at->flags |= MIBARP_FOUND; } - +#endif /* * Handle a routing socket message. */ @@ -1083,6 +1092,11 @@ handle_rtmsg(struct rt_msghdr *rtm) case RTM_GET: mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); +#if 0 + /* + * XXX - Qing fix + * + */ if (rtm->rtm_flags & RTF_LLINFO) { if (addrs[RTAX_DST] == NULL || addrs[RTAX_GATEWAY] == NULL || @@ -1093,14 +1107,22 @@ handle_rtmsg(struct rt_msghdr *rtm) (struct sockaddr_dl *)(void *)addrs[RTAX_GATEWAY], (struct sockaddr_in *)(void *)addrs[RTAX_DST]); } else { +#endif if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP)) mib_sroute_process(rtm, addrs[RTAX_GATEWAY], addrs[RTAX_DST], addrs[RTAX_NETMASK]); +#if 0 } +#endif break; case RTM_ADD: mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); +#if 0 + /* + * XXX - Qing fix + * + */ if (rtm->rtm_flags & RTF_LLINFO) { if (addrs[RTAX_DST] == NULL || addrs[RTAX_GATEWAY] == NULL || @@ -1111,15 +1133,18 @@ handle_rtmsg(struct rt_msghdr *rtm) (struct sockaddr_dl *)(void *)addrs[RTAX_GATEWAY], (struct sockaddr_in *)(void *)addrs[RTAX_DST]); } else { +#endif if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP)) mib_sroute_process(rtm, addrs[RTAX_GATEWAY], addrs[RTAX_DST], addrs[RTAX_NETMASK]); +#if 0 } +#endif break; case RTM_DELETE: mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); - if (rtm->rtm_errno == 0 && !(rtm->rtm_flags & RTF_LLINFO)) + if (rtm->rtm_errno == 0) mib_sroute_process(rtm, addrs[RTAX_GATEWAY], addrs[RTAX_DST], addrs[RTAX_NETMASK]); break; @@ -1289,7 +1314,10 @@ update_ifa_info(void) /* * Update arp table - */ + * + * XXX - Qing +*/ +#if 0 void mib_arp_update(void) { @@ -1305,11 +1333,15 @@ mib_arp_update(void) TAILQ_FOREACH(at, &mibarp_list, link) at->flags &= ~MIBARP_FOUND; + /* + * XXX - Qing fix + * + */ if ((buf = mib_fetch_rtab(AF_INET, NET_RT_FLAGS, RTF_LLINFO, &needed)) == NULL) { in_update_arp = 0; return; } - + next = buf; while (next < buf + needed) { rtm = (struct rt_msghdr *)(void *)next; @@ -1329,6 +1361,7 @@ mib_arp_update(void) update_arp = 0; in_update_arp = 0; } +#endif /* @@ -1631,11 +1664,22 @@ mibII_idle(void) mib_refresh_iflist(); update_ifa_info(); +#if 0 + /* + * XXX Qing + * + */ mib_arp_update(); +#endif mib_iflist_bad = 0; } +#if 0 + /* + * XXX Qing + */ if (update_arp) mib_arp_update(); +#endif } Modified: projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII_route.c ============================================================================== --- projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII_route.c Fri Dec 12 01:00:38 2008 (r185959) +++ projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII_route.c Fri Dec 12 01:01:03 2008 (r185960) @@ -186,8 +186,7 @@ mib_sroute_process(struct rt_msghdr *rtm memcpy(r->index, key.index, sizeof(r->index)); r->ifindex = (ifp == NULL) ? 0 : ifp->index; - r->type = (rtm->rtm_flags & RTF_LLINFO) ? 3 : - (rtm->rtm_flags & RTF_REJECT) ? 2 : 4; + r->type = (rtm->rtm_flags & RTF_REJECT) ? 2 : 4; /* cannot really know, what protocol it runs */ r->proto = (rtm->rtm_flags & RTF_LOCAL) ? 2 : Modified: projects/arpv2_merge_1/libexec/bootpd/rtmsg.c ============================================================================== --- projects/arpv2_merge_1/libexec/bootpd/rtmsg.c Fri Dec 12 01:00:38 2008 (r185959) +++ projects/arpv2_merge_1/libexec/bootpd/rtmsg.c Fri Dec 12 01:01:03 2008 (r185960) @@ -152,13 +152,6 @@ tryagain: sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin); if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { if (sdl->sdl_family == AF_LINK && -#if 0 - /* - * XXX Qing - what should be here? - * - */ - (rtm->rtm_flags & RTF_LLINFO) && -#endif !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023: case IFT_ISO88024: case IFT_ISO88025: Modified: projects/arpv2_merge_1/sbin/route/route.c ============================================================================== --- projects/arpv2_merge_1/sbin/route/route.c Fri Dec 12 01:00:38 2008 (r185959) +++ projects/arpv2_merge_1/sbin/route/route.c Fri Dec 12 01:01:03 2008 (r185960) @@ -605,6 +605,14 @@ newroute(argc, argv) case K_NOSTATIC: flags &= ~RTF_STATIC; break; +#if 0 + case K_CLONING: + flags |= RTF_CLONING; + break; + case K_LLINFO: + flags |= RTF_LLINFO; + break; +#endif case K_LOCK: locking = 1; break; Modified: projects/arpv2_merge_1/sbin/routed/table.c ============================================================================== --- projects/arpv2_merge_1/sbin/routed/table.c Fri Dec 12 01:00:38 2008 (r185959) +++ projects/arpv2_merge_1/sbin/routed/table.c Fri Dec 12 01:01:03 2008 (r185960) @@ -1103,14 +1103,13 @@ flush_kern(void) || INFO_DST(&info)->sa_family != AF_INET) continue; +#if defined (RTF_LLINFO) /* ignore ARP table entries on systems with a merged route * and ARP table. */ -#if defined(RTF_LLINFO) if (rtm->rtm_flags & RTF_LLINFO) continue; #endif - #if defined(RTF_WASCLONED) && defined(__FreeBSD__) /* ignore cloned routes */ @@ -1262,12 +1261,14 @@ read_rt(void) trace_act("ignore multicast %s", str); continue; } + #if defined(RTF_LLINFO) if (m.r.rtm.rtm_flags & RTF_LLINFO) { trace_act("ignore ARP %s", str); continue; } #endif + #if defined(RTF_WASCLONED) && defined(__FreeBSD__) if (m.r.rtm.rtm_flags & RTF_WASCLONED) { trace_act("ignore cloned %s", str); Modified: projects/arpv2_merge_1/usr.bin/netstat/route.c ============================================================================== --- projects/arpv2_merge_1/usr.bin/netstat/route.c Fri Dec 12 01:00:38 2008 (r185959) +++ projects/arpv2_merge_1/usr.bin/netstat/route.c Fri Dec 12 01:01:03 2008 (r185960) @@ -347,7 +347,7 @@ size_cols_rtentry(struct rtentry *rt) wid_flags = MAX(len, wid_flags); if (addr.u_sa.sa_family == AF_INET || Wflag) { - len = snprintf(buffer, sizeof(buffer), "%ld", rt->rt_refcnt); + len = snprintf(buffer, sizeof(buffer), "%d", rt->rt_refcnt); wid_refs = MAX(len, wid_refs); len = snprintf(buffer, sizeof(buffer), "%lu", rt->rt_use); wid_use = MAX(len, wid_use); @@ -772,7 +772,7 @@ p_rtentry(struct rtentry *rt) snprintf(buffer, sizeof(buffer), "%%-%d.%ds ", wid_flags, wid_flags); p_flags(rt->rt_flags, buffer); if (addr.u_sa.sa_family == AF_INET || Wflag) { - printf("%*ld %*lu ", wid_refs, rt->rt_refcnt, + printf("%*d %*lu ", wid_refs, rt->rt_refcnt, wid_use, rt->rt_use); if (Wflag) { if (rt->rt_rmx.rmx_mtu != 0) Modified: projects/arpv2_merge_1/usr.sbin/ppp/route.c ============================================================================== --- projects/arpv2_merge_1/usr.sbin/ppp/route.c Fri Dec 12 01:00:38 2008 (r185959) +++ projects/arpv2_merge_1/usr.sbin/ppp/route.c Fri Dec 12 01:01:03 2008 (r185960) @@ -158,7 +158,10 @@ static struct bits { { RTF_MODIFIED, 'M' }, { RTF_DONE, 'd' }, { RTF_XRESOLVE, 'X' }, - { RTF_STATIC, 'S' }, +#ifdef RTF_CLONING + { RTF_CLONING, 'C' }, +#endif + { RTF_STATIC, 'S' }, { RTF_PROTO1, '1' }, { RTF_PROTO2, '2' }, { RTF_BLACKHOLE, 'B' }, From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 02:11:51 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B04A8106564A; Fri, 12 Dec 2008 02:11:51 +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 9C6AC8FC0C; Fri, 12 Dec 2008 02:11:51 +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 mBC2BpxM083477; Fri, 12 Dec 2008 02:11:51 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC2BoJm083447; Fri, 12 Dec 2008 02:11:50 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812120211.mBC2BoJm083447@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 02:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185966 - in projects/arpv2_merge_1: contrib/binutils/bfd contrib/binutils/gas/config contrib/binutils/ld/emulparams gnu/usr.bin/binutils/as gnu/usr.bin/binutils/as/mips-freebsd gnu/usr... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 02:11:51 -0000 Author: kmacy Date: Fri Dec 12 02:11:49 2008 New Revision: 185966 URL: http://svn.freebsd.org/changeset/base/185966 Log: IFC 185919:185965 daily merge from -CURRENT Added: projects/arpv2_merge_1/contrib/binutils/ld/emulparams/elf32bmip_fbsd.sh projects/arpv2_merge_1/gnu/usr.bin/binutils/as/mips-freebsd/ projects/arpv2_merge_1/gnu/usr.bin/binutils/as/mips-freebsd/itbl-cpu.h projects/arpv2_merge_1/gnu/usr.bin/binutils/as/mips-freebsd/targ-cpu.h projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/Makefile.mips projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf64btsmip_fbsd.sh projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf64ltsmip_fbsd.sh projects/arpv2_merge_1/gnu/usr.bin/binutils/libbfd/Makefile.mips projects/arpv2_merge_1/gnu/usr.bin/binutils/libopcodes/Makefile.mips projects/arpv2_merge_1/share/man/man9/VOP_VPTOCNP.9 Modified: projects/arpv2_merge_1/contrib/binutils/bfd/config.bfd projects/arpv2_merge_1/contrib/binutils/gas/config/tc-mips.c projects/arpv2_merge_1/gnu/usr.bin/binutils/as/Makefile projects/arpv2_merge_1/gnu/usr.bin/binutils/libbfd/bfd.h projects/arpv2_merge_1/share/man/man9/Makefile projects/arpv2_merge_1/share/man/man9/ifnet.9 projects/arpv2_merge_1/sys/amd64/amd64/local_apic.c projects/arpv2_merge_1/sys/amd64/include/apicreg.h projects/arpv2_merge_1/sys/amd64/include/apicvar.h projects/arpv2_merge_1/sys/boot/zfs/zfs.c projects/arpv2_merge_1/sys/conf/options projects/arpv2_merge_1/sys/dev/usb/usbdevs projects/arpv2_merge_1/sys/dev/usb2/bluetooth/ng_ubt2.c projects/arpv2_merge_1/sys/dev/usb2/bluetooth/ubtbcmfw2.c projects/arpv2_merge_1/sys/dev/usb2/controller/at91dci.c projects/arpv2_merge_1/sys/dev/usb2/controller/at91dci_atmelarm.c projects/arpv2_merge_1/sys/dev/usb2/controller/ehci2.c projects/arpv2_merge_1/sys/dev/usb2/controller/ehci2_pci.c projects/arpv2_merge_1/sys/dev/usb2/controller/musb2_otg.c projects/arpv2_merge_1/sys/dev/usb2/controller/musb2_otg_atmelarm.c projects/arpv2_merge_1/sys/dev/usb2/controller/ohci2.c projects/arpv2_merge_1/sys/dev/usb2/controller/uhci2.c projects/arpv2_merge_1/sys/dev/usb2/controller/usb2_controller.c projects/arpv2_merge_1/sys/dev/usb2/controller/uss820dci.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_busdma.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_busdma.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_compat_linux.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_compat_linux.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_config_td.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_config_td.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_core.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_debug.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_dev.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_dev.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_device.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_device.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_dynamic.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_dynamic.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_error.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_generic.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_handle_request.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_hid.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_hub.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_hub.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_lookup.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_mbuf.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_msctest.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_msctest.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_parse.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_process.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_process.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_request.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_request.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_sw_transfer.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_sw_transfer.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_transfer.c projects/arpv2_merge_1/sys/dev/usb2/core/usb2_transfer.h projects/arpv2_merge_1/sys/dev/usb2/core/usb2_util.c projects/arpv2_merge_1/sys/dev/usb2/ethernet/if_aue2.c projects/arpv2_merge_1/sys/dev/usb2/ethernet/if_axe2.c projects/arpv2_merge_1/sys/dev/usb2/ethernet/if_cdce2.c projects/arpv2_merge_1/sys/dev/usb2/ethernet/if_cue2.c projects/arpv2_merge_1/sys/dev/usb2/ethernet/if_kue2.c projects/arpv2_merge_1/sys/dev/usb2/ethernet/if_rue2.c projects/arpv2_merge_1/sys/dev/usb2/ethernet/if_udav2.c projects/arpv2_merge_1/sys/dev/usb2/ethernet/usb2_ethernet.c projects/arpv2_merge_1/sys/dev/usb2/ethernet/usb2_ethernet.h projects/arpv2_merge_1/sys/dev/usb2/image/uscanner2.c projects/arpv2_merge_1/sys/dev/usb2/input/uhid2.c projects/arpv2_merge_1/sys/dev/usb2/input/ukbd2.c projects/arpv2_merge_1/sys/dev/usb2/input/ums2.c projects/arpv2_merge_1/sys/dev/usb2/misc/udbp2.c projects/arpv2_merge_1/sys/dev/usb2/misc/ufm2.c projects/arpv2_merge_1/sys/dev/usb2/quirk/usb2_quirk.c projects/arpv2_merge_1/sys/dev/usb2/serial/uark2.c projects/arpv2_merge_1/sys/dev/usb2/serial/ubsa2.c projects/arpv2_merge_1/sys/dev/usb2/serial/ubser2.c projects/arpv2_merge_1/sys/dev/usb2/serial/uchcom2.c projects/arpv2_merge_1/sys/dev/usb2/serial/ucycom2.c projects/arpv2_merge_1/sys/dev/usb2/serial/ufoma2.c projects/arpv2_merge_1/sys/dev/usb2/serial/uftdi2.c projects/arpv2_merge_1/sys/dev/usb2/serial/ugensa2.c projects/arpv2_merge_1/sys/dev/usb2/serial/uipaq2.c projects/arpv2_merge_1/sys/dev/usb2/serial/ulpt2.c projects/arpv2_merge_1/sys/dev/usb2/serial/umct2.c projects/arpv2_merge_1/sys/dev/usb2/serial/umodem2.c projects/arpv2_merge_1/sys/dev/usb2/serial/umoscom2.c projects/arpv2_merge_1/sys/dev/usb2/serial/uplcom2.c projects/arpv2_merge_1/sys/dev/usb2/serial/usb2_serial.c projects/arpv2_merge_1/sys/dev/usb2/serial/usb2_serial.h projects/arpv2_merge_1/sys/dev/usb2/serial/uvisor2.c projects/arpv2_merge_1/sys/dev/usb2/serial/uvscom2.c projects/arpv2_merge_1/sys/dev/usb2/sound/uaudio2.c projects/arpv2_merge_1/sys/dev/usb2/sound/uaudio2.h projects/arpv2_merge_1/sys/dev/usb2/storage/ata-usb2.c projects/arpv2_merge_1/sys/dev/usb2/storage/umass2.c projects/arpv2_merge_1/sys/dev/usb2/storage/urio2.c projects/arpv2_merge_1/sys/dev/usb2/storage/ustorage2_fs.c projects/arpv2_merge_1/sys/dev/usb2/template/usb2_template.c projects/arpv2_merge_1/sys/dev/usb2/wlan/if_rum2.c projects/arpv2_merge_1/sys/dev/usb2/wlan/if_ural2.c projects/arpv2_merge_1/sys/dev/usb2/wlan/if_zyd2.c projects/arpv2_merge_1/sys/dev/vr/if_vr.c projects/arpv2_merge_1/sys/fs/deadfs/dead_vnops.c projects/arpv2_merge_1/sys/fs/devfs/devfs_vnops.c projects/arpv2_merge_1/sys/i386/i386/local_apic.c projects/arpv2_merge_1/sys/i386/include/apicreg.h projects/arpv2_merge_1/sys/i386/include/apicvar.h projects/arpv2_merge_1/sys/kern/kern_poll.c projects/arpv2_merge_1/sys/kern/tty_pts.c projects/arpv2_merge_1/sys/kern/vfs_cache.c projects/arpv2_merge_1/sys/kern/vfs_default.c projects/arpv2_merge_1/sys/kern/vnode_if.src projects/arpv2_merge_1/sys/net/if.c projects/arpv2_merge_1/sys/net/if_tun.c projects/arpv2_merge_1/sys/net/raw_cb.h projects/arpv2_merge_1/sys/netinet/in_pcb.h projects/arpv2_merge_1/sys/netinet/ip_fw2.c projects/arpv2_merge_1/sys/netinet/ip_fw_nat.c projects/arpv2_merge_1/sys/netinet/ip_fw_pfil.c projects/arpv2_merge_1/sys/netinet/ip_var.h projects/arpv2_merge_1/sys/netinet/tcp_subr.c projects/arpv2_merge_1/sys/netinet/tcp_var.h projects/arpv2_merge_1/sys/netinet/udp_var.h projects/arpv2_merge_1/sys/netinet6/in6_ifattach.c projects/arpv2_merge_1/sys/netinet6/in6_proto.c projects/arpv2_merge_1/sys/netinet6/in6_var.h projects/arpv2_merge_1/sys/netinet6/ip6_var.h projects/arpv2_merge_1/sys/netinet6/nd6.h projects/arpv2_merge_1/sys/netinet6/tcp6_var.h projects/arpv2_merge_1/sys/netinet6/vinet6.h projects/arpv2_merge_1/sys/netipx/ipx_usrreq.c projects/arpv2_merge_1/sys/sys/resource.h projects/arpv2_merge_1/sys/sys/vimage.h projects/arpv2_merge_1/sys/sys/vnode.h Modified: projects/arpv2_merge_1/contrib/binutils/bfd/config.bfd ============================================================================== --- projects/arpv2_merge_1/contrib/binutils/bfd/config.bfd Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/contrib/binutils/bfd/config.bfd Fri Dec 12 02:11:49 2008 (r185966) @@ -768,6 +768,10 @@ case "${targ}" in targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec" ;; + mips*-*-freebsd*) + targ_defvec=bfd_elf32_tradbigmips_vec + targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmisp_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec" + ;; mips*-*-netbsd*) targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec" Modified: projects/arpv2_merge_1/contrib/binutils/gas/config/tc-mips.c ============================================================================== --- projects/arpv2_merge_1/contrib/binutils/gas/config/tc-mips.c Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/contrib/binutils/gas/config/tc-mips.c Fri Dec 12 02:11:49 2008 (r185966) @@ -281,6 +281,9 @@ static int mips_32bitmode = 0; #define HAVE_64BIT_OBJECTS (mips_abi == N64_ABI) +/* True if relocations are stored in-place. */ +#define HAVE_IN_PLACE_ADDENDS (!HAVE_NEWABI) + /* We can only have 64bit addresses if the object file format supports it. */ #define HAVE_32BIT_ADDRESSES \ @@ -13020,6 +13023,26 @@ mips_fix_adjustable (fixS *fixp) if (fixp->fx_addsy == NULL) return 1; + /* If symbol SYM is in a mergeable section, relocations of the form + SYM + 0 can usually be made section-relative. The mergeable data + is then identified by the section offset rather than by the symbol. + + However, if we're generating REL LO16 relocations, the offset is split + between the LO16 and parterning high part relocation. The linker will + need to recalculate the complete offset in order to correctly identify + the merge data. + + The linker has traditionally not looked for the parterning high part + relocation, and has thus allowed orphaned R_MIPS_LO16 relocations to be + placed anywhere. Rather than break backwards compatibility by changing + this, it seems better not to force the issue, and instead keep the + original symbol. This will work with either linker behavior. */ + if ((fixp->fx_r_type == BFD_RELOC_LO16 + || reloc_needs_lo_p (fixp->fx_r_type)) + && HAVE_IN_PLACE_ADDENDS + && (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE) != 0) + return 0; + #ifdef OBJ_ELF if (OUTPUT_FLAVOR == bfd_target_elf_flavour && S_GET_OTHER (fixp->fx_addsy) == STO_MIPS16 Added: projects/arpv2_merge_1/contrib/binutils/ld/emulparams/elf32bmip_fbsd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/contrib/binutils/ld/emulparams/elf32bmip_fbsd.sh Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf32bmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Modified: projects/arpv2_merge_1/gnu/usr.bin/binutils/as/Makefile ============================================================================== --- projects/arpv2_merge_1/gnu/usr.bin/binutils/as/Makefile Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/as/Makefile Fri Dec 12 02:11:49 2008 (r185966) @@ -20,6 +20,10 @@ SRCS+= app.c as.c atof-generic.c atof-ie # DEO: why not used? #SRCS+= itbl-ops.c +.if ${TARGET_ARCH} == "mips" +SRCS+= itbl-ops.c itbl-parse.y itbl-lex.l +.endif + .if ${TARGET_ARCH} == "amd64" SRCS+= tc-i386.c .elif ${TARGET_ARCH} == "powerpc" Added: projects/arpv2_merge_1/gnu/usr.bin/binutils/as/mips-freebsd/itbl-cpu.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/as/mips-freebsd/itbl-cpu.h Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,19 @@ +/* $FreeBSD$ */ + +#include "itbl-mips.h" + +/* Choose a default ABI for MIPS targets. */ +/* XXX: Where should this be ? */ +#define MIPS_DEFAULT_ABI NO_ABI + +/* Default CPU for MIPS targets. */ +#define MIPS_CPU_STRING_DEFAULT "from-abi" + +/* Generate 64-bit code by default on MIPS targets. */ +#define MIPS_DEFAULT_64BIT 0 + +/* Allow use of E_MIPS_ABI_O32 on MIPS targets. */ +#define USE_E_MIPS_ABI_O32 1 + +/* Use traditional mips */ +#define TE_TMIPS 1 Added: projects/arpv2_merge_1/gnu/usr.bin/binutils/as/mips-freebsd/targ-cpu.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/as/mips-freebsd/targ-cpu.h Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,4 @@ +/* $FreeBSD$ */ +#define TE_TMIPS 1 + +#include "tc-mips.h" Added: projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/Makefile.mips ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/Makefile.mips Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,24 @@ +# $FreeBSD$ + +#xxxIMPxxx: size? +#xxxIMPxxx: TARGET_BIG_ENDIAN is lame. We should use the netbsd convention +# of mipsel and mips. +_sz?=32 +.if defined(TARGET_BIG_ENDIAN) +NATIVE_EMULATION=elf${_sz}btsmip_fbsd +.else +NATIVE_EMULATION=elf${_sz}ltsmip_fbsd +.endif + +SRCS+= e${NATIVE_EMULATION}.c +CLEANFILES+= e${NATIVE_EMULATION}.c + +# nb: elf32 handles both elf32 and elf64 targets +e${NATIVE_EMULATION}.c: ${.CURDIR}/${NATIVE_EMULATION}.sh emultempl/elf32.em \ + scripttempl/elf.sc genscripts.sh stringify.sed + sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSERACHPATH} \ + ${TOOLS_PREFIX}/usr \ + ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \ + ${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE} \ + ${.CURDIR}/${NATIVE_EMULATION}.sh + Added: projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,4 @@ +# $FreeBSD$ +. ${srcdir}/emulparams/elf32btsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Added: projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,4 @@ +# $FreeBSD$ +. ${srcdir}/emulparams/elf32ltsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Added: projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf64btsmip_fbsd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf64btsmip_fbsd.sh Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,4 @@ +# $FreeBSD$ +. ${srcdir}/emulparams/elf64btsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Added: projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf64ltsmip_fbsd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/ld/elf64ltsmip_fbsd.sh Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,4 @@ +# $FreeBSD$ +. ${srcdir}/emulparams/elf64ltsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Added: projects/arpv2_merge_1/gnu/usr.bin/binutils/libbfd/Makefile.mips ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/libbfd/Makefile.mips Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,27 @@ +# $FreeBSD$ + +#xxxIMPxxx: endian and size +DEFAULT_VECTOR= bfd_elf32_tradbigmips_vec + +SRCS+= coff-mips.c \ + cpu-mips.c \ + ecoff.c \ + ecofflink.c \ + elf32.c \ + elf64.c \ + elfn32-mips.c \ + elf32-mips.c \ + elf64-mips.c \ + elfxx-mips.c \ + elf32-target.h \ + elf64-target.h \ + elflink.c + +VECS= bfd_elf32_tradbigmips_vec \ + bfd_elf32_tradlittlemips_vec \ + bfd_elf32_ntradbigmips_vec \ + bfd_elf32_ntradlittlemips_vec \ + bfd_elf64_tradbigmips_vec \ + bfd_elf64_tradlittlemips_vec \ + ecoff_little_vec \ + ecoff_big_vec Modified: projects/arpv2_merge_1/gnu/usr.bin/binutils/libbfd/bfd.h ============================================================================== --- projects/arpv2_merge_1/gnu/usr.bin/binutils/libbfd/bfd.h Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/libbfd/bfd.h Fri Dec 12 02:11:49 2008 (r185966) @@ -57,7 +57,7 @@ extern "C" { #define BFD_ARCH_SIZE 64 -#if defined(__i386__) || defined(__powerpc__) || defined(__arm__) +#if defined(__i386__) || defined(__powerpc__) || defined(__arm__) || defined(__mips__) #define BFD_HOST_64BIT_LONG 0 #define BFD_HOST_64_BIT long long #define BFD_HOST_U_64_BIT unsigned long long Added: projects/arpv2_merge_1/gnu/usr.bin/binutils/libopcodes/Makefile.mips ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/gnu/usr.bin/binutils/libopcodes/Makefile.mips Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +SRCS+= mips-dis.c mips-opc.c mips16-opc.c +CFLAGS+= -DARCH_mips Modified: projects/arpv2_merge_1/share/man/man9/Makefile ============================================================================== --- projects/arpv2_merge_1/share/man/man9/Makefile Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/share/man/man9/Makefile Fri Dec 12 02:11:49 2008 (r185966) @@ -348,6 +348,7 @@ MAN= accept_filter.9 \ VOP_SETACL.9 \ VOP_SETEXTATTR.9 \ VOP_STRATEGY.9 \ + VOP_VPTOCNP.9 \ VOP_VPTOFH.9 \ vput.9 \ vref.9 \ Added: projects/arpv2_merge_1/share/man/man9/VOP_VPTOCNP.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arpv2_merge_1/share/man/man9/VOP_VPTOCNP.9 Fri Dec 12 02:11:49 2008 (r185966) @@ -0,0 +1,110 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 2008 Joe Marcus Clarke +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 7, 2008 +.Os +.Dt VOP_VPTOCNP 9 +.Sh NAME +.Nm VOP_VPTOCNP +.Nd translate a vnode to its component name +.Sh SYNOPSIS +.In sys/param.h +.In sys/vnode.h +.Ft int +.Fn VOP_VPTOCNP "struct vnode *vp" "struct vnode **dvp" "char *buf" "int *buflen" +.Sh DESCRIPTION +This translates a vnode into its component name, and writes that name to +the head of the buffer specified by +.Fa buf +.Bl -tag -width buflen +.It Fa vp +The vnode to translate. +.It Fa dvp +The vnode of the parent directory of +.Fa vp . +.It Fa buf +The buffer into which to preprend the component name. +.It Fa buflen +The remaining size of the buffer. +.El +.Pp +The default implementation of +.Nm +simply returns ENOENT. +.Sh LOCKS +The vnode should be locked on entry and will still be locked on exit. The +parent directory vnode will be unlocked on a successful exit. However, it +will have its hold count incremented. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error code is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_vptocnp(struct vnode *vp, struct vnode **dvp, char *buf, int *buflen) +{ + int error = 0; + + /* + * Translate the vnode to its component name. + * + * Decrement the component name's length from buflen. + * + * Obtain the vnode's parent directory vnode. + */ + ...; + + /* + * Increment the parent directory's hold count. + */ + vhold(*dvp); + + return error; +} +.Ed +.Sh ERRORS +.Bl -tag -width Er +.It Bq Er ENOMEM +The buffer was not large enough to hold the vnode's component name. +.It Bq Er ENOENT +The vnode was not found on the file system. +.El +.Sh SEE ALSO +.Xr VOP_LOOKUP 9 , +.Xr vnode 9 +.Sh NOTES +This interface is a work in progress. +.Sh HISTORY +The function +.Nm +appeared in +.Fx 8.0 . +.Sh AUTHORS +This manual page was written by +.An Joe Marcus Clarke . Modified: projects/arpv2_merge_1/share/man/man9/ifnet.9 ============================================================================== --- projects/arpv2_merge_1/share/man/man9/ifnet.9 Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/share/man/man9/ifnet.9 Fri Dec 12 02:11:49 2008 (r185966) @@ -103,6 +103,10 @@ .Ft void .Fn \*(lp*if_start\*(rp "struct ifnet *ifp" .Ft int +.Fn \*(lp*if_transmit\*(rp "struct ifnet *ifp" "struct mbuf *m" +.Ft void +.Fn \*(lp*if_qflush\*(rp "struct ifnet *ifp" +.Ft int .Fn \*(lp*if_ioctl\*(rp "struct ifnet *ifp" "int cmd" "caddr_t data" .Ft void .Fn \*(lp*if_watchdog\*(rp "struct ifnet *ifp" @@ -350,6 +354,20 @@ framing, e.g., Ethernet. Output a packet on interface .Fa ifp , or queue it on the output queue if the interface is already active. +.It Fn if_transmit +Transmit a packet on an interface or queue it if the interface is +in use. This function will return +.Dv ENOBUFS +if the devices software and hardware queues are both full. This +function must be installed after +.It Fn if_qflush +Free mbufs in internally managed queues when the interface is marked down. +This function must be installed after +.Fn if_attach +to override the default implementation. This function is exposed in order +to allow drivers to manage their own queues and to reduce the latency +caused by a frequently gratuitous enqueue / dequeue pair to ifq. The +suggested internal software queueing mechanism is buf_ring. .It Fn if_start Start queued output on an interface. This function is exposed in @@ -363,7 +381,8 @@ flag is not set. (Thus, .Dv IFF_OACTIVE does not literally mean that output is active, but rather that the -device's internal output queue is full.) +device's internal output queue is full.) Please note that this function +will soon be deprecated. .It Fn if_done Not used. We are not even sure what it was ever for. Modified: projects/arpv2_merge_1/sys/amd64/amd64/local_apic.c ============================================================================== --- projects/arpv2_merge_1/sys/amd64/amd64/local_apic.c Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/amd64/amd64/local_apic.c Fri Dec 12 02:11:49 2008 (r185966) @@ -299,6 +299,7 @@ lapic_setup(int boot) /* Program LINT[01] LVT entries. */ lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0); lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1); + #ifdef HWPMC_HOOKS /* Program the PMC LVT entry if present. */ if (maxlvt >= LVT_PMC) @@ -644,6 +645,18 @@ lapic_eoi(void) lapic->eoi = 0; } +/* + * Read the contents of the error status register. We have to write + * to the register first before reading from it. + */ +u_int +lapic_error(void) +{ + + lapic->esr = 0; + return (lapic->esr); +} + void lapic_handle_intr(int vector, struct trapframe *frame) { Modified: projects/arpv2_merge_1/sys/amd64/include/apicreg.h ============================================================================== --- projects/arpv2_merge_1/sys/amd64/include/apicreg.h Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/amd64/include/apicreg.h Fri Dec 12 02:11:49 2008 (r185966) @@ -260,6 +260,14 @@ typedef struct IOAPIC ioapic_t; # define APIC_TPR_INT 0x000000f0 # define APIC_TPR_SUB 0x0000000f +/* fields in ESR */ +#define APIC_ESR_SEND_CS_ERROR 0x00000001 +#define APIC_ESR_RECEIVE_CS_ERROR 0x00000002 +#define APIC_ESR_SEND_ACCEPT 0x00000004 +#define APIC_ESR_RECEIVE_ACCEPT 0x00000008 +#define APIC_ESR_SEND_ILLEGAL_VECTOR 0x00000020 +#define APIC_ESR_RECEIVE_ILLEGAL_VECTOR 0x00000040 +#define APIC_ESR_ILLEGAL_REGISTER 0x00000080 /* fields in ICR_LOW */ #define APIC_VECTOR_MASK 0x000000ff Modified: projects/arpv2_merge_1/sys/amd64/include/apicvar.h ============================================================================== --- projects/arpv2_merge_1/sys/amd64/include/apicvar.h Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/amd64/include/apicvar.h Fri Dec 12 02:11:49 2008 (r185966) @@ -200,6 +200,7 @@ void lapic_create(u_int apic_id, int boo void lapic_disable(void); void lapic_dump(const char *str); void lapic_eoi(void); +u_int lapic_error(void); int lapic_id(void); void lapic_init(vm_paddr_t addr); int lapic_intr_pending(u_int vector); Modified: projects/arpv2_merge_1/sys/boot/zfs/zfs.c ============================================================================== --- projects/arpv2_merge_1/sys/boot/zfs/zfs.c Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/boot/zfs/zfs.c Fri Dec 12 02:11:49 2008 (r185966) @@ -486,6 +486,7 @@ zfs_dev_open(struct open_file *f, ...) } f->f_devdata = spa; + free(dev); return (0); } Modified: projects/arpv2_merge_1/sys/conf/options ============================================================================== --- projects/arpv2_merge_1/sys/conf/options Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/conf/options Fri Dec 12 02:11:49 2008 (r185966) @@ -415,7 +415,6 @@ TCPDEBUG TCP_OFFLOAD_DISABLE opt_inet.h #Disable code to dispatch tcp offloading TCP_SIGNATURE opt_inet.h VLAN_ARRAY opt_vlan.h -VIMAGE_GLOBALS opt_global.h XBONEHACK # @@ -786,3 +785,4 @@ IEEE80211_AMPDU_AGE opt_wlan.h # Virtualize the network stack VIMAGE opt_global.h +VIMAGE_GLOBALS opt_global.h Modified: projects/arpv2_merge_1/sys/dev/usb/usbdevs ============================================================================== --- projects/arpv2_merge_1/sys/dev/usb/usbdevs Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/dev/usb/usbdevs Fri Dec 12 02:11:49 2008 (r185966) @@ -620,6 +620,7 @@ vendor AMIT 0x18c5 AMIT vendor QCOM 0x18e8 Qcom vendor LINKSYS3 0x1915 Linksys vendor QUALCOMMINC 0x19d2 Qualcomm, Incorporated +vendor STELERA 0x1a8d Stelera Wireless vendor DLINK 0x2001 D-Link vendor PLANEX2 0x2019 Planex Communications vendor ERICSSON 0x2282 Ericsson @@ -1876,6 +1877,7 @@ product OPTION VODAFONEMC3G 0x5000 Vodaf product OPTION GT3G 0x6000 GlobeTrotter 3G datacard product OPTION GT3GQUAD 0x6300 GlobeTrotter 3G QUAD datacard product OPTION GT3GPLUS 0x6600 GlobeTrotter 3G+ datacard +product OPTION GTICON322 0xd033 GlobeTrotter Icon322 storage product OPTION GTMAX36 0x6701 GlobeTrotter Max 3.6 Modem product OPTION GTMAXHSUPA 0x7001 GlobeTrotter HSUPA @@ -2125,12 +2127,14 @@ product SIERRA AIRCARD595 0x0019 Sierra product SIERRA AC595U 0x0120 Sierra Wireless AirCard 595U product SIERRA AC597E 0x0021 Sierra Wireless AirCard 597E product SIERRA C597 0x0023 Sierra Wireless Compass 597 +product SIERRA AC875 0x6820 Sierra Wireless AirCard 875 product SIERRA AC880 0x6850 Sierra Wireless AirCard 880 product SIERRA AC881 0x6851 Sierra Wireless AirCard 881 product SIERRA AC880E 0x6852 Sierra Wireless AirCard 880E product SIERRA AC881E 0x6853 Sierra Wireless AirCard 881E product SIERRA AC880U 0x6855 Sierra Wireless AirCard 880U product SIERRA AC881U 0x6856 Sierra Wireless AirCard 881U +product SIERRA AC885U 0x6880 Sierra Wireless AirCard 885U product SIERRA EM5625 0x0017 EM5625 product SIERRA MC5720 0x0218 MC5720 Wireless Modem product SIERRA MC5720_2 0x0018 MC5720 @@ -2253,6 +2257,10 @@ product SPARKLAN RT2573 0x0004 RT2573 /* Sphairon Access Systems GmbH products */ product SPHAIRON UB801R 0x0110 UB801R +/* Stelera Wireless products */ +product STELERA ZEROCD 0x1000 Zerocd Installer +product STELERA C105 0x1002 Stelera/Bandrish C105 USB + /* STMicroelectronics products */ product STMICRO BIOCPU 0x2016 Biometric Coprocessor product STMICRO COMMUNICATOR 0x7554 USB Communicator Modified: projects/arpv2_merge_1/sys/dev/usb2/bluetooth/ng_ubt2.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/usb2/bluetooth/ng_ubt2.c Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/dev/usb2/bluetooth/ng_ubt2.c Fri Dec 12 02:11:49 2008 (r185966) @@ -193,10 +193,10 @@ static usb2_callback_t ubt_bulk_write_cl static usb2_callback_t ubt_isoc_read_callback; static usb2_callback_t ubt_isoc_write_callback; -static int ubt_modevent(module_t mod, int event, void *data); -static void ubt_intr_read_complete(node_p node, hook_p hook, void *arg1, int arg2); -static void ubt_bulk_read_complete(node_p node, hook_p hook, void *arg1, int arg2); -static void ubt_isoc_read_complete(node_p node, hook_p hook, void *arg1, int arg2); +static int ubt_modevent(module_t, int, void *); +static void ubt_intr_read_complete(node_p, hook_p, void *, int); +static void ubt_bulk_read_complete(node_p, hook_p, void *, int); +static void ubt_isoc_read_complete(node_p, hook_p, void *, int); /* USB config */ static const struct usb2_config ubt_config_if_0[UBT_IF_0_N_TRANSFER] = { @@ -818,7 +818,6 @@ ubt_intr_read_clear_stall_callback(struc sc->sc_flags &= ~UBT_FLAG_INTR_STALL; usb2_transfer_start(xfer_other); } - return; } static void @@ -883,8 +882,6 @@ done: usb2_transfer_start(sc->sc_xfer_if_0[2]); mtx_unlock(&sc->sc_mtx); - - return; } static void @@ -972,7 +969,6 @@ ubt_bulk_read_clear_stall_callback(struc sc->sc_flags &= ~UBT_FLAG_READ_STALL; usb2_transfer_start(xfer_other); } - return; } static void @@ -1040,8 +1036,6 @@ done: usb2_transfer_start(sc->sc_xfer_if_0[1]); mtx_unlock(&sc->sc_mtx); - - return; } static void @@ -1121,7 +1115,6 @@ ubt_bulk_write_clear_stall_callback(stru sc->sc_flags &= ~UBT_FLAG_WRITE_STALL; usb2_transfer_start(xfer_other); } - return; } static void @@ -1265,8 +1258,6 @@ done: } mtx_unlock(&sc->sc_mtx); - - return; } static void Modified: projects/arpv2_merge_1/sys/dev/usb2/bluetooth/ubtbcmfw2.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/usb2/bluetooth/ubtbcmfw2.c Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/dev/usb2/bluetooth/ubtbcmfw2.c Fri Dec 12 02:11:49 2008 (r185966) @@ -305,7 +305,6 @@ ubtbcmfw_write_clear_stall_callback(stru sc->sc_flags &= ~UBTBCMFW_FLAG_WRITE_STALL; usb2_transfer_start(xfer_other); } - return; } static void @@ -351,7 +350,6 @@ ubtbcmfw_read_clear_stall_callback(struc sc->sc_flags &= ~UBTBCMFW_FLAG_READ_STALL; usb2_transfer_start(xfer_other); } - return; } static void @@ -360,7 +358,6 @@ ubtbcmfw_start_read(struct usb2_fifo *fi struct ubtbcmfw_softc *sc = fifo->priv_sc0; usb2_transfer_start(sc->sc_xfer[1]); - return; } static void @@ -370,7 +367,6 @@ ubtbcmfw_stop_read(struct usb2_fifo *fif usb2_transfer_stop(sc->sc_xfer[3]); usb2_transfer_stop(sc->sc_xfer[1]); - return; } static void @@ -379,7 +375,6 @@ ubtbcmfw_start_write(struct usb2_fifo *f struct ubtbcmfw_softc *sc = fifo->priv_sc0; usb2_transfer_start(sc->sc_xfer[0]); - return; } static void @@ -389,7 +384,6 @@ ubtbcmfw_stop_write(struct usb2_fifo *fi usb2_transfer_stop(sc->sc_xfer[2]); usb2_transfer_stop(sc->sc_xfer[0]); - return; } static int @@ -424,7 +418,6 @@ ubtbcmfw_close(struct usb2_fifo *fifo, i if (fflags & (FREAD | FWRITE)) { usb2_fifo_free_buffer(fifo); } - return; } static int Modified: projects/arpv2_merge_1/sys/dev/usb2/controller/at91dci.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/usb2/controller/at91dci.c Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/dev/usb2/controller/at91dci.c Fri Dec 12 02:11:49 2008 (r185966) @@ -99,10 +99,10 @@ static at91dci_cmd_t at91dci_setup_rx; static at91dci_cmd_t at91dci_data_rx; static at91dci_cmd_t at91dci_data_tx; static at91dci_cmd_t at91dci_data_tx_sync; -static void at91dci_device_done(struct usb2_xfer *xfer, usb2_error_t error); -static void at91dci_do_poll(struct usb2_bus *bus); -static void at91dci_root_ctrl_poll(struct at91dci_softc *sc); -static void at91dci_standard_done(struct usb2_xfer *xfer); +static void at91dci_device_done(struct usb2_xfer *, usb2_error_t); +static void at91dci_do_poll(struct usb2_bus *); +static void at91dci_root_ctrl_poll(struct at91dci_softc *); +static void at91dci_standard_done(struct usb2_xfer *); static usb2_sw_transfer_func_t at91dci_root_intr_done; static usb2_sw_transfer_func_t at91dci_root_ctrl_done; @@ -200,7 +200,6 @@ at91dci_get_hw_ep_profile(struct usb2_de } else { *ppf = NULL; } - return; } static void @@ -219,7 +218,6 @@ at91dci_clocks_on(struct at91dci_softc * /* enable Transceiver */ AT91_UDP_WRITE_4(sc, AT91_UDP_TXVC, 0); } - return; } static void @@ -237,7 +235,6 @@ at91dci_clocks_off(struct at91dci_softc } sc->sc_flags.clocks_off = 1; } - return; } static void @@ -250,7 +247,6 @@ at91dci_pull_up(struct at91dci_softc *sc sc->sc_flags.d_pulled_up = 1; (sc->sc_pull_up) (sc->sc_pull_arg); } - return; } static void @@ -262,7 +258,6 @@ at91dci_pull_down(struct at91dci_softc * sc->sc_flags.d_pulled_up = 0; (sc->sc_pull_down) (sc->sc_pull_arg); } - return; } static void @@ -279,8 +274,6 @@ at91dci_wakeup_peer(struct at91dci_softc return; } AT91_UDP_WRITE_4(sc, AT91_UDP_GSTATE, temp); - - return; } static void @@ -304,8 +297,6 @@ at91dci_rem_wakeup_set(struct usb2_devic } AT91_UDP_WRITE_4(sc, AT91_UDP_GSTATE, temp); - - return; } static void @@ -315,8 +306,6 @@ at91dci_set_address(struct at91dci_softc AT91_UDP_WRITE_4(sc, AT91_UDP_FADDR, addr | AT91_UDP_FADDR_EN); - - return; } static uint8_t @@ -756,7 +745,6 @@ repeat: goto repeat; } } - return; } static void @@ -792,8 +780,6 @@ at91dci_vbus_interrupt(struct usb2_bus * } USB_BUS_UNLOCK(&sc->sc_bus); - - return; } void @@ -880,8 +866,6 @@ at91dci_interrupt(struct at91dci_softc * at91dci_interrupt_poll(sc); } USB_BUS_UNLOCK(&sc->sc_bus); - - return; } static void @@ -906,7 +890,6 @@ at91dci_setup_standard_chain_sub(struct td->did_stall = 0; td->short_pkt = temp->short_pkt; td->alt_next = temp->setup_alt_next; - return; } static void @@ -1054,7 +1037,6 @@ at91dci_setup_standard_chain(struct usb2 td = xfer->td_transfer_first; td->fifo_bank = 1; } - return; } static void @@ -1071,8 +1053,6 @@ at91dci_timeout(void *arg) at91dci_device_done(xfer, USB_ERR_TIMEOUT); USB_BUS_UNLOCK(&sc->sc_bus); - - return; } static void @@ -1104,7 +1084,6 @@ at91dci_start_standard_chain(struct usb2 &at91dci_timeout, xfer->timeout); } } - return; } static void @@ -1240,7 +1219,6 @@ at91dci_standard_done(struct usb2_xfer * } done: at91dci_device_done(xfer, err); - return; } /*------------------------------------------------------------------------* @@ -1270,7 +1248,6 @@ at91dci_device_done(struct usb2_xfer *xf } /* dequeue transfer and start next transfer */ usb2_transfer_done(xfer, error); - return; } static void @@ -1296,7 +1273,6 @@ at91dci_set_stall(struct usb2_device *ud csr_val = AT91_UDP_READ_4(sc, csr_reg); AT91_CSR_ACK(csr_val, AT91_UDP_CSR_FORCESTALL); AT91_UDP_WRITE_4(sc, csr_reg, csr_val); - return; } static void @@ -1393,8 +1369,6 @@ at91dci_clear_stall_sub(struct at91dci_s /* enable endpoint */ AT91_UDP_WRITE_4(sc, AT91_UDP_CSR(ep_no), csr_val); - - return; } static void @@ -1423,7 +1397,6 @@ at91dci_clear_stall(struct usb2_device * (ed->bEndpointAddress & UE_ADDR), (ed->bmAttributes & UE_XFERTYPE), (ed->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT))); - return; } usb2_error_t @@ -1511,8 +1484,6 @@ at91dci_uninit(struct at91dci_softc *sc) at91dci_pull_down(sc); at91dci_clocks_off(sc); USB_BUS_UNLOCK(&sc->sc_bus); - - return; } void @@ -1536,7 +1507,6 @@ at91dci_do_poll(struct usb2_bus *bus) at91dci_interrupt_poll(sc); at91dci_root_ctrl_poll(sc); USB_BUS_UNLOCK(&sc->sc_bus); - return; } /*------------------------------------------------------------------------* @@ -1552,7 +1522,6 @@ static void at91dci_device_bulk_close(struct usb2_xfer *xfer) { at91dci_device_done(xfer, USB_ERR_CANCELLED); - return; } static void @@ -1567,7 +1536,6 @@ at91dci_device_bulk_start(struct usb2_xf /* setup TDs */ at91dci_setup_standard_chain(xfer); at91dci_start_standard_chain(xfer); - return; } struct usb2_pipe_methods at91dci_device_bulk_methods = @@ -1593,7 +1561,6 @@ static void at91dci_device_ctrl_close(struct usb2_xfer *xfer) { at91dci_device_done(xfer, USB_ERR_CANCELLED); - return; } static void @@ -1608,7 +1575,6 @@ at91dci_device_ctrl_start(struct usb2_xf /* setup TDs */ at91dci_setup_standard_chain(xfer); at91dci_start_standard_chain(xfer); - return; } struct usb2_pipe_methods at91dci_device_ctrl_methods = @@ -1634,7 +1600,6 @@ static void at91dci_device_intr_close(struct usb2_xfer *xfer) { at91dci_device_done(xfer, USB_ERR_CANCELLED); - return; } static void @@ -1649,7 +1614,6 @@ at91dci_device_intr_start(struct usb2_xf /* setup TDs */ at91dci_setup_standard_chain(xfer); at91dci_start_standard_chain(xfer); - return; } struct usb2_pipe_methods at91dci_device_intr_methods = @@ -1675,7 +1639,6 @@ static void at91dci_device_isoc_fs_close(struct usb2_xfer *xfer) { at91dci_device_done(xfer, USB_ERR_CANCELLED); - return; } static void @@ -1728,7 +1691,6 @@ at91dci_device_isoc_fs_enter(struct usb2 /* setup TDs */ at91dci_setup_standard_chain(xfer); - return; } static void @@ -1736,7 +1698,6 @@ at91dci_device_isoc_fs_start(struct usb2 { /* start TD chain */ at91dci_start_standard_chain(xfer); - return; } struct usb2_pipe_methods at91dci_device_isoc_fs_methods = @@ -1771,7 +1732,6 @@ at91dci_root_ctrl_close(struct usb2_xfer sc->sc_root_ctrl.xfer = NULL; } at91dci_device_done(xfer, USB_ERR_CANCELLED); - return; } /* @@ -1876,8 +1836,6 @@ at91dci_root_ctrl_start(struct usb2_xfer usb2_config_td_queue_command( &sc->sc_config_td, NULL, &at91dci_root_ctrl_task, 0, 0); - - return; } static void @@ -1885,7 +1843,6 @@ at91dci_root_ctrl_task(struct at91dci_so struct at91dci_config_copy *cc, uint16_t refcount) { at91dci_root_ctrl_poll(sc); - return; } static void @@ -2294,7 +2251,6 @@ at91dci_root_ctrl_poll(struct at91dci_so { usb2_sw_transfer(&sc->sc_root_ctrl, &at91dci_root_ctrl_done); - return; } struct usb2_pipe_methods at91dci_root_ctrl_methods = @@ -2325,7 +2281,6 @@ at91dci_root_intr_close(struct usb2_xfer sc->sc_root_intr.xfer = NULL; } at91dci_device_done(xfer, USB_ERR_CANCELLED); - return; } static void @@ -2340,7 +2295,6 @@ at91dci_root_intr_start(struct usb2_xfer struct at91dci_softc *sc = xfer->usb2_sc; sc->sc_root_intr.xfer = xfer; - return; } struct usb2_pipe_methods at91dci_root_intr_methods = @@ -2465,7 +2419,6 @@ at91dci_xfer_setup(struct usb2_setup_par } xfer->td_start[0] = last_obj; - return; } static void @@ -2530,7 +2483,6 @@ at91dci_pipe_init(struct usb2_device *ud break; } } - return; } struct usb2_bus_methods at91dci_bus_methods = Modified: projects/arpv2_merge_1/sys/dev/usb2/controller/at91dci_atmelarm.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/usb2/controller/at91dci_atmelarm.c Fri Dec 12 02:07:45 2008 (r185965) +++ projects/arpv2_merge_1/sys/dev/usb2/controller/at91dci_atmelarm.c Fri Dec 12 02:11:49 2008 (r185966) @@ -87,7 +87,6 @@ at91_vbus_interrupt(struct at91_udp_soft vbus_val = at91_pio_gpio_get(VBUS_BASE, VBUS_MASK); (sc->sc_dci.sc_bus.methods->vbus_interrupt) (&sc->sc_dci.sc_bus, vbus_val); - return; } static void @@ -97,7 +96,6 @@ at91_udp_clocks_on(void *arg) at91_pmc_clock_enable(sc->sc_iclk); at91_pmc_clock_enable(sc->sc_fclk); - return; } static void @@ -107,21 +105,18 @@ at91_udp_clocks_off(void *arg) at91_pmc_clock_disable(sc->sc_fclk); at91_pmc_clock_disable(sc->sc_iclk); - return; } static void at91_udp_pull_up(void *arg) { at91_pio_gpio_set(PULLUP_BASE, PULLUP_MASK); - return; } static void at91_udp_pull_down(void *arg) { at91_pio_gpio_clear(PULLUP_BASE, PULLUP_MASK); - return; } static int Modified: projects/arpv2_merge_1/sys/dev/usb2/controller/ehci2.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/usb2/controller/ehci2.c Fri Dec 12 02:07:45 2008 (r185965) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 05:59:59 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96BD8106564A; Fri, 12 Dec 2008 05:59:59 +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 6D1798FC12; Fri, 12 Dec 2008 05:59:59 +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 mBC5xxWp088183; Fri, 12 Dec 2008 05:59:59 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC5xxn7088182; Fri, 12 Dec 2008 05:59:59 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812120559.mBC5xxn7088182@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 05:59:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185971 - projects/arpv2_merge_1/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 05:59:59 -0000 Author: sam Date: Fri Dec 12 05:59:59 2008 New Revision: 185971 URL: http://svn.freebsd.org/changeset/base/185971 Log: kill unused type decl Modified: projects/arpv2_merge_1/sys/net/if_var.h Modified: projects/arpv2_merge_1/sys/net/if_var.h ============================================================================== --- projects/arpv2_merge_1/sys/net/if_var.h Fri Dec 12 05:45:39 2008 (r185970) +++ projects/arpv2_merge_1/sys/net/if_var.h Fri Dec 12 05:59:59 2008 (r185971) @@ -68,7 +68,6 @@ struct rtentry; struct rt_addrinfo; struct socket; struct ether_header; -struct lltable; struct carp_if; struct ifvlantrunk; #endif From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 06:00:16 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 517D2106564A; Fri, 12 Dec 2008 06:00: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 4140E8FC14; Fri, 12 Dec 2008 06:00: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 mBC60Gue088253; Fri, 12 Dec 2008 06:00:16 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC60Ge0088252; Fri, 12 Dec 2008 06:00:16 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812120600.mBC60Ge0088252@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 06:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185972 - projects/arpv2_merge_1/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 06:00:16 -0000 Author: sam Date: Fri Dec 12 06:00:15 2008 New Revision: 185972 URL: http://svn.freebsd.org/changeset/base/185972 Log: compare ptr to NULL Modified: projects/arpv2_merge_1/sys/net/if_ethersubr.c Modified: projects/arpv2_merge_1/sys/net/if_ethersubr.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_ethersubr.c Fri Dec 12 05:59:59 2008 (r185971) +++ projects/arpv2_merge_1/sys/net/if_ethersubr.c Fri Dec 12 06:00:15 2008 (r185972) @@ -293,7 +293,7 @@ ether_output(struct ifnet *ifp, struct m senderr(EAFNOSUPPORT); } - if (lle && (lle->la_flags & LLE_IFADDR)) { + if (lle != NULL && (lle->la_flags & LLE_IFADDR)) { int csum_flags = 0; if (m->m_pkthdr.csum_flags & CSUM_IP) csum_flags |= (CSUM_IP_CHECKED|CSUM_IP_VALID); From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 06:01:10 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56C2B1065673; Fri, 12 Dec 2008 06:01:10 +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 469A08FC14; Fri, 12 Dec 2008 06:01:10 +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 mBC61AjO088303; Fri, 12 Dec 2008 06:01:10 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC61AOp088302; Fri, 12 Dec 2008 06:01:10 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812120601.mBC61AOp088302@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 06:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185973 - projects/arpv2_merge_1/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 06:01:10 -0000 Author: sam Date: Fri Dec 12 06:01:09 2008 New Revision: 185973 URL: http://svn.freebsd.org/changeset/base/185973 Log: o fix comments o gratuitous style change Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.c Fri Dec 12 06:00:15 2008 (r185972) +++ projects/arpv2_merge_1/sys/net/if_llatbl.c Fri Dec 12 06:01:09 2008 (r185973) @@ -237,10 +237,7 @@ lla_rt_output(struct rt_msghdr *rtm, str return EINVAL; /* XXX not implemented yet */ } - /* - * XXXXXXXX: - * REVISE this approach if possible. - */ + /* XXX linked list may be too expensive */ IFNET_RLOCK(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af == dst->sa_family && @@ -258,9 +255,10 @@ lla_rt_output(struct rt_msghdr *rtm, str IF_AFDATA_UNLOCK(ifp); if (lle != NULL) { if (flags & LLE_CREATE) { - /* qing: if we delay the delete, then if a subsequent - * "arp add" on the same host should look up this entry, - * reset the LLE_DELETED flag, and reset the expiration timer + /* + * If we delay the delete, then a subsequent + * "arp add" should look up this entry, reset the + * LLE_DELETED flag, and reset the expiration timer */ bcopy(LLADDR(dl), &lle->ll_addr, ifp->if_addrlen); lle->la_flags |= LLE_VALID; @@ -273,7 +271,7 @@ lla_rt_output(struct rt_msghdr *rtm, str lle->ln_state = ND6_LLINFO_REACHABLE; #endif /* - * "arp" and "ndp" always sets the (RTF_STATIC | RTF_HOST) flags + * NB: arp and ndp always set (RTF_STATIC | RTF_HOST) */ if (rtm->rtm_rmx.rmx_expire == 0) { @@ -285,8 +283,7 @@ lla_rt_output(struct rt_msghdr *rtm, str LLE_WUNLOCK(lle); #ifdef INET /* gratuious ARP */ - if ((laflags & LLE_PUB) && - dst->sa_family == AF_INET) { + if ((laflags & LLE_PUB) && dst->sa_family == AF_INET) { arprequest(ifp, &((struct sockaddr_in *)dst)->sin_addr, &((struct sockaddr_in *)dst)->sin_addr, From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 06:01:30 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92FAB1065677; Fri, 12 Dec 2008 06:01: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 828998FC0C; Fri, 12 Dec 2008 06:01: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 mBC61Ubo088345; Fri, 12 Dec 2008 06:01:30 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC61UFJ088344; Fri, 12 Dec 2008 06:01:30 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812120601.mBC61UFJ088344@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 06:01:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185974 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 06:01:30 -0000 Author: sam Date: Fri Dec 12 06:01:30 2008 New Revision: 185974 URL: http://svn.freebsd.org/changeset/base/185974 Log: o fix comment o compare ptr to NULL Modified: projects/arpv2_merge_1/sys/netinet/in.c Modified: projects/arpv2_merge_1/sys/netinet/in.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in.c Fri Dec 12 06:01:09 2008 (r185973) +++ projects/arpv2_merge_1/sys/netinet/in.c Fri Dec 12 06:01:30 2008 (r185974) @@ -1040,9 +1040,9 @@ in_lltable_new(const struct sockaddr *l3 return NULL; callout_init(&lle->base.la_timer, CALLOUT_MPSAFE); - /* qing + /* * For IPv4 this will trigger "arpresolve" to generate - * an ARP request + * an ARP request. */ lle->base.la_expire = time_second; /* mark expired */ lle->l3_addr4 = *(const struct sockaddr_in *)l3addr; @@ -1085,9 +1085,8 @@ in_lltable_rtcheck(struct ifnet *ifp, co } /* - * Returns NULL if not found or marked for deletion - * if found returns lle read locked - * + * Return NULL if not found or marked for deletion. + * If found return lle read locked. */ static struct llentry * in_lltable_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) @@ -1148,7 +1147,7 @@ in_lltable_lookup(struct lltable *llt, u #endif lle = NULL; } - if (lle) { + if (lle != NULL) { if (flags & LLE_EXCLUSIVE) LLE_WLOCK(lle); else From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 06:03:08 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B56EE106564A; Fri, 12 Dec 2008 06:03: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 A4D4D8FC18; Fri, 12 Dec 2008 06:03: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 mBC638Rn088410; Fri, 12 Dec 2008 06:03:08 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC638ZV088409; Fri, 12 Dec 2008 06:03:08 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812120603.mBC638ZV088409@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 06:03:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185975 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 06:03:08 -0000 Author: sam Date: Fri Dec 12 06:03:08 2008 New Revision: 185975 URL: http://svn.freebsd.org/changeset/base/185975 Log: misc cleanups: o remove excessive ()'s o kill pointless blank lines o add comment markers for some questionable code o compare ptr's to NULL o kill dead code Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_ether.c Fri Dec 12 06:01:30 2008 (r185974) +++ projects/arpv2_merge_1/sys/netinet/if_ether.c Fri Dec 12 06:03:08 2008 (r185975) @@ -156,12 +156,10 @@ arptimer(void *arg) ifp = lle->lle_tbl->llt_ifp; if ((lle->la_flags & LLE_DELETED) || (time_second >= lle->la_expire)) { - IF_AFDATA_LOCK(ifp); - if (!callout_pending(&lle->la_timer) && - (callout_active(&lle->la_timer))) { - (void)llentry_free(lle); - } + if (!callout_pending(&lle->la_timer) && + callout_active(&lle->la_timer)) + (void) llentry_free(lle); IF_AFDATA_UNLOCK(ifp); } else { /* @@ -171,7 +169,6 @@ arptimer(void *arg) } } - /* * Broadcast an ARP request. Caller specifies: * - arp header source ip address @@ -187,6 +184,7 @@ arprequest(struct ifnet *ifp, struct in_ struct sockaddr sa; if (sip == NULL) { + /* XXX don't believe this can happen (or explain why) */ /* * The caller did not supply a source address, try to find * a compatible one among those assigned to this interface. @@ -275,6 +273,7 @@ arpresolve(struct ifnet *ifp, struct rte /* XXXXX * Since this function returns an llentry, the * lock is held by the caller. + * XXX if caller is required to hold lock, assert it */ retry: la = lla_lookup(LLTABLE(ifp), flags, dst); @@ -288,7 +287,7 @@ retry: } if ((la->la_flags & LLE_VALID) && - ((la->la_flags & LLE_STATIC) || (la->la_expire > time_uptime))) { + ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) { bcopy(&la->ll_addr, desten, ifp->if_addrlen); /* * If entry has an expiry time and it is approaching, @@ -317,8 +316,7 @@ retry: } renew = (la->la_asked == 0 || la->la_expire != time_uptime); - - if ((renew || m) && ((flags & LLE_EXCLUSIVE) == 0)) { + if ((renew || m != NULL) && (flags & LLE_EXCLUSIVE) == 0) { flags |= LLE_EXCLUSIVE; LLE_RUNLOCK(la); goto retry; @@ -328,8 +326,8 @@ retry: * response yet. Replace the held mbuf with this * latest one. */ - if (m) { - if (la->la_hold) + if (m != NULL) { + if (la->la_hold != NULL) m_freem(la->la_hold); la->la_hold = m; if (renew == 0 && (flags & LLE_EXCLUSIVE)) { @@ -360,7 +358,6 @@ retry: IF_LLADDR(ifp)); return (error); } - done: if (flags & LLE_EXCLUSIVE) LLE_WUNLOCK(la); @@ -458,9 +455,6 @@ in_arpinput(struct mbuf *m) u_int8_t *enaddr = NULL; int op, flags; struct mbuf *m0; -/* -, rif_len; -*/ int req_len; int bridged = 0, is_bridge = 0; #ifdef DEV_CARP @@ -499,7 +493,7 @@ in_arpinput(struct mbuf *m) */ LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { if (((bridged && ia->ia_ifp->if_bridge != NULL) || - (ia->ia_ifp == ifp)) && + ia->ia_ifp == ifp) && itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) goto match; #ifdef DEV_CARP @@ -513,7 +507,7 @@ in_arpinput(struct mbuf *m) } LIST_FOREACH(ia, INADDR_HASH(isaddr.s_addr), ia_hash) if (((bridged && ia->ia_ifp->if_bridge != NULL) || - (ia->ia_ifp == ifp)) && + ia->ia_ifp == ifp) && isaddr.s_addr == ia->ia_addr.sin_addr.s_addr) goto match; @@ -643,7 +637,7 @@ match: } la->la_asked = 0; la->la_preempt = V_arp_maxtries; - if (la->la_hold) { + if (la->la_hold != NULL) { m0 = la->la_hold; la->la_hold = 0; memcpy(&sa, L3_ADDR(la), sizeof(sa)); @@ -727,7 +721,7 @@ reply: } } - if (la) + if (la != NULL) LLE_WUNLOCK(la); if (itaddr.s_addr == myaddr.s_addr && IN_LINKLOCAL(ntohl(itaddr.s_addr))) { @@ -754,7 +748,7 @@ reply: return; drop: - if (la) + if (la != NULL) LLE_WUNLOCK(la); m_freem(m); } From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 06:06:50 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 021F51065677; Fri, 12 Dec 2008 06:06:50 +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 E5A1E8FC1B; Fri, 12 Dec 2008 06:06: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 mBC66n3j088520; Fri, 12 Dec 2008 06:06:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC66ncH088519; Fri, 12 Dec 2008 06:06:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812120606.mBC66ncH088519@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 06:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185976 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 06:06:50 -0000 Author: kmacy Date: Fri Dec 12 06:06:49 2008 New Revision: 185976 URL: http://svn.freebsd.org/changeset/base/185976 Log: change INVARIANTS to DIAGNOSTICS for debugging messages Modified: projects/arpv2_merge_1/sys/netinet/in.c Modified: projects/arpv2_merge_1/sys/netinet/in.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in.c Fri Dec 12 06:03:08 2008 (r185975) +++ projects/arpv2_merge_1/sys/netinet/in.c Fri Dec 12 06:06:49 2008 (r185976) @@ -1109,7 +1109,7 @@ in_lltable_lookup(struct lltable *llt, u break; } if (lle == NULL) { -#ifdef INVARIANTS +#ifdef DIAGNOSTICS if (flags & LLE_DELETE) log(LOG_INFO, "interface address is missing from cache = %p in delete\n", lle); #endif @@ -1142,7 +1142,7 @@ in_lltable_lookup(struct lltable *llt, u LLE_WLOCK(lle); lle->la_flags = LLE_DELETED; LLE_WUNLOCK(lle); -#ifdef INVARIANTS +#ifdef DIAGNOSTICS log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); #endif lle = NULL; From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 06:30:10 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33F431065672; Fri, 12 Dec 2008 06:30:10 +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 22FA18FC12; Fri, 12 Dec 2008 06:30:10 +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 mBC6U92U088991; Fri, 12 Dec 2008 06:30:09 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC6U9cM088989; Fri, 12 Dec 2008 06:30:09 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812120630.mBC6U9cM088989@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 06:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185977 - projects/arpv2_merge_1/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 06:30:10 -0000 Author: kmacy Date: Fri Dec 12 06:30:09 2008 New Revision: 185977 URL: http://svn.freebsd.org/changeset/base/185977 Log: update copyright to reflect years more accurately Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c projects/arpv2_merge_1/sys/net/if_llatbl.h Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.c Fri Dec 12 06:06:49 2008 (r185976) +++ projects/arpv2_merge_1/sys/net/if_llatbl.c Fri Dec 12 06:30:09 2008 (r185977) @@ -1,5 +1,7 @@ /* - * Copyright (c) 2007 Qing Li, Luigi Rizzo, Alessandro Cerri. All rights reserved. + * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved. + * Copyright (c) 2004-2008 Qing Li. All rights reserved. + * Copyright (c) 2008 Kip Macy. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: projects/arpv2_merge_1/sys/net/if_llatbl.h ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.h Fri Dec 12 06:06:49 2008 (r185976) +++ projects/arpv2_merge_1/sys/net/if_llatbl.h Fri Dec 12 06:30:09 2008 (r185977) @@ -1,5 +1,7 @@ /* - * Copyright (c) 2007 Qing Li, Luigi Rizzo, Alessandro Cerri. All rights reserved. + * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved. + * Copyright (c) 2004-2008 Qing Li. All rights reserved. + * Copyright (c) 2008 Kip Macy. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 06:33:55 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F6B51065673; Fri, 12 Dec 2008 06:33:55 +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 4EF1B8FC08; Fri, 12 Dec 2008 06:33:55 +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 mBC6XtGu089131; Fri, 12 Dec 2008 06:33:55 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC6XtTZ089130; Fri, 12 Dec 2008 06:33:55 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812120633.mBC6XtTZ089130@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 06:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185978 - projects/arpv2_merge_1/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 06:33:55 -0000 Author: kmacy Date: Fri Dec 12 06:33:54 2008 New Revision: 185978 URL: http://svn.freebsd.org/changeset/base/185978 Log: don't make RTM_RESOLVE return EINVAL - it is still needed for compat Modified: projects/arpv2_merge_1/sys/net/route.c Modified: projects/arpv2_merge_1/sys/net/route.c ============================================================================== --- projects/arpv2_merge_1/sys/net/route.c Fri Dec 12 06:30:09 2008 (r185977) +++ projects/arpv2_merge_1/sys/net/route.c Fri Dec 12 06:33:54 2008 (r185978) @@ -972,10 +972,10 @@ deldone: break; case RTM_RESOLVE: /* - * resolve is only used for route cloning - * + * resolve was only used for route cloning + * here for compat */ - senderr(EINVAL); + break; case RTM_ADD: if ((flags & RTF_GATEWAY) && !gateway) senderr(EINVAL); From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 07:34:43 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16F7C1065675; Fri, 12 Dec 2008 07:34:43 +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 05EE58FC14; Fri, 12 Dec 2008 07:34:43 +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 mBC7Ygwl090269; Fri, 12 Dec 2008 07:34:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBC7YgjK090268; Fri, 12 Dec 2008 07:34:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812120734.mBC7YgjK090268@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 07:34:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185979 - projects/arpv2_merge_1/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 07:34:43 -0000 Author: kmacy Date: Fri Dec 12 07:34:42 2008 New Revision: 185979 URL: http://svn.freebsd.org/changeset/base/185979 Log: need to do a WUNLOCK if LLE_EXCLUSIVE was passed Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.c Fri Dec 12 06:33:54 2008 (r185978) +++ projects/arpv2_merge_1/sys/net/if_llatbl.c Fri Dec 12 07:34:42 2008 (r185979) @@ -294,8 +294,12 @@ lla_rt_output(struct rt_msghdr *rtm, str (u_char *)LLADDR(dl))); } #endif - } else - LLE_RUNLOCK(lle); + } else { + if (flags & LLE_EXCLUSIVE) + LLE_WUNLOCK(lle); + else + LLE_RUNLOCK(lle); + } } else { if (flags & LLE_DELETE) error = EINVAL; From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 21:45:11 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D5911065670; Fri, 12 Dec 2008 21:45:11 +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 1D3F18FC08; Fri, 12 Dec 2008 21:45:11 +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 mBCLjBFo009332; Fri, 12 Dec 2008 21:45:11 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBCLjAgw009326; Fri, 12 Dec 2008 21:45:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812122145.mBCLjAgw009326@svn.freebsd.org> From: Kip Macy Date: Fri, 12 Dec 2008 21:45:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186000 - in projects/arpv2_merge_1/sys: net netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 21:45:11 -0000 Author: kmacy Date: Fri Dec 12 21:45:10 2008 New Revision: 186000 URL: http://svn.freebsd.org/changeset/base/186000 Log: We no longer automatically create a host route to the gateway for storing its L2 information. This changes remove rt_gwroute from rtentry and the corresponding validation function rt_check. Modified: projects/arpv2_merge_1/sys/net/if_atmsubr.c projects/arpv2_merge_1/sys/net/if_fwsubr.c projects/arpv2_merge_1/sys/net/if_iso88025subr.c projects/arpv2_merge_1/sys/net/route.c projects/arpv2_merge_1/sys/net/route.h projects/arpv2_merge_1/sys/netinet/if_ether.c Modified: projects/arpv2_merge_1/sys/net/if_atmsubr.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_atmsubr.c Fri Dec 12 20:29:34 2008 (r185999) +++ projects/arpv2_merge_1/sys/net/if_atmsubr.c Fri Dec 12 21:45:10 2008 (r186000) @@ -153,22 +153,11 @@ atm_output(struct ifnet *ifp, struct mbu case AF_INET: case AF_INET6: { - struct rtentry *rt = NULL; - /* - * check route - */ - if (rt0 != NULL) { - error = rt_check(&rt, &rt0, dst); - if (error) - goto bad; - RT_UNLOCK(rt); - } - if (dst->sa_family == AF_INET6) etype = ETHERTYPE_IPV6; else etype = ETHERTYPE_IP; - if (!atmresolve(rt, m, dst, &atmdst)) { + if (!atmresolve(rt0, m, dst, &atmdst)) { m = NULL; /* XXX: atmresolve already free'd it */ senderr(EHOSTUNREACH); Modified: projects/arpv2_merge_1/sys/net/if_fwsubr.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_fwsubr.c Fri Dec 12 20:29:34 2008 (r185999) +++ projects/arpv2_merge_1/sys/net/if_fwsubr.c Fri Dec 12 21:45:10 2008 (r186000) @@ -81,7 +81,6 @@ firewire_output(struct ifnet *ifp, struc { struct fw_com *fc = IFP2FWC(ifp); int error, type; - struct rtentry *rt = NULL; struct m_tag *mtag; union fw_encap *enc; struct fw_hwaddr *destfw; @@ -104,13 +103,6 @@ firewire_output(struct ifnet *ifp, struc goto bad; } - if (rt0 != NULL) { - error = rt_check(&rt, &rt0, dst); - if (error) - goto bad; - RT_UNLOCK(rt); - } - /* * For unicast, we make a tag to store the lladdr of the * destination. This might not be the first time we have seen @@ -146,7 +138,7 @@ firewire_output(struct ifnet *ifp, struc * doesn't fit into the arp model. */ if (unicast) { - error = arpresolve(ifp, rt, m, dst, (u_char *) destfw, &lle); + error = arpresolve(ifp, rt0, m, dst, (u_char *) destfw, &lle); if (error) return (error == EWOULDBLOCK ? 0 : error); } @@ -175,7 +167,7 @@ firewire_output(struct ifnet *ifp, struc #ifdef INET6 case AF_INET6: if (unicast) { - error = nd6_storelladdr(fc->fc_ifp, rt, m, dst, + error = nd6_storelladdr(fc->fc_ifp, rt0, m, dst, (u_char *) destfw, &lle); if (error) return (error); Modified: projects/arpv2_merge_1/sys/net/if_iso88025subr.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_iso88025subr.c Fri Dec 12 20:29:34 2008 (r185999) +++ projects/arpv2_merge_1/sys/net/if_iso88025subr.c Fri Dec 12 21:45:10 2008 (r186000) @@ -244,7 +244,6 @@ iso88025_output(ifp, m, dst, rt0) struct iso88025_header *th; struct iso88025_header gen_th; struct sockaddr_dl *sdl = NULL; - struct rtentry *rt = NULL; struct llentry *lle; #ifdef MAC @@ -262,14 +261,8 @@ iso88025_output(ifp, m, dst, rt0) /* Calculate routing info length based on arp table entry */ /* XXX any better way to do this ? */ - if (rt0 != NULL) { - error = rt_check(&rt, &rt0, dst); - if (error) - goto bad; - RT_UNLOCK(rt); - } - if (rt && (sdl = (struct sockaddr_dl *)rt->rt_gateway)) + if (rt0 && (sdl = (struct sockaddr_dl *)rt0->rt_gateway)) if (SDL_ISO88025(sdl)->trld_rcf != 0) rif_len = TR_RCF_RIFLEN(SDL_ISO88025(sdl)->trld_rcf); Modified: projects/arpv2_merge_1/sys/net/route.c ============================================================================== --- projects/arpv2_merge_1/sys/net/route.c Fri Dec 12 20:29:34 2008 (r185999) +++ projects/arpv2_merge_1/sys/net/route.c Fri Dec 12 21:45:10 2008 (r186000) @@ -783,16 +783,6 @@ rtexpunge(struct rtentry *rt) rt->rt_flags &= ~RTF_UP; /* - * Remove any external references we may have. - * This might result in another rtentry being freed if - * we held its last reference. - */ - if (rt->rt_gwroute) { - RTFREE(rt->rt_gwroute); - rt->rt_gwroute = NULL; - } - - /* * Give the protocol a chance to keep things in sync. */ if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest) { @@ -934,16 +924,6 @@ normal_rtdel: rt->rt_flags &= ~RTF_UP; /* - * Remove any external references we may have. - * This might result in another rtentry being freed if - * we held its last reference. - */ - if (rt->rt_gwroute) { - RTFREE(rt->rt_gwroute); - rt->rt_gwroute = NULL; - } - - /* * give the protocol a chance to keep things in sync. */ if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest) @@ -994,7 +974,7 @@ deldone: rt->rt_fibnum = fibnum; /* * Add the gateway. Possibly re-malloc-ing the storage for it - * also add the rt_gwroute if possible. + * */ RT_LOCK(rt); if ((error = rt_setgate(rt, dst, gateway)) != 0) { @@ -1029,8 +1009,6 @@ deldone: /* do not permit exactly the same dst/mask/gw pair */ if (rn_mpath_capable(rnh) && rt_mpath_conflict(rnh, rt, netmask)) { - if (rt->rt_gwroute) - RTFREE(rt->rt_gwroute); if (rt->rt_ifa) { IFAFREE(rt->rt_ifa); } @@ -1048,8 +1026,6 @@ deldone: * then un-make it (this should be a function) */ if (rn == NULL) { - if (rt->rt_gwroute) - RTFREE(rt->rt_gwroute); if (rt->rt_ifa) IFAFREE(rt->rt_ifa); Free(rt_key(rt)); @@ -1101,48 +1077,10 @@ rt_setgate(struct rtentry *rt, struct so V_rt_tables[rt->rt_fibnum][dst->sa_family]; int dlen = SA_SIZE(dst), glen = SA_SIZE(gate); -again: RT_LOCK_ASSERT(rt); RADIX_NODE_HEAD_LOCK_ASSERT(rnh); /* - * Cloning loop avoidance in case of bad configuration. - */ - if (rt->rt_flags & RTF_GATEWAY) { - struct rtentry *gwrt; - - RT_UNLOCK(rt); /* XXX workaround LOR */ - gwrt = rtalloc1_fib(gate, 1, RTF_RNH_LOCKED, rt->rt_fibnum); - if (gwrt == rt) { - RT_REMREF(rt); - return (EADDRINUSE); /* failure */ - } - /* - * Try to reacquire the lock on rt, and if it fails, - * clean state and restart from scratch. - */ - if (!RT_TRYLOCK(rt)) { - RTFREE_LOCKED(gwrt); - RT_LOCK(rt); - goto again; - } - /* - * If there is already a gwroute, then drop it. If we - * are asked to replace route with itself, then do - * not leak its refcounter. - */ - if (rt->rt_gwroute != NULL) { - if (rt->rt_gwroute == gwrt) { - RT_REMREF(rt->rt_gwroute); - } else - RTFREE(rt->rt_gwroute); - } - - if ((rt->rt_gwroute = gwrt) != NULL) - RT_UNLOCK(rt->rt_gwroute); - } - - /* * Prepare to store the gateway in rt->rt_gateway. * Both dst and gateway are stored one after the other in the same * malloc'd chunk. If we have room, we can reuse the old buffer, @@ -1426,147 +1364,5 @@ rtinit(struct ifaddr *ifa, int cmd, int return (rtinit1(ifa, cmd, flags, fib)); } -/* - * rt_check() is invoked on each layer 2 output path, prior to - * encapsulating outbound packets. - * - * The function is mostly used to find a routing entry for the gateway, - * which in some protocol families could also point to the link-level - * address for the gateway itself (the side effect of revalidating the - * route to the destination is rather pointless at this stage, we did it - * already a moment before in the pr_output() routine to locate the ifp - * and gateway to use). - * - * When we remove the layer-3 to layer-2 mapping tables from the - * routing table, this function can be removed. - * - * === On input === - * *dst is the address of the NEXT HOP (which coincides with the - * final destination if directly reachable); - * *lrt0 points to the cached route to the final destination; - * *lrt is not meaningful; - * (*lrt0 has no ref held on it by us so REMREF is not needed. - * Refs only account for major structural references and not usages, - * which is actually a bit of a problem.) - * - * === Operation === - * If the route is marked down try to find a new route. If the route - * to the gateway is gone, try to setup a new route. Otherwise, - * if the route is marked for packets to be rejected, enforce that. - * Note that rtalloc returns an rtentry with an extra REF that we may - * need to lose. - * - * === On return === - * *dst is unchanged; - * *lrt0 points to the (possibly new) route to the final destination - * *lrt points to the route to the next hop [LOCKED] - * - * Their values are meaningful ONLY if no error is returned. - * - * To follow this you have to remember that: - * RT_REMREF reduces the reference count by 1 but doesn't check it for 0 (!) - * RTFREE_LOCKED includes an RT_REMREF (or an rtfree if refs == 1) - * and an RT_UNLOCK - * RTFREE does an RT_LOCK and an RTFREE_LOCKED - * The gwroute pointer counts as a reference on the rtentry to which it points. - * so when we add it we use the ref that rtalloc gives us and when we lose it - * we need to remove the reference. - * RT_TEMP_UNLOCK does an RT_ADDREF before freeing the lock, and - * RT_RELOCK locks it (it can't have gone away due to the ref) and - * drops the ref, possibly freeing it and zeroing the pointer if - * the ref goes to 0 (unlocking in the process). - */ -int -rt_check(struct rtentry **lrt, struct rtentry **lrt0, struct sockaddr *dst) -{ - struct rtentry *rt; - struct rtentry *rt0; - u_int fibnum; - - KASSERT(*lrt0 != NULL, ("rt_check")); - rt0 = *lrt0; - rt = NULL; - fibnum = rt0->rt_fibnum; - - /* NB: the locking here is tortuous... */ - RT_LOCK(rt0); -retry: - if (rt0 && (rt0->rt_flags & RTF_UP) == 0) { - /* Current rt0 is useless, try get a replacement. */ - RT_UNLOCK(rt0); - rt0 = NULL; - } - if (rt0 == NULL) { - rt0 = rtalloc1_fib(dst, 1, 0UL, fibnum); - if (rt0 == NULL) { - return (EHOSTUNREACH); - } - RT_REMREF(rt0); /* don't need the reference. */ - } - - if (rt0->rt_flags & RTF_GATEWAY) { - if ((rt = rt0->rt_gwroute) != NULL) { - RT_LOCK(rt); /* NB: gwroute */ - if ((rt->rt_flags & RTF_UP) == 0) { - /* gw route is dud. ignore/lose it */ - RTFREE_LOCKED(rt); /* unref (&unlock) gwroute */ - rt = rt0->rt_gwroute = NULL; - } - } - - if (rt == NULL) { /* NOT AN ELSE CLAUSE */ - RT_TEMP_UNLOCK(rt0); /* MUST return to undo this */ - rt = rtalloc1_fib(rt0->rt_gateway, 1, 0UL, fibnum); - if ((rt == rt0) || (rt == NULL)) { - /* the best we can do is not good enough */ - if (rt) { - RT_REMREF(rt); /* assumes ref > 0 */ - RT_UNLOCK(rt); - } - RTFREE(rt0); /* lock, unref, (unlock) */ - return (ENETUNREACH); - } - /* - * Relock it and lose the added reference. - * All sorts of things could have happenned while we - * had no lock on it, so check for them. - */ - RT_RELOCK(rt0); - if (rt0 == NULL || ((rt0->rt_flags & RTF_UP) == 0)) - /* Ru-roh.. what we had is no longer any good */ - goto retry; - /* - * While we were away, someone replaced the gateway. - * Since a reference count is involved we can't just - * overwrite it. - */ - if (rt0->rt_gwroute) { - if (rt0->rt_gwroute != rt) { - RTFREE_LOCKED(rt); - goto retry; - } - } else { - rt0->rt_gwroute = rt; - } - } - RT_LOCK_ASSERT(rt); - RT_UNLOCK(rt0); - } else { - /* think of rt as having the lock from now on.. */ - rt = rt0; - } - /* XXX why are we inspecting rmx_expire? */ - if ((rt->rt_flags & RTF_REJECT) && - (rt->rt_rmx.rmx_expire == 0 || - time_uptime < rt->rt_rmx.rmx_expire)) { - RT_UNLOCK(rt); - return (rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); - } - - *lrt = rt; - *lrt0 = rt0; - return (0); -} - /* This must be before ip6_init2(), which is now SI_ORDER_MIDDLE */ SYSINIT(route, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, 0); Modified: projects/arpv2_merge_1/sys/net/route.h ============================================================================== --- projects/arpv2_merge_1/sys/net/route.h Fri Dec 12 20:29:34 2008 (r185999) +++ projects/arpv2_merge_1/sys/net/route.h Fri Dec 12 21:45:10 2008 (r186000) @@ -140,7 +140,6 @@ struct rtentry { struct ifnet *rt_ifp; /* the answer: interface to use */ struct ifaddr *rt_ifa; /* the answer: interface address to use */ struct rt_metrics_lite rt_rmx; /* metrics used by rx'ing protocols */ - struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ u_int rt_fibnum; /* which FIB */ #ifdef _KERNEL /* XXX ugly, user apps use this definition but don't have a mtx def */ Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_ether.c Fri Dec 12 20:29:34 2008 (r185999) +++ projects/arpv2_merge_1/sys/netinet/if_ether.c Fri Dec 12 21:45:10 2008 (r186000) @@ -276,7 +276,9 @@ arpresolve(struct ifnet *ifp, struct rte * XXX if caller is required to hold lock, assert it */ retry: + IF_AFDATA_LOCK(ifp); la = lla_lookup(LLTABLE(ifp), flags, dst); + IF_AFDATA_UNLOCK(ifp); if (la == NULL) { if (flags & LLE_CREATE) log(LOG_DEBUG, From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 23:04:08 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77837106564A; Fri, 12 Dec 2008 23:04: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 501328FC12; Fri, 12 Dec 2008 23:04: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 mBCN481E010913; Fri, 12 Dec 2008 23:04:08 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBCN48W3010912; Fri, 12 Dec 2008 23:04:08 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812122304.mBCN48W3010912@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 23:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186003 - projects/cambria X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 23:04:08 -0000 Author: sam Date: Fri Dec 12 23:04:08 2008 New Revision: 186003 URL: http://svn.freebsd.org/changeset/base/186003 Log: create tree to bring in Gateworks Cambria board support Added: projects/cambria/ From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 23:06:49 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57EEC1065670; Fri, 12 Dec 2008 23:06:49 +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 305C78FC14; Fri, 12 Dec 2008 23:06:49 +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 mBCN6mZk010999; Fri, 12 Dec 2008 23:06:48 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBCN6mjL010998; Fri, 12 Dec 2008 23:06:48 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812122306.mBCN6mjL010998@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 23:06:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186004 - projects/cambria/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 23:06:49 -0000 Author: sam Date: Fri Dec 12 23:06:48 2008 New Revision: 186004 URL: http://svn.freebsd.org/changeset/base/186004 Log: branch from HEAD Added: projects/cambria/sys/ (props changed) - copied from r186003, head/sys/ From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 23:10:35 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80100106564A; Fri, 12 Dec 2008 23:10: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 584C18FC13; Fri, 12 Dec 2008 23:10: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 mBCNAZxO011106; Fri, 12 Dec 2008 23:10:35 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBCNAZ0Q011105; Fri, 12 Dec 2008 23:10:35 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812122310.mBCNAZ0Q011105@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 23:10:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186005 - projects/cambria/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 23:10:35 -0000 Author: sam Date: Fri Dec 12 23:10:34 2008 New Revision: 186005 URL: http://svn.freebsd.org/changeset/base/186005 Log: oops, ditch this Deleted: projects/cambria/sys/ From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 23:12:11 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D68DF1065673; Fri, 12 Dec 2008 23:12:11 +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 AF53E8FC19; Fri, 12 Dec 2008 23:12:11 +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 mBCNCB4x011189; Fri, 12 Dec 2008 23:12:11 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBCNCBBk011188; Fri, 12 Dec 2008 23:12:11 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812122312.mBCNCBBk011188@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 23:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186006 - projects/cambria/head X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 23:12:11 -0000 Author: sam Date: Fri Dec 12 23:12:11 2008 New Revision: 186006 URL: http://svn.freebsd.org/changeset/base/186006 Log: branch from HEAD Added: projects/cambria/head/ - copied from r186005, head/ From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 23:13:11 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BB52106568E; Fri, 12 Dec 2008 23:13:11 +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 E89A68FC17; Fri, 12 Dec 2008 23:13:10 +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 mBCNDAcG011243; Fri, 12 Dec 2008 23:13:10 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBCNDATX011242; Fri, 12 Dec 2008 23:13:10 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812122313.mBCNDATX011242@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 23:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186007 - projects/cambria X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 23:13:11 -0000 Author: sam Date: Fri Dec 12 23:13:10 2008 New Revision: 186007 URL: http://svn.freebsd.org/changeset/base/186007 Log: try again, delete the whole tree Deleted: projects/cambria/ From owner-svn-src-projects@FreeBSD.ORG Fri Dec 12 23:13:41 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D5AD106568A; Fri, 12 Dec 2008 23:13: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 EA4818FC19; Fri, 12 Dec 2008 23:13:40 +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 mBCNDe2C011293; Fri, 12 Dec 2008 23:13:40 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBCNDenx011292; Fri, 12 Dec 2008 23:13:40 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812122313.mBCNDenx011292@svn.freebsd.org> From: Sam Leffler Date: Fri, 12 Dec 2008 23:13:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186008 - projects/cambria X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 23:13:41 -0000 Author: sam Date: Fri Dec 12 23:13:40 2008 New Revision: 186008 URL: http://svn.freebsd.org/changeset/base/186008 Log: branch HEAD to integrate support for Gateworks Cambria boards Added: projects/cambria/ - copied from r186007, head/ From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 00:01:16 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF2A81065673; Sat, 13 Dec 2008 00:01:16 +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 AFE258FC16; Sat, 13 Dec 2008 00:01:16 +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 mBD01G7M012280; Sat, 13 Dec 2008 00:01:16 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD01GMO012279; Sat, 13 Dec 2008 00:01:16 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812130001.mBD01GMO012279@svn.freebsd.org> From: Kip Macy Date: Sat, 13 Dec 2008 00:01:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186010 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 00:01:16 -0000 Author: kmacy Date: Sat Dec 13 00:01:16 2008 New Revision: 186010 URL: http://svn.freebsd.org/changeset/base/186010 Log: return non-NULL (-1) if the entry to be deleted is found Modified: projects/arpv2_merge_1/sys/netinet/in.c Modified: projects/arpv2_merge_1/sys/netinet/in.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in.c Fri Dec 12 23:17:00 2008 (r186009) +++ projects/arpv2_merge_1/sys/netinet/in.c Sat Dec 13 00:01:16 2008 (r186010) @@ -1145,9 +1145,10 @@ in_lltable_lookup(struct lltable *llt, u #ifdef DIAGNOSTICS log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); #endif - lle = NULL; + lle = (void *)-1; + } - if (lle != NULL) { + if (lle != NULL && lle != (void *)-1) { if (flags & LLE_EXCLUSIVE) LLE_WLOCK(lle); else From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 01:21:38 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 090A4106564A; Sat, 13 Dec 2008 01:21:38 +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 E95B18FC08; Sat, 13 Dec 2008 01:21:37 +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 mBD1LbRf013856; Sat, 13 Dec 2008 01:21:37 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD1LbYx013846; Sat, 13 Dec 2008 01:21:37 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812130121.mBD1LbYx013846@svn.freebsd.org> From: Sam Leffler Date: Sat, 13 Dec 2008 01:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186011 - in projects/cambria/sys: arm/arm arm/conf arm/include arm/xscale/ixp425 conf contrib/dev/npe dev/usb X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 01:21:38 -0000 Author: sam Date: Sat Dec 13 01:21:37 2008 New Revision: 186011 URL: http://svn.freebsd.org/changeset/base/186011 Log: Merge WIP from p4: o recognize ixp435 cpu o change memory layout for for ixp4xx to not assume memory is aliases to 0x10000000 (Cambria/ixp435 memory starts at zero) o handle 64 irqs for ixp435 o dual EHCI USB 2.0 controller integral to ixp435 o overhaul NPE code for ixp435 and better MAC+MII naming o updated NPE firmware (including NPE-A image for ixp435/ixp465) o Gateworks Cambria board support: - IDE compact flash - MCU - front panel LED on i2c bus - Octal LED latch Sanity-tested with NFS-root on Avila and Cambria boards. Requires pending boot2 mods for CF-boot on Cambria. Added: projects/cambria/sys/arm/xscale/ixp425/cambria_fled.c (contents, props changed) projects/cambria/sys/arm/xscale/ixp425/cambria_led.c (contents, props changed) projects/cambria/sys/arm/xscale/ixp425/ixp435_ehci.c (contents, props changed) projects/cambria/sys/arm/xscale/ixp425/std.ixp435 projects/cambria/sys/dev/usb/ehci_ddb.c (contents, props changed) Modified: projects/cambria/sys/arm/arm/cpufunc.c projects/cambria/sys/arm/arm/identcpu.c projects/cambria/sys/arm/conf/AVILA projects/cambria/sys/arm/conf/AVILA.hints projects/cambria/sys/arm/include/armreg.h projects/cambria/sys/arm/include/intr.h projects/cambria/sys/arm/xscale/ixp425/avila_ata.c projects/cambria/sys/arm/xscale/ixp425/avila_led.c projects/cambria/sys/arm/xscale/ixp425/avila_machdep.c projects/cambria/sys/arm/xscale/ixp425/files.avila projects/cambria/sys/arm/xscale/ixp425/files.ixp425 projects/cambria/sys/arm/xscale/ixp425/if_npe.c projects/cambria/sys/arm/xscale/ixp425/if_npereg.h projects/cambria/sys/arm/xscale/ixp425/ixp425.c projects/cambria/sys/arm/xscale/ixp425/ixp425_iic.c projects/cambria/sys/arm/xscale/ixp425/ixp425_intr.h projects/cambria/sys/arm/xscale/ixp425/ixp425_mem.c projects/cambria/sys/arm/xscale/ixp425/ixp425_npe.c projects/cambria/sys/arm/xscale/ixp425/ixp425_npevar.h projects/cambria/sys/arm/xscale/ixp425/ixp425_pci.c projects/cambria/sys/arm/xscale/ixp425/ixp425_qmgr.c projects/cambria/sys/arm/xscale/ixp425/ixp425_timer.c projects/cambria/sys/arm/xscale/ixp425/ixp425_wdog.c projects/cambria/sys/arm/xscale/ixp425/ixp425reg.h projects/cambria/sys/arm/xscale/ixp425/ixp425var.h projects/cambria/sys/arm/xscale/ixp425/std.avila projects/cambria/sys/conf/files projects/cambria/sys/conf/options.arm projects/cambria/sys/contrib/dev/npe/IxNpeMicrocode.dat.uu projects/cambria/sys/dev/usb/ehci.c projects/cambria/sys/dev/usb/ehci_pci.c projects/cambria/sys/dev/usb/ehcireg.h projects/cambria/sys/dev/usb/ehcivar.h projects/cambria/sys/dev/usb/usbdi.h Modified: projects/cambria/sys/arm/arm/cpufunc.c ============================================================================== --- projects/cambria/sys/arm/arm/cpufunc.c Sat Dec 13 00:01:16 2008 (r186010) +++ projects/cambria/sys/arm/arm/cpufunc.c Sat Dec 13 01:21:37 2008 (r186011) @@ -1211,7 +1211,7 @@ set_cpufuncs() #endif /* CPU_XSCALE_PXA2X0 */ #ifdef CPU_XSCALE_IXP425 if (cputype == CPU_ID_IXP425_533 || cputype == CPU_ID_IXP425_400 || - cputype == CPU_ID_IXP425_266) { + cputype == CPU_ID_IXP425_266 || cputype == CPU_ID_IXP435) { cpufuncs = xscale_cpufuncs; #if defined(PERFCTRS) Modified: projects/cambria/sys/arm/arm/identcpu.c ============================================================================== --- projects/cambria/sys/arm/arm/identcpu.c Sat Dec 13 00:01:16 2008 (r186010) +++ projects/cambria/sys/arm/arm/identcpu.c Sat Dec 13 01:21:37 2008 (r186011) @@ -300,6 +300,10 @@ const struct cpuidtab cpuids[] = { { CPU_ID_IXP425_266, CPU_CLASS_XSCALE, "IXP425 266MHz", ixp425_steppings }, + /* XXX ixp435 steppings? */ + { CPU_ID_IXP435, CPU_CLASS_XSCALE, "IXP435", + ixp425_steppings }, + { CPU_ID_ARM1136JS, CPU_CLASS_ARM11J, "ARM1136J-S", generic_steppings }, { CPU_ID_ARM1136JSR1, CPU_CLASS_ARM11J, "ARM1136J-S R1", Modified: projects/cambria/sys/arm/conf/AVILA ============================================================================== --- projects/cambria/sys/arm/conf/AVILA Sat Dec 13 00:01:16 2008 (r186010) +++ projects/cambria/sys/arm/conf/AVILA Sat Dec 13 01:21:37 2008 (r186011) @@ -20,20 +20,18 @@ ident AVILA -options PHYSADDR=0x10000000 -options KERNPHYSADDR=0x10200000 -options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm -options FLASHADDR=0x50000000 -options LOADERRAMADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x10000000 - +include "../xscale/ixp425/std.ixp425" +# NB: memory mapping is defined in std.avila include "../xscale/ixp425/std.avila" +options XSCALE_CACHE_READ_WRITE_ALLOCATE +#options ARM_USE_SMALL_ALLOC #To statically compile in device wiring instead of /boot/device.hints hints "AVILA.hints" #Default places to look for devices. makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale +makeoptions MODULES_OVERRIDE="" #options HZ=1000 options HZ=100 options DEVICE_POLLING @@ -42,34 +40,18 @@ options DEVICE_POLLING options KDB #options GDB options DDB #Enable the kernel debugger -#options INVARIANTS #Enable calls of extra sanity checking -#options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS +options INVARIANTS #Enable calls of extra sanity checking +options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC options SCHED_4BSD #4BSD scheduler options INET #InterNETworking -options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support -options UFS_ACL #Support for access control lists -options UFS_DIRHASH #Improve performance on big directories options NFSCLIENT #Network Filesystem Client -options NFSSERVER #Network Filesystem Server -options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCLIENT -#options MSDOSFS #MSDOS Filesystem -options CD9660 #ISO 9660 Filesystem -#options PROCFS #Process filesystem (requires PSEUDOFS) -options PSEUDOFS #Pseudo-filesystem framework -options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI -options KTRACE #ktrace(1) support -options SYSVSHM #SYSV-style shared memory -options SYSVMSG #SYSV-style message queues -options SYSVSEM #SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions -options KBD_INSTALL_CDEV # install a CDEV entry in /dev options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 @@ -106,7 +88,6 @@ device npe_fw device firmware device qmgr # Q Manager (required by npe) device miibus # NB: required by npe -device rl # RealTek 8129/8139 device ether device bpf @@ -114,37 +95,48 @@ device pty device loop device if_bridge -options XSCALE_CACHE_READ_WRITE_ALLOCATE device md device random # Entropy device -#options ARM_USE_SMALL_ALLOC - # Wireless NIC cards device wlan # 802.11 support +options IEEE80211_DEBUG device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_xauth + device ath # Atheros pci/cardbus NIC's -device ath_hal # Atheros HAL (Hardware Access Layer) -options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors -device ath_rate_sample # SampleRate tx rate control for ath options ATH_DEBUG +options ATH_DIAGAPI +#options ATH_TX99_DIAG +device ath_rate_sample # SampleRate tx rate control for ath -#device crypto -#device cryptodev -#device hifn # NB: Soekris minipci card known to work +#options AH_DEBUG +#options AH_ASSERT +#device ath_ar5210 +#device ath_ar5211 +device ath_ar5212 +device ath_rf2413 +device ath_rf2417 +device ath_rf2425 +device ath_rf5111 +device ath_rf5112 +device ath_rf5413 +# +device ath_ar5416 +options AH_SUPPORT_AR5416 +device ath_ar9160 device usb -options USB_DEBUG +#options USB_DEBUG device ohci device ehci device ugen -device umass -device scbus # SCSI bus (required for SCSI) -device da # Direct Access (disks) - -device ural -device zyd -device wlan_amrr +#device umass +#device scbus # SCSI bus (required for SCSI) +#device da # Direct Access (disks) + +#device ural +#device zyd +#device wlan_amrr Modified: projects/cambria/sys/arm/conf/AVILA.hints ============================================================================== --- projects/cambria/sys/arm/conf/AVILA.hints Sat Dec 13 00:01:16 2008 (r186010) +++ projects/cambria/sys/arm/conf/AVILA.hints Sat Dec 13 01:21:37 2008 (r186011) @@ -17,21 +17,22 @@ hint.uart.1.irq=13 # NPE Hardware Queue Manager hint.ixpqmgr.0.at="ixp0" -# NPE wireless NIC's, requires ixpqmgr +# NPE wired NIC's, requires ixpqmgr hint.npe.0.at="ixp0" -hint.npe.0.mac="A" -hint.npe.0.mii="A" +hint.npe.0.npeid="B" +hint.npe.0.mac="B" +hint.npe.0.mii="B" hint.npe.0.phy=0 hint.npe.1.at="ixp0" -hint.npe.1.mac="B" -# NB: on 2348 boards all PHY's are addressed through MAC A -hint.npe.1.mii="A" +hint.npe.1.npeid="C" +hint.npe.1.mac="C" +hint.npe.1.mii="B" hint.npe.1.phy=1 # CF IDE controller hint.ata_avila.0.at="ixp0" -# LED connected to gpio +# Front Panel LED hint.led_avila.0.at="ixp0" # Analog Devices AD7418 temperature sensor Modified: projects/cambria/sys/arm/include/armreg.h ============================================================================== --- projects/cambria/sys/arm/include/armreg.h Sat Dec 13 00:01:16 2008 (r186010) +++ projects/cambria/sys/arm/include/armreg.h Sat Dec 13 01:21:37 2008 (r186011) @@ -174,6 +174,7 @@ #define CPU_ID_IXP425_533 0x690541c0 #define CPU_ID_IXP425_400 0x690541d0 #define CPU_ID_IXP425_266 0x690541f0 +#define CPU_ID_IXP435 0x69054040 /* ARM3-specific coprocessor 15 registers */ #define ARM3_CP15_FLUSH 1 Modified: projects/cambria/sys/arm/include/intr.h ============================================================================== --- projects/cambria/sys/arm/include/intr.h Sat Dec 13 00:01:16 2008 (r186010) +++ projects/cambria/sys/arm/include/intr.h Sat Dec 13 01:21:37 2008 (r186011) @@ -39,6 +39,7 @@ #ifndef _MACHINE_INTR_H_ #define _MACHINE_INTR_H_ +/* XXX move to std.* files? */ #ifdef CPU_XSCALE_81342 #define NIRQ 128 #elif defined(CPU_XSCALE_PXA2X0) @@ -46,7 +47,8 @@ #define NIRQ IRQ_GPIO_MAX #elif defined(SOC_MV_DISCOVERY) #define NIRQ 96 -#elif defined(CPU_ARM9) || defined(SOC_MV_KIRKWOOD) +#elif defined(CPU_ARM9) || defined(SOC_MV_KIRKWOOD) || \ + defined(CPU_XSCALE_IXP435) #define NIRQ 64 #else #define NIRQ 32 Modified: projects/cambria/sys/arm/xscale/ixp425/avila_ata.c ============================================================================== --- projects/cambria/sys/arm/xscale/ixp425/avila_ata.c Sat Dec 13 00:01:16 2008 (r186010) +++ projects/cambria/sys/arm/xscale/ixp425/avila_ata.c Sat Dec 13 01:21:37 2008 (r186011) @@ -67,13 +67,64 @@ __FBSDID("$FreeBSD$"); #include #include -#define AVILA_IDE_GPIN 12 /* GPIO pin # */ -#define AVILA_IDE_IRQ IXP425_INT_GPIO_12 -#define AVILA_IDE_CTRL 0x06 /* control register */ - -#define PRONGHORN_IDE_GPIN 0 /* GPIO pin # */ -#define PRONGHORN_IDE_IRQ IXP425_INT_GPIO_0 -#define PRONGHORN_IDE_CNTRL 0x06 /* control register */ +#define AVILA_IDE_CTRL 0x06 + +struct ata_config { + const char *desc; /* description for probe */ + uint8_t gpin; /* GPIO pin */ + uint8_t irq; /* IRQ */ + uint32_t base16; /* CS base addr for 16-bit */ + uint32_t size16; /* CS size for 16-bit */ + uint32_t off16; /* CS offset for 16-bit */ + uint32_t basealt; /* CS base addr for alt */ + uint32_t sizealt; /* CS size for alt */ + uint32_t offalt; /* CS offset for alt */ +}; + +static const struct ata_config * +ata_getconfig(struct ixp425_softc *sa) +{ + static const struct ata_config configs[] = { + { .desc = "Gateworks Avila IDE/CF Controller", + .gpin = 12, + .irq = IXP425_INT_GPIO_12, + .base16 = IXP425_EXP_BUS_CS1_HWBASE, + .size16 = IXP425_EXP_BUS_CS1_SIZE, + .off16 = EXP_TIMING_CS1_OFFSET, + .basealt = IXP425_EXP_BUS_CS2_HWBASE, + .sizealt = IXP425_EXP_BUS_CS2_SIZE, + .offalt = EXP_TIMING_CS2_OFFSET, + }, + { .desc = "Gateworks Cambria IDE/CF Controller", + .gpin = 12, + .irq = IXP425_INT_GPIO_12, + .base16 = CAMBRIA_CFSEL0_HWBASE, + .size16 = CAMBRIA_CFSEL0_SIZE, + .off16 = EXP_TIMING_CS3_OFFSET, + .basealt = CAMBRIA_CFSEL1_HWBASE, + .sizealt = CAMBRIA_CFSEL1_SIZE, + .offalt = EXP_TIMING_CS4_OFFSET, + }, + { .desc = "ADI Pronghorn Metro IDE/CF Controller", + .gpin = 0, + .irq = IXP425_INT_GPIO_0, + .base16 = IXP425_EXP_BUS_CS3_HWBASE, + .size16 = IXP425_EXP_BUS_CS3_SIZE, + .off16 = EXP_TIMING_CS3_OFFSET, + .basealt = IXP425_EXP_BUS_CS4_HWBASE, + .sizealt = IXP425_EXP_BUS_CS4_SIZE, + .offalt = EXP_TIMING_CS4_OFFSET, + }, + }; + + /* XXX honor hint? (but then no multi-board support) */ + /* XXX total hack */ + if ((cpu_id() & CPU_ID_CPU_MASK) == CPU_ID_IXP435) + return &configs[1]; /* Cambria */ + if (EXP_BUS_READ_4(sa, EXP_TIMING_CS2_OFFSET) != 0) + return &configs[0]; /* Avila */ + return &configs[2]; /* Pronghorn */ +} struct ata_avila_softc { device_t sc_dev; @@ -105,14 +156,14 @@ static int ata_avila_probe(device_t dev) { struct ixp425_softc *sa = device_get_softc(device_get_parent(dev)); + const struct ata_config *config; - /* XXX any way to check? */ - if (EXP_BUS_READ_4(sa, EXP_TIMING_CS2_OFFSET) != 0) - device_set_desc_copy(dev, "Gateworks Avila IDE/CF Controller"); - else - device_set_desc_copy(dev, - "ADI Pronghorn Metro IDE/CF Controller"); - return 0; + config = ata_getconfig(sa); + if (config != NULL) { + device_set_desc_copy(dev, config->desc); + return 0; + } + return ENXIO; } static int @@ -120,41 +171,25 @@ ata_avila_attach(device_t dev) { struct ata_avila_softc *sc = device_get_softc(dev); struct ixp425_softc *sa = device_get_softc(device_get_parent(dev)); - u_int32_t alt_t_off, ide_gpin, ide_irq; + const struct ata_config *config; + + config = ata_getconfig(sa); + KASSERT(config != NULL, ("no board config")); sc->sc_dev = dev; /* NB: borrow from parent */ sc->sc_iot = sa->sc_iot; sc->sc_exp_ioh = sa->sc_exp_ioh; - if (EXP_BUS_READ_4(sc, EXP_TIMING_CS2_OFFSET) != 0) { - /* Avila board */ - if (bus_space_map(sc->sc_iot, IXP425_EXP_BUS_CS1_HWBASE, - IXP425_EXP_BUS_CS1_SIZE, 0, &sc->sc_ioh)) - panic("%s: unable to map Expansion Bus CS1 window", - __func__); - if (bus_space_map(sc->sc_iot, IXP425_EXP_BUS_CS2_HWBASE, - IXP425_EXP_BUS_CS2_SIZE, 0, &sc->sc_alt_ioh)) - panic("%s: unable to map Expansion Bus CS2 window", - __func__); - ide_gpin = AVILA_IDE_GPIN; - ide_irq = AVILA_IDE_IRQ; - sc->sc_16bit_off = EXP_TIMING_CS1_OFFSET; - alt_t_off = EXP_TIMING_CS2_OFFSET; - } else { - /* Pronghorn */ - if (bus_space_map(sc->sc_iot, IXP425_EXP_BUS_CS3_HWBASE, - IXP425_EXP_BUS_CS3_SIZE, 0, &sc->sc_ioh)) - panic("%s: unable to map Expansion Bus CS3 window", - __func__); - if (bus_space_map(sc->sc_iot, IXP425_EXP_BUS_CS4_HWBASE, - IXP425_EXP_BUS_CS4_SIZE, 0, &sc->sc_alt_ioh)) - panic("%s: unable to map Expansion Bus CS4 window", - __func__); - ide_gpin = PRONGHORN_IDE_GPIN; - ide_irq = PRONGHORN_IDE_IRQ; - sc->sc_16bit_off = EXP_TIMING_CS3_OFFSET; - alt_t_off = EXP_TIMING_CS4_OFFSET; - } + + if (bus_space_map(sc->sc_iot, config->base16, config->size16, + 0, &sc->sc_ioh)) + panic("%s: cannot map 16-bit window (0x%x/0x%x)", + __func__, config->base16, config->size16); + if (bus_space_map(sc->sc_iot, config->basealt, config->sizealt, + 0, &sc->sc_alt_ioh)) + panic("%s: cannot map alt window (0x%x/0x%x)", + __func__, config->basealt, config->sizealt); + sc->sc_16bit_off = config->off16; /* * Craft special resource for ATA bus space ops @@ -184,30 +219,30 @@ ata_avila_attach(device_t dev) rman_set_bushandle(&sc->sc_alt_ata, sc->sc_alt_ioh); GPIO_CONF_WRITE_4(sa, IXP425_GPIO_GPOER, - GPIO_CONF_READ_4(sa, IXP425_GPIO_GPOER) | (1<gpin)); /* set interrupt type */ - GPIO_CONF_WRITE_4(sa, GPIO_TYPE_REG(ide_gpin), - (GPIO_CONF_READ_4(sa, GPIO_TYPE_REG(ide_gpin)) &~ - GPIO_TYPE(ide_gpin, GPIO_TYPE_MASK)) | - GPIO_TYPE(ide_gpin, GPIO_TYPE_EDG_RISING)); + GPIO_CONF_WRITE_4(sa, GPIO_TYPE_REG(config->gpin), + (GPIO_CONF_READ_4(sa, GPIO_TYPE_REG(config->gpin)) &~ + GPIO_TYPE(config->gpin, GPIO_TYPE_MASK)) | + GPIO_TYPE(config->gpin, GPIO_TYPE_EDG_RISING)); /* clear ISR */ - GPIO_CONF_WRITE_4(sa, IXP425_GPIO_GPISR, (1<gpin)); /* configure CS1/3 window, leaving timing unchanged */ EXP_BUS_WRITE_4(sc, sc->sc_16bit_off, EXP_BUS_READ_4(sc, sc->sc_16bit_off) | EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); /* configure CS2/4 window, leaving timing unchanged */ - EXP_BUS_WRITE_4(sc, alt_t_off, - EXP_BUS_READ_4(sc, alt_t_off) | + EXP_BUS_WRITE_4(sc, config->offalt, + EXP_BUS_READ_4(sc, config->offalt) | EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); /* setup interrupt */ sc->sc_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->sc_rid, - ide_irq, ide_irq, 1, RF_ACTIVE); + config->irq, config->irq, 1, RF_ACTIVE); if (!sc->sc_irq) - panic("Unable to allocate irq %u.\n", ide_irq); + panic("Unable to allocate irq %u.\n", config->irq); bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_BIO | INTR_MPSAFE | INTR_ENTROPY, NULL, ata_avila_intr, sc, &sc->sc_ih); @@ -230,9 +265,9 @@ ata_avila_detach(device_t dev) /* detach & delete all children */ if (device_get_children(dev, &children, &nc) == 0) { - if (nc > 0) - device_delete_child(dev, children[0]); - free(children, M_TEMP); + if (nc > 0) + device_delete_child(dev, children[0]); + free(children, M_TEMP); } bus_teardown_intr(dev, sc->sc_irq, sc->sc_ih); @@ -308,7 +343,7 @@ ata_avila_teardown_intr(device_t dev, de /* * Enable/disable 16-bit ops on the expansion bus. */ -static void __inline +static __inline void enable_16(struct ata_avila_softc *sc) { EXP_BUS_WRITE_4(sc, sc->sc_16bit_off, @@ -316,7 +351,7 @@ enable_16(struct ata_avila_softc *sc) DELAY(100); /* XXX? */ } -static void __inline +static __inline void disable_16(struct ata_avila_softc *sc) { DELAY(100); /* XXX? */ Modified: projects/cambria/sys/arm/xscale/ixp425/avila_led.c ============================================================================== --- projects/cambria/sys/arm/xscale/ixp425/avila_led.c Sat Dec 13 00:01:16 2008 (r186010) +++ projects/cambria/sys/arm/xscale/ixp425/avila_led.c Sat Dec 13 01:21:37 2008 (r186011) @@ -37,22 +37,19 @@ __FBSDID("$FreeBSD$"); #include #define GPIO_LED_STATUS 3 -#define GPIO_LED_STATUS_BIT (1U << GPIO_LED_STATUS) - -static struct cdev *gpioled; +#define GPIO_LED_STATUS_BIT (1U << GPIO_LED_STATUS) struct led_avila_softc { device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_gpio_ioh; + struct cdev *sc_led; }; -static struct led_avila_softc *led_avila_sc = NULL; - static void -led_func(void *unused, int onoff) +led_func(void *arg, int onoff) { - struct led_avila_softc *sc = led_avila_sc; + struct led_avila_softc *sc = arg; uint32_t reg; reg = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPOUTR); @@ -66,7 +63,7 @@ led_func(void *unused, int onoff) static int led_avila_probe(device_t dev) { - device_set_desc(dev, "Gateworks Avila GPIO connected LED"); + device_set_desc(dev, "Gateworks Avila Front Panel LED"); return (0); } @@ -75,31 +72,35 @@ led_avila_attach(device_t dev) { struct led_avila_softc *sc = device_get_softc(dev); struct ixp425_softc *sa = device_get_softc(device_get_parent(dev)); - void *led = NULL; - uint32_t reg; - - led_avila_sc = sc; sc->sc_dev = dev; sc->sc_iot = sa->sc_iot; sc->sc_gpio_ioh = sa->sc_gpio_ioh; /* Configure LED GPIO pin as output */ - reg = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPOER); - reg &= ~GPIO_LED_STATUS_BIT; - GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPOER, reg); + GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPOER, + GPIO_CONF_READ_4(sc, IXP425_GPIO_GPOER) &~ GPIO_LED_STATUS_BIT); - gpioled = led_create(led_func, led, "gpioled"); + sc->sc_led = led_create(led_func, sc, "gpioled"); - /* Turn on LED */ - led_func(led, 1); + led_func(sc, 1); /* Turn on LED */ return (0); } +static void +led_avila_detach(device_t dev) +{ + struct led_avila_softc *sc = device_get_softc(dev); + + if (sc->sc_led != NULL) + led_destroy(sc->sc_led); +} + static device_method_t led_avila_methods[] = { DEVMETHOD(device_probe, led_avila_probe), DEVMETHOD(device_attach, led_avila_attach), + DEVMETHOD(device_detach, led_avila_detach), {0, 0}, }; Modified: projects/cambria/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- projects/cambria/sys/arm/xscale/ixp425/avila_machdep.c Sat Dec 13 00:01:16 2008 (r186010) +++ projects/cambria/sys/arm/xscale/ixp425/avila_machdep.c Sat Dec 13 01:21:37 2008 (r186011) @@ -95,6 +95,11 @@ __FBSDID("$FreeBSD$"); #include #include +/* kernel text starts where we were loaded at boot */ +#define KERNEL_TEXT_OFF (KERNPHYSADDR - PHYSADDR) +#define KERNEL_TEXT_BASE (KERNBASE + KERNEL_TEXT_OFF) +#define KERNEL_TEXT_PHYS (PHYSADDR + KERNEL_TEXT_OFF) + #define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */ #define KERNEL_PT_IO 1 #define KERNEL_PT_IO_NUM 3 @@ -142,114 +147,109 @@ static struct trapframe proc0_tf; /* Static device mappings. */ static const struct pmap_devmap ixp425_devmap[] = { /* Physical/Virtual address for I/O space */ - { - IXP425_IO_VBASE, - IXP425_IO_HWBASE, - IXP425_IO_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, + { IXP425_IO_VBASE, IXP425_IO_HWBASE, IXP425_IO_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, /* Expansion Bus */ - { - IXP425_EXP_VBASE, - IXP425_EXP_HWBASE, - IXP425_EXP_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, + { IXP425_EXP_VBASE, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, /* IXP425 PCI Configuration */ - { - IXP425_PCI_VBASE, - IXP425_PCI_HWBASE, - IXP425_PCI_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, + { IXP425_PCI_VBASE, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, /* SDRAM Controller */ - { - IXP425_MCU_VBASE, - IXP425_MCU_HWBASE, - IXP425_MCU_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, + { IXP425_MCU_VBASE, IXP425_MCU_HWBASE, IXP425_MCU_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, /* PCI Memory Space */ - { - IXP425_PCI_MEM_VBASE, - IXP425_PCI_MEM_HWBASE, - IXP425_PCI_MEM_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, + { IXP425_PCI_MEM_VBASE, IXP425_PCI_MEM_HWBASE, IXP425_PCI_MEM_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* Q-Mgr Memory Space */ + { IXP425_QMGR_VBASE, IXP425_QMGR_HWBASE, IXP425_QMGR_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* NPE-A Memory Space */ - { - IXP425_NPE_A_VBASE, - IXP425_NPE_A_HWBASE, - IXP425_NPE_A_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, + { IXP425_NPE_A_VBASE, IXP425_NPE_A_HWBASE, IXP425_NPE_A_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, /* NPE-B Memory Space */ - { - IXP425_NPE_B_VBASE, - IXP425_NPE_B_HWBASE, - IXP425_NPE_B_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, + { IXP425_NPE_B_VBASE, IXP425_NPE_B_HWBASE, IXP425_NPE_B_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, /* NPE-C Memory Space */ - { - IXP425_NPE_C_VBASE, - IXP425_NPE_C_HWBASE, - IXP425_NPE_C_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, - /* MAC-A Memory Space */ - { - IXP425_MAC_A_VBASE, - IXP425_MAC_A_HWBASE, - IXP425_MAC_A_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, + { IXP425_NPE_C_VBASE, IXP425_NPE_C_HWBASE, IXP425_NPE_C_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* MAC-B Memory Space */ - { - IXP425_MAC_B_VBASE, - IXP425_MAC_B_HWBASE, - IXP425_MAC_B_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, - /* Q-Mgr Memory Space */ - { - IXP425_QMGR_VBASE, - IXP425_QMGR_HWBASE, - IXP425_QMGR_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, - - { - 0, - 0, - 0, - 0, - 0, - } + { IXP425_MAC_B_VBASE, IXP425_MAC_B_HWBASE, IXP425_MAC_B_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* MAC-C Memory Space */ + { IXP425_MAC_C_VBASE, IXP425_MAC_C_HWBASE, IXP425_MAC_C_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + { 0 }, }; -#define SDRAM_START 0x10000000 +/* Static device mappings. */ +static const struct pmap_devmap ixp435_devmap[] = { + /* Physical/Virtual address for I/O space */ + { IXP425_IO_VBASE, IXP425_IO_HWBASE, IXP425_IO_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* Expansion Bus */ + { IXP425_EXP_VBASE, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* IXP425 PCI Configuration */ + { IXP425_PCI_VBASE, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* DDRII Controller NB: mapped same place as IXP425 */ + { IXP425_MCU_VBASE, IXP435_MCU_HWBASE, IXP425_MCU_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* PCI Memory Space */ + { IXP425_PCI_MEM_VBASE, IXP425_PCI_MEM_HWBASE, IXP425_PCI_MEM_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* Q-Mgr Memory Space */ + { IXP425_QMGR_VBASE, IXP425_QMGR_HWBASE, IXP425_QMGR_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* NPE-A Memory Space */ + { IXP425_NPE_A_VBASE, IXP425_NPE_A_HWBASE, IXP425_NPE_A_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* NPE-C Memory Space */ + { IXP425_NPE_C_VBASE, IXP425_NPE_C_HWBASE, IXP425_NPE_C_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* MAC-C Memory Space */ + { IXP425_MAC_C_VBASE, IXP425_MAC_C_HWBASE, IXP425_MAC_C_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* MAC-B Memory Space */ + { IXP425_MAC_B_VBASE, IXP425_MAC_B_HWBASE, IXP425_MAC_B_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* MAC-A Memory Space */ + { IXP435_MAC_A_VBASE, IXP435_MAC_A_HWBASE, IXP435_MAC_A_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* USB1 Memory Space */ + { IXP435_USB1_VBASE, IXP435_USB1_HWBASE, IXP435_USB1_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* USB2 Memory Space */ + { IXP435_USB2_VBASE, IXP435_USB2_HWBASE, IXP435_USB2_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + { 0 } +}; extern vm_offset_t xscale_cache_clean_addr; void * initarm(void *arg, void *arg2) { +#define next_chunk2(a,b) (((a) + (b)) &~ ((b)-1)) +#define next_page(a) next_chunk2(a,PAGE_SIZE) struct pv_addr kernel_l1pt; int loop, i; u_int l1pagetable; @@ -260,25 +260,40 @@ initarm(void *arg, void *arg2) vm_offset_t lastaddr; uint32_t memsize; - set_cpufuncs(); + set_cpufuncs(); /* NB: sets cputype */ lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); - freemempos = 0x10200000; - /* Define a macro to simplify memory allocation */ -#define valloc_pages(var, np) \ - alloc_pages((var).pv_pa, (np)); \ - (var).pv_va = (var).pv_pa + 0xb0000000; - -#define alloc_pages(var, np) \ - freemempos -= (np * PAGE_SIZE); \ - (var) = freemempos; \ - memset((char *)(var), 0, ((np) * PAGE_SIZE)); + /* + * We allocate memory downwards from where we were loaded + * by RedBoot; first the L1 page table, then NUM_KERNEL_PTS + * entries in the L2 page table. Past that we re-align the + * allocation boundary so later data structures (stacks, etc) + * can be mapped with different attributes (write-back vs + * write-through). Note this leaves a gap for expansion + * (or might be repurposed). + */ + freemempos = KERNPHYSADDR; + + /* macros to simplify initial memory allocation */ +#define alloc_pages(var, np) do { \ + freemempos -= (np * PAGE_SIZE); \ + (var) = freemempos; \ + /* NB: this works because locore maps PA=VA */ \ + memset((char *)(var), 0, ((np) * PAGE_SIZE)); \ +} while (0) +#define valloc_pages(var, np) do { \ + alloc_pages((var).pv_pa, (np)); \ + (var).pv_va = (var).pv_pa + (KERNVIRTADDR - KERNPHYSADDR); \ +} while (0) + /* force L1 page table alignment */ while (((freemempos - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) != 0) freemempos -= PAGE_SIZE; + /* allocate contiguous L1 page table */ valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE); + /* now allocate L2 page tables; they are linked to L1 below */ for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) { if (!(loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL))) { valloc_pages(kernel_pt_table[loop], @@ -288,11 +303,18 @@ initarm(void *arg, void *arg2) (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * L2_TABLE_SIZE_REAL; kernel_pt_table[loop].pv_va = - kernel_pt_table[loop].pv_pa + 0xb0000000; + kernel_pt_table[loop].pv_pa + + (KERNVIRTADDR - KERNPHYSADDR); } } - freemem_pt = freemempos; - freemempos = 0x10100000; + freemem_pt = freemempos; /* base of allocated pt's */ + + /* + * Re-align allocation boundary so we can map the area + * write-back instead of write-through for the stacks and + * related structures allocated below. + */ + freemempos = PHYSADDR + 0x100000; /* * Allocate a page for the system page mapped to V0x00000000 * This page will just contain the system vectors and can be @@ -308,30 +330,25 @@ initarm(void *arg, void *arg2) alloc_pages(minidataclean.pv_pa, 1); valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); #ifdef ARM_USE_SMALL_ALLOC +#error "I am broken" /* XXX save people grief */ freemempos -= PAGE_SIZE; freemem_pt = trunc_page(freemem_pt); freemem_after = freemempos - ((freemem_pt - 0x10100000) / PAGE_SIZE) * sizeof(struct arm_small_page); - arm_add_smallalloc_pages((void *)(freemem_after + 0xb0000000) + arm_add_smallalloc_pages((void *)(freemem_after + (KERNVIRTADDR - KERNPHYSADDR) , (void *)0xc0100000, freemem_pt - 0x10100000, 1); freemem_after -= ((freemem_after - 0x10001000) / PAGE_SIZE) * sizeof(struct arm_small_page); - arm_add_smallalloc_pages((void *)(freemem_after + 0xb0000000) + arm_add_smallalloc_pages((void *)(freemem_after + (KEYVIRTADDR - KERNPHYSADDR)) , (void *)0xc0001000, trunc_page(freemem_after) - 0x10001000, 0); freemempos = trunc_page(freemem_after); freemempos -= PAGE_SIZE; #endif - /* - * Allocate memory for the l1 and l2 page tables. The scheme to avoid - * wasting memory by allocating the l1pt on the first 16k memory was - * taken from NetBSD rpc_machdep.c. NKPT should be greater than 12 for - * this to work (which is supposed to be the case). - */ /* - * Now we start construction of the L1 page table - * We start by mapping the L2 page tables into the L1. - * This means that we can replace L1 mappings later on if necessary + * Now construct the L1 page table. First map the L2 + * page tables into the L1 so we can replace L1 mappings + * later on if necessary */ l1pagetable = kernel_l1pt.pv_va; @@ -339,30 +356,28 @@ initarm(void *arg, void *arg2) pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH & ~(0x00100000 - 1), &kernel_pt_table[KERNEL_PT_SYS]); pmap_link_l2pt(l1pagetable, IXP425_IO_VBASE, - &kernel_pt_table[KERNEL_PT_IO]); + &kernel_pt_table[KERNEL_PT_IO]); pmap_link_l2pt(l1pagetable, IXP425_MCU_VBASE, - &kernel_pt_table[KERNEL_PT_IO + 1]); + &kernel_pt_table[KERNEL_PT_IO + 1]); pmap_link_l2pt(l1pagetable, IXP425_PCI_MEM_VBASE, - &kernel_pt_table[KERNEL_PT_IO + 2]); + &kernel_pt_table[KERNEL_PT_IO + 2]); pmap_link_l2pt(l1pagetable, KERNBASE, &kernel_pt_table[KERNEL_PT_BEFOREKERN]); - pmap_map_chunk(l1pagetable, KERNBASE, SDRAM_START, 0x100000, + pmap_map_chunk(l1pagetable, KERNBASE, PHYSADDR, 0x100000, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - pmap_map_chunk(l1pagetable, KERNBASE + 0x100000, SDRAM_START + 0x100000, + pmap_map_chunk(l1pagetable, KERNBASE + 0x100000, PHYSADDR + 0x100000, 0x100000, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); - pmap_map_chunk(l1pagetable, KERNBASE + 0x200000, SDRAM_START + 0x200000, - (((uint32_t)(lastaddr) - KERNBASE - 0x200000) + L1_S_SIZE) & ~(L1_S_SIZE - 1), + pmap_map_chunk(l1pagetable, KERNEL_TEXT_BASE, KERNEL_TEXT_PHYS, + next_chunk2(((uint32_t)lastaddr) - KERNEL_TEXT_BASE, L1_S_SIZE), VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - freemem_after = ((int)lastaddr + PAGE_SIZE) & ~(PAGE_SIZE - 1); - afterkern = round_page(((vm_offset_t)lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - - 1)); + freemem_after = next_page((int)lastaddr); + afterkern = round_page(next_chunk2((vm_offset_t)lastaddr, L1_S_SIZE)); for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { pmap_link_l2pt(l1pagetable, afterkern + i * 0x00100000, &kernel_pt_table[KERNEL_PT_AFKERNEL + i]); } pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - #ifdef ARM_USE_SMALL_ALLOC if ((freemem_after + 2 * PAGE_SIZE) <= afterkern) { @@ -380,7 +395,10 @@ initarm(void *arg, void *arg2) /* Map the vector page. */ pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - pmap_devmap_bootstrap(l1pagetable, ixp425_devmap); + if (cpu_is_ixp43x()) + pmap_devmap_bootstrap(l1pagetable, ixp435_devmap); + else + pmap_devmap_bootstrap(l1pagetable, ixp425_devmap); /* * Give the XScale global cache clean code an appropriately * sized chunk of unmapped VA space starting at 0xff000000 @@ -392,6 +410,7 @@ initarm(void *arg, void *arg2) setttb(kernel_l1pt.pv_pa); cpu_tlb_flushID(); cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)); + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. @@ -400,16 +419,9 @@ initarm(void *arg, void *arg2) * Since the ARM stacks use STMFD etc. we must set r13 to the top end * of the stack memory. */ - - - set_stackptr(PSR_IRQ32_MODE, - irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); - set_stackptr(PSR_ABT32_MODE, - abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE); - set_stackptr(PSR_UND32_MODE, - undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE); - - + set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE*PAGE_SIZE); + set_stackptr(PSR_ABT32_MODE, abtstack.pv_va + ABT_STACK_SIZE*PAGE_SIZE); + set_stackptr(PSR_UND32_MODE, undstack.pv_va + UND_STACK_SIZE*PAGE_SIZE); /* * We must now clean the cache again.... @@ -422,21 +434,25 @@ initarm(void *arg, void *arg2) * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); + /* ready to setup the console (XXX move earlier if possible) */ + cninit(); /* - * Fetch the SDRAM start/size from the ixp425 SDRAM configration - * registers. + * Fetch the RAM size from the MCU registers. The + * expansion bus was mapped above so we can now read 'em. */ - cninit(); - memsize = ixp425_sdram_size(); + if (cpu_is_ixp43x()) + memsize = ixp435_ddram_size(); + else + memsize = ixp425_sdram_size(); physmem = memsize / PAGE_SIZE; /* Set stack for exception handlers */ - + data_abort_handler_address = (u_int)data_abort_handler; prefetch_abort_handler_address = (u_int)prefetch_abort_handler; undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - + proc_linkup0(&proc0, &thread0); thread0.td_kstack = kernelstack.pv_va; thread0.td_pcb = (struct pcb *) @@ -444,38 +460,33 @@ initarm(void *arg, void *arg2) thread0.td_pcb->pcb_flags = 0; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; - - /* Enable MMU, I-cache, D-cache, write buffer. */ arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); - - pmap_curmaxkvaddr = afterkern + PAGE_SIZE; - dump_avail[0] = 0x10000000; - dump_avail[1] = 0x10000000 + memsize; + dump_avail[0] = PHYSADDR; + dump_avail[1] = PHYSADDR + memsize; dump_avail[2] = 0; dump_avail[3] = 0; - - pmap_bootstrap(pmap_curmaxkvaddr, - 0xd0000000, &kernel_l1pt); + + pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, MSGBUF_SIZE); mutex_init(); - + i = 0; #ifdef ARM_USE_SMALL_ALLOC - phys_avail[i++] = 0x10000000; - phys_avail[i++] = 0x10001000; /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 02:53:13 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76FF31065670; Sat, 13 Dec 2008 02:53:13 +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 621C58FC0C; Sat, 13 Dec 2008 02:53:13 +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 mBD2rD8A015607; Sat, 13 Dec 2008 02:53:13 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD2rDI6015588; Sat, 13 Dec 2008 02:53:13 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812130253.mBD2rDI6015588@svn.freebsd.org> From: Sam Leffler Date: Sat, 13 Dec 2008 02:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186012 - in projects/cambria/tools/tools/nanobsd/gateworks: . Files Files/root Files/usr Files/usr/local Files/usr/local/bin cfg cfg/ssh X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 02:53:13 -0000 Author: sam Date: Sat Dec 13 02:53:12 2008 New Revision: 186012 URL: http://svn.freebsd.org/changeset/base/186012 Log: nanobsd glue for building Avila and Cambria CF images Added: projects/cambria/tools/tools/nanobsd/gateworks/ projects/cambria/tools/tools/nanobsd/gateworks/Files/ projects/cambria/tools/tools/nanobsd/gateworks/Files/root/ projects/cambria/tools/tools/nanobsd/gateworks/Files/root/.profile projects/cambria/tools/tools/nanobsd/gateworks/Files/usr/ projects/cambria/tools/tools/nanobsd/gateworks/Files/usr/local/ projects/cambria/tools/tools/nanobsd/gateworks/Files/usr/local/bin/ projects/cambria/tools/tools/nanobsd/gateworks/Files/usr/local/bin/netperf (contents, props changed) projects/cambria/tools/tools/nanobsd/gateworks/Files/usr/local/bin/netserver (contents, props changed) projects/cambria/tools/tools/nanobsd/gateworks/G2348 projects/cambria/tools/tools/nanobsd/gateworks/G2358 projects/cambria/tools/tools/nanobsd/gateworks/avila projects/cambria/tools/tools/nanobsd/gateworks/cambria projects/cambria/tools/tools/nanobsd/gateworks/cfg/ projects/cambria/tools/tools/nanobsd/gateworks/cfg/motd projects/cambria/tools/tools/nanobsd/gateworks/cfg/rc.conf (contents, props changed) projects/cambria/tools/tools/nanobsd/gateworks/cfg/ssh/ projects/cambria/tools/tools/nanobsd/gateworks/cfg/ssh/sshd_config Added: projects/cambria/tools/tools/nanobsd/gateworks/Files/root/.profile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/cambria/tools/tools/nanobsd/gateworks/Files/root/.profile Sat Dec 13 02:53:12 2008 (r186012) @@ -0,0 +1,15 @@ +# $FreeBSD: src/etc/root/dot.profile,v 1.21 2007/05/29 06:33:10 dougb Exp $ +# +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:~/bin +export PATH +HOME=/root; export HOME +TERM=${TERM:-cons25}; export TERM +PAGER=more; export PAGER + +#set -o vi +set -o emacs +if [ `id -u` = 0 ]; then + PS1="`hostname -s`# " +else + PS1="`hostname -s`% " +fi Added: projects/cambria/tools/tools/nanobsd/gateworks/Files/usr/local/bin/netperf ============================================================================== Binary file. No diff available. Added: projects/cambria/tools/tools/nanobsd/gateworks/Files/usr/local/bin/netserver ============================================================================== Binary file. No diff available. Added: projects/cambria/tools/tools/nanobsd/gateworks/G2348 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/cambria/tools/tools/nanobsd/gateworks/G2348 Sat Dec 13 02:53:12 2008 (r186012) @@ -0,0 +1,120 @@ +# +# Gateworks Avila XScale board +# kernel configuration file for FreeBSD/arm +# +# $FreeBSD$ + +machine arm +ident G2348 + +include "../xscale/ixp425/std.ixp425" +include "../xscale/ixp425/std.avila" +options XSCALE_CACHE_READ_WRITE_ALLOCATE +#options ARM_USE_SMALL_ALLOC +hints "AVILA.hints" +makeoptions MODULES_OVERRIDE="" + +# NB: patched by boot2 to reflect boot/root partition +options ROOTDEVNAME=\"ufs:ad0s1\" + +makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions CONF_CFLAGS=-mcpu=xscale + +options HZ=100 +options DEVICE_POLLING + +# Debugging for use in -current +options KDB +options DDB #Enable the kernel debugger +#options INVARIANTS #Enable calls of extra sanity checking +#options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS #Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed +#options DIAGNOSTIC + +options SCHED_4BSD #4BSD scheduler +#options PREEMPTION + +options INET #InterNETworking +#options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options SOFTUPDATES #Enable FFS soft updates support +#options UFS_ACL #Support for access control lists +options UFS_DIRHASH #Improve performance on big directories +options NFSCLIENT #Network Filesystem Client +options NFSLOCKD #Network Lock Manager +options KTRACE #ktrace(1) support +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options KBD_INSTALL_CDEV # install a CDEV entry in /dev +#options VERBOSE_SYSINIT + +#device saarm + +device pci +device uart + +# I2C Bus +device iicbus +device iicbb +device iic + +device ixpiic +device ixpwdog # watchdog timer +device ds1672 # DS1672 on I2C bus +device ad7418 # AD7418 on I2C bus + +device avila_led + +device ata +device atadisk # ATA disk drives +device avila_ata # Gateworks CF/IDE support + +device npe # Network Processing Engine +device npe_fw +device firmware +device qmgr # Q Manager (required by npe) +device miibus # NB: required by npe +device ether +device bpf + +device pty +device loop +device if_bridge + +device md +device random # Entropy device + +# Wireless NIC cards +device wlan # 802.11 support +options IEEE80211_DEBUG # enable debugging msgs +options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's +device wlan_wep # 802.11 WEP support +device wlan_ccmp # 802.11 CCMP support +device wlan_tkip # 802.11 TKIP support + +device ath # Atheros pci/cardbus NIC's +device ath_rate_sample # SampleRate tx rate control for ath +options ATH_DEBUG # enable athdebug msgs +options ATH_DIAGAPI # enable api for athregs + +device ath_hal # Atheros HAL (includes binary component) +options AH_DEBUG +#options AH_ASSERT +options AH_SUPPORT_AR5416 + +#device crypto +#device cryptodev +#device hifn # NB: Soekris minipci card known to work + +device usb +options USB_DEBUG +device uhci +device ohci +device ehci +device ugen +device umass +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) Added: projects/cambria/tools/tools/nanobsd/gateworks/G2358 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/cambria/tools/tools/nanobsd/gateworks/G2358 Sat Dec 13 02:53:12 2008 (r186012) @@ -0,0 +1,121 @@ +# +# Gateworks Avila XScale board +# kernel configuration file for FreeBSD/arm +# +# $FreeBSD$ + +machine arm +ident G2358 + +include "../xscale/ixp425/std.ixp435" +include "../xscale/ixp425/std.avila" +options XSCALE_CACHE_READ_WRITE_ALLOCATE +#options ARM_USE_SMALL_ALLOC +hints "CAMBRIA.hints" +makeoptions MODULES_OVERRIDE="" + +# NB: patched by boot2 to reflect boot/root partition +options ROOTDEVNAME=\"ufs:ad0s1\" + +makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions CONF_CFLAGS=-mcpu=xscale + +options HZ=100 +options DEVICE_POLLING + +# Debugging for use in -current +options KDB +options DDB #Enable the kernel debugger +#options INVARIANTS #Enable calls of extra sanity checking +#options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS #Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed +#options DIAGNOSTIC + +options SCHED_4BSD #4BSD scheduler +#options PREEMPTION + +options INET #InterNETworking +#options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options SOFTUPDATES #Enable FFS soft updates support +#options UFS_ACL #Support for access control lists +options UFS_DIRHASH #Improve performance on big directories +options NFSCLIENT #Network Filesystem Client +options NFSLOCKD #Network Lock Manager +options KTRACE #ktrace(1) support +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options KBD_INSTALL_CDEV # install a CDEV entry in /dev +#options VERBOSE_SYSINIT + +#device saarm + +device pci +device uart + +# I2C Bus +device iicbus +device iicbb +device iic + +device ixpiic +device ixpwdog # watchdog timer +device ds1672 # DS1672 on I2C bus +device ad7418 # AD7418 on I2C bus + +device cambria_led +device cambria_fled + +device ata +device atadisk # ATA disk drives +device avila_ata # Gateworks CF/IDE support + +device npe # Network Processing Engine +device npe_fw +device firmware +device qmgr # Q Manager (required by npe) +device miibus # NB: required by npe +device ether +device bpf + +device pty +device loop +device if_bridge + +device md +device random # Entropy device + +# Wireless NIC cards +device wlan # 802.11 support +options IEEE80211_DEBUG # enable debugging msgs +options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's +device wlan_wep # 802.11 WEP support +device wlan_ccmp # 802.11 CCMP support +device wlan_tkip # 802.11 TKIP support + +device ath # Atheros pci/cardbus NIC's +device ath_rate_sample # SampleRate tx rate control for ath +options ATH_DEBUG # enable athdebug msgs +options ATH_DIAGAPI # enable api for athregs + +device ath_hal # Atheros HAL (includes binary component) +options AH_DEBUG +#options AH_ASSERT +options AH_SUPPORT_AR5416 + +#device crypto +#device cryptodev +#device hifn # NB: Soekris minipci card known to work + +device usb +options USB_DEBUG +device uhci +device ohci +device ehci +device ugen +device umass +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) Added: projects/cambria/tools/tools/nanobsd/gateworks/avila ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/cambria/tools/tools/nanobsd/gateworks/avila Sat Dec 13 02:53:12 2008 (r186012) @@ -0,0 +1,351 @@ +NANO_NAME="gateworks" +NANO_SRC="/usr/sam/base/projects/cambria" +NANO_KERNEL="G2348" + +NANO_CFGDIR=${NANO_SRC}/${NANO_TOOLS}/${NANO_NAME}/cfg +test -d ${NANO_CFGDIR} || NANO_CFGDIR=/var/empty +NANO_PMAKE="make" # NB: disable -j 3 + +NANO_ARCH=arm +TARGET_CPUTYPE=xscale; export TARGET_CPUTYPE # XXX +TARGET_BIG_ENDIAN=true; export TARGET_BIG_ENDIAN # XXX + +NANO_IMAGES=1 +FlashDevice Sandisk 64 + +NANO_CUSTOMIZE="cust_allow_ssh_root" + +clean_usr_local() +{ + LOCAL_DIR=${NANO_WORLDDIR}/usr/local + pprint 2 "Clean and create world directory (${LOCAL_DIR})" + if rm -rf ${LOCAL_DIR}/ > /dev/null 2>&1 ; then + true + else + chflags -R noschg ${LOCAL_DIR}/ + rm -rf ${LOCAL_DIR}/ + fi + for f in bin etc lib libdata libexec sbin share; do + mkdir -p ${LOCAL_DIR}/$f + done +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE clean_usr_local" + +cust_install_machine_files() +{ + echo "cd ${NANO_TOOLS}/${NANO_NAME}/Files" + cd ${NANO_TOOLS}/${NANO_NAME}/Files + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR} +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE cust_install_files cust_install_machine_files" + +buildenv() +{ + cd ${NANO_SRC} + env TARGET_ARCH=${NANO_ARCH} __MAKE_CONF=${NANO_MAKE_CONF} \ + DESTDIR=${NANO_WORLDDIR} make buildenv +} + +net80211_tools() +{ + for f in wlanstats wlanwds wlanwatch; do + echo "(cd tools/tools/net80211/$f; make $1)"; + done | buildenv +} +net80211_clean_tools() +{ + net80211_tools "clean" +} +net80211_build_tools() +{ + net80211_tools "" +} +net80211_install_tools() +{ + net80211_tools "install" +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_clean_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_build_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_install_tools" + +ath_clean_tools() +{ + echo "cd tools/tools/ath; make clean" | buildenv +} +ath_build_tools() +{ + echo "cd tools/tools/ath; make" | buildenv +} +ath_install_tools() +{ + echo "cd tools/tools/ath; make install" | buildenv +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_clean_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_build_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_install_tools" + +NANO_MAKEFS="makefs -B big \ + -o bsize=4096,fsize=512,density=8192,optimization=space" +export NANO_MAKEFS + +# NB: leave c++ enabled so devd can be built +CONF_BUILD=" +WITHOUT_ACPI=true +WITHOUT_ATM=true +WITHOUT_AUDIT=true +WITHOUT_BIND_DNSSEC=true +WITHOUT_BIND_ETC=true +WITHOUT_BIND_LIBS_LWRES=true +WITHOUT_BLUETOOTH=true +WITHOUT_CALENDAR=true +WITHOUT_CDDL=true +WITHOUT_CVS=true +WITHOUT_DICT=true +WITHOUT_EXAMPLES=true +WITHOUT_FORTRAN=true +WITHOUT_GAMES=true +WITHOUT_GCOV=true +WITHOUT_GPIB=true +WITHOUT_HTML=true +WITHOUT_I4B=true +WITHOUT_INET6=true +WITHOUT_INFO=true +WITHOUT_IPFILTER=true +WITHOUT_IPX=true +WITHOUT_KERBEROS=true +WITHOUT_LIBKSE=true +WITHOUT_LOCALES=true +WITHOUT_LPR=true +WITHOUT_MAN=true +WITHOUT_NETCAT=true +WITHOUT_NIS=true +WITHOUT_NLS=true +WITHOUT_NS_CACHING=true +WITHOUT_OBJC=true +WITHOUT_PROFILE=true +WITHOUT_RCMDS=true +WITHOUT_RCS=true +WITHOUT_RESCUE=true +WITHOUT_SENDMAIL=true +WITHOUT_SHAREDOCS=true +WITHOUT_SSP=true +WITHOUT_SYSCONS=true +WITHOUT_TCSH=true +" +CONF_INSTALL="$CONF_BUILD +WITHOUT_TOOLCHAIN=true +WITHOUT_INSTALLLIB=true +" + +# NB: override to suppress install of kernel.symbols +install_kernel() +{ + pprint 2 "install kernel" + pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.ik" + + cd ${NANO_SRC} + env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} installkernel \ + INSTALL_NODEBUG=true \ + DESTDIR=${NANO_WORLDDIR} \ + __MAKE_CONF=${NANO_MAKE_CONF} KERNCONF=`basename ${NANO_KERNEL}` \ + > ${MAKEOBJDIRPREFIX}/_.ik 2>&1 +} + +# NB: override to force / on s1 instead of s1a +setup_nanobsd_etc() +{ + pprint 2 "configure nanobsd /etc" + + ( + cd ${NANO_WORLDDIR} + + # create diskless marker file + touch etc/diskless + + # Make root filesystem R/O by default + echo "root_rw_mount=NO" >> etc/defaults/rc.conf + + # save config file for scripts + echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf + + echo "/dev/${NANO_DRIVE}s1 / ufs ro 1 1" > etc/fstab + echo "/dev/${NANO_DRIVE}s3 /cfg ufs rw,noauto 2 2" >> etc/fstab + mkdir -p cfg + ) +} + +create_arm_diskimage() +{ + pprint 2 "build diskimage" + pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.di" + + ( + echo "NANO_MEDIASIZE: $NANO_MEDIASIZE" + echo "NANO_IMAGES: $NANO_IMAGES" + echo "NANO_SECTS: $NANO_SECTS" + echo "NANO_HEADS: $NANO_HEADS" + echo "NANO_CODESIZE: $NANO_CODESIZE" + echo "NANO_CONFSIZE: $NANO_CONFSIZE" + echo "NANO_DATASIZE: $NANO_DATASIZE" + + echo $NANO_MEDIASIZE $NANO_IMAGES \ + $NANO_SECTS $NANO_HEADS \ + $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | + awk ' + { + printf "# %s\n", $0 + + # size of cylinder in sectors + cs = $3 * $4 + + # number of full cylinders on media + cyl = int ($1 / cs) + + # output fdisk geometry spec, truncate cyls to 1023 + if (cyl <= 1023) + print "g c" cyl " h" $4 " s" $3 + else + print "g c" 1023 " h" $4 " s" $3 + + if ($7 > 0) { + # size of data partition in full cylinders + dsl = int (($7 + cs - 1) / cs) + } else { + dsl = 0; + } + + # size of config partition in full cylinders + csl = int (($6 + cs - 1) / cs) + + if ($5 == 0) { + # size of image partition(s) in full cylinders + isl = int ((cyl - dsl - csl) / $2) + } else { + isl = int (($5 + cs - 1) / cs) + } + + # First image partition start at second track + print "p 1 165 " $3, isl * cs - $3 + c = isl * cs; + + # Second image partition (if any) also starts offset one + # track to keep them identical. + if ($2 > 1) { + print "p 2 165 " $3 + c, isl * cs - $3 + c += isl * cs; + } + + # Config partition starts at cylinder boundary. + print "p 3 165 " c, csl * cs + c += csl * cs + + # Data partition (if any) starts at cylinder boundary. + if ($7 > 0) { + print "p 4 165 " c, dsl * cs + } else if ($7 < 0 && $1 > c) { + print "p 4 165 " c, $1 - c + } else if ($1 < c) { + print "Disk space overcommitted by", \ + c - $1, "sectors" > "/dev/stderr" + exit 2 + } + + # Force slice 1 to be marked active. This is necessary + # for booting the image from a USB device to work. + print "a 1" + } + ' > ${MAKEOBJDIRPREFIX}/_.fdisk + + IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} + BS=${NANO_SECTS}b + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + else + echo ""; echo "Creating md backing file ${IMG} ..." + _c=`expr ${NANO_MEDIASIZE} / ${NANO_SECTS}` + pprint 2 "dd if=/dev/zero of=${IMG} bs=${BS} count=${_c}" + dd if=/dev/zero of=${IMG} bs=${BS} count=${_c} + pprint 2 "mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} -y ${NANO_HEADS}" + MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + fi + + trap "mdconfig -d -u $MD" 1 2 15 EXIT + + echo ""; echo "Write partition table ..." + FDISK=${MAKEOBJDIRPREFIX}/_.fdisk + pprint 2 "fdisk -i -f ${FDISK} ${MD}" + fdisk -i -f ${FDISK} ${MD} + pprint 2 "fdisk ${MD}" + fdisk ${MD} + + # Create first image + IMG1=${NANO_DISKIMGDIR}/_.disk.image1 + echo ""; echo "Create first image ${IMG1} ..." + SIZE=`awk '/^p 1/ { print $5 "b" }' ${FDISK}` + pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR}" + ${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR} + pprint 2 "dd if=${IMG1} of=/dev/${MD}s1 bs=${BS}" + dd if=${IMG1} of=/dev/${MD}s1 bs=${BS} + + if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then + IMG2=${NANO_DISKIMGDIR}/_.disk.image2 + echo ""; echo "Create second image ${IMG2}..." + for f in ${NANO_WORLDDIR}/etc/fstab ${NANO_WORLDDIR}/conf/base/etc/fstab + do + sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/g" $f + done + + SIZE=`awk '/^p 2/ { print $5 "b" }' ${FDISK}` + pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${IMG2} ${NANO_WORLDDIR}" + ${NANO_MAKEFS} -s ${SIZE} ${IMG2} ${NANO_WORLDDIR} + pprint 2 "dd if=${IMG2} of=/dev/${MD}s2 bs=${BS}" + dd if=${IMG2} of=/dev/${MD}s2 bs=${BS} + fi + + # Create Config slice + CFG=${NANO_DISKIMGDIR}/_.disk.cfg + echo ""; echo "Creating config partition ${CFG}..." + SIZE=`awk '/^p 3/ { print $5 "b" }' ${FDISK}` + # XXX: fill from where ? + pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${CFG} ${NANO_CFGDIR}" + ${NANO_MAKEFS} -s ${SIZE} ${CFG} ${NANO_CFGDIR} + pprint 2 "dd if=${CFG} of=/dev/${MD}s3 bs=${BS}" + dd if=${CFG} of=/dev/${MD}s3 bs=${BS} + pprint 2 "rm ${CFG}" + rm ${CFG}; CFG= # NB: disable printing below + + # Create Data slice, if any. + if [ $NANO_DATASIZE -gt 0 ] ; then + DATA=${NANO_DISKIMGDIR}/_.disk.data + echo ""; echo "Creating data partition ${DATA}..." + SIZE=`awk '/^p 4/ { print $5 "b" }' ${FDISK}` + # XXX: fill from where ? + pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${DATA} /var/empty" + ${NANO_MAKEFS} -s ${SIZE} ${DATA} /var/empty + pprint 2 "dd if=${DATA} of=/dev/${MD}s4 bs=${BS}" + dd if=${DATA} of=/dev/${MD}s4 bs=${BS} + pprint 2 "rm ${DATA}" + rm ${DATA}; DATA= # NB: disable printing below + fi + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + echo "Writing out _.disk.full..." + dd if=/dev/${MD} of=${IMG} bs=${BS} + fi + + echo "" + echo "Completed images in:" + echo "" + echo "Full disk: ${IMG}" + echo "Primary partition: ${IMG1}" + test "${IMG2}" && echo "2ndary partition: ${IMG2}" + test "${CFG}" && echo "/cfg partition: ${CFG}" + test "${DATA}" && echo "/data partition: ${DATA}" + echo "" + echo "Use dd if= of=/dev/ bs=${BS} to transfer an" + echo "image to bootable media /dev/." + ) > ${MAKEOBJDIRPREFIX}/_.di 2>&1 +} Added: projects/cambria/tools/tools/nanobsd/gateworks/cambria ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/cambria/tools/tools/nanobsd/gateworks/cambria Sat Dec 13 02:53:12 2008 (r186012) @@ -0,0 +1,351 @@ +NANO_NAME="cambria" +NANO_SRC="/usr/sam/base/projects/cambria" +NANO_KERNEL="G2358" + +NANO_CFGDIR=${NANO_SRC}/${NANO_TOOLS}/gateworks/cfg +test -d ${NANO_CFGDIR} || NANO_CFGDIR=/var/empty +NANO_PMAKE="make" # NB: disable -j 3 + +NANO_ARCH=arm +TARGET_CPUTYPE=xscale; export TARGET_CPUTYPE # XXX +TARGET_BIG_ENDIAN=true; export TARGET_BIG_ENDIAN # XXX + +NANO_IMAGES=1 +FlashDevice Sandisk 64 + +NANO_CUSTOMIZE="cust_allow_ssh_root" + +clean_usr_local() +{ + LOCAL_DIR=${NANO_WORLDDIR}/usr/local + pprint 2 "Clean and create world directory (${LOCAL_DIR})" + if rm -rf ${LOCAL_DIR}/ > /dev/null 2>&1 ; then + true + else + chflags -R noschg ${LOCAL_DIR}/ + rm -rf ${LOCAL_DIR}/ + fi + for f in bin etc lib libdata libexec sbin share; do + mkdir -p ${LOCAL_DIR}/$f + done +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE clean_usr_local" + +cust_install_machine_files() +{ + echo "cd ${NANO_TOOLS}/gateworks/Files" + cd ${NANO_TOOLS}/gateworks/Files + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR} +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE cust_install_files cust_install_machine_files" + +buildenv() +{ + cd ${NANO_SRC} + env TARGET_ARCH=${NANO_ARCH} __MAKE_CONF=${NANO_MAKE_CONF} \ + DESTDIR=${NANO_WORLDDIR} make buildenv +} + +net80211_tools() +{ + for f in wlanstats wlanwds wlanwatch; do + echo "(cd tools/tools/net80211/$f; make $1)"; + done | buildenv +} +net80211_clean_tools() +{ + net80211_tools "clean" +} +net80211_build_tools() +{ + net80211_tools "" +} +net80211_install_tools() +{ + net80211_tools "install" +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_clean_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_build_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_install_tools" + +ath_clean_tools() +{ + echo "cd tools/tools/ath; make clean" | buildenv +} +ath_build_tools() +{ + echo "cd tools/tools/ath; make" | buildenv +} +ath_install_tools() +{ + echo "cd tools/tools/ath; make install" | buildenv +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_clean_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_build_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_install_tools" + +NANO_MAKEFS="makefs -B big \ + -o bsize=4096,fsize=512,density=8192,optimization=space" +export NANO_MAKEFS + +# NB: leave c++ enabled so devd can be built +CONF_BUILD=" +WITHOUT_ACPI=true +WITHOUT_ATM=true +WITHOUT_AUDIT=true +WITHOUT_BIND_DNSSEC=true +WITHOUT_BIND_ETC=true +WITHOUT_BIND_LIBS_LWRES=true +WITHOUT_BLUETOOTH=true +WITHOUT_CALENDAR=true +WITHOUT_CDDL=true +WITHOUT_CVS=true +WITHOUT_DICT=true +WITHOUT_EXAMPLES=true +WITHOUT_FORTRAN=true +WITHOUT_GAMES=true +WITHOUT_GCOV=true +WITHOUT_GPIB=true +WITHOUT_HTML=true +WITHOUT_I4B=true +WITHOUT_INET6=true +WITHOUT_INFO=true +WITHOUT_IPFILTER=true +WITHOUT_IPX=true +WITHOUT_KERBEROS=true +WITHOUT_LIBKSE=true +WITHOUT_LOCALES=true +WITHOUT_LPR=true +WITHOUT_MAN=true +WITHOUT_NETCAT=true +WITHOUT_NIS=true +WITHOUT_NLS=true +WITHOUT_NS_CACHING=true +WITHOUT_OBJC=true +WITHOUT_PROFILE=true +WITHOUT_RCMDS=true +WITHOUT_RCS=true +WITHOUT_RESCUE=true +WITHOUT_SENDMAIL=true +WITHOUT_SHAREDOCS=true +WITHOUT_SSP=true +WITHOUT_SYSCONS=true +WITHOUT_TCSH=true +" +CONF_INSTALL="$CONF_BUILD +WITHOUT_TOOLCHAIN=true +WITHOUT_INSTALLLIB=true +" + +# NB: override to suppress install of kernel.symbols +install_kernel() +{ + pprint 2 "install kernel" + pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.ik" + + cd ${NANO_SRC} + env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} installkernel \ + INSTALL_NODEBUG=true \ + DESTDIR=${NANO_WORLDDIR} \ + __MAKE_CONF=${NANO_MAKE_CONF} KERNCONF=`basename ${NANO_KERNEL}` \ + > ${MAKEOBJDIRPREFIX}/_.ik 2>&1 +} + +# NB: override to force / on s1 instead of s1a +setup_nanobsd_etc() +{ + pprint 2 "configure nanobsd /etc" + + ( + cd ${NANO_WORLDDIR} + + # create diskless marker file + touch etc/diskless + + # Make root filesystem R/O by default + echo "root_rw_mount=NO" >> etc/defaults/rc.conf + + # save config file for scripts + echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf + + echo "/dev/${NANO_DRIVE}s1 / ufs ro 1 1" > etc/fstab + echo "/dev/${NANO_DRIVE}s3 /cfg ufs rw,noauto 2 2" >> etc/fstab + mkdir -p cfg + ) +} + +create_arm_diskimage() +{ + pprint 2 "build diskimage" + pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.di" + + ( + echo "NANO_MEDIASIZE: $NANO_MEDIASIZE" + echo "NANO_IMAGES: $NANO_IMAGES" + echo "NANO_SECTS: $NANO_SECTS" + echo "NANO_HEADS: $NANO_HEADS" + echo "NANO_CODESIZE: $NANO_CODESIZE" + echo "NANO_CONFSIZE: $NANO_CONFSIZE" + echo "NANO_DATASIZE: $NANO_DATASIZE" + + echo $NANO_MEDIASIZE $NANO_IMAGES \ + $NANO_SECTS $NANO_HEADS \ + $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | + awk ' + { + printf "# %s\n", $0 + + # size of cylinder in sectors + cs = $3 * $4 + + # number of full cylinders on media + cyl = int ($1 / cs) + + # output fdisk geometry spec, truncate cyls to 1023 + if (cyl <= 1023) + print "g c" cyl " h" $4 " s" $3 + else + print "g c" 1023 " h" $4 " s" $3 + + if ($7 > 0) { + # size of data partition in full cylinders + dsl = int (($7 + cs - 1) / cs) + } else { + dsl = 0; + } + + # size of config partition in full cylinders + csl = int (($6 + cs - 1) / cs) + + if ($5 == 0) { + # size of image partition(s) in full cylinders + isl = int ((cyl - dsl - csl) / $2) + } else { + isl = int (($5 + cs - 1) / cs) + } + + # First image partition start at second track + print "p 1 165 " $3, isl * cs - $3 + c = isl * cs; + + # Second image partition (if any) also starts offset one + # track to keep them identical. + if ($2 > 1) { + print "p 2 165 " $3 + c, isl * cs - $3 + c += isl * cs; + } + + # Config partition starts at cylinder boundary. + print "p 3 165 " c, csl * cs + c += csl * cs + + # Data partition (if any) starts at cylinder boundary. + if ($7 > 0) { + print "p 4 165 " c, dsl * cs + } else if ($7 < 0 && $1 > c) { + print "p 4 165 " c, $1 - c + } else if ($1 < c) { + print "Disk space overcommitted by", \ + c - $1, "sectors" > "/dev/stderr" + exit 2 + } + + # Force slice 1 to be marked active. This is necessary + # for booting the image from a USB device to work. + print "a 1" + } + ' > ${MAKEOBJDIRPREFIX}/_.fdisk + + IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} + BS=${NANO_SECTS}b + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + else + echo ""; echo "Creating md backing file ${IMG} ..." + _c=`expr ${NANO_MEDIASIZE} / ${NANO_SECTS}` + pprint 2 "dd if=/dev/zero of=${IMG} bs=${BS} count=${_c}" + dd if=/dev/zero of=${IMG} bs=${BS} count=${_c} + pprint 2 "mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} -y ${NANO_HEADS}" + MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + fi + + trap "mdconfig -d -u $MD" 1 2 15 EXIT + + echo ""; echo "Write partition table ..." + FDISK=${MAKEOBJDIRPREFIX}/_.fdisk + pprint 2 "fdisk -i -f ${FDISK} ${MD}" + fdisk -i -f ${FDISK} ${MD} + pprint 2 "fdisk ${MD}" + fdisk ${MD} + + # Create first image + IMG1=${NANO_DISKIMGDIR}/_.disk.image1 + echo ""; echo "Create first image ${IMG1} ..." + SIZE=`awk '/^p 1/ { print $5 "b" }' ${FDISK}` + pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR}" + ${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR} + pprint 2 "dd if=${IMG1} of=/dev/${MD}s1 bs=${BS}" + dd if=${IMG1} of=/dev/${MD}s1 bs=${BS} + + if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then + IMG2=${NANO_DISKIMGDIR}/_.disk.image2 + echo ""; echo "Create second image ${IMG2}..." + for f in ${NANO_WORLDDIR}/etc/fstab ${NANO_WORLDDIR}/conf/base/etc/fstab + do + sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/g" $f + done + + SIZE=`awk '/^p 2/ { print $5 "b" }' ${FDISK}` + pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${IMG2} ${NANO_WORLDDIR}" + ${NANO_MAKEFS} -s ${SIZE} ${IMG2} ${NANO_WORLDDIR} + pprint 2 "dd if=${IMG2} of=/dev/${MD}s2 bs=${BS}" + dd if=${IMG2} of=/dev/${MD}s2 bs=${BS} + fi + + # Create Config slice + CFG=${NANO_DISKIMGDIR}/_.disk.cfg + echo ""; echo "Creating config partition ${CFG}..." + SIZE=`awk '/^p 3/ { print $5 "b" }' ${FDISK}` + # XXX: fill from where ? + pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${CFG} ${NANO_CFGDIR}" + ${NANO_MAKEFS} -s ${SIZE} ${CFG} ${NANO_CFGDIR} + pprint 2 "dd if=${CFG} of=/dev/${MD}s3 bs=${BS}" + dd if=${CFG} of=/dev/${MD}s3 bs=${BS} + pprint 2 "rm ${CFG}" + rm ${CFG}; CFG= # NB: disable printing below + + # Create Data slice, if any. + if [ $NANO_DATASIZE -gt 0 ] ; then + DATA=${NANO_DISKIMGDIR}/_.disk.data + echo ""; echo "Creating data partition ${DATA}..." + SIZE=`awk '/^p 4/ { print $5 "b" }' ${FDISK}` + # XXX: fill from where ? + pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${DATA} /var/empty" + ${NANO_MAKEFS} -s ${SIZE} ${DATA} /var/empty + pprint 2 "dd if=${DATA} of=/dev/${MD}s4 bs=${BS}" + dd if=${DATA} of=/dev/${MD}s4 bs=${BS} + pprint 2 "rm ${DATA}" + rm ${DATA}; DATA= # NB: disable printing below + fi + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + echo "Writing out _.disk.full..." + dd if=/dev/${MD} of=${IMG} bs=${BS} + fi + + echo "" + echo "Completed images in:" + echo "" + echo "Full disk: ${IMG}" + echo "Primary partition: ${IMG1}" + test "${IMG2}" && echo "2ndary partition: ${IMG2}" + test "${CFG}" && echo "/cfg partition: ${CFG}" + test "${DATA}" && echo "/data partition: ${DATA}" + echo "" + echo "Use dd if= of=/dev/ bs=${BS} to transfer an" + echo "image to bootable media /dev/." + ) > ${MAKEOBJDIRPREFIX}/_.di 2>&1 +} Added: projects/cambria/tools/tools/nanobsd/gateworks/cfg/motd ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/cambria/tools/tools/nanobsd/gateworks/cfg/motd Sat Dec 13 02:53:12 2008 (r186012) @@ -0,0 +1 @@ +FreeBSD 7.1-PRERELEASE (G2348) #1: Fri Sep 26 14:37:41 PDT 2008 Added: projects/cambria/tools/tools/nanobsd/gateworks/cfg/rc.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/cambria/tools/tools/nanobsd/gateworks/cfg/rc.conf Sat Dec 13 02:53:12 2008 (r186012) @@ -0,0 +1,24 @@ +#!/bin/sh + +hostname="avila" +ifconfig_npe0="DHCP" +background_dhclient_npe0="YES" # Start dhcp client in the background. +#ifconfig_npe1="DHCP" +background_dhclient_npe1="YES" # Start dhcp client in the background. + +wlans_ath0="wlan0" + +sshd_enable="YES" +nfs_client_enable="YES" + +sendmail_enable="NO" # Run the sendmail inbound daemon (YES/NO). +sendmail_submit_enable="NO" # Start a localhost-only MTA for mail submission +sendmail_outbound_enable="NO" # Dequeue stuck mail (YES/NO). +sendmail_msp_queue_enable="NO" # Dequeue stuck clientmqueue mail (YES/NO). + +dumpdev="NO" # Device to crashdump to (device name, AUTO, or NO). +background_fsck="NO" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 02:56:09 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56F8C106564A; Sat, 13 Dec 2008 02:56:09 +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 3C2398FC16; Sat, 13 Dec 2008 02:56:09 +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 mBD2u9fO015708; Sat, 13 Dec 2008 02:56:09 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD2u9r8015704; Sat, 13 Dec 2008 02:56:09 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812130256.mBD2u9r8015704@svn.freebsd.org> From: Sam Leffler Date: Sat, 13 Dec 2008 02:56:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186013 - projects/cambria/sys/boot/arm/ixp425/boot2 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 02:56:09 -0000 Author: sam Date: Sat Dec 13 02:56:08 2008 New Revision: 186013 URL: http://svn.freebsd.org/changeset/base/186013 Log: merge WIP multi-board support; tested on Avila and Cambria, still needs Proghorn testing Modified: projects/cambria/sys/boot/arm/ixp425/boot2/arm_init.S projects/cambria/sys/boot/arm/ixp425/boot2/boot2.c projects/cambria/sys/boot/arm/ixp425/boot2/ixp425_board.c projects/cambria/sys/boot/arm/ixp425/boot2/lib.h Modified: projects/cambria/sys/boot/arm/ixp425/boot2/arm_init.S ============================================================================== --- projects/cambria/sys/boot/arm/ixp425/boot2/arm_init.S Sat Dec 13 02:53:12 2008 (r186012) +++ projects/cambria/sys/boot/arm/ixp425/boot2/arm_init.S Sat Dec 13 02:56:08 2008 (r186013) @@ -24,8 +24,9 @@ * $FreeBSD$ */ -start: +#include +ASENTRY_NP(start) /* Initialise bss and sp */ nop adr r1, .Lstart @@ -47,4 +48,9 @@ infiniteLoop: .word _edata .word _end .word BOOT_STACK + +ENTRY(cpu_id) + mrc p15, 0, r0, c0, c0, 0 + RET + /* End */ Modified: projects/cambria/sys/boot/arm/ixp425/boot2/boot2.c ============================================================================== --- projects/cambria/sys/boot/arm/ixp425/boot2/boot2.c Sat Dec 13 02:53:12 2008 (r186012) +++ projects/cambria/sys/boot/arm/ixp425/boot2/boot2.c Sat Dec 13 02:56:08 2008 (r186013) @@ -163,7 +163,7 @@ main(void) p_memset((char *)dmadat, 0, 32 * 1024); bt = board_init(); - printf("FreeBSD ARM (%s) boot2 v%d.%d\n", bt, 0, 3); + printf("FreeBSD ARM (%s) boot2 v%d.%d\n", bt, 0, 4); autoboot = 1; Modified: projects/cambria/sys/boot/arm/ixp425/boot2/ixp425_board.c ============================================================================== --- projects/cambria/sys/boot/arm/ixp425/boot2/ixp425_board.c Sat Dec 13 02:53:12 2008 (r186012) +++ projects/cambria/sys/boot/arm/ixp425/boot2/ixp425_board.c Sat Dec 13 02:56:08 2008 (r186013) @@ -27,20 +27,35 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "lib.h" #include "cf_ata.h" +#include #include #include -static u_int8_t *ubase; +struct board_config { + const char *desc; + int (*probe)(int boardtype_hint); + void (*init)(void); +}; +/* set of registered boards */ +SET_DECLARE(boards, struct board_config); +#define BOARD_CONFIG(name, _desc) \ +static struct board_config name##config = { \ + .desc = _desc, \ + .probe = name##_probe, \ + .init = name##_init, \ +}; \ +DATA_SET(boards, name##config) -#define BOARD_AVILA 0 -#define BOARD_PRONGHORN 1 -static int board; +static u_int cputype; +#define cpu_is_ixp43x() (cputype == CPU_ID_IXP435) +static u_int8_t *ubase; static u_int8_t uart_getreg(u_int8_t *, int); static void uart_setreg(u_int8_t *, int, u_int8_t); @@ -57,32 +72,18 @@ static void cf_clr(void); const char * board_init(void) { - volatile u_int32_t *cs; - const char *bt = NULL; + struct board_config **pbp; - /* - * Redboot only configure the chip selects that are needed, so - * use that to figure out if it is an Avila or ADI board. The - * Avila boards use CS2 and ADI does not. - */ - cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS2_OFFSET); - if (*cs != 0) { - board = BOARD_AVILA; - bt = "Avila"; - } else { - board = BOARD_PRONGHORN; - bt = "Pronghorn Metro"; - } + cputype = cpu_id() & CPU_ID_CPU_MASK; - /* Config the serial port. RedBoot should do the rest. */ - if (board == BOARD_AVILA) - ubase = (u_int8_t *)(IXP425_UART0_HWBASE); - else - ubase = (u_int8_t *)(IXP425_UART1_HWBASE); - - cf_init(); - - return bt; + SET_FOREACH(pbp, boards) + /* XXX pass down redboot board type */ + if ((*pbp)->probe(0)) { + (*pbp)->init(); + return (*pbp)->desc; + } + /* XXX panic, unknown board type */ + return "???"; } /* @@ -228,6 +229,9 @@ struct { u_int8_t sectors; u_int32_t cylinders; + u_int32_t *cs1to; + u_int32_t *cs2to; + u_int8_t *cs1; u_int8_t *cs2; @@ -265,38 +269,21 @@ cf_init(void) #ifdef DEBUG int rval; #endif - volatile u_int32_t *cs; - - /* Setup the CF select timeing. Maybe already done by RedBoot? */ - if (board == BOARD_AVILA) { - cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS1_OFFSET); - *cs |= (EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); - DPRINTF("t1 %x, ", *cs); - - cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS2_OFFSET); - *cs |= (EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); - DPRINTF("t2 %x\n", *cs); - - dskinf.cs1 = (u_int8_t *)IXP425_EXP_BUS_CS1_HWBASE; - dskinf.cs2 = (u_int8_t *)IXP425_EXP_BUS_CS2_HWBASE; - } else { - cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS3_OFFSET); - *cs |= (EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); - DPRINTF("t1 %x, ", *cs); - - cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS4_OFFSET); - *cs |= (EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); - DPRINTF("t2 %x\n", *cs); - - dskinf.cs1 = (u_int8_t *)IXP425_EXP_BUS_CS3_HWBASE; - dskinf.cs2 = (u_int8_t *)IXP425_EXP_BUS_CS4_HWBASE; - } - DPRINTF("cs1 %x, cs2 %x\n", dskinf.cs1, dskinf.cs2); + /* NB: board init routines setup other parts of dskinf */ dskinf.use_stream8 = 0; dskinf.use_lba = 0; dskinf.debug = 1; + DPRINTF("cs1 %x, cs2 %x\n", dskinf.cs1, dskinf.cs2); + + /* Setup the CF window */ + *dskinf.cs1to |= (EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); + DPRINTF("t1 %x, ", *dskinf.cs1to); + + *dskinf.cs2to |= (EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); + DPRINTF("t2 %x\n", *dskinf.cs2to); + /* Detect if there is a disk. */ cfwrite8(CF_DRV_HEAD, CF_D_IBM); DELAY(1000); @@ -340,29 +327,24 @@ static void cfenable16(void) { u_int32_t val; - volatile u_int32_t *cs; - if (board == BOARD_AVILA) - cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS1_OFFSET); - else - cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS3_OFFSET); - val = *cs; - *cs = val & (~1); - DPRINTF("cfenable16: cs1 timing reg %x\n", *cs); + val = *dskinf.cs1to; + *dskinf.cs1to = val &~ EXP_BYTE_EN; +#if 0 + DPRINTF("%s: cs1 timing reg %x\n", *dskinf.cs1to, __func__); +#endif } static void cfdisable16(void) { u_int32_t val; - volatile u_int32_t *cs; - if (board == BOARD_AVILA) - cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS1_OFFSET); - else - cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS3_OFFSET); - val = *cs; - *cs = val | 1; + val = *dskinf.cs1to; + *dskinf.cs1to = val | EXP_BYTE_EN; +#if 0 + DPRINTF("%s: cs1 timing reg %x\n", *dskinf.cs1to, __func__); +#endif } static u_int8_t @@ -478,7 +460,8 @@ cfwait(u_int8_t mask) while (tout <= 5000000) { status = cfread8(CF_STATUS); if (status == 0xff) { - printf("cfwait: master: no status, reselecting\n"); + printf("%s: master: no status, reselecting\n", + __func__); cfwrite8(CF_DRV_HEAD, CF_D_IBM); DELAY(1); status = cfread8(CF_STATUS); @@ -487,10 +470,14 @@ cfwait(u_int8_t mask) return -1; dskinf.status = status; if (!(status & CF_S_BUSY)) { - if (status & CF_S_ERROR) + if (status & CF_S_ERROR) { dskinf.error = cfread8(CF_ERROR); + printf("%s: error, status 0x%x error 0x%x\n", + __func__, status, dskinf.error); + } if ((status & mask) == mask) { - DPRINTF("cfwait: tout %u\n", tout); + DPRINTF("%s: status 0x%x mask 0x%x tout %u\n", + __func__, status, mask, tout); return (status & CF_S_ERROR); } } @@ -695,3 +682,88 @@ avila_read(char *dest, unsigned source, return 0; } +/* + * Gateworks Avila Support. + */ +static int +avila_probe(int boardtype_hint) +{ + volatile u_int32_t *cs; + /* + * Redboot only configure the chip selects that are needed, so + * use that to figure out if it is an Avila or ADI board. The + * Avila boards use CS2 and ADI does not. + */ + cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS2_OFFSET); + return (*cs != 0); +} + +static void +avila_init(void) +{ + /* Config the serial port. RedBoot should do the rest. */ + ubase = (u_int8_t *)(IXP425_UART0_HWBASE); + + dskinf.cs1to = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS1_OFFSET); + dskinf.cs2to = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS2_OFFSET); + dskinf.cs1 = (u_int8_t *)IXP425_EXP_BUS_CS1_HWBASE; + dskinf.cs2 = (u_int8_t *)IXP425_EXP_BUS_CS2_HWBASE; + + cf_init(); +} +BOARD_CONFIG(avila, "Gateworks Avila"); + +/* + * Gateworks Cambria Support. + */ +static int +cambria_probe(int boardtype_hint) +{ + return cpu_is_ixp43x(); +} + +static void +cambria_init(void) +{ + /* Config the serial port. RedBoot should do the rest. */ + ubase = (u_int8_t *)(IXP425_UART0_HWBASE); + + dskinf.cs1to = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS3_OFFSET); + dskinf.cs2to = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS4_OFFSET); + dskinf.cs1 = (u_int8_t *)CAMBRIA_CFSEL0_HWBASE; + dskinf.cs2 = (u_int8_t *)CAMBRIA_CFSEL1_HWBASE; + + cf_init(); +} +BOARD_CONFIG(cambria, "Gateworks Cambria"); + +/* + * Pronghorn Metro Support. + */ +static int +pronghorn_probe(int boardtype_hint) +{ + volatile u_int32_t *cs; + /* + * Redboot only configure the chip selects that are needed, so + * use that to figure out if it is an Avila or ADI board. The + * Avila boards use CS2 and ADI does not. + */ + cs = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS2_OFFSET); + return (*cs == 0); +} + +static void +pronghorn_init(void) +{ + /* Config the serial port. RedBoot should do the rest. */ + ubase = (u_int8_t *)(IXP425_UART1_HWBASE); + + dskinf.cs1to = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS3_OFFSET); + dskinf.cs2to = (u_int32_t *)(IXP425_EXP_HWBASE + EXP_TIMING_CS4_OFFSET); + dskinf.cs1 = (u_int8_t *)IXP425_EXP_BUS_CS3_HWBASE; + dskinf.cs2 = (u_int8_t *)IXP425_EXP_BUS_CS4_HWBASE; + + cf_init(); +} +BOARD_CONFIG(pronghorn, "Pronghorn Metro"); Modified: projects/cambria/sys/boot/arm/ixp425/boot2/lib.h ============================================================================== --- projects/cambria/sys/boot/arm/ixp425/boot2/lib.h Sat Dec 13 02:53:12 2008 (r186012) +++ projects/cambria/sys/boot/arm/ixp425/boot2/lib.h Sat Dec 13 02:56:08 2008 (r186013) @@ -60,5 +60,6 @@ u_int32_t swap32(u_int32_t); const char *board_init(void); void clr_board(void); int avila_read(char*, unsigned, unsigned); +u_int cpu_id(void); #endif /* !ARM_BOOT_LIB_H */ From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 04:51:58 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 891B81065676; Sat, 13 Dec 2008 04:51:58 +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 783738FC13; Sat, 13 Dec 2008 04:51:58 +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 mBD4pwlg018996; Sat, 13 Dec 2008 04:51:58 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD4pwt9018994; Sat, 13 Dec 2008 04:51:58 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812130451.mBD4pwt9018994@svn.freebsd.org> From: Sam Leffler Date: Sat, 13 Dec 2008 04:51:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186021 - projects/cambria/tools/tools/nanobsd/gateworks X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 04:51:58 -0000 Author: sam Date: Sat Dec 13 04:51:58 2008 New Revision: 186021 URL: http://svn.freebsd.org/changeset/base/186021 Log: fix comments Modified: projects/cambria/tools/tools/nanobsd/gateworks/G2348 projects/cambria/tools/tools/nanobsd/gateworks/G2358 Modified: projects/cambria/tools/tools/nanobsd/gateworks/G2348 ============================================================================== --- projects/cambria/tools/tools/nanobsd/gateworks/G2348 Sat Dec 13 03:50:31 2008 (r186020) +++ projects/cambria/tools/tools/nanobsd/gateworks/G2348 Sat Dec 13 04:51:58 2008 (r186021) @@ -1,5 +1,5 @@ # -# Gateworks Avila XScale board +# Gateworks Avila IXP425 XScale board # kernel configuration file for FreeBSD/arm # # $FreeBSD$ Modified: projects/cambria/tools/tools/nanobsd/gateworks/G2358 ============================================================================== --- projects/cambria/tools/tools/nanobsd/gateworks/G2358 Sat Dec 13 03:50:31 2008 (r186020) +++ projects/cambria/tools/tools/nanobsd/gateworks/G2358 Sat Dec 13 04:51:58 2008 (r186021) @@ -1,5 +1,5 @@ # -# Gateworks Avila XScale board +# Gateworks Cambria IXP435 XScale board # kernel configuration file for FreeBSD/arm # # $FreeBSD$ From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 04:52:58 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C2B21065672; Sat, 13 Dec 2008 04:52:58 +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 EECD18FC0C; Sat, 13 Dec 2008 04:52:57 +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 mBD4qvkA019051; Sat, 13 Dec 2008 04:52:57 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD4qv9h019048; Sat, 13 Dec 2008 04:52:57 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812130452.mBD4qv9h019048@svn.freebsd.org> From: Sam Leffler Date: Sat, 13 Dec 2008 04:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186022 - projects/cambria/tools/tools/nanobsd/gateworks X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 04:52:58 -0000 Author: sam Date: Sat Dec 13 04:52:57 2008 New Revision: 186022 URL: http://svn.freebsd.org/changeset/base/186022 Log: move common bits to a shared file Added: projects/cambria/tools/tools/nanobsd/gateworks/common Modified: projects/cambria/tools/tools/nanobsd/gateworks/avila projects/cambria/tools/tools/nanobsd/gateworks/cambria Modified: projects/cambria/tools/tools/nanobsd/gateworks/avila ============================================================================== --- projects/cambria/tools/tools/nanobsd/gateworks/avila Sat Dec 13 04:51:58 2008 (r186021) +++ projects/cambria/tools/tools/nanobsd/gateworks/avila Sat Dec 13 04:52:57 2008 (r186022) @@ -1,351 +1,5 @@ -NANO_NAME="gateworks" +NANO_NAME="avila" NANO_SRC="/usr/sam/base/projects/cambria" NANO_KERNEL="G2348" -NANO_CFGDIR=${NANO_SRC}/${NANO_TOOLS}/${NANO_NAME}/cfg -test -d ${NANO_CFGDIR} || NANO_CFGDIR=/var/empty -NANO_PMAKE="make" # NB: disable -j 3 - -NANO_ARCH=arm -TARGET_CPUTYPE=xscale; export TARGET_CPUTYPE # XXX -TARGET_BIG_ENDIAN=true; export TARGET_BIG_ENDIAN # XXX - -NANO_IMAGES=1 -FlashDevice Sandisk 64 - -NANO_CUSTOMIZE="cust_allow_ssh_root" - -clean_usr_local() -{ - LOCAL_DIR=${NANO_WORLDDIR}/usr/local - pprint 2 "Clean and create world directory (${LOCAL_DIR})" - if rm -rf ${LOCAL_DIR}/ > /dev/null 2>&1 ; then - true - else - chflags -R noschg ${LOCAL_DIR}/ - rm -rf ${LOCAL_DIR}/ - fi - for f in bin etc lib libdata libexec sbin share; do - mkdir -p ${LOCAL_DIR}/$f - done -} -NANO_CUSTOMIZE="$NANO_CUSTOMIZE clean_usr_local" - -cust_install_machine_files() -{ - echo "cd ${NANO_TOOLS}/${NANO_NAME}/Files" - cd ${NANO_TOOLS}/${NANO_NAME}/Files - find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR} -} -NANO_CUSTOMIZE="$NANO_CUSTOMIZE cust_install_files cust_install_machine_files" - -buildenv() -{ - cd ${NANO_SRC} - env TARGET_ARCH=${NANO_ARCH} __MAKE_CONF=${NANO_MAKE_CONF} \ - DESTDIR=${NANO_WORLDDIR} make buildenv -} - -net80211_tools() -{ - for f in wlanstats wlanwds wlanwatch; do - echo "(cd tools/tools/net80211/$f; make $1)"; - done | buildenv -} -net80211_clean_tools() -{ - net80211_tools "clean" -} -net80211_build_tools() -{ - net80211_tools "" -} -net80211_install_tools() -{ - net80211_tools "install" -} -NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_clean_tools" -NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_build_tools" -NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_install_tools" - -ath_clean_tools() -{ - echo "cd tools/tools/ath; make clean" | buildenv -} -ath_build_tools() -{ - echo "cd tools/tools/ath; make" | buildenv -} -ath_install_tools() -{ - echo "cd tools/tools/ath; make install" | buildenv -} -NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_clean_tools" -NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_build_tools" -NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_install_tools" - -NANO_MAKEFS="makefs -B big \ - -o bsize=4096,fsize=512,density=8192,optimization=space" -export NANO_MAKEFS - -# NB: leave c++ enabled so devd can be built -CONF_BUILD=" -WITHOUT_ACPI=true -WITHOUT_ATM=true -WITHOUT_AUDIT=true -WITHOUT_BIND_DNSSEC=true -WITHOUT_BIND_ETC=true -WITHOUT_BIND_LIBS_LWRES=true -WITHOUT_BLUETOOTH=true -WITHOUT_CALENDAR=true -WITHOUT_CDDL=true -WITHOUT_CVS=true -WITHOUT_DICT=true -WITHOUT_EXAMPLES=true -WITHOUT_FORTRAN=true -WITHOUT_GAMES=true -WITHOUT_GCOV=true -WITHOUT_GPIB=true -WITHOUT_HTML=true -WITHOUT_I4B=true -WITHOUT_INET6=true -WITHOUT_INFO=true -WITHOUT_IPFILTER=true -WITHOUT_IPX=true -WITHOUT_KERBEROS=true -WITHOUT_LIBKSE=true -WITHOUT_LOCALES=true -WITHOUT_LPR=true -WITHOUT_MAN=true -WITHOUT_NETCAT=true -WITHOUT_NIS=true -WITHOUT_NLS=true -WITHOUT_NS_CACHING=true -WITHOUT_OBJC=true -WITHOUT_PROFILE=true -WITHOUT_RCMDS=true -WITHOUT_RCS=true -WITHOUT_RESCUE=true -WITHOUT_SENDMAIL=true -WITHOUT_SHAREDOCS=true -WITHOUT_SSP=true -WITHOUT_SYSCONS=true -WITHOUT_TCSH=true -" -CONF_INSTALL="$CONF_BUILD -WITHOUT_TOOLCHAIN=true -WITHOUT_INSTALLLIB=true -" - -# NB: override to suppress install of kernel.symbols -install_kernel() -{ - pprint 2 "install kernel" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.ik" - - cd ${NANO_SRC} - env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} installkernel \ - INSTALL_NODEBUG=true \ - DESTDIR=${NANO_WORLDDIR} \ - __MAKE_CONF=${NANO_MAKE_CONF} KERNCONF=`basename ${NANO_KERNEL}` \ - > ${MAKEOBJDIRPREFIX}/_.ik 2>&1 -} - -# NB: override to force / on s1 instead of s1a -setup_nanobsd_etc() -{ - pprint 2 "configure nanobsd /etc" - - ( - cd ${NANO_WORLDDIR} - - # create diskless marker file - touch etc/diskless - - # Make root filesystem R/O by default - echo "root_rw_mount=NO" >> etc/defaults/rc.conf - - # save config file for scripts - echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf - - echo "/dev/${NANO_DRIVE}s1 / ufs ro 1 1" > etc/fstab - echo "/dev/${NANO_DRIVE}s3 /cfg ufs rw,noauto 2 2" >> etc/fstab - mkdir -p cfg - ) -} - -create_arm_diskimage() -{ - pprint 2 "build diskimage" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.di" - - ( - echo "NANO_MEDIASIZE: $NANO_MEDIASIZE" - echo "NANO_IMAGES: $NANO_IMAGES" - echo "NANO_SECTS: $NANO_SECTS" - echo "NANO_HEADS: $NANO_HEADS" - echo "NANO_CODESIZE: $NANO_CODESIZE" - echo "NANO_CONFSIZE: $NANO_CONFSIZE" - echo "NANO_DATASIZE: $NANO_DATASIZE" - - echo $NANO_MEDIASIZE $NANO_IMAGES \ - $NANO_SECTS $NANO_HEADS \ - $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | - awk ' - { - printf "# %s\n", $0 - - # size of cylinder in sectors - cs = $3 * $4 - - # number of full cylinders on media - cyl = int ($1 / cs) - - # output fdisk geometry spec, truncate cyls to 1023 - if (cyl <= 1023) - print "g c" cyl " h" $4 " s" $3 - else - print "g c" 1023 " h" $4 " s" $3 - - if ($7 > 0) { - # size of data partition in full cylinders - dsl = int (($7 + cs - 1) / cs) - } else { - dsl = 0; - } - - # size of config partition in full cylinders - csl = int (($6 + cs - 1) / cs) - - if ($5 == 0) { - # size of image partition(s) in full cylinders - isl = int ((cyl - dsl - csl) / $2) - } else { - isl = int (($5 + cs - 1) / cs) - } - - # First image partition start at second track - print "p 1 165 " $3, isl * cs - $3 - c = isl * cs; - - # Second image partition (if any) also starts offset one - # track to keep them identical. - if ($2 > 1) { - print "p 2 165 " $3 + c, isl * cs - $3 - c += isl * cs; - } - - # Config partition starts at cylinder boundary. - print "p 3 165 " c, csl * cs - c += csl * cs - - # Data partition (if any) starts at cylinder boundary. - if ($7 > 0) { - print "p 4 165 " c, dsl * cs - } else if ($7 < 0 && $1 > c) { - print "p 4 165 " c, $1 - c - } else if ($1 < c) { - print "Disk space overcommitted by", \ - c - $1, "sectors" > "/dev/stderr" - exit 2 - } - - # Force slice 1 to be marked active. This is necessary - # for booting the image from a USB device to work. - print "a 1" - } - ' > ${MAKEOBJDIRPREFIX}/_.fdisk - - IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} - BS=${NANO_SECTS}b - - if [ "${NANO_MD_BACKING}" = "swap" ] ; then - MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` - else - echo ""; echo "Creating md backing file ${IMG} ..." - _c=`expr ${NANO_MEDIASIZE} / ${NANO_SECTS}` - pprint 2 "dd if=/dev/zero of=${IMG} bs=${BS} count=${_c}" - dd if=/dev/zero of=${IMG} bs=${BS} count=${_c} - pprint 2 "mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} -y ${NANO_HEADS}" - MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` - fi - - trap "mdconfig -d -u $MD" 1 2 15 EXIT - - echo ""; echo "Write partition table ..." - FDISK=${MAKEOBJDIRPREFIX}/_.fdisk - pprint 2 "fdisk -i -f ${FDISK} ${MD}" - fdisk -i -f ${FDISK} ${MD} - pprint 2 "fdisk ${MD}" - fdisk ${MD} - - # Create first image - IMG1=${NANO_DISKIMGDIR}/_.disk.image1 - echo ""; echo "Create first image ${IMG1} ..." - SIZE=`awk '/^p 1/ { print $5 "b" }' ${FDISK}` - pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR}" - ${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR} - pprint 2 "dd if=${IMG1} of=/dev/${MD}s1 bs=${BS}" - dd if=${IMG1} of=/dev/${MD}s1 bs=${BS} - - if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then - IMG2=${NANO_DISKIMGDIR}/_.disk.image2 - echo ""; echo "Create second image ${IMG2}..." - for f in ${NANO_WORLDDIR}/etc/fstab ${NANO_WORLDDIR}/conf/base/etc/fstab - do - sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/g" $f - done - - SIZE=`awk '/^p 2/ { print $5 "b" }' ${FDISK}` - pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${IMG2} ${NANO_WORLDDIR}" - ${NANO_MAKEFS} -s ${SIZE} ${IMG2} ${NANO_WORLDDIR} - pprint 2 "dd if=${IMG2} of=/dev/${MD}s2 bs=${BS}" - dd if=${IMG2} of=/dev/${MD}s2 bs=${BS} - fi - - # Create Config slice - CFG=${NANO_DISKIMGDIR}/_.disk.cfg - echo ""; echo "Creating config partition ${CFG}..." - SIZE=`awk '/^p 3/ { print $5 "b" }' ${FDISK}` - # XXX: fill from where ? - pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${CFG} ${NANO_CFGDIR}" - ${NANO_MAKEFS} -s ${SIZE} ${CFG} ${NANO_CFGDIR} - pprint 2 "dd if=${CFG} of=/dev/${MD}s3 bs=${BS}" - dd if=${CFG} of=/dev/${MD}s3 bs=${BS} - pprint 2 "rm ${CFG}" - rm ${CFG}; CFG= # NB: disable printing below - - # Create Data slice, if any. - if [ $NANO_DATASIZE -gt 0 ] ; then - DATA=${NANO_DISKIMGDIR}/_.disk.data - echo ""; echo "Creating data partition ${DATA}..." - SIZE=`awk '/^p 4/ { print $5 "b" }' ${FDISK}` - # XXX: fill from where ? - pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${DATA} /var/empty" - ${NANO_MAKEFS} -s ${SIZE} ${DATA} /var/empty - pprint 2 "dd if=${DATA} of=/dev/${MD}s4 bs=${BS}" - dd if=${DATA} of=/dev/${MD}s4 bs=${BS} - pprint 2 "rm ${DATA}" - rm ${DATA}; DATA= # NB: disable printing below - fi - - if [ "${NANO_MD_BACKING}" = "swap" ] ; then - echo "Writing out _.disk.full..." - dd if=/dev/${MD} of=${IMG} bs=${BS} - fi - - echo "" - echo "Completed images in:" - echo "" - echo "Full disk: ${IMG}" - echo "Primary partition: ${IMG1}" - test "${IMG2}" && echo "2ndary partition: ${IMG2}" - test "${CFG}" && echo "/cfg partition: ${CFG}" - test "${DATA}" && echo "/data partition: ${DATA}" - echo "" - echo "Use dd if= of=/dev/ bs=${BS} to transfer an" - echo "image to bootable media /dev/." - ) > ${MAKEOBJDIRPREFIX}/_.di 2>&1 -} +. common Modified: projects/cambria/tools/tools/nanobsd/gateworks/cambria ============================================================================== --- projects/cambria/tools/tools/nanobsd/gateworks/cambria Sat Dec 13 04:51:58 2008 (r186021) +++ projects/cambria/tools/tools/nanobsd/gateworks/cambria Sat Dec 13 04:52:57 2008 (r186022) @@ -2,350 +2,4 @@ NANO_NAME="cambria" NANO_SRC="/usr/sam/base/projects/cambria" NANO_KERNEL="G2358" -NANO_CFGDIR=${NANO_SRC}/${NANO_TOOLS}/gateworks/cfg -test -d ${NANO_CFGDIR} || NANO_CFGDIR=/var/empty -NANO_PMAKE="make" # NB: disable -j 3 - -NANO_ARCH=arm -TARGET_CPUTYPE=xscale; export TARGET_CPUTYPE # XXX -TARGET_BIG_ENDIAN=true; export TARGET_BIG_ENDIAN # XXX - -NANO_IMAGES=1 -FlashDevice Sandisk 64 - -NANO_CUSTOMIZE="cust_allow_ssh_root" - -clean_usr_local() -{ - LOCAL_DIR=${NANO_WORLDDIR}/usr/local - pprint 2 "Clean and create world directory (${LOCAL_DIR})" - if rm -rf ${LOCAL_DIR}/ > /dev/null 2>&1 ; then - true - else - chflags -R noschg ${LOCAL_DIR}/ - rm -rf ${LOCAL_DIR}/ - fi - for f in bin etc lib libdata libexec sbin share; do - mkdir -p ${LOCAL_DIR}/$f - done -} -NANO_CUSTOMIZE="$NANO_CUSTOMIZE clean_usr_local" - -cust_install_machine_files() -{ - echo "cd ${NANO_TOOLS}/gateworks/Files" - cd ${NANO_TOOLS}/gateworks/Files - find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR} -} -NANO_CUSTOMIZE="$NANO_CUSTOMIZE cust_install_files cust_install_machine_files" - -buildenv() -{ - cd ${NANO_SRC} - env TARGET_ARCH=${NANO_ARCH} __MAKE_CONF=${NANO_MAKE_CONF} \ - DESTDIR=${NANO_WORLDDIR} make buildenv -} - -net80211_tools() -{ - for f in wlanstats wlanwds wlanwatch; do - echo "(cd tools/tools/net80211/$f; make $1)"; - done | buildenv -} -net80211_clean_tools() -{ - net80211_tools "clean" -} -net80211_build_tools() -{ - net80211_tools "" -} -net80211_install_tools() -{ - net80211_tools "install" -} -NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_clean_tools" -NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_build_tools" -NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_install_tools" - -ath_clean_tools() -{ - echo "cd tools/tools/ath; make clean" | buildenv -} -ath_build_tools() -{ - echo "cd tools/tools/ath; make" | buildenv -} -ath_install_tools() -{ - echo "cd tools/tools/ath; make install" | buildenv -} -NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_clean_tools" -NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_build_tools" -NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_install_tools" - -NANO_MAKEFS="makefs -B big \ - -o bsize=4096,fsize=512,density=8192,optimization=space" -export NANO_MAKEFS - -# NB: leave c++ enabled so devd can be built -CONF_BUILD=" -WITHOUT_ACPI=true -WITHOUT_ATM=true -WITHOUT_AUDIT=true -WITHOUT_BIND_DNSSEC=true -WITHOUT_BIND_ETC=true -WITHOUT_BIND_LIBS_LWRES=true -WITHOUT_BLUETOOTH=true -WITHOUT_CALENDAR=true -WITHOUT_CDDL=true -WITHOUT_CVS=true -WITHOUT_DICT=true -WITHOUT_EXAMPLES=true -WITHOUT_FORTRAN=true -WITHOUT_GAMES=true -WITHOUT_GCOV=true -WITHOUT_GPIB=true -WITHOUT_HTML=true -WITHOUT_I4B=true -WITHOUT_INET6=true -WITHOUT_INFO=true -WITHOUT_IPFILTER=true -WITHOUT_IPX=true -WITHOUT_KERBEROS=true -WITHOUT_LIBKSE=true -WITHOUT_LOCALES=true -WITHOUT_LPR=true -WITHOUT_MAN=true -WITHOUT_NETCAT=true -WITHOUT_NIS=true -WITHOUT_NLS=true -WITHOUT_NS_CACHING=true -WITHOUT_OBJC=true -WITHOUT_PROFILE=true -WITHOUT_RCMDS=true -WITHOUT_RCS=true -WITHOUT_RESCUE=true -WITHOUT_SENDMAIL=true -WITHOUT_SHAREDOCS=true -WITHOUT_SSP=true -WITHOUT_SYSCONS=true -WITHOUT_TCSH=true -" -CONF_INSTALL="$CONF_BUILD -WITHOUT_TOOLCHAIN=true -WITHOUT_INSTALLLIB=true -" - -# NB: override to suppress install of kernel.symbols -install_kernel() -{ - pprint 2 "install kernel" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.ik" - - cd ${NANO_SRC} - env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} installkernel \ - INSTALL_NODEBUG=true \ - DESTDIR=${NANO_WORLDDIR} \ - __MAKE_CONF=${NANO_MAKE_CONF} KERNCONF=`basename ${NANO_KERNEL}` \ - > ${MAKEOBJDIRPREFIX}/_.ik 2>&1 -} - -# NB: override to force / on s1 instead of s1a -setup_nanobsd_etc() -{ - pprint 2 "configure nanobsd /etc" - - ( - cd ${NANO_WORLDDIR} - - # create diskless marker file - touch etc/diskless - - # Make root filesystem R/O by default - echo "root_rw_mount=NO" >> etc/defaults/rc.conf - - # save config file for scripts - echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf - - echo "/dev/${NANO_DRIVE}s1 / ufs ro 1 1" > etc/fstab - echo "/dev/${NANO_DRIVE}s3 /cfg ufs rw,noauto 2 2" >> etc/fstab - mkdir -p cfg - ) -} - -create_arm_diskimage() -{ - pprint 2 "build diskimage" - pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.di" - - ( - echo "NANO_MEDIASIZE: $NANO_MEDIASIZE" - echo "NANO_IMAGES: $NANO_IMAGES" - echo "NANO_SECTS: $NANO_SECTS" - echo "NANO_HEADS: $NANO_HEADS" - echo "NANO_CODESIZE: $NANO_CODESIZE" - echo "NANO_CONFSIZE: $NANO_CONFSIZE" - echo "NANO_DATASIZE: $NANO_DATASIZE" - - echo $NANO_MEDIASIZE $NANO_IMAGES \ - $NANO_SECTS $NANO_HEADS \ - $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | - awk ' - { - printf "# %s\n", $0 - - # size of cylinder in sectors - cs = $3 * $4 - - # number of full cylinders on media - cyl = int ($1 / cs) - - # output fdisk geometry spec, truncate cyls to 1023 - if (cyl <= 1023) - print "g c" cyl " h" $4 " s" $3 - else - print "g c" 1023 " h" $4 " s" $3 - - if ($7 > 0) { - # size of data partition in full cylinders - dsl = int (($7 + cs - 1) / cs) - } else { - dsl = 0; - } - - # size of config partition in full cylinders - csl = int (($6 + cs - 1) / cs) - - if ($5 == 0) { - # size of image partition(s) in full cylinders - isl = int ((cyl - dsl - csl) / $2) - } else { - isl = int (($5 + cs - 1) / cs) - } - - # First image partition start at second track - print "p 1 165 " $3, isl * cs - $3 - c = isl * cs; - - # Second image partition (if any) also starts offset one - # track to keep them identical. - if ($2 > 1) { - print "p 2 165 " $3 + c, isl * cs - $3 - c += isl * cs; - } - - # Config partition starts at cylinder boundary. - print "p 3 165 " c, csl * cs - c += csl * cs - - # Data partition (if any) starts at cylinder boundary. - if ($7 > 0) { - print "p 4 165 " c, dsl * cs - } else if ($7 < 0 && $1 > c) { - print "p 4 165 " c, $1 - c - } else if ($1 < c) { - print "Disk space overcommitted by", \ - c - $1, "sectors" > "/dev/stderr" - exit 2 - } - - # Force slice 1 to be marked active. This is necessary - # for booting the image from a USB device to work. - print "a 1" - } - ' > ${MAKEOBJDIRPREFIX}/_.fdisk - - IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} - BS=${NANO_SECTS}b - - if [ "${NANO_MD_BACKING}" = "swap" ] ; then - MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` - else - echo ""; echo "Creating md backing file ${IMG} ..." - _c=`expr ${NANO_MEDIASIZE} / ${NANO_SECTS}` - pprint 2 "dd if=/dev/zero of=${IMG} bs=${BS} count=${_c}" - dd if=/dev/zero of=${IMG} bs=${BS} count=${_c} - pprint 2 "mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} -y ${NANO_HEADS}" - MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` - fi - - trap "mdconfig -d -u $MD" 1 2 15 EXIT - - echo ""; echo "Write partition table ..." - FDISK=${MAKEOBJDIRPREFIX}/_.fdisk - pprint 2 "fdisk -i -f ${FDISK} ${MD}" - fdisk -i -f ${FDISK} ${MD} - pprint 2 "fdisk ${MD}" - fdisk ${MD} - - # Create first image - IMG1=${NANO_DISKIMGDIR}/_.disk.image1 - echo ""; echo "Create first image ${IMG1} ..." - SIZE=`awk '/^p 1/ { print $5 "b" }' ${FDISK}` - pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR}" - ${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR} - pprint 2 "dd if=${IMG1} of=/dev/${MD}s1 bs=${BS}" - dd if=${IMG1} of=/dev/${MD}s1 bs=${BS} - - if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then - IMG2=${NANO_DISKIMGDIR}/_.disk.image2 - echo ""; echo "Create second image ${IMG2}..." - for f in ${NANO_WORLDDIR}/etc/fstab ${NANO_WORLDDIR}/conf/base/etc/fstab - do - sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/g" $f - done - - SIZE=`awk '/^p 2/ { print $5 "b" }' ${FDISK}` - pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${IMG2} ${NANO_WORLDDIR}" - ${NANO_MAKEFS} -s ${SIZE} ${IMG2} ${NANO_WORLDDIR} - pprint 2 "dd if=${IMG2} of=/dev/${MD}s2 bs=${BS}" - dd if=${IMG2} of=/dev/${MD}s2 bs=${BS} - fi - - # Create Config slice - CFG=${NANO_DISKIMGDIR}/_.disk.cfg - echo ""; echo "Creating config partition ${CFG}..." - SIZE=`awk '/^p 3/ { print $5 "b" }' ${FDISK}` - # XXX: fill from where ? - pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${CFG} ${NANO_CFGDIR}" - ${NANO_MAKEFS} -s ${SIZE} ${CFG} ${NANO_CFGDIR} - pprint 2 "dd if=${CFG} of=/dev/${MD}s3 bs=${BS}" - dd if=${CFG} of=/dev/${MD}s3 bs=${BS} - pprint 2 "rm ${CFG}" - rm ${CFG}; CFG= # NB: disable printing below - - # Create Data slice, if any. - if [ $NANO_DATASIZE -gt 0 ] ; then - DATA=${NANO_DISKIMGDIR}/_.disk.data - echo ""; echo "Creating data partition ${DATA}..." - SIZE=`awk '/^p 4/ { print $5 "b" }' ${FDISK}` - # XXX: fill from where ? - pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${DATA} /var/empty" - ${NANO_MAKEFS} -s ${SIZE} ${DATA} /var/empty - pprint 2 "dd if=${DATA} of=/dev/${MD}s4 bs=${BS}" - dd if=${DATA} of=/dev/${MD}s4 bs=${BS} - pprint 2 "rm ${DATA}" - rm ${DATA}; DATA= # NB: disable printing below - fi - - if [ "${NANO_MD_BACKING}" = "swap" ] ; then - echo "Writing out _.disk.full..." - dd if=/dev/${MD} of=${IMG} bs=${BS} - fi - - echo "" - echo "Completed images in:" - echo "" - echo "Full disk: ${IMG}" - echo "Primary partition: ${IMG1}" - test "${IMG2}" && echo "2ndary partition: ${IMG2}" - test "${CFG}" && echo "/cfg partition: ${CFG}" - test "${DATA}" && echo "/data partition: ${DATA}" - echo "" - echo "Use dd if= of=/dev/ bs=${BS} to transfer an" - echo "image to bootable media /dev/." - ) > ${MAKEOBJDIRPREFIX}/_.di 2>&1 -} +. common Added: projects/cambria/tools/tools/nanobsd/gateworks/common ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/cambria/tools/tools/nanobsd/gateworks/common Sat Dec 13 04:52:57 2008 (r186022) @@ -0,0 +1,347 @@ +NANO_CFGDIR=${NANO_SRC}/${NANO_TOOLS}/gateworks/cfg +test -d ${NANO_CFGDIR} || NANO_CFGDIR=/var/empty +NANO_PMAKE="make" # NB: disable -j 3 + +NANO_ARCH=arm +TARGET_CPUTYPE=xscale; export TARGET_CPUTYPE # XXX +TARGET_BIG_ENDIAN=true; export TARGET_BIG_ENDIAN # XXX + +NANO_IMAGES=1 +FlashDevice Sandisk 64 + +NANO_CUSTOMIZE="cust_allow_ssh_root" + +clean_usr_local() +{ + LOCAL_DIR=${NANO_WORLDDIR}/usr/local + pprint 2 "Clean and create world directory (${LOCAL_DIR})" + if rm -rf ${LOCAL_DIR}/ > /dev/null 2>&1 ; then + true + else + chflags -R noschg ${LOCAL_DIR}/ + rm -rf ${LOCAL_DIR}/ + fi + for f in bin etc lib libdata libexec sbin share; do + mkdir -p ${LOCAL_DIR}/$f + done +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE clean_usr_local" + +cust_install_machine_files() +{ + echo "cd ${NANO_TOOLS}/gateworks/Files" + cd ${NANO_TOOLS}/gateworks/Files + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR} +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE cust_install_files cust_install_machine_files" + +buildenv() +{ + cd ${NANO_SRC} + env TARGET_ARCH=${NANO_ARCH} __MAKE_CONF=${NANO_MAKE_CONF} \ + DESTDIR=${NANO_WORLDDIR} make buildenv +} + +net80211_tools() +{ + for f in wlanstats wlanwds wlanwatch; do + echo "(cd tools/tools/net80211/$f; make $1)"; + done | buildenv +} +net80211_clean_tools() +{ + net80211_tools "clean" +} +net80211_build_tools() +{ + net80211_tools "" +} +net80211_install_tools() +{ + net80211_tools "install" +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_clean_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_build_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE net80211_install_tools" + +ath_clean_tools() +{ + echo "cd tools/tools/ath; make clean" | buildenv +} +ath_build_tools() +{ + echo "cd tools/tools/ath; make" | buildenv +} +ath_install_tools() +{ + echo "cd tools/tools/ath; make install" | buildenv +} +NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_clean_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_build_tools" +NANO_CUSTOMIZE="$NANO_CUSTOMIZE ath_install_tools" + +NANO_MAKEFS="makefs -B big \ + -o bsize=4096,fsize=512,density=8192,optimization=space" +export NANO_MAKEFS + +# NB: leave c++ enabled so devd can be built +CONF_BUILD=" +WITHOUT_ACPI=true +WITHOUT_ATM=true +WITHOUT_AUDIT=true +WITHOUT_BIND_DNSSEC=true +WITHOUT_BIND_ETC=true +WITHOUT_BIND_LIBS_LWRES=true +WITHOUT_BLUETOOTH=true +WITHOUT_CALENDAR=true +WITHOUT_CDDL=true +WITHOUT_CVS=true +WITHOUT_DICT=true +WITHOUT_EXAMPLES=true +WITHOUT_FORTRAN=true +WITHOUT_GAMES=true +WITHOUT_GCOV=true +WITHOUT_GPIB=true +WITHOUT_HTML=true +WITHOUT_I4B=true +WITHOUT_INET6=true +WITHOUT_INFO=true +WITHOUT_IPFILTER=true +WITHOUT_IPX=true +WITHOUT_KERBEROS=true +WITHOUT_LIBKSE=true +WITHOUT_LOCALES=true +WITHOUT_LPR=true +WITHOUT_MAN=true +WITHOUT_NETCAT=true +WITHOUT_NIS=true +WITHOUT_NLS=true +WITHOUT_NS_CACHING=true +WITHOUT_OBJC=true +WITHOUT_PROFILE=true +WITHOUT_RCMDS=true +WITHOUT_RCS=true +WITHOUT_RESCUE=true +WITHOUT_SENDMAIL=true +WITHOUT_SHAREDOCS=true +WITHOUT_SSP=true +WITHOUT_SYSCONS=true +WITHOUT_TCSH=true +" +CONF_INSTALL="$CONF_BUILD +WITHOUT_TOOLCHAIN=true +WITHOUT_INSTALLLIB=true +" + +# NB: override to suppress install of kernel.symbols +install_kernel() +{ + pprint 2 "install kernel" + pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.ik" + + cd ${NANO_SRC} + env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} installkernel \ + INSTALL_NODEBUG=true \ + DESTDIR=${NANO_WORLDDIR} \ + __MAKE_CONF=${NANO_MAKE_CONF} KERNCONF=`basename ${NANO_KERNEL}` \ + > ${MAKEOBJDIRPREFIX}/_.ik 2>&1 +} + +# NB: override to force / on s1 instead of s1a +setup_nanobsd_etc() +{ + pprint 2 "configure nanobsd /etc" + + ( + cd ${NANO_WORLDDIR} + + # create diskless marker file + touch etc/diskless + + # Make root filesystem R/O by default + echo "root_rw_mount=NO" >> etc/defaults/rc.conf + + # save config file for scripts + echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf + + echo "/dev/${NANO_DRIVE}s1 / ufs ro 1 1" > etc/fstab + echo "/dev/${NANO_DRIVE}s3 /cfg ufs rw,noauto 2 2" >> etc/fstab + mkdir -p cfg + ) +} + +create_arm_diskimage() +{ + pprint 2 "build diskimage" + pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.di" + + ( + echo "NANO_MEDIASIZE: $NANO_MEDIASIZE" + echo "NANO_IMAGES: $NANO_IMAGES" + echo "NANO_SECTS: $NANO_SECTS" + echo "NANO_HEADS: $NANO_HEADS" + echo "NANO_CODESIZE: $NANO_CODESIZE" + echo "NANO_CONFSIZE: $NANO_CONFSIZE" + echo "NANO_DATASIZE: $NANO_DATASIZE" + + echo $NANO_MEDIASIZE $NANO_IMAGES \ + $NANO_SECTS $NANO_HEADS \ + $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | + awk ' + { + printf "# %s\n", $0 + + # size of cylinder in sectors + cs = $3 * $4 + + # number of full cylinders on media + cyl = int ($1 / cs) + + # output fdisk geometry spec, truncate cyls to 1023 + if (cyl <= 1023) + print "g c" cyl " h" $4 " s" $3 + else + print "g c" 1023 " h" $4 " s" $3 + + if ($7 > 0) { + # size of data partition in full cylinders + dsl = int (($7 + cs - 1) / cs) + } else { + dsl = 0; + } + + # size of config partition in full cylinders + csl = int (($6 + cs - 1) / cs) + + if ($5 == 0) { + # size of image partition(s) in full cylinders + isl = int ((cyl - dsl - csl) / $2) + } else { + isl = int (($5 + cs - 1) / cs) + } + + # First image partition start at second track + print "p 1 165 " $3, isl * cs - $3 + c = isl * cs; + + # Second image partition (if any) also starts offset one + # track to keep them identical. + if ($2 > 1) { + print "p 2 165 " $3 + c, isl * cs - $3 + c += isl * cs; + } + + # Config partition starts at cylinder boundary. + print "p 3 165 " c, csl * cs + c += csl * cs + + # Data partition (if any) starts at cylinder boundary. + if ($7 > 0) { + print "p 4 165 " c, dsl * cs + } else if ($7 < 0 && $1 > c) { + print "p 4 165 " c, $1 - c + } else if ($1 < c) { + print "Disk space overcommitted by", \ + c - $1, "sectors" > "/dev/stderr" + exit 2 + } + + # Force slice 1 to be marked active. This is necessary + # for booting the image from a USB device to work. + print "a 1" + } + ' > ${MAKEOBJDIRPREFIX}/_.fdisk + + IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} + BS=${NANO_SECTS}b + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + else + echo ""; echo "Creating md backing file ${IMG} ..." + _c=`expr ${NANO_MEDIASIZE} / ${NANO_SECTS}` + pprint 2 "dd if=/dev/zero of=${IMG} bs=${BS} count=${_c}" + dd if=/dev/zero of=${IMG} bs=${BS} count=${_c} + pprint 2 "mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} -y ${NANO_HEADS}" + MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + fi + + trap "mdconfig -d -u $MD" 1 2 15 EXIT + + echo ""; echo "Write partition table ..." + FDISK=${MAKEOBJDIRPREFIX}/_.fdisk + pprint 2 "fdisk -i -f ${FDISK} ${MD}" + fdisk -i -f ${FDISK} ${MD} + pprint 2 "fdisk ${MD}" + fdisk ${MD} + + # Create first image + IMG1=${NANO_DISKIMGDIR}/_.disk.image1 + echo ""; echo "Create first image ${IMG1} ..." + SIZE=`awk '/^p 1/ { print $5 "b" }' ${FDISK}` + pprint 2 "${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR}" + ${NANO_MAKEFS} -s ${SIZE} ${IMG1} ${NANO_WORLDDIR} + pprint 2 "dd if=${IMG1} of=/dev/${MD}s1 bs=${BS}" + dd if=${IMG1} of=/dev/${MD}s1 bs=${BS} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 05:28:20 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C5111065672; Sat, 13 Dec 2008 05:28:20 +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 2C58F8FC17; Sat, 13 Dec 2008 05:28:20 +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 mBD5SKtG019697; Sat, 13 Dec 2008 05:28:20 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD5SKmZ019695; Sat, 13 Dec 2008 05:28:20 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812130528.mBD5SKmZ019695@svn.freebsd.org> From: Kip Macy Date: Sat, 13 Dec 2008 05:28:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186023 - projects/arpv2_merge_1/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 05:28:20 -0000 Author: kmacy Date: Sat Dec 13 05:28:19 2008 New Revision: 186023 URL: http://svn.freebsd.org/changeset/base/186023 Log: check lle against both NULL AND -1 to determine validity Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c projects/arpv2_merge_1/sys/net/if_llatbl.h Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.c Sat Dec 13 04:52:57 2008 (r186022) +++ projects/arpv2_merge_1/sys/net/if_llatbl.c Sat Dec 13 05:28:19 2008 (r186023) @@ -255,7 +255,7 @@ lla_rt_output(struct rt_msghdr *rtm, str IF_AFDATA_LOCK(ifp); lle = lla_lookup(llt, flags, dst); IF_AFDATA_UNLOCK(ifp); - if (lle != NULL) { + if (LLE_IS_VALID(lle)) { if (flags & LLE_CREATE) { /* * If we delay the delete, then a subsequent Modified: projects/arpv2_merge_1/sys/net/if_llatbl.h ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.h Sat Dec 13 04:52:57 2008 (r186022) +++ projects/arpv2_merge_1/sys/net/if_llatbl.h Sat Dec 13 05:28:19 2008 (r186023) @@ -83,6 +83,8 @@ struct llentry { #define LLE_LOCK_INIT(lle) rw_init_flags(&(lle)->lle_lock, "lle", RW_DUPOK) #define LLE_WLOCK_ASSERT(lle) rw_assert(&(lle)->lle_lock, RA_WLOCKED) +#define LLE_IS_VALID(lle) (((lle) != NULL) && ((lle) != (void *)-1)) + #define LLE_ADDREF(lle) do { \ LLE_WLOCK_ASSERT(lle); \ KASSERT((lle)->lle_refcnt >= 0, \ From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 05:35:21 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 912261065673; Sat, 13 Dec 2008 05:35:21 +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 815448FC17; Sat, 13 Dec 2008 05:35:21 +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 mBD5ZL4B019909; Sat, 13 Dec 2008 05:35:21 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD5ZL0I019908; Sat, 13 Dec 2008 05:35:21 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812130535.mBD5ZL0I019908@svn.freebsd.org> From: Kip Macy Date: Sat, 13 Dec 2008 05:35:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186024 - projects/arpv2_merge_1/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 05:35:21 -0000 Author: kmacy Date: Sat Dec 13 05:35:21 2008 New Revision: 186024 URL: http://svn.freebsd.org/changeset/base/186024 Log: only return EINVAL if the LLE requested for delete was not found Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.c Sat Dec 13 05:28:19 2008 (r186023) +++ projects/arpv2_merge_1/sys/net/if_llatbl.c Sat Dec 13 05:35:21 2008 (r186024) @@ -300,10 +300,9 @@ lla_rt_output(struct rt_msghdr *rtm, str else LLE_RUNLOCK(lle); } - } else { - if (flags & LLE_DELETE) - error = EINVAL; - } + } else if ((lle == NULL) && (flags & LLE_DELETE)) + error = EINVAL; + return (error); } From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 06:01:55 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25760106564A; Sat, 13 Dec 2008 06:01:55 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15D5C8FC1A; Sat, 13 Dec 2008 06:01:55 +0000 (UTC) (envelope-from qingli@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 mBD61tUX020439; Sat, 13 Dec 2008 06:01:55 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD61tGY020438; Sat, 13 Dec 2008 06:01:55 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200812130601.mBD61tGY020438@svn.freebsd.org> From: Qing Li Date: Sat, 13 Dec 2008 06:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186025 - projects/arpv2_merge_1/usr.sbin/arp X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 06:01:55 -0000 Author: qingli Date: Sat Dec 13 06:01:54 2008 New Revision: 186025 URL: http://svn.freebsd.org/changeset/base/186025 Log: Removing code block that no longer applies and add a comment block for a reminder the kernel needs to address ECMP group. Modified: projects/arpv2_merge_1/usr.sbin/arp/arp.c Modified: projects/arpv2_merge_1/usr.sbin/arp/arp.c ============================================================================== --- projects/arpv2_merge_1/usr.sbin/arp/arp.c Sat Dec 13 05:35:21 2008 (r186024) +++ projects/arpv2_merge_1/usr.sbin/arp/arp.c Sat Dec 13 06:01:54 2008 (r186025) @@ -425,25 +425,39 @@ delete(char *host, int do_proxy) struct sockaddr_inarp *addr, *dst; struct rt_msghdr *rtm; struct sockaddr_dl *sdl; + struct sockaddr_dl sdl_m; dst = getaddr(host); if (dst == NULL) return (1); dst->sin_other = do_proxy; + + /* + * setup the data structure to notify the kernel + * it is the ARP entry the RTM_GET is interested + * in + */ + bzero(&sdl_m, sizeof(sdl_m)); + sdl_m.sdl_len = sizeof(sdl_m); + sdl_m.sdl_family = AF_LINK; + for (;;) { /* try twice */ - rtm = rtmsg(RTM_GET, dst, NULL); + rtm = rtmsg(RTM_GET, dst, &sdl_m); if (rtm == NULL) { warn("%s", host); return (1); } addr = (struct sockaddr_inarp *)(rtm + 1); sdl = (struct sockaddr_dl *)(SA_SIZE(addr) + (char *)addr); - if (addr->sin_addr.s_addr == dst->sin_addr.s_addr && - sdl->sdl_family == AF_LINK && - !(rtm->rtm_flags & RTF_GATEWAY) && - valid_type(sdl->sdl_type) ) - break; /* found it */ + /* + * With the new L2/L3 restructure, the route + * returned is a prefix route. The important + * piece of information from the previous + * RTM_GET is the interface index. In the + * case of ECMP, the kernel will traverse + * the route group for the given entry. + */ if (sdl->sdl_family == AF_LINK && !(rtm->rtm_flags & RTF_GATEWAY) && valid_type(sdl->sdl_type) ) { From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 06:41:25 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA3EE1065670; Sat, 13 Dec 2008 06:41:25 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B0218FC0C; Sat, 13 Dec 2008 06:41:25 +0000 (UTC) (envelope-from qingli@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 mBD6fPOv021317; Sat, 13 Dec 2008 06:41:25 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD6fPtk021315; Sat, 13 Dec 2008 06:41:25 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200812130641.mBD6fPtk021315@svn.freebsd.org> From: Qing Li Date: Sat, 13 Dec 2008 06:41:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186027 - projects/arpv2_merge_1/sys/netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 06:41:25 -0000 Author: qingli Date: Sat Dec 13 06:41:25 2008 New Revision: 186027 URL: http://svn.freebsd.org/changeset/base/186027 Log: remove marker Modified: projects/arpv2_merge_1/sys/netinet6/in6.c projects/arpv2_merge_1/sys/netinet6/nd6.c Modified: projects/arpv2_merge_1/sys/netinet6/in6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6.c Sat Dec 13 06:04:34 2008 (r186026) +++ projects/arpv2_merge_1/sys/netinet6/in6.c Sat Dec 13 06:41:25 2008 (r186027) @@ -2207,9 +2207,9 @@ in6_lltable_lookup(struct lltable *llt, #ifdef INVARIANTS log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); #endif - lle = NULL; + lle = (void *)-1; } - if (lle) { + if (lle != NULL && lle != (void *)-1) { if (flags & LLE_EXCLUSIVE) LLE_WLOCK(lle); else Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6.c Sat Dec 13 06:04:34 2008 (r186026) +++ projects/arpv2_merge_1/sys/netinet6/nd6.c Sat Dec 13 06:41:25 2008 (r186027) @@ -857,7 +857,7 @@ nd6_purge(struct ifnet *ifp) */ } -/* Qing +/* * the caller acquires and releases the lock on the lltbls * Returns the llentry locked */ From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 06:50:52 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F9CC1065673; Sat, 13 Dec 2008 06:50:52 +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 60AC08FC16; Sat, 13 Dec 2008 06:50:52 +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 mBD6oqWF021529; Sat, 13 Dec 2008 06:50:52 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD6oqsu021528; Sat, 13 Dec 2008 06:50:52 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812130650.mBD6oqsu021528@svn.freebsd.org> From: Kip Macy Date: Sat, 13 Dec 2008 06:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186028 - projects/arpv2_merge_1/sys/netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 06:50:52 -0000 Author: kmacy Date: Sat Dec 13 06:50:52 2008 New Revision: 186028 URL: http://svn.freebsd.org/changeset/base/186028 Log: clarify unlock condition Modified: projects/arpv2_merge_1/sys/netinet6/in6.c Modified: projects/arpv2_merge_1/sys/netinet6/in6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6.c Sat Dec 13 06:41:25 2008 (r186027) +++ projects/arpv2_merge_1/sys/netinet6/in6.c Sat Dec 13 06:50:52 2008 (r186028) @@ -2204,12 +2204,12 @@ in6_lltable_lookup(struct lltable *llt, LLE_WLOCK(lle); lle->la_flags = LLE_DELETED; LLE_WUNLOCK(lle); -#ifdef INVARIANTS +#ifdef DIAGNOSTICS log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); #endif lle = (void *)-1; } - if (lle != NULL && lle != (void *)-1) { + if (LLE_IS_VALID(lle)) { if (flags & LLE_EXCLUSIVE) LLE_WLOCK(lle); else From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 07:03:17 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 380EF106567F; Sat, 13 Dec 2008 07:03:17 +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 284568FC26; Sat, 13 Dec 2008 07:03:17 +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 mBD73HWO021813; Sat, 13 Dec 2008 07:03:17 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD73HGn021812; Sat, 13 Dec 2008 07:03:17 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812130703.mBD73HGn021812@svn.freebsd.org> From: Kip Macy Date: Sat, 13 Dec 2008 07:03:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186029 - projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 07:03:17 -0000 Author: kmacy Date: Sat Dec 13 07:03:16 2008 New Revision: 186029 URL: http://svn.freebsd.org/changeset/base/186029 Log: Traversing the routing table is no longer necessary for "discovering" new ARP entries. We can now obtain all arp entries by way of the sysctl. Simplify the RTM_{GET,ADD} code to reflect this. Modified: projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII.c Modified: projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII.c Sat Dec 13 06:50:52 2008 (r186028) +++ projects/arpv2_merge_1/contrib/bsnmp/snmp_mibII/mibII.c Sat Dec 13 07:03:16 2008 (r186029) @@ -48,15 +48,8 @@ static void *route_fd; /* if-index allocator */ static uint32_t next_if_index = 1; -#if 0 -/* - * XXX - Qing - * - */ -/* re-fetch arp table */ -static int update_arp; +/* currently fetching the arp table */ static int in_update_arp; -#endif /* OR registrations */ static u_int ifmib_reg; @@ -916,39 +909,6 @@ mib_find_ifa(struct in_addr addr) return (NULL); } -#if 0 -/* - * Qing -- fix - * Process a new ARP entry - */ - -static void -process_arp(const struct rt_msghdr *rtm, const struct sockaddr_dl *sdl, - const struct sockaddr_in *sa) -{ - struct mibif *ifp; - struct mibarp *at; - - /* IP arp table entry */ - if (sdl->sdl_alen == 0) { - update_arp = 1; - return; - } - if ((ifp = mib_find_if_sys(sdl->sdl_index)) == NULL) - return; - /* have a valid entry */ - if ((at = mib_find_arp(ifp, sa->sin_addr)) == NULL && - (at = mib_arp_create(ifp, sa->sin_addr, - sdl->sdl_data + sdl->sdl_nlen, sdl->sdl_alen)) == NULL) - return; - - if (rtm->rtm_rmx.rmx_expire == 0) - at->flags |= MIBARP_PERM; - else - at->flags &= ~MIBARP_PERM; - at->flags |= MIBARP_FOUND; -} -#endif /* * Handle a routing socket message. */ @@ -1089,62 +1049,12 @@ handle_rtmsg(struct rt_msghdr *rtm) } break; #endif - case RTM_GET: - mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); -#if 0 - /* - * XXX - Qing fix - * - */ - if (rtm->rtm_flags & RTF_LLINFO) { - if (addrs[RTAX_DST] == NULL || - addrs[RTAX_GATEWAY] == NULL || - addrs[RTAX_DST]->sa_family != AF_INET || - addrs[RTAX_GATEWAY]->sa_family != AF_LINK) - break; - process_arp(rtm, - (struct sockaddr_dl *)(void *)addrs[RTAX_GATEWAY], - (struct sockaddr_in *)(void *)addrs[RTAX_DST]); - } else { -#endif - if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP)) - mib_sroute_process(rtm, addrs[RTAX_GATEWAY], - addrs[RTAX_DST], addrs[RTAX_NETMASK]); -#if 0 - } -#endif - break; - case RTM_ADD: - mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); -#if 0 - /* - * XXX - Qing fix - * - */ - if (rtm->rtm_flags & RTF_LLINFO) { - if (addrs[RTAX_DST] == NULL || - addrs[RTAX_GATEWAY] == NULL || - addrs[RTAX_DST]->sa_family != AF_INET || - addrs[RTAX_GATEWAY]->sa_family != AF_LINK) - break; - process_arp(rtm, - (struct sockaddr_dl *)(void *)addrs[RTAX_GATEWAY], - (struct sockaddr_in *)(void *)addrs[RTAX_DST]); - } else { -#endif - if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP)) - mib_sroute_process(rtm, addrs[RTAX_GATEWAY], - addrs[RTAX_DST], addrs[RTAX_NETMASK]); -#if 0 - } -#endif - break; - case RTM_DELETE: mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); - if (rtm->rtm_errno == 0) + + if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP)) mib_sroute_process(rtm, addrs[RTAX_GATEWAY], addrs[RTAX_DST], addrs[RTAX_NETMASK]); break; @@ -1315,9 +1225,7 @@ update_ifa_info(void) /* * Update arp table * - * XXX - Qing */ -#if 0 void mib_arp_update(void) { @@ -1333,11 +1241,7 @@ mib_arp_update(void) TAILQ_FOREACH(at, &mibarp_list, link) at->flags &= ~MIBARP_FOUND; - /* - * XXX - Qing fix - * - */ - if ((buf = mib_fetch_rtab(AF_INET, NET_RT_FLAGS, RTF_LLINFO, &needed)) == NULL) { + if ((buf = mib_fetch_rtab(AF_INET, NET_RT_FLAGS, 0, &needed)) == NULL) { in_update_arp = 0; return; } @@ -1358,10 +1262,8 @@ mib_arp_update(void) at = at1; } mibarpticks = get_ticks(); - update_arp = 0; in_update_arp = 0; } -#endif /* @@ -1664,22 +1566,11 @@ mibII_idle(void) mib_refresh_iflist(); update_ifa_info(); -#if 0 - /* - * XXX Qing - * - */ mib_arp_update(); -#endif mib_iflist_bad = 0; } -#if 0 - /* - * XXX Qing - */ - if (update_arp) - mib_arp_update(); -#endif + + mib_arp_update(); } From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 08:31:33 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 349E5106564A; Sat, 13 Dec 2008 08:31:33 +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 24D7E8FC22; Sat, 13 Dec 2008 08:31:33 +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 mBD8VW8A023464; Sat, 13 Dec 2008 08:31:32 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD8VWKF023463; Sat, 13 Dec 2008 08:31:32 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812130831.mBD8VWKF023463@svn.freebsd.org> From: Kip Macy Date: Sat, 13 Dec 2008 08:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186032 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 08:31:33 -0000 Author: kmacy Date: Sat Dec 13 08:31:32 2008 New Revision: 186032 URL: http://svn.freebsd.org/changeset/base/186032 Log: hold lle lock across flags check Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c Modified: projects/arpv2_merge_1/sys/netinet/if_ether.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/if_ether.c Sat Dec 13 07:45:48 2008 (r186031) +++ projects/arpv2_merge_1/sys/netinet/if_ether.c Sat Dec 13 08:31:32 2008 (r186032) @@ -154,19 +154,20 @@ arptimer(void *arg) return; } ifp = lle->lle_tbl->llt_ifp; + IF_AFDATA_LOCK(ifp); + LLE_WLOCK(lle); if ((lle->la_flags & LLE_DELETED) || (time_second >= lle->la_expire)) { - IF_AFDATA_LOCK(ifp); if (!callout_pending(&lle->la_timer) && callout_active(&lle->la_timer)) (void) llentry_free(lle); - IF_AFDATA_UNLOCK(ifp); } else { /* * Still valid, just drop our reference */ - LLE_FREE(lle); + LLE_FREE_LOCKED(lle); } + IF_AFDATA_UNLOCK(ifp); } /* From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 08:32:13 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FA04106564A; Sat, 13 Dec 2008 08:32:13 +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 4FD038FC08; Sat, 13 Dec 2008 08:32:13 +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 mBD8WDfm023514; Sat, 13 Dec 2008 08:32:13 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBD8WD2P023512; Sat, 13 Dec 2008 08:32:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812130832.mBD8WD2P023512@svn.freebsd.org> From: Kip Macy Date: Sat, 13 Dec 2008 08:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186033 - in projects/arpv2_merge_1/sys: net netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 08:32:13 -0000 Author: kmacy Date: Sat Dec 13 08:32:13 2008 New Revision: 186033 URL: http://svn.freebsd.org/changeset/base/186033 Log: updating locking interface to llentry_free Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c projects/arpv2_merge_1/sys/netinet6/nd6.c Modified: projects/arpv2_merge_1/sys/net/if_llatbl.c ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.c Sat Dec 13 08:31:32 2008 (r186032) +++ projects/arpv2_merge_1/sys/net/if_llatbl.c Sat Dec 13 08:32:13 2008 (r186033) @@ -92,8 +92,8 @@ done: void llentry_free(struct llentry *lle) { - - LLE_WLOCK(lle); + + LLE_WLOCK_ASSERT(lle); LIST_REMOVE(lle, lle_next); if (lle->la_hold != NULL) @@ -121,7 +121,9 @@ lltable_free(struct lltable *llt) for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { + callout_drain(&lle->la_timer); + LLE_WLOCK(lle); llentry_free(lle); } } Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6.c Sat Dec 13 08:31:32 2008 (r186032) +++ projects/arpv2_merge_1/sys/netinet6/nd6.c Sat Dec 13 08:32:13 2008 (r186033) @@ -1094,6 +1094,7 @@ nd6_free(struct llentry *ln, int gc) ifp = ln->lle_tbl->llt_ifp; IF_AFDATA_LOCK(ifp); + LLE_WLOCK(ln); llentry_free(ln); IF_AFDATA_UNLOCK(ifp); From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 10:19:29 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1DED1065672; Sat, 13 Dec 2008 10:19: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 8EFEA8FC13; Sat, 13 Dec 2008 10:19:29 +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 mBDAJTWJ025871; Sat, 13 Dec 2008 10:19:29 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBDAJTkF025863; Sat, 13 Dec 2008 10:19:29 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812131019.mBDAJTkF025863@svn.freebsd.org> From: Kip Macy Date: Sat, 13 Dec 2008 10:19:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186035 - in projects/arpv2_merge_1/sys: amd64/conf net netinet netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 10:19:29 -0000 Author: kmacy Date: Sat Dec 13 10:19:28 2008 New Revision: 186035 URL: http://svn.freebsd.org/changeset/base/186035 Log: - add AFDATA and LLE lock asserts - fix LLE_REMREF - add nd6_llinfo_settimer_locked and nd6_output_lle for case where lle lock is already held - remove inappropriate AFDATA lock in ip6_forward - change "Qing" to "XXX QL" Modified: projects/arpv2_merge_1/sys/amd64/conf/GENERIC projects/arpv2_merge_1/sys/net/if_llatbl.h projects/arpv2_merge_1/sys/netinet/in.c projects/arpv2_merge_1/sys/netinet6/in6.c projects/arpv2_merge_1/sys/netinet6/ip6_forward.c projects/arpv2_merge_1/sys/netinet6/nd6.c projects/arpv2_merge_1/sys/netinet6/nd6.h projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c Modified: projects/arpv2_merge_1/sys/amd64/conf/GENERIC ============================================================================== --- projects/arpv2_merge_1/sys/amd64/conf/GENERIC Sat Dec 13 09:33:03 2008 (r186034) +++ projects/arpv2_merge_1/sys/amd64/conf/GENERIC Sat Dec 13 10:19:28 2008 (r186035) @@ -313,3 +313,5 @@ device fwe # Ethernet over FireWire (n device fwip # IP over FireWire (RFC 2734,3146) device dcons # Dumb console driver device dcons_crom # Configuration ROM for dcons + +options ALT_BREAK_TO_DEBUGGER Modified: projects/arpv2_merge_1/sys/net/if_llatbl.h ============================================================================== --- projects/arpv2_merge_1/sys/net/if_llatbl.h Sat Dec 13 09:33:03 2008 (r186034) +++ projects/arpv2_merge_1/sys/net/if_llatbl.h Sat Dec 13 10:19:28 2008 (r186035) @@ -94,9 +94,9 @@ struct llentry { #define LLE_REMREF(lle) do { \ LLE_WLOCK_ASSERT(lle); \ - KASSERT((lle)->rt_refcnt > 0, \ - ("bogus refcnt %ld", (lle)->rt_refcnt)); \ - (lle)->rt_refcnt--; \ + KASSERT((lle)->lle_refcnt > 1, \ + ("bogus refcnt %d", (lle)->lle_refcnt)); \ + (lle)->lle_refcnt--; \ } while (0) #define LLE_FREE_LOCKED(lle) do { \ Modified: projects/arpv2_merge_1/sys/netinet/in.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in.c Sat Dec 13 09:33:03 2008 (r186034) +++ projects/arpv2_merge_1/sys/netinet/in.c Sat Dec 13 10:19:28 2008 (r186035) @@ -1097,6 +1097,7 @@ in_lltable_lookup(struct lltable *llt, u struct llentries *lleh; u_int hashkey; + IF_AFDATA_LOCK_ASSERT(ifp); KASSERT(l3addr->sa_family == AF_INET, ("sin_family %d", l3addr->sa_family)); Modified: projects/arpv2_merge_1/sys/netinet6/in6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6.c Sat Dec 13 09:33:03 2008 (r186034) +++ projects/arpv2_merge_1/sys/netinet6/in6.c Sat Dec 13 10:19:28 2008 (r186035) @@ -1533,7 +1533,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 * XXX: the logic below rejects assigning multiple addresses on a p2p * interface that share the same destination. */ -#if 0 /* QING - verify */ +#if 0 /* QL - verify */ plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ if (!(ia->ia_flags & IFA_ROUTE) && plen == 128 && ia->ia_dstaddr.sin6_family == AF_INET6) { @@ -1587,7 +1587,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 IF_AFDATA_LOCK(ifp); ia->ia_ifa.ifa_rtrequest = NULL; - /* Qing + /* XXX QL * we need to report rt_newaddrmsg */ ln = lla_lookup(LLTABLE6(ifp), (LLE_CREATE | LLE_IFADDR | LLE_EXCLUSIVE), @@ -2162,6 +2162,7 @@ in6_lltable_lookup(struct lltable *llt, struct llentries *lleh; u_int hashkey; + IF_AFDATA_LOCK_ASSERT(ifp); KASSERT(l3addr->sa_family == AF_INET6, ("sin_family %d", l3addr->sa_family)); Modified: projects/arpv2_merge_1/sys/netinet6/ip6_forward.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/ip6_forward.c Sat Dec 13 09:33:03 2008 (r186034) +++ projects/arpv2_merge_1/sys/netinet6/ip6_forward.c Sat Dec 13 10:19:28 2008 (r186035) @@ -610,9 +610,7 @@ ip6_forward(struct mbuf *m, int srcrt) ip6 = mtod(m, struct ip6_hdr *); pass: - IF_AFDATA_LOCK(rt->rt_ifp); error = nd6_output(rt->rt_ifp, origifp, m, dst, rt); - IF_AFDATA_UNLOCK(rt->rt_ifp); if (error) { in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard); V_ip6stat.ip6s_cantforward++; Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6.c Sat Dec 13 09:33:03 2008 (r186034) +++ projects/arpv2_merge_1/sys/netinet6/nd6.c Sat Dec 13 10:19:28 2008 (r186035) @@ -434,13 +434,20 @@ skip1: * ND6 timer routine to handle ND6 entries */ void -nd6_llinfo_settimer(struct llentry *ln, long tick) +nd6_llinfo_settimer_locked(struct llentry *ln, long tick) { - LLE_WLOCK(ln); if (tick < 0) { ln->la_expire = 0; ln->ln_ntick = 0; callout_stop(&ln->ln_timer_ch); + /* + * XXX - do we know that there is + * callout installed? i.e. are we + * guaranteed that we're not dropping + * a reference that we did not add? + * KMM + */ + LLE_REMREF(ln); } else { ln->la_expire = time_second + tick / hz; LLE_ADDREF(ln); @@ -454,6 +461,14 @@ nd6_llinfo_settimer(struct llentry *ln, nd6_llinfo_timer, ln); } } +} + +void +nd6_llinfo_settimer(struct llentry *ln, long tick) +{ + + LLE_WLOCK(ln); + nd6_llinfo_settimer_locked(ln, tick); LLE_WUNLOCK(ln); } @@ -477,12 +492,6 @@ nd6_llinfo_timer(void *arg) CURVNET_SET(ifp->if_vnet); INIT_VNET_INET6(curvnet); - /* - * llentry is refcounted - we shouldn't need to protect it - * with IF_AFDATA - */ - IF_AFDATA_LOCK(ifp); - if (ln->ln_ntick > 0) { if (ln->ln_ntick > INT_MAX) { ln->ln_ntick -= INT_MAX; @@ -491,21 +500,17 @@ nd6_llinfo_timer(void *arg) ln->ln_ntick = 0; nd6_llinfo_settimer(ln, ln->ln_ntick); } - IF_AFDATA_UNLOCK(ifp); goto done; } ndi = ND_IFINFO(ifp); dst = &L3_ADDR_SIN6(ln)->sin6_addr; - if ((ln->la_flags & LLE_STATIC) || (ln->la_expire > time_second)) { - IF_AFDATA_UNLOCK(ifp); goto done; } if (ln->la_flags & LLE_DELETED) { (void)nd6_free(ln, 0); - IF_AFDATA_UNLOCK(ifp); goto done; } @@ -574,10 +579,9 @@ nd6_llinfo_timer(void *arg) } break; } - IF_AFDATA_UNLOCK(ifp); CURVNET_RESTORE(); done: - LLE_FREE_LOCKED(ln); + LLE_FREE(ln); } @@ -1427,6 +1431,7 @@ nd6_cache_lladdr(struct ifnet *ifp, stru if (ln) IF_AFDATA_UNLOCK(ifp); if (ln == NULL) { + flags |= LLE_EXCLUSIVE; ln = nd6_lookup(from, flags |ND6_CREATE, ifp); IF_AFDATA_UNLOCK(ifp); is_newentry = 1; @@ -1436,7 +1441,6 @@ nd6_cache_lladdr(struct ifnet *ifp, stru goto done; is_newentry = 0; } - if (ln == NULL) return (NULL); @@ -1495,7 +1499,7 @@ nd6_cache_lladdr(struct ifnet *ifp, stru * we must set the timer now, although it is actually * meaningless. */ - nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); + nd6_llinfo_settimer_locked(ln, (long)V_nd6_gctimer * hz); if (ln->la_hold) { struct mbuf *m_hold, *m_hold_next; @@ -1515,12 +1519,12 @@ nd6_cache_lladdr(struct ifnet *ifp, stru * just set the 2nd argument as the * 1st one. */ - nd6_output(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL); + nd6_output_lle(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL, ln); } } } else if (ln->ln_state == ND6_LLINFO_INCOMPLETE) { /* probe right away */ - nd6_llinfo_settimer((void *)ln, 0); + nd6_llinfo_settimer_locked((void *)ln, 0); } } @@ -1660,6 +1664,15 @@ nd6_slowtimo(void *arg) CURVNET_RESTORE(); } +int +nd6_output(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0, + struct sockaddr_in6 *dst, struct rtentry *rt0) +{ + + return (nd6_output_lle(ifp, origifp, m0, dst, rt0, NULL)); +} + + /* * Note that I'm not enforcing any global serialization * lle state or asked changes here as the logic is too @@ -1669,17 +1682,22 @@ nd6_slowtimo(void *arg) * */ #define senderr(e) { error = (e); goto bad;} + int -nd6_output(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0, - struct sockaddr_in6 *dst, struct rtentry *rt0) +nd6_output_lle(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0, + struct sockaddr_in6 *dst, struct rtentry *rt0, struct llentry *lle) { INIT_VNET_INET6(curvnet); struct mbuf *m = m0; struct rtentry *rt = rt0; - struct llentry *ln = NULL; + struct llentry *ln = lle; int error = 0; int flags = 0; +#ifdef INVARIANTS + if (lle) + LLE_WLOCK_ASSERT(lle); +#endif if (IN6_IS_ADDR_MULTICAST(&dst->sin6_addr)) goto sendpkt; @@ -1696,21 +1714,25 @@ nd6_output(struct ifnet *ifp, struct ifn * At this point, the destination of the packet must be a unicast * or an anycast address(i.e. not a multicast). */ - flags = m ? LLE_EXCLUSIVE : 0; - IF_AFDATA_LOCK(rt->rt_ifp); - ln = lla_lookup(LLTABLE6(ifp), flags, (struct sockaddr *)dst); - IF_AFDATA_UNLOCK(rt->rt_ifp); - if ((ln == NULL) && nd6_is_addr_neighbor(dst, ifp)) { - /* - * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), - * the condition below is not very efficient. But we believe - * it is tolerable, because this should be a rare case. - */ - flags = ND6_CREATE | (m ? ND6_EXCLUSIVE : 0); + + flags = (m || lle) ? LLE_EXCLUSIVE : 0; + if (ln == NULL) { + retry: IF_AFDATA_LOCK(rt->rt_ifp); - ln = nd6_lookup(&dst->sin6_addr, flags, ifp); + ln = lla_lookup(LLTABLE6(ifp), flags, (struct sockaddr *)dst); IF_AFDATA_UNLOCK(rt->rt_ifp); - } + if ((ln == NULL) && nd6_is_addr_neighbor(dst, ifp)) { + /* + * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), + * the condition below is not very efficient. But we believe + * it is tolerable, because this should be a rare case. + */ + flags = ND6_CREATE | (m ? ND6_EXCLUSIVE : 0); + IF_AFDATA_LOCK(rt->rt_ifp); + ln = nd6_lookup(&dst->sin6_addr, flags, ifp); + IF_AFDATA_UNLOCK(rt->rt_ifp); + } + } if (ln == NULL) { if ((ifp->if_flags & IFF_POINTOPOINT) == 0 && !(ND_IFINFO(ifp)->flags & ND6_IFF_PERFORMNUD)) { @@ -1727,8 +1749,12 @@ nd6_output(struct ifnet *ifp, struct ifn /* We don't have to do link-layer address resolution on a p2p link. */ if ((ifp->if_flags & IFF_POINTOPOINT) != 0 && ln->ln_state < ND6_LLINFO_REACHABLE) { + if ((flags & LLE_EXCLUSIVE) == 0) { + flags |= LLE_EXCLUSIVE; + goto retry; + } ln->ln_state = ND6_LLINFO_STALE; - nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); + nd6_llinfo_settimer_locked(ln, (long)V_nd6_gctimer * hz); } /* @@ -1739,9 +1765,14 @@ nd6_output(struct ifnet *ifp, struct ifn * (RFC 2461 7.3.3) */ if (ln->ln_state == ND6_LLINFO_STALE) { + if ((flags & LLE_EXCLUSIVE) == 0) { + flags |= LLE_EXCLUSIVE; + LLE_RUNLOCK(ln); + goto retry; + } ln->la_asked = 0; ln->ln_state = ND6_LLINFO_DELAY; - nd6_llinfo_settimer(ln, (long)V_nd6_delay * hz); + nd6_llinfo_settimer_locked(ln, (long)V_nd6_delay * hz); } /* @@ -1761,10 +1792,16 @@ nd6_output(struct ifnet *ifp, struct ifn */ if (ln->ln_state == ND6_LLINFO_NOSTATE) ln->ln_state = ND6_LLINFO_INCOMPLETE; + + if ((flags & LLE_EXCLUSIVE) == 0) { + flags |= LLE_EXCLUSIVE; + LLE_RUNLOCK(ln); + goto retry; + } if (ln->la_hold) { struct mbuf *m_hold; int i; - + i = 0; for (m_hold = ln->la_hold; m_hold; m_hold = m_hold->m_nextpkt) { i++; @@ -1782,11 +1819,16 @@ nd6_output(struct ifnet *ifp, struct ifn } else { ln->la_hold = m; } - - if (flags & LLE_EXCLUSIVE) - LLE_WUNLOCK(ln); - else - LLE_RUNLOCK(ln); + /* + * We did the lookup (no lle arg) so we + * need to do the unlock here + */ + if (lle == NULL) { + if (flags & LLE_EXCLUSIVE) + LLE_WUNLOCK(ln); + else + LLE_RUNLOCK(ln); + } /* * If there has been no NS for the neighbor after entering the @@ -1807,7 +1849,11 @@ nd6_output(struct ifnet *ifp, struct ifn error = ENETDOWN; /* better error? */ goto bad; } - if (ln) { + /* + * ln is valid and the caller did not pass in + * an llentry + */ + if (ln && (lle == NULL)) { if (flags & LLE_EXCLUSIVE) LLE_WUNLOCK(ln); else @@ -1825,7 +1871,11 @@ nd6_output(struct ifnet *ifp, struct ifn return (error); bad: - if (ln) { + /* + * ln is valid and the caller did not pass in + * an llentry + */ + if (ln && (lle == NULL)) { if (flags & LLE_EXCLUSIVE) LLE_WUNLOCK(ln); else Modified: projects/arpv2_merge_1/sys/netinet6/nd6.h ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6.h Sat Dec 13 09:33:03 2008 (r186034) +++ projects/arpv2_merge_1/sys/netinet6/nd6.h Sat Dec 13 10:19:28 2008 (r186035) @@ -380,6 +380,7 @@ int nd6_options __P((union nd_opts *)); struct llentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *)); void nd6_setmtu __P((struct ifnet *)); void nd6_llinfo_settimer __P((struct llentry *, long)); +void nd6_llinfo_settimer_locked __P((struct llentry *, long)); void nd6_timer __P((void *)); void nd6_purge __P((struct ifnet *)); void nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int)); @@ -390,6 +391,8 @@ struct llentry *nd6_cache_lladdr __P((st char *, int, int, int)); int nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *, struct sockaddr_in6 *, struct rtentry *)); +int nd6_output_lle __P((struct ifnet *, struct ifnet *, struct mbuf *, + struct sockaddr_in6 *, struct rtentry *, struct llentry *)); int nd6_need_cache __P((struct ifnet *)); int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *, struct sockaddr *, u_char *, struct llentry **)); Modified: projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c Sat Dec 13 09:33:03 2008 (r186034) +++ projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c Sat Dec 13 10:19:28 2008 (r186035) @@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -603,7 +605,7 @@ nd6_na_input(struct mbuf *m, int off, in char *lladdr = NULL; int lladdrlen = 0; struct ifaddr *ifa; - struct llentry *ln; + struct llentry *ln = NULL; union nd_opts ndopts; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; @@ -699,7 +701,7 @@ nd6_na_input(struct mbuf *m, int off, in * discarded. */ IF_AFDATA_LOCK(ifp); - ln = nd6_lookup(&taddr6, 0, ifp); + ln = nd6_lookup(&taddr6, LLE_EXCLUSIVE, ifp); IF_AFDATA_UNLOCK(ifp); if (ln == NULL) { goto freeit; @@ -723,12 +725,12 @@ nd6_na_input(struct mbuf *m, int off, in ln->ln_state = ND6_LLINFO_REACHABLE; ln->ln_byhint = 0; if (!ND6_LLINFO_PERMANENT(ln)) { - nd6_llinfo_settimer(ln, + nd6_llinfo_settimer_locked(ln, (long)ND_IFINFO(ln->lle_tbl->llt_ifp)->reachable * hz); } } else { ln->ln_state = ND6_LLINFO_STALE; - nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); + nd6_llinfo_settimer_locked(ln, (long)V_nd6_gctimer * hz); } if ((ln->ln_router = is_router) != 0) { /* @@ -782,7 +784,7 @@ nd6_na_input(struct mbuf *m, int off, in */ if (ln->ln_state == ND6_LLINFO_REACHABLE) { ln->ln_state = ND6_LLINFO_STALE; - nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz); + nd6_llinfo_settimer_locked(ln, (long)V_nd6_gctimer * hz); } goto freeit; } else if (is_override /* (2a) */ @@ -805,13 +807,13 @@ nd6_na_input(struct mbuf *m, int off, in ln->ln_state = ND6_LLINFO_REACHABLE; ln->ln_byhint = 0; if (!ND6_LLINFO_PERMANENT(ln)) { - nd6_llinfo_settimer(ln, + nd6_llinfo_settimer_locked(ln, (long)ND_IFINFO(ifp)->reachable * hz); } } else { if (lladdr != NULL && llchange) { ln->ln_state = ND6_LLINFO_STALE; - nd6_llinfo_settimer(ln, + nd6_llinfo_settimer_locked(ln, (long)V_nd6_gctimer * hz); } } @@ -825,7 +827,6 @@ nd6_na_input(struct mbuf *m, int off, in */ struct nd_defrouter *dr; struct in6_addr *in6; -/* int s;*/ in6 = &L3_ADDR_SIN6(ln)->sin6_addr; @@ -835,9 +836,6 @@ nd6_na_input(struct mbuf *m, int off, in * is only called under the network software interrupt * context. However, we keep it just for safety. */ -/* Qing - removing - s = splnet(); -*/ dr = defrouter_lookup(in6, ln->lle_tbl->llt_ifp); if (dr) defrtrlist_del(dr); @@ -851,15 +849,13 @@ nd6_na_input(struct mbuf *m, int off, in */ rt6_flush(&ip6->ip6_src, ifp); } -/* Qing - removing - splx(s); -*/ } ln->ln_router = is_router; } - /* Qing - do we care ? - rt->rt_flags &= ~RTF_REJECT; - */ + /* XXX - QL + * Does this matter? + * rt->rt_flags &= ~RTF_REJECT; + */ ln->la_asked = 0; if (ln->la_hold) { struct mbuf *m_hold, *m_hold_next; @@ -877,14 +873,20 @@ nd6_na_input(struct mbuf *m, int off, in * we assume ifp is not a loopback here, so just set * the 2nd argument as the 1st one. */ - nd6_output(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL); + nd6_output_lle(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL, ln); } } freeit: + if (ln) + LLE_WUNLOCK(ln); + m_freem(m); return; bad: + if (ln) + LLE_WUNLOCK(ln); + V_icmp6stat.icp6s_badna++; m_freem(m); } From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 19:14:26 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DC081065670; Sat, 13 Dec 2008 19:14:26 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C44E8FC0C; Sat, 13 Dec 2008 19:14:26 +0000 (UTC) (envelope-from brueffer@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 mBDJEQMJ037436; Sat, 13 Dec 2008 19:14:26 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBDJEQsv037434; Sat, 13 Dec 2008 19:14:26 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200812131914.mBDJEQsv037434@svn.freebsd.org> From: Christian Brueffer Date: Sat, 13 Dec 2008 19:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186049 - projects/arpv2_merge_1/share/man/man9 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 19:14:26 -0000 Author: brueffer Date: Sat Dec 13 19:14:26 2008 New Revision: 186049 URL: http://svn.freebsd.org/changeset/base/186049 Log: Fix spelling and mdoc, bump .Dd for the previous changes. Modified: projects/arpv2_merge_1/share/man/man9/rtalloc.9 projects/arpv2_merge_1/share/man/man9/rtentry.9 Modified: projects/arpv2_merge_1/share/man/man9/rtalloc.9 ============================================================================== --- projects/arpv2_merge_1/share/man/man9/rtalloc.9 Sat Dec 13 19:13:03 2008 (r186048) +++ projects/arpv2_merge_1/share/man/man9/rtalloc.9 Sat Dec 13 19:14:26 2008 (r186049) @@ -27,7 +27,8 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd October 11, 2004 +.\" +.Dd December 11, 2008 .Os .Dt RTALLOC 9 .Sh NAME @@ -145,7 +146,7 @@ directly as the argument. The second argument, .Fa report , -controls whether the lower layers are notifed when a lookup fails. +controls whether the lower layers are notified when a lookup fails. The third argument, .Fa flags , is a set of flags to ignore, as in Modified: projects/arpv2_merge_1/share/man/man9/rtentry.9 ============================================================================== --- projects/arpv2_merge_1/share/man/man9/rtentry.9 Sat Dec 13 19:13:03 2008 (r186048) +++ projects/arpv2_merge_1/share/man/man9/rtentry.9 Sat Dec 13 19:14:26 2008 (r186049) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 7, 2004 +.Dd December 11, 2008 .Os .Dt RTENTRY 9 .Sh NAME @@ -249,4 +249,3 @@ The and .Va rmx_filler fields could be named better. -.Pp From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 23:24:04 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E59781065672; Sat, 13 Dec 2008 23:24:04 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5F028FC12; Sat, 13 Dec 2008 23:24:04 +0000 (UTC) (envelope-from qingli@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 mBDNO4qN042895; Sat, 13 Dec 2008 23:24:04 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBDNO43J042894; Sat, 13 Dec 2008 23:24:04 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200812132324.mBDNO43J042894@svn.freebsd.org> From: Qing Li Date: Sat, 13 Dec 2008 23:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186065 - projects/arpv2_merge_1/sys/netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 23:24:05 -0000 Author: qingli Date: Sat Dec 13 23:24:04 2008 New Revision: 186065 URL: http://svn.freebsd.org/changeset/base/186065 Log: The meaning of the return code from nd6_is_addr_neighbor() was reversed, causing all sorts of ... Modified: projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c Modified: projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c Sat Dec 13 23:10:36 2008 (r186064) +++ projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c Sat Dec 13 23:24:04 2008 (r186065) @@ -117,7 +117,7 @@ nd6_ns_input(struct mbuf *m, int off, in struct ifaddr *ifa = NULL; int lladdrlen = 0; int anycast = 0, proxy = 0, tentative = 0; - int tlladdr, error; + int tlladdr; union nd_opts ndopts; struct sockaddr_dl *proxydl = NULL; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; @@ -171,8 +171,7 @@ nd6_ns_input(struct mbuf *m, int off, in src_sa6.sin6_family = AF_INET6; src_sa6.sin6_len = sizeof(src_sa6); src_sa6.sin6_addr = saddr6; - error = nd6_is_addr_neighbor(&src_sa6, ifp); - if (error) { + if (nd6_is_addr_neighbor(&src_sa6, ifp) == 0) { nd6log((LOG_INFO, "nd6_ns_input: " "NS packet from non-neighbor\n")); goto bad; From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 23:36:34 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4961106564A; Sat, 13 Dec 2008 23:36:34 +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 BC1038FC12; Sat, 13 Dec 2008 23:36:34 +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 mBDNaYJq043216; Sat, 13 Dec 2008 23:36:34 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBDNaYlG043215; Sat, 13 Dec 2008 23:36:34 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200812132336.mBDNaYlG043215@svn.freebsd.org> From: Andrew Thompson Date: Sat, 13 Dec 2008 23:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186067 - projects/l2filter X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 23:36:35 -0000 Author: thompsa Date: Sat Dec 13 23:36:34 2008 New Revision: 186067 URL: http://svn.freebsd.org/changeset/base/186067 Log: Create a branch to hold Gleb Kurtsou's layer2 filter changes (soc2008). Added: projects/l2filter/ - copied from r186066, head/ From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 23:49:10 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 146031065673; Sat, 13 Dec 2008 23:49:10 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 039808FC08; Sat, 13 Dec 2008 23:49:10 +0000 (UTC) (envelope-from lulf@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 mBDNn9nv043508; Sat, 13 Dec 2008 23:49:09 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBDNn9mL043501; Sat, 13 Dec 2008 23:49:09 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200812132349.mBDNn9mL043501@svn.freebsd.org> From: Ulf Lilleengen Date: Sat, 13 Dec 2008 23:49:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186068 - projects/gvinum/sys/geom/vinum X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 23:49:10 -0000 Author: lulf Date: Sat Dec 13 23:49:09 2008 New Revision: 186068 URL: http://svn.freebsd.org/changeset/base/186068 Log: - More assertions where appropriate. - Minor fixes to error handling. - Fix a bug where calling start on a volume with subdisk in the down state would make it panic. - Allow RAID5 volumes to skip initialization. Modified: projects/gvinum/sys/geom/vinum/geom_vinum.c projects/gvinum/sys/geom/vinum/geom_vinum_init.c projects/gvinum/sys/geom/vinum/geom_vinum_plex.c projects/gvinum/sys/geom/vinum/geom_vinum_raid5.c projects/gvinum/sys/geom/vinum/geom_vinum_state.c projects/gvinum/sys/geom/vinum/geom_vinum_subr.c projects/gvinum/sys/geom/vinum/geom_vinum_var.h Modified: projects/gvinum/sys/geom/vinum/geom_vinum.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum.c Sat Dec 13 23:36:34 2008 (r186067) +++ projects/gvinum/sys/geom/vinum/geom_vinum.c Sat Dec 13 23:49:09 2008 (r186068) @@ -111,6 +111,8 @@ gv_done(struct bio *bp) struct g_geom *gp; struct gv_softc *sc; + KASSERT(bp != NULL, ("NULL bp")); + gp = bp->bio_from->geom; sc = gp->softc; bp->bio_cflags |= GV_BIO_DONE; Modified: projects/gvinum/sys/geom/vinum/geom_vinum_init.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_init.c Sat Dec 13 23:36:34 2008 (r186067) +++ projects/gvinum/sys/geom/vinum/geom_vinum_init.c Sat Dec 13 23:49:09 2008 (r186068) @@ -104,13 +104,8 @@ gv_start_plex(struct gv_plex *p) KASSERT(p != NULL, ("gv_start_plex: NULL p")); -/* if (p->state == GV_PLEX_UP) - return (0);*/ - error = 0; v = p->vol_sc; -/* if ((v != NULL) && (v->plexcount > 1)) - error = gv_sync(v);*/ if (p->org == GV_PLEX_STRIPED) { grow = 0; LIST_FOREACH(s, &p->subdisks, in_plex) { Modified: projects/gvinum/sys/geom/vinum/geom_vinum_plex.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_plex.c Sat Dec 13 23:36:34 2008 (r186067) +++ projects/gvinum/sys/geom/vinum/geom_vinum_plex.c Sat Dec 13 23:49:09 2008 (r186068) @@ -210,11 +210,12 @@ gv_plex_normal_request(struct gv_plex *p off_t real_len, real_off; int i, err, sdno; - err = ENXIO; s = NULL; sdno = -1; real_len = real_off = 0; + err = ENXIO; + if (p == NULL || LIST_EMPTY(&p->subdisks)) goto bad; @@ -225,8 +226,11 @@ gv_plex_normal_request(struct gv_plex *p bioq_disksort(p->rqueue, bp); return (-1); /* "Fail", and delay request. */ } - if (err) + if (err) { + err = ENXIO; goto bad; + } + err = ENXIO; /* Find the right subdisk. */ i = 0; @@ -245,9 +249,17 @@ gv_plex_normal_request(struct gv_plex *p case GV_SD_UP: /* If the subdisk is up, just continue. */ break; + case GV_SD_DOWN: + if (bp->bio_cflags & GV_BIO_INTERNAL) + G_VINUM_DEBUG(0, "subdisk must be in the stale state in" + " order to perform administrative requests"); + goto bad; case GV_SD_STALE: - if (!(bp->bio_cflags & GV_BIO_SYNCREQ)) + if (!(bp->bio_cflags & GV_BIO_SYNCREQ)) { + G_VINUM_DEBUG(0, "subdisk stale, unable to perform " + "regular requests"); goto bad; + } G_VINUM_DEBUG(1, "sd %s is initializing", s->name); gv_set_sd_state(s, GV_SD_INITIALIZING, GV_SETSTATE_FORCE); @@ -258,7 +270,6 @@ gv_plex_normal_request(struct gv_plex *p break; default: /* All other subdisk states mean it's not accessible. */ - err = EINVAL; goto bad; } @@ -280,8 +291,18 @@ gv_plex_normal_request(struct gv_plex *p bioq_insert_tail(p->bqueue, cbp); return (real_len); bad: - /* Building the sub-request failed. */ G_VINUM_LOGREQ(0, bp, "plex request failed."); + /* Building the sub-request failed. If internal BIO, do not deliver. */ + if (bp->bio_cflags & GV_BIO_INTERNAL) { + if (bp->bio_cflags & GV_BIO_MALLOC) + g_free(bp->bio_data); + g_destroy_bio(bp); + /* Reset flags. */ + p->flags &= ~GV_PLEX_SYNCING; + p->flags &= ~GV_PLEX_REBUILDING; + p->flags &= ~GV_PLEX_GROWING; + return (-1); + } g_io_deliver(bp, err); return (-1); } @@ -427,6 +448,8 @@ gv_plex_raid5_done(struct gv_plex *p, st gv_rebuild_complete(p, pbp); } else if (pbp->bio_cflags & GV_BIO_INIT) { gv_init_complete(p, pbp); + } else if (pbp->bio_cflags & GV_BIO_SYNCREQ) { + gv_sync_complete(p, pbp); } else if (pbp->bio_pflags & GV_BIO_SYNCREQ) { gv_grow_complete(p, pbp); } else { @@ -545,6 +568,9 @@ gv_sync_request(struct gv_plex *from, st { struct bio *bp; + KASSERT(from != NULL, ("NULL from")); + KASSERT(to != NULL, ("NULL to")); + bp = g_new_bio(); if (bp == NULL) { G_VINUM_DEBUG(0, "sync from '%s' failed at offset " @@ -583,9 +609,14 @@ gv_sync_complete(struct gv_plex *to, str g_topology_assert_not(); err = 0; + KASSERT(to != NULL, ("NULL to")); + KASSERT(bp != NULL, ("NULL bp")); from = bp->bio_caller2; + KASSERT(from != NULL, ("NULL from")); v = to->vol_sc; + KASSERT(v != NULL, ("NULL v")); sc = v->vinumconf; + KASSERT(sc != NULL, ("NULL sc")); /* If it was a read, write it. */ if (bp->bio_cmd == BIO_READ) { @@ -600,11 +631,11 @@ gv_sync_complete(struct gv_plex *to, str if (bp->bio_offset + bp->bio_length >= from->size) { G_VINUM_DEBUG(1, "syncing of %s from %s completed", to->name, from->name); - to->flags &= ~GV_PLEX_SYNCING; - to->synced = 0; /* Update our state. */ LIST_FOREACH(s, &to->subdisks, in_plex) gv_set_sd_state(s, GV_SD_UP, 0); + to->flags &= ~GV_PLEX_SYNCING; + to->synced = 0; } else { offset = bp->bio_offset + bp->bio_length; err = gv_sync_request(from, to, offset, @@ -701,11 +732,7 @@ gv_grow_complete(struct gv_plex *p, stru /* Find the real size of the plex. */ sdcount = gv_sdcount(p, 1); s = LIST_FIRST(&p->subdisks); - /* XXX: should not ever happen */ - if (s == NULL) { - G_VINUM_DEBUG(0, "error growing plex without subdisks"); - return; - } + KASSERT(s != NULL, ("NULL s")); origsize = (s->size * (sdcount - 1)); if (bp->bio_offset + bp->bio_length >= origsize) { G_VINUM_DEBUG(1, "growing of %s completed", p->name); Modified: projects/gvinum/sys/geom/vinum/geom_vinum_raid5.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_raid5.c Sat Dec 13 23:36:34 2008 (r186067) +++ projects/gvinum/sys/geom/vinum/geom_vinum_raid5.c Sat Dec 13 23:49:09 2008 (r186068) @@ -61,6 +61,8 @@ gv_raid5_start(struct gv_plex *p, struct delay = 0; wp = g_malloc(sizeof(*wp), M_WAITOK | M_ZERO); wp->bio = bp; + wp->waiting = NULL; + wp->parity = NULL; TAILQ_INIT(&wp->bits); if (bp->bio_cflags & GV_BIO_REBUILD) @@ -80,7 +82,7 @@ gv_raid5_start(struct gv_plex *p, struct * Building the sub-request failed, we probably need to clean up a lot. */ if (err) { - G_VINUM_LOGREQ(0, bp, "plex request failed."); + G_VINUM_LOGREQ(0, bp, "raid5 plex request failed."); TAILQ_FOREACH_SAFE(bq, &wp->bits, queue, bq2) { TAILQ_REMOVE(&wp->bits, bq, queue); g_free(bq); @@ -117,6 +119,17 @@ gv_raid5_start(struct gv_plex *p, struct cbp = bioq_takefirst(p->bqueue); } + /* If internal, stop and reset state. */ + if (bp->bio_cflags & GV_BIO_INTERNAL) { + if (bp->bio_cflags & GV_BIO_MALLOC) + g_free(cbp->bio_data); + g_destroy_bio(bp); + /* Reset flags. */ + p->flags &= ~GV_PLEX_SYNCING; + p->flags &= ~GV_PLEX_REBUILDING; + p->flags &= ~GV_PLEX_GROWING; + return (NULL); + } g_io_deliver(bp, err); return (NULL); } @@ -385,8 +398,13 @@ gv_raid5_request(struct gv_plex *p, stru /* Our data stripe is missing. */ if (original->state != GV_SD_UP) type = REQ_TYPE_DEGRADED; + + /* If synchronizing request, just write it if disks are stale. */ + if (original->state == GV_SD_STALE && parity->state == GV_SD_STALE && + bp->bio_cflags & GV_BIO_SYNCREQ && bp->bio_cmd == BIO_WRITE) { + type = REQ_TYPE_NORMAL; /* Our parity stripe is missing. */ - if (parity->state != GV_SD_UP) { + } else if (parity->state != GV_SD_UP) { /* We cannot take another failure if we're already degraded. */ if (type != REQ_TYPE_NORMAL) return (ENXIO); Modified: projects/gvinum/sys/geom/vinum/geom_vinum_state.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_state.c Sat Dec 13 23:36:34 2008 (r186067) +++ projects/gvinum/sys/geom/vinum/geom_vinum_state.c Sat Dec 13 23:49:09 2008 (r186068) @@ -243,8 +243,11 @@ gv_set_sd_state(struct gv_sd *s, int new if (p == NULL || flags & GV_SETSTATE_FORCE) break; - if ((p->org != GV_PLEX_RAID5) && - (p->vol_sc->plexcount == 1)) + if ((p->org != GV_PLEX_RAID5 && + p->vol_sc->plexcount == 1) || + (p->flags & GV_PLEX_SYNCING && + p->synced > 0 && + p->org == GV_PLEX_RAID5)) break; else return (GV_ERR_SETSTATE); Modified: projects/gvinum/sys/geom/vinum/geom_vinum_subr.c ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Sat Dec 13 23:36:34 2008 (r186067) +++ projects/gvinum/sys/geom/vinum/geom_vinum_subr.c Sat Dec 13 23:49:09 2008 (r186068) @@ -486,9 +486,6 @@ gv_update_plex_config(struct gv_plex *p) KASSERT(p != NULL, ("gv_update_plex_config: NULL p")); - /* This is what we want the plex to be. */ - state = GV_PLEX_UP; - /* The plex was added to an already running volume. */ if (p->flags & GV_PLEX_ADDED) gv_set_plex_state(p, GV_PLEX_DOWN, GV_SETSTATE_FORCE); @@ -540,16 +537,23 @@ gv_update_plex_config(struct gv_plex *p) p->size = gv_plex_size(p); if (p->sdcount == 0) gv_set_plex_state(p, GV_PLEX_DOWN, GV_SETSTATE_FORCE); - else if ((p->flags & GV_PLEX_ADDED) || - ((p->org == GV_PLEX_RAID5) && (p->flags & GV_PLEX_NEWBORN))) { + else if (p->org == GV_PLEX_RAID5 && p->flags & GV_PLEX_NEWBORN) { LIST_FOREACH(s, &p->subdisks, in_plex) - gv_set_sd_state(s, GV_SD_STALE, GV_SETSTATE_FORCE); + gv_set_sd_state(s, GV_SD_UP, GV_SETSTATE_FORCE); + /* If added to a volume, we want the plex to be down. */ + state = (p->flags & GV_PLEX_ADDED) ? GV_PLEX_DOWN : GV_PLEX_UP; + gv_set_plex_state(p, state, GV_SETSTATE_FORCE); p->flags &= ~GV_PLEX_ADDED; + } else if (p->flags & GV_PLEX_ADDED) { + LIST_FOREACH(s, &p->subdisks, in_plex) + gv_set_sd_state(s, GV_SD_STALE, GV_SETSTATE_FORCE); gv_set_plex_state(p, GV_PLEX_DOWN, GV_SETSTATE_FORCE); + p->flags &= ~GV_PLEX_ADDED; } else if (p->state == GV_PLEX_UP) { LIST_FOREACH(s, &p->subdisks, in_plex) { if (s->flags & GV_SD_GROW) { - p->state = GV_PLEX_GROWABLE; + gv_set_plex_state(p, GV_PLEX_GROWABLE, + GV_SETSTATE_FORCE); break; } } @@ -1124,9 +1128,13 @@ int gv_attach_plex(struct gv_plex *p, struct gv_volume *v, int rename) { struct gv_sd *s; + struct gv_softc *sc; g_topology_assert(); + sc = p->vinumconf; + KASSERT(sc != NULL, ("NULL sc")); + if (p->vol_sc != NULL) { G_VINUM_DEBUG(1, "unable to attach %s: already attached to %s", p->name, p->volume); Modified: projects/gvinum/sys/geom/vinum/geom_vinum_var.h ============================================================================== --- projects/gvinum/sys/geom/vinum/geom_vinum_var.h Sat Dec 13 23:36:34 2008 (r186067) +++ projects/gvinum/sys/geom/vinum/geom_vinum_var.h Sat Dec 13 23:49:09 2008 (r186068) @@ -117,6 +117,8 @@ #define GV_BIO_CHECK 0x40 #define GV_BIO_PARITY 0x80 #define GV_BIO_RETRY 0x100 +#define GV_BIO_INTERNAL \ + (GV_BIO_SYNCREQ | GV_BIO_INIT | GV_BIO_REBUILD |GV_BIO_CHECK) /* Error codes to be used within gvinum. */ #define GV_ERR_SETSTATE (-1) /* Error setting state. */