From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 24 11:01:42 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B73C106566B; Sun, 24 Apr 2011 11:01:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88DC38FC0C; Sun, 24 Apr 2011 11:01:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3OB1gOx029251; Sun, 24 Apr 2011 11:01:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3OB1gbc029246; Sun, 24 Apr 2011 11:01:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201104241101.p3OB1gbc029246@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 24 Apr 2011 11:01:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220986 - stable/8/sys/ufs/ufs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2011 11:01:42 -0000 Author: kib Date: Sun Apr 24 11:01:42 2011 New Revision: 220986 URL: http://svn.freebsd.org/changeset/base/220986 Log: Merge the part of r207141 that fixes the locking for ufs_rename() (and r218838 followup). Adopt the SU calls to the stable/8 SU implementation, with the help from Kirk. PR: kern/156545 Reviewed by: mckusick Tested by: pho Modified: stable/8/sys/ufs/ufs/inode.h stable/8/sys/ufs/ufs/ufs_extern.h stable/8/sys/ufs/ufs/ufs_lookup.c stable/8/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/ufs/ufs/inode.h ============================================================================== --- stable/8/sys/ufs/ufs/inode.h Sun Apr 24 10:47:56 2011 (r220985) +++ stable/8/sys/ufs/ufs/inode.h Sun Apr 24 11:01:42 2011 (r220986) @@ -120,7 +120,7 @@ struct inode { #define IN_CHANGE 0x0002 /* Inode change time update request. */ #define IN_UPDATE 0x0004 /* Modification time update request. */ #define IN_MODIFIED 0x0008 /* Inode has been modified. */ -#define IN_RENAME 0x0010 /* Inode is being renamed. */ +#define IN_NEEDSYNC 0x0010 /* Inode requires fsync. */ #define IN_LAZYMOD 0x0040 /* Modified, but don't write yet. */ #define IN_SPACECOUNTED 0x0080 /* Blocks to be freed in free count. */ #define IN_LAZYACCESS 0x0100 /* Process IN_ACCESS after the Modified: stable/8/sys/ufs/ufs/ufs_extern.h ============================================================================== --- stable/8/sys/ufs/ufs/ufs_extern.h Sun Apr 24 10:47:56 2011 (r220985) +++ stable/8/sys/ufs/ufs/ufs_extern.h Sun Apr 24 11:01:42 2011 (r220986) @@ -57,7 +57,7 @@ int ufs_bmap(struct vop_bmap_args *); int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *, struct buf *, int *, int *); int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **); -int ufs_checkpath(ino_t, struct inode *, struct ucred *); +int ufs_checkpath(ino_t, ino_t, struct inode *, struct ucred *, ino_t *); void ufs_dirbad(struct inode *, doff_t, char *); int ufs_dirbadentry(struct vnode *, struct direct *, int); int ufs_dirempty(struct inode *, ino_t, struct ucred *); @@ -66,9 +66,11 @@ int ufs_extwrite(struct vop_write_args void ufs_makedirentry(struct inode *, struct componentname *, struct direct *); int ufs_direnter(struct vnode *, struct vnode *, struct direct *, - struct componentname *, struct buf *); + struct componentname *, struct buf *, int); int ufs_dirremove(struct vnode *, struct inode *, int, int); int ufs_dirrewrite(struct inode *, struct inode *, ino_t, int, int); +int ufs_lookup_ino(struct vnode *, struct vnode **, struct componentname *, + ino_t *); int ufs_getlbns(struct vnode *, ufs2_daddr_t, struct indir *, int *); int ufs_inactive(struct vop_inactive_args *); int ufs_init(struct vfsconf *); Modified: stable/8/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- stable/8/sys/ufs/ufs/ufs_lookup.c Sun Apr 24 10:47:56 2011 (r220985) +++ stable/8/sys/ufs/ufs/ufs_lookup.c Sun Apr 24 11:01:42 2011 (r220986) @@ -76,9 +76,6 @@ SYSCTL_INT(_debug, OID_AUTO, dircheck, C /* true if old FS format...*/ #define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0) -static int ufs_lookup_(struct vnode *, struct vnode **, struct componentname *, - ino_t *); - #ifdef QUOTA static int ufs_lookup_upgrade_lock(struct vnode *vp) @@ -214,11 +211,11 @@ ufs_lookup(ap) } */ *ap; { - return (ufs_lookup_(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL)); + return (ufs_lookup_ino(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL)); } -static int -ufs_lookup_(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp, +int +ufs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp, ino_t *dd_ino) { struct inode *dp; /* inode for directory being searched */ @@ -556,6 +553,8 @@ notfound: return (ENOENT); found: + if (dd_ino != NULL) + *dd_ino = ino; if (numdirpasses == 2) nchstats.ncs_pass2++; /* @@ -578,11 +577,6 @@ found: if ((flags & ISLASTCN) && nameiop == LOOKUP) dp->i_diroff = i_offset &~ (DIRBLKSIZ - 1); - if (dd_ino != NULL) { - *dd_ino = ino; - return (0); - } - /* * If deleting, and at end of pathname, return * parameters which can be used to remove file. @@ -590,17 +584,6 @@ found: if (nameiop == DELETE && (flags & ISLASTCN)) { if (flags & LOCKPARENT) ASSERT_VOP_ELOCKED(vdp, __FUNCTION__); - if ((error = VFS_VGET(vdp->v_mount, ino, - LK_EXCLUSIVE, &tdp)) != 0) - return (error); - - error = ufs_delete_denied(vdp, tdp, cred, cnp->cn_thread); - if (error) { - vput(tdp); - return (error); - } - - /* * Return pointer to current entry in dp->i_offset, * and distance past previous entry (if there @@ -617,6 +600,16 @@ found: dp->i_count = 0; else dp->i_count = dp->i_offset - prevoff; + if (dd_ino != NULL) + return (0); + if ((error = VFS_VGET(vdp->v_mount, ino, + LK_EXCLUSIVE, &tdp)) != 0) + return (error); + error = ufs_delete_denied(vdp, tdp, cred, cnp->cn_thread); + if (error) { + vput(tdp); + return (error); + } if (dp->i_number == ino) { VREF(vdp); *vpp = vdp; @@ -648,6 +641,8 @@ found: dp->i_offset = i_offset; if (dp->i_number == ino) return (EISDIR); + if (dd_ino != NULL) + return (0); if ((error = VFS_VGET(vdp->v_mount, ino, LK_EXCLUSIVE, &tdp)) != 0) return (error); @@ -682,6 +677,8 @@ found: cnp->cn_flags |= SAVENAME; return (0); } + if (dd_ino != NULL) + return (0); /* * Step through the translation in the name. We do not `vput' the @@ -713,7 +710,7 @@ found: * to the inode we looked up before vdp lock was * dropped. */ - error = ufs_lookup_(pdp, NULL, cnp, &ino1); + error = ufs_lookup_ino(pdp, NULL, cnp, &ino1); if (error) { vput(tdp); return (error); @@ -865,12 +862,13 @@ ufs_makedirentry(ip, cnp, newdirp) * soft dependency code). */ int -ufs_direnter(dvp, tvp, dirp, cnp, newdirbp) +ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename) struct vnode *dvp; struct vnode *tvp; struct direct *dirp; struct componentname *cnp; struct buf *newdirbp; + int isrename; { struct ucred *cr; struct thread *td; @@ -943,22 +941,30 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir blkoff += DIRBLKSIZ; } if (softdep_setup_directory_add(bp, dp, dp->i_offset, - dirp->d_ino, newdirbp, 1) == 0) { - bdwrite(bp); + dirp->d_ino, newdirbp, 1)) + dp->i_flag |= IN_NEEDSYNC; +#ifdef JOURNALED_SOFTUPDATES + if (newdirbp) + bdwrite(newdirbp); +#endif + bdwrite(bp); + if ((dp->i_flag & IN_NEEDSYNC) == 0) return (UFS_UPDATE(dvp, 0)); - } - /* We have just allocated a directory block in an - * indirect block. Rather than tracking when it gets - * claimed by the inode, we simply do a VOP_FSYNC - * now to ensure that it is there (in case the user - * does a future fsync). Note that we have to unlock - * the inode for the entry that we just entered, as - * the VOP_FSYNC may need to lock other inodes which - * can lead to deadlock if we also hold a lock on - * the newly entered node. + /* + * We have just allocated a directory block in an + * indirect block. We must prevent holes in the + * directory created if directory entries are + * written out of order. To accomplish this we + * fsync when we extend a directory into indirects. + * During rename it's not safe to drop the tvp lock + * so sync must be delayed until it is. + * + * This synchronous step could be removed if fsck and + * the kernel were taught to fill in sparse + * directories rather than panic. */ - if ((error = bwrite(bp))) - return (error); + if (isrename) + return (0); if (tvp != NULL) VOP_UNLOCK(tvp, 0); error = VOP_FSYNC(dvp, MNT_WAIT, td); @@ -1099,6 +1105,10 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir (void) softdep_setup_directory_add(bp, dp, dp->i_offset + (caddr_t)ep - dirbuf, dirp->d_ino, newdirbp, 0); +#ifdef JOURNALED_SOFTUPDATES + if (newdirbp != NULL) + bdwrite(newdirbp); +#endif bdwrite(bp); } else { if (DOINGASYNC(dvp)) { @@ -1116,7 +1126,8 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir * lock other inodes which can lead to deadlock if we also hold a * lock on the newly entered node. */ - if (error == 0 && dp->i_endoff && dp->i_endoff < dp->i_size) { + if (isrename == 0 && error == 0 && + dp->i_endoff && dp->i_endoff < dp->i_size) { if (tvp != NULL) VOP_UNLOCK(tvp, 0); #ifdef UFS_DIRHASH @@ -1386,25 +1397,25 @@ ufs_dir_dd_ino(struct vnode *vp, struct /* * Check if source directory is in the path of the target directory. - * Target is supplied locked, source is unlocked. - * The target is always vput before returning. */ int -ufs_checkpath(ino_t source_ino, struct inode *target, struct ucred *cred) +ufs_checkpath(ino_t source_ino, ino_t parent_ino, struct inode *target, struct ucred *cred, ino_t *wait_ino) { - struct vnode *vp, *vp1; + struct mount *mp; + struct vnode *tvp, *vp, *vp1; int error; ino_t dd_ino; - vp = ITOV(target); - if (target->i_number == source_ino) { - error = EEXIST; - goto out; - } - error = 0; + vp = tvp = ITOV(target); + mp = vp->v_mount; + *wait_ino = 0; + if (target->i_number == source_ino) + return (EEXIST); + if (target->i_number == parent_ino) + return (0); if (target->i_number == ROOTINO) - goto out; - + return (0); + error = 0; for (;;) { error = ufs_dir_dd_ino(vp, cred, &dd_ino); if (error != 0) @@ -1415,9 +1426,13 @@ ufs_checkpath(ino_t source_ino, struct i } if (dd_ino == ROOTINO) break; - error = vn_vget_ino(vp, dd_ino, LK_EXCLUSIVE, &vp1); - if (error != 0) + if (dd_ino == parent_ino) + break; + error = VFS_VGET(mp, dd_ino, LK_SHARED | LK_NOWAIT, &vp1); + if (error != 0) { + *wait_ino = dd_ino; break; + } /* Recheck that ".." still points to vp1 after relock of vp */ error = ufs_dir_dd_ino(vp, cred, &dd_ino); if (error != 0) { @@ -1429,14 +1444,14 @@ ufs_checkpath(ino_t source_ino, struct i vput(vp1); continue; } - vput(vp); + if (vp != tvp) + vput(vp); vp = vp1; } -out: if (error == ENOTDIR) - printf("checkpath: .. not a directory\n"); - if (vp != NULL) + panic("checkpath: .. not a directory\n"); + if (vp != tvp) vput(vp); return (error); } Modified: stable/8/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/8/sys/ufs/ufs/ufs_vnops.c Sun Apr 24 10:47:56 2011 (r220985) +++ stable/8/sys/ufs/ufs/ufs_vnops.c Sun Apr 24 11:01:42 2011 (r220986) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -114,6 +115,8 @@ static vop_close_t ufsfifo_close; static vop_kqfilter_t ufsfifo_kqfilter; static vop_pathconf_t ufsfifo_pathconf; +SYSCTL_NODE(_vfs, OID_AUTO, ufs, CTLFLAG_RD, 0, "UFS filesystem"); + /* * A virgin directory (no blushing please). */ @@ -992,7 +995,7 @@ ufs_link(ap) error = UFS_UPDATE(vp, !(DOINGSOFTDEP(vp) | DOINGASYNC(vp))); if (!error) { ufs_makedirentry(ip, cnp, &newdir); - error = ufs_direnter(tdvp, vp, &newdir, cnp, NULL); + error = ufs_direnter(tdvp, vp, &newdir, cnp, NULL, 0); } if (error) { @@ -1043,7 +1046,7 @@ ufs_whiteout(ap) newdir.d_namlen = cnp->cn_namelen; bcopy(cnp->cn_nameptr, newdir.d_name, (unsigned)cnp->cn_namelen + 1); newdir.d_type = DT_WHT; - error = ufs_direnter(dvp, NULL, &newdir, cnp, NULL); + error = ufs_direnter(dvp, NULL, &newdir, cnp, NULL, 0); break; case DELETE: @@ -1062,6 +1065,11 @@ ufs_whiteout(ap) return (error); } +static volatile int rename_restarts; +SYSCTL_INT(_vfs_ufs, OID_AUTO, rename_restarts, CTLFLAG_RD, + __DEVOLATILE(int *, &rename_restarts), 0, + "Times rename had to restart due to lock contention"); + /* * Rename system call. * rename("foo", "bar"); @@ -1101,111 +1109,185 @@ ufs_rename(ap) struct vnode *tdvp = ap->a_tdvp; struct vnode *fvp = ap->a_fvp; struct vnode *fdvp = ap->a_fdvp; + struct vnode *nvp; struct componentname *tcnp = ap->a_tcnp; struct componentname *fcnp = ap->a_fcnp; struct thread *td = fcnp->cn_thread; - struct inode *ip, *xp, *dp; + struct inode *fip, *tip, *tdp, *fdp; struct direct newdir; - int doingdirectory = 0, oldparent = 0, newparent = 0; + off_t endoff; + int doingdirectory, newparent; int error = 0, ioflag; - ino_t fvp_ino; + struct mount *mp; + ino_t ino; #ifdef INVARIANTS if ((tcnp->cn_flags & HASBUF) == 0 || (fcnp->cn_flags & HASBUF) == 0) panic("ufs_rename: no name"); #endif + endoff = 0; + mp = tdvp->v_mount; + VOP_UNLOCK(tdvp, 0); + if (tvp && tvp != tdvp) + VOP_UNLOCK(tvp, 0); /* * Check for cross-device rename. */ if ((fvp->v_mount != tdvp->v_mount) || (tvp && (fvp->v_mount != tvp->v_mount))) { error = EXDEV; -abortit: - if (tdvp == tvp) - vrele(tdvp); - else - vput(tdvp); - if (tvp) - vput(tvp); - vrele(fdvp); + mp = NULL; + goto releout; + } + error = vfs_busy(mp, 0); + if (error) { + mp = NULL; + goto releout; + } +relock: + /* + * We need to acquire 2 to 4 locks depending on whether tvp is NULL + * and fdvp and tdvp are the same directory. Subsequently we need + * to double-check all paths and in the directory rename case we + * need to verify that we are not creating a directory loop. To + * handle this we acquire all but fdvp using non-blocking + * acquisitions. If we fail to acquire any lock in the path we will + * drop all held locks, acquire the new lock in a blocking fashion, + * and then release it and restart the rename. This acquire/release + * step ensures that we do not spin on a lock waiting for release. + */ + error = vn_lock(fdvp, LK_EXCLUSIVE); + if (error) + goto releout; + if (vn_lock(tdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { + VOP_UNLOCK(fdvp, 0); + error = vn_lock(tdvp, LK_EXCLUSIVE); + if (error) + goto releout; + VOP_UNLOCK(tdvp, 0); + atomic_add_int(&rename_restarts, 1); + goto relock; + } + /* + * Re-resolve fvp to be certain it still exists and fetch the + * correct vnode. + */ + error = ufs_lookup_ino(fdvp, NULL, fcnp, &ino); + if (error) { + VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(tdvp, 0); + goto releout; + } + error = VFS_VGET(mp, ino, LK_EXCLUSIVE | LK_NOWAIT, &nvp); + if (error) { + VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(tdvp, 0); + if (error != EBUSY) + goto releout; + error = VFS_VGET(mp, ino, LK_EXCLUSIVE, &nvp); + if (error != 0) + goto releout; + VOP_UNLOCK(nvp, 0); vrele(fvp); - return (error); + fvp = nvp; + atomic_add_int(&rename_restarts, 1); + goto relock; + } + vrele(fvp); + fvp = nvp; + /* + * Re-resolve tvp and acquire the vnode lock if present. + */ + error = ufs_lookup_ino(tdvp, NULL, tcnp, &ino); + if (error != 0 && error != EJUSTRETURN) { + VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(tdvp, 0); + VOP_UNLOCK(fvp, 0); + goto releout; } - + /* + * If tvp disappeared we just carry on. + */ + if (error == EJUSTRETURN && tvp != NULL) { + vrele(tvp); + tvp = NULL; + } + /* + * Get the tvp ino if the lookup succeeded. We may have to restart + * if the non-blocking acquire fails. + */ + if (error == 0) { + nvp = NULL; + error = VFS_VGET(mp, ino, LK_EXCLUSIVE | LK_NOWAIT, &nvp); + if (tvp) + vrele(tvp); + tvp = nvp; + if (error) { + VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(tdvp, 0); + VOP_UNLOCK(fvp, 0); + if (error != EBUSY) + goto releout; + error = VFS_VGET(mp, ino, LK_EXCLUSIVE, &nvp); + if (error != 0) + goto releout; + VOP_UNLOCK(nvp, 0); + atomic_add_int(&rename_restarts, 1); + goto relock; + } + } + fdp = VTOI(fdvp); + fip = VTOI(fvp); + tdp = VTOI(tdvp); + tip = NULL; + if (tvp) + tip = VTOI(tvp); if (tvp && ((VTOI(tvp)->i_flags & (NOUNLINK | IMMUTABLE | APPEND)) || (VTOI(tdvp)->i_flags & APPEND))) { error = EPERM; - goto abortit; + goto unlockout; } - /* * Renaming a file to itself has no effect. The upper layers should - * not call us in that case. Temporarily just warn if they do. + * not call us in that case. However, things could change after + * we drop the locks above. */ if (fvp == tvp) { - printf("ufs_rename: fvp == tvp (can't happen)\n"); error = 0; - goto abortit; + goto unlockout; } - - if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0) - goto abortit; - dp = VTOI(fdvp); - ip = VTOI(fvp); - if (ip->i_nlink >= LINK_MAX) { - VOP_UNLOCK(fvp, 0); + doingdirectory = 0; + newparent = 0; + ino = fip->i_number; + if (fip->i_nlink >= LINK_MAX) { error = EMLINK; - goto abortit; + goto unlockout; } - if ((ip->i_flags & (NOUNLINK | IMMUTABLE | APPEND)) - || (dp->i_flags & APPEND)) { - VOP_UNLOCK(fvp, 0); + if ((fip->i_flags & (NOUNLINK | IMMUTABLE | APPEND)) + || (fdp->i_flags & APPEND)) { error = EPERM; - goto abortit; + goto unlockout; } - if ((ip->i_mode & IFMT) == IFDIR) { + if ((fip->i_mode & IFMT) == IFDIR) { /* * Avoid ".", "..", and aliases of "." for obvious reasons. */ if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') || - dp == ip || (fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT || - (ip->i_flag & IN_RENAME)) { - VOP_UNLOCK(fvp, 0); + fdp == fip || + (fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT) { error = EINVAL; - goto abortit; + goto unlockout; } - ip->i_flag |= IN_RENAME; - oldparent = dp->i_number; + if (fdp->i_number != tdp->i_number) + newparent = tdp->i_number; doingdirectory = 1; } - vrele(fdvp); - - /* - * When the target exists, both the directory - * and target vnodes are returned locked. - */ - dp = VTOI(tdvp); - xp = NULL; - if (tvp) - xp = VTOI(tvp); - - /* - * 1) Bump link count while we're moving stuff - * around. If we crash somewhere before - * completing our work, the link count - * may be wrong, but correctable. - */ - ip->i_effnlink++; - ip->i_nlink++; - DIP_SET(ip, i_nlink, ip->i_nlink); - ip->i_flag |= IN_CHANGE; - if (DOINGSOFTDEP(fvp)) - softdep_change_linkcnt(ip); - if ((error = UFS_UPDATE(fvp, !(DOINGSOFTDEP(fvp) | - DOINGASYNC(fvp)))) != 0) { - VOP_UNLOCK(fvp, 0); - goto bad; + if ((fvp->v_type == VDIR && fvp->v_mountedhere != NULL) || + (tvp != NULL && tvp->v_type == VDIR && + tvp->v_mountedhere != NULL)) { + error = EXDEV; + goto unlockout; } /* @@ -1214,35 +1296,55 @@ abortit: * directory hierarchy above the target, as this would * orphan everything below the source directory. Also * the user must have write permission in the source so - * as to be able to change "..". We must repeat the call - * to namei, as the parent directory is unlocked by the - * call to checkpath(). - */ - error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread); - fvp_ino = ip->i_number; - VOP_UNLOCK(fvp, 0); - if (oldparent != dp->i_number) - newparent = dp->i_number; + * as to be able to change "..". + */ if (doingdirectory && newparent) { - if (error) /* write access check above */ - goto bad; - if (xp != NULL) - vput(tvp); - error = ufs_checkpath(fvp_ino, dp, tcnp->cn_cred); + error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread); if (error) - goto out; + goto unlockout; + error = ufs_checkpath(ino, fdp->i_number, tdp, tcnp->cn_cred, + &ino); + /* + * We encountered a lock that we have to wait for. Unlock + * everything else and VGET before restarting. + */ + if (ino) { + VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(tdvp, 0); + if (tvp) + VOP_UNLOCK(tvp, 0); + error = VFS_VGET(mp, ino, LK_SHARED, &nvp); + if (error == 0) + vput(nvp); + atomic_add_int(&rename_restarts, 1); + goto relock; + } + if (error) + goto unlockout; if ((tcnp->cn_flags & SAVESTART) == 0) panic("ufs_rename: lost to startdir"); - VREF(tdvp); - error = relookup(tdvp, &tvp, tcnp); - if (error) - goto out; - vrele(tdvp); - dp = VTOI(tdvp); - xp = NULL; - if (tvp) - xp = VTOI(tvp); } + if (fip->i_effnlink == 0 || fdp->i_effnlink == 0 || + tdp->i_effnlink == 0) + panic("Bad effnlink fip %p, fdp %p, tdp %p", fip, fdp, tdp); + + /* + * 1) Bump link count while we're moving stuff + * around. If we crash somewhere before + * completing our work, the link count + * may be wrong, but correctable. + */ + fip->i_effnlink++; + fip->i_nlink++; + DIP_SET(fip, i_nlink, fip->i_nlink); + fip->i_flag |= IN_CHANGE; + if (DOINGSOFTDEP(fvp)) + softdep_change_linkcnt(fip); + error = UFS_UPDATE(fvp, !(DOINGSOFTDEP(fvp) | DOINGASYNC(fvp))); + if (error) + goto bad; + /* * 2) If target doesn't exist, link the target * to the source and unlink the source. @@ -1250,52 +1352,37 @@ abortit: * entry to reference the source inode and * expunge the original entry's existence. */ - if (xp == NULL) { - if (dp->i_dev != ip->i_dev) + if (tip == NULL) { + if (tdp->i_dev != fip->i_dev) panic("ufs_rename: EXDEV"); - /* - * Account for ".." in new directory. - * When source and destination have the same - * parent we don't fool with the link count. - */ if (doingdirectory && newparent) { - if ((nlink_t)dp->i_nlink >= LINK_MAX) { + /* + * Account for ".." in new directory. + * When source and destination have the same + * parent we don't adjust the link count. The + * actual link modification is completed when + * .. is rewritten below. + */ + if ((nlink_t)tdp->i_nlink >= LINK_MAX) { error = EMLINK; goto bad; } - dp->i_effnlink++; - dp->i_nlink++; - DIP_SET(dp, i_nlink, dp->i_nlink); - dp->i_flag |= IN_CHANGE; - if (DOINGSOFTDEP(tdvp)) - softdep_change_linkcnt(dp); - error = UFS_UPDATE(tdvp, !(DOINGSOFTDEP(tdvp) | - DOINGASYNC(tdvp))); - if (error) - goto bad; } - ufs_makedirentry(ip, tcnp, &newdir); - error = ufs_direnter(tdvp, NULL, &newdir, tcnp, NULL); - if (error) { - if (doingdirectory && newparent) { - dp->i_effnlink--; - dp->i_nlink--; - DIP_SET(dp, i_nlink, dp->i_nlink); - dp->i_flag |= IN_CHANGE; - if (DOINGSOFTDEP(tdvp)) - softdep_change_linkcnt(dp); - (void)UFS_UPDATE(tdvp, 1); - } + ufs_makedirentry(fip, tcnp, &newdir); + error = ufs_direnter(tdvp, NULL, &newdir, tcnp, NULL, 1); + if (error) goto bad; - } - vput(tdvp); + /* Setup tdvp for directory compaction if needed. */ + if (tdp->i_count && tdp->i_endoff && + tdp->i_endoff < tdp->i_size) + endoff = tdp->i_endoff; } else { - if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev) + if (tip->i_dev != tdp->i_dev || tip->i_dev != fip->i_dev) panic("ufs_rename: EXDEV"); /* * Short circuit rename(foo, foo). */ - if (xp->i_number == ip->i_number) + if (tip->i_number == fip->i_number) panic("ufs_rename: same file"); /* * If the parent directory is "sticky", then the caller @@ -1303,7 +1390,7 @@ abortit: * destination of the rename. This implements append-only * directories. */ - if ((dp->i_mode & S_ISTXT) && + if ((tdp->i_mode & S_ISTXT) && VOP_ACCESS(tdvp, VADMIN, tcnp->cn_cred, td) && VOP_ACCESS(tvp, VADMIN, tcnp->cn_cred, td)) { error = EPERM; @@ -1314,9 +1401,9 @@ abortit: * to it. Also, ensure source and target are compatible * (both directories, or both not directories). */ - if ((xp->i_mode&IFMT) == IFDIR) { - if ((xp->i_effnlink > 2) || - !ufs_dirempty(xp, dp->i_number, tcnp->cn_cred)) { + if ((tip->i_mode & IFMT) == IFDIR) { + if ((tip->i_effnlink > 2) || + !ufs_dirempty(tip, tdp->i_number, tcnp->cn_cred)) { error = ENOTEMPTY; goto bad; } @@ -1329,20 +1416,30 @@ abortit: error = EISDIR; goto bad; } - error = ufs_dirrewrite(dp, xp, ip->i_number, - IFTODT(ip->i_mode), - (doingdirectory && newparent) ? newparent : doingdirectory); - if (error) - goto bad; if (doingdirectory) { if (!newparent) { - dp->i_effnlink--; + tdp->i_effnlink--; if (DOINGSOFTDEP(tdvp)) - softdep_change_linkcnt(dp); + softdep_change_linkcnt(tdp); } - xp->i_effnlink--; + tip->i_effnlink--; if (DOINGSOFTDEP(tvp)) - softdep_change_linkcnt(xp); + softdep_change_linkcnt(tip); + } + error = ufs_dirrewrite(tdp, tip, fip->i_number, + IFTODT(fip->i_mode), + (doingdirectory && newparent) ? newparent : doingdirectory); + if (error) { + if (doingdirectory) { + if (!newparent) { + tdp->i_effnlink++; + if (DOINGSOFTDEP(tdvp)) + softdep_change_linkcnt(tdp); + } + tip->i_effnlink++; + if (DOINGSOFTDEP(tvp)) + softdep_change_linkcnt(tip); + } } if (doingdirectory && !DOINGSOFTDEP(tvp)) { /* @@ -1357,115 +1454,107 @@ abortit: * them now. */ if (!newparent) { - dp->i_nlink--; - DIP_SET(dp, i_nlink, dp->i_nlink); - dp->i_flag |= IN_CHANGE; + tdp->i_nlink--; + DIP_SET(tdp, i_nlink, tdp->i_nlink); + tdp->i_flag |= IN_CHANGE; } - xp->i_nlink--; - DIP_SET(xp, i_nlink, xp->i_nlink); - xp->i_flag |= IN_CHANGE; + tip->i_nlink--; + DIP_SET(tip, i_nlink, tip->i_nlink); + tip->i_flag |= IN_CHANGE; ioflag = IO_NORMAL; if (!DOINGASYNC(tvp)) ioflag |= IO_SYNC; + /* Don't go to bad here as the new link exists. */ if ((error = UFS_TRUNCATE(tvp, (off_t)0, ioflag, tcnp->cn_cred, tcnp->cn_thread)) != 0) - goto bad; + goto unlockout; } - vput(tdvp); - vput(tvp); - xp = NULL; } /* - * 3) Unlink the source. + * 3) Unlink the source. We have to resolve the path again to + * fixup the directory offset and count for ufs_dirremove. */ - fcnp->cn_flags &= ~MODMASK; - fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; - if ((fcnp->cn_flags & SAVESTART) == 0) - panic("ufs_rename: lost from startdir"); - VREF(fdvp); - error = relookup(fdvp, &fvp, fcnp); - if (error == 0) - vrele(fdvp); - if (fvp != NULL) { - xp = VTOI(fvp); - dp = VTOI(fdvp); - } else { - /* - * From name has disappeared. IN_RENAME is not sufficient - * to protect against directory races due to timing windows, - * so we have to remove the panic. XXX the only real way - * to solve this issue is at a much higher level. By the - * time we hit ufs_rename() it's too late. - */ -#if 0 - if (doingdirectory) - panic("ufs_rename: lost dir entry"); -#endif - vrele(ap->a_fvp); - return (0); + if (fdvp == tdvp) { + error = ufs_lookup_ino(fdvp, NULL, fcnp, &ino); + if (error) + panic("ufs_rename: from entry went away!"); + if (ino != fip->i_number) + panic("ufs_rename: ino mismatch %d != %d\n", ino, + fip->i_number); } /* - * Ensure that the directory entry still exists and has not - * changed while the new name has been entered. If the source is - * a file then the entry may have been unlinked or renamed. In - * either case there is no further work to be done. If the source - * is a directory then it cannot have been rmdir'ed; the IN_RENAME - * flag ensures that it cannot be moved by another rename or removed - * by a rmdir. - */ - if (xp != ip) { - /* - * From name resolves to a different inode. IN_RENAME is - * not sufficient protection against timing window races - * so we can't panic here. XXX the only real way - * to solve this issue is at a much higher level. By the - * time we hit ufs_rename() it's too late. - */ -#if 0 - if (doingdirectory) - panic("ufs_rename: lost dir entry"); -#endif - } else { + * If the source is a directory with a + * new parent, the link count of the old + * parent directory must be decremented + * and ".." set to point to the new parent. + */ + if (doingdirectory && newparent) { /* - * If the source is a directory with a - * new parent, the link count of the old - * parent directory must be decremented - * and ".." set to point to the new parent. + * If tip exists we simply use its link, otherwise we must + * add a new one. */ - if (doingdirectory && newparent) { - xp->i_offset = mastertemplate.dot_reclen; - ufs_dirrewrite(xp, dp, newparent, DT_DIR, 0); - cache_purge(fdvp); - } - error = ufs_dirremove(fdvp, xp, fcnp->cn_flags, 0); - xp->i_flag &= ~IN_RENAME; - } - if (dp) - vput(fdvp); - if (xp) - vput(fvp); - vrele(ap->a_fvp); + if (tip == NULL) { + tdp->i_effnlink++; + tdp->i_nlink++; + DIP_SET(tdp, i_nlink, tdp->i_nlink); + tdp->i_flag |= IN_CHANGE; + if (DOINGSOFTDEP(tdvp)) + softdep_change_linkcnt(tdp); + error = UFS_UPDATE(tdvp, !(DOINGSOFTDEP(tdvp) | + DOINGASYNC(tdvp))); + /* Don't go to bad here as the new link exists. */ + if (error) + goto unlockout; + } + fip->i_offset = mastertemplate.dot_reclen; + ufs_dirrewrite(fip, fdp, newparent, DT_DIR, 0); + cache_purge(fdvp); + } + error = ufs_dirremove(fdvp, fip, fcnp->cn_flags, 0); + +unlockout: + vput(fdvp); + vput(fvp); + if (tvp) + vput(tvp); + /* + * If compaction or fsync was requested do it now that other locks + * are no longer needed. + */ + if (error == 0 && endoff != 0) { +#ifdef UFS_DIRHASH + if (tdp->i_dirhash != NULL) + ufsdirhash_dirtrunc(tdp, endoff); +#endif + UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | IO_SYNC, tcnp->cn_cred, + td); + } + if (error == 0 && tdp->i_flag & IN_NEEDSYNC) + error = VOP_FSYNC(tdvp, MNT_WAIT, td); + vput(tdvp); + if (mp) + vfs_unbusy(mp); return (error); bad: - if (xp) - vput(ITOV(xp)); - vput(ITOV(dp)); -out: - if (doingdirectory) - ip->i_flag &= ~IN_RENAME; - if (vn_lock(fvp, LK_EXCLUSIVE) == 0) { - ip->i_effnlink--; - ip->i_nlink--; - DIP_SET(ip, i_nlink, ip->i_nlink); - ip->i_flag |= IN_CHANGE; - ip->i_flag &= ~IN_RENAME; - if (DOINGSOFTDEP(fvp)) - softdep_change_linkcnt(ip); - vput(fvp); - } else - vrele(fvp); + fip->i_effnlink--; + fip->i_nlink--; + DIP_SET(fip, i_nlink, fip->i_nlink); + fip->i_flag |= IN_CHANGE; + if (DOINGSOFTDEP(fvp)) + softdep_change_linkcnt(fip); + goto unlockout; + +releout: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 24 19:35:54 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AD2C106564A; Sun, 24 Apr 2011 19:35:54 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78D5C8FC0A; Sun, 24 Apr 2011 19:35:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3OJZsnB044477; Sun, 24 Apr 2011 19:35:54 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3OJZs8N044475; Sun, 24 Apr 2011 19:35:54 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201104241935.p3OJZs8N044475@svn.freebsd.org> From: Rick Macklem Date: Sun, 24 Apr 2011 19:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220997 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2011 19:35:54 -0000 Author: rmacklem Date: Sun Apr 24 19:35:54 2011 New Revision: 220997 URL: http://svn.freebsd.org/changeset/base/220997 Log: MFC: r220507 Add a VOP_UNLOCK() for the directory, when that is not what VOP_LOOKUP() returned. This fixes a bug in the experimental NFS server for the case where VFS_VGET() fails returning EOPNOTSUPP in the ReaddirPlus RPC, forcing the use of VOP_LOOKUP() instead. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sun Apr 24 17:28:27 2011 (r220996) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sun Apr 24 19:35:54 2011 (r220997) @@ -1972,9 +1972,13 @@ again: vref(vp); nvp = vp; r = 0; - } else + } else { r = VOP_LOOKUP(vp, &nvp, &cn); + if (vp != nvp) + VOP_UNLOCK(vp, + 0); + } } } if (!r) { From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 24 19:50:13 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97869106564A; Sun, 24 Apr 2011 19:50:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 854408FC0C; Sun, 24 Apr 2011 19:50:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3OJoD7s044930; Sun, 24 Apr 2011 19:50:13 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3OJoDl9044928; Sun, 24 Apr 2011 19:50:13 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201104241950.p3OJoDl9044928@svn.freebsd.org> From: Rick Macklem Date: Sun, 24 Apr 2011 19:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220998 - stable/8/usr.sbin/nfsd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2011 19:50:13 -0000 Author: rmacklem Date: Sun Apr 24 19:50:13 2011 New Revision: 220998 URL: http://svn.freebsd.org/changeset/base/220998 Log: MFC: r220510 Add support for a backup stable restart file to the nfsd, used for NFSv4 restart. This permits the nfsd to create the stable restart file as required and minimizes the risk of trouble if the file is lost. Modified: stable/8/usr.sbin/nfsd/nfsd.c Directory Properties: stable/8/usr.sbin/nfsd/ (props changed) Modified: stable/8/usr.sbin/nfsd/nfsd.c ============================================================================== --- stable/8/usr.sbin/nfsd/nfsd.c Sun Apr 24 19:35:54 2011 (r220997) +++ stable/8/usr.sbin/nfsd/nfsd.c Sun Apr 24 19:50:13 2011 (r220998) @@ -51,6 +51,9 @@ static const char rcsid[] = #include #include #include +#include +#include +#include #include #include @@ -79,6 +82,7 @@ int debug = 0; #endif #define NFSD_STABLERESTART "/var/db/nfs-stablerestart" +#define NFSD_STABLEBACKUP "/var/db/nfs-stablerestart.bak" #define MAXNFSDCNT 256 #define DEFNFSDCNT 4 pid_t children[MAXNFSDCNT]; /* PIDs of children */ @@ -86,6 +90,8 @@ int nfsdcnt; /* number of children */ int new_syscall; int run_v4server = 0; /* Force running of nfsv4 server */ int nfssvc_nfsd; /* Set to correct NFSSVC_xxx flag */ +int stablefd = -1; /* Fd for the stable restart file */ +int backupfd; /* Fd for the backup stable restart file */ void cleanup(int); void child_cleanup(int); @@ -98,6 +104,9 @@ int setbindhost(struct addrinfo **ia, co void start_server(int); void unregistration(void); void usage(void); +void open_stable(int *, int *); +void copy_stable(int, int); +void backup_stable(int); /* * Nfs server daemon mostly just a user context for nfssvc() @@ -136,7 +145,7 @@ main(int argc, char **argv) int tcp6sock, ip6flag, tcpflag, tcpsock; int udpflag, ecode, error, s, srvcnt; int bindhostc, bindanyflag, rpcbreg, rpcbregcnt; - int stablefd, nfssvc_addsock; + int nfssvc_addsock; char **bindhost = NULL; pid_t pid; @@ -346,6 +355,7 @@ main(int argc, char **argv) } (void)signal(SIGSYS, nonfs); (void)signal(SIGCHLD, reapchild); + (void)signal(SIGUSR2, backup_stable); openlog("nfsd", LOG_PID, LOG_DAEMON); @@ -355,22 +365,21 @@ main(int argc, char **argv) * regular nfssvc() call to service NFS requests. * (This way the file remains open until the last nfsd is killed * off.) - * Note that this file is not created by this daemon and can - * only be relocated by recompiling the daemon, in order to - * minimize accidentally starting up with the wrong file. - * If should be created as an empty file Read and Write for - * root before the first time you run NFS v4 and should never - * be re-initialized if at all possible. It should live on a + * It and the backup copy will be created as empty files + * the first time this nfsd is started and should never be + * deleted/replaced if at all possible. It should live on a * local, non-volatile storage device that does not do hardware * level write-back caching. (See SCSI doc for more information * on how to prevent write-back caching on SCSI disks.) */ if (run_v4server > 0) { - stablefd = open(NFSD_STABLERESTART, O_RDWR, 0); + open_stable(&stablefd, &backupfd); if (stablefd < 0) { syslog(LOG_ERR, "Can't open %s\n", NFSD_STABLERESTART); exit(1); } + /* This system call will fail for old kernels, but that's ok. */ + nfssvc(NFSSVC_BACKUPSTABLE, NULL); if (nfssvc(NFSSVC_STABLERESTART, (caddr_t)&stablefd) < 0) { syslog(LOG_ERR, "Can't read stable storage file\n"); exit(1); @@ -739,9 +748,9 @@ main(int argc, char **argv) if (select(maxsock + 1, &ready, NULL, NULL, NULL) < 1) { error = errno; - syslog(LOG_ERR, "select failed: %m"); if (error == EINTR) continue; + syslog(LOG_ERR, "select failed: %m"); nfsd_exit(1); } } @@ -973,3 +982,95 @@ start_server(int master) else exit(status); } + +/* + * Open the stable restart file and return the file descriptor for it. + */ +void +open_stable(int *stable_fdp, int *backup_fdp) +{ + int stable_fd, backup_fd = -1, ret; + struct stat st, backup_st; + + /* Open and stat the stable restart file. */ + stable_fd = open(NFSD_STABLERESTART, O_RDWR, 0); + if (stable_fd < 0) + stable_fd = open(NFSD_STABLERESTART, O_RDWR | O_CREAT, 0600); + if (stable_fd >= 0) { + ret = fstat(stable_fd, &st); + if (ret < 0) { + close(stable_fd); + stable_fd = -1; + } + } + + /* Open and stat the backup stable restart file. */ + if (stable_fd >= 0) { + backup_fd = open(NFSD_STABLEBACKUP, O_RDWR, 0); + if (backup_fd < 0) + backup_fd = open(NFSD_STABLEBACKUP, O_RDWR | O_CREAT, + 0600); + if (backup_fd >= 0) { + ret = fstat(backup_fd, &backup_st); + if (ret < 0) { + close(backup_fd); + backup_fd = -1; + } + } + if (backup_fd < 0) { + close(stable_fd); + stable_fd = -1; + } + } + + *stable_fdp = stable_fd; + *backup_fdp = backup_fd; + if (stable_fd < 0) + return; + + /* Sync up the 2 files, as required. */ + if (st.st_size > 0) + copy_stable(stable_fd, backup_fd); + else if (backup_st.st_size > 0) + copy_stable(backup_fd, stable_fd); +} + +/* + * Copy the stable restart file to the backup or vice versa. + */ +void +copy_stable(int from_fd, int to_fd) +{ + int cnt, ret; + static char buf[1024]; + + ret = lseek(from_fd, (off_t)0, SEEK_SET); + if (ret >= 0) + ret = lseek(to_fd, (off_t)0, SEEK_SET); + if (ret >= 0) + ret = ftruncate(to_fd, (off_t)0); + if (ret >= 0) + do { + cnt = read(from_fd, buf, 1024); + if (cnt > 0) + ret = write(to_fd, buf, cnt); + else if (cnt < 0) + ret = cnt; + } while (cnt > 0 && ret >= 0); + if (ret >= 0) + ret = fsync(to_fd); + if (ret < 0) + syslog(LOG_ERR, "stable restart copy failure: %m"); +} + +/* + * Back up the stable restart file when indicated by the kernel. + */ +void +backup_stable(__unused int signo) +{ + + if (stablefd >= 0) + copy_stable(stablefd, backupfd); +} + From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 24 21:27:29 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3E891065672; Sun, 24 Apr 2011 21:27:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93B6D8FC15; Sun, 24 Apr 2011 21:27:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3OLRTDc047812; Sun, 24 Apr 2011 21:27:29 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3OLRTTL047810; Sun, 24 Apr 2011 21:27:29 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201104242127.p3OLRTTL047810@svn.freebsd.org> From: Rick Macklem Date: Sun, 24 Apr 2011 21:27:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220999 - stable/8/lib/libc/rpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2011 21:27:29 -0000 Author: rmacklem Date: Sun Apr 24 21:27:29 2011 New Revision: 220999 URL: http://svn.freebsd.org/changeset/base/220999 Log: MFC: r220519 Fix a bug in the userland rpc library, where it would use a negative return value from write to update its position in a buffer. The patch, courtesy of Andrey Simonenko, also simplifies a conditional by removing the "i != cnt" clause, since it is always true at this point in the code. The bug caused problems for mountd, when it generated a large reply to an exports RPC request. Modified: stable/8/lib/libc/rpc/svc_vc.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/rpc/svc_vc.c ============================================================================== --- stable/8/lib/libc/rpc/svc_vc.c Sun Apr 24 19:50:13 2011 (r220998) +++ stable/8/lib/libc/rpc/svc_vc.c Sun Apr 24 21:27:29 2011 (r220999) @@ -546,7 +546,7 @@ write_vc(xprtp, buf, len) cd->strm_stat = XPRT_DIED; return (-1); } - if (cd->nonblock && i != cnt) { + if (cd->nonblock) { /* * For non-blocking connections, do not * take more than 2 seconds writing the @@ -560,6 +560,7 @@ write_vc(xprtp, buf, len) return (-1); } } + i = 0; } } From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 24 23:04:10 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B88E106564A; Sun, 24 Apr 2011 23:04:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 507908FC0A; Sun, 24 Apr 2011 23:04:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3ON49J7050833; Sun, 24 Apr 2011 23:04:09 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3ON49Xf050829; Sun, 24 Apr 2011 23:04:09 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201104242304.p3ON49Xf050829@svn.freebsd.org> From: Rick Macklem Date: Sun, 24 Apr 2011 23:04:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221002 - in stable/8/sys/fs: nfs nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2011 23:04:10 -0000 Author: rmacklem Date: Sun Apr 24 23:04:08 2011 New Revision: 221002 URL: http://svn.freebsd.org/changeset/base/221002 Log: MFC: r220530 Add some cleanup code to the module unload operation for the experimental NFS server, so that it doesn't leak memory when unloaded. However, unloading the NFSv4 server is not recommended, since all NFSv4 state will be lost by the unload and clients will have to recover the state after a server reload/restart as if the server crashed/rebooted. Modified: stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Sun Apr 24 22:28:26 2011 (r221001) +++ stable/8/sys/fs/nfs/nfs_var.h Sun Apr 24 23:04:08 2011 (r221002) @@ -124,6 +124,7 @@ int nfsrv_checkgetattr(struct nfsrv_desc struct nfsvattr *, nfsattrbit_t *, struct ucred *, NFSPROC_T *); int nfsrv_nfsuserdport(u_short, NFSPROC_T *); void nfsrv_nfsuserddelport(void); +void nfsrv_throwawayallstate(NFSPROC_T *); /* nfs_nfsdserv.c */ int nfsrvd_access(struct nfsrv_descript *, int, Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sun Apr 24 22:28:26 2011 (r221001) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sun Apr 24 23:04:08 2011 (r221002) @@ -52,6 +52,7 @@ extern int newnfs_numnfsd; extern struct mount nfsv4root_mnt; extern struct nfsrv_stablefirst nfsrv_stablefirst; extern void (*nfsd_call_servertimer)(void); +extern SVCPOOL *nfsrvd_pool; struct vfsoptlist nfsv4root_opt, nfsv4root_newopt; NFSDLOCKMUTEX; struct mtx nfs_cache_mutex; @@ -3122,9 +3123,16 @@ nfsd_modevent(module_t mod, int type, vo nfsd_call_servertimer = NULL; nfsd_call_nfsd = NULL; + /* Clean out all NFSv4 state. */ + nfsrv_throwawayallstate(curthread); + /* Clean the NFS server reply cache */ nfsrvd_cleancache(); + /* Free up the krpc server pool. */ + if (nfsrvd_pool != NULL) + svcpool_destroy(nfsrvd_pool); + /* and get rid of the locks */ mtx_destroy(&nfs_cache_mutex); mtx_destroy(&nfs_v4root_mutex); Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sun Apr 24 22:28:26 2011 (r221001) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sun Apr 24 23:04:08 2011 (r221002) @@ -5194,3 +5194,37 @@ nfsrv_unlocklf(struct nfslockfile *lfp) nfsv4_unlock(&lfp->lf_locallock_lck, 0); } +/* + * Clear out all state for the NFSv4 server. + * Must be called by a thread that can sleep when no nfsds are running. + */ +void +nfsrv_throwawayallstate(NFSPROC_T *p) +{ + struct nfsclient *clp, *nclp; + struct nfslockfile *lfp, *nlfp; + int i; + + /* + * For each client, clean out the state and then free the structure. + */ + for (i = 0; i < NFSCLIENTHASHSIZE; i++) { + LIST_FOREACH_SAFE(clp, &nfsclienthash[i], lc_hash, nclp) { + nfsrv_cleanclient(clp, p); + nfsrv_freedeleglist(&clp->lc_deleg); + nfsrv_freedeleglist(&clp->lc_olddeleg); + free(clp, M_NFSDCLIENT); + } + } + + /* + * Also, free up any remaining lock file structures. + */ + for (i = 0; i < NFSLOCKHASHSIZE; i++) { + LIST_FOREACH_SAFE(lfp, &nfslockhash[i], lf_hash, nlfp) { + printf("nfsd unload: fnd a lock file struct\n"); + nfsrv_freenfslockfile(lfp); + } + } +} + From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 25 04:33:14 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05B2F106566B; Mon, 25 Apr 2011 04:33:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB6D48FC0C; Mon, 25 Apr 2011 04:33:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3P4XDjN060582; Mon, 25 Apr 2011 04:33:13 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3P4XDnG060580; Mon, 25 Apr 2011 04:33:13 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201104250433.p3P4XDnG060580@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 25 Apr 2011 04:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221003 - stable/8/sys/netgraph X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2011 04:33:14 -0000 Author: ae Date: Mon Apr 25 04:33:13 2011 New Revision: 221003 URL: http://svn.freebsd.org/changeset/base/221003 Log: MFC r220767: Use M_WAITOK flag instead M_WAIT for malloc. Suggested by: glebius Modified: stable/8/sys/netgraph/ng_patch.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netgraph/ng_patch.c ============================================================================== --- stable/8/sys/netgraph/ng_patch.c Sun Apr 24 23:04:08 2011 (r221002) +++ stable/8/sys/netgraph/ng_patch.c Mon Apr 25 04:33:13 2011 (r221003) @@ -165,7 +165,7 @@ ng_patch_constructor(node_p node) { priv_p privdata; - privdata = malloc(sizeof(*privdata), M_NETGRAPH, M_WAIT | M_ZERO); + privdata = malloc(sizeof(*privdata), M_NETGRAPH, M_WAITOK | M_ZERO); NG_NODE_SET_PRIVATE(node, privdata); privdata->in = NULL; privdata->out = NULL; @@ -208,7 +208,8 @@ ng_patch_rcvmsg(node_p node, item_p item if (privp->config == NULL) break; NG_MKRESPONSE(resp, msg, - NG_PATCH_CONF_SIZE(privp->config->count), M_WAIT); + NG_PATCH_CONF_SIZE(privp->config->count), + M_WAITOK); bcopy(privp->config, resp->data, NG_PATCH_CONF_SIZE(privp->config->count)); break; @@ -248,10 +249,10 @@ ng_patch_rcvmsg(node_p node, item_p item if (error == 0) { newconf = malloc( NG_PATCH_CONF_SIZE(conf->count), - M_NETGRAPH, M_WAIT); + M_NETGRAPH, M_WAITOK); newval = malloc(conf->count * sizeof(union patch_val), M_NETGRAPH, - M_WAIT); + M_WAITOK); for(i = 0; i < conf->count; i++) { switch (conf->ops[i].length) { case 1: @@ -288,7 +289,7 @@ ng_patch_rcvmsg(node_p node, item_p item /* FALLTHROUGH */ case NGM_PATCH_GET_STATS: NG_MKRESPONSE(resp, msg, sizeof(struct ng_patch_stats), - M_WAIT); + M_WAITOK); bcopy(&(privp->stats), resp->data, sizeof(struct ng_patch_stats)); if (clear == 0) From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 25 06:36:27 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 426EE1065670; Mon, 25 Apr 2011 06:36:27 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24A738FC16; Mon, 25 Apr 2011 06:36:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3P6aRql064400; Mon, 25 Apr 2011 06:36:27 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3P6aRuU064397; Mon, 25 Apr 2011 06:36:27 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201104250636.p3P6aRuU064397@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 25 Apr 2011 06:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221008 - in stable/8: lib/libc/sys sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2011 06:36:27 -0000 Author: pluknet Date: Mon Apr 25 06:36:26 2011 New Revision: 221008 URL: http://svn.freebsd.org/changeset/base/221008 Log: MFC r218989: Remove no more useful sysctl vm.max_proc_mmap, which also fixes mmap(2) overflow seen with over 256GB of physical memory installed. Modified: stable/8/lib/libc/sys/mmap.2 stable/8/sys/vm/vm_mmap.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/lib/libc/sys/mmap.2 ============================================================================== --- stable/8/lib/libc/sys/mmap.2 Mon Apr 25 06:03:22 2011 (r221007) +++ stable/8/lib/libc/sys/mmap.2 Mon Apr 25 06:36:26 2011 (r221008) @@ -329,9 +329,6 @@ was specified and the argument was not available. .Dv MAP_ANON was specified and insufficient memory was available. -The system has reached the per-process mmap limit specified in the -.Va vm.max_proc_mmap -sysctl. .El .Sh SEE ALSO .Xr madvise 2 , Modified: stable/8/sys/vm/vm_mmap.c ============================================================================== --- stable/8/sys/vm/vm_mmap.c Mon Apr 25 06:03:22 2011 (r221007) +++ stable/8/sys/vm/vm_mmap.c Mon Apr 25 06:36:26 2011 (r221008) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -66,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -80,7 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef HWPMC_HOOKS #include @@ -92,30 +89,6 @@ struct sbrk_args { }; #endif -static int max_proc_mmap; -SYSCTL_INT(_vm, OID_AUTO, max_proc_mmap, CTLFLAG_RW, &max_proc_mmap, 0, - "Maximum number of memory-mapped files per process"); - -/* - * Set the maximum number of vm_map_entry structures per process. Roughly - * speaking vm_map_entry structures are tiny, so allowing them to eat 1/100 - * of our KVM malloc space still results in generous limits. We want a - * default that is good enough to prevent the kernel running out of resources - * if attacked from compromised user account but generous enough such that - * multi-threaded processes are not unduly inconvenienced. - */ -static void vmmapentry_rsrc_init(void *); -SYSINIT(vmmersrc, SI_SUB_KVM_RSRC, SI_ORDER_FIRST, vmmapentry_rsrc_init, - NULL); - -static void -vmmapentry_rsrc_init(dummy) - void *dummy; -{ - max_proc_mmap = vm_kmem_size / sizeof(struct vm_map_entry); - max_proc_mmap /= 100; -} - static int vm_mmap_vnode(struct thread *, vm_size_t, vm_prot_t, vm_prot_t *, int *, struct vnode *, vm_ooffset_t *, vm_object_t *); static int vm_mmap_cdev(struct thread *, vm_size_t, vm_prot_t, vm_prot_t *, @@ -375,18 +348,6 @@ mmap(td, uap) handle_type = OBJT_VNODE; } map: - - /* - * Do not allow more then a certain number of vm_map_entry structures - * per process. Scale with the number of rforks sharing the map - * to make the limit reasonable for threads. - */ - if (max_proc_mmap && - vms->vm_map.nentries >= max_proc_mmap * vms->vm_refcnt) { - error = ENOMEM; - goto done; - } - td->td_fpop = fp; error = vm_mmap(&vms->vm_map, &addr, size, prot, maxprot, flags, handle_type, handle, pos); From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 25 14:36:39 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DEAD106566B; Mon, 25 Apr 2011 14:36:39 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BD7E8FC0C; Mon, 25 Apr 2011 14:36:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3PEacXL080273; Mon, 25 Apr 2011 14:36:38 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3PEac3J080271; Mon, 25 Apr 2011 14:36:38 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201104251436.p3PEac3J080271@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 25 Apr 2011 14:36:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221017 - stable/8/usr.bin/printf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2011 14:36:39 -0000 Author: jilles Date: Mon Apr 25 14:36:38 2011 New Revision: 221017 URL: http://svn.freebsd.org/changeset/base/221017 Log: MFC r212244: printf(1): Clarify that \OOO produces a byte, different %b escape sequences. Octal escape sequences are expanded to bytes, not characters, and multiple are required for a multibyte character. The valid escape sequences in %b strings are slightly different from the escape sequences in the format string. Modified: stable/8/usr.bin/printf/printf.1 Directory Properties: stable/8/usr.bin/printf/ (props changed) Modified: stable/8/usr.bin/printf/printf.1 ============================================================================== --- stable/8/usr.bin/printf/printf.1 Mon Apr 25 14:12:58 2011 (r221016) +++ stable/8/usr.bin/printf/printf.1 Mon Apr 25 14:36:38 2011 (r221017) @@ -35,7 +35,7 @@ .\" @(#)printf.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd April 14, 2005 +.Dd September 5, 2010 .Dt PRINTF 1 .Os .Sh NAME @@ -109,12 +109,13 @@ Write a character. .It Cm \e\e Write a backslash character. .It Cm \e Ns Ar num -.It Cm \e0 Ns Ar num -Write an 8-bit character whose -.Tn ASCII +Write a byte whose value is the 1-, 2-, or 3-digit octal number .Ar num . +Multibyte characters can be constructed using multiple +.Cm \e Ns Ar num +sequences. .El .Pp Each format specification is introduced by the percent character @@ -289,6 +290,11 @@ As for .Cm s , but interpret character escapes in backslash notation in the string .Ar argument . +The permitted escape sequences are slightly different in that +octal escapes are +.Cm \e0 Ns Ar num +instead of +.Cm \e Ns Ar num . .It Cm \&% Print a `%'; no argument is used. .El From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 25 21:14:14 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01A3A106564A; Mon, 25 Apr 2011 21:14:14 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1EBA8FC15; Mon, 25 Apr 2011 21:14:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3PLEDlT092584; Mon, 25 Apr 2011 21:14:13 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3PLEDoa092581; Mon, 25 Apr 2011 21:14:13 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201104252114.p3PLEDoa092581@svn.freebsd.org> From: Rick Macklem Date: Mon, 25 Apr 2011 21:14:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221028 - stable/8/usr.sbin/nfsd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2011 21:14:14 -0000 Author: rmacklem Date: Mon Apr 25 21:14:13 2011 New Revision: 221028 URL: http://svn.freebsd.org/changeset/base/221028 Log: MFC: r210933,r211397,r220518 Modify the man pages to reflect the addition of a backup stable restart file, as done by r220510. I also merged the typo fixes done in head as r210933, r211397 with joel@'s permission. This is a content change. Modified: stable/8/usr.sbin/nfsd/nfsv4.4 stable/8/usr.sbin/nfsd/stablerestart.5 Directory Properties: stable/8/usr.sbin/nfsd/ (props changed) Modified: stable/8/usr.sbin/nfsd/nfsv4.4 ============================================================================== --- stable/8/usr.sbin/nfsd/nfsv4.4 Mon Apr 25 20:54:12 2011 (r221027) +++ stable/8/usr.sbin/nfsd/nfsv4.4 Mon Apr 25 21:14:13 2011 (r221028) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2009 +.Dd April 10, 2011 .Dt NFSV4 4 .Os .Sh NAME @@ -56,12 +56,13 @@ open/lock state changing operations. To provide for correct recovery semantics, a small file described by .Xr stablerestart 5 is used by the server during the recovery phase. -If this file is missing, -the server will not start. -If this file is lost, it should be recovered from backups, since creating -an empty -.Xr stablerestart 5 -file will result in the server starting without providing a Grace Period +If this file is missing or empty, there is a backup copy maintained by +.Xr nfsd 8 +that will be used. If either file is missing, they will be +created by the +.Xr nfsd 8 . +If both the file and the backup copy are empty, +it will result in the server starting without providing a grace period for recovery. Note that recovery only occurs when the server machine is rebooted, not when the @@ -187,25 +188,9 @@ are set in .Pp You will also need to add at least one ``V4:'' line to the .Xr exports 5 -file and, before starting the server for the first time, create an empty -.sp -.Bd -literal -offset indent -compact -/var/db/nfs-stablerestart -.Ed -.sp -file. -The command -.sp -.Bd -literal -offset indent -compact -install -o root -g wheel -m 600 /dev/null /var/db/nfs-stablerestart -.Ed -.sp -executed as ``su'' should suffice. -This can only be done when the server is not running and there are no +file for .Nm -file system mounts against the server. -If this file is lost during a crash, recovery from backups is -recommended. +to work. .Pp If the file systems you are exporting are only being accessed via .Nm @@ -313,9 +298,11 @@ daemons at boot time via the ``nfsuserd_ .Xr rc.conf 5 variables. .Sh FILES -.Bl -tag -width /var/db/nfs-stablerestart -compact +.Bl -tag -width /var/db/nfs-stablerestart.bak -compact .It Pa /var/db/nfs-stablerestart NFS V4 stable restart file +.It Pa /var/db/nfs-stablerestart.bak +backup copy of the file .El .Sh SEE ALSO .Xr stablerestart 5 @@ -329,5 +316,5 @@ NFS V4 stable restart file At this time, there is no recall of delegations for local file system operations. As such, delegations should only be enabled for file systems -that are being used soley as NFS export volumes and are not being accessed +that are being used solely as NFS export volumes and are not being accessed via local system calls nor services such as Samba. Modified: stable/8/usr.sbin/nfsd/stablerestart.5 ============================================================================== --- stable/8/usr.sbin/nfsd/stablerestart.5 Mon Apr 25 20:54:12 2011 (r221027) +++ stable/8/usr.sbin/nfsd/stablerestart.5 Mon Apr 25 21:14:13 2011 (r221028) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sept 7, 2007 +.Dd April 10, 2011 .Dt STABLERESTART 5 .Os .Sh NAME @@ -58,7 +58,7 @@ end of the Grace Period. The rest of the file are appended records, as defined by struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used represent one of two things. There are records which indicate that a -client successfully aquired state and records that indicate a client's state was revoked. +client successfully acquired state and records that indicate a client's state was revoked. State revoke records indicate that state information for a client was discarded, due to lease expiry and an otherwise conflicting open or lock request being made by a different client. @@ -75,9 +75,11 @@ is written to stable storage by the time has returned. This might require hardware level caching to be disabled for a local disk drive that holds the file, or similar. .Sh FILES -.Bl -tag -width /var/db/nfs-stablerestart -compact +.Bl -tag -width /var/db/nfs-stablerestart.bak -compact .It Pa /var/db/nfs-stablerestart NFS V4 stable restart file +.It Pa /var/db/nfs-stablerestart.bak +backup copy of the file .El .Sh SEE ALSO .Xr nfsv4 4 @@ -86,8 +88,10 @@ NFS V4 stable restart file If the file is empty, the NFS V4 server has no choice but to return NFSERR_NOGRACE for all Reclaim requests. Although correct, this is a highly undesirable occurrence, so the file should not be lost if -at all possible. Nfsd will not create the file if it does not -exist and will simply log a failure to start, in the hopes that the -file can be recovered from a backup. To move the file, you must edit +at all possible. The backup copy of the file is maintained +and used by the +.Xr nfsd 8 +to minimize the risk of this occurring. +To move the file, you must edit the nfsd sources and recompile it. This was done to discourage accidental relocation of the file. From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 25 21:27:39 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B691106566C; Mon, 25 Apr 2011 21:27:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 088808FC15; Mon, 25 Apr 2011 21:27:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3PLRcgf093032; Mon, 25 Apr 2011 21:27:38 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3PLRcwI093030; Mon, 25 Apr 2011 21:27:38 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201104252127.p3PLRcwI093030@svn.freebsd.org> From: Rick Macklem Date: Mon, 25 Apr 2011 21:27:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221029 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2011 21:27:39 -0000 Author: rmacklem Date: Mon Apr 25 21:27:38 2011 New Revision: 221029 URL: http://svn.freebsd.org/changeset/base/221029 Log: MFC: r220546 Vrele ni_startdir in the experimental NFS server for the case of NFSv2 getting an error return from VOP_MKNOD(). Without this patch, the server file system remains busy after an NFSv2 VOP_MKNOD() fails. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Mon Apr 25 21:14:13 2011 (r221028) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Mon Apr 25 21:27:38 2011 (r221029) @@ -763,10 +763,9 @@ nfsvno_createsub(struct nfsrv_descript * &ndp->ni_cnd, &nvap->na_vattr); vput(ndp->ni_dvp); nfsvno_relpathbuf(ndp); - if (error) { - vrele(ndp->ni_startdir); + vrele(ndp->ni_startdir); + if (error) return (error); - } } else { vrele(ndp->ni_startdir); nfsvno_relpathbuf(ndp); From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 26 10:02:15 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8EA7106566B; Tue, 26 Apr 2011 10:02:15 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8E5A8FC13; Tue, 26 Apr 2011 10:02:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3QA2F9N016872; Tue, 26 Apr 2011 10:02:15 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3QA2F8d016870; Tue, 26 Apr 2011 10:02:15 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201104261002.p3QA2F8d016870@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 26 Apr 2011 10:02:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221058 - stable/8/sys/arm/xscale/i8134x X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 10:02:15 -0000 Author: pluknet Date: Tue Apr 26 10:02:15 2011 New Revision: 221058 URL: http://svn.freebsd.org/changeset/base/221058 Log: MFC r220836: Call init_param1() much earlier, so that msgbufsize is non-zero when we want to map and use the msgbuf. Modified: stable/8/sys/arm/xscale/i8134x/crb_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- stable/8/sys/arm/xscale/i8134x/crb_machdep.c Tue Apr 26 08:18:01 2011 (r221057) +++ stable/8/sys/arm/xscale/i8134x/crb_machdep.c Tue Apr 26 10:02:15 2011 (r221058) @@ -196,6 +196,9 @@ initarm(void *arg, void *arg2) pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); + /* Do basic tuning, hz etc */ + init_param1(); + freemempos = 0x00200000; /* Define a macro to simplify memory allocation */ #define valloc_pages(var, np) \ @@ -389,8 +392,6 @@ initarm(void *arg, void *arg2) phys_avail[i++] = 0; phys_avail[i] = 0; - /* Do basic tuning, hz etc */ - init_param1(); init_param2(physmem); kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 26 12:07:07 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED969106566C; Tue, 26 Apr 2011 12:07:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF0308FC0C; Tue, 26 Apr 2011 12:07:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3QC77SR021727; Tue, 26 Apr 2011 12:07:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3QC77tG021725; Tue, 26 Apr 2011 12:07:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201104261207.p3QC77tG021725@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 26 Apr 2011 12:07:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221061 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 12:07:08 -0000 Author: kib Date: Tue Apr 26 12:07:07 2011 New Revision: 221061 URL: http://svn.freebsd.org/changeset/base/221061 Log: MFC r220977: Fix two bugs in r218670. Hold the vnode around the region where object lock is dropped, until vnode lock is acquired. Do not drop the vnode reference for a case when the object was deallocated during unlock. Note that in this case, VV_TEXT is cleared by vnode_pager_dealloc(). Modified: stable/8/sys/vm/vm_object.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/vm/vm_object.c ============================================================================== --- stable/8/sys/vm/vm_object.c Tue Apr 26 11:43:57 2011 (r221060) +++ stable/8/sys/vm/vm_object.c Tue Apr 26 12:07:07 2011 (r221061) @@ -447,14 +447,21 @@ vm_object_vndeallocate(vm_object_t objec /* vrele may need the vnode lock. */ vrele(vp); } else { + vhold(vp); VM_OBJECT_UNLOCK(object); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vdrop(vp); VM_OBJECT_LOCK(object); object->ref_count--; - if (object->ref_count == 0) - vp->v_vflag &= ~VV_TEXT; - VM_OBJECT_UNLOCK(object); - vput(vp); + if (object->type == OBJT_DEAD) { + VM_OBJECT_UNLOCK(object); + VOP_UNLOCK(vp, 0); + } else { + if (object->ref_count == 0) + vp->v_vflag &= ~VV_TEXT; + VM_OBJECT_UNLOCK(object); + vput(vp); + } } } From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 26 12:25:36 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 929481065782; Tue, 26 Apr 2011 12:25:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 838E88FC1A; Tue, 26 Apr 2011 12:25:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3QCPaU2022297; Tue, 26 Apr 2011 12:25:36 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3QCPa8Q022295; Tue, 26 Apr 2011 12:25:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201104261225.p3QCPa8Q022295@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 26 Apr 2011 12:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221062 - stable/8/sys/dev/drm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 12:25:36 -0000 Author: kib Date: Tue Apr 26 12:25:36 2011 New Revision: 221062 URL: http://svn.freebsd.org/changeset/base/221062 Log: MFC r220979: Fix display of the drm sysctls (nop on stable/8). Sponsored by: The FreeBSD Foundation Modified: stable/8/sys/dev/drm/drm_sysctl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/drm/drm_sysctl.c ============================================================================== --- stable/8/sys/dev/drm/drm_sysctl.c Tue Apr 26 12:07:07 2011 (r221061) +++ stable/8/sys/dev/drm/drm_sysctl.c Tue Apr 26 12:25:36 2011 (r221062) @@ -95,7 +95,7 @@ int drm_sysctl_init(struct drm_device *d SYSCTL_CHILDREN(top), OID_AUTO, drm_sysctl_list[i].name, - CTLTYPE_INT | CTLFLAG_RD, + CTLTYPE_STRING | CTLFLAG_RD, dev, 0, drm_sysctl_list[i].f, From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 26 13:09:19 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4C981065674; Tue, 26 Apr 2011 13:09:19 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A54658FC16; Tue, 26 Apr 2011 13:09:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3QD9JPq023705; Tue, 26 Apr 2011 13:09:19 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3QD9Jp0023703; Tue, 26 Apr 2011 13:09:19 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201104261309.p3QD9Jp0023703@svn.freebsd.org> From: Glen Barber Date: Tue, 26 Apr 2011 13:09:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221064 - stable/8/lib/libc/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 13:09:19 -0000 Author: gjb (doc committer) Date: Tue Apr 26 13:09:19 2011 New Revision: 221064 URL: http://svn.freebsd.org/changeset/base/221064 Log: MFC 220975: - Clarification on kld_file_stat.size - While here, remove a few C comments that don't seem to contribute anything additional to the man page. PR: 146047 Modified: stable/8/lib/libc/sys/kldstat.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/sys/kldstat.2 ============================================================================== --- stable/8/lib/libc/sys/kldstat.2 Tue Apr 26 12:50:26 2011 (r221063) +++ stable/8/lib/libc/sys/kldstat.2 Tue Apr 26 13:09:19 2011 (r221064) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 1999 +.Dd April 23, 2011 .Dt KLDSTAT 2 .Os .Sh NAME @@ -51,8 +51,8 @@ struct kld_file_stat { char name[MAXPATHLEN]; int refs; int id; - caddr_t address; /* load address */ - size_t size; /* size in bytes */ + caddr_t address; + size_t size; char pathname[MAXPATHLEN]; }; .Ed @@ -77,7 +77,7 @@ The id of the file specified in .It address The load address of the kld file. .It size -The size of the file. +The amount of memory in bytes allocated by the file. .It pathname The full name of the file referred to by .Fa fileid , From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 26 16:56:43 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BEFE106566B; Tue, 26 Apr 2011 16:56:43 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8891B8FC18; Tue, 26 Apr 2011 16:56:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3QGuhOl030637; Tue, 26 Apr 2011 16:56:43 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3QGuh6I030634; Tue, 26 Apr 2011 16:56:43 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201104261656.p3QGuh6I030634@svn.freebsd.org> From: Maksim Yevmenkin Date: Tue, 26 Apr 2011 16:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221070 - stable/8/usr.sbin/bluetooth/l2control X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 16:56:43 -0000 Author: emax Date: Tue Apr 26 16:56:43 2011 New Revision: 221070 URL: http://svn.freebsd.org/changeset/base/221070 Log: MFC r220840 Improve the man page and l2control's usage() a bit. Submitted by: arundel Modified: stable/8/usr.sbin/bluetooth/l2control/l2control.8 stable/8/usr.sbin/bluetooth/l2control/l2control.c Directory Properties: stable/8/usr.sbin/bluetooth/l2control/ (props changed) Modified: stable/8/usr.sbin/bluetooth/l2control/l2control.8 ============================================================================== --- stable/8/usr.sbin/bluetooth/l2control/l2control.8 Tue Apr 26 16:14:55 2011 (r221069) +++ stable/8/usr.sbin/bluetooth/l2control/l2control.8 Tue Apr 26 16:56:43 2011 (r221070) @@ -25,7 +25,7 @@ .\" $Id: l2control.8,v 1.5 2003/05/21 00:53:00 max Exp $ .\" $FreeBSD$ .\" -.Dd June 14, 2002 +.Dd April 9, 2011 .Dt L2CONTROL 8 .Os .Sh NAME @@ -34,25 +34,27 @@ .Sh SYNOPSIS .Nm .Op Fl hn -.Fl a Ar BD_ADDR +.Fl a Ar local .Ar command .Op Ar parameters ... .Sh DESCRIPTION The .Nm -utility connects to the local device with the specified BD_ADDR and attempts -to send the specified command. +utility connects to the local device with the specified BD_ADDR or name +and attempts to send the specified command. The .Nm utility will print results to the standard output and error messages to -the standard error. +the standard error output. .Pp The options are as follows: .Bl -tag -width indent -.It Fl a Ar BD_ADDR -Connect to the local device with the specified BD_ADDR. +.It Fl a Ar local +Connect to the local device with the specified BD_ADDR or name. Example: -.Fl a Li 00:01:02:03:04:05 . +.Fl a Li 00:01:02:03:04:05 +or +.Fl a Li bt_device . .It Fl h Display usage message and exit. .It Fl n @@ -62,10 +64,10 @@ Normally attempts to resolve Bluetooth addresses, and display them symbolically. .It Ar command One of the supported commands (see below). -Special command +The special command .Cm help -can be used to obtain the list of all supported commands. -To get more information about specific command use +can be used to obtain a list of all supported commands. +To get more information about a specific command use .Cm help Ar command . .It Ar parameters One or more optional space separated command parameters. @@ -92,4 +94,4 @@ are: .Xr ng_l2cap 4 , .Xr l2ping 8 .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq emax@FreeBSD.org Modified: stable/8/usr.sbin/bluetooth/l2control/l2control.c ============================================================================== --- stable/8/usr.sbin/bluetooth/l2control/l2control.c Tue Apr 26 16:14:55 2011 (r221069) +++ stable/8/usr.sbin/bluetooth/l2control/l2control.c Tue Apr 26 16:56:43 2011 (r221070) @@ -207,7 +207,14 @@ print_l2cap_command(struct l2cap_command static void usage(void) { - fprintf(stdout, "Usage: l2control -a BD_ADDR [-n] [-h] cmd [p1] [..]]\n"); + fprintf(stderr, "Usage: l2control [-hn] -a local cmd [params ..]\n"); + fprintf(stderr, "Where:\n"); + fprintf(stderr, " -a local Specify local device to connect to\n"); + fprintf(stderr, " -h Display this message\n"); + fprintf(stderr, " -n Show addresses as numbers\n"); + fprintf(stderr, " cmd Supported command " \ + "(see l2control help)\n"); + fprintf(stderr, " params Optional command parameters\n"); exit(255); } /* usage */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 26 18:18:10 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E0FF1065673; Tue, 26 Apr 2011 18:18:10 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B46D8FC19; Tue, 26 Apr 2011 18:18:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3QIIAlr033260; Tue, 26 Apr 2011 18:18:10 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3QIIAYs033258; Tue, 26 Apr 2011 18:18:10 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201104261818.p3QIIAYs033258@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 26 Apr 2011 18:18:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221072 - stable/8/sys/netinet/ipfw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 18:18:10 -0000 Author: ae Date: Tue Apr 26 18:18:10 2011 New Revision: 221072 URL: http://svn.freebsd.org/changeset/base/221072 Log: MFC r220812: Use M_WAITOK instead M_WAIT for malloc. Remove unneded checks. Modified: stable/8/sys/netinet/ipfw/ip_dummynet.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_dummynet.c Tue Apr 26 17:01:49 2011 (r221071) +++ stable/8/sys/netinet/ipfw/ip_dummynet.c Tue Apr 26 18:18:10 2011 (r221072) @@ -1833,9 +1833,7 @@ dummynet_get(struct sockopt *sopt, void #endif if (l > sizeof(r)) { /* request larger than default, allocate buffer */ - cmd = malloc(l, M_DUMMYNET, M_WAIT); - if (cmd == NULL) - return ENOMEM; //XXX + cmd = malloc(l, M_DUMMYNET, M_WAITOK); error = sooptcopyin(sopt, cmd, l, l); sopt->sopt_valsize = sopt_valsize; if (error) @@ -1891,10 +1889,6 @@ dummynet_get(struct sockopt *sopt, void have = need; start = malloc(have, M_DUMMYNET, M_WAITOK | M_ZERO); - if (start == NULL) { - error = ENOMEM; - goto done; - } } if (start == NULL) { From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 26 22:15:32 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B917B106564A; Tue, 26 Apr 2011 22:15:32 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FD098FC1E; Tue, 26 Apr 2011 22:15:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3QMFWA6041043; Tue, 26 Apr 2011 22:15:32 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3QMFWCN041039; Tue, 26 Apr 2011 22:15:32 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201104262215.p3QMFWCN041039@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 26 Apr 2011 22:15:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221093 - stable/8/share/zoneinfo X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 22:15:32 -0000 Author: edwin Date: Tue Apr 26 22:15:32 2011 New Revision: 221093 URL: http://svn.freebsd.org/changeset/base/221093 Log: MFC of 221092, tzdata2011g - Egypt has cancelled the move to DST for now. Modified: stable/8/share/zoneinfo/africa stable/8/share/zoneinfo/europe stable/8/share/zoneinfo/southamerica Directory Properties: stable/8/share/zoneinfo/ (props changed) Modified: stable/8/share/zoneinfo/africa ============================================================================== --- stable/8/share/zoneinfo/africa Tue Apr 26 22:14:10 2011 (r221092) +++ stable/8/share/zoneinfo/africa Tue Apr 26 22:15:32 2011 (r221093) @@ -1,5 +1,5 @@ #
-# @(#)africa	8.30
+# @(#)africa	8.31
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -212,7 +212,21 @@ Rule	Egypt	1989	only	-	May	 6	1:00	1:00	
 Rule	Egypt	1990	1994	-	May	 1	1:00	1:00	S
 # IATA (after 1990) says transitions are at 0:00.
 # Go with IATA starting in 1995, except correct 1995 entry from 09-30 to 09-29.
-Rule	Egypt	1995	max	-	Apr	lastFri	 0:00s	1:00	S
+
+# From Alexander Krivenyshev (2011-04-20):
+# "...Egypt's interim cabinet decided on Wednesday to cancel daylight
+# saving time after a poll posted on its website showed the majority of
+# Egyptians would approve the cancellation."
+#
+# Egypt to cancel daylight saving time
+# 
+# http://www.almasryalyoum.com/en/node/407168
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_egypt04.html
+# 
+Rule	Egypt	1995	2010	-	Apr	lastFri	 0:00s	1:00	S
 Rule	Egypt	1995	2005	-	Sep	lastThu	23:00s	0	-
 # From Steffen Thorsen (2006-09-19):
 # The Egyptian Gazette, issue 41,090 (2006-09-18), page 1, reports:
@@ -313,7 +327,7 @@ Rule	Egypt	2008	only	-	Aug	lastThu	23:00
 Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
 Rule	Egypt	2010	only	-	Aug	11	0:00	0	-
 Rule	Egypt	2010	only	-	Sep	10	0:00	1:00	S
-Rule	Egypt	2010	max	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	2010	only	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct

Modified: stable/8/share/zoneinfo/europe
==============================================================================
--- stable/8/share/zoneinfo/europe	Tue Apr 26 22:14:10 2011	(r221092)
+++ stable/8/share/zoneinfo/europe	Tue Apr 26 22:15:32 2011	(r221093)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.31
+# @(#)europe	8.32
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -146,7 +146,7 @@
 # A monument to Willett was unveiled on 1927-05-21, in an open space in
 # a 45-acre wood near Chislehurst, Kent that was purchased by popular
 # subscription and open to the public.  On the south face of the monolith,
-# designed by G. W. Miller, is the the William Willett Memorial Sundial,
+# designed by G. W. Miller, is the...William Willett Memorial Sundial,
 # which is permanently set to Summer Time.
 
 # From Winston Churchill (1934-04-28):
@@ -1786,7 +1786,7 @@ Zone	Europe/Oslo	0:43:00 -	LMT	1895 Jan 
 #
 # All these events predate our cutoff date of 1970.  Unless we can
 # come up with more definitive info about the timekeeping during the
-# war years it's probably best just do do the following for now:
+# war years it's probably best just do...the following for now:
 Link	Europe/Oslo	Arctic/Longyearbyen
 
 # Poland

Modified: stable/8/share/zoneinfo/southamerica
==============================================================================
--- stable/8/share/zoneinfo/southamerica	Tue Apr 26 22:14:10 2011	(r221092)
+++ stable/8/share/zoneinfo/southamerica	Tue Apr 26 22:15:32 2011	(r221093)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.48
+# @(#)southamerica	8.49
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -745,7 +745,7 @@ Zone	America/La_Paz	-4:32:36 -	LMT	1890
 #
 # As a result of the above Decree I believe the America/Rio_Branco
 # timezone shall be modified from UTC-5 to UTC-4 and a new timezone shall
-# be created to represent the the west side of the Para State. I
+# be created to represent the...west side of the Para State. I
 # suggest this new timezone be called Santarem as the most
 # important/populated city in the affected area.
 #

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 01:33:12 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AD0671065672;
	Wed, 27 Apr 2011 01:33:12 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8040D8FC08;
	Wed, 27 Apr 2011 01:33:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3R1XCuk047583;
	Wed, 27 Apr 2011 01:33:12 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3R1XCWP047580;
	Wed, 27 Apr 2011 01:33:12 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201104270133.p3R1XCWP047580@svn.freebsd.org>
From: Rick Macklem 
Date: Wed, 27 Apr 2011 01:33:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221104 - stable/8/sys/rpc
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 01:33:12 -0000

Author: rmacklem
Date: Wed Apr 27 01:33:12 2011
New Revision: 221104
URL: http://svn.freebsd.org/changeset/base/221104

Log:
  MFC: r220585
  Fix a couple of mbuf leaks introduced by r217242. I do
  not believe that these leaks had a practical impact,
  since the situations in which they would have occurred
  would have been extremely rare.

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

Modified: stable/8/sys/rpc/clnt_dg.c
==============================================================================
--- stable/8/sys/rpc/clnt_dg.c	Wed Apr 27 01:10:15 2011	(r221103)
+++ stable/8/sys/rpc/clnt_dg.c	Wed Apr 27 01:33:12 2011	(r221104)
@@ -1086,11 +1086,13 @@ clnt_dg_soupcall(struct socket *so, void
 		/*
 		 * The XID is in the first uint32_t of the reply.
 		 */
-		if (m->m_len < sizeof(xid) && m_length(m, NULL) < sizeof(xid))
+		if (m->m_len < sizeof(xid) && m_length(m, NULL) < sizeof(xid)) {
 			/*
 			 * Should never happen.
 			 */
+			m_freem(m);
 			continue;
+		}
 
 		m_copydata(m, 0, sizeof(xid), (char *)&xid);
 		xid = ntohl(xid);

Modified: stable/8/sys/rpc/clnt_vc.c
==============================================================================
--- stable/8/sys/rpc/clnt_vc.c	Wed Apr 27 01:10:15 2011	(r221103)
+++ stable/8/sys/rpc/clnt_vc.c	Wed Apr 27 01:33:12 2011	(r221104)
@@ -973,8 +973,11 @@ clnt_vc_soupcall(struct socket *so, void
 				 * the reply.
 				 */
 				if (ct->ct_record->m_len < sizeof(xid) &&
-				    m_length(ct->ct_record, NULL) < sizeof(xid))
+				    m_length(ct->ct_record, NULL) <
+				    sizeof(xid)) {
+					m_freem(ct->ct_record);
 					break;
+				}
 				m_copydata(ct->ct_record, 0, sizeof(xid),
 				    (char *)&xid);
 				xid = ntohl(xid);

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 01:45:06 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB01B106564A;
	Wed, 27 Apr 2011 01:45:05 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B94308FC20;
	Wed, 27 Apr 2011 01:45:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3R1j5LA048005;
	Wed, 27 Apr 2011 01:45:05 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3R1j5c7048004;
	Wed, 27 Apr 2011 01:45:05 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201104270145.p3R1j5c7048004@svn.freebsd.org>
From: Rick Macklem 
Date: Wed, 27 Apr 2011 01:45:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221105 - stable/8/sys/fs/nfsclient
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 01:45:06 -0000

Author: rmacklem
Date: Wed Apr 27 01:45:05 2011
New Revision: 221105
URL: http://svn.freebsd.org/changeset/base/221105

Log:
  MFC: r220610
  Fix the experimental NFSv4 client so that it recognizes server
  mount point crossings correctly. It was testing the wrong flag.
  Also, try harder to make sure that the fsid is different than
  the one assigned to the client mount point, by hashing the
  server's fsid (just to create a different value deterministically)
  when it is the same.

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

Modified: stable/8/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clport.c	Wed Apr 27 01:33:12 2011	(r221104)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c	Wed Apr 27 01:45:05 2011	(r221105)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
  * generally, I don't like #includes inside .h files, but it seems to
  * be the easiest way to handle the port.
  */
+#include 
 #include 
 #include 
 #include 
@@ -377,12 +378,23 @@ nfscl_loadattrcache(struct vnode **vpp, 
 	 * be the same as a local fs, but since this is in an NFS mount
 	 * point, I don't think that will cause any problems?
 	 */
-	if ((nmp->nm_flag & (NFSMNT_NFSV4 | NFSMNT_HASSETFSID)) ==
-	    (NFSMNT_NFSV4 | NFSMNT_HASSETFSID) &&
+	if (NFSHASNFSV4(nmp) && NFSHASHASSETFSID(nmp) &&
 	    (nmp->nm_fsid[0] != np->n_vattr.na_filesid[0] ||
-	     nmp->nm_fsid[1] != np->n_vattr.na_filesid[1]))
-		vap->va_fsid = np->n_vattr.na_filesid[0];
-	else
+	     nmp->nm_fsid[1] != np->n_vattr.na_filesid[1])) {
+		/*
+		 * va_fsid needs to be set to some value derived from
+		 * np->n_vattr.na_filesid that is not equal
+		 * vp->v_mount->mnt_stat.f_fsid[0], so that it changes
+		 * from the value used for the top level server volume
+		 * in the mounted subtree.
+		 */
+		if (vp->v_mount->mnt_stat.f_fsid.val[0] !=
+		    (uint32_t)np->n_vattr.na_filesid[0])
+			vap->va_fsid = (uint32_t)np->n_vattr.na_filesid[0];
+		else
+			vap->va_fsid = (uint32_t)hash32_buf(
+			    np->n_vattr.na_filesid, 2 * sizeof(uint64_t), 0);
+	} else
 		vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
 	np->n_attrstamp = time_second;
 	if (vap->va_size != np->n_size) {

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 03:16:01 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A2091065670;
	Wed, 27 Apr 2011 03:16:01 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7E3A68FC0A;
	Wed, 27 Apr 2011 03:16:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3R3G10D051505;
	Wed, 27 Apr 2011 03:16:01 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3R3G1ii051503;
	Wed, 27 Apr 2011 03:16:01 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201104270316.p3R3G1ii051503@svn.freebsd.org>
From: Rick Macklem 
Date: Wed, 27 Apr 2011 03:16:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221111 - stable/8/sys/fs/nfsclient
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 03:16:01 -0000

Author: rmacklem
Date: Wed Apr 27 03:16:01 2011
New Revision: 221111
URL: http://svn.freebsd.org/changeset/base/221111

Log:
  MFC: r220611
  Add VOP_PATHCONF() support to the experimental NFS client
  so that it can, along with other things, report whether or
  not NFS4 ACLs are supported.

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

Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvnops.c	Wed Apr 27 02:55:03 2011	(r221110)
+++ stable/8/sys/fs/nfsclient/nfs_clvnops.c	Wed Apr 27 03:16:01 2011	(r221111)
@@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$");
 #define	FALSE	0
 
 extern struct nfsstats newnfsstats;
+extern int nfsrv_useacl;
 MALLOC_DECLARE(M_NEWNFSREQ);
 
 /*
@@ -103,6 +104,7 @@ static vop_lookup_t	nfs_lookup;
 static vop_create_t	nfs_create;
 static vop_mknod_t	nfs_mknod;
 static vop_open_t	nfs_open;
+static vop_pathconf_t	nfs_pathconf;
 static vop_close_t	nfs_close;
 static vop_access_t	nfs_access;
 static vop_getattr_t	nfs_getattr;
@@ -153,6 +155,7 @@ struct vop_vector newnfs_vnodeops = {
 	.vop_mkdir =		nfs_mkdir,
 	.vop_mknod =		nfs_mknod,
 	.vop_open =		nfs_open,
+	.vop_pathconf =		nfs_pathconf,
 	.vop_print =		nfs_print,
 	.vop_read =		nfs_read,
 	.vop_readdir =		nfs_readdir,
@@ -3247,3 +3250,115 @@ nfs_setacl(struct vop_setacl_args *ap)
 }
 
 #endif	/* NFS4_ACL_EXTATTR_NAME */
+
+/*
+ * Return POSIX pathconf information applicable to nfs filesystems.
+ */
+static int
+nfs_pathconf(struct vop_pathconf_args *ap)
+{
+	struct nfsv3_pathconf pc;
+	struct nfsvattr nfsva;
+	struct vnode *vp = ap->a_vp;
+	struct thread *td = curthread;
+	int attrflag, error;
+
+	if (NFS_ISV34(vp)) {
+		error = nfsrpc_pathconf(vp, &pc, td->td_ucred, td, &nfsva,
+		    &attrflag, NULL);
+		if (attrflag != 0)
+			(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0,
+			    1);
+		if (error != 0)
+			return (error);
+	} else {
+		/* For NFSv2, just fake them. */
+		pc.pc_linkmax = LINK_MAX;
+		pc.pc_namemax = NFS_MAXNAMLEN;
+		pc.pc_notrunc = 1;
+		pc.pc_chownrestricted = 1;
+		pc.pc_caseinsensitive = 0;
+		pc.pc_casepreserving = 1;
+		error = 0;
+	}
+	switch (ap->a_name) {
+	case _PC_LINK_MAX:
+		*ap->a_retval = pc.pc_linkmax;
+		break;
+	case _PC_NAME_MAX:
+		*ap->a_retval = pc.pc_namemax;
+		break;
+	case _PC_PATH_MAX:
+		*ap->a_retval = PATH_MAX;
+		break;
+	case _PC_PIPE_BUF:
+		*ap->a_retval = PIPE_BUF;
+		break;
+	case _PC_CHOWN_RESTRICTED:
+		*ap->a_retval = pc.pc_chownrestricted;
+		break;
+	case _PC_NO_TRUNC:
+		*ap->a_retval = pc.pc_notrunc;
+		break;
+	case _PC_ACL_EXTENDED:
+		*ap->a_retval = 0;
+		break;
+	case _PC_ACL_NFS4:
+		if (NFS_ISV4(vp) && nfsrv_useacl != 0 && attrflag != 0 &&
+		    NFSISSET_ATTRBIT(&nfsva.na_suppattr, NFSATTRBIT_ACL))
+			*ap->a_retval = 1;
+		else
+			*ap->a_retval = 0;
+		break;
+	case _PC_ACL_PATH_MAX:
+		if (NFS_ISV4(vp))
+			*ap->a_retval = ACL_MAX_ENTRIES;
+		else
+			*ap->a_retval = 3;
+		break;
+	case _PC_MAC_PRESENT:
+		*ap->a_retval = 0;
+		break;
+	case _PC_ASYNC_IO:
+		/* _PC_ASYNC_IO should have been handled by upper layers. */
+		KASSERT(0, ("_PC_ASYNC_IO should not get here"));
+		error = EINVAL;
+		break;
+	case _PC_PRIO_IO:
+		*ap->a_retval = 0;
+		break;
+	case _PC_SYNC_IO:
+		*ap->a_retval = 0;
+		break;
+	case _PC_ALLOC_SIZE_MIN:
+		*ap->a_retval = vp->v_mount->mnt_stat.f_bsize;
+		break;
+	case _PC_FILESIZEBITS:
+		if (NFS_ISV34(vp))
+			*ap->a_retval = 64;
+		else
+			*ap->a_retval = 32;
+		break;
+	case _PC_REC_INCR_XFER_SIZE:
+		*ap->a_retval = vp->v_mount->mnt_stat.f_iosize;
+		break;
+	case _PC_REC_MAX_XFER_SIZE:
+		*ap->a_retval = -1; /* means ``unlimited'' */
+		break;
+	case _PC_REC_MIN_XFER_SIZE:
+		*ap->a_retval = vp->v_mount->mnt_stat.f_iosize;
+		break;
+	case _PC_REC_XFER_ALIGN:
+		*ap->a_retval = PAGE_SIZE;
+		break;
+	case _PC_SYMLINK_MAX:
+		*ap->a_retval = NFS_MAXPATHLEN;
+		break;
+
+	default:
+		error = EINVAL;
+		break;
+	}
+	return (error);
+}
+

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 09:35:40 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 77E23106566B;
	Wed, 27 Apr 2011 09:35:40 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 66E0A8FC0A;
	Wed, 27 Apr 2011 09:35:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3R9Zewp063610;
	Wed, 27 Apr 2011 09:35:40 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3R9Ze5B063608;
	Wed, 27 Apr 2011 09:35:40 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201104270935.p3R9Ze5B063608@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 27 Apr 2011 09:35:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221117 - stable/8/sys/sys
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 09:35:40 -0000

Author: kib
Date: Wed Apr 27 09:35:40 2011
New Revision: 221117
URL: http://svn.freebsd.org/changeset/base/221117

Log:
  MFC r220987:
  Fix typo.

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

Modified: stable/8/sys/sys/systm.h
==============================================================================
--- stable/8/sys/sys/systm.h	Wed Apr 27 09:10:58 2011	(r221116)
+++ stable/8/sys/sys/systm.h	Wed Apr 27 09:35:40 2011	(r221117)
@@ -150,7 +150,7 @@ int	nullop(void);
 int	eopnotsupp(void);
 int	ureadc(int, struct uio *);
 void	hashdestroy(void *, struct malloc_type *, u_long);
-void	*hashinit(int count, struct malloc_type *type, u_long *hashmark);
+void	*hashinit(int count, struct malloc_type *type, u_long *hashmask);
 void	*hashinit_flags(int count, struct malloc_type *type,
     u_long *hashmask, int flags);
 #define	HASH_NOWAIT	0x00000001

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 16:16:02 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3C3AC1065674;
	Wed, 27 Apr 2011 16:16:02 +0000 (UTC) (envelope-from np@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2BCB78FC16;
	Wed, 27 Apr 2011 16:16:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3RGG2sE078736;
	Wed, 27 Apr 2011 16:16:02 GMT (envelope-from np@svn.freebsd.org)
Received: (from np@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3RGG21A078732;
	Wed, 27 Apr 2011 16:16:02 GMT (envelope-from np@svn.freebsd.org)
Message-Id: <201104271616.p3RGG21A078732@svn.freebsd.org>
From: Navdeep Parhar 
Date: Wed, 27 Apr 2011 16:16:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221120 - stable/8/sys/dev/cxgbe
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 16:16:02 -0000

Author: np
Date: Wed Apr 27 16:16:01 2011
New Revision: 221120
URL: http://svn.freebsd.org/changeset/base/221120

Log:
  MFC r220873, r220897, r220905.
  
  r220873:
  - Move all Ethernet specific items from sge_eq to sge_txq.  sge_eq is
    now a suitable base for all kinds of egress queues.
  
  - Add control queues (sge_ctrlq) and allocate one of these per hardware           channel.  They can be used to program filters and steer traffic (and
    more).
  
  r220897:
  Use the correct free routine when destroying a control queue.
  
  r220905:
  Ring the freelist doorbell from within refill_fl.  While here, fix a bug
  that could have allowed the hardware pidx to reach the cidx even though
  the freelist isn't empty.  (Haven't actually seen this but it was there
  waiting to happen..)

Modified:
  stable/8/sys/dev/cxgbe/adapter.h
  stable/8/sys/dev/cxgbe/t4_main.c
  stable/8/sys/dev/cxgbe/t4_sge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/cxgbe/adapter.h
==============================================================================
--- stable/8/sys/dev/cxgbe/adapter.h	Wed Apr 27 14:58:06 2011	(r221119)
+++ stable/8/sys/dev/cxgbe/adapter.h	Wed Apr 27 16:16:01 2011	(r221120)
@@ -110,6 +110,9 @@ enum {
 	FW_IQ_QSIZE = 256,
 	FW_IQ_ESIZE = 64,	/* At least 64 mandated by the firmware spec */
 
+	CTRL_EQ_QSIZE = 128,
+	CTRL_EQ_ESIZE = 64,
+
 	RX_IQ_QSIZE = 1024,
 	RX_IQ_ESIZE = 64,	/* At least 64 so CPL_RX_PKT will fit */
 
@@ -218,7 +221,7 @@ struct tx_map {
 
 struct tx_sdesc {
 	uint8_t desc_used;	/* # of hardware descriptors used by the WR */
-	uint8_t map_used;	/* # of frames sent out in the WR */
+	uint8_t credits;	/* NIC txq: # of frames sent out in the WR */
 };
 
 typedef void (iq_intr_handler_t)(void *);
@@ -275,7 +278,6 @@ enum {
  * consumes them) but it's special enough to have its own struct (see sge_fl).
  */
 struct sge_eq {
-	bus_dma_tag_t tx_tag;	/* tag for transmit buffers */
 	bus_dma_tag_t desc_tag;
 	bus_dmamap_t desc_map;
 	char lockname[16];
@@ -284,8 +286,6 @@ struct sge_eq {
 
 	struct tx_desc *desc;	/* KVA of descriptor ring */
 	bus_addr_t ba;		/* bus address of descriptor ring */
-	struct tx_sdesc *sdesc;	/* KVA of software descriptor ring */
-	struct buf_ring *br;	/* tx buffer ring */
 	struct sge_qstat *spg;	/* status page, for convenience */
 	uint16_t cap;		/* max # of desc, for convenience */
 	uint16_t avail;		/* available descriptors, for convenience */
@@ -295,14 +295,7 @@ struct sge_eq {
 	uint16_t pending;	/* # of descriptors used since last doorbell */
 	uint16_t iqid;		/* iq that gets egr_update for the eq */
 	uint32_t cntxt_id;	/* SGE context id for the eq */
-
-	/* DMA maps used for tx */
-	struct tx_map *maps;
-	uint32_t map_total;	/* # of DMA maps */
-	uint32_t map_pidx;	/* next map to be used */
-	uint32_t map_cidx;	/* reclaimed up to this index */
-	uint32_t map_avail;	/* # of available maps */
-} __aligned(CACHE_LINE_SIZE);
+};
 
 struct sge_fl {
 	bus_dma_tag_t desc_tag;
@@ -325,13 +318,23 @@ struct sge_fl {
 	unsigned int dmamap_failed;
 };
 
-/* txq: SGE egress queue + miscellaneous items */
+/* txq: SGE egress queue + what's needed for Ethernet NIC */
 struct sge_txq {
 	struct sge_eq eq;	/* MUST be first */
+
+	struct ifnet *ifp;	/* the interface this txq belongs to */
+	bus_dma_tag_t tx_tag;	/* tag for transmit buffers */
+	struct buf_ring *br;	/* tx buffer ring */
+	struct tx_sdesc *sdesc;	/* KVA of software descriptor ring */
 	struct mbuf *m;		/* held up due to temporary resource shortage */
 	struct task resume_tx;
 
-	struct ifnet *ifp;	/* the interface this txq belongs to */
+	/* DMA maps used for tx */
+	struct tx_map *maps;
+	uint32_t map_total;	/* # of DMA maps */
+	uint32_t map_pidx;	/* next map to be used */
+	uint32_t map_cidx;	/* reclaimed up to this index */
+	uint32_t map_avail;	/* # of available maps */
 
 	/* stats for common events first */
 
@@ -349,11 +352,12 @@ struct sge_txq {
 	uint32_t no_dmamap;	/* no DMA map to load the mbuf */
 	uint32_t no_desc;	/* out of hardware descriptors */
 	uint32_t egr_update;	/* # of SGE_EGR_UPDATE notifications for txq */
-};
+} __aligned(CACHE_LINE_SIZE);
 
 enum {
 	RXQ_LRO_ENABLED	= (1 << 0)
 };
+
 /* rxq: SGE ingress queue + SGE free list + miscellaneous items */
 struct sge_rxq {
 	struct sge_iq iq;	/* MUST be first */
@@ -374,6 +378,20 @@ struct sge_rxq {
 
 } __aligned(CACHE_LINE_SIZE);
 
+/* ctrlq: SGE egress queue + stats for control queue */
+struct sge_ctrlq {
+	struct sge_eq eq;	/* MUST be first */
+
+	/* stats for common events first */
+
+	uint64_t total_wrs;	/* # of work requests sent down this queue */
+
+	/* stats for not-that-common events */
+
+	uint32_t no_desc;	/* out of hardware descriptors */
+	uint32_t too_long;	/* WR longer than hardware max */
+} __aligned(CACHE_LINE_SIZE);
+
 struct sge {
 	uint16_t timer_val[SGE_NTIMERS];
 	uint8_t  counter_val[SGE_NCOUNTERS];
@@ -384,6 +402,7 @@ struct sge {
 	int neq;	/* total egress queues */
 
 	struct sge_iq fwq;	/* Firmware event queue */
+	struct sge_ctrlq *ctrlq;/* Control queues */
 	struct sge_iq *fiq;	/* Forwarded interrupt queues (INTR_FWD) */
 	struct sge_txq *txq;	/* NIC tx queues */
 	struct sge_rxq *rxq;	/* NIC rx queues */
@@ -436,6 +455,9 @@ struct adapter {
 	struct adapter_params params;
 	struct t4_virt_res vres;
 
+	struct sysctl_ctx_list ctx; /* from first_port_up to last_port_down */
+	struct sysctl_oid *oid_ctrlq;
+
 	struct mtx sc_lock;
 	char lockname[16];
 };
@@ -572,8 +594,8 @@ void t4_sge_modload(void);
 void t4_sge_init(struct adapter *);
 int t4_create_dma_tag(struct adapter *);
 int t4_destroy_dma_tag(struct adapter *);
-int t4_setup_adapter_iqs(struct adapter *);
-int t4_teardown_adapter_iqs(struct adapter *);
+int t4_setup_adapter_queues(struct adapter *);
+int t4_teardown_adapter_queues(struct adapter *);
 int t4_setup_eth_queues(struct port_info *);
 int t4_teardown_eth_queues(struct port_info *);
 void t4_intr_all(void *);
@@ -583,6 +605,7 @@ void t4_intr_evt(void *);
 void t4_intr_data(void *);
 void t4_evt_rx(void *);
 void t4_eth_rx(void *);
+int t4_mgmt_tx(struct adapter *, struct mbuf *);
 int t4_eth_tx(struct ifnet *, struct sge_txq *, struct mbuf *);
 void t4_update_fl_bufsize(struct ifnet *);
 

Modified: stable/8/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/8/sys/dev/cxgbe/t4_main.c	Wed Apr 27 14:58:06 2011	(r221119)
+++ stable/8/sys/dev/cxgbe/t4_main.c	Wed Apr 27 16:16:01 2011	(r221120)
@@ -544,7 +544,8 @@ t4_attach(device_t dev)
 	s = &sc->sge;
 	s->nrxq = n10g * iaq.nrxq10g + n1g * iaq.nrxq1g;
 	s->ntxq = n10g * iaq.ntxq10g + n1g * iaq.ntxq1g;
-	s->neq = s->ntxq + s->nrxq;	/* the fl in an rxq is an eq */
+	s->neq = s->ntxq + s->nrxq;	/* the free list in an rxq is an eq */
+	s->neq += NCHAN;		/* control queues, 1 per hw channel */
 	s->niq = s->nrxq + 1;		/* 1 extra for firmware event queue */
 	if (iaq.intr_fwd) {
 		sc->flags |= INTR_FWD;
@@ -552,6 +553,8 @@ t4_attach(device_t dev)
 		s->fiq = malloc(NFIQ(sc) * sizeof(struct sge_iq), M_CXGBE,
 		    M_ZERO | M_WAITOK);
 	}
+	s->ctrlq = malloc(NCHAN * sizeof(struct sge_ctrlq), M_CXGBE,
+	    M_ZERO | M_WAITOK);
 	s->rxq = malloc(s->nrxq * sizeof(struct sge_rxq), M_CXGBE,
 	    M_ZERO | M_WAITOK);
 	s->txq = malloc(s->ntxq * sizeof(struct sge_txq), M_CXGBE,
@@ -654,6 +657,7 @@ t4_detach(device_t dev)
 	free(sc->irq, M_CXGBE);
 	free(sc->sge.rxq, M_CXGBE);
 	free(sc->sge.txq, M_CXGBE);
+	free(sc->sge.ctrlq, M_CXGBE);
 	free(sc->sge.fiq, M_CXGBE);
 	free(sc->sge.iqmap, M_CXGBE);
 	free(sc->sge.eqmap, M_CXGBE);
@@ -993,7 +997,7 @@ cxgbe_transmit(struct ifnet *ifp, struct
 
 	if (m->m_flags & M_FLOWID)
 		txq += (m->m_pkthdr.flowid % pi->ntxq);
-	br = txq->eq.br;
+	br = txq->br;
 
 	if (TXQ_TRYLOCK(txq) == 0) {
 		/*
@@ -1048,7 +1052,7 @@ cxgbe_qflush(struct ifnet *ifp)
 		for_each_txq(pi, i, txq) {
 			TXQ_LOCK(txq);
 			m_freem(txq->m);
-			while ((m = buf_ring_dequeue_sc(txq->eq.br)) != NULL)
+			while ((m = buf_ring_dequeue_sc(txq->br)) != NULL)
 				m_freem(m);
 			TXQ_UNLOCK(txq);
 		}
@@ -1895,9 +1899,9 @@ first_port_up(struct adapter *sc)
 	ADAPTER_LOCK_ASSERT_NOTOWNED(sc);
 
 	/*
-	 * The firmware event queue and the optional forwarded interrupt queues.
+	 * queues that belong to the adapter (not any particular port).
 	 */
-	rc = t4_setup_adapter_iqs(sc);
+	rc = t4_setup_adapter_queues(sc);
 	if (rc != 0)
 		goto done;
 
@@ -1964,7 +1968,7 @@ last_port_down(struct adapter *sc)
 
 	t4_intr_disable(sc);
 
-	t4_teardown_adapter_iqs(sc);
+	t4_teardown_adapter_queues(sc);
 
 	for (i = 0; i < sc->intr_count; i++)
 		t4_free_irq(sc, &sc->irq[i]);
@@ -2279,7 +2283,7 @@ cxgbe_tick(void *arg)
 
 	drops = s->tx_drop;
 	for_each_txq(pi, i, txq)
-		drops += txq->eq.br->br_drops;
+		drops += txq->br->br_drops;
 	ifp->if_snd.ifq_drops = drops;
 
 	ifp->if_oerrors = s->tx_error_frames;
@@ -2675,7 +2679,7 @@ txq_start(struct ifnet *ifp, struct sge_
 
 	TXQ_LOCK_ASSERT_OWNED(txq);
 
-	br = txq->eq.br;
+	br = txq->br;
 	m = txq->m ? txq->m : drbr_dequeue(ifp, br);
 	if (m)
 		t4_eth_tx(ifp, txq, m);

Modified: stable/8/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- stable/8/sys/dev/cxgbe/t4_sge.c	Wed Apr 27 14:58:06 2011	(r221119)
+++ stable/8/sys/dev/cxgbe/t4_sge.c	Wed Apr 27 16:16:01 2011	(r221120)
@@ -94,7 +94,7 @@ struct sgl {
 static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int,
     int, iq_intr_handler_t *, char *);
 static inline void init_fl(struct sge_fl *, int, char *);
-static inline void init_txq(struct sge_txq *, int, char *);
+static inline void init_eq(struct sge_eq *, int, char *);
 static int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *,
     bus_addr_t *, void **);
 static int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
@@ -106,17 +106,19 @@ static int alloc_iq(struct sge_iq *, int
 static int free_iq(struct sge_iq *);
 static int alloc_rxq(struct port_info *, struct sge_rxq *, int, int);
 static int free_rxq(struct port_info *, struct sge_rxq *);
+static int alloc_ctrlq(struct adapter *, struct sge_ctrlq *, int);
+static int free_ctrlq(struct adapter *, struct sge_ctrlq *);
 static int alloc_txq(struct port_info *, struct sge_txq *, int);
 static int free_txq(struct port_info *, struct sge_txq *);
 static void oneseg_dma_callback(void *, bus_dma_segment_t *, int, int);
 static inline bool is_new_response(const struct sge_iq *, struct rsp_ctrl **);
 static inline void iq_next(struct sge_iq *);
 static inline void ring_fl_db(struct adapter *, struct sge_fl *);
-static void refill_fl(struct sge_fl *, int);
+static void refill_fl(struct adapter *, struct sge_fl *, int, int);
 static int alloc_fl_sdesc(struct sge_fl *);
 static void free_fl_sdesc(struct sge_fl *);
-static int alloc_eq_maps(struct sge_eq *);
-static void free_eq_maps(struct sge_eq *);
+static int alloc_tx_maps(struct sge_txq *);
+static void free_tx_maps(struct sge_txq *);
 static void set_fl_tag_idx(struct sge_fl *, int);
 
 static int get_pkt_sgl(struct sge_txq *, struct mbuf **, struct sgl *, int);
@@ -130,14 +132,16 @@ static inline void write_ulp_cpl_sgl(str
     struct txpkts *, struct mbuf *, struct sgl *);
 static int write_sgl_to_txd(struct sge_eq *, struct sgl *, caddr_t *);
 static inline void copy_to_txd(struct sge_eq *, caddr_t, caddr_t *, int);
-static inline void ring_tx_db(struct adapter *, struct sge_eq *);
+static inline void ring_eq_db(struct adapter *, struct sge_eq *);
 static inline int reclaimable(struct sge_eq *);
-static int reclaim_tx_descs(struct sge_eq *, int, int);
+static int reclaim_tx_descs(struct sge_txq *, int, int);
 static void write_eqflush_wr(struct sge_eq *);
 static __be64 get_flit(bus_dma_segment_t *, int, int);
 static int handle_sge_egr_update(struct adapter *,
     const struct cpl_sge_egr_update *);
 
+static int ctrl_tx(struct adapter *, struct sge_ctrlq *, struct mbuf *);
+
 /*
  * Called on MOD_LOAD and fills up fl_buf_info[].
  */
@@ -235,23 +239,32 @@ t4_destroy_dma_tag(struct adapter *sc)
 }
 
 /*
- * Allocate and initialize the firmware event queue and the forwarded interrupt
- * queues, if any.  The adapter owns all these queues as they are not associated
- * with any particular port.
+ * Allocate and initialize the firmware event queue, control queues, and the
+ * forwarded interrupt queues (if any).  The adapter owns all these queues as
+ * they are not associated with any particular port.
  *
  * Returns errno on failure.  Resources allocated up to that point may still be
  * allocated.  Caller is responsible for cleanup in case this function fails.
  */
 int
-t4_setup_adapter_iqs(struct adapter *sc)
+t4_setup_adapter_queues(struct adapter *sc)
 {
 	int i, rc;
 	struct sge_iq *iq, *fwq;
+	struct sge_ctrlq *ctrlq;
 	iq_intr_handler_t *handler;
 	char name[16];
 
 	ADAPTER_LOCK_ASSERT_NOTOWNED(sc);
 
+	if (sysctl_ctx_init(&sc->ctx) == 0) {
+		struct sysctl_oid *oid = device_get_sysctl_tree(sc->dev);
+		struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid);
+
+		sc->oid_ctrlq = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO,
+		    "ctrlq", CTLFLAG_RD, NULL, "ctrl queues");
+	}
+
 	fwq = &sc->sge.fwq;
 	if (sc->flags & INTR_FWD) {
 		iq = &sc->sge.fiq[0];
@@ -292,6 +305,25 @@ t4_setup_adapter_iqs(struct adapter *sc)
 	if (rc != 0) {
 		device_printf(sc->dev,
 		    "failed to create firmware event queue: %d\n", rc);
+
+		return (rc);
+	}
+
+	/*
+	 * Control queues - one per hardware channel.
+	 */
+	ctrlq = &sc->sge.ctrlq[0];
+	for (i = 0; i < NCHAN; i++, ctrlq++) {
+		snprintf(name, sizeof(name), "%s ctrlq%d",
+		    device_get_nameunit(sc->dev), i);
+		init_eq(&ctrlq->eq, CTRL_EQ_QSIZE, name);
+
+		rc = alloc_ctrlq(sc, ctrlq, i);
+		if (rc != 0) {
+			device_printf(sc->dev,
+			    "failed to create control queue %d: %d\n", i, rc);
+			return (rc);
+		}
 	}
 
 	return (rc);
@@ -301,13 +333,22 @@ t4_setup_adapter_iqs(struct adapter *sc)
  * Idempotent
  */
 int
-t4_teardown_adapter_iqs(struct adapter *sc)
+t4_teardown_adapter_queues(struct adapter *sc)
 {
 	int i;
 	struct sge_iq *iq;
 
 	ADAPTER_LOCK_ASSERT_NOTOWNED(sc);
 
+	/* Do this before freeing the queues */
+	if (sc->oid_ctrlq) {
+		sysctl_ctx_free(&sc->ctx);
+		sc->oid_ctrlq = NULL;
+	}
+
+	for (i = 0; i < NCHAN; i++)
+		free_ctrlq(sc, &sc->sge.ctrlq[i]);
+
 	iq = &sc->sge.fwq;
 	free_iq(iq);
 	if (sc->flags & INTR_FWD) {
@@ -367,7 +408,7 @@ t4_setup_eth_queues(struct port_info *pi
 
 		snprintf(name, sizeof(name), "%s txq%d",
 		    device_get_nameunit(pi->dev), i);
-		init_txq(txq, pi->qsize_txq, name);
+		init_eq(&txq->eq, pi->qsize_txq, name);
 
 		rc = alloc_txq(pi, txq, i);
 		if (rc != 0)
@@ -722,9 +763,7 @@ t4_eth_rx(void *arg)
 		FL_LOCK(fl);
 		fl->needed += i;
 		if (fl->needed >= 32)
-			refill_fl(fl, 64);
-		if (fl->pending >= 32)
-			ring_fl_db(sc, fl);
+			refill_fl(sc, fl, 64, 32);
 		FL_UNLOCK(fl);
 
 nextdesc:	ndescs++;
@@ -752,12 +791,16 @@ nextdesc:	ndescs++;
 
 	FL_LOCK(fl);
 	if (fl->needed >= 32)
-		refill_fl(fl, 128);
-	if (fl->pending >= 8)
-		ring_fl_db(sc, fl);
+		refill_fl(sc, fl, 128, 8);
 	FL_UNLOCK(fl);
 }
 
+int
+t4_mgmt_tx(struct adapter *sc, struct mbuf *m)
+{
+	return ctrl_tx(sc, &sc->sge.ctrlq[0], m);
+}
+
 /* Per-packet header in a coalesced tx WR, before the SGL starts (in flits) */
 #define TXPKTS_PKT_HDR ((\
     sizeof(struct ulp_txpkt) + \
@@ -789,7 +832,7 @@ t4_eth_tx(struct ifnet *ifp, struct sge_
 	struct port_info *pi = (void *)ifp->if_softc;
 	struct adapter *sc = pi->adapter;
 	struct sge_eq *eq = &txq->eq;
-	struct buf_ring *br = eq->br;
+	struct buf_ring *br = txq->br;
 	struct mbuf *next;
 	int rc, coalescing, can_reclaim;
 	struct txpkts txpkts;
@@ -799,13 +842,13 @@ t4_eth_tx(struct ifnet *ifp, struct sge_
 	KASSERT(m, ("%s: called with nothing to do.", __func__));
 
 	prefetch(&eq->desc[eq->pidx]);
-	prefetch(&eq->sdesc[eq->pidx]);
+	prefetch(&txq->sdesc[eq->pidx]);
 
 	txpkts.npkt = 0;/* indicates there's nothing in txpkts */
 	coalescing = 0;
 
 	if (eq->avail < 8)
-		reclaim_tx_descs(eq, 0, 8);
+		reclaim_tx_descs(txq, 0, 8);
 
 	for (; m; m = next ? next : drbr_dequeue(ifp, br)) {
 
@@ -861,7 +904,7 @@ t4_eth_tx(struct ifnet *ifp, struct sge_
 		coalescing = 0;
 
 		if (eq->avail < 8)
-			reclaim_tx_descs(eq, 0, 8);
+			reclaim_tx_descs(txq, 0, 8);
 		rc = write_txpkt_wr(pi, txq, m, &sgl);
 		if (rc != 0) {
 
@@ -887,11 +930,11 @@ t4_eth_tx(struct ifnet *ifp, struct sge_
 doorbell:
 		/* Fewer and fewer doorbells as the queue fills up */
 		if (eq->pending >= (1 << (fls(eq->qsize - eq->avail) / 2)))
-		    ring_tx_db(sc, eq);
+		    ring_eq_db(sc, eq);
 
 		can_reclaim = reclaimable(eq);
 		if (can_reclaim >= 32)
-			reclaim_tx_descs(eq, can_reclaim, 32);
+			reclaim_tx_descs(txq, can_reclaim, 32);
 	}
 
 	if (txpkts.npkt > 0)
@@ -907,16 +950,21 @@ doorbell:
 	 * WR that reduced it to 0 so we don't need another flush (we don't have
 	 * any descriptor for a flush WR anyway, duh).
 	 */
-	if (m && eq->avail > 0 && !(eq->flags & EQ_CRFLUSHED))
+	if (m && eq->avail > 0 && !(eq->flags & EQ_CRFLUSHED)) {
+		struct tx_sdesc *txsd = &txq->sdesc[eq->pidx];
+
+		txsd->desc_used = 1;
+		txsd->credits = 0;
 		write_eqflush_wr(eq);
+	}
 	txq->m = m;
 
 	if (eq->pending)
-		ring_tx_db(sc, eq);
+		ring_eq_db(sc, eq);
 
 	can_reclaim = reclaimable(eq);
 	if (can_reclaim >= 32)
-		reclaim_tx_descs(eq, can_reclaim, 128);
+		reclaim_tx_descs(txq, can_reclaim, 128);
 
 	return (0);
 }
@@ -970,10 +1018,10 @@ init_fl(struct sge_fl *fl, int qsize, ch
 }
 
 static inline void
-init_txq(struct sge_txq *txq, int qsize, char *name)
+init_eq(struct sge_eq *eq, int qsize, char *name)
 {
-	txq->eq.qsize = qsize;
-	strlcpy(txq->eq.lockname, name, sizeof(txq->eq.lockname));
+	eq->qsize = qsize;
+	strlcpy(eq->lockname, name, sizeof(eq->lockname));
 }
 
 static int
@@ -1127,7 +1175,7 @@ alloc_iq_fl(struct port_info *pi, struct
 			    rc);
 			return (rc);
 		}
-		fl->needed = fl->cap - 1; /* one less to avoid cidx = pidx */
+		fl->needed = fl->cap;
 
 		c.iqns_to_fl0congen =
 		    htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE));
@@ -1170,9 +1218,7 @@ alloc_iq_fl(struct port_info *pi, struct
 		sc->sge.eqmap[cntxt_id] = (void *)fl;
 
 		FL_LOCK(fl);
-		refill_fl(fl, -1);
-		if (fl->pending >= 8)
-			ring_fl_db(sc, fl);
+		refill_fl(sc, fl, -1, 8);
 		FL_UNLOCK(fl);
 	}
 
@@ -1333,6 +1379,110 @@ free_rxq(struct port_info *pi, struct sg
 }
 
 static int
+alloc_ctrlq(struct adapter *sc, struct sge_ctrlq *ctrlq, int idx)
+{
+	int rc, cntxt_id;
+	size_t len;
+	struct fw_eq_ctrl_cmd c;
+	struct sge_eq *eq = &ctrlq->eq;
+	char name[16];
+	struct sysctl_oid *oid;
+	struct sysctl_oid_list *children;
+
+	mtx_init(&eq->eq_lock, eq->lockname, NULL, MTX_DEF);
+
+	len = eq->qsize * CTRL_EQ_ESIZE;
+	rc = alloc_ring(sc, len, &eq->desc_tag, &eq->desc_map,
+	    &eq->ba, (void **)&eq->desc);
+	if (rc)
+		return (rc);
+
+	eq->cap = eq->qsize - SPG_LEN / CTRL_EQ_ESIZE;
+	eq->spg = (void *)&eq->desc[eq->cap];
+	eq->avail = eq->cap - 1;	/* one less to avoid cidx = pidx */
+	eq->iqid = sc->sge.fwq.cntxt_id;
+
+	bzero(&c, sizeof(c));
+
+	c.op_to_vfn = htobe32(V_FW_CMD_OP(FW_EQ_CTRL_CMD) | F_FW_CMD_REQUEST |
+	    F_FW_CMD_WRITE | F_FW_CMD_EXEC | V_FW_EQ_CTRL_CMD_PFN(sc->pf) |
+	    V_FW_EQ_CTRL_CMD_VFN(0));
+	c.alloc_to_len16 = htobe32(F_FW_EQ_CTRL_CMD_ALLOC |
+	    F_FW_EQ_CTRL_CMD_EQSTART | FW_LEN16(c));
+	c.cmpliqid_eqid = htonl(V_FW_EQ_CTRL_CMD_CMPLIQID(eq->iqid)); /* XXX */
+	c.physeqid_pkd = htobe32(0);
+	c.fetchszm_to_iqid =
+	    htobe32(V_FW_EQ_CTRL_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) |
+		V_FW_EQ_CTRL_CMD_PCIECHN(idx) |
+		V_FW_EQ_CTRL_CMD_IQID(eq->iqid));
+	c.dcaen_to_eqsize =
+	    htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) |
+		V_FW_EQ_CTRL_CMD_FBMAX(X_FETCHBURSTMAX_512B) |
+		V_FW_EQ_CTRL_CMD_CIDXFTHRESH(X_CIDXFLUSHTHRESH_32) |
+		V_FW_EQ_CTRL_CMD_EQSIZE(eq->qsize));
+	c.eqaddr = htobe64(eq->ba);
+
+	rc = -t4_wr_mbox(sc, sc->mbox, &c, sizeof(c), &c);
+	if (rc != 0) {
+		device_printf(sc->dev,
+		    "failed to create control queue %d: %d\n", idx, rc);
+		return (rc);
+	}
+
+	eq->pidx = eq->cidx = 0;
+	eq->cntxt_id = G_FW_EQ_CTRL_CMD_EQID(be32toh(c.cmpliqid_eqid));
+	eq->flags |= (EQ_ALLOCATED | EQ_STARTED);
+
+	cntxt_id = eq->cntxt_id - sc->sge.eq_start;
+	KASSERT(cntxt_id < sc->sge.neq,
+	    ("%s: eq->cntxt_id (%d) more than the max (%d)", __func__,
+	    cntxt_id, sc->sge.neq - 1));
+	sc->sge.eqmap[cntxt_id] = eq;
+
+	children = SYSCTL_CHILDREN(sc->oid_ctrlq);
+
+	snprintf(name, sizeof(name), "%d", idx);
+	oid = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, name, CTLFLAG_RD,
+	    NULL, "ctrl queue");
+	children = SYSCTL_CHILDREN(oid);
+
+	SYSCTL_ADD_QUAD(&sc->ctx, children, OID_AUTO, "total_wrs", CTLFLAG_RD,
+	    &ctrlq->total_wrs, "total # of work requests");
+	SYSCTL_ADD_UINT(&sc->ctx, children, OID_AUTO, "no_desc", CTLFLAG_RD,
+	    &ctrlq->no_desc, 0,
+	    "# of times ctrlq ran out of hardware descriptors");
+	SYSCTL_ADD_UINT(&sc->ctx, children, OID_AUTO, "too_long", CTLFLAG_RD,
+	    &ctrlq->too_long, 0, "# of oversized work requests");
+
+	return (rc);
+}
+
+static int
+free_ctrlq(struct adapter *sc, struct sge_ctrlq *ctrlq)
+{
+	int rc;
+	struct sge_eq *eq = &ctrlq->eq;
+
+	if (eq->flags & (EQ_ALLOCATED | EQ_STARTED)) {
+		rc = -t4_ctrl_eq_free(sc, sc->mbox, sc->pf, 0, eq->cntxt_id);
+		if (rc != 0) {
+			device_printf(sc->dev,
+			    "failed to free ctrl queue %p: %d\n", eq, rc);
+			return (rc);
+		}
+		eq->flags &= ~(EQ_ALLOCATED | EQ_STARTED);
+	}
+
+	free_ring(sc, eq->desc_tag, eq->desc_map, eq->ba, eq->desc);
+
+	if (mtx_initialized(&eq->eq_lock))
+		mtx_destroy(&eq->eq_lock);
+
+	bzero(ctrlq, sizeof(*ctrlq));
+	return (0);
+}
+
+static int
 alloc_txq(struct port_info *pi, struct sge_txq *txq, int idx)
 {
 	int rc, cntxt_id;
@@ -1358,21 +1508,21 @@ alloc_txq(struct port_info *pi, struct s
 	eq->cap = eq->qsize - SPG_LEN / TX_EQ_ESIZE;
 	eq->spg = (void *)&eq->desc[eq->cap];
 	eq->avail = eq->cap - 1;	/* one less to avoid cidx = pidx */
-	eq->sdesc = malloc(eq->cap * sizeof(struct tx_sdesc), M_CXGBE,
+	txq->sdesc = malloc(eq->cap * sizeof(struct tx_sdesc), M_CXGBE,
 	    M_ZERO | M_WAITOK);
-	eq->br = buf_ring_alloc(eq->qsize, M_CXGBE, M_WAITOK, &eq->eq_lock);
+	txq->br = buf_ring_alloc(eq->qsize, M_CXGBE, M_WAITOK, &eq->eq_lock);
 	eq->iqid = sc->sge.rxq[pi->first_rxq].iq.cntxt_id;
 
 	rc = bus_dma_tag_create(sc->dmat, 1, 0, BUS_SPACE_MAXADDR,
 	    BUS_SPACE_MAXADDR, NULL, NULL, 64 * 1024, TX_SGL_SEGS,
-	    BUS_SPACE_MAXSIZE, BUS_DMA_ALLOCNOW, NULL, NULL, &eq->tx_tag);
+	    BUS_SPACE_MAXSIZE, BUS_DMA_ALLOCNOW, NULL, NULL, &txq->tx_tag);
 	if (rc != 0) {
 		device_printf(sc->dev,
 		    "failed to create tx DMA tag: %d\n", rc);
 		return (rc);
 	}
 
-	rc = alloc_eq_maps(eq);
+	rc = alloc_tx_maps(txq);
 	if (rc != 0) {
 		device_printf(sc->dev, "failed to setup tx DMA maps: %d\n", rc);
 		return (rc);
@@ -1488,15 +1638,15 @@ free_txq(struct port_info *pi, struct sg
 
 	free_ring(sc, eq->desc_tag, eq->desc_map, eq->ba, eq->desc);
 
-	free(eq->sdesc, M_CXGBE);
+	free(txq->sdesc, M_CXGBE);
 
-	if (eq->maps)
-		free_eq_maps(eq);
+	if (txq->maps)
+		free_tx_maps(txq);
 
-	buf_ring_free(eq->br, M_CXGBE);
+	buf_ring_free(txq->br, M_CXGBE);
 
-	if (eq->tx_tag)
-		bus_dma_tag_destroy(eq->tx_tag);
+	if (txq->tx_tag)
+		bus_dma_tag_destroy(txq->tx_tag);
 
 	if (mtx_initialized(&eq->eq_lock))
 		mtx_destroy(&eq->eq_lock);
@@ -1536,24 +1686,31 @@ iq_next(struct sge_iq *iq)
 	}
 }
 
+#define FL_HW_IDX(x) ((x) >> 3)
 static inline void
 ring_fl_db(struct adapter *sc, struct sge_fl *fl)
 {
 	int ndesc = fl->pending / 8;
 
-	/* Caller responsible for ensuring there's something useful to do */
-	KASSERT(ndesc > 0, ("%s called with no useful work to do.", __func__));
+	if (FL_HW_IDX(fl->pidx) == FL_HW_IDX(fl->cidx))
+		ndesc--;	/* hold back one credit */
+
+	if (ndesc <= 0)
+		return;		/* nothing to do */
 
 	wmb();
 
 	t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), F_DBPRIO |
 	    V_QID(fl->cntxt_id) | V_PIDX(ndesc));
-
-	fl->pending &= 7;
+	fl->pending -= ndesc * 8;
 }
 
+/*
+ * Fill up the freelist by upto nbufs and ring its doorbell if the number of
+ * buffers ready to be handed to the hardware >= dbthresh.
+ */
 static void
-refill_fl(struct sge_fl *fl, int nbufs)
+refill_fl(struct adapter *sc, struct sge_fl *fl, int nbufs, int dbthresh)
 {
 	__be64 *d = &fl->desc[fl->pidx];
 	struct fl_sdesc *sd = &fl->sdesc[fl->pidx];
@@ -1644,6 +1801,9 @@ recycled:
 			d = fl->desc;
 		}
 	}
+
+	if (fl->pending >= dbthresh)
+		ring_fl_db(sc, fl);
 }
 
 static int
@@ -1718,7 +1878,7 @@ free_fl_sdesc(struct sge_fl *fl)
 }
 
 static int
-alloc_eq_maps(struct sge_eq *eq)
+alloc_tx_maps(struct sge_txq *txq)
 {
 	struct tx_map *txm;
 	int i, rc, count;
@@ -1728,16 +1888,16 @@ alloc_eq_maps(struct sge_eq *eq)
 	 * limit for any WR).  txq->no_dmamap events shouldn't occur if maps is
 	 * sized for the worst case.
 	 */
-	count = eq->qsize * 10 / 8;
-	eq->map_total = eq->map_avail = count;
-	eq->map_cidx = eq->map_pidx = 0;
+	count = txq->eq.qsize * 10 / 8;
+	txq->map_total = txq->map_avail = count;
+	txq->map_cidx = txq->map_pidx = 0;
 
-	eq->maps = malloc(count * sizeof(struct tx_map), M_CXGBE,
+	txq->maps = malloc(count * sizeof(struct tx_map), M_CXGBE,
 	    M_ZERO | M_WAITOK);
 
-	txm = eq->maps;
+	txm = txq->maps;
 	for (i = 0; i < count; i++, txm++) {
-		rc = bus_dmamap_create(eq->tx_tag, 0, &txm->map);
+		rc = bus_dmamap_create(txq->tx_tag, 0, &txm->map);
 		if (rc != 0)
 			goto failed;
 	}
@@ -1746,36 +1906,36 @@ alloc_eq_maps(struct sge_eq *eq)
 failed:
 	while (--i >= 0) {
 		txm--;
-		bus_dmamap_destroy(eq->tx_tag, txm->map);
+		bus_dmamap_destroy(txq->tx_tag, txm->map);
 	}
-	KASSERT(txm == eq->maps, ("%s: EDOOFUS", __func__));
+	KASSERT(txm == txq->maps, ("%s: EDOOFUS", __func__));
 
-	free(eq->maps, M_CXGBE);
-	eq->maps = NULL;
+	free(txq->maps, M_CXGBE);
+	txq->maps = NULL;
 
 	return (rc);
 }
 
 static void
-free_eq_maps(struct sge_eq *eq)
+free_tx_maps(struct sge_txq *txq)
 {
 	struct tx_map *txm;
 	int i;
 
-	txm = eq->maps;
-	for (i = 0; i < eq->map_total; i++, txm++) {
+	txm = txq->maps;
+	for (i = 0; i < txq->map_total; i++, txm++) {
 
 		if (txm->m) {
-			bus_dmamap_unload(eq->tx_tag, txm->map);
+			bus_dmamap_unload(txq->tx_tag, txm->map);
 			m_freem(txm->m);
 			txm->m = NULL;
 		}
 
-		bus_dmamap_destroy(eq->tx_tag, txm->map);
+		bus_dmamap_destroy(txq->tx_tag, txm->map);
 	}
 
-	free(eq->maps, M_CXGBE);
-	eq->maps = NULL;
+	free(txq->maps, M_CXGBE);
+	txq->maps = NULL;
 }
 
 /*
@@ -1802,7 +1962,6 @@ get_pkt_sgl(struct sge_txq *txq, struct 
     int sgl_only)
 {
 	struct mbuf *m = *fp;
-	struct sge_eq *eq = &txq->eq;
 	struct tx_map *txm;
 	int rc, defragged = 0, n;
 
@@ -1816,11 +1975,11 @@ start:	sgl->nsegs = 0;
 	if (m->m_pkthdr.len <= IMM_LEN && !sgl_only)
 		return (0);	/* nsegs = 0 tells caller to use imm. tx */
 
-	if (eq->map_avail == 0) {
+	if (txq->map_avail == 0) {
 		txq->no_dmamap++;
 		return (ENOMEM);
 	}
-	txm = &eq->maps[eq->map_pidx];
+	txm = &txq->maps[txq->map_pidx];
 
 	if (m->m_pkthdr.tso_segsz && m->m_len < 50) {
 		*fp = m_pullup(m, 50);
@@ -1829,7 +1988,7 @@ start:	sgl->nsegs = 0;
 			return (ENOBUFS);
 	}
 
-	rc = bus_dmamap_load_mbuf_sg(eq->tx_tag, txm->map, m, sgl->seg,
+	rc = bus_dmamap_load_mbuf_sg(txq->tx_tag, txm->map, m, sgl->seg,
 	    &sgl->nsegs, BUS_DMA_NOWAIT);
 	if (rc == EFBIG && defragged == 0) {
 		m = m_defrag(m, M_DONTWAIT);
@@ -1844,9 +2003,9 @@ start:	sgl->nsegs = 0;
 		return (rc);
 
 	txm->m = m;
-	eq->map_avail--;
-	if (++eq->map_pidx == eq->map_total)
-		eq->map_pidx = 0;
+	txq->map_avail--;
+	if (++txq->map_pidx == txq->map_total)
+		txq->map_pidx = 0;
 
 	KASSERT(sgl->nsegs > 0 && sgl->nsegs <= TX_SGL_SEGS,
 	    ("%s: bad DMA mapping (%d segments)", __func__, sgl->nsegs));
@@ -1870,7 +2029,6 @@ start:	sgl->nsegs = 0;
 static int
 free_pkt_sgl(struct sge_txq *txq, struct sgl *sgl)
 {
-	struct sge_eq *eq = &txq->eq;
 	struct tx_map *txm;
 
 	TXQ_LOCK_ASSERT_OWNED(txq);
@@ -1880,14 +2038,14 @@ free_pkt_sgl(struct sge_txq *txq, struct
 
 	/* 1 pkt uses exactly 1 map, back it out */
 
-	eq->map_avail++;
-	if (eq->map_pidx > 0)
-		eq->map_pidx--;
+	txq->map_avail++;
+	if (txq->map_pidx > 0)
+		txq->map_pidx--;
 	else
-		eq->map_pidx = eq->map_total - 1;
+		txq->map_pidx = txq->map_total - 1;
 
-	txm = &eq->maps[eq->map_pidx];
-	bus_dmamap_unload(eq->tx_tag, txm->map);
+	txm = &txq->maps[txq->map_pidx];
+	bus_dmamap_unload(txq->tx_tag, txm->map);
 	txm->m = NULL;
 
 	return (0);
@@ -1997,7 +2155,7 @@ write_txpkt_wr(struct port_info *pi, str
 	cpl->ctrl1 = htobe64(ctrl1);
 
 	/* Software descriptor */
-	txsd = &eq->sdesc[eq->pidx];
+	txsd = &txq->sdesc[eq->pidx];
 	txsd->desc_used = ndesc;
 
 	eq->pending += ndesc;
@@ -2009,11 +2167,11 @@ write_txpkt_wr(struct port_info *pi, str
 	/* SGL */
 	dst = (void *)(cpl + 1);
 	if (sgl->nsegs > 0) {
-		txsd->map_used = 1;
+		txsd->credits = 1;
 		txq->sgl_wrs++;
 		write_sgl_to_txd(eq, sgl, &dst);
 	} else {
-		txsd->map_used = 0;
+		txsd->credits = 0;
 		txq->imm_wrs++;
 		for (; m; m = m->m_next) {
 			copy_to_txd(eq, mtod(m, caddr_t), &dst, m->m_len);
@@ -2063,8 +2221,8 @@ add_to_txpkts(struct port_info *pi, stru
 			txpkts->nflits += flits;
 			txpkts->plen += m->m_pkthdr.len;
 
-			txsd = &eq->sdesc[eq->pidx];
-			txsd->map_used++;
+			txsd = &txq->sdesc[eq->pidx];
+			txsd->credits++;
 
 			return (0);
 		}
@@ -2098,8 +2256,8 @@ add_to_txpkts(struct port_info *pi, stru
 	txpkts->flitp = &eq->desc[eq->pidx].flit[2];
 	txpkts->plen = m->m_pkthdr.len;
 
-	txsd = &eq->sdesc[eq->pidx];
-	txsd->map_used = 1;
+	txsd = &txq->sdesc[eq->pidx];
+	txsd->credits = 1;
 
 	return (0);
 }
@@ -2137,7 +2295,7 @@ write_txpkts_wr(struct sge_txq *txq, str
 
 	/* Everything else already written */
 
-	txsd = &eq->sdesc[eq->pidx];
+	txsd = &txq->sdesc[eq->pidx];
 	txsd->desc_used = ndesc;
 
 	KASSERT(eq->avail >= ndesc, ("%s: out of descriptors", __func__));
@@ -2328,7 +2486,7 @@ copy_to_txd(struct sge_eq *eq, caddr_t f
 }
 
 static inline void
-ring_tx_db(struct adapter *sc, struct sge_eq *eq)
+ring_eq_db(struct adapter *sc, struct sge_eq *eq)
 {
 	wmb();
 	t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL),
@@ -2357,11 +2515,12 @@ reclaimable(struct sge_eq *eq)
  * The actual number reclaimed is provided as the return value.
  */
 static int
-reclaim_tx_descs(struct sge_eq *eq, int can_reclaim, int n)
+reclaim_tx_descs(struct sge_txq *txq, int can_reclaim, int n)
 {
 	struct tx_sdesc *txsd;
 	struct tx_map *txm;
 	unsigned int reclaimed, maps;
+	struct sge_eq *eq = &txq->eq;
 
 	EQ_LOCK_ASSERT_OWNED(eq);
 
@@ -2372,7 +2531,7 @@ reclaim_tx_descs(struct sge_eq *eq, int 
 	while (can_reclaim && maps < n) {
 		int ndesc;
 
-		txsd = &eq->sdesc[eq->cidx];
+		txsd = &txq->sdesc[eq->cidx];
 		ndesc = txsd->desc_used;
 
 		/* Firmware doesn't return "partial" credits. */
@@ -2380,7 +2539,7 @@ reclaim_tx_descs(struct sge_eq *eq, int 
 		    ("%s: unexpected number of credits: %d, %d",
 		    __func__, can_reclaim, ndesc));
 
-		maps += txsd->map_used;
+		maps += txsd->credits;
 
 		reclaimed += ndesc;
 		can_reclaim -= ndesc;
@@ -2390,7 +2549,7 @@ reclaim_tx_descs(struct sge_eq *eq, int 
 			eq->cidx -= eq->cap;
 	}
 
-	txm = &eq->maps[eq->map_cidx];
+	txm = &txq->maps[txq->map_cidx];
 	if (maps)
 		prefetch(txm->m);
 
@@ -2398,25 +2557,25 @@ reclaim_tx_descs(struct sge_eq *eq, int 
 	KASSERT(eq->avail < eq->cap,	/* avail tops out at (cap - 1) */
 	    ("%s: too many descriptors available", __func__));
 
-	eq->map_avail += maps;
-	KASSERT(eq->map_avail <= eq->map_total,
+	txq->map_avail += maps;
+	KASSERT(txq->map_avail <= txq->map_total,
 	    ("%s: too many maps available", __func__));
 
 	while (maps--) {
 		struct tx_map *next;

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

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 17:07:23 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 42A90106564A;
	Wed, 27 Apr 2011 17:07:23 +0000 (UTC)
	(envelope-from pluknet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 19B3E8FC14;
	Wed, 27 Apr 2011 17:07:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3RH7MlY080460;
	Wed, 27 Apr 2011 17:07:22 GMT (envelope-from pluknet@svn.freebsd.org)
Received: (from pluknet@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3RH7MJT080455;
	Wed, 27 Apr 2011 17:07:22 GMT (envelope-from pluknet@svn.freebsd.org)
Message-Id: <201104271707.p3RH7MJT080455@svn.freebsd.org>
From: Sergey Kandaurov 
Date: Wed, 27 Apr 2011 17:07:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221122 - stable/8/sys/mips/conf
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 17:07:23 -0000

Author: pluknet
Date: Wed Apr 27 17:07:22 2011
New Revision: 221122
URL: http://svn.freebsd.org/changeset/base/221122

Log:
  MFC r216475 (by gonzo):
  - include argument should be in quotes

Modified:
  stable/8/sys/mips/conf/SWARM
  stable/8/sys/mips/conf/SWARM64
  stable/8/sys/mips/conf/SWARM64_SMP
  stable/8/sys/mips/conf/SWARM_SMP
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/mips/conf/SWARM
==============================================================================
--- stable/8/sys/mips/conf/SWARM	Wed Apr 27 16:43:03 2011	(r221121)
+++ stable/8/sys/mips/conf/SWARM	Wed Apr 27 17:07:22 2011	(r221122)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 #
 
-include		std.SWARM
+include		"std.SWARM"
 
 ident		SWARM
 

Modified: stable/8/sys/mips/conf/SWARM64
==============================================================================
--- stable/8/sys/mips/conf/SWARM64	Wed Apr 27 16:43:03 2011	(r221121)
+++ stable/8/sys/mips/conf/SWARM64	Wed Apr 27 17:07:22 2011	(r221122)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 #
 
-include		std.SWARM
+include		"std.SWARM"
 
 ident		SWARM64
 

Modified: stable/8/sys/mips/conf/SWARM64_SMP
==============================================================================
--- stable/8/sys/mips/conf/SWARM64_SMP	Wed Apr 27 16:43:03 2011	(r221121)
+++ stable/8/sys/mips/conf/SWARM64_SMP	Wed Apr 27 17:07:22 2011	(r221122)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 #
 
-include		std.SWARM
+include		"std.SWARM"
 
 ident		SWARM64_SMP
 

Modified: stable/8/sys/mips/conf/SWARM_SMP
==============================================================================
--- stable/8/sys/mips/conf/SWARM_SMP	Wed Apr 27 16:43:03 2011	(r221121)
+++ stable/8/sys/mips/conf/SWARM_SMP	Wed Apr 27 17:07:22 2011	(r221122)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 #
 
-include		std.SWARM
+include		"std.SWARM"
 
 ident		SWARM_SMP
 

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 18:00:48 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4A5861065672;
	Wed, 27 Apr 2011 18:00:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 37E2A8FC0A;
	Wed, 27 Apr 2011 18:00:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3RI0mn9082388;
	Wed, 27 Apr 2011 18:00:48 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3RI0kJD082284;
	Wed, 27 Apr 2011 18:00:46 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201104271800.p3RI0kJD082284@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 27 Apr 2011 18:00:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221125 - in stable/8/sys: amd64/acpica cam
	dev/sound/usb dev/usb dev/usb/controller dev/usb/input
	dev/usb/misc dev/usb/net dev/usb/quirk dev/usb/serial
	dev/usb/storage dev/usb/template...
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 18:00:48 -0000

Author: jhb
Date: Wed Apr 27 18:00:46 2011
New Revision: 221125
URL: http://svn.freebsd.org/changeset/base/221125

Log:
  MFC 217265:
  Remove unneeded includes of .  Other headers that use
  it internally contain nested includes.
  
  Requested by:	hselasky

Modified:
  stable/8/sys/amd64/acpica/OsdEnvironment.c
  stable/8/sys/cam/cam_periph.c
  stable/8/sys/dev/sound/usb/uaudio.c
  stable/8/sys/dev/usb/controller/at91dci.c
  stable/8/sys/dev/usb/controller/at91dci_atmelarm.c
  stable/8/sys/dev/usb/controller/atmegadci.c
  stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c
  stable/8/sys/dev/usb/controller/avr32dci.c
  stable/8/sys/dev/usb/controller/ehci.c
  stable/8/sys/dev/usb/controller/ehci_ixp4xx.c
  stable/8/sys/dev/usb/controller/ehci_mbus.c
  stable/8/sys/dev/usb/controller/ehci_pci.c
  stable/8/sys/dev/usb/controller/musb_otg.c
  stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c
  stable/8/sys/dev/usb/controller/ohci.c
  stable/8/sys/dev/usb/controller/ohci_atmelarm.c
  stable/8/sys/dev/usb/controller/ohci_pci.c
  stable/8/sys/dev/usb/controller/uhci.c
  stable/8/sys/dev/usb/controller/uhci_pci.c
  stable/8/sys/dev/usb/controller/usb_controller.c
  stable/8/sys/dev/usb/controller/uss820dci.c
  stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c
  stable/8/sys/dev/usb/controller/xhci.c
  stable/8/sys/dev/usb/controller/xhci_pci.c
  stable/8/sys/dev/usb/input/uhid.c
  stable/8/sys/dev/usb/input/ukbd.c
  stable/8/sys/dev/usb/input/ums.c
  stable/8/sys/dev/usb/misc/udbp.c
  stable/8/sys/dev/usb/misc/ufm.c
  stable/8/sys/dev/usb/net/if_aue.c
  stable/8/sys/dev/usb/net/if_axe.c
  stable/8/sys/dev/usb/net/if_cdce.c
  stable/8/sys/dev/usb/net/if_cue.c
  stable/8/sys/dev/usb/net/if_ipheth.c
  stable/8/sys/dev/usb/net/if_kue.c
  stable/8/sys/dev/usb/net/if_rue.c
  stable/8/sys/dev/usb/net/if_udav.c
  stable/8/sys/dev/usb/net/usb_ethernet.c
  stable/8/sys/dev/usb/quirk/usb_quirk.c
  stable/8/sys/dev/usb/serial/u3g.c
  stable/8/sys/dev/usb/serial/uark.c
  stable/8/sys/dev/usb/serial/ubsa.c
  stable/8/sys/dev/usb/serial/ubser.c
  stable/8/sys/dev/usb/serial/uchcom.c
  stable/8/sys/dev/usb/serial/ucycom.c
  stable/8/sys/dev/usb/serial/ufoma.c
  stable/8/sys/dev/usb/serial/uftdi.c
  stable/8/sys/dev/usb/serial/ugensa.c
  stable/8/sys/dev/usb/serial/uipaq.c
  stable/8/sys/dev/usb/serial/ulpt.c
  stable/8/sys/dev/usb/serial/umct.c
  stable/8/sys/dev/usb/serial/umodem.c
  stable/8/sys/dev/usb/serial/umoscom.c
  stable/8/sys/dev/usb/serial/uplcom.c
  stable/8/sys/dev/usb/serial/usb_serial.c
  stable/8/sys/dev/usb/serial/uslcom.c
  stable/8/sys/dev/usb/serial/uvisor.c
  stable/8/sys/dev/usb/serial/uvscom.c
  stable/8/sys/dev/usb/storage/umass.c
  stable/8/sys/dev/usb/storage/urio.c
  stable/8/sys/dev/usb/storage/ustorage_fs.c
  stable/8/sys/dev/usb/template/usb_template.c
  stable/8/sys/dev/usb/template/usb_template_cdce.c
  stable/8/sys/dev/usb/template/usb_template_msc.c
  stable/8/sys/dev/usb/template/usb_template_mtp.c
  stable/8/sys/dev/usb/usb_busdma.c
  stable/8/sys/dev/usb/usb_compat_linux.c
  stable/8/sys/dev/usb/usb_core.c
  stable/8/sys/dev/usb/usb_debug.c
  stable/8/sys/dev/usb/usb_dev.c
  stable/8/sys/dev/usb/usb_device.c
  stable/8/sys/dev/usb/usb_dynamic.c
  stable/8/sys/dev/usb/usb_error.c
  stable/8/sys/dev/usb/usb_generic.c
  stable/8/sys/dev/usb/usb_handle_request.c
  stable/8/sys/dev/usb/usb_hid.c
  stable/8/sys/dev/usb/usb_hub.c
  stable/8/sys/dev/usb/usb_lookup.c
  stable/8/sys/dev/usb/usb_mbuf.c
  stable/8/sys/dev/usb/usb_msctest.c
  stable/8/sys/dev/usb/usb_parse.c
  stable/8/sys/dev/usb/usb_process.c
  stable/8/sys/dev/usb/usb_request.c
  stable/8/sys/dev/usb/usb_transfer.c
  stable/8/sys/dev/usb/usb_util.c
  stable/8/sys/i386/acpica/OsdEnvironment.c
  stable/8/sys/ia64/acpica/OsdEnvironment.c
  stable/8/sys/kern/kern_lock.c
  stable/8/sys/kern/kern_sx.c
  stable/8/sys/kern/subr_lock.c
  stable/8/sys/kern/subr_pcpu.c
  stable/8/sys/mips/cavium/usb/octusb.c
  stable/8/sys/mips/cavium/usb/octusb_octeon.c
  stable/8/sys/mips/rmi/xls_ehci.c
  stable/8/sys/net/vnet.c
  stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
  stable/8/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c
  stable/8/sys/sparc64/sparc64/db_trace.c
  stable/8/sys/sparc64/sparc64/tlb.c
  stable/8/sys/sparc64/sparc64/tsb.c
  stable/8/sys/sparc64/sparc64/vm_machdep.c
  stable/8/sys/sun4v/sun4v/db_interface.c
  stable/8/sys/sun4v/sun4v/db_trace.c
  stable/8/sys/sun4v/sun4v/vm_machdep.c
  stable/8/sys/vm/phys_pager.c
  stable/8/sys/vm/vm_contig.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/amd64/acpica/OsdEnvironment.c
==============================================================================
--- stable/8/sys/amd64/acpica/OsdEnvironment.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/amd64/acpica/OsdEnvironment.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$");
  */
 #include 
 #include 
-#include 
 #include 
 
 #include 

Modified: stable/8/sys/cam/cam_periph.c
==============================================================================
--- stable/8/sys/cam/cam_periph.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/cam/cam_periph.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/sound/usb/uaudio.c
==============================================================================
--- stable/8/sys/dev/sound/usb/uaudio.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/sound/usb/uaudio.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -53,7 +53,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/at91dci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/at91dci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/at91dci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/at91dci_atmelarm.c
==============================================================================
--- stable/8/sys/dev/usb/controller/at91dci_atmelarm.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/at91dci_atmelarm.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/atmegadci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/atmegadci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/atmegadci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c
==============================================================================
--- stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/avr32dci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/avr32dci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/avr32dci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/ehci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/ehci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/ehci_ixp4xx.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci_ixp4xx.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/ehci_ixp4xx.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/ehci_mbus.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci_mbus.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/ehci_mbus.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/ehci_pci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci_pci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/ehci_pci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/musb_otg.c
==============================================================================
--- stable/8/sys/dev/usb/controller/musb_otg.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/musb_otg.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -44,7 +44,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c
==============================================================================
--- stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/ohci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ohci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/ohci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/ohci_atmelarm.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ohci_atmelarm.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/ohci_atmelarm.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/ohci_pci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ohci_pci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/ohci_pci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/uhci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/uhci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/uhci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/uhci_pci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/uhci_pci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/uhci_pci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- stable/8/sys/dev/usb/controller/usb_controller.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/usb_controller.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/uss820dci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/uss820dci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/uss820dci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c
==============================================================================
--- stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/xhci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/xhci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/xhci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/xhci_pci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/xhci_pci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/controller/xhci_pci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/input/uhid.c
==============================================================================
--- stable/8/sys/dev/usb/input/uhid.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/input/uhid.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/input/ukbd.c
==============================================================================
--- stable/8/sys/dev/usb/input/ukbd.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/input/ukbd.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/input/ums.c
==============================================================================
--- stable/8/sys/dev/usb/input/ums.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/input/ums.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/misc/udbp.c
==============================================================================
--- stable/8/sys/dev/usb/misc/udbp.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/misc/udbp.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/misc/ufm.c
==============================================================================
--- stable/8/sys/dev/usb/misc/ufm.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/misc/ufm.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/net/if_aue.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_aue.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/net/if_aue.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -76,7 +76,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/net/if_axe.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_axe.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/net/if_axe.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/net/if_cdce.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_cdce.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/net/if_cdce.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/net/if_cue.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_cue.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/net/if_cue.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/net/if_ipheth.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_ipheth.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/net/if_ipheth.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/net/if_kue.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_kue.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/net/if_kue.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -73,7 +73,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/net/if_rue.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_rue.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/net/if_rue.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -73,7 +73,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/net/if_udav.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_udav.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/net/if_udav.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/net/usb_ethernet.c
==============================================================================
--- stable/8/sys/dev/usb/net/usb_ethernet.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/net/usb_ethernet.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c
==============================================================================
--- stable/8/sys/dev/usb/quirk/usb_quirk.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/quirk/usb_quirk.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/u3g.c
==============================================================================
--- stable/8/sys/dev/usb/serial/u3g.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/u3g.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -39,7 +39,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/uark.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uark.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/uark.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/ubsa.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ubsa.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/ubsa.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -70,7 +70,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/ubser.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ubser.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/ubser.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/uchcom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uchcom.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/uchcom.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/ucycom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ucycom.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/ucycom.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/ufoma.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ufoma.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/ufoma.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -90,7 +90,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/uftdi.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uftdi.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/uftdi.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/ugensa.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ugensa.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/ugensa.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -43,7 +43,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/uipaq.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uipaq.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/uipaq.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/ulpt.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ulpt.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/ulpt.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/umct.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umct.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/umct.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/umodem.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umodem.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/umodem.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -88,7 +88,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/umoscom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umoscom.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/umoscom.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/uplcom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uplcom.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/uplcom.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -92,7 +92,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/usb_serial.c
==============================================================================
--- stable/8/sys/dev/usb/serial/usb_serial.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/usb_serial.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/uslcom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uslcom.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/uslcom.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -27,7 +27,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/uvisor.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uvisor.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/uvisor.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -55,7 +55,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/serial/uvscom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uvscom.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/serial/uvscom.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/storage/umass.c
==============================================================================
--- stable/8/sys/dev/usb/storage/umass.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/storage/umass.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -110,7 +110,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/storage/urio.c
==============================================================================
--- stable/8/sys/dev/usb/storage/urio.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/storage/urio.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/storage/ustorage_fs.c
==============================================================================
--- stable/8/sys/dev/usb/storage/ustorage_fs.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/storage/ustorage_fs.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -44,7 +44,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/template/usb_template.c
==============================================================================
--- stable/8/sys/dev/usb/template/usb_template.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/template/usb_template.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/template/usb_template_cdce.c
==============================================================================
--- stable/8/sys/dev/usb/template/usb_template_cdce.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/template/usb_template_cdce.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/template/usb_template_msc.c
==============================================================================
--- stable/8/sys/dev/usb/template/usb_template_msc.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/template/usb_template_msc.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/template/usb_template_mtp.c
==============================================================================
--- stable/8/sys/dev/usb/template/usb_template_mtp.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/template/usb_template_mtp.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_busdma.c
==============================================================================
--- stable/8/sys/dev/usb/usb_busdma.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_busdma.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_compat_linux.c
==============================================================================
--- stable/8/sys/dev/usb/usb_compat_linux.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_compat_linux.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_core.c
==============================================================================
--- stable/8/sys/dev/usb/usb_core.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_core.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -38,7 +38,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_debug.c
==============================================================================
--- stable/8/sys/dev/usb/usb_debug.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_debug.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_dev.c
==============================================================================
--- stable/8/sys/dev/usb/usb_dev.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_dev.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_device.c
==============================================================================
--- stable/8/sys/dev/usb/usb_device.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_device.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_dynamic.c
==============================================================================
--- stable/8/sys/dev/usb/usb_dynamic.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_dynamic.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_error.c
==============================================================================
--- stable/8/sys/dev/usb/usb_error.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_error.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_generic.c
==============================================================================
--- stable/8/sys/dev/usb/usb_generic.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_generic.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_handle_request.c
==============================================================================
--- stable/8/sys/dev/usb/usb_handle_request.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_handle_request.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_hid.c
==============================================================================
--- stable/8/sys/dev/usb/usb_hid.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_hid.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_hub.c
==============================================================================
--- stable/8/sys/dev/usb/usb_hub.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_hub.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -38,7 +38,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_lookup.c
==============================================================================
--- stable/8/sys/dev/usb/usb_lookup.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_lookup.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_mbuf.c
==============================================================================
--- stable/8/sys/dev/usb/usb_mbuf.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_mbuf.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_msctest.c
==============================================================================
--- stable/8/sys/dev/usb/usb_msctest.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_msctest.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_parse.c
==============================================================================
--- stable/8/sys/dev/usb/usb_parse.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_parse.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_process.c
==============================================================================
--- stable/8/sys/dev/usb/usb_process.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_process.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_request.c
==============================================================================
--- stable/8/sys/dev/usb/usb_request.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_request.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_transfer.c
==============================================================================
--- stable/8/sys/dev/usb/usb_transfer.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_transfer.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/usb_util.c
==============================================================================
--- stable/8/sys/dev/usb/usb_util.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/dev/usb/usb_util.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/i386/acpica/OsdEnvironment.c
==============================================================================
--- stable/8/sys/i386/acpica/OsdEnvironment.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/i386/acpica/OsdEnvironment.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$");
  */
 #include 
 #include 
-#include 
 #include 
 
 #include 

Modified: stable/8/sys/ia64/acpica/OsdEnvironment.c
==============================================================================
--- stable/8/sys/ia64/acpica/OsdEnvironment.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/ia64/acpica/OsdEnvironment.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -29,7 +29,6 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
 #include 
 #include 
 

Modified: stable/8/sys/kern/kern_lock.c
==============================================================================
--- stable/8/sys/kern/kern_lock.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/kern/kern_lock.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/kern/kern_sx.c
==============================================================================
--- stable/8/sys/kern/kern_sx.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/kern/kern_sx.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/kern/subr_lock.c
==============================================================================
--- stable/8/sys/kern/subr_lock.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/kern/subr_lock.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/kern/subr_pcpu.c
==============================================================================
--- stable/8/sys/kern/subr_pcpu.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/kern/subr_pcpu.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/mips/cavium/usb/octusb.c
==============================================================================
--- stable/8/sys/mips/cavium/usb/octusb.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/mips/cavium/usb/octusb.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/mips/cavium/usb/octusb_octeon.c
==============================================================================
--- stable/8/sys/mips/cavium/usb/octusb_octeon.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/mips/cavium/usb/octusb_octeon.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/mips/rmi/xls_ehci.c
==============================================================================
--- stable/8/sys/mips/rmi/xls_ehci.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/mips/rmi/xls_ehci.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/net/vnet.c
==============================================================================
--- stable/8/sys/net/vnet.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/net/vnet.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
==============================================================================
--- stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -100,7 +100,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c
==============================================================================
--- stable/8/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -39,7 +39,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/sparc64/sparc64/db_trace.c
==============================================================================
--- stable/8/sys/sparc64/sparc64/db_trace.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/sparc64/sparc64/db_trace.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/sparc64/sparc64/tlb.c
==============================================================================
--- stable/8/sys/sparc64/sparc64/tlb.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/sparc64/sparc64/tlb.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: stable/8/sys/sparc64/sparc64/tsb.c
==============================================================================
--- stable/8/sys/sparc64/sparc64/tsb.c	Wed Apr 27 17:51:51 2011	(r221124)
+++ stable/8/sys/sparc64/sparc64/tsb.c	Wed Apr 27 18:00:46 2011	(r221125)
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

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

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 19:36:01 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 103D9106566B;
	Wed, 27 Apr 2011 19:36:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DBA2F8FC13;
	Wed, 27 Apr 2011 19:36:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3RJa0Wp086167;
	Wed, 27 Apr 2011 19:36:00 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3RJa08q086163;
	Wed, 27 Apr 2011 19:36:00 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201104271936.p3RJa08q086163@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 27 Apr 2011 19:36:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221133 - in stable/8/sys: mips/alchemy mips/sibyte
	powerpc/booke
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 19:36:01 -0000

Author: jhb
Date: Wed Apr 27 19:36:00 2011
New Revision: 221133
URL: http://svn.freebsd.org/changeset/base/221133

Log:
  MFC: Various small compile nits found by make universe that are in already
  merged changes or larger changes not suitable for MFC.

Modified:
  stable/8/sys/mips/alchemy/obio.c
  stable/8/sys/mips/sibyte/sb_zbbus.c
  stable/8/sys/powerpc/booke/platform_bare.c

Modified: stable/8/sys/mips/alchemy/obio.c
==============================================================================
--- stable/8/sys/mips/alchemy/obio.c	Wed Apr 27 19:34:01 2011	(r221132)
+++ stable/8/sys/mips/alchemy/obio.c	Wed Apr 27 19:36:00 2011	(r221133)
@@ -101,7 +101,7 @@ int irq_priorities[NIRQS] = {
 
 static int	obio_activate_resource(device_t, device_t, int, int,
 		    struct resource *);
-static device_t	obio_add_child(device_t, int, const char *, int);
+static device_t	obio_add_child(device_t, u_int, const char *, int);
 static struct resource *
 		obio_alloc_resource(device_t, device_t, int, int *, u_long,
 		    u_long, u_long, u_int);
@@ -472,7 +472,7 @@ obio_hinted_child(device_t bus, const ch
 }
 
 static device_t
-obio_add_child(device_t bus, int order, const char *name, int unit)
+obio_add_child(device_t bus, u_int order, const char *name, int unit)
 {
 	device_t		child;
 	struct obio_ivar	*ivar;

Modified: stable/8/sys/mips/sibyte/sb_zbbus.c
==============================================================================
--- stable/8/sys/mips/sibyte/sb_zbbus.c	Wed Apr 27 19:34:01 2011	(r221132)
+++ stable/8/sys/mips/sibyte/sb_zbbus.c	Wed Apr 27 19:36:00 2011	(r221133)
@@ -402,7 +402,7 @@ zbbus_setup_intr(device_t dev, device_t 
 }
 
 static device_t
-zbbus_add_child(device_t bus, int order, const char *name, int unit)
+zbbus_add_child(device_t bus, u_int order, const char *name, int unit)
 {
 	device_t child;
 	struct zbbus_devinfo *dinfo;

Modified: stable/8/sys/powerpc/booke/platform_bare.c
==============================================================================
--- stable/8/sys/powerpc/booke/platform_bare.c	Wed Apr 27 19:34:01 2011	(r221132)
+++ stable/8/sys/powerpc/booke/platform_bare.c	Wed Apr 27 19:36:00 2011	(r221133)
@@ -79,7 +79,7 @@ static platform_method_t bare_methods[] 
 	PLATFORMMETHOD(platform_smp_get_bsp,	bare_smp_get_bsp),
 	PLATFORMMETHOD(platform_smp_start_cpu,	bare_smp_start_cpu),
 
-	PLATFORMMETHOD(platform_reset,		e500_reset);
+	PLATFORMMETHOD(platform_reset,		e500_reset),
 
 	{ 0, 0 }
 };

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 19:46:57 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 98885106566B;
	Wed, 27 Apr 2011 19:46:57 +0000 (UTC)
	(envelope-from trociny@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8700C8FC1E;
	Wed, 27 Apr 2011 19:46:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3RJkvtV086666;
	Wed, 27 Apr 2011 19:46:57 GMT (envelope-from trociny@svn.freebsd.org)
Received: (from trociny@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3RJkv5Y086656;
	Wed, 27 Apr 2011 19:46:57 GMT (envelope-from trociny@svn.freebsd.org)
Message-Id: <201104271946.p3RJkv5Y086656@svn.freebsd.org>
From: Mikolaj Golub 
Date: Wed, 27 Apr 2011 19:46:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221135 - in stable/8/sbin: hastctl hastd
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 19:46:57 -0000

Author: trociny
Date: Wed Apr 27 19:46:57 2011
New Revision: 221135
URL: http://svn.freebsd.org/changeset/base/221135

Log:
  MFC r220520, r220521, r220522, r220523, r220573, r220744, r220865,
    r220889, r220890, r220898, r220899:
  
  r220520:
  
  hastd(8) maintains a map of dirty extents, not hastctl(8). Fix this.
  
  r220521:
  
  Fix a typo in comments.
  
  r220522:
  
  In hast_proto_recv_data() check that the size of the data to be
  received does not exceed the buffer size.
  
  r220573 (pjd):
  
  The replication mode that is currently support is fullsync, not memsync.
  Correct this and print a warning if different replication mode is
  configured.
  
  r220523, r220744:
  
  Remove hast_proto_recv(). It was used only in one place, where
  hast_proto_recv_hdr() may be used.
  
  r220865 (pjd):
  
  Scenario:
  - We have two nodes connected and synchronized (local counters on both sides
    are 0).
  - We take secondary down and recreate it.
  - Primary connects to it and starts synchronization (but local counters are
    still 0).
  - We switch the roles.
  - Synchronization restarts but data is synchronized now from new primary
    (because local counters are 0) that doesn't have new data yet.
  
  This fix this issue we bump local counter on primary when we discover that
  connected secondary was recreated and has no data yet.
  
  Reported by:    trociny
  Discussed with: trociny
  Tested by:      trociny
  
  r220889 (pjd):
  
  Timeout must be positive.
  
  r220890 (pjd):
  
  If we act in different role than requested by the remote node, log it
  as a warning and not an error.
  
  MFC after:      1 week
  
  r220898 (pjd), r220899 (pjd):
  
  When we become primary, we connect to the remote and expect it to be in
  secondary role. It is possible that the remote node is primary, but only
  because there was a role change and it didn't finish cleaning up (unmounting
  file systems, etc.). If we detect such situation, wait for the remote node
  to switch the role to secondary before accepting I/Os. If we don't wait for
  it in that case, we will most likely cause split-brain.
  
  Approved by:	pjd (mentor)

Modified:
  stable/8/sbin/hastctl/hastctl.8
  stable/8/sbin/hastctl/hastctl.c
  stable/8/sbin/hastd/activemap.c
  stable/8/sbin/hastd/hast_proto.c
  stable/8/sbin/hastd/hast_proto.h
  stable/8/sbin/hastd/hastd.c
  stable/8/sbin/hastd/parse.y
  stable/8/sbin/hastd/primary.c
  stable/8/sbin/hastd/secondary.c
Directory Properties:
  stable/8/sbin/hastctl/   (props changed)
  stable/8/sbin/hastd/   (props changed)

Modified: stable/8/sbin/hastctl/hastctl.8
==============================================================================
--- stable/8/sbin/hastctl/hastctl.8	Wed Apr 27 19:36:35 2011	(r221134)
+++ stable/8/sbin/hastctl/hastctl.8	Wed Apr 27 19:46:57 2011	(r221135)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 13, 2011
+.Dd April 10, 2011
 .Dt HASTCTL 8
 .Os
 .Sh NAME
@@ -88,7 +88,7 @@ Additional options include:
 .It Fl e Ar extentsize
 Size of an extent.
 Extent is a block which is used for synchronization.
-.Nm
+.Xr hastd 8
 maintains a map of dirty extents and extent is the smallest region that
 can be marked as dirty.
 If any part of an extent is modified, entire extent will be synchronized

Modified: stable/8/sbin/hastctl/hastctl.c
==============================================================================
--- stable/8/sbin/hastctl/hastctl.c	Wed Apr 27 19:36:35 2011	(r221134)
+++ stable/8/sbin/hastctl/hastctl.c	Wed Apr 27 19:46:57 2011	(r221135)
@@ -492,7 +492,7 @@ main(int argc, char *argv[])
 	}
 	nv_free(nv);
 	/* ...and receive reply. */
-	if (hast_proto_recv(NULL, controlconn, &nv, NULL, 0) < 0) {
+	if (hast_proto_recv_hdr(controlconn, &nv) < 0) {
 		pjdlog_exit(EX_UNAVAILABLE,
 		    "cannot receive reply from hastd via %s",
 		    cfg->hc_controladdr);

Modified: stable/8/sbin/hastd/activemap.c
==============================================================================
--- stable/8/sbin/hastd/activemap.c	Wed Apr 27 19:36:35 2011	(r221134)
+++ stable/8/sbin/hastd/activemap.c	Wed Apr 27 19:46:57 2011	(r221135)
@@ -470,7 +470,7 @@ activemap_copyin(struct activemap *amp, 
 }
 
 /*
- * Function merges the given bitmap with existng one.
+ * Function merges the given bitmap with existing one.
  */
 void
 activemap_merge(struct activemap *amp, const unsigned char *buf, size_t size)

Modified: stable/8/sbin/hastd/hast_proto.c
==============================================================================
--- stable/8/sbin/hastd/hast_proto.c	Wed Apr 27 19:36:35 2011	(r221134)
+++ stable/8/sbin/hastd/hast_proto.c	Wed Apr 27 19:46:57 2011	(r221135)
@@ -189,9 +189,12 @@ hast_proto_recv_data(const struct hast_r
 	dptr = data;
 
 	dsize = nv_get_uint32(nv, "size");
-	if (dsize == 0)
+	if (dsize > size) {
+		errno = EINVAL;
+		goto end;
+	} else if (dsize == 0) {
 		(void)nv_set_error(nv, 0);
-	else {
+	} else {
 		if (proto_recv(conn, data, dsize) < 0)
 			goto end;
 		for (ii = sizeof(pipeline) / sizeof(pipeline[0]); ii > 0;
@@ -216,26 +219,3 @@ end:
 		free(dptr);
 	return (ret);
 }
-
-int
-hast_proto_recv(const struct hast_resource *res, struct proto_conn *conn,
-    struct nv **nvp, void *data, size_t size)
-{
-	struct nv *nv;
-	size_t dsize;
-	int ret;
-
-	ret = hast_proto_recv_hdr(conn, &nv);
-	if (ret < 0)
-		return (ret);
-	dsize = nv_get_uint32(nv, "size");
-	if (dsize == 0)
-		(void)nv_set_error(nv, 0);
-	else
-		ret = hast_proto_recv_data(res, conn, nv, data, size);
-	if (ret < 0)
-		nv_free(nv);
-	else
-		*nvp = nv;
-	return (ret);
-}

Modified: stable/8/sbin/hastd/hast_proto.h
==============================================================================
--- stable/8/sbin/hastd/hast_proto.h	Wed Apr 27 19:36:35 2011	(r221134)
+++ stable/8/sbin/hastd/hast_proto.h	Wed Apr 27 19:46:57 2011	(r221135)
@@ -39,8 +39,6 @@
 
 int hast_proto_send(const struct hast_resource *res, struct proto_conn *conn,
     struct nv *nv, const void *data, size_t size);
-int hast_proto_recv(const struct hast_resource *res, struct proto_conn *conn,
-    struct nv **nvp, void *data, size_t size);
 int hast_proto_recv_hdr(const struct proto_conn *conn, struct nv **nvp);
 int hast_proto_recv_data(const struct hast_resource *res,
     struct proto_conn *conn, struct nv *nv, void *data, size_t size);

Modified: stable/8/sbin/hastd/hastd.c
==============================================================================
--- stable/8/sbin/hastd/hastd.c	Wed Apr 27 19:36:35 2011	(r221134)
+++ stable/8/sbin/hastd/hastd.c	Wed Apr 27 19:46:57 2011	(r221135)
@@ -730,12 +730,19 @@ listen_accept(void)
 	}
 	/* Is the resource marked as secondary? */
 	if (res->hr_role != HAST_ROLE_SECONDARY) {
-		pjdlog_error("We act as %s for the resource and not as %s as requested by %s.",
+		pjdlog_warning("We act as %s for the resource and not as %s as requested by %s.",
 		    role2str(res->hr_role), role2str(HAST_ROLE_SECONDARY),
 		    raddr);
 		nv_add_stringf(nverr, "errmsg",
 		    "Remote node acts as %s for the resource and not as %s.",
 		    role2str(res->hr_role), role2str(HAST_ROLE_SECONDARY));
+		if (res->hr_role == HAST_ROLE_PRIMARY) {
+			/*
+			 * If we act as primary request the other side to wait
+			 * for us a bit, as we might be finishing cleanups.
+			 */
+			nv_add_uint8(nverr, 1, "wait");
+		}
 		goto fail;
 	}
 	/* Does token (if exists) match? */

Modified: stable/8/sbin/hastd/parse.y
==============================================================================
--- stable/8/sbin/hastd/parse.y	Wed Apr 27 19:36:35 2011	(r221134)
+++ stable/8/sbin/hastd/parse.y	Wed Apr 27 19:46:57 2011	(r221135)
@@ -169,7 +169,7 @@ yy_config_parse(const char *config, bool
 	lineno = 0;
 
 	depth0_timeout = HAST_TIMEOUT;
-	depth0_replication = HAST_REPLICATION_MEMSYNC;
+	depth0_replication = HAST_REPLICATION_FULLSYNC;
 	depth0_checksum = HAST_CHECKSUM_NONE;
 	depth0_compression = HAST_COMPRESSION_HOLE;
 	strlcpy(depth0_control, HAST_CONTROL, sizeof(depth0_control));
@@ -228,6 +228,13 @@ yy_config_parse(const char *config, bool
 			 */
 			curres->hr_replication = depth0_replication;
 		}
+		if (curres->hr_replication == HAST_REPLICATION_MEMSYNC ||
+		    curres->hr_replication == HAST_REPLICATION_ASYNC) {
+			pjdlog_warning("Replication mode \"%s\" is not implemented, falling back to \"%s\".",
+			    curres->hr_replication == HAST_REPLICATION_MEMSYNC ?
+			    "memsync" : "async", "fullsync");
+			curres->hr_replication = HAST_REPLICATION_FULLSYNC;
+		}
 		if (curres->hr_checksum == -1) {
 			/*
 			 * Checksum is not set at resource-level.
@@ -454,6 +461,10 @@ compression_type:
 
 timeout_statement:	TIMEOUT NUM
 	{
+		if ($2 <= 0) {
+			pjdlog_error("Negative or zero timeout.");
+			return (1);
+		}
 		switch (depth) {
 		case 0:
 			depth0_timeout = $2;

Modified: stable/8/sbin/hastd/primary.c
==============================================================================
--- stable/8/sbin/hastd/primary.c	Wed Apr 27 19:36:35 2011	(r221134)
+++ stable/8/sbin/hastd/primary.c	Wed Apr 27 19:46:57 2011	(r221135)
@@ -219,6 +219,7 @@ static pthread_cond_t range_regular_cond
 static struct rangelocks *range_sync;
 static bool range_sync_wait;
 static pthread_cond_t range_sync_cond;
+static bool fullystarted;
 
 static void *ggate_recv_thread(void *arg);
 static void *local_send_thread(void *arg);
@@ -524,7 +525,7 @@ primary_connect(struct hast_resource *re
 	return (0);
 }
 
-static bool
+static int
 init_remote(struct hast_resource *res, struct proto_conn **inp,
     struct proto_conn **outp)
 {
@@ -537,6 +538,7 @@ init_remote(struct hast_resource *res, s
 	int64_t datasize;
 	uint32_t mapsize;
 	size_t size;
+	int error;
 
 	PJDLOG_ASSERT((inp == NULL && outp == NULL) || (inp != NULL && outp != NULL));
 	PJDLOG_ASSERT(real_remote(res));
@@ -545,7 +547,9 @@ init_remote(struct hast_resource *res, s
 	errmsg = NULL;
 
 	if (primary_connect(res, &out) == -1)
-		return (false);
+		return (ECONNREFUSED);
+
+	error = ECONNABORTED;
 
 	/*
 	 * First handshake step.
@@ -577,6 +581,8 @@ init_remote(struct hast_resource *res, s
 	errmsg = nv_get_string(nvin, "errmsg");
 	if (errmsg != NULL) {
 		pjdlog_warning("%s", errmsg);
+		if (nv_exists(nvin, "wait"))
+			error = EBUSY;
 		nv_free(nvin);
 		goto close;
 	}
@@ -667,6 +673,25 @@ init_remote(struct hast_resource *res, s
 	res->hr_secondary_localcnt = nv_get_uint64(nvin, "localcnt");
 	res->hr_secondary_remotecnt = nv_get_uint64(nvin, "remotecnt");
 	res->hr_syncsrc = nv_get_uint8(nvin, "syncsrc");
+	if (nv_exists(nvin, "virgin")) {
+		/*
+		 * Secondary was reinitialized, bump localcnt if it is 0 as
+		 * only we have the data.
+		 */
+		PJDLOG_ASSERT(res->hr_syncsrc == HAST_SYNCSRC_PRIMARY);
+		PJDLOG_ASSERT(res->hr_secondary_localcnt == 0);
+
+		if (res->hr_primary_localcnt == 0) {
+			PJDLOG_ASSERT(res->hr_secondary_remotecnt == 0);
+
+			mtx_lock(&metadata_lock);
+			res->hr_primary_localcnt++;
+			pjdlog_debug(1, "Increasing localcnt to %ju.",
+			    (uintmax_t)res->hr_primary_localcnt);
+			(void)metadata_write(res);
+			mtx_unlock(&metadata_lock);
+		}
+	}
 	map = NULL;
 	mapsize = nv_get_uint32(nvin, "mapsize");
 	if (mapsize > 0) {
@@ -715,14 +740,14 @@ init_remote(struct hast_resource *res, s
 		res->hr_remoteout = out;
 	}
 	event_send(res, EVENT_CONNECT);
-	return (true);
+	return (0);
 close:
 	if (errmsg != NULL && strcmp(errmsg, "Split-brain condition!") == 0)
 		event_send(res, EVENT_SPLITBRAIN);
 	proto_close(out);
 	if (in != NULL)
 		proto_close(in);
-	return (false);
+	return (error);
 }
 
 static void
@@ -901,8 +926,30 @@ hastd_primary(struct hast_resource *res)
 	 */
 	error = pthread_create(&td, NULL, ctrl_thread, res);
 	PJDLOG_ASSERT(error == 0);
-	if (real_remote(res) && init_remote(res, NULL, NULL))
-		sync_start();
+	if (real_remote(res)) {
+		error = init_remote(res, NULL, NULL);
+		if (error == 0) {
+			sync_start();
+		} else if (error == EBUSY) {
+			time_t start = time(NULL);
+
+			pjdlog_warning("Waiting for remote node to become %s for %ds.",
+			    role2str(HAST_ROLE_SECONDARY),
+			    res->hr_timeout);
+			for (;;) {
+				sleep(1);
+				error = init_remote(res, NULL, NULL);
+				if (error != EBUSY)
+					break;
+				if (time(NULL) > start + res->hr_timeout)
+					break;
+			}
+			if (error == EBUSY) {
+				pjdlog_warning("Remote node is still %s, starting anyway.",
+				    role2str(HAST_ROLE_PRIMARY));
+			}
+		}
+	}
 	error = pthread_create(&td, NULL, ggate_recv_thread, res);
 	PJDLOG_ASSERT(error == 0);
 	error = pthread_create(&td, NULL, local_send_thread, res);
@@ -913,6 +960,7 @@ hastd_primary(struct hast_resource *res)
 	PJDLOG_ASSERT(error == 0);
 	error = pthread_create(&td, NULL, ggate_send_thread, res);
 	PJDLOG_ASSERT(error == 0);
+	fullystarted = true;
 	(void)sync_thread(res);
 }
 
@@ -2076,7 +2124,7 @@ guard_one(struct hast_resource *res, uns
 	pjdlog_debug(2, "remote_guard: Reconnecting to %s.",
 	    res->hr_remoteaddr);
 	in = out = NULL;
-	if (init_remote(res, &in, &out)) {
+	if (init_remote(res, &in, &out) == 0) {
 		rw_wlock(&hio_remote_lock[ncomp]);
 		PJDLOG_ASSERT(res->hr_remotein == NULL);
 		PJDLOG_ASSERT(res->hr_remoteout == NULL);
@@ -2134,12 +2182,19 @@ guard_thread(void *arg)
 			break;
 		}
 
-		pjdlog_debug(2, "remote_guard: Checking connections.");
-		now = time(NULL);
-		if (lastcheck + HAST_KEEPALIVE <= now) {
-			for (ii = 0; ii < ncomps; ii++)
-				guard_one(res, ii);
-			lastcheck = now;
+		/*
+		 * Don't check connections until we fully started,
+		 * as we may still be looping, waiting for remote node
+		 * to switch from primary to secondary.
+		 */
+		if (fullystarted) {
+			pjdlog_debug(2, "remote_guard: Checking connections.");
+			now = time(NULL);
+			if (lastcheck + HAST_KEEPALIVE <= now) {
+				for (ii = 0; ii < ncomps; ii++)
+					guard_one(res, ii);
+				lastcheck = now;
+			}
 		}
 		signo = sigtimedwait(&mask, NULL, &timeout);
 	}

Modified: stable/8/sbin/hastd/secondary.c
==============================================================================
--- stable/8/sbin/hastd/secondary.c	Wed Apr 27 19:36:35 2011	(r221134)
+++ stable/8/sbin/hastd/secondary.c	Wed Apr 27 19:46:57 2011	(r221135)
@@ -261,6 +261,7 @@ init_remote(struct hast_resource *res, s
 		} else {
 			memset(map, 0xff, mapsize);
 		}
+		nv_add_int8(nvout, 1, "virgin");
 		nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc");
 	} else if (res->hr_resuid != resuid) {
 		char errmsg[256];

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 27 21:13:20 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7A5AE106566B;
	Wed, 27 Apr 2011 21:13:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 678FF8FC17;
	Wed, 27 Apr 2011 21:13:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3RLDKD3090474;
	Wed, 27 Apr 2011 21:13:20 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3RLDKE2090468;
	Wed, 27 Apr 2011 21:13:20 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201104272113.p3RLDKE2090468@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 27 Apr 2011 21:13:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221140 - in stable/8/sys/dev: acpica pci
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 27 Apr 2011 21:13:20 -0000

Author: jhb
Date: Wed Apr 27 21:13:20 2011
New Revision: 221140
URL: http://svn.freebsd.org/changeset/base/221140

Log:
  MFC 210864:
  - Retire acpi_pcib_resume().  It is has just been an alias for
    bus_generic_resume() since the pci_link(4) driver was added.
  - Change the ACPI PCI-PCI bridge driver to inherit most of its methods
    from the generic PCI-PCI bridge driver.
  - This also exposes the generic PCI-PCI bridge driver as pcib_driver so
    other drivers can inherit from it.

Modified:
  stable/8/sys/dev/acpica/acpi_pcib.c
  stable/8/sys/dev/acpica/acpi_pcib_acpi.c
  stable/8/sys/dev/acpica/acpi_pcib_pci.c
  stable/8/sys/dev/acpica/acpi_pcibvar.h
  stable/8/sys/dev/pci/pcib_private.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/acpica/acpi_pcib.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_pcib.c	Wed Apr 27 20:42:30 2011	(r221139)
+++ stable/8/sys/dev/acpica/acpi_pcib.c	Wed Apr 27 21:13:20 2011	(r221140)
@@ -171,13 +171,6 @@ acpi_pcib_attach(device_t dev, ACPI_BUFF
     return_VALUE (bus_generic_attach(dev));
 }
 
-int
-acpi_pcib_resume(device_t dev)
-{
-
-    return (bus_generic_resume(dev));
-}
-
 static void
 prt_lookup_device(ACPI_PCI_ROUTING_TABLE *entry, void *arg)
 {

Modified: stable/8/sys/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_pcib_acpi.c	Wed Apr 27 20:42:30 2011	(r221139)
+++ stable/8/sys/dev/acpica/acpi_pcib_acpi.c	Wed Apr 27 21:13:20 2011	(r221140)
@@ -65,7 +65,6 @@ struct acpi_hpcib_softc {
 
 static int		acpi_pcib_acpi_probe(device_t bus);
 static int		acpi_pcib_acpi_attach(device_t bus);
-static int		acpi_pcib_acpi_resume(device_t bus);
 static int		acpi_pcib_read_ivar(device_t dev, device_t child,
 			    int which, uintptr_t *result);
 static int		acpi_pcib_write_ivar(device_t dev, device_t child,
@@ -94,7 +93,7 @@ static device_method_t acpi_pcib_acpi_me
     DEVMETHOD(device_attach,		acpi_pcib_acpi_attach),
     DEVMETHOD(device_shutdown,		bus_generic_shutdown),
     DEVMETHOD(device_suspend,		bus_generic_suspend),
-    DEVMETHOD(device_resume,		acpi_pcib_acpi_resume),
+    DEVMETHOD(device_resume,		bus_generic_resume),
 
     /* Bus interface */
     DEVMETHOD(bus_print_child,		bus_generic_print_child),
@@ -257,13 +256,6 @@ acpi_pcib_acpi_attach(device_t dev)
     return (acpi_pcib_attach(dev, &sc->ap_prt, sc->ap_bus));
 }
 
-static int
-acpi_pcib_acpi_resume(device_t dev)
-{
-
-    return (acpi_pcib_resume(dev));
-}
-
 /*
  * Support for standard PCI bridge ivars.
  */

Modified: stable/8/sys/dev/acpica/acpi_pcib_pci.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_pcib_pci.c	Wed Apr 27 20:42:30 2011	(r221139)
+++ stable/8/sys/dev/acpica/acpi_pcib_pci.c	Wed Apr 27 21:13:20 2011	(r221140)
@@ -65,7 +65,6 @@ struct acpi_pcib_lookup_info {
 
 static int		acpi_pcib_pci_probe(device_t bus);
 static int		acpi_pcib_pci_attach(device_t bus);
-static int		acpi_pcib_pci_resume(device_t bus);
 static int		acpi_pcib_read_ivar(device_t dev, device_t child,
 			    int which, uintptr_t *result);
 static int		acpi_pcib_pci_route_interrupt(device_t pcib,
@@ -75,39 +74,20 @@ static device_method_t acpi_pcib_pci_met
     /* Device interface */
     DEVMETHOD(device_probe,		acpi_pcib_pci_probe),
     DEVMETHOD(device_attach,		acpi_pcib_pci_attach),
-    DEVMETHOD(device_shutdown,		bus_generic_shutdown),
-    DEVMETHOD(device_suspend,		bus_generic_suspend),
-    DEVMETHOD(device_resume,		acpi_pcib_pci_resume),
 
     /* Bus interface */
-    DEVMETHOD(bus_print_child,		bus_generic_print_child),
     DEVMETHOD(bus_read_ivar,		acpi_pcib_read_ivar),
-    DEVMETHOD(bus_write_ivar,		pcib_write_ivar),
-    DEVMETHOD(bus_alloc_resource,	pcib_alloc_resource),
-    DEVMETHOD(bus_release_resource,	bus_generic_release_resource),
-    DEVMETHOD(bus_activate_resource,	bus_generic_activate_resource),
-    DEVMETHOD(bus_deactivate_resource, 	bus_generic_deactivate_resource),
-    DEVMETHOD(bus_setup_intr,		bus_generic_setup_intr),
-    DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
 
     /* pcib interface */
-    DEVMETHOD(pcib_maxslots,		pcib_maxslots),
-    DEVMETHOD(pcib_read_config,		pcib_read_config),
-    DEVMETHOD(pcib_write_config,	pcib_write_config),
     DEVMETHOD(pcib_route_interrupt,	acpi_pcib_pci_route_interrupt),
-    DEVMETHOD(pcib_alloc_msi,		pcib_alloc_msi),
-    DEVMETHOD(pcib_release_msi,		pcib_release_msi),
-    DEVMETHOD(pcib_alloc_msix,		pcib_alloc_msix),
-    DEVMETHOD(pcib_release_msix,	pcib_release_msix),
-    DEVMETHOD(pcib_map_msi,		pcib_map_msi),
 
     {0, 0}
 };
 
 static devclass_t pcib_devclass;
 
-DEFINE_CLASS_0(pcib, acpi_pcib_pci_driver, acpi_pcib_pci_methods,
-    sizeof(struct acpi_pcib_softc));
+DEFINE_CLASS_1(pcib, acpi_pcib_pci_driver, acpi_pcib_pci_methods,
+    sizeof(struct acpi_pcib_softc), pcib_driver);
 DRIVER_MODULE(acpi_pcib, pci, acpi_pcib_pci_driver, pcib_devclass, 0, 0);
 MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1);
 
@@ -142,13 +122,6 @@ acpi_pcib_pci_attach(device_t dev)
 }
 
 static int
-acpi_pcib_pci_resume(device_t dev)
-{
-
-    return (acpi_pcib_resume(dev));
-}
-
-static int
 acpi_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
 {
     struct acpi_pcib_softc *sc = device_get_softc(dev);

Modified: stable/8/sys/dev/acpica/acpi_pcibvar.h
==============================================================================
--- stable/8/sys/dev/acpica/acpi_pcibvar.h	Wed Apr 27 20:42:30 2011	(r221139)
+++ stable/8/sys/dev/acpica/acpi_pcibvar.h	Wed Apr 27 21:13:20 2011	(r221140)
@@ -31,13 +31,14 @@
 #define	_ACPI_PCIBVAR_H_
 
 #ifdef _KERNEL
+
 void	acpi_pci_link_add_reference(device_t dev, int index, device_t pcib,
     int slot, int pin);
 int	acpi_pci_link_route_interrupt(device_t dev, int index);
 int	acpi_pcib_attach(device_t bus, ACPI_BUFFER *prt, int busno);
 int	acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
     ACPI_BUFFER *prtbuf);
-int	acpi_pcib_resume(device_t dev);
+
 #endif /* _KERNEL */
 
 #endif /* !_ACPI_PCIBVAR_H_ */

Modified: stable/8/sys/dev/pci/pcib_private.h
==============================================================================
--- stable/8/sys/dev/pci/pcib_private.h	Wed Apr 27 20:42:30 2011	(r221139)
+++ stable/8/sys/dev/pci/pcib_private.h	Wed Apr 27 21:13:20 2011	(r221140)
@@ -37,6 +37,7 @@
  * Export portions of generic PCI:PCI bridge support so that it can be
  * used by subclasses.
  */
+DECLARE_CLASS(pcib_driver);
 
 /*
  * Bridge-specific data.

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 06:51:48 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F574106564A;
	Thu, 28 Apr 2011 06:51:48 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3D5BA8FC17;
	Thu, 28 Apr 2011 06:51:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3S6pmUG009573;
	Thu, 28 Apr 2011 06:51:48 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3S6pm8g009571;
	Thu, 28 Apr 2011 06:51:48 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201104280651.p3S6pm8g009571@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 28 Apr 2011 06:51:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221149 - stable/8/sys/dev/sound/usb
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 06:51:48 -0000

Author: hselasky
Date: Thu Apr 28 06:51:47 2011
New Revision: 221149
URL: http://svn.freebsd.org/changeset/base/221149

Log:
  MFC r220900.
  Only set the sample rate if the USB audio channel reports
  that it supports the frequency control request.
  
  Approved by:	thompsa

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

Modified: stable/8/sys/dev/sound/usb/uaudio.c
==============================================================================
--- stable/8/sys/dev/sound/usb/uaudio.c	Thu Apr 28 05:48:32 2011	(r221148)
+++ stable/8/sys/dev/sound/usb/uaudio.c	Thu Apr 28 06:51:47 2011	(r221149)
@@ -1364,11 +1364,10 @@ uaudio_chan_init(struct uaudio_softc *sc
 	usbd_set_parent_iface(sc->sc_udev, iface_index, sc->sc_mixer_iface_index);
 
 	/*
-	 * If just one sampling rate is supported,
-	 * no need to call "uaudio_set_speed()".
-	 * Roland SD-90 freezes by a SAMPLING_FREQ_CONTROL request.
+	 * Only set the sample rate if the channel reports that it
+	 * supports the frequency control.
 	 */
-	if (ch->p_asf1d->bSamFreqType != 1) {
+	if (ch->p_sed->bmAttributes & UA_SED_FREQ_CONTROL) {
 		if (uaudio_set_speed(sc->sc_udev, endpoint, ch->sample_rate)) {
 			/*
 			 * If the endpoint is adaptive setting the speed may

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 06:54:39 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 434EC106564A;
	Thu, 28 Apr 2011 06:54:39 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3186B8FC20;
	Thu, 28 Apr 2011 06:54:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3S6sdhf009703;
	Thu, 28 Apr 2011 06:54:39 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3S6sdZT009701;
	Thu, 28 Apr 2011 06:54:39 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201104280654.p3S6sdZT009701@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 28 Apr 2011 06:54:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221150 - stable/8/sys/dev/usb/controller
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 06:54:39 -0000

Author: hselasky
Date: Thu Apr 28 06:54:38 2011
New Revision: 221150
URL: http://svn.freebsd.org/changeset/base/221150

Log:
  MFC r221073.
  Fix for missing EHCI datatoggle change case.
  
  Approved by:	thompsa

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

Modified: stable/8/sys/dev/usb/controller/ehci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci.c	Thu Apr 28 06:51:47 2011	(r221149)
+++ stable/8/sys/dev/usb/controller/ehci.c	Thu Apr 28 06:54:38 2011	(r221150)
@@ -1196,6 +1196,8 @@ ehci_data_toggle_update(struct usb_xfer 
 		dt ^= 1;	/* short packet at the end */
 	else if (actlen != xlen)
 		dt ^= 1;	/* zero length packet at the end */
+	else if (xlen == 0)
+		dt ^= 1;	/* zero length transfer */
 
 	xfer->endpoint->toggle_next ^= dt;
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 06:57:47 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 504FA106566C;
	Thu, 28 Apr 2011 06:57:47 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E87C8FC13;
	Thu, 28 Apr 2011 06:57:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3S6vllH009898;
	Thu, 28 Apr 2011 06:57:47 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3S6vlwG009896;
	Thu, 28 Apr 2011 06:57:47 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201104280657.p3S6vlwG009896@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 28 Apr 2011 06:57:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221151 - stable/8/sys/dev/usb/net
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 06:57:47 -0000

Author: hselasky
Date: Thu Apr 28 06:57:46 2011
New Revision: 221151
URL: http://svn.freebsd.org/changeset/base/221151

Log:
  MFC r221077.
  The maximum NCM frame size must be so that it
  will generate a short terminated USB transfer if
  the maximum NCM frame size is greater than what
  the driver can handle.
  
  Approved by: 	thompsa

Modified:
  stable/8/sys/dev/usb/net/if_cdcereg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/usb/net/if_cdcereg.h
==============================================================================
--- stable/8/sys/dev/usb/net/if_cdcereg.h	Thu Apr 28 06:54:38 2011	(r221150)
+++ stable/8/sys/dev/usb/net/if_cdcereg.h	Thu Apr 28 06:57:46 2011	(r221151)
@@ -39,7 +39,7 @@
 #define	CDCE_IND_SIZE_MAX 32            /* bytes */
 
 #define	CDCE_NCM_TX_MINLEN 512		/* bytes, must be power of two */
-#define	CDCE_NCM_TX_MAXLEN (1UL << 14)	/* bytes */
+#define	CDCE_NCM_TX_MAXLEN (16384 + 4)	/* bytes, must be short terminated */
 #define	CDCE_NCM_TX_FRAMES_MAX 8	/* units */
 
 #define	CDCE_NCM_RX_MAXLEN (1UL << 14)	/* bytes */

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 07:21:02 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 204AA106566B;
	Thu, 28 Apr 2011 07:21:02 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0EA198FC14;
	Thu, 28 Apr 2011 07:21:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3S7L1em010781;
	Thu, 28 Apr 2011 07:21:01 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3S7L1dN010779;
	Thu, 28 Apr 2011 07:21:01 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201104280721.p3S7L1dN010779@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 28 Apr 2011 07:21:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221152 - stable/8/sys/cam
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 07:21:02 -0000

Author: mav
Date: Thu Apr 28 07:21:01 2011
New Revision: 221152
URL: http://svn.freebsd.org/changeset/base/221152

Log:
  MFC r220786:
  Remove always false "< 0" check for unsgined int variable. This check is
  also duplicate, as the value was already checked for 0 before decrementing.

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

Modified: stable/8/sys/cam/cam_periph.c
==============================================================================
--- stable/8/sys/cam/cam_periph.c	Thu Apr 28 06:57:46 2011	(r221151)
+++ stable/8/sys/cam/cam_periph.c	Thu Apr 28 07:21:01 2011	(r221152)
@@ -527,8 +527,6 @@ cam_periph_invalidate(struct cam_periph 
 	xpt_lock_buses();
 	if (periph->refcount == 0)
 		camperiphfree(periph);
-	else if (periph->refcount < 0)
-		printf("cam_invalidate_periph: refcount < 0!!\n");
 	xpt_unlock_buses();
 }
 

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 07:22:41 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CF64E1065672;
	Thu, 28 Apr 2011 07:22:41 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A2FD88FC12;
	Thu, 28 Apr 2011 07:22:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3S7MfVM010893;
	Thu, 28 Apr 2011 07:22:41 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3S7MfO3010889;
	Thu, 28 Apr 2011 07:22:41 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201104280722.p3S7MfO3010889@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 28 Apr 2011 07:22:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221153 - stable/8/sys/cam/ata
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 07:22:41 -0000

Author: mav
Date: Thu Apr 28 07:22:41 2011
New Revision: 221153
URL: http://svn.freebsd.org/changeset/base/221153

Log:
  MFC r220886:
  Add basic support for DMA-capable ATA disks on DMA-incapable controller.
  This is really rare situation these days, but still may happen in embedded.

Modified:
  stable/8/sys/cam/ata/ata_all.h
  stable/8/sys/cam/ata/ata_da.c
  stable/8/sys/cam/ata/ata_xpt.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/cam/ata/ata_all.h
==============================================================================
--- stable/8/sys/cam/ata/ata_all.h	Thu Apr 28 07:21:01 2011	(r221152)
+++ stable/8/sys/cam/ata/ata_all.h	Thu Apr 28 07:22:41 2011	(r221153)
@@ -35,6 +35,8 @@ struct ccb_ataio;
 struct cam_periph;
 union  ccb;
 
+#define	SID_DMA		0x10	/* Abuse inq_flags bit to track enabled DMA. */
+
 struct ata_cmd {
 	u_int8_t	flags;		/* ATA command flags */
 #define		CAM_ATAIO_48BIT		0x01	/* Command has 48-bit format */

Modified: stable/8/sys/cam/ata/ata_da.c
==============================================================================
--- stable/8/sys/cam/ata/ata_da.c	Thu Apr 28 07:21:01 2011	(r221152)
+++ stable/8/sys/cam/ata/ata_da.c	Thu Apr 28 07:22:41 2011	(r221153)
@@ -737,7 +737,8 @@ adaregister(struct cam_periph *periph, v
 	bioq_init(&softc->bio_queue);
 	bioq_init(&softc->trim_queue);
 
-	if (cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA)
+	if (cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA &&
+	    (cgd->inq_flags & SID_DMA))
 		softc->flags |= ADA_FLAG_CAN_DMA;
 	if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48)
 		softc->flags |= ADA_FLAG_CAN_48BIT;
@@ -746,7 +747,7 @@ adaregister(struct cam_periph *periph, v
 	if (cgd->ident_data.support.command1 & ATA_SUPPORT_POWERMGT)
 		softc->flags |= ADA_FLAG_CAN_POWERMGT;
 	if (cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ &&
-	    cgd->inq_flags & SID_CmdQue)
+	    (cgd->inq_flags & SID_DMA) && (cgd->inq_flags & SID_CmdQue))
 		softc->flags |= ADA_FLAG_CAN_NCQ;
 	if (cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) {
 		softc->flags |= ADA_FLAG_CAN_TRIM;

Modified: stable/8/sys/cam/ata/ata_xpt.c
==============================================================================
--- stable/8/sys/cam/ata/ata_xpt.c	Thu Apr 28 07:21:01 2011	(r221152)
+++ stable/8/sys/cam/ata/ata_xpt.c	Thu Apr 28 07:22:41 2011	(r221153)
@@ -388,6 +388,11 @@ negotiate:
 		/* If SIM disagree - renegotiate. */
 		if (mode != wantmode)
 			goto negotiate;
+		/* Remember what transport thinks about DMA. */
+		if (mode < ATA_DMA)
+			path->device->inq_flags &= ~SID_DMA;
+		else
+			path->device->inq_flags |= SID_DMA;
 		cam_fill_ataio(ataio,
 		      1,
 		      probedone,

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 07:26:28 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DEDAA1065673;
	Thu, 28 Apr 2011 07:26:28 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CC6DD8FC17;
	Thu, 28 Apr 2011 07:26:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3S7QSMI011118;
	Thu, 28 Apr 2011 07:26:28 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3S7QSRj011114;
	Thu, 28 Apr 2011 07:26:28 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201104280726.p3S7QSRj011114@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 28 Apr 2011 07:26:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221154 - in stable/8/sys/dev: ahci mvs siis
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 07:26:29 -0000

Author: mav
Date: Thu Apr 28 07:26:28 2011
New Revision: 221154
URL: http://svn.freebsd.org/changeset/base/221154

Log:
  MFC r220822:
  Properly handle memory allocation errors during error recovery.

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

Modified: stable/8/sys/dev/ahci/ahci.c
==============================================================================
--- stable/8/sys/dev/ahci/ahci.c	Thu Apr 28 07:22:41 2011	(r221153)
+++ stable/8/sys/dev/ahci/ahci.c	Thu Apr 28 07:26:28 2011	(r221154)
@@ -2126,7 +2126,6 @@ ahci_issue_recovery(device_t dev)
 	struct ccb_scsiio *csio;
 	int i;
 
-	ch->recoverycmd = 1;
 	/* Find some holden command. */
 	for (i = 0; i < ch->numslots; i++) {
 		if (ch->hold[i])
@@ -2134,8 +2133,20 @@ ahci_issue_recovery(device_t dev)
 	}
 	ccb = xpt_alloc_ccb_nowait();
 	if (ccb == NULL) {
-		device_printf(dev, "Unable allocate READ LOG command");
-		return; /* XXX */
+		device_printf(dev, "Unable allocate recovery command\n");
+completeall:
+		/* We can't do anything -- complete holden commands. */
+		for (i = 0; i < ch->numslots; i++) {
+			if (ch->hold[i] == NULL)
+				continue;
+			ch->hold[i]->ccb_h.status &= ~CAM_STATUS_MASK;
+			ch->hold[i]->ccb_h.status |= CAM_RESRC_UNAVAIL;
+			xpt_done(ch->hold[i]);
+			ch->hold[i] = NULL;
+			ch->numhslots--;
+		}
+		ahci_reset(dev);
+		return;
 	}
 	ccb->ccb_h = ch->hold[i]->ccb_h;	/* Reuse old header. */
 	if (ccb->ccb_h.func_code == XPT_ATA_IO) {
@@ -2148,8 +2159,9 @@ ahci_issue_recovery(device_t dev)
 		ataio->data_ptr = malloc(512, M_AHCI, M_NOWAIT);
 		if (ataio->data_ptr == NULL) {
 			xpt_free_ccb(ccb);
-			device_printf(dev, "Unable allocate memory for READ LOG command");
-			return; /* XXX */
+			device_printf(dev,
+			    "Unable allocate memory for READ LOG command\n");
+			goto completeall;
 		}
 		ataio->dxfer_len = 512;
 		bzero(&ataio->cmd, sizeof(ataio->cmd));
@@ -2177,6 +2189,7 @@ ahci_issue_recovery(device_t dev)
 		csio->cdb_io.cdb_bytes[4] = csio->dxfer_len;
 	}
 	/* Freeze SIM while doing recovery. */
+	ch->recoverycmd = 1;
 	xpt_freeze_simq(ch->sim, 1);
 	ahci_begin_transaction(dev, ccb);
 }

Modified: stable/8/sys/dev/mvs/mvs.c
==============================================================================
--- stable/8/sys/dev/mvs/mvs.c	Thu Apr 28 07:22:41 2011	(r221153)
+++ stable/8/sys/dev/mvs/mvs.c	Thu Apr 28 07:26:28 2011	(r221154)
@@ -1780,7 +1780,6 @@ mvs_issue_recovery(device_t dev)
 	struct ccb_scsiio *csio;
 	int i;
 
-	ch->recoverycmd = 1;
 	/* Find some holden command. */
 	for (i = 0; i < MVS_MAX_SLOTS; i++) {
 		if (ch->hold[i])
@@ -1788,8 +1787,20 @@ mvs_issue_recovery(device_t dev)
 	}
 	ccb = xpt_alloc_ccb_nowait();
 	if (ccb == NULL) {
-		device_printf(dev, "Unable allocate READ LOG command");
-		return; /* XXX */
+		device_printf(dev, "Unable allocate recovery command\n");
+completeall:
+		/* We can't do anything -- complete holden commands. */
+		for (i = 0; i < MVS_MAX_SLOTS; i++) {
+			if (ch->hold[i] == NULL)
+				continue;
+			ch->hold[i]->ccb_h.status &= ~CAM_STATUS_MASK;
+			ch->hold[i]->ccb_h.status |= CAM_RESRC_UNAVAIL;
+			xpt_done(ch->hold[i]);
+			ch->hold[i] = NULL;
+			ch->numhslots--;
+		}
+		mvs_reset(dev);
+		return;
 	}
 	ccb->ccb_h = ch->hold[i]->ccb_h;	/* Reuse old header. */
 	if (ccb->ccb_h.func_code == XPT_ATA_IO) {
@@ -1802,8 +1813,9 @@ mvs_issue_recovery(device_t dev)
 		ataio->data_ptr = malloc(512, M_MVS, M_NOWAIT);
 		if (ataio->data_ptr == NULL) {
 			xpt_free_ccb(ccb);
-			device_printf(dev, "Unable allocate memory for READ LOG command");
-			return; /* XXX */
+			device_printf(dev,
+			    "Unable allocate memory for READ LOG command\n");
+			goto completeall;
 		}
 		ataio->dxfer_len = 512;
 		bzero(&ataio->cmd, sizeof(ataio->cmd));
@@ -1830,7 +1842,8 @@ mvs_issue_recovery(device_t dev)
 		csio->cdb_io.cdb_bytes[0] = 0x03;
 		csio->cdb_io.cdb_bytes[4] = csio->dxfer_len;
 	}
-	/* Freeze SIM while doing READ LOG EXT. */
+	/* Freeze SIM while doing recovery. */
+	ch->recoverycmd = 1;
 	xpt_freeze_simq(ch->sim, 1);
 	mvs_begin_transaction(dev, ccb);
 }

Modified: stable/8/sys/dev/siis/siis.c
==============================================================================
--- stable/8/sys/dev/siis/siis.c	Thu Apr 28 07:22:41 2011	(r221153)
+++ stable/8/sys/dev/siis/siis.c	Thu Apr 28 07:26:28 2011	(r221154)
@@ -1373,11 +1373,22 @@ siis_issue_recovery(device_t dev)
 	}
 	if (i == SIIS_MAX_SLOTS)
 		return;
-	ch->recoverycmd = 1;
 	ccb = xpt_alloc_ccb_nowait();
 	if (ccb == NULL) {
-		device_printf(dev, "Unable allocate READ LOG command");
-		return; /* XXX */
+		device_printf(dev, "Unable allocate recovery command\n");
+completeall:
+		/* We can't do anything -- complete holden commands. */
+		for (i = 0; i < SIIS_MAX_SLOTS; i++) {
+			if (ch->hold[i] == NULL)
+				continue;
+			ch->hold[i]->ccb_h.status &= ~CAM_STATUS_MASK;
+			ch->hold[i]->ccb_h.status |= CAM_RESRC_UNAVAIL;
+			xpt_done(ch->hold[i]);
+			ch->hold[i] = NULL;
+			ch->numhslots--;
+		}
+		siis_reset(dev);
+		return;
 	}
 	ccb->ccb_h = ch->hold[i]->ccb_h;	/* Reuse old header. */
 	if (ccb->ccb_h.func_code == XPT_ATA_IO) {
@@ -1390,8 +1401,9 @@ siis_issue_recovery(device_t dev)
 		ataio->data_ptr = malloc(512, M_SIIS, M_NOWAIT);
 		if (ataio->data_ptr == NULL) {
 			xpt_free_ccb(ccb);
-			device_printf(dev, "Unable allocate memory for READ LOG command");
-			return; /* XXX */
+			device_printf(dev,
+			    "Unable allocate memory for READ LOG command\n");
+			goto completeall;
 		}
 		ataio->dxfer_len = 512;
 		bzero(&ataio->cmd, sizeof(ataio->cmd));
@@ -1418,6 +1430,7 @@ siis_issue_recovery(device_t dev)
 		csio->cdb_io.cdb_bytes[0] = 0x03;
 		csio->cdb_io.cdb_bytes[4] = csio->dxfer_len;
 	}
+	ch->recoverycmd = 1;
 	siis_begin_transaction(dev, ccb);
 }
 

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 07:33:15 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 40D4B106566C;
	Thu, 28 Apr 2011 07:33:15 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2F0338FC16;
	Thu, 28 Apr 2011 07:33:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3S7XFBB011501;
	Thu, 28 Apr 2011 07:33:15 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3S7XFRJ011499;
	Thu, 28 Apr 2011 07:33:15 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201104280733.p3S7XFRJ011499@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 28 Apr 2011 07:33:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221155 - stable/8/sys/dev/ata
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 07:33:15 -0000

Author: mav
Date: Thu Apr 28 07:33:14 2011
New Revision: 221155
URL: http://svn.freebsd.org/changeset/base/221155

Log:
  MFC r220917:
  Use periodic status polling added at r214671 only in ATA_CAM mode. Legacy
  mode won't receive much benefit from it due to its hot-plug limitations.

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

Modified: stable/8/sys/dev/ata/ata-all.c
==============================================================================
--- stable/8/sys/dev/ata/ata-all.c	Thu Apr 28 07:26:28 2011	(r221154)
+++ stable/8/sys/dev/ata/ata-all.c	Thu Apr 28 07:33:14 2011	(r221155)
@@ -82,7 +82,9 @@ static void bswap(int8_t *, int);
 static void btrim(int8_t *, int);
 static void bpack(int8_t *, int8_t *, int);
 static void ata_interrupt_locked(void *data);
+#ifdef ATA_CAM
 static void ata_periodic_poll(void *data);
+#endif
 
 /* global vars */
 MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer");
@@ -177,8 +179,8 @@ ata_attach(device_t dev)
 		if (ch->pm_level > 1)
 			ch->user[i].caps |= CTS_SATA_CAPS_D_PMREQ;
 	}
-#endif
 	callout_init(&ch->poll_callout, 1);
+#endif
 
     /* reset the controller HW, the channel and device(s) */
     while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit)
@@ -206,8 +208,6 @@ ata_attach(device_t dev)
 	device_printf(dev, "unable to setup interrupt\n");
 	return error;
     }
-    if (ch->flags & ATA_PERIODIC_POLL)
-	callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
 
 #ifndef ATA_CAM
     /* probe and attach devices on this channel unless we are in early boot */
@@ -215,6 +215,8 @@ ata_attach(device_t dev)
 	ata_identify(dev);
     return (0);
 #else
+	if (ch->flags & ATA_PERIODIC_POLL)
+		callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
 	mtx_lock(&ch->state_mtx);
 	/* Create the device queue for our SIM. */
 	devq = cam_simq_alloc(1);
@@ -277,8 +279,10 @@ ata_detach(device_t dev)
     mtx_lock(&ch->state_mtx);
     ch->state |= ATA_STALL_QUEUE;
     mtx_unlock(&ch->state_mtx);
+#ifdef ATA_CAM
     if (ch->flags & ATA_PERIODIC_POLL)
 	callout_drain(&ch->poll_callout);
+#endif
 
 #ifndef ATA_CAM
     /* detach & delete all children */
@@ -466,9 +470,9 @@ ata_suspend(device_t dev)
     if (!dev || !(ch = device_get_softc(dev)))
 	return ENXIO;
 
-    if (ch->flags & ATA_PERIODIC_POLL)
-	callout_drain(&ch->poll_callout);
 #ifdef ATA_CAM
+	if (ch->flags & ATA_PERIODIC_POLL)
+		callout_drain(&ch->poll_callout);
 	mtx_lock(&ch->state_mtx);
 	xpt_freeze_simq(ch->sim, 1);
 	while (ch->state != ATA_IDLE)
@@ -506,14 +510,14 @@ ata_resume(device_t dev)
 	error = ata_reinit(dev);
 	xpt_release_simq(ch->sim, TRUE);
 	mtx_unlock(&ch->state_mtx);
+	if (ch->flags & ATA_PERIODIC_POLL)
+		callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
 #else
     /* reinit the devices, we dont know what mode/state they are in */
     error = ata_reinit(dev);
     /* kick off requests on the queue */
     ata_start(dev);
 #endif
-    if (ch->flags & ATA_PERIODIC_POLL)
-	callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
     return error;
 }
 
@@ -580,6 +584,7 @@ ata_interrupt_locked(void *data)
 #endif
 }
 
+#ifdef ATA_CAM
 static void
 ata_periodic_poll(void *data)
 {
@@ -588,6 +593,7 @@ ata_periodic_poll(void *data)
     callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
     ata_interrupt(ch);
 }
+#endif
 
 void
 ata_print_cable(device_t dev, u_int8_t *who)

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 07:34:37 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF903106564A;
	Thu, 28 Apr 2011 07:34:37 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B32E98FC19;
	Thu, 28 Apr 2011 07:34:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3S7Yb3O011590;
	Thu, 28 Apr 2011 07:34:37 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3S7Ybq7011587;
	Thu, 28 Apr 2011 07:34:37 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201104280734.p3S7Ybq7011587@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 28 Apr 2011 07:34:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221156 - in stable/8/sys/dev/ata: . chipsets
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 07:34:38 -0000

Author: mav
Date: Thu Apr 28 07:34:37 2011
New Revision: 221156
URL: http://svn.freebsd.org/changeset/base/221156

Log:
  MFC r220920:
   - Fix mapping of the last two SATA ports on 6-port Intel controllers.
  This improves hard-reset and hot-plug on these ports.
   - Device with ID 0x29218086 is a 2-port variant of ICH9 in legacy mode.
  Skip probing for nonexistent slave devices there.

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

Modified: stable/8/sys/dev/ata/ata-pci.h
==============================================================================
--- stable/8/sys/dev/ata/ata-pci.h	Thu Apr 28 07:33:14 2011	(r221155)
+++ stable/8/sys/dev/ata/ata-pci.h	Thu Apr 28 07:34:37 2011	(r221156)
@@ -187,7 +187,7 @@ struct ata_pci_controller {
 #define ATA_I82801HBM_S2        0x28298086
 #define ATA_I82801HBM_S3        0x282a8086
 #define ATA_I82801IB_S1         0x29208086
-#define ATA_I82801IB_AH2        0x29218086
+#define ATA_I82801IB_S3         0x29218086
 #define ATA_I82801IB_AH6        0x29228086
 #define ATA_I82801IB_AH4        0x29238086
 #define ATA_I82801IB_R1         0x29258086

Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c
==============================================================================
--- stable/8/sys/dev/ata/chipsets/ata-intel.c	Thu Apr 28 07:33:14 2011	(r221155)
+++ stable/8/sys/dev/ata/chipsets/ata-intel.c	Thu Apr 28 07:34:37 2011	(r221156)
@@ -140,7 +140,7 @@ ata_intel_probe(device_t dev)
      { ATA_I82801HBM_S3, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8M" },
      { ATA_I82801IB_S1,  0, INTEL_6CH,  0, ATA_SA300, "ICH9" },
      { ATA_I82801IB_S2,  0, INTEL_6CH2, 0, ATA_SA300, "ICH9" },
-     { ATA_I82801IB_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" },
+     { ATA_I82801IB_S3,  0, INTEL_6CH2, 0, ATA_SA300, "ICH9" },
      { ATA_I82801IB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" },
      { ATA_I82801IB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" },
      { ATA_I82801IB_R1,  0, INTEL_AHCI, 0, ATA_SA300, "ICH9" },
@@ -336,7 +336,7 @@ ata_intel_ch_attach(device_t dev)
 		} else if (ctlr->chip->cfg1 & INTEL_6CH2) {
 			ch->flags |= ATA_SATA;
 			ch->flags |= ATA_NO_SLAVE;
-			smap[0] = (ch->unit == 0) ? 4 : 5;
+			smap[0] = (ch->unit == 0) ? 0 : 1;
 			smap[1] = 0;
 		} else {
 			map &= 0x03;

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 08:49:44 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 10CF5106566B;
	Thu, 28 Apr 2011 08:49:44 +0000 (UTC)
	(envelope-from vanhu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F124D8FC14;
	Thu, 28 Apr 2011 08:49:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3S8nhBT014137;
	Thu, 28 Apr 2011 08:49:43 GMT (envelope-from vanhu@svn.freebsd.org)
Received: (from vanhu@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3S8nhgN014130;
	Thu, 28 Apr 2011 08:49:43 GMT (envelope-from vanhu@svn.freebsd.org)
Message-Id: <201104280849.p3S8nhgN014130@svn.freebsd.org>
From: VANHULLEBUS Yvan 
Date: Thu, 28 Apr 2011 08:49:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221157 - in stable/8: . sys/netipsec sys/opencrypto
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 08:49:44 -0000

Author: vanhu
Date: Thu Apr 28 08:49:43 2011
New Revision: 221157
URL: http://svn.freebsd.org/changeset/base/221157

Log:
  MFC 218794, 219026:
  Fixed IPsec's HMAC_SHA256-512 support to be RFC4868 compliant.
  This will break interoperability with all older versions of
  FreeBSD for those algorithms.
  
  Reviewed by:	bz, gnn
  Obtained from:	NETASQ

Modified:
  stable/8/UPDATING
  stable/8/sys/netipsec/key.c
  stable/8/sys/netipsec/xform.h
  stable/8/sys/netipsec/xform_ah.c
  stable/8/sys/netipsec/xform_esp.c
  stable/8/sys/opencrypto/xform.h
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/UPDATING
==============================================================================
--- stable/8/UPDATING	Thu Apr 28 07:34:37 2011	(r221156)
+++ stable/8/UPDATING	Thu Apr 28 08:49:43 2011	(r221157)
@@ -15,6 +15,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	debugging tools present in HEAD were left in place because
 	sun4v support still needs work to become production ready.
 
+20110428:
+	IPsec's HMAC_SHA256-512 support has been fixed to be RFC4868
+	compliant, and will now use half of hash for authentication.
+	This will break interoperability with all stacks (including all
+	older FreeBSD versions) who implement
+	draft-ietf-ipsec-ciph-sha-256-00 (they use 96 bits of hash for
+	authentication).
+	The only workaround with such peers is to use another HMAC
+	algorithm for IPsec ("phase 2") authentication.
+
 20110221:
 	8.2-RELEASE.
 

Modified: stable/8/sys/netipsec/key.c
==============================================================================
--- stable/8/sys/netipsec/key.c	Thu Apr 28 07:34:37 2011	(r221156)
+++ stable/8/sys/netipsec/key.c	Thu Apr 28 08:49:43 2011	(r221157)
@@ -6103,6 +6103,9 @@ key_getsizes_ah(
 		case SADB_X_AALG_MD5:	*min = *max = 16; break;
 		case SADB_X_AALG_SHA:	*min = *max = 20; break;
 		case SADB_X_AALG_NULL:	*min = 1; *max = 256; break;
+		case SADB_X_AALG_SHA2_256: *min = *max = 32; break;
+		case SADB_X_AALG_SHA2_384: *min = *max = 48; break;
+		case SADB_X_AALG_SHA2_512: *min = *max = 64; break;
 		default:
 			DPRINTF(("%s: unknown AH algorithm %u\n",
 				__func__, alg));
@@ -6128,7 +6131,11 @@ key_getcomb_ah()
 	for (i = 1; i <= SADB_AALG_MAX; i++) {
 #if 1
 		/* we prefer HMAC algorithms, not old algorithms */
-		if (i != SADB_AALG_SHA1HMAC && i != SADB_AALG_MD5HMAC)
+		if (i != SADB_AALG_SHA1HMAC &&
+		    i != SADB_AALG_MD5HMAC  &&
+		    i != SADB_X_AALG_SHA2_256 &&
+		    i != SADB_X_AALG_SHA2_384 &&
+		    i != SADB_X_AALG_SHA2_512)
 			continue;
 #endif
 		algo = ah_algorithm_lookup(i);

Modified: stable/8/sys/netipsec/xform.h
==============================================================================
--- stable/8/sys/netipsec/xform.h	Thu Apr 28 07:34:37 2011	(r221156)
+++ stable/8/sys/netipsec/xform.h	Thu Apr 28 08:49:43 2011	(r221157)
@@ -46,6 +46,7 @@
 #include 
 
 #define	AH_HMAC_HASHLEN		12	/* 96 bits of authenticator */
+#define	AH_HMAC_MAXHASHLEN	(SHA2_512_HASH_LEN/2)	/* Keep this updated */
 #define	AH_HMAC_INITIAL_RPL	1	/* replay counter initial value */
 
 /*

Modified: stable/8/sys/netipsec/xform_ah.c
==============================================================================
--- stable/8/sys/netipsec/xform_ah.c	Thu Apr 28 07:34:37 2011	(r221156)
+++ stable/8/sys/netipsec/xform_ah.c	Thu Apr 28 08:49:43 2011	(r221157)
@@ -85,8 +85,7 @@
  * to use a fixed 16-byte authenticator.  The new algorithm use 12-byte
  * authenticator.
  */
-#define	AUTHSIZE(sav) \
-	((sav->flags & SADB_X_EXT_OLD) ? 16 : AH_HMAC_HASHLEN)
+#define	AUTHSIZE(sav)	ah_authsize(sav)
 
 VNET_DEFINE(int, ah_enable) = 1;	/* control flow of packets with AH */
 VNET_DEFINE(int, ah_cleartos) = 1;	/* clear ip_tos when doing AH calc */
@@ -105,6 +104,27 @@ static unsigned char ipseczeroes[256];	/
 static int ah_input_cb(struct cryptop*);
 static int ah_output_cb(struct cryptop*);
 
+static int
+ah_authsize(struct secasvar *sav)
+{
+
+	IPSEC_ASSERT(sav != NULL, ("%s: sav == NULL", __func__));
+
+	if (sav->flags & SADB_X_EXT_OLD)
+		return 16;
+
+	switch (sav->alg_auth) {
+	case SADB_X_AALG_SHA2_256:
+		return 16;
+	case SADB_X_AALG_SHA2_384:
+		return 24;
+	case SADB_X_AALG_SHA2_512:
+		return 32;
+	default:
+		return AH_HMAC_HASHLEN;
+	}
+	/* NOTREACHED */
+}
 /*
  * NB: this is public for use by the PF_KEY support.
  */

Modified: stable/8/sys/netipsec/xform_esp.c
==============================================================================
--- stable/8/sys/netipsec/xform_esp.c	Thu Apr 28 07:34:37 2011	(r221156)
+++ stable/8/sys/netipsec/xform_esp.c	Thu Apr 28 08:49:43 2011	(r221157)
@@ -297,7 +297,19 @@ esp_input(struct mbuf *m, struct secasva
 	else
 		hlen = sizeof (struct newesp) + sav->ivlen;
 	/* Authenticator hash size */
-	alen = esph ? AH_HMAC_HASHLEN : 0;
+	if (esph != NULL) {
+		switch (esph->type) {
+		case CRYPTO_SHA2_256_HMAC:
+		case CRYPTO_SHA2_384_HMAC:
+		case CRYPTO_SHA2_512_HMAC:
+			alen = esph->hashsize/2;
+			break;
+		default:
+			alen = AH_HMAC_HASHLEN;
+			break;
+		}
+	}else
+		alen = 0;
 
 	/*
 	 * Verify payload length is multiple of encryption algorithm
@@ -450,8 +462,8 @@ esp_input(struct mbuf *m, struct secasva
 static int
 esp_input_cb(struct cryptop *crp)
 {
-	u_int8_t lastthree[3], aalg[AH_HMAC_HASHLEN];
-	int hlen, skip, protoff, error;
+	u_int8_t lastthree[3], aalg[AH_HMAC_MAXHASHLEN];
+	int hlen, skip, protoff, error, alen;
 	struct mbuf *m;
 	struct cryptodesc *crd;
 	struct auth_hash *esph;
@@ -519,6 +531,16 @@ esp_input_cb(struct cryptop *crp)
 
 	/* If authentication was performed, check now. */
 	if (esph != NULL) {
+		switch (esph->type) {
+		case CRYPTO_SHA2_256_HMAC:
+		case CRYPTO_SHA2_384_HMAC:
+		case CRYPTO_SHA2_512_HMAC:
+			alen = esph->hashsize/2;
+			break;
+		default:
+			alen = AH_HMAC_HASHLEN;
+			break;
+		}
 		/*
 		 * If we have a tag, it means an IPsec-aware NIC did
 		 * the verification for us.  Otherwise we need to
@@ -527,13 +549,13 @@ esp_input_cb(struct cryptop *crp)
 		V_ahstat.ahs_hist[sav->alg_auth]++;
 		if (mtag == NULL) {
 			/* Copy the authenticator from the packet */
-			m_copydata(m, m->m_pkthdr.len - AH_HMAC_HASHLEN,
-				AH_HMAC_HASHLEN, aalg);
+			m_copydata(m, m->m_pkthdr.len - alen,
+				alen, aalg);
 
 			ptr = (caddr_t) (tc + 1);
 
 			/* Verify authenticator */
-			if (bcmp(ptr, aalg, AH_HMAC_HASHLEN) != 0) {
+			if (bcmp(ptr, aalg, alen) != 0) {
 				DPRINTF(("%s: "
 		    "authentication hash mismatch for packet in SA %s/%08lx\n",
 				    __func__,
@@ -546,7 +568,7 @@ esp_input_cb(struct cryptop *crp)
 		}
 
 		/* Remove trailing authenticator */
-		m_adj(m, -AH_HMAC_HASHLEN);
+		m_adj(m, -alen);
 	}
 
 	/* Release the crypto descriptors */
@@ -690,7 +712,16 @@ esp_output(
 	plen = rlen + padding;		/* Padded payload length. */
 
 	if (esph)
+		switch (esph->type) {
+		case CRYPTO_SHA2_256_HMAC:
+		case CRYPTO_SHA2_384_HMAC:
+		case CRYPTO_SHA2_512_HMAC:
+			alen = esph->hashsize/2;
+			break;
+		default:
 		alen = AH_HMAC_HASHLEN;
+			break;
+		}
 	else
 		alen = 0;
 
@@ -944,7 +975,7 @@ esp_output_cb(struct cryptop *crp)
 #ifdef REGRESSION
 	/* Emulate man-in-the-middle attack when ipsec_integrity is TRUE. */
 	if (V_ipsec_integrity) {
-		static unsigned char ipseczeroes[AH_HMAC_HASHLEN];
+		static unsigned char ipseczeroes[AH_HMAC_MAXHASHLEN];
 		struct auth_hash *esph;
 
 		/*
@@ -953,8 +984,20 @@ esp_output_cb(struct cryptop *crp)
 		 */
 		esph = sav->tdb_authalgxform;
 		if (esph !=  NULL) {
-			m_copyback(m, m->m_pkthdr.len - AH_HMAC_HASHLEN,
-			    AH_HMAC_HASHLEN, ipseczeroes);
+			int alen;
+
+			switch (esph->type) {
+			case CRYPTO_SHA2_256_HMAC:
+			case CRYPTO_SHA2_384_HMAC:
+			case CRYPTO_SHA2_512_HMAC:
+				alen = esph->hashsize/2;
+				break;
+			default:
+				alen = AH_HMAC_HASHLEN;
+				break;
+			}
+			m_copyback(m, m->m_pkthdr.len - alen,
+			    alen, ipseczeroes);
 		}
 	}
 #endif

Modified: stable/8/sys/opencrypto/xform.h
==============================================================================
--- stable/8/sys/opencrypto/xform.h	Thu Apr 28 07:34:37 2011	(r221156)
+++ stable/8/sys/opencrypto/xform.h	Thu Apr 28 08:49:43 2011	(r221157)
@@ -43,7 +43,8 @@ struct auth_hash {
 	void (*Final) (u_int8_t *, void *);
 };
 
-#define	AH_ALEN_MAX	20	/* max authenticator hash length */
+/* XXX use a define common with other hash stuff ! */
+#define	AH_ALEN_MAX	64	/* max authenticator hash length */
 
 struct enc_xform {
 	int type;

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 14:42:43 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3665A1065670;
	Thu, 28 Apr 2011 14:42:43 +0000 (UTC)
	(envelope-from gallatin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2432A8FC08;
	Thu, 28 Apr 2011 14:42:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3SEghH9027404;
	Thu, 28 Apr 2011 14:42:43 GMT
	(envelope-from gallatin@svn.freebsd.org)
Received: (from gallatin@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3SEghVR027402;
	Thu, 28 Apr 2011 14:42:43 GMT
	(envelope-from gallatin@svn.freebsd.org)
Message-Id: <201104281442.p3SEghVR027402@svn.freebsd.org>
From: Andrew Gallatin 
Date: Thu, 28 Apr 2011 14:42:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221168 - stable/8/sys/dev/mxge
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 14:42:43 -0000

Author: gallatin
Date: Thu Apr 28 14:42:42 2011
New Revision: 221168
URL: http://svn.freebsd.org/changeset/base/221168

Log:
  MFC r220385: Implement mxge_init()
  
    This fixes a long standing bug in mxge(4) where "ifconfig mxge0 $IP"
    did not bring the interface into a RUNNING state, like it does on
    most (all?) other FreeBSD NIC drivers.
  
    Thanks to gnn for mentioning the bug, and yongari for pointing out that
    ether_ioctl() invokes ifp->if_init() in SIOCSIFADDR.

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

Modified: stable/8/sys/dev/mxge/if_mxge.c
==============================================================================
--- stable/8/sys/dev/mxge/if_mxge.c	Thu Apr 28 14:33:15 2011	(r221167)
+++ stable/8/sys/dev/mxge/if_mxge.c	Thu Apr 28 14:42:42 2011	(r221168)
@@ -3057,6 +3057,14 @@ mxge_intr(void *arg)
 static void
 mxge_init(void *arg)
 {
+	mxge_softc_t *sc = arg;
+	struct ifnet *ifp = sc->ifp;
+
+
+	mtx_lock(&sc->driver_mtx);
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+		(void) mxge_open(sc);
+	mtx_unlock(&sc->driver_mtx);
 }
 
 

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 14:55:35 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 237B3106566C;
	Thu, 28 Apr 2011 14:55:35 +0000 (UTC)
	(envelope-from gallatin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 11B118FC1A;
	Thu, 28 Apr 2011 14:55:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3SEtYs6028029;
	Thu, 28 Apr 2011 14:55:34 GMT
	(envelope-from gallatin@svn.freebsd.org)
Received: (from gallatin@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3SEtY7x028027;
	Thu, 28 Apr 2011 14:55:34 GMT
	(envelope-from gallatin@svn.freebsd.org)
Message-Id: <201104281455.p3SEtY7x028027@svn.freebsd.org>
From: Andrew Gallatin 
Date: Thu, 28 Apr 2011 14:55:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221171 - stable/8/sys/dev/mxge
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 14:55:35 -0000

Author: gallatin
Date: Thu Apr 28 14:55:34 2011
New Revision: 221171
URL: http://svn.freebsd.org/changeset/base/221171

Log:
  MFC r220424:
    Fix a bug in mxge's LRO which can cause dup acks to
    get aggregated & hence prevent TCP from entering
    fast retransmit.
  
    Pointed out by: jeff
    Reviewed by: gnn

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

Modified: stable/8/sys/dev/mxge/mxge_lro.c
==============================================================================
--- stable/8/sys/dev/mxge/mxge_lro.c	Thu Apr 28 14:43:38 2011	(r221170)
+++ stable/8/sys/dev/mxge/mxge_lro.c	Thu Apr 28 14:55:34 2011	(r221171)
@@ -237,8 +237,10 @@ mxge_lro_rx(struct mxge_slice_state *ss,
 		    lro->dest_ip == ip->ip_dst.s_addr) {
 			/* Try to append it */
 
-			if (__predict_false(seq != lro->next_seq)) {
-				/* out of order packet */
+			if (__predict_false(seq != lro->next_seq ||
+				    (tcp_data_len == 0 &&
+				     lro->ack_seq == tcp->th_ack))) {
+				/* out of order packet or dup ack */
 				SLIST_REMOVE(&ss->lro_active, lro,
 					     lro_entry, next);
 				mxge_lro_flush(ss, lro);

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 16:18:31 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 118241065672;
	Thu, 28 Apr 2011 16:18:31 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F09BB8FC08;
	Thu, 28 Apr 2011 16:18:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3SGIUcV030641;
	Thu, 28 Apr 2011 16:18:30 GMT
	(envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3SGIUqr030633;
	Thu, 28 Apr 2011 16:18:30 GMT
	(envelope-from hselasky@svn.freebsd.org)
Message-Id: <201104281618.p3SGIUqr030633@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 28 Apr 2011 16:18:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221174 - in stable/8: sbin/geom/class/sched
	sbin/ifconfig sys/conf sys/dev/usb sys/dev/usb/controller
	sys/modules/usb/usb sys/net usr.sbin
	usr.sbin/bsnmpd/modules/snmp_hostres usr.sbin...
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 16:18:31 -0000

Author: hselasky
Date: Thu Apr 28 16:18:30 2011
New Revision: 221174
URL: http://svn.freebsd.org/changeset/base/221174

Log:
  MFC r215649,r215764,r215802,r215804,r215810,r215812,r216091,r216267,r218165,r220301,r215651,r215803,r216138,r218010,r217558,r220312,r220314,r215846 and r216268.
  Backport USB PF and usbdump from head to 8-stable.
  
  Approved by:	thompsa

Added:
  stable/8/sys/dev/usb/usb_pf.c
     - copied, changed from r215649, head/sys/dev/usb/usb_pf.c
  stable/8/sys/dev/usb/usb_pf.h
     - copied, changed from r215649, head/sys/dev/usb/usb_pf.h
     - copied from r215651, head/usr.sbin/usbdump/
Directory Properties:
  stable/8/usr.sbin/usbdump/   (props changed)
Modified:
  stable/8/sbin/ifconfig/ifconfig.c
  stable/8/sys/conf/files
  stable/8/sys/dev/usb/controller/usb_controller.c
  stable/8/sys/dev/usb/usb_bus.h
  stable/8/sys/dev/usb/usb_freebsd.h
  stable/8/sys/dev/usb/usb_transfer.c
  stable/8/sys/dev/usb/usbdi.h
  stable/8/sys/modules/usb/usb/Makefile
  stable/8/sys/net/if.h
  stable/8/usr.sbin/Makefile   (contents, props changed)
  stable/8/usr.sbin/usbdump/usbdump.c
Directory Properties:
  stable/8/sbin/   (props changed)
  stable/8/sbin/atacontrol/   (props changed)
  stable/8/sbin/bsdlabel/   (props changed)
  stable/8/sbin/camcontrol/   (props changed)
  stable/8/sbin/conscontrol/   (props changed)
  stable/8/sbin/ddb/   (props changed)
  stable/8/sbin/devd/   (props changed)
  stable/8/sbin/devfs/   (props changed)
  stable/8/sbin/dhclient/   (props changed)
  stable/8/sbin/dump/   (props changed)
  stable/8/sbin/dumpfs/   (props changed)
  stable/8/sbin/fdisk/   (props changed)
  stable/8/sbin/fsck/   (props changed)
  stable/8/sbin/fsck_ffs/   (props changed)
  stable/8/sbin/fsck_msdosfs/   (props changed)
  stable/8/sbin/fsirand/   (props changed)
  stable/8/sbin/geom/   (props changed)
  stable/8/sbin/geom/class/multipath/   (props changed)
  stable/8/sbin/geom/class/part/   (props changed)
  stable/8/sbin/geom/class/sched/gsched.8   (props changed)
  stable/8/sbin/geom/class/stripe/   (props changed)
  stable/8/sbin/ggate/   (props changed)
  stable/8/sbin/growfs/   (props changed)
  stable/8/sbin/gvinum/   (props changed)
  stable/8/sbin/hastctl/   (props changed)
  stable/8/sbin/hastd/   (props changed)
  stable/8/sbin/ifconfig/   (props changed)
  stable/8/sbin/ipfw/   (props changed)
  stable/8/sbin/iscontrol/   (props changed)
  stable/8/sbin/kldload/   (props changed)
  stable/8/sbin/kldstat/   (props changed)
  stable/8/sbin/mdconfig/   (props changed)
  stable/8/sbin/mksnap_ffs/   (props changed)
  stable/8/sbin/mount/   (props changed)
  stable/8/sbin/mount_cd9660/   (props changed)
  stable/8/sbin/mount_msdosfs/   (props changed)
  stable/8/sbin/mount_nfs/   (props changed)
  stable/8/sbin/mount_unionfs/   (props changed)
  stable/8/sbin/natd/   (props changed)
  stable/8/sbin/newfs/   (props changed)
  stable/8/sbin/newfs_msdos/   (props changed)
  stable/8/sbin/ping6/   (props changed)
  stable/8/sbin/quotacheck/   (props changed)
  stable/8/sbin/reboot/   (props changed)
  stable/8/sbin/restore/   (props changed)
  stable/8/sbin/route/   (props changed)
  stable/8/sbin/routed/   (props changed)
  stable/8/sbin/setkey/   (props changed)
  stable/8/sbin/spppcontrol/   (props changed)
  stable/8/sbin/sysctl/   (props changed)
  stable/8/sbin/tunefs/   (props changed)
  stable/8/sbin/umount/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/usr.sbin/   (props changed)
  stable/8/usr.sbin/acpi/   (props changed)
  stable/8/usr.sbin/arp/   (props changed)
  stable/8/usr.sbin/asf/   (props changed)
  stable/8/usr.sbin/bluetooth/   (props changed)
  stable/8/usr.sbin/bluetooth/bthidcontrol/   (props changed)
  stable/8/usr.sbin/bluetooth/bthidd/   (props changed)
  stable/8/usr.sbin/bluetooth/l2control/   (props changed)
  stable/8/usr.sbin/bluetooth/l2ping/   (props changed)
  stable/8/usr.sbin/boot0cfg/   (props changed)
  stable/8/usr.sbin/bsnmpd/   (props changed)
  stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_processor_tbl.c   (props changed)
  stable/8/usr.sbin/burncd/   (props changed)
  stable/8/usr.sbin/cdcontrol/   (props changed)
  stable/8/usr.sbin/chown/   (props changed)
  stable/8/usr.sbin/config/   (props changed)
  stable/8/usr.sbin/config/SMM.doc/   (props changed)
  stable/8/usr.sbin/cpucontrol/   (props changed)
  stable/8/usr.sbin/crashinfo/   (props changed)
  stable/8/usr.sbin/cron/   (props changed)
  stable/8/usr.sbin/crunch/examples/   (props changed)
  stable/8/usr.sbin/ctm/   (props changed)
  stable/8/usr.sbin/cxgbtool/   (props changed)
  stable/8/usr.sbin/devinfo/   (props changed)
  stable/8/usr.sbin/diskinfo/   (props changed)
  stable/8/usr.sbin/dumpcis/cardinfo.h   (props changed)
  stable/8/usr.sbin/dumpcis/cis.h   (props changed)
  stable/8/usr.sbin/faithd/   (props changed)
  stable/8/usr.sbin/fdcontrol/   (props changed)
  stable/8/usr.sbin/fdformat/   (props changed)
  stable/8/usr.sbin/fdread/   (props changed)
  stable/8/usr.sbin/fdwrite/   (props changed)
  stable/8/usr.sbin/fifolog/   (props changed)
  stable/8/usr.sbin/flowctl/   (props changed)
  stable/8/usr.sbin/freebsd-update/   (props changed)
  stable/8/usr.sbin/i2c/   (props changed)
  stable/8/usr.sbin/inetd/   (props changed)
  stable/8/usr.sbin/iostat/   (props changed)
  stable/8/usr.sbin/jail/   (props changed)
  stable/8/usr.sbin/jls/   (props changed)
  stable/8/usr.sbin/lpr/   (props changed)
  stable/8/usr.sbin/mailwrapper/   (props changed)
  stable/8/usr.sbin/makefs/ffs/ffs_bswap.c   (props changed)
  stable/8/usr.sbin/makefs/ffs/ffs_subr.c   (props changed)
  stable/8/usr.sbin/makefs/ffs/ufs_bswap.h   (props changed)
  stable/8/usr.sbin/makefs/getid.c   (props changed)
  stable/8/usr.sbin/mergemaster/   (props changed)
  stable/8/usr.sbin/mfiutil/   (props changed)
  stable/8/usr.sbin/mountd/   (props changed)
  stable/8/usr.sbin/moused/   (props changed)
  stable/8/usr.sbin/mptutil/   (props changed)
  stable/8/usr.sbin/mtest/   (props changed)
  stable/8/usr.sbin/mtree/   (props changed)
  stable/8/usr.sbin/named/   (props changed)
  stable/8/usr.sbin/ndp/   (props changed)
  stable/8/usr.sbin/newsyslog/   (props changed)
  stable/8/usr.sbin/nfsd/   (props changed)
  stable/8/usr.sbin/nfsdumpstate/   (props changed)
  stable/8/usr.sbin/ntp/   (props changed)
  stable/8/usr.sbin/pciconf/   (props changed)
  stable/8/usr.sbin/periodic/   (props changed)
  stable/8/usr.sbin/pkg_install/   (props changed)
  stable/8/usr.sbin/pmcannotate/   (props changed)
  stable/8/usr.sbin/pmccontrol/   (props changed)
  stable/8/usr.sbin/pmcstat/   (props changed)
  stable/8/usr.sbin/powerd/   (props changed)
  stable/8/usr.sbin/ppp/   (props changed)
  stable/8/usr.sbin/pppctl/   (props changed)
  stable/8/usr.sbin/pstat/   (props changed)
  stable/8/usr.sbin/pw/   (props changed)
  stable/8/usr.sbin/rpc.lockd/   (props changed)
  stable/8/usr.sbin/rpc.umntall/   (props changed)
  stable/8/usr.sbin/rpcbind/   (props changed)
  stable/8/usr.sbin/rtadvd/   (props changed)
  stable/8/usr.sbin/rtsold/   (props changed)
  stable/8/usr.sbin/sade/   (props changed)
  stable/8/usr.sbin/service/   (props changed)
  stable/8/usr.sbin/services_mkdb/   (props changed)
  stable/8/usr.sbin/setfmac/   (props changed)
  stable/8/usr.sbin/setpmac/   (props changed)
  stable/8/usr.sbin/smbmsg/   (props changed)
  stable/8/usr.sbin/sysinstall/   (props changed)
  stable/8/usr.sbin/syslogd/   (props changed)
  stable/8/usr.sbin/traceroute/   (props changed)
  stable/8/usr.sbin/traceroute6/   (props changed)
  stable/8/usr.sbin/tzsetup/   (props changed)
  stable/8/usr.sbin/uathload/   (props changed)
  stable/8/usr.sbin/ugidfw/   (props changed)
  stable/8/usr.sbin/uhsoctl/   (props changed)
  stable/8/usr.sbin/usbconfig/   (props changed)
  stable/8/usr.sbin/vidcontrol/   (props changed)
  stable/8/usr.sbin/watchdogd/   (props changed)
  stable/8/usr.sbin/wpa/   (props changed)
  stable/8/usr.sbin/ypserv/   (props changed)
  stable/8/usr.sbin/zic/   (props changed)

Modified: stable/8/sbin/ifconfig/ifconfig.c
==============================================================================
--- stable/8/sbin/ifconfig/ifconfig.c	Thu Apr 28 16:02:05 2011	(r221173)
+++ stable/8/sbin/ifconfig/ifconfig.c	Thu Apr 28 16:18:30 2011	(r221174)
@@ -305,6 +305,8 @@ main(int argc, char *argv[])
 		}
 		cp = ifa->ifa_name;
 
+		if ((ifa->ifa_flags & IFF_CANTCONFIG) != 0)
+			continue;
 		if (downonly && (ifa->ifa_flags & IFF_UP) != 0)
 			continue;
 		if (uponly && (ifa->ifa_flags & IFF_UP) == 0)

Modified: stable/8/sys/conf/files
==============================================================================
--- stable/8/sys/conf/files	Thu Apr 28 16:02:05 2011	(r221173)
+++ stable/8/sys/conf/files	Thu Apr 28 16:18:30 2011	(r221174)
@@ -1749,6 +1749,7 @@ dev/usb/usb_lookup.c		optional usb
 dev/usb/usb_mbuf.c		optional usb
 dev/usb/usb_msctest.c		optional usb
 dev/usb/usb_parse.c		optional usb
+dev/usb/usb_pf.c		optional usb
 dev/usb/usb_process.c		optional usb
 dev/usb/usb_request.c		optional usb
 dev/usb/usb_transfer.c		optional usb

Modified: stable/8/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- stable/8/sys/dev/usb/controller/usb_controller.c	Thu Apr 28 16:02:05 2011	(r221173)
+++ stable/8/sys/dev/usb/controller/usb_controller.c	Thu Apr 28 16:18:30 2011	(r221174)
@@ -60,6 +60,7 @@
 
 #include 
 #include 
+#include 
 
 /* function prototypes  */
 
@@ -205,6 +206,9 @@ usb_detach(device_t dev)
 
 	usb_proc_free(&bus->control_xfer_proc);
 
+#if USB_HAVE_PF
+	usbpf_detach(bus);
+#endif
 	return (0);
 }
 
@@ -433,6 +437,9 @@ usb_attach_sub(device_t dev, struct usb_
 		usb_devclass_ptr = devclass_find("usbus");
 	mtx_unlock(&Giant);
 
+#if USB_HAVE_PF
+	usbpf_attach(bus);
+#endif
 	/* Initialise USB process messages */
 	bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore;
 	bus->explore_msg[0].bus = bus;
@@ -595,3 +602,4 @@ usb_bus_mem_free_all(struct usb_bus *bus
 
 	mtx_destroy(&bus->bus_mtx);
 }
+

Modified: stable/8/sys/dev/usb/usb_bus.h
==============================================================================
--- stable/8/sys/dev/usb/usb_bus.h	Thu Apr 28 16:02:05 2011	(r221173)
+++ stable/8/sys/dev/usb/usb_bus.h	Thu Apr 28 16:18:30 2011	(r221174)
@@ -86,6 +86,8 @@ struct usb_bus {
 	struct usb_bus_methods *methods;	/* filled by HC driver */
 	struct usb_device **devices;
 
+	struct ifnet *ifp;	/* only for USB Packet Filter */
+
 	usb_power_mask_t hw_power_state;	/* see USB_HW_POWER_XXX */
 	usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
 

Modified: stable/8/sys/dev/usb/usb_freebsd.h
==============================================================================
--- stable/8/sys/dev/usb/usb_freebsd.h	Thu Apr 28 16:02:05 2011	(r221173)
+++ stable/8/sys/dev/usb/usb_freebsd.h	Thu Apr 28 16:18:30 2011	(r221174)
@@ -40,6 +40,7 @@
 #define	USB_HAVE_TT_SUPPORT 1
 #define	USB_HAVE_POWERD 1
 #define	USB_HAVE_MSCTEST 1
+#define	USB_HAVE_PF 1
 
 #define	USB_TD_GET_PROC(td) (td)->td_proc
 #define	USB_PROC_GET_GID(td) (td)->p_pgid

Copied and modified: stable/8/sys/dev/usb/usb_pf.c (from r215649, head/sys/dev/usb/usb_pf.c)
==============================================================================
--- head/sys/dev/usb/usb_pf.c	Mon Nov 22 01:11:28 2010	(r215649, copy source)
+++ stable/8/sys/dev/usb/usb_pf.c	Thu Apr 28 16:18:30 2011	(r221174)
@@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -55,1623 +58,58 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-/*
- * All usbpf implementations are extracted from bpf(9) APIs and it's
- * specialized for USB packet filtering between the driver and the host
- * controller.
- */
-
-MALLOC_DEFINE(M_USBPF, "USBPktFilter", "USB Packet Filter");
-
-/*
- * Rotate the packet buffers in descriptor ud.  Move the store buffer into the
- * hold slot, and the free buffer ino the store slot.  Zero the length of the
- * new store buffer.  Descriptor lock should be held.
- */
-#define	USBPF_ROTATE_BUFFERS(ud)	do {				\
-	(ud)->ud_hbuf = (ud)->ud_sbuf;					\
-	(ud)->ud_hlen = (ud)->ud_slen;					\
-	(ud)->ud_sbuf = (ud)->ud_fbuf;					\
-	(ud)->ud_slen = 0;						\
-	(ud)->ud_fbuf = NULL;						\
-	usbpf_bufheld(ud);						\
-} while (0)
+static int usb_no_pf;
 
-#ifndef __i386__
-#define	USBPF_ALIGN
-#endif
-
-#ifndef USBPF_ALIGN
-#define	USBPF_EXTRACT_SHORT(p)	((u_int16_t)ntohs(*(u_int16_t *)p))
-#define	USBPF_EXTRACT_LONG(p)	(ntohl(*(u_int32_t *)p))
-#else
-#define	USBPF_EXTRACT_SHORT(p)						\
-	((u_int16_t)							\
-	    ((u_int16_t)*((u_char *)p+0)<<8|				\
-		(u_int16_t)*((u_char *)p+1)<<0))
-#define	USBPF_EXTRACT_LONG(p)						\
-	((u_int32_t)*((u_char *)p+0)<<24|				\
-	    (u_int32_t)*((u_char *)p+1)<<16|				\
-	    (u_int32_t)*((u_char *)p+2)<<8|				\
-	    (u_int32_t)*((u_char *)p+3)<<0)
-#endif
-
-/*
- * Number of scratch memory words (for USBPF_LD|USBPF_MEM and USBPF_ST).
- */
-#define	USBPF_MEMWORDS		 16
-
-/* Values for ud_state */
-#define	USBPF_IDLE		0	/* no select in progress */
-#define	USBPF_WAITING		1	/* waiting for read timeout in select */
-#define	USBPF_TIMED_OUT		2	/* read timeout has expired in select */
-
-#define	PRIUSB			26	/* interruptible */
-
-/* Frame directions */
-enum usbpf_direction {
-	USBPF_D_IN,	/* See incoming frames */
-	USBPF_D_INOUT,	/* See incoming and outgoing frames */
-	USBPF_D_OUT	/* See outgoing frames */
-};
-
-static void	usbpf_append_bytes(struct usbpf_d *, caddr_t, u_int, void *,
-		    u_int);
-static void	usbpf_attachd(struct usbpf_d *, struct usbpf_if *);
-static void	usbpf_detachd(struct usbpf_d *);
-static int	usbpf_canfreebuf(struct usbpf_d *);
-static void	usbpf_buf_reclaimed(struct usbpf_d *);
-static int	usbpf_canwritebuf(struct usbpf_d *);
-
-static	d_open_t	usbpf_open;
-static	d_read_t	usbpf_read;
-static	d_write_t	usbpf_write;
-static	d_ioctl_t	usbpf_ioctl;
-static	d_poll_t	usbpf_poll;
-static	d_kqfilter_t	usbpf_kqfilter;
-
-static struct cdevsw usbpf_cdevsw = {
-	.d_version =	D_VERSION,
-	.d_open =	usbpf_open,
-	.d_read =	usbpf_read,
-	.d_write =	usbpf_write,
-	.d_ioctl =	usbpf_ioctl,
-	.d_poll =	usbpf_poll,
-	.d_name =	"usbpf",
-	.d_kqfilter =	usbpf_kqfilter,
-};
-
-static LIST_HEAD(, usbpf_if)	usbpf_iflist;
-static struct mtx	usbpf_mtx;		/* global lock */
-static int usbpf_uifd_cnt;
-
-static int usbpf_bufsize = 4096;
-#define	USBPF_MINBUFSIZE 32
-#define	USBPF_MAXBUFSIZE 0x80000
-static int usbpf_maxbufsize = USBPF_MAXBUFSIZE;
-#define	USBPF_MAXINSNS 512
-static int usbpf_maxinsns = USBPF_MAXINSNS;
-
-static void
-usbpf_buffer_init(struct usbpf_d *ud)
-{
-
-	ud->ud_bufsize = usbpf_bufsize;
-}
-
-/*
- * Free USBPF kernel buffers on device close.
- */
-static void
-usbpf_buffer_free(struct usbpf_d *ud)
-{
-
-	if (ud->ud_sbuf != NULL)
-		free(ud->ud_sbuf, M_USBPF);
-	if (ud->ud_hbuf != NULL)
-		free(ud->ud_hbuf, M_USBPF);
-	if (ud->ud_fbuf != NULL)
-		free(ud->ud_fbuf, M_USBPF);
-
-#ifdef INVARIANTS
-	ud->ud_sbuf = ud->ud_hbuf = ud->ud_fbuf = (caddr_t)~0;
-#endif
-}
-
-static void
-usbpf_buffer_alloc(struct usbpf_d *ud)
-{
-
-	KASSERT(ud->ud_fbuf == NULL, ("%s: ud_fbuf != NULL", __func__));
-	KASSERT(ud->ud_sbuf == NULL, ("%s: ud_sbuf != NULL", __func__));
-	KASSERT(ud->ud_hbuf == NULL, ("%s: ud_hbuf != NULL", __func__));
-
-	ud->ud_fbuf = (caddr_t)malloc(ud->ud_bufsize, M_USBPF, M_WAITOK);
-	ud->ud_sbuf = (caddr_t)malloc(ud->ud_bufsize, M_USBPF, M_WAITOK);
-	ud->ud_hbuf = NULL;
-	ud->ud_slen = 0;
-	ud->ud_hlen = 0;
-}
-
-/*
- * Copy buffer storage to user space in read().
- */
-static int
-usbpf_buffer_uiomove(struct usbpf_d *ud, caddr_t buf, u_int len,
-    struct uio *uio)
-{
-
-	return (uiomove(buf, len, uio));
-}
-
-/*
- * Simple data copy to the current kernel buffer.
- */
-static void
-usbpf_buffer_append_bytes(struct usbpf_d *ud, caddr_t buf, u_int offset,
-    void *src, u_int len)
-{
-	u_char *src_bytes;
-
-	src_bytes = (u_char *)src;
-	bcopy(src_bytes, buf + offset, len);
-}
-
-/*
- * Allocate or resize buffers.
- */
-static int
-usbpf_buffer_ioctl_sblen(struct usbpf_d *ud, u_int *i)
-{
-	u_int size;
-
-	USBPFD_LOCK(ud);
-	if (ud->ud_bif != NULL) {
-		USBPFD_UNLOCK(ud);
-		return (EINVAL);
-	}
-	size = *i;
-	if (size > usbpf_maxbufsize)
-		*i = size = usbpf_maxbufsize;
-	else if (size < USBPF_MINBUFSIZE)
-		*i = size = USBPF_MINBUFSIZE;
-	ud->ud_bufsize = size;
-	USBPFD_UNLOCK(ud);
-	return (0);
-}
-
-static const u_short	usbpf_code_map[] = {
-	0x10ff,	/* 0x00-0x0f: 1111111100001000 */
-	0x3070,	/* 0x10-0x1f: 0000111000001100 */
-	0x3131,	/* 0x20-0x2f: 1000110010001100 */
-	0x3031,	/* 0x30-0x3f: 1000110000001100 */
-	0x3131,	/* 0x40-0x4f: 1000110010001100 */
-	0x1011,	/* 0x50-0x5f: 1000100000001000 */
-	0x1013,	/* 0x60-0x6f: 1100100000001000 */
-	0x1010,	/* 0x70-0x7f: 0000100000001000 */
-	0x0093,	/* 0x80-0x8f: 1100100100000000 */
-	0x0000,	/* 0x90-0x9f: 0000000000000000 */
-	0x0000,	/* 0xa0-0xaf: 0000000000000000 */
-	0x0002,	/* 0xb0-0xbf: 0100000000000000 */
-	0x0000,	/* 0xc0-0xcf: 0000000000000000 */
-	0x0000,	/* 0xd0-0xdf: 0000000000000000 */
-	0x0000,	/* 0xe0-0xef: 0000000000000000 */
-	0x0000	/* 0xf0-0xff: 0000000000000000 */
-};
-
-#define	USBPF_VALIDATE_CODE(c)	\
-    ((c) <= 0xff && (usbpf_code_map[(c) >> 4] & (1 << ((c) & 0xf))) != 0)
-
-/*
- * Return true if the 'fcode' is a valid filter program.
- * The constraints are that each jump be forward and to a valid
- * code.  The code must terminate with either an accept or reject.
- *
- * The kernel needs to be able to verify an application's filter code.
- * Otherwise, a bogus program could easily crash the system.
- */
-static int
-usbpf_validate(const struct usbpf_insn *f, int len)
-{
-	register int i;
-	register const struct usbpf_insn *p;
-
-	/* Do not accept negative length filter. */
-	if (len < 0)
-		return (0);
-
-	/* An empty filter means accept all. */
-	if (len == 0)
-		return (1);
-
-	for (i = 0; i < len; ++i) {
-		p = &f[i];
-		/*
-		 * Check that the code is valid.
-		 */
-		if (!USBPF_VALIDATE_CODE(p->code))
-			return (0);
-		/*
-		 * Check that that jumps are forward, and within
-		 * the code block.
-		 */
-		if (USBPF_CLASS(p->code) == USBPF_JMP) {
-			register u_int offset;
-
-			if (p->code == (USBPF_JMP|USBPF_JA))
-				offset = p->k;
-			else
-				offset = p->jt > p->jf ? p->jt : p->jf;
-			if (offset >= (u_int)(len - i) - 1)
-				return (0);
-			continue;
-		}
-		/*
-		 * Check that memory operations use valid addresses.
-		 */
-		if (p->code == USBPF_ST || p->code == USBPF_STX ||
-		    p->code == (USBPF_LD|USBPF_MEM) ||
-		    p->code == (USBPF_LDX|USBPF_MEM)) {
-			if (p->k >= USBPF_MEMWORDS)
-				return (0);
-			continue;
-		}
-		/*
-		 * Check for constant division by 0.
-		 */
-		if (p->code == (USBPF_ALU|USBPF_DIV|USBPF_K) && p->k == 0)
-			return (0);
-	}
-	return (USBPF_CLASS(f[len - 1].code) == USBPF_RET);
-}
-
-#ifdef _KERNEL
-#define	MINDEX(m, k) \
-{ \
-	register int len = m->m_len; \
- \
-	while (k >= len) { \
-		k -= len; \
-		m = m->m_next; \
-		if (m == 0) \
-			return (0); \
-		len = m->m_len; \
-	} \
-}
-
-static u_int16_t	m_xhalf(struct mbuf *m, usbpf_u_int32 k, int *err);
-static u_int32_t	m_xword(struct mbuf *m, usbpf_u_int32 k, int *err);
-
-static u_int32_t
-m_xword(struct mbuf *m, usbpf_u_int32 k, int *err)
-{
-	size_t len;
-	u_char *cp, *np;
-	struct mbuf *m0;
-
-	len = m->m_len;
-	while (k >= len) {
-		k -= len;
-		m = m->m_next;
-		if (m == 0)
-			goto bad;
-		len = m->m_len;
-	}
-	cp = mtod(m, u_char *) + k;
-	if (len - k >= 4) {
-		*err = 0;
-		return (USBPF_EXTRACT_LONG(cp));
-	}
-	m0 = m->m_next;
-	if (m0 == 0 || m0->m_len + len - k < 4)
-		goto bad;
-	*err = 0;
-	np = mtod(m0, u_char *);
-	switch (len - k) {
-	case 1:
-		return (((u_int32_t)cp[0] << 24) |
-		    ((u_int32_t)np[0] << 16) |
-		    ((u_int32_t)np[1] << 8)  |
-		    (u_int32_t)np[2]);
-
-	case 2:
-		return (((u_int32_t)cp[0] << 24) |
-		    ((u_int32_t)cp[1] << 16) |
-		    ((u_int32_t)np[0] << 8) |
-		    (u_int32_t)np[1]);
-
-	default:
-		return (((u_int32_t)cp[0] << 24) |
-		    ((u_int32_t)cp[1] << 16) |
-		    ((u_int32_t)cp[2] << 8) |
-		    (u_int32_t)np[0]);
-	}
-    bad:
-	*err = 1;
-	return (0);
-}
-
-static u_int16_t
-m_xhalf(struct mbuf *m, usbpf_u_int32 k, int *err)
-{
-	size_t len;
-	u_char *cp;
-	struct mbuf *m0;
-
-	len = m->m_len;
-	while (k >= len) {
-		k -= len;
-		m = m->m_next;
-		if (m == 0)
-			goto bad;
-		len = m->m_len;
-	}
-	cp = mtod(m, u_char *) + k;
-	if (len - k >= 2) {
-		*err = 0;
-		return (USBPF_EXTRACT_SHORT(cp));
-	}
-	m0 = m->m_next;
-	if (m0 == 0)
-		goto bad;
-	*err = 0;
-	return ((cp[0] << 8) | mtod(m0, u_char *)[0]);
- bad:
-	*err = 1;
-	return (0);
-}
-#endif
-
-/*
- * Execute the filter program starting at pc on the packet p
- * wirelen is the length of the original packet
- * buflen is the amount of data present
- */
-static u_int
-usbpf_filter(const struct usbpf_insn *pc, u_char *p, u_int wirelen,
-    u_int buflen)
-{
-	u_int32_t A = 0, X = 0;
-	usbpf_u_int32 k;
-	u_int32_t mem[USBPF_MEMWORDS];
-
-	/*
-	 * XXX temporarily the filter system is disabled because currently it
-	 * could not handle the some machine code properly that leads to
-	 * kernel crash by invalid usage.
-	 */
-	return ((u_int)-1);
-
-	if (pc == NULL)
-		/*
-		 * No filter means accept all.
-		 */
-		return ((u_int)-1);
-
-	--pc;
-	while (1) {
-		++pc;
-		switch (pc->code) {
-		default:
-#ifdef _KERNEL
-			return (0);
-#else
-			abort();
-#endif
-
-		case USBPF_RET|USBPF_K:
-			return ((u_int)pc->k);
-
-		case USBPF_RET|USBPF_A:
-			return ((u_int)A);
-
-		case USBPF_LD|USBPF_W|USBPF_ABS:
-			k = pc->k;
-			if (k > buflen || sizeof(int32_t) > buflen - k) {
-#ifdef _KERNEL
-				int merr;
-
-				if (buflen != 0)
-					return (0);
-				A = m_xword((struct mbuf *)p, k, &merr);
-				if (merr != 0)
-					return (0);
-				continue;
-#else
-				return (0);
-#endif
-			}
-#ifdef USBPF_ALIGN
-			if (((intptr_t)(p + k) & 3) != 0)
-				A = USBPF_EXTRACT_LONG(&p[k]);
-			else
-#endif
-				A = ntohl(*(int32_t *)(p + k));
-			continue;
-
-		case USBPF_LD|USBPF_H|USBPF_ABS:
-			k = pc->k;
-			if (k > buflen || sizeof(int16_t) > buflen - k) {
-#ifdef _KERNEL
-				int merr;
-
-				if (buflen != 0)
-					return (0);
-				A = m_xhalf((struct mbuf *)p, k, &merr);
-				continue;
-#else
-				return (0);
-#endif
-			}
-			A = USBPF_EXTRACT_SHORT(&p[k]);
-			continue;
+SYSCTL_INT(_hw_usb, OID_AUTO, no_pf, CTLFLAG_RW,
+    &usb_no_pf, 0, "Set to disable USB packet filtering");
 
-		case USBPF_LD|USBPF_B|USBPF_ABS:
-			k = pc->k;
-			if (k >= buflen) {
-#ifdef _KERNEL
-				struct mbuf *m;
-
-				if (buflen != 0)
-					return (0);
-				m = (struct mbuf *)p;
-				MINDEX(m, k);
-				A = mtod(m, u_char *)[k];
-				continue;
-#else
-				return (0);
-#endif
-			}
-			A = p[k];
-			continue;
-
-		case USBPF_LD|USBPF_W|USBPF_LEN:
-			A = wirelen;
-			continue;
-
-		case USBPF_LDX|USBPF_W|USBPF_LEN:
-			X = wirelen;
-			continue;
-
-		case USBPF_LD|USBPF_W|USBPF_IND:
-			k = X + pc->k;
-			if (pc->k > buflen || X > buflen - pc->k ||
-			    sizeof(int32_t) > buflen - k) {
-#ifdef _KERNEL
-				int merr;
-
-				if (buflen != 0)
-					return (0);
-				A = m_xword((struct mbuf *)p, k, &merr);
-				if (merr != 0)
-					return (0);
-				continue;
-#else
-				return (0);
-#endif
-			}
-#ifdef USBPF_ALIGN
-			if (((intptr_t)(p + k) & 3) != 0)
-				A = USBPF_EXTRACT_LONG(&p[k]);
-			else
-#endif
-				A = ntohl(*(int32_t *)(p + k));
-			continue;
-
-		case USBPF_LD|USBPF_H|USBPF_IND:
-			k = X + pc->k;
-			if (X > buflen || pc->k > buflen - X ||
-			    sizeof(int16_t) > buflen - k) {
-#ifdef _KERNEL
-				int merr;
-
-				if (buflen != 0)
-					return (0);
-				A = m_xhalf((struct mbuf *)p, k, &merr);
-				if (merr != 0)
-					return (0);
-				continue;
-#else
-				return (0);
-#endif
-			}
-			A = USBPF_EXTRACT_SHORT(&p[k]);
-			continue;
-
-		case USBPF_LD|USBPF_B|USBPF_IND:
-			k = X + pc->k;
-			if (pc->k >= buflen || X >= buflen - pc->k) {
-#ifdef _KERNEL
-				struct mbuf *m;
-
-				if (buflen != 0)
-					return (0);
-				m = (struct mbuf *)p;
-				MINDEX(m, k);
-				A = mtod(m, u_char *)[k];
-				continue;
-#else
-				return (0);
-#endif
-			}
-			A = p[k];
-			continue;
-
-		case USBPF_LDX|USBPF_MSH|USBPF_B:
-			k = pc->k;
-			if (k >= buflen) {
-#ifdef _KERNEL
-				register struct mbuf *m;
-
-				if (buflen != 0)
-					return (0);
-				m = (struct mbuf *)p;
-				MINDEX(m, k);
-				X = (mtod(m, u_char *)[k] & 0xf) << 2;
-				continue;
-#else
-				return (0);
-#endif
-			}
-			X = (p[pc->k] & 0xf) << 2;
-			continue;
-
-		case USBPF_LD|USBPF_IMM:
-			A = pc->k;
-			continue;
-
-		case USBPF_LDX|USBPF_IMM:
-			X = pc->k;
-			continue;
-
-		case USBPF_LD|USBPF_MEM:
-			A = mem[pc->k];
-			continue;
-
-		case USBPF_LDX|USBPF_MEM:
-			X = mem[pc->k];
-			continue;
-
-		case USBPF_ST:
-			mem[pc->k] = A;
-			continue;
-
-		case USBPF_STX:
-			mem[pc->k] = X;
-			continue;
-
-		case USBPF_JMP|USBPF_JA:
-			pc += pc->k;
-			continue;
-
-		case USBPF_JMP|USBPF_JGT|USBPF_K:
-			pc += (A > pc->k) ? pc->jt : pc->jf;
-			continue;
-
-		case USBPF_JMP|USBPF_JGE|USBPF_K:
-			pc += (A >= pc->k) ? pc->jt : pc->jf;
-			continue;
-
-		case USBPF_JMP|USBPF_JEQ|USBPF_K:
-			pc += (A == pc->k) ? pc->jt : pc->jf;
-			continue;
-
-		case USBPF_JMP|USBPF_JSET|USBPF_K:
-			pc += (A & pc->k) ? pc->jt : pc->jf;
-			continue;
-
-		case USBPF_JMP|USBPF_JGT|USBPF_X:
-			pc += (A > X) ? pc->jt : pc->jf;
-			continue;
-
-		case USBPF_JMP|USBPF_JGE|USBPF_X:
-			pc += (A >= X) ? pc->jt : pc->jf;
-			continue;
-
-		case USBPF_JMP|USBPF_JEQ|USBPF_X:
-			pc += (A == X) ? pc->jt : pc->jf;
-			continue;
-
-		case USBPF_JMP|USBPF_JSET|USBPF_X:
-			pc += (A & X) ? pc->jt : pc->jf;
-			continue;
-
-		case USBPF_ALU|USBPF_ADD|USBPF_X:
-			A += X;
-			continue;
-
-		case USBPF_ALU|USBPF_SUB|USBPF_X:
-			A -= X;
-			continue;
-
-		case USBPF_ALU|USBPF_MUL|USBPF_X:
-			A *= X;
-			continue;
-
-		case USBPF_ALU|USBPF_DIV|USBPF_X:
-			if (X == 0)
-				return (0);
-			A /= X;
-			continue;
-
-		case USBPF_ALU|USBPF_AND|USBPF_X:
-			A &= X;
-			continue;
-
-		case USBPF_ALU|USBPF_OR|USBPF_X:
-			A |= X;
-			continue;
-
-		case USBPF_ALU|USBPF_LSH|USBPF_X:
-			A <<= X;
-			continue;
-
-		case USBPF_ALU|USBPF_RSH|USBPF_X:
-			A >>= X;
-			continue;
-
-		case USBPF_ALU|USBPF_ADD|USBPF_K:
-			A += pc->k;
-			continue;
-
-		case USBPF_ALU|USBPF_SUB|USBPF_K:
-			A -= pc->k;
-			continue;
-
-		case USBPF_ALU|USBPF_MUL|USBPF_K:
-			A *= pc->k;
-			continue;
-
-		case USBPF_ALU|USBPF_DIV|USBPF_K:
-			A /= pc->k;
-			continue;
-
-		case USBPF_ALU|USBPF_AND|USBPF_K:
-			A &= pc->k;
-			continue;
-
-		case USBPF_ALU|USBPF_OR|USBPF_K:
-			A |= pc->k;
-			continue;
-
-		case USBPF_ALU|USBPF_LSH|USBPF_K:
-			A <<= pc->k;
-			continue;
-
-		case USBPF_ALU|USBPF_RSH|USBPF_K:
-			A >>= pc->k;
-			continue;
-
-		case USBPF_ALU|USBPF_NEG:
-			A = -A;
-			continue;
-
-		case USBPF_MISC|USBPF_TAX:
-			X = A;
-			continue;
-
-		case USBPF_MISC|USBPF_TXA:
-			A = X;
-			continue;
-		}
-	}
-}
-
-static void
-usbpf_free(struct usbpf_d *ud)
-{
-
-	switch (ud->ud_bufmode) {
-	case USBPF_BUFMODE_BUFFER:
-		return (usbpf_buffer_free(ud));
-	default:
-		panic("usbpf_buf_free");
-	}
-}
+TUNABLE_INT("hw.usb.no_pf", &usb_no_pf);
 
-/*
- * Notify the buffer model that a buffer has moved into the hold position.
- */
-static void
-usbpf_bufheld(struct usbpf_d *ud)
-{
-
-	USBPFD_LOCK_ASSERT(ud);
-}
-
-/*
- * Free buffers currently in use by a descriptor.
- * Called on close.
- */
-static void
-usbpf_freed(struct usbpf_d *ud)
-{
-
-	/*
-	 * We don't need to lock out interrupts since this descriptor has
-	 * been detached from its interface and it yet hasn't been marked
-	 * free.
-	 */
-	usbpf_free(ud);
-	if (ud->ud_rfilter != NULL)
-		free((caddr_t)ud->ud_rfilter, M_USBPF);
-	if (ud->ud_wfilter != NULL)
-		free((caddr_t)ud->ud_wfilter, M_USBPF);
-	mtx_destroy(&ud->ud_mtx);
-}
-
-/*
- * Close the descriptor by detaching it from its interface,
- * deallocating its buffers, and marking it free.
- */
-static void
-usbpf_dtor(void *data)
-{
-	struct usbpf_d *ud = data;
-
-	USBPFD_LOCK(ud);
-	if (ud->ud_state == USBPF_WAITING)
-		callout_stop(&ud->ud_callout);
-	ud->ud_state = USBPF_IDLE;
-	USBPFD_UNLOCK(ud);
-	funsetown(&ud->ud_sigio);
-	mtx_lock(&usbpf_mtx);
-	if (ud->ud_bif)
-		usbpf_detachd(ud);
-	mtx_unlock(&usbpf_mtx);
-	selwakeuppri(&ud->ud_sel, PRIUSB);
-	knlist_destroy(&ud->ud_sel.si_note);
-	callout_drain(&ud->ud_callout);
-	usbpf_freed(ud);
-	free(ud, M_USBPF);
-}
-
-/*
- * Open device.  Returns ENXIO for illegal minor device number,
- * EBUSY if file is open by another process.
- */
-/* ARGSUSED */
-static	int
-usbpf_open(struct cdev *dev, int flags, int fmt, struct thread *td)
-{
-	struct usbpf_d *ud;
-	int error;
-
-	ud = malloc(sizeof(*ud), M_USBPF, M_WAITOK | M_ZERO);
-	error = devfs_set_cdevpriv(ud, usbpf_dtor);
-	if (error != 0) {
-		free(ud, M_USBPF);
-		return (error);
-	}
-
-	usbpf_buffer_init(ud);
-	ud->ud_bufmode = USBPF_BUFMODE_BUFFER;
-	ud->ud_sig = SIGIO;
-	ud->ud_direction = USBPF_D_INOUT;
-	ud->ud_pid = td->td_proc->p_pid;
-	mtx_init(&ud->ud_mtx, devtoname(dev), "usbpf cdev lock", MTX_DEF);
-	callout_init_mtx(&ud->ud_callout, &ud->ud_mtx, 0);
-	knlist_init_mtx(&ud->ud_sel.si_note, &ud->ud_mtx);
-
-	return (0);
-}
-
-static int
-usbpf_uiomove(struct usbpf_d *ud, caddr_t buf, u_int len, struct uio *uio)
-{
-
-	if (ud->ud_bufmode != USBPF_BUFMODE_BUFFER)
-		return (EOPNOTSUPP);
-	return (usbpf_buffer_uiomove(ud, buf, len, uio));
-}
-
-/*
- *  usbpf_read - read next chunk of packets from buffers
- */
-static	int
-usbpf_read(struct cdev *dev, struct uio *uio, int ioflag)
-{
-	struct usbpf_d *ud;
-	int error;
-	int non_block;
-	int timed_out;
-
-	error = devfs_get_cdevpriv((void **)&ud);
-	if (error != 0)
-		return (error);
-
-	/*
-	 * Restrict application to use a buffer the same size as
-	 * as kernel buffers.
-	 */
-	if (uio->uio_resid != ud->ud_bufsize)
-		return (EINVAL);
-
-	non_block = ((ioflag & O_NONBLOCK) != 0);
-
-	USBPFD_LOCK(ud);
-	ud->ud_pid = curthread->td_proc->p_pid;
-	if (ud->ud_bufmode != USBPF_BUFMODE_BUFFER) {
-		USBPFD_UNLOCK(ud);
-		return (EOPNOTSUPP);
-	}
-	if (ud->ud_state == USBPF_WAITING)
-		callout_stop(&ud->ud_callout);
-	timed_out = (ud->ud_state == USBPF_TIMED_OUT);
-	ud->ud_state = USBPF_IDLE;
-	/*
-	 * If the hold buffer is empty, then do a timed sleep, which
-	 * ends when the timeout expires or when enough packets
-	 * have arrived to fill the store buffer.
-	 */
-	while (ud->ud_hbuf == NULL) {
-		if (ud->ud_slen != 0) {
-			/*
-			 * A packet(s) either arrived since the previous
-			 * read or arrived while we were asleep.
-			 */
-			if (ud->ud_immediate || non_block || timed_out) {
-				/*
-				 * Rotate the buffers and return what's here
-				 * if we are in immediate mode, non-blocking
-				 * flag is set, or this descriptor timed out.
-				 */
-				USBPF_ROTATE_BUFFERS(ud);
-				break;
-			}
-		}
-
-		/*
-		 * No data is available, check to see if the usbpf device
-		 * is still pointed at a real interface.  If not, return
-		 * ENXIO so that the userland process knows to rebind
-		 * it before using it again.
-		 */
-		if (ud->ud_bif == NULL) {
-			USBPFD_UNLOCK(ud);
-			return (ENXIO);
-		}
-
-		if (non_block) {
-			USBPFD_UNLOCK(ud);
-			return (EWOULDBLOCK);
-		}
-		error = msleep(ud, &ud->ud_mtx, PRIUSB|PCATCH,
-		    "uff", ud->ud_rtout);
-		if (error == EINTR || error == ERESTART) {
-			USBPFD_UNLOCK(ud);
-			return (error);
-		}
-		if (error == EWOULDBLOCK) {
-			/*
-			 * On a timeout, return what's in the buffer,
-			 * which may be nothing.  If there is something
-			 * in the store buffer, we can rotate the buffers.
-			 */
-			if (ud->ud_hbuf)
-				/*
-				 * We filled up the buffer in between
-				 * getting the timeout and arriving
-				 * here, so we don't need to rotate.
-				 */
-				break;
-
-			if (ud->ud_slen == 0) {
-				USBPFD_UNLOCK(ud);

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

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 28 21:27:35 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3ECA4106564A;
	Thu, 28 Apr 2011 21:27:35 +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 2D6438FC16;
	Thu, 28 Apr 2011 21:27:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3SLRZpu063556;
	Thu, 28 Apr 2011 21:27:35 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3SLRZYl063554;
	Thu, 28 Apr 2011 21:27:35 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201104282127.p3SLRZYl063554@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 28 Apr 2011 21:27:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221185 - stable/8/usr.sbin/usbdump
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 28 Apr 2011 21:27:35 -0000

Author: thompsa
Date: Thu Apr 28 21:27:34 2011
New Revision: 221185
URL: http://svn.freebsd.org/changeset/base/221185

Log:
  MFC r220316
  
   Lower WARNS to unbreak the build, some archs may have alignment issues.

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

Modified: stable/8/usr.sbin/usbdump/Makefile
==============================================================================
--- stable/8/usr.sbin/usbdump/Makefile	Thu Apr 28 21:25:58 2011	(r221184)
+++ stable/8/usr.sbin/usbdump/Makefile	Thu Apr 28 21:27:34 2011	(r221185)
@@ -3,6 +3,6 @@
 PROG=	usbdump
 SRCS=	usbdump.c
 MAN=	usbdump.8
-WARNS?=	4
+WARNS?=	3
 
 .include 

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 00:00:55 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1FD261065672;
	Fri, 29 Apr 2011 00:00:55 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0F8908FC14;
	Fri, 29 Apr 2011 00:00:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3T00txh074896;
	Fri, 29 Apr 2011 00:00:55 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3T00sNR074886;
	Fri, 29 Apr 2011 00:00:54 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <201104290000.p3T00sNR074886@svn.freebsd.org>
From: Jack F Vogel 
Date: Fri, 29 Apr 2011 00:00:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221191 - in stable/8/sys/dev: e1000 ixgbe
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 00:00:55 -0000

Author: jfv
Date: Fri Apr 29 00:00:54 2011
New Revision: 221191
URL: http://svn.freebsd.org/changeset/base/221191

Log:
  MFC of the 1G Intel drivers, the following revisions
  from HEAD are merged:
  
  217318,218530,218548,218581,218582,218583,218587,218588,
  219753,219763,219764,220251,220254,220375,221187,221189

Modified:
  stable/8/sys/dev/e1000/e1000_80003es2lan.c
  stable/8/sys/dev/e1000/e1000_80003es2lan.h
  stable/8/sys/dev/e1000/e1000_82540.c
  stable/8/sys/dev/e1000/e1000_82541.c
  stable/8/sys/dev/e1000/e1000_82542.c
  stable/8/sys/dev/e1000/e1000_82543.c
  stable/8/sys/dev/e1000/e1000_82571.c
  stable/8/sys/dev/e1000/e1000_82575.c
  stable/8/sys/dev/e1000/e1000_82575.h
  stable/8/sys/dev/e1000/e1000_api.c
  stable/8/sys/dev/e1000/e1000_api.h
  stable/8/sys/dev/e1000/e1000_defines.h
  stable/8/sys/dev/e1000/e1000_hw.h
  stable/8/sys/dev/e1000/e1000_ich8lan.c
  stable/8/sys/dev/e1000/e1000_ich8lan.h
  stable/8/sys/dev/e1000/e1000_mac.c
  stable/8/sys/dev/e1000/e1000_mac.h
  stable/8/sys/dev/e1000/e1000_manage.c
  stable/8/sys/dev/e1000/e1000_manage.h
  stable/8/sys/dev/e1000/e1000_mbx.c
  stable/8/sys/dev/e1000/e1000_nvm.c
  stable/8/sys/dev/e1000/e1000_nvm.h
  stable/8/sys/dev/e1000/e1000_osdep.c
  stable/8/sys/dev/e1000/e1000_phy.c
  stable/8/sys/dev/e1000/e1000_phy.h
  stable/8/sys/dev/e1000/e1000_regs.h
  stable/8/sys/dev/e1000/e1000_vf.c
  stable/8/sys/dev/e1000/e1000_vf.h
  stable/8/sys/dev/e1000/if_em.c
  stable/8/sys/dev/e1000/if_em.h
  stable/8/sys/dev/e1000/if_igb.c
  stable/8/sys/dev/e1000/if_igb.h
  stable/8/sys/dev/e1000/if_lem.c
  stable/8/sys/dev/e1000/if_lem.h
  stable/8/sys/dev/ixgbe/ixgbe.c
  stable/8/sys/dev/ixgbe/ixgbe.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/e1000/e1000_80003es2lan.c
==============================================================================
--- stable/8/sys/dev/e1000/e1000_80003es2lan.c	Thu Apr 28 23:21:50 2011	(r221190)
+++ stable/8/sys/dev/e1000/e1000_80003es2lan.c	Fri Apr 29 00:00:54 2011	(r221191)
@@ -82,8 +82,8 @@ static void e1000_power_down_phy_copper_
  * with a lower bound at "index" and the upper bound at
  * "index + 5".
  */
-static const u16 e1000_gg82563_cable_length_table[] =
-         { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF };
+static const u16 e1000_gg82563_cable_length_table[] = {
+	0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF };
 #define GG82563_CABLE_LENGTH_TABLE_SIZE \
                 (sizeof(e1000_gg82563_cable_length_table) / \
                  sizeof(e1000_gg82563_cable_length_table[0]))
@@ -854,7 +854,7 @@ static s32 e1000_get_link_up_info_80003e
  **/
 static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
 {
-	u32 ctrl, icr;
+	u32 ctrl;
 	s32 ret_val;
 
 	DEBUGFUNC("e1000_reset_hw_80003es2lan");
@@ -890,7 +890,7 @@ static s32 e1000_reset_hw_80003es2lan(st
 
 	/* Clear any pending interrupt events. */
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-	icr = E1000_READ_REG(hw, E1000_ICR);
+	E1000_READ_REG(hw, E1000_ICR);
 
 	ret_val = e1000_check_alt_mac_addr_generic(hw);
 
@@ -909,6 +909,7 @@ static s32 e1000_init_hw_80003es2lan(str
 	struct e1000_mac_info *mac = &hw->mac;
 	u32 reg_data;
 	s32 ret_val;
+	u16 kum_reg_data;
 	u16 i;
 
 	DEBUGFUNC("e1000_init_hw_80003es2lan");
@@ -936,6 +937,13 @@ static s32 e1000_init_hw_80003es2lan(str
 	/* Setup link and flow control */
 	ret_val = mac->ops.setup_link(hw);
 
+	/* Disable IBIST slave mode (far-end loopback) */
+	e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
+	                                &kum_reg_data);
+	kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
+	e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
+	                                 kum_reg_data);
+
 	/* Set the transmit descriptor write-back policy */
 	reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0));
 	reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |

Modified: stable/8/sys/dev/e1000/e1000_80003es2lan.h
==============================================================================
--- stable/8/sys/dev/e1000/e1000_80003es2lan.h	Thu Apr 28 23:21:50 2011	(r221190)
+++ stable/8/sys/dev/e1000/e1000_80003es2lan.h	Fri Apr 29 00:00:54 2011	(r221191)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2009, Intel Corporation 
+  Copyright (c) 2001-2010, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 

Modified: stable/8/sys/dev/e1000/e1000_82540.c
==============================================================================
--- stable/8/sys/dev/e1000/e1000_82540.c	Thu Apr 28 23:21:50 2011	(r221190)
+++ stable/8/sys/dev/e1000/e1000_82540.c	Fri Apr 29 00:00:54 2011	(r221191)
@@ -269,7 +269,7 @@ void e1000_init_function_pointers_82540(
  **/
 static s32 e1000_reset_hw_82540(struct e1000_hw *hw)
 {
-	u32 ctrl, icr, manc;
+	u32 ctrl, manc;
 	s32 ret_val = E1000_SUCCESS;
 
 	DEBUGFUNC("e1000_reset_hw_82540");
@@ -314,7 +314,7 @@ static s32 e1000_reset_hw_82540(struct e
 	E1000_WRITE_REG(hw, E1000_MANC, manc);
 
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-	icr = E1000_READ_REG(hw, E1000_ICR);
+	E1000_READ_REG(hw, E1000_ICR);
 
 	return ret_val;
 }

Modified: stable/8/sys/dev/e1000/e1000_82541.c
==============================================================================
--- stable/8/sys/dev/e1000/e1000_82541.c	Thu Apr 28 23:21:50 2011	(r221190)
+++ stable/8/sys/dev/e1000/e1000_82541.c	Fri Apr 29 00:00:54 2011	(r221191)
@@ -300,7 +300,7 @@ void e1000_init_function_pointers_82541(
  **/
 static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
 {
-	u32 ledctl, ctrl, icr, manc;
+	u32 ledctl, ctrl, manc;
 
 	DEBUGFUNC("e1000_reset_hw_82541");
 
@@ -364,7 +364,7 @@ static s32 e1000_reset_hw_82541(struct e
 	E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
 
 	/* Clear any pending interrupt events. */
-	icr = E1000_READ_REG(hw, E1000_ICR);
+	E1000_READ_REG(hw, E1000_ICR);
 
 	return E1000_SUCCESS;
 }
@@ -390,7 +390,7 @@ static s32 e1000_init_hw_82541(struct e1
 		DEBUGOUT("Error initializing identification LED\n");
 		/* This is not fatal and we should not stop init due to this */
 	}
-        
+
 	/* Storing the Speed Power Down  value for later use */
 	ret_val = hw->phy.ops.read_reg(hw,
 	                               IGP01E1000_GMII_FIFO,

Modified: stable/8/sys/dev/e1000/e1000_82542.c
==============================================================================
--- stable/8/sys/dev/e1000/e1000_82542.c	Thu Apr 28 23:21:50 2011	(r221190)
+++ stable/8/sys/dev/e1000/e1000_82542.c	Fri Apr 29 00:00:54 2011	(r221191)
@@ -51,7 +51,6 @@ static void e1000_rar_set_82542(struct e
 static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw);
 static s32  e1000_read_mac_addr_82542(struct e1000_hw *hw);
 
-
 /**
  *  e1000_init_phy_params_82542 - Init PHY func ptrs.
  *  @hw: pointer to the HW structure
@@ -192,7 +191,7 @@ static s32 e1000_reset_hw_82542(struct e
 {
 	struct e1000_bus_info *bus = &hw->bus;
 	s32 ret_val = E1000_SUCCESS;
-	u32 ctrl, icr;
+	u32 ctrl;
 
 	DEBUGFUNC("e1000_reset_hw_82542");
 
@@ -223,7 +222,7 @@ static s32 e1000_reset_hw_82542(struct e
 	msec_delay(2);
 
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-	icr = E1000_READ_REG(hw, E1000_ICR);
+	E1000_READ_REG(hw, E1000_ICR);
 
 	if (hw->revision_id == E1000_REVISION_2) {
 		if (bus->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)

Modified: stable/8/sys/dev/e1000/e1000_82543.c
==============================================================================
--- stable/8/sys/dev/e1000/e1000_82543.c	Thu Apr 28 23:21:50 2011	(r221190)
+++ stable/8/sys/dev/e1000/e1000_82543.c	Fri Apr 29 00:00:54 2011	(r221191)
@@ -901,7 +901,7 @@ static s32 e1000_phy_hw_reset_82543(stru
  **/
 static s32 e1000_reset_hw_82543(struct e1000_hw *hw)
 {
-	u32 ctrl, icr;
+	u32 ctrl;
 	s32 ret_val = E1000_SUCCESS;
 
 	DEBUGFUNC("e1000_reset_hw_82543");
@@ -943,7 +943,7 @@ static s32 e1000_reset_hw_82543(struct e
 
 	/* Masking off and clearing any pending interrupts */
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-	icr = E1000_READ_REG(hw, E1000_ICR);
+	E1000_READ_REG(hw, E1000_ICR);
 
 	return ret_val;
 }

Modified: stable/8/sys/dev/e1000/e1000_82571.c
==============================================================================
--- stable/8/sys/dev/e1000/e1000_82571.c	Thu Apr 28 23:21:50 2011	(r221190)
+++ stable/8/sys/dev/e1000/e1000_82571.c	Fri Apr 29 00:00:54 2011	(r221191)
@@ -82,6 +82,10 @@ static s32  e1000_get_hw_semaphore_82573
 static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw);
 static s32  e1000_get_hw_semaphore_82574(struct e1000_hw *hw);
 static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw);
+static s32  e1000_set_d0_lplu_state_82574(struct e1000_hw *hw,
+                                          bool active);
+static s32  e1000_set_d3_lplu_state_82574(struct e1000_hw *hw,
+                                          bool active);
 static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw);
 static s32  e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
                                        u16 words, u16 *data);
@@ -95,7 +99,6 @@ static void e1000_power_down_phy_copper_
 static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
 {
 	struct e1000_phy_info *phy = &hw->phy;
-	struct e1000_dev_spec_82571 *dev_spec = &hw->dev_spec._82571;
 	s32 ret_val = E1000_SUCCESS;
 
 	DEBUGFUNC("e1000_init_phy_params_82571");
@@ -129,16 +132,6 @@ static s32 e1000_init_phy_params_82571(s
 		phy->ops.write_reg          = e1000_write_phy_reg_igp;
 		phy->ops.acquire            = e1000_get_hw_semaphore_82571;
 		phy->ops.release            = e1000_put_hw_semaphore_82571;
-
-		/* This uses above function pointers */
-		ret_val = e1000_get_phy_id_82571(hw);
-
-		/* Verify PHY ID */
-		if (phy->id != IGP01E1000_I_PHY_ID) {
-			ret_val = -E1000_ERR_PHY;
-			DEBUGOUT1("PHY ID unknown: type = 0x%08x\n", phy->id);
-			goto out;
-		}
 		break;
 	case e1000_82573:
 		phy->type                   = e1000_phy_m88;
@@ -152,20 +145,10 @@ static s32 e1000_init_phy_params_82571(s
 		phy->ops.write_reg          = e1000_write_phy_reg_m88;
 		phy->ops.acquire            = e1000_get_hw_semaphore_82571;
 		phy->ops.release            = e1000_put_hw_semaphore_82571;
-
-		/* This uses above function pointers */
-		ret_val = e1000_get_phy_id_82571(hw);
-
-		/* Verify PHY ID */
-		if (phy->id != M88E1111_I_PHY_ID) {
-			ret_val = -E1000_ERR_PHY;
-			DEBUGOUT1("PHY ID unknown: type = 0x%08x\n", phy->id);
-			goto out;
-		}
 		break;
 	case e1000_82574:
 	case e1000_82583:
-		E1000_MUTEX_INIT(&dev_spec->swflag_mutex);
+		E1000_MUTEX_INIT(&hw->dev_spec._82571.swflag_mutex);
 
 		phy->type                   = e1000_phy_bm;
 		phy->ops.get_cfg_done       = e1000_get_cfg_done_generic;
@@ -178,22 +161,46 @@ static s32 e1000_init_phy_params_82571(s
 		phy->ops.write_reg          = e1000_write_phy_reg_bm2;
 		phy->ops.acquire            = e1000_get_hw_semaphore_82574;
 		phy->ops.release            = e1000_put_hw_semaphore_82574;
+		phy->ops.set_d0_lplu_state  = e1000_set_d0_lplu_state_82574;
+		phy->ops.set_d3_lplu_state  = e1000_set_d3_lplu_state_82574;
+		break;
+	default:
+		ret_val = -E1000_ERR_PHY;
+		goto out;
+		break;
+	}
+
+	/* This can only be done after all function pointers are setup. */
+	ret_val = e1000_get_phy_id_82571(hw);
+	if (ret_val) {
+		DEBUGOUT("Error getting PHY ID\n");
+		goto out;
+	}
 
-		/* This uses above function pointers */
-		ret_val = e1000_get_phy_id_82571(hw);
-		/* Verify PHY ID */
-		if (phy->id != BME1000_E_PHY_ID_R2) {
+	/* Verify phy id */
+	switch (hw->mac.type) {
+	case e1000_82571:
+	case e1000_82572:
+		if (phy->id != IGP01E1000_I_PHY_ID)
+			ret_val = -E1000_ERR_PHY;
+		break;
+	case e1000_82573:
+		if (phy->id != M88E1111_I_PHY_ID)
+			ret_val = -E1000_ERR_PHY;
+		break;
+	case e1000_82574:
+	case e1000_82583:
+		if (phy->id != BME1000_E_PHY_ID_R2)
 			ret_val = -E1000_ERR_PHY;
-			DEBUGOUT1("PHY ID unknown: type = 0x%08x\n", phy->id);
-			goto out;
-		}
 		break;
 	default:
 		ret_val = -E1000_ERR_PHY;
-		goto out;
 		break;
 	}
 
+	if (ret_val)
+		DEBUGOUT1("PHY ID unknown: type = 0x%08x\n", phy->id);
+
 out:
 	return ret_val;
 }
@@ -693,6 +700,62 @@ static void e1000_put_hw_semaphore_82574
 }
 
 /**
+ *  e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state
+ *  @hw: pointer to the HW structure
+ *  @active: TRUE to enable LPLU, FALSE to disable
+ *
+ *  Sets the LPLU D0 state according to the active flag.
+ *  LPLU will not be activated unless the
+ *  device autonegotiation advertisement meets standards of
+ *  either 10 or 10/100 or 10/100/1000 at all duplexes.
+ *  This is a function pointer entry point only called by
+ *  PHY setup routines.
+ **/
+static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active)
+{
+	u16 data = E1000_READ_REG(hw, E1000_POEMB);
+
+	DEBUGFUNC("e1000_set_d0_lplu_state_82574");
+
+	if (active)
+		data |= E1000_PHY_CTRL_D0A_LPLU;
+	else
+		data &= ~E1000_PHY_CTRL_D0A_LPLU;
+
+	E1000_WRITE_REG(hw, E1000_POEMB, data);
+	return E1000_SUCCESS;
+}
+
+/**
+ *  e1000_set_d3_lplu_state_82574 - Sets low power link up state for D3
+ *  @hw: pointer to the HW structure
+ *  @active: boolean used to enable/disable lplu
+ *
+ *  The low power link up (lplu) state is set to the power management level D3
+ *  when active is TRUE, else clear lplu for D3. LPLU
+ *  is used during Dx states where the power conservation is most important.
+ *  During driver activity, SmartSpeed should be enabled so performance is
+ *  maintained.
+ **/
+static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active)
+{
+	u16 data = E1000_READ_REG(hw, E1000_POEMB);
+
+	DEBUGFUNC("e1000_set_d3_lplu_state_82574");
+
+	if (!active) {
+		data &= ~E1000_PHY_CTRL_NOND0A_LPLU;
+	} else if ((hw->phy.autoneg_advertised == E1000_ALL_SPEED_DUPLEX) ||
+	           (hw->phy.autoneg_advertised == E1000_ALL_NOT_GIG) ||
+	           (hw->phy.autoneg_advertised == E1000_ALL_10_SPEED)) {
+		data |= E1000_PHY_CTRL_NOND0A_LPLU;
+	}
+
+	E1000_WRITE_REG(hw, E1000_POEMB, data);
+	return E1000_SUCCESS;
+}
+
+/**
  *  e1000_acquire_nvm_82571 - Request for access to the EEPROM
  *  @hw: pointer to the HW structure
  *
@@ -1039,7 +1102,7 @@ out:
  **/
 static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
 {
-	u32 ctrl, ctrl_ext, icr;
+	u32 ctrl, ctrl_ext;
 	s32 ret_val;
 
 	DEBUGFUNC("e1000_reset_hw_82571");
@@ -1125,7 +1188,7 @@ static s32 e1000_reset_hw_82571(struct e
 
 	/* Clear any pending interrupt events. */
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-	icr = E1000_READ_REG(hw, E1000_ICR);
+	E1000_READ_REG(hw, E1000_ICR);
 
 	if (hw->mac.type == e1000_82571) {
 		/* Install any alternate MAC address into RAR0 */
@@ -1336,7 +1399,7 @@ static void e1000_initialize_hw_bits_825
 		 * apply workaround for hardware errata documented in errata
 		 * docs Fixes issue where some error prone or unreliable PCIe
 		 * completions are occurring, particularly with ASPM enabled.
-		 * Without fix, issue can cause tx timeouts.
+		 * Without fix, issue can cause Tx timeouts.
 		 */
 		reg = E1000_READ_REG(hw, E1000_GCR2);
 		reg |= 1;
@@ -1467,7 +1530,7 @@ bool e1000_check_phy_82574(struct e1000_
 	                               &receive_errors);
 	if (ret_val)
 		goto out;
-	if (receive_errors == E1000_RECEIVE_ERROR_MAX)  {
+	if (receive_errors == E1000_RECEIVE_ERROR_MAX) {
 		ret_val = hw->phy.ops.read_reg(hw, E1000_BASE1000T_STATUS,
 		                               &status_1kbt);
 		if (ret_val)
@@ -1510,6 +1573,7 @@ static s32 e1000_setup_link_82571(struct
 	default:
 		break;
 	}
+
 	return e1000_setup_link_generic(hw);
 }
 
@@ -1645,7 +1709,7 @@ static s32 e1000_check_for_serdes_link_8
 			 * auto-negotiation in the TXCW register and disable
 			 * forced link in the Device Control register in an
 			 * attempt to auto-negotiate with our link partner.
-			 * If the partner code word is null, stop forcing 
+			 * If the partner code word is null, stop forcing
 			 * and restart auto negotiation.
 			 */
 			if ((rxcw & E1000_RXCW_C) || !(rxcw & E1000_RXCW_CW))  {

Modified: stable/8/sys/dev/e1000/e1000_82575.c
==============================================================================
--- stable/8/sys/dev/e1000/e1000_82575.c	Thu Apr 28 23:21:50 2011	(r221190)
+++ stable/8/sys/dev/e1000/e1000_82575.c	Fri Apr 29 00:00:54 2011	(r221191)
@@ -36,7 +36,6 @@
  * 82575EB Gigabit Network Connection
  * 82575EB Gigabit Backplane Connection
  * 82575GB Gigabit Network Connection
- * 82575GB Gigabit Network Connection
  * 82576 Gigabit Network Connection
  * 82576 Quad Port Gigabit Mezzanine Adapter
  */
@@ -44,7 +43,6 @@
 #include "e1000_api.h"
 
 static s32  e1000_init_phy_params_82575(struct e1000_hw *hw);
-static s32  e1000_init_nvm_params_82575(struct e1000_hw *hw);
 static s32  e1000_init_mac_params_82575(struct e1000_hw *hw);
 static s32  e1000_acquire_phy_82575(struct e1000_hw *hw);
 static void e1000_release_phy_82575(struct e1000_hw *hw);
@@ -60,10 +58,14 @@ static s32  e1000_read_phy_reg_sgmii_825
                                            u16 *data);
 static s32  e1000_reset_hw_82575(struct e1000_hw *hw);
 static s32  e1000_reset_hw_82580(struct e1000_hw *hw);
-static s32 e1000_read_phy_reg_82580(struct e1000_hw *hw,
+static s32  e1000_read_phy_reg_82580(struct e1000_hw *hw,
                                     u32 offset, u16 *data);
-static s32 e1000_write_phy_reg_82580(struct e1000_hw *hw,
+static s32  e1000_write_phy_reg_82580(struct e1000_hw *hw,
                                      u32 offset, u16 data);
+static s32  e1000_set_d0_lplu_state_82580(struct e1000_hw *hw,
+                                          bool active);
+static s32  e1000_set_d3_lplu_state_82580(struct e1000_hw *hw,
+                                          bool active);
 static s32  e1000_set_d0_lplu_state_82575(struct e1000_hw *hw,
                                           bool active);
 static s32  e1000_setup_copper_link_82575(struct e1000_hw *hw);
@@ -86,6 +88,14 @@ static void e1000_shutdown_serdes_link_8
 static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw);
 static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw);
 static s32 e1000_reset_mdicnfg_82580(struct e1000_hw *hw);
+static s32 e1000_validate_nvm_checksum_82580(struct e1000_hw *hw);
+static s32 e1000_update_nvm_checksum_82580(struct e1000_hw *hw);
+static s32 e1000_update_nvm_checksum_with_offset(struct e1000_hw *hw,
+						u16 offset);
+static s32 e1000_validate_nvm_checksum_with_offset(struct e1000_hw *hw,
+						u16 offset);
+static s32 e1000_validate_nvm_checksum_i350(struct e1000_hw *hw);
+static s32 e1000_update_nvm_checksum_i350(struct e1000_hw *hw);
 
 static const u16 e1000_82580_rxpbs_table[] =
 	{ 36, 72, 144, 1, 2, 4, 8, 16,
@@ -115,6 +125,7 @@ static bool e1000_sgmii_uses_mdio_82575(
 		ext_mdio = !!(reg & E1000_MDIC_DEST);
 		break;
 	case e1000_82580:
+	case e1000_i350:
 		reg = E1000_READ_REG(hw, E1000_MDICNFG);
 		ext_mdio = !!(reg & E1000_MDICNFG_EXT_MDIO);
 		break;
@@ -165,7 +176,7 @@ static s32 e1000_init_phy_params_82575(s
 
 	E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext);
 	e1000_reset_mdicnfg_82580(hw);
-		
+
 	if (e1000_sgmii_active_82575(hw) && !e1000_sgmii_uses_mdio_82575(hw)) {
 		phy->ops.read_reg   = e1000_read_phy_reg_sgmii_82575;
 		phy->ops.write_reg  = e1000_write_phy_reg_sgmii_82575;
@@ -182,11 +193,19 @@ static s32 e1000_init_phy_params_82575(s
 
 	/* Verify phy id and set remaining function pointers */
 	switch (phy->id) {
+	case I347AT4_E_PHY_ID:
+	case M88E1112_E_PHY_ID:
+	case M88E1340M_E_PHY_ID:
 	case M88E1111_I_PHY_ID:
 		phy->type                   = e1000_phy_m88;
 		phy->ops.check_polarity     = e1000_check_polarity_m88;
 		phy->ops.get_info           = e1000_get_phy_info_m88;
-		phy->ops.get_cable_length   = e1000_get_cable_length_m88;
+		if (phy->id == I347AT4_E_PHY_ID ||
+		    phy->id == M88E1112_E_PHY_ID ||
+		    phy->id == M88E1340M_E_PHY_ID)
+			phy->ops.get_cable_length = e1000_get_cable_length_m88_gen2;
+		else
+			phy->ops.get_cable_length = e1000_get_cable_length_m88;
 		phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88;
 		break;
 	case IGP03E1000_E_PHY_ID:
@@ -200,11 +219,14 @@ static s32 e1000_init_phy_params_82575(s
 		phy->ops.set_d3_lplu_state  = e1000_set_d3_lplu_state_generic;
 		break;
 	case I82580_I_PHY_ID:
+	case I350_I_PHY_ID:
 		phy->type                   = e1000_phy_82580;
 		phy->ops.check_polarity     = e1000_check_polarity_82577;
 		phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_82577;
 		phy->ops.get_cable_length   = e1000_get_cable_length_82577;
 		phy->ops.get_info           = e1000_get_phy_info_82577;
+		phy->ops.set_d0_lplu_state  = e1000_set_d0_lplu_state_82580;
+		phy->ops.set_d3_lplu_state  = e1000_set_d3_lplu_state_82580;
 		break;
 	default:
 		ret_val = -E1000_ERR_PHY;
@@ -219,7 +241,7 @@ out:
  *  e1000_init_nvm_params_82575 - Init NVM func ptrs.
  *  @hw: pointer to the HW structure
  **/
-static s32 e1000_init_nvm_params_82575(struct e1000_hw *hw)
+s32 e1000_init_nvm_params_82575(struct e1000_hw *hw)
 {
 	struct e1000_nvm_info *nvm = &hw->nvm;
 	u32 eecd = E1000_READ_REG(hw, E1000_EECD);
@@ -227,6 +249,15 @@ static s32 e1000_init_nvm_params_82575(s
 
 	DEBUGFUNC("e1000_init_nvm_params_82575");
 
+	size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
+	             E1000_EECD_SIZE_EX_SHIFT);
+	/*
+	 * Added to a constant, "size" becomes the left-shift value
+	 * for setting word_size.
+	 */
+	size += NVM_WORD_SIZE_BASE_SHIFT;
+
+	nvm->word_size = 1 << size;
 	nvm->opcode_bits        = 8;
 	nvm->delay_usec         = 1;
 	switch (nvm->override) {
@@ -244,30 +275,37 @@ static s32 e1000_init_nvm_params_82575(s
 		break;
 	}
 
-	nvm->type              = e1000_nvm_eeprom_spi;
+	nvm->type = e1000_nvm_eeprom_spi;
 
-	size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
-	                  E1000_EECD_SIZE_EX_SHIFT);
+	if (nvm->word_size == (1 << 15))
+		nvm->page_size = 128;
 
-	/*
-	 * Added to a constant, "size" becomes the left-shift value
-	 * for setting word_size.
-	 */
-	size += NVM_WORD_SIZE_BASE_SHIFT;
+	/* Function Pointers */
+	nvm->ops.acquire    = e1000_acquire_nvm_82575;
+	nvm->ops.release    = e1000_release_nvm_82575;
+	if (nvm->word_size < (1 << 15))
+		nvm->ops.read    = e1000_read_nvm_eerd;
+	else
+		nvm->ops.read    = e1000_read_nvm_spi;
 
-	/* EEPROM access above 16k is unsupported */
-	if (size > 14)
-		size = 14;
-	nvm->word_size = 1 << size;
+	nvm->ops.write              = e1000_write_nvm_spi;
+	nvm->ops.validate           = e1000_validate_nvm_checksum_generic;
+	nvm->ops.update             = e1000_update_nvm_checksum_generic;
+	nvm->ops.valid_led_default  = e1000_valid_led_default_82575;
 
-	/* Function Pointers */
-	nvm->ops.acquire       = e1000_acquire_nvm_82575;
-	nvm->ops.read          = e1000_read_nvm_eerd;
-	nvm->ops.release       = e1000_release_nvm_82575;
-	nvm->ops.update        = e1000_update_nvm_checksum_generic;
-	nvm->ops.valid_led_default = e1000_valid_led_default_82575;
-	nvm->ops.validate      = e1000_validate_nvm_checksum_generic;
-	nvm->ops.write         = e1000_write_nvm_spi;
+	/* override genric family function pointers for specific descendants */
+	switch (hw->mac.type) {
+	case e1000_82580:
+		nvm->ops.validate = e1000_validate_nvm_checksum_82580;
+		nvm->ops.update = e1000_update_nvm_checksum_82580;
+		break;
+	case e1000_i350:
+		nvm->ops.validate = e1000_validate_nvm_checksum_i350;
+		nvm->ops.update = e1000_update_nvm_checksum_i350;
+		break;
+	default:
+		break;
+	}
 
 	return E1000_SUCCESS;
 }
@@ -318,6 +356,12 @@ static s32 e1000_init_mac_params_82575(s
 		mac->rar_entry_count = E1000_RAR_ENTRIES_82576;
 	if (mac->type == e1000_82580)
 		mac->rar_entry_count = E1000_RAR_ENTRIES_82580;
+	if (mac->type == e1000_i350) {
+		mac->rar_entry_count = E1000_RAR_ENTRIES_I350;
+		/* Enable EEE default settings for i350 */
+		dev_spec->eee_disable = FALSE;
+	}
+
 	/* Set if part includes ASF firmware */
 	mac->asf_firmware_present = TRUE;
 	/* FWSM register */
@@ -550,6 +594,7 @@ static s32 e1000_get_phy_id_82575(struct
 			phy->addr = mdic >> E1000_MDIC_PHY_SHIFT;
 			break;
 		case e1000_82580:
+		case e1000_i350:
 			mdic = E1000_READ_REG(hw, E1000_MDICNFG);
 			mdic &= E1000_MDICNFG_PHY_MASK;
 			phy->addr = mdic >> E1000_MDICNFG_PHY_SHIFT;
@@ -730,6 +775,103 @@ out:
 }
 
 /**
+ *  e1000_set_d0_lplu_state_82580 - Set Low Power Linkup D0 state
+ *  @hw: pointer to the HW structure
+ *  @active: TRUE to enable LPLU, FALSE to disable
+ *
+ *  Sets the LPLU D0 state according to the active flag.  When
+ *  activating LPLU this function also disables smart speed
+ *  and vice versa.  LPLU will not be activated unless the
+ *  device autonegotiation advertisement meets standards of
+ *  either 10 or 10/100 or 10/100/1000 at all duplexes.
+ *  This is a function pointer entry point only called by
+ *  PHY setup routines.
+ **/
+static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
+{
+	struct e1000_phy_info *phy = &hw->phy;
+	s32 ret_val = E1000_SUCCESS;
+	u16 data;
+
+	DEBUGFUNC("e1000_set_d0_lplu_state_82580");
+
+	data = E1000_READ_REG(hw, E1000_82580_PHY_POWER_MGMT);
+
+	if (active) {
+		data |= E1000_82580_PM_D0_LPLU;
+
+		/* When LPLU is enabled, we should disable SmartSpeed */
+		data &= ~E1000_82580_PM_SPD;
+	} else {
+		data &= ~E1000_82580_PM_D0_LPLU;
+
+		/*
+		 * LPLU and SmartSpeed are mutually exclusive.  LPLU is used
+		 * during Dx states where the power conservation is most
+		 * important.  During driver activity we should enable
+		 * SmartSpeed, so performance is maintained.
+		 */
+		if (phy->smart_speed == e1000_smart_speed_on) {
+			data |= E1000_82580_PM_SPD;
+		} else if (phy->smart_speed == e1000_smart_speed_off) {
+			data &= ~E1000_82580_PM_SPD;
+		}
+	}
+
+	E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, data);
+	return ret_val;
+}
+
+/**
+ *  e1000_set_d3_lplu_state_82580 - Sets low power link up state for D3
+ *  @hw: pointer to the HW structure
+ *  @active: boolean used to enable/disable lplu
+ *
+ *  Success returns 0, Failure returns 1
+ *
+ *  The low power link up (lplu) state is set to the power management level D3
+ *  and SmartSpeed is disabled when active is TRUE, else clear lplu for D3
+ *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
+ *  is used during Dx states where the power conservation is most important.
+ *  During driver activity, SmartSpeed should be enabled so performance is
+ *  maintained.
+ **/
+s32 e1000_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active)
+{
+	struct e1000_phy_info *phy = &hw->phy;
+	s32 ret_val = E1000_SUCCESS;
+	u16 data;
+
+	DEBUGFUNC("e1000_set_d3_lplu_state_82580");
+
+	data = E1000_READ_REG(hw, E1000_82580_PHY_POWER_MGMT);
+
+	if (!active) {
+		data &= ~E1000_82580_PM_D3_LPLU;
+		/*
+		 * LPLU and SmartSpeed are mutually exclusive.  LPLU is used
+		 * during Dx states where the power conservation is most
+		 * important.  During driver activity we should enable
+		 * SmartSpeed, so performance is maintained.
+		 */
+		if (phy->smart_speed == e1000_smart_speed_on) {
+			data |= E1000_82580_PM_SPD;
+		} else if (phy->smart_speed == e1000_smart_speed_off) {
+			data &= ~E1000_82580_PM_SPD;
+		}
+	} else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) ||
+	           (phy->autoneg_advertised == E1000_ALL_NOT_GIG) ||
+	           (phy->autoneg_advertised == E1000_ALL_10_SPEED)) {
+		data |= E1000_82580_PM_D3_LPLU;
+		/* When LPLU is enabled, we should disable SmartSpeed */
+		data &= ~E1000_82580_PM_SPD;
+	}
+
+	E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, data);
+	return ret_val;
+}
+
+/**
  *  e1000_acquire_nvm_82575 - Request for access to EEPROM
  *  @hw: pointer to the HW structure
  *
@@ -747,9 +889,7 @@ static s32 e1000_acquire_nvm_82575(struc
 	ret_val = e1000_acquire_swfw_sync_82575(hw, E1000_SWFW_EEP_SM);
 	if (ret_val)
 		goto out;
-
 	ret_val = e1000_acquire_nvm_generic(hw);
-
 	if (ret_val)
 		e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM);
 
@@ -768,7 +908,6 @@ static void e1000_release_nvm_82575(stru
 {
 	DEBUGFUNC("e1000_release_nvm_82575");
 
-	e1000_release_nvm_generic(hw);
 	e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM);
 }
 
@@ -1076,7 +1215,7 @@ void e1000_shutdown_serdes_link_82575(st
  **/
 static s32 e1000_reset_hw_82575(struct e1000_hw *hw)
 {
-	u32 ctrl, icr;
+	u32 ctrl;
 	s32 ret_val;
 
 	DEBUGFUNC("e1000_reset_hw_82575");
@@ -1126,7 +1265,7 @@ static s32 e1000_reset_hw_82575(struct e
 
 	/* Clear any pending interrupt events. */
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-	icr = E1000_READ_REG(hw, E1000_ICR);
+	E1000_READ_REG(hw, E1000_ICR);
 
 	/* Install any alternate MAC address into RAR0 */
 	ret_val = e1000_check_alt_mac_addr_generic(hw);
@@ -1222,7 +1361,12 @@ static s32 e1000_setup_copper_link_82575
 	}
 	switch (hw->phy.type) {
 	case e1000_phy_m88:
-		ret_val = e1000_copper_link_setup_m88(hw);
+		if (hw->phy.id == I347AT4_E_PHY_ID ||
+		    hw->phy.id == M88E1112_E_PHY_ID ||
+		    hw->phy.id == M88E1340M_E_PHY_ID)
+			ret_val = e1000_copper_link_setup_m88_gen2(hw);
+		else
+			ret_val = e1000_copper_link_setup_m88(hw);
 		break;
 	case e1000_phy_igp_3:
 		ret_val = e1000_copper_link_setup_igp(hw);
@@ -1570,7 +1714,7 @@ static void e1000_clear_hw_cntrs_82575(s
 }
 
 /**
- *  e1000_rx_fifo_flush_82575 - Clean rx fifo after RX enable
+ *  e1000_rx_fifo_flush_82575 - Clean rx fifo after Rx enable
  *  @hw: pointer to the HW structure
  *
  *  After rx enable if managability is enabled then there is likely some
@@ -1588,7 +1732,7 @@ void e1000_rx_fifo_flush_82575(struct e1
 	    !(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_RCV_TCO_EN))
 		return;
 
-	/* Disable all RX queues */
+	/* Disable all Rx queues */
 	for (i = 0; i < 4; i++) {
 		rxdctl[i] = E1000_READ_REG(hw, E1000_RXDCTL(i));
 		E1000_WRITE_REG(hw, E1000_RXDCTL(i),
@@ -1626,7 +1770,7 @@ void e1000_rx_fifo_flush_82575(struct e1
 	E1000_WRITE_FLUSH(hw);
 	msec_delay(2);
 
-	/* Enable RX queues that were previously enabled and restore our
+	/* Enable Rx queues that were previously enabled and restore our
 	 * previous state
 	 */
 	for (i = 0; i < 4; i++)
@@ -1694,7 +1838,6 @@ out:
 	return ret_val;
 }
 
-
 /**
  *  e1000_vmdq_set_anti_spoofing_pf - enable or disable anti-spoofing
  *  @hw: pointer to the hardware struct
@@ -1709,6 +1852,7 @@ void e1000_vmdq_set_anti_spoofing_pf(str
 
 	switch (hw->mac.type) {
 	case e1000_82576:
+	case e1000_i350:
 		dtxswc = E1000_READ_REG(hw, E1000_DTXSWC);
 		if (enable) {
 			dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK |
@@ -1747,6 +1891,14 @@ void e1000_vmdq_set_loopback_pf(struct e
 			dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN;
 		E1000_WRITE_REG(hw, E1000_DTXSWC, dtxswc);
 		break;
+	case e1000_i350:
+		dtxswc = E1000_READ_REG(hw, E1000_TXSWC);
+		if (enable)
+			dtxswc |= E1000_DTXSWC_VMDQ_LOOPBACK_EN;
+		else
+			dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN;
+		E1000_WRITE_REG(hw, E1000_TXSWC, dtxswc);
+		break;
 	default:
 		/* Currently no other hardware supports loopback */
 		break;
@@ -1831,7 +1983,7 @@ out:
  *  e1000_reset_mdicnfg_82580 - Reset MDICNFG destination and com_mdio bits
  *  @hw: pointer to the HW structure
  *
- *  This resets the MDICNFG.Destination and MDICNFG.Com_MDIO bits based on
+ *  This resets the the MDICNFG.Destination and MDICNFG.Com_MDIO bits based on
  *  the values found in the EEPROM.  This addresses an issue in which these
  *  bits are not restored from EEPROM after reset.
  **/
@@ -1839,7 +1991,7 @@ static s32 e1000_reset_mdicnfg_82580(str
 {
 	s32 ret_val = E1000_SUCCESS;
 	u32 mdicnfg;
-	u16 nvm_data;
+	u16 nvm_data = 0;
 
 	DEBUGFUNC("e1000_reset_mdicnfg_82580");
 
@@ -1878,7 +2030,7 @@ static s32 e1000_reset_hw_82580(struct e
 	s32 ret_val = E1000_SUCCESS;
 	/* BH SW mailbox bit in SW_FW_SYNC */
 	u16 swmbsw_mask = E1000_SW_SYNCH_MB;
-	u32 ctrl, icr;
+	u32 ctrl;
 	bool global_device_reset = hw->dev_spec._82575.global_device_reset;
 
 	DEBUGFUNC("e1000_reset_hw_82580");
@@ -1940,7 +2092,7 @@ static s32 e1000_reset_hw_82580(struct e
 
 	/* Clear any pending interrupt events. */
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-	icr = E1000_READ_REG(hw, E1000_ICR);
+	E1000_READ_REG(hw, E1000_ICR);
 
 	ret_val = e1000_reset_mdicnfg_82580(hw);
 	if (ret_val)
@@ -1957,7 +2109,7 @@ static s32 e1000_reset_hw_82580(struct e
 }
 
 /**
- *  e1000_rxpbs_adjust_82580 - adjust RXPBS value to reflect actual RX PBA size
+ *  e1000_rxpbs_adjust_82580 - adjust RXPBS value to reflect actual Rx PBA size
  *  @data: data received by reading RXPBS register
  *
  *  The 82580 uses a table based approach for packet buffer allocation sizes.
@@ -1975,3 +2127,263 @@ u16 e1000_rxpbs_adjust_82580(u32 data)
 
 	return ret_val;
 }
+
+/**
+ *  e1000_validate_nvm_checksum_with_offset - Validate EEPROM
+ *  checksum
+ *  @hw: pointer to the HW structure
+ *  @offset: offset in words of the checksum protected region
+ *
+ *  Calculates the EEPROM checksum by reading/adding each word of the EEPROM
+ *  and then verifies that the sum of the EEPROM is equal to 0xBABA.
+ **/
+s32 e1000_validate_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset)
+{
+	s32 ret_val = E1000_SUCCESS;
+	u16 checksum = 0;
+	u16 i, nvm_data;
+
+	DEBUGFUNC("e1000_validate_nvm_checksum_with_offset");
+
+	for (i = offset; i < ((NVM_CHECKSUM_REG + offset) + 1); i++) {
+		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
+		if (ret_val) {
+			DEBUGOUT("NVM Read Error\n");
+			goto out;
+		}
+		checksum += nvm_data;
+	}
+
+	if (checksum != (u16) NVM_SUM) {
+		DEBUGOUT("NVM Checksum Invalid\n");
+		ret_val = -E1000_ERR_NVM;
+		goto out;
+	}
+
+out:
+	return ret_val;
+}
+
+/**
+ *  e1000_update_nvm_checksum_with_offset - Update EEPROM
+ *  checksum
+ *  @hw: pointer to the HW structure
+ *  @offset: offset in words of the checksum protected region
+ *
+ *  Updates the EEPROM checksum by reading/adding each word of the EEPROM
+ *  up to the checksum.  Then calculates the EEPROM checksum and writes the
+ *  value to the EEPROM.
+ **/
+s32 e1000_update_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset)
+{
+	s32 ret_val;
+	u16 checksum = 0;
+	u16 i, nvm_data;
+
+	DEBUGFUNC("e1000_update_nvm_checksum_with_offset");
+
+	for (i = offset; i < (NVM_CHECKSUM_REG + offset); i++) {
+		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
+		if (ret_val) {
+			DEBUGOUT("NVM Read Error while updating checksum.\n");
+			goto out;
+		}
+		checksum += nvm_data;
+	}
+	checksum = (u16) NVM_SUM - checksum;
+	ret_val = hw->nvm.ops.write(hw, (NVM_CHECKSUM_REG + offset), 1,
+				&checksum);
+	if (ret_val)
+		DEBUGOUT("NVM Write Error while updating checksum.\n");
+
+out:
+	return ret_val;
+}
+
+/**
+ *  e1000_validate_nvm_checksum_82580 - Validate EEPROM checksum
+ *  @hw: pointer to the HW structure
+ *
+ *  Calculates the EEPROM section checksum by reading/adding each word of
+ *  the EEPROM and then verifies that the sum of the EEPROM is
+ *  equal to 0xBABA.
+ **/
+static s32 e1000_validate_nvm_checksum_82580(struct e1000_hw *hw)
+{
+	s32 ret_val = E1000_SUCCESS;
+	u16 eeprom_regions_count = 1;
+	u16 j, nvm_data;
+	u16 nvm_offset;
+
+	DEBUGFUNC("e1000_validate_nvm_checksum_82580");
+
+	ret_val = hw->nvm.ops.read(hw, NVM_COMPATIBILITY_REG_3, 1, &nvm_data);
+	if (ret_val) {
+		DEBUGOUT("NVM Read Error\n");
+		goto out;
+	}
+
+	if (nvm_data & NVM_COMPATIBILITY_BIT_MASK) {
+		/* if chekcsums compatibility bit is set validate checksums
+		 * for all 4 ports. */
+		eeprom_regions_count = 4;
+	}
+
+	for (j = 0; j < eeprom_regions_count; j++) {
+		nvm_offset = NVM_82580_LAN_FUNC_OFFSET(j);
+		ret_val = e1000_validate_nvm_checksum_with_offset(hw,
+								nvm_offset);
+		if (ret_val != E1000_SUCCESS)
+			goto out;
+	}
+
+out:
+	return ret_val;
+}
+
+/**
+ *  e1000_update_nvm_checksum_82580 - Update EEPROM checksum
+ *  @hw: pointer to the HW structure
+ *
+ *  Updates the EEPROM section checksums for all 4 ports by reading/adding
+ *  each word of the EEPROM up to the checksum.  Then calculates the EEPROM
+ *  checksum and writes the value to the EEPROM.
+ **/
+static s32 e1000_update_nvm_checksum_82580(struct e1000_hw *hw)
+{
+	s32 ret_val;
+	u16 j, nvm_data;
+	u16 nvm_offset;
+
+	DEBUGFUNC("e1000_update_nvm_checksum_82580");
+
+	ret_val = hw->nvm.ops.read(hw, NVM_COMPATIBILITY_REG_3, 1, &nvm_data);
+	if (ret_val) {
+		DEBUGOUT("NVM Read Error while updating checksum"
+			" compatibility bit.\n");
+		goto out;
+	}
+
+	if ((nvm_data & NVM_COMPATIBILITY_BIT_MASK) == 0) {
+		/* set compatibility bit to validate checksums appropriately */
+		nvm_data = nvm_data | NVM_COMPATIBILITY_BIT_MASK;
+		ret_val = hw->nvm.ops.write(hw, NVM_COMPATIBILITY_REG_3, 1,

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

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 00:24:17 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A05E7106564A;
	Fri, 29 Apr 2011 00:24:17 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 90D208FC13;
	Fri, 29 Apr 2011 00:24:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3T0OHLG075771;
	Fri, 29 Apr 2011 00:24:17 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3T0OHhP075767;
	Fri, 29 Apr 2011 00:24:17 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <201104290024.p3T0OHhP075767@svn.freebsd.org>
From: Jack F Vogel 
Date: Fri, 29 Apr 2011 00:24:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221192 - stable/8/sys/dev/ixgbe
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 00:24:17 -0000

Author: jfv
Date: Fri Apr 29 00:24:17 2011
New Revision: 221192
URL: http://svn.freebsd.org/changeset/base/221192

Log:
  MFC of the ixgbe driver: revisions 217131, 217132, and 221041.
  This brings this driver up to the level in HEAD as well.

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

Modified: stable/8/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- stable/8/sys/dev/ixgbe/ixgbe.c	Fri Apr 29 00:00:54 2011	(r221191)
+++ stable/8/sys/dev/ixgbe/ixgbe.c	Fri Apr 29 00:24:17 2011	(r221192)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2010, Intel Corporation 
+  Copyright (c) 2001-2011, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -33,7 +33,7 @@
 /*$FreeBSD$*/
 
 #ifdef HAVE_KERNEL_OPTION_HEADERS
-#include "opt_device_polling.h"
+#include "opt_inet.h"
 #endif
 
 #include "ixgbe.h"
@@ -46,7 +46,7 @@ int             ixgbe_display_debug_stat
 /*********************************************************************
  *  Driver version
  *********************************************************************/
-char ixgbe_driver_version[] = "2.3.8";
+char ixgbe_driver_version[] = "2.3.10";
 
 /*********************************************************************
  *  PCI Device ID Table
@@ -270,8 +270,8 @@ TUNABLE_INT("hw.ixgbe.hdr_split", &ixgbe
 /*
  * Number of Queues, can be set to 0,
  * it then autoconfigures based on the
- * number of cpus. Each queue is a pair
- * of RX and TX rings with a msix vector
+ * number of cpus with a max of 8. This
+ * can be overriden manually here.
  */
 static int ixgbe_num_queues = 0;
 TUNABLE_INT("hw.ixgbe.num_queues", &ixgbe_num_queues);
@@ -787,10 +787,6 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 		return (err);
 	}
 
-	/* Call cleanup if number of TX descriptors low */
-	if (txr->tx_avail <= IXGBE_TX_CLEANUP_THRESHOLD)
-		ixgbe_txeof(txr);
-
 	enqueued = 0;
 	if (m == NULL) {
 		next = drbr_dequeue(ifp, txr->br);
@@ -814,7 +810,9 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 		ETHER_BPF_MTAP(ifp, next);
 		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 			break;
-		if (txr->tx_avail <= IXGBE_TX_OP_THRESHOLD) {
+		if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD)
+			ixgbe_txeof(txr);
+		if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD) {
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 			break;
 		}
@@ -864,10 +862,35 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c
 {
 	struct adapter	*adapter = ifp->if_softc;
 	struct ifreq	*ifr = (struct ifreq *) data;
+#ifdef INET
+	struct ifaddr *ifa = (struct ifaddr *)data;
+#endif
 	int             error = 0;
 
 	switch (command) {
 
+        case SIOCSIFADDR:
+#ifdef INET
+		if (ifa->ifa_addr->sa_family == AF_INET) {
+			/*
+			 * Since resetting hardware takes a very long time
+			 * and results in link renegotiation we only
+			 * initialize the hardware only when it is absolutely
+			 * required.
+			 */
+			ifp->if_flags |= IFF_UP;
+			if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+				IXGBE_CORE_LOCK(adapter);
+				ixgbe_init_locked(adapter);
+				IXGBE_CORE_UNLOCK(adapter);
+			}
+			if (!(ifp->if_flags & IFF_NOARP))
+				arp_ifinit(ifp, ifa);
+		} else
+#endif
+			error = ether_ioctl(ifp, command, data);
+		break;
+
 	case SIOCSIFMTU:
 		IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)");
 		if (ifr->ifr_mtu > IXGBE_MAX_FRAME_SIZE - ETHER_HDR_LEN) {
@@ -989,7 +1012,7 @@ ixgbe_init_locked(struct adapter *adapte
 	if (ifp->if_capenable & IFCAP_TXCSUM) {
 		ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP);
 #if __FreeBSD_version >= 800000
-		if (hw->mac.type == ixgbe_mac_82599EB)
+		if (hw->mac.type != ixgbe_mac_82598EB)
 			ifp->if_hwassist |= CSUM_SCTP;
 #endif
 	}
@@ -1032,14 +1055,12 @@ ixgbe_init_locked(struct adapter *adapte
 
 	gpie = IXGBE_READ_REG(&adapter->hw, IXGBE_GPIE);
 
-	if (hw->mac.type == ixgbe_mac_82599EB) {
-		gpie |= IXGBE_SDP1_GPIEN;
-		gpie |= IXGBE_SDP2_GPIEN;
-	}
-
 	/* Enable Fan Failure Interrupt */
-	if (hw->device_id == IXGBE_DEV_ID_82598AT)
-		gpie |= IXGBE_SDP1_GPIEN;
+	gpie |= IXGBE_SDP1_GPIEN;
+
+	/* Add for Thermal detection */
+	if (hw->mac.type == ixgbe_mac_82599EB)
+		gpie |= IXGBE_SDP2_GPIEN;
 
 	if (adapter->msix > 1) {
 		/* Enable Enhanced MSIX mode */
@@ -1121,7 +1142,7 @@ ixgbe_init_locked(struct adapter *adapte
 
 #ifdef IXGBE_FDIR
 	/* Init Flow director */
-	if (hw->mac.type == ixgbe_mac_82599EB)
+	if (hw->mac.type != ixgbe_mac_82598EB)
 		ixgbe_init_fdir_signature_82599(&adapter->hw, fdir_pballoc);
 #endif
 
@@ -1338,8 +1359,6 @@ ixgbe_msix_que(void *arg)
 	more_tx = ixgbe_txeof(txr);
 	IXGBE_TX_UNLOCK(txr);
 
-	more_rx = ixgbe_rxeof(que, adapter->rx_process_limit);
-
 	/* Do AIM now? */
 
 	if (ixgbe_enable_aim == FALSE)
@@ -1417,7 +1436,7 @@ ixgbe_msix_link(void *arg)
 	if (reg_eicr & IXGBE_EICR_LSC)
 		taskqueue_enqueue(adapter->tq, &adapter->link_task);
 
-	if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
+	if (adapter->hw.mac.type != ixgbe_mac_82598EB) {
 #ifdef IXGBE_FDIR
 		if (reg_eicr & IXGBE_EICR_FLOW_DIR) {
 			/* This is probably overkill :) */
@@ -2792,7 +2811,7 @@ ixgbe_setup_transmit_ring(struct tx_ring
 
 #ifdef IXGBE_FDIR
 	/* Set the rate at which we sample packets */
-	if (adapter->hw.mac.type == ixgbe_mac_82599EB)
+	if (adapter->hw.mac.type != ixgbe_mac_82598EB)
 		txr->atr_sample = atr_sample_rate;
 #endif
 
@@ -2874,7 +2893,7 @@ ixgbe_initialize_transmit_units(struct a
 
 	}
 
-	if (hw->mac.type == ixgbe_mac_82599EB) {
+	if (hw->mac.type != ixgbe_mac_82598EB) {
 		u32 dmatxctl, rttdcs;
 		dmatxctl = IXGBE_READ_REG(hw, IXGBE_DMATXCTL);
 		dmatxctl |= IXGBE_DMATXCTL_TE;
@@ -3386,11 +3405,15 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 	bus_dma_segment_t	pseg[1];
 	struct ixgbe_rx_buf	*rxbuf;
 	struct mbuf		*mh, *mp;
-	int			i, nsegs, error, cleaned;
+	int			i, j, nsegs, error;
+	bool			refreshed = FALSE;
 
-	i = rxr->next_to_refresh;
-	cleaned = -1; /* Signify no completions */
-	while (i != limit) {
+	i = j = rxr->next_to_refresh;
+	/* Control the loop with one beyond */
+	if (++j == adapter->num_rx_desc)
+		j = 0;
+
+	while (j != limit) {
 		rxbuf = &rxr->rx_buffers[i];
 		if (rxr->hdr_split == FALSE)
 			goto no_split;
@@ -3418,7 +3441,8 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 		rxbuf->m_head = mh;
 		bus_dmamap_sync(rxr->htag, rxbuf->hmap,
 		    BUS_DMASYNC_PREREAD);
-		rxr->rx_base[i].read.hdr_addr = htole64(hseg[0].ds_addr);
+		rxr->rx_base[i].read.hdr_addr =
+		    htole64(hseg[0].ds_addr);
 
 no_split:
 		if (rxbuf->m_pack == NULL) {
@@ -3446,17 +3470,17 @@ no_split:
 		rxr->rx_base[i].read.pkt_addr =
 		    htole64(pseg[0].ds_addr);
 
-		cleaned = i;
-		/* Calculate next index */
-		if (++i == adapter->num_rx_desc)
-			i = 0;
-		/* This is the work marker for refresh */
+		refreshed = TRUE;
+		/* Next is precalculated */
+		i = j;
 		rxr->next_to_refresh = i;
+		if (++j == adapter->num_rx_desc)
+			j = 0;
 	}
 update:
-	if (cleaned != -1) /* If we refreshed some, bump tail */
+	if (refreshed) /* Update hardware tail index */
 		IXGBE_WRITE_REG(&adapter->hw,
-		    IXGBE_RDT(rxr->me), cleaned);
+		    IXGBE_RDT(rxr->me), rxr->next_to_refresh);
 	return;
 }
 
@@ -3727,6 +3751,7 @@ skip_head:
 	rxr->lro_enabled = FALSE;
 	rxr->rx_split_packets = 0;
 	rxr->rx_bytes = 0;
+	rxr->discard = FALSE;
 
 	bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
 	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -3736,7 +3761,7 @@ skip_head:
 	** 82598 uses software LRO, the
 	** 82599 uses a hardware assist.
 	*/
-	if ((adapter->hw.mac.type == ixgbe_mac_82599EB) &&
+	if ((adapter->hw.mac.type != ixgbe_mac_82598EB) &&
 	    (ifp->if_capenable & IFCAP_RXCSUM) &&
 	    (ifp->if_capenable & IFCAP_LRO))
 		ixgbe_setup_hw_rsc(rxr);
@@ -3862,8 +3887,7 @@ ixgbe_initialize_receive_units(struct ad
 		IXGBE_WRITE_REG(hw, IXGBE_RDT(i), 0);
 	}
 
-	if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
-		/* PSRTYPE must be initialized in 82599 */
+	if (adapter->hw.mac.type != ixgbe_mac_82598EB) {
 		u32 psrtype = IXGBE_PSRTYPE_TCPHDR |
 			      IXGBE_PSRTYPE_UDPHDR |
 			      IXGBE_PSRTYPE_IPV4HDR |
@@ -4307,10 +4331,8 @@ next_desc:
 	}
 
 	/* Refresh any remaining buf structs */
-	if (processed != 0) {
+	if (ixgbe_rx_unrefreshed(rxr))
 		ixgbe_refresh_mbufs(rxr, i);
-		processed = 0;
-	}
 
 	rxr->next_to_check = i;
 
@@ -4472,7 +4494,7 @@ ixgbe_setup_vlan_hw_support(struct adapt
 	IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl);
 
 	/* On 82599 the VLAN enable is per/queue in RXDCTL */
-	if (hw->mac.type == ixgbe_mac_82599EB)
+	if (hw->mac.type != ixgbe_mac_82598EB)
 		for (int i = 0; i < adapter->num_queues; i++) {
 			ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i));
 				ctrl |= IXGBE_RXDCTL_VME;
@@ -4491,9 +4513,7 @@ ixgbe_enable_intr(struct adapter *adapte
 	/* Enable Fan Failure detection */
 	if (hw->device_id == IXGBE_DEV_ID_82598AT)
 		    mask |= IXGBE_EIMS_GPI_SDP1;
-
-	/* 82599 specific interrupts */
-	if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
+	else {
 		    mask |= IXGBE_EIMS_ECC;
 		    mask |= IXGBE_EIMS_GPI_SDP1;
 		    mask |= IXGBE_EIMS_GPI_SDP2;
@@ -4810,7 +4830,7 @@ ixgbe_update_stats_counters(struct adapt
 	adapter->stats.gprc += IXGBE_READ_REG(hw, IXGBE_GPRC);
 	adapter->stats.gprc -= missed_rx;
 
-	if (hw->mac.type == ixgbe_mac_82599EB) {
+	if (hw->mac.type != ixgbe_mac_82598EB) {
 		adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCL) +
 		    ((u64)IXGBE_READ_REG(hw, IXGBE_GORCH) << 32);
 		adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL) +
@@ -4878,7 +4898,7 @@ ixgbe_update_stats_counters(struct adapt
 	adapter->stats.fccrc += IXGBE_READ_REG(hw, IXGBE_FCCRC);
 	adapter->stats.fclast += IXGBE_READ_REG(hw, IXGBE_FCLAST);
 	/* Only read FCOE on 82599 */
-	if (hw->mac.type == ixgbe_mac_82599EB) {
+	if (hw->mac.type != ixgbe_mac_82598EB) {
 		adapter->stats.fcoerpdc += IXGBE_READ_REG(hw, IXGBE_FCOERPDC);
 		adapter->stats.fcoeprc += IXGBE_READ_REG(hw, IXGBE_FCOEPRC);
 		adapter->stats.fcoeptc += IXGBE_READ_REG(hw, IXGBE_FCOEPTC);

Modified: stable/8/sys/dev/ixgbe/ixgbe.h
==============================================================================
--- stable/8/sys/dev/ixgbe/ixgbe.h	Fri Apr 29 00:00:54 2011	(r221191)
+++ stable/8/sys/dev/ixgbe/ixgbe.h	Fri Apr 29 00:24:17 2011	(r221192)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2010, Intel Corporation 
+  Copyright (c) 2001-2011, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -490,7 +490,7 @@ ixgbe_is_sfp(struct ixgbe_hw *hw)
 }
 
 /* Workaround to make 8.0 buildable */
-#if __FreeBSD_version < 800504
+#if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504
 static __inline int
 drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)
 {
@@ -502,4 +502,19 @@ drbr_needs_enqueue(struct ifnet *ifp, st
 }
 #endif
 
+/*
+** Find the number of unrefreshed RX descriptors
+*/
+static inline u16
+ixgbe_rx_unrefreshed(struct rx_ring *rxr)
+{       
+	struct adapter  *adapter = rxr->adapter;
+        
+	if (rxr->next_to_check > rxr->next_to_refresh)
+		return (rxr->next_to_check - rxr->next_to_refresh - 1);
+	else
+		return ((adapter->num_rx_desc + rxr->next_to_check) -
+		    rxr->next_to_refresh - 1);
+}       
+
 #endif /* _IXGBE_H_ */

Modified: stable/8/sys/dev/ixgbe/ixv.h
==============================================================================
--- stable/8/sys/dev/ixgbe/ixv.h	Fri Apr 29 00:00:54 2011	(r221191)
+++ stable/8/sys/dev/ixgbe/ixv.h	Fri Apr 29 00:24:17 2011	(r221192)
@@ -175,7 +175,11 @@
 #define VFTA_SIZE			128
 
 /* Offload bits in mbuf flag */
+#if __FreeBSD_version >= 800000
 #define CSUM_OFFLOAD		(CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP)
+#else
+#define CSUM_OFFLOAD		(CSUM_IP|CSUM_TCP|CSUM_UDP)
+#endif
 
 /*
  *****************************************************************************
@@ -400,7 +404,7 @@ struct adapter {
 #define IXV_TX_LOCK_ASSERT(_sc)         mtx_assert(&(_sc)->tx_mtx, MA_OWNED)
 
 /* Workaround to make 8.0 buildable */
-#if __FreeBSD_version < 800504
+#if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504
 static __inline int
 drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)
 {

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 00:40:00 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8888B1065672;
	Fri, 29 Apr 2011 00:40:00 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7685C8FC08;
	Fri, 29 Apr 2011 00:40:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3T0e0EA076261;
	Fri, 29 Apr 2011 00:40:00 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3T0e0Q4076257;
	Fri, 29 Apr 2011 00:40:00 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201104290040.p3T0e0Q4076257@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 Apr 2011 00:40:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221193 - stable/8/lib/libutil
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 00:40:00 -0000

Author: delphij
Date: Fri Apr 29 00:40:00 2011
New Revision: 221193
URL: http://svn.freebsd.org/changeset/base/221193

Log:
  MFC r220582:
  
  Add support for IEE/IEC (and now also SI) power of two notions of
  prefixes (Ki, Mi, Gi...) for humanize_number(3).
  
  Note that applications has to pass HN_IEC_PREFIXES to use this
  feature for backward compatibility reasons.
  
  Reviewed by:	arundel

Modified:
  stable/8/lib/libutil/humanize_number.3
  stable/8/lib/libutil/humanize_number.c
  stable/8/lib/libutil/libutil.h
Directory Properties:
  stable/8/lib/libutil/   (props changed)

Modified: stable/8/lib/libutil/humanize_number.3
==============================================================================
--- stable/8/lib/libutil/humanize_number.3	Fri Apr 29 00:24:17 2011	(r221192)
+++ stable/8/lib/libutil/humanize_number.3	Fri Apr 29 00:40:00 2011	(r221193)
@@ -35,7 +35,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 25, 2004
+.Dd Apr 12, 2011
 .Dt HUMANIZE_NUMBER 3
 .Os
 .Sh NAME
@@ -75,17 +75,24 @@ then divide
 by 1024 until it will.
 In this case, prefix
 .Fa suffix
-with the appropriate SI designator.
+with the appropriate designator.
 The
 .Fn humanize_number
-function
-follows the traditional computer science conventions rather than the proposed
-SI power of two convention.
+function follows the traditional computer science conventions by
+default, rather than the IEE/IEC (and now also SI) power of two
+convention or the power of ten notion.
+This behaviour however can be altered by specifying the
+.Dv HN_DIVISOR_1000
+and
+.Dv HN_IEC_PREFIXES
+flags.
 .Pp
-The prefixes are:
+The traditional
+.Pq default
+prefixes are:
 .Bl -column "Prefix" "Description" "1000000000000000000" -offset indent
 .It Sy "Prefix" Ta Sy "Description" Ta Sy "Multiplier" Ta Sy "Multiplier 1000x"
-.It Li k Ta No kilo Ta 1024 Ta 1000
+.It Li (note) Ta No kilo Ta 1024 Ta 1000
 .It Li M Ta No mega Ta 1048576 Ta 1000000
 .It Li G Ta No giga Ta 1073741824 Ta 1000000000
 .It Li T Ta No tera Ta 1099511627776 Ta 1000000000000
@@ -93,6 +100,20 @@ The prefixes are:
 .It Li E Ta No exa Ta 1152921504606846976 Ta 1000000000000000000
 .El
 .Pp
+Note:
+An uppercase K indicates a power of two, a lowercase k a power of ten.
+.Pp
+The IEE/IEC (and now also SI) power of two prefixes are:
+.Bl -column "Prefix" "Description" "1000000000000000000" -offset indent
+.It Sy "Prefix" Ta Sy "Description" Ta Sy "Multiplier"
+.It Li Ki Ta No kibi Ta 1024
+.It Li Mi Ta No mebi Ta 1048576
+.It Li Gi Ta No gibi Ta 1073741824
+.It Li Ti Ta No tebi Ta 1099511627776
+.It Li Pi Ta No pebi Ta 1125899906842624
+.It Li Ei Ta No exbi Ta 1152921504606846976
+.El
+.Pp
 The
 .Fa len
 argument must be at least 4 plus the length of
@@ -101,7 +122,12 @@ in order to ensure a useful result is ge
 .Fa buf .
 To use a specific prefix, specify this as
 .Fa scale
-(multiplier = 1024 ^ scale).
+.Po multiplier = 1024 ^ scale;
+when
+.Dv HN_DIVISOR_1000
+is specified,
+multiplier = 1000 ^ scale
+.Pc .
 This cannot be combined with any of the
 .Fa scale
 flags below.
@@ -134,6 +160,11 @@ Use
 Divide
 .Fa number
 with 1000 instead of 1024.
+.It Dv HN_IEC_PREFIXES
+Use the IEE/IEC notion of prefixes (Ki, Mi, Gi...).
+This flag has no effect when
+.Dv HN_DIVISOR_1000
+is also specified.
 .El
 .Sh RETURN VALUES
 The
@@ -148,6 +179,18 @@ If
 is specified, the prefix index number will be returned instead.
 .Sh SEE ALSO
 .Xr expand_number 3
+.Sh STANDARDS
+The
+.Dv HN_DIVISOR_1000
+and
+.Dv HN_IEC_PREFIXES
+flags
+conform to
+.Tn ISO/IEC
+Std\~80000-13:2008
+and
+.Tn IEEE
+Std\~1541-2002.
 .Sh HISTORY
 The
 .Fn humanize_number
@@ -155,3 +198,7 @@ function first appeared in
 .Nx 2.0
 and then in
 .Fx 5.3 .
+The
+.Dv HN_IEC_PREFIXES
+flag was introduced in
+.Fx 9.0 .

Modified: stable/8/lib/libutil/humanize_number.c
==============================================================================
--- stable/8/lib/libutil/humanize_number.c	Fri Apr 29 00:24:17 2011	(r221192)
+++ stable/8/lib/libutil/humanize_number.c	Fri Apr 29 00:40:00 2011	(r221193)
@@ -42,45 +42,58 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+static const int maxscale = 7;
+
 int
 humanize_number(char *buf, size_t len, int64_t quotient,
     const char *suffix, int scale, int flags)
 {
 	const char *prefixes, *sep;
-	int	i, r, remainder, maxscale, s1, s2, sign;
+	int	i, r, remainder, s1, s2, sign;
 	int64_t	divisor, max;
 	size_t	baselen;
 
 	assert(buf != NULL);
 	assert(suffix != NULL);
 	assert(scale >= 0);
+	assert(scale < maxscale || (((scale & (HN_AUTOSCALE | HN_GETSCALE)) != 0)));
+	assert(!((flags & HN_DIVISOR_1000) && (flags & HN_IEC_PREFIXES)));
 
 	remainder = 0;
 
-	if (flags & HN_DIVISOR_1000) {
-		/* SI for decimal multiplies */
-		divisor = 1000;
-		if (flags & HN_B)
-			prefixes = "B\0k\0M\0G\0T\0P\0E";
-		else
-			prefixes = "\0\0k\0M\0G\0T\0P\0E";
-	} else {
+	if (flags & HN_IEC_PREFIXES) {
+		baselen = 2;
 		/*
-		 * binary multiplies
-		 * XXX IEC 60027-2 recommends Ki, Mi, Gi...
+		 * Use the prefixes for power of two recommended by
+		 * the International Electrotechnical Commission
+		 * (IEC) in IEC 80000-3 (i.e. Ki, Mi, Gi...).
+		 *
+		 * HN_IEC_PREFIXES implies a divisor of 1024 here
+		 * (use of HN_DIVISOR_1000 would have triggered
+		 * an assertion earlier).
 		 */
 		divisor = 1024;
 		if (flags & HN_B)
-			prefixes = "B\0K\0M\0G\0T\0P\0E";
+			prefixes = "B\0\0Ki\0Mi\0Gi\0Ti\0Pi\0Ei";
+		else
+			prefixes = "\0\0Ki\0Mi\0Gi\0Ti\0Pi\0Ei";
+	} else {
+		baselen = 1;
+		if (flags & HN_DIVISOR_1000)
+			divisor = 1000;
+		else
+			divisor = 1024;
+
+		if (flags & HN_B)
+			prefixes = "B\0\0k\0\0M\0\0G\0\0T\0\0P\0\0E";
 		else
-			prefixes = "\0\0K\0M\0G\0T\0P\0E";
+			prefixes = "\0\0\0k\0\0M\0\0G\0\0T\0\0P\0\0E";
 	}
 
-#define	SCALE2PREFIX(scale)	(&prefixes[(scale) << 1])
-	maxscale = 7;
+#define	SCALE2PREFIX(scale)	(&prefixes[(scale) * 3])
 
-	if (scale >= maxscale &&
-	    (scale & (HN_AUTOSCALE | HN_GETSCALE)) == 0)
+	if (scale < 0 || (scale >= maxscale &&
+	    (scale & (HN_AUTOSCALE | HN_GETSCALE)) == 0))
 		return (-1);
 
 	if (buf == NULL || suffix == NULL)
@@ -91,10 +104,10 @@ humanize_number(char *buf, size_t len, i
 	if (quotient < 0) {
 		sign = -1;
 		quotient = -quotient;
-		baselen = 3;		/* sign, digit, prefix */
+		baselen += 2;		/* sign, digit */
 	} else {
 		sign = 1;
-		baselen = 2;		/* digit, prefix */
+		baselen += 1;		/* digit */
 	}
 	if (flags & HN_NOSPACE)
 		sep = "";

Modified: stable/8/lib/libutil/libutil.h
==============================================================================
--- stable/8/lib/libutil/libutil.h	Fri Apr 29 00:24:17 2011	(r221192)
+++ stable/8/lib/libutil/libutil.h	Fri Apr 29 00:40:00 2011	(r221193)
@@ -207,7 +207,9 @@ __END_DECLS
 #define HN_NOSPACE		0x02
 #define HN_B			0x04
 #define HN_DIVISOR_1000		0x08
+#define HN_IEC_PREFIXES		0x10
 
+/* maxscale = 0x07 */
 #define HN_GETSCALE		0x10
 #define HN_AUTOSCALE		0x20
 

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 10:28:56 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 55854106566B;
	Fri, 29 Apr 2011 10:28:56 +0000 (UTC)
	(envelope-from gavin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 448D78FC12;
	Fri, 29 Apr 2011 10:28:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3TASusS095367;
	Fri, 29 Apr 2011 10:28:56 GMT (envelope-from gavin@svn.freebsd.org)
Received: (from gavin@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3TASucO095365;
	Fri, 29 Apr 2011 10:28:56 GMT (envelope-from gavin@svn.freebsd.org)
Message-Id: <201104291028.p3TASucO095365@svn.freebsd.org>
From: Gavin Atkinson 
Date: Fri, 29 Apr 2011 10:28:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221203 - stable/8/sys/geom/part
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 10:28:56 -0000

Author: gavin
Date: Fri Apr 29 10:28:55 2011
New Revision: 221203
URL: http://svn.freebsd.org/changeset/base/221203

Log:
  Merge r220652 from head:
  
    Remove an incorrect be16toh() that prevented geom_part_apm from working on                                                                                                       little-endian machines.

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

Modified: stable/8/sys/geom/part/g_part_apm.c
==============================================================================
--- stable/8/sys/geom/part/g_part_apm.c	Fri Apr 29 07:26:22 2011	(r221202)
+++ stable/8/sys/geom/part/g_part_apm.c	Fri Apr 29 10:28:55 2011	(r221203)
@@ -387,7 +387,7 @@ g_part_apm_probe(struct g_part_table *ba
 	buf = g_read_data(cp, 0L, pp->sectorsize, &error);
 	if (buf == NULL)
 		return (error);
-	if (be16dec(buf) == be16toh(APM_DDR_SIG)) {
+	if (be16dec(buf) == APM_DDR_SIG) {
 		/* Normal Apple DDR */
 		table->ddr.ddr_sig = be16dec(buf);
 		table->ddr.ddr_blksize = be16dec(buf + 2);

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 17:04:52 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 856A4106564A;
	Fri, 29 Apr 2011 17:04:52 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 74EE78FC14;
	Fri, 29 Apr 2011 17:04:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3TH4qRU007495;
	Fri, 29 Apr 2011 17:04:52 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3TH4qY3007493;
	Fri, 29 Apr 2011 17:04:52 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <201104291704.p3TH4qY3007493@svn.freebsd.org>
From: Attilio Rao 
Date: Fri, 29 Apr 2011 17:04:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221211 - stable/8/sys/ddb
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 17:04:52 -0000

Author: attilio
Date: Fri Apr 29 17:04:52 2011
New Revision: 221211
URL: http://svn.freebsd.org/changeset/base/221211

Log:
  MFC r220362:
  Extend the DDB command watchdog with the ability to specify a timeout
  value.

Modified:
  stable/8/sys/ddb/db_command.c

Modified: stable/8/sys/ddb/db_command.c
==============================================================================
--- stable/8/sys/ddb/db_command.c	Fri Apr 29 16:43:30 2011	(r221210)
+++ stable/8/sys/ddb/db_command.c	Fri Apr 29 17:04:52 2011	(r221211)
@@ -129,7 +129,7 @@ static struct command db_cmds[] = {
 	{ "reboot",	db_reset,		0,	0 },
 	{ "reset",	db_reset,		0,	0 },
 	{ "kill",	db_kill,		CS_OWN,	0 },
-	{ "watchdog",	db_watchdog,		0,	0 },
+	{ "watchdog",	db_watchdog,		CS_OWN,	0 },
 	{ "thread",	db_set_thread,		CS_OWN,	0 },
 	{ "run",	db_run_cmd,		CS_OWN,	0 },
 	{ "script",	db_script_cmd,		CS_OWN,	0 },
@@ -708,15 +708,32 @@ db_watchdog(dummy1, dummy2, dummy3, dumm
 	db_expr_t	dummy3;
 	char *		dummy4;
 {
-	int i;
+	db_expr_t old_radix, tout;
+	int err, i;
 
-	/*
-	 * XXX: It might make sense to be able to set the watchdog to a
-	 * XXX: timeout here so that failure or hang as a result of subsequent
-	 * XXX: ddb commands could be recovered by a reset.
-	 */
+	old_radix = db_radix;
+	db_radix = 10;
+	err = db_expression(&tout);
+	db_skip_to_eol();
+	db_radix = old_radix;
 
-	EVENTHANDLER_INVOKE(watchdog_list, 0, &i);
+	/* If no argument is provided the watchdog will just be disabled. */
+	if (err == 0) {
+		db_printf("No argument provided, disabling watchdog\n");
+		tout = 0;
+	} else if ((tout & WD_INTERVAL) == WD_TO_NEVER) {
+		db_error("Out of range watchdog interval\n");
+		return;
+	} else {
+
+		/*
+		 * XXX: Right now we only support WD_ACTIVE, in the future we
+		 * may be possibly needing a more convoluted function for
+		 * dealing with different cases.
+		 */
+		tout |= WD_ACTIVE;
+	}
+	EVENTHANDLER_INVOKE(watchdog_list, tout, &i);
 }
 
 static void

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 17:57:36 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 37B0E106566C;
	Fri, 29 Apr 2011 17:57:36 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 25E488FC0A;
	Fri, 29 Apr 2011 17:57:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3THvadX009135;
	Fri, 29 Apr 2011 17:57:36 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3THva0n009126;
	Fri, 29 Apr 2011 17:57:36 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201104291757.p3THva0n009126@svn.freebsd.org>
From: Rick Macklem 
Date: Fri, 29 Apr 2011 17:57:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221212 - in stable/8/sys/fs: nfs nfsclient
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 17:57:36 -0000

Author: rmacklem
Date: Fri Apr 29 17:57:35 2011
New Revision: 221212
URL: http://svn.freebsd.org/changeset/base/221212

Log:
  MFC: r200069
  Remove unneeded ifdefs.
  MFC'd with trasz@'s permission.

Modified:
  stable/8/sys/fs/nfs/nfs_commonacl.c
  stable/8/sys/fs/nfs/nfs_commonport.c
  stable/8/sys/fs/nfs/nfs_commonsubs.c
  stable/8/sys/fs/nfs/nfs_var.h
  stable/8/sys/fs/nfs/nfsport.h
  stable/8/sys/fs/nfsclient/nfs_clrpcops.c
  stable/8/sys/fs/nfsclient/nfs_clvnops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs_commonacl.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonacl.c	Fri Apr 29 17:04:52 2011	(r221211)
+++ stable/8/sys/fs/nfs/nfs_commonacl.c	Fri Apr 29 17:57:35 2011	(r221212)
@@ -37,7 +37,6 @@ extern int nfsrv_useacl;
 static int nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner,
     enum vtype type, acl_perm_t *permp);
 
-#if defined(NFS4_ACL_EXTATTR_NAME)
 /*
  * Handle xdr for an ace.
  */
@@ -263,189 +262,7 @@ nfsrv_acemasktoperm(u_int32_t acetype, u
 	*permp = perm;
 	return (0);
 }
-#else
-/*
- * Handle xdr for an ace.
- */
-APPLESTATIC int
-nfsrv_dissectace(struct nfsrv_descript *nd, struct acl_entry *acep,
-    int *aceerrp, int *acesizep, NFSPROC_T *p)
-{
-	u_int32_t *tl;
-	int len, gotid = 0, owner = 0, error = 0, aceerr = 0;
-	u_char *name, namestr[NFSV4_SMALLSTR + 1];
-	u_int32_t flag, mask, acetype;
-	gid_t gid;
-	uid_t uid;
-
-	*aceerrp = 0;
-	NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
-	acetype = fxdr_unsigned(u_int32_t, *tl++);
-	flag = fxdr_unsigned(u_int32_t, *tl++);
-	mask = fxdr_unsigned(u_int32_t, *tl++);
-	len = fxdr_unsigned(int, *tl);
-	if (len < 0) {
-		return (NFSERR_BADXDR);
-	} else if (len == 0) {
-		/* Netapp filers return a 0 length who for nil users */
-		acep->ae_tag = ACL_UNDEFINED_TAG;
-		acep->ae_id = ACL_UNDEFINED_ID;
-		acep->ae_perm = (acl_perm_t)0;
-		if (acesizep)
-			*acesizep = 4 * NFSX_UNSIGNED;
-		return (0);
-	}
-	if (len > NFSV4_SMALLSTR)
-		name = malloc(len + 1, M_NFSSTRING, M_WAITOK);
-	else
-		name = namestr;
-	error = nfsrv_mtostr(nd, name, len);
-	if (error) {
-		if (len > NFSV4_SMALLSTR)
-			free(name, M_NFSSTRING);
-		return (error);
-	}
-	if (len == 6) {
-		if (!NFSBCMP(name, "OWNER@", 6)) {
-			acep->ae_tag = ACL_USER_OBJ;
-			acep->ae_id = ACL_UNDEFINED_ID;
-			owner = 1;
-			gotid = 1;
-		} else if (!NFSBCMP(name, "GROUP@", 6)) {
-			acep->ae_tag = ACL_GROUP_OBJ;
-			acep->ae_id = ACL_UNDEFINED_ID;
-			gotid = 1;
-			flag &= ~NFSV4ACE_IDENTIFIERGROUP;
-		}
-	} else if (len == 9 && !NFSBCMP(name, "EVERYONE@", 9)) {
-		acep->ae_tag = ACL_OTHER;
-		acep->ae_id = ACL_UNDEFINED_ID;
-		gotid = 1;
-	}
-	if (!gotid) {
-		if (flag & NFSV4ACE_IDENTIFIERGROUP) {
-			flag &= ~NFSV4ACE_IDENTIFIERGROUP;
-			acep->ae_tag = ACL_GROUP;
-			aceerr = nfsv4_strtogid(name, len, &gid, p);
-			if (!aceerr)
-				acep->ae_id = (uid_t)gid;
-		} else {
-			acep->ae_tag = ACL_USER;
-			aceerr = nfsv4_strtouid(name, len, &uid, p);
-			if (!aceerr)
-				acep->ae_id = uid;
-		}
-	}
-	if (len > NFSV4_SMALLSTR)
-		free(name, M_NFSSTRING);
-
-	/*
-	 * Now, check for unsupported types or flag bits.
-	 */
-	if (!aceerr && ((acetype != NFSV4ACE_ALLOWEDTYPE &&
-	     acetype != NFSV4ACE_AUDITTYPE && acetype != NFSV4ACE_ALARMTYPE
-	     && acetype != NFSV4ACE_DENIEDTYPE) || flag))
-		aceerr = NFSERR_ATTRNOTSUPP;
-
-	/*
-	 * And turn the mask into perm bits.
-	 */
-	if (!aceerr)
-		aceerr = nfsrv_acemasktoperm(acetype, mask, owner, VREG,
-			&acep->ae_perm);
-	*aceerrp = aceerr;
-	if (acesizep)
-		*acesizep = NFSM_RNDUP(len) + (4 * NFSX_UNSIGNED);
-	return (0);
-nfsmout:
-	return (error);
-}
-
-/*
- * Turn an NFSv4 ace mask into R/W/X flag bits.
- */
-static int
-nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner,
-    enum vtype type, acl_perm_t *permp)
-{
-	acl_perm_t perm = 0x0;
-
-	if (acetype != NFSV4ACE_ALLOWEDTYPE && acetype != NFSV4ACE_DENIEDTYPE){
-		if (mask & ~NFSV4ACE_AUDITMASK)
-			return (NFSERR_ATTRNOTSUPP);
-	}
-	if (mask & NFSV4ACE_DELETE) {
-		return (NFSERR_ATTRNOTSUPP);
-	}
-	if (acetype == NFSV4ACE_DENIEDTYPE) {
-		if (mask & NFSV4ACE_ALLFILESMASK) {
-			return (NFSERR_ATTRNOTSUPP);
-		}
-		if (owner) {
-			if (mask & NFSV4ACE_OWNERMASK) {
-				return (NFSERR_ATTRNOTSUPP);
-			}
-		} else {
-			if ((mask & NFSV4ACE_OWNERMASK) != NFSV4ACE_OWNERMASK) {
-				return (NFSERR_ATTRNOTSUPP);
-			}
-			mask &= ~NFSV4ACE_OWNERMASK;
-		}
-	} else if (acetype == NFSV4ACE_ALLOWEDTYPE) {
-		if ((mask & NFSV4ACE_ALLFILESMASK) != NFSV4ACE_ALLFILESMASK) {
-			return (NFSERR_ATTRNOTSUPP);
-		}
-		mask &= ~NFSV4ACE_ALLFILESMASK;
-		if (owner) {
-			if ((mask & NFSV4ACE_OWNERMASK) != NFSV4ACE_OWNERMASK) {
-				return (NFSERR_ATTRNOTSUPP);
-			}
-			mask &= ~NFSV4ACE_OWNERMASK;
-		} else if (mask & NFSV4ACE_OWNERMASK) {
-			return (NFSERR_ATTRNOTSUPP);
-		}
-	}
-	if (type == VDIR) {
-		if ((mask & NFSV4ACE_DIRREADMASK) == NFSV4ACE_DIRREADMASK) {
-			perm |= ACL_READ;
-			mask &= ~NFSV4ACE_DIRREADMASK;
-		}
-		if ((mask & NFSV4ACE_DIRWRITEMASK) == NFSV4ACE_DIRWRITEMASK) {
-			perm |= ACL_WRITE;
-			mask &= ~NFSV4ACE_DIRWRITEMASK;
-		}
-		if ((mask & NFSV4ACE_DIREXECUTEMASK)==NFSV4ACE_DIREXECUTEMASK){
-			perm |= ACL_EXECUTE;
-			mask &= ~NFSV4ACE_DIREXECUTEMASK;
-		}
-	} else {
-		if (acetype == NFSV4ACE_DENIEDTYPE &&
-		    (mask & NFSV4ACE_SYNCHRONIZE)) {
-			return (NFSERR_ATTRNOTSUPP);
-		}
-		mask &= ~(NFSV4ACE_SYNCHRONIZE | NFSV4ACE_DELETECHILD);
-		if ((mask & NFSV4ACE_READMASK) == NFSV4ACE_READMASK) {
-			perm |= ACL_READ;
-			mask &= ~NFSV4ACE_READMASK;
-		}
-		if ((mask & NFSV4ACE_WRITEMASK) == NFSV4ACE_WRITEMASK) {
-			perm |= ACL_WRITE;
-			mask &= ~NFSV4ACE_WRITEMASK;
-		}
-		if ((mask & NFSV4ACE_EXECUTEMASK) == NFSV4ACE_EXECUTEMASK) {
-			perm |= ACL_EXECUTE;
-			mask &= ~NFSV4ACE_EXECUTEMASK;
-		}
-	}
-	if (mask) {
-		return (NFSERR_ATTRNOTSUPP);
-	}
-	*permp = perm;
-	return (0);
-}
-#endif	/* !NFS4_ACL_EXTATTR_NAME */
 
-#ifdef NFS4_ACL_EXTATTR_NAME
 /* local functions */
 static int nfsrv_buildace(struct nfsrv_descript *, u_char *, int,
     enum vtype, int, int, struct acl_entry *);
@@ -678,5 +495,3 @@ nfsrv_compareacl(NFSACL_T *aclp1, NFSACL
 	}
 	return (0);
 }
-
-#endif	/* NFS4_ACL_EXTATTR_NAME */

Modified: stable/8/sys/fs/nfs/nfs_commonport.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonport.c	Fri Apr 29 17:04:52 2011	(r221211)
+++ stable/8/sys/fs/nfs/nfs_commonport.c	Fri Apr 29 17:57:35 2011	(r221212)
@@ -432,7 +432,6 @@ newnfs_portinit(void)
 	mtx_init(&nfs_state_mutex, "nfs_state_mutex", NULL, MTX_DEF);
 }
 
-#ifdef NFS4_ACL_EXTATTR_NAME
 /*
  * Determine if the file system supports NFSv4 ACLs.
  * Return 1 if it does, 0 otherwise.
@@ -452,7 +451,6 @@ nfs_supportsnfsv4acls(struct mount *mp)
 	}
 	return (0);
 }
-#endif	/* NFS4_ACL_EXTATTR_NAME */
 
 extern int (*nfsd_call_nfscommon)(struct thread *, struct nfssvc_args *);
 

Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonsubs.c	Fri Apr 29 17:04:52 2011	(r221211)
+++ stable/8/sys/fs/nfs/nfs_commonsubs.c	Fri Apr 29 17:57:35 2011	(r221212)
@@ -650,10 +650,8 @@ nfsrv_dissectacl(struct nfsrv_descript *
 	int acecnt, error = 0, aceerr = 0, acesize;
 
 	*aclerrp = 0;
-#ifdef NFS4_ACL_EXTATTR_NAME
 	if (aclp)
 		aclp->acl_cnt = 0;
-#endif
 	/*
 	 * Parse out the ace entries and expect them to conform to
 	 * what can be supported by R/W/X bits.
@@ -661,28 +659,22 @@ nfsrv_dissectacl(struct nfsrv_descript *
 	NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 	aclsize = NFSX_UNSIGNED;
 	acecnt = fxdr_unsigned(int, *tl);
-#ifdef NFS4_ACL_EXTATTR_NAME
 	if (acecnt > ACL_MAX_ENTRIES)
 		aceerr = 1;
-#endif
 	if (nfsrv_useacl == 0)
 		aceerr = 1;
 	for (i = 0; i < acecnt; i++) {
-#ifdef NFS4_ACL_EXTATTR_NAME
 		if (aclp && !aceerr)
 			error = nfsrv_dissectace(nd, &aclp->acl_entry[i],
 			    &aceerr, &acesize, p);
 		else
-#endif
 			error = nfsrv_skipace(nd, &acesize);
 		if (error)
 			return (error);
 		aclsize += acesize;
 	}
-#ifdef NFS4_ACL_EXTATTR_NAME
 	if (aclp && !aceerr)
 		aclp->acl_cnt = acecnt;
-#endif
 	if (aceerr)
 		*aclerrp = aceerr;
 	if (aclsizep)
@@ -1014,7 +1006,6 @@ nfsv4_loadattr(struct nfsrv_descript *nd
 		case NFSATTRBIT_ACL:
 			if (compare) {
 			  if (!(*retcmpp)) {
-#ifdef NFS4_ACL_EXTATTR_NAME
 			    if (nfsrv_useacl) {
 				NFSACL_T *naclp;
 
@@ -1028,9 +1019,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd
 				if (aceerr || nfsrv_compareacl(aclp, naclp))
 				    *retcmpp = NFSERR_NOTSAME;
 				acl_free(naclp);
-			    } else
-#endif
-			    {
+			    } else {
 				error = nfsrv_dissectacl(nd, NULL, &aceerr,
 				    &cnt, p);
 				*retcmpp = NFSERR_ATTRNOTSUPP;
@@ -1960,9 +1949,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 		aclp = saclp;
 	} else {
 		NFSCLRNOTFILLABLE_ATTRBIT(retbitp);
-#ifdef NFS4_ACL_EXTATTR_NAME
 		naclp = acl_alloc(M_WAITOK);
-#endif
 		aclp = naclp;
 	}
 	nfsvno_getfs(&fsinf, isdgram);
@@ -1985,21 +1972,15 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 	/*
 	 * And the NFSv4 ACL...
 	 */
-	if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT)
-#ifdef NFS4_ACL_EXTATTR_NAME
-	    && (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) &&
-		!NFSHASNFS4ACL(vnode_mount(vp))))
-#endif
-	    ) {
+	if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT) &&
+	    (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) &&
+		!NFSHASNFS4ACL(vnode_mount(vp))))) {
 		NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT);
 	}
 	if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACL)) {
-#ifdef NFS4_ACL_EXTATTR_NAME
 		if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) &&
 		    !NFSHASNFS4ACL(vnode_mount(vp)))) {
-#endif
 			NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL);
-#ifdef NFS4_ACL_EXTATTR_NAME
 		} else if (naclp != NULL) {
 			if (vn_lock(vp, LK_SHARED) == 0) {
 				error = VOP_ACCESSX(vp, VREAD_ACL, cred, p);
@@ -2017,7 +1998,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 				NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL);
 			}
 		}
-#endif
 	}
 	/*
 	 * Put out the attribute bitmap for the ones being filled in
@@ -2035,11 +2015,8 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 		switch (bitpos) {
 		case NFSATTRBIT_SUPPORTEDATTRS:
 			NFSSETSUPP_ATTRBIT(&attrbits);
-#ifdef NFS4_ACL_EXTATTR_NAME
 			if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL)
-			    && !NFSHASNFS4ACL(vnode_mount(vp))))
-#endif
-			{
+			    && !NFSHASNFS4ACL(vnode_mount(vp)))) {
 			    NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACLSUPPORT);
 			    NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACL);
 			}
@@ -2112,7 +2089,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 		/*
 		 * Recommended Attributes. (Only the supported ones.)
 		 */
-#ifdef NFS4_ACL_EXTATTR_NAME
 		case NFSATTRBIT_ACL:
 			retnum += nfsrv_buildacl(nd, aclp, vnode_vtype(vp), p);
 			break;
@@ -2121,7 +2097,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 			*tl = txdr_unsigned(NFSV4ACE_SUPTYPES);
 			retnum += NFSX_UNSIGNED;
 			break;
-#endif
 		case NFSATTRBIT_CANSETTIME:
 			NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
 			if (fsinf.fs_properties & NFSV3FSINFO_CANSETTIME)
@@ -2427,10 +2402,8 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 		};
 	    }
 	}
-#ifdef NFS4_ACL_EXTATTR_NAME
 	if (naclp != NULL)
 		acl_free(naclp);
-#endif
 	*retnump = txdr_unsigned(retnum);
 	return (retnum + prefixnum);
 }

Modified: stable/8/sys/fs/nfs/nfs_var.h
==============================================================================
--- stable/8/sys/fs/nfs/nfs_var.h	Fri Apr 29 17:04:52 2011	(r221211)
+++ stable/8/sys/fs/nfs/nfs_var.h	Fri Apr 29 17:57:35 2011	(r221212)
@@ -332,13 +332,11 @@ void newnfs_timer(void *);
 /* nfs_commonacl.c */
 int nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *,
     int *, int *, NFSPROC_T *);
-#ifdef NFS4_ACL_EXTATTR_NAME
 int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, enum vtype,
     NFSPROC_T *);
 int nfsrv_setacl(vnode_t, NFSACL_T *, struct ucred *,
     NFSPROC_T *);
 int nfsrv_compareacl(NFSACL_T *, NFSACL_T *);
-#endif
 
 /* nfs_clrpcops.c */
 int nfsrpc_null(vnode_t, struct ucred *, NFSPROC_T *);

Modified: stable/8/sys/fs/nfs/nfsport.h
==============================================================================
--- stable/8/sys/fs/nfs/nfsport.h	Fri Apr 29 17:04:52 2011	(r221211)
+++ stable/8/sys/fs/nfs/nfsport.h	Fri Apr 29 17:57:35 2011	(r221212)
@@ -125,11 +125,7 @@
 #define	NFSPROC_T	struct thread
 #define	NFSDEV_T	dev_t
 #define	NFSSVCARGS	nfssvc_args
-#ifdef NFS4_ACL_EXTATTR_NAME
 #define	NFSACL_T	struct acl
-#else
-#define	NFSACL_T	void
-#endif
 
 /*
  * These should be defined as the types used for the corresponding VOP's

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Fri Apr 29 17:04:52 2011	(r221211)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Fri Apr 29 17:57:35 2011	(r221212)
@@ -81,10 +81,8 @@ static int nfsrpc_createv4(vnode_t , cha
 static int nfsrpc_locku(struct nfsrv_descript *, struct nfsmount *,
     struct nfscllockowner *, u_int64_t, u_int64_t,
     u_int32_t, struct ucred *, NFSPROC_T *, int);
-#ifdef NFS4_ACL_EXTATTR_NAME
 static int nfsrpc_setaclrpc(vnode_t, struct ucred *, NFSPROC_T *,
     struct acl *, nfsv4stateid_t *, void *);
-#endif
 
 /*
  * nfs null call from vfs.
@@ -998,14 +996,9 @@ nfsrpc_setattr(vnode_t vp, struct vattr 
 		if (vap != NULL)
 			error = nfsrpc_setattrrpc(vp, vap, &stateid, cred, p,
 			    rnap, attrflagp, stuff);
-#ifdef NFS4_ACL_EXTATTR_NAME
 		else
 			error = nfsrpc_setaclrpc(vp, cred, p, aclp, &stateid,
 			    stuff);
-#else
-		else
-			error = EOPNOTSUPP;
-#endif
 		if (error == NFSERR_STALESTATEID)
 			nfscl_initiate_recovery(nmp->nm_clp);
 		if (lckp != NULL)
@@ -4119,7 +4112,6 @@ nfsrpc_delegreturn(struct nfscldeleg *dp
 	return (error);
 }
 
-#ifdef NFS4_ACL_EXTATTR_NAME
 /*
  * nfs getacl call.
  */
@@ -4193,5 +4185,3 @@ nfsrpc_setaclrpc(vnode_t vp, struct ucre
 	mbuf_freem(nd->nd_mrep);
 	return (nd->nd_repstat);
 }
-
-#endif	/* NFS4_ACL_EXTATTR_NAME */

Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvnops.c	Fri Apr 29 17:04:52 2011	(r221211)
+++ stable/8/sys/fs/nfsclient/nfs_clvnops.c	Fri Apr 29 17:57:35 2011	(r221212)
@@ -129,10 +129,8 @@ static vop_readlink_t	nfs_readlink;
 static vop_print_t	nfs_print;
 static vop_advlock_t	nfs_advlock;
 static vop_advlockasync_t nfs_advlockasync;
-#ifdef NFS4_ACL_EXTATTR_NAME
 static vop_getacl_t nfs_getacl;
 static vop_setacl_t nfs_setacl;
-#endif
 
 /*
  * Global vfs data structures for nfs
@@ -168,10 +166,8 @@ struct vop_vector newnfs_vnodeops = {
 	.vop_strategy =		nfs_strategy,
 	.vop_symlink =		nfs_symlink,
 	.vop_write =		ncl_write,
-#ifdef NFS4_ACL_EXTATTR_NAME
 	.vop_getacl =		nfs_getacl,
 	.vop_setacl =		nfs_setacl,
-#endif
 };
 
 struct vop_vector newnfs_fifoops = {
@@ -329,12 +325,9 @@ nfs_access(struct vop_access_args *ap)
 	 * unless the file is a socket, fifo, or a block or character
 	 * device resident on the filesystem.
 	 */
-	if ((ap->a_accmode & (VWRITE | VAPPEND
-#ifdef NFS4_ACL_EXTATTR_NAME
-	    | VWRITE_NAMED_ATTRS | VDELETE_CHILD | VWRITE_ATTRIBUTES |
-	    VDELETE | VWRITE_ACL | VWRITE_OWNER
-#endif
-	    )) != 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) != 0) {
+	if ((ap->a_accmode & (VWRITE | VAPPEND | VWRITE_NAMED_ATTRS |
+	    VDELETE_CHILD | VWRITE_ATTRIBUTES | VDELETE | VWRITE_ACL |
+	    VWRITE_OWNER)) != 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) != 0) {
 		switch (vp->v_type) {
 		case VREG:
 		case VDIR:
@@ -364,10 +357,8 @@ nfs_access(struct vop_access_args *ap)
 				mode |= NFSACCESS_EXTEND;
 			if (ap->a_accmode & VEXEC)
 				mode |= NFSACCESS_EXECUTE;
-#ifdef NFS4_ACL_EXTATTR_NAME
 			if (ap->a_accmode & VDELETE)
 				mode |= NFSACCESS_DELETE;
-#endif
 		} else {
 			if (ap->a_accmode & VWRITE)
 				mode |= (NFSACCESS_MODIFY | NFSACCESS_EXTEND);
@@ -375,12 +366,10 @@ nfs_access(struct vop_access_args *ap)
 				mode |= NFSACCESS_EXTEND;
 			if (ap->a_accmode & VEXEC)
 				mode |= NFSACCESS_LOOKUP;
-#ifdef NFS4_ACL_EXTATTR_NAME
 			if (ap->a_accmode & VDELETE)
 				mode |= NFSACCESS_DELETE;
 			if (ap->a_accmode & VDELETE_CHILD)
 				mode |= NFSACCESS_MODIFY;
-#endif
 		}
 		/* XXX safety belt, only make blanket request if caching */
 		if (nfsaccess_cache_timeout > 0) {
@@ -3216,7 +3205,6 @@ nfs_lock1(struct vop_lock1_args *ap)
 	    ap->a_line));
 }
 
-#ifdef NFS4_ACL_EXTATTR_NAME
 static int
 nfs_getacl(struct vop_getacl_args *ap)
 {
@@ -3249,8 +3237,6 @@ nfs_setacl(struct vop_setacl_args *ap)
 	return (error);
 }
 
-#endif	/* NFS4_ACL_EXTATTR_NAME */
-
 /*
  * Return POSIX pathconf information applicable to nfs filesystems.
  */

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 18:17:01 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BFF4E106564A;
	Fri, 29 Apr 2011 18:17:01 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ADE8C8FC17;
	Fri, 29 Apr 2011 18:17:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3TIH1Cq009761;
	Fri, 29 Apr 2011 18:17:01 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3TIH1ix009753;
	Fri, 29 Apr 2011 18:17:01 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201104291817.p3TIH1ix009753@svn.freebsd.org>
From: Rick Macklem 
Date: Fri, 29 Apr 2011 18:17:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221213 - in stable/8/sys/fs: nfs nfsclient nfsserver
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 18:17:01 -0000

Author: rmacklem
Date: Fri Apr 29 18:17:01 2011
New Revision: 221213
URL: http://svn.freebsd.org/changeset/base/221213

Log:
  MFC: r220645
  Modify the experimental NFSv4 server so that it handles
  crossing of server mount points properly. The functions
  nfsvno_fillattr() and nfsv4_fillattr() were modified to
  take the extra arguments that are the mount point, a flag
  to indicate that it is a file system root and the mounted
  on fileno. The mount point argument needs to be busy when
  nfsvno_fillattr() is called, since the vp argument is not
  locked.

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

Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonsubs.c	Fri Apr 29 17:57:35 2011	(r221212)
+++ stable/8/sys/fs/nfs/nfs_commonsubs.c	Fri Apr 29 18:17:01 2011	(r221213)
@@ -1916,9 +1916,10 @@ nfsrv_mtostr(struct nfsrv_descript *nd, 
  * Fill in the attributes as marked by the bitmap (V4).
  */
 APPLESTATIC int
-nfsv4_fillattr(struct nfsrv_descript *nd, vnode_t vp, NFSACL_T *saclp,
-    struct vattr *vap, fhandle_t *fhp, int rderror, nfsattrbit_t *attrbitp,
-    struct ucred *cred, NFSPROC_T *p, int isdgram, int reterr)
+nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
+    NFSACL_T *saclp, struct vattr *vap, fhandle_t *fhp, int rderror,
+    nfsattrbit_t *attrbitp, struct ucred *cred, NFSPROC_T *p, int isdgram,
+    int reterr, int at_root, uint64_t mounted_on_fileno)
 {
 	int bitpos, retnum = 0;
 	u_int32_t *tl;
@@ -1928,7 +1929,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 	nfsattrbit_t *retbitp = &retbits;
 	u_int32_t freenum, *retnump;
 	u_int64_t uquad;
-	long fid;
 	struct statfs fs;
 	struct nfsfsinfo fsinf;
 	struct timespec temptime;
@@ -1958,7 +1958,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 	 * Get the VFS_STATFS(), since some attributes need them.
 	 */
 	if (NFSISSETSTATFS_ATTRBIT(retbitp)) {
-		error = VFS_STATFS(vnode_mount(vp), &fs);
+		error = VFS_STATFS(mp, &fs);
 		if (error != 0) {
 			if (reterr) {
 				nd->nd_repstat = NFSERR_ACCES;
@@ -1974,12 +1974,12 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 	 */
 	if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT) &&
 	    (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) &&
-		!NFSHASNFS4ACL(vnode_mount(vp))))) {
+		!NFSHASNFS4ACL(mp)))) {
 		NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT);
 	}
 	if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACL)) {
 		if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) &&
-		    !NFSHASNFS4ACL(vnode_mount(vp)))) {
+		    !NFSHASNFS4ACL(mp))) {
 			NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL);
 		} else if (naclp != NULL) {
 			if (vn_lock(vp, LK_SHARED) == 0) {
@@ -2016,7 +2016,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 		case NFSATTRBIT_SUPPORTEDATTRS:
 			NFSSETSUPP_ATTRBIT(&attrbits);
 			if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL)
-			    && !NFSHASNFS4ACL(vnode_mount(vp)))) {
+			    && !NFSHASNFS4ACL(mp))) {
 			    NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACLSUPPORT);
 			    NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACL);
 			}
@@ -2066,9 +2066,9 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 		case NFSATTRBIT_FSID:
 			NFSM_BUILD(tl, u_int32_t *, NFSX_V4FSID);
 			*tl++ = 0;
-			*tl++=txdr_unsigned(vfs_statfs(vnode_mount(vp))->f_fsid.val[0]);
+			*tl++ = txdr_unsigned(mp->mnt_stat.f_fsid.val[0]);
 			*tl++ = 0;
-			*tl=txdr_unsigned(vfs_statfs(vnode_mount(vp))->f_fsid.val[1]);
+			*tl = txdr_unsigned(mp->mnt_stat.f_fsid.val[1]);
 			retnum += NFSX_V4FSID;
 			break;
 		case NFSATTRBIT_UNIQUEHANDLES:
@@ -2142,7 +2142,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 			 */
 			savuid = p->p_cred->p_ruid;
 			p->p_cred->p_ruid = cred->cr_uid;
-			if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA),
+			if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA),
 			    cred->cr_uid, (caddr_t)&dqb))
 			    freenum = min(dqb.dqb_isoftlimit-dqb.dqb_curinodes,
 				freenum);
@@ -2249,7 +2249,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 			 */
 			savuid = p->p_cred->p_ruid;
 			p->p_cred->p_ruid = cred->cr_uid;
-			if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA),
+			if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA),
 			    cred->cr_uid, (caddr_t)&dqb))
 			    freenum = min(dqb.dqb_bhardlimit, freenum);
 			p->p_cred->p_ruid = savuid;
@@ -2273,7 +2273,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 			 */
 			savuid = p->p_cred->p_ruid;
 			p->p_cred->p_ruid = cred->cr_uid;
-			if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA),
+			if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA),
 			    cred->cr_uid, (caddr_t)&dqb))
 			    freenum = min(dqb.dqb_bsoftlimit, freenum);
 			p->p_cred->p_ruid = savuid;
@@ -2294,7 +2294,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 			 */
 			savuid = p->p_cred->p_ruid;
 			p->p_cred->p_ruid = cred->cr_uid;
-			if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA),
+			if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA),
 			    cred->cr_uid, (caddr_t)&dqb))
 			    freenum = dqb.dqb_curblocks;
 			p->p_cred->p_ruid = savuid;
@@ -2390,11 +2390,11 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 			break;
 		case NFSATTRBIT_MOUNTEDONFILEID:
 			NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER);
-			*tl++ = 0;
-			if (nfsrv_atroot(vp, &fid))
-				*tl = txdr_unsigned(fid);
+			if (at_root != 0)
+				uquad = mounted_on_fileno;
 			else
-				*tl = txdr_unsigned(vap->va_fileid);
+				uquad = (u_int64_t)vap->va_fileid;
+			txdr_hyper(uquad, tl);
 			retnum += NFSX_HYPER;
 			break;
 		default:

Modified: stable/8/sys/fs/nfs/nfs_var.h
==============================================================================
--- stable/8/sys/fs/nfs/nfs_var.h	Fri Apr 29 17:57:35 2011	(r221212)
+++ stable/8/sys/fs/nfs/nfs_var.h	Fri Apr 29 18:17:01 2011	(r221213)
@@ -288,9 +288,9 @@ int nfsrv_mtofh(struct nfsrv_descript *,
 int nfsrv_putattrbit(struct nfsrv_descript *, nfsattrbit_t *);
 void nfsrv_wcc(struct nfsrv_descript *, int, struct nfsvattr *, int,
     struct nfsvattr *);
-int nfsv4_fillattr(struct nfsrv_descript *, vnode_t, NFSACL_T *,
+int nfsv4_fillattr(struct nfsrv_descript *, struct mount *, vnode_t, NFSACL_T *,
     struct vattr *, fhandle_t *, int, nfsattrbit_t *,
-    struct ucred *, NFSPROC_T *, int, int);
+    struct ucred *, NFSPROC_T *, int, int, int, uint64_t);
 void nfsrv_fillattr(struct nfsrv_descript *, struct nfsvattr *);
 void nfsrv_adj(mbuf_t, int, int);
 void nfsrv_postopattr(struct nfsrv_descript *, int, struct nfsvattr *);
@@ -556,9 +556,9 @@ void nfsvno_open(struct nfsrv_descript *
     struct nfsexstuff *, vnode_t *);
 void nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct ucred *,
     NFSPROC_T *);
-int nfsvno_fillattr(struct nfsrv_descript *, vnode_t,
+int nfsvno_fillattr(struct nfsrv_descript *, struct mount *, vnode_t,
     struct nfsvattr *, fhandle_t *, int, nfsattrbit_t *,
-    struct ucred *, NFSPROC_T *, int, int);
+    struct ucred *, NFSPROC_T *, int, int, int, uint64_t);
 int nfsrv_sattr(struct nfsrv_descript *, struct nfsvattr *, nfsattrbit_t *,
     NFSACL_T *, NFSPROC_T *);
 int nfsv4_sattr(struct nfsrv_descript *, struct nfsvattr *, nfsattrbit_t *,

Modified: stable/8/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clport.c	Fri Apr 29 17:57:35 2011	(r221212)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c	Fri Apr 29 18:17:01 2011	(r221213)
@@ -803,8 +803,8 @@ nfscl_fillsattr(struct nfsrv_descript *n
 			NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESSSET);
 		if (vap->va_mtime.tv_sec != VNOVAL)
 			NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFYSET);
-		(void) nfsv4_fillattr(nd, vp, NULL, vap, NULL, 0, &attrbits,
-		    NULL, NULL, 0, 0);
+		(void) nfsv4_fillattr(nd, vp->v_mount, vp, NULL, vap, NULL, 0,
+		    &attrbits, NULL, NULL, 0, 0, 0, (uint64_t)0);
 		break;
 	};
 }

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Fri Apr 29 17:57:35 2011	(r221212)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Fri Apr 29 18:17:01 2011	(r221213)
@@ -4176,8 +4176,8 @@ nfsrpc_setaclrpc(vnode_t vp, struct ucre
 	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
 	NFSZERO_ATTRBIT(&attrbits);
 	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
-	(void) nfsv4_fillattr(nd, vp, aclp, NULL, NULL, 0, &attrbits,
-	    NULL, NULL, 0, 0);
+	(void) nfsv4_fillattr(nd, vnode_mount(vp), vp, aclp, NULL, NULL, 0,
+	    &attrbits, NULL, NULL, 0, 0, 0, (uint64_t)0);
 	error = nfscl_request(nd, vp, p, cred, stuff);
 	if (error)
 		return (error);

Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clstate.c	Fri Apr 29 17:57:35 2011	(r221212)
+++ stable/8/sys/fs/nfsclient/nfs_clstate.c	Fri Apr 29 18:17:01 2011	(r221213)
@@ -3061,8 +3061,9 @@ nfscl_docb(struct nfsrv_descript *nd, NF
 					NFSSETBIT_ATTRBIT(&rattrbits,
 					    NFSATTRBIT_CHANGE);
 				}
-				(void) nfsv4_fillattr(nd, NULL, NULL, &va,
-				    NULL, 0, &rattrbits, NULL, NULL, 0, 0);
+				(void) nfsv4_fillattr(nd, NULL, NULL, NULL, &va,
+				    NULL, 0, &rattrbits, NULL, NULL, 0, 0, 0,
+				    (uint64_t)0);
 				if (!ret)
 					vrele(vp);
 			}

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Fri Apr 29 17:57:35 2011	(r221212)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Fri Apr 29 18:17:01 2011	(r221213)
@@ -68,15 +68,15 @@ static uint32_t nfsv4_sysid = 0;
 static int nfssvc_srvcall(struct thread *, struct nfssvc_args *,
     struct ucred *);
 
-static int enable_crossmntpt = 1;
+int nfsrv_enable_crossmntpt = 1;
 static int nfs_commit_blks;
 static int nfs_commit_miss;
 extern int nfsrv_issuedelegs;
 extern int nfsrv_dolocallocks;
 
 SYSCTL_DECL(_vfs_newnfs);
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, mirrormnt, CTLFLAG_RW, &enable_crossmntpt,
-    0, "Enable nfsd to cross mount points");
+SYSCTL_INT(_vfs_newnfs, OID_AUTO, mirrormnt, CTLFLAG_RW,
+    &nfsrv_enable_crossmntpt, 0, "Enable nfsd to cross mount points");
 SYSCTL_INT(_vfs_newnfs, OID_AUTO, commit_blks, CTLFLAG_RW, &nfs_commit_blks,
     0, "");
 SYSCTL_INT(_vfs_newnfs, OID_AUTO, commit_miss, CTLFLAG_RW, &nfs_commit_miss,
@@ -306,12 +306,12 @@ nfsvno_namei(struct nfsrv_descript *nd, 
 			dp = rootvnode;
 			VREF(dp);
 		}
-	} else if ((enable_crossmntpt == 0 && NFSVNO_EXPORTED(exp)) ||
+	} else if ((nfsrv_enable_crossmntpt == 0 && NFSVNO_EXPORTED(exp)) ||
 	    (nd->nd_flag & ND_NFSV4) == 0) {
 		/*
 		 * Only cross mount points for NFSv4 when doing a
 		 * mount while traversing the file system above
-		 * the mount point, unless enable_crossmntpt is set.
+		 * the mount point, unless nfsrv_enable_crossmntpt is set.
 		 */
 		cnp->cn_flags |= NOCROSSMOUNT;
 		crossmnt = 0;
@@ -1391,14 +1391,15 @@ nfsvno_updfilerev(struct vnode *vp, stru
  * Glue routine to nfsv4_fillattr().
  */
 int
-nfsvno_fillattr(struct nfsrv_descript *nd, struct vnode *vp,
+nfsvno_fillattr(struct nfsrv_descript *nd, struct mount *mp, struct vnode *vp,
     struct nfsvattr *nvap, fhandle_t *fhp, int rderror, nfsattrbit_t *attrbitp,
-    struct ucred *cred, struct thread *p, int isdgram, int reterr)
+    struct ucred *cred, struct thread *p, int isdgram, int reterr, int at_root,
+    uint64_t mounted_on_fileno)
 {
 	int error;
 
-	error = nfsv4_fillattr(nd, vp, NULL, &nvap->na_vattr, fhp, rderror,
-	    attrbitp, cred, p, isdgram, reterr);
+	error = nfsv4_fillattr(nd, mp, vp, NULL, &nvap->na_vattr, fhp, rderror,
+	    attrbitp, cred, p, isdgram, reterr, at_root, mounted_on_fileno);
 	return (error);
 }
 
@@ -1688,8 +1689,9 @@ nfsrvd_readdirplus(struct nfsrv_descript
 	struct uio io;
 	struct iovec iv;
 	struct componentname cn;
-	int not_zfs;
-	struct mount *mp;
+	int at_root, needs_unbusy, not_zfs;
+	struct mount *mp, *new_mp;
+	uint64_t mounted_on_fileno;
 
 	if (nd->nd_repstat) {
 		nfsrv_postopattr(nd, getret, &at);
@@ -1929,6 +1931,10 @@ again:
 			nvp = NULL;
 			refp = NULL;
 			r = 0;
+			at_root = 0;
+			needs_unbusy = 0;
+			new_mp = mp;
+			mounted_on_fileno = (uint64_t)dp->d_fileno;
 			if ((nd->nd_flag & ND_NFSV3) ||
 			    NFSNONZERO_ATTRBIT(&savbits)) {
 				if (nd->nd_flag & ND_NFSV4)
@@ -1980,6 +1986,29 @@ again:
 								    0);
 						}
 					}
+
+					/*
+					 * For NFSv4, check to see if nvp is
+					 * a mount point and get the mount
+					 * point vnode, as required.
+					 */
+					if (r == 0 &&
+					    nfsrv_enable_crossmntpt != 0 &&
+					    (nd->nd_flag & ND_NFSV4) != 0 &&
+					    nvp->v_type == VDIR &&
+					    nvp->v_mountedhere != NULL) {
+						new_mp = nvp->v_mountedhere;
+						r = vfs_busy(new_mp, 0);
+						vput(nvp);
+						nvp = NULL;
+						if (r == 0) {
+							r = VFS_ROOT(new_mp,
+							    LK_SHARED, &nvp);
+							needs_unbusy = 1;
+							if (r == 0)
+								at_root = 1;
+						}
+					}
 				}
 				if (!r) {
 				    if (refp == NULL &&
@@ -1998,6 +2027,8 @@ again:
 					    NFSATTRBIT_RDATTRERROR)) {
 						if (nvp != NULL)
 							vput(nvp);
+						if (needs_unbusy != 0)
+							vfs_unbusy(new_mp);
 						nd->nd_repstat = r;
 						break;
 					}
@@ -2036,21 +2067,27 @@ again:
 					if (nd->nd_repstat) {
 						if (nvp != NULL)
 							vrele(nvp);
+						if (needs_unbusy != 0)
+							vfs_unbusy(new_mp);
 						break;
 					}
 				} else if (r) {
-					dirlen += nfsvno_fillattr(nd, nvp, nvap,
-					    &nfh, r, &rderrbits, nd->nd_cred,
-					    p, isdgram, 0);
+					dirlen += nfsvno_fillattr(nd, new_mp,
+					    nvp, nvap, &nfh, r, &rderrbits,
+					    nd->nd_cred, p, isdgram, 0, at_root,
+					    mounted_on_fileno);
 				} else {
-					dirlen += nfsvno_fillattr(nd, nvp, nvap,
-					    &nfh, r, &attrbits, nd->nd_cred,
-					    p, isdgram, 0);
+					dirlen += nfsvno_fillattr(nd, new_mp,
+					    nvp, nvap, &nfh, r, &attrbits,
+					    nd->nd_cred, p, isdgram, 0, at_root,
+					    mounted_on_fileno);
 				}
 				if (nvp != NULL)
 					vrele(nvp);
 				dirlen += (3 * NFSX_UNSIGNED);
 			}
+			if (needs_unbusy != 0)
+				vfs_unbusy(new_mp);
 			if (dirlen <= cnt)
 				entrycnt++;
 		}

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c	Fri Apr 29 17:57:35 2011	(r221212)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c	Fri Apr 29 18:17:01 2011	(r221213)
@@ -52,6 +52,7 @@ extern u_int32_t newnfs_false, newnfs_tr
 extern enum vtype nv34tov_type[8];
 extern struct timeval nfsboottime;
 extern int nfs_rootfhset;
+extern int nfsrv_enable_crossmntpt;
 #endif	/* !APPLEKEXT */
 
 /*
@@ -169,9 +170,13 @@ nfsrvd_getattr(struct nfsrv_descript *nd
 {
 	struct nfsvattr nva;
 	fhandle_t fh;
-	int error = 0;
+	int at_root = 0, error = 0;
 	struct nfsreferral *refp;
 	nfsattrbit_t attrbits;
+	struct mount *mp;
+	struct vnode *tvp = NULL;
+	struct vattr va;
+	uint64_t mounted_on_fileno = 0;
 
 	if (nd->nd_repstat)
 		return (0);
@@ -207,11 +212,46 @@ nfsrvd_getattr(struct nfsrv_descript *nd
 			if (!nd->nd_repstat)
 				nd->nd_repstat = nfsrv_checkgetattr(nd, vp,
 				    &nva, &attrbits, nd->nd_cred, p);
-			NFSVOPUNLOCK(vp, 0, p);
-			if (!nd->nd_repstat)
-				(void) nfsvno_fillattr(nd, vp, &nva, &fh,
-				    0, &attrbits, nd->nd_cred, p, isdgram, 1);
-			vrele(vp);
+			if (nd->nd_repstat == 0) {
+				mp = vp->v_mount;
+				if (nfsrv_enable_crossmntpt != 0 &&
+				    vp->v_type == VDIR &&
+				    (vp->v_vflag & VV_ROOT) != 0 &&
+				    vp != rootvnode) {
+					tvp = mp->mnt_vnodecovered;
+					VREF(tvp);
+					at_root = 1;
+				} else
+					at_root = 0;
+				vfs_ref(mp);
+				VOP_UNLOCK(vp, 0);
+				if (at_root != 0) {
+					if ((nd->nd_repstat =
+					     vn_lock(tvp, LK_SHARED)) == 0) {
+						nd->nd_repstat = VOP_GETATTR(
+						    tvp, &va, nd->nd_cred);
+						vput(tvp);
+					} else
+						vrele(tvp);
+					if (nd->nd_repstat == 0)
+						mounted_on_fileno = (uint64_t)
+						    va.va_fileid;
+					else
+						at_root = 0;
+				}
+				if (nd->nd_repstat == 0)
+					nd->nd_repstat = vfs_busy(mp, 0);
+				vfs_rel(mp);
+				if (nd->nd_repstat == 0) {
+					(void)nfsvno_fillattr(nd, mp, vp, &nva,
+					    &fh, 0, &attrbits, nd->nd_cred, p,
+					    isdgram, 1, at_root,
+					    mounted_on_fileno);
+					vfs_unbusy(mp);
+				}
+				vrele(vp);
+			} else
+				vput(vp);
 		} else {
 			nfsrv_fillattr(nd, &nva);
 			vput(vp);

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 18:30:54 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 80C14106564A;
	Fri, 29 Apr 2011 18:30:54 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6EB1F8FC13;
	Fri, 29 Apr 2011 18:30:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3TIUsTj010340;
	Fri, 29 Apr 2011 18:30:54 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3TIUst7010329;
	Fri, 29 Apr 2011 18:30:54 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201104291830.p3TIUst7010329@svn.freebsd.org>
From: Rick Macklem 
Date: Fri, 29 Apr 2011 18:30:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221217 - in stable/8/sys/fs: nfs nfsclient nfsserver
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 18:30:54 -0000

Author: rmacklem
Date: Fri Apr 29 18:30:53 2011
New Revision: 221217
URL: http://svn.freebsd.org/changeset/base/221217

Log:
  MFC: r220648
  Fix the experimental NFSv4 server so that it uses VOP_PATHCONF()
  to determine if a file system supports NFSv4 ACLs. Since
  VOP_PATHCONF() must be called with a locked vnode, the function
  is called before nfsvno_fillattr() and the result is passed in
  as an extra argument.

Modified:
  stable/8/sys/fs/nfs/nfs_commonacl.c
  stable/8/sys/fs/nfs/nfs_commonport.c
  stable/8/sys/fs/nfs/nfs_commonsubs.c
  stable/8/sys/fs/nfs/nfs_var.h
  stable/8/sys/fs/nfs/nfsport.h
  stable/8/sys/fs/nfsclient/nfs_clport.c
  stable/8/sys/fs/nfsclient/nfs_clrpcops.c
  stable/8/sys/fs/nfsclient/nfs_clstate.c
  stable/8/sys/fs/nfsserver/nfs_nfsdport.c
  stable/8/sys/fs/nfsserver/nfs_nfsdserv.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs_commonacl.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonacl.c	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfs/nfs_commonacl.c	Fri Apr 29 18:30:53 2011	(r221217)
@@ -445,7 +445,7 @@ nfsrv_setacl(vnode_t vp, NFSACL_T *aclp,
 {
 	int error;
 
-	if (nfsrv_useacl == 0 || !NFSHASNFS4ACL(vnode_mount(vp)))
+	if (nfsrv_useacl == 0 || nfs_supportsnfsv4acls(vp) == 0)
 		return (NFSERR_ATTRNOTSUPP);
 	/*
 	 * With NFSv4 ACLs, chmod(2) may need to add additional entries.

Modified: stable/8/sys/fs/nfs/nfs_commonport.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonport.c	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfs/nfs_commonport.c	Fri Apr 29 18:30:53 2011	(r221217)
@@ -437,18 +437,18 @@ newnfs_portinit(void)
  * Return 1 if it does, 0 otherwise.
  */
 int
-nfs_supportsnfsv4acls(struct mount *mp)
+nfs_supportsnfsv4acls(struct vnode *vp)
 {
+	int error;
+	register_t retval;
 
-	if (mp->mnt_stat.f_fstypename == NULL)
-		return (0);
-	if (strcmp(mp->mnt_stat.f_fstypename, "ufs") == 0) {
-		/* Not yet */
+	ASSERT_VOP_LOCKED(vp, "nfs supports nfsv4acls");
+
+	if (nfsrv_useacl == 0)
 		return (0);
-	} else if (strcmp(mp->mnt_stat.f_fstypename, "zfs") == 0) {
-		/* Always supports them */
+	error = VOP_PATHCONF(vp, _PC_ACL_NFS4, &retval);
+	if (error == 0 && retval != 0)
 		return (1);
-	}
 	return (0);
 }
 

Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonsubs.c	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfs/nfs_commonsubs.c	Fri Apr 29 18:30:53 2011	(r221217)
@@ -1919,7 +1919,7 @@ APPLESTATIC int
 nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
     NFSACL_T *saclp, struct vattr *vap, fhandle_t *fhp, int rderror,
     nfsattrbit_t *attrbitp, struct ucred *cred, NFSPROC_T *p, int isdgram,
-    int reterr, int at_root, uint64_t mounted_on_fileno)
+    int reterr, int supports_nfsv4acls, int at_root, uint64_t mounted_on_fileno)
 {
 	int bitpos, retnum = 0;
 	u_int32_t *tl;
@@ -1974,12 +1974,12 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 	 */
 	if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT) &&
 	    (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) &&
-		!NFSHASNFS4ACL(mp)))) {
+		supports_nfsv4acls == 0))) {
 		NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT);
 	}
 	if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACL)) {
 		if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) &&
-		    !NFSHASNFS4ACL(mp))) {
+		    supports_nfsv4acls == 0)) {
 			NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL);
 		} else if (naclp != NULL) {
 			if (vn_lock(vp, LK_SHARED) == 0) {
@@ -2016,7 +2016,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 		case NFSATTRBIT_SUPPORTEDATTRS:
 			NFSSETSUPP_ATTRBIT(&attrbits);
 			if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL)
-			    && !NFSHASNFS4ACL(mp))) {
+			    && supports_nfsv4acls == 0)) {
 			    NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACLSUPPORT);
 			    NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACL);
 			}

Modified: stable/8/sys/fs/nfs/nfs_var.h
==============================================================================
--- stable/8/sys/fs/nfs/nfs_var.h	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfs/nfs_var.h	Fri Apr 29 18:30:53 2011	(r221217)
@@ -290,7 +290,7 @@ void nfsrv_wcc(struct nfsrv_descript *, 
     struct nfsvattr *);
 int nfsv4_fillattr(struct nfsrv_descript *, struct mount *, vnode_t, NFSACL_T *,
     struct vattr *, fhandle_t *, int, nfsattrbit_t *,
-    struct ucred *, NFSPROC_T *, int, int, int, uint64_t);
+    struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t);
 void nfsrv_fillattr(struct nfsrv_descript *, struct nfsvattr *);
 void nfsrv_adj(mbuf_t, int, int);
 void nfsrv_postopattr(struct nfsrv_descript *, int, struct nfsvattr *);
@@ -328,6 +328,7 @@ int nfs_catnap(int, int, const char *);
 struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);
 int nfsrv_atroot(vnode_t, long *);
 void newnfs_timer(void *);
+int nfs_supportsnfsv4acls(vnode_t);
 
 /* nfs_commonacl.c */
 int nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *,
@@ -558,7 +559,7 @@ void nfsvno_updfilerev(vnode_t, struct n
     NFSPROC_T *);
 int nfsvno_fillattr(struct nfsrv_descript *, struct mount *, vnode_t,
     struct nfsvattr *, fhandle_t *, int, nfsattrbit_t *,
-    struct ucred *, NFSPROC_T *, int, int, int, uint64_t);
+    struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t);
 int nfsrv_sattr(struct nfsrv_descript *, struct nfsvattr *, nfsattrbit_t *,
     NFSACL_T *, NFSPROC_T *);
 int nfsv4_sattr(struct nfsrv_descript *, struct nfsvattr *, nfsattrbit_t *,

Modified: stable/8/sys/fs/nfs/nfsport.h
==============================================================================
--- stable/8/sys/fs/nfs/nfsport.h	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfs/nfsport.h	Fri Apr 29 18:30:53 2011	(r221217)
@@ -778,12 +778,6 @@ void newnfs_realign(struct mbuf **);
 #define	NFSHASPRIVACY(n)	((n)->nm_flag & NFSMNT_PRIVACY)
 #define	NFSSETWRITEVERF(n)	((n)->nm_state |= NFSSTA_HASWRITEVERF)
 #define	NFSSETHASSETFSID(n)	((n)->nm_state |= NFSSTA_HASSETFSID)
-#ifdef NFS4_ACL_EXTATTR_NAME
-#define	NFSHASNFS4ACL(m)	nfs_supportsnfsv4acls(m)
-int nfs_supportsnfsv4acls(struct mount *);
-#else
-#define	NFSHASNFS4ACL(m)	0
-#endif
 
 /*
  * Gets the stats field out of the mount structure.

Modified: stable/8/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clport.c	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c	Fri Apr 29 18:30:53 2011	(r221217)
@@ -804,7 +804,7 @@ nfscl_fillsattr(struct nfsrv_descript *n
 		if (vap->va_mtime.tv_sec != VNOVAL)
 			NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFYSET);
 		(void) nfsv4_fillattr(nd, vp->v_mount, vp, NULL, vap, NULL, 0,
-		    &attrbits, NULL, NULL, 0, 0, 0, (uint64_t)0);
+		    &attrbits, NULL, NULL, 0, 0, 0, 0, (uint64_t)0);
 		break;
 	};
 }

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Fri Apr 29 18:30:53 2011	(r221217)
@@ -4177,7 +4177,7 @@ nfsrpc_setaclrpc(vnode_t vp, struct ucre
 	NFSZERO_ATTRBIT(&attrbits);
 	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
 	(void) nfsv4_fillattr(nd, vnode_mount(vp), vp, aclp, NULL, NULL, 0,
-	    &attrbits, NULL, NULL, 0, 0, 0, (uint64_t)0);
+	    &attrbits, NULL, NULL, 0, 0, 0, 0, (uint64_t)0);
 	error = nfscl_request(nd, vp, p, cred, stuff);
 	if (error)
 		return (error);

Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clstate.c	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfsclient/nfs_clstate.c	Fri Apr 29 18:30:53 2011	(r221217)
@@ -3062,7 +3062,7 @@ nfscl_docb(struct nfsrv_descript *nd, NF
 					    NFSATTRBIT_CHANGE);
 				}
 				(void) nfsv4_fillattr(nd, NULL, NULL, NULL, &va,
-				    NULL, 0, &rattrbits, NULL, NULL, 0, 0, 0,
+				    NULL, 0, &rattrbits, NULL, NULL, 0, 0, 0, 0,
 				    (uint64_t)0);
 				if (!ret)
 					vrele(vp);

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Fri Apr 29 18:30:53 2011	(r221217)
@@ -1393,13 +1393,14 @@ nfsvno_updfilerev(struct vnode *vp, stru
 int
 nfsvno_fillattr(struct nfsrv_descript *nd, struct mount *mp, struct vnode *vp,
     struct nfsvattr *nvap, fhandle_t *fhp, int rderror, nfsattrbit_t *attrbitp,
-    struct ucred *cred, struct thread *p, int isdgram, int reterr, int at_root,
-    uint64_t mounted_on_fileno)
+    struct ucred *cred, struct thread *p, int isdgram, int reterr,
+    int supports_nfsv4acls, int at_root, uint64_t mounted_on_fileno)
 {
 	int error;
 
 	error = nfsv4_fillattr(nd, mp, vp, NULL, &nvap->na_vattr, fhp, rderror,
-	    attrbitp, cred, p, isdgram, reterr, at_root, mounted_on_fileno);
+	    attrbitp, cred, p, isdgram, reterr, supports_nfsv4acls, at_root,
+	    mounted_on_fileno);
 	return (error);
 }
 
@@ -1689,7 +1690,7 @@ nfsrvd_readdirplus(struct nfsrv_descript
 	struct uio io;
 	struct iovec iv;
 	struct componentname cn;
-	int at_root, needs_unbusy, not_zfs;
+	int at_root, needs_unbusy, not_zfs, supports_nfsv4acls;
 	struct mount *mp, *new_mp;
 	uint64_t mounted_on_fileno;
 
@@ -2058,8 +2059,12 @@ again:
 				*tl++ = 0;
 				*tl = txdr_unsigned(*cookiep);
 				dirlen += nfsm_strtom(nd, dp->d_name, nlen);
-				if (nvp != NULL)
+				if (nvp != NULL) {
+					supports_nfsv4acls =
+					    nfs_supportsnfsv4acls(nvp);
 					VOP_UNLOCK(nvp, 0);
+				} else
+					supports_nfsv4acls = 0;
 				if (refp != NULL) {
 					dirlen += nfsrv_putreferralattr(nd,
 					    &savbits, refp, 0,
@@ -2074,12 +2079,14 @@ again:
 				} else if (r) {
 					dirlen += nfsvno_fillattr(nd, new_mp,
 					    nvp, nvap, &nfh, r, &rderrbits,
-					    nd->nd_cred, p, isdgram, 0, at_root,
+					    nd->nd_cred, p, isdgram, 0,
+					    supports_nfsv4acls, at_root,
 					    mounted_on_fileno);
 				} else {
 					dirlen += nfsvno_fillattr(nd, new_mp,
 					    nvp, nvap, &nfh, r, &attrbits,
-					    nd->nd_cred, p, isdgram, 0, at_root,
+					    nd->nd_cred, p, isdgram, 0,
+					    supports_nfsv4acls, at_root,
 					    mounted_on_fileno);
 				}
 				if (nvp != NULL)

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c	Fri Apr 29 18:27:50 2011	(r221216)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c	Fri Apr 29 18:30:53 2011	(r221217)
@@ -170,7 +170,7 @@ nfsrvd_getattr(struct nfsrv_descript *nd
 {
 	struct nfsvattr nva;
 	fhandle_t fh;
-	int at_root = 0, error = 0;
+	int at_root = 0, error = 0, supports_nfsv4acls;
 	struct nfsreferral *refp;
 	nfsattrbit_t attrbits;
 	struct mount *mp;
@@ -213,6 +213,7 @@ nfsrvd_getattr(struct nfsrv_descript *nd
 				nd->nd_repstat = nfsrv_checkgetattr(nd, vp,
 				    &nva, &attrbits, nd->nd_cred, p);
 			if (nd->nd_repstat == 0) {
+				supports_nfsv4acls = nfs_supportsnfsv4acls(vp);
 				mp = vp->v_mount;
 				if (nfsrv_enable_crossmntpt != 0 &&
 				    vp->v_type == VDIR &&
@@ -245,8 +246,8 @@ nfsrvd_getattr(struct nfsrv_descript *nd
 				if (nd->nd_repstat == 0) {
 					(void)nfsvno_fillattr(nd, mp, vp, &nva,
 					    &fh, 0, &attrbits, nd->nd_cred, p,
-					    isdgram, 1, at_root,
-					    mounted_on_fileno);
+					    isdgram, 1, supports_nfsv4acls,
+					    at_root, mounted_on_fileno);
 					vfs_unbusy(mp);
 				}
 				vrele(vp);

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 18:49:37 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 334EC106566C;
	Fri, 29 Apr 2011 18:49:37 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 183698FC18;
	Fri, 29 Apr 2011 18:49:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3TIna2U010973;
	Fri, 29 Apr 2011 18:49:36 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3TInajJ010967;
	Fri, 29 Apr 2011 18:49:36 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201104291849.p3TInajJ010967@svn.freebsd.org>
From: Rick Macklem 
Date: Fri, 29 Apr 2011 18:49:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221219 - in stable/8/sys/fs: nfs nfsclient
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 18:49:37 -0000

Author: rmacklem
Date: Fri Apr 29 18:49:36 2011
New Revision: 221219
URL: http://svn.freebsd.org/changeset/base/221219

Log:
  MFC: r220683
  Change the experimental NFS client so that it creates nfsiod
  threads in the same manner as the regular NFS client after
  r214026 was committed. This resolves the lors fixed by r214026
  and its predecessors for the regular client.

Modified:
  stable/8/sys/fs/nfs/nfs.h
  stable/8/sys/fs/nfsclient/nfs.h
  stable/8/sys/fs/nfsclient/nfs_clbio.c
  stable/8/sys/fs/nfsclient/nfs_clnfsiod.c
  stable/8/sys/fs/nfsclient/nfs_clsubs.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs.h
==============================================================================
--- stable/8/sys/fs/nfs/nfs.h	Fri Apr 29 18:41:21 2011	(r221218)
+++ stable/8/sys/fs/nfs/nfs.h	Fri Apr 29 18:49:36 2011	(r221219)
@@ -70,8 +70,9 @@
 #define	NFS_WSIZE	8192		/* Def. write data size <= 8192 */
 #define	NFS_RSIZE	8192		/* Def. read data size <= 8192 */
 #define	NFS_READDIRSIZE	8192		/* Def. readdir size */
-#define	NFS_DEFRAHEAD	0		/* Def. read ahead # blocks */
-#define	NFS_MAXRAHEAD	32		/* Max. read ahead # blocks */
+#define	NFS_DEFRAHEAD	1		/* Def. read ahead # blocks */
+#define	NFS_MAXRAHEAD	16		/* Max. read ahead # blocks */
+#define	NFS_MAXASYNCDAEMON 	64	/* Max. number async_daemons runnable */
 #define	NFS_MAXUIDHASH	64		/* Max. # of hashed uid entries/mp */
 #ifndef	NFSRV_LEASE
 #define	NFSRV_LEASE		120	/* Lease time in seconds for V4 */

Modified: stable/8/sys/fs/nfsclient/nfs.h
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs.h	Fri Apr 29 18:41:21 2011	(r221218)
+++ stable/8/sys/fs/nfsclient/nfs.h	Fri Apr 29 18:49:36 2011	(r221219)
@@ -102,7 +102,8 @@ int ncl_fsinfo(struct nfsmount *, struct
 int ncl_init(struct vfsconf *);
 int ncl_uninit(struct vfsconf *);
 int ncl_mountroot(struct mount *);
-int ncl_nfsiodnew(int);
+void	ncl_nfsiodnew(void);
+void	ncl_nfsiodnew_tq(__unused void *, int);
 
 #endif	/* _KERNEL */
 

Modified: stable/8/sys/fs/nfsclient/nfs_clbio.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clbio.c	Fri Apr 29 18:41:21 2011	(r221218)
+++ stable/8/sys/fs/nfsclient/nfs_clbio.c	Fri Apr 29 18:49:36 2011	(r221219)
@@ -63,8 +63,8 @@ extern int newnfs_directio_allow_mmap;
 extern struct nfsstats newnfsstats;
 extern struct mtx ncl_iod_mutex;
 extern int ncl_numasync;
-extern enum nfsiod_state ncl_iodwant[NFS_MAXRAHEAD];
-extern struct nfsmount *ncl_iodmount[NFS_MAXRAHEAD];
+extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON];
+extern struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON];
 extern int newnfs_directio_enable;
 
 int ncl_pbuf_freecnt = -1;	/* start out unlimited */
@@ -1359,15 +1359,6 @@ ncl_asyncio(struct nfsmount *nmp, struct
 	int error, error2;
 
 	/*
-	 * Unless iothreadcnt is set > 0, don't bother with async I/O
-	 * threads. For LAN environments, they don't buy any significant
-	 * performance improvement that you can't get with large block
-	 * sizes.
-	 */
-	if (nmp->nm_readahead == 0)
-		return (EPERM);
-
-	/*
 	 * Commits are usually short and sweet so lets save some cpu and
 	 * leave the async daemons for more important rpc's (such as reads
 	 * and writes).
@@ -1395,13 +1386,9 @@ again:
 	/*
 	 * Try to create one if none are free.
 	 */
-	if (!gotiod) {
-		iod = ncl_nfsiodnew(1);
-		if (iod != -1)
-			gotiod = TRUE;
-	}
-
-	if (gotiod) {
+	if (!gotiod)
+		ncl_nfsiodnew();
+	else {
 		/*
 		 * Found one, so wake it up and tell it which
 		 * mount to process.
@@ -1458,11 +1445,7 @@ again:
 			 * We might have lost our iod while sleeping,
 			 * so check and loop if nescessary.
 			 */
-			if (nmp->nm_bufqiods == 0) {
-				NFS_DPF(ASYNCIO,
-					("ncl_asyncio: no iods after mount %p queue was drained, looping\n", nmp));
-				goto again;
-			}
+			goto again;
 		}
 
 		/* We might have lost our nfsiod */

Modified: stable/8/sys/fs/nfsclient/nfs_clnfsiod.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clnfsiod.c	Fri Apr 29 18:41:21 2011	(r221218)
+++ stable/8/sys/fs/nfsclient/nfs_clnfsiod.c	Fri Apr 29 18:49:36 2011	(r221219)
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -68,28 +69,32 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-extern struct mtx ncl_iod_mutex;
+extern struct mtx	ncl_iod_mutex;
+extern struct task	ncl_nfsiodnew_task;
 
 int ncl_numasync;
-enum nfsiod_state ncl_iodwant[NFS_MAXRAHEAD];
-struct nfsmount *ncl_iodmount[NFS_MAXRAHEAD];
+enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON];
+struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON];
 
 static void	nfssvc_iod(void *);
 
-static int nfs_asyncdaemon[NFS_MAXRAHEAD];
+static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
 
 SYSCTL_DECL(_vfs_newnfs);
 
 /* Maximum number of seconds a nfsiod kthread will sleep before exiting */
-static unsigned int ncl_iodmaxidle = 120;
-SYSCTL_UINT(_vfs_newnfs, OID_AUTO, iodmaxidle, CTLFLAG_RW, &ncl_iodmaxidle, 0, "");
+static unsigned int nfs_iodmaxidle = 120;
+SYSCTL_UINT(_vfs_newnfs, OID_AUTO, iodmaxidle, CTLFLAG_RW, &nfs_iodmaxidle, 0,
+    "Max number of seconds an nfsiod kthread will sleep before exiting");
 
 /* Maximum number of nfsiod kthreads */
-unsigned int ncl_iodmax = NFS_MAXRAHEAD;
+unsigned int ncl_iodmax = 20;
 
 /* Minimum number of nfsiod kthreads to keep as spares */
 static unsigned int nfs_iodmin = 0;
 
+static int nfs_nfsiodnew_sync(void);
+
 static int
 sysctl_iodmin(SYSCTL_HANDLER_ARGS)
 {
@@ -113,14 +118,14 @@ sysctl_iodmin(SYSCTL_HANDLER_ARGS)
 	 * than the new minimum, create some more.
 	 */
 	for (i = nfs_iodmin - ncl_numasync; i > 0; i--)
-		ncl_nfsiodnew(0);
+		nfs_nfsiodnew_sync();
 out:
 	mtx_unlock(&ncl_iod_mutex);	
 	return (0);
 }
 SYSCTL_PROC(_vfs_newnfs, OID_AUTO, iodmin, CTLTYPE_UINT | CTLFLAG_RW, 0,
-    sizeof (nfs_iodmin), sysctl_iodmin, "IU", "");
-
+    sizeof (nfs_iodmin), sysctl_iodmin, "IU",
+    "Min number of nfsiod kthreads to keep as spares");
 
 static int
 sysctl_iodmax(SYSCTL_HANDLER_ARGS)
@@ -132,7 +137,7 @@ sysctl_iodmax(SYSCTL_HANDLER_ARGS)
 	error = sysctl_handle_int(oidp, &newmax, 0, req);
 	if (error || (req->newptr == NULL))
 		return (error);
-	if (newmax > NFS_MAXRAHEAD)
+	if (newmax > NFS_MAXASYNCDAEMON)
 		return (EINVAL);
 	mtx_lock(&ncl_iod_mutex);
 	ncl_iodmax = newmax;
@@ -155,64 +160,79 @@ out:
 	return (0);
 }
 SYSCTL_PROC(_vfs_newnfs, OID_AUTO, iodmax, CTLTYPE_UINT | CTLFLAG_RW, 0,
-    sizeof (ncl_iodmax), sysctl_iodmax, "IU", "");
+    sizeof (ncl_iodmax), sysctl_iodmax, "IU",
+    "Max number of nfsiod kthreads");
 
-int
-ncl_nfsiodnew(int set_iodwant)
+static int
+nfs_nfsiodnew_sync(void)
 {
 	int error, i;
-	int newiod;
 
-	if (ncl_numasync >= ncl_iodmax)
-		return (-1);
-	newiod = -1;
-	for (i = 0; i < ncl_iodmax; i++)
+	mtx_assert(&ncl_iod_mutex, MA_OWNED);
+	for (i = 0; i < ncl_iodmax; i++) {
 		if (nfs_asyncdaemon[i] == 0) {
-			nfs_asyncdaemon[i]++;
-			newiod = i;
+			nfs_asyncdaemon[i] = 1;
 			break;
 		}
-	if (newiod == -1)
-		return (-1);
-	if (set_iodwant > 0)
-		ncl_iodwant[i] = NFSIOD_CREATED_FOR_NFS_ASYNCIO;
+	}
+	if (i == ncl_iodmax)
+		return (0);
 	mtx_unlock(&ncl_iod_mutex);
-	error = kproc_create(nfssvc_iod, nfs_asyncdaemon + i, NULL, RFHIGHPID,
-	    0, "nfsiod %d", newiod);
+	error = kproc_create(nfssvc_iod, nfs_asyncdaemon + i, NULL,
+	    RFHIGHPID, 0, "newnfs %d", i);
+	mtx_lock(&ncl_iod_mutex);
+	if (error == 0) {
+		ncl_numasync++;
+		ncl_iodwant[i] = NFSIOD_AVAILABLE;
+	} else
+		nfs_asyncdaemon[i] = 0;
+	return (error);
+}
+
+void
+ncl_nfsiodnew_tq(__unused void *arg, int pending)
+{
+
 	mtx_lock(&ncl_iod_mutex);
-	if (error) {
-		if (set_iodwant > 0)
-			ncl_iodwant[i] = NFSIOD_NOT_AVAILABLE;
-		return (-1);
+	while (pending > 0) {
+		pending--;
+		nfs_nfsiodnew_sync();
 	}
-	ncl_numasync++;
-	return (newiod);
+	mtx_unlock(&ncl_iod_mutex);
+}
+
+void
+ncl_nfsiodnew(void)
+{
+
+	mtx_assert(&ncl_iod_mutex, MA_OWNED);
+	taskqueue_enqueue(taskqueue_thread, &ncl_nfsiodnew_task);
 }
 
 static void
 nfsiod_setup(void *dummy)
 {
-	int i;
 	int error;
 
 	TUNABLE_INT_FETCH("vfs.newnfs.iodmin", &nfs_iodmin);
 	nfscl_init();
 	mtx_lock(&ncl_iod_mutex);
 	/* Silently limit the start number of nfsiod's */
-	if (nfs_iodmin > NFS_MAXRAHEAD)
-		nfs_iodmin = NFS_MAXRAHEAD;
+	if (nfs_iodmin > NFS_MAXASYNCDAEMON)
+		nfs_iodmin = NFS_MAXASYNCDAEMON;
 
-	for (i = 0; i < nfs_iodmin; i++) {
-		error = ncl_nfsiodnew(0);
+	while (ncl_numasync < nfs_iodmin) {
+		error = nfs_nfsiodnew_sync();
 		if (error == -1)
-			panic("newnfsiod_setup: ncl_nfsiodnew failed");
+			panic("nfsiod_setup: nfs_nfsiodnew failed");
 	}
 	mtx_unlock(&ncl_iod_mutex);
 }
 SYSINIT(newnfsiod, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, nfsiod_setup, NULL);
 
 static int nfs_defect = 0;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0, "");
+SYSCTL_INT(_vfs_newnfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0,
+    "Allow nfsiods to migrate serving different mounts");
 
 /*
  * Asynchronous I/O daemons for client nfs.
@@ -245,7 +265,7 @@ nfssvc_iod(void *instance)
 		/*
 		 * Always keep at least nfs_iodmin kthreads.
 		 */
-		timo = (myiod < nfs_iodmin) ? 0 : ncl_iodmaxidle * hz;
+		timo = (myiod < nfs_iodmin) ? 0 : nfs_iodmaxidle * hz;
 		error = msleep(&ncl_iodwant[myiod], &ncl_iod_mutex, PWAIT | PCATCH,
 		    "-", timo);
 		if (error) {
@@ -263,7 +283,6 @@ nfssvc_iod(void *instance)
 	    if (error)
 		    break;
 	    while ((bp = TAILQ_FIRST(&nmp->nm_bufq)) != NULL) {
-		    
 		/* Take one off the front of the list */
 		TAILQ_REMOVE(&nmp->nm_bufq, bp, b_freelist);
 		nmp->nm_bufqlen--;

Modified: stable/8/sys/fs/nfsclient/nfs_clsubs.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clsubs.c	Fri Apr 29 18:41:21 2011	(r221218)
+++ stable/8/sys/fs/nfsclient/nfs_clsubs.c	Fri Apr 29 18:49:36 2011	(r221219)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -77,12 +78,14 @@ __FBSDID("$FreeBSD$");
 #include 
 
 extern struct mtx ncl_iod_mutex;
-extern enum nfsiod_state ncl_iodwant[NFS_MAXRAHEAD];
-extern struct nfsmount *ncl_iodmount[NFS_MAXRAHEAD];
+extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON];
+extern struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON];
 extern int ncl_numasync;
 extern unsigned int ncl_iodmax;
 extern struct nfsstats newnfsstats;
 
+struct task	ncl_nfsiodnew_task;
+
 int
 ncl_uninit(struct vfsconf *vfsp)
 {
@@ -393,10 +396,11 @@ ncl_init(struct vfsconf *vfsp)
 	int i;
 
 	/* Ensure async daemons disabled */
-	for (i = 0; i < NFS_MAXRAHEAD; i++) {
+	for (i = 0; i < NFS_MAXASYNCDAEMON; i++) {
 		ncl_iodwant[i] = NFSIOD_NOT_AVAILABLE;
 		ncl_iodmount[i] = NULL;
 	}
+	TASK_INIT(&ncl_nfsiodnew_task, 0, ncl_nfsiodnew_tq, NULL);
 	ncl_nhinit();			/* Init the nfsnode table */
 
 	return (0);

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 20:31:53 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 62575106566B;
	Fri, 29 Apr 2011 20:31:53 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 50EF08FC19;
	Fri, 29 Apr 2011 20:31:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3TKVrtL014193;
	Fri, 29 Apr 2011 20:31:53 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3TKVrhb014188;
	Fri, 29 Apr 2011 20:31:53 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201104292031.p3TKVrhb014188@svn.freebsd.org>
From: Doug Barton 
Date: Fri, 29 Apr 2011 20:31:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221221 - in stable/8/etc: . defaults rc.d
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 20:31:53 -0000

Author: dougb
Date: Fri Apr 29 20:31:52 2011
New Revision: 221221
URL: http://svn.freebsd.org/changeset/base/221221

Log:
  MFC r216744 for rc.d/devd:
  
  Add pidfile [1]
  
  While I'm here, don't run the sysctl frob unconditionally, and
  s/sysctl/$SYSCTL/
  
  MFC r220962:
  
  Introduce to rc.subr get_pidfile_from_conf(). It does just what it sounds
  like, determines the path to a pid file as it is specified in a conf file.
  
  Use the new feature for rc.d/named and rc.d/devd, the 2 services in the
  base that list their pid files in their conf files.
  
  Remove the now-obsolete named_pidfile, and warn users if they have it set.
  
  MFC r220963:
  
  Improve the error handling for the new get_pidfile_from_conf()

Modified:
  stable/8/etc/defaults/rc.conf
  stable/8/etc/rc.d/devd
  stable/8/etc/rc.d/named
  stable/8/etc/rc.subr
Directory Properties:
  stable/8/etc/   (props changed)

Modified: stable/8/etc/defaults/rc.conf
==============================================================================
--- stable/8/etc/defaults/rc.conf	Fri Apr 29 20:05:19 2011	(r221220)
+++ stable/8/etc/defaults/rc.conf	Fri Apr 29 20:31:52 2011	(r221221)
@@ -271,7 +271,6 @@ named_enable="NO"		# Run named, the DNS 
 named_program="/usr/sbin/named" # Path to named, if you want a different one.
 named_conf="/etc/namedb/named.conf" 	# Path to the configuration file
 #named_flags=""			# Use this for flags OTHER than -u and -c
-named_pidfile="/var/run/named/pid" # Must set this in named.conf as well
 named_uid="bind" 		# User to run named as
 named_chrootdir="/var/named"	# Chroot directory (or "" not to auto-chroot it)
 named_chroot_autoupdate="YES"	# Automatically install/update chrooted

Modified: stable/8/etc/rc.d/devd
==============================================================================
--- stable/8/etc/rc.d/devd	Fri Apr 29 20:05:19 2011	(r221220)
+++ stable/8/etc/rc.d/devd	Fri Apr 29 20:31:52 2011	(r221221)
@@ -14,10 +14,27 @@ name="devd"
 rcvar=`set_rcvar`
 command="/sbin/${name}"
 
+start_precmd=${name}_prestart
+stop_precmd=find_pidfile
+
+find_pidfile()
+{
+	if get_pidfile_from_conf pid-file /etc/devd.conf; then
+		pidfile="$_pidfile_from_conf"
+	else
+		pidfile="/var/run/${name}.pid"
+	fi
+}
+
+devd_prestart ()
+{
+	find_pidfile
+
+	# If devd is disabled, turn it off in the kernel to avoid memory leaks.
+	if ! checkyesno ${rcvar}; then
+	    $SYSCTL hw.bus.devctl_disable=1
+	fi
+}
+
 load_rc_config $name
 run_rc_command "$1"
-
-# If devd is disabled, turn it off in the kernel to avoid memory leaks.
-if ! checkyesno ${rcvar}; then
-    sysctl hw.bus.devctl_disable=1
-fi

Modified: stable/8/etc/rc.d/named
==============================================================================
--- stable/8/etc/rc.d/named	Fri Apr 29 20:05:19 2011	(r221220)
+++ stable/8/etc/rc.d/named	Fri Apr 29 20:31:52 2011	(r221221)
@@ -112,8 +112,19 @@ named_reload()
 	${command%/named}/rndc reload
 }
 
+find_pidfile()
+{
+	if get_pidfile_from_conf pid-file $named_conf; then
+		pidfile="$_pidfile_from_conf"
+	else
+		pidfile="/var/run/named/pid"
+	fi
+}
+
 named_stop()
 {
+	find_pidfile
+
 	# This duplicates an undesirably large amount of code from the stop
 	# routine in rc.subr in order to use rndc to shut down the process,
 	# and to give it a second chance in case rndc fails.
@@ -156,6 +167,12 @@ create_file () {
 
 named_prestart()
 {
+	find_pidfile
+
+	if [ -n "$named_pidfile" ]; then
+		warn 'named_pidfile: now determined from the conf file'
+	fi
+
 	command_args="-u ${named_uid:=root}"
 
 	if [ ! "$named_conf" = '/etc/namedb/named.conf' ]; then
@@ -279,7 +296,6 @@ load_rc_config $name
 #
 required_dirs="$named_chrootdir"	# if it is set, it must exist
 
-pidfile="${named_pidfile:-/var/run/named/pid}"
 named_confdir="${named_chrootdir}${named_conf%/*}"
 
 run_rc_command "$1"

Modified: stable/8/etc/rc.subr
==============================================================================
--- stable/8/etc/rc.subr	Fri Apr 29 20:05:19 2011	(r221220)
+++ stable/8/etc/rc.subr	Fri Apr 29 20:31:52 2011	(r221221)
@@ -384,6 +384,49 @@ wait_for_pids()
 }
 
 #
+# get_pidfile_from_conf string file
+#
+#	Takes a string to search for in the specified file.
+#	Ignores lines with traditional comment characters.
+#
+# Example:
+#
+# if get_pidfile_from_conf string file; then
+#	pidfile="$_pidfile_from_conf"
+# else
+#	pidfile='appropriate default'
+# fi
+#
+get_pidfile_from_conf()
+{
+	if [ -z "$1" -o -z "$2" ]; then
+		err 3 "USAGE: get_pidfile_from_conf string file ($name)"
+	fi
+
+	local string file line
+
+	string="$1" ; file="$2"
+
+	if [ ! -s "$file" ]; then
+		err 3 "get_pidfile_from_conf: $file does not exist ($name)"
+	fi
+
+	while read line; do
+		case "$line" in
+		*[#\;]*${string}*)	continue ;;
+		*${string}*)		break ;;
+		esac
+	done < $file
+
+	if [ -n "$line" ]; then
+		line=${line#*/}
+		_pidfile_from_conf="/${line%%[\"\;]*}"
+	else
+		return 1
+	fi
+}
+
+#
 # check_startmsgs
 #	If rc_quiet is set (usually as a result of using faststart at
 #	boot time) check if rc_startmsgs is enabled.

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 29 20:46:09 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6C597106564A;
	Fri, 29 Apr 2011 20:46:09 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5B85F8FC0C;
	Fri, 29 Apr 2011 20:46:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3TKk9C1014788;
	Fri, 29 Apr 2011 20:46:09 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3TKk9LV014786;
	Fri, 29 Apr 2011 20:46:09 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201104292046.p3TKk9LV014786@svn.freebsd.org>
From: Doug Barton 
Date: Fri, 29 Apr 2011 20:46:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221223 - stable/8/etc/rc.d
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 29 Apr 2011 20:46:09 -0000

Author: dougb
Date: Fri Apr 29 20:46:09 2011
New Revision: 221223
URL: http://svn.freebsd.org/changeset/base/221223

Log:
  MFC 221007:
  
  Create a function for the code from r192246 so that it can be used both
  times mount is called.
  
  Limit the automatic behavior to when AUTO is specified (as it is in
  etc/defaults/rc.conf) and for everything else take advantage of all
  of the goodness in checkyesno.

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

Modified: stable/8/etc/rc.d/tmp
==============================================================================
--- stable/8/etc/rc.d/tmp	Fri Apr 29 20:44:39 2011	(r221222)
+++ stable/8/etc/rc.d/tmp	Fri Apr 29 20:46:09 2011	(r221223)
@@ -37,20 +37,20 @@ stop_cmd=':'
 
 load_rc_config $name
 
+mount_tmpmfs ()
+{
+	if ! /bin/df /tmp | grep -q "^/dev/md[0-9]"; then
+		mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
+		chmod 01777 /tmp
+	fi
+}
+
 # If we do not have a writable /tmp, create a memory
 # filesystem for /tmp.  If /tmp is a symlink (e.g. to /var/tmp,
 # then it should already be writable).
 #
 case "${tmpmfs}" in
-[Yy][Ee][Ss])
-	if ! /bin/df /tmp | grep -q "^/dev/md[0-9]"; then
-		mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
-		chmod 01777 /tmp
-	fi
-	;;
-[Nn][Oo])
-	;;
-*)
+[Aa][Uu][Tt][Oo])
 	if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then
 		rmdir ${_tmpdir}
 	else
@@ -59,9 +59,13 @@ case "${tmpmfs}" in
 			echo "dropping into shell, ^D to continue anyway."
 			/bin/sh
 		else
-			mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
-			chmod 01777 /tmp
+			mount_tmpmfs
 		fi
 	fi
 	;;
+*)
+	if checkyesno tmpmfs; then
+		mount_tmpmfs
+	fi
+	;;
 esac

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 30 01:16:20 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 952CB106566B;
	Sat, 30 Apr 2011 01:16:20 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A8278FC08;
	Sat, 30 Apr 2011 01:16:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3U1GKku023399;
	Sat, 30 Apr 2011 01:16:20 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3U1GKM3023397;
	Sat, 30 Apr 2011 01:16:20 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201104300116.p3U1GKM3023397@svn.freebsd.org>
From: Rick Macklem 
Date: Sat, 30 Apr 2011 01:16:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221237 - stable/8/sys/fs/nfsclient
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 30 Apr 2011 01:16:20 -0000

Author: rmacklem
Date: Sat Apr 30 01:16:19 2011
New Revision: 221237
URL: http://svn.freebsd.org/changeset/base/221237

Log:
  MFC: r220731
  Add mutex locking on the nfs node in ncl_inactive() for the
  experimental NFS client.

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

Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clnode.c	Sat Apr 30 00:44:17 2011	(r221236)
+++ stable/8/sys/fs/nfsclient/nfs_clnode.c	Sat Apr 30 01:16:19 2011	(r221237)
@@ -202,12 +202,14 @@ ncl_inactive(struct vop_inactive_args *a
 		(void) nfsrpc_close(vp, 1, ap->a_td);
 	}
 
+	mtx_lock(&np->n_mtx);
 	if (vp->v_type != VDIR) {
 		sp = np->n_sillyrename;
 		np->n_sillyrename = NULL;
 	} else
 		sp = NULL;
 	if (sp) {
+		mtx_unlock(&np->n_mtx);
 		(void) ncl_vinvalbuf(vp, 0, ap->a_td, 1);
 		/*
 		 * Remove the silly file that was rename'd earlier
@@ -216,8 +218,10 @@ ncl_inactive(struct vop_inactive_args *a
 		crfree(sp->s_cred);
 		vrele(sp->s_dvp);
 		FREE((caddr_t)sp, M_NEWNFSREQ);
+		mtx_lock(&np->n_mtx);
 	}
 	np->n_flag &= NMODIFIED;
+	mtx_unlock(&np->n_mtx);
 	return (0);
 }
 

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 30 01:29:19 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E141106566B;
	Sat, 30 Apr 2011 01:29:19 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 408338FC13;
	Sat, 30 Apr 2011 01:29:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3U1TJR8023826;
	Sat, 30 Apr 2011 01:29:19 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3U1TJbL023818;
	Sat, 30 Apr 2011 01:29:19 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201104300129.p3U1TJbL023818@svn.freebsd.org>
From: Rick Macklem 
Date: Sat, 30 Apr 2011 01:29:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221238 - in stable/8/sys/fs: nfs nfsclient
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 30 Apr 2011 01:29:19 -0000

Author: rmacklem
Date: Sat Apr 30 01:29:18 2011
New Revision: 221238
URL: http://svn.freebsd.org/changeset/base/221238

Log:
  MFC: r220732
  Add a lktype flags argument to nfscl_nget() and ncl_nget() in the
  experimental NFS client so that its nfs_lookup() function can use
  cn_lkflags in a manner analagous to the regular NFS client.

Modified:
  stable/8/sys/fs/nfs/nfs_var.h
  stable/8/sys/fs/nfsclient/nfs_clnode.c
  stable/8/sys/fs/nfsclient/nfs_clport.c
  stable/8/sys/fs/nfsclient/nfs_clrpcops.c
  stable/8/sys/fs/nfsclient/nfs_clvfsops.c
  stable/8/sys/fs/nfsclient/nfs_clvnops.c
  stable/8/sys/fs/nfsclient/nfsnode.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs_var.h
==============================================================================
--- stable/8/sys/fs/nfs/nfs_var.h	Sat Apr 30 01:16:19 2011	(r221237)
+++ stable/8/sys/fs/nfs/nfs_var.h	Sat Apr 30 01:29:18 2011	(r221238)
@@ -487,7 +487,7 @@ void nfscl_cleanup(NFSPROC_T *);
 
 /* nfs_clport.c */
 int nfscl_nget(mount_t, vnode_t, struct nfsfh *,
-    struct componentname *, NFSPROC_T *, struct nfsnode **, void *);
+    struct componentname *, NFSPROC_T *, struct nfsnode **, void *, int);
 NFSPROC_T *nfscl_getparent(NFSPROC_T *);
 void nfscl_start_renewthread(struct nfsclclient *);
 void nfscl_loadsbinfo(struct nfsmount *, struct nfsstatfs *, void *);

Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clnode.c	Sat Apr 30 01:16:19 2011	(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clnode.c	Sat Apr 30 01:29:18 2011	(r221238)
@@ -86,7 +86,8 @@ ncl_nhuninit(void)
  * nfsnode structure is returned.
  */
 int
-ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp)
+ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp,
+    int lkflags)
 {
 	struct thread *td = curthread;	/* XXX */
 	struct nfsnode *np;
@@ -106,7 +107,7 @@ ncl_nget(struct mount *mntp, u_int8_t *f
 	    M_NFSFH, M_WAITOK);
 	bcopy(fhp, &nfhp->nfh_fh[0], fhsize);
 	nfhp->nfh_len = fhsize;
-	error = vfs_hash_get(mntp, hash, LK_EXCLUSIVE,
+	error = vfs_hash_get(mntp, hash, lkflags,
 	    td, &nvp, newnfs_vncmpf, nfhp);
 	FREE(nfhp, M_NFSFH);
 	if (error)
@@ -168,7 +169,7 @@ ncl_nget(struct mount *mntp, u_int8_t *f
 		uma_zfree(newnfsnode_zone, np);
 		return (error);
 	}
-	error = vfs_hash_insert(vp, hash, LK_EXCLUSIVE, 
+	error = vfs_hash_insert(vp, hash, lkflags, 
 	    td, &nvp, newnfs_vncmpf, np->n_fhp);
 	if (error)
 		return (error);

Modified: stable/8/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clport.c	Sat Apr 30 01:16:19 2011	(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c	Sat Apr 30 01:29:18 2011	(r221238)
@@ -85,7 +85,7 @@ newnfs_vncmpf(struct vnode *vp, void *ar
 int
 nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp,
     struct componentname *cnp, struct thread *td, struct nfsnode **npp,
-    void *stuff)
+    void *stuff, int lkflags)
 {
 	struct nfsnode *np, *dnp;
 	struct vnode *vp, *nvp;
@@ -100,7 +100,7 @@ nfscl_nget(struct mount *mntp, struct vn
 
 	hash = fnv_32_buf(nfhp->nfh_fh, nfhp->nfh_len, FNV1_32_INIT);
 
-	error = vfs_hash_get(mntp, hash, LK_EXCLUSIVE,
+	error = vfs_hash_get(mntp, hash, lkflags,
 	    td, &nvp, newnfs_vncmpf, nfhp);
 	if (error == 0 && nvp != NULL) {
 		/*
@@ -244,7 +244,7 @@ nfscl_nget(struct mount *mntp, struct vn
 		uma_zfree(newnfsnode_zone, np);
 		return (error);
 	}
-	error = vfs_hash_insert(vp, hash, LK_EXCLUSIVE, 
+	error = vfs_hash_insert(vp, hash, lkflags, 
 	    td, &nvp, newnfs_vncmpf, nfhp);
 	if (error)
 		return (error);

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Sat Apr 30 01:16:19 2011	(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Sat Apr 30 01:29:18 2011	(r221238)
@@ -3271,7 +3271,7 @@ nfsrpc_readdirplus(vnode_t vp, struct ui
 				    np = dnp;
 				} else {
 				    error = nfscl_nget(vnode_mount(vp), vp,
-				      nfhp, cnp, p, &np, NULL);
+				      nfhp, cnp, p, &np, NULL, LK_EXCLUSIVE);
 				    if (!error) {
 					newvp = NFSTOV(np);
 					unlocknewvp = 1;

Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvfsops.c	Sat Apr 30 01:16:19 2011	(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c	Sat Apr 30 01:29:18 2011	(r221238)
@@ -271,7 +271,7 @@ nfs_statfs(struct mount *mp, struct stat
 	error = vfs_busy(mp, MBF_NOWAIT);
 	if (error)
 		return (error);
-	error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
+	error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np, LK_EXCLUSIVE);
 	if (error) {
 		vfs_unbusy(mp);
 		return (error);
@@ -1219,7 +1219,8 @@ mountnfs(struct nfs_args *argp, struct m
 		 * by nfs_statfs() before any I/O occurs.
 		 */
 		mp->mnt_stat.f_iosize = NFS_DIRBLKSIZ;
-		error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
+		error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np,
+		    LK_EXCLUSIVE);
 		if (error)
 			goto bad;
 		*vpp = NFSTOV(np);
@@ -1334,7 +1335,7 @@ nfs_root(struct mount *mp, int flags, st
 	int error;
 
 	nmp = VFSTONFS(mp);
-	error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
+	error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np, flags);
 	if (error)
 		return error;
 	vp = NFSTOV(np);

Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvnops.c	Sat Apr 30 01:16:19 2011	(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clvnops.c	Sat Apr 30 01:29:18 2011	(r221238)
@@ -1156,7 +1156,8 @@ nfs_lookup(struct vop_lookup_args *ap)
 			FREE((caddr_t)nfhp, M_NFSFH);
 			return (EISDIR);
 		}
-		error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL);
+		error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
+		    LK_EXCLUSIVE);
 		if (error)
 			return (error);
 		newvp = NFSTOV(np);
@@ -1185,7 +1186,8 @@ nfs_lookup(struct vop_lookup_args *ap)
 				return (error);
 		}
 		VOP_UNLOCK(dvp, 0);
-		error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL);
+		error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
+		    cnp->cn_lkflags);
 		if (error == 0)
 			newvp = NFSTOV(np);
 		vfs_unbusy(mp);
@@ -1213,7 +1215,8 @@ nfs_lookup(struct vop_lookup_args *ap)
 			(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
 			    0, 1);
 	} else {
-		error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL);
+		error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
+		    cnp->cn_lkflags);
 		if (error)
 			return (error);
 		newvp = NFSTOV(np);
@@ -1395,7 +1398,7 @@ nfs_mknodrpc(struct vnode *dvp, struct v
 			    NULL);
 		if (nfhp)
 			error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
-			    cnp->cn_thread, &np, NULL);
+			    cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
 	}
 	if (dattrflag)
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
@@ -1497,7 +1500,7 @@ again:
 			    NULL);
 		if (nfhp != NULL)
 			error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
-			    cnp->cn_thread, &np, NULL);
+			    cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
 	}
 	if (dattrflag)
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
@@ -1920,7 +1923,7 @@ nfs_symlink(struct vop_symlink_args *ap)
 	    &nfsva, &nfhp, &attrflag, &dattrflag, NULL);
 	if (nfhp) {
 		ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
-		    &np, NULL);
+		    &np, NULL, LK_EXCLUSIVE);
 		if (!ret)
 			newvp = NFSTOV(np);
 		else if (!error)
@@ -2003,7 +2006,7 @@ nfs_mkdir(struct vop_mkdir_args *ap)
 		dnp->n_attrstamp = 0;
 	if (nfhp) {
 		ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
-		    &np, NULL);
+		    &np, NULL, LK_EXCLUSIVE);
 		if (!ret) {
 			newvp = NFSTOV(np);
 			if (attrflag)
@@ -2378,7 +2381,7 @@ printf("replace=%s\n",nnn);
 		    cn.cn_nameptr = name;
 		    cn.cn_namelen = len;
 		    error = nfscl_nget(dvp->v_mount, dvp, nfhp, &cn, td,
-			&np, NULL);
+			&np, NULL, LK_EXCLUSIVE);
 		    if (error)
 			return (error);
 		    newvp = NFSTOV(np);

Modified: stable/8/sys/fs/nfsclient/nfsnode.h
==============================================================================
--- stable/8/sys/fs/nfsclient/nfsnode.h	Sat Apr 30 01:16:19 2011	(r221237)
+++ stable/8/sys/fs/nfsclient/nfsnode.h	Sat Apr 30 01:29:18 2011	(r221238)
@@ -186,7 +186,7 @@ int	ncl_reclaim(struct vop_reclaim_args 
 
 /* other stuff */
 int	ncl_removeit(struct sillyrename *, struct vnode *);
-int	ncl_nget(struct mount *, u_int8_t *, int, struct nfsnode **);
+int	ncl_nget(struct mount *, u_int8_t *, int, struct nfsnode **, int);
 nfsuint64 *ncl_getcookie(struct nfsnode *, off_t, int);
 void	ncl_invaldir(struct vnode *);
 int	ncl_upgrade_vnlock(struct vnode *);

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 30 05:28:55 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E2B8106567E;
	Sat, 30 Apr 2011 05:28:55 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4E6878FC19;
	Sat, 30 Apr 2011 05:28:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3U5StZe031261;
	Sat, 30 Apr 2011 05:28:55 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3U5StZN031259;
	Sat, 30 Apr 2011 05:28:55 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201104300528.p3U5StZN031259@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Sat, 30 Apr 2011 05:28:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221242 -
	stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 30 Apr 2011 05:28:55 -0000

Author: marcel
Date: Sat Apr 30 05:28:54 2011
New Revision: 221242
URL: http://svn.freebsd.org/changeset/base/221242

Log:
  Unbreak non-x86 and in particular ia64, The default stack size
  on ia64 is 32KB. Unconditionally hardcoding a 16KB stack for
  reasons of increasing the stack size on i386 is just wrong. If
  the size was indeed expressed in terms of pages, as the commit
  log suggested, then it would happen to be just right for ia64,
  though only accidentally.
  
  Pointy hat: avg, pjd

Modified:
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c

Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c
==============================================================================
--- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c	Sat Apr 30 02:44:15 2011	(r221241)
+++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c	Sat Apr 30 05:28:54 2011	(r221242)
@@ -129,6 +129,7 @@ void
 txg_sync_start(dsl_pool_t *dp)
 {
 	tx_state_t *tx = &dp->dp_tx;
+	size_t stksize = 0;
 
 	mutex_enter(&tx->tx_sync_lock);
 
@@ -146,7 +147,10 @@ txg_sync_start(dsl_pool_t *dp)
 	 * 32-bit x86.  This is due in part to nested pools and
 	 * scrub_visitbp() recursion.
 	 */
-	tx->tx_sync_thread = thread_create(NULL, 16<<10, txg_sync_thread,
+#ifdef __i386__
+	stksize = 16 << 10;
+#endif
+	tx->tx_sync_thread = thread_create(NULL, stksize, txg_sync_thread,
 	    dp, 0, &p0, TS_RUN, minclsyspri);
 
 	mutex_exit(&tx->tx_sync_lock);

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 30 22:07:05 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F52D106566C;
	Sat, 30 Apr 2011 22:07:05 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 27B0C8FC0A;
	Sat, 30 Apr 2011 22:07:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3UM75Lw064163;
	Sat, 30 Apr 2011 22:07:05 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3UM74JH064153;
	Sat, 30 Apr 2011 22:07:04 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201104302207.p3UM74JH064153@svn.freebsd.org>
From: Martin Matuska 
Date: Sat, 30 Apr 2011 22:07:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221274 - in stable/8: contrib/gcc
	contrib/gcc/config/i386 contrib/gcc/config/mips
	contrib/gcc/config/rs6000 contrib/gcc/config/s390
	contrib/gcc/cp contrib/gcc/doc contrib/libstdc++ con...
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 30 Apr 2011 22:07:05 -0000

Author: mm
Date: Sat Apr 30 22:07:04 2011
New Revision: 221274
URL: http://svn.freebsd.org/changeset/base/221274

Log:
  MFC 219374, 219376, 219639, 219640, 219697, 219711, 220150:
  
  MFC r219374:
  Backport Intel Core 2 and AMD Geode CPU types from gcc-4.3 (GPLv2)
  These options are supported in this shape in all newer GCC versions.
  
  Source:	gcc-4_3-branch (rev. 118090, 118973, 120846; GPLv2)
  
  MFC r219376:
  Add AMD Geode CPU type to bsd.cpu.mk and examples/etc/make.conf
  For CPUTYPE=core2 use -march=core2
  
  MFC r219639:
  Backport SSSE3 instruction set support to base gcc.
  Enabled by default for -march=core2
  
  Source:	gcc-4_3-branch (rev. 117958, 121687, 121726, 123639; GPLv2)
  
  MFC r219640:
  Add ssse3 capability for CPUTYPE=core2 to MACHINE_CPU in bsd.cpu.mk
  
  MFC r219697:
  Fix -march/-mtune=native autodetection for Intel Core 2 CPUs
  
  Source:	gcc-4_3-branch (partial rev. 119454; GPLv2)
  
  MFC r219711:
  Backport missing tunings for -march=core2:
  - enable extra 80387 mathematical constants (ext_80387_constants)
  - enable compare and exchange 16 bytes (cmpxchg16b)
  
  Verified against llvm-gcc (and apple gcc)
  Source:	gcc-4_3-branch (ref. svn revs. 119260, 121140; GPLv2)
  
  MFC r220150:
  Upgrade of base gcc and libstdc++ to the last GPLv2-licensed revision
  (rev. 127959 of gcc-4_2-branch).
  
  Resolved GCC bugs:
  	c++: 17763, 29365, 30535, 30917, 31337, 31941, 32108, 32112, 32346,
  	     32898, 32992
  	debug: 32610, 32914
  	libstdc++: 33084, 33128
  	middle-end: 32563
  	rtl-optimization: 33148
  	tree-optimization: 25413, 32723
  	target: 32218
  
  Source:	gcc-4_2-branch (up to rev. 127959)
  
  Obtained from:	gcc (var. revs of gcc-4_2-branch and gcc-4_3-branch; GPLv2)
  PR:		gnu/153298, gnu/153959, gnu/154385, gnu/155308

Added:
  stable/8/contrib/gcc/config/i386/geode.md
     - copied unchanged from r219374, head/contrib/gcc/config/i386/geode.md
  stable/8/contrib/gcc/config/i386/tmmintrin.h
     - copied unchanged from r219639, head/contrib/gcc/config/i386/tmmintrin.h
Modified:
  stable/8/contrib/gcc/BASE-VER
  stable/8/contrib/gcc/ChangeLog
  stable/8/contrib/gcc/DATESTAMP
  stable/8/contrib/gcc/DEV-PHASE
  stable/8/contrib/gcc/config.gcc
  stable/8/contrib/gcc/config/i386/driver-i386.c
  stable/8/contrib/gcc/config/i386/i386.c
  stable/8/contrib/gcc/config/i386/i386.h
  stable/8/contrib/gcc/config/i386/i386.md
  stable/8/contrib/gcc/config/i386/i386.opt
  stable/8/contrib/gcc/config/i386/sse.md
  stable/8/contrib/gcc/config/i386/xmmintrin.h
  stable/8/contrib/gcc/config/mips/predicates.md
  stable/8/contrib/gcc/config/rs6000/rs6000.c
  stable/8/contrib/gcc/config/s390/s390.md
  stable/8/contrib/gcc/cp/ChangeLog
  stable/8/contrib/gcc/cp/call.c
  stable/8/contrib/gcc/cp/cp-tree.h
  stable/8/contrib/gcc/cp/cxx-pretty-print.c
  stable/8/contrib/gcc/cp/decl.c
  stable/8/contrib/gcc/cp/decl2.c
  stable/8/contrib/gcc/cp/error.c
  stable/8/contrib/gcc/cp/lex.c
  stable/8/contrib/gcc/cp/name-lookup.c
  stable/8/contrib/gcc/cp/pt.c
  stable/8/contrib/gcc/cp/semantics.c
  stable/8/contrib/gcc/cp/typeck.c
  stable/8/contrib/gcc/doc/contrib.texi
  stable/8/contrib/gcc/doc/extend.texi
  stable/8/contrib/gcc/doc/gcc.1
  stable/8/contrib/gcc/doc/invoke.texi
  stable/8/contrib/gcc/dwarf2out.c
  stable/8/contrib/gcc/expr.c
  stable/8/contrib/gcc/fold-const.c
  stable/8/contrib/gcc/gimplify.c
  stable/8/contrib/gcc/reload1.c
  stable/8/contrib/gcc/simplify-rtx.c
  stable/8/contrib/gcc/target-def.h
  stable/8/contrib/gcc/target.h
  stable/8/contrib/gcc/targhooks.c
  stable/8/contrib/gcc/targhooks.h
  stable/8/contrib/gcc/tree-if-conv.c
  stable/8/contrib/gcc/tree-ssa-structalias.c
  stable/8/contrib/gcc/tree-vect-analyze.c
  stable/8/contrib/gcc/tree-vect-patterns.c
  stable/8/contrib/gcc/tree.c
  stable/8/contrib/gcc/tree.h
  stable/8/contrib/libstdc++/ChangeLog
  stable/8/contrib/libstdc++/include/std/std_valarray.h
  stable/8/contrib/libstdc++/include/tr1/random
  stable/8/share/examples/etc/make.conf
  stable/8/share/mk/bsd.cpu.mk
Directory Properties:
  stable/8/contrib/gcc/   (props changed)
  stable/8/contrib/libstdc++/   (props changed)
  stable/8/share/examples/   (props changed)
  stable/8/share/examples/cvsup/   (props changed)
  stable/8/share/mk/   (props changed)

Modified: stable/8/contrib/gcc/BASE-VER
==============================================================================
--- stable/8/contrib/gcc/BASE-VER	Sat Apr 30 21:55:08 2011	(r221273)
+++ stable/8/contrib/gcc/BASE-VER	Sat Apr 30 22:07:04 2011	(r221274)
@@ -1 +1 @@
-4.2.1
+4.2.2

Modified: stable/8/contrib/gcc/ChangeLog
==============================================================================
--- stable/8/contrib/gcc/ChangeLog	Sat Apr 30 21:55:08 2011	(r221273)
+++ stable/8/contrib/gcc/ChangeLog	Sat Apr 30 22:07:04 2011	(r221274)
@@ -1,3 +1,121 @@
+2007-08-31  Jakub Jelinek  
+
+	PR rtl-optimization/33148
+	* simplify-rtx.c (simplify_unary_operation_1): Only optimize
+	(neg (lt X 0)) if X has scalar int mode.
+
+	PR debug/32914
+	* dwarf2out.c (rtl_for_decl_init): If vector decl has CONSTRUCTOR
+	initializer, use build_vector_from_ctor if possible to create
+	VECTOR_CST out of it.  If vector initializer is not VECTOR_CST
+	even after this, return NULL.
+
+2007-08-27  Jason Merrill  
+
+	PR c++/31337
+	* gimplify.c (gimplify_modify_expr): Discard the assignment of 
+	zero-sized types after calling gimplify_modify_expr_rhs.
+
+2007-08-24  Jakub Jelinek  
+
+	PR debug/32610
+	* dwarf2out.c (gen_decl_die): Don't call
+	gen_tagged_type_instantiation_die if decl doesn't have tagged type.
+
+2007-08-24  Richard Guenther  
+
+	* expr.c (get_inner_reference): Remove unused variable.
+
+2007-08-24  Richard Guenther  
+
+	* expr.c (get_inner_reference): Do computation of bitoffset
+	from offset in a way we can detect overflow reliably.
+
+2007-08-22  Richard Guenther  
+
+	PR middle-end/32563
+	* tree.c (host_integerp): Treat sizetype as signed as it is
+	sign-extended.
+
+2007-08-20  Adam Nemet  
+
+	* config/mips/predicates.md (const_call_insn_operand): Invoke
+	SYMBOL_REF_LONG_CALL_P only on SYMBOL_REFs.
+
+2007-08-17  Chen liqin  
+
+        * config/score/score.md : Update pattern tablejump.
+        * config/score/score.c : Update score_initialize_trampoline 
+        function.
+        * config/score/score.h (TRAMPOLINE_TEMPLATE): Added macro.
+        (TRAMPOLINE_INSNS, TRAMPOLINE_SIZE) Update macro.
+        * doc/contrib.texi: Add my entry.
+
+2007-08-02  Andreas Krebbel  
+
+	* config/s390/s390.md ("*xordi3_cconly"): Change xr to xg.
+
+2007-08-01  Andreas Krebbel  
+
+	* config/s390/s390.md (TF in GPR splitter): Change operand_subword
+	parameter to TFmode.
+
+2007-07-30  Mark Mitchell  
+
+	* BASE-VER: Bump.
+	* DEV-PHASE: Mark as prerelease.
+
+2007-07-25  Steve Ellcey  
+
+	PR target/32218
+	* tree-vect-patterns.c (vect_pattern_recog_1): Check for valid type.
+
+2007-07-25  Dorit Nuzman  
+	    Devang Patel  
+
+	PR tree-optimization/25413
+	* targhooks.c (default_builtin_vector_alignment_reachable): New.
+	* targhooks.h (default_builtin_vector_alignment_reachable): New.
+	* tree.h (contains_packed_reference): New.
+	* expr.c (contains_packed_reference): New.
+	* tree-vect-analyze.c (vector_alignment_reachable_p): New.
+	(vect_enhance_data_refs_alignment): Call
+	vector_alignment_reachable_p.
+	* target.h (vector_alignment_reachable): New builtin.
+	* target-def.h (TARGET_VECTOR_ALIGNMENT_REACHABLE): New.
+	* config/rs6000/rs6000.c (rs6000_vector_alignment_reachable): New.
+	(TARGET_VECTOR_ALIGNMENT_REACHABLE): Define.
+
+2007-07-24  Richard Guenther  
+
+	Backport from mainline:
+	2007-07-16  Richard Guenther  
+		    Uros Bizjak  
+
+	* tree-if-conv.c (find_phi_replacement_condition): Unshare "*cond"
+	before forcing it to gimple operand.
+
+2007-07-24  Richard Guenther  
+
+	PR tree-optimization/32723
+	Backport from mainline:
+	2007-03-09  Daniel Berlin  
+
+        * tree-ssa-structalias.c (shared_bitmap_info_t): New structure.
+        (shared_bitmap_table): New variable.
+        (shared_bitmap_hash): New function.
+        (shared_bitmap_eq): Ditto
+        (shared_bitmap_lookup): Ditto.
+        (shared_bitmap_add): Ditto.
+        (find_what_p_points_to): Rewrite to use shared bitmap hashtable.
+        (init_alias_vars): Init shared bitmap hashtable.
+        (delete_points_to_sets): Delete shared bitmap hashtable.
+
+2007-07-23  Bernd Schmidt  
+
+	* reload1.c (choose_reload_regs): Set reload_spill_index for regs
+	chosen during find_reloads.
+
 2007-07-19  Release Manager
 
 	* GCC 4.2.1 released.

Modified: stable/8/contrib/gcc/DATESTAMP
==============================================================================
--- stable/8/contrib/gcc/DATESTAMP	Sat Apr 30 21:55:08 2011	(r221273)
+++ stable/8/contrib/gcc/DATESTAMP	Sat Apr 30 22:07:04 2011	(r221274)
@@ -1 +1 @@
-20070719
+20070831

Modified: stable/8/contrib/gcc/DEV-PHASE
==============================================================================
--- stable/8/contrib/gcc/DEV-PHASE	Sat Apr 30 21:55:08 2011	(r221273)
+++ stable/8/contrib/gcc/DEV-PHASE	Sat Apr 30 22:07:04 2011	(r221274)
@@ -0,0 +1 @@
+prerelease

Modified: stable/8/contrib/gcc/config.gcc
==============================================================================
--- stable/8/contrib/gcc/config.gcc	Sat Apr 30 21:55:08 2011	(r221273)
+++ stable/8/contrib/gcc/config.gcc	Sat Apr 30 22:07:04 2011	(r221274)
@@ -268,11 +268,13 @@ xscale-*-*)
 	;;
 i[34567]86-*-*)
 	cpu_type=i386
-	extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h pmmintrin.h"
+	extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h
+		       pmmintrin.h tmmintrin.h"
 	;;
 x86_64-*-*)
 	cpu_type=i386
-	extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h pmmintrin.h"
+	extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h
+		       pmmintrin.h tmmintrin.h"
 	need_64bit_hwint=yes
 	;;
 ia64-*-*)
@@ -1207,14 +1209,14 @@ i[34567]86-*-solaris2*)
 		# FIXME: -m64 for i[34567]86-*-* should be allowed just
 		# like -m32 for x86_64-*-*.
 		case X"${with_cpu}" in
-		Xgeneric|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx)
+		Xgeneric|Xcore2|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx)
 			;;
 		X)
 			with_cpu=generic
 			;;
 		*)
 			echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
-			echo "generic nocona x86-64 k8 opteron athlon64 athlon-fx" 1>&2
+			echo "generic core2 nocona x86-64 k8 opteron athlon64 athlon-fx" 1>&2
 			exit 1
 			;;
 		esac
@@ -2537,6 +2539,9 @@ if test x$with_cpu = x ; then
         nocona-*)
           with_cpu=nocona
           ;;
+	core2-*)
+	  with_cpu=core2
+	  ;;
         pentium_m-*)
           with_cpu=pentium-m
           ;;
@@ -2556,6 +2561,9 @@ if test x$with_cpu = x ; then
         nocona-*)
           with_cpu=nocona
           ;;
+	core2-*)
+	  with_cpu=core2
+	  ;;
         *)
           with_cpu=generic
           ;;
@@ -2787,7 +2795,7 @@ case "${target}" in
 				esac
 				# OK
 				;;
-			"" | k8 | opteron | athlon64 | athlon-fx | nocona | generic)
+			"" | k8 | opteron | athlon64 | athlon-fx | nocona | core2 | generic)
 				# OK
 				;;
 			*)

Modified: stable/8/contrib/gcc/config/i386/driver-i386.c
==============================================================================
--- stable/8/contrib/gcc/config/i386/driver-i386.c	Sat Apr 30 21:55:08 2011	(r221273)
+++ stable/8/contrib/gcc/config/i386/driver-i386.c	Sat Apr 30 22:07:04 2011	(r221274)
@@ -39,6 +39,7 @@ const char *host_detect_local_cpu (int a
 #define bit_SSE2 (1 << 26)
 
 #define bit_SSE3 (1 << 0)
+#define bit_SSSE3 (1 << 9)
 #define bit_CMPXCHG16B (1 << 13)
 
 #define bit_3DNOW (1 << 31)
@@ -66,7 +67,7 @@ const char *host_detect_local_cpu (int a
   unsigned int vendor;
   unsigned int ext_level;
   unsigned char has_mmx = 0, has_3dnow = 0, has_3dnowp = 0, has_sse = 0;
-  unsigned char has_sse2 = 0, has_sse3 = 0, has_cmov = 0;
+  unsigned char has_sse2 = 0, has_sse3 = 0, has_ssse3 = 0, has_cmov = 0;
   unsigned char has_longmode = 0, has_cmpxchg8b = 0;
   unsigned char is_amd = 0;
   unsigned int family = 0;
@@ -107,6 +108,7 @@ const char *host_detect_local_cpu (int a
   has_sse = !!(edx & bit_SSE);
   has_sse2 = !!(edx & bit_SSE2);
   has_sse3 = !!(ecx & bit_SSE3);
+  has_ssse3 = !!(ecx & bit_SSSE3);
   /* We don't care for extended family.  */
   family = (eax >> 8) & ~(1 << 4);
 
@@ -148,7 +150,9 @@ const char *host_detect_local_cpu (int a
 	  /* We have no idea.  Use something reasonable.  */
 	  if (arch)
 	    {
-	      if (has_sse3)
+	      if (has_ssse3)
+		cpu = "core2";
+	      else if (has_sse3)
 		{
 		  if (has_longmode)
 		    cpu = "nocona";
@@ -230,6 +234,9 @@ const char *host_detect_local_cpu (int a
 	  cpu = "generic";
 	}
       break;
+    case PROCESSOR_GEODE:
+      cpu = "geode";
+      break;
     case PROCESSOR_K6:
       if (has_3dnow)
         cpu = "k6-3";

Copied: stable/8/contrib/gcc/config/i386/geode.md (from r219374, head/contrib/gcc/config/i386/geode.md)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/contrib/gcc/config/i386/geode.md	Sat Apr 30 22:07:04 2011	(r221274, copy of r219374, head/contrib/gcc/config/i386/geode.md)
@@ -0,0 +1,153 @@
+;; Geode Scheduling
+;; Copyright (C) 2006
+;; Free Software Foundation, Inc.
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GCC is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING.  If not, write to
+;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+;;
+;; The Geode architecture is one insn issue processor.
+;;
+;; This description is based on data from the following documents:
+;;
+;;    "AMD Geode GX Processor Data Book"
+;;    Advanced Micro Devices, Inc., Aug 2005.
+;;
+;;    "AMD Geode LX Processor Data Book"
+;;    Advanced Micro Devices, Inc., Jan 2006.
+;;
+;;
+;; CPU execution units of the Geode:
+;;
+;; issue	describes the issue pipeline.
+;; alu		describes the Integer unit
+;; fpu		describes the FP unit
+;;
+;; The fp unit is out of order execution unit with register renaming.
+;; There is also memory management unit and execution pipeline for
+;; load/store operations.  We ignore it and difference between insns
+;; using memory and registers.
+
+(define_automaton "geode")
+
+(define_cpu_unit "geode_issue,geode_alu,geode_fpu" "geode")
+
+(define_insn_reservation "alu" 1
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "alu,alu1,negnot,icmp,lea,test,imov,imovx,icmov,incdec,setcc"))
+			 "geode_issue,geode_alu")
+
+(define_insn_reservation "shift" 2
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "ishift,ishift1,rotate,rotate1,cld"))
+			 "geode_issue,geode_alu*2")
+
+(define_insn_reservation "imul" 7
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "imul"))
+			 "geode_issue,geode_alu*7")
+
+(define_insn_reservation "idiv" 40
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "idiv"))
+			 "geode_issue,geode_alu*40")
+
+;; The branch unit.
+(define_insn_reservation "call" 2
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "call,callv"))
+			 "geode_issue,geode_alu*2")
+
+(define_insn_reservation "geode_branch" 1
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "ibr"))
+			 "geode_issue,geode_alu")
+
+(define_insn_reservation "geode_pop_push" 1
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "pop,push"))
+			 "geode_issue,geode_alu")
+
+(define_insn_reservation "geode_leave" 2
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "leave"))
+			 "geode_issue,geode_alu*2")
+
+(define_insn_reservation "geode_load_str" 4
+			 (and (eq_attr "cpu" "geode")
+			      (and (eq_attr "type" "str")
+				   (eq_attr "memory" "load,both")))
+			 "geode_issue,geode_alu*4")
+
+(define_insn_reservation "geode_store_str" 2
+			 (and (eq_attr "cpu" "geode")
+			      (and (eq_attr "type" "str")
+				   (eq_attr "memory" "store")))
+			 "geode_issue,geode_alu*2")
+
+;; Be optimistic
+(define_insn_reservation "geode_unknown" 1
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "multi,other"))
+			 "geode_issue,geode_alu")
+
+;; FPU
+
+(define_insn_reservation "geode_fop" 6
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "fop,fcmp"))
+			 "geode_issue,geode_fpu*6")
+
+(define_insn_reservation "geode_fsimple" 1
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "fmov,fcmov,fsgn,fxch"))
+			 "geode_issue,geode_fpu")
+
+(define_insn_reservation "geode_fist" 4
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "fistp,fisttp"))
+			 "geode_issue,geode_fpu*4")
+
+(define_insn_reservation "geode_fmul" 10
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "fmul"))
+			 "geode_issue,geode_fpu*10")
+
+(define_insn_reservation "geode_fdiv" 47
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "fdiv"))
+			 "geode_issue,geode_fpu*47")
+
+;; We use minimal latency (fsin) here
+(define_insn_reservation "geode_fpspc" 54
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "fpspc"))
+			 "geode_issue,geode_fpu*54")
+
+(define_insn_reservation "geode_frndint" 12
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "frndint"))
+			 "geode_issue,geode_fpu*12")
+
+(define_insn_reservation "geode_mmxmov" 1
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "mmxmov"))
+			 "geode_issue,geode_fpu")
+
+(define_insn_reservation "geode_mmx" 2
+			 (and (eq_attr "cpu" "geode")
+			      (eq_attr "type" "mmx,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"))
+			 "geode_issue,geode_fpu*2")

Modified: stable/8/contrib/gcc/config/i386/i386.c
==============================================================================
--- stable/8/contrib/gcc/config/i386/i386.c	Sat Apr 30 21:55:08 2011	(r221273)
+++ stable/8/contrib/gcc/config/i386/i386.c	Sat Apr 30 22:07:04 2011	(r221274)
@@ -336,6 +336,60 @@ struct processor_costs pentiumpro_cost =
 };
 
 static const
+struct processor_costs geode_cost = {
+  COSTS_N_INSNS (1),			/* cost of an add instruction */
+  COSTS_N_INSNS (1),			/* cost of a lea instruction */
+  COSTS_N_INSNS (2),			/* variable shift costs */
+  COSTS_N_INSNS (1),			/* constant shift costs */
+  {COSTS_N_INSNS (3),			/* cost of starting multiply for QI */
+   COSTS_N_INSNS (4),			/*                               HI */
+   COSTS_N_INSNS (7),			/*                               SI */
+   COSTS_N_INSNS (7),			/*                               DI */
+   COSTS_N_INSNS (7)},			/*                               other */
+  0,					/* cost of multiply per each bit set */
+  {COSTS_N_INSNS (15),			/* cost of a divide/mod for QI */
+   COSTS_N_INSNS (23),			/*                          HI */
+   COSTS_N_INSNS (39),			/*                          SI */
+   COSTS_N_INSNS (39),			/*                          DI */
+   COSTS_N_INSNS (39)},			/*                          other */
+  COSTS_N_INSNS (1),			/* cost of movsx */
+  COSTS_N_INSNS (1),			/* cost of movzx */
+  8,					/* "large" insn */
+  4,					/* MOVE_RATIO */
+  1,					/* cost for loading QImode using movzbl */
+  {1, 1, 1},				/* cost of loading integer registers
+					   in QImode, HImode and SImode.
+					   Relative to reg-reg move (2).  */
+  {1, 1, 1},				/* cost of storing integer registers */
+  1,					/* cost of reg,reg fld/fst */
+  {1, 1, 1},				/* cost of loading fp registers
+					   in SFmode, DFmode and XFmode */
+  {4, 6, 6},				/* cost of storing fp registers
+					   in SFmode, DFmode and XFmode */
+
+  1,					/* cost of moving MMX register */
+  {1, 1},				/* cost of loading MMX registers
+					   in SImode and DImode */
+  {1, 1},				/* cost of storing MMX registers
+					   in SImode and DImode */
+  1,					/* cost of moving SSE register */
+  {1, 1, 1},				/* cost of loading SSE registers
+					   in SImode, DImode and TImode */
+  {1, 1, 1},				/* cost of storing SSE registers
+					   in SImode, DImode and TImode */
+  1,					/* MMX or SSE register to integer */
+  32,					/* size of prefetch block */
+  1,					/* number of parallel prefetches */
+  1,					/* Branch cost */
+  COSTS_N_INSNS (6),			/* cost of FADD and FSUB insns.  */
+  COSTS_N_INSNS (11),			/* cost of FMUL instruction.  */
+  COSTS_N_INSNS (47),			/* cost of FDIV instruction.  */
+  COSTS_N_INSNS (1),			/* cost of FABS instruction.  */
+  COSTS_N_INSNS (1),			/* cost of FCHS instruction.  */
+  COSTS_N_INSNS (54),			/* cost of FSQRT instruction.  */
+};
+
+static const
 struct processor_costs k6_cost = {
   COSTS_N_INSNS (1),			/* cost of an add instruction */
   COSTS_N_INSNS (2),			/* cost of a lea instruction */
@@ -600,6 +654,58 @@ struct processor_costs nocona_cost = {
   COSTS_N_INSNS (44),			/* cost of FSQRT instruction.  */
 };
 
+static const
+struct processor_costs core2_cost = {
+  COSTS_N_INSNS (1),			/* cost of an add instruction */
+  COSTS_N_INSNS (1) + 1,		/* cost of a lea instruction */
+  COSTS_N_INSNS (1),			/* variable shift costs */
+  COSTS_N_INSNS (1),			/* constant shift costs */
+  {COSTS_N_INSNS (3),			/* cost of starting multiply for QI */
+   COSTS_N_INSNS (3),			/*                               HI */
+   COSTS_N_INSNS (3),			/*                               SI */
+   COSTS_N_INSNS (3),			/*                               DI */
+   COSTS_N_INSNS (3)},			/*                               other */
+  0,					/* cost of multiply per each bit set */
+  {COSTS_N_INSNS (22),			/* cost of a divide/mod for QI */
+   COSTS_N_INSNS (22),			/*                          HI */
+   COSTS_N_INSNS (22),			/*                          SI */
+   COSTS_N_INSNS (22),			/*                          DI */
+   COSTS_N_INSNS (22)},			/*                          other */
+  COSTS_N_INSNS (1),			/* cost of movsx */
+  COSTS_N_INSNS (1),			/* cost of movzx */
+  8,					/* "large" insn */
+  16,					/* MOVE_RATIO */
+  2,					/* cost for loading QImode using movzbl */
+  {6, 6, 6},				/* cost of loading integer registers
+					   in QImode, HImode and SImode.
+					   Relative to reg-reg move (2).  */
+  {4, 4, 4},				/* cost of storing integer registers */
+  2,					/* cost of reg,reg fld/fst */
+  {6, 6, 6},				/* cost of loading fp registers
+					   in SFmode, DFmode and XFmode */
+  {4, 4, 4},				/* cost of loading integer registers */
+  2,					/* cost of moving MMX register */
+  {6, 6},				/* cost of loading MMX registers
+					   in SImode and DImode */
+  {4, 4},				/* cost of storing MMX registers
+					   in SImode and DImode */
+  2,					/* cost of moving SSE register */
+  {6, 6, 6},				/* cost of loading SSE registers
+					   in SImode, DImode and TImode */
+  {4, 4, 4},				/* cost of storing SSE registers
+					   in SImode, DImode and TImode */
+  2,					/* MMX or SSE register to integer */
+  128,					/* size of prefetch block */
+  8,					/* number of parallel prefetches */
+  3,					/* Branch cost */
+  COSTS_N_INSNS (3),			/* cost of FADD and FSUB insns.  */
+  COSTS_N_INSNS (5),			/* cost of FMUL instruction.  */
+  COSTS_N_INSNS (32),			/* cost of FDIV instruction.  */
+  COSTS_N_INSNS (1),			/* cost of FABS instruction.  */
+  COSTS_N_INSNS (1),			/* cost of FCHS instruction.  */
+  COSTS_N_INSNS (58),			/* cost of FSQRT instruction.  */
+};
+
 /* Generic64 should produce code tuned for Nocona and K8.  */
 static const
 struct processor_costs generic64_cost = {
@@ -721,38 +827,41 @@ const struct processor_costs *ix86_cost 
 #define m_486 (1<mask, d->name, type, d->code);
     }
 
+  /* Add all builtins that are more or less simple operations on 1 operand.  */
+  for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
+    {
+      enum machine_mode mode;
+      tree type;
+
+      if (d->name == 0)
+	continue;
+      mode = insn_data[d->icode].operand[1].mode;
+
+      switch (mode)
+	{
+	case V16QImode:
+	  type = v16qi_ftype_v16qi;
+	  break;
+	case V8HImode:
+	  type = v8hi_ftype_v8hi;
+	  break;
+	case V4SImode:
+	  type = v4si_ftype_v4si;
+	  break;
+	case V2DFmode:
+	  type = v2df_ftype_v2df;
+	  break;
+	case V4SFmode:
+	  type = v4sf_ftype_v4sf;
+	  break;
+	case V8QImode:
+	  type = v8qi_ftype_v8qi;
+	  break;
+	case V4HImode:
+	  type = v4hi_ftype_v4hi;
+	  break;
+	case V2SImode:
+	  type = v2si_ftype_v2si;
+	  break;
+
+	default:
+	  abort ();
+	}
+
+      def_builtin (d->mask, d->name, type, d->code);
+    }
+
   /* Add the remaining MMX insns with somewhat more complicated types.  */
   def_builtin (MASK_MMX, "__builtin_ia32_emms", void_ftype_void, IX86_BUILTIN_EMMS);
   def_builtin (MASK_MMX, "__builtin_ia32_psllw", v4hi_ftype_v4hi_di, IX86_BUILTIN_PSLLW);
@@ -15531,6 +15798,12 @@ ix86_init_mmx_sse_builtins (void)
   def_builtin (MASK_SSE3, "__builtin_ia32_lddqu",
 	       v16qi_ftype_pcchar, IX86_BUILTIN_LDDQU);
 
+  /* SSSE3.  */
+  def_builtin (MASK_SSSE3, "__builtin_ia32_palignr128",
+	       v2di_ftype_v2di_v2di_int, IX86_BUILTIN_PALIGNR128);
+  def_builtin (MASK_SSSE3, "__builtin_ia32_palignr", di_ftype_di_di_int,
+	       IX86_BUILTIN_PALIGNR);
+
   /* Access to the vec_init patterns.  */
   ftype = build_function_type_list (V2SI_type_node, integer_type_node,
 				    integer_type_node, NULL_TREE);
@@ -16029,7 +16302,7 @@ ix86_expand_builtin (tree exp, rtx targe
   tree arglist = TREE_OPERAND (exp, 1);
   tree arg0, arg1, arg2;
   rtx op0, op1, op2, pat;
-  enum machine_mode tmode, mode0, mode1, mode2;
+  enum machine_mode tmode, mode0, mode1, mode2, mode3;
   unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
 
   switch (fcode)
@@ -16499,6 +16772,52 @@ ix86_expand_builtin (tree exp, rtx targe
       return ix86_expand_unop_builtin (CODE_FOR_sse3_lddqu, arglist,
 				       target, 1);
 
+    case IX86_BUILTIN_PALIGNR:
+    case IX86_BUILTIN_PALIGNR128:
+      if (fcode == IX86_BUILTIN_PALIGNR)
+	{
+	  icode = CODE_FOR_ssse3_palignrdi;
+	  mode = DImode;
+	}
+      else
+	{
+	  icode = CODE_FOR_ssse3_palignrti;
+	  mode = V2DImode;
+	}
+      arg0 = TREE_VALUE (arglist);
+      arg1 = TREE_VALUE (TREE_CHAIN (arglist));
+      arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
+      op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
+      op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
+      op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
+      tmode = insn_data[icode].operand[0].mode;
+      mode1 = insn_data[icode].operand[1].mode;
+      mode2 = insn_data[icode].operand[2].mode;

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

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 30 22:15:15 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1C27E1065676;
	Sat, 30 Apr 2011 22:15:15 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 08B808FC0A;
	Sat, 30 Apr 2011 22:15:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3UMFExg064446;
	Sat, 30 Apr 2011 22:15:14 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3UMFEA3064444;
	Sat, 30 Apr 2011 22:15:14 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201104302215.p3UMFEA3064444@svn.freebsd.org>
From: Martin Matuska 
Date: Sat, 30 Apr 2011 22:15:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r221275 - stable/8/sys/sys
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 30 Apr 2011 22:15:15 -0000

Author: mm
Date: Sat Apr 30 22:15:14 2011
New Revision: 221275
URL: http://svn.freebsd.org/changeset/base/221275

Log:
  Bump __FreeBSD_version for the gcc MFC (r220150)

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

Modified: stable/8/sys/sys/param.h
==============================================================================
--- stable/8/sys/sys/param.h	Sat Apr 30 22:07:04 2011	(r221274)
+++ stable/8/sys/sys/param.h	Sat Apr 30 22:15:14 2011	(r221275)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 802502	/* Master, propagated to newvers */
+#define __FreeBSD_version 802503	/* Master, propagated to newvers */
 
 #ifdef _KERNEL
 #define	P_OSREL_SIGSEGV		700004