From owner-svn-src-stable-9@FreeBSD.ORG Sun Feb 12 06:01:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64B3F106564A; Sun, 12 Feb 2012 06:01:50 +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 3834D8FC08; Sun, 12 Feb 2012 06:01:50 +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 q1C61oMC067818; Sun, 12 Feb 2012 06:01:50 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1C61ohW067816; Sun, 12 Feb 2012 06:01:50 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202120601.q1C61ohW067816@svn.freebsd.org> From: Rick Macklem Date: Sun, 12 Feb 2012 06:01:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231545 - stable/9/sys/fs/nfsclient X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 06:01:50 -0000 Author: rmacklem Date: Sun Feb 12 06:01:49 2012 New Revision: 231545 URL: http://svn.freebsd.org/changeset/base/231545 Log: MFC: r231133 r228827 fixed a problem where copying of NFSv4 open credentials into a credential structure would corrupt it. This happened when the p argument was != NULL. However, I now realize that the copying of open credentials should only happen for p == NULL, since that indicates that it is a read-ahead or write-behind. This patch fixes this. After this commit, r228827 could be reverted, but I think the code is clearer and safer with the patch, so I am going to leave it in. Without this patch, it was possible that a NFSv4 VOP_SETATTR() could have changed the credentials of the caller. This would have happened if the process doing the VOP_SETATTR() did not have the file open, but some other process running as a different uid had the file open for writing at the same time. Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clstate.c Sun Feb 12 05:34:01 2012 (r231544) +++ stable/9/sys/fs/nfsclient/nfs_clstate.c Sun Feb 12 06:01:49 2012 (r231545) @@ -559,8 +559,12 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n NFSUNLOCKCLSTATE(); return (ENOENT); } - /* for read aheads or write behinds, use the open cred */ - newnfs_copycred(&op->nfso_cred, cred); + /* + * For read aheads or write behinds, use the open cred. + * A read ahead or write behind is indicated by p == NULL. + */ + if (p == NULL) + newnfs_copycred(&op->nfso_cred, cred); } /* From owner-svn-src-stable-9@FreeBSD.ORG Sun Feb 12 07:52:15 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0014D106566B; Sun, 12 Feb 2012 07:52:14 +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 E222D8FC12; Sun, 12 Feb 2012 07:52:14 +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 q1C7qEui071378; Sun, 12 Feb 2012 07:52:14 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1C7qEtj071376; Sun, 12 Feb 2012 07:52:14 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202120752.q1C7qEtj071376@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 12 Feb 2012 07:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231550 - stable/9/lib/libkvm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 07:52:15 -0000 Author: trociny Date: Sun Feb 12 07:52:14 2012 New Revision: 231550 URL: http://svn.freebsd.org/changeset/base/231550 Log: MFC r230873: Try to avoid ambiguity when sysctl returns ENOMEM additionally checking the returned oldlen: when ENOMEM is due to the supplied buffer being too short the return oldlen is equal to buffer size. Without this additional check kvm_getprocs() gets stuck in loop if the returned ENOMEM was due the exceeded memorylocked limit. This is easily can be observed running `limits -l 1k top'. Submitted by: Andrey Zonov Modified: stable/9/lib/libkvm/kvm_proc.c Directory Properties: stable/9/lib/libkvm/ (props changed) Modified: stable/9/lib/libkvm/kvm_proc.c ============================================================================== --- stable/9/lib/libkvm/kvm_proc.c Sun Feb 12 07:45:48 2012 (r231549) +++ stable/9/lib/libkvm/kvm_proc.c Sun Feb 12 07:52:14 2012 (r231550) @@ -474,7 +474,7 @@ struct kinfo_proc * kvm_getprocs(kvm_t *kd, int op, int arg, int *cnt) { int mib[4], st, nprocs; - size_t size; + size_t size, osize; int temp_op; if (kd->procbase != 0) { @@ -524,10 +524,11 @@ kvm_getprocs(kvm_t *kd, int op, int arg, _kvm_realloc(kd, kd->procbase, size); if (kd->procbase == 0) return (0); + osize = size; st = sysctl(mib, temp_op == KERN_PROC_ALL || temp_op == KERN_PROC_PROC ? 3 : 4, kd->procbase, &size, NULL, 0); - } while (st == -1 && errno == ENOMEM); + } while (st == -1 && errno == ENOMEM && size == osize); if (st == -1) { _kvm_syserr(kd, kd->program, "kvm_getprocs"); return (0); From owner-svn-src-stable-9@FreeBSD.ORG Sun Feb 12 07:55:34 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 498AE106566C; Sun, 12 Feb 2012 07:55:34 +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 3774C8FC0A; Sun, 12 Feb 2012 07:55:34 +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 q1C7tYoZ071588; Sun, 12 Feb 2012 07:55:34 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1C7tYb3071586; Sun, 12 Feb 2012 07:55:34 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202120755.q1C7tYb3071586@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 12 Feb 2012 07:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231553 - stable/9/usr.bin/sockstat X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 07:55:34 -0000 Author: trociny Date: Sun Feb 12 07:55:33 2012 New Revision: 231553 URL: http://svn.freebsd.org/changeset/base/231553 Log: MFC r230874: Try to avoid ambiguity when sysctl returns ENOMEM additionally checking the returned oldlen: when ENOMEM is due to the supplied buffer being too short the return oldlen is equal to buffer size. Without this additional check sockstat gets stuck in loop leaking the memory if the returned ENOMEM was due the exceeded memorylocked limit. This is easily can be observed running `limits -l 1k sockstat'. Submitted by: Andrey Zonov Modified: stable/9/usr.bin/sockstat/sockstat.c Directory Properties: stable/9/usr.bin/sockstat/ (props changed) Modified: stable/9/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/9/usr.bin/sockstat/sockstat.c Sun Feb 12 07:53:37 2012 (r231552) +++ stable/9/usr.bin/sockstat/sockstat.c Sun Feb 12 07:55:33 2012 (r231553) @@ -295,7 +295,7 @@ gather_inet(int proto) break; if (errno == ENOENT) goto out; - if (errno != ENOMEM) + if (errno != ENOMEM || len != bufsize) err(1, "sysctlbyname()"); bufsize *= 2; } @@ -423,7 +423,7 @@ gather_unix(int proto) len = bufsize; if (sysctlbyname(varname, buf, &len, NULL, 0) == 0) break; - if (errno != ENOMEM) + if (errno != ENOMEM || len != bufsize) err(1, "sysctlbyname()"); bufsize *= 2; } @@ -475,14 +475,15 @@ out: static void getfiles(void) { - size_t len; + size_t len, olen; - if ((xfiles = malloc(len = sizeof *xfiles)) == NULL) + olen = len = sizeof *xfiles; + if ((xfiles = malloc(len)) == NULL) err(1, "malloc()"); while (sysctlbyname("kern.file", xfiles, &len, 0, 0) == -1) { - if (errno != ENOMEM) + if (errno != ENOMEM || len != olen) err(1, "sysctlbyname()"); - len *= 2; + olen = len *= 2; if ((xfiles = realloc(xfiles, len)) == NULL) err(1, "realloc()"); } From owner-svn-src-stable-9@FreeBSD.ORG Sun Feb 12 07:57:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE524106564A; Sun, 12 Feb 2012 07:57:58 +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 CC5D08FC12; Sun, 12 Feb 2012 07:57:58 +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 q1C7vwen071763; Sun, 12 Feb 2012 07:57:58 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1C7vwwL071761; Sun, 12 Feb 2012 07:57:58 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202120757.q1C7vwwL071761@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 12 Feb 2012 07:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231556 - stable/9/sbin/hastd X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 07:57:59 -0000 Author: trociny Date: Sun Feb 12 07:57:58 2012 New Revision: 231556 URL: http://svn.freebsd.org/changeset/base/231556 Log: MFC r231015, r231016: r231015: Fix the regression introduced in r226859: if the local component is out of date BIO_READ requests got lost instead of being sent to the remote component. Reviewed by: pjd r231016: If a local write request is from the synchronization thread, when it is synchronizing data that is out of date on the local component, we should not send G_GATE_CMD_DONE acknowledge to the kernel. This fixes the issue, observed in async mode, when on synchronization from the remote component the worker terminated with "G_GATE_CMD_DONE failed" error. Reported by: Artem Kajalainen Reviewed by: pjd Modified: stable/9/sbin/hastd/primary.c Directory Properties: stable/9/sbin/hastd/ (props changed) Modified: stable/9/sbin/hastd/primary.c ============================================================================== --- stable/9/sbin/hastd/primary.c Sun Feb 12 07:56:46 2012 (r231555) +++ stable/9/sbin/hastd/primary.c Sun Feb 12 07:57:58 2012 (r231556) @@ -1255,7 +1255,7 @@ ggate_recv_thread(void *arg) pjdlog_debug(2, "ggate_recv: (%p) Moving request to the send queues.", hio); refcount_init(&hio->hio_countdown, ncomps); - for (ii = ncomp; ii < ncomps; ii++) + for (ii = ncomp; ii < ncomp + ncomps; ii++) QUEUE_INSERT1(hio, send, ii); } /* NOTREACHED */ @@ -1326,7 +1326,8 @@ local_send_thread(void *arg) } else { hio->hio_errors[ncomp] = 0; if (hio->hio_replication == - HAST_REPLICATION_ASYNC) { + HAST_REPLICATION_ASYNC && + !ISSYNCREQ(hio)) { ggio->gctl_error = 0; write_complete(res, hio); } From owner-svn-src-stable-9@FreeBSD.ORG Sun Feb 12 14:56:31 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8150106564A; Sun, 12 Feb 2012 14:56:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A64BB8FC15; Sun, 12 Feb 2012 14:56:31 +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 q1CEuV5G089119; Sun, 12 Feb 2012 14:56:31 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1CEuVdj089117; Sun, 12 Feb 2012 14:56:31 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202121456.q1CEuVdj089117@svn.freebsd.org> From: Dimitry Andric Date: Sun, 12 Feb 2012 14:56:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231560 - stable/9/usr.bin/rpcgen X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 14:56:31 -0000 Author: dim Date: Sun Feb 12 14:56:31 2012 New Revision: 231560 URL: http://svn.freebsd.org/changeset/base/231560 Log: MFC r231054: In usr.bin/rpcgen/rpc_main.c, properly check the return value of strlcpy(), in addition to checking that of strlcat(). Modified: stable/9/usr.bin/rpcgen/rpc_main.c Directory Properties: stable/9/usr.bin/rpcgen/ (props changed) Modified: stable/9/usr.bin/rpcgen/rpc_main.c ============================================================================== --- stable/9/usr.bin/rpcgen/rpc_main.c Sun Feb 12 14:55:27 2012 (r231559) +++ stable/9/usr.bin/rpcgen/rpc_main.c Sun Feb 12 14:56:31 2012 (r231560) @@ -1129,9 +1129,11 @@ parseargs(int argc, const char *argv[], if (++i == argc) { return (0); } - (void) strlcpy(pathbuf, argv[i], sizeof(pathbuf)); - if (strlcat(pathbuf, "/cpp", sizeof(pathbuf)) - >= sizeof(pathbuf)) { + if (strlcpy(pathbuf, argv[i], + sizeof(pathbuf)) >= sizeof(pathbuf) + || strlcat(pathbuf, "/cpp", + sizeof(pathbuf)) >= + sizeof(pathbuf)) { warnx("argument too long"); return (0); } From owner-svn-src-stable-9@FreeBSD.ORG Sun Feb 12 23:07:45 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB878106564A; Sun, 12 Feb 2012 23:07:45 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D53D48FC08; Sun, 12 Feb 2012 23:07:45 +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 q1CN7jq1004915; Sun, 12 Feb 2012 23:07:45 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1CN7j02004913; Sun, 12 Feb 2012 23:07:45 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201202122307.q1CN7j02004913@svn.freebsd.org> From: Brooks Davis Date: Sun, 12 Feb 2012 23:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231566 - stable/9/lib/libc/net X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 23:07:46 -0000 Author: brooks Date: Sun Feb 12 23:07:45 2012 New Revision: 231566 URL: http://svn.freebsd.org/changeset/base/231566 Log: MFC 231196: eui64_aton and eui64_ntoa are actually the equivalent of ether_aton_r and ether_nota_r and do not use static variables so remove the note copied from ethers.3 saying they do. Reported by: bms Modified: stable/9/lib/libc/net/eui64.3 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/net/eui64.3 ============================================================================== --- stable/9/lib/libc/net/eui64.3 Sun Feb 12 19:29:34 2012 (r231565) +++ stable/9/lib/libc/net/eui64.3 Sun Feb 12 23:07:45 2012 (r231566) @@ -221,10 +221,3 @@ These functions first appears in They are derived from the .Xr ethers 3 family of functions. -.Sh BUGS -The -.Fn eui64_aton -and -.Fn eui64_ntoa -functions returns values that are stored in static memory areas -which may be overwritten the next time they are called. From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 07:30:42 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEE4C106566C; Mon, 13 Feb 2012 07:30:42 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCFC88FC0A; Mon, 13 Feb 2012 07:30: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 q1D7Ug77022120; Mon, 13 Feb 2012 07:30:42 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1D7Ugbp022118; Mon, 13 Feb 2012 07:30:42 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201202130730.q1D7Ugbp022118@svn.freebsd.org> From: Don Lewis Date: Mon, 13 Feb 2012 07:30:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231574 - stable/9/sbin/fsdb X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 07:30:43 -0000 Author: truckman Date: Mon Feb 13 07:30:42 2012 New Revision: 231574 URL: http://svn.freebsd.org/changeset/base/231574 Log: MFC r231102: Improve sparse file handling when printing the block list for an inode by not bailing out early when a hole is encountered in the direct block list. Print NULL block pointers in the direct block list. Simplify the code that prints the fragment count. Match the style of the existing code. Reviewed by: mckusick Modified: stable/9/sbin/fsdb/fsdbutil.c Directory Properties: stable/9/sbin/fsdb/ (props changed) Modified: stable/9/sbin/fsdb/fsdbutil.c ============================================================================== --- stable/9/sbin/fsdb/fsdbutil.c Mon Feb 13 01:44:12 2012 (r231573) +++ stable/9/sbin/fsdb/fsdbutil.c Mon Feb 13 07:30:42 2012 (r231574) @@ -295,22 +295,21 @@ printblocks(ino_t inum, union dinode *dp printf("Blocks for inode %d:\n", inum); printf("Direct blocks:\n"); ndb = howmany(DIP(dp, di_size), sblock.fs_bsize); - for (i = 0; i < NDADDR; i++) { - if (DIP(dp, di_db[i]) == 0) { - putchar('\n'); - return; - } + for (i = 0; i < NDADDR && i < ndb; i++) { if (i > 0) printf(", "); blkno = DIP(dp, di_db[i]); printf("%jd", (intmax_t)blkno); - if (--ndb == 0 && (offset = blkoff(&sblock, DIP(dp, di_size))) != 0) { + } + if (ndb <= NDADDR) { + offset = blkoff(&sblock, DIP(dp, di_size)); + if (offset != 0) { nfrags = numfrags(&sblock, fragroundup(&sblock, offset)); printf(" (%d frag%s)", nfrags, nfrags > 1? "s": ""); } } putchar('\n'); - if (ndb == 0) + if (ndb <= NDADDR) return; bufp = malloc((unsigned int)sblock.fs_bsize); From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 10:24:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 083451065670; Mon, 13 Feb 2012 10:24:50 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D07FA8FC14; Mon, 13 Feb 2012 10:24:49 +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 q1DAOnhW038171; Mon, 13 Feb 2012 10:24:49 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DAOnZY038169; Mon, 13 Feb 2012 10:24:49 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201202131024.q1DAOnZY038169@svn.freebsd.org> From: Tijl Coosemans Date: Mon, 13 Feb 2012 10:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231578 - stable/9/usr.bin/hexdump X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 10:24:50 -0000 Author: tijl Date: Mon Feb 13 10:24:49 2012 New Revision: 231578 URL: http://svn.freebsd.org/changeset/base/231578 Log: MFC r229794: - Fix how hexdump parses escape strings From the NetBSD bug: The way how hexdump(1) parses escape sequences has some bugs. It shows up when an escape sequence is used as the non-last character of a format string. MFC r230649: Fix decoding of escape sequences in format strings: - Zero-terminate the resulting string by letting the for-loop copy the terminating zero. - Exit the for-loop after handling a backslash at the end of the format string to fix a buffer overrun. - Remove some unnecessary comments and blank lines. PR: bin/144722 Modified: stable/9/usr.bin/hexdump/parse.c Directory Properties: stable/9/usr.bin/hexdump/ (props changed) Modified: stable/9/usr.bin/hexdump/parse.c ============================================================================== --- stable/9/usr.bin/hexdump/parse.c Mon Feb 13 10:24:22 2012 (r231577) +++ stable/9/usr.bin/hexdump/parse.c Mon Feb 13 10:24:49 2012 (r231578) @@ -255,7 +255,9 @@ rewrite(FS *fs) sokay = NOTOKAY; } - p2 = p1 + 1; /* Set end pointer. */ + p2 = *p1 ? p1 + 1 : p1; /* Set end pointer -- make sure + * that it's non-NUL/-NULL first + * though. */ cs[0] = *p1; /* Set conversion string. */ cs[1] = '\0'; @@ -449,13 +451,14 @@ escape(char *p1) char *p2; /* alphabetic escape sequences have to be done in place */ - for (p2 = p1;; ++p1, ++p2) { - if (!*p1) { - *p2 = *p1; - break; - } - if (*p1 == '\\') - switch(*++p1) { + for (p2 = p1;; p1++, p2++) { + if (*p1 == '\\') { + p1++; + switch(*p1) { + case '\0': + *p2 = '\\'; + *++p2 = '\0'; + return; case 'a': /* *p2 = '\a'; */ *p2 = '\007'; @@ -482,6 +485,11 @@ escape(char *p1) *p2 = *p1; break; } + } else { + *p2 = *p1; + if (*p1 == '\0') + return; + } } } From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 10:40:15 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CD1610656B7; Mon, 13 Feb 2012 10:40:15 +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 EDCF78FC17; Mon, 13 Feb 2012 10:40:14 +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 q1DAeEGq038699; Mon, 13 Feb 2012 10:40:14 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DAeED6038695; Mon, 13 Feb 2012 10:40:14 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202131040.q1DAeED6038695@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 13 Feb 2012 10:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231579 - stable/9/libexec/rtld-elf X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 10:40:15 -0000 Author: kib Date: Mon Feb 13 10:40:14 2012 New Revision: 231579 URL: http://svn.freebsd.org/changeset/base/231579 Log: MFC r230784: Add support for GNU RELRO. Modified: stable/9/libexec/rtld-elf/map_object.c stable/9/libexec/rtld-elf/rtld.c stable/9/libexec/rtld-elf/rtld.h Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/map_object.c ============================================================================== --- stable/9/libexec/rtld-elf/map_object.c Mon Feb 13 10:24:49 2012 (r231578) +++ stable/9/libexec/rtld-elf/map_object.c Mon Feb 13 10:40:14 2012 (r231579) @@ -84,6 +84,8 @@ map_object(int fd, const char *path, con Elf_Addr bss_vlimit; caddr_t bss_addr; Elf_Word stack_flags; + Elf_Addr relro_page; + size_t relro_size; hdr = get_elf_header(fd, path); if (hdr == NULL) @@ -100,6 +102,8 @@ map_object(int fd, const char *path, con nsegs = -1; phdyn = phinterp = phtls = NULL; phdr_vaddr = 0; + relro_page = 0; + relro_size = 0; segs = alloca(sizeof(segs[0]) * hdr->e_phnum); stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W; while (phdr < phlimit) { @@ -134,6 +138,11 @@ map_object(int fd, const char *path, con case PT_GNU_STACK: stack_flags = phdr->p_flags; break; + + case PT_GNU_RELRO: + relro_page = phdr->p_vaddr; + relro_size = phdr->p_memsz; + break; } ++phdr; @@ -269,6 +278,9 @@ map_object(int fd, const char *path, con obj->tlsinit = mapbase + phtls->p_vaddr; } obj->stack_flags = stack_flags; + obj->relro_page = obj->relocbase + trunc_page(relro_page); + obj->relro_size = round_page(relro_size); + return obj; } Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Mon Feb 13 10:24:49 2012 (r231578) +++ stable/9/libexec/rtld-elf/rtld.c Mon Feb 13 10:40:14 2012 (r231579) @@ -1114,6 +1114,11 @@ digest_phdr(const Elf_Phdr *phdr, int ph case PT_GNU_STACK: obj->stack_flags = ph->p_flags; break; + + case PT_GNU_RELRO: + obj->relro_page = obj->relocbase + trunc_page(ph->p_vaddr); + obj->relro_size = round_page(ph->p_memsz); + break; } } if (nsegs < 1) { @@ -2007,6 +2012,14 @@ relocate_objects(Obj_Entry *first, bool if (reloc_jmpslots(obj, lockstate) == -1) return -1; + if (obj->relro_size > 0) { + if (mprotect(obj->relro_page, obj->relro_size, PROT_READ) == -1) { + _rtld_error("%s: Cannot enforce relro protection: %s", + obj->path, strerror(errno)); + return -1; + } + } + /* * Set up the magic number and version in the Obj_Entry. These * were checked in the crt1.o from the original ElfKit, so we Modified: stable/9/libexec/rtld-elf/rtld.h ============================================================================== --- stable/9/libexec/rtld-elf/rtld.h Mon Feb 13 10:24:49 2012 (r231578) +++ stable/9/libexec/rtld-elf/rtld.h Mon Feb 13 10:40:14 2012 (r231579) @@ -168,6 +168,9 @@ typedef struct Struct_Obj_Entry { size_t tlsoffset; /* Offset of static TLS block for this module */ size_t tlsalign; /* Alignment of static TLS block */ + caddr_t relro_page; + size_t relro_size; + /* Items from the dynamic section. */ Elf_Addr *pltgot; /* PLT or GOT, depending on architecture */ const Elf_Rel *rel; /* Relocation entries */ From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 10:45:21 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 671C1106564A; Mon, 13 Feb 2012 10:45:21 +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 55BAE8FC12; Mon, 13 Feb 2012 10:45:21 +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 q1DAjLbm038981; Mon, 13 Feb 2012 10:45:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DAjLoZ038979; Mon, 13 Feb 2012 10:45:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202131045.q1DAjLoZ038979@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 13 Feb 2012 10:45:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231580 - stable/9/sys/ufs/ffs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 10:45:21 -0000 Author: kib Date: Mon Feb 13 10:45:20 2012 New Revision: 231580 URL: http://svn.freebsd.org/changeset/base/231580 Log: MFC r231077: JNEWBLK dependency may legitimately appear on the buf dependency list. Modified: stable/9/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_softdep.c Mon Feb 13 10:40:14 2012 (r231579) +++ stable/9/sys/ufs/ffs/ffs_softdep.c Mon Feb 13 10:45:20 2012 (r231580) @@ -12111,6 +12111,7 @@ top: case D_FREEWORK: case D_FREEDEP: case D_JSEGDEP: + case D_JNEWBLK: continue; default: From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 10:48:44 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DE99106566B; Mon, 13 Feb 2012 10:48:44 +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 2C82C8FC0C; Mon, 13 Feb 2012 10:48:44 +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 q1DAmiS5039131; Mon, 13 Feb 2012 10:48:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DAmhLS039129; Mon, 13 Feb 2012 10:48:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202131048.q1DAmhLS039129@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 13 Feb 2012 10:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231581 - stable/9/sys/ufs/ffs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 10:48:44 -0000 Author: kib Date: Mon Feb 13 10:48:43 2012 New Revision: 231581 URL: http://svn.freebsd.org/changeset/base/231581 Log: MFC r231091: Add missing opt_quota.h include to activate #ifdef QUOTA blocks. Modified: stable/9/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_softdep.c Mon Feb 13 10:45:20 2012 (r231580) +++ stable/9/sys/ufs/ffs/ffs_softdep.c Mon Feb 13 10:48:43 2012 (r231581) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ffs.h" +#include "opt_quota.h" #include "opt_ddb.h" /* @@ -6427,7 +6428,7 @@ softdep_setup_freeblocks(ip, length, fla } #ifdef QUOTA /* Reference the quotas in case the block count is wrong in the end. */ - quotaref(vp, freeblks->fb_quota); + quotaref(ITOV(ip), freeblks->fb_quota); (void) chkdq(ip, -datablocks, NOCRED, 0); #endif freeblks->fb_chkcnt = -datablocks; From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 15:21:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6FF91065670; Mon, 13 Feb 2012 15:21:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3E348FC0C; Mon, 13 Feb 2012 15:21: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 q1DFLCMH048241; Mon, 13 Feb 2012 15:21:12 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DFLC5q048235; Mon, 13 Feb 2012 15:21:12 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201202131521.q1DFLC5q048235@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 13 Feb 2012 15:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231587 - in stable/9/sys: kern netgraph X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 15:21:13 -0000 Author: glebius Date: Mon Feb 13 15:21:12 2012 New Revision: 231587 URL: http://svn.freebsd.org/changeset/base/231587 Log: Merge from head 226829, 230213, 230480, 230486, 230487, 231585: r226829 in ng_base: - If KDB & NETGRAPH_DEBUG are on, print traces on discovered failed invariants. - Reduce tautology in NETGRAPH_DEBUG output. r230213 in ng_socket: Remove some disabled NOTYET code. Probability of enabling it is low, if anyone wants, he/she can take it from svn. r230480 in ng_base: Convert locks that protect name hash, ID hash and typelist from mutex(9) to rwlock(9) based locks. While here remove dropping lock when processing NGM_LISTNODES, and NGM_LISTTYPES generic commands. We don't need to drop it since memory allocation is done with M_NOWAIT. r230486 in subr_hash.c: Convert panic()s to KASSERT()s. This is an optimisation for hashdestroy() since in absence of INVARIANTS a compiler will drop the entire for() cycle. 230487, 231585 in ng_socket: Provide a findhook method for ng_socket(4). The node stores a hash with names of its hooks. It starts with size of 16, and grows when number of hooks reaches twice the current size. A failure to grow (memory is allocated with M_NOWAIT) isn't fatal, however. I used standard hash(9) function for the hash. With 25000 hooks named in the mpd (ports/net/mpd5) manner of "b%u", the distributions is the following: 72.1% entries consist of one element, 22.1% consist of two, 5.2% consist of three and 0.6% of four. Speedup in a synthetic test that creates 25000 hooks and then runs through a long cyclce dereferencing them in a random order is over 25 times. The last merge was done in an ABI preserving manner, the struct ngsock is still exposed to userland (unlike in head), but its new fields are at its end and under #ifdef _KERNEL. Modified: stable/9/sys/kern/subr_hash.c stable/9/sys/netgraph/netgraph.h stable/9/sys/netgraph/ng_base.c stable/9/sys/netgraph/ng_socket.c stable/9/sys/netgraph/ng_socketvar.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_hash.c ============================================================================== --- stable/9/sys/kern/subr_hash.c Mon Feb 13 14:40:15 2012 (r231586) +++ stable/9/sys/kern/subr_hash.c Mon Feb 13 15:21:12 2012 (r231587) @@ -52,9 +52,7 @@ hashinit_flags(int elements, struct mall LIST_HEAD(generic, generic) *hashtbl; int i; - if (elements <= 0) - panic("hashinit: bad elements"); - + KASSERT(elements > 0, ("%s: bad elements", __func__)); /* Exactly one of HASH_WAITOK and HASH_NOWAIT must be set. */ KASSERT((flags & HASH_WAITOK) ^ (flags & HASH_NOWAIT), ("Bad flags (0x%x) passed to hashinit_flags", flags)); @@ -95,8 +93,7 @@ hashdestroy(void *vhashtbl, struct mallo hashtbl = vhashtbl; for (hp = hashtbl; hp <= &hashtbl[hashmask]; hp++) - if (!LIST_EMPTY(hp)) - panic("hashdestroy: hash not empty"); + KASSERT(LIST_EMPTY(hp), ("%s: hash not empty", __func__)); free(hashtbl, type); } @@ -115,8 +112,7 @@ phashinit(int elements, struct malloc_ty LIST_HEAD(generic, generic) *hashtbl; int i; - if (elements <= 0) - panic("phashinit: bad elements"); + KASSERT(elements > 0, ("%s: bad elements", __func__)); for (i = 1, hashsize = primes[1]; hashsize <= elements;) { i++; if (i == NPRIMES) Modified: stable/9/sys/netgraph/netgraph.h ============================================================================== --- stable/9/sys/netgraph/netgraph.h Mon Feb 13 14:40:15 2012 (r231586) +++ stable/9/sys/netgraph/netgraph.h Mon Feb 13 15:21:12 2012 (r231587) @@ -57,6 +57,7 @@ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_netgraph.h" +#include "opt_kdb.h" #endif /* debugging options */ @@ -190,7 +191,7 @@ static __inline void _chkhook(hook_p hook, char *file, int line) { if (hook->hk_magic != HK_MAGIC) { - printf("Accessing freed hook "); + printf("Accessing freed "); dumphook(hook, file, line); } hook->lastline = line; @@ -458,7 +459,7 @@ static __inline void _chknode(node_p node, char *file, int line) { if (node->nd_magic != ND_MAGIC) { - printf("Accessing freed node "); + printf("Accessing freed "); dumpnode(node, file, line); } node->lastline = line; Modified: stable/9/sys/netgraph/ng_base.c ============================================================================== --- stable/9/sys/netgraph/ng_base.c Mon Feb 13 14:40:15 2012 (r231586) +++ stable/9/sys/netgraph/ng_base.c Mon Feb 13 15:21:12 2012 (r231587) @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -163,19 +165,28 @@ static struct mtx ng_worklist_mtx; /* /* List of installed types */ static LIST_HEAD(, ng_type) ng_typelist; -static struct mtx ng_typelist_mtx; +static struct rwlock ng_typelist_lock; +#define TYPELIST_RLOCK() rw_rlock(&ng_typelist_lock) +#define TYPELIST_RUNLOCK() rw_runlock(&ng_typelist_lock) +#define TYPELIST_WLOCK() rw_wlock(&ng_typelist_lock) +#define TYPELIST_WUNLOCK() rw_wunlock(&ng_typelist_lock) /* Hash related definitions */ /* XXX Don't need to initialise them because it's a LIST */ static VNET_DEFINE(LIST_HEAD(, ng_node), ng_ID_hash[NG_ID_HASH_SIZE]); #define V_ng_ID_hash VNET(ng_ID_hash) -static struct mtx ng_idhash_mtx; +static struct rwlock ng_idhash_lock; +#define IDHASH_RLOCK() rw_rlock(&ng_idhash_lock) +#define IDHASH_RUNLOCK() rw_runlock(&ng_idhash_lock) +#define IDHASH_WLOCK() rw_wlock(&ng_idhash_lock) +#define IDHASH_WUNLOCK() rw_wunlock(&ng_idhash_lock) + /* Method to find a node.. used twice so do it here */ #define NG_IDHASH_FN(ID) ((ID) % (NG_ID_HASH_SIZE)) #define NG_IDHASH_FIND(ID, node) \ do { \ - mtx_assert(&ng_idhash_mtx, MA_OWNED); \ + rw_assert(&ng_idhash_lock, RA_LOCKED); \ LIST_FOREACH(node, &V_ng_ID_hash[NG_IDHASH_FN(ID)], \ nd_idnodes) { \ if (NG_NODE_IS_VALID(node) \ @@ -188,7 +199,6 @@ static struct mtx ng_idhash_mtx; static VNET_DEFINE(LIST_HEAD(, ng_node), ng_name_hash[NG_NAME_HASH_SIZE]); #define V_ng_name_hash VNET(ng_name_hash) -static struct mtx ng_namehash_mtx; #define NG_NAMEHASH(NAME, HASH) \ do { \ u_char h = 0; \ @@ -198,6 +208,11 @@ static struct mtx ng_namehash_mtx; (HASH) = h % (NG_NAME_HASH_SIZE); \ } while (0) +static struct rwlock ng_namehash_lock; +#define NAMEHASH_RLOCK() rw_rlock(&ng_namehash_lock) +#define NAMEHASH_RUNLOCK() rw_runlock(&ng_namehash_lock) +#define NAMEHASH_WLOCK() rw_wlock(&ng_namehash_lock) +#define NAMEHASH_WUNLOCK() rw_wunlock(&ng_namehash_lock) /* Internal functions */ static int ng_add_hook(node_p node, const char *name, hook_p * hookp); @@ -647,12 +662,12 @@ ng_make_node_common(struct ng_type *type LIST_INIT(&node->nd_hooks); /* Link us into the name hash. */ - mtx_lock(&ng_namehash_mtx); + NAMEHASH_WLOCK(); LIST_INSERT_HEAD(&V_ng_name_hash[0], node, nd_nodes); - mtx_unlock(&ng_namehash_mtx); + NAMEHASH_WUNLOCK(); /* get an ID and put us in the hash chain */ - mtx_lock(&ng_idhash_mtx); + IDHASH_WLOCK(); for (;;) { /* wrap protection, even if silly */ node_p node2 = NULL; node->nd_ID = V_nextID++; /* 137/sec for 1 year before wrap */ @@ -665,7 +680,7 @@ ng_make_node_common(struct ng_type *type } LIST_INSERT_HEAD(&V_ng_ID_hash[NG_IDHASH_FN(node->nd_ID)], node, nd_idnodes); - mtx_unlock(&ng_idhash_mtx); + IDHASH_WUNLOCK(); /* Done */ *nodepp = node; @@ -777,14 +792,14 @@ ng_unref_node(node_p node) if (refcount_release(&node->nd_refs)) { /* we were the last */ - mtx_lock(&ng_namehash_mtx); node->nd_type->refs--; /* XXX maybe should get types lock? */ + NAMEHASH_WLOCK(); LIST_REMOVE(node, nd_nodes); - mtx_unlock(&ng_namehash_mtx); + NAMEHASH_WUNLOCK(); - mtx_lock(&ng_idhash_mtx); + IDHASH_WLOCK(); LIST_REMOVE(node, nd_idnodes); - mtx_unlock(&ng_idhash_mtx); + IDHASH_WUNLOCK(); mtx_destroy(&node->nd_input_queue.q_mtx); NG_FREE_NODE(node); @@ -798,11 +813,11 @@ static node_p ng_ID2noderef(ng_ID_t ID) { node_p node; - mtx_lock(&ng_idhash_mtx); + IDHASH_RLOCK(); NG_IDHASH_FIND(ID, node); if(node) NG_NODE_REF(node); - mtx_unlock(&ng_idhash_mtx); + IDHASH_RUNLOCK(); return(node); } @@ -851,10 +866,10 @@ ng_name_node(node_p node, const char *na /* Update name hash. */ NG_NAMEHASH(name, hash); - mtx_lock(&ng_namehash_mtx); + NAMEHASH_WLOCK(); LIST_REMOVE(node, nd_nodes); LIST_INSERT_HEAD(&V_ng_name_hash[hash], node, nd_nodes); - mtx_unlock(&ng_namehash_mtx); + NAMEHASH_WUNLOCK(); return (0); } @@ -889,16 +904,15 @@ ng_name2noderef(node_p here, const char /* Find node by name */ NG_NAMEHASH(name, hash); - mtx_lock(&ng_namehash_mtx); - LIST_FOREACH(node, &V_ng_name_hash[hash], nd_nodes) { + NAMEHASH_RLOCK(); + LIST_FOREACH(node, &V_ng_name_hash[hash], nd_nodes) if (NG_NODE_IS_VALID(node) && (strcmp(NG_NODE_NAME(node), name) == 0)) { + NG_NODE_REF(node); break; } - } - if (node) - NG_NODE_REF(node); - mtx_unlock(&ng_namehash_mtx); + NAMEHASH_RUNLOCK(); + return (node); } @@ -1187,10 +1201,10 @@ ng_newtype(struct ng_type *tp) /* Link in new type */ - mtx_lock(&ng_typelist_mtx); + TYPELIST_WLOCK(); LIST_INSERT_HEAD(&ng_typelist, tp, types); tp->refs = 1; /* first ref is linked list */ - mtx_unlock(&ng_typelist_mtx); + TYPELIST_WUNLOCK(); return (0); } @@ -1208,9 +1222,9 @@ ng_rmtype(struct ng_type *tp) } /* Unlink type */ - mtx_lock(&ng_typelist_mtx); + TYPELIST_WLOCK(); LIST_REMOVE(tp, types); - mtx_unlock(&ng_typelist_mtx); + TYPELIST_WUNLOCK(); return (0); } @@ -1222,12 +1236,12 @@ ng_findtype(const char *typename) { struct ng_type *type; - mtx_lock(&ng_typelist_mtx); + TYPELIST_RLOCK(); LIST_FOREACH(type, &ng_typelist, types) { if (strcmp(type->name, typename) == 0) break; } - mtx_unlock(&ng_typelist_mtx); + TYPELIST_RUNLOCK(); return (type); } @@ -2565,7 +2579,7 @@ ng_generic_msg(node_p here, item_p item, node_p node; int num = 0, i; - mtx_lock(&ng_namehash_mtx); + NAMEHASH_RLOCK(); /* Count number of nodes */ for (i = 0; i < NG_NAME_HASH_SIZE; i++) { LIST_FOREACH(node, &V_ng_name_hash[i], nd_nodes) { @@ -2575,12 +2589,12 @@ ng_generic_msg(node_p here, item_p item, } } } - mtx_unlock(&ng_namehash_mtx); /* Get response struct */ NG_MKRESPONSE(resp, msg, sizeof(*nl) + (num * sizeof(struct nodeinfo)), M_NOWAIT); if (resp == NULL) { + NAMEHASH_RUNLOCK(); error = ENOMEM; break; } @@ -2588,7 +2602,6 @@ ng_generic_msg(node_p here, item_p item, /* Cycle through the linked list of nodes */ nl->numnames = 0; - mtx_lock(&ng_namehash_mtx); for (i = 0; i < NG_NAME_HASH_SIZE; i++) { LIST_FOREACH(node, &V_ng_name_hash[i], nd_nodes) { struct nodeinfo *const np = @@ -2598,20 +2611,17 @@ ng_generic_msg(node_p here, item_p item, continue; if (!unnamed && (! NG_NODE_HAS_NAME(node))) continue; - if (nl->numnames >= num) { - log(LOG_ERR, "%s: number of nodes changed\n", - __func__); - break; - } if (NG_NODE_HAS_NAME(node)) strcpy(np->name, NG_NODE_NAME(node)); strcpy(np->type, node->nd_type->name); np->id = ng_node2ID(node); np->hooks = node->nd_numhooks; + KASSERT(nl->numnames < num, ("%s: no space", + __func__)); nl->numnames++; } } - mtx_unlock(&ng_namehash_mtx); + NAMEHASH_RUNLOCK(); break; } @@ -2621,17 +2631,16 @@ ng_generic_msg(node_p here, item_p item, struct ng_type *type; int num = 0; - mtx_lock(&ng_typelist_mtx); + TYPELIST_RLOCK(); /* Count number of types */ - LIST_FOREACH(type, &ng_typelist, types) { + LIST_FOREACH(type, &ng_typelist, types) num++; - } - mtx_unlock(&ng_typelist_mtx); /* Get response struct */ NG_MKRESPONSE(resp, msg, sizeof(*tl) + (num * sizeof(struct typeinfo)), M_NOWAIT); if (resp == NULL) { + TYPELIST_RUNLOCK(); error = ENOMEM; break; } @@ -2639,20 +2648,15 @@ ng_generic_msg(node_p here, item_p item, /* Cycle through the linked list of types */ tl->numtypes = 0; - mtx_lock(&ng_typelist_mtx); LIST_FOREACH(type, &ng_typelist, types) { struct typeinfo *const tp = &tl->typeinfo[tl->numtypes]; - if (tl->numtypes >= num) { - log(LOG_ERR, "%s: number of %s changed\n", - __func__, "types"); - break; - } strcpy(tp->type_name, type->name); tp->numnodes = type->refs - 1; /* don't count list */ + KASSERT(tl->numtypes < num, ("%s: no space", __func__)); tl->numtypes++; } - mtx_unlock(&ng_typelist_mtx); + TYPELIST_RUNLOCK(); break; } @@ -2986,10 +2990,10 @@ ng_mod_event(module_t mod, int event, vo /* Call type specific code */ if (type->mod_event != NULL) if ((error = (*type->mod_event)(mod, event, data))) { - mtx_lock(&ng_typelist_mtx); + TYPELIST_WLOCK(); type->refs--; /* undo it */ LIST_REMOVE(type, types); - mtx_unlock(&ng_typelist_mtx); + TYPELIST_WUNLOCK(); } break; @@ -3004,9 +3008,9 @@ ng_mod_event(module_t mod, int event, vo if (error != 0) /* type refuses.. */ break; } - mtx_lock(&ng_typelist_mtx); + TYPELIST_WLOCK(); LIST_REMOVE(type, types); - mtx_unlock(&ng_typelist_mtx); + TYPELIST_WUNLOCK(); } break; @@ -3029,7 +3033,7 @@ vnet_netgraph_uninit(const void *unused do { /* Find a node to kill */ - mtx_lock(&ng_namehash_mtx); + NAMEHASH_RLOCK(); for (i = 0; i < NG_NAME_HASH_SIZE; i++) { LIST_FOREACH(node, &V_ng_name_hash[i], nd_nodes) { if (node != &ng_deadnode) { @@ -3040,7 +3044,7 @@ vnet_netgraph_uninit(const void *unused if (node != NULL) break; } - mtx_unlock(&ng_namehash_mtx); + NAMEHASH_RUNLOCK(); /* Attempt to kill it only if it is a regular node */ if (node != NULL) { @@ -3078,12 +3082,9 @@ ngb_mod_event(module_t mod, int event, v case MOD_LOAD: /* Initialize everything. */ NG_WORKLIST_LOCK_INIT(); - mtx_init(&ng_typelist_mtx, "netgraph types mutex", NULL, - MTX_DEF); - mtx_init(&ng_idhash_mtx, "netgraph idhash mutex", NULL, - MTX_DEF); - mtx_init(&ng_namehash_mtx, "netgraph namehash mutex", NULL, - MTX_DEF); + rw_init(&ng_typelist_lock, "netgraph types"); + rw_init(&ng_idhash_lock, "netgraph idhash"); + rw_init(&ng_namehash_lock, "netgraph namehash"); mtx_init(&ng_topo_mtx, "netgraph topology mutex", NULL, MTX_DEF); #ifdef NETGRAPH_DEBUG @@ -3143,6 +3144,9 @@ dumphook (hook_p hook, char *file, int l hook->lastfile, hook->lastline); if (line) { printf(" problem discovered at file %s, line %d\n", file, line); +#ifdef KDB + kdb_backtrace(); +#endif } } @@ -3157,6 +3161,9 @@ dumpnode(node_p node, char *file, int li node->lastfile, node->lastline); if (line) { printf(" problem discovered at file %s, line %d\n", file, line); +#ifdef KDB + kdb_backtrace(); +#endif } } Modified: stable/9/sys/netgraph/ng_socket.c ============================================================================== --- stable/9/sys/netgraph/ng_socket.c Mon Feb 13 14:40:15 2012 (r231586) +++ stable/9/sys/netgraph/ng_socket.c Mon Feb 13 15:21:12 2012 (r231587) @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -64,9 +65,6 @@ #include #include #include -#ifdef NOTYET -#include -#endif #include @@ -115,6 +113,7 @@ static ng_rcvmsg_t ngs_rcvmsg; static ng_shutdown_t ngs_shutdown; static ng_newhook_t ngs_newhook; static ng_connect_t ngs_connect; +static ng_findhook_t ngs_findhook; static ng_rcvdata_t ngs_rcvdata; static ng_disconnect_t ngs_disconnect; @@ -124,9 +123,6 @@ static int ng_attach_cntl(struct socket static int ng_attach_common(struct socket *so, int type); static void ng_detach_common(struct ngpcb *pcbp, int type); static void ng_socket_free_priv(struct ngsock *priv); -#ifdef NOTYET -static int ng_internalize(struct mbuf *m, struct thread *p); -#endif static int ng_connect_data(struct sockaddr *nam, struct ngpcb *pcbp); static int ng_bind(struct sockaddr *nam, struct ngpcb *pcbp); @@ -143,6 +139,7 @@ static struct ng_type typestruct = { .shutdown = ngs_shutdown, .newhook = ngs_newhook, .connect = ngs_connect, + .findhook = ngs_findhook, .rcvdata = ngs_rcvdata, .disconnect = ngs_disconnect, }; @@ -209,19 +206,10 @@ ngc_send(struct socket *so, int flags, s int len, error = 0; struct ng_apply_info apply; -#ifdef NOTYET - if (control && (error = ng_internalize(control, td))) { - if (pcbp->sockdata == NULL) { - error = ENOTCONN; - goto release; - } - } -#else /* NOTYET */ if (control) { error = EINVAL; goto release; } -#endif /* NOTYET */ /* Require destination as there may be >= 1 hooks on this node. */ if (addr == NULL) { @@ -539,8 +527,14 @@ ng_attach_cntl(struct socket *so) return (error); } - /* Allocate node private info */ + /* + * Allocate node private info and hash. We start + * with 16 hash entries, however we may grow later + * in ngs_newhook(). We can't predict how much hooks + * does this node plan to have. + */ priv = malloc(sizeof(*priv), M_NETGRAPH_SOCK, M_WAITOK | M_ZERO); + priv->hash = hashinit(16, M_NETGRAPH_SOCK, &priv->hmask); /* Initialize mutex. */ mtx_init(&priv->mtx, "ng_socket", NULL, MTX_DEF); @@ -646,6 +640,7 @@ ng_socket_free_priv(struct ngsock *priv) if (priv->refs == 0) { mtx_destroy(&priv->mtx); + hashdestroy(priv->hash, M_NETGRAPH_SOCK, priv->hmask); free(priv, M_NETGRAPH_SOCK); return; } @@ -661,69 +656,6 @@ ng_socket_free_priv(struct ngsock *priv) mtx_unlock(&priv->mtx); } -#ifdef NOTYET -/* - * File descriptors can be passed into an AF_NETGRAPH socket. - * Note, that file descriptors cannot be passed OUT. - * Only character device descriptors are accepted. - * Character devices are useful to connect a graph to a device, - * which after all is the purpose of this whole system. - */ -static int -ng_internalize(struct mbuf *control, struct thread *td) -{ - const struct cmsghdr *cm = mtod(control, const struct cmsghdr *); - struct file *fp; - struct vnode *vn; - int oldfds; - int fd; - - if (cm->cmsg_type != SCM_RIGHTS || cm->cmsg_level != SOL_SOCKET || - cm->cmsg_len != control->m_len) { - TRAP_ERROR; - return (EINVAL); - } - - /* Check there is only one FD. XXX what would more than one signify? */ - oldfds = ((caddr_t)cm + cm->cmsg_len - (caddr_t)data) / sizeof (int); - if (oldfds != 1) { - TRAP_ERROR; - return (EINVAL); - } - - /* Check that the FD given is legit. and change it to a pointer to a - * struct file. */ - fd = CMSG_DATA(cm); - if ((error = fget(td, fd, 0, &fp)) != 0) - return (error); - - /* Depending on what kind of resource it is, act differently. For - * devices, we treat it as a file. For an AF_NETGRAPH socket, - * shortcut straight to the node. */ - switch (fp->f_type) { - case DTYPE_VNODE: - vn = fp->f_data; - if (vn && (vn->v_type == VCHR)) { - /* for a VCHR, actually reference the FILE */ - fhold(fp); - /* XXX then what :) */ - /* how to pass on to other modules? */ - } else { - fdrop(fp, td); - TRAP_ERROR; - return (EINVAL); - } - break; - default: - fdrop(fp, td); - TRAP_ERROR; - return (EINVAL); - } - fdrop(fp, td); - return (0); -} -#endif /* NOTYET */ - /* * Connect the data socket to a named control socket node. */ @@ -817,6 +749,35 @@ ngs_constructor(node_p nodep) return (EINVAL); } +static void +ngs_rehash(node_p node) +{ + struct ngsock *priv = NG_NODE_PRIVATE(node); + struct ngshash *new; + struct hookpriv *hp; + hook_p hook; + uint32_t h; + u_long hmask; + + new = hashinit_flags((priv->hmask + 1) * 2, M_NETGRAPH_SOCK, &hmask, + HASH_NOWAIT); + if (new == NULL) + return; + + LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { + hp = NG_HOOK_PRIVATE(hook); +#ifdef INVARIANTS + LIST_REMOVE(hp, next); +#endif + h = hash32_str(NG_HOOK_NAME(hook), HASHINIT) & hmask; + LIST_INSERT_HEAD(&new[h], hp, next); + } + + hashdestroy(priv->hash, M_NETGRAPH_SOCK, priv->hmask); + priv->hash = new; + priv->hmask = hmask; +} + /* * We allow any hook to be connected to the node. * There is no per-hook private information though. @@ -824,7 +785,20 @@ ngs_constructor(node_p nodep) static int ngs_newhook(node_p node, hook_p hook, const char *name) { - NG_HOOK_SET_PRIVATE(hook, NG_NODE_PRIVATE(node)); + struct ngsock *const priv = NG_NODE_PRIVATE(node); + struct hookpriv *hp; + uint32_t h; + + hp = malloc(sizeof(*hp), M_NETGRAPH_SOCK, M_NOWAIT); + if (hp == NULL) + return (ENOMEM); + if (node->nd_numhooks * 2 > priv->hmask) + ngs_rehash(node); + hp->hook = hook; + h = hash32_str(name, HASHINIT) & priv->hmask; + LIST_INSERT_HEAD(&priv->hash[h], hp, next); + NG_HOOK_SET_PRIVATE(hook, hp); + return (0); } @@ -846,6 +820,38 @@ ngs_connect(hook_p hook) return (0); } +/* Look up hook by name */ +static hook_p +ngs_findhook(node_p node, const char *name) +{ + struct ngsock *priv = NG_NODE_PRIVATE(node); + struct hookpriv *hp; + uint32_t h; + + /* + * Microoptimisation for an ng_socket with + * a single hook, which is a common case. + */ + if (node->nd_numhooks == 1) { + hook_p hook; + + hook = LIST_FIRST(&node->nd_hooks); + + if (strcmp(NG_HOOK_NAME(hook), name) == 0) + return (hook); + else + return (NULL); + } + + h = hash32_str(name, HASHINIT) & priv->hmask; + + LIST_FOREACH(hp, &priv->hash[h], next) + if (strcmp(NG_HOOK_NAME(hp->hook), name) == 0) + return (hp->hook); + + return (NULL); +} + /* * Incoming messages get passed up to the control socket. * Unless they are for us specifically (socket_type) @@ -1013,6 +1019,10 @@ ngs_disconnect(hook_p hook) { node_p node = NG_HOOK_NODE(hook); struct ngsock *const priv = NG_NODE_PRIVATE(node); + struct hookpriv *hp = NG_HOOK_PRIVATE(hook); + + LIST_REMOVE(hp, next); + free(hp, M_NETGRAPH_SOCK); if ((priv->datasock) && (priv->datasock->ng_socket)) { if (NG_NODE_NUMHOOKS(node) == 1) Modified: stable/9/sys/netgraph/ng_socketvar.h ============================================================================== --- stable/9/sys/netgraph/ng_socketvar.h Mon Feb 13 14:40:15 2012 (r231586) +++ stable/9/sys/netgraph/ng_socketvar.h Mon Feb 13 15:21:12 2012 (r231587) @@ -52,6 +52,14 @@ struct ngpcb { int type; /* NG_CONTROL or NG_DATA */ }; +#ifdef _KERNEL +struct hookpriv { + LIST_ENTRY(hookpriv) next; + hook_p hook; +}; +LIST_HEAD(ngshash, hookpriv); +#endif + /* Per-node private data */ struct ngsock { struct ng_node *node; /* the associated netgraph node */ @@ -62,6 +70,10 @@ struct ngsock { struct mtx mtx; /* mtx to wait on */ int error; /* place to store error */ ng_ID_t node_id; /* a hint for netstat(1) to find the node */ +#ifdef _KERNEL + struct ngshash *hash; /* hash for hook names */ + u_long hmask; /* hash mask */ +#endif }; #define NGS_FLAG_NOLINGER 1 /* close with last hook */ From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 18:26:59 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 807511065674; Mon, 13 Feb 2012 18:26:59 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F38C8FC1C; Mon, 13 Feb 2012 18:26:59 +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 q1DIQxWE055500; Mon, 13 Feb 2012 18:26:59 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DIQxhm055498; Mon, 13 Feb 2012 18:26:59 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201202131826.q1DIQxhm055498@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 13 Feb 2012 18:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231591 - stable/9/sbin/mount X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 18:26:59 -0000 Author: jh Date: Mon Feb 13 18:26:58 2012 New Revision: 231591 URL: http://svn.freebsd.org/changeset/base/231591 Log: MFC r230373: Change mount_fs() to not exit on error. The "failok" mount option requires that errors are passed to the caller. PR: 163668 Modified: stable/9/sbin/mount/mount_fs.c Directory Properties: stable/9/sbin/mount/ (props changed) Modified: stable/9/sbin/mount/mount_fs.c ============================================================================== --- stable/9/sbin/mount/mount_fs.c Mon Feb 13 18:10:13 2012 (r231590) +++ stable/9/sbin/mount/mount_fs.c Mon Feb 13 18:26:58 2012 (r231591) @@ -82,7 +82,6 @@ mount_fs(const char *vfstype, int argc, char fstype[32]; char errmsg[255]; char *p, *val; - int ret; strlcpy(fstype, vfstype, sizeof(fstype)); memset(errmsg, 0, sizeof(errmsg)); @@ -125,10 +124,10 @@ mount_fs(const char *vfstype, int argc, build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); build_iovec(&iov, &iovlen, "from", dev, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); - - ret = nmount(iov, iovlen, mntflags); - if (ret < 0) - err(1, "%s %s", dev, errmsg); - return (ret); + if (nmount(iov, iovlen, mntflags) == -1) { + warn("%s: %s", dev, errmsg); + return (1); + } + return (0); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 18:54:16 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4914B1065670; Mon, 13 Feb 2012 18:54:16 +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 375C68FC0C; Mon, 13 Feb 2012 18:54:16 +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 q1DIsGMq056614; Mon, 13 Feb 2012 18:54:16 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DIsFSO056609; Mon, 13 Feb 2012 18:54:16 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131854.q1DIsFSO056609@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 18:54:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231593 - stable/9/sys/dev/cxgbe X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 18:54:16 -0000 Author: np Date: Mon Feb 13 18:54:15 2012 New Revision: 231593 URL: http://svn.freebsd.org/changeset/base/231593 Log: MFC r231115: cxgbe: reduce diffs with other branches. Modified: stable/9/sys/dev/cxgbe/adapter.h stable/9/sys/dev/cxgbe/t4_l2t.c stable/9/sys/dev/cxgbe/t4_l2t.h stable/9/sys/dev/cxgbe/t4_main.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/9/sys/dev/cxgbe/adapter.h Mon Feb 13 18:41:32 2012 (r231592) +++ stable/9/sys/dev/cxgbe/adapter.h Mon Feb 13 18:54:15 2012 (r231593) @@ -66,6 +66,17 @@ prefetch(void *x) #define prefetch(x) #endif +#ifndef SYSCTL_ADD_UQUAD +#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD +#define sysctl_handle_64 sysctl_handle_quad +#define CTLTYPE_U64 CTLTYPE_QUAD +#endif + +#if (__FreeBSD_version >= 900030) || \ + ((__FreeBSD_version >= 802507) && (__FreeBSD_version < 900000)) +#define SBUF_DRAIN 1 +#endif + #ifdef __amd64__ /* XXX: need systemwide bus_space_read_8/bus_space_write_8 */ static __inline uint64_t Modified: stable/9/sys/dev/cxgbe/t4_l2t.c ============================================================================== --- stable/9/sys/dev/cxgbe/t4_l2t.c Mon Feb 13 18:41:32 2012 (r231592) +++ stable/9/sys/dev/cxgbe/t4_l2t.c Mon Feb 13 18:54:15 2012 (r231593) @@ -259,6 +259,7 @@ t4_free_l2t(struct l2t_data *d) return (0); } +#ifdef SBUF_DRAIN static inline unsigned int vlan_prio(const struct l2t_entry *e) { @@ -333,6 +334,7 @@ skip: return (rc); } +#endif #ifndef TCP_OFFLOAD_DISABLE static inline void @@ -652,6 +654,11 @@ t4_l2t_get(struct port_info *pi, struct } else return (NULL); +#ifndef VLAN_TAG + if (ifp->if_type == IFT_L2VLAN) + return (NULL); +#endif + hash = addr_hash(addr, addr_len, ifp->if_index); rw_wlock(&d->lock); @@ -678,10 +685,12 @@ t4_l2t_get(struct port_info *pi, struct e->v6 = (addr_len == 16); e->lle = NULL; atomic_store_rel_int(&e->refcnt, 1); +#ifdef VLAN_TAG if (ifp->if_type == IFT_L2VLAN) VLAN_TAG(ifp, &e->vlan); else e->vlan = VLAN_NONE; +#endif e->next = d->l2tab[hash].first; d->l2tab[hash].first = e; mtx_unlock(&e->lock); Modified: stable/9/sys/dev/cxgbe/t4_l2t.h ============================================================================== --- stable/9/sys/dev/cxgbe/t4_l2t.h Mon Feb 13 18:41:32 2012 (r231592) +++ stable/9/sys/dev/cxgbe/t4_l2t.h Mon Feb 13 18:54:15 2012 (r231593) @@ -67,7 +67,9 @@ struct l2t_entry *t4_l2t_alloc_switching int t4_l2t_set_switching(struct adapter *, struct l2t_entry *, uint16_t, uint8_t, uint8_t *); void t4_l2t_release(struct l2t_entry *); +#ifdef SBUF_DRAIN int sysctl_l2t(SYSCTL_HANDLER_ARGS); +#endif #ifndef TCP_OFFLOAD_DISABLE struct l2t_entry *t4_l2t_get(struct port_info *, struct ifnet *, Modified: stable/9/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/9/sys/dev/cxgbe/t4_main.c Mon Feb 13 18:41:32 2012 (r231592) +++ stable/9/sys/dev/cxgbe/t4_main.c Mon Feb 13 18:54:15 2012 (r231593) @@ -309,6 +309,7 @@ static int sysctl_holdoff_pktc_idx(SYSCT static int sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS); static int sysctl_qsize_txq(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); +#ifdef SBUF_DRAIN static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cpl_stats(SYSCTL_HANDLER_ARGS); static int sysctl_ddp_stats(SYSCTL_HANDLER_ARGS); @@ -324,6 +325,7 @@ static int sysctl_tcp_stats(SYSCTL_HANDL static int sysctl_tids(SYSCTL_HANDLER_ARGS); static int sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS); static int sysctl_tx_rate(SYSCTL_HANDLER_ARGS); +#endif static inline void txq_start(struct ifnet *, struct sge_txq *); static uint32_t fconf_to_mode(uint32_t); static uint32_t mode_to_fconf(uint32_t); @@ -2980,6 +2982,7 @@ t4_sysctls(struct adapter *sc) sizeof(sc->sge.counter_val), sysctl_int_array, "A", "interrupt holdoff packet counter values"); +#ifdef SBUF_DRAIN /* * dev.t4nex.X.misc. Marked CTLFLAG_SKIP to avoid information overload. */ @@ -3051,6 +3054,7 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tx_rate", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_tx_rate, "A", "Tx rate"); +#endif #ifndef TCP_OFFLOAD_DISABLE if (is_offload(sc)) { @@ -3465,6 +3469,7 @@ sysctl_handle_t4_reg64(SYSCTL_HANDLER_AR return (sysctl_handle_64(oidp, &val, 0, req)); } +#ifdef SBUF_DRAIN static int sysctl_cctrl(SYSCTL_HANDLER_ARGS) { @@ -4297,6 +4302,7 @@ sysctl_tx_rate(SYSCTL_HANDLER_ARGS) return (rc); } +#endif static inline void txq_start(struct ifnet *ifp, struct sge_txq *txq) From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 19:02:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2326D106564A; Mon, 13 Feb 2012 19:02:12 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11DDD8FC13; Mon, 13 Feb 2012 19:02: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 q1DJ2BhQ057030; Mon, 13 Feb 2012 19:02:11 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJ2Bjn057028; Mon, 13 Feb 2012 19:02:11 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201202131902.q1DJ2Bjn057028@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 13 Feb 2012 19:02:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231596 - stable/9/sbin/mount X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:02:12 -0000 Author: jh Date: Mon Feb 13 19:02:11 2012 New Revision: 231596 URL: http://svn.freebsd.org/changeset/base/231596 Log: MFC r230377: Don't print the nmount(2) provided error message if it is empty. Modified: stable/9/sbin/mount/mount_fs.c Directory Properties: stable/9/sbin/mount/ (props changed) Modified: stable/9/sbin/mount/mount_fs.c ============================================================================== --- stable/9/sbin/mount/mount_fs.c Mon Feb 13 18:57:36 2012 (r231595) +++ stable/9/sbin/mount/mount_fs.c Mon Feb 13 19:02:11 2012 (r231596) @@ -126,7 +126,10 @@ mount_fs(const char *vfstype, int argc, build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if (nmount(iov, iovlen, mntflags) == -1) { - warn("%s: %s", dev, errmsg); + if (*errmsg != '\0') + warn("%s: %s", dev, errmsg); + else + warn("%s", dev); return (1); } return (0); From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 19:17:43 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F09A1065680; Mon, 13 Feb 2012 19:17:43 +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 834F78FC14; Mon, 13 Feb 2012 19:17: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 q1DJHhlr057528; Mon, 13 Feb 2012 19:17:43 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJHhC9057523; Mon, 13 Feb 2012 19:17:43 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131917.q1DJHhC9057523@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:17:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231597 - in stable/9/sys/dev: cxgb cxgbe X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:17:43 -0000 Author: np Date: Mon Feb 13 19:17:43 2012 New Revision: 231597 URL: http://svn.freebsd.org/changeset/base/231597 Log: MFC r231116: Remove if_start from cxgb and cxgbe. Modified: stable/9/sys/dev/cxgb/cxgb_adapter.h stable/9/sys/dev/cxgb/cxgb_main.c stable/9/sys/dev/cxgb/cxgb_sge.c stable/9/sys/dev/cxgbe/t4_main.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- stable/9/sys/dev/cxgb/cxgb_adapter.h Mon Feb 13 19:02:11 2012 (r231596) +++ stable/9/sys/dev/cxgb/cxgb_adapter.h Mon Feb 13 19:17:43 2012 (r231597) @@ -572,5 +572,4 @@ static inline int offload_running(adapte void cxgb_tx_watchdog(void *arg); int cxgb_transmit(struct ifnet *ifp, struct mbuf *m); void cxgb_qflush(struct ifnet *ifp); -void cxgb_start(struct ifnet *ifp); #endif Modified: stable/9/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/9/sys/dev/cxgb/cxgb_main.c Mon Feb 13 19:02:11 2012 (r231596) +++ stable/9/sys/dev/cxgb/cxgb_main.c Mon Feb 13 19:17:43 2012 (r231597) @@ -227,14 +227,6 @@ TUNABLE_INT("hw.cxgb.use_16k_clusters", SYSCTL_INT(_hw_cxgb, OID_AUTO, use_16k_clusters, CTLFLAG_RDTUN, &cxgb_use_16k_clusters, 0, "use 16kB clusters for the jumbo queue "); -/* - * Tune the size of the output queue. - */ -int cxgb_snd_queue_len = IFQ_MAXLEN; -TUNABLE_INT("hw.cxgb.snd_queue_len", &cxgb_snd_queue_len); -SYSCTL_INT(_hw_cxgb, OID_AUTO, snd_queue_len, CTLFLAG_RDTUN, - &cxgb_snd_queue_len, 0, "send queue size "); - static int nfilters = -1; TUNABLE_INT("hw.cxgb.nfilters", &nfilters); SYSCTL_INT(_hw_cxgb, OID_AUTO, nfilters, CTLFLAG_RDTUN, @@ -1019,11 +1011,8 @@ cxgb_port_attach(device_t dev) ifp->if_softc = p; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = cxgb_ioctl; - ifp->if_start = cxgb_start; - - ifp->if_snd.ifq_drv_maxlen = max(cxgb_snd_queue_len, ifqmaxlen); - IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); - IFQ_SET_READY(&ifp->if_snd); + ifp->if_transmit = cxgb_transmit; + ifp->if_qflush = cxgb_qflush; ifp->if_capabilities = CXGB_CAP; ifp->if_capenable = CXGB_CAP_ENABLE; @@ -1039,8 +1028,6 @@ cxgb_port_attach(device_t dev) } ether_ifattach(ifp, p->hw_addr); - ifp->if_transmit = cxgb_transmit; - ifp->if_qflush = cxgb_qflush; #ifdef DEFAULT_JUMBO if (sc->params.nports <= 2) Modified: stable/9/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- stable/9/sys/dev/cxgb/cxgb_sge.c Mon Feb 13 19:02:11 2012 (r231596) +++ stable/9/sys/dev/cxgb/cxgb_sge.c Mon Feb 13 19:17:43 2012 (r231597) @@ -1767,19 +1767,6 @@ cxgb_transmit(struct ifnet *ifp, struct error = drbr_enqueue(ifp, qs->txq[TXQ_ETH].txq_mr, m); return (error); } -void -cxgb_start(struct ifnet *ifp) -{ - struct port_info *pi = ifp->if_softc; - struct sge_qset *qs = &pi->adapter->sge.qs[pi->first_qset]; - - if (!pi->link_config.link_ok) - return; - - TXQ_LOCK(qs); - cxgb_start_locked(qs); - TXQ_UNLOCK(qs); -} void cxgb_qflush(struct ifnet *ifp) Modified: stable/9/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/9/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:02:11 2012 (r231596) +++ stable/9/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:17:43 2012 (r231597) @@ -112,7 +112,6 @@ static struct cdevsw t4_cdevsw = { /* ifnet + media interface */ static void cxgbe_init(void *); static int cxgbe_ioctl(struct ifnet *, unsigned long, caddr_t); -static void cxgbe_start(struct ifnet *); static int cxgbe_transmit(struct ifnet *, struct mbuf *); static void cxgbe_qflush(struct ifnet *); static int cxgbe_media_change(struct ifnet *); @@ -829,14 +828,9 @@ cxgbe_attach(device_t dev) ifp->if_init = cxgbe_init; ifp->if_ioctl = cxgbe_ioctl; - ifp->if_start = cxgbe_start; ifp->if_transmit = cxgbe_transmit; ifp->if_qflush = cxgbe_qflush; - ifp->if_snd.ifq_drv_maxlen = 1024; - IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); - IFQ_SET_READY(&ifp->if_snd); - ifp->if_capabilities = T4_CAP; #ifndef TCP_OFFLOAD_DISABLE if (is_offload(pi->adapter)) @@ -1095,21 +1089,6 @@ fail: return (rc); } -static void -cxgbe_start(struct ifnet *ifp) -{ - struct port_info *pi = ifp->if_softc; - struct sge_txq *txq; - int i; - - for_each_txq(pi, i, txq) { - if (TXQ_TRYLOCK(txq)) { - txq_start(ifp, txq); - TXQ_UNLOCK(txq); - } - } -} - static int cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) { From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 19:25:38 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8081C106566C; Mon, 13 Feb 2012 19:25:38 +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 6F5E88FC17; Mon, 13 Feb 2012 19:25:38 +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 q1DJPcdb057894; Mon, 13 Feb 2012 19:25:38 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJPcG4057892; Mon, 13 Feb 2012 19:25:38 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131925.q1DJPcG4057892@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:25:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231599 - stable/9/sys/dev/cxgbe X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:25:38 -0000 Author: np Date: Mon Feb 13 19:25:37 2012 New Revision: 231599 URL: http://svn.freebsd.org/changeset/base/231599 Log: MFC r231120: Acquire the adapter lock before updating fields of the filter structure. Modified: stable/9/sys/dev/cxgbe/t4_main.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/9/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:18:08 2012 (r231598) +++ stable/9/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:25:37 2012 (r231599) @@ -4839,22 +4839,22 @@ filter_rpl(struct sge_iq *iq, const stru unsigned int rc = G_COOKIE(rpl->cookie); struct filter_entry *f = &sc->tids.ftid_tab[idx]; + ADAPTER_LOCK(sc); if (rc == FW_FILTER_WR_FLT_ADDED) { f->smtidx = (be64toh(rpl->oldval) >> 24) & 0xff; f->pending = 0; /* asynchronous setup completed */ f->valid = 1; - return (0); - } + } else { + if (rc != FW_FILTER_WR_FLT_DELETED) { + /* Add or delete failed, display an error */ + log(LOG_ERR, + "filter %u setup failed with error %u\n", + idx, rc); + } - if (rc != FW_FILTER_WR_FLT_DELETED) { - /* Add or delete failed, need to display an error */ - device_printf(sc->dev, - "filter %u setup failed with error %u\n", idx, rc); + clear_filter(f); + sc->tids.ftids_in_use--; } - - clear_filter(f); - ADAPTER_LOCK(sc); - sc->tids.ftids_in_use--; ADAPTER_UNLOCK(sc); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 19:31:16 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2C291065672; Mon, 13 Feb 2012 19:31:16 +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 9793D8FC21; Mon, 13 Feb 2012 19:31:16 +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 q1DJVGE7058193; Mon, 13 Feb 2012 19:31:16 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJVGiZ058191; Mon, 13 Feb 2012 19:31:16 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131931.q1DJVGiZ058191@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231601 - stable/9/sys/dev/cxgbe X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:31:16 -0000 Author: np Date: Mon Feb 13 19:31:16 2012 New Revision: 231601 URL: http://svn.freebsd.org/changeset/base/231601 Log: MFC r231172: Program the MAC exact match table in batches of 7 addresses at a time when possible. This is more efficient than one at a time. Modified: stable/9/sys/dev/cxgbe/t4_main.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/9/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:25:58 2012 (r231600) +++ stable/9/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:31:16 2012 (r231601) @@ -2013,6 +2013,8 @@ build_medialist(struct port_info *pi) PORT_UNLOCK(pi); } +#define FW_MAC_EXACT_CHUNK 7 + /* * Program the port's XGMAC based on parameters in ifnet. The caller also * indicates which parameters should be programmed (the rest are left alone). @@ -2064,28 +2066,57 @@ update_mac_settings(struct port_info *pi } if (flags & XGMAC_MCADDRS) { - const uint8_t *mcaddr; + const uint8_t *mcaddr[FW_MAC_EXACT_CHUNK]; int del = 1; uint64_t hash = 0; struct ifmultiaddr *ifma; + int i = 0, j; if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) + if (ifma->ifma_addr->sa_family == AF_LINK) continue; - mcaddr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + mcaddr[i++] = + LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - rc = t4_alloc_mac_filt(sc, sc->mbox, pi->viid, del, 1, - &mcaddr, NULL, &hash, 0); + if (i == FW_MAC_EXACT_CHUNK) { + rc = t4_alloc_mac_filt(sc, sc->mbox, pi->viid, + del, i, mcaddr, NULL, &hash, 0); + if (rc < 0) { + rc = -rc; + for (j = 0; j < i; j++) { + if_printf(ifp, + "failed to add mc address" + " %02x:%02x:%02x:" + "%02x:%02x:%02x rc=%d\n", + mcaddr[j][0], mcaddr[j][1], + mcaddr[j][2], mcaddr[j][3], + mcaddr[j][4], mcaddr[j][5], + rc); + } + goto mcfail; + } + del = 0; + i = 0; + } + } + if (i > 0) { + rc = t4_alloc_mac_filt(sc, sc->mbox, pi->viid, + del, i, mcaddr, NULL, &hash, 0); if (rc < 0) { rc = -rc; - if_printf(ifp, "failed to add mc address" - " %02x:%02x:%02x:%02x:%02x:%02x rc=%d\n", - mcaddr[0], mcaddr[1], mcaddr[2], mcaddr[3], - mcaddr[4], mcaddr[5], rc); + for (j = 0; j < i; j++) { + if_printf(ifp, + "failed to add mc address" + " %02x:%02x:%02x:" + "%02x:%02x:%02x rc=%d\n", + mcaddr[j][0], mcaddr[j][1], + mcaddr[j][2], mcaddr[j][3], + mcaddr[j][4], mcaddr[j][5], + rc); + } goto mcfail; } - del = 0; } rc = -t4_set_addr_hash(sc, sc->mbox, pi->viid, 0, hash, 0); From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 19:35:39 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36FC3106566C; Mon, 13 Feb 2012 19:35:39 +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 25B368FC08; Mon, 13 Feb 2012 19:35: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 q1DJZd76058508; Mon, 13 Feb 2012 19:35:39 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJZckg058506; Mon, 13 Feb 2012 19:35:38 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131935.q1DJZckg058506@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231604 - stable/9/sys/dev/cxgb X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:35:39 -0000 Author: np Date: Mon Feb 13 19:35:38 2012 New Revision: 231604 URL: http://svn.freebsd.org/changeset/base/231604 Log: MFC r231175: Allocate the BAR for userspace doorbells after the is_offload check is functional. Modified: stable/9/sys/dev/cxgb/cxgb_main.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/9/sys/dev/cxgb/cxgb_main.c Mon Feb 13 19:35:35 2012 (r231603) +++ stable/9/sys/dev/cxgb/cxgb_main.c Mon Feb 13 19:35:38 2012 (r231604) @@ -473,15 +473,6 @@ cxgb_controller_attach(device_t dev) device_printf(dev, "Cannot allocate BAR region 0\n"); return (ENXIO); } - sc->udbs_rid = PCIR_BAR(2); - sc->udbs_res = NULL; - if (is_offload(sc) && - ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->udbs_rid, RF_ACTIVE)) == NULL)) { - device_printf(dev, "Cannot allocate BAR region 1\n"); - error = ENXIO; - goto out; - } snprintf(sc->lockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb controller lock %d", device_get_unit(dev)); @@ -510,6 +501,17 @@ cxgb_controller_attach(device_t dev) error = ENODEV; goto out; } + + sc->udbs_rid = PCIR_BAR(2); + sc->udbs_res = NULL; + if (is_offload(sc) && + ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->udbs_rid, RF_ACTIVE)) == NULL)) { + device_printf(dev, "Cannot allocate BAR region 1\n"); + error = ENXIO; + goto out; + } + /* Allocate the BAR for doing MSI-X. If it succeeds, try to allocate * enough messages for the queue sets. If that fails, try falling * back to MSI. If that fails, then try falling back to the legacy From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 19:36:10 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96B8A1065787; Mon, 13 Feb 2012 19:36:10 +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 852A38FC21; Mon, 13 Feb 2012 19:36: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 q1DJaA3d058601; Mon, 13 Feb 2012 19:36:10 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJaAmD058599; Mon, 13 Feb 2012 19:36:10 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202131936.q1DJaAmD058599@svn.freebsd.org> From: John Baldwin Date: Mon, 13 Feb 2012 19:36:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231606 - stable/9/release/doc/share/misc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:36:10 -0000 Author: jhb Date: Mon Feb 13 19:36:09 2012 New Revision: 231606 URL: http://svn.freebsd.org/changeset/base/231606 Log: MFC 230332: Add support for the Em command. This restores a missing 'not' in the description of snd_emu10kx(4). Modified: stable/9/release/doc/share/misc/man2hwnotes.pl Directory Properties: stable/9/release/ (props changed) stable/9/release/doc/en_US.ISO8859-1/hardware/ (props changed) Modified: stable/9/release/doc/share/misc/man2hwnotes.pl ============================================================================== --- stable/9/release/doc/share/misc/man2hwnotes.pl Mon Feb 13 19:36:00 2012 (r231605) +++ stable/9/release/doc/share/misc/man2hwnotes.pl Mon Feb 13 19:36:09 2012 (r231606) @@ -324,6 +324,11 @@ sub parse { } elsif (/^Fx/) { dlog(3, "Got Fx command"); parabuf_addline(\%mdocvars, "FreeBSD"); + } elsif (/^Em (.+)$/) { + my ($txt, $punct_str) = split_punct_chars($1); + + parabuf_addline(\%mdocvars, + normalize("$txt$punct_str")); } else { # Ignore all other commands. dlog(3, "Ignoring unknown command $cmd"); From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 19:41:01 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A983D106564A; Mon, 13 Feb 2012 19:41:01 +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 982338FC08; Mon, 13 Feb 2012 19:41: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 q1DJf1L6058831; Mon, 13 Feb 2012 19:41:01 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJf1wk058829; Mon, 13 Feb 2012 19:41:01 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131941.q1DJf1wk058829@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231607 - stable/9/sys/dev/cxgbe/common X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:41:01 -0000 Author: np Date: Mon Feb 13 19:41:01 2012 New Revision: 231607 URL: http://svn.freebsd.org/changeset/base/231607 Log: MFC r231592: Use the non-sleeping variang of t4_wr_mbox in code that can be called with locks held. Modified: stable/9/sys/dev/cxgbe/common/t4_hw.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/9/sys/dev/cxgbe/common/t4_hw.c Mon Feb 13 19:36:09 2012 (r231606) +++ stable/9/sys/dev/cxgbe/common/t4_hw.c Mon Feb 13 19:41:01 2012 (r231607) @@ -4314,7 +4314,7 @@ int t4_change_mac(struct adapter *adap, V_FW_VI_MAC_CMD_IDX(idx)); memcpy(p->macaddr, addr, sizeof(p->macaddr)); - ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); + ret = t4_wr_mbox_ns(adap, mbox, &c, sizeof(c), &c); if (ret == 0) { ret = G_FW_VI_MAC_CMD_IDX(ntohs(p->valid_to_idx)); if (ret >= FW_CLS_TCAM_NUM_ENTRIES) From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 19:51:59 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B19C9106566B; Mon, 13 Feb 2012 19:51:59 +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 A04408FC0A; Mon, 13 Feb 2012 19:51:59 +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 q1DJpxbw059318; Mon, 13 Feb 2012 19:51:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJpxZo059316; Mon, 13 Feb 2012 19:51:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202131951.q1DJpxZo059316@svn.freebsd.org> From: John Baldwin Date: Mon, 13 Feb 2012 19:51:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231610 - stable/9/sys/dev/pci X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:51:59 -0000 Author: jhb Date: Mon Feb 13 19:51:59 2012 New Revision: 231610 URL: http://svn.freebsd.org/changeset/base/231610 Log: MFC 230340: Properly return success once a matching VPD entry is found in pci_get_vpd_readonly_method(). Previously the loop was always running to completion and falling through to failing with ENXIO. Modified: stable/9/sys/dev/pci/pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Mon Feb 13 19:49:45 2012 (r231609) +++ stable/9/sys/dev/pci/pci.c Mon Feb 13 19:51:59 2012 (r231610) @@ -1136,11 +1136,9 @@ pci_get_vpd_readonly_method(device_t dev if (memcmp(kw, cfg->vpd.vpd_ros[i].keyword, sizeof(cfg->vpd.vpd_ros[i].keyword)) == 0) { *vptr = cfg->vpd.vpd_ros[i].value; + return (0); } - if (i != cfg->vpd.vpd_rocnt) - return (0); - *vptr = NULL; return (ENXIO); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Feb 13 20:59:21 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CEA5106564A; Mon, 13 Feb 2012 20:59:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C0BD8FC0A; Mon, 13 Feb 2012 20:59:21 +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 q1DKxLl1061672; Mon, 13 Feb 2012 20:59:21 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DKxKbP061669; Mon, 13 Feb 2012 20:59:20 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202132059.q1DKxKbP061669@svn.freebsd.org> From: Dimitry Andric Date: Mon, 13 Feb 2012 20:59:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231612 - stable/9/usr.bin/rpcgen X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 20:59:21 -0000 Author: dim Date: Mon Feb 13 20:59:20 2012 New Revision: 231612 URL: http://svn.freebsd.org/changeset/base/231612 Log: MFC r231079: Let rpcgen(1) support an environment variable RPCGEN_CPP to find the C preprocessor to run. Previously, it always ran /usr/bin/cpp, unless you used the -Y option, and even then you could not set the basename. It also attempted to run /usr/ccs/lib/cpp for SVR4 compatibility, but this is obsolete, and has been removed. Note that setting RPCGEN_CPP to a command with arguments is supported, though the command line parsing is simplistic. However, setting it to e.g. "gcc46 -E" or "clang -E" will lead to problems, because both gcc and clang in -E mode will consider files with unknown extensions (such as .x) as object files, and attempt to link them. This could be worked around by also adding "-x c", but it is much safer to set RPCGEN_CPP to e.g. "cpp46" or "clang-cpp" instead. MFC r231080: Amend r231079 by properly shifting up the existing arguments in rpc_main.c's insarg() function. I had forgotten to put this in my patch queue, sorry. Pointy hat to: me MFC r231101: In usr.bin/rpcgen/rpc_main.c, use execvp(3) instead of execv(3), so rpcgen will search the current PATH for the preprocessor. This makes it possible to run a preprocessor built during the cross-tools stage of buildworld. Modified: stable/9/usr.bin/rpcgen/rpc_main.c stable/9/usr.bin/rpcgen/rpcgen.1 Directory Properties: stable/9/usr.bin/rpcgen/ (props changed) Modified: stable/9/usr.bin/rpcgen/rpc_main.c ============================================================================== --- stable/9/usr.bin/rpcgen/rpc_main.c Mon Feb 13 19:52:18 2012 (r231611) +++ stable/9/usr.bin/rpcgen/rpc_main.c Mon Feb 13 20:59:20 2012 (r231612) @@ -79,13 +79,8 @@ static void s_output(int, const char **, #define EXTEND 1 /* alias for TRUE */ #define DONT_EXTEND 0 /* alias for FALSE */ -#define SVR4_CPP "/usr/ccs/lib/cpp" -#define SUNOS_CPP "/usr/bin/cpp" - -static int cppDefined = 0; /* explicit path for C preprocessor */ - static const char *svcclosetime = "120"; -static const char *CPP = SVR4_CPP; +static const char *CPP = NULL; static const char CPPFLAGS[] = "-C"; static char pathbuf[MAXPATHLEN + 1]; static const char *allv[] = { @@ -101,7 +96,7 @@ static int allnc = sizeof (allnv)/sizeof * machinations for handling expanding argument list */ static void addarg(const char *); /* add another argument to the list */ -static void putarg(int, const char *); /* put argument at specified location */ +static void insarg(int, const char *); /* insert arg at specified location */ static void clear_args(void); /* clear argument list */ static void checkfiles(const char *, const char *); /* check if out file already exists */ @@ -109,7 +104,7 @@ static void checkfiles(const char *, con #define ARGLISTLEN 20 -#define FIXEDARGS 2 +#define FIXEDARGS 0 static char *arglist[ARGLISTLEN]; static int argcount = FIXEDARGS; @@ -292,24 +287,29 @@ clear_args(void) argcount = FIXEDARGS; } -/* make sure that a CPP exists */ +/* prepend C-preprocessor and flags before arguments */ static void -find_cpp(void) +prepend_cpp(void) { - struct stat buf; - - if (stat(CPP, &buf) < 0) { /* SVR4 or explicit cpp does not exist */ - if (cppDefined) { - warnx("cannot find C preprocessor: %s", CPP); - crash(); - } else { /* try the other one */ - CPP = SUNOS_CPP; - if (stat(CPP, &buf) < 0) { /* can't find any cpp */ - warnx("cannot find C preprocessor: %s", CPP); - crash(); - } + int idx = 1; + const char *var; + char *dupvar, *s, *t; + + if (CPP != NULL) + insarg(0, CPP); + else if ((var = getenv("RPCGEN_CPP")) == NULL) + insarg(0, "/usr/bin/cpp"); + else { + /* Parse command line in a rudimentary way */ + dupvar = xstrdup(var); + for (s = dupvar, idx = 0; (t = strsep(&s, " \t")) != NULL; ) { + if (t[0]) + insarg(idx++, t); } + free(dupvar); } + + insarg(idx, CPPFLAGS); } /* @@ -324,9 +324,7 @@ open_input(const char *infile, const cha (void) pipe(pd); switch (childpid = fork()) { case 0: - find_cpp(); - putarg(0, CPP); - putarg(1, CPPFLAGS); + prepend_cpp(); addarg(define); if (infile) addarg(infile); @@ -334,8 +332,8 @@ open_input(const char *infile, const cha (void) close(1); (void) dup2(pd[1], 1); (void) close(pd[0]); - execv(arglist[0], arglist); - err(1, "execv"); + execvp(arglist[0], arglist); + err(1, "execvp %s", arglist[0]); case -1: err(1, "fork"); } @@ -938,18 +936,26 @@ addarg(const char *cp) } +/* + * Insert an argument at the specified location + */ static void -putarg(int place, const char *cp) +insarg(int place, const char *cp) { - if (place >= ARGLISTLEN) { - warnx("arglist coding error"); + int i; + + if (argcount >= ARGLISTLEN) { + warnx("too many defines"); crash(); /*NOTREACHED*/ } - if (cp != NULL) - arglist[place] = xstrdup(cp); - else - arglist[place] = NULL; + + /* Move up existing arguments */ + for (i = argcount - 1; i >= place; i--) + arglist[i + 1] = arglist[i]; + + arglist[place] = xstrdup(cp); + argcount++; } /* @@ -1138,7 +1144,6 @@ parseargs(int argc, const char *argv[], return (0); } CPP = pathbuf; - cppDefined = 1; goto nextarg; Modified: stable/9/usr.bin/rpcgen/rpcgen.1 ============================================================================== --- stable/9/usr.bin/rpcgen/rpcgen.1 Mon Feb 13 19:52:18 2012 (r231611) +++ stable/9/usr.bin/rpcgen/rpcgen.1 Mon Feb 13 20:59:20 2012 (r231612) @@ -490,6 +490,11 @@ Give the name of the directory where .Nm will start looking for the C-preprocessor. .El +.Sh ENVIRONMENT +If the +.Ev RPCGEN_CPP +environment variable is set, its value is used as the command line of the +C preprocessor to be run on the input file. .Sh EXAMPLES The following example: .Dl example% rpcgen -T prot.x From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 00:54:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4197106568A; Tue, 14 Feb 2012 00:54:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCCBB8FC12; Tue, 14 Feb 2012 00:54:50 +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 q1E0soXg070245; Tue, 14 Feb 2012 00:54:50 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E0soHN070239; Tue, 14 Feb 2012 00:54:50 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202140054.q1E0soHN070239@svn.freebsd.org> From: Marius Strobl Date: Tue, 14 Feb 2012 00:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231623 - stable/9/sys/dev/mpt X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 00:54:51 -0000 Author: marius Date: Tue Feb 14 00:54:50 2012 New Revision: 231623 URL: http://svn.freebsd.org/changeset/base/231623 Log: MFC: r231518 Remove extra newlines from panic messages. Modified: stable/9/sys/dev/mpt/mpt.c stable/9/sys/dev/mpt/mpt.h stable/9/sys/dev/mpt/mpt_cam.c stable/9/sys/dev/mpt/mpt_pci.c stable/9/sys/dev/mpt/mpt_reg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mpt/mpt.c ============================================================================== --- stable/9/sys/dev/mpt/mpt.c Tue Feb 14 00:54:40 2012 (r231622) +++ stable/9/sys/dev/mpt/mpt.c Tue Feb 14 00:54:50 2012 (r231623) @@ -1053,6 +1053,12 @@ mpt_hard_reset(struct mpt_softc *mpt) mpt_lprt(mpt, MPT_PRT_DEBUG, "hard reset\n"); + if (mpt->is_1078) { + mpt_write(mpt, MPT_OFFSET_RESET_1078, 0x07); + DELAY(1000); + return; + } + error = mpt_enable_diag_mode(mpt); if (error) { mpt_prt(mpt, "WARNING - Could not enter diagnostic mode !\n"); @@ -2451,6 +2457,11 @@ mpt_download_fw(struct mpt_softc *mpt) uint32_t ext_offset; uint32_t data; + if (mpt->pci_pio_reg == NULL) { + mpt_prt(mpt, "No PIO resource!\n"); + return (ENXIO); + } + mpt_prt(mpt, "Downloading Firmware - Image Size %d\n", mpt->fw_image_size); Modified: stable/9/sys/dev/mpt/mpt.h ============================================================================== --- stable/9/sys/dev/mpt/mpt.h Tue Feb 14 00:54:40 2012 (r231622) +++ stable/9/sys/dev/mpt/mpt.h Tue Feb 14 00:54:50 2012 (r231623) @@ -608,7 +608,7 @@ struct mpt_softc { #endif uint32_t mpt_pers_mask; uint32_t - : 8, + : 7, unit : 8, ready : 1, fw_uploaded : 1, @@ -625,7 +625,8 @@ struct mpt_softc { disabled : 1, is_spi : 1, is_sas : 1, - is_fc : 1; + is_fc : 1, + is_1078 : 1; u_int cfg_role; u_int role; /* role: none, ini, target, both */ @@ -982,12 +983,14 @@ mpt_read(struct mpt_softc *mpt, int offs static __inline void mpt_pio_write(struct mpt_softc *mpt, size_t offset, uint32_t val) { + KASSERT(mpt->pci_pio_reg != NULL, ("no PIO resource")); bus_space_write_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset, val); } static __inline uint32_t mpt_pio_read(struct mpt_softc *mpt, int offset) { + KASSERT(mpt->pci_pio_reg != NULL, ("no PIO resource")); return (bus_space_read_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset)); } /*********************** Reply Frame/Request Management ***********************/ Modified: stable/9/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/9/sys/dev/mpt/mpt_cam.c Tue Feb 14 00:54:40 2012 (r231622) +++ stable/9/sys/dev/mpt/mpt_cam.c Tue Feb 14 00:54:50 2012 (r231623) @@ -1279,8 +1279,9 @@ mpt_execute_req_a64(void *arg, bus_dma_s char *mpt_off; union ccb *ccb; struct mpt_softc *mpt; - int seg, first_lim; - uint32_t flags, nxt_off; + bus_addr_t chain_list_addr; + int first_lim, seg, this_seg_lim; + uint32_t addr, cur_off, flags, nxt_off, tf; void *sglp = NULL; MSG_REQUEST_HEADER *hdrp; SGE_SIMPLE64 *se; @@ -1434,16 +1435,20 @@ bad: se = (SGE_SIMPLE64 *) sglp; for (seg = 0; seg < first_lim; seg++, se++, dm_segs++) { - uint32_t tf; - + tf = flags; memset(se, 0, sizeof (*se)); + MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); se->Address.Low = htole32(dm_segs->ds_addr & 0xffffffff); if (sizeof(bus_addr_t) > 4) { - se->Address.High = - htole32(((uint64_t)dm_segs->ds_addr) >> 32); + addr = ((uint64_t)dm_segs->ds_addr) >> 32; + /* SAS1078 36GB limitation WAR */ + if (mpt->is_1078 && (((uint64_t)dm_segs->ds_addr + + MPI_SGE_LENGTH(se->FlagsLength)) >> 32) == 9) { + addr |= (1 << 31); + tf |= MPI_SGE_FLAGS_LOCAL_ADDRESS; + } + se->Address.High = htole32(addr); } - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); - tf = flags; if (seg == first_lim - 1) { tf |= MPI_SGE_FLAGS_LAST_ELEMENT; } @@ -1468,15 +1473,11 @@ bad: /* * Make up the rest of the data segments out of a chain element - * (contiained in the current request frame) which points to + * (contained in the current request frame) which points to * SIMPLE64 elements in the next request frame, possibly ending * with *another* chain element (if there's more). */ while (seg < nseg) { - int this_seg_lim; - uint32_t tf, cur_off; - bus_addr_t chain_list_addr; - /* * Point to the chain descriptor. Note that the chain * descriptor is at the end of the *previous* list (whether @@ -1504,7 +1505,7 @@ bad: nxt_off += MPT_RQSL(mpt); /* - * Now initialized the chain descriptor. + * Now initialize the chain descriptor. */ memset(ce, 0, sizeof (*ce)); @@ -1554,16 +1555,24 @@ bad: * set the end of list and end of buffer flags. */ while (seg < this_seg_lim) { + tf = flags; memset(se, 0, sizeof (*se)); + MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); se->Address.Low = htole32(dm_segs->ds_addr & 0xffffffff); if (sizeof (bus_addr_t) > 4) { - se->Address.High = - htole32(((uint64_t)dm_segs->ds_addr) >> 32); + addr = ((uint64_t)dm_segs->ds_addr) >> 32; + /* SAS1078 36GB limitation WAR */ + if (mpt->is_1078 && + (((uint64_t)dm_segs->ds_addr + + MPI_SGE_LENGTH(se->FlagsLength)) >> + 32) == 9) { + addr |= (1 << 31); + tf |= MPI_SGE_FLAGS_LOCAL_ADDRESS; + } + se->Address.High = htole32(addr); } - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); - tf = flags; - if (seg == this_seg_lim - 1) { + if (seg == this_seg_lim - 1) { tf |= MPI_SGE_FLAGS_LAST_ELEMENT; } if (seg == nseg - 1) { @@ -1868,7 +1877,7 @@ bad: /* * Make up the rest of the data segments out of a chain element - * (contiained in the current request frame) which points to + * (contained in the current request frame) which points to * SIMPLE32 elements in the next request frame, possibly ending * with *another* chain element (if there's more). */ @@ -1904,7 +1913,7 @@ bad: nxt_off += MPT_RQSL(mpt); /* - * Now initialized the chain descriptor. + * Now initialize the chain descriptor. */ memset(ce, 0, sizeof (*ce)); @@ -1958,7 +1967,7 @@ bad: MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); tf = flags; - if (seg == this_seg_lim - 1) { + if (seg == this_seg_lim - 1) { tf |= MPI_SGE_FLAGS_LAST_ELEMENT; } if (seg == nseg - 1) { Modified: stable/9/sys/dev/mpt/mpt_pci.c ============================================================================== --- stable/9/sys/dev/mpt/mpt_pci.c Tue Feb 14 00:54:40 2012 (r231622) +++ stable/9/sys/dev/mpt/mpt_pci.c Tue Feb 14 00:54:50 2012 (r231623) @@ -438,6 +438,10 @@ mpt_pci_attach(device_t dev) case PCI_PRODUCT_LSI_FC7X04X: mpt->is_fc = 1; break; + case PCI_PRODUCT_LSI_SAS1078: + case PCI_PRODUCT_LSI_SAS1078DE: + mpt->is_1078 = 1; + /* FALLTHROUGH */ case PCI_PRODUCT_LSI_SAS1064: case PCI_PRODUCT_LSI_SAS1064A: case PCI_PRODUCT_LSI_SAS1064E: @@ -445,8 +449,6 @@ mpt_pci_attach(device_t dev) case PCI_PRODUCT_LSI_SAS1066E: case PCI_PRODUCT_LSI_SAS1068: case PCI_PRODUCT_LSI_SAS1068E: - case PCI_PRODUCT_LSI_SAS1078: - case PCI_PRODUCT_LSI_SAS1078DE: mpt->is_sas = 1; break; default: @@ -527,23 +529,31 @@ mpt_pci_attach(device_t dev) mpt->pci_pio_reg = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &mpt_io_bar, RF_ACTIVE); if (mpt->pci_pio_reg == NULL) { - device_printf(dev, "unable to map registers in PIO mode\n"); - goto bad; + if (bootverbose) { + device_printf(dev, + "unable to map registers in PIO mode\n"); + } + } else { + mpt->pci_pio_st = rman_get_bustag(mpt->pci_pio_reg); + mpt->pci_pio_sh = rman_get_bushandle(mpt->pci_pio_reg); } - mpt->pci_pio_st = rman_get_bustag(mpt->pci_pio_reg); - mpt->pci_pio_sh = rman_get_bushandle(mpt->pci_pio_reg); /* Allocate kernel virtual memory for the 9x9's Mem0 region */ mpt_mem_bar = PCIR_BAR(mpt_mem_bar); mpt->pci_reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &mpt_mem_bar, RF_ACTIVE); if (mpt->pci_reg == NULL) { - device_printf(dev, "Unable to memory map registers.\n"); - if (mpt->is_sas) { + if (bootverbose || mpt->is_sas || mpt->pci_pio_reg == NULL) { + device_printf(dev, + "Unable to memory map registers.\n"); + } + if (mpt->is_sas || mpt->pci_pio_reg == NULL) { device_printf(dev, "Giving Up.\n"); goto bad; } - device_printf(dev, "Falling back to PIO mode.\n"); + if (bootverbose) { + device_printf(dev, "Falling back to PIO mode.\n"); + } mpt->pci_st = mpt->pci_pio_st; mpt->pci_sh = mpt->pci_pio_sh; } else { Modified: stable/9/sys/dev/mpt/mpt_reg.h ============================================================================== --- stable/9/sys/dev/mpt/mpt_reg.h Tue Feb 14 00:54:40 2012 (r231622) +++ stable/9/sys/dev/mpt/mpt_reg.h Tue Feb 14 00:54:50 2012 (r231623) @@ -77,6 +77,7 @@ #define MPT_OFFSET_REPLY_Q 0x44 #define MPT_OFFSET_HOST_INDEX 0x50 #define MPT_OFFSET_FUBAR 0x90 +#define MPT_OFFSET_RESET_1078 0x10fc /* Bit Maps for DOORBELL register */ enum DB_STATE_BITS { From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 01:05:38 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09A4E1065672; Tue, 14 Feb 2012 01:05:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E85068FC19; Tue, 14 Feb 2012 01:05: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 q1E15bNW070794; Tue, 14 Feb 2012 01:05:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E15bPo070788; Tue, 14 Feb 2012 01:05:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202140105.q1E15bPo070788@svn.freebsd.org> From: Marius Strobl Date: Tue, 14 Feb 2012 01:05:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231626 - stable/9/sys/dev/mpt X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 01:05:38 -0000 Author: marius Date: Tue Feb 14 01:05:37 2012 New Revision: 231626 URL: http://svn.freebsd.org/changeset/base/231626 Log: Forced commit to denote that the commit message of r231623 actually should have read: MFC: r231518 Flesh out support for SAS1078 and SAS1078DE (which are said to actually be the same chip): - The I/O port resource may not be available with these. However, given that we actually only need this resource for some controllers that require their firmware to be up- and downloaded (which excludes the SAS1078{,DE}) just handle failure to allocate this resource gracefully when possible. While at it, generally put non-fatal resource allocation failures under bootverbose. - SAS1078{,DE} use a different hard reset protocol. - Add workarounds for the 36GB physical address limitation of scatter/ gather elements of these controllers. Tested by: Slawa Olhovchenkov PR: 149220 (remaining part) Modified: stable/9/sys/dev/mpt/mpt.c stable/9/sys/dev/mpt/mpt.h stable/9/sys/dev/mpt/mpt_cam.c stable/9/sys/dev/mpt/mpt_pci.c stable/9/sys/dev/mpt/mpt_reg.h Modified: stable/9/sys/dev/mpt/mpt.c ============================================================================== Modified: stable/9/sys/dev/mpt/mpt.h ============================================================================== Modified: stable/9/sys/dev/mpt/mpt_cam.c ============================================================================== Modified: stable/9/sys/dev/mpt/mpt_pci.c ============================================================================== Modified: stable/9/sys/dev/mpt/mpt_reg.h ============================================================================== From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 01:15:02 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DB85106566B; Tue, 14 Feb 2012 01:15:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 033F28FC18; Tue, 14 Feb 2012 01:15: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 q1E1F1U3071275; Tue, 14 Feb 2012 01:15:01 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E1F1S6071271; Tue, 14 Feb 2012 01:15:01 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202140115.q1E1F1S6071271@svn.freebsd.org> From: Marius Strobl Date: Tue, 14 Feb 2012 01:15:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231629 - stable/9/sys/dev/mpt X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 01:15:02 -0000 Author: marius Date: Tue Feb 14 01:15:01 2012 New Revision: 231629 URL: http://svn.freebsd.org/changeset/base/231629 Log: MFC: r231228 Remove extra newlines from panic messages. Modified: stable/9/sys/dev/mpt/mpt.c stable/9/sys/dev/mpt/mpt.h stable/9/sys/dev/mpt/mpt_cam.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mpt/mpt.c ============================================================================== --- stable/9/sys/dev/mpt/mpt.c Tue Feb 14 01:09:10 2012 (r231628) +++ stable/9/sys/dev/mpt/mpt.c Tue Feb 14 01:15:01 2012 (r231629) @@ -148,7 +148,7 @@ static __inline struct mpt_personality * mpt_pers_find(struct mpt_softc *mpt, u_int start_at) { KASSERT(start_at <= MPT_MAX_PERSONALITIES, - ("mpt_pers_find: starting position out of range\n")); + ("mpt_pers_find: starting position out of range")); while (start_at < MPT_MAX_PERSONALITIES && (mpt->mpt_pers_mask & (0x1 << start_at)) == 0) { @@ -1203,8 +1203,7 @@ mpt_free_request(struct mpt_softc *mpt, uint32_t offset, reply_baddr; if (req == NULL || req != &mpt->request_pool[req->index]) { - panic("mpt_free_request bad req ptr\n"); - return; + panic("mpt_free_request: bad req ptr"); } if ((nxt = req->chain) != NULL) { req->chain = NULL; @@ -1267,7 +1266,7 @@ retry: req = TAILQ_FIRST(&mpt->request_free_list); if (req != NULL) { KASSERT(req == &mpt->request_pool[req->index], - ("mpt_get_request: corrupted request free list\n")); + ("mpt_get_request: corrupted request free list")); KASSERT(req->state == REQ_STATE_FREE, ("req %p:%u not free on free list %x index %d function %x", req, req->serno, req->state, req->index, Modified: stable/9/sys/dev/mpt/mpt.h ============================================================================== --- stable/9/sys/dev/mpt/mpt.h Tue Feb 14 01:09:10 2012 (r231628) +++ stable/9/sys/dev/mpt/mpt.h Tue Feb 14 01:15:01 2012 (r231629) @@ -852,7 +852,7 @@ mpt_lockspl(struct mpt_softc *mpt) mpt->mpt_splsaved = s; } else { splx(s); - panic("Recursed lock with mask: 0x%x\n", s); + panic("Recursed lock with mask: 0x%x", s); } } @@ -864,7 +864,7 @@ mpt_unlockspl(struct mpt_softc *mpt) splx(mpt->mpt_splsaved); } } else - panic("Negative lock count\n"); + panic("Negative lock count"); } static __inline int @@ -1147,7 +1147,7 @@ static __inline request_t * mpt_tag_2_req(struct mpt_softc *mpt, uint32_t tag) { uint16_t rtg = (tag >> 18); - KASSERT(rtg < mpt->tgt_cmds_allocated, ("bad tag %d\n", tag)); + KASSERT(rtg < mpt->tgt_cmds_allocated, ("bad tag %d", tag)); KASSERT(mpt->tgt_cmd_ptrs, ("no cmd backpointer array")); KASSERT(mpt->tgt_cmd_ptrs[rtg], ("no cmd backpointer")); return (mpt->tgt_cmd_ptrs[rtg]); @@ -1214,7 +1214,7 @@ mpt_req_spcl(struct mpt_softc *mpt, requ return; } } - panic("%s(%d): req %p:%u function %x not in els or tgt ptrs\n", + panic("%s(%d): req %p:%u function %x not in els or tgt ptrs", s, line, req, req->serno, ((PTR_MSG_REQUEST_HEADER)req->req_vbuf)->Function); } @@ -1228,13 +1228,13 @@ mpt_req_not_spcl(struct mpt_softc *mpt, int i; for (i = 0; i < mpt->els_cmds_allocated; i++) { KASSERT(req != mpt->els_cmd_ptrs[i], - ("%s(%d): req %p:%u func %x in els ptrs at ioindex %d\n", + ("%s(%d): req %p:%u func %x in els ptrs at ioindex %d", s, line, req, req->serno, ((PTR_MSG_REQUEST_HEADER)req->req_vbuf)->Function, i)); } for (i = 0; i < mpt->tgt_cmds_allocated; i++) { KASSERT(req != mpt->tgt_cmd_ptrs[i], - ("%s(%d): req %p:%u func %x in tgt ptrs at ioindex %d\n", + ("%s(%d): req %p:%u func %x in tgt ptrs at ioindex %d", s, line, req, req->serno, ((PTR_MSG_REQUEST_HEADER)req->req_vbuf)->Function, i)); } Modified: stable/9/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/9/sys/dev/mpt/mpt_cam.c Tue Feb 14 01:09:10 2012 (r231628) +++ stable/9/sys/dev/mpt/mpt_cam.c Tue Feb 14 01:15:01 2012 (r231629) @@ -1357,7 +1357,7 @@ bad: MPT_TGT_STATE(mpt, cmd_req)->req = NULL; } ccb->ccb_h.status &= ~CAM_SIM_QUEUED; - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); mpt_free_request(mpt, req); @@ -1643,7 +1643,7 @@ out: bus_dmamap_unload(mpt->buffer_dmat, req->dmap); } ccb->ccb_h.status &= ~CAM_SIM_QUEUED; - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); mpt_free_request(mpt, req); @@ -1768,7 +1768,7 @@ bad: MPT_TGT_STATE(mpt, cmd_req)->req = NULL; } ccb->ccb_h.status &= ~CAM_SIM_QUEUED; - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); mpt_free_request(mpt, req); @@ -2038,7 +2038,7 @@ out: bus_dmamap_unload(mpt->buffer_dmat, req->dmap); } ccb->ccb_h.status &= ~CAM_SIM_QUEUED; - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); mpt_free_request(mpt, req); @@ -2746,7 +2746,7 @@ mpt_scsi_reply_handler(struct mpt_softc mpt_prt(mpt, "mpt_scsi_reply_handler: %p:%u complete\n", req, req->serno); } - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); MPTLOCK_2_CAMLOCK(mpt); xpt_done(ccb); CAMLOCK_2_MPTLOCK(mpt); @@ -3661,7 +3661,7 @@ mpt_action(struct cam_sim *sim, union cc break; } mpt_calc_geometry(ccg, /*extended*/1); - KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__)); + KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); break; } case XPT_PATH_INQ: /* Path routing inquiry */ @@ -4560,7 +4560,7 @@ mpt_target_start_io(struct mpt_softc *mp request_t *req; KASSERT((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE, - ("dxfer_len %u but direction is NONE\n", csio->dxfer_len)); + ("dxfer_len %u but direction is NONE", csio->dxfer_len)); if ((req = mpt_get_request(mpt, FALSE)) == NULL) { if (mpt->outofbeer == 0) { @@ -5464,7 +5464,7 @@ mpt_scsi_tgt_reply_handler(struct mpt_so mpt_set_ccb_status(ccb, CAM_REQ_CMP); ccb->ccb_h.status &= ~CAM_SIM_QUEUED; KASSERT(ccb->ccb_h.status, - ("zero ccb sts at %d\n", __LINE__)); + ("zero ccb sts at %d", __LINE__)); tgt->state = TGT_STATE_IN_CAM; if (mpt->outofbeer) { ccb->ccb_h.status |= CAM_RELEASE_SIMQ; @@ -5526,7 +5526,7 @@ mpt_scsi_tgt_reply_handler(struct mpt_so mpt_set_ccb_status(ccb, CAM_REQ_CMP); ccb->ccb_h.status &= ~CAM_SIM_QUEUED; KASSERT(ccb->ccb_h.status, - ("ZERO ccb sts at %d\n", __LINE__)); + ("ZERO ccb sts at %d", __LINE__)); tgt->ccb = NULL; } else { mpt_lprt(mpt, MPT_PRT_DEBUG, @@ -5598,7 +5598,7 @@ mpt_scsi_tgt_reply_handler(struct mpt_so } tgt = MPT_TGT_STATE(mpt, req); KASSERT(tgt->state == TGT_STATE_LOADING, - ("bad state 0x%x on reply to buffer post\n", tgt->state)); + ("bad state 0x%x on reply to buffer post", tgt->state)); mpt_assign_serno(mpt, req); tgt->state = TGT_STATE_LOADED; break; From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 04:07:36 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BD72106564A; Tue, 14 Feb 2012 04:07: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 455BE8FC12; Tue, 14 Feb 2012 04:07: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 q1E47aN1076892; Tue, 14 Feb 2012 04:07:36 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E47aEQ076890; Tue, 14 Feb 2012 04:07:36 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202140407.q1E47aEQ076890@svn.freebsd.org> From: Rick Macklem Date: Tue, 14 Feb 2012 04:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231633 - stable/9/sys/nlm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 04:07:36 -0000 Author: rmacklem Date: Tue Feb 14 04:07:35 2012 New Revision: 231633 URL: http://svn.freebsd.org/changeset/base/231633 Log: MFC: r230801 jwd@ reported a problem via email to freebsd-fs@ on Aug 25, 2011 under the subject "F_RDLCK lock to FreeBSD NFS fails to R/O target file". This occurred because the server side NLM always checked for VWRITE access, irrespective of the type of lock request. This patch replaces VOP_ACCESS(..VWRITE..) with one appropriate to the lock operation. It allows unlock and lock cancellation to be done without a check of VOP_ACCESS(), so that files can't be left locked indefinitely after the file permissions have been changed. Modified: stable/9/sys/nlm/nlm_prot_impl.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/nlm/nlm_prot_impl.c ============================================================================== --- stable/9/sys/nlm/nlm_prot_impl.c Tue Feb 14 02:03:17 2012 (r231632) +++ stable/9/sys/nlm/nlm_prot_impl.c Tue Feb 14 04:07:35 2012 (r231633) @@ -1774,10 +1774,10 @@ struct vfs_state { static int nlm_get_vfs_state(struct nlm_host *host, struct svc_req *rqstp, - fhandle_t *fhp, struct vfs_state *vs) + fhandle_t *fhp, struct vfs_state *vs, accmode_t accmode) { int error, exflags; - struct ucred *cred = NULL, *credanon; + struct ucred *cred = NULL, *credanon = NULL; memset(vs, 0, sizeof(*vs)); @@ -1787,14 +1787,19 @@ nlm_get_vfs_state(struct nlm_host *host, } vs->vs_vfslocked = VFS_LOCK_GIANT(vs->vs_mp); - error = VFS_CHECKEXP(vs->vs_mp, (struct sockaddr *)&host->nh_addr, - &exflags, &credanon, NULL, NULL); - if (error) - goto out; + /* accmode == 0 means don't check, since it is an unlock. */ + if (accmode != 0) { + error = VFS_CHECKEXP(vs->vs_mp, + (struct sockaddr *)&host->nh_addr, &exflags, &credanon, + NULL, NULL); + if (error) + goto out; - if (exflags & MNT_EXRDONLY || (vs->vs_mp->mnt_flag & MNT_RDONLY)) { - error = EROFS; - goto out; + if (exflags & MNT_EXRDONLY || + (vs->vs_mp->mnt_flag & MNT_RDONLY)) { + error = EROFS; + goto out; + } } error = VFS_FHTOVP(vs->vs_mp, &fhp->fh_fid, LK_EXCLUSIVE, &vs->vs_vp); @@ -1802,22 +1807,31 @@ nlm_get_vfs_state(struct nlm_host *host, goto out; vs->vs_vnlocked = TRUE; - if (!svc_getcred(rqstp, &cred, NULL)) { - error = EINVAL; - goto out; - } - if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) { - crfree(cred); - cred = credanon; - credanon = NULL; - } + if (accmode != 0) { + if (!svc_getcred(rqstp, &cred, NULL)) { + error = EINVAL; + goto out; + } + if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) { + crfree(cred); + cred = credanon; + credanon = NULL; + } - /* - * Check cred. - */ - error = VOP_ACCESS(vs->vs_vp, VWRITE, cred, curthread); - if (error) - goto out; + /* + * Check cred. + */ + error = VOP_ACCESS(vs->vs_vp, accmode, cred, curthread); + /* + * If this failed and accmode != VWRITE, try again with + * VWRITE to maintain backwards compatibility with the + * old code that always used VWRITE. + */ + if (error != 0 && accmode != VWRITE) + error = VOP_ACCESS(vs->vs_vp, VWRITE, cred, curthread); + if (error) + goto out; + } #if __FreeBSD_version < 800011 VOP_UNLOCK(vs->vs_vp, 0, curthread); @@ -1871,6 +1885,7 @@ nlm_do_test(nlm4_testargs *argp, nlm4_te struct nlm_host *host, *bhost; int error, sysid; struct flock fl; + accmode_t accmode; memset(result, 0, sizeof(*result)); memset(&vs, 0, sizeof(vs)); @@ -1896,7 +1911,8 @@ nlm_do_test(nlm4_testargs *argp, nlm4_te goto out; } - error = nlm_get_vfs_state(host, rqstp, &fh, &vs); + accmode = argp->exclusive ? VWRITE : VREAD; + error = nlm_get_vfs_state(host, rqstp, &fh, &vs, accmode); if (error) { result->stat.stat = nlm_convert_error(error); goto out; @@ -1967,6 +1983,7 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re struct nlm_host *host; int error, sysid; struct flock fl; + accmode_t accmode; memset(result, 0, sizeof(*result)); memset(&vs, 0, sizeof(vs)); @@ -2001,7 +2018,8 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re goto out; } - error = nlm_get_vfs_state(host, rqstp, &fh, &vs); + accmode = argp->exclusive ? VWRITE : VREAD; + error = nlm_get_vfs_state(host, rqstp, &fh, &vs, accmode); if (error) { result->stat.stat = nlm_convert_error(error); goto out; @@ -2180,7 +2198,7 @@ nlm_do_cancel(nlm4_cancargs *argp, nlm4_ goto out; } - error = nlm_get_vfs_state(host, rqstp, &fh, &vs); + error = nlm_get_vfs_state(host, rqstp, &fh, &vs, (accmode_t)0); if (error) { result->stat.stat = nlm_convert_error(error); goto out; @@ -2269,7 +2287,7 @@ nlm_do_unlock(nlm4_unlockargs *argp, nlm goto out; } - error = nlm_get_vfs_state(host, rqstp, &fh, &vs); + error = nlm_get_vfs_state(host, rqstp, &fh, &vs, (accmode_t)0); if (error) { result->stat.stat = nlm_convert_error(error); goto out; From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 04:20:02 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8E4D1065672; Tue, 14 Feb 2012 04:20:02 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AAA78FC1A; Tue, 14 Feb 2012 04:20: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 q1E4K2Bt077363; Tue, 14 Feb 2012 04:20:02 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E4K266077361; Tue, 14 Feb 2012 04:20:02 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201202140420.q1E4K266077361@svn.freebsd.org> From: David Xu Date: Tue, 14 Feb 2012 04:20:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231635 - stable/9/lib/libthr/thread X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 04:20:02 -0000 Author: davidxu Date: Tue Feb 14 04:20:02 2012 New Revision: 231635 URL: http://svn.freebsd.org/changeset/base/231635 Log: MFC 231106: Plug a memory leak. When a cached thread is reused, don't clear sleep queue pointers, just reuse it. MFC 231503: Make code more stable by checking NULL pointers. Modified: stable/9/lib/libthr/thread/thr_list.c stable/9/lib/libthr/thread/thr_private.h Directory Properties: stable/9/lib/libthr/ (props changed) Modified: stable/9/lib/libthr/thread/thr_list.c ============================================================================== --- stable/9/lib/libthr/thread/thr_list.c Tue Feb 14 04:18:59 2012 (r231634) +++ stable/9/lib/libthr/thread/thr_list.c Tue Feb 14 04:20:02 2012 (r231635) @@ -149,11 +149,20 @@ _thr_alloc(struct pthread *curthread) if (total_threads > MAX_THREADS) return (NULL); atomic_fetchadd_int(&total_threads, 1); - thread = malloc(sizeof(struct pthread)); + thread = calloc(1, sizeof(struct pthread)); if (thread == NULL) { atomic_fetchadd_int(&total_threads, -1); return (NULL); } + if ((thread->sleepqueue = _sleepq_alloc()) == NULL || + (thread->wake_addr = _thr_alloc_wake_addr()) == NULL) { + thr_destroy(curthread, thread); + atomic_fetchadd_int(&total_threads, -1); + return (NULL); + } + } else { + bzero(&thread->_pthread_startzero, + __rangeof(struct pthread, _pthread_startzero, _pthread_endzero)); } if (curthread != NULL) { THR_LOCK_ACQUIRE(curthread, &tcb_lock); @@ -163,10 +172,7 @@ _thr_alloc(struct pthread *curthread) tcb = _tcb_ctor(thread, 1 /* initial tls */); } if (tcb != NULL) { - memset(thread, 0, sizeof(*thread)); thread->tcb = tcb; - thread->sleepqueue = _sleepq_alloc(); - thread->wake_addr = _thr_alloc_wake_addr(); } else { thr_destroy(curthread, thread); atomic_fetchadd_int(&total_threads, -1); @@ -194,8 +200,6 @@ _thr_free(struct pthread *curthread, str } thread->tcb = NULL; if ((curthread == NULL) || (free_thread_count >= MAX_CACHED_THREADS)) { - _sleepq_free(thread->sleepqueue); - _thr_release_wake_addr(thread->wake_addr); thr_destroy(curthread, thread); atomic_fetchadd_int(&total_threads, -1); } else { @@ -213,6 +217,10 @@ _thr_free(struct pthread *curthread, str static void thr_destroy(struct pthread *curthread __unused, struct pthread *thread) { + if (thread->sleepqueue != NULL) + _sleepq_free(thread->sleepqueue); + if (thread->wake_addr != NULL) + _thr_release_wake_addr(thread->wake_addr); free(thread); } Modified: stable/9/lib/libthr/thread/thr_private.h ============================================================================== --- stable/9/lib/libthr/thread/thr_private.h Tue Feb 14 04:18:59 2012 (r231634) +++ stable/9/lib/libthr/thread/thr_private.h Tue Feb 14 04:20:02 2012 (r231635) @@ -343,6 +343,7 @@ struct pthread_key { * Thread structure. */ struct pthread { +#define _pthread_startzero tid /* Kernel thread id. */ long tid; #define TID_TERMINATED 1 @@ -506,12 +507,6 @@ struct pthread { /* Event */ td_event_msg_t event_buf; - struct wake_addr *wake_addr; -#define WAKE_ADDR(td) ((td)->wake_addr) - - /* Sleep queue */ - struct sleepqueue *sleepqueue; - /* Wait channel */ void *wchan; @@ -526,6 +521,14 @@ struct pthread { /* Deferred threads from pthread_cond_signal. */ unsigned int *defer_waiters[MAX_DEFER_WAITERS]; +#define _pthread_endzero wake_addr + + struct wake_addr *wake_addr; +#define WAKE_ADDR(td) ((td)->wake_addr) + + /* Sleep queue */ + struct sleepqueue *sleepqueue; + }; #define THR_SHOULD_GC(thrd) \ From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 04:48:37 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89BD1106566C; Tue, 14 Feb 2012 04:48: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 73EA98FC08; Tue, 14 Feb 2012 04:48: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 q1E4mbi7078287; Tue, 14 Feb 2012 04:48:37 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E4mbq8078284; Tue, 14 Feb 2012 04:48:37 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202140448.q1E4mbq8078284@svn.freebsd.org> From: Rick Macklem Date: Tue, 14 Feb 2012 04:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231636 - in stable/9/sys: fs/nfsclient nfsclient X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 04:48:37 -0000 Author: rmacklem Date: Tue Feb 14 04:48:36 2012 New Revision: 231636 URL: http://svn.freebsd.org/changeset/base/231636 Log: MFC: r230803 When a "mount -u" switches an NFS mount point from TCP to UDP, any thread doing an I/O RPC with a transfer size greater than NFS_UDPMAXDATA will be hung indefinitely, retrying the RPC. After a discussion on freebsd-fs@, I decided to add a warning message for this case, as suggested by Jeremy Chadwick. Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c stable/9/sys/nfsclient/nfs_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Tue Feb 14 04:20:02 2012 (r231635) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Tue Feb 14 04:48:36 2012 (r231636) @@ -989,6 +989,19 @@ nfs_mount(struct mount *mp) error = EIO; goto out; } + + /* + * If a change from TCP->UDP is done and there are thread(s) + * that have I/O RPC(s) in progress with a tranfer size + * greater than NFS_MAXDGRAMDATA, those thread(s) will be + * hung, retrying the RPC(s) forever. Usually these threads + * will be seen doing an uninterruptible sleep on wait channel + * "newnfsreq" (truncated to "newnfsre" by procstat). + */ + if (args.sotype == SOCK_DGRAM && nmp->nm_sotype == SOCK_STREAM) + tprintf(td->td_proc, LOG_WARNING, + "Warning: mount -u that changes TCP->UDP can result in hung threads\n"); + /* * When doing an update, we can't change version, * security, switch lockd strategies or change cookie Modified: stable/9/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/9/sys/nfsclient/nfs_vfsops.c Tue Feb 14 04:20:02 2012 (r231635) +++ stable/9/sys/nfsclient/nfs_vfsops.c Tue Feb 14 04:48:36 2012 (r231636) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1106,6 +1107,19 @@ nfs_mount(struct mount *mp) error = EIO; goto out; } + + /* + * If a change from TCP->UDP is done and there are thread(s) + * that have I/O RPC(s) in progress with a tranfer size + * greater than NFS_MAXDGRAMDATA, those thread(s) will be + * hung, retrying the RPC(s) forever. Usually these threads + * will be seen doing an uninterruptible sleep on wait channel + * "newnfsreq" (truncated to "newnfsre" by procstat). + */ + if (args.sotype == SOCK_DGRAM && nmp->nm_sotype == SOCK_STREAM) + tprintf(curthread->td_proc, LOG_WARNING, + "Warning: mount -u that changes TCP->UDP can result in hung threads\n"); + /* * When doing an update, we can't change from or to * v3, switch lockd strategies or change cookie translation From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 06:40:59 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40190106564A; Tue, 14 Feb 2012 06:40:59 +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 1021C8FC14; Tue, 14 Feb 2012 06:40:59 +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 q1E6ewix082532; Tue, 14 Feb 2012 06:40:58 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E6ewZR082530; Tue, 14 Feb 2012 06:40:58 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201202140640.q1E6ewZR082530@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 14 Feb 2012 06:40:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231638 - stable/9/etc/devd X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 06:40:59 -0000 Author: hselasky Date: Tue Feb 14 06:40:58 2012 New Revision: 231638 URL: http://svn.freebsd.org/changeset/base/231638 Log: MFC r231575: Update /etc/devd/usb.conf Modified: stable/9/etc/devd/usb.conf Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/devd/usb.conf ============================================================================== --- stable/9/etc/devd/usb.conf Tue Feb 14 05:12:52 2012 (r231637) +++ stable/9/etc/devd/usb.conf Tue Feb 14 06:40:58 2012 (r231638) @@ -157,7 +157,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0403"; - match "product" "(0x6001|0x6004|0x6010|0x6011|0x8372|0x9e90|0xcc48|0xcc49|0xcc4a|0xd678|0xe6c8|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xee18|0xf608|0xf60b|0xf850|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfc08|0xfc09|0xfc0b|0xfc0c|0xfc0d|0xfc82)"; + match "product" "(0x6001|0x6004|0x6010|0x6011|0x8372|0x9e90|0xa6d0|0xa6d0|0xcc48|0xcc49|0xcc4a|0xd678|0xe6c8|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xee18|0xf608|0xf60b|0xf850|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfc08|0xfc09|0xfc0b|0xfc0c|0xfc0d|0xfc82)"; action "kldload uftdi"; }; @@ -293,7 +293,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0411"; - match "product" "(0x0148|0x0150|0x015d|0x016f)"; + match "product" "(0x0148|0x0150|0x015d|0x016f|0x01a2)"; action "kldload if_run"; }; @@ -1021,7 +1021,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x05c6"; - match "product" "(0x6000|0x6613)"; + match "product" "(0x1000|0x6000|0x6613)"; action "kldload u3g"; }; @@ -1301,7 +1301,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0789"; - match "product" "(0x0162|0x0163|0x0164)"; + match "product" "(0x0162|0x0163|0x0164|0x0166)"; action "kldload if_run"; }; @@ -2093,7 +2093,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0b95"; - match "product" "(0x1720|0x1780|0x7720|0x772a|0x772b)"; + match "product" "(0x1720|0x1780|0x7720|0x772a|0x772b|0x7e2b)"; action "kldload if_axe"; }; @@ -4205,6 +4205,15 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "intclass" "0x02"; + match "intsubclass" "0x02"; + match "intprotocol" "0xff"; + action "kldload umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "intclass" "0x03"; match "intsubclass" "0x01"; match "intprotocol" "0x01"; @@ -4327,5 +4336,5 @@ nomatch 32 { action "kldload umass"; }; -# 1645 USB entries processed +# 1652 USB entries processed From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 07:12:46 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E015106564A; Tue, 14 Feb 2012 07:12:46 +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 88A798FC17; Tue, 14 Feb 2012 07:12:46 +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 q1E7CkAR083597; Tue, 14 Feb 2012 07:12:46 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E7CkGm083595; Tue, 14 Feb 2012 07:12:46 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201202140712.q1E7CkGm083595@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 14 Feb 2012 07:12:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231640 - stable/9/sys/geom/part X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 07:12:46 -0000 Author: ae Date: Tue Feb 14 07:12:46 2012 New Revision: 231640 URL: http://svn.freebsd.org/changeset/base/231640 Log: MFC r231349: Let's be more realistic and limit maximum number of partition to 4k. Modified: stable/9/sys/geom/part/g_part_apm.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/part/g_part_apm.c ============================================================================== --- stable/9/sys/geom/part/g_part_apm.c Tue Feb 14 06:42:43 2012 (r231639) +++ stable/9/sys/geom/part/g_part_apm.c Tue Feb 14 07:12:46 2012 (r231640) @@ -102,7 +102,7 @@ static struct g_part_scheme g_part_apm_s sizeof(struct g_part_apm_table), .gps_entrysz = sizeof(struct g_part_apm_entry), .gps_minent = 16, - .gps_maxent = INT_MAX, + .gps_maxent = 4096, }; G_PART_SCHEME_DECLARE(g_part_apm); From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 07:24:23 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 146331065729; Tue, 14 Feb 2012 07:24:23 +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 F21508FC12; Tue, 14 Feb 2012 07:24:22 +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 q1E7OMeb084082; Tue, 14 Feb 2012 07:24:22 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E7OMBX084079; Tue, 14 Feb 2012 07:24:22 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201202140724.q1E7OMBX084079@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 14 Feb 2012 07:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231643 - in stable/9/sys: geom/part sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 07:24:23 -0000 Author: ae Date: Tue Feb 14 07:24:22 2012 New Revision: 231643 URL: http://svn.freebsd.org/changeset/base/231643 Log: MFC r231367: Add alias for the partition with type 0x42 to the MBR scheme. Modified: stable/9/sys/geom/part/g_part_mbr.c stable/9/sys/sys/diskmbr.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/part/g_part_mbr.c ============================================================================== --- stable/9/sys/geom/part/g_part_mbr.c Tue Feb 14 07:14:42 2012 (r231642) +++ stable/9/sys/geom/part/g_part_mbr.c Tue Feb 14 07:24:22 2012 (r231643) @@ -119,6 +119,7 @@ static struct g_part_mbr_alias { { DOSPTYP_EXT, G_PART_ALIAS_EBR }, { DOSPTYP_NTFS, G_PART_ALIAS_MS_NTFS }, { DOSPTYP_FAT32, G_PART_ALIAS_MS_FAT32 }, + { DOSPTYP_LDM, G_PART_ALIAS_MS_LDM_DATA }, { DOSPTYP_LINSWP, G_PART_ALIAS_LINUX_SWAP }, { DOSPTYP_LINUX, G_PART_ALIAS_LINUX_DATA }, { DOSPTYP_LINLVM, G_PART_ALIAS_LINUX_LVM }, Modified: stable/9/sys/sys/diskmbr.h ============================================================================== --- stable/9/sys/sys/diskmbr.h Tue Feb 14 07:14:42 2012 (r231642) +++ stable/9/sys/sys/diskmbr.h Tue Feb 14 07:24:22 2012 (r231643) @@ -48,6 +48,7 @@ #define DOSPTYP_NTFS 0x07 /* NTFS partition */ #define DOSPTYP_FAT32 0x0b /* FAT32 partition */ #define DOSPTYP_EXTLBA 0x0f /* DOS extended partition */ +#define DOSPTYP_LDM 0x42 /* Win2k dynamic extended partition */ #define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ #define DOSPTYP_LINSWP 0x82 /* Linux swap partition */ #define DOSPTYP_LINUX 0x83 /* Linux partition */ From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 09:42:03 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A585106566B; Tue, 14 Feb 2012 09:42:03 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2172C8FC17; Tue, 14 Feb 2012 09:42:03 +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 q1E9g35j089228; Tue, 14 Feb 2012 09:42:03 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E9g2qj089218; Tue, 14 Feb 2012 09:42:02 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201202140942.q1E9g2qj089218@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 14 Feb 2012 09:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231650 - in stable/9: share/man/man4 sys/conf sys/dev/netmap sys/net tools/tools/netmap X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 09:42:03 -0000 Author: luigi Date: Tue Feb 14 09:42:02 2012 New Revision: 231650 URL: http://svn.freebsd.org/changeset/base/231650 Log: MFC: import netmap core files into RELENG_9. This is the same code as in HEAD. Device driver modifications will be imported separately because the base drivers differ and patches might be slightly different between the various releases. The code is disconnected from the main build targets unless you explicitly put a 'device netmap' in your kernel config file. Added: stable/9/share/man/man4/netmap.4 (contents, props changed) stable/9/sys/dev/netmap/ stable/9/sys/dev/netmap/if_em_netmap.h (contents, props changed) stable/9/sys/dev/netmap/if_igb_netmap.h (contents, props changed) stable/9/sys/dev/netmap/if_lem_netmap.h (contents, props changed) stable/9/sys/dev/netmap/if_re_netmap.h (contents, props changed) stable/9/sys/dev/netmap/ixgbe_netmap.h (contents, props changed) stable/9/sys/dev/netmap/netmap.c (contents, props changed) stable/9/sys/dev/netmap/netmap_kern.h (contents, props changed) stable/9/sys/net/netmap.h (contents, props changed) stable/9/sys/net/netmap_user.h (contents, props changed) stable/9/tools/tools/netmap/ stable/9/tools/tools/netmap/Makefile (contents, props changed) stable/9/tools/tools/netmap/README (contents, props changed) stable/9/tools/tools/netmap/bridge.c (contents, props changed) stable/9/tools/tools/netmap/click-test.cfg (contents, props changed) stable/9/tools/tools/netmap/pcap.c (contents, props changed) stable/9/tools/tools/netmap/pkt-gen.c (contents, props changed) Modified: stable/9/share/man/man4/Makefile stable/9/sys/conf/NOTES stable/9/sys/conf/files stable/9/sys/conf/options Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Tue Feb 14 09:36:02 2012 (r231649) +++ stable/9/share/man/man4/Makefile Tue Feb 14 09:42:02 2012 (r231650) @@ -257,6 +257,7 @@ MAN= aac.4 \ net80211.4 \ netgraph.4 \ netintro.4 \ + netmap.4 \ ${_nfe.4} \ ${_nfsmb.4} \ ng_async.4 \ Added: stable/9/share/man/man4/netmap.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man4/netmap.4 Tue Feb 14 09:42:02 2012 (r231650) @@ -0,0 +1,299 @@ +.\" Copyright (c) 2011 Matteo Landi, Luigi Rizzo, Universita` di Pisa +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" This document is derived in part from the enet man page (enet.4) +.\" distributed with 4.3BSD Unix. +.\" +.\" $FreeBSD$ +.\" $Id: netmap.4 9662 2011-11-16 13:18:06Z luigi $: stable/8/share/man/man4/bpf.4 181694 2008-08-13 17:45:06Z ed $ +.\" +.Dd November 16, 2011 +.Dt NETMAP 4 +.Os +.Sh NAME +.Nm netmap +.Nd a framework for fast packet I/O +.Sh SYNOPSIS +.Cd device netmap +.Sh DESCRIPTION +.Nm +is a framework for fast and safe access to network devices +(reaching 14.88 Mpps at less than 1 GHz). +.Nm +uses memory mapped buffers and metadata +(buffer indexes and lengths) to communicate with the kernel, +which is in charge of validating information through +.Pa ioctl() +and +.Pa select()/poll(). +.Nm +can exploit the parallelism in multiqueue devices and +multicore systems. +.Pp +.Pp +.Nm +requires explicit support in device drivers. +For a list of supported devices, see the end of this manual page. +.Sh OPERATION +.Nm +clients must first open the +.Pa open("/dev/netmap") , +and then issue an +.Pa ioctl(...,NIOCREGIF,...) +to bind the file descriptor to a network device. +.Pp +When a device is put in +.Nm +mode, its data path is disconnected from the host stack. +The processes owning the file descriptor +can exchange packets with the device, or with the host stack, +through an mmapped memory region that contains pre-allocated +buffers and metadata. +.Pp +Non blocking I/O is done with special +.Pa ioctl()'s , +whereas the file descriptor can be passed to +.Pa select()/poll() +to be notified about incoming packet or available transmit buffers. +.Ss Data structures +All data structures for all devices in +.Nm +mode are in a memory +region shared by the kernel and all processes +who open +.Pa /dev/netmap +(NOTE: visibility may be restricted in future implementations). +All references between the shared data structure +are relative (offsets or indexes). Some macros help converting +them into actual pointers. +.Pp +The data structures in shared memory are the following: +.Pp +.Bl -tag -width XXX +.It Dv struct netmap_if (one per interface) +indicates the number of rings supported by an interface, their +sizes, and the offsets of the +.Pa netmap_rings +associated to the interface. +The offset of a +.Pa struct netmap_if +in the shared memory region is indicated by the +.Pa nr_offset +field in the structure returned by the +.Pa NIOCREGIF +(see below). +.Bd -literal +struct netmap_if { + char ni_name[IFNAMSIZ]; /* name of the interface. */ + const u_int ni_num_queues; /* number of hw ring pairs */ + const ssize_t ring_ofs[]; /* offset of tx and rx rings */ +}; +.Ed +.It Dv struct netmap_ring (one per ring) +contains the index of the current read or write slot (cur), +the number of slots available for reception or transmission (avail), +and an array of +.Pa slots +describing the buffers. +There is one ring pair for each of the N hardware ring pairs +supported by the card (numbered 0..N-1), plus +one ring pair (numbered N) for packets from/to the host stack. +.Bd -literal +struct netmap_ring { + const ssize_t buf_ofs; + const uint32_t num_slots; /* number of slots in the ring. */ + uint32_t avail; /* number of usable slots */ + uint32_t cur; /* 'current' index for the user side */ + + const uint16_t nr_buf_size; + uint16_t flags; + struct netmap_slot slot[0]; /* array of slots. */ +} +.Ed +.It Dv struct netmap_slot (one per packet) +contains the metadata for a packet: a buffer index (buf_idx), +a buffer length (len), and some flags. +.Bd -literal +struct netmap_slot { + uint32_t buf_idx; /* buffer index */ + uint16_t len; /* packet length */ + uint16_t flags; /* buf changed, etc. */ +#define NS_BUF_CHANGED 0x0001 /* must resync, buffer changed */ +#define NS_REPORT 0x0002 /* tell hw to report results + * e.g. by generating an interrupt + */ +}; +.Ed +.It Dv packet buffers +are fixed size (approximately 2k) buffers allocated by the kernel +that contain packet data. Buffers addresses are computed through +macros. +.El +.Pp +Some macros support the access to objects in the shared memory +region. In particular: +.Bd -literal +struct netmap_if *nifp; +struct netmap_ring *txring = NETMAP_TXRING(nifp, i); +struct netmap_ring *rxring = NETMAP_RXRING(nifp, i); +int i = txring->slot[txring->cur].buf_idx; +char *buf = NETMAP_BUF(txring, i); +.Ed +.Ss IOCTLS +.Pp +.Nm +supports some ioctl() to synchronize the state of the rings +between the kernel and the user processes, plus some +to query and configure the interface. +The former do not require any argument, whereas the latter +use a +.Pa struct netmap_req +defined as follows: +.Bd -literal +struct nmreq { + char nr_name[IFNAMSIZ]; + uint32_t nr_offset; /* nifp offset in the shared region */ + uint32_t nr_memsize; /* size of the shared region */ + uint32_t nr_numdescs; /* descriptors per queue */ + uint16_t nr_numqueues; + uint16_t nr_ringid; /* ring(s) we care about */ +#define NETMAP_HW_RING 0x4000 /* low bits indicate one hw ring */ +#define NETMAP_SW_RING 0x2000 /* we process the sw ring */ +#define NETMAP_NO_TX_POLL 0x1000 /* no gratuitous txsync on poll */ +#define NETMAP_RING_MASK 0xfff /* the actual ring number */ +}; + +.Ed +A device descriptor obtained through +.Pa /dev/netmap +also supports the ioctl supported by network devices. +.Pp +The netmap-specific +.Xr ioctl 2 +command codes below are defined in +.In net/netmap.h +and are: +.Bl -tag -width XXXX +.It Dv NIOCGINFO +returns information about the interface named in nr_name. +On return, nr_memsize indicates the size of the shared netmap +memory region (this is device-independent), +nr_numslots indicates how many buffers are in a ring, +nr_numrings indicates the number of rings supported by the hardware. +.Pp +If the device does not support netmap, the ioctl returns EINVAL. +.It Dv NIOCREGIF +puts the interface named in nr_name into netmap mode, disconnecting +it from the host stack, and/or defines which rings are controlled +through this file descriptor. +On return, it gives the same info as NIOCGINFO, and nr_ringid +indicates the identity of the rings controlled through the file +descriptor. +.Pp +Possible values for nr_ringid are +.Bl -tag -width XXXXX +.It 0 +default, all hardware rings +.It NETMAP_SW_RING +the ``host rings'' connecting to the host stack +.It NETMAP_HW_RING + i +the i-th hardware ring +.El +By default, a +.Nm poll +or +.Nm select +call pushes out any pending packets on the transmit ring, even if +no write events are specified. +The feature can be disabled by or-ing +.Nm NETMAP_NO_TX_SYNC +to nr_ringid. +But normally you should keep this feature unless you are using +separate file descriptors for the send and receive rings, because +otherwise packets are pushed out only if NETMAP_TXSYNC is called, +or the send queue is full. +.Pp +.Pa NIOCREGIF +can be used multiple times to change the association of a +file descriptor to a ring pair, always within the same device. +.It Dv NIOCUNREGIF +brings an interface back to normal mode. +.It Dv NIOCTXSYNC +tells the hardware of new packets to transmit, and updates the +number of slots available for transmission. +.It Dv NIOCRXSYNC +tells the hardware of consumed packets, and asks for newly available +packets. +.El +.Ss SYSTEM CALLS +.Nm +uses +.Nm select +and +.Nm poll +to wake up processes when significant events occur. +.Sh EXAMPLES +The following code implements a traffic generator +.Pp +.Bd -literal -compact +#include +#include +struct netmap_if *nifp; +struct netmap_ring *ring; +struct netmap_request nmr; + +fd = open("/dev/netmap", O_RDWR); +bzero(&nmr, sizeof(nmr)); +strcpy(nmr.nm_name, "ix0"); +ioctl(fd, NIOCREG, &nmr); +p = mmap(0, nmr.memsize, fd); +nifp = NETMAP_IF(p, nmr.offset); +ring = NETMAP_TXRING(nifp, 0); +fds.fd = fd; +fds.events = POLLOUT; +for (;;) { + poll(list, 1, -1); + while (ring->avail-- > 0) { + i = ring->cur; + buf = NETMAP_BUF(ring, ring->slot[i].buf_index); + ... prepare packet in buf ... + ring->slot[i].len = ... packet length ... + ring->cur = NETMAP_RING_NEXT(ring, i); + } +} +.Ed +.Sh SUPPORTED INTERFACES +.Nm +supports the following interfaces: +.Xr em 4 , +.Xr ixgbe 4 , +.Xr re 4 , +.Sh AUTHORS +The +.Nm +framework has been designed and implemented by +.An Luigi Rizzo +and +.An Matteo Landi +in 2011 at the Universita` di Pisa. Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Tue Feb 14 09:36:02 2012 (r231649) +++ stable/9/sys/conf/NOTES Tue Feb 14 09:42:02 2012 (r231650) @@ -799,6 +799,12 @@ device sppp # option. DHCP requires bpf. device bpf +# The `netmap' device implements memory-mapped access to network +# devices from userspace, enabling wire-speed packet capture and +# generation even at 10Gbit/s. Requires support in the device +# driver. Supported drivers are ixgbe, e1000, re. +device netmap + # The `disc' device implements a minimal network interface, # which throws away all packets sent and never receives any. It is # included for testing and benchmarking purposes. Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Tue Feb 14 09:36:02 2012 (r231649) +++ stable/9/sys/conf/files Tue Feb 14 09:42:02 2012 (r231650) @@ -1501,6 +1501,7 @@ dev/mxge/mxge_rss_ethp_z8e.c optional mx dev/my/if_my.c optional my dev/ncv/ncr53c500.c optional ncv dev/ncv/ncr53c500_pccard.c optional ncv pccard +dev/netmap/netmap.c optional netmap dev/nge/if_nge.c optional nge dev/nxge/if_nxge.c optional nxge \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" Modified: stable/9/sys/conf/options ============================================================================== --- stable/9/sys/conf/options Tue Feb 14 09:36:02 2012 (r231649) +++ stable/9/sys/conf/options Tue Feb 14 09:42:02 2012 (r231650) @@ -687,6 +687,7 @@ ISAPNP opt_isa.h # various 'device presence' options. DEV_BPF opt_bpf.h +DEV_NETMAP opt_global.h DEV_MCA opt_mca.h DEV_CARP opt_carp.h DEV_SPLASH opt_splash.h Added: stable/9/sys/dev/netmap/if_em_netmap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/netmap/if_em_netmap.h Tue Feb 14 09:42:02 2012 (r231650) @@ -0,0 +1,397 @@ +/* + * Copyright (C) 2011 Matteo Landi, Luigi Rizzo. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * $FreeBSD$ + * $Id: if_em_netmap.h 9802 2011-12-02 18:42:37Z luigi $ + * + * netmap changes for if_em. + * + * For structure and details on the individual functions please see + * ixgbe_netmap.h + */ + +#include +#include +#include +#include /* vtophys ? */ +#include + +static void em_netmap_block_tasks(struct adapter *); +static void em_netmap_unblock_tasks(struct adapter *); +static int em_netmap_reg(struct ifnet *, int onoff); +static int em_netmap_txsync(struct ifnet *, u_int, int); +static int em_netmap_rxsync(struct ifnet *, u_int, int); +static void em_netmap_lock_wrapper(struct ifnet *, int, u_int); + +static void +em_netmap_attach(struct adapter *adapter) +{ + struct netmap_adapter na; + + bzero(&na, sizeof(na)); + + na.ifp = adapter->ifp; + na.separate_locks = 1; + na.num_tx_desc = adapter->num_tx_desc; + na.num_rx_desc = adapter->num_rx_desc; + na.nm_txsync = em_netmap_txsync; + na.nm_rxsync = em_netmap_rxsync; + na.nm_lock = em_netmap_lock_wrapper; + na.nm_register = em_netmap_reg; + netmap_attach(&na, adapter->num_queues); +} + + +/* + * wrapper to export locks to the generic code + */ +static void +em_netmap_lock_wrapper(struct ifnet *ifp, int what, u_int queueid) +{ + struct adapter *adapter = ifp->if_softc; + + ASSERT(queueid < adapter->num_queues); + switch (what) { + case NETMAP_CORE_LOCK: + EM_CORE_LOCK(adapter); + break; + case NETMAP_CORE_UNLOCK: + EM_CORE_UNLOCK(adapter); + break; + case NETMAP_TX_LOCK: + EM_TX_LOCK(&adapter->tx_rings[queueid]); + break; + case NETMAP_TX_UNLOCK: + EM_TX_UNLOCK(&adapter->tx_rings[queueid]); + break; + case NETMAP_RX_LOCK: + EM_RX_LOCK(&adapter->rx_rings[queueid]); + break; + case NETMAP_RX_UNLOCK: + EM_RX_UNLOCK(&adapter->rx_rings[queueid]); + break; + } +} + + +// XXX do we need to block/unblock the tasks ? +static void +em_netmap_block_tasks(struct adapter *adapter) +{ + if (adapter->msix > 1) { /* MSIX */ + int i; + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + + for (i = 0; i < adapter->num_queues; i++, txr++, rxr++) { + taskqueue_block(txr->tq); + taskqueue_drain(txr->tq, &txr->tx_task); + taskqueue_block(rxr->tq); + taskqueue_drain(rxr->tq, &rxr->rx_task); + } + } else { /* legacy */ + taskqueue_block(adapter->tq); + taskqueue_drain(adapter->tq, &adapter->link_task); + taskqueue_drain(adapter->tq, &adapter->que_task); + } +} + + +static void +em_netmap_unblock_tasks(struct adapter *adapter) +{ + if (adapter->msix > 1) { + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + int i; + + for (i = 0; i < adapter->num_queues; i++) { + taskqueue_unblock(txr->tq); + taskqueue_unblock(rxr->tq); + } + } else { /* legacy */ + taskqueue_unblock(adapter->tq); + } +} + +/* + * register-unregister routine + */ +static int +em_netmap_reg(struct ifnet *ifp, int onoff) +{ + struct adapter *adapter = ifp->if_softc; + struct netmap_adapter *na = NA(ifp); + int error = 0; + + if (na == NULL) + return EINVAL; /* no netmap support here */ + + em_disable_intr(adapter); + + /* Tell the stack that the interface is no longer active */ + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + em_netmap_block_tasks(adapter); + + if (onoff) { + ifp->if_capenable |= IFCAP_NETMAP; + + na->if_transmit = ifp->if_transmit; + ifp->if_transmit = netmap_start; + + em_init_locked(adapter); + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == 0) { + error = ENOMEM; + goto fail; + } + } else { +fail: + /* restore if_transmit */ + ifp->if_transmit = na->if_transmit; + ifp->if_capenable &= ~IFCAP_NETMAP; + em_init_locked(adapter); /* also enable intr */ + } + em_netmap_unblock_tasks(adapter); + return (error); +} + +/* + * Reconcile hardware and user view of the transmit ring. + */ +static int +em_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int do_lock) +{ + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = &adapter->tx_rings[ring_nr]; + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->tx_rings[ring_nr]; + struct netmap_ring *ring = kring->ring; + int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; + + /* generate an interrupt approximately every half ring */ + int report_frequency = kring->nkr_num_slots >> 1; + + k = ring->cur; + if (k > lim) + return netmap_ring_reinit(kring); + + if (do_lock) + EM_TX_LOCK(txr); + bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, + BUS_DMASYNC_POSTREAD); + + /* check for new packets to send. + * j indexes the netmap ring, l indexes the nic ring, and + * j = kring->nr_hwcur, l = E1000_TDT (not tracked), + * j == (l + kring->nkr_hwofs) % ring_size + */ + j = kring->nr_hwcur; + if (j != k) { /* we have packets to send */ + l = j - kring->nkr_hwofs; + if (l < 0) + l += lim + 1; + while (j != k) { + struct netmap_slot *slot = &ring->slot[j]; + struct e1000_tx_desc *curr = &txr->tx_base[l]; + struct em_buffer *txbuf = &txr->tx_buffers[l]; + int flags = ((slot->flags & NS_REPORT) || + j == 0 || j == report_frequency) ? + E1000_TXD_CMD_RS : 0; + uint64_t paddr; + void *addr = PNMB(slot, &paddr); + int len = slot->len; + if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) { + if (do_lock) + EM_TX_UNLOCK(txr); + return netmap_ring_reinit(kring); + } + + slot->flags &= ~NS_REPORT; + curr->upper.data = 0; + curr->lower.data = + htole32(adapter->txd_cmd | len | + (E1000_TXD_CMD_EOP | flags) ); + if (slot->flags & NS_BUF_CHANGED) { + curr->buffer_addr = htole64(paddr); + /* buffer has changed, reload map */ + netmap_reload_map(txr->txtag, txbuf->map, addr); + slot->flags &= ~NS_BUF_CHANGED; + } + + bus_dmamap_sync(txr->txtag, txbuf->map, + BUS_DMASYNC_PREWRITE); + j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; + n++; + } + kring->nr_hwcur = k; + + /* decrease avail by number of sent packets */ + kring->nr_hwavail -= n; + + bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), l); + } + + if (n == 0 || kring->nr_hwavail < 1) { + int delta; + + /* record completed transmissions using THD. */ + l = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); + if (l >= kring->nkr_num_slots) { /* XXX can happen */ + D("TDH wrap %d", l); + l -= kring->nkr_num_slots; + } + delta = l - txr->next_to_clean; + if (delta) { + /* some completed, increment hwavail. */ + if (delta < 0) + delta += kring->nkr_num_slots; + txr->next_to_clean = l; + kring->nr_hwavail += delta; + } + } + /* update avail to what the hardware knows */ + ring->avail = kring->nr_hwavail; + + if (do_lock) + EM_TX_UNLOCK(txr); + return 0; +} + +/* + * Reconcile kernel and user view of the receive ring. + */ +static int +em_netmap_rxsync(struct ifnet *ifp, u_int ring_nr, int do_lock) +{ + struct adapter *adapter = ifp->if_softc; + struct rx_ring *rxr = &adapter->rx_rings[ring_nr]; + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[ring_nr]; + struct netmap_ring *ring = kring->ring; + int j, k, l, n, lim = kring->nkr_num_slots - 1; + + k = ring->cur; + if (k > lim) + return netmap_ring_reinit(kring); + + if (do_lock) + EM_RX_LOCK(rxr); + /* XXX check sync modes */ + bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + + /* import newly received packets into the netmap ring. + * j is an index in the netmap ring, l in the NIC ring, and + * j = (kring->nr_hwcur + kring->nr_hwavail) % ring_size + * l = rxr->next_to_check; + * and + * j == (l + kring->nkr_hwofs) % ring_size + */ + l = rxr->next_to_check; + j = l + kring->nkr_hwofs; + /* here nkr_hwofs can be negative so must check for j < 0 */ + if (j < 0) + j += lim + 1; + else if (j > lim) + j -= lim + 1; + for (n = 0; ; n++) { + struct e1000_rx_desc *curr = &rxr->rx_base[l]; + + if ((curr->status & E1000_RXD_STAT_DD) == 0) + break; + ring->slot[j].len = le16toh(curr->length); + bus_dmamap_sync(rxr->rxtag, rxr->rx_buffers[l].map, + BUS_DMASYNC_POSTREAD); + j = (j == lim) ? 0 : j + 1; + /* make sure next_to_refresh follows next_to_check */ + rxr->next_to_refresh = l; // XXX + l = (l == lim) ? 0 : l + 1; + } + if (n) { + rxr->next_to_check = l; + kring->nr_hwavail += n; + } + + /* skip past packets that userspace has already processed */ + j = kring->nr_hwcur; + if (j != k) { /* userspace has read some packets. */ + n = 0; + l = j - kring->nkr_hwofs; /* NIC ring index */ + /* here nkr_hwofs can be negative so check for l > lim */ + if (l < 0) + l += lim + 1; + else if (l > lim) + l -= lim + 1; + while (j != k) { + struct netmap_slot *slot = &ring->slot[j]; + struct e1000_rx_desc *curr = &rxr->rx_base[l]; + struct em_buffer *rxbuf = &rxr->rx_buffers[l]; + uint64_t paddr; + void *addr = PNMB(slot, &paddr); + + if (addr == netmap_buffer_base) { /* bad buf */ + if (do_lock) + EM_RX_UNLOCK(rxr); + return netmap_ring_reinit(kring); + } + + curr->status = 0; + if (slot->flags & NS_BUF_CHANGED) { + curr->buffer_addr = htole64(paddr); + /* buffer has changed, reload map */ + netmap_reload_map(rxr->rxtag, rxbuf->map, addr); + slot->flags &= ~NS_BUF_CHANGED; + } + + bus_dmamap_sync(rxr->rxtag, rxbuf->map, + BUS_DMASYNC_PREREAD); + + j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; + n++; + } + kring->nr_hwavail -= n; + kring->nr_hwcur = k; + bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* + * IMPORTANT: we must leave one free slot in the ring, + * so move l back by one unit + */ + l = (l == 0) ? lim : l - 1; + E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), l); + } + /* tell userspace that there are new packets */ + ring->avail = kring->nr_hwavail ; + if (do_lock) + EM_RX_UNLOCK(rxr); + return 0; +} Added: stable/9/sys/dev/netmap/if_igb_netmap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/netmap/if_igb_netmap.h Tue Feb 14 09:42:02 2012 (r231650) @@ -0,0 +1,357 @@ +/* + * Copyright (C) 2011 Universita` di Pisa. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * $FreeBSD$ + * $Id: if_igb_netmap.h 9802 2011-12-02 18:42:37Z luigi $ + * + * netmap modifications for igb + * contribured by Ahmed Kooli + */ + +#include +#include +#include +#include /* vtophys ? */ +#include + +static int igb_netmap_reg(struct ifnet *, int onoff); +static int igb_netmap_txsync(struct ifnet *, u_int, int); +static int igb_netmap_rxsync(struct ifnet *, u_int, int); +static void igb_netmap_lock_wrapper(struct ifnet *, int, u_int); + + +static void +igb_netmap_attach(struct adapter *adapter) +{ + struct netmap_adapter na; + + bzero(&na, sizeof(na)); + + na.ifp = adapter->ifp; + na.separate_locks = 1; + na.num_tx_desc = adapter->num_tx_desc; + na.num_rx_desc = adapter->num_rx_desc; + na.nm_txsync = igb_netmap_txsync; + na.nm_rxsync = igb_netmap_rxsync; + na.nm_lock = igb_netmap_lock_wrapper; + na.nm_register = igb_netmap_reg; + netmap_attach(&na, adapter->num_queues); +} + + +/* + * wrapper to export locks to the generic code + */ +static void +igb_netmap_lock_wrapper(struct ifnet *ifp, int what, u_int queueid) +{ + struct adapter *adapter = ifp->if_softc; + + ASSERT(queueid < adapter->num_queues); + switch (what) { + case NETMAP_CORE_LOCK: + IGB_CORE_LOCK(adapter); + break; + case NETMAP_CORE_UNLOCK: + IGB_CORE_UNLOCK(adapter); + break; + case NETMAP_TX_LOCK: + IGB_TX_LOCK(&adapter->tx_rings[queueid]); + break; + case NETMAP_TX_UNLOCK: + IGB_TX_UNLOCK(&adapter->tx_rings[queueid]); + break; + case NETMAP_RX_LOCK: + IGB_RX_LOCK(&adapter->rx_rings[queueid]); + break; + case NETMAP_RX_UNLOCK: + IGB_RX_UNLOCK(&adapter->rx_rings[queueid]); + break; + } +} + + +/* + * support for netmap register/unregisted. We are already under core lock. + * only called on the first init or the last unregister. + */ +static int +igb_netmap_reg(struct ifnet *ifp, int onoff) +{ + struct adapter *adapter = ifp->if_softc; + struct netmap_adapter *na = NA(ifp); + int error = 0; + + if (na == NULL) + return EINVAL; + + igb_disable_intr(adapter); + + /* Tell the stack that the interface is no longer active */ + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + if (onoff) { + ifp->if_capenable |= IFCAP_NETMAP; + + /* save if_transmit to restore it later */ + na->if_transmit = ifp->if_transmit; + ifp->if_transmit = netmap_start; + + igb_init_locked(adapter); + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == 0) { + error = ENOMEM; + goto fail; + } + } else { +fail: + /* restore if_transmit */ + ifp->if_transmit = na->if_transmit; + ifp->if_capenable &= ~IFCAP_NETMAP; + igb_init_locked(adapter); /* also enables intr */ + } + return (error); +} + + +/* + * Reconcile kernel and user view of the transmit ring. + */ +static int +igb_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int do_lock) +{ + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = &adapter->tx_rings[ring_nr]; + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->tx_rings[ring_nr]; + struct netmap_ring *ring = kring->ring; + int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; + + /* generate an interrupt approximately every half ring */ + int report_frequency = kring->nkr_num_slots >> 1; + + k = ring->cur; + if (k > lim) + return netmap_ring_reinit(kring); + + if (do_lock) + IGB_TX_LOCK(txr); + bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, + BUS_DMASYNC_POSTREAD); + + /* update avail to what the hardware knows */ + ring->avail = kring->nr_hwavail; + + j = kring->nr_hwcur; /* netmap ring index */ + if (j != k) { /* we have new packets to send */ + u32 olinfo_status = 0; + + l = j - kring->nkr_hwofs; /* NIC ring index */ + if (l < 0) + l += lim + 1; + /* 82575 needs the queue index added */ + if (adapter->hw.mac.type == e1000_82575) + olinfo_status |= txr->me << 4; + + while (j != k) { + struct netmap_slot *slot = &ring->slot[j]; + struct igb_tx_buffer *txbuf = &txr->tx_buffers[l]; + union e1000_adv_tx_desc *curr = + (union e1000_adv_tx_desc *)&txr->tx_base[l]; + uint64_t paddr; + void *addr = PNMB(slot, &paddr); + int flags = ((slot->flags & NS_REPORT) || + j == 0 || j == report_frequency) ? + E1000_ADVTXD_DCMD_RS : 0; + int len = slot->len; + + if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) { + if (do_lock) + IGB_TX_UNLOCK(txr); + return netmap_ring_reinit(kring); + } + + slot->flags &= ~NS_REPORT; + // XXX do we need to set the address ? + curr->read.buffer_addr = htole64(paddr); + curr->read.olinfo_status = + htole32(olinfo_status | + (len<< E1000_ADVTXD_PAYLEN_SHIFT)); + curr->read.cmd_type_len = + htole32(len | E1000_ADVTXD_DTYP_DATA | + E1000_ADVTXD_DCMD_IFCS | + E1000_ADVTXD_DCMD_DEXT | + E1000_ADVTXD_DCMD_EOP | flags); + if (slot->flags & NS_BUF_CHANGED) { + /* buffer has changed, reload map */ + netmap_reload_map(txr->txtag, txbuf->map, addr); + slot->flags &= ~NS_BUF_CHANGED; + } + + bus_dmamap_sync(txr->txtag, txbuf->map, + BUS_DMASYNC_PREWRITE); + j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; + n++; + } + kring->nr_hwcur = k; + + /* decrease avail by number of sent packets */ + kring->nr_hwavail -= n; + ring->avail = kring->nr_hwavail; + + /* Set the watchdog XXX ? */ + txr->queue_status = IGB_QUEUE_WORKING; + txr->watchdog_time = ticks; + + bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), l); + } + if (n == 0 || kring->nr_hwavail < 1) { + int delta; + + /* record completed transmission using TDH */ + l = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); + if (l >= kring->nkr_num_slots) /* XXX can it happen ? */ + l -= kring->nkr_num_slots; + delta = l - txr->next_to_clean; + if (delta) { + /* new tx were completed */ + if (delta < 0) + delta += kring->nkr_num_slots; + txr->next_to_clean = l; + kring->nr_hwavail += delta; + ring->avail = kring->nr_hwavail; + } + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 10:16:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 369DA106564A; Tue, 14 Feb 2012 10:16:58 +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 1E1858FC16; Tue, 14 Feb 2012 10:16:58 +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 q1EAGwPG092380; Tue, 14 Feb 2012 10:16:58 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EAGvoj092311; Tue, 14 Feb 2012 10:16:57 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202141016.q1EAGvoj092311@svn.freebsd.org> From: Doug Barton Date: Tue, 14 Feb 2012 10:16:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231653 - stable/9/etc/rc.d X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 10:16:58 -0000 Author: dougb Date: Tue Feb 14 10:16:56 2012 New Revision: 231653 URL: http://svn.freebsd.org/changeset/base/231653 Log: MFC r230099: Change rcvar= assignments to the literal values set_rcvar would have returned. This will slightly reduce boot time, and help in diff reduction to HEAD. Modified: stable/9/etc/rc.d/accounting stable/9/etc/rc.d/amd stable/9/etc/rc.d/apm stable/9/etc/rc.d/apmd stable/9/etc/rc.d/bootparams stable/9/etc/rc.d/bsnmpd stable/9/etc/rc.d/bthidd stable/9/etc/rc.d/cleanvar stable/9/etc/rc.d/cleartmp stable/9/etc/rc.d/cron stable/9/etc/rc.d/ddb stable/9/etc/rc.d/devd stable/9/etc/rc.d/dmesg stable/9/etc/rc.d/ftp-proxy stable/9/etc/rc.d/ftpd stable/9/etc/rc.d/gptboot stable/9/etc/rc.d/hastd stable/9/etc/rc.d/hcsecd stable/9/etc/rc.d/hostapd stable/9/etc/rc.d/inetd stable/9/etc/rc.d/ip6addrctl stable/9/etc/rc.d/ipfilter stable/9/etc/rc.d/ipfs stable/9/etc/rc.d/ipmon stable/9/etc/rc.d/ipnat stable/9/etc/rc.d/ipsec stable/9/etc/rc.d/ipxrouted stable/9/etc/rc.d/jail stable/9/etc/rc.d/keyserv stable/9/etc/rc.d/lpd stable/9/etc/rc.d/mountd stable/9/etc/rc.d/moused stable/9/etc/rc.d/mroute6d stable/9/etc/rc.d/mrouted stable/9/etc/rc.d/natd stable/9/etc/rc.d/netwait stable/9/etc/rc.d/newsyslog stable/9/etc/rc.d/nfscbd stable/9/etc/rc.d/nfsd stable/9/etc/rc.d/nfsuserd stable/9/etc/rc.d/nscd stable/9/etc/rc.d/ntpd stable/9/etc/rc.d/ntpdate stable/9/etc/rc.d/pf stable/9/etc/rc.d/pflog stable/9/etc/rc.d/pfsync stable/9/etc/rc.d/powerd stable/9/etc/rc.d/ppp stable/9/etc/rc.d/pppoed stable/9/etc/rc.d/quota stable/9/etc/rc.d/rarpd stable/9/etc/rc.d/rfcomm_pppd_server stable/9/etc/rc.d/route6d stable/9/etc/rc.d/routed stable/9/etc/rc.d/rpcbind stable/9/etc/rc.d/rtadvd stable/9/etc/rc.d/rtsold stable/9/etc/rc.d/rwho stable/9/etc/rc.d/sdpd stable/9/etc/rc.d/sendmail stable/9/etc/rc.d/sshd stable/9/etc/rc.d/syslogd stable/9/etc/rc.d/timed stable/9/etc/rc.d/ubthidhci stable/9/etc/rc.d/virecover stable/9/etc/rc.d/watchdogd Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/rc.d/accounting ============================================================================== --- stable/9/etc/rc.d/accounting Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/accounting Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="accounting" -rcvar=`set_rcvar` +rcvar="accounting_enable" accounting_command="/usr/sbin/accton" accounting_file="/var/account/acct" Modified: stable/9/etc/rc.d/amd ============================================================================== --- stable/9/etc/rc.d/amd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/amd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="amd" -rcvar=`set_rcvar` +rcvar="amd_enable" command="/usr/sbin/${name}" start_precmd="amd_precmd" command_args="&" Modified: stable/9/etc/rc.d/apm ============================================================================== --- stable/9/etc/rc.d/apm Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/apm Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="apm" -rcvar=`set_rcvar` +rcvar="apm_enable" start_precmd="apm_precmd" command="/usr/sbin/${name}" start_cmd="${command} -e enable" Modified: stable/9/etc/rc.d/apmd ============================================================================== --- stable/9/etc/rc.d/apmd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/apmd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="apmd" -rcvar=`set_rcvar` +rcvar="apmd_enable" command="/usr/sbin/${name}" start_precmd="apmd_prestart" Modified: stable/9/etc/rc.d/bootparams ============================================================================== --- stable/9/etc/rc.d/bootparams Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/bootparams Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="bootparamd" -rcvar=`set_rcvar` +rcvar="bootparamd_enable" required_files="/etc/bootparams" command="/usr/sbin/${name}" Modified: stable/9/etc/rc.d/bsnmpd ============================================================================== --- stable/9/etc/rc.d/bsnmpd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/bsnmpd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="bsnmpd" -rcvar=`set_rcvar` +rcvar="bsnmpd_enable" command="/usr/sbin/${name}" pidfile="/var/run/snmpd.pid" Modified: stable/9/etc/rc.d/bthidd ============================================================================== --- stable/9/etc/rc.d/bthidd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/bthidd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,9 +11,9 @@ . /etc/rc.subr name="bthidd" +rcvar="bthidd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" -rcvar=`set_rcvar` start_precmd="bthidd_prestart" bthidd_prestart() Modified: stable/9/etc/rc.d/cleanvar ============================================================================== --- stable/9/etc/rc.d/cleanvar Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/cleanvar Tue Feb 14 10:16:56 2012 (r231653) @@ -9,7 +9,7 @@ . /etc/rc.subr name="cleanvar" -rcvar=`set_rcvar` +rcvar="cleanvar_enable" start_precmd="${name}_prestart" start_cmd="${name}_start" Modified: stable/9/etc/rc.d/cleartmp ============================================================================== --- stable/9/etc/rc.d/cleartmp Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/cleartmp Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ name="cleartmp" # Disguise rcvar for the start method to run irrespective of its setting. -rcvar1=`set_rcvar clear_tmp` +rcvar1="clear_tmp_enable" start_cmd="${name}_start" stop_cmd=":" Modified: stable/9/etc/rc.d/cron ============================================================================== --- stable/9/etc/rc.d/cron Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/cron Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="cron" -rcvar="`set_rcvar`" +rcvar="cron_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" Modified: stable/9/etc/rc.d/ddb ============================================================================== --- stable/9/etc/rc.d/ddb Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ddb Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ddb" -rcvar=`set_rcvar` +rcvar="ddb_enable" command="/sbin/${name}" start_precmd="ddb_prestart" stop_cmd=":" Modified: stable/9/etc/rc.d/devd ============================================================================== --- stable/9/etc/rc.d/devd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/devd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="devd" -rcvar=`set_rcvar` +rcvar="devd_enable" command="/sbin/${name}" start_precmd=${name}_prestart Modified: stable/9/etc/rc.d/dmesg ============================================================================== --- stable/9/etc/rc.d/dmesg Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/dmesg Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="dmesg" -rcvar=`set_rcvar` +rcvar="dmesg_enable" dmesg_file="/var/run/dmesg.boot" start_cmd="do_dmesg" stop_cmd=":" Modified: stable/9/etc/rc.d/ftp-proxy ============================================================================== --- stable/9/etc/rc.d/ftp-proxy Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ftp-proxy Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ftpproxy" -rcvar=`set_rcvar` +rcvar="ftpproxy_enable" command="/usr/sbin/ftp-proxy" load_rc_config $name Modified: stable/9/etc/rc.d/ftpd ============================================================================== --- stable/9/etc/rc.d/ftpd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ftpd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ftpd" -rcvar=`set_rcvar` +rcvar="ftpd_enable" command="/usr/libexec/${name}" pidfile="/var/run/${name}.pid" start_precmd=ftpd_prestart Modified: stable/9/etc/rc.d/gptboot ============================================================================== --- stable/9/etc/rc.d/gptboot Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/gptboot Tue Feb 14 10:16:56 2012 (r231653) @@ -34,7 +34,7 @@ . /etc/rc.subr name="gptboot" -rcvar=`set_rcvar` +rcvar="gptboot_enable" start_cmd="gptboot_report" gptboot_report() Modified: stable/9/etc/rc.d/hastd ============================================================================== --- stable/9/etc/rc.d/hastd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/hastd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="hastd" -rcvar=`set_rcvar` +rcvar="hastd_enable" pidfile="/var/run/${name}.pid" command="/sbin/${name}" hastctl="/sbin/hastctl" Modified: stable/9/etc/rc.d/hcsecd ============================================================================== --- stable/9/etc/rc.d/hcsecd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/hcsecd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,9 +11,9 @@ . /etc/rc.subr name="hcsecd" +rcvar="hcsecd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" -rcvar=`set_rcvar` required_modules="ng_btsocket" load_rc_config $name Modified: stable/9/etc/rc.d/hostapd ============================================================================== --- stable/9/etc/rc.d/hostapd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/hostapd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,8 +10,8 @@ . /etc/rc.subr name="hostapd" +rcvar="hostapd_enable" command="/usr/sbin/${name}" -rcvar=`set_rcvar` conf_file="/etc/${name}.conf" pidfile="/var/run/${name}.pid" Modified: stable/9/etc/rc.d/inetd ============================================================================== --- stable/9/etc/rc.d/inetd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/inetd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="inetd" -rcvar=`set_rcvar` +rcvar="inetd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/${name}.conf" Modified: stable/9/etc/rc.d/ip6addrctl ============================================================================== --- stable/9/etc/rc.d/ip6addrctl Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ip6addrctl Tue Feb 14 10:16:56 2012 (r231653) @@ -12,7 +12,7 @@ . /etc/network.subr name="ip6addrctl" -rcvar=`set_rcvar` +rcvar="ip6addrctl_enable" start_cmd="ip6addrctl_start" stop_cmd="ip6addrctl_stop" extra_commands="status prefer_ipv6 prefer_ipv4" Modified: stable/9/etc/rc.d/ipfilter ============================================================================== --- stable/9/etc/rc.d/ipfilter Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ipfilter Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ipfilter" -rcvar=`set_rcvar` +rcvar="ipfilter_enable" load_rc_config $name stop_precmd="test -f ${ipfilter_rules} -o -f ${ipv6_ipfilter_rules}" Modified: stable/9/etc/rc.d/ipfs ============================================================================== --- stable/9/etc/rc.d/ipfs Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ipfs Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ipfs" -rcvar=`set_rcvar` +rcvar="ipfs_enable" start_cmd="ipfs_start" stop_cmd="ipfs_stop" start_precmd="ipfs_prestart" Modified: stable/9/etc/rc.d/ipmon ============================================================================== --- stable/9/etc/rc.d/ipmon Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ipmon Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ipmon" -rcvar=`set_rcvar` +rcvar="ipmon_enable" command="/sbin/${name}" start_precmd="ipmon_precmd" Modified: stable/9/etc/rc.d/ipnat ============================================================================== --- stable/9/etc/rc.d/ipnat Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ipnat Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ipnat" -rcvar=`set_rcvar` +rcvar="ipnat_enable" load_rc_config $name start_cmd="ipnat_start" stop_cmd="${ipnat_program} -F -C" Modified: stable/9/etc/rc.d/ipsec ============================================================================== --- stable/9/etc/rc.d/ipsec Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ipsec Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ipsec" -rcvar=`set_rcvar` +rcvar="ipsec_enable" start_precmd="ipsec_prestart" start_cmd="ipsec_start" stop_precmd="test -f $ipsec_file" Modified: stable/9/etc/rc.d/ipxrouted ============================================================================== --- stable/9/etc/rc.d/ipxrouted Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ipxrouted Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ipxrouted" -rcvar=`set_rcvar` +rcvar="ipxrouted_enable" command="/usr/sbin/IPXrouted" command_args="> /dev/null 2>&1" Modified: stable/9/etc/rc.d/jail ============================================================================== --- stable/9/etc/rc.d/jail Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/jail Tue Feb 14 10:16:56 2012 (r231653) @@ -17,7 +17,7 @@ . /etc/rc.subr name="jail" -rcvar=`set_rcvar` +rcvar="jail_enable" start_precmd="jail_prestart" start_cmd="jail_start" Modified: stable/9/etc/rc.d/keyserv ============================================================================== --- stable/9/etc/rc.d/keyserv Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/keyserv Tue Feb 14 10:16:56 2012 (r231653) @@ -13,7 +13,7 @@ . /etc/rc.subr name="keyserv" -rcvar=`set_rcvar` +rcvar="keyserv_enable" command="/usr/sbin/${name}" start_precmd="keyserv_prestart" Modified: stable/9/etc/rc.d/lpd ============================================================================== --- stable/9/etc/rc.d/lpd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/lpd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="lpd" -rcvar=`set_rcvar` +rcvar="lpd_enable" command="/usr/sbin/${name}" required_files="/etc/printcap" start_precmd="chkprintcap" Modified: stable/9/etc/rc.d/mountd ============================================================================== --- stable/9/etc/rc.d/mountd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/mountd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="mountd" -rcvar=`set_rcvar` +rcvar="mountd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/exports" Modified: stable/9/etc/rc.d/moused ============================================================================== --- stable/9/etc/rc.d/moused Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/moused Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="moused" -rcvar=`set_rcvar` +rcvar="moused_enable" command="/usr/sbin/${name}" start_cmd="moused_start" pidprefix="/var/run/moused" @@ -23,7 +23,7 @@ load_rc_config $name # if [ -n "$2" ]; then eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}} - rcvar=`set_rcvar moused_$2` + rcvar="moused_${2}_enable" pidfile="${pidprefix}.$2.pid" pidarg="-I $pidfile" fi Modified: stable/9/etc/rc.d/mroute6d ============================================================================== --- stable/9/etc/rc.d/mroute6d Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/mroute6d Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="mroute6d" -rcvar=`set_rcvar` +rcvar="mroute6d_enable" command="/usr/local/sbin/pim6dd" load_rc_config $name Modified: stable/9/etc/rc.d/mrouted ============================================================================== --- stable/9/etc/rc.d/mrouted Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/mrouted Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="mrouted" -rcvar=`set_rcvar` +rcvar="mrouted_enable" command="/usr/local/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/${name}.conf" Modified: stable/9/etc/rc.d/natd ============================================================================== --- stable/9/etc/rc.d/natd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/natd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/network.subr name="natd" -rcvar=`set_rcvar` +rcvar="natd_enable" command="/sbin/${name}" pidfile="/var/run/${name}.pid" start_precmd="natd_precmd" Modified: stable/9/etc/rc.d/netwait ============================================================================== --- stable/9/etc/rc.d/netwait Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/netwait Tue Feb 14 10:16:56 2012 (r231653) @@ -14,7 +14,7 @@ . /etc/rc.subr name="netwait" -rcvar=`set_rcvar` +rcvar="netwait_enable" start_cmd="${name}_start" stop_cmd=":" Modified: stable/9/etc/rc.d/newsyslog ============================================================================== --- stable/9/etc/rc.d/newsyslog Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/newsyslog Tue Feb 14 10:16:56 2012 (r231653) @@ -9,7 +9,7 @@ . /etc/rc.subr name="newsyslog" -rcvar=`set_rcvar` +rcvar="newsyslog_enable" required_files="/etc/newsyslog.conf" command="/usr/sbin/${name}" start_cmd="newsyslog_start" Modified: stable/9/etc/rc.d/nfscbd ============================================================================== --- stable/9/etc/rc.d/nfscbd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/nfscbd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="nfscbd" -rcvar=`set_rcvar` +rcvar="nfscbd_enable" command="/usr/sbin/${name}" sig_stop="USR1" Modified: stable/9/etc/rc.d/nfsd ============================================================================== --- stable/9/etc/rc.d/nfsd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/nfsd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="nfsd" -rcvar=`set_rcvar nfs_server` +rcvar="nfs_server_enable" command="/usr/sbin/${name}" load_rc_config $name Modified: stable/9/etc/rc.d/nfsuserd ============================================================================== --- stable/9/etc/rc.d/nfsuserd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/nfsuserd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="nfsuserd" -rcvar=`set_rcvar` +rcvar="nfsuserd_enable" command="/usr/sbin/${name}" sig_stop="USR1" Modified: stable/9/etc/rc.d/nscd ============================================================================== --- stable/9/etc/rc.d/nscd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/nscd Tue Feb 14 10:16:56 2012 (r231653) @@ -19,7 +19,7 @@ . /etc/rc.subr name="nscd" -rcvar=`set_rcvar` +rcvar="nscd_enable" command=/usr/sbin/nscd extra_commands="flush" Modified: stable/9/etc/rc.d/ntpd ============================================================================== --- stable/9/etc/rc.d/ntpd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ntpd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ntpd" -rcvar=`set_rcvar` +rcvar="ntpd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" start_precmd="ntpd_precmd" Modified: stable/9/etc/rc.d/ntpdate ============================================================================== --- stable/9/etc/rc.d/ntpdate Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ntpdate Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ntpdate" -rcvar=`set_rcvar` +rcvar="ntpdate_enable" stop_cmd=":" start_cmd="ntpdate_start" Modified: stable/9/etc/rc.d/pf ============================================================================== --- stable/9/etc/rc.d/pf Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/pf Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="pf" -rcvar=`set_rcvar` +rcvar="pf_enable" load_rc_config $name start_cmd="pf_start" stop_cmd="pf_stop" Modified: stable/9/etc/rc.d/pflog ============================================================================== --- stable/9/etc/rc.d/pflog Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/pflog Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="pflog" -rcvar=`set_rcvar` +rcvar="pflog_enable" command="/sbin/pflogd" pidfile="/var/run/pflogd.pid" start_precmd="pflog_prestart" Modified: stable/9/etc/rc.d/pfsync ============================================================================== --- stable/9/etc/rc.d/pfsync Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/pfsync Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="pfsync" -rcvar=`set_rcvar` +rcvar="pfsync_enable" start_precmd="pfsync_prestart" start_cmd="pfsync_start" stop_cmd="pfsync_stop" Modified: stable/9/etc/rc.d/powerd ============================================================================== --- stable/9/etc/rc.d/powerd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/powerd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="powerd" -rcvar=`set_rcvar` +rcvar="powerd_enable" command="/usr/sbin/${name}" stop_postcmd=powerd_poststop Modified: stable/9/etc/rc.d/ppp ============================================================================== --- stable/9/etc/rc.d/ppp Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ppp Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ppp" -rcvar=`set_rcvar` +rcvar="ppp_enable" command="/usr/sbin/${name}" start_cmd="ppp_start" stop_cmd="ppp_stop" Modified: stable/9/etc/rc.d/pppoed ============================================================================== --- stable/9/etc/rc.d/pppoed Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/pppoed Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="pppoed" -rcvar="`set_rcvar`" +rcvar="pppoed_enable" start_cmd="pppoed_start" # XXX stop_cmd will not be straightforward stop_cmd=":" Modified: stable/9/etc/rc.d/quota ============================================================================== --- stable/9/etc/rc.d/quota Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/quota Tue Feb 14 10:16:56 2012 (r231653) @@ -13,7 +13,7 @@ . /etc/rc.subr name="quota" -rcvar=`set_rcvar` +rcvar="quota_enable" load_rc_config $name start_cmd="quota_start" stop_cmd="/usr/sbin/quotaoff ${quotaoff_flags}" Modified: stable/9/etc/rc.d/rarpd ============================================================================== --- stable/9/etc/rc.d/rarpd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/rarpd Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="rarpd" -rcvar=`set_rcvar` +rcvar="rarpd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/ethers" Modified: stable/9/etc/rc.d/rfcomm_pppd_server ============================================================================== --- stable/9/etc/rc.d/rfcomm_pppd_server Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/rfcomm_pppd_server Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="rfcomm_pppd_server" -rcvar=`set_rcvar` +rcvar="rfcomm_pppd_server_enable" command="/usr/sbin/rfcomm_pppd" start_cmd="rfcomm_pppd_server_start" stop_cmd="rfcomm_pppd_server_stop" Modified: stable/9/etc/rc.d/route6d ============================================================================== --- stable/9/etc/rc.d/route6d Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/route6d Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="route6d" -rcvar=`set_rcvar` +rcvar="route6d_enable" set_rcvar_obsolete ipv6_router_enable route6d_enable set_rcvar_obsolete ipv6_router route6d_program Modified: stable/9/etc/rc.d/routed ============================================================================== --- stable/9/etc/rc.d/routed Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/routed Tue Feb 14 10:16:56 2012 (r231653) @@ -10,8 +10,8 @@ . /etc/rc.subr name="routed" +rcvar="routed_enable" desc="network RIP and router discovery routing daemon" -rcvar=`set_rcvar` set_rcvar_obsolete router_enable routed_enable set_rcvar_obsolete router routed_program Modified: stable/9/etc/rc.d/rpcbind ============================================================================== --- stable/9/etc/rc.d/rpcbind Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/rpcbind Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="rpcbind" -rcvar=`set_rcvar` +rcvar="rpcbind_enable" command="/usr/sbin/${name}" stop_postcmd='/bin/rm -f /var/run/rpcbind.*' Modified: stable/9/etc/rc.d/rtadvd ============================================================================== --- stable/9/etc/rc.d/rtadvd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/rtadvd Tue Feb 14 10:16:56 2012 (r231653) @@ -12,7 +12,7 @@ . /etc/network.subr name="rtadvd" -rcvar=`set_rcvar` +rcvar="rtadvd_enable" command="/usr/sbin/${name}" start_precmd="rtadvd_precmd" Modified: stable/9/etc/rc.d/rtsold ============================================================================== --- stable/9/etc/rc.d/rtsold Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/rtsold Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="rtsold" -rcvar=`set_rcvar` +rcvar="rtsold_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" start_postcmd="rtsold_poststart" Modified: stable/9/etc/rc.d/rwho ============================================================================== --- stable/9/etc/rc.d/rwho Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/rwho Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="rwhod" -rcvar="`set_rcvar`" +rcvar="rwhod_enable" command="/usr/sbin/${name}" load_rc_config $name Modified: stable/9/etc/rc.d/sdpd ============================================================================== --- stable/9/etc/rc.d/sdpd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/sdpd Tue Feb 14 10:16:56 2012 (r231653) @@ -12,7 +12,7 @@ name="sdpd" command="/usr/sbin/${name}" -rcvar=`set_rcvar` +rcvar="sdpd_enable" required_modules="ng_btsocket" load_rc_config $name Modified: stable/9/etc/rc.d/sendmail ============================================================================== --- stable/9/etc/rc.d/sendmail Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/sendmail Tue Feb 14 10:16:56 2012 (r231653) @@ -15,7 +15,7 @@ . /etc/rc.subr name="sendmail" -rcvar=`set_rcvar` +rcvar="sendmail_enable" required_files="/etc/mail/${name}.cf" start_precmd="sendmail_precmd" @@ -79,14 +79,14 @@ required_files= if checkyesno sendmail_submit_enable; then name="sendmail_submit" - rcvar=`set_rcvar` + rcvar="sendmail_submit_enable" start_cmd="${command} ${sendmail_submit_flags}" run_rc_command "$1" fi if checkyesno sendmail_outbound_enable; then name="sendmail_outbound" - rcvar=`set_rcvar` + rcvar="sendmail_outbound_enable" start_cmd="${command} ${sendmail_outbound_flags}" run_rc_command "$1" fi Modified: stable/9/etc/rc.d/sshd ============================================================================== --- stable/9/etc/rc.d/sshd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/sshd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="sshd" -rcvar=`set_rcvar` +rcvar="sshd_enable" command="/usr/sbin/${name}" keygen_cmd="sshd_keygen" start_precmd="sshd_precmd" Modified: stable/9/etc/rc.d/syslogd ============================================================================== --- stable/9/etc/rc.d/syslogd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/syslogd Tue Feb 14 10:16:56 2012 (r231653) @@ -10,7 +10,7 @@ . /etc/rc.subr name="syslogd" -rcvar=`set_rcvar` +rcvar="syslogd_enable" pidfile="/var/run/syslog.pid" command="/usr/sbin/${name}" required_files="/etc/syslog.conf" @@ -41,7 +41,7 @@ syslogd_precmd() # for _l in $altlog_proglist; do eval _ldir=\$${_l}_chrootdir - if checkyesno `set_rcvar $_l` && [ -n "$_ldir" ]; then + if checkyesno ${_l}_enable && [ -n "$_ldir" ]; then echo "${_ldir}/var/run/log" >> $sockfile fi done Modified: stable/9/etc/rc.d/timed ============================================================================== --- stable/9/etc/rc.d/timed Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/timed Tue Feb 14 10:16:56 2012 (r231653) @@ -11,7 +11,7 @@ . /etc/rc.subr name="timed" -rcvar=`set_rcvar` +rcvar="timed_enable" command="/usr/sbin/${name}" load_rc_config $name Modified: stable/9/etc/rc.d/ubthidhci ============================================================================== --- stable/9/etc/rc.d/ubthidhci Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/ubthidhci Tue Feb 14 10:16:56 2012 (r231653) @@ -11,8 +11,8 @@ . /etc/rc.subr name="ubthidhci" +rcvar="ubthidhci_enable" command="/usr/sbin/usbconfig" -rcvar=`set_rcvar` start_precmd="ubthidhci_prestart" ubthidhci_prestart() Modified: stable/9/etc/rc.d/virecover ============================================================================== --- stable/9/etc/rc.d/virecover Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/virecover Tue Feb 14 10:16:56 2012 (r231653) @@ -12,7 +12,7 @@ . /etc/rc.subr name="virecover" -rcvar="`set_rcvar`" +rcvar="virecover_enable" stop_cmd=":" start_cmd="virecover_start" Modified: stable/9/etc/rc.d/watchdogd ============================================================================== --- stable/9/etc/rc.d/watchdogd Tue Feb 14 10:11:53 2012 (r231652) +++ stable/9/etc/rc.d/watchdogd Tue Feb 14 10:16:56 2012 (r231653) @@ -34,7 +34,7 @@ . /etc/rc.subr name="watchdogd" -rcvar="`set_rcvar`" +rcvar="watchdogd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 10:18:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38389106566C; Tue, 14 Feb 2012 10:18:50 +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 2285F8FC1A; Tue, 14 Feb 2012 10:18:50 +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 q1EAInis092740; Tue, 14 Feb 2012 10:18:50 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EAInS4092738; Tue, 14 Feb 2012 10:18:49 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202141018.q1EAInS4092738@svn.freebsd.org> From: Doug Barton Date: Tue, 14 Feb 2012 10:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231657 - stable/9/etc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 10:18:50 -0000 Author: dougb Date: Tue Feb 14 10:18:49 2012 New Revision: 231657 URL: http://svn.freebsd.org/changeset/base/231657 Log: MFC r230374: If we're booting there is no need to waste time determining if the service is running or not. Modified: stable/9/etc/rc.subr Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/rc.subr ============================================================================== --- stable/9/etc/rc.subr Tue Feb 14 10:17:30 2012 (r231656) +++ stable/9/etc/rc.subr Tue Feb 14 10:18:49 2012 (r231657) @@ -683,7 +683,7 @@ run_rc_command() fi fi - eval $_pidcmd # determine the pid if necessary + [ -z "$autoboot" ] && eval $_pidcmd # determine the pid if necessary for _elem in $_keywords; do if [ "$_elem" != "$rc_arg" ]; then From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 10:29:33 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E7D41065670; Tue, 14 Feb 2012 10:29:33 +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 3D8608FC1E; Tue, 14 Feb 2012 10:29:33 +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 q1EATX0n093340; Tue, 14 Feb 2012 10:29:33 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EATW3h093336; Tue, 14 Feb 2012 10:29:33 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202141029.q1EATW3h093336@svn.freebsd.org> From: Doug Barton Date: Tue, 14 Feb 2012 10:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231660 - in stable/9: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 10:29:33 -0000 Author: dougb Date: Tue Feb 14 10:29:32 2012 New Revision: 231660 URL: http://svn.freebsd.org/changeset/base/231660 Log: MFC r231194: Add a knob to always load the default rulesets. While I'm here document the other devfs_ knobs in rc.conf.5. Modified: stable/9/etc/defaults/rc.conf stable/9/etc/rc.d/devfs stable/9/share/man/man5/rc.conf.5 Directory Properties: stable/9/etc/ (props changed) stable/9/share/man/man5/ (props changed) Modified: stable/9/etc/defaults/rc.conf ============================================================================== --- stable/9/etc/defaults/rc.conf Tue Feb 14 10:19:58 2012 (r231659) +++ stable/9/etc/defaults/rc.conf Tue Feb 14 10:29:32 2012 (r231660) @@ -648,6 +648,7 @@ devfs_rulesets="/etc/defaults/devfs.rule devfs_system_ruleset="" # The name (NOT number) of a ruleset to apply to /dev devfs_set_rulesets="" # A list of /mount/dev=ruleset_name settings to # apply (must be mounted already, i.e. fstab(5)) +devfs_load_rulesets="NO" # Enable to always load the default rulesets performance_cx_lowest="HIGH" # Online CPU idle state performance_cpu_freq="NONE" # Online CPU frequency economy_cx_lowest="HIGH" # Offline CPU idle state Modified: stable/9/etc/rc.d/devfs ============================================================================== --- stable/9/etc/rc.d/devfs Tue Feb 14 10:19:58 2012 (r231659) +++ stable/9/etc/rc.d/devfs Tue Feb 14 10:29:32 2012 (r231660) @@ -16,7 +16,8 @@ stop_cmd=':' devfs_start() { - if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ]; then + if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ] || + checkyesno devfs_load_rulesets; then devfs_init_rulesets if [ -n "$devfs_system_ruleset" ]; then devfs_set_ruleset $devfs_system_ruleset /dev Modified: stable/9/share/man/man5/rc.conf.5 ============================================================================== --- stable/9/share/man/man5/rc.conf.5 Tue Feb 14 10:19:58 2012 (r231659) +++ stable/9/share/man/man5/rc.conf.5 Tue Feb 14 10:29:32 2012 (r231660) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 13, 2011 +.Dd February 8, 2012 .Dt RC.CONF 5 .Os .Sh NAME @@ -3673,6 +3673,25 @@ is set to these are the flags passed to the .Xr watchdogd 8 daemon. +.It Va devfs_rulesets +.Pq Vt str +List of files containing sets of rules for +.Xr devfs 8 . +.It Va devfs_system_ruleset +.Pq Vt str +Rule name(s) to apply to the system +.Pa /dev +itself. +.It Va devfs_set_rulesets +.Pq Vt str +Pairs of already-mounted +.Pa dev +directories and rulesets that should be applied to them. +For example: /mount/dev=ruleset_name +.It Va devfs_load_rulesets +.Pq Vt bool +If set, always load the default rulesets listed in +.Va devfs_rulesets . .It Va performance_cx_lowest .Pq Vt str CPU idle state to use while on AC power. @@ -4532,6 +4551,7 @@ The default is 30. .Xr chkprintcap 8 , .Xr chown 8 , .Xr cron 8 , +.Xr devfs 8 , .Xr dhclient 8 , .Xr ftpd 8 , .Xr geli 8 , From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 10:30:23 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9376C10656D2; Tue, 14 Feb 2012 10:30:23 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7BF6F8FC1E; Tue, 14 Feb 2012 10:30: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 q1EAUNNo093517; Tue, 14 Feb 2012 10:30:23 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EAUNs3093511; Tue, 14 Feb 2012 10:30:23 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201202141030.q1EAUNs3093511@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 14 Feb 2012 10:30:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231663 - in stable/9/sys: conf dev/oce modules modules/oce X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 10:30:23 -0000 Author: luigi Date: Tue Feb 14 10:30:22 2012 New Revision: 231663 URL: http://svn.freebsd.org/changeset/base/231663 Log: MFC: the "oce" driver for Emulex OneConnect 10Gbit Ethernet. This is the same exact code that you can find in HEAD Added: stable/9/sys/dev/oce/ stable/9/sys/dev/oce/oce_hw.c (contents, props changed) stable/9/sys/dev/oce/oce_hw.h (contents, props changed) stable/9/sys/dev/oce/oce_if.c (contents, props changed) stable/9/sys/dev/oce/oce_if.h (contents, props changed) stable/9/sys/dev/oce/oce_mbox.c (contents, props changed) stable/9/sys/dev/oce/oce_queue.c (contents, props changed) stable/9/sys/dev/oce/oce_sysctl.c (contents, props changed) stable/9/sys/dev/oce/oce_util.c (contents, props changed) stable/9/sys/modules/oce/ stable/9/sys/modules/oce/Makefile (contents, props changed) Modified: stable/9/sys/conf/NOTES stable/9/sys/conf/files stable/9/sys/modules/Makefile Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Tue Feb 14 10:30:12 2012 (r231662) +++ stable/9/sys/conf/NOTES Tue Feb 14 10:30:22 2012 (r231663) @@ -1960,6 +1960,7 @@ device xmphy # XaQti XMAC II # SMC EZ Card 1000 (SMC9462TX), D-Link DGE-500T, Asante FriendlyNet # GigaNIX 1000TA and 1000TPC, the Addtron AEG320T, the Surecom # EP-320G-TX and the Netgear GA622T. +# oce: Emulex 10 Gbit adapters (OneConnect Ethernet) # pcn: Support for PCI fast ethernet adapters based on the AMD Am79c97x # PCnet-FAST, PCnet-FAST+, PCnet-FAST III, PCnet-PRO and PCnet-Home # chipsets. These can also be handled by the le(4) driver if the @@ -2100,6 +2101,7 @@ device ixgbe # Intel Pro/10Gbe PCIE Et device le # AMD Am7900 LANCE and Am79C9xx PCnet device mxge # Myricom Myri-10G 10GbE NIC device nxge # Neterion Xframe 10GbE Server/Storage Adapter +device oce # Emulex 10 GbE (OneConnect Ethernet) device ti # Alteon Networks Tigon I/II gigabit Ethernet device txp # 3Com 3cR990 (``Typhoon'') device vx # 3Com 3c590, 3c595 (``Vortex'') Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Tue Feb 14 10:30:12 2012 (r231662) +++ stable/9/sys/conf/files Tue Feb 14 10:30:22 2012 (r231663) @@ -1526,6 +1526,12 @@ dev/nmdm/nmdm.c optional nmdm dev/nsp/nsp.c optional nsp dev/nsp/nsp_pccard.c optional nsp pccard dev/null/null.c standard +dev/oce/oce_hw.c optional oce pci +dev/oce/oce_if.c optional oce pci +dev/oce/oce_mbox.c optional oce pci +dev/oce/oce_queue.c optional oce pci +dev/oce/oce_sysctl.c optional oce pci +dev/oce/oce_util.c optional oce pci dev/patm/if_patm.c optional patm pci dev/patm/if_patm_attach.c optional patm pci dev/patm/if_patm_intr.c optional patm pci Added: stable/9/sys/dev/oce/oce_hw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/oce/oce_hw.c Tue Feb 14 10:30:22 2012 (r231663) @@ -0,0 +1,588 @@ +/*- + * Copyright (C) 2012 Emulex + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Emulex Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Contact Information: + * freebsd-drivers@emulex.com + * + * Emulex + * 3333 Susan Street + * Costa Mesa, CA 92626 + */ + +/* $FreeBSD$ */ + +#include "oce_if.h" + +static int oce_POST(POCE_SOFTC sc); + +/** + * @brief Function to post status + * @param sc software handle to the device + */ +static int +oce_POST(POCE_SOFTC sc) +{ + mpu_ep_semaphore_t post_status; + int tmo = 60000; + + /* read semaphore CSR */ + post_status.dw0 = OCE_READ_REG32(sc, csr, MPU_EP_SEMAPHORE(sc)); + + /* if host is ready then wait for fw ready else send POST */ + if (post_status.bits.stage <= POST_STAGE_AWAITING_HOST_RDY) { + post_status.bits.stage = POST_STAGE_CHIP_RESET; + OCE_WRITE_REG32(sc, csr, MPU_EP_SEMAPHORE(sc), post_status.dw0); + } + + /* wait for FW ready */ + for (;;) { + if (--tmo == 0) + break; + + DELAY(1000); + + post_status.dw0 = OCE_READ_REG32(sc, csr, MPU_EP_SEMAPHORE(sc)); + if (post_status.bits.error) { + device_printf(sc->dev, + "POST failed: %x\n", post_status.dw0); + return ENXIO; + } + if (post_status.bits.stage == POST_STAGE_ARMFW_READY) + return 0; + } + + device_printf(sc->dev, "POST timed out: %x\n", post_status.dw0); + + return ENXIO; +} + +/** + * @brief Function for hardware initialization + * @param sc software handle to the device + */ +int +oce_hw_init(POCE_SOFTC sc) +{ + int rc = 0; + + rc = oce_POST(sc); + if (rc) + return rc; + + /* create the bootstrap mailbox */ + rc = oce_dma_alloc(sc, sizeof(struct oce_bmbx), &sc->bsmbx, 0); + if (rc) { + device_printf(sc->dev, "Mailbox alloc failed\n"); + return rc; + } + + rc = oce_reset_fun(sc); + if (rc) + goto error; + + + rc = oce_mbox_init(sc); + if (rc) + goto error; + + + rc = oce_get_fw_version(sc); + if (rc) + goto error; + + + rc = oce_get_fw_config(sc); + if (rc) + goto error; + + + sc->macaddr.size_of_struct = 6; + rc = oce_read_mac_addr(sc, 0, 1, MAC_ADDRESS_TYPE_NETWORK, + &sc->macaddr); + if (rc) + goto error; + + if (IS_BE(sc) && (sc->flags & OCE_FLAGS_BE3)) { + rc = oce_mbox_check_native_mode(sc); + if (rc) + goto error; + } else + sc->be3_native = 0; + + return rc; + +error: + oce_dma_free(sc, &sc->bsmbx); + device_printf(sc->dev, "Hardware initialisation failed\n"); + return rc; +} + + + +/** + * @brief Releases the obtained pci resources + * @param sc software handle to the device + */ +void +oce_hw_pci_free(POCE_SOFTC sc) +{ + int pci_cfg_barnum = 0; + + if (IS_BE(sc) && (sc->flags & OCE_FLAGS_BE2)) + pci_cfg_barnum = OCE_DEV_BE2_CFG_BAR; + else + pci_cfg_barnum = OCE_DEV_CFG_BAR; + + if (sc->devcfg_res != NULL) { + bus_release_resource(sc->dev, + SYS_RES_MEMORY, + PCIR_BAR(pci_cfg_barnum), sc->devcfg_res); + sc->devcfg_res = (struct resource *)NULL; + sc->devcfg_btag = (bus_space_tag_t) 0; + sc->devcfg_bhandle = (bus_space_handle_t)0; + sc->devcfg_vhandle = (void *)NULL; + } + + if (sc->csr_res != NULL) { + bus_release_resource(sc->dev, + SYS_RES_MEMORY, + PCIR_BAR(OCE_PCI_CSR_BAR), sc->csr_res); + sc->csr_res = (struct resource *)NULL; + sc->csr_btag = (bus_space_tag_t)0; + sc->csr_bhandle = (bus_space_handle_t)0; + sc->csr_vhandle = (void *)NULL; + } + + if (sc->db_res != NULL) { + bus_release_resource(sc->dev, + SYS_RES_MEMORY, + PCIR_BAR(OCE_PCI_DB_BAR), sc->db_res); + sc->db_res = (struct resource *)NULL; + sc->db_btag = (bus_space_tag_t)0; + sc->db_bhandle = (bus_space_handle_t)0; + sc->db_vhandle = (void *)NULL; + } +} + + + + +/** + * @brief Function to get the PCI capabilities + * @param sc software handle to the device + */ +static +void oce_get_pci_capabilities(POCE_SOFTC sc) +{ + uint32_t val; + + if (pci_find_extcap(sc->dev, PCIY_PCIX, &val) == 0) { + if (val != 0) + sc->flags |= OCE_FLAGS_PCIX; + } + + if (pci_find_extcap(sc->dev, PCIY_EXPRESS, &val) == 0) { + if (val != 0) { + uint16_t link_status = + pci_read_config(sc->dev, val + 0x12, 2); + + sc->flags |= OCE_FLAGS_PCIE; + sc->pcie_link_speed = link_status & 0xf; + sc->pcie_link_width = (link_status >> 4) & 0x3f; + } + } + + if (pci_find_extcap(sc->dev, PCIY_MSI, &val) == 0) { + if (val != 0) + sc->flags |= OCE_FLAGS_MSI_CAPABLE; + } + + if (pci_find_extcap(sc->dev, PCIY_MSIX, &val) == 0) { + if (val != 0) { + val = pci_msix_count(sc->dev); + sc->flags |= OCE_FLAGS_MSIX_CAPABLE; + } + } +} + +/** + * @brief Allocate PCI resources. + * + * @param sc software handle to the device + * @returns 0 if successful, or error + */ +int +oce_hw_pci_alloc(POCE_SOFTC sc) +{ + int rr, pci_cfg_barnum = 0; + pci_sli_intf_t intf; + + pci_enable_busmaster(sc->dev); + + oce_get_pci_capabilities(sc); + + sc->fn = pci_get_function(sc->dev); + + /* setup the device config region */ + if (IS_BE(sc) && (sc->flags & OCE_FLAGS_BE2)) + pci_cfg_barnum = OCE_DEV_BE2_CFG_BAR; + else + pci_cfg_barnum = OCE_DEV_CFG_BAR; + + rr = PCIR_BAR(pci_cfg_barnum); + + if (IS_BE(sc)) + sc->devcfg_res = bus_alloc_resource_any(sc->dev, + SYS_RES_MEMORY, &rr, + RF_ACTIVE|RF_SHAREABLE); + else + sc->devcfg_res = bus_alloc_resource(sc->dev, + SYS_RES_MEMORY, &rr, + 0ul, ~0ul, 32768, + RF_ACTIVE|RF_SHAREABLE); + + if (!sc->devcfg_res) + goto error; + + sc->devcfg_btag = rman_get_bustag(sc->devcfg_res); + sc->devcfg_bhandle = rman_get_bushandle(sc->devcfg_res); + sc->devcfg_vhandle = rman_get_virtual(sc->devcfg_res); + + /* Read the SLI_INTF register and determine whether we + * can use this port and its features + */ + intf.dw0 = pci_read_config((sc)->dev,OCE_INTF_REG_OFFSET,4); + + if (intf.bits.sli_valid != OCE_INTF_VALID_SIG) + goto error; + + if (intf.bits.sli_rev != OCE_INTF_SLI_REV4) { + device_printf(sc->dev, "Adapter doesnt support SLI4\n"); + goto error; + } + + if (intf.bits.sli_if_type == OCE_INTF_IF_TYPE_1) + sc->flags |= OCE_FLAGS_MBOX_ENDIAN_RQD; + + if (intf.bits.sli_hint1 == OCE_INTF_FUNC_RESET_REQD) + sc->flags |= OCE_FLAGS_FUNCRESET_RQD; + + if (intf.bits.sli_func_type == OCE_INTF_VIRT_FUNC) + sc->flags |= OCE_FLAGS_VIRTUAL_PORT; + + /* Lancer has one BAR (CFG) but BE3 has three (CFG, CSR, DB) */ + if (IS_BE(sc)) { + /* set up CSR region */ + rr = PCIR_BAR(OCE_PCI_CSR_BAR); + sc->csr_res = bus_alloc_resource_any(sc->dev, + SYS_RES_MEMORY, &rr, RF_ACTIVE|RF_SHAREABLE); + if (!sc->csr_res) + goto error; + sc->csr_btag = rman_get_bustag(sc->csr_res); + sc->csr_bhandle = rman_get_bushandle(sc->csr_res); + sc->csr_vhandle = rman_get_virtual(sc->csr_res); + + /* set up DB doorbell region */ + rr = PCIR_BAR(OCE_PCI_DB_BAR); + sc->db_res = bus_alloc_resource_any(sc->dev, + SYS_RES_MEMORY, &rr, RF_ACTIVE|RF_SHAREABLE); + if (!sc->db_res) + goto error; + sc->db_btag = rman_get_bustag(sc->db_res); + sc->db_bhandle = rman_get_bushandle(sc->db_res); + sc->db_vhandle = rman_get_virtual(sc->db_res); + } + + return 0; + +error: + oce_hw_pci_free(sc); + return ENXIO; +} + + +/** + * @brief Function for device shutdown + * @param sc software handle to the device + * @returns 0 on success, error otherwise + */ +void +oce_hw_shutdown(POCE_SOFTC sc) +{ + + oce_stats_free(sc); + /* disable hardware interrupts */ + oce_hw_intr_disable(sc); + /* Free LRO resources */ + oce_free_lro(sc); + /* Release queue*/ + oce_queue_release_all(sc); + /*Delete Network Interface*/ + oce_delete_nw_interface(sc); + /* After fw clean we dont send any cmds to fw.*/ + oce_fw_clean(sc); + /* release intr resources */ + oce_intr_free(sc); + /* release PCI resources */ + oce_hw_pci_free(sc); + /* free mbox specific resources */ + LOCK_DESTROY(&sc->bmbx_lock); + LOCK_DESTROY(&sc->dev_lock); + + oce_dma_free(sc, &sc->bsmbx); +} + + +/** + * @brief Function for creating nw interface. + * @param sc software handle to the device + * @returns 0 on success, error otherwise + */ +int +oce_create_nw_interface(POCE_SOFTC sc) +{ + int rc; + uint32_t capab_flags; + uint32_t capab_en_flags; + + /* interface capabilities to give device when creating interface */ + capab_flags = OCE_CAPAB_FLAGS; + + /* capabilities to enable by default (others set dynamically) */ + capab_en_flags = OCE_CAPAB_ENABLE; + + if (IS_XE201(sc)) { + /* LANCER A0 workaround */ + capab_en_flags &= ~MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR; + capab_flags &= ~MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR; + } + + /* enable capabilities controlled via driver startup parameters */ + if (sc->rss_enable) + capab_en_flags |= MBX_RX_IFACE_FLAGS_RSS; + else { + capab_en_flags &= ~MBX_RX_IFACE_FLAGS_RSS; + capab_flags &= ~MBX_RX_IFACE_FLAGS_RSS; + } + + rc = oce_if_create(sc, + capab_flags, + capab_en_flags, + 0, &sc->macaddr.mac_addr[0], &sc->if_id); + if (rc) + return rc; + + atomic_inc_32(&sc->nifs); + + sc->if_cap_flags = capab_en_flags; + + /* Enable VLAN Promisc on HW */ + rc = oce_config_vlan(sc, (uint8_t) sc->if_id, NULL, 0, 1, 1); + if (rc) + goto error; + + /* set default flow control */ + rc = oce_set_flow_control(sc, sc->flow_control); + if (rc) + goto error; + + rc = oce_rxf_set_promiscuous(sc, sc->promisc); + if (rc) + goto error; + + return rc; + +error: + oce_delete_nw_interface(sc); + return rc; + +} + +/** + * @brief Function to delete a nw interface. + * @param sc software handle to the device + */ +void +oce_delete_nw_interface(POCE_SOFTC sc) +{ + /* currently only single interface is implmeneted */ + if (sc->nifs > 0) { + oce_if_del(sc, sc->if_id); + atomic_dec_32(&sc->nifs); + } +} + +/** + * @brief Soft reset. + * @param sc software handle to the device + * @returns 0 on success, error otherwise + */ +int +oce_pci_soft_reset(POCE_SOFTC sc) +{ + int rc; + mpu_ep_control_t ctrl; + + ctrl.dw0 = OCE_READ_REG32(sc, csr, MPU_EP_CONTROL); + ctrl.bits.cpu_reset = 1; + OCE_WRITE_REG32(sc, csr, MPU_EP_CONTROL, ctrl.dw0); + DELAY(50); + rc=oce_POST(sc); + + return rc; +} + +/** + * @brief Function for hardware start + * @param sc software handle to the device + * @returns 0 on success, error otherwise + */ +int +oce_hw_start(POCE_SOFTC sc) +{ + struct link_status link = { 0 }; + int rc = 0; + + rc = oce_get_link_status(sc, &link); + if (rc) + return 1; + + if (link.logical_link_status == NTWK_LOGICAL_LINK_UP) { + sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; + sc->link_status = NTWK_LOGICAL_LINK_UP; + if_link_state_change(sc->ifp, LINK_STATE_UP); + } else { + sc->ifp->if_drv_flags &= + ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + sc->link_status = NTWK_LOGICAL_LINK_DOWN; + if_link_state_change(sc->ifp, LINK_STATE_DOWN); + } + + if (link.mac_speed > 0 && link.mac_speed < 5) + sc->link_speed = link.mac_speed; + else + sc->link_speed = 0; + + sc->qos_link_speed = (uint32_t )link.qos_link_speed * 10; + + rc = oce_start_mq(sc->mq); + + /* we need to get MCC aync events. + So enable intrs and also arm first EQ + */ + oce_hw_intr_enable(sc); + oce_arm_eq(sc, sc->eq[0]->eq_id, 0, TRUE, FALSE); + + return rc; +} + + +/** + * @brief Function for hardware enable interupts. + * @param sc software handle to the device + */ +void +oce_hw_intr_enable(POCE_SOFTC sc) +{ + uint32_t reg; + + reg = OCE_READ_REG32(sc, devcfg, PCICFG_INTR_CTRL); + reg |= HOSTINTR_MASK; + OCE_WRITE_REG32(sc, devcfg, PCICFG_INTR_CTRL, reg); + +} + + +/** + * @brief Function for hardware disable interupts + * @param sc software handle to the device + */ +void +oce_hw_intr_disable(POCE_SOFTC sc) +{ + uint32_t reg; + + reg = OCE_READ_REG32(sc, devcfg, PCICFG_INTR_CTRL); + reg &= ~HOSTINTR_MASK; + OCE_WRITE_REG32(sc, devcfg, PCICFG_INTR_CTRL, reg); +} + + + +/** + * @brief Function for hardware update multicast filter + * @param sc software handle to the device + */ +int +oce_hw_update_multicast(POCE_SOFTC sc) +{ + struct ifnet *ifp = sc->ifp; + struct ifmultiaddr *ifma; + struct mbx_set_common_iface_multicast *req = NULL; + OCE_DMA_MEM dma; + int rc = 0; + + /* Allocate DMA mem*/ + if (oce_dma_alloc(sc, sizeof(struct mbx_set_common_iface_multicast), + &dma, 0)) + return ENOMEM; + + req = OCE_DMAPTR(&dma, struct mbx_set_common_iface_multicast); + bzero(req, sizeof(struct mbx_set_common_iface_multicast)); + +#if __FreeBSD_version > 800000 + if_maddr_rlock(ifp); +#endif + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + + if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) { + /*More multicast addresses than our hardware table + So Enable multicast promiscus in our hardware to + accept all multicat packets + */ + req->params.req.promiscuous = 1; + break; + } + bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), + &req->params.req.mac[req->params.req.num_mac], + ETH_ADDR_LEN); + req->params.req.num_mac = req->params.req.num_mac + 1; + } +#if __FreeBSD_version > 800000 + if_maddr_runlock(ifp); +#endif + req->params.req.if_id = sc->if_id; + rc = oce_update_multicast(sc, &dma); + oce_dma_free(sc, &dma); + return rc; +} + Added: stable/9/sys/dev/oce/oce_hw.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/oce/oce_hw.h Tue Feb 14 10:30:22 2012 (r231663) @@ -0,0 +1,3381 @@ +/*- + * Copyright (C) 2012 Emulex + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Emulex Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Contact Information: + * freebsd-drivers@emulex.com + * + * Emulex + * 3333 Susan Street + * Costa Mesa, CA 92626 + */ + +/* $FreeBSD$ */ + +#include + +#undef _BIG_ENDIAN /* TODO */ +#pragma pack(1) + +#define OC_CNA_GEN2 0x2 +#define OC_CNA_GEN3 0x3 +#define DEVID_TIGERSHARK 0x700 +#define DEVID_TOMCAT 0x710 + +/* PCI CSR offsets */ +#define PCICFG_F1_CSR 0x0 /* F1 for NIC */ +#define PCICFG_SEMAPHORE 0xbc +#define PCICFG_SOFT_RESET 0x5c +#define PCICFG_UE_STATUS_HI_MASK 0xac +#define PCICFG_UE_STATUS_LO_MASK 0xa8 +#define PCICFG_ONLINE0 0xb0 +#define PCICFG_ONLINE1 0xb4 +#define INTR_EN 0x20000000 +#define IMAGE_TRANSFER_SIZE (32 * 1024) /* 32K at a time */ + +/* CSR register offsets */ +#define MPU_EP_CONTROL 0 +#define MPU_EP_SEMAPHORE_BE3 0xac +#define MPU_EP_SEMAPHORE_XE201 0x400 +#define MPU_EP_SEMAPHORE(sc) \ + ((IS_BE(sc)) ? MPU_EP_SEMAPHORE_BE3 : MPU_EP_SEMAPHORE_XE201) +#define PCICFG_INTR_CTRL 0xfc +#define HOSTINTR_MASK (1 << 29) +#define HOSTINTR_PFUNC_SHIFT 26 +#define HOSTINTR_PFUNC_MASK 7 + +/* POST status reg struct */ +#define POST_STAGE_POWER_ON_RESET 0x00 +#define POST_STAGE_AWAITING_HOST_RDY 0x01 +#define POST_STAGE_HOST_RDY 0x02 +#define POST_STAGE_CHIP_RESET 0x03 +#define POST_STAGE_ARMFW_READY 0xc000 +#define POST_STAGE_ARMFW_UE 0xf000 + +/* DOORBELL registers */ +#define PD_RXULP_DB 0x0100 +#define PD_TXULP_DB 0x0060 +#define DB_RQ_ID_MASK 0x3FF + +#define PD_CQ_DB 0x0120 +#define PD_EQ_DB PD_CQ_DB +#define PD_MPU_MBOX_DB 0x0160 +#define PD_MQ_DB 0x0140 + +/* EQE completion types */ +#define EQ_MINOR_CODE_COMPLETION 0x00 +#define EQ_MINOR_CODE_OTHER 0x01 +#define EQ_MAJOR_CODE_COMPLETION 0x00 + +/* Link Status field values */ +#define PHY_LINK_FAULT_NONE 0x0 +#define PHY_LINK_FAULT_LOCAL 0x01 +#define PHY_LINK_FAULT_REMOTE 0x02 + +#define PHY_LINK_SPEED_ZERO 0x0 /* No link */ +#define PHY_LINK_SPEED_10MBPS 0x1 /* (10 Mbps) */ +#define PHY_LINK_SPEED_100MBPS 0x2 /* (100 Mbps) */ +#define PHY_LINK_SPEED_1GBPS 0x3 /* (1 Gbps) */ +#define PHY_LINK_SPEED_10GBPS 0x4 /* (10 Gbps) */ + +#define PHY_LINK_DUPLEX_NONE 0x0 +#define PHY_LINK_DUPLEX_HALF 0x1 +#define PHY_LINK_DUPLEX_FULL 0x2 + +#define NTWK_PORT_A 0x0 /* (Port A) */ +#define NTWK_PORT_B 0x1 /* (Port B) */ + +#define PHY_LINK_SPEED_ZERO 0x0 /* (No link.) */ +#define PHY_LINK_SPEED_10MBPS 0x1 /* (10 Mbps) */ +#define PHY_LINK_SPEED_100MBPS 0x2 /* (100 Mbps) */ +#define PHY_LINK_SPEED_1GBPS 0x3 /* (1 Gbps) */ +#define PHY_LINK_SPEED_10GBPS 0x4 /* (10 Gbps) */ + +/* Hardware Address types */ +#define MAC_ADDRESS_TYPE_STORAGE 0x0 /* (Storage MAC Address) */ +#define MAC_ADDRESS_TYPE_NETWORK 0x1 /* (Network MAC Address) */ +#define MAC_ADDRESS_TYPE_PD 0x2 /* (Protection Domain MAC Addr) */ +#define MAC_ADDRESS_TYPE_MANAGEMENT 0x3 /* (Management MAC Address) */ +#define MAC_ADDRESS_TYPE_FCOE 0x4 /* (FCoE MAC Address) */ + +/* CREATE_IFACE capability and cap_en flags */ +#define MBX_RX_IFACE_FLAGS_RSS 0x4 +#define MBX_RX_IFACE_FLAGS_PROMISCUOUS 0x8 +#define MBX_RX_IFACE_FLAGS_BROADCAST 0x10 +#define MBX_RX_IFACE_FLAGS_UNTAGGED 0x20 +#define MBX_RX_IFACE_FLAGS_VLAN_PROMISCUOUS 0x80 +#define MBX_RX_IFACE_FLAGS_VLAN 0x100 +#define MBX_RX_IFACE_FLAGS_MCAST_PROMISCUOUS 0x200 +#define MBX_RX_IFACE_FLAGS_PASS_L2_ERR 0x400 +#define MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR 0x800 +#define MBX_RX_IFACE_FLAGS_MULTICAST 0x1000 +#define MBX_RX_IFACE_RX_FILTER_IF_MULTICAST_HASH 0x2000 +#define MBX_RX_IFACE_FLAGS_HDS 0x4000 +#define MBX_RX_IFACE_FLAGS_DIRECTED 0x8000 +#define MBX_RX_IFACE_FLAGS_VMQ 0x10000 +#define MBX_RX_IFACE_FLAGS_NETQ 0x20000 +#define MBX_RX_IFACE_FLAGS_QGROUPS 0x40000 +#define MBX_RX_IFACE_FLAGS_LSO 0x80000 +#define MBX_RX_IFACE_FLAGS_LRO 0x100000 + +#define MQ_RING_CONTEXT_SIZE_16 0x5 /* (16 entries) */ +#define MQ_RING_CONTEXT_SIZE_32 0x6 /* (32 entries) */ +#define MQ_RING_CONTEXT_SIZE_64 0x7 /* (64 entries) */ +#define MQ_RING_CONTEXT_SIZE_128 0x8 /* (128 entries) */ + +#define MBX_DB_READY_BIT 0x1 +#define MBX_DB_HI_BIT 0x2 +#define ASYNC_EVENT_CODE_LINK_STATE 0x1 +#define ASYNC_EVENT_LINK_UP 0x1 +#define ASYNC_EVENT_LINK_DOWN 0x0 + +/* port link_status */ +#define ASYNC_EVENT_LOGICAL 0x02 + +/* Logical Link Status */ +#define NTWK_LOGICAL_LINK_DOWN 0 +#define NTWK_LOGICAL_LINK_UP 1 + +/* Rx filter bits */ +#define NTWK_RX_FILTER_IP_CKSUM 0x1 +#define NTWK_RX_FILTER_TCP_CKSUM 0x2 +#define NTWK_RX_FILTER_UDP_CKSUM 0x4 +#define NTWK_RX_FILTER_STRIP_CRC 0x8 + +/* max SGE per mbx */ +#define MAX_MBX_SGE 19 + +/* Max multicast filter size*/ +#define OCE_MAX_MC_FILTER_SIZE 64 + +/* PCI SLI (Service Level Interface) capabilities register */ +#define OCE_INTF_REG_OFFSET 0x58 +#define OCE_INTF_VALID_SIG 6 /* register's signature */ +#define OCE_INTF_FUNC_RESET_REQD 1 +#define OCE_INTF_HINT1_NOHINT 0 +#define OCE_INTF_HINT1_SEMAINIT 1 +#define OCE_INTF_HINT1_STATCTRL 2 +#define OCE_INTF_IF_TYPE_0 0 +#define OCE_INTF_IF_TYPE_1 1 +#define OCE_INTF_IF_TYPE_2 2 +#define OCE_INTF_IF_TYPE_3 3 +#define OCE_INTF_SLI_REV3 3 /* not supported by driver */ +#define OCE_INTF_SLI_REV4 4 /* driver supports SLI-4 */ +#define OCE_INTF_PHYS_FUNC 0 +#define OCE_INTF_VIRT_FUNC 1 +#define OCE_INTF_FAMILY_BE2 0 /* not supported by driver */ +#define OCE_INTF_FAMILY_BE3 1 /* driver supports BE3 */ +#define OCE_INTF_FAMILY_A0_CHIP 0xA /* Lancer A0 chip (supported) */ +#define OCE_INTF_FAMILY_B0_CHIP 0xB /* Lancer B0 chip (future) */ + +#define NIC_WQE_SIZE 16 +#define NIC_UNICAST 0x00 +#define NIC_MULTICAST 0x01 +#define NIC_BROADCAST 0x02 + +#define NIC_HDS_NO_SPLIT 0x00 +#define NIC_HDS_SPLIT_L3PL 0x01 +#define NIC_HDS_SPLIT_L4PL 0x02 + +#define NIC_WQ_TYPE_FORWARDING 0x01 +#define NIC_WQ_TYPE_STANDARD 0x02 +#define NIC_WQ_TYPE_LOW_LATENCY 0x04 + +#define OCE_RESET_STATS 1 +#define OCE_RETAIN_STATS 0 +#define OCE_TXP_SW_SZ 48 + +typedef union pci_sli_intf_u { + uint32_t dw0; + struct { +#ifdef _BIG_ENDIAN + uint32_t sli_valid:3; + uint32_t sli_hint2:5; + uint32_t sli_hint1:8; + uint32_t sli_if_type:4; + uint32_t sli_family:4; + uint32_t sli_rev:4; + uint32_t rsv0:3; + uint32_t sli_func_type:1; +#else + uint32_t sli_func_type:1; + uint32_t rsv0:3; + uint32_t sli_rev:4; + uint32_t sli_family:4; + uint32_t sli_if_type:4; + uint32_t sli_hint1:8; + uint32_t sli_hint2:5; + uint32_t sli_valid:3; +#endif + } bits; +} pci_sli_intf_t; + + + +/* physical address structure to be used in MBX */ +struct phys_addr { + /* dw0 */ + uint32_t lo; + /* dw1 */ + uint32_t hi; +}; + + + +typedef union pcicfg_intr_ctl_u { + uint32_t dw0; + struct { +#ifdef _BIG_ENDIAN + uint32_t winselect:2; + uint32_t hostintr:1; + uint32_t pfnum:3; + uint32_t vf_cev_int_line_en:1; + uint32_t winaddr:23; + uint32_t membarwinen:1; +#else + uint32_t membarwinen:1; + uint32_t winaddr:23; + uint32_t vf_cev_int_line_en:1; + uint32_t pfnum:3; + uint32_t hostintr:1; + uint32_t winselect:2; +#endif + } bits; +} pcicfg_intr_ctl_t; + + + + +typedef union pcicfg_semaphore_u { + uint32_t dw0; + struct { +#ifdef _BIG_ENDIAN + uint32_t rsvd:31; + uint32_t lock:1; +#else + uint32_t lock:1; + uint32_t rsvd:31; +#endif + } bits; +} pcicfg_semaphore_t; + + + + +typedef union pcicfg_soft_reset_u { + uint32_t dw0; + struct { +#ifdef _BIG_ENDIAN + uint32_t nec_ll_rcvdetect:8; + uint32_t dbg_all_reqs_62_49:14; + uint32_t scratchpad0:1; + uint32_t exception_oe:1; + uint32_t soft_reset:1; + uint32_t rsvd0:7; +#else + uint32_t rsvd0:7; + uint32_t soft_reset:1; + uint32_t exception_oe:1; + uint32_t scratchpad0:1; + uint32_t dbg_all_reqs_62_49:14; + uint32_t nec_ll_rcvdetect:8; +#endif + } bits; +} pcicfg_soft_reset_t; + + + + +typedef union pcicfg_online1_u { + uint32_t dw0; + struct { +#ifdef _BIG_ENDIAN + uint32_t host8_online:1; + uint32_t host7_online:1; + uint32_t host6_online:1; + uint32_t host5_online:1; + uint32_t host4_online:1; + uint32_t host3_online:1; + uint32_t host2_online:1; + uint32_t ipc_online:1; + uint32_t arm_online:1; + uint32_t txp_online:1; + uint32_t xaui_online:1; + uint32_t rxpp_online:1; + uint32_t txpb_online:1; + uint32_t rr_online:1; + uint32_t pmem_online:1; + uint32_t pctl1_online:1; + uint32_t pctl0_online:1; + uint32_t pcs1online_online:1; + uint32_t mpu_iram_online:1; + uint32_t pcs0online_online:1; + uint32_t mgmt_mac_online:1; + uint32_t lpcmemhost_online:1; +#else + uint32_t lpcmemhost_online:1; + uint32_t mgmt_mac_online:1; + uint32_t pcs0online_online:1; + uint32_t mpu_iram_online:1; + uint32_t pcs1online_online:1; + uint32_t pctl0_online:1; + uint32_t pctl1_online:1; + uint32_t pmem_online:1; + uint32_t rr_online:1; + uint32_t txpb_online:1; + uint32_t rxpp_online:1; + uint32_t xaui_online:1; + uint32_t txp_online:1; + uint32_t arm_online:1; + uint32_t ipc_online:1; + uint32_t host2_online:1; + uint32_t host3_online:1; + uint32_t host4_online:1; + uint32_t host5_online:1; + uint32_t host6_online:1; + uint32_t host7_online:1; + uint32_t host8_online:1; +#endif + } bits; +} pcicfg_online1_t; + + + +typedef union mpu_ep_semaphore_u { + uint32_t dw0; + struct { +#ifdef _BIG_ENDIAN *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 10:33:57 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4CCA106566B; Tue, 14 Feb 2012 10:33:57 +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 ADFA98FC18; Tue, 14 Feb 2012 10:33: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 q1EAXv06093721; Tue, 14 Feb 2012 10:33:57 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EAXvvk093718; Tue, 14 Feb 2012 10:33:57 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202141033.q1EAXvvk093718@svn.freebsd.org> From: Doug Barton Date: Tue, 14 Feb 2012 10:33:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231664 - stable/9/etc/rc.d X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 10:33:57 -0000 Author: dougb Date: Tue Feb 14 10:33:57 2012 New Revision: 231664 URL: http://svn.freebsd.org/changeset/base/231664 Log: MFC r231507: Move addswap to run right after kld (aka early in the second stage), as it did previously. Modified: stable/9/etc/rc.d/addswap stable/9/etc/rc.d/var Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/rc.d/addswap ============================================================================== --- stable/9/etc/rc.d/addswap Tue Feb 14 10:30:22 2012 (r231663) +++ stable/9/etc/rc.d/addswap Tue Feb 14 10:33:57 2012 (r231664) @@ -6,7 +6,7 @@ # # PROVIDE: addswap -# REQUIRE: FILESYSTEMS +# REQUIRE: FILESYSTEMS kld # KEYWORD: nojail . /etc/rc.subr Modified: stable/9/etc/rc.d/var ============================================================================== --- stable/9/etc/rc.d/var Tue Feb 14 10:30:22 2012 (r231663) +++ stable/9/etc/rc.d/var Tue Feb 14 10:33:57 2012 (r231664) @@ -28,7 +28,7 @@ # # PROVIDE: var -# REQUIRE: FILESYSTEMS kld +# REQUIRE: FILESYSTEMS kld addswap . /etc/rc.subr From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 12:43:34 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07BCD106576C; Tue, 14 Feb 2012 12:43:34 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEF388FC13; Tue, 14 Feb 2012 12:43:33 +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 q1EChX43098744; Tue, 14 Feb 2012 12:43:33 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EChXrJ098740; Tue, 14 Feb 2012 12:43:33 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201202141243.q1EChXrJ098740@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 14 Feb 2012 12:43:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231676 - in stable/9: etc etc/rc.d share/man/man8 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 12:43:34 -0000 Author: des Date: Tue Feb 14 12:43:33 2012 New Revision: 231676 URL: http://svn.freebsd.org/changeset/base/231676 Log: MFH r230007, r230388: document quiet*, fix devd/dhclient interaction. Modified: stable/9/etc/rc.d/dhclient stable/9/etc/rc.subr stable/9/share/man/man8/rc.subr.8 Directory Properties: stable/9/etc/ (props changed) stable/9/share/man/ (props changed) Modified: stable/9/etc/rc.d/dhclient ============================================================================== --- stable/9/etc/rc.d/dhclient Tue Feb 14 12:13:04 2012 (r231675) +++ stable/9/etc/rc.d/dhclient Tue Feb 14 12:43:33 2012 (r231676) @@ -22,7 +22,14 @@ stop_precmd="dhclient_pre_check" dhclient_pre_check() { if [ -z "${rc_force}" ] && ! dhcpif $ifn; then - err 1 "'$ifn' is not a DHCP-enabled interface" + local msg + msg="'$ifn' is not a DHCP-enabled interface" + if [ -z "${rc_quiet}" ]; then + echo "$msg" + else + debug "$msg" + fi + exit 1 fi } Modified: stable/9/etc/rc.subr ============================================================================== --- stable/9/etc/rc.subr Tue Feb 14 12:13:04 2012 (r231675) +++ stable/9/etc/rc.subr Tue Feb 14 12:43:33 2012 (r231676) @@ -1117,7 +1117,7 @@ load_rc_config_var() # rc_usage() { - echo -n 1>&2 "Usage: $0 [fast|force|one](" + echo -n 1>&2 "Usage: $0 [fast|force|one|quiet](" _sep= for _elem; do Modified: stable/9/share/man/man8/rc.subr.8 ============================================================================== --- stable/9/share/man/man8/rc.subr.8 Tue Feb 14 12:13:04 2012 (r231675) +++ stable/9/share/man/man8/rc.subr.8 Tue Feb 14 12:43:33 2012 (r231676) @@ -339,7 +339,7 @@ with being the list of valid arguments prefixed by .Sm off -.Dq Bq Li fast | force | one . +.Dq Bq Li fast | force | one | quiet . .Sm on .It Ic reverse_list Ar item ... Print the list of @@ -427,6 +427,22 @@ Skip the checks for being set to .Dq Li YES , but performs all the other prerequisite tests. +.It Li quiet +Inhibits some verbose diagnostics. +Currently, this includes messages +.Qq Starting ${name} +(as checked by +.Ic check_startmsgs +inside +.Nm ) +and errors about usage of services that are not enabled in +.Xr rc.conf 5 . +This prefix also sets +.Va rc_quiet Ns = Ns Li YES . +.Em Please, note: +.Va rc_quiet +is not intended to completely mask all debug and warning messages, +but only certain small classes of them. .El .Pp .Ic run_rc_command From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 14:17:46 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A259B1065672; Tue, 14 Feb 2012 14:17:46 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ECDF8FC12; Tue, 14 Feb 2012 14:17:46 +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 q1EEHkZl002144; Tue, 14 Feb 2012 14:17:46 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EEHkT2002137; Tue, 14 Feb 2012 14:17:46 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202141417.q1EEHkT2002137@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 14 Feb 2012 14:17:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231679 - stable/9/sys/dev/mps X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 14:17:46 -0000 Author: ken Date: Tue Feb 14 14:17:46 2012 New Revision: 231679 URL: http://svn.freebsd.org/changeset/base/231679 Log: MFC 231240 Bring in a number of mps(4) driver fixes from LSI: 1. Fixed timeout specification for the msleep in mps_wait_command(). Added 30 second timeout for mps_wait_command() calls in mps_user.c. 2. Make sure we call mps_detach_user() from the kldunload path. 3. Raid Hotplug behavior change. The driver now removes a volume when it goes to a failed state, so we also need to add volume back to the OS when it goes to opitimal/degraded/online from failed/missing. Handle raid volume add and remove from the IR_Volume event. 4. Added some more debugging information. 5. Replace xpt_async(AC_LOST_DEVICE, path, NULL) with mpssas_rescan_target(). This is to work around a panic in CAM that shows up when adding a drive with a rescan and removing another device from the driver thread with an AC_LOST_DEVICE async notification. This problem was encountered in testing with the LSI sas2ircu utility, which was used to create a RAID volume from physical disks. The driver has to create the RAID volume target and remove the physical disk targets, and triggered a panic in the process. The CAM issue needs to be fully diagnosed and fixed, but this works around the issue for now. 6. Fix some memory initialization issues in mps_free_command(). 7. Resolve the "devq freeze forever" issue. This was caused by the internal read capacity command issued in the non-head version of the driver. When the command completed with an error, the driver wasn't unfreezing thd device queue. The version in head uses the CAM infrastructure for getting the read capacity information, and therefore doesn't have the same issue. 8. Bump the version to 13.00.00.00-fbsd. (this is very close to LSI's internal stable driver 13.00.00.00) Submitted by: Kashyap Desai Modified: stable/9/sys/dev/mps/mps.c stable/9/sys/dev/mps/mps_sas.c stable/9/sys/dev/mps/mps_sas.h stable/9/sys/dev/mps/mps_sas_lsi.c stable/9/sys/dev/mps/mps_user.c stable/9/sys/dev/mps/mpsvar.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/mps/mps.c ============================================================================== --- stable/9/sys/dev/mps/mps.c Tue Feb 14 12:50:20 2012 (r231678) +++ stable/9/sys/dev/mps/mps.c Tue Feb 14 14:17:46 2012 (r231679) @@ -529,7 +529,7 @@ mps_enqueue_request(struct mps_softc *sc mps_dprint(sc, MPS_TRACE, "%s SMID %u cm %p ccb %p\n", __func__, cm->cm_desc.Default.SMID, cm, cm->cm_ccb); - if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE) + if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE && !(sc->mps_flags & MPS_FLAGS_SHUTDOWN)) mtx_assert(&sc->mps_mtx, MA_OWNED); if (++sc->io_cmds_active > sc->io_cmds_highwater) @@ -1335,6 +1335,8 @@ mps_free(struct mps_softc *sc) ((error = mps_detach_sas(sc)) != 0)) return (error); + mps_detach_user(sc); + /* Put the IOC back in the READY state. */ mps_lock(sc); if ((error = mps_transition_ready(sc)) != 0) { @@ -2142,7 +2144,7 @@ mps_wait_command(struct mps_softc *sc, s error = mps_map_command(sc, cm); if ((error != 0) && (error != EINPROGRESS)) return (error); - error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout); + error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout*hz); if (error == EWOULDBLOCK) error = ETIMEDOUT; return (error); Modified: stable/9/sys/dev/mps/mps_sas.c ============================================================================== --- stable/9/sys/dev/mps/mps_sas.c Tue Feb 14 12:50:20 2012 (r231678) +++ stable/9/sys/dev/mps/mps_sas.c Tue Feb 14 14:17:46 2012 (r231679) @@ -139,7 +139,6 @@ static uint8_t op_code_prot[256] = { MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); -static struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc *, int, uint16_t); static void mpssas_discovery_timeout(void *data); static void mpssas_remove_device(struct mps_softc *, struct mps_command *); static void mpssas_remove_complete(struct mps_softc *, struct mps_command *); @@ -175,7 +174,7 @@ static int mpssas_send_portenable(struct static void mpssas_portenable_complete(struct mps_softc *sc, struct mps_command *cm); -static struct mpssas_target * +struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc *sassc, int start, uint16_t handle) { struct mpssas_target *target; @@ -351,22 +350,123 @@ mpssas_log_command(struct mps_command *c va_end(ap); } + static void -mpssas_lost_target(struct mps_softc *sc, struct mpssas_target *targ) +mpssas_remove_volume(struct mps_softc *sc, struct mps_command *tm) { - struct mpssas_softc *sassc = sc->sassc; - path_id_t pathid = cam_sim_path(sassc->sim); - struct cam_path *path; + MPI2_SCSI_TASK_MANAGE_REPLY *reply; + struct mpssas_target *targ; + uint16_t handle; + + mps_dprint(sc, MPS_INFO, "%s\n", __func__); + + reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply; + handle = (uint16_t)(uintptr_t)tm->cm_complete_data; + targ = tm->cm_targ; - mps_printf(sc, "%s targetid %u\n", __func__, targ->tid); - if (xpt_create_path(&path, NULL, pathid, targ->tid, 0) != CAM_REQ_CMP) { - mps_printf(sc, "unable to create path for lost target %d\n", - targ->tid); + if (reply == NULL) { + /* XXX retry the remove after the diag reset completes? */ + mps_printf(sc, "%s NULL reply reseting device 0x%04x\n", + __func__, handle); + mpssas_free_tm(sc, tm); return; } - xpt_async(AC_LOST_DEVICE, path, NULL); - xpt_free_path(path); + if (reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) { + mps_printf(sc, "IOCStatus = 0x%x while resetting device 0x%x\n", + reply->IOCStatus, handle); + mpssas_free_tm(sc, tm); + return; + } + + mps_printf(sc, "Reset aborted %u commands\n", reply->TerminationCount); + mps_free_reply(sc, tm->cm_reply_data); + tm->cm_reply = NULL; /* Ensures the the reply won't get re-freed */ + + mps_printf(sc, "clearing target %u handle 0x%04x\n", targ->tid, handle); + + /* + * Don't clear target if remove fails because things will get confusing. + * Leave the devname and sasaddr intact so that we know to avoid reusing + * this target id if possible, and so we can assign the same target id + * to this device if it comes back in the future. + */ + if (reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) { + targ = tm->cm_targ; + targ->handle = 0x0; + targ->encl_handle = 0x0; + targ->encl_slot = 0x0; + targ->exp_dev_handle = 0x0; + targ->phy_num = 0x0; + targ->linkrate = 0x0; + targ->devinfo = 0x0; + targ->flags = 0x0; + } + + mpssas_free_tm(sc, tm); +} + + +/* + * No Need to call "MPI2_SAS_OP_REMOVE_DEVICE" For Volume removal. + * Otherwise Volume Delete is same as Bare Drive Removal. + */ +void +mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle) +{ + MPI2_SCSI_TASK_MANAGE_REQUEST *req; + struct mps_softc *sc; + struct mps_command *cm; + struct mpssas_target *targ = NULL; + + mps_dprint(sassc->sc, MPS_INFO, "%s\n", __func__); + sc = sassc->sc; + +#ifdef WD_SUPPORT + /* + * If this is a WD controller, determine if the disk should be exposed + * to the OS or not. If disk should be exposed, return from this + * function without doing anything. + */ + if (sc->WD_available && (sc->WD_hide_expose == + MPS_WD_EXPOSE_ALWAYS)) { + return; + } +#endif //WD_SUPPORT + + targ = mpssas_find_target_by_handle(sassc, 0, handle); + if (targ == NULL) { + /* FIXME: what is the action? */ + /* We don't know about this device? */ + printf("%s %d : invalid handle 0x%x \n", __func__,__LINE__, handle); + return; + } + + targ->flags |= MPSSAS_TARGET_INREMOVAL; + + cm = mpssas_alloc_tm(sc); + if (cm == NULL) { + mps_printf(sc, "%s: command alloc failure\n", __func__); + return; + } + + mpssas_rescan_target(sc, targ); + + req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req; + req->DevHandle = targ->handle; + req->Function = MPI2_FUNCTION_SCSI_TASK_MGMT; + req->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET; + + /* SAS Hard Link Reset / SATA Link Reset */ + req->MsgFlags = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET; + + cm->cm_targ = targ; + cm->cm_data = NULL; + cm->cm_desc.HighPriority.RequestFlags = + MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; + cm->cm_complete = mpssas_remove_volume; + cm->cm_complete_data = (void *)(uintptr_t)handle; + mps_map_command(sc, cm); } /* @@ -386,7 +486,7 @@ mpssas_prepare_remove(struct mpssas_soft struct mps_command *cm; struct mpssas_target *targ = NULL; - mps_dprint(sassc->sc, MPS_TRACE, "%s\n", __func__); + mps_dprint(sassc->sc, MPS_INFO, "%s\n", __func__); /* * If this is a WD controller, determine if the disk should be exposed @@ -403,7 +503,7 @@ mpssas_prepare_remove(struct mpssas_soft if (targ == NULL) { /* FIXME: what is the action? */ /* We don't know about this device? */ - printf("%s: invalid handle 0x%x \n", __func__, handle); + printf("%s %d : invalid handle 0x%x \n", __func__,__LINE__, handle); return; } @@ -415,7 +515,7 @@ mpssas_prepare_remove(struct mpssas_soft return; } - mpssas_lost_target(sc, targ); + mpssas_rescan_target(sc, targ); req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req; memset(req, 0, sizeof(*req)); @@ -443,7 +543,7 @@ mpssas_remove_device(struct mps_softc *s struct mps_command *next_cm; uint16_t handle; - mps_dprint(sc, MPS_TRACE, "%s\n", __func__); + mps_dprint(sc, MPS_INFO, "%s\n", __func__); reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply; handle = (uint16_t)(uintptr_t)tm->cm_complete_data; @@ -514,7 +614,7 @@ mpssas_remove_complete(struct mps_softc uint16_t handle; struct mpssas_target *targ; - mps_dprint(sc, MPS_TRACE, "%s\n", __func__); + mps_dprint(sc, MPS_INFO, "%s\n", __func__); reply = (MPI2_SAS_IOUNIT_CONTROL_REPLY *)tm->cm_reply; handle = (uint16_t)(uintptr_t)tm->cm_complete_data; @@ -558,6 +658,7 @@ mpssas_remove_complete(struct mps_softc targ->phy_num = 0x0; targ->linkrate = 0x0; targ->devinfo = 0x0; + targ->flags = 0x0; } mpssas_free_tm(sc, tm); @@ -690,7 +791,7 @@ mps_detach_sas(struct mps_softc *sc) { struct mpssas_softc *sassc; - mps_dprint(sc, MPS_TRACE, "%s\n", __func__); + mps_dprint(sc, MPS_INFO, "%s\n", __func__); if (sc->sassc == NULL) return (0); @@ -733,6 +834,7 @@ mps_detach_sas(struct mps_softc *sc) } mps_unlock(sc); + mps_dprint(sc, MPS_INFO, "%s:%d\n", __func__,__LINE__); if (sassc->devq != NULL) cam_simq_free(sassc->devq); @@ -1475,11 +1577,11 @@ mpssas_action_scsiio(struct mpssas_softc uint16_t eedp_flags; sc = sassc->sc; - mps_dprint(sc, MPS_TRACE, "%s ccb %p\n", __func__, ccb); mtx_assert(&sc->mps_mtx, MA_OWNED); csio = &ccb->csio; targ = &sassc->targets[csio->ccb_h.target_id]; + mps_dprint(sc, MPS_TRACE, "%s ccb %p target flag %x\n", __func__, ccb, targ->flags); if (targ->handle == 0x0) { mps_dprint(sc, MPS_TRACE, "%s NULL handle for target %u\n", __func__, csio->ccb_h.target_id); @@ -1487,6 +1589,13 @@ mpssas_action_scsiio(struct mpssas_softc xpt_done(ccb); return; } + if (targ->flags & MPS_TARGET_FLAGS_RAID_COMPONENT) { + mps_dprint(sc, MPS_TRACE, "%s Raid component no SCSI IO supported %u\n", + __func__, csio->ccb_h.target_id); + csio->ccb_h.status = CAM_TID_INVALID; + xpt_done(ccb); + return; + } /* * If devinfo is 0 this will be a volume. In that case don't tell CAM * that the volume has timed out. We want volumes to be enumerated @@ -1684,6 +1793,198 @@ mpssas_action_scsiio(struct mpssas_softc } static void +mps_response_code(struct mps_softc *sc, u8 response_code) +{ + char *desc; + + switch (response_code) { + case MPI2_SCSITASKMGMT_RSP_TM_COMPLETE: + desc = "task management request completed"; + break; + case MPI2_SCSITASKMGMT_RSP_INVALID_FRAME: + desc = "invalid frame"; + break; + case MPI2_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED: + desc = "task management request not supported"; + break; + case MPI2_SCSITASKMGMT_RSP_TM_FAILED: + desc = "task management request failed"; + break; + case MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED: + desc = "task management request succeeded"; + break; + case MPI2_SCSITASKMGMT_RSP_TM_INVALID_LUN: + desc = "invalid lun"; + break; + case 0xA: + desc = "overlapped tag attempted"; + break; + case MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC: + desc = "task queued, however not sent to target"; + break; + default: + desc = "unknown"; + break; + } + mps_dprint(sc, MPS_INFO, "response_code(0x%01x): %s\n", + response_code, desc); +} +/** + * mps_sc_failed_io_info - translated non-succesfull SCSI_IO request + */ +static void +mps_sc_failed_io_info(struct mps_softc *sc, struct ccb_scsiio *csio, + Mpi2SCSIIOReply_t *mpi_reply) +{ + u32 response_info; + u8 *response_bytes; + u16 ioc_status = le16toh(mpi_reply->IOCStatus) & + MPI2_IOCSTATUS_MASK; + u8 scsi_state = mpi_reply->SCSIState; + u8 scsi_status = mpi_reply->SCSIStatus; + char *desc_ioc_state = NULL; + char *desc_scsi_status = NULL; + char *desc_scsi_state = sc->tmp_string; + u32 log_info = le32toh(mpi_reply->IOCLogInfo); + + if (log_info == 0x31170000) + return; + + switch (ioc_status) { + case MPI2_IOCSTATUS_SUCCESS: + desc_ioc_state = "success"; + break; + case MPI2_IOCSTATUS_INVALID_FUNCTION: + desc_ioc_state = "invalid function"; + break; + case MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR: + desc_ioc_state = "scsi recovered error"; + break; + case MPI2_IOCSTATUS_SCSI_INVALID_DEVHANDLE: + desc_ioc_state = "scsi invalid dev handle"; + break; + case MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE: + desc_ioc_state = "scsi device not there"; + break; + case MPI2_IOCSTATUS_SCSI_DATA_OVERRUN: + desc_ioc_state = "scsi data overrun"; + break; + case MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN: + desc_ioc_state = "scsi data underrun"; + break; + case MPI2_IOCSTATUS_SCSI_IO_DATA_ERROR: + desc_ioc_state = "scsi io data error"; + break; + case MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR: + desc_ioc_state = "scsi protocol error"; + break; + case MPI2_IOCSTATUS_SCSI_TASK_TERMINATED: + desc_ioc_state = "scsi task terminated"; + break; + case MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: + desc_ioc_state = "scsi residual mismatch"; + break; + case MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED: + desc_ioc_state = "scsi task mgmt failed"; + break; + case MPI2_IOCSTATUS_SCSI_IOC_TERMINATED: + desc_ioc_state = "scsi ioc terminated"; + break; + case MPI2_IOCSTATUS_SCSI_EXT_TERMINATED: + desc_ioc_state = "scsi ext terminated"; + break; + case MPI2_IOCSTATUS_EEDP_GUARD_ERROR: + desc_ioc_state = "eedp guard error"; + break; + case MPI2_IOCSTATUS_EEDP_REF_TAG_ERROR: + desc_ioc_state = "eedp ref tag error"; + break; + case MPI2_IOCSTATUS_EEDP_APP_TAG_ERROR: + desc_ioc_state = "eedp app tag error"; + break; + default: + desc_ioc_state = "unknown"; + break; + } + + switch (scsi_status) { + case MPI2_SCSI_STATUS_GOOD: + desc_scsi_status = "good"; + break; + case MPI2_SCSI_STATUS_CHECK_CONDITION: + desc_scsi_status = "check condition"; + break; + case MPI2_SCSI_STATUS_CONDITION_MET: + desc_scsi_status = "condition met"; + break; + case MPI2_SCSI_STATUS_BUSY: + desc_scsi_status = "busy"; + break; + case MPI2_SCSI_STATUS_INTERMEDIATE: + desc_scsi_status = "intermediate"; + break; + case MPI2_SCSI_STATUS_INTERMEDIATE_CONDMET: + desc_scsi_status = "intermediate condmet"; + break; + case MPI2_SCSI_STATUS_RESERVATION_CONFLICT: + desc_scsi_status = "reservation conflict"; + break; + case MPI2_SCSI_STATUS_COMMAND_TERMINATED: + desc_scsi_status = "command terminated"; + break; + case MPI2_SCSI_STATUS_TASK_SET_FULL: + desc_scsi_status = "task set full"; + break; + case MPI2_SCSI_STATUS_ACA_ACTIVE: + desc_scsi_status = "aca active"; + break; + case MPI2_SCSI_STATUS_TASK_ABORTED: + desc_scsi_status = "task aborted"; + break; + default: + desc_scsi_status = "unknown"; + break; + } + + desc_scsi_state[0] = '\0'; + if (!scsi_state) + desc_scsi_state = " "; + if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) + strcat(desc_scsi_state, "response info "); + if (scsi_state & MPI2_SCSI_STATE_TERMINATED) + strcat(desc_scsi_state, "state terminated "); + if (scsi_state & MPI2_SCSI_STATE_NO_SCSI_STATUS) + strcat(desc_scsi_state, "no status "); + if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_FAILED) + strcat(desc_scsi_state, "autosense failed "); + if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID) + strcat(desc_scsi_state, "autosense valid "); + + mps_dprint(sc, MPS_INFO, "\thandle(0x%04x), ioc_status(%s)(0x%04x), \n", + le16toh(mpi_reply->DevHandle), + desc_ioc_state, ioc_status); + /* We can add more detail about underflow data here + * TO-DO + * */ + mps_dprint(sc, MPS_INFO, "\tscsi_status(%s)(0x%02x), " + "scsi_state(%s)(0x%02x)\n", desc_scsi_status, + scsi_status, desc_scsi_state, scsi_state); + + if (sc->mps_debug & MPS_INFO && + scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID) { + mps_dprint(sc, MPS_INFO, "-> Sense Buffer Data : Start :\n"); + scsi_sense_print(csio); + mps_dprint(sc, MPS_INFO, "-> Sense Buffer Data : End :\n"); + } + + if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) { + response_info = le32toh(mpi_reply->ResponseInfo); + response_bytes = (u8 *)&response_info; + mps_response_code(sc,response_bytes[0]); + } +} + +static void mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm) { MPI2_SCSI_IO_REPLY *rep; @@ -2018,6 +2319,8 @@ mpssas_scsiio_complete(struct mps_softc ccb->ccb_h.status = CAM_REQ_CMP_ERR; break; } + + mps_sc_failed_io_info(sc,csio,rep); if (sassc->flags & MPSSAS_QUEUE_FROZEN) { ccb->ccb_h.status |= CAM_RELEASE_SIMQ; @@ -2799,17 +3102,26 @@ mpssas_scanner_thread(void *arg) mps_lock(sc); for (;;) { + /* Sleep for 1 second and check the queue status*/ msleep(&sassc->ccb_scanq, &sc->mps_mtx, PRIBIO, - "mps_scanq", 0); + "mps_scanq", 1 * hz); if (sassc->flags & MPSSAS_SHUTDOWN) { mps_dprint(sc, MPS_TRACE, "Scanner shutting down\n"); break; } +next_work: + // Get first work. ccb = (union ccb *)TAILQ_FIRST(&sassc->ccb_scanq); if (ccb == NULL) continue; + // Got first work. TAILQ_REMOVE(&sassc->ccb_scanq, &ccb->ccb_h, sim_links.tqe); xpt_action(ccb); + if (sassc->flags & MPSSAS_SHUTDOWN) { + mps_dprint(sc, MPS_TRACE, "Scanner shutting down\n"); + break; + } + goto next_work; } sassc->flags &= ~MPSSAS_SCANTHREAD; @@ -3009,7 +3321,7 @@ mpssas_check_eedp(struct mpssas_softc *s } if (!found_lun) { lun = malloc(sizeof(struct mpssas_lun), - M_MPT2, M_WAITOK | M_ZERO); + M_MPT2, M_NOWAIT | M_ZERO); if (lun == NULL) { mps_dprint(sc, MPS_FAULT, "Unable to alloc LUN for " @@ -3084,6 +3396,20 @@ mpssas_read_cap_done(struct cam_periph * if (done_ccb == NULL) return; + + /* Driver need to release devq, it Scsi command is + * generated by driver internally. + * Currently there is a single place where driver + * calls scsi command internally. In future if driver + * calls more scsi command internally, it needs to release + * devq internally, since those command will not go back to + * cam_periph. + */ + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) ) { + done_ccb->ccb_h.status &= ~CAM_DEV_QFRZN; + xpt_release_devq(done_ccb->ccb_h.path, + /*count*/ 1, /*run_queue*/TRUE); + } rcap_buf = (struct scsi_read_capacity_eedp *)done_ccb->csio.data_ptr; Modified: stable/9/sys/dev/mps/mps_sas.h ============================================================================== --- stable/9/sys/dev/mps/mps_sas.h Tue Feb 14 12:50:20 2012 (r231678) +++ stable/9/sys/dev/mps/mps_sas.h Tue Feb 14 14:17:46 2012 (r231679) @@ -49,8 +49,11 @@ struct mpssas_target { #define MPSSAS_TARGET_INRESET (1 << 1) #define MPSSAS_TARGET_INDIAGRESET (1 << 2) #define MPSSAS_TARGET_INREMOVAL (1 << 3) +#define MPS_TARGET_FLAGS_RAID_COMPONENT (1 << 4) +#define MPS_TARGET_FLAGS_VOLUME (1 << 5) #define MPSSAS_TARGET_INRECOVERY (MPSSAS_TARGET_INABORT | \ MPSSAS_TARGET_INRESET | MPSSAS_TARGET_INCHIPRESET) + #define MPSSAS_TARGET_ADD (1 << 29) #define MPSSAS_TARGET_REMOVE (1 << 30) uint16_t tid; Modified: stable/9/sys/dev/mps/mps_sas_lsi.c ============================================================================== --- stable/9/sys/dev/mps/mps_sas_lsi.c Tue Feb 14 12:50:20 2012 (r231678) +++ stable/9/sys/dev/mps/mps_sas_lsi.c Tue Feb 14 14:17:46 2012 (r231679) @@ -107,7 +107,7 @@ struct _ata_identify_device_data { u16 model_number[20]; /* 27-46*/ u16 reserved3[209]; /* 47-255*/ }; - +static u32 event_count; static void mpssas_fw_work(struct mps_softc *sc, struct mps_fw_event_work *fw_event); static void mpssas_fw_event_free(struct mps_softc *, @@ -119,7 +119,7 @@ static int mpssas_get_sata_identify(stru int mpssas_get_sas_address_for_sata_disk(struct mps_softc *sc, u64 *sas_address, u16 handle, u32 device_info); static int mpssas_volume_add(struct mps_softc *sc, - Mpi2EventIrConfigElement_t *element); + u16 handle); void mpssas_evt_handler(struct mps_softc *sc, uintptr_t data, @@ -191,6 +191,8 @@ mpssas_fw_work(struct mps_softc *sc, str struct mpssas_softc *sassc; sassc = sc->sassc; + mps_dprint(sc, MPS_INFO, "(%d)->(%s) Working on Event: [%x]\n", + event_count++,__func__,fw_event->event); switch (fw_event->event) { case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST: { @@ -284,7 +286,7 @@ mpssas_fw_work(struct mps_softc *sc, str case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED: case MPI2_EVENT_IR_CHANGE_RC_ADDED: if (!foreign_config) { - if (mpssas_volume_add(sc, element)) { + if (mpssas_volume_add(sc, le16toh(element->VolDevHandle))){ printf("%s: failed to add RAID " "volume with handle 0x%x\n", __func__, le16toh(element-> @@ -319,12 +321,18 @@ mpssas_fw_work(struct mps_softc *sc, str } break; case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED: + case MPI2_EVENT_IR_CHANGE_RC_HIDE: /* * Phys Disk of a volume has been created. Hide * it from the OS. */ - mpssas_prepare_remove(sassc, element-> - PhysDiskDevHandle); + targ = mpssas_find_target_by_handle(sassc, 0, element->PhysDiskDevHandle); + if (targ == NULL) + break; + + targ->flags |= MPS_TARGET_FLAGS_RAID_COMPONENT; + mpssas_rescan_target(sc, targ); + break; case MPI2_EVENT_IR_CHANGE_RC_PD_DELETED: /* @@ -379,6 +387,35 @@ mpssas_fw_work(struct mps_softc *sc, str "handle 0x%x", event_data->PreviousValue, event_data->NewValue, event_data->VolDevHandle); + u32 state; + struct mpssas_target *targ; + state = le32toh(event_data->NewValue); + switch (state) { + case MPI2_RAID_VOL_STATE_MISSING: + case MPI2_RAID_VOL_STATE_FAILED: + mpssas_prepare_volume_remove(sassc, event_data-> + VolDevHandle); + break; + + case MPI2_RAID_VOL_STATE_ONLINE: + case MPI2_RAID_VOL_STATE_DEGRADED: + case MPI2_RAID_VOL_STATE_OPTIMAL: + targ = mpssas_find_target_by_handle(sassc, 0, event_data->VolDevHandle); + if (targ) { + printf("%s %d: Volume handle 0x%x is already added \n", + __func__, __LINE__ , event_data->VolDevHandle); + break; + } + if (mpssas_volume_add(sc, le16toh(event_data->VolDevHandle))) { + printf("%s: failed to add RAID " + "volume with handle 0x%x\n", + __func__, le16toh(event_data-> + VolDevHandle)); + } + break; + default: + break; + } break; default: break; @@ -389,6 +426,7 @@ mpssas_fw_work(struct mps_softc *sc, str { Mpi2EventDataIrPhysicalDisk_t *event_data = fw_event->event_data; + struct mpssas_target *targ; /* * Informational only. @@ -399,7 +437,7 @@ mpssas_fw_work(struct mps_softc *sc, str mps_dprint(sc, MPS_INFO, " Phys Disk Settings " "changed from 0x%x to 0x%x for Phys Disk Number " "%d and handle 0x%x at Enclosure handle 0x%x, Slot " - "%d", event_data->PreviousValue, + "%d\n", event_data->PreviousValue, event_data->NewValue, event_data->PhysDiskNum, event_data->PhysDiskDevHandle, event_data->EnclosureHandle, event_data->Slot); @@ -407,7 +445,7 @@ mpssas_fw_work(struct mps_softc *sc, str case MPI2_EVENT_IR_PHYSDISK_RC_STATUS_FLAGS_CHANGED: mps_dprint(sc, MPS_INFO, " Phys Disk Status changed " "from 0x%x to 0x%x for Phys Disk Number %d and " - "handle 0x%x at Enclosure handle 0x%x, Slot %d", + "handle 0x%x at Enclosure handle 0x%x, Slot %d\n", event_data->PreviousValue, event_data->NewValue, event_data->PhysDiskNum, event_data->PhysDiskDevHandle, @@ -416,12 +454,38 @@ mpssas_fw_work(struct mps_softc *sc, str case MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED: mps_dprint(sc, MPS_INFO, " Phys Disk State changed " "from 0x%x to 0x%x for Phys Disk Number %d and " - "handle 0x%x at Enclosure handle 0x%x, Slot %d", + "handle 0x%x at Enclosure handle 0x%x, Slot %d\n", event_data->PreviousValue, event_data->NewValue, event_data->PhysDiskNum, event_data->PhysDiskDevHandle, event_data->EnclosureHandle, event_data->Slot); - break; + switch (event_data->NewValue) { + case MPI2_RAID_PD_STATE_ONLINE: + case MPI2_RAID_PD_STATE_DEGRADED: + case MPI2_RAID_PD_STATE_REBUILDING: + case MPI2_RAID_PD_STATE_OPTIMAL: + case MPI2_RAID_PD_STATE_HOT_SPARE: + targ = mpssas_find_target_by_handle(sassc, 0, + event_data->PhysDiskDevHandle); + if (targ) { + targ->flags |= MPS_TARGET_FLAGS_RAID_COMPONENT; + printf("%s %d: Found Target for handle 0x%x. \n", + __func__, __LINE__ , event_data->PhysDiskDevHandle); + } + break; + case MPI2_RAID_PD_STATE_OFFLINE: + case MPI2_RAID_PD_STATE_NOT_CONFIGURED: + case MPI2_RAID_PD_STATE_NOT_COMPATIBLE: + default: + targ = mpssas_find_target_by_handle(sassc, 0, + event_data->PhysDiskDevHandle); + if (targ) { + targ->flags |= ~MPS_TARGET_FLAGS_RAID_COMPONENT; + printf("%s %d: Found Target for handle 0x%x. \n", + __func__, __LINE__ , event_data->PhysDiskDevHandle); + } + break; + } default: break; } @@ -494,6 +558,7 @@ mpssas_fw_work(struct mps_softc *sc, str break; } + mps_dprint(sc, MPS_INFO, "(%d)->(%s) Event Free: [%x]\n",event_count,__func__, fw_event->event); mpssas_fw_event_free(sc, fw_event); } @@ -584,7 +649,7 @@ mpssas_add_device(struct mps_softc *sc, error = ENXIO; goto out; } - mps_vprintf(sc, "SAS Address from SAS device page0 = %jx\n", + mps_dprint(sc, MPS_INFO, "SAS Address from SAS device page0 = %jx\n", sas_address); targ = &sassc->targets[id]; targ->devinfo = device_info; @@ -605,12 +670,12 @@ mpssas_add_device(struct mps_softc *sc, TAILQ_INIT(&targ->timedout_commands); SLIST_INIT(&targ->luns); mps_describe_devinfo(targ->devinfo, devstring, 80); - mps_vprintf(sc, "Found device <%s> <%s> <0x%04x> <%d/%d>\n", devstring, + mps_dprint(sc, MPS_INFO, "Found device <%s> <%s> <0x%04x> <%d/%d>\n", devstring, mps_describe_table(mps_linkrate_names, targ->linkrate), targ->handle, targ->encl_handle, targ->encl_slot); if ((sassc->flags & MPSSAS_IN_STARTUP) == 0) mpssas_rescan_target(sc, targ); - mps_vprintf(sc, "Target id 0x%x added\n", targ->tid); + mps_dprint(sc, MPS_INFO, "Target id 0x%x added\n", targ->tid); out: mpssas_startup_decrement(sassc); return (error); @@ -751,12 +816,11 @@ out: } static int -mpssas_volume_add(struct mps_softc *sc, Mpi2EventIrConfigElement_t *element) +mpssas_volume_add(struct mps_softc *sc, u16 handle) { struct mpssas_softc *sassc; struct mpssas_target *targ; u64 wwid; - u16 handle = le16toh(element->VolDevHandle); unsigned int id; int error = 0; @@ -855,7 +919,9 @@ mpssas_ir_shutdown(struct mps_softc *sc) action->Function = MPI2_FUNCTION_RAID_ACTION; action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; + mps_lock(sc); mps_request_polled(sc, cm); + mps_unlock(sc); /* * Don't check for reply, just leave. Modified: stable/9/sys/dev/mps/mps_user.c ============================================================================== --- stable/9/sys/dev/mps/mps_user.c Tue Feb 14 12:50:20 2012 (r231678) +++ stable/9/sys/dev/mps/mps_user.c Tue Feb 14 14:17:46 2012 (r231679) @@ -712,7 +712,7 @@ mps_user_command(struct mps_softc *sc, s cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; mps_lock(sc); - err = mps_wait_command(sc, cm, 0); + err = mps_wait_command(sc, cm, 30); if (err) { mps_printf(sc, "%s: invalid request: error %d\n", @@ -842,7 +842,7 @@ mps_user_pass_thru(struct mps_softc *sc, cm->cm_complete = NULL; cm->cm_complete_data = NULL; - err = mps_wait_command(sc, cm, 0); + err = mps_wait_command(sc, cm, 30); if (err != 0) { err = EIO; @@ -979,7 +979,7 @@ mps_user_pass_thru(struct mps_softc *sc, mps_lock(sc); - err = mps_wait_command(sc, cm, 0); + err = mps_wait_command(sc, cm, 30); if (err) { mps_printf(sc, "%s: invalid request: error %d\n", __func__, @@ -1098,10 +1098,12 @@ mps_user_get_adapter_data(struct mps_sof * Need to get BIOS Config Page 3 for the BIOS Version. */ data->BiosVersion = 0; + mps_lock(sc); if (mps_config_get_bios_pg3(sc, &mpi_reply, &config_page)) printf("%s: Error while retrieving BIOS Version\n", __func__); else data->BiosVersion = config_page.BiosVersion; + mps_unlock(sc); } static void @@ -1194,7 +1196,7 @@ mps_post_fw_diag_buffer(struct mps_softc /* * Send command synchronously. */ - status = mps_wait_command(sc, cm, 0); + status = mps_wait_command(sc, cm, 30); if (status) { mps_printf(sc, "%s: invalid request: error %d\n", __func__, status); @@ -1278,7 +1280,7 @@ mps_release_fw_diag_buffer(struct mps_so /* * Send command synchronously. */ - status = mps_wait_command(sc, cm, 0); + status = mps_wait_command(sc, cm, 30); if (status) { mps_printf(sc, "%s: invalid request: error %d\n", __func__, status); Modified: stable/9/sys/dev/mps/mpsvar.h ============================================================================== --- stable/9/sys/dev/mps/mpsvar.h Tue Feb 14 12:50:20 2012 (r231678) +++ stable/9/sys/dev/mps/mpsvar.h Tue Feb 14 14:17:46 2012 (r231679) @@ -58,7 +58,7 @@ #ifndef _MPSVAR_H #define _MPSVAR_H -#define MPS_DRIVER_VERSION "11.255.03.00-fbsd" +#define MPS_DRIVER_VERSION "13.00.00.00-fbsd" #define MPS_DB_MAX_WAIT 2500 @@ -78,6 +78,7 @@ #define MPS_PERIODIC_DELAY 1 /* 1 second heartbeat/watchdog check */ #define MPS_SCSI_RI_INVALID_FRAME (0x00000002) +#define MPS_STRING_LENGTH 64 /* * host mapping related macro definitions @@ -309,7 +310,7 @@ struct mps_softc { struct callout periodic; struct mpssas_softc *sassc; - + char tmp_string[MPS_STRING_LENGTH]; TAILQ_HEAD(, mps_command) req_list; TAILQ_HEAD(, mps_command) high_priority_req_list; TAILQ_HEAD(, mps_chain) chain_list; @@ -521,6 +522,12 @@ mps_free_command(struct mps_softc *sc, s cm->cm_max_segs = 0; cm->cm_lun = 0; cm->cm_state = MPS_CM_STATE_FREE; + cm->cm_data = NULL; + cm->cm_length = 0; + cm->cm_out_len = 0; + cm->cm_sglsize = 0; + cm->cm_sge = NULL; + TAILQ_FOREACH_SAFE(chain, &cm->cm_chain_list, chain_link, chain_temp) { TAILQ_REMOVE(&cm->cm_chain_list, chain, chain_link); mps_free_chain(sc, chain); @@ -749,7 +756,9 @@ void mps_mapping_ir_config_change_event( void mpssas_evt_handler(struct mps_softc *sc, uintptr_t data, MPI2_EVENT_NOTIFICATION_REPLY *event); void mpssas_prepare_remove(struct mpssas_softc *sassc, uint16_t handle); +void mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle); int mpssas_startup(struct mps_softc *sc); +struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc *, int, uint16_t); SYSCTL_DECL(_hw_mps); From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 15:17:49 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D1A51065673; Tue, 14 Feb 2012 15:17:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 013A68FC1A; Tue, 14 Feb 2012 15:17:49 +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 q1EFHmjO005117; Tue, 14 Feb 2012 15:17:48 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EFHmOU005114; Tue, 14 Feb 2012 15:17:48 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201202141517.q1EFHmOU005114@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 14 Feb 2012 15:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231684 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 15:17:49 -0000 Author: bz Date: Tue Feb 14 15:17:48 2012 New Revision: 231684 URL: http://svn.freebsd.org/changeset/base/231684 Log: MFC 229547: Mark a couple of file local functions static and stop exporting them. Discussed with: rwatson Modified: stable/9/sys/netinet6/nd6.h stable/9/sys/netinet6/nd6_rtr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/nd6.h ============================================================================== --- stable/9/sys/netinet6/nd6.h Tue Feb 14 14:55:27 2012 (r231683) +++ stable/9/sys/netinet6/nd6.h Tue Feb 14 15:17:48 2012 (r231684) @@ -437,15 +437,12 @@ void nd6_dad_duplicated __P((struct ifad void nd6_rs_input __P((struct mbuf *, int, int)); void nd6_ra_input __P((struct mbuf *, int, int)); void prelist_del __P((struct nd_prefix *)); -void defrouter_addreq __P((struct nd_defrouter *)); void defrouter_reset __P((void)); void defrouter_select __P((void)); void defrtrlist_del __P((struct nd_defrouter *)); void prelist_remove __P((struct nd_prefix *)); int nd6_prelist_add __P((struct nd_prefixctl *, struct nd_defrouter *, struct nd_prefix **)); -int nd6_prefix_onlink __P((struct nd_prefix *)); -int nd6_prefix_offlink __P((struct nd_prefix *)); void pfxlist_onlink_check __P((void)); struct nd_defrouter *defrouter_lookup __P((struct in6_addr *, struct ifnet *)); struct nd_prefix *nd6_prefix_lookup __P((struct nd_prefixctl *)); Modified: stable/9/sys/netinet6/nd6_rtr.c ============================================================================== --- stable/9/sys/netinet6/nd6_rtr.c Tue Feb 14 14:55:27 2012 (r231683) +++ stable/9/sys/netinet6/nd6_rtr.c Tue Feb 14 15:17:48 2012 (r231684) @@ -84,6 +84,9 @@ static int in6_init_prefix_ltimes(struct static void in6_init_address_ltimes __P((struct nd_prefix *, struct in6_addrlifetime *)); +static int nd6_prefix_onlink(struct nd_prefix *); +static int nd6_prefix_offlink(struct nd_prefix *); + static int rt6_deleteroute(struct radix_node *, void *); VNET_DECLARE(int, nd6_recalc_reachtm_interval); @@ -465,7 +468,7 @@ nd6_rtmsg(int cmd, struct rtentry *rt) ifa_free(ifa); } -void +static void defrouter_addreq(struct nd_defrouter *new) { struct sockaddr_in6 def, mask, gate; @@ -1547,7 +1550,7 @@ pfxlist_onlink_check() } } -int +static int nd6_prefix_onlink(struct nd_prefix *pr) { struct ifaddr *ifa; @@ -1672,7 +1675,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) return (error); } -int +static int nd6_prefix_offlink(struct nd_prefix *pr) { int error = 0; From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 15:58:51 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CB9A106566C; Tue, 14 Feb 2012 15:58:51 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAC5A8FC13; Tue, 14 Feb 2012 15:58:50 +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 q1EFwoWR006657; Tue, 14 Feb 2012 15:58:50 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EFwonu006629; Tue, 14 Feb 2012 15:58:50 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201202141558.q1EFwonu006629@svn.freebsd.org> From: Jim Harris Date: Tue, 14 Feb 2012 15:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231689 - in stable/9: . share/man/man4 sys/amd64/conf sys/conf sys/dev/isci sys/dev/isci/scil sys/i386/conf sys/modules sys/modules/isci X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 15:58:51 -0000 Author: jimharris Date: Tue Feb 14 15:58:49 2012 New Revision: 231689 URL: http://svn.freebsd.org/changeset/base/231689 Log: MFC r230843, r231134, r231136, r231137, r231296 Add isci(4) driver for amd64 and i386 targets. The isci driver is for the integrated SAS controller in the Intel C600 (Patsburg) chipset. Source files in sys/dev/isci directory are FreeBSD-specific, and sys/dev/isci/scil subdirectory contains an OS-agnostic library (SCIL) published by Intel to control the SAS controller. This library is used primarily as-is in this driver, with some post-processing to better integrate into the kernel build environment. isci.4 and a README in the sys/dev/isci directory contain a few additional details. This driver is only built for amd64 and i386 targets. Sponsored by: Intel Reviewed by: scottl Approved by: scottl Added: stable/9/share/man/man4/isci.4 - copied unchanged from r230843, head/share/man/man4/isci.4 stable/9/sys/dev/isci/ - copied from r230843, head/sys/dev/isci/ stable/9/sys/modules/isci/ - copied from r230843, head/sys/modules/isci/ Modified: stable/9/MAINTAINERS (contents, props changed) stable/9/share/man/man4/Makefile stable/9/sys/amd64/conf/GENERIC stable/9/sys/amd64/conf/NOTES stable/9/sys/conf/files.amd64 stable/9/sys/conf/files.i386 stable/9/sys/conf/options.amd64 stable/9/sys/conf/options.i386 stable/9/sys/dev/isci/isci.h (contents, props changed) stable/9/sys/dev/isci/isci_io_request.c (contents, props changed) stable/9/sys/dev/isci/isci_remote_device.c (contents, props changed) stable/9/sys/dev/isci/scil/sati_abort_task_set.c (contents, props changed) stable/9/sys/dev/isci/scil/scic_sds_controller.c (contents, props changed) stable/9/sys/dev/isci/scil/scic_sds_stp_request.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_controller.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_controller_state_handlers.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_domain.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_io_request.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_remote_device.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_smp_io_request.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_smp_remote_device.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_stp_io_request.c (contents, props changed) stable/9/sys/dev/isci/scil/scif_sas_stp_task_request.c (contents, props changed) stable/9/sys/i386/conf/GENERIC stable/9/sys/i386/conf/NOTES stable/9/sys/modules/Makefile stable/9/sys/modules/isci/Makefile (contents, props changed) Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/dev/isci/README (props changed) stable/9/sys/dev/isci/environment.h (props changed) stable/9/sys/dev/isci/isci.c (props changed) stable/9/sys/dev/isci/isci_controller.c (props changed) stable/9/sys/dev/isci/isci_domain.c (props changed) stable/9/sys/dev/isci/isci_interrupt.c (props changed) stable/9/sys/dev/isci/isci_logger.c (props changed) stable/9/sys/dev/isci/isci_oem_parameters.c (props changed) stable/9/sys/dev/isci/isci_sysctl.c (props changed) stable/9/sys/dev/isci/isci_task_request.c (props changed) stable/9/sys/dev/isci/isci_timer.c (props changed) stable/9/sys/dev/isci/sci_environment.h (props changed) stable/9/sys/dev/isci/scil/intel_ata.h (props changed) stable/9/sys/dev/isci/scil/intel_pci.h (props changed) stable/9/sys/dev/isci/scil/intel_sas.h (props changed) stable/9/sys/dev/isci/scil/intel_sat.h (props changed) stable/9/sys/dev/isci/scil/intel_sata.h (props changed) stable/9/sys/dev/isci/scil/intel_scsi.h (props changed) stable/9/sys/dev/isci/scil/sati.c (props changed) stable/9/sys/dev/isci/scil/sati.h (props changed) stable/9/sys/dev/isci/scil/sati_abort_task_set.h (props changed) stable/9/sys/dev/isci/scil/sati_atapi.c (props changed) stable/9/sys/dev/isci/scil/sati_atapi.h (props changed) stable/9/sys/dev/isci/scil/sati_callbacks.h (props changed) stable/9/sys/dev/isci/scil/sati_design.h (props changed) stable/9/sys/dev/isci/scil/sati_device.c (props changed) stable/9/sys/dev/isci/scil/sati_device.h (props changed) stable/9/sys/dev/isci/scil/sati_inquiry.c (props changed) stable/9/sys/dev/isci/scil/sati_inquiry.h (props changed) stable/9/sys/dev/isci/scil/sati_log_sense.c (props changed) stable/9/sys/dev/isci/scil/sati_log_sense.h (props changed) stable/9/sys/dev/isci/scil/sati_lun_reset.c (props changed) stable/9/sys/dev/isci/scil/sati_lun_reset.h (props changed) stable/9/sys/dev/isci/scil/sati_mode_pages.c (props changed) stable/9/sys/dev/isci/scil/sati_mode_pages.h (props changed) stable/9/sys/dev/isci/scil/sati_mode_select.c (props changed) stable/9/sys/dev/isci/scil/sati_mode_select.h (props changed) stable/9/sys/dev/isci/scil/sati_mode_sense.c (props changed) stable/9/sys/dev/isci/scil/sati_mode_sense.h (props changed) stable/9/sys/dev/isci/scil/sati_mode_sense_10.c (props changed) stable/9/sys/dev/isci/scil/sati_mode_sense_10.h (props changed) stable/9/sys/dev/isci/scil/sati_mode_sense_6.c (props changed) stable/9/sys/dev/isci/scil/sati_mode_sense_6.h (props changed) stable/9/sys/dev/isci/scil/sati_move.c (props changed) stable/9/sys/dev/isci/scil/sati_move.h (props changed) stable/9/sys/dev/isci/scil/sati_passthrough.c (props changed) stable/9/sys/dev/isci/scil/sati_passthrough.h (props changed) stable/9/sys/dev/isci/scil/sati_read.c (props changed) stable/9/sys/dev/isci/scil/sati_read.h (props changed) stable/9/sys/dev/isci/scil/sati_read_buffer.c (props changed) stable/9/sys/dev/isci/scil/sati_read_buffer.h (props changed) stable/9/sys/dev/isci/scil/sati_read_capacity.c (props changed) stable/9/sys/dev/isci/scil/sati_read_capacity.h (props changed) stable/9/sys/dev/isci/scil/sati_reassign_blocks.c (props changed) stable/9/sys/dev/isci/scil/sati_reassign_blocks.h (props changed) stable/9/sys/dev/isci/scil/sati_report_luns.c (props changed) stable/9/sys/dev/isci/scil/sati_report_luns.h (props changed) stable/9/sys/dev/isci/scil/sati_request_sense.c (props changed) stable/9/sys/dev/isci/scil/sati_request_sense.h (props changed) stable/9/sys/dev/isci/scil/sati_start_stop_unit.c (props changed) stable/9/sys/dev/isci/scil/sati_start_stop_unit.h (props changed) stable/9/sys/dev/isci/scil/sati_synchronize_cache.c (props changed) stable/9/sys/dev/isci/scil/sati_synchronize_cache.h (props changed) stable/9/sys/dev/isci/scil/sati_test_unit_ready.c (props changed) stable/9/sys/dev/isci/scil/sati_test_unit_ready.h (props changed) stable/9/sys/dev/isci/scil/sati_translator_sequence.h (props changed) stable/9/sys/dev/isci/scil/sati_types.h (props changed) stable/9/sys/dev/isci/scil/sati_unmap.c (props changed) stable/9/sys/dev/isci/scil/sati_unmap.h (props changed) stable/9/sys/dev/isci/scil/sati_util.c (props changed) stable/9/sys/dev/isci/scil/sati_util.h (props changed) stable/9/sys/dev/isci/scil/sati_verify.c (props changed) stable/9/sys/dev/isci/scil/sati_verify.h (props changed) stable/9/sys/dev/isci/scil/sati_write.c (props changed) stable/9/sys/dev/isci/scil/sati_write.h (props changed) stable/9/sys/dev/isci/scil/sati_write_and_verify.c (props changed) stable/9/sys/dev/isci/scil/sati_write_and_verify.h (props changed) stable/9/sys/dev/isci/scil/sati_write_buffer.c (props changed) stable/9/sys/dev/isci/scil/sati_write_buffer.h (props changed) stable/9/sys/dev/isci/scil/sati_write_long.c (props changed) stable/9/sys/dev/isci/scil/sati_write_long.h (props changed) stable/9/sys/dev/isci/scil/sci_abstract_list.c (props changed) stable/9/sys/dev/isci/scil/sci_abstract_list.h (props changed) stable/9/sys/dev/isci/scil/sci_base_controller.c (props changed) stable/9/sys/dev/isci/scil/sci_base_controller.h (props changed) stable/9/sys/dev/isci/scil/sci_base_domain.c (props changed) stable/9/sys/dev/isci/scil/sci_base_domain.h (props changed) stable/9/sys/dev/isci/scil/sci_base_iterator.c (props changed) stable/9/sys/dev/isci/scil/sci_base_iterator.h (props changed) stable/9/sys/dev/isci/scil/sci_base_library.c (props changed) stable/9/sys/dev/isci/scil/sci_base_library.h (props changed) stable/9/sys/dev/isci/scil/sci_base_logger.c (props changed) stable/9/sys/dev/isci/scil/sci_base_logger.h (props changed) stable/9/sys/dev/isci/scil/sci_base_memory_descriptor_list.c (props changed) stable/9/sys/dev/isci/scil/sci_base_memory_descriptor_list.h (props changed) stable/9/sys/dev/isci/scil/sci_base_memory_descriptor_list_decorator.c (props changed) stable/9/sys/dev/isci/scil/sci_base_object.c (props changed) stable/9/sys/dev/isci/scil/sci_base_object.h (props changed) stable/9/sys/dev/isci/scil/sci_base_observer.c (props changed) stable/9/sys/dev/isci/scil/sci_base_observer.h (props changed) stable/9/sys/dev/isci/scil/sci_base_phy.c (props changed) stable/9/sys/dev/isci/scil/sci_base_phy.h (props changed) stable/9/sys/dev/isci/scil/sci_base_port.c (props changed) stable/9/sys/dev/isci/scil/sci_base_port.h (props changed) stable/9/sys/dev/isci/scil/sci_base_remote_device.c (props changed) stable/9/sys/dev/isci/scil/sci_base_remote_device.h (props changed) stable/9/sys/dev/isci/scil/sci_base_request.c (props changed) stable/9/sys/dev/isci/scil/sci_base_request.h (props changed) stable/9/sys/dev/isci/scil/sci_base_state.h (props changed) stable/9/sys/dev/isci/scil/sci_base_state_machine.c (props changed) stable/9/sys/dev/isci/scil/sci_base_state_machine.h (props changed) stable/9/sys/dev/isci/scil/sci_base_state_machine_logger.c (props changed) stable/9/sys/dev/isci/scil/sci_base_state_machine_logger.h (props changed) stable/9/sys/dev/isci/scil/sci_base_state_machine_observer.c (props changed) stable/9/sys/dev/isci/scil/sci_base_state_machine_observer.h (props changed) stable/9/sys/dev/isci/scil/sci_base_subject.c (props changed) stable/9/sys/dev/isci/scil/sci_base_subject.h (props changed) stable/9/sys/dev/isci/scil/sci_controller.h (props changed) stable/9/sys/dev/isci/scil/sci_controller_constants.h (props changed) stable/9/sys/dev/isci/scil/sci_fast_list.h (props changed) stable/9/sys/dev/isci/scil/sci_iterator.h (props changed) stable/9/sys/dev/isci/scil/sci_library.h (props changed) stable/9/sys/dev/isci/scil/sci_logger.h (props changed) stable/9/sys/dev/isci/scil/sci_memory_descriptor_list.h (props changed) stable/9/sys/dev/isci/scil/sci_memory_descriptor_list_decorator.h (props changed) stable/9/sys/dev/isci/scil/sci_object.h (props changed) stable/9/sys/dev/isci/scil/sci_overview.h (props changed) stable/9/sys/dev/isci/scil/sci_pool.h (props changed) stable/9/sys/dev/isci/scil/sci_simple_list.h (props changed) stable/9/sys/dev/isci/scil/sci_status.h (props changed) stable/9/sys/dev/isci/scil/sci_types.h (props changed) stable/9/sys/dev/isci/scil/sci_util.c (props changed) stable/9/sys/dev/isci/scil/sci_util.h (props changed) stable/9/sys/dev/isci/scil/scic_config_parameters.h (props changed) stable/9/sys/dev/isci/scil/scic_controller.h (props changed) stable/9/sys/dev/isci/scil/scic_io_request.h (props changed) stable/9/sys/dev/isci/scil/scic_library.h (props changed) stable/9/sys/dev/isci/scil/scic_logger.h (props changed) stable/9/sys/dev/isci/scil/scic_overview.h (props changed) stable/9/sys/dev/isci/scil/scic_phy.h (props changed) stable/9/sys/dev/isci/scil/scic_port.h (props changed) stable/9/sys/dev/isci/scil/scic_remote_device.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_controller.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_controller_registers.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_library.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_library.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_logger.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_pci.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_pci.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_phy.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_phy.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_phy_registers.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_port.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_port.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_port_configuration_agent.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_port_configuration_agent.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_port_registers.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_remote_device.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_remote_device.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_remote_node_context.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_remote_node_context.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_remote_node_table.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_remote_node_table.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_request.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_request.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_sgpio.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_smp_remote_device.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_smp_request.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_smp_request.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_ssp_request.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_stp_packet_request.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_stp_packet_request.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_stp_pio_request.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_stp_remote_device.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_stp_request.h (props changed) stable/9/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.c (props changed) stable/9/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.h (props changed) stable/9/sys/dev/isci/scil/scic_sgpio.h (props changed) stable/9/sys/dev/isci/scil/scic_task_request.h (props changed) stable/9/sys/dev/isci/scil/scic_user_callback.h (props changed) stable/9/sys/dev/isci/scil/scif_config_parameters.h (props changed) stable/9/sys/dev/isci/scil/scif_controller.h (props changed) stable/9/sys/dev/isci/scil/scif_domain.h (props changed) stable/9/sys/dev/isci/scil/scif_io_request.h (props changed) stable/9/sys/dev/isci/scil/scif_library.h (props changed) stable/9/sys/dev/isci/scil/scif_logger.h (props changed) stable/9/sys/dev/isci/scil/scif_overview.h (props changed) stable/9/sys/dev/isci/scil/scif_remote_device.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_constants.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_controller.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_controller_states.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_design.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_domain.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_domain_state_handlers.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_domain_states.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_high_priority_request_queue.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_high_priority_request_queue.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_internal_io_request.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_internal_io_request.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_io_request.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_io_request_state_handlers.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_io_request_states.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_library.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_library.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_logger.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_remote_device.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_remote_device_ready_substate_handlers.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_remote_device_starting_substate_handlers.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_remote_device_starting_substates.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_remote_device_state_handlers.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_remote_device_states.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_request.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_request.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_sati_binding.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_smp_activity_clear_affiliation.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_smp_io_request.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_smp_phy.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_smp_phy.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_smp_remote_device.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_stp_io_request.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_stp_remote_device.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_stp_remote_device.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_stp_task_request.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_task_request.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_task_request.h (props changed) stable/9/sys/dev/isci/scil/scif_sas_task_request_state_handlers.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_task_request_states.c (props changed) stable/9/sys/dev/isci/scil/scif_sas_timer.c (props changed) stable/9/sys/dev/isci/scil/scif_task_request.h (props changed) stable/9/sys/dev/isci/scil/scif_user_callback.h (props changed) stable/9/sys/dev/isci/scil/scu_bios_definitions.h (props changed) stable/9/sys/dev/isci/scil/scu_completion_codes.h (props changed) stable/9/sys/dev/isci/scil/scu_constants.h (props changed) stable/9/sys/dev/isci/scil/scu_event_codes.h (props changed) stable/9/sys/dev/isci/scil/scu_registers.h (props changed) stable/9/sys/dev/isci/scil/scu_remote_node_context.h (props changed) stable/9/sys/dev/isci/scil/scu_task_context.h (props changed) stable/9/sys/dev/isci/scil/scu_unsolicited_frame.h (props changed) stable/9/sys/dev/isci/scil/scu_viit_data.h (props changed) stable/9/sys/dev/isci/types.h (props changed) Modified: stable/9/MAINTAINERS ============================================================================== --- stable/9/MAINTAINERS Tue Feb 14 15:56:01 2012 (r231688) +++ stable/9/MAINTAINERS Tue Feb 14 15:58:49 2012 (r231689) @@ -126,6 +126,7 @@ lib/libc/stdtime edwin Heads-up apprec sysinstall randi Please contact about any major changes so that they can be co-ordinated. sbin/routed bms Pre-commit review; notify vendor at rhyolite.com +isci(4) jimharris Pre-commit review requested. Following are the entries from the Makefiles, and a few other sources. Please remove stale entries from both their origin, and this file. Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Tue Feb 14 15:56:01 2012 (r231688) +++ stable/9/share/man/man4/Makefile Tue Feb 14 15:58:49 2012 (r231689) @@ -182,6 +182,7 @@ MAN= aac.4 \ ipsec.4 \ ipw.4 \ ipwfw.4 \ + isci.4 \ iscsi_initiator.4 \ isp.4 \ ispfw.4 \ Copied: stable/9/share/man/man4/isci.4 (from r230843, head/share/man/man4/isci.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man4/isci.4 Tue Feb 14 15:58:49 2012 (r231689, copy of r230843, head/share/man/man4/isci.4) @@ -0,0 +1,110 @@ +.\" +.\" Copyright (c) 2012 Intel Corporation +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" substantially similar to the "NO WARRANTY" disclaimer below +.\" ("Disclaimer") and any redistribution must be conditioned upon +.\" including a substantially similar Disclaimer requirement for further +.\" binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGES. +.\" +.\" isci driver man page. +.\" +.\" Author: Jim Harris +.\" +.\" $FreeBSD$ +.\" +.Dd January 23, 2012 +.Dt ISCI 4 +.Os +.Sh NAME +.Nm isci +.Nd Intel C600 Serial Attached SCSI driver +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device scbus" +.Cd "device isci" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +isci_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for Intel C600 +.Tn SAS +controller. +.Sh CONFIGURATION +To force legacy interrupts for all +.Nm +driver instances, set the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.isci.force_legacy_interrupts=1 +.Ed +.Sh DEBUGGING +To enable debugging prints from the +.Nm +driver, set the +.Bd -literal -offset indent +hw.isci.debug_level +.Ed +.Pp +variable to a value between 1 and 4 in +.Xr loader.conf 5 . +.Pp +The hardware layer in the isci driver has extensive logging capabilities +which are disabled by default for performance reasons. These can be enabled +by adding +.Bd -literal -offset indent +options ISCI_LOGGING +.Ed +.Pp +to the kernel configuration file. +.Sh SEE ALSO +.Xr cd 4 , +.Xr ch 4 , +.Xr da 4 , +.Xr pci 4 , +.Xr sa 4 , +.Xr scsi 4 . +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was developed by Intel and originally written by +.An Jim Harris Aq jimharris@FreeBSD.org +with contributions from Sohaib Ahsan and input from +.An Scott Long Aq scottl@FreeBSD.org . +.Pp +This man page was written by +.An Jim Harris Aq jimharris@FreeBSD.org . Modified: stable/9/sys/amd64/conf/GENERIC ============================================================================== --- stable/9/sys/amd64/conf/GENERIC Tue Feb 14 15:56:01 2012 (r231688) +++ stable/9/sys/amd64/conf/GENERIC Tue Feb 14 15:58:49 2012 (r231689) @@ -109,6 +109,7 @@ device adv # Advansys SCSI adapters device adw # Advansys wide SCSI adapters device aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60. device bt # Buslogic/Mylex MultiMaster SCSI adapters +device isci # Intel C600 SAS controller # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) Modified: stable/9/sys/amd64/conf/NOTES ============================================================================== --- stable/9/sys/amd64/conf/NOTES Tue Feb 14 15:56:01 2012 (r231688) +++ stable/9/sys/amd64/conf/NOTES Tue Feb 14 15:58:49 2012 (r231689) @@ -409,6 +409,11 @@ device hptiop device ips # +# Intel C600 (Patsburg) integrated SAS controller +device isci +options ISCI_LOGGING # enable debugging in isci HAL + +# # SafeNet crypto driver: can be moved to the MI NOTES as soon as # it's tested on a big-endian machine # Modified: stable/9/sys/conf/files.amd64 ============================================================================== --- stable/9/sys/conf/files.amd64 Tue Feb 14 15:56:01 2012 (r231688) +++ stable/9/sys/conf/files.amd64 Tue Feb 14 15:58:49 2012 (r231689) @@ -269,6 +269,115 @@ dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_amd64.c optional uart dev/viawd/viawd.c optional viawd dev/wpi/if_wpi.c optional wpi +dev/isci/isci.c optional isci +dev/isci/isci_controller.c optional isci +dev/isci/isci_domain.c optional isci +dev/isci/isci_interrupt.c optional isci +dev/isci/isci_io_request.c optional isci +dev/isci/isci_logger.c optional isci +dev/isci/isci_oem_parameters.c optional isci +dev/isci/isci_remote_device.c optional isci +dev/isci/isci_sysctl.c optional isci +dev/isci/isci_task_request.c optional isci +dev/isci/isci_timer.c optional isci +dev/isci/scil/sati.c optional isci +dev/isci/scil/sati_abort_task_set.c optional isci +dev/isci/scil/sati_atapi.c optional isci +dev/isci/scil/sati_device.c optional isci +dev/isci/scil/sati_inquiry.c optional isci +dev/isci/scil/sati_log_sense.c optional isci +dev/isci/scil/sati_lun_reset.c optional isci +dev/isci/scil/sati_mode_pages.c optional isci +dev/isci/scil/sati_mode_select.c optional isci +dev/isci/scil/sati_mode_sense.c optional isci +dev/isci/scil/sati_mode_sense_10.c optional isci +dev/isci/scil/sati_mode_sense_6.c optional isci +dev/isci/scil/sati_move.c optional isci +dev/isci/scil/sati_passthrough.c optional isci +dev/isci/scil/sati_read.c optional isci +dev/isci/scil/sati_read_buffer.c optional isci +dev/isci/scil/sati_read_capacity.c optional isci +dev/isci/scil/sati_reassign_blocks.c optional isci +dev/isci/scil/sati_report_luns.c optional isci +dev/isci/scil/sati_request_sense.c optional isci +dev/isci/scil/sati_start_stop_unit.c optional isci +dev/isci/scil/sati_synchronize_cache.c optional isci +dev/isci/scil/sati_test_unit_ready.c optional isci +dev/isci/scil/sati_unmap.c optional isci +dev/isci/scil/sati_util.c optional isci +dev/isci/scil/sati_verify.c optional isci +dev/isci/scil/sati_write.c optional isci +dev/isci/scil/sati_write_and_verify.c optional isci +dev/isci/scil/sati_write_buffer.c optional isci +dev/isci/scil/sati_write_long.c optional isci +dev/isci/scil/sci_abstract_list.c optional isci +dev/isci/scil/sci_base_controller.c optional isci +dev/isci/scil/sci_base_domain.c optional isci +dev/isci/scil/sci_base_iterator.c optional isci +dev/isci/scil/sci_base_library.c optional isci +dev/isci/scil/sci_base_logger.c optional isci +dev/isci/scil/sci_base_memory_descriptor_list.c optional isci +dev/isci/scil/sci_base_memory_descriptor_list_decorator.c optional isci +dev/isci/scil/sci_base_object.c optional isci +dev/isci/scil/sci_base_observer.c optional isci +dev/isci/scil/sci_base_phy.c optional isci +dev/isci/scil/sci_base_port.c optional isci +dev/isci/scil/sci_base_remote_device.c optional isci +dev/isci/scil/sci_base_request.c optional isci +dev/isci/scil/sci_base_state_machine.c optional isci +dev/isci/scil/sci_base_state_machine_logger.c optional isci +dev/isci/scil/sci_base_state_machine_observer.c optional isci +dev/isci/scil/sci_base_subject.c optional isci +dev/isci/scil/sci_util.c optional isci +dev/isci/scil/scic_sds_controller.c optional isci +dev/isci/scil/scic_sds_library.c optional isci +dev/isci/scil/scic_sds_pci.c optional isci +dev/isci/scil/scic_sds_phy.c optional isci +dev/isci/scil/scic_sds_port.c optional isci +dev/isci/scil/scic_sds_port_configuration_agent.c optional isci +dev/isci/scil/scic_sds_remote_device.c optional isci +dev/isci/scil/scic_sds_remote_node_context.c optional isci +dev/isci/scil/scic_sds_remote_node_table.c optional isci +dev/isci/scil/scic_sds_request.c optional isci +dev/isci/scil/scic_sds_sgpio.c optional isci +dev/isci/scil/scic_sds_smp_remote_device.c optional isci +dev/isci/scil/scic_sds_smp_request.c optional isci +dev/isci/scil/scic_sds_ssp_request.c optional isci +dev/isci/scil/scic_sds_stp_packet_request.c optional isci +dev/isci/scil/scic_sds_stp_remote_device.c optional isci +dev/isci/scil/scic_sds_stp_request.c optional isci +dev/isci/scil/scic_sds_unsolicited_frame_control.c optional isci +dev/isci/scil/scif_sas_controller.c optional isci +dev/isci/scil/scif_sas_controller_state_handlers.c optional isci +dev/isci/scil/scif_sas_controller_states.c optional isci +dev/isci/scil/scif_sas_domain.c optional isci +dev/isci/scil/scif_sas_domain_state_handlers.c optional isci +dev/isci/scil/scif_sas_domain_states.c optional isci +dev/isci/scil/scif_sas_high_priority_request_queue.c optional isci +dev/isci/scil/scif_sas_internal_io_request.c optional isci +dev/isci/scil/scif_sas_io_request.c optional isci +dev/isci/scil/scif_sas_io_request_state_handlers.c optional isci +dev/isci/scil/scif_sas_io_request_states.c optional isci +dev/isci/scil/scif_sas_library.c optional isci +dev/isci/scil/scif_sas_remote_device.c optional isci +dev/isci/scil/scif_sas_remote_device_ready_substate_handlers.c optional isci +dev/isci/scil/scif_sas_remote_device_ready_substates.c optional isci +dev/isci/scil/scif_sas_remote_device_starting_substate_handlers.c optional isci +dev/isci/scil/scif_sas_remote_device_starting_substates.c optional isci +dev/isci/scil/scif_sas_remote_device_state_handlers.c optional isci +dev/isci/scil/scif_sas_remote_device_states.c optional isci +dev/isci/scil/scif_sas_request.c optional isci +dev/isci/scil/scif_sas_smp_activity_clear_affiliation.c optional isci +dev/isci/scil/scif_sas_smp_io_request.c optional isci +dev/isci/scil/scif_sas_smp_phy.c optional isci +dev/isci/scil/scif_sas_smp_remote_device.c optional isci +dev/isci/scil/scif_sas_stp_io_request.c optional isci +dev/isci/scil/scif_sas_stp_remote_device.c optional isci +dev/isci/scil/scif_sas_stp_task_request.c optional isci +dev/isci/scil/scif_sas_task_request.c optional isci +dev/isci/scil/scif_sas_task_request_state_handlers.c optional isci +dev/isci/scil/scif_sas_task_request_states.c optional isci +dev/isci/scil/scif_sas_timer.c optional isci isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/kern_clocksource.c standard Modified: stable/9/sys/conf/files.i386 ============================================================================== --- stable/9/sys/conf/files.i386 Tue Feb 14 15:56:01 2012 (r231688) +++ stable/9/sys/conf/files.i386 Tue Feb 14 15:58:49 2012 (r231689) @@ -248,6 +248,115 @@ dev/viawd/viawd.c optional viawd dev/acpica/acpi_if.m standard dev/acpi_support/acpi_wmi_if.m standard dev/wpi/if_wpi.c optional wpi +dev/isci/isci.c optional isci +dev/isci/isci_controller.c optional isci +dev/isci/isci_domain.c optional isci +dev/isci/isci_interrupt.c optional isci +dev/isci/isci_io_request.c optional isci +dev/isci/isci_logger.c optional isci +dev/isci/isci_oem_parameters.c optional isci +dev/isci/isci_remote_device.c optional isci +dev/isci/isci_sysctl.c optional isci +dev/isci/isci_task_request.c optional isci +dev/isci/isci_timer.c optional isci +dev/isci/scil/sati.c optional isci +dev/isci/scil/sati_abort_task_set.c optional isci +dev/isci/scil/sati_atapi.c optional isci +dev/isci/scil/sati_device.c optional isci +dev/isci/scil/sati_inquiry.c optional isci +dev/isci/scil/sati_log_sense.c optional isci +dev/isci/scil/sati_lun_reset.c optional isci +dev/isci/scil/sati_mode_pages.c optional isci +dev/isci/scil/sati_mode_select.c optional isci +dev/isci/scil/sati_mode_sense.c optional isci +dev/isci/scil/sati_mode_sense_10.c optional isci +dev/isci/scil/sati_mode_sense_6.c optional isci +dev/isci/scil/sati_move.c optional isci +dev/isci/scil/sati_passthrough.c optional isci +dev/isci/scil/sati_read.c optional isci +dev/isci/scil/sati_read_buffer.c optional isci +dev/isci/scil/sati_read_capacity.c optional isci +dev/isci/scil/sati_reassign_blocks.c optional isci +dev/isci/scil/sati_report_luns.c optional isci +dev/isci/scil/sati_request_sense.c optional isci +dev/isci/scil/sati_start_stop_unit.c optional isci +dev/isci/scil/sati_synchronize_cache.c optional isci +dev/isci/scil/sati_test_unit_ready.c optional isci +dev/isci/scil/sati_unmap.c optional isci +dev/isci/scil/sati_util.c optional isci +dev/isci/scil/sati_verify.c optional isci +dev/isci/scil/sati_write.c optional isci +dev/isci/scil/sati_write_and_verify.c optional isci +dev/isci/scil/sati_write_buffer.c optional isci +dev/isci/scil/sati_write_long.c optional isci +dev/isci/scil/sci_abstract_list.c optional isci +dev/isci/scil/sci_base_controller.c optional isci +dev/isci/scil/sci_base_domain.c optional isci +dev/isci/scil/sci_base_iterator.c optional isci +dev/isci/scil/sci_base_library.c optional isci +dev/isci/scil/sci_base_logger.c optional isci +dev/isci/scil/sci_base_memory_descriptor_list.c optional isci +dev/isci/scil/sci_base_memory_descriptor_list_decorator.c optional isci +dev/isci/scil/sci_base_object.c optional isci +dev/isci/scil/sci_base_observer.c optional isci +dev/isci/scil/sci_base_phy.c optional isci +dev/isci/scil/sci_base_port.c optional isci +dev/isci/scil/sci_base_remote_device.c optional isci +dev/isci/scil/sci_base_request.c optional isci +dev/isci/scil/sci_base_state_machine.c optional isci +dev/isci/scil/sci_base_state_machine_logger.c optional isci +dev/isci/scil/sci_base_state_machine_observer.c optional isci +dev/isci/scil/sci_base_subject.c optional isci +dev/isci/scil/sci_util.c optional isci +dev/isci/scil/scic_sds_controller.c optional isci +dev/isci/scil/scic_sds_library.c optional isci +dev/isci/scil/scic_sds_pci.c optional isci +dev/isci/scil/scic_sds_phy.c optional isci +dev/isci/scil/scic_sds_port.c optional isci +dev/isci/scil/scic_sds_port_configuration_agent.c optional isci +dev/isci/scil/scic_sds_remote_device.c optional isci +dev/isci/scil/scic_sds_remote_node_context.c optional isci +dev/isci/scil/scic_sds_remote_node_table.c optional isci +dev/isci/scil/scic_sds_request.c optional isci +dev/isci/scil/scic_sds_sgpio.c optional isci +dev/isci/scil/scic_sds_smp_remote_device.c optional isci +dev/isci/scil/scic_sds_smp_request.c optional isci +dev/isci/scil/scic_sds_ssp_request.c optional isci +dev/isci/scil/scic_sds_stp_packet_request.c optional isci +dev/isci/scil/scic_sds_stp_remote_device.c optional isci +dev/isci/scil/scic_sds_stp_request.c optional isci +dev/isci/scil/scic_sds_unsolicited_frame_control.c optional isci +dev/isci/scil/scif_sas_controller.c optional isci +dev/isci/scil/scif_sas_controller_state_handlers.c optional isci +dev/isci/scil/scif_sas_controller_states.c optional isci +dev/isci/scil/scif_sas_domain.c optional isci +dev/isci/scil/scif_sas_domain_state_handlers.c optional isci +dev/isci/scil/scif_sas_domain_states.c optional isci +dev/isci/scil/scif_sas_high_priority_request_queue.c optional isci +dev/isci/scil/scif_sas_internal_io_request.c optional isci +dev/isci/scil/scif_sas_io_request.c optional isci +dev/isci/scil/scif_sas_io_request_state_handlers.c optional isci +dev/isci/scil/scif_sas_io_request_states.c optional isci +dev/isci/scil/scif_sas_library.c optional isci +dev/isci/scil/scif_sas_remote_device.c optional isci +dev/isci/scil/scif_sas_remote_device_ready_substate_handlers.c optional isci +dev/isci/scil/scif_sas_remote_device_ready_substates.c optional isci +dev/isci/scil/scif_sas_remote_device_starting_substate_handlers.c optional isci +dev/isci/scil/scif_sas_remote_device_starting_substates.c optional isci +dev/isci/scil/scif_sas_remote_device_state_handlers.c optional isci +dev/isci/scil/scif_sas_remote_device_states.c optional isci +dev/isci/scil/scif_sas_request.c optional isci +dev/isci/scil/scif_sas_smp_activity_clear_affiliation.c optional isci +dev/isci/scil/scif_sas_smp_io_request.c optional isci +dev/isci/scil/scif_sas_smp_phy.c optional isci +dev/isci/scil/scif_sas_smp_remote_device.c optional isci +dev/isci/scil/scif_sas_stp_io_request.c optional isci +dev/isci/scil/scif_sas_stp_remote_device.c optional isci +dev/isci/scil/scif_sas_stp_task_request.c optional isci +dev/isci/scil/scif_sas_task_request.c optional isci +dev/isci/scil/scif_sas_task_request_state_handlers.c optional isci +dev/isci/scil/scif_sas_task_request_states.c optional isci +dev/isci/scil/scif_sas_timer.c optional isci i386/acpica/acpi_machdep.c optional acpi acpi_wakecode.o optional acpi \ dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \ Modified: stable/9/sys/conf/options.amd64 ============================================================================== --- stable/9/sys/conf/options.amd64 Tue Feb 14 15:56:01 2012 (r231688) +++ stable/9/sys/conf/options.amd64 Tue Feb 14 15:58:49 2012 (r231689) @@ -65,3 +65,6 @@ KDTRACE_FRAME opt_kdtrace.h BPF_JITTER opt_bpf.h XENHVM opt_global.h + +# options for the Intel C600 SAS driver (isci) +ISCI_LOGGING opt_isci.h Modified: stable/9/sys/conf/options.i386 ============================================================================== --- stable/9/sys/conf/options.i386 Tue Feb 14 15:56:01 2012 (r231688) +++ stable/9/sys/conf/options.i386 Tue Feb 14 15:58:49 2012 (r231689) @@ -119,3 +119,6 @@ BPF_JITTER opt_bpf.h NATIVE opt_global.h XEN opt_global.h XENHVM opt_global.h + +# options for the Intel C600 SAS driver (isci) +ISCI_LOGGING opt_isci.h Modified: stable/9/sys/dev/isci/isci.h ============================================================================== --- head/sys/dev/isci/isci.h Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/isci.h Tue Feb 14 15:58:49 2012 (r231689) @@ -160,7 +160,6 @@ struct ISCI_REQUEST struct ISCI_IO_REQUEST { struct ISCI_REQUEST parent; - SCI_STATUS status; SCI_IO_REQUEST_HANDLE_T sci_object; union ccb *ccb; uint32_t num_segments; Modified: stable/9/sys/dev/isci/isci_io_request.c ============================================================================== --- head/sys/dev/isci/isci_io_request.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/isci_io_request.c Tue Feb 14 15:58:49 2012 (r231689) @@ -626,16 +626,16 @@ isci_io_request_construct(void *arg, bus return; } - io_request->status = scif_io_request_construct( + status = scif_io_request_construct( io_request->parent.controller_handle, io_request->parent.remote_device_handle, SCI_CONTROLLER_INVALID_IO_TAG, (void *)io_request, (void *)((char*)io_request + sizeof(struct ISCI_IO_REQUEST)), &io_request->sci_object); - if (io_request->status != SCI_SUCCESS) { + if (status != SCI_SUCCESS) { isci_io_request_complete(io_request->parent.controller_handle, - device, io_request, io_request->status); + device, io_request, (SCI_IO_STATUS)status); return; } @@ -650,7 +650,7 @@ isci_io_request_construct(void *arg, bus if (status != SCI_SUCCESS) { isci_io_request_complete(io_request->parent.controller_handle, - device, io_request, status); + device, io_request, (SCI_IO_STATUS)status); return; } @@ -900,7 +900,7 @@ isci_io_request_execute_smp_io(union ccb if (status != SCI_SUCCESS) { isci_io_request_complete(controller->scif_controller_handle, - smp_device_handle, io_request, status); + smp_device_handle, io_request, (SCI_IO_STATUS)status); return; } @@ -912,7 +912,7 @@ isci_io_request_execute_smp_io(union ccb if (status != SCI_SUCCESS) { isci_io_request_complete(controller->scif_controller_handle, - smp_device_handle, io_request, status); + smp_device_handle, io_request, (SCI_IO_STATUS)status); return; } Modified: stable/9/sys/dev/isci/isci_remote_device.c ============================================================================== --- head/sys/dev/isci/isci_remote_device.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/isci_remote_device.c Tue Feb 14 15:58:49 2012 (r231689) @@ -195,7 +195,7 @@ isci_remote_device_reset(struct ISCI_REM if (status != SCI_SUCCESS) { isci_task_request_complete(controller->scif_controller_handle, remote_device->sci_object, task_request->sci_object, - status); + (SCI_TASK_STATUS)status); return; } @@ -207,7 +207,7 @@ isci_remote_device_reset(struct ISCI_REM isci_task_request_complete( controller->scif_controller_handle, remote_device->sci_object, task_request->sci_object, - status); + (SCI_TASK_STATUS)status); return; } } Modified: stable/9/sys/dev/isci/scil/sati_abort_task_set.c ============================================================================== --- head/sys/dev/isci/scil/sati_abort_task_set.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/sati_abort_task_set.c Tue Feb 14 15:58:49 2012 (r231689) @@ -124,8 +124,8 @@ SATI_STATUS sati_abort_task_set_translat for (tag_index = 0; tag_index < 32; tag_index++) { - void * matching_command; - SCI_STATUS completion_status; + void * matching_command; + SCI_IO_STATUS completion_status; sati_cb_device_get_request_by_ncq_tag( scsi_task, tag_index, @@ -141,7 +141,7 @@ SATI_STATUS sati_abort_task_set_translat ) { sati_translate_error(sequence, matching_command, log->error); - completion_status = SCI_FAILURE_IO_RESPONSE_VALID; + completion_status = SCI_IO_FAILURE_RESPONSE_VALID; if(sequence->state == SATI_SEQUENCE_STATE_READ_ERROR) { @@ -159,7 +159,7 @@ SATI_STATUS sati_abort_task_set_translat } else { - completion_status = SCI_FAILURE_IO_TERMINATED; + completion_status = SCI_IO_FAILURE_TERMINATED; } sati_cb_io_request_complete(matching_command, completion_status); Modified: stable/9/sys/dev/isci/scil/scic_sds_controller.c ============================================================================== --- head/sys/dev/isci/scil/scic_sds_controller.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scic_sds_controller.c Tue Feb 14 15:58:49 2012 (r231689) @@ -4165,7 +4165,7 @@ SCI_IO_STATUS scic_controller_start_io( U16 io_tag ) { - SCI_IO_STATUS status; + SCI_STATUS status; SCIC_SDS_CONTROLLER_T *this_controller; this_controller = (SCIC_SDS_CONTROLLER_T *)controller; @@ -4183,7 +4183,7 @@ SCI_IO_STATUS scic_controller_start_io( io_tag ); - return status; + return (SCI_IO_STATUS)status; } // --------------------------------------------------------------------------- @@ -4253,7 +4253,7 @@ SCI_TASK_STATUS scic_controller_start_ta U16 task_tag ) { - SCI_TASK_STATUS status = SCI_FAILURE_INVALID_STATE; + SCI_STATUS status = SCI_FAILURE_INVALID_STATE; SCIC_SDS_CONTROLLER_T *this_controller; this_controller = (SCIC_SDS_CONTROLLER_T *)controller; @@ -4282,7 +4282,7 @@ SCI_TASK_STATUS scic_controller_start_ta )); } - return status; + return (SCI_TASK_STATUS)status; } // --------------------------------------------------------------------------- Modified: stable/9/sys/dev/isci/scil/scic_sds_stp_request.c ============================================================================== --- head/sys/dev/isci/scil/scic_sds_stp_request.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scic_sds_stp_request.c Tue Feb 14 15:58:49 2012 (r231689) @@ -1124,9 +1124,6 @@ SCI_STATUS scic_sds_stp_request_pio_data if (status == SCI_SUCCESS) { this_sds_stp_request->type.pio.pio_transfer_bytes -= remaining_bytes_in_current_sgl; - - //update the current sgl, sgl_offset and save for future - current_sgl = scic_sds_stp_request_pio_get_next_sgl(this_sds_stp_request); sgl_offset = 0; } } Modified: stable/9/sys/dev/isci/scil/scif_sas_controller.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_controller.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_controller.c Tue Feb 14 15:58:49 2012 (r231689) @@ -87,6 +87,10 @@ SCI_STATUS scif_controller_construct( SCIF_SAS_LIBRARY_T * fw_library = (SCIF_SAS_LIBRARY_T*) library; SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller; + // Validate the user supplied parameters. + if ((library == SCI_INVALID_HANDLE) || (controller == SCI_INVALID_HANDLE)) + return SCI_FAILURE_INVALID_PARAMETER_VALUE; + SCIF_LOG_TRACE(( sci_base_object_get_logger(library), SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION, @@ -94,10 +98,6 @@ SCI_STATUS scif_controller_construct( library, controller )); - // Validate the user supplied parameters. - if ((library == SCI_INVALID_HANDLE) || (controller == SCI_INVALID_HANDLE)) - return SCI_FAILURE_INVALID_PARAMETER_VALUE; - // Construct the base controller. As part of constructing the base // controller we ask it to also manage the MDL iteration for the Core. sci_base_controller_construct( @@ -144,6 +144,10 @@ SCI_STATUS scif_controller_initialize( { SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller; + // Validate the user supplied parameters. + if (controller == SCI_INVALID_HANDLE) + return SCI_FAILURE_INVALID_PARAMETER_VALUE; + SCIF_LOG_TRACE(( sci_base_object_get_logger(controller), SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION, @@ -151,10 +155,6 @@ SCI_STATUS scif_controller_initialize( controller )); - // Validate the user supplied parameters. - if (controller == SCI_INVALID_HANDLE) - return SCI_FAILURE_INVALID_PARAMETER_VALUE; - return fw_controller->state_handlers->initialize_handler( &fw_controller->parent ); @@ -187,6 +187,10 @@ SCI_STATUS scif_controller_start( { SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller; + // Validate the user supplied parameters. + if (controller == SCI_INVALID_HANDLE) + return SCI_FAILURE_INVALID_PARAMETER_VALUE; + SCIF_LOG_TRACE(( sci_base_object_get_logger(controller), SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_INITIALIZATION, @@ -194,10 +198,6 @@ SCI_STATUS scif_controller_start( controller, timeout )); - // Validate the user supplied parameters. - if (controller == SCI_INVALID_HANDLE) - return SCI_FAILURE_INVALID_PARAMETER_VALUE; - return fw_controller->state_handlers-> start_handler(&fw_controller->parent, timeout); } @@ -211,6 +211,10 @@ SCI_STATUS scif_controller_stop( { SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller; + // Validate the user supplied parameters. + if (controller == SCI_INVALID_HANDLE) + return SCI_FAILURE_INVALID_PARAMETER_VALUE; + SCIF_LOG_TRACE(( sci_base_object_get_logger(controller), SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_SHUTDOWN, @@ -218,10 +222,6 @@ SCI_STATUS scif_controller_stop( controller, timeout )); - // Validate the user supplied parameters. - if (controller == SCI_INVALID_HANDLE) - return SCI_FAILURE_INVALID_PARAMETER_VALUE; - return fw_controller->state_handlers-> stop_handler(&fw_controller->parent, timeout); @@ -235,6 +235,10 @@ SCI_STATUS scif_controller_reset( { SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller; + // Validate the user supplied parameters. + if (controller == SCI_INVALID_HANDLE) + return SCI_FAILURE_INVALID_PARAMETER_VALUE; + SCIF_LOG_TRACE(( sci_base_object_get_logger(controller), SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_CONTROLLER_RESET, @@ -242,10 +246,6 @@ SCI_STATUS scif_controller_reset( controller )); - // Validate the user supplied parameters. - if (controller == SCI_INVALID_HANDLE) - return SCI_FAILURE_INVALID_PARAMETER_VALUE; - return fw_controller->state_handlers-> reset_handler(&fw_controller->parent); } @@ -271,6 +271,7 @@ SCI_IO_STATUS scif_controller_start_io( ) { SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller; + SCI_STATUS status; SCIF_LOG_TRACE(( sci_base_object_get_logger(controller), @@ -284,7 +285,7 @@ SCI_IO_STATUS scif_controller_start_io( || scif_sas_controller_sufficient_resource(controller) ) { - return fw_controller->state_handlers->start_io_handler( + status = fw_controller->state_handlers->start_io_handler( (SCI_BASE_CONTROLLER_T*) controller, (SCI_BASE_REMOTE_DEVICE_T*) remote_device, (SCI_BASE_REQUEST_T*) io_request, @@ -292,7 +293,9 @@ SCI_IO_STATUS scif_controller_start_io( ); } else - return SCI_FAILURE_INSUFFICIENT_RESOURCES; + status = SCI_FAILURE_INSUFFICIENT_RESOURCES; + + return (SCI_IO_STATUS)status; } // --------------------------------------------------------------------------- @@ -305,25 +308,26 @@ SCI_TASK_STATUS scif_controller_start_ta ) { SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller; - - SCIF_LOG_TRACE(( - sci_base_object_get_logger(controller), - SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT, - "scif_controller_start_task(0x%x, 0x%x, 0x%x, 0x%x) enter\n", - controller, remote_device, task_request, io_tag - )); + SCI_STATUS status; // Validate the user supplied parameters. if ( (controller == SCI_INVALID_HANDLE) || (remote_device == SCI_INVALID_HANDLE) || (task_request == SCI_INVALID_HANDLE) ) { - return SCI_FAILURE_INVALID_PARAMETER_VALUE; + return SCI_TASK_FAILURE_INVALID_PARAMETER_VALUE; } + SCIF_LOG_TRACE(( + sci_base_object_get_logger(controller), + SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT, + "scif_controller_start_task(0x%x, 0x%x, 0x%x, 0x%x) enter\n", + controller, remote_device, task_request, io_tag + )); + if (scif_sas_controller_sufficient_resource(controller)) { - return fw_controller->state_handlers->start_task_handler( + status = fw_controller->state_handlers->start_task_handler( (SCI_BASE_CONTROLLER_T*) controller, (SCI_BASE_REMOTE_DEVICE_T*) remote_device, (SCI_BASE_REQUEST_T*) task_request, @@ -331,7 +335,9 @@ SCI_TASK_STATUS scif_controller_start_ta ); } else - return SCI_FAILURE_INSUFFICIENT_RESOURCES; + status = SCI_FAILURE_INSUFFICIENT_RESOURCES; + + return (SCI_TASK_STATUS)status; } // --------------------------------------------------------------------------- @@ -368,13 +374,6 @@ SCI_STATUS scif_controller_complete_task { SCIF_SAS_CONTROLLER_T * fw_controller = (SCIF_SAS_CONTROLLER_T*) controller; - SCIF_LOG_TRACE(( - sci_base_object_get_logger(controller), - SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT, - "scif_controller_complete_task(0x%x, 0x%x, 0x%x) enter\n", - controller, remote_device, task_request - )); - // Validate the user supplied parameters. if ( (controller == SCI_INVALID_HANDLE) || (remote_device == SCI_INVALID_HANDLE) @@ -383,6 +382,13 @@ SCI_STATUS scif_controller_complete_task return SCI_FAILURE_INVALID_PARAMETER_VALUE; } + SCIF_LOG_TRACE(( + sci_base_object_get_logger(controller), + SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_TASK_MANAGEMENT, + "scif_controller_complete_task(0x%x, 0x%x, 0x%x) enter\n", + controller, remote_device, task_request + )); + return fw_controller->state_handlers->complete_task_handler( (SCI_BASE_CONTROLLER_T*) controller, (SCI_BASE_REMOTE_DEVICE_T*) remote_device, Modified: stable/9/sys/dev/isci/scil/scif_sas_controller_state_handlers.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_controller_state_handlers.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_controller_state_handlers.c Tue Feb 14 15:58:49 2012 (r231689) @@ -586,7 +586,7 @@ SCI_STATUS scif_sas_controller_ready_sta if (status == SCI_SUCCESS) { // Ask the core to start processing for this IO request. - status = scic_controller_start_io( + status = (SCI_STATUS)scic_controller_start_io( fw_controller->core_object, fw_device->core_object, fw_io->parent.core_object, @@ -903,7 +903,7 @@ SCI_STATUS scif_sas_controller_ready_sta } // Ask the core to start processing for this task request. - status = scic_controller_start_task( + status = (SCI_STATUS)scic_controller_start_task( fw_controller->core_object, fw_device->core_object, fw_task->parent.core_object, @@ -1072,7 +1072,7 @@ SCI_STATUS scif_sas_controller_common_st if (status == SCI_SUCCESS) { // Ask the core to start processing for this IO request. - status = scic_controller_start_io( + status = (SCI_STATUS)scic_controller_start_io( fw_controller->core_object, fw_device->core_object, fw_io->parent.core_object, @@ -1683,7 +1683,7 @@ SCI_STATUS scif_sas_controller_failed_st &((SCIF_SAS_CONTROLLER_T *)controller)->parent.state_machine) )); - return SCI_IO_FAILURE; + return SCI_FAILURE; } #define scif_sas_controller_stopping_complete_io_handler \ Modified: stable/9/sys/dev/isci/scil/scif_sas_domain.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_domain.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_domain.c Tue Feb 14 15:58:49 2012 (r231689) @@ -142,8 +142,8 @@ SCI_PORT_HANDLE_T scif_domain_get_scic_p { SCIF_SAS_DOMAIN_T * fw_domain = (SCIF_SAS_DOMAIN_T*) domain; - if ( (fw_domain != NULL) && (fw_domain->core_object != SCI_INVALID_HANDLE) ) - return fw_domain->core_object; + if ( (fw_domain == NULL) || (fw_domain->core_object == SCI_INVALID_HANDLE) ) + return SCI_INVALID_HANDLE; SCIF_LOG_WARNING(( sci_base_object_get_logger(fw_domain), @@ -152,7 +152,7 @@ SCI_PORT_HANDLE_T scif_domain_get_scic_p fw_domain )); - return SCI_INVALID_HANDLE; + return fw_domain->core_object; } // --------------------------------------------------------------------------- Modified: stable/9/sys/dev/isci/scil/scif_sas_io_request.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_io_request.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_io_request.c Tue Feb 14 15:58:49 2012 (r231689) @@ -811,7 +811,7 @@ SCI_STATUS scif_sas_io_request_continue( ); //start the new constructed IO. - return scif_controller_start_io( + return (SCI_STATUS)scif_controller_start_io( (SCI_CONTROLLER_HANDLE_T) fw_controller, (SCI_REMOTE_DEVICE_HANDLE_T) fw_device, (SCI_IO_REQUEST_HANDLE_T) fw_request, Modified: stable/9/sys/dev/isci/scil/scif_sas_remote_device.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_remote_device.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_remote_device.c Tue Feb 14 15:58:49 2012 (r231689) @@ -362,8 +362,8 @@ SCI_REMOTE_DEVICE_HANDLE_T scif_remote_d SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T*) scif_remote_device; - if ( (fw_device != NULL) && (fw_device->core_object != SCI_INVALID_HANDLE) ) - return fw_device->core_object; + if ( (fw_device == NULL) || (fw_device->core_object == SCI_INVALID_HANDLE) ) + return SCI_INVALID_HANDLE; SCIF_LOG_WARNING(( sci_base_object_get_logger(fw_device), @@ -372,7 +372,7 @@ SCI_REMOTE_DEVICE_HANDLE_T scif_remote_d fw_device )); - return SCI_INVALID_HANDLE; + return fw_device->core_object; } // --------------------------------------------------------------------------- Modified: stable/9/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c Tue Feb 14 15:58:49 2012 (r231689) @@ -255,7 +255,7 @@ void scif_sas_remote_device_ready_ncq_er } } - status = scif_controller_start_task( + scif_controller_start_task( fw_controller, fw_device, fw_request, Modified: stable/9/sys/dev/isci/scil/scif_sas_smp_io_request.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_smp_io_request.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_smp_io_request.c Tue Feb 14 15:58:49 2012 (r231689) @@ -580,7 +580,7 @@ SCI_STATUS scif_sas_smp_external_request default: //unsupported case, TBD - break; + return SCI_FAILURE; } //end of switch //set the retry count to new built smp request. Modified: stable/9/sys/dev/isci/scil/scif_sas_smp_remote_device.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_smp_remote_device.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_smp_remote_device.c Tue Feb 14 15:58:49 2012 (r231689) @@ -748,7 +748,6 @@ SCI_STATUS scif_sas_smp_remote_device_de { SCIF_SAS_DOMAIN_T * fw_domain; SCI_SAS_ADDRESS_T attached_device_address; - SCIF_SAS_REMOTE_DEVICE_T * attached_remote_device; SMP_RESPONSE_DISCOVER_T * discover_response = &smp_response->response.discover; @@ -782,13 +781,11 @@ SCI_STATUS scif_sas_smp_remote_device_de fw_domain = fw_device->domain; attached_device_address = discover_response->attached_sas_address; - attached_remote_device = (SCIF_SAS_REMOTE_DEVICE_T *) - scif_domain_get_device_by_sas_address( - fw_domain, &attached_device_address - ); - // the device should have already existed in the domian. - ASSERT (attached_remote_device != SCI_INVALID_HANDLE); + ASSERT(scif_domain_get_device_by_sas_address( + fw_domain, + &attached_device_address + ) != SCI_INVALID_HANDLE); return SCI_SUCCESS; } else @@ -1774,6 +1771,8 @@ SCIF_SAS_SMP_PHY_T * scif_sas_smp_remote SCI_FAST_LIST_ELEMENT_T * element = smp_remote_device->smp_phy_list.list_head; SCIF_SAS_SMP_PHY_T * curr_smp_phy = NULL; + ASSERT(phy_identifier < smp_remote_device->smp_phy_list.number_of_phys); + while (element != NULL) { curr_smp_phy = (SCIF_SAS_SMP_PHY_T*) sci_fast_list_get_object(element); @@ -1854,7 +1853,7 @@ void scif_sas_smp_remote_device_terminat )); scif_sas_smp_remote_device_decode_smp_response( - fw_device, fw_request, NULL, SCI_FAILURE_RETRY_REQUIRED + fw_device, fw_request, NULL, SCI_IO_FAILURE_RETRY_REQUIRED ); } @@ -1934,11 +1933,8 @@ SCI_STATUS scif_sas_smp_remote_device_sa scif_domain_get_device_by_sas_address( fw_device->domain, &discover_response->attached_sas_address); - if (smp_phy != NULL) - { - scif_sas_smp_phy_save_information( - smp_phy, attached_device, discover_response); - } + scif_sas_smp_phy_save_information( + smp_phy, attached_device, discover_response); //handle the special case of smp phys between expanders. if ( discover_response->protocols.u.bits.attached_smp_target ) @@ -2372,11 +2368,7 @@ void scif_sas_smp_remote_device_clean_ro SCIF_SAS_REMOTE_DEVICE_T * fw_device ) { - SCIF_SAS_SMP_PHY_T * smp_phy_being_config = - scif_sas_smp_remote_device_find_smp_phy_by_id( - fw_device->protocol_device.smp_device.current_activity_phy_index, - &(fw_device->protocol_device.smp_device) - ); + SCIF_SAS_SMP_PHY_T * smp_phy_being_config; SCIF_LOG_TRACE(( sci_base_object_get_logger(fw_device), Modified: stable/9/sys/dev/isci/scil/scif_sas_stp_io_request.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_stp_io_request.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_stp_io_request.c Tue Feb 14 15:58:49 2012 (r231689) @@ -396,7 +396,7 @@ SCI_STATUS scif_sas_stp_io_request_const fw_io->parent.protocol_complete_handler = scif_sas_stp_core_cb_io_request_complete_handler; // Done with translation - sci_status = SATI_SUCCESS; + sci_status = SCI_SUCCESS; } else if (sati_status == SATI_COMPLETE) sci_status = SCI_SUCCESS_IO_COMPLETE_BEFORE_START; Modified: stable/9/sys/dev/isci/scil/scif_sas_stp_task_request.c ============================================================================== --- head/sys/dev/isci/scil/scif_sas_stp_task_request.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/9/sys/dev/isci/scil/scif_sas_stp_task_request.c Tue Feb 14 15:58:49 2012 (r231689) @@ -254,7 +254,7 @@ void scif_sas_stp_task_request_abort_tas fw_domain->controller, fw_device, pending_request, - SCI_FAILURE_IO_TERMINATED + SCI_IO_FAILURE_TERMINATED ); } //otherwise, the abort succeeded. Since the waiting flag is cleared, Modified: stable/9/sys/i386/conf/GENERIC ============================================================================== --- stable/9/sys/i386/conf/GENERIC Tue Feb 14 15:56:01 2012 (r231688) +++ stable/9/sys/i386/conf/GENERIC Tue Feb 14 15:58:49 2012 (r231689) @@ -116,6 +116,7 @@ device bt # Buslogic/Mylex MultiMaster device ncv # NCR 53C500 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 16:47:00 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D1BB106566C; Tue, 14 Feb 2012 16:47:00 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B5868FC15; Tue, 14 Feb 2012 16:47: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 q1EGl0Lc008303; Tue, 14 Feb 2012 16:47:00 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EGkx4K008301; Tue, 14 Feb 2012 16:46:59 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202141646.q1EGkx4K008301@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 14 Feb 2012 16:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231690 - stable/9/sys/dev/mps X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 16:47:00 -0000 Author: ken Date: Tue Feb 14 16:46:59 2012 New Revision: 231690 URL: http://svn.freebsd.org/changeset/base/231690 Log: MFC 231485 Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR from the mps driver probe routine. This will allow LSI to ship drivers that return BUS_PROBE_VENDOR to override the in-tree version of the driver. Modified: stable/9/sys/dev/mps/mps_pci.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/mps/mps_pci.c ============================================================================== --- stable/9/sys/dev/mps/mps_pci.c Tue Feb 14 15:58:49 2012 (r231689) +++ stable/9/sys/dev/mps/mps_pci.c Tue Feb 14 16:46:59 2012 (r231690) @@ -172,7 +172,7 @@ mps_pci_probe(device_t dev) if ((id = mps_find_ident(dev)) != NULL) { device_set_desc(dev, id->desc); - return (BUS_PROBE_VENDOR); + return (BUS_PROBE_DEFAULT); } return (ENXIO); } From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 17:09:21 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50BAD1065673; Tue, 14 Feb 2012 17:09:21 +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 3DA108FC1B; Tue, 14 Feb 2012 17:09:21 +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 q1EH9Lnl009162; Tue, 14 Feb 2012 17:09:21 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EH9KAF009157; Tue, 14 Feb 2012 17:09:20 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201202141709.q1EH9KAF009157@svn.freebsd.org> From: Martin Matuska Date: Tue, 14 Feb 2012 17:09:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231692 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 17:09:21 -0000 Author: mm Date: Tue Feb 14 17:09:20 2012 New Revision: 231692 URL: http://svn.freebsd.org/changeset/base/231692 Log: MFC r230129,r230143,r230407,r231012: MFC r320129 [1]: Introduce vn_path_to_global_path() This function updates path string to vnode's full global path and checks the size of the new path string against the pathlen argument. In vfs_domount(), sys_unmount() and kern_jail_set() this new function is used to update the supplied path argument to the respective global path. Unbreaks jailed zfs(8) with enforce_statfs set to 1. MFC r230143 [2]: Fix missing in r230129: kern_jail.c: initialize fullpath_disabled to zero vfs_cache.c: add missing dot in comment MFC r230407 [3]: Use separate buffer for global path to avoid overflow of path buffer. MFC r231012: Analogous to r230407 a separate path buffer in vfs_mount.c is required for r230129. Fixes a out of bounds write to fspath. Reviewed by: kib [1] [2], jamie [3] Modified: stable/9/sys/kern/kern_jail.c stable/9/sys/kern/vfs_cache.c stable/9/sys/kern/vfs_mount.c stable/9/sys/sys/vnode.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_jail.c ============================================================================== --- stable/9/sys/kern/kern_jail.c Tue Feb 14 16:47:52 2012 (r231691) +++ stable/9/sys/kern/kern_jail.c Tue Feb 14 17:09:20 2012 (r231692) @@ -521,6 +521,7 @@ kern_jail_set(struct thread *td, struct struct prison *pr, *deadpr, *mypr, *ppr, *tpr; struct vnode *root; char *domain, *errmsg, *host, *name, *namelc, *p, *path, *uuid; + char *g_path; #if defined(INET) || defined(INET6) struct prison *tppr; void *op; @@ -531,6 +532,7 @@ kern_jail_set(struct thread *td, struct int gotchildmax, gotenforce, gothid, gotslevel; int fi, jid, jsys, len, level; int childmax, slevel, vfslocked; + int fullpath_disabled; #if defined(INET) || defined(INET6) int ii, ij; #endif @@ -574,6 +576,7 @@ kern_jail_set(struct thread *td, struct #ifdef INET6 ip6 = NULL; #endif + g_path = NULL; error = vfs_copyopt(opts, "jid", &jid, sizeof(jid)); if (error == ENOENT) @@ -880,6 +883,7 @@ kern_jail_set(struct thread *td, struct } #endif + fullpath_disabled = 0; root = NULL; error = vfs_getopt(opts, "path", (void **)&path, &len); if (error == ENOENT) @@ -897,30 +901,44 @@ kern_jail_set(struct thread *td, struct error = EINVAL; goto done_free; } - if (len < 2 || (len == 2 && path[0] == '/')) - path = NULL; - else { + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, UIO_SYSSPACE, + path, td); + error = namei(&nd); + if (error) + goto done_free; + vfslocked = NDHASGIANT(&nd); + root = nd.ni_vp; + NDFREE(&nd, NDF_ONLY_PNBUF); + g_path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + strlcpy(g_path, path, MAXPATHLEN); + error = vn_path_to_global_path(td, root, g_path, MAXPATHLEN); + if (error == 0) + path = g_path; + else if (error == ENODEV) { + /* proceed if sysctl debug.disablefullpath == 1 */ + fullpath_disabled = 1; + if (len < 2 || (len == 2 && path[0] == '/')) + path = NULL; + } else { + /* exit on other errors */ + VFS_UNLOCK_GIANT(vfslocked); + goto done_free; + } + if (root->v_type != VDIR) { + error = ENOTDIR; + vput(root); + VFS_UNLOCK_GIANT(vfslocked); + goto done_free; + } + VOP_UNLOCK(root, 0); + VFS_UNLOCK_GIANT(vfslocked); + if (fullpath_disabled) { /* Leave room for a real-root full pathname. */ if (len + (path[0] == '/' && strcmp(mypr->pr_path, "/") ? strlen(mypr->pr_path) : 0) > MAXPATHLEN) { error = ENAMETOOLONG; goto done_free; } - NDINIT(&nd, LOOKUP, MPSAFE | FOLLOW, UIO_SYSSPACE, - path, td); - error = namei(&nd); - if (error) - goto done_free; - vfslocked = NDHASGIANT(&nd); - root = nd.ni_vp; - NDFREE(&nd, NDF_ONLY_PNBUF); - if (root->v_type != VDIR) { - error = ENOTDIR; - vrele(root); - VFS_UNLOCK_GIANT(vfslocked); - goto done_free; - } - VFS_UNLOCK_GIANT(vfslocked); } } @@ -1583,7 +1601,8 @@ kern_jail_set(struct thread *td, struct } if (path != NULL) { /* Try to keep a real-rooted full pathname. */ - if (path[0] == '/' && strcmp(mypr->pr_path, "/")) + if (fullpath_disabled && path[0] == '/' && + strcmp(mypr->pr_path, "/")) snprintf(pr->pr_path, sizeof(pr->pr_path), "%s%s", mypr->pr_path, path); else @@ -1806,6 +1825,8 @@ kern_jail_set(struct thread *td, struct #ifdef INET6 free(ip6, M_PRISON); #endif + if (g_path != NULL) + free(g_path, M_TEMP); vfs_freeopts(opts); return (error); } Modified: stable/9/sys/kern/vfs_cache.c ============================================================================== --- stable/9/sys/kern/vfs_cache.c Tue Feb 14 16:47:52 2012 (r231691) +++ stable/9/sys/kern/vfs_cache.c Tue Feb 14 17:09:20 2012 (r231692) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1277,3 +1278,76 @@ vn_commname(struct vnode *vp, char *buf, buf[l] = '\0'; return (0); } + +/* + * This function updates path string to vnode's full global path + * and checks the size of the new path string against the pathlen argument. + * + * Requires a locked, referenced vnode and GIANT lock held. + * Vnode is re-locked on success or ENODEV, otherwise unlocked. + * + * If sysctl debug.disablefullpath is set, ENODEV is returned, + * vnode is left locked and path remain untouched. + * + * If vp is a directory, the call to vn_fullpath_global() always succeeds + * because it falls back to the ".." lookup if the namecache lookup fails. + */ +int +vn_path_to_global_path(struct thread *td, struct vnode *vp, char *path, + u_int pathlen) +{ + struct nameidata nd; + struct vnode *vp1; + char *rpath, *fbuf; + int error, vfslocked; + + VFS_ASSERT_GIANT(vp->v_mount); + ASSERT_VOP_ELOCKED(vp, __func__); + + /* Return ENODEV if sysctl debug.disablefullpath==1 */ + if (disablefullpath) + return (ENODEV); + + /* Construct global filesystem path from vp. */ + VOP_UNLOCK(vp, 0); + error = vn_fullpath_global(td, vp, &rpath, &fbuf); + + if (error != 0) { + vrele(vp); + return (error); + } + + if (strlen(rpath) >= pathlen) { + vrele(vp); + error = ENAMETOOLONG; + goto out; + } + + /* + * Re-lookup the vnode by path to detect a possible rename. + * As a side effect, the vnode is relocked. + * If vnode was renamed, return ENOENT. + */ + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, + UIO_SYSSPACE, path, td); + error = namei(&nd); + if (error != 0) { + vrele(vp); + goto out; + } + vfslocked = NDHASGIANT(&nd); + NDFREE(&nd, NDF_ONLY_PNBUF); + vp1 = nd.ni_vp; + vrele(vp); + if (vp1 == vp) + strcpy(path, rpath); + else { + vput(vp1); + error = ENOENT; + } + VFS_UNLOCK_GIANT(vfslocked); + +out: + free(fbuf, M_TEMP); + return (error); +} Modified: stable/9/sys/kern/vfs_mount.c ============================================================================== --- stable/9/sys/kern/vfs_mount.c Tue Feb 14 16:47:52 2012 (r231691) +++ stable/9/sys/kern/vfs_mount.c Tue Feb 14 17:09:20 2012 (r231692) @@ -1024,6 +1024,7 @@ vfs_domount( struct vfsconf *vfsp; struct nameidata nd; struct vnode *vp; + char *pathbuf; int error; /* @@ -1087,11 +1088,17 @@ vfs_domount( NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; if ((fsflags & MNT_UPDATE) == 0) { - error = vfs_domount_first(td, vfsp, fspath, vp, fsflags, - optlist); - } else { + pathbuf = malloc(MNAMELEN, M_TEMP, M_WAITOK); + strcpy(pathbuf, fspath); + error = vn_path_to_global_path(td, vp, pathbuf, MNAMELEN); + /* debug.disablefullpath == 1 results in ENODEV */ + if (error == 0 || error == ENODEV) { + error = vfs_domount_first(td, vfsp, pathbuf, vp, + fsflags, optlist); + } + free(pathbuf, M_TEMP); + } else error = vfs_domount_update(td, vp, fsflags, optlist); - } mtx_unlock(&Giant); ASSERT_VI_UNLOCKED(vp, __func__); @@ -1121,9 +1128,10 @@ sys_unmount(td, uap) int flags; } */ *uap; { + struct nameidata nd; struct mount *mp; char *pathbuf; - int error, id0, id1; + int error, id0, id1, vfslocked; AUDIT_ARG_VALUE(uap->flags); if (jailed(td->td_ucred) || usermount == 0) { @@ -1157,6 +1165,21 @@ sys_unmount(td, uap) mtx_unlock(&mountlist_mtx); } else { AUDIT_ARG_UPATH1(td, pathbuf); + /* + * Try to find global path for path argument. + */ + NDINIT(&nd, LOOKUP, + FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, + UIO_SYSSPACE, pathbuf, td); + if (namei(&nd) == 0) { + vfslocked = NDHASGIANT(&nd); + NDFREE(&nd, NDF_ONLY_PNBUF); + error = vn_path_to_global_path(td, nd.ni_vp, pathbuf, + MNAMELEN); + if (error == 0 || error == ENODEV) + vput(nd.ni_vp); + VFS_UNLOCK_GIANT(vfslocked); + } mtx_lock(&mountlist_mtx); TAILQ_FOREACH_REVERSE(mp, &mountlist, mntlist, mnt_list) { if (strcmp(mp->mnt_stat.f_mntonname, pathbuf) == 0) Modified: stable/9/sys/sys/vnode.h ============================================================================== --- stable/9/sys/sys/vnode.h Tue Feb 14 16:47:52 2012 (r231691) +++ stable/9/sys/sys/vnode.h Tue Feb 14 17:09:20 2012 (r231692) @@ -605,6 +605,8 @@ int vn_fullpath(struct thread *td, struc int vn_fullpath_global(struct thread *td, struct vnode *vn, char **retbuf, char **freebuf); int vn_commname(struct vnode *vn, char *buf, u_int buflen); +int vn_path_to_global_path(struct thread *td, struct vnode *vp, + char *path, u_int pathlen); int vaccess(enum vtype type, mode_t file_mode, uid_t file_uid, gid_t file_gid, accmode_t accmode, struct ucred *cred, int *privused); From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 17:18:45 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAE301065704; Tue, 14 Feb 2012 17:18:45 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D83CA8FC1A; Tue, 14 Feb 2012 17:18:45 +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 q1EHIjZj009636; Tue, 14 Feb 2012 17:18:45 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EHIj6N009634; Tue, 14 Feb 2012 17:18:45 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201202141718.q1EHIj6N009634@svn.freebsd.org> From: Jim Harris Date: Tue, 14 Feb 2012 17:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231695 - stable/9/share/man/man4 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 17:18:46 -0000 Author: jimharris Date: Tue Feb 14 17:18:45 2012 New Revision: 231695 URL: http://svn.freebsd.org/changeset/base/231695 Log: MFC r231615, r231693 r231615: Minor cleanup and added missing svn keywords (from brueffer@) r231693: Update HISTORY for isci.4 man page. Sponsored by: Intel Approved by: scottl Modified: stable/9/share/man/man4/isci.4 (contents, props changed) Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/isci.4 ============================================================================== --- stable/9/share/man/man4/isci.4 Tue Feb 14 17:16:45 2012 (r231694) +++ stable/9/share/man/man4/isci.4 Tue Feb 14 17:18:45 2012 (r231695) @@ -57,7 +57,7 @@ The .Nm driver provides support for Intel C600 .Tn SAS -controller. +controllers. .Sh CONFIGURATION To force legacy interrupts for all .Nm @@ -77,9 +77,11 @@ hw.isci.debug_level variable to a value between 1 and 4 in .Xr loader.conf 5 . .Pp -The hardware layer in the isci driver has extensive logging capabilities -which are disabled by default for performance reasons. These can be enabled -by adding +The hardware layer in the +.Nm +driver has extensive logging capabilities +which are disabled by default for performance reasons. +These can be enabled by adding .Bd -literal -offset indent options ISCI_LOGGING .Ed @@ -91,12 +93,12 @@ to the kernel configuration file. .Xr da 4 , .Xr pci 4 , .Xr sa 4 , -.Xr scsi 4 . +.Xr scsi 4 .Sh HISTORY The .Nm driver first appeared in -.Fx 10.0 . +.Fx 8.3 and 9.1 . .Sh AUTHORS .An -nosplit The From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 18:00:37 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7D61106566C; Tue, 14 Feb 2012 18:00:37 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 926EE8FC0C; Tue, 14 Feb 2012 18:00: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 q1EI0bjJ011094; Tue, 14 Feb 2012 18:00:37 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EI0bHb011087; Tue, 14 Feb 2012 18:00:37 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202141800.q1EI0bHb011087@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 14 Feb 2012 18:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231697 - in stable/9: share/man/man4 sys/conf sys/dev/xen/blkback sys/dev/xen/netback sys/i386/include/xen sys/kern sys/xen/interface/io X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 18:00:37 -0000 Author: ken Date: Tue Feb 14 18:00:37 2012 New Revision: 231697 URL: http://svn.freebsd.org/changeset/base/231697 Log: MFC 230587, 230916 Xen netback driver rewrite. r230587 | ken | 2012-01-26 09:35:09 -0700 (Thu, 26 Jan 2012) | 38 lines Xen netback driver rewrite. share/man/man4/Makefile, share/man/man4/xnb.4, sys/dev/xen/netback/netback.c, sys/dev/xen/netback/netback_unit_tests.c: Rewrote the netback driver for xen to attach properly via newbus and work properly in both HVM and PVM mode (only HVM is tested). Works with the in-tree FreeBSD netfront driver or the Windows netfront driver from SuSE. Has not been extensively tested with a Linux netfront driver. Does not implement LRO, TSO, or polling. Includes unit tests that may be run through sysctl after compiling with XNB_DEBUG defined. sys/dev/xen/blkback/blkback.c, sys/xen/interface/io/netif.h: Comment elaboration. sys/kern/uipc_mbuf.c: Fix page fault in kernel mode when calling m_print() on a null mbuf. Since m_print() is only used for debugging, there are no performance concerns for extra error checking code. sys/kern/subr_scanf.c: Add the "hh" and "ll" width specifiers from C99 to scanf(). A few callers were already using "ll" even though scanf() was handling it as "l". Submitted by: Alan Somers Submitted by: John Suykerbuyk Sponsored by: Spectra Logic Reviewed by: ken r230916 | ken | 2012-02-02 10:54:35 -0700 (Thu, 02 Feb 2012) | 13 lines Fix the netback driver build for i386. netback.c: Add missing VM includes. xen/xenvar.h, xen/xenpmap.h: Move some XENHVM macros from to on i386 to match the amd64 headers. conf/files: Add netback to the build. Submitted by: jhb Added: stable/9/share/man/man4/xnb.4 - copied unchanged from r230587, head/share/man/man4/xnb.4 stable/9/sys/dev/xen/netback/netback_unit_tests.c - copied unchanged from r230587, head/sys/dev/xen/netback/netback_unit_tests.c Modified: stable/9/share/man/man4/Makefile stable/9/sys/conf/files stable/9/sys/dev/xen/blkback/blkback.c stable/9/sys/dev/xen/netback/netback.c stable/9/sys/i386/include/xen/xenpmap.h stable/9/sys/i386/include/xen/xenvar.h stable/9/sys/kern/subr_scanf.c stable/9/sys/kern/uipc_mbuf.c stable/9/sys/xen/interface/io/netif.h Directory Properties: stable/9/ (props changed) stable/9/share/ (props changed) stable/9/share/man/ (props changed) stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Tue Feb 14 17:35:44 2012 (r231696) +++ stable/9/share/man/man4/Makefile Tue Feb 14 18:00:37 2012 (r231697) @@ -528,6 +528,7 @@ MAN= aac.4 \ ${_xen.4} \ xhci.4 \ xl.4 \ + ${_xnb.4} \ xpt.4 \ zero.4 \ zyd.4 @@ -722,6 +723,7 @@ _urtw.4= urtw.4 _viawd.4= viawd.4 _wpi.4= wpi.4 _xen.4= xen.4 +_xnb.4= xnb.4 MLINKS+=lindev.4 full.4 .endif Copied: stable/9/share/man/man4/xnb.4 (from r230587, head/share/man/man4/xnb.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man4/xnb.4 Tue Feb 14 18:00:37 2012 (r231697, copy of r230587, head/share/man/man4/xnb.4) @@ -0,0 +1,134 @@ +.\" Copyright (c) 2012 Spectra Logic Corporation +.\" All rights reserved. +.\" +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" substantially similar to the "NO WARRANTY" disclaimer below +.\" ("Disclaimer") and any redistribution must be conditioned upon +.\" including a substantially similar Disclaimer requirement for further +.\" binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGES. +.\" +.\" Authors: Alan Somers (Spectra Logic Corporation) +.\" +.\" $FreeBSD$ +.\" + +.Dd January 6, 2012 +.Dt XNB 4 +.Os +.Sh NAME +.Nm xnb +.Nd "Xen Paravirtualized Backend Ethernet Driver" +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "options XENHVM" +.Cd "device xenpci" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides the back half of a paravirtualized +.Xr xen 4 +network connection. The netback and netfront drivers appear to their +respective operating systems as Ethernet devices linked by a crossover cable. +Typically, +.Nm +will run on Domain 0 and the netfront driver will run on a guest domain. +However, it is also possible to run +.Nm +on a guest domain. It may be bridged or routed to provide the netfront's +domain access to other guest domains or to a physical network. +.Pp +In most respects, the +.Nm +device appears to the OS as an other Ethernet device. It can be configured at +runtime entirely with +.Xr ifconfig 8 +\&. In particular, it supports MAC changing, arbitrary MTU sizes, checksum +offload for IP, UDP, and TCP for both receive and transmit, and TSO. However, +see +.Sx CAVEATS +before enabling txcsum, rxcsum, or tso. +.Sh SYSCTL VARIABLES +The following read-only variables are available via +.Xr sysctl 8 : +.Bl -tag -width indent +.It Va dev.xnb.%d.dump_rings +Displays information about the ring buffers used to pass requests between the +netfront and netback. Mostly useful for debugging, but can also be used to +get traffic statistics. +.It Va dev.xnb.%d.unit_test_results +Runs a builtin suite of unit tests and displays the results. Does not affect +the operation of the driver in any way. Note that the test suite simulates +error conditions; this will result in error messages being printed to the +system system log. +.Sh CAVEATS +Packets sent through Xennet pass over shared memory, so the protocol includes +no form of link-layer checksum or CRC. Furthermore, Xennet drivers always +report to their hosts that they support receive and transmit checksum +offloading. They "offload" the checksum calculation by simply skipping it. +That works fine for packets that are exchanged between two domains on the same +machine. However, when a Xennet interface is bridged to a physical interface, +a correct checksum must be attached to any packets bound for that physical +interface. Currently, FreeBSD lacks any mechanism for an ethernet device to +inform the OS that newly received packets are valid even though their checksums +are not. So if the netfront driver is configured to offload checksum +calculations, it will pass non-checksumed packets to +.Nm +, which must then calculate the checksum in software before passing the packet +to the OS. +.Pp +For this reason, it is recommended that if +.Nm +is bridged to a physcal interface, then transmit checksum offloading should be +disabled on the netfront. The Xennet protocol does not have any mechanism for +the netback to request the netfront to do this; the operator must do it +manually. +.Sh SEE ALSO +.Xr arp 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr ifconfig 8 , +.Xr xen 4 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 10.0 +. +.Sh AUTHORS +The +.Nm +driver was written by +.An Alan Somers +.Aq alans@spectralogic.com +and +.An John Suykerbuyk +.Aq johns@spectralogic.com +.Sh BUGS +The +.Nm +driver does not properly checksum UDP datagrams that span more than one +Ethernet frame. Nor does it correctly checksum IPv6 packets. To workaround +that bug, disable transmit checksum offloading on the netfront driver. Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Tue Feb 14 17:35:44 2012 (r231696) +++ stable/9/sys/conf/files Tue Feb 14 18:00:37 2012 (r231697) @@ -3493,6 +3493,7 @@ dev/xen/blkback/blkback.c optional xen | dev/xen/console/console.c optional xen dev/xen/console/xencons_ring.c optional xen dev/xen/control/control.c optional xen | xenhvm +dev/xen/netback/netback.c optional xen | xenhvm dev/xen/netfront/netfront.c optional xen | xenhvm dev/xen/xenpci/xenpci.c optional xenpci dev/xen/xenpci/evtchn.c optional xenpci Modified: stable/9/sys/dev/xen/blkback/blkback.c ============================================================================== --- stable/9/sys/dev/xen/blkback/blkback.c Tue Feb 14 17:35:44 2012 (r231696) +++ stable/9/sys/dev/xen/blkback/blkback.c Tue Feb 14 18:00:37 2012 (r231697) @@ -3434,6 +3434,10 @@ xbb_shutdown(struct xbb_softc *xbb) DPRINTF("\n"); + /* + * Before unlocking mutex, set this flag to prevent other threads from + * getting into this function + */ xbb->flags |= XBBF_IN_SHUTDOWN; mtx_unlock(&xbb->lock); Modified: stable/9/sys/dev/xen/netback/netback.c ============================================================================== --- stable/9/sys/dev/xen/netback/netback.c Tue Feb 14 17:35:44 2012 (r231696) +++ stable/9/sys/dev/xen/netback/netback.c Tue Feb 14 18:00:37 2012 (r231697) @@ -1,1596 +1,2537 @@ -/* - * Copyright (c) 2006, Cisco Systems, Inc. +/*- + * Copyright (c) 2009-2011 Spectra Logic Corporation * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Cisco Systems, Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * Authors: Justin T. Gibbs (Spectra Logic Corporation) + * Alan Somers (Spectra Logic Corporation) + * John Suykerbuyk (Spectra Logic Corporation) */ #include __FBSDID("$FreeBSD$"); + +/** + * \file netback.c + * + * \brief Device driver supporting the vending of network access + * from this FreeBSD domain to other domains. + */ +#include "opt_inet.h" +#include "opt_global.h" + #include "opt_sctp.h" #include -#include -#include -#include -#include #include -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include #include -#include #include -#include +#include +#include +#include -#include #include -#include #include +#include +#if __FreeBSD_version >= 700000 #include -#include -#ifdef SCTP -#include -#include #endif +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include + +#include +#include +#include +#include +/*--------------------------- Compile-time Tunables --------------------------*/ + +/*---------------------------------- Macros ----------------------------------*/ +/** + * Custom malloc type for all driver allocations. + */ +static MALLOC_DEFINE(M_XENNETBACK, "xnb", "Xen Net Back Driver Data"); -#ifdef XEN_NETBACK_DEBUG -#define DPRINTF(fmt, args...) \ - printf("netback (%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) +#define XNB_SG 1 /* netback driver supports feature-sg */ +#define XNB_GSO_TCPV4 1 /* netback driver supports feature-gso-tcpv4 */ +#define XNB_RX_COPY 1 /* netback driver supports feature-rx-copy */ +#define XNB_RX_FLIP 0 /* netback driver does not support feature-rx-flip */ + +#undef XNB_DEBUG +#define XNB_DEBUG /* hardcode on during development */ + +#ifdef XNB_DEBUG +#define DPRINTF(fmt, args...) \ + printf("xnb(%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) #else -#define DPRINTF(fmt, args...) ((void)0) +#define DPRINTF(fmt, args...) do {} while (0) #endif -#ifdef XEN_NETBACK_DEBUG_LOTS -#define DDPRINTF(fmt, args...) \ - printf("netback (%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) -#define DPRINTF_MBUF(_m) print_mbuf(_m, 0) -#define DPRINTF_MBUF_LEN(_m, _len) print_mbuf(_m, _len) -#else -#define DDPRINTF(fmt, args...) ((void)0) -#define DPRINTF_MBUF(_m) ((void)0) -#define DPRINTF_MBUF_LEN(_m, _len) ((void)0) +/* Default length for stack-allocated grant tables */ +#define GNTTAB_LEN (64) + +/* Features supported by all backends. TSO and LRO can be negotiated */ +#define XNB_CSUM_FEATURES (CSUM_TCP | CSUM_UDP) + +#define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE) +#define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE) + +/** + * Two argument version of the standard macro. Second argument is a tentative + * value of req_cons + */ +#define RING_HAS_UNCONSUMED_REQUESTS_2(_r, cons) ({ \ + unsigned int req = (_r)->sring->req_prod - cons; \ + unsigned int rsp = RING_SIZE(_r) - \ + (cons - (_r)->rsp_prod_pvt); \ + req < rsp ? req : rsp; \ +}) + +#define virt_to_mfn(x) (vtomach(x) >> PAGE_SHIFT) +#define virt_to_offset(x) ((x) & (PAGE_SIZE - 1)) + +/** + * Predefined array type of grant table copy descriptors. Used to pass around + * statically allocated memory structures. + */ +typedef struct gnttab_copy gnttab_copy_table[GNTTAB_LEN]; + +/*--------------------------- Forward Declarations ---------------------------*/ +struct xnb_softc; +struct xnb_pkt; + +static void xnb_attach_failed(struct xnb_softc *xnb, + int err, const char *fmt, ...) + __printflike(3,4); +static int xnb_shutdown(struct xnb_softc *xnb); +static int create_netdev(device_t dev); +static int xnb_detach(device_t dev); +static int xen_net_read_mac(device_t dev, uint8_t mac[]); +static int xnb_ifmedia_upd(struct ifnet *ifp); +static void xnb_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); +static void xnb_intr(void *arg); +static int xnb_send(netif_rx_back_ring_t *rxb, domid_t otherend, + const struct mbuf *mbufc, gnttab_copy_table gnttab); +static int xnb_recv(netif_tx_back_ring_t *txb, domid_t otherend, + struct mbuf **mbufc, struct ifnet *ifnet, + gnttab_copy_table gnttab); +static int xnb_ring2pkt(struct xnb_pkt *pkt, + const netif_tx_back_ring_t *tx_ring, + RING_IDX start); +static void xnb_txpkt2rsp(const struct xnb_pkt *pkt, + netif_tx_back_ring_t *ring, int error); +static struct mbuf *xnb_pkt2mbufc(const struct xnb_pkt *pkt, struct ifnet *ifp); +static int xnb_txpkt2gnttab(const struct xnb_pkt *pkt, + const struct mbuf *mbufc, + gnttab_copy_table gnttab, + const netif_tx_back_ring_t *txb, + domid_t otherend_id); +static void xnb_update_mbufc(struct mbuf *mbufc, + const gnttab_copy_table gnttab, int n_entries); +static int xnb_mbufc2pkt(const struct mbuf *mbufc, + struct xnb_pkt *pkt, + RING_IDX start, int space); +static int xnb_rxpkt2gnttab(const struct xnb_pkt *pkt, + const struct mbuf *mbufc, + gnttab_copy_table gnttab, + const netif_rx_back_ring_t *rxb, + domid_t otherend_id); +static int xnb_rxpkt2rsp(const struct xnb_pkt *pkt, + const gnttab_copy_table gnttab, int n_entries, + netif_rx_back_ring_t *ring); +static void xnb_add_mbuf_cksum(struct mbuf *mbufc); +static void xnb_stop(struct xnb_softc*); +static int xnb_ioctl(struct ifnet*, u_long, caddr_t); +static void xnb_start_locked(struct ifnet*); +static void xnb_start(struct ifnet*); +static void xnb_ifinit_locked(struct xnb_softc*); +static void xnb_ifinit(void*); +#ifdef XNB_DEBUG +static int xnb_unit_test_main(SYSCTL_HANDLER_ARGS); +static int xnb_dump_rings(SYSCTL_HANDLER_ARGS); #endif +/*------------------------------ Data Structures -----------------------------*/ -#define WPRINTF(fmt, args...) \ - printf("netback (%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) -#define BUG_ON PANIC_IF +/** + * Representation of a xennet packet. Simplified version of a packet as + * stored in the Xen tx ring. Applicable to both RX and TX packets + */ +struct xnb_pkt{ + /** + * Array index of the first data-bearing (eg, not extra info) entry + * for this packet + */ + RING_IDX car; + + /** + * Array index of the second data-bearing entry for this packet. + * Invalid if the packet has only one data-bearing entry. If the + * packet has more than two data-bearing entries, then the second + * through the last will be sequential modulo the ring size + */ + RING_IDX cdr; + + /** + * Optional extra info. Only valid if flags contains + * NETTXF_extra_info. Note that extra.type will always be + * XEN_NETIF_EXTRA_TYPE_GSO. Currently, no known netfront or netback + * driver will ever set XEN_NETIF_EXTRA_TYPE_MCAST_* + */ + netif_extra_info_t extra; + + /** Size of entire packet in bytes. */ + uint16_t size; -#define IFNAME(_np) (_np)->ifp->if_xname + /** The size of the first entry's data in bytes */ + uint16_t car_size; -#define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE) -#define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE) + /** + * Either NETTXF_ or NETRXF_ flags. Note that the flag values are + * not the same for TX and RX packets + */ + uint16_t flags; + + /** + * The number of valid data-bearing entries (either netif_tx_request's + * or netif_rx_response's) in the packet. If this is 0, it means the + * entire packet is invalid. + */ + uint16_t list_len; -struct ring_ref { - vm_offset_t va; - grant_handle_t handle; - uint64_t bus_addr; + /** There was an error processing the packet */ + uint8_t error; }; -typedef struct netback_info { +/** xnb_pkt method: initialize it */ +static inline void +xnb_pkt_initialize(struct xnb_pkt *pxnb) +{ + bzero(pxnb, sizeof(*pxnb)); +} - /* Schedule lists */ - STAILQ_ENTRY(netback_info) next_tx; - STAILQ_ENTRY(netback_info) next_rx; - int on_tx_sched_list; - int on_rx_sched_list; - - struct xenbus_device *xdev; - XenbusState frontend_state; - - domid_t domid; - int handle; - char *bridge; - - int rings_connected; - struct ring_ref tx_ring_ref; - struct ring_ref rx_ring_ref; - netif_tx_back_ring_t tx; - netif_rx_back_ring_t rx; - evtchn_port_t evtchn; - int irq; - void *irq_cookie; +/** xnb_pkt method: mark the packet as valid */ +static inline void +xnb_pkt_validate(struct xnb_pkt *pxnb) +{ + pxnb->error = 0; +}; - struct ifnet *ifp; - int ref_cnt; +/** xnb_pkt method: mark the packet as invalid */ +static inline void +xnb_pkt_invalidate(struct xnb_pkt *pxnb) +{ + pxnb->error = 1; +}; - device_t ndev; - int attached; -} netif_t; - - -#define MAX_PENDING_REQS 256 -#define PKT_PROT_LEN 64 - -static struct { - netif_tx_request_t req; - netif_t *netif; -} pending_tx_info[MAX_PENDING_REQS]; -static uint16_t pending_ring[MAX_PENDING_REQS]; -typedef unsigned int PEND_RING_IDX; -#define MASK_PEND_IDX(_i) ((_i)&(MAX_PENDING_REQS-1)) -static PEND_RING_IDX pending_prod, pending_cons; -#define NR_PENDING_REQS (MAX_PENDING_REQS - pending_prod + pending_cons) - -static unsigned long mmap_vstart; -#define MMAP_VADDR(_req) (mmap_vstart + ((_req) * PAGE_SIZE)) - -/* Freed TX mbufs get batched on this ring before return to pending_ring. */ -static uint16_t dealloc_ring[MAX_PENDING_REQS]; -static PEND_RING_IDX dealloc_prod, dealloc_cons; - -static multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1]; -static mmu_update_t rx_mmu[NET_RX_RING_SIZE]; -static gnttab_transfer_t grant_rx_op[NET_RX_RING_SIZE]; - -static grant_handle_t grant_tx_handle[MAX_PENDING_REQS]; -static gnttab_unmap_grant_ref_t tx_unmap_ops[MAX_PENDING_REQS]; -static gnttab_map_grant_ref_t tx_map_ops[MAX_PENDING_REQS]; - -static struct task net_tx_task, net_rx_task; -static struct callout rx_task_callout; - -static STAILQ_HEAD(netback_tx_sched_list, netback_info) tx_sched_list = - STAILQ_HEAD_INITIALIZER(tx_sched_list); -static STAILQ_HEAD(netback_rx_sched_list, netback_info) rx_sched_list = - STAILQ_HEAD_INITIALIZER(rx_sched_list); -static struct mtx tx_sched_list_lock; -static struct mtx rx_sched_list_lock; - -static int vif_unit_maker = 0; - -/* Protos */ -static void netback_start(struct ifnet *ifp); -static int netback_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); -static int vif_add_dev(struct xenbus_device *xdev); -static void disconnect_rings(netif_t *netif); +/** xnb_pkt method: Check whether the packet is valid */ +static inline int +xnb_pkt_is_valid(const struct xnb_pkt *pxnb) +{ + return (! pxnb->error); +} + +#ifdef XNB_DEBUG +/** xnb_pkt method: print the packet's contents in human-readable format*/ +static void __unused +xnb_dump_pkt(const struct xnb_pkt *pkt) { + if (pkt == NULL) { + DPRINTF("Was passed a null pointer.\n"); + return; + } + DPRINTF("pkt address= %p\n", pkt); + DPRINTF("pkt->size=%d\n", pkt->size); + DPRINTF("pkt->car_size=%d\n", pkt->car_size); + DPRINTF("pkt->flags=0x%04x\n", pkt->flags); + DPRINTF("pkt->list_len=%d\n", pkt->list_len); + /* DPRINTF("pkt->extra"); TODO */ + DPRINTF("pkt->car=%d\n", pkt->car); + DPRINTF("pkt->cdr=%d\n", pkt->cdr); + DPRINTF("pkt->error=%d\n", pkt->error); +} +#endif /* XNB_DEBUG */ -#ifdef XEN_NETBACK_DEBUG_LOTS -/* Debug code to display the contents of an mbuf */ static void -print_mbuf(struct mbuf *m, int max) +xnb_dump_txreq(RING_IDX idx, const struct netif_tx_request *txreq) { - int i, j=0; - printf("mbuf %08x len = %d", (unsigned int)m, m->m_pkthdr.len); - for (; m; m = m->m_next) { - unsigned char *d = m->m_data; - for (i=0; i < m->m_len; i++) { - if (max && j == max) - break; - if ((j++ % 16) == 0) - printf("\n%04x:", j); - printf(" %02x", d[i]); - } + if (txreq != NULL) { + DPRINTF("netif_tx_request index =%u\n", idx); + DPRINTF("netif_tx_request.gref =%u\n", txreq->gref); + DPRINTF("netif_tx_request.offset=%hu\n", txreq->offset); + DPRINTF("netif_tx_request.flags =%hu\n", txreq->flags); + DPRINTF("netif_tx_request.id =%hu\n", txreq->id); + DPRINTF("netif_tx_request.size =%hu\n", txreq->size); } - printf("\n"); } -#endif -#define MAX_MFN_ALLOC 64 -static unsigned long mfn_list[MAX_MFN_ALLOC]; -static unsigned int alloc_index = 0; +/** + * \brief Configuration data for a shared memory request ring + * used to communicate with the front-end client of this + * this driver. + */ +struct xnb_ring_config { + /** + * Runtime structures for ring access. Unfortunately, TX and RX rings + * use different data structures, and that cannot be changed since it + * is part of the interdomain protocol. + */ + union{ + netif_rx_back_ring_t rx_ring; + netif_tx_back_ring_t tx_ring; + } back_ring; + + /** + * The device bus address returned by the hypervisor when + * mapping the ring and required to unmap it when a connection + * is torn down. + */ + uint64_t bus_addr; + + /** The pseudo-physical address where ring memory is mapped.*/ + uint64_t gnt_addr; -static unsigned long -alloc_mfn(void) -{ - unsigned long mfn = 0; - struct xen_memory_reservation reservation = { - .extent_start = mfn_list, - .nr_extents = MAX_MFN_ALLOC, - .extent_order = 0, - .domid = DOMID_SELF - }; - if ( unlikely(alloc_index == 0) ) - alloc_index = HYPERVISOR_memory_op( - XENMEM_increase_reservation, &reservation); - if ( alloc_index != 0 ) - mfn = mfn_list[--alloc_index]; - return mfn; -} + /** KVA address where ring memory is mapped. */ + vm_offset_t va; -static unsigned long -alloc_empty_page_range(unsigned long nr_pages) + /** + * Grant table handles, one per-ring page, returned by the + * hyperpervisor upon mapping of the ring and required to + * unmap it when a connection is torn down. + */ + grant_handle_t handle; + + /** The number of ring pages mapped for the current connection. */ + unsigned ring_pages; + + /** + * The grant references, one per-ring page, supplied by the + * front-end, allowing us to reference the ring pages in the + * front-end's domain and to map these pages into our own domain. + */ + grant_ref_t ring_ref; +}; + +/** + * Per-instance connection state flags. + */ +typedef enum { - void *pages; - int i = 0, j = 0; - multicall_entry_t mcl[17]; - unsigned long mfn_list[16]; - struct xen_memory_reservation reservation = { - .extent_start = mfn_list, - .nr_extents = 0, - .address_bits = 0, - .extent_order = 0, - .domid = DOMID_SELF - }; + /** Communication with the front-end has been established. */ + XNBF_RING_CONNECTED = 0x01, - pages = malloc(nr_pages*PAGE_SIZE, M_DEVBUF, M_NOWAIT); - if (pages == NULL) - return 0; + /** + * Front-end requests exist in the ring and are waiting for + * xnb_xen_req objects to free up. + */ + XNBF_RESOURCE_SHORTAGE = 0x02, + + /** Connection teardown has started. */ + XNBF_SHUTDOWN = 0x04, - memset(mcl, 0, sizeof(mcl)); + /** A thread is already performing shutdown processing. */ + XNBF_IN_SHUTDOWN = 0x08 +} xnb_flag_t; - while (i < nr_pages) { - unsigned long va = (unsigned long)pages + (i++ * PAGE_SIZE); +/** + * Types of rings. Used for array indices and to identify a ring's control + * data structure type + */ +typedef enum{ + XNB_RING_TYPE_TX = 0, /* ID of TX rings, used for array indices */ + XNB_RING_TYPE_RX = 1, /* ID of RX rings, used for array indices */ + XNB_NUM_RING_TYPES +} xnb_ring_type_t; - mcl[j].op = __HYPERVISOR_update_va_mapping; - mcl[j].args[0] = va; +/** + * Per-instance configuration data. + */ +struct xnb_softc { + /** NewBus device corresponding to this instance. */ + device_t dev; + + /* Media related fields */ + + /** Generic network media state */ + struct ifmedia sc_media; + + /** Media carrier info */ + struct ifnet *xnb_ifp; + + /** Our own private carrier state */ + unsigned carrier; + + /** Device MAC Address */ + uint8_t mac[ETHER_ADDR_LEN]; + + /* Xen related fields */ + + /** + * \brief The netif protocol abi in effect. + * + * There are situations where the back and front ends can + * have a different, native abi (e.g. intel x86_64 and + * 32bit x86 domains on the same machine). The back-end + * always accomodates the front-end's native abi. That + * value is pulled from the XenStore and recorded here. + */ + int abi; - mfn_list[j++] = vtomach(va) >> PAGE_SHIFT; + /** + * Name of the bridge to which this VIF is connected, if any + * This field is dynamically allocated by xenbus and must be free()ed + * when no longer needed + */ + char *bridge; - xen_phys_machine[(vtophys(va) >> PAGE_SHIFT)] = INVALID_P2M_ENTRY; + /** The interrupt driven even channel used to signal ring events. */ + evtchn_port_t evtchn; - if (j == 16 || i == nr_pages) { - mcl[j-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_LOCAL; + /** Xen device handle.*/ + long handle; - reservation.nr_extents = j; + /** IRQ mapping for the communication ring event channel. */ + int irq; + + /** + * \brief Cached value of the front-end's domain id. + * + * This value is used at once for each mapped page in + * a transaction. We cache it to avoid incuring the + * cost of an ivar access every time this is needed. + */ + domid_t otherend_id; - mcl[j].op = __HYPERVISOR_memory_op; - mcl[j].args[0] = XENMEM_decrease_reservation; - mcl[j].args[1] = (unsigned long)&reservation; - - (void)HYPERVISOR_multicall(mcl, j+1); + /** + * Undocumented frontend feature. Has something to do with + * scatter/gather IO + */ + uint8_t can_sg; + /** Undocumented frontend feature */ + uint8_t gso; + /** Undocumented frontend feature */ + uint8_t gso_prefix; + /** Can checksum TCP/UDP over IPv4 */ + uint8_t ip_csum; + + /* Implementation related fields */ + /** + * Preallocated grant table copy descriptor for RX operations. + * Access must be protected by rx_lock + */ + gnttab_copy_table rx_gnttab; - mcl[j-1].args[MULTI_UVMFLAGS_INDEX] = 0; - j = 0; - } - } + /** + * Preallocated grant table copy descriptor for TX operations. + * Access must be protected by tx_lock + */ + gnttab_copy_table tx_gnttab; - return (unsigned long)pages; -} +#ifdef XENHVM + /** + * Resource representing allocated physical address space + * associated with our per-instance kva region. + */ + struct resource *pseudo_phys_res; -#ifdef XEN_NETBACK_FIXUP_CSUM -static void -fixup_checksum(struct mbuf *m) -{ - struct ether_header *eh = mtod(m, struct ether_header *); - struct ip *ip = (struct ip *)(eh + 1); - int iphlen = ip->ip_hl << 2; - int iplen = ntohs(ip->ip_len); - - if ((m->m_pkthdr.csum_flags & CSUM_TCP)) { - struct tcphdr *th = (struct tcphdr *)((caddr_t)ip + iphlen); - th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, - htons(IPPROTO_TCP + (iplen - iphlen))); - th->th_sum = in_cksum_skip(m, iplen + sizeof(*eh), sizeof(*eh) + iphlen); - m->m_pkthdr.csum_flags &= ~CSUM_TCP; -#ifdef SCTP - } else if (sw_csum & CSUM_SCTP) { - sctp_delayed_cksum(m, iphlen); - sw_csum &= ~CSUM_SCTP; -#endif - } else { - u_short csum; - struct udphdr *uh = (struct udphdr *)((caddr_t)ip + iphlen); - uh->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, - htons(IPPROTO_UDP + (iplen - iphlen))); - if ((csum = in_cksum_skip(m, iplen + sizeof(*eh), sizeof(*eh) + iphlen)) == 0) - csum = 0xffff; - uh->uh_sum = csum; - m->m_pkthdr.csum_flags &= ~CSUM_UDP; - } -} + /** Resource id for allocated physical address space. */ + int pseudo_phys_res_id; #endif -/* Add the interface to the specified bridge */ -static int -add_to_bridge(struct ifnet *ifp, char *bridge) -{ - struct ifdrv ifd; - struct ifbreq ifb; - struct ifnet *ifp_bridge = ifunit(bridge); + /** Ring mapping and interrupt configuration data. */ + struct xnb_ring_config ring_configs[XNB_NUM_RING_TYPES]; - if (!ifp_bridge) - return ENOENT; + /** + * Global pool of kva used for mapping remote domain ring + * and I/O transaction data. + */ + vm_offset_t kva; - bzero(&ifd, sizeof(ifd)); - bzero(&ifb, sizeof(ifb)); + /** Psuedo-physical address corresponding to kva. */ + uint64_t gnt_base_addr; - strcpy(ifb.ifbr_ifsname, ifp->if_xname); - strcpy(ifd.ifd_name, ifp->if_xname); - ifd.ifd_cmd = BRDGADD; - ifd.ifd_len = sizeof(ifb); - ifd.ifd_data = &ifb; + /** Various configuration and state bit flags. */ + xnb_flag_t flags; - return bridge_ioctl_kern(ifp_bridge, SIOCSDRVSPEC, &ifd); - -} + /** Mutex protecting per-instance data in the receive path. */ + struct mtx rx_lock; -static int -netif_create(int handle, struct xenbus_device *xdev, char *bridge) -{ - netif_t *netif; - struct ifnet *ifp; + /** Mutex protecting per-instance data in the softc structure. */ + struct mtx sc_lock; - netif = (netif_t *)malloc(sizeof(*netif), M_DEVBUF, M_NOWAIT | M_ZERO); - if (!netif) - return ENOMEM; + /** Mutex protecting per-instance data in the transmit path. */ + struct mtx tx_lock; - netif->ref_cnt = 1; - netif->handle = handle; - netif->domid = xdev->otherend_id; - netif->xdev = xdev; - netif->bridge = bridge; - xdev->data = netif; - - /* Set up ifnet structure */ - ifp = netif->ifp = if_alloc(IFT_ETHER); - if (!ifp) { - if (bridge) - free(bridge, M_DEVBUF); - free(netif, M_DEVBUF); - return ENOMEM; - } + /** The size of the global kva pool. */ + int kva_size; +}; - ifp->if_softc = netif; - if_initname(ifp, "vif", - atomic_fetchadd_int(&vif_unit_maker, 1) /* ifno */ ); - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; - ifp->if_output = ether_output; - ifp->if_start = netback_start; - ifp->if_ioctl = netback_ioctl; - ifp->if_mtu = ETHERMTU; - ifp->if_snd.ifq_maxlen = NET_TX_RING_SIZE - 1; - - DPRINTF("Created %s for domid=%d handle=%d\n", IFNAME(netif), netif->domid, netif->handle); +/*---------------------------- Debugging functions ---------------------------*/ +#ifdef XNB_DEBUG +static void __unused *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 19:08:22 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 095381065687; Tue, 14 Feb 2012 19:08:22 +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 EBFC78FC23; Tue, 14 Feb 2012 19:08:21 +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 q1EJ8Ll5013603; Tue, 14 Feb 2012 19:08:21 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EJ8LGU013601; Tue, 14 Feb 2012 19:08:21 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202141908.q1EJ8LGU013601@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 14 Feb 2012 19:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231700 - stable/9/sbin/hastd X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 19:08:22 -0000 Author: trociny Date: Tue Feb 14 19:08:21 2012 New Revision: 231700 URL: http://svn.freebsd.org/changeset/base/231700 Log: MFC r231525 (pjd): Nice range comparison. Modified: stable/9/sbin/hastd/rangelock.c Directory Properties: stable/9/sbin/hastd/ (props changed) Modified: stable/9/sbin/hastd/rangelock.c ============================================================================== --- stable/9/sbin/hastd/rangelock.c Tue Feb 14 18:57:10 2012 (r231699) +++ stable/9/sbin/hastd/rangelock.c Tue Feb 14 19:08:21 2012 (r231700) @@ -128,15 +128,13 @@ bool rangelock_islocked(struct rangelocks *rls, off_t offset, off_t length) { struct rlock *rl; + off_t end; PJDLOG_ASSERT(rls->rls_magic == RANGELOCKS_MAGIC); + end = offset + length; TAILQ_FOREACH(rl, &rls->rls_locks, rl_next) { - if (rl->rl_start >= offset && rl->rl_start < offset + length) - break; - else if (rl->rl_end > offset && rl->rl_end <= offset + length) - break; - else if (rl->rl_start < offset && rl->rl_end > offset + length) + if (rl->rl_start < end && rl->rl_end > offset) break; } return (rl != NULL); From owner-svn-src-stable-9@FreeBSD.ORG Tue Feb 14 19:36:36 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F7EF1065670; Tue, 14 Feb 2012 19:36:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A33D8FC16; Tue, 14 Feb 2012 19:36: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 q1EJaa3W014660; Tue, 14 Feb 2012 19:36:36 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EJaZte014636; Tue, 14 Feb 2012 19:36:35 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202141936.q1EJaZte014636@svn.freebsd.org> From: Dimitry Andric Date: Tue, 14 Feb 2012 19:36:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231702 - in stable/9: include/rpc include/rpcsvc lib/libc/rpc lib/libc/yp lib/librpcsvc lib/libypclnt libexec/ypxfr release/picobsd/tinyware/passwd sys/conf sys/modules/kgssapi sys/mod... X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 19:36:36 -0000 Author: dim Date: Tue Feb 14 19:36:35 2012 New Revision: 231702 URL: http://svn.freebsd.org/changeset/base/231702 Log: MFC r231118: Consistently set RPCGEN_CPP when running rpcgen, so the C preprocessor set via ${CPP} is used, instead of always using hardcoded /usr/bin/cpp. Modified: stable/9/include/rpc/Makefile stable/9/include/rpcsvc/Makefile stable/9/lib/libc/rpc/Makefile.inc stable/9/lib/libc/yp/Makefile.inc stable/9/lib/librpcsvc/Makefile stable/9/lib/libypclnt/Makefile stable/9/libexec/ypxfr/Makefile stable/9/release/picobsd/tinyware/passwd/Makefile stable/9/sys/conf/files stable/9/sys/modules/kgssapi/Makefile stable/9/sys/modules/kgssapi_krb5/Makefile stable/9/usr.sbin/amd/Makefile.inc stable/9/usr.sbin/bootparamd/bootparamd/Makefile stable/9/usr.sbin/bootparamd/callbootd/Makefile stable/9/usr.sbin/gssd/Makefile stable/9/usr.sbin/keyserv/Makefile stable/9/usr.sbin/rpc.lockd/Makefile stable/9/usr.sbin/rpc.statd/Makefile stable/9/usr.sbin/rpc.yppasswdd/Makefile stable/9/usr.sbin/rpc.ypupdated/Makefile stable/9/usr.sbin/rpc.ypxfrd/Makefile stable/9/usr.sbin/yppush/Makefile stable/9/usr.sbin/ypserv/Makefile Directory Properties: stable/9/include/ (props changed) stable/9/lib/libc/ (props changed) stable/9/lib/librpcsvc/ (props changed) stable/9/lib/libypclnt/ (props changed) stable/9/libexec/ypxfr/ (props changed) stable/9/release/picobsd/tinyware/passwd/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/usr.sbin/amd/ (props changed) stable/9/usr.sbin/bootparamd/ (props changed) stable/9/usr.sbin/gssd/ (props changed) stable/9/usr.sbin/keyserv/ (props changed) stable/9/usr.sbin/rpc.lockd/ (props changed) stable/9/usr.sbin/rpc.statd/ (props changed) stable/9/usr.sbin/rpc.yppasswdd/ (props changed) stable/9/usr.sbin/rpc.ypupdated/ (props changed) stable/9/usr.sbin/rpc.ypxfrd/ (props changed) stable/9/usr.sbin/yppush/ (props changed) stable/9/usr.sbin/ypserv/ (props changed) Modified: stable/9/include/rpc/Makefile ============================================================================== --- stable/9/include/rpc/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/include/rpc/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -3,7 +3,7 @@ .SUFFIXES: .x -RPCCOM = rpcgen -C +RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -C HDRS= rpcb_prot.h Modified: stable/9/include/rpcsvc/Makefile ============================================================================== --- stable/9/include/rpcsvc/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/include/rpcsvc/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -3,7 +3,7 @@ .SUFFIXES: .x -RPCCOM = rpcgen -C +RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -C HDRS= key_prot.h klm_prot.h mount.h nfs_prot.h nlm_prot.h rex.h rnusers.h \ rquota.h rstat.h rwall.h sm_inter.h spray.h yppasswd.h yp.h \ Modified: stable/9/lib/libc/rpc/Makefile.inc ============================================================================== --- stable/9/lib/libc/rpc/Makefile.inc Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/lib/libc/rpc/Makefile.inc Tue Feb 14 19:36:35 2012 (r231702) @@ -34,7 +34,7 @@ CFLAGS+= -I${.CURDIR}/rpc CLEANFILES+= crypt_clnt.c crypt_xdr.c crypt.h RPCDIR= ${DESTDIR}/usr/include/rpcsvc -RPCGEN= rpcgen -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C crypt_clnt.c: ${RPCDIR}/crypt.x crypt.h ${RPCGEN} -l -o ${.TARGET} ${RPCDIR}/crypt.x Modified: stable/9/lib/libc/yp/Makefile.inc ============================================================================== --- stable/9/lib/libc/yp/Makefile.inc Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/lib/libc/yp/Makefile.inc Tue Feb 14 19:36:35 2012 (r231702) @@ -10,7 +10,7 @@ CLEANFILES+= yp.h yp_xdr.c SYM_MAPS+= ${.CURDIR}/yp/Symbol.map RPCSRC= ${DESTDIR}/usr/include/rpcsvc/yp.x -RPCGEN= rpcgen -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C yp_xdr.c: ${RPCSRC} ${RPCGEN} -c -o ${.TARGET} ${RPCSRC} Modified: stable/9/lib/librpcsvc/Makefile ============================================================================== --- stable/9/lib/librpcsvc/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/lib/librpcsvc/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -18,7 +18,7 @@ SECRPCSRCS= secretkey.c xcrypt.c OTHERSRCS+= yp_passwd.c yp_update.c .endif -RPCCOM = rpcgen -C +RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -C INCDIRS= -I${DESTDIR}/usr/include/rpcsvc Modified: stable/9/lib/libypclnt/Makefile ============================================================================== --- stable/9/lib/libypclnt/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/lib/libypclnt/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -22,7 +22,7 @@ GENSRCS=yp.h \ yppasswd_private_clnt.c \ yppasswd_private_xdr.c -RPCGEN= rpcgen -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C RPCSRC= ${.CURDIR}/../../include/rpcsvc/yp.x RPCSRC_PW= ${.CURDIR}/../../include/rpcsvc/yppasswd.x RPCSRC_PRIV= ${.CURDIR}/../../usr.sbin/rpc.yppasswdd/yppasswd_private.x Modified: stable/9/libexec/ypxfr/Makefile ============================================================================== --- stable/9/libexec/ypxfr/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/libexec/ypxfr/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -22,7 +22,7 @@ LDADD= -lrpcsvc CLEANFILES= ${GENSRCS} RPCDIR= ${.CURDIR}/../../include/rpcsvc -RPCGEN= rpcgen -I -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -I -C ypxfr_clnt.c: ${RPCDIR}/yp.x rm -f ${.TARGET} Modified: stable/9/release/picobsd/tinyware/passwd/Makefile ============================================================================== --- stable/9/release/picobsd/tinyware/passwd/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/release/picobsd/tinyware/passwd/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -26,7 +26,7 @@ CFLAGS+= -DLOGIN_CAP -DCRYPT -I. -I${.CU CLEANFILES= ${GENSRCS} -RPCGEN= rpcgen -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C RPCSRC= ${DESTDIR}/usr/include/rpcsvc/yp.x RPCSRC_PW= ${DESTDIR}/usr/include/rpcsvc/yppasswd.x RPCSRC_PRIV= ${.CURDIR}/../../usr.sbin/rpc.yppasswdd/yppasswd_private.x Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/sys/conf/files Tue Feb 14 19:36:35 2012 (r231702) @@ -2461,17 +2461,17 @@ kern/vfs_vnops.c standard # gssd.h optional kgssapi \ dependency "$S/kgssapi/gssd.x" \ - compile-with "rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h" \ + compile-with "RPCGEN_CPP='${CPP}' rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h" \ no-obj no-implicit-rule before-depend local \ clean "gssd.h" gssd_xdr.c optional kgssapi \ dependency "$S/kgssapi/gssd.x gssd.h" \ - compile-with "rpcgen -c $S/kgssapi/gssd.x -o gssd_xdr.c" \ + compile-with "RPCGEN_CPP='${CPP}' rpcgen -c $S/kgssapi/gssd.x -o gssd_xdr.c" \ no-implicit-rule before-depend local \ clean "gssd_xdr.c" gssd_clnt.c optional kgssapi \ dependency "$S/kgssapi/gssd.x gssd.h" \ - compile-with "rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c" \ + compile-with "RPCGEN_CPP='${CPP}' rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c" \ no-implicit-rule before-depend local \ clean "gssd_clnt.c" kgssapi/gss_accept_sec_context.c optional kgssapi Modified: stable/9/sys/modules/kgssapi/Makefile ============================================================================== --- stable/9/sys/modules/kgssapi/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/sys/modules/kgssapi/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -44,12 +44,12 @@ CLEANFILES= gssd.h gssd_xdr.c gssd_clnt. S= ${.CURDIR}/../.. gssd.h: $S/kgssapi/gssd.x - rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h + RPCGEN_CPP=${CPP:Q} rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h gssd_xdr.c: $S/kgssapi/gssd.x - rpcgen -c $S/kgssapi/gssd.x -o gssd_xdr.c + RPCGEN_CPP=${CPP:Q} rpcgen -c $S/kgssapi/gssd.x -o gssd_xdr.c gssd_clnt.c: $S/kgssapi/gssd.x - rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c + RPCGEN_CPP=${CPP:Q} rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c .include Modified: stable/9/sys/modules/kgssapi_krb5/Makefile ============================================================================== --- stable/9/sys/modules/kgssapi_krb5/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/sys/modules/kgssapi_krb5/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -18,6 +18,6 @@ CLEANFILES= gssd.h S= ${.CURDIR}/../.. gssd.h: $S/kgssapi/gssd.x - rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h + RPCGEN_CPP=${CPP:Q} rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h .include Modified: stable/9/usr.sbin/amd/Makefile.inc ============================================================================== --- stable/9/usr.sbin/amd/Makefile.inc Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/amd/Makefile.inc Tue Feb 14 19:36:35 2012 (r231702) @@ -36,7 +36,7 @@ LIBAMUDIR= ${.CURDIR}/../libamu .endif LIBAMU= ${LIBAMUDIR}/libamu.a -RPCCOM= rpcgen +RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen MOUNT_X= ${DESTDIR}/usr/include/rpcsvc/mount.x NFS_PROT_X= ${DESTDIR}/usr/include/rpcsvc/nfs_prot.x Modified: stable/9/usr.sbin/bootparamd/bootparamd/Makefile ============================================================================== --- stable/9/usr.sbin/bootparamd/bootparamd/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/bootparamd/bootparamd/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -18,12 +18,12 @@ CLEANFILES= ${GENSRCS} RPCSRC= ${DESTDIR}/usr/include/rpcsvc/bootparam_prot.x bootparam_prot_svc.c: ${RPCSRC} - rpcgen -C -m -o ${.TARGET} ${RPCSRC} + RPCGEN_CPP=${CPP:Q} rpcgen -C -m -o ${.TARGET} ${RPCSRC} bootparam_prot_xdr.c: ${RPCSRC} - rpcgen -C -c -o ${.TARGET} ${RPCSRC} + RPCGEN_CPP=${CPP:Q} rpcgen -C -c -o ${.TARGET} ${RPCSRC} bootparam_prot.h: ${RPCSRC} - rpcgen -C -h -o ${.TARGET} ${RPCSRC} + RPCGEN_CPP=${CPP:Q} rpcgen -C -h -o ${.TARGET} ${RPCSRC} .include Modified: stable/9/usr.sbin/bootparamd/callbootd/Makefile ============================================================================== --- stable/9/usr.sbin/bootparamd/callbootd/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/bootparamd/callbootd/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -13,12 +13,12 @@ CLEANFILES= ${GENSRCS} RPCSRC= ${DESTDIR}/usr/include/rpcsvc/bootparam_prot.x bootparam_prot_clnt.c: ${RPCSRC} - rpcgen -C -l -o ${.TARGET} ${RPCSRC} + RPCGEN_CPP=${CPP:Q} rpcgen -C -l -o ${.TARGET} ${RPCSRC} bootparam_prot_xdr.c: ${RPCSRC} - rpcgen -C -c -o ${.TARGET} ${RPCSRC} + RPCGEN_CPP=${CPP:Q} rpcgen -C -c -o ${.TARGET} ${RPCSRC} bootparam_prot.h: ${RPCSRC} - rpcgen -C -h -o ${.TARGET} ${RPCSRC} + RPCGEN_CPP=${CPP:Q} rpcgen -C -h -o ${.TARGET} ${RPCSRC} .include Modified: stable/9/usr.sbin/gssd/Makefile ============================================================================== --- stable/9/usr.sbin/gssd/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/gssd/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -13,7 +13,7 @@ LDADD= -lgssapi CLEANFILES= gssd_svc.c gssd.h RPCSRC= ${.CURDIR}/../../sys/kgssapi/gssd.x -RPCGEN= rpcgen -L -C -M +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C -M gssd_svc.c: ${RPCSRC} gssd.h ${RPCGEN} -m -o ${.TARGET} ${RPCSRC} Modified: stable/9/usr.sbin/keyserv/Makefile ============================================================================== --- stable/9/usr.sbin/keyserv/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/keyserv/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -15,7 +15,7 @@ RPCDIR= ${DESTDIR}/usr/include/rpcsvc CLEANFILES= crypt_svc.c crypt.h -RPCGEN= rpcgen -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C crypt_svc.c: ${RPCDIR}/crypt.x ${RPCGEN} -m -o ${.TARGET} ${RPCDIR}/crypt.x Modified: stable/9/usr.sbin/rpc.lockd/Makefile ============================================================================== --- stable/9/usr.sbin/rpc.lockd/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/rpc.lockd/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -15,7 +15,7 @@ LDADD= -lrpcsvc -lutil CLEANFILES= nlm_prot_svc.c nlm_prot.h test RPCSRC= ${DESTDIR}/usr/include/rpcsvc/nlm_prot.x -RPCGEN= rpcgen -L -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C nlm_prot_svc.c: ${RPCSRC} ${RPCGEN} -m -o ${.TARGET} ${RPCSRC} Modified: stable/9/usr.sbin/rpc.statd/Makefile ============================================================================== --- stable/9/usr.sbin/rpc.statd/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/rpc.statd/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -13,7 +13,7 @@ LDADD= -lrpcsvc CLEANFILES= sm_inter_svc.c sm_inter.h RPCSRC= ${DESTDIR}/usr/include/rpcsvc/sm_inter.x -RPCGEN= rpcgen -L -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C sm_inter_svc.c: ${RPCSRC} ${RPCGEN} -m -o ${.TARGET} ${RPCSRC} Modified: stable/9/usr.sbin/rpc.yppasswdd/Makefile ============================================================================== --- stable/9/usr.sbin/rpc.yppasswdd/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/rpc.yppasswdd/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -25,7 +25,7 @@ LDADD= -lrpcsvc -lcrypt -lutil CLEANFILES= ${GENSRCS} -RPCGEN= rpcgen -I -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -I -C # We need to remove the 'static' keyword from _rpcsvcstate so that # yppasswdd_main.c can see it. Modified: stable/9/usr.sbin/rpc.ypupdated/Makefile ============================================================================== --- stable/9/usr.sbin/rpc.ypupdated/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/rpc.ypupdated/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -19,7 +19,7 @@ LDADD= -lrpcsvc CLEANFILES= ypupdate_prot_svc.c ypupdate_prot.h RPCDIR= ${DESTDIR}/usr/include/rpcsvc -RPCGEN= rpcgen -I -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -I -C # We need to remove the 'static' keyword from _rpcsvcstate so that # ypupdated_main.c can see it. Modified: stable/9/usr.sbin/rpc.ypxfrd/Makefile ============================================================================== --- stable/9/usr.sbin/rpc.ypxfrd/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/rpc.ypxfrd/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -17,7 +17,7 @@ LDADD= -lrpcsvc CLEANFILES= ypxfrd_svc.c ypxfrd.h RPCDIR= ${.CURDIR}/../../include/rpcsvc -RPCGEN= rpcgen -I -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -I -C # We need to remove the 'static' keyword from _rpcsvcstate so that # ypxfrd_main.c can see it. Modified: stable/9/usr.sbin/yppush/Makefile ============================================================================== --- stable/9/usr.sbin/yppush/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/yppush/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -14,7 +14,7 @@ CFLAGS+= -I. -I${.CURDIR}/../../libexec/ WARNS?= 2 -RPCGEN= rpcgen -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C CLEANFILES= ${GENSRCS} Modified: stable/9/usr.sbin/ypserv/Makefile ============================================================================== --- stable/9/usr.sbin/ypserv/Makefile Tue Feb 14 19:09:01 2012 (r231701) +++ stable/9/usr.sbin/ypserv/Makefile Tue Feb 14 19:36:35 2012 (r231702) @@ -17,7 +17,7 @@ LDADD= -lwrap CLEANFILES= yp_svc.c ypxfr_clnt.c yp.h -RPCGEN= rpcgen -I -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -I -C # We need to remove the 'static' keyword from _rpcsvcstate so that # yp_main.c can see it. From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 01:39:05 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35AFF1065670; Wed, 15 Feb 2012 01:39:05 +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 1E8C38FC0A; Wed, 15 Feb 2012 01:39: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 q1F1d5IQ028816; Wed, 15 Feb 2012 01:39:05 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F1d4Lh028803; Wed, 15 Feb 2012 01:39:04 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201202150139.q1F1d4Lh028803@svn.freebsd.org> From: Glen Barber Date: Wed, 15 Feb 2012 01:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231718 - in stable/9/share/man: man4 man5 man7 man9 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 01:39:05 -0000 Author: gjb (doc committer) Date: Wed Feb 15 01:39:04 2012 New Revision: 231718 URL: http://svn.freebsd.org/changeset/base/231718 Log: MFC r231244: - Fix some Xr references: - - ada(4): ad(4) - removed, ada(4) would be a self-referencing entry - - cd(4): ad(4) -> ada(4) - - da(4): ad(4) -> ada(4) - - DEVICE_PROBE(9): ugen(5) -> ugen(4) - - ed(4): dhclinet(8) -> dhclient(8) (typo) - - lmc(4): Netgraph(4) -> netgraph(4) - - security(7): rc.conf(8) -> rc.conf(5) - - sfxge(4): cpuset(8) -> cpuset(1) - - sbp(4): sysctl(1) -> sysctl(8) - - portindex(5): build(1) -> build(7) - - u3g(4): usbconfig(5) -> usbconfig(8) - - usb_quirk(4): usbconfig(5) -> usbconfig(8) Modified: stable/9/share/man/man4/ada.4 stable/9/share/man/man4/cd.4 stable/9/share/man/man4/da.4 stable/9/share/man/man4/ed.4 stable/9/share/man/man4/lmc.4 stable/9/share/man/man4/sbp.4 stable/9/share/man/man4/sfxge.4 stable/9/share/man/man4/u3g.4 stable/9/share/man/man4/usb_quirk.4 stable/9/share/man/man5/portindex.5 stable/9/share/man/man7/security.7 stable/9/share/man/man9/DEVICE_PROBE.9 Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/share/man/man5/ (props changed) stable/9/share/man/man7/ (props changed) stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man4/ada.4 ============================================================================== --- stable/9/share/man/man4/ada.4 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man4/ada.4 Wed Feb 15 01:39:04 2012 (r231718) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 8, 2011 +.Dd February 8, 2012 .Dt ADA 4 .Os .Sh NAME @@ -139,7 +139,6 @@ The per-device default is to leave it as ATA device nodes .El .Sh SEE ALSO -.Xr ad 4 , .Xr ahci 4 , .Xr cam 4 , .Xr da 4 , Modified: stable/9/share/man/man4/cd.4 ============================================================================== --- stable/9/share/man/man4/cd.4 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man4/cd.4 Wed Feb 15 01:39:04 2012 (r231718) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 2009 +.Dd February 8, 2012 .Dt CD 4 .Os .Sh NAME @@ -52,7 +52,7 @@ but it will only last until the .Tn CD-ROM is unmounted. In general the interfaces are similar to those described by -.Xr ad 4 +.Xr ada 4 and .Xr da 4 . .Pp Modified: stable/9/share/man/man4/da.4 ============================================================================== --- stable/9/share/man/man4/da.4 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man4/da.4 Wed Feb 15 01:39:04 2012 (r231718) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 2, 2003 +.Dd February 8, 2012 .Dt DA 4 .Os .Sh NAME @@ -195,7 +195,7 @@ SCSI disk device nodes .Sh DIAGNOSTICS None. .Sh SEE ALSO -.Xr ad 4 , +.Xr ada 4 , .Xr cam 4 , .Xr geom 4 , .Xr bsdlabel 8 , Modified: stable/9/share/man/man4/ed.4 ============================================================================== --- stable/9/share/man/man4/ed.4 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man4/ed.4 Wed Feb 15 01:39:04 2012 (r231718) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 9, 2009 +.Dd February 8, 2012 .Dt ED 4 .Os .Sh NAME @@ -431,7 +431,7 @@ Some devices supported by do not generate the link state change events used by .Xr devd 8 to start -.Xr dhclinet 8 . +.Xr dhclient 8 . If you have problems with .Xr dhclient 8 not starting and the device is always attached to the network it may Modified: stable/9/share/man/man4/lmc.4 ============================================================================== --- stable/9/share/man/man4/lmc.4 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man4/lmc.4 Wed Feb 15 01:39:04 2012 (r231718) @@ -43,7 +43,7 @@ .\" this program; if not, write to the Free Software Foundation, Inc., 59 .\" Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\" -.Dd July 23, 2011 +.Dd February 8, 2012 .Dt LMC 4 .Os .\" @@ -179,7 +179,7 @@ higher-level issues like protocol multip This driver is compatible with several line protocol packages: .Bl -tag -width "Generic HDLC" .It Sy "Netgraph" -.Xr Netgraph 4 +.Xr netgraph 4 implements many basic packet-handling functions as kernel loadable modules. They can be interconnected in a graph to implement many protocols. Configuration is done from userland without rebuilding the kernel. Modified: stable/9/share/man/man4/sbp.4 ============================================================================== --- stable/9/share/man/man4/sbp.4 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man4/sbp.4 Wed Feb 15 01:39:04 2012 (r231718) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2002 +.Dd February 8, 2012 .Dt SBP 4 .Os .Sh NAME @@ -71,7 +71,7 @@ topology. If you want to force to detach the device, run .Dq Nm fwcontrol Fl r several times or set hw.firewire.hold_count=0 by -.Xr sysctl 1 . +.Xr sysctl 8 . .Pp Some (broken) HDDs do not work well with tagged queuing. If you have problems with such drives, try Modified: stable/9/share/man/man4/sfxge.4 ============================================================================== --- stable/9/share/man/man4/sfxge.4 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man4/sfxge.4 Wed Feb 15 01:39:04 2012 (r231718) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 16, 2011 +.Dd February 8, 2012 .Dt SFXGE 4 .Os .Sh NAME @@ -57,7 +57,7 @@ and Receive Side Scaling (RSS) using MSI The driver allocates 1 receive queue, transmit queue, event queue and IRQ per CPU up to a maximum of 64. IRQ affinities should be spread out using -.Xr cpuset 8 . +.Xr cpuset 1 . Interrupt moderation may be controlled through the sysctl .Va dev.sfxge.%d.int_mod (units are microseconds). @@ -85,7 +85,7 @@ go to the Solarflare support website at: .Xr netintro 4 , .Xr ng_ether 4 , .Xr vlan 4 , -.Xr cpuset 8 , +.Xr cpuset 1 , .Xr ifconfig 8 .Sh AUTHORS The Modified: stable/9/share/man/man4/u3g.4 ============================================================================== --- stable/9/share/man/man4/u3g.4 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man4/u3g.4 Wed Feb 15 01:39:04 2012 (r231718) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 7, 2008 +.Dd February 8, 2012 .Dt U3G 4 .Os .Sh NAME @@ -86,7 +86,7 @@ driver is present which contains Windows The device starts up in disk mode (TruInstall, ZeroCD, etc.) and requires additional commands to switch it to modem mode. If your device is not switching automatically, please try to add quirks. See -.Xr usbconfig 5 +.Xr usbconfig 8 and .Xr usb_quirk 4 . .Pp @@ -95,7 +95,7 @@ and .Xr ucom 4 , .Xr usb 4 , .Xr usb_quirk 4 , -.Xr usbconfig 5 +.Xr usbconfig 8 .Sh HISTORY The .Nm Modified: stable/9/share/man/man4/usb_quirk.4 ============================================================================== --- stable/9/share/man/man4/usb_quirk.4 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man4/usb_quirk.4 Wed Feb 15 01:39:04 2012 (r231718) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 27, 2011 +.Dd February 8, 2012 .Dt USB_QUIRK 4 .Os .Sh NAME @@ -41,7 +41,7 @@ The .Nm module provides support for dynamically adding and removing quirks for USB devices with -.Xr usbconfig 5 . +.Xr usbconfig 8 . .Sh General quirks: .Bl -tag -width Ds .It UQ_AUDIO_SWAP_LR @@ -183,7 +183,7 @@ device which appears as a USB device on usbconfig -d ugen0.3 add_quirk UQ_MSC_EJECT_WAIT .Ed .Sh SEE ALSO -.Xr usbconfig 5 +.Xr usbconfig 8 .Sh HISTORY The .Nm Modified: stable/9/share/man/man5/portindex.5 ============================================================================== --- stable/9/share/man/man5/portindex.5 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man5/portindex.5 Wed Feb 15 01:39:04 2012 (r231718) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 28, 2009 +.Dd February 8, 2012 .Dt PORTINDEX 5 .Os .Sh NAME @@ -90,7 +90,7 @@ branch. vim-6.3.15|/usr/ports/editors/vim|/usr/local|Vi "workalike", with many additional features|/usr/ports/editors/vim/pkg-descr|obrien@FreeBSD.org|editors|libiconv-1.9.2_1|libiconv-1.9.2_1|http://www.vim.org/||| .Ed .Sh SEE ALSO -.Xr build 1 , +.Xr build 7 , .Xr csup 1 , .Xr ports 7 .Sh AUTHORS Modified: stable/9/share/man/man7/security.7 ============================================================================== --- stable/9/share/man/man7/security.7 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man7/security.7 Wed Feb 15 01:39:04 2012 (r231718) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2010 +.Dd February 8, 2012 .Dt SECURITY 7 .Os .Sh NAME @@ -573,7 +573,7 @@ configuration cannot be adjusted. .El .Pp The security level can be configured with variables documented in -.Xr rc.conf 8 . +.Xr rc.conf 5 . .Sh CHECKING FILE INTEGRITY: BINARIES, CONFIG FILES, ETC When it comes right down to it, you can only protect your core system configuration and control files so much before the convenience factor Modified: stable/9/share/man/man9/DEVICE_PROBE.9 ============================================================================== --- stable/9/share/man/man9/DEVICE_PROBE.9 Tue Feb 14 22:49:34 2012 (r231717) +++ stable/9/share/man/man9/DEVICE_PROBE.9 Wed Feb 15 01:39:04 2012 (r231718) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2008 +.Dd February 8, 2012 .Dt DEVICE_PROBE 9 .Os .Sh NAME @@ -120,7 +120,7 @@ treatment for some reason. .It BUS_PROBE_HOOVER The driver matches all unclaimed devices on a bus. The -.Xr ugen 5 +.Xr ugen 4 device is one example. .It BUS_PROBE_NOWILDCARD The driver expects its parent to tell it which children to manage From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 01:53:00 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45374106566B; Wed, 15 Feb 2012 01:53:00 +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 14DB88FC08; Wed, 15 Feb 2012 01:53: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 q1F1qxPu029476; Wed, 15 Feb 2012 01:52:59 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F1qxGD029472; Wed, 15 Feb 2012 01:52:59 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201202150152.q1F1qxGD029472@svn.freebsd.org> From: Glen Barber Date: Wed, 15 Feb 2012 01:52:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231721 - in stable/9: etc/defaults etc/periodic/daily share/man/man5 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 01:53:00 -0000 Author: gjb (doc committer) Date: Wed Feb 15 01:52:59 2012 New Revision: 231721 URL: http://svn.freebsd.org/changeset/base/231721 Log: MFC r231171: - Add an option to 404.status-zfs (enabled by default) to list all zfs pools on the system. - While here, document daily_status_zfs_enable in periodic.conf(5). Approved by: jhb Modified: stable/9/etc/defaults/periodic.conf stable/9/etc/periodic/daily/404.status-zfs stable/9/share/man/man5/periodic.conf.5 Directory Properties: stable/9/etc/ (props changed) stable/9/share/man/man5/ (props changed) Modified: stable/9/etc/defaults/periodic.conf ============================================================================== --- stable/9/etc/defaults/periodic.conf Wed Feb 15 01:41:00 2012 (r231720) +++ stable/9/etc/defaults/periodic.conf Wed Feb 15 01:52:59 2012 (r231721) @@ -96,6 +96,7 @@ daily_status_disks_df_flags="-l -h" # d # 404.status-zfs daily_status_zfs_enable="NO" # Check ZFS +daily_status_zfs_zpool_list_enable="YES" # List ZFS pools # 405.status-ata_raid daily_status_ata_raid_enable="NO" # Check ATA raid status Modified: stable/9/etc/periodic/daily/404.status-zfs ============================================================================== --- stable/9/etc/periodic/daily/404.status-zfs Wed Feb 15 01:41:00 2012 (r231720) +++ stable/9/etc/periodic/daily/404.status-zfs Wed Feb 15 01:52:59 2012 (r231721) @@ -16,12 +16,21 @@ case "$daily_status_zfs_enable" in echo echo 'Checking status of zfs pools:' - out=`zpool status -x` - echo "$out" + case "$daily_status_zfs_zpool_list_enable" in + [Yy][Ee][Ss]) + lout=`zpool list` + echo "$lout" + echo + ;; + *) + ;; + esac + sout=`zpool status -x` + echo "$sout" # zpool status -x always exits with 0, so we have to interpret its # output to see what's going on. - if [ "$out" = "all pools are healthy" \ - -o "$out" = "no pools available" ]; then + if [ "$sout" = "all pools are healthy" \ + -o "$sout" = "no pools available" ]; then rc=0 else rc=1 Modified: stable/9/share/man/man5/periodic.conf.5 ============================================================================== --- stable/9/share/man/man5/periodic.conf.5 Wed Feb 15 01:41:00 2012 (r231720) +++ stable/9/share/man/man5/periodic.conf.5 Wed Feb 15 01:52:59 2012 (r231721) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 8, 2011 +.Dd February 7, 2012 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -335,6 +335,28 @@ utility when .Va daily_status_disks_enable is set to .Dq Li YES . +.It Va daily_status_zfs_enable +.Pq Vt bool +Set to +.Dq Li YES +if you want to run +.Nm zpool Cm status +on your +.Xr zfs 8 +pools. +.It Va daily_status_zfs_zpool_list_enable +.Pq Vt bool +Set to +.Dq Li YES +if you want to run +.Nm zpool Cm list +on your +.Xr zfs 8 +pools. +Requires +.Va daily_status_zfs_enable +to be set to +.Li YES . .It Va daily_status_ata_raid_enable .Pq Vt bool Set to From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 03:33:48 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC0151065672; Wed, 15 Feb 2012 03:33:48 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C9BD8FC14; Wed, 15 Feb 2012 03:33: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 q1F3Xmgj033306; Wed, 15 Feb 2012 03:33:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F3XmVV033304; Wed, 15 Feb 2012 03:33:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150333.q1F3XmVV033304@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 03:33:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231725 - stable/9/sys/dev/et X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 03:33:48 -0000 Author: yongari Date: Wed Feb 15 03:33:48 2012 New Revision: 231725 URL: http://svn.freebsd.org/changeset/base/231725 Log: MFC r229940: style. No functional changes. Modified: stable/9/sys/dev/et/if_et.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/et/if_et.c ============================================================================== --- stable/9/sys/dev/et/if_et.c Wed Feb 15 02:59:17 2012 (r231724) +++ stable/9/sys/dev/et/if_et.c Wed Feb 15 03:33:48 2012 (r231725) @@ -363,8 +363,9 @@ fail: static int et_detach(device_t dev) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; + sc = device_get_softc(dev); if (device_is_attached(dev)) { ether_ifdetach(sc->ifp); ET_LOCK(sc); @@ -401,8 +402,9 @@ et_detach(device_t dev) static int et_shutdown(device_t dev) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; + sc = device_get_softc(dev); ET_LOCK(sc); et_stop(sc); ET_UNLOCK(sc); @@ -412,10 +414,11 @@ et_shutdown(device_t dev) static int et_miibus_readreg(device_t dev, int phy, int reg) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; uint32_t val; int i, ret; + sc = device_get_softc(dev); /* Stop any pending operations */ CSR_WRITE_4(sc, ET_MII_CMD, 0); @@ -455,10 +458,11 @@ back: static int et_miibus_writereg(device_t dev, int phy, int reg, int val0) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; uint32_t val; int i; + sc = device_get_softc(dev); /* Stop any pending operations */ CSR_WRITE_4(sc, ET_MII_CMD, 0); @@ -593,10 +597,12 @@ et_miibus_statchg(device_t dev) static int et_ifmedia_upd_locked(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct et_softc *sc; + struct mii_data *mii; struct mii_softc *miisc; + sc = ifp->if_softc; + mii = device_get_softc(sc->sc_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); return (mii_mediachg(mii)); @@ -605,9 +611,10 @@ et_ifmedia_upd_locked(struct ifnet *ifp) static int et_ifmedia_upd(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; int res; + sc = ifp->if_softc; ET_LOCK(sc); res = et_ifmedia_upd_locked(ifp); ET_UNLOCK(sc); @@ -638,10 +645,11 @@ et_ifmedia_sts(struct ifnet *ifp, struct static void et_stop(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; + struct ifnet *ifp; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; callout_stop(&sc->sc_tick); /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); @@ -757,6 +765,7 @@ et_get_eaddr(device_t dev, uint8_t eaddr static void et_reset(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_MAC_CFG1, ET_MAC_CFG1_RST_TXFUNC | ET_MAC_CFG1_RST_RXFUNC | ET_MAC_CFG1_RST_TXMC | ET_MAC_CFG1_RST_RXMC | @@ -1163,10 +1172,11 @@ et_chip_attach(struct et_softc *sc) static void et_intr(void *xsc) { - struct et_softc *sc = xsc; + struct et_softc *sc; struct ifnet *ifp; uint32_t status; + sc = xsc; ET_LOCK(sc); ifp = sc->ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -1268,10 +1278,14 @@ et_init(void *xsc) static int et_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); - struct ifreq *ifr = (struct ifreq *)data; - int error = 0, mask, max_framelen; + struct et_softc *sc; + struct mii_data *mii; + struct ifreq *ifr; + int error, mask, max_framelen; + + sc = ifp->if_softc; + ifr = (struct ifreq *)data; + error = 0; /* XXX LOCKSUSED */ switch (cmd) { @@ -1295,6 +1309,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, case SIOCSIFMEDIA: case SIOCGIFMEDIA: + mii = device_get_softc(sc->sc_miibus); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); break; @@ -1424,8 +1439,9 @@ et_start_locked(struct ifnet *ifp) static void et_start(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; + sc = ifp->if_softc; ET_LOCK(sc); et_start_locked(ifp); ET_UNLOCK(sc); @@ -1456,6 +1472,7 @@ et_watchdog(struct et_softc *sc) static int et_stop_rxdma(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_RXDMA_CTRL, ET_RXDMA_CTRL_HALT | ET_RXDMA_CTRL_RING1_ENABLE); @@ -1470,6 +1487,7 @@ et_stop_rxdma(struct et_softc *sc) static int et_stop_txdma(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_TXDMA_CTRL, ET_TXDMA_CTRL_HALT | ET_TXDMA_CTRL_SINGLE_EPKT); return (0); @@ -1598,10 +1616,11 @@ back: static int et_chip_init(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; + struct ifnet *ifp; uint32_t rxq_end; int error, frame_len, rxmem_size; + ifp = sc->ifp; /* * Split 16Kbytes internal memory between TX and RX * according to frame length. @@ -1716,8 +1735,8 @@ et_init_rx_ring(struct et_softc *sc) static int et_init_rxdma(struct et_softc *sc) { - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; + struct et_rxstatus_data *rxsd; + struct et_rxstat_ring *rxst_ring; struct et_rxdesc_ring *rx_ring; int error; @@ -1730,12 +1749,14 @@ et_init_rxdma(struct et_softc *sc) /* * Install RX status */ + rxsd = &sc->sc_rx_status; CSR_WRITE_4(sc, ET_RX_STATUS_HI, ET_ADDR_HI(rxsd->rxsd_paddr)); CSR_WRITE_4(sc, ET_RX_STATUS_LO, ET_ADDR_LO(rxsd->rxsd_paddr)); /* * Install RX stat ring */ + rxst_ring = &sc->sc_rxstat_ring; CSR_WRITE_4(sc, ET_RXSTAT_HI, ET_ADDR_HI(rxst_ring->rsr_paddr)); CSR_WRITE_4(sc, ET_RXSTAT_LO, ET_ADDR_LO(rxst_ring->rsr_paddr)); CSR_WRITE_4(sc, ET_RXSTAT_CNT, ET_RX_NSTAT - 1); @@ -1786,8 +1807,8 @@ et_init_rxdma(struct et_softc *sc) static int et_init_txdma(struct et_softc *sc) { - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; + struct et_txdesc_ring *tx_ring; + struct et_txstatus_data *txsd; int error; error = et_stop_txdma(sc); @@ -1799,6 +1820,7 @@ et_init_txdma(struct et_softc *sc) /* * Install TX descriptor ring */ + tx_ring = &sc->sc_tx_ring; CSR_WRITE_4(sc, ET_TX_RING_HI, ET_ADDR_HI(tx_ring->tr_paddr)); CSR_WRITE_4(sc, ET_TX_RING_LO, ET_ADDR_LO(tx_ring->tr_paddr)); CSR_WRITE_4(sc, ET_TX_RING_CNT, ET_TX_NDESC - 1); @@ -1806,6 +1828,7 @@ et_init_txdma(struct et_softc *sc) /* * Install TX status */ + txsd = &sc->sc_tx_status; CSR_WRITE_4(sc, ET_TX_STATUS_HI, ET_ADDR_HI(txsd->txsd_paddr)); CSR_WRITE_4(sc, ET_TX_STATUS_LO, ET_ADDR_LO(txsd->txsd_paddr)); @@ -1821,8 +1844,8 @@ et_init_txdma(struct et_softc *sc) static void et_init_mac(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const uint8_t *eaddr = IF_LLADDR(ifp); + struct ifnet *ifp; + const uint8_t *eaddr; uint32_t val; /* Reset MAC */ @@ -1858,6 +1881,8 @@ et_init_mac(struct et_softc *sc) /* * Set MAC address */ + ifp = sc->ifp; + eaddr = IF_LLADDR(ifp); val = eaddr[2] | (eaddr[3] << 8) | (eaddr[4] << 16) | (eaddr[5] << 24); CSR_WRITE_4(sc, ET_MAC_ADDR1, val); val = (eaddr[0] << 16) | (eaddr[1] << 24); @@ -1873,8 +1898,8 @@ et_init_mac(struct et_softc *sc) static void et_init_rxmac(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const uint8_t *eaddr = IF_LLADDR(ifp); + struct ifnet *ifp; + const uint8_t *eaddr; uint32_t val; int i; @@ -1892,6 +1917,8 @@ et_init_rxmac(struct et_softc *sc) /* * Set WOL source address. XXX is this necessary? */ + ifp = sc->ifp; + eaddr = IF_LLADDR(ifp); val = (eaddr[2] << 24) | (eaddr[3] << 16) | (eaddr[4] << 8) | eaddr[5]; CSR_WRITE_4(sc, ET_WOL_SA_LO, val); val = (eaddr[0] << 8) | eaddr[1]; @@ -1958,6 +1985,7 @@ et_init_rxmac(struct et_softc *sc) static void et_init_txmac(struct et_softc *sc) { + /* Disable TX MAC and FC(?) */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, ET_TXMAC_CTRL_FC_DISABLE); @@ -1976,12 +2004,12 @@ et_init_txmac(struct et_softc *sc) static int et_start_rxdma(struct et_softc *sc) { - uint32_t val = 0; + uint32_t val; - val |= (sc->sc_rx_data[0].rbd_bufsize & ET_RXDMA_CTRL_RING0_SIZE_MASK) | - ET_RXDMA_CTRL_RING0_ENABLE; + val = (sc->sc_rx_data[0].rbd_bufsize & ET_RXDMA_CTRL_RING0_SIZE_MASK) | + ET_RXDMA_CTRL_RING0_ENABLE; val |= (sc->sc_rx_data[1].rbd_bufsize & ET_RXDMA_CTRL_RING1_SIZE_MASK) | - ET_RXDMA_CTRL_RING1_ENABLE; + ET_RXDMA_CTRL_RING1_ENABLE; CSR_WRITE_4(sc, ET_RXDMA_CTRL, val); @@ -1997,6 +2025,7 @@ et_start_rxdma(struct et_softc *sc) static int et_start_txdma(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_TXDMA_CTRL, ET_TXDMA_CTRL_SINGLE_EPKT); return (0); } @@ -2274,10 +2303,11 @@ et_txeof(struct et_softc *sc) static void et_tick(void *xsc) { - struct et_softc *sc = xsc; + struct et_softc *sc; struct ifnet *ifp; struct mii_data *mii; + sc = xsc; ET_LOCK_ASSERT(sc); ifp = sc->ifp; mii = device_get_softc(sc->sc_miibus); @@ -2539,10 +2569,12 @@ et_add_sysctls(struct et_softc * sc) static int et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_ARGS) { - struct et_softc *sc = arg1; - struct ifnet *ifp = sc->ifp; - int error = 0, v; + struct et_softc *sc; + struct ifnet *ifp; + int error, v; + sc = arg1; + ifp = sc->ifp; v = sc->sc_rx_intr_npkts; error = sysctl_handle_int(oidp, &v, 0, req); if (error || req->newptr == NULL) @@ -2564,10 +2596,12 @@ back: static int et_sysctl_rx_intr_delay(SYSCTL_HANDLER_ARGS) { - struct et_softc *sc = arg1; - struct ifnet *ifp = sc->ifp; - int error = 0, v; + struct et_softc *sc; + struct ifnet *ifp; + int error, v; + sc = arg1; + ifp = sc->ifp; v = sc->sc_rx_intr_delay; error = sysctl_handle_int(oidp, &v, 0, req); if (error || req->newptr == NULL) From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 03:41:49 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97561106566C; Wed, 15 Feb 2012 03:41:49 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81C698FC14; Wed, 15 Feb 2012 03:41:49 +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 q1F3fnYq033738; Wed, 15 Feb 2012 03:41:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F3fnNG033736; Wed, 15 Feb 2012 03:41:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150341.q1F3fnNG033736@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 03:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231728 - stable/9/sys/dev/re X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 03:41:49 -0000 Author: yongari Date: Wed Feb 15 03:41:48 2012 New Revision: 231728 URL: http://svn.freebsd.org/changeset/base/231728 Log: MFC r230575-230576: r230275: Use a RX DMA tag to free loaded RX DMA maps. Previously it used a TX DMA tag. r230276: Free allocated jumbo buffers when controller is stopped. Modified: stable/9/sys/dev/re/if_re.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/re/if_re.c ============================================================================== --- stable/9/sys/dev/re/if_re.c Wed Feb 15 03:35:39 2012 (r231727) +++ stable/9/sys/dev/re/if_re.c Wed Feb 15 03:41:48 2012 (r231728) @@ -3515,7 +3515,6 @@ re_stop(struct rl_softc *sc) } /* Free the TX list buffers. */ - for (i = 0; i < sc->rl_ldata.rl_tx_desc_cnt; i++) { txd = &sc->rl_ldata.rl_tx_desc[i]; if (txd->tx_m != NULL) { @@ -3529,11 +3528,10 @@ re_stop(struct rl_softc *sc) } /* Free the RX list buffers. */ - for (i = 0; i < sc->rl_ldata.rl_rx_desc_cnt; i++) { rxd = &sc->rl_ldata.rl_rx_desc[i]; if (rxd->rx_m != NULL) { - bus_dmamap_sync(sc->rl_ldata.rl_tx_mtag, + bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->rl_ldata.rl_rx_mtag, rxd->rx_dmamap); @@ -3541,6 +3539,20 @@ re_stop(struct rl_softc *sc) rxd->rx_m = NULL; } } + + if ((sc->rl_flags & RL_FLAG_JUMBOV2) != 0) { + for (i = 0; i < sc->rl_ldata.rl_rx_desc_cnt; i++) { + rxd = &sc->rl_ldata.rl_jrx_desc[i]; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(sc->rl_ldata.rl_jrx_mtag, + rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->rl_ldata.rl_jrx_mtag, + rxd->rx_dmamap); + m_freem(rxd->rx_m); + rxd->rx_m = NULL; + } + } + } } /* From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 03:48:23 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 148F6106566B; Wed, 15 Feb 2012 03:48:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F30B98FC1B; Wed, 15 Feb 2012 03:48:22 +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 q1F3mMcO034094; Wed, 15 Feb 2012 03:48:22 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F3mMxP034092; Wed, 15 Feb 2012 03:48:22 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150348.q1F3mMxP034092@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 03:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231731 - stable/9/sys/dev/re X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 03:48:23 -0000 Author: yongari Date: Wed Feb 15 03:48:22 2012 New Revision: 231731 URL: http://svn.freebsd.org/changeset/base/231731 Log: MFC r230336: Fix a logic error which resulted in putting PHY into sleep when WOL is active. If WOL is active driver should not put PHY into sleep. This change makes WOL work on RTL8168E. Modified: stable/9/sys/dev/re/if_re.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/re/if_re.c ============================================================================== --- stable/9/sys/dev/re/if_re.c Wed Feb 15 03:43:46 2012 (r231730) +++ stable/9/sys/dev/re/if_re.c Wed Feb 15 03:48:22 2012 (r231731) @@ -3765,7 +3765,7 @@ re_setwol(struct rl_softc *sc) /* Config register write done. */ CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - if ((ifp->if_capenable & IFCAP_WOL) != 0 && + if ((ifp->if_capenable & IFCAP_WOL) == 0 && (sc->rl_flags & RL_FLAG_PHYWAKE_PM) != 0) CSR_WRITE_1(sc, RL_PMCH, CSR_READ_1(sc, RL_PMCH) & ~0x80); /* From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 04:02:42 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C5941065670; Wed, 15 Feb 2012 04:02:42 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BA7E8FC15; Wed, 15 Feb 2012 04:02: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 q1F42fjA034846; Wed, 15 Feb 2012 04:02:41 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F42f6u034843; Wed, 15 Feb 2012 04:02:41 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150402.q1F42f6u034843@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 04:02:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231734 - stable/9/sys/dev/bge X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 04:02:42 -0000 Author: yongari Date: Wed Feb 15 04:02:41 2012 New Revision: 231734 URL: http://svn.freebsd.org/changeset/base/231734 Log: MFC r230286,230337-230338,231159: r230286: Introduce a tunable that disables use of MSI. Non-zero value will use INTx. r230337-230338: Rename dev.bge.%d.msi_disable to dev.bge.%d.msi which matches enable/disable and default it to on. r231159: Call bge_add_sysctls() early and especially before bge_can_use_msi() so r230337 actually has a chance of working and doesn't always unconditionally disable the use of MSIs. Modified: stable/9/sys/dev/bge/if_bge.c stable/9/sys/dev/bge/if_bgereg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/bge/if_bge.c ============================================================================== --- stable/9/sys/dev/bge/if_bge.c Wed Feb 15 03:51:09 2012 (r231733) +++ stable/9/sys/dev/bge/if_bge.c Wed Feb 15 04:02:41 2012 (r231734) @@ -2745,6 +2745,9 @@ bge_can_use_msi(struct bge_softc *sc) { int can_use_msi = 0; + if (sc->bge_msi == 0) + return (0); + /* Disable MSI for polling(4). */ #ifdef DEVICE_POLLING return (0); @@ -2783,6 +2786,8 @@ bge_attach(device_t dev) sc = device_get_softc(dev); sc->bge_dev = dev; + bge_add_sysctls(sc); + TASK_INIT(&sc->bge_intr_task, 0, bge_intr_task, sc); /* @@ -3195,8 +3200,6 @@ bge_attach(device_t dev) goto fail; } - bge_add_sysctls(sc); - /* Set default tuneable values. */ sc->bge_stat_ticks = BGE_TICKS_PER_SEC; sc->bge_rx_coal_ticks = 150; @@ -5627,6 +5630,12 @@ bge_add_sysctls(struct bge_softc *sc) "Number of fragmented TX buffers of a frame allowed before " "forced collapsing"); + sc->bge_msi = 1; + snprintf(tn, sizeof(tn), "dev.bge.%d.msi", unit); + TUNABLE_INT_FETCH(tn, &sc->bge_msi); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "msi", + CTLFLAG_RD, &sc->bge_msi, 0, "Enable MSI"); + /* * It seems all Broadcom controllers have a bug that can generate UDP * datagrams with checksum value 0 when TX UDP checksum offloading is Modified: stable/9/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/9/sys/dev/bge/if_bgereg.h Wed Feb 15 03:51:09 2012 (r231733) +++ stable/9/sys/dev/bge/if_bgereg.h Wed Feb 15 04:02:41 2012 (r231734) @@ -2864,6 +2864,7 @@ struct bge_softc { int bge_timer; int bge_forced_collapse; int bge_forced_udpcsum; + int bge_msi; int bge_csum_features; struct callout bge_stat_ch; uint32_t bge_rx_discards; From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 04:09:04 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C693D106564A; Wed, 15 Feb 2012 04:09:04 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B02CF8FC14; Wed, 15 Feb 2012 04:09:04 +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 q1F494T1035236; Wed, 15 Feb 2012 04:09:04 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F494FL035234; Wed, 15 Feb 2012 04:09:04 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150409.q1F494FL035234@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 04:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231737 - stable/9/share/man/man4 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 04:09:04 -0000 Author: yongari Date: Wed Feb 15 04:09:04 2012 New Revision: 231737 URL: http://svn.freebsd.org/changeset/base/231737 Log: MFC r230288,230339: r230288: Document dev.bge.%d.msi_disable tunable. r230339: Reflect tunable name change made in r230337. Modified: stable/9/share/man/man4/bge.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/bge.4 ============================================================================== --- stable/9/share/man/man4/bge.4 Wed Feb 15 04:04:36 2012 (r231736) +++ stable/9/share/man/man4/bge.4 Wed Feb 15 04:09:04 2012 (r231737) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 2, 2011 +.Dd January 19, 2012 .Dt BGE 4 .Os .Sh NAME @@ -188,7 +188,7 @@ SysKonnect SK-9D21 (10/100/1000baseTX) SysKonnect SK-9D41 (1000baseSX) .El .Sh LOADER TUNABLES -The following tunable can be set at the +The following tunables can be set at the .Xr loader 8 prompt before booting the kernel, or stored in .Xr loader.conf 5 . @@ -197,6 +197,9 @@ prompt before booting the kernel, or sto Allow the ASF feature for cooperating with IPMI. Can cause system lockup problems on a small number of systems. Enabled by default. +.It Va dev.bge.%d.msi +Non-zero value enables MSI support on the Ethernet hardware. +The default value is 1. .El .Sh SYSCTL VARIABLES The following variables are available as both From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 09:32:21 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F333E1065672; Wed, 15 Feb 2012 09:32:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD84E8FC0A; Wed, 15 Feb 2012 09:32: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 q1F9WKUX047274; Wed, 15 Feb 2012 09:32:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F9WKKE047272; Wed, 15 Feb 2012 09:32:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201202150932.q1F9WKKE047272@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 15 Feb 2012 09:32:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231746 - stable/9/lib/libipsec X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 09:32:21 -0000 Author: bz Date: Wed Feb 15 09:32:20 2012 New Revision: 231746 URL: http://svn.freebsd.org/changeset/base/231746 Log: MFC r231515: Use the correct constant (with same value) for comparying the SA type. PR: kern/142741 Submitted by: Matthijs Kooiman (matthijs stdin.nl) Modified: stable/9/lib/libipsec/pfkey.c Directory Properties: stable/9/lib/libipsec/ (props changed) Modified: stable/9/lib/libipsec/pfkey.c ============================================================================== --- stable/9/lib/libipsec/pfkey.c Wed Feb 15 07:30:23 2012 (r231745) +++ stable/9/lib/libipsec/pfkey.c Wed Feb 15 09:32:20 2012 (r231746) @@ -662,7 +662,7 @@ pfkey_send_register(so, satype) { int len, algno; - if (satype == PF_UNSPEC) { + if (satype == SADB_SATYPE_UNSPEC) { for (algno = 0; algno < sizeof(supported_map)/sizeof(supported_map[0]); algno++) { From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 09:52:10 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BDFC1065672; Wed, 15 Feb 2012 09:52:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 559D78FC21; Wed, 15 Feb 2012 09:52: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 q1F9qADj048139; Wed, 15 Feb 2012 09:52:10 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F9qAYY048136; Wed, 15 Feb 2012 09:52:10 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201202150952.q1F9qAYY048136@svn.freebsd.org> From: Andriy Gapon Date: Wed, 15 Feb 2012 09:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231749 - stable/9/etc/rc.d X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 09:52:10 -0000 Author: avg Date: Wed Feb 15 09:52:09 2012 New Revision: 231749 URL: http://svn.freebsd.org/changeset/base/231749 Log: MFC r231563: start watchdogd before most of other daemons/servers Modified: stable/9/etc/rc.d/SERVERS stable/9/etc/rc.d/watchdogd Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/rc.d/SERVERS ============================================================================== --- stable/9/etc/rc.d/SERVERS Wed Feb 15 09:32:51 2012 (r231748) +++ stable/9/etc/rc.d/SERVERS Wed Feb 15 09:52:09 2012 (r231749) @@ -4,7 +4,7 @@ # # PROVIDE: SERVERS -# REQUIRE: mountcritremote abi ldconfig savecore +# REQUIRE: mountcritremote abi ldconfig savecore watchdogd # This is a dummy dependency, for early-start servers relying on # some basic configuration. Modified: stable/9/etc/rc.d/watchdogd ============================================================================== --- stable/9/etc/rc.d/watchdogd Wed Feb 15 09:32:51 2012 (r231748) +++ stable/9/etc/rc.d/watchdogd Wed Feb 15 09:52:09 2012 (r231749) @@ -28,7 +28,7 @@ # # PROVIDE: watchdogd -# REQUIRE: DAEMON cleanvar +# REQUIRE: FILESYSTEMS cleanvar syslogd # KEYWORD: nojail shutdown . /etc/rc.subr From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 10:08:14 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AFDA1065670; Wed, 15 Feb 2012 10:08:14 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B09B8FC18; Wed, 15 Feb 2012 10:08:14 +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 q1FA8EWZ048858; Wed, 15 Feb 2012 10:08:14 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FA8EKU048855; Wed, 15 Feb 2012 10:08:14 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201202151008.q1FA8EKU048855@svn.freebsd.org> From: Max Khon Date: Wed, 15 Feb 2012 10:08:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231752 - stable/9/sys/netgraph X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 10:08:14 -0000 Author: fjoe Date: Wed Feb 15 10:08:13 2012 New Revision: 231752 URL: http://svn.freebsd.org/changeset/base/231752 Log: MFC: rev. 231543 - Use fixed-width integer types. - Prefer to use C99 stdint types. This fixes ng_cisco on 64-bit architectures. Modified: stable/9/sys/netgraph/ng_cisco.c stable/9/sys/netgraph/ng_cisco.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netgraph/ng_cisco.c ============================================================================== --- stable/9/sys/netgraph/ng_cisco.c Wed Feb 15 10:02:19 2012 (r231751) +++ stable/9/sys/netgraph/ng_cisco.c Wed Feb 15 10:08:13 2012 (r231752) @@ -75,33 +75,33 @@ #define KEEPALIVE_SECS 10 struct cisco_header { - u_char address; - u_char control; - u_short protocol; -}; + uint8_t address; + uint8_t control; + uint16_t protocol; +} __packed; #define CISCO_HEADER_LEN sizeof (struct cisco_header) struct cisco_packet { - u_long type; - u_long par1; - u_long par2; - u_short rel; - u_short time0; - u_short time1; -}; + uint32_t type; + uint32_t par1; + uint32_t par2; + uint16_t rel; + uint16_t time0; + uint16_t time1; +} __packed; #define CISCO_PACKET_LEN (sizeof(struct cisco_packet)) struct protoent { hook_p hook; /* the hook for this proto */ - u_short af; /* address family, -1 = downstream */ + uint16_t af; /* address family, -1 = downstream */ }; struct cisco_priv { - u_long local_seq; - u_long remote_seq; - u_long seqRetries; /* how many times we've been here throwing out + uint32_t local_seq; + uint32_t remote_seq; + uint32_t seqRetries; /* how many times we've been here throwing out * the same sequence number without ack */ node_p node; struct callout handle; @@ -271,7 +271,7 @@ cisco_rcvmsg(node_p node, item_p item, h pos = sprintf(arg, "keepalive period: %d sec; ", KEEPALIVE_SECS); pos += sprintf(arg + pos, - "unacknowledged keepalives: %ld", sc->seqRetries); + "unacknowledged keepalives: %d", sc->seqRetries); resp->header.arglen = pos + 1; break; } @@ -602,7 +602,7 @@ cisco_send(sc_p sc, int type, long par1, struct cisco_packet *ch; struct mbuf *m; struct timeval time; - u_long t; + uint32_t t; int error = 0; getmicrouptime(&time); @@ -625,8 +625,8 @@ cisco_send(sc_p sc, int type, long par1, ch->par1 = htonl(par1); ch->par2 = htonl(par2); ch->rel = -1; - ch->time0 = htons((u_short) (t >> 16)); - ch->time1 = htons((u_short) t); + ch->time0 = htons((uint16_t) (t >> 16)); + ch->time1 = htons((uint16_t) t); NG_SEND_DATA_ONLY(error, sc->downstream.hook, m); return (error); Modified: stable/9/sys/netgraph/ng_cisco.h ============================================================================== --- stable/9/sys/netgraph/ng_cisco.h Wed Feb 15 10:02:19 2012 (r231751) +++ stable/9/sys/netgraph/ng_cisco.h Wed Feb 15 10:08:13 2012 (r231752) @@ -76,8 +76,8 @@ struct ng_cisco_ipaddr { } struct ng_cisco_stats { - u_int32_t seqRetries; /* # unack'd retries */ - u_int32_t keepAlivePeriod; /* in seconds */ + uint32_t seqRetries; /* # unack'd retries */ + uint32_t keepAlivePeriod; /* in seconds */ }; /* Keep this in sync with the above structure definition */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 13:32:57 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5016D1065670; Wed, 15 Feb 2012 13:32:57 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5CD88FC19; Wed, 15 Feb 2012 13:32: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 q1FDWut1063869; Wed, 15 Feb 2012 13:32:56 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FDWuij063867; Wed, 15 Feb 2012 13:32:56 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201202151332.q1FDWuij063867@svn.freebsd.org> From: Takahashi Yoshihiro Date: Wed, 15 Feb 2012 13:32:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231756 - stable/9/sys/pc98/conf X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 13:32:57 -0000 Author: nyan Date: Wed Feb 15 13:32:56 2012 New Revision: 231756 URL: http://svn.freebsd.org/changeset/base/231756 Log: MFC: r231273 - Disable the olpt driver. Because it conflicts with the ppc/lpt driver. - Remove obsolete comment. Modified: stable/9/sys/pc98/conf/GENERIC Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/pc98/conf/GENERIC ============================================================================== --- stable/9/sys/pc98/conf/GENERIC Wed Feb 15 11:11:58 2012 (r231755) +++ stable/9/sys/pc98/conf/GENERIC Wed Feb 15 13:32:56 2012 (r231756) @@ -153,8 +153,7 @@ device plip # TCP/IP over parallel device ppi # Parallel port interface device #device vpo # Requires scbus and da # OLD Parallel port -# Please stay olpt driver after ppc driver -device olpt +#device olpt # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (``Tulip'') From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 13:40:11 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42E3F106566B; Wed, 15 Feb 2012 13:40:11 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DC278FC2A; Wed, 15 Feb 2012 13:40:11 +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 q1FDeBw4064204; Wed, 15 Feb 2012 13:40:11 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FDeAEo064202; Wed, 15 Feb 2012 13:40:10 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201202151340.q1FDeAEo064202@svn.freebsd.org> From: Takahashi Yoshihiro Date: Wed, 15 Feb 2012 13:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231758 - stable/9/release X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 13:40:11 -0000 Author: nyan Date: Wed Feb 15 13:40:10 2012 New Revision: 231758 URL: http://svn.freebsd.org/changeset/base/231758 Log: MFC: r231123 - Set TERM to cons25w on pc98 because we still use old cons25w terminal to show Japanese. - Add cons25w to terminal lists. Reviewed by: nwhitehorn Modified: stable/9/release/rc.local Directory Properties: stable/9/release/ (props changed) Modified: stable/9/release/rc.local ============================================================================== --- stable/9/release/rc.local Wed Feb 15 13:36:06 2012 (r231757) +++ stable/9/release/rc.local Wed Feb 15 13:40:10 2012 (r231758) @@ -8,10 +8,16 @@ : ${DIALOG_ITEM_HELP=4} : ${DIALOG_ESC=255} +MACHINE=`uname -m` + kbdcontrol -d >/dev/null 2>&1 if [ $? -eq 0 ]; then # Syscons: use xterm - TERM=xterm + if [ ${MACHINE} = "pc98" ]; then + TERM=cons25w + else + TERM=xterm + fi else # Serial or other console echo @@ -22,6 +28,7 @@ else echo " ansi Standard ANSI terminal" echo " vt100 VT100 or compatible terminal" echo " xterm xterm terminal emulator (or compatible)" + echo " cons25w cons25w terminal" echo echo -n "Console type [vt100]: " read TERM From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 14:30:04 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D79C8106567A; Wed, 15 Feb 2012 14:30:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBCBC8FC19; Wed, 15 Feb 2012 14:30:04 +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 q1FEU43F066079; Wed, 15 Feb 2012 14:30:04 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FEU4D0066077; Wed, 15 Feb 2012 14:30:04 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201202151430.q1FEU4D0066077@svn.freebsd.org> From: Alexander Motin Date: Wed, 15 Feb 2012 14:30:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231762 - stable/9/sys/dev/sound/pcm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 14:30:05 -0000 Author: mav Date: Wed Feb 15 14:30:04 2012 New Revision: 231762 URL: http://svn.freebsd.org/changeset/base/231762 Log: MFC r231647: Do not handle MOD_SHUTDOWN equally to MOD_UNLOAD in sound kernel module. MOD_SHUTDOWN is not an end of existence, and there is a life after it. In particular, code previously called on MOD_SHUTDOWN grabbed lock and deallocated unit numbering. That caused infinite wait loop if snd_uaudio tried to destroy its PCM device after that point. Modified: stable/9/sys/dev/sound/pcm/sound.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/sound/pcm/sound.c ============================================================================== --- stable/9/sys/dev/sound/pcm/sound.c Wed Feb 15 14:29:23 2012 (r231761) +++ stable/9/sys/dev/sound/pcm/sound.c Wed Feb 15 14:30:04 2012 (r231762) @@ -1415,7 +1415,6 @@ sound_modevent(module_t mod, int type, v pcmsg_unrhdr = new_unrhdr(1, INT_MAX, NULL); break; case MOD_UNLOAD: - case MOD_SHUTDOWN: ret = sndstat_acquire(curthread); if (ret != 0) break; @@ -1424,6 +1423,8 @@ sound_modevent(module_t mod, int type, v pcmsg_unrhdr = NULL; } break; + case MOD_SHUTDOWN: + break; default: ret = ENOTSUP; } From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 15:55:17 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71A2B1065675; Wed, 15 Feb 2012 15:55:04 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 200928FC08; Wed, 15 Feb 2012 15:55:02 +0000 (UTC) Received: by werm13 with SMTP id m13so1135893wer.13 for ; Wed, 15 Feb 2012 07:55:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=9TONhAra0mqQvkbau+fIlXNYdsGLXtxK8hPJh7PCrQw=; b=OOWbT2gwrk4jB+Q8+ffaxhA1gtdFgCdcr2A53ElLL0YPGfWNI4ZHXEp31NUBp8FlwU 4a1geNggXX7lfBvUibL9SoA6SXCv/hqmCFtsJtbG92w8j16qPmuHXfIN/8M8mc/WSQSA KhZjvYb1IW3DXzPYVwcsqOuIFA7t0jkMZ7jZI= Received: by 10.180.77.228 with SMTP id v4mr36491307wiw.2.1329321302260; Wed, 15 Feb 2012 07:55:02 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.223.15.90 with HTTP; Wed, 15 Feb 2012 07:54:32 -0800 (PST) In-Reply-To: <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> From: Eitan Adler Date: Wed, 15 Feb 2012 10:54:32 -0500 X-Google-Sender-Auth: 492tYvffb5gcPnfDI8AkI0sEnHg Message-ID: To: Jaakko Heinonen Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlZw+gevo9CC4tGITV4WxznA+RDhnxPw6iiOPnBpObME/SyKbD5vgHVTds06UPA6dRlpawh Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 15:55:17 -0000 On Wed, Feb 15, 2012 at 10:50 AM, Jaakko Heinonen wrote: > I think this commit incorrectly placed mergeinfo to stable/9/share/. I used the following command: 2811 svn merge -c229831 $FSVN/head/share share Should I have committed somewhere else? http://wiki.freebsd.org/SubversionPrimer/Merging is not particularly helpful for share/ changes. -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 16:10:00 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FEF4106564A; Wed, 15 Feb 2012 16:10:00 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116]) by mx1.freebsd.org (Postfix) with ESMTP id AF3AE8FC15; Wed, 15 Feb 2012 16:09:59 +0000 (UTC) Received: from a91-153-116-96.elisa-laajakaista.fi (a91-153-116-96.elisa-laajakaista.fi [91.153.116.96]) by gw02.mail.saunalahti.fi (Postfix) with SMTP id 06AF4176287; Wed, 15 Feb 2012 18:09:51 +0200 (EET) Date: Wed, 15 Feb 2012 18:09:51 +0200 From: Jaakko Heinonen To: Eitan Adler Message-ID: <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 16:10:00 -0000 On 2012-02-15, Eitan Adler wrote: > On Wed, Feb 15, 2012 at 10:50 AM, Jaakko Heinonen wrote: > > > I think this commit incorrectly placed mergeinfo to stable/9/share/. > > I used the following command: > > 2811 svn merge -c229831 $FSVN/head/share share > > Should I have committed somewhere else? > http://wiki.freebsd.org/SubversionPrimer/Merging is not particularly > helpful for share/ changes. Looking at previous merges I would have merged it to share/examples. -- Jaakko From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 16:10:14 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA3B41065713 for ; Wed, 15 Feb 2012 16:10:14 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by mx1.freebsd.org (Postfix) with ESMTP id 517B18FC23 for ; Wed, 15 Feb 2012 16:10:02 +0000 (UTC) Received: from a91-153-116-96.elisa-laajakaista.fi (a91-153-116-96.elisa-laajakaista.fi [91.153.116.96]) by gw01.mail.saunalahti.fi (Postfix) with SMTP id 2E722151519; Wed, 15 Feb 2012 17:50:12 +0200 (EET) Date: Wed, 15 Feb 2012 17:50:11 +0200 From: Jaakko Heinonen To: Eitan Adler Message-ID: <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> References: <201201281948.q0SJmjIL096609@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201281948.q0SJmjIL096609@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@FreeBSD.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 16:10:14 -0000 Hi, On 2012-01-28, Eitan Adler wrote: > Log: > MFC r229831: > - X11BASE has been deprecated for a long time and will die soon > > Approved by: cperciva > > Modified: > stable/9/lib/libopie/config.h > stable/9/share/examples/diskless/README.TEMPLATING > stable/9/share/examples/ppp/ppp.linkdown.sample > stable/9/share/examples/printing/hpvf > stable/9/tools/tools/nanobsd/pcengines/Files/root/.cshrc > stable/9/usr.sbin/pkg_install/add/main.c > Directory Properties: > stable/9/lib/libopie/ (props changed) > stable/9/share/ (props changed) > stable/9/share/examples/ (props changed) > stable/9/tools/tools/nanobsd/ (props changed) > stable/9/usr.sbin/pkg_install/ (props changed) I think this commit incorrectly placed mergeinfo to stable/9/share/. -- Jaakko From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 16:32:40 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20B89106564A; Wed, 15 Feb 2012 16:32:40 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 94C058FC15; Wed, 15 Feb 2012 16:32:38 +0000 (UTC) Received: by werm13 with SMTP id m13so1177215wer.13 for ; Wed, 15 Feb 2012 08:32:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=avrnaM9LYLEvgjzLE5AjukdFFckD3vxsXAI29eSgjeo=; b=Yc80+nYq1Les+E3CtMWU374iaw7q1k6Sq7HhBywEAtkdi/4muluh1lnfM1O1zkDbcP pB2kfAsG1IV3t66HMAC4k6y0AKvz+p1wRKOeuhORWNefpVPCbLfXY6ExDbaelKtWAU92 /LLOIxS7DO7GRFGpJ5v++62fIMlcxjG/3N0Z0= Received: by 10.180.92.73 with SMTP id ck9mr36703957wib.2.1329323557854; Wed, 15 Feb 2012 08:32:37 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.223.15.90 with HTTP; Wed, 15 Feb 2012 08:32:07 -0800 (PST) In-Reply-To: <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> From: Eitan Adler Date: Wed, 15 Feb 2012 11:32:07 -0500 X-Google-Sender-Auth: unTh5Ays0fQE8b_M_Xx4fqxmQ98 Message-ID: To: Jaakko Heinonen Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQkWnQDEAvVEJIRHy4TB9QjfLqGyINmJGGjBJG2CH1wk8TMBrcD2R3C9UEOx2+WgwLz+sNiq Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 16:32:40 -0000 On Wed, Feb 15, 2012 at 11:09 AM, Jaakko Heinonen wrote: > On 2012-02-15, Eitan Adler wrote: >> On Wed, Feb 15, 2012 at 10:50 AM, Jaakko Heinonen wrote= : >> >> > I think this commit incorrectly placed mergeinfo to stable/9/share/. >> >> I used the following command: >> >> =C2=A02811 =C2=A0svn merge -c229831 $FSVN/head/share share >> >> Should I have committed somewhere else? >> http://wiki.freebsd.org/SubversionPrimer/Merging is not particularly >> helpful for share/ changes. > > Looking at previous merges I would have merged it to share/examples. I updated the wiki (see #11) and thanks for the help. --=20 Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 16:56:53 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 728F71065670; Wed, 15 Feb 2012 16:56:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FB918FC13; Wed, 15 Feb 2012 16:56: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 q1FGuruT071233; Wed, 15 Feb 2012 16:56:53 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FGurxR071227; Wed, 15 Feb 2012 16:56:53 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201202151656.q1FGurxR071227@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 15 Feb 2012 16:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231768 - in stable/9: lib/libc/gen sys/net sys/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 16:56:53 -0000 Author: bz Date: Wed Feb 15 16:56:52 2012 New Revision: 231768 URL: http://svn.freebsd.org/changeset/base/231768 Log: MFC r231505,231520: Introduce a new NET_RT_IFLISTL API to query the address list. It works on extended and extensible structs if_msghdrl and ifa_msghdrl. This will allow us to extend both the msghdrl structs and eventually if_data in the future without breaking the ABI. The MFC is just to provide the new API to old stable branches to make updating and if needed downgrading a lot easier for updates to 10. Bump __FreeBSD_version to allow ports to more easily detect the new API. Reviewed by: brooks Tested by: brooks Modified: stable/9/lib/libc/gen/sysctl.3 stable/9/sys/net/if.h stable/9/sys/net/rtsock.c stable/9/sys/sys/param.h stable/9/sys/sys/socket.h Directory Properties: stable/9/lib/libc/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/lib/libc/gen/sysctl.3 ============================================================================== --- stable/9/lib/libc/gen/sysctl.3 Wed Feb 15 16:09:56 2012 (r231767) +++ stable/9/lib/libc/gen/sysctl.3 Wed Feb 15 16:56:52 2012 (r231768) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd April 25, 2010 +.Dd February 11, 2012 .Dt SYSCTL 3 .Os .Sh NAME @@ -554,6 +554,7 @@ The fifth and sixth level names are as f .It "NET_RT_DUMP None" .It "NET_RT_IFLIST 0 or if_index" .It "NET_RT_IFMALIST 0 or if_index" +.It "NET_RT_IFLISTL 0 or if_index" .El .Pp The @@ -561,6 +562,19 @@ The name returns information about multicast group memberships on all interfaces if 0 is specified, or for the interface specified by .Va if_index . +.Pp +The +.Dv NET_RT_IFLISTL +is like +.Dv NET_RT_IFLIST , +just returning message header structs with additional fields allowing the +interface to be extended without breaking binary compatibility. +The +.Dv NET_RT_IFLISTL +uses 'l' versions of the message header structures: +.Va struct if_msghdrl +and +.Va struct ifa_msghdrl . .It Li PF_INET Get or set various global information about the IPv4 (Internet Protocol version 4). Modified: stable/9/sys/net/if.h ============================================================================== --- stable/9/sys/net/if.h Wed Feb 15 16:09:56 2012 (r231767) +++ stable/9/sys/net/if.h Wed Feb 15 16:56:52 2012 (r231768) @@ -244,6 +244,7 @@ struct if_data { /* * Message format for use in obtaining information about interfaces * from getkerninfo and the routing socket + * For the new, extensible interface see struct if_msghdrl below. */ struct if_msghdr { u_short ifm_msglen; /* to skip over non-understood messages */ @@ -256,8 +257,34 @@ struct if_msghdr { }; /* + * The 'l' version shall be used by new interfaces, like NET_RT_IFLISTL. It is + * extensible after ifm_data_off or within ifm_data. Both the if_msghdr and + * if_data now have a member field detailing the struct length in addition to + * the routing message length. Macros are provided to find the start of + * ifm_data and the start of the socket address strucutres immediately following + * struct if_msghdrl given a pointer to struct if_msghdrl. + */ +#define IF_MSGHDRL_IFM_DATA(_l) \ + (struct if_data *)((char *)(_l) + (_l)->ifm_data_off) +#define IF_MSGHDRL_RTA(_l) \ + (void *)((uintptr_t)(_l) + (_l)->ifm_len) +struct if_msghdrl { + u_short ifm_msglen; /* to skip over non-understood messages */ + u_char ifm_version; /* future binary compatibility */ + u_char ifm_type; /* message type */ + int ifm_addrs; /* like rtm_addrs */ + int ifm_flags; /* value of if_flags */ + u_short ifm_index; /* index for associated ifp */ + u_short _ifm_spare1; /* spare space to grow if_index, see if_var.h */ + u_short ifm_len; /* length of if_msghdrl incl. if_data */ + u_short ifm_data_off; /* offset of if_data from beginning */ + struct if_data ifm_data;/* statistics and other data about if */ +}; + +/* * Message format for use in obtaining information about interface addresses * from getkerninfo and the routing socket + * For the new, extensible interface see struct ifa_msghdrl below. */ struct ifa_msghdr { u_short ifam_msglen; /* to skip over non-understood messages */ @@ -270,6 +297,33 @@ struct ifa_msghdr { }; /* + * The 'l' version shall be used by new interfaces, like NET_RT_IFLISTL. It is + * extensible after ifam_metric or within ifam_data. Both the ifa_msghdrl and + * if_data now have a member field detailing the struct length in addition to + * the routing message length. Macros are provided to find the start of + * ifm_data and the start of the socket address strucutres immediately following + * struct ifa_msghdrl given a pointer to struct ifa_msghdrl. + */ +#define IFA_MSGHDRL_IFAM_DATA(_l) \ + (struct if_data *)((char *)(_l) + (_l)->ifam_data_off) +#define IFA_MSGHDRL_RTA(_l) \ + (void *)((uintptr_t)(_l) + (_l)->ifam_len) +struct ifa_msghdrl { + u_short ifam_msglen; /* to skip over non-understood messages */ + u_char ifam_version; /* future binary compatibility */ + u_char ifam_type; /* message type */ + int ifam_addrs; /* like rtm_addrs */ + int ifam_flags; /* value of ifa_flags */ + u_short ifam_index; /* index for associated ifp */ + u_short _ifam_spare1; /* spare space to grow if_index, see if_var.h */ + u_short ifam_len; /* length of ifa_msghdrl incl. if_data */ + u_short ifam_data_off; /* offset of if_data from beginning */ + int ifam_metric; /* value of ifa_metric */ + struct if_data ifam_data;/* statistics and other data about if or + * address */ +}; + +/* * Message format for use in obtaining information about multicast addresses * from the routing socket */ Modified: stable/9/sys/net/rtsock.c ============================================================================== --- stable/9/sys/net/rtsock.c Wed Feb 15 16:09:56 2012 (r231767) +++ stable/9/sys/net/rtsock.c Wed Feb 15 16:56:52 2012 (r231768) @@ -114,7 +114,34 @@ struct if_msghdr32 { uint16_t ifm_index; struct if_data32 ifm_data; }; -#endif + +struct if_msghdrl32 { + uint16_t ifm_msglen; + uint8_t ifm_version; + uint8_t ifm_type; + int32_t ifm_addrs; + int32_t ifm_flags; + uint16_t ifm_index; + uint16_t _ifm_spare1; + uint16_t ifm_len; + uint16_t ifm_data_off; + struct if_data32 ifm_data; +}; + +struct ifa_msghdrl32 { + uint16_t ifam_msglen; + uint8_t ifam_version; + uint8_t ifam_type; + int32_t ifam_addrs; + int32_t ifam_flags; + uint16_t ifam_index; + uint16_t _ifam_spare1; + uint16_t ifam_len; + uint16_t ifam_data_off; + int32_t ifam_metric; + struct if_data32 ifam_data; +}; +#endif /* COMPAT_FREEBSD32 */ MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables"); @@ -1010,6 +1037,9 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, str return (0); } +/* + * Used by the routing socket. + */ static struct mbuf * rt_msg1(int type, struct rt_addrinfo *rtinfo) { @@ -1077,6 +1107,9 @@ rt_msg1(int type, struct rt_addrinfo *rt return (m); } +/* + * Used by the sysctl code and routing socket. + */ static int rt_msg2(int type, struct rt_addrinfo *rtinfo, caddr_t cp, struct walkarg *w) { @@ -1090,17 +1123,31 @@ again: case RTM_DELADDR: case RTM_NEWADDR: - len = sizeof(struct ifa_msghdr); + if (w != NULL && w->w_op == NET_RT_IFLISTL) { +#ifdef COMPAT_FREEBSD32 + if (w->w_req->flags & SCTL_MASK32) + len = sizeof(struct ifa_msghdrl32); + else +#endif + len = sizeof(struct ifa_msghdrl); + } else + len = sizeof(struct ifa_msghdr); break; case RTM_IFINFO: #ifdef COMPAT_FREEBSD32 if (w != NULL && w->w_req->flags & SCTL_MASK32) { - len = sizeof(struct if_msghdr32); + if (w->w_op == NET_RT_IFLISTL) + len = sizeof(struct if_msghdrl32); + else + len = sizeof(struct if_msghdr32); break; } #endif - len = sizeof(struct if_msghdr); + if (w != NULL && w->w_op == NET_RT_IFLISTL) + len = sizeof(struct if_msghdrl); + else + len = sizeof(struct if_msghdr); break; case RTM_NEWMADDR: @@ -1530,6 +1577,127 @@ copy_ifdata32(struct if_data *src, struc #endif static int +sysctl_iflist_ifml(struct ifnet *ifp, struct rt_addrinfo *info, + struct walkarg *w, int len) +{ + struct if_msghdrl *ifm; + +#ifdef COMPAT_FREEBSD32 + if (w->w_req->flags & SCTL_MASK32) { + struct if_msghdrl32 *ifm32; + + ifm32 = (struct if_msghdrl32 *)w->w_tmem; + ifm32->ifm_addrs = info->rti_addrs; + ifm32->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm32->ifm_index = ifp->if_index; + ifm32->_ifm_spare1 = 0; + ifm32->ifm_len = sizeof(*ifm32); + ifm32->ifm_data_off = offsetof(struct if_msghdrl32, ifm_data); + + copy_ifdata32(&ifp->if_data, &ifm32->ifm_data); + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifm32, len)); + } +#endif + ifm = (struct if_msghdrl *)w->w_tmem; + ifm->ifm_addrs = info->rti_addrs; + ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm->ifm_index = ifp->if_index; + ifm->_ifm_spare1 = 0; + ifm->ifm_len = sizeof(*ifm); + ifm->ifm_data_off = offsetof(struct if_msghdrl, ifm_data); + + ifm->ifm_data = ifp->if_data; + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); +} + +static int +sysctl_iflist_ifm(struct ifnet *ifp, struct rt_addrinfo *info, + struct walkarg *w, int len) +{ + struct if_msghdr *ifm; + +#ifdef COMPAT_FREEBSD32 + if (w->w_req->flags & SCTL_MASK32) { + struct if_msghdr32 *ifm32; + + ifm32 = (struct if_msghdr32 *)w->w_tmem; + ifm32->ifm_addrs = info->rti_addrs; + ifm32->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm32->ifm_index = ifp->if_index; + + copy_ifdata32(&ifp->if_data, &ifm32->ifm_data); + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifm32, len)); + } +#endif + ifm = (struct if_msghdr *)w->w_tmem; + ifm->ifm_addrs = info->rti_addrs; + ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm->ifm_index = ifp->if_index; + + ifm->ifm_data = ifp->if_data; + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); +} + +static int +sysctl_iflist_ifaml(struct ifaddr *ifa, struct rt_addrinfo *info, + struct walkarg *w, int len) +{ + struct ifa_msghdrl *ifam; + +#ifdef COMPAT_FREEBSD32 + if (w->w_req->flags & SCTL_MASK32) { + struct ifa_msghdrl32 *ifam32; + + ifam32 = (struct ifa_msghdrl32 *)w->w_tmem; + ifam32->ifam_addrs = info->rti_addrs; + ifam32->ifam_flags = ifa->ifa_flags; + ifam32->ifam_index = ifa->ifa_ifp->if_index; + ifam32->_ifam_spare1 = 0; + ifam32->ifam_len = sizeof(*ifam32); + ifam32->ifam_data_off = + offsetof(struct ifa_msghdrl32, ifam_data); + ifam32->ifam_metric = ifa->ifa_metric; + + copy_ifdata32(&ifa->ifa_ifp->if_data, &ifam32->ifam_data); + + return (SYSCTL_OUT(w->w_req, (caddr_t)ifam32, len)); + } +#endif + + ifam = (struct ifa_msghdrl *)w->w_tmem; + ifam->ifam_addrs = info->rti_addrs; + ifam->ifam_flags = ifa->ifa_flags; + ifam->ifam_index = ifa->ifa_ifp->if_index; + ifam->_ifam_spare1 = 0; + ifam->ifam_len = sizeof(*ifam); + ifam->ifam_data_off = offsetof(struct ifa_msghdrl, ifam_data); + ifam->ifam_metric = ifa->ifa_metric; + + ifam->ifam_data = ifa->if_data; + + return (SYSCTL_OUT(w->w_req, w->w_tmem, len)); +} + +static int +sysctl_iflist_ifam(struct ifaddr *ifa, struct rt_addrinfo *info, + struct walkarg *w, int len) +{ + struct ifa_msghdr *ifam; + + ifam = (struct ifa_msghdr *)w->w_tmem; + ifam->ifam_addrs = info->rti_addrs; + ifam->ifam_flags = ifa->ifa_flags; + ifam->ifam_index = ifa->ifa_ifp->if_index; + ifam->ifam_metric = ifa->ifa_metric; + + return (SYSCTL_OUT(w->w_req, w->w_tmem, len)); +} + +static int sysctl_iflist(int af, struct walkarg *w) { struct ifnet *ifp; @@ -1548,32 +1716,10 @@ sysctl_iflist(int af, struct walkarg *w) len = rt_msg2(RTM_IFINFO, &info, NULL, w); info.rti_info[RTAX_IFP] = NULL; if (w->w_req && w->w_tmem) { - struct if_msghdr *ifm; - -#ifdef COMPAT_FREEBSD32 - if (w->w_req->flags & SCTL_MASK32) { - struct if_msghdr32 *ifm32; - - ifm32 = (struct if_msghdr32 *)w->w_tmem; - ifm32->ifm_index = ifp->if_index; - ifm32->ifm_flags = ifp->if_flags | - ifp->if_drv_flags; - copy_ifdata32(&ifp->if_data, &ifm32->ifm_data); - ifm32->ifm_addrs = info.rti_addrs; - error = SYSCTL_OUT(w->w_req, (caddr_t)ifm32, - len); - goto sysctl_out; - } -#endif - ifm = (struct if_msghdr *)w->w_tmem; - ifm->ifm_index = ifp->if_index; - ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; - ifm->ifm_data = ifp->if_data; - ifm->ifm_addrs = info.rti_addrs; - error = SYSCTL_OUT(w->w_req, (caddr_t)ifm, len); -#ifdef COMPAT_FREEBSD32 - sysctl_out: -#endif + if (w->w_op == NET_RT_IFLISTL) + error = sysctl_iflist_ifml(ifp, &info, w, len); + else + error = sysctl_iflist_ifm(ifp, &info, w, len); if (error) goto done; } @@ -1588,14 +1734,12 @@ sysctl_iflist(int af, struct walkarg *w) info.rti_info[RTAX_BRD] = ifa->ifa_dstaddr; len = rt_msg2(RTM_NEWADDR, &info, NULL, w); if (w->w_req && w->w_tmem) { - struct ifa_msghdr *ifam; - - ifam = (struct ifa_msghdr *)w->w_tmem; - ifam->ifam_index = ifa->ifa_ifp->if_index; - ifam->ifam_flags = ifa->ifa_flags; - ifam->ifam_metric = ifa->ifa_metric; - ifam->ifam_addrs = info.rti_addrs; - error = SYSCTL_OUT(w->w_req, w->w_tmem, len); + if (w->w_op == NET_RT_IFLISTL) + error = sysctl_iflist_ifaml(ifa, &info, + w, len); + else + error = sysctl_iflist_ifam(ifa, &info, + w, len); if (error) goto done; } @@ -1725,6 +1869,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) break; case NET_RT_IFLIST: + case NET_RT_IFLISTL: error = sysctl_iflist(af, &w); break; Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Wed Feb 15 16:09:56 2012 (r231767) +++ stable/9/sys/sys/param.h Wed Feb 15 16:56:52 2012 (r231768) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900502 /* Master, propagated to newvers */ +#define __FreeBSD_version 900503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/9/sys/sys/socket.h ============================================================================== --- stable/9/sys/sys/socket.h Wed Feb 15 16:09:56 2012 (r231767) +++ stable/9/sys/sys/socket.h Wed Feb 15 16:56:52 2012 (r231768) @@ -396,7 +396,9 @@ struct sockproto { #define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ #define NET_RT_IFLIST 3 /* survey interface list */ #define NET_RT_IFMALIST 4 /* return multicast address list */ -#define NET_RT_MAXID 5 +#define NET_RT_IFLISTL 5 /* Survey interface list, using 'l'en + * versions of msghdr structs. */ +#define NET_RT_MAXID 6 #define CTL_NET_RT_NAMES { \ { 0, 0 }, \ @@ -404,6 +406,7 @@ struct sockproto { { "flags", CTLTYPE_STRUCT }, \ { "iflist", CTLTYPE_STRUCT }, \ { "ifmalist", CTLTYPE_STRUCT }, \ + { "iflistl", CTLTYPE_STRUCT }, \ } #endif /* __BSD_VISIBLE */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 17:28:10 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CB091065674; Wed, 15 Feb 2012 17:28:10 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06A5D8FC13; Wed, 15 Feb 2012 17:28: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 q1FHS9xQ072534; Wed, 15 Feb 2012 17:28:09 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FHS9Lh072509; Wed, 15 Feb 2012 17:28:09 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202151728.q1FHS9Lh072509@svn.freebsd.org> From: "Kenneth D. Merry" Date: Wed, 15 Feb 2012 17:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231772 - in stable/9: share/examples/scsi_target sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/... X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 17:28:10 -0000 Author: ken Date: Wed Feb 15 17:28:09 2012 New Revision: 231772 URL: http://svn.freebsd.org/changeset/base/231772 Log: MFC r229997, r230033, and r230334 Bring the CAM Target Layer into stable/9. r230334 | ken | 2012-01-19 11:42:03 -0700 (Thu, 19 Jan 2012) | 19 lines Quiet some clang warnings when compiling CTL. ctl_error.c, ctl_error.h: Take out the ctl_sense_format enumeration, and use scsi_sense_data_type instead. Remove ctl_get_sense_format() and switch ctl_build_ua() over to using scsi_sense_data_type. ctl_backend_ramdisk.c, ctl_backend_block.c: Use C99 structure initializers instead of GNU initializers. ctl.c: Switch over to using the SCSI sense format enumeration instead of the CTL-specific enumeration. Submitted by: dim (partially) MFC after: 1 month r230033 | ken | 2012-01-12 15:08:33 -0700 (Thu, 12 Jan 2012) | 5 lines Silence some unnecessary verbosity. Reported by: mav MFC after: 1 month r229997 | ken | 2012-01-11 17:34:33 -0700 (Wed, 11 Jan 2012) | 170 lines Add the CAM Target Layer (CTL). CTL is a disk and processor device emulation subsystem originally written for Copan Systems under Linux starting in 2003. It has been shipping in Copan (now SGI) products since 2005. It was ported to FreeBSD in 2008, and thanks to an agreement between SGI (who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is available under a BSD-style license. The intent behind the agreement was that Spectra would work to get CTL into the FreeBSD tree. Some CTL features: - Disk and processor device emulation. - Tagged queueing - SCSI task attribute support (ordered, head of queue, simple tags) - SCSI implicit command ordering support. (e.g. if a read follows a mode select, the read will be blocked until the mode select completes.) - Full task management support (abort, LUN reset, target reset, etc.) - Support for multiple ports - Support for multiple simultaneous initiators - Support for multiple simultaneous backing stores - Persistent reservation support - Mode sense/select support - Error injection support - High Availability support (1) - All I/O handled in-kernel, no userland context switch overhead. (1) HA Support is just an API stub, and needs much more to be fully functional. ctl.c: The core of CTL. Command handlers and processing, character driver, and HA support are here. ctl.h: Basic function declarations and data structures. ctl_backend.c, ctl_backend.h: The basic CTL backend API. ctl_backend_block.c, ctl_backend_block.h: The block and file backend. This allows for using a disk or a file as the backing store for a LUN. Multiple threads are started to do I/O to the backing device, primarily because the VFS API requires that to get any concurrency. ctl_backend_ramdisk.c: A "fake" ramdisk backend. It only allocates a small amount of memory to act as a source and sink for reads and writes from an initiator. Therefore it cannot be used for any real data, but it can be used to test for throughput. It can also be used to test initiators' support for extremely large LUNs. ctl_cmd_table.c: This is a table with all 256 possible SCSI opcodes, and command handler functions defined for supported opcodes. ctl_debug.h: Debugging support. ctl_error.c, ctl_error.h: CTL-specific wrappers around the CAM sense building functions. ctl_frontend.c, ctl_frontend.h: These files define the basic CTL frontend port API. ctl_frontend_cam_sim.c: This is a CTL frontend port that is also a CAM SIM. This frontend allows for using CTL without any target-capable hardware. So any LUNs you create in CTL are visible in CAM via this port. ctl_frontend_internal.c, ctl_frontend_internal.h: This is a frontend port written for Copan to do some system-specific tasks that required sending commands into CTL from inside the kernel. This isn't entirely relevant to FreeBSD in general, but can perhaps be repurposed. ctl_ha.h: This is a stubbed-out High Availability API. Much more is needed for full HA support. See the comments in the header and the description of what is needed in the README.ctl.txt file for more details. ctl_io.h: This defines most of the core CTL I/O structures. union ctl_io is conceptually very similar to CAM's union ccb. ctl_ioctl.h: This defines all ioctls available through the CTL character device, and the data structures needed for those ioctls. ctl_mem_pool.c, ctl_mem_pool.h: Generic memory pool implementation used by the internal frontend. ctl_private.h: Private data structres (e.g. CTL softc) and function prototypes. This also includes the SCSI vendor and product names used by CTL. ctl_scsi_all.c, ctl_scsi_all.h: CTL wrappers around CAM sense printing functions. ctl_ser_table.c: Command serialization table. This defines what happens when one type of command is followed by another type of command. ctl_util.c, ctl_util.h: CTL utility functions, primarily designed to be used from userland. See ctladm for the primary consumer of these functions. These include CDB building functions. scsi_ctl.c: CAM target peripheral driver and CTL frontend port. This is the path into CTL for commands from target-capable hardware/SIMs. README.ctl.txt: CTL code features, roadmap, to-do list. usr.sbin/Makefile: Add ctladm. ctladm/Makefile, ctladm/ctladm.8, ctladm/ctladm.c, ctladm/ctladm.h, ctladm/util.c: ctladm(8) is the CTL management utility. It fills a role similar to camcontrol(8). It allow configuring LUNs, issuing commands, injecting errors and various other control functions. usr.bin/Makefile: Add ctlstat. ctlstat/Makefile ctlstat/ctlstat.8, ctlstat/ctlstat.c: ctlstat(8) fills a role similar to iostat(8). It reports I/O statistics for CTL. sys/conf/files: Add CTL files. sys/conf/NOTES: Add device ctl. sys/cam/scsi_all.h: To conform to more recent specs, the inquiry CDB length field is now 2 bytes long. Add several mode page definitions for CTL. sys/cam/scsi_all.c: Handle the new 2 byte inquiry length. sys/dev/ciss/ciss.c, sys/dev/ata/atapi-cam.c, sys/cam/scsi/scsi_targ_bh.c, scsi_target/scsi_cmds.c, mlxcontrol/interface.c: Update for 2 byte inquiry length field. scsi_da.h: Add versions of the format and rigid disk pages that are in a more reasonable format for CTL. amd64/conf/GENERIC, i386/conf/GENERIC, ia64/conf/GENERIC, sparc64/conf/GENERIC: Add device ctl. i386/conf/PAE: The CTL frontend SIM at least does not compile cleanly on PAE. Sponsored by: Copan Systems, SGI and Spectra Logic MFC after: 1 month Added: stable/9/sys/cam/ctl/ - copied from r229997, head/sys/cam/ctl/ - copied from r229997, head/usr.bin/ctlstat/ stable/9/usr.sbin/ctladm/ - copied from r229997, head/usr.sbin/ctladm/ Directory Properties: stable/9/usr.bin/ctlstat/ (props changed) Modified: stable/9/share/examples/scsi_target/scsi_cmds.c stable/9/sys/amd64/conf/GENERIC stable/9/sys/cam/ctl/ctl.c stable/9/sys/cam/ctl/ctl_backend_block.c stable/9/sys/cam/ctl/ctl_backend_ramdisk.c stable/9/sys/cam/ctl/ctl_error.c stable/9/sys/cam/ctl/ctl_error.h stable/9/sys/cam/ctl/scsi_ctl.c stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_da.h stable/9/sys/cam/scsi/scsi_targ_bh.c stable/9/sys/conf/NOTES stable/9/sys/conf/files stable/9/sys/dev/ata/atapi-cam.c stable/9/sys/dev/ciss/ciss.c stable/9/sys/i386/conf/GENERIC stable/9/sys/i386/conf/PAE stable/9/sys/ia64/conf/GENERIC stable/9/sys/sparc64/conf/GENERIC stable/9/usr.bin/Makefile stable/9/usr.bin/ctlstat/ctlstat.c stable/9/usr.sbin/Makefile stable/9/usr.sbin/mlxcontrol/interface.c Directory Properties: stable/9/ (props changed) stable/9/share/ (props changed) stable/9/share/examples/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/usr.bin/ (props changed) Modified: stable/9/share/examples/scsi_target/scsi_cmds.c ============================================================================== --- stable/9/share/examples/scsi_target/scsi_cmds.c Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/share/examples/scsi_target/scsi_cmds.c Wed Feb 15 17:28:09 2012 (r231772) @@ -328,7 +328,7 @@ tcmd_inquiry(struct ccb_accept_tio *atio bcopy(&inq_data, ctio->data_ptr, sizeof(inq_data)); ctio->dxfer_len = inq_data.additional_length + 4; ctio->dxfer_len = min(ctio->dxfer_len, - SCSI_CDB6_LEN(inq->length)); + scsi_2btoul(inq->length)); ctio->ccb_h.flags |= CAM_DIR_IN | CAM_SEND_STATUS; ctio->scsi_status = SCSI_STATUS_OK; } Modified: stable/9/sys/amd64/conf/GENERIC ============================================================================== --- stable/9/sys/amd64/conf/GENERIC Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/amd64/conf/GENERIC Wed Feb 15 17:28:09 2012 (r231772) @@ -118,7 +118,8 @@ device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) -device ses # SCSI Environmental Services (and SAF-TE) +device ses # Enclosure Services (SES and SAF-TE) +device ctl # CAM Target Layer # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID Modified: stable/9/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Jan 12 00:34:33 2012 (r229997) +++ stable/9/sys/cam/ctl/ctl.c Wed Feb 15 17:28:09 2012 (r231772) @@ -8736,7 +8736,7 @@ ctl_request_sense(struct ctl_scsiio *cts struct ctl_lun *lun; uint32_t initidx; int have_error; - ctl_sense_format sense_format; + scsi_sense_data_type sense_format; cdb = (struct scsi_request_sense *)ctsio->cdb; @@ -8748,9 +8748,9 @@ ctl_request_sense(struct ctl_scsiio *cts * Determine which sense format the user wants. */ if (cdb->byte2 & SRS_DESC) - sense_format = CTL_SENSE_DESCRIPTOR; + sense_format = SSD_TYPE_DESC; else - sense_format = CTL_SENSE_FIXED; + sense_format = SSD_TYPE_FIXED; ctsio->kern_data_ptr = malloc(sizeof(*sense_ptr), M_CTL, M_WAITOK); if (ctsio->kern_data_ptr == NULL) { @@ -8789,13 +8789,13 @@ ctl_request_sense(struct ctl_scsiio *cts */ mtx_lock(&lun->ctl_softc->ctl_lock); if (ctl_is_set(lun->have_ca, initidx)) { - ctl_sense_format stored_format; + scsi_sense_data_type stored_format; /* * Check to see which sense format was used for the stored * sense data. */ - stored_format = ctl_get_sense_format( + stored_format = scsi_sense_type( &lun->pending_sense[initidx].sense); /* @@ -8804,14 +8804,17 @@ ctl_request_sense(struct ctl_scsiio *cts * format. If we're going from descriptor to fixed format * sense data, we may lose things in translation, depending * on what options were used. + * + * If the stored format is SSD_TYPE_NONE (i.e. invalid), + * for some reason we'll just copy it out as-is. */ - if ((stored_format == CTL_SENSE_FIXED) - && (sense_format == CTL_SENSE_DESCRIPTOR)) + if ((stored_format == SSD_TYPE_FIXED) + && (sense_format == SSD_TYPE_DESC)) ctl_sense_to_desc((struct scsi_sense_data_fixed *) &lun->pending_sense[initidx].sense, (struct scsi_sense_data_desc *)sense_ptr); - else if ((stored_format == CTL_SENSE_DESCRIPTOR) - && (sense_format == CTL_SENSE_FIXED)) + else if ((stored_format == SSD_TYPE_DESC) + && (sense_format == SSD_TYPE_FIXED)) ctl_sense_to_fixed((struct scsi_sense_data_desc *) &lun->pending_sense[initidx].sense, (struct scsi_sense_data_fixed *)sense_ptr); @@ -10459,14 +10462,14 @@ ctl_scsiio_precheck(struct ctl_softc *ct ua_type = lun->pending_sense[initidx].ua_pending; if (ua_type != CTL_UA_NONE) { - ctl_sense_format sense_format; + scsi_sense_data_type sense_format; if (lun != NULL) sense_format = (lun->flags & - CTL_LUN_SENSE_DESC) ? CTL_SENSE_DESCRIPTOR : - CTL_SENSE_FIXED; + CTL_LUN_SENSE_DESC) ? SSD_TYPE_DESC : + SSD_TYPE_FIXED; else - sense_format = CTL_SENSE_FIXED; + sense_format = SSD_TYPE_FIXED; ua_type = ctl_build_ua(ua_type, &ctsio->sense_data, sense_format); Modified: stable/9/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Thu Jan 12 00:34:33 2012 (r229997) +++ stable/9/sys/cam/ctl/ctl_backend_block.c Wed Feb 15 17:28:09 2012 (r231772) @@ -260,15 +260,15 @@ int ctl_be_block_init(void); static struct ctl_backend_driver ctl_be_block_driver = { - name: "block", - flags: CTL_BE_FLAG_HAS_CONFIG, - init: ctl_be_block_init, - data_submit: ctl_be_block_submit, - data_move_done: ctl_be_block_move_done, - config_read: ctl_be_block_config_read, - config_write: ctl_be_block_config_write, - ioctl: ctl_be_block_ioctl, - lun_info: ctl_be_block_lun_info + .name = "block", + .flags = CTL_BE_FLAG_HAS_CONFIG, + .init = ctl_be_block_init, + .data_submit = ctl_be_block_submit, + .data_move_done = ctl_be_block_move_done, + .config_read = ctl_be_block_config_read, + .config_write = ctl_be_block_config_write, + .ioctl = ctl_be_block_ioctl, + .lun_info = ctl_be_block_lun_info }; MALLOC_DEFINE(M_CTLBLK, "ctlblk", "Memory used for CTL block backend"); Modified: stable/9/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Thu Jan 12 00:34:33 2012 (r229997) +++ stable/9/sys/cam/ctl/ctl_backend_ramdisk.c Wed Feb 15 17:28:09 2012 (r231772) @@ -110,14 +110,14 @@ static int ctl_backend_ramdisk_config_re static struct ctl_backend_driver ctl_be_ramdisk_driver = { - name: "ramdisk", - flags: CTL_BE_FLAG_HAS_CONFIG, - init: ctl_backend_ramdisk_init, - data_submit: ctl_backend_ramdisk_submit, - data_move_done: ctl_backend_ramdisk_move_done, - config_read: ctl_backend_ramdisk_config_read, - config_write: ctl_backend_ramdisk_config_write, - ioctl: ctl_backend_ramdisk_ioctl + .name = "ramdisk", + .flags = CTL_BE_FLAG_HAS_CONFIG, + .init = ctl_backend_ramdisk_init, + .data_submit = ctl_backend_ramdisk_submit, + .data_move_done = ctl_backend_ramdisk_move_done, + .config_read = ctl_backend_ramdisk_config_read, + .config_write = ctl_backend_ramdisk_config_write, + .ioctl = ctl_backend_ramdisk_ioctl }; MALLOC_DEFINE(M_RAMDISK, "ramdisk", "Memory used for CTL RAMdisk"); Modified: stable/9/sys/cam/ctl/ctl_error.c ============================================================================== --- head/sys/cam/ctl/ctl_error.c Thu Jan 12 00:34:33 2012 (r229997) +++ stable/9/sys/cam/ctl/ctl_error.c Wed Feb 15 17:28:09 2012 (r231772) @@ -354,21 +354,6 @@ ctl_sense_to_fixed(struct scsi_sense_dat SSD_ELEM_NONE); } -ctl_sense_format -ctl_get_sense_format(struct scsi_sense_data *sense_data) -{ - switch (sense_data->error_code & SSD_ERRCODE) { - case SSD_DESC_CURRENT_ERROR: - case SSD_DESC_DEFERRED_ERROR: - return (SSD_TYPE_DESC); - case SSD_CURRENT_ERROR: - case SSD_DEFERRED_ERROR: - default: - return (SSD_TYPE_FIXED); - break; - } -} - void ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq) { @@ -382,7 +367,7 @@ ctl_set_ua(struct ctl_scsiio *ctsio, int ctl_ua_type ctl_build_ua(ctl_ua_type ua_type, struct scsi_sense_data *sense, - ctl_sense_format sense_format) + scsi_sense_data_type sense_format) { ctl_ua_type ua_to_build; int i, asc, ascq; Modified: stable/9/sys/cam/ctl/ctl_error.h ============================================================================== --- head/sys/cam/ctl/ctl_error.h Thu Jan 12 00:34:33 2012 (r229997) +++ stable/9/sys/cam/ctl/ctl_error.h Wed Feb 15 17:28:09 2012 (r231772) @@ -42,12 +42,6 @@ #ifndef _CTL_ERROR_H_ #define _CTL_ERROR_H_ -typedef enum { - CTL_SENSE_NOT_SPECIFIED, - CTL_SENSE_FIXED, - CTL_SENSE_DESCRIPTOR -} ctl_sense_format; - void ctl_set_sense_data_va(struct scsi_sense_data *sense_data, void *lun, scsi_sense_data_type sense_format, int current_error, int sense_key, int asc, int ascq, va_list ap); @@ -60,10 +54,9 @@ void ctl_sense_to_desc(struct scsi_sense struct scsi_sense_data_desc *sense_dest); void ctl_sense_to_fixed(struct scsi_sense_data_desc *sense_src, struct scsi_sense_data_fixed *sense_dest); -ctl_sense_format ctl_get_sense_format(struct scsi_sense_data *sense_data); void ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq); ctl_ua_type ctl_build_ua(ctl_ua_type ua_type, struct scsi_sense_data *sense, - ctl_sense_format sense_format); + scsi_sense_data_type sense_format); void ctl_set_overlapped_cmd(struct ctl_scsiio *ctsio); void ctl_set_overlapped_tag(struct ctl_scsiio *ctsio, uint8_t tag); void ctl_set_invalid_field(struct ctl_scsiio *ctsio, int sks_valid, int command, Modified: stable/9/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Thu Jan 12 00:34:33 2012 (r229997) +++ stable/9/sys/cam/ctl/scsi_ctl.c Wed Feb 15 17:28:09 2012 (r231772) @@ -305,8 +305,10 @@ ctlfeasync(void *callback_arg, uint32_t /* Don't attach if it doesn't support target mode */ if ((cpi->target_sprt & PIT_PROCESSOR) == 0) { +#ifdef CTLFEDEBUG printf("%s: SIM %s%d doesn't support target mode\n", __func__, cpi->dev_name, cpi->unit_number); +#endif break; } @@ -421,8 +423,10 @@ ctlfeasync(void *callback_arg, uint32_t * XXX KDM need to figure out whether we're the master or * slave. */ +#ifdef CTLFEDEBUG printf("%s: calling ctl_frontend_register() for %s%d\n", __func__, cpi->dev_name, cpi->unit_number); +#endif retval = ctl_frontend_register(fe, /*master_SC*/ 1); if (retval != 0) { printf("%s: ctl_frontend_register() failed with " Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/cam/scsi/scsi_all.c Wed Feb 15 17:28:09 2012 (r231772) @@ -5057,14 +5057,7 @@ scsi_inquiry(struct ccb_scsiio *csio, u_ scsi_cmd->byte2 |= SI_EVPD; scsi_cmd->page_code = page_code; } - /* - * A 'transfer units' count of 256 is coded as - * zero for all commands with a single byte count - * field. - */ - if (inq_len == 256) - inq_len = 0; - scsi_cmd->length = inq_len; + scsi_ulto2b(inq_len, scsi_cmd->length); } void Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/cam/scsi/scsi_all.h Wed Feb 15 17:28:09 2012 (r231772) @@ -175,8 +175,7 @@ struct scsi_inquiry #define SI_EVPD 0x01 #define SI_CMDDT 0x02 u_int8_t page_code; - u_int8_t reserved; - u_int8_t length; + u_int8_t length[2]; u_int8_t control; }; @@ -532,6 +531,55 @@ struct scsi_caching_page { uint8_t non_cache_seg_size[3]; }; +/* + * XXX KDM move this off to a vendor shim. + */ +struct copan_power_subpage { + uint8_t page_code; +#define PWR_PAGE_CODE 0x00 + uint8_t subpage; +#define PWR_SUBPAGE_CODE 0x02 + uint8_t page_length[2]; + uint8_t page_version; +#define PWR_VERSION 0x01 + uint8_t total_luns; + uint8_t max_active_luns; +#define PWR_DFLT_MAX_LUNS 0x07 + uint8_t reserved[25]; +}; + +/* + * XXX KDM move this off to a vendor shim. + */ +struct copan_aps_subpage { + uint8_t page_code; +#define APS_PAGE_CODE 0x00 + uint8_t subpage; +#define APS_SUBPAGE_CODE 0x03 + uint8_t page_length[2]; + uint8_t page_version; +#define APS_VERSION 0x00 + uint8_t lock_active; +#define APS_LOCK_ACTIVE 0x01 +#define APS_LOCK_INACTIVE 0x00 + uint8_t reserved[26]; +}; + +/* + * XXX KDM move this off to a vendor shim. + */ +struct copan_debugconf_subpage { + uint8_t page_code; +#define DBGCNF_PAGE_CODE 0x00 + uint8_t subpage; +#define DBGCNF_SUBPAGE_CODE 0xF0 + uint8_t page_length[2]; + uint8_t page_version; +#define DBGCNF_VERSION 0x00 + uint8_t ctl_time_io_secs[2]; +}; + + struct scsi_info_exceptions_page { u_int8_t page_code; #define SIEP_PAGE_SAVABLE 0x80 /* Page is savable */ Modified: stable/9/sys/cam/scsi/scsi_da.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.h Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/cam/scsi/scsi_da.h Wed Feb 15 17:28:09 2012 (r231772) @@ -421,6 +421,56 @@ union disk_pages /* this is the structur } flexible_disk; }; +/* + * XXX KDM + * Here for CTL compatibility, reconcile this. + */ +struct scsi_format_page { + uint8_t page_code; + uint8_t page_length; + uint8_t tracks_per_zone[2]; + uint8_t alt_sectors_per_zone[2]; + uint8_t alt_tracks_per_zone[2]; + uint8_t alt_tracks_per_lun[2]; + uint8_t sectors_per_track[2]; + uint8_t bytes_per_sector[2]; + uint8_t interleave[2]; + uint8_t track_skew[2]; + uint8_t cylinder_skew[2]; + uint8_t flags; +#define SFP_SSEC 0x80 +#define SFP_HSEC 0x40 +#define SFP_RMB 0x20 +#define SFP_SURF 0x10 + uint8_t reserved[3]; +}; + +/* + * XXX KDM + * Here for CTL compatibility, reconcile this. + */ +struct scsi_rigid_disk_page { + uint8_t page_code; +#define SMS_RIGID_DISK_PAGE 0x04 + uint8_t page_length; + uint8_t cylinders[3]; + uint8_t heads; + uint8_t start_write_precomp[3]; + uint8_t start_reduced_current[3]; + uint8_t step_rate[2]; + uint8_t landing_zone_cylinder[3]; + uint8_t rpl; +#define SRDP_RPL_DISABLED 0x00 +#define SRDP_RPL_SLAVE 0x01 +#define SRDP_RPL_MASTER 0x02 +#define SRDP_RPL_MASTER_CONTROL 0x03 + uint8_t rotational_offset; + uint8_t reserved1; + uint8_t rotation_rate[2]; + uint8_t reserved2[2]; +}; + + struct scsi_da_rw_recovery_page { u_int8_t page_code; #define SMS_RW_ERROR_RECOVERY_PAGE 0x01 Modified: stable/9/sys/cam/scsi/scsi_targ_bh.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_targ_bh.c Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/cam/scsi/scsi_targ_bh.c Wed Feb 15 17:28:09 2012 (r231772) @@ -604,7 +604,7 @@ targbhdone(struct cam_periph *periph, un atio->ccb_h.flags |= CAM_DIR_IN; descr->data = &no_lun_inq_data; descr->data_resid = MIN(sizeof(no_lun_inq_data), - SCSI_CDB6_LEN(inq->length)); + scsi_2btoul(inq->length)); descr->data_increment = descr->data_resid; descr->timeout = 5 * 1000; descr->status = SCSI_STATUS_OK; Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/conf/NOTES Wed Feb 15 17:28:09 2012 (r231772) @@ -1283,6 +1283,7 @@ device targ #SCSI Target Mode Code device targbh #SCSI Target Mode Blackhole Device device pass #CAM passthrough driver device sg #Linux SCSI passthrough +device ctl #CAM Target Layer # CAM OPTIONS: # debugging options: Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/conf/files Wed Feb 15 17:28:09 2012 (r231772) @@ -115,6 +115,19 @@ cam/scsi/scsi_all.c optional scbus cam/scsi/scsi_cd.c optional cd cam/scsi/scsi_ch.c optional ch cam/ata/ata_da.c optional ada | da +cam/ctl/ctl.c optional ctl +cam/ctl/ctl_backend.c optional ctl +cam/ctl/ctl_backend_block.c optional ctl +cam/ctl/ctl_backend_ramdisk.c optional ctl +cam/ctl/ctl_cmd_table.c optional ctl +cam/ctl/ctl_frontend.c optional ctl +cam/ctl/ctl_frontend_cam_sim.c optional ctl +cam/ctl/ctl_frontend_internal.c optional ctl +cam/ctl/ctl_mem_pool.c optional ctl +cam/ctl/ctl_scsi_all.c optional ctl +cam/ctl/ctl_error.c optional ctl +cam/ctl/ctl_util.c optional ctl +cam/ctl/scsi_ctl.c optional ctl cam/scsi/scsi_da.c optional da cam/scsi/scsi_low.c optional ct | ncv | nsp | stg cam/scsi/scsi_low_pisa.c optional ct | ncv | nsp | stg Modified: stable/9/sys/dev/ata/atapi-cam.c ============================================================================== --- stable/9/sys/dev/ata/atapi-cam.c Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/dev/ata/atapi-cam.c Wed Feb 15 17:28:09 2012 (r231772) @@ -576,9 +576,10 @@ atapi_action(struct cam_sim *sim, union struct scsi_inquiry *inq = (struct scsi_inquiry *) &request->u.atapi.ccb[0]; if (inq->byte2 == 0 && inq->page_code == 0 && - inq->length > SHORT_INQUIRY_LENGTH) { + scsi_2btoul(inq->length) > SHORT_INQUIRY_LENGTH) { bzero(buf, len); - len = inq->length = SHORT_INQUIRY_LENGTH; + len = SHORT_INQUIRY_LENGTH; + scsi_ulto2b(len, inq->length); } break; } Modified: stable/9/sys/dev/ciss/ciss.c ============================================================================== --- stable/9/sys/dev/ciss/ciss.c Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/dev/ciss/ciss.c Wed Feb 15 17:28:09 2012 (r231772) @@ -1620,7 +1620,7 @@ ciss_inquiry_logical(struct ciss_softc * inq->opcode = INQUIRY; inq->byte2 = SI_EVPD; inq->page_code = CISS_VPD_LOGICAL_DRIVE_GEOMETRY; - inq->length = sizeof(ld->cl_geometry); + scsi_ulto2b(sizeof(ld->cl_geometry), inq->length); if ((error = ciss_synch_request(cr, 60 * 1000)) != 0) { ciss_printf(sc, "error getting geometry (%d)\n", error); Modified: stable/9/sys/i386/conf/GENERIC ============================================================================== --- stable/9/sys/i386/conf/GENERIC Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/i386/conf/GENERIC Wed Feb 15 17:28:09 2012 (r231772) @@ -125,7 +125,8 @@ device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) -device ses # SCSI Environmental Services (and SAF-TE) +device ses # Enclosure Services (SES and SAF-TE) +device ctl # CAM Target Layer # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID Modified: stable/9/sys/i386/conf/PAE ============================================================================== --- stable/9/sys/i386/conf/PAE Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/i386/conf/PAE Wed Feb 15 17:28:09 2012 (r231772) @@ -23,6 +23,7 @@ device ispfw # address properly may cause data corruption when used in a machine with more # than 4 gigabytes of memory. + nodevice ahb nodevice amd nodevice sym @@ -38,6 +39,8 @@ nodevice ncv nodevice nsp nodevice stg +nodevice ctl + nodevice asr nodevice dpt nodevice mly Modified: stable/9/sys/ia64/conf/GENERIC ============================================================================== --- stable/9/sys/ia64/conf/GENERIC Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/ia64/conf/GENERIC Wed Feb 15 17:28:09 2012 (r231772) @@ -99,7 +99,8 @@ device ch # Media changer device da # Direct Access (ie disk) device pass # Passthrough (direct ATA/SCSI access) device sa # Sequential Access (ie tape) -device ses # Environmental Services (and SAF-TE) +device ses # Enclosure Services (SES and SAF-TE) +device ctl # CAM Target Layer # RAID controllers device aac # Adaptec FSA RAID Modified: stable/9/sys/sparc64/conf/GENERIC ============================================================================== --- stable/9/sys/sparc64/conf/GENERIC Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/sys/sparc64/conf/GENERIC Wed Feb 15 17:28:09 2012 (r231772) @@ -105,6 +105,7 @@ device sa # Sequential Access (tape et device cd # CD device pass # Passthrough device (direct ATA/SCSI access) device ses # SCSI Environmental Services (and SAF-TE) +device ctl # CAM Target Layer # RAID controllers #device amr # AMI MegaRAID Modified: stable/9/usr.bin/Makefile ============================================================================== --- stable/9/usr.bin/Makefile Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/usr.bin/Makefile Wed Feb 15 17:28:09 2012 (r231772) @@ -33,6 +33,7 @@ SUBDIR= alias \ compress \ cpuset \ csplit \ + ctlstat \ cut \ dirname \ du \ Modified: stable/9/usr.bin/ctlstat/ctlstat.c ============================================================================== --- head/usr.bin/ctlstat/ctlstat.c Thu Jan 12 00:34:33 2012 (r229997) +++ stable/9/usr.bin/ctlstat/ctlstat.c Wed Feb 15 17:28:09 2012 (r231772) @@ -146,7 +146,7 @@ static void compute_stats(struct ctl_lun static void usage(int error) { - fprintf(error ? stderr : stdout, ctlstat_usage); + fputs(ctlstat_usage, error ? stderr : stdout); } static int Modified: stable/9/usr.sbin/Makefile ============================================================================== --- stable/9/usr.sbin/Makefile Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/usr.sbin/Makefile Wed Feb 15 17:28:09 2012 (r231772) @@ -16,6 +16,7 @@ SUBDIR= adduser \ clear_locks \ crashinfo \ cron \ + ctladm \ daemon \ dconschat \ devinfo \ Modified: stable/9/usr.sbin/mlxcontrol/interface.c ============================================================================== --- stable/9/usr.sbin/mlxcontrol/interface.c Wed Feb 15 17:09:26 2012 (r231771) +++ stable/9/usr.sbin/mlxcontrol/interface.c Wed Feb 15 17:28:09 2012 (r231772) @@ -253,7 +253,7 @@ mlx_scsi_inquiry(int unit, int channel, /* build the cdb */ inq_cmd->opcode = INQUIRY; - inq_cmd->length = SHORT_INQUIRY_LENGTH; + scsi_ulto2b(SHORT_INQUIRY_LENGTH, inq_cmd->length); /* hand it off for processing */ mlx_perform(unit, mlx_command, &cmd); From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 17:46:17 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A866106566B; Wed, 15 Feb 2012 17:46:17 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08D428FC08; Wed, 15 Feb 2012 17:46: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 q1FHkGbt073585; Wed, 15 Feb 2012 17:46:16 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FHkG7u073583; Wed, 15 Feb 2012 17:46:16 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202151746.q1FHkG7u073583@svn.freebsd.org> From: "Kenneth D. Merry" Date: Wed, 15 Feb 2012 17:46:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231773 - stable/9/sys/cam/ctl X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 17:46:17 -0000 Author: ken Date: Wed Feb 15 17:46:16 2012 New Revision: 231773 URL: http://svn.freebsd.org/changeset/base/231773 Log: MFC r231092 r231092 | emaste | 2012-02-06 11:11:00 -0700 (Mon, 06 Feb 2012) | 4 lines Avoid panic from unlocking a not locked mutex (in some error cases). Reviewed by: ken@ Modified: stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c Wed Feb 15 17:28:09 2012 (r231772) +++ stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c Wed Feb 15 17:46:16 2012 (r231773) @@ -221,6 +221,7 @@ cfcs_init(void) mtx_lock(&softc->lock); if (xpt_bus_register(softc->sim, NULL, 0) != CAM_SUCCESS) { + mtx_unlock(&softc->lock); printf("%s: error registering SIM\n", __func__); retval = ENOMEM; goto bailout; @@ -230,6 +231,7 @@ cfcs_init(void) cam_sim_path(softc->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + mtx_unlock(&softc->lock); printf("%s: error creating path\n", __func__); xpt_bus_deregister(cam_sim_path(softc->sim)); retval = 1; @@ -253,8 +255,6 @@ bailout: else if (softc->devq) cam_simq_free(softc->devq); - mtx_unlock(&softc->lock); - return (retval); } From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 18:15:26 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CABEA1065670; Wed, 15 Feb 2012 18:15:26 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EF538FC0C; Wed, 15 Feb 2012 18:15:26 +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 q1FIFQvX074780; Wed, 15 Feb 2012 18:15:26 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FIFQVn074778; Wed, 15 Feb 2012 18:15:26 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201202151815.q1FIFQVn074778@svn.freebsd.org> From: Alan Cox Date: Wed, 15 Feb 2012 18:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231775 - stable/9/sys/fs/tmpfs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 18:15:26 -0000 Author: alc Date: Wed Feb 15 18:15:26 2012 New Revision: 231775 URL: http://svn.freebsd.org/changeset/base/231775 Log: MFC r229363 Don't pass VM_ALLOC_ZERO to vm_page_grab() in tmpfs_mappedwrite() and tmpfs_nocacheread(). It is both unnecessary and a pessimization. It results in either the page being zeroed twice or zeroed first and then overwritten by an I/O operation. Modified: stable/9/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/9/sys/fs/tmpfs/tmpfs_vnops.c Wed Feb 15 18:07:24 2012 (r231774) +++ stable/9/sys/fs/tmpfs/tmpfs_vnops.c Wed Feb 15 18:15:26 2012 (r231775) @@ -442,7 +442,7 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p VM_OBJECT_LOCK(tobj); vm_object_pip_add(tobj, 1); m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + VM_ALLOC_NORMAL | VM_ALLOC_RETRY); if (m->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(tobj, idx, NULL, NULL)) { error = vm_pager_get_pages(tobj, &m, 1, 0); @@ -666,7 +666,7 @@ nocache: VM_OBJECT_LOCK(tobj); vm_object_pip_add(tobj, 1); tpg = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + VM_ALLOC_NORMAL | VM_ALLOC_RETRY); if (tpg->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(tobj, idx, NULL, NULL)) { error = vm_pager_get_pages(tobj, &tpg, 1, 0); From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 21:03:26 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA299106566B; Wed, 15 Feb 2012 21:03:26 +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 B7C9F8FC0A; Wed, 15 Feb 2012 21:03:26 +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 q1FL3Q85081186; Wed, 15 Feb 2012 21:03:26 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FL3Qp4081183; Wed, 15 Feb 2012 21:03:26 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202152103.q1FL3Qp4081183@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 15 Feb 2012 21:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231779 - stable/9/usr.bin/sockstat X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 21:03:27 -0000 Author: jilles Date: Wed Feb 15 21:03:26 2012 New Revision: 231779 URL: http://svn.freebsd.org/changeset/base/231779 Log: MFC r230512: sockstat: Also show sockets not associated with a descriptor. Sockets not associated with a file descriptor include TCP TIME_WAIT states and sockets created via the socket(9) API such as from rpc.lockd and the NFS client. PR: bin/164081 Modified: stable/9/usr.bin/sockstat/sockstat.1 stable/9/usr.bin/sockstat/sockstat.c Directory Properties: stable/9/usr.bin/sockstat/ (props changed) Modified: stable/9/usr.bin/sockstat/sockstat.1 ============================================================================== --- stable/9/usr.bin/sockstat/sockstat.1 Wed Feb 15 18:59:26 2012 (r231778) +++ stable/9/usr.bin/sockstat/sockstat.1 Wed Feb 15 21:03:26 2012 (r231779) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 9, 2009 +.Dd January 24, 2012 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -137,19 +137,10 @@ The address the foreign end of the socke .Xr getpeername 2 ) . .El .Pp -Note that TCP sockets in the -.Dv AF_INET -or -.Dv AF_INET6 -domains that are not in one of the -.Dv LISTEN , SYN_SENT , -or -.Dv ESTABLISHED -states may not be shown by -.Nm ; -use -.Xr netstat 1 -to examine them instead. +If a socket is associated with more than one file descriptor, +it is shown multiple times. +If a socket is not associated with any file descriptor, +the first four columns have no meaning. .Sh SEE ALSO .Xr fstat 1 , .Xr netstat 1 , @@ -167,10 +158,3 @@ The .Nm command and this manual page were written by .An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . -.Sh BUGS -Unlike -.Xr netstat 1 , -.Nm -lists sockets by walking file descriptor tables and will not output -the ones owned by the kernel, e.g. NLM sockets created by -.Xr rpc.lockd 8 . Modified: stable/9/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/9/usr.bin/sockstat/sockstat.c Wed Feb 15 18:59:26 2012 (r231778) +++ stable/9/usr.bin/sockstat/sockstat.c Wed Feb 15 21:03:26 2012 (r231779) @@ -86,6 +86,7 @@ static int *ports; struct sock { void *socket; void *pcb; + int shown; int vflag; int family; int proto; @@ -572,12 +573,67 @@ check_ports(struct sock *s) } static void +displaysock(struct sock *s, int pos) +{ + void *p; + int hash; + + while (pos < 29) + pos += xprintf(" "); + pos += xprintf("%s", s->protoname); + if (s->vflag & INP_IPV4) + pos += xprintf("4 "); + if (s->vflag & INP_IPV6) + pos += xprintf("6 "); + while (pos < 36) + pos += xprintf(" "); + switch (s->family) { + case AF_INET: + case AF_INET6: + pos += printaddr(s->family, &s->laddr); + if (s->family == AF_INET6 && pos >= 58) + pos += xprintf(" "); + while (pos < 58) + pos += xprintf(" "); + pos += printaddr(s->family, &s->faddr); + break; + case AF_UNIX: + /* server */ + if (s->laddr.ss_len > 0) { + pos += printaddr(s->family, &s->laddr); + break; + } + /* client */ + p = *(void **)&s->faddr; + if (p == NULL) { + pos += xprintf("(not connected)"); + break; + } + pos += xprintf("-> "); + for (hash = 0; hash < HASHSIZE; ++hash) { + for (s = sockhash[hash]; s != NULL; s = s->next) + if (s->pcb == p) + break; + if (s != NULL) + break; + } + if (s == NULL || s->laddr.ss_len == 0) + pos += xprintf("??"); + else + pos += printaddr(s->family, &s->laddr); + break; + default: + abort(); + } + xprintf("\n"); +} + +static void display(void) { struct passwd *pwd; struct xfile *xf; struct sock *s; - void *p; int hash, n, pos; printf("%-8s %-10s %-5s %-2s %-6s %-21s %-21s\n", @@ -595,6 +651,7 @@ display(void) continue; if (!check_ports(s)) continue; + s->shown = 1; pos = 0; if ((pwd = getpwuid(xf->xf_uid)) == NULL) pos += xprintf("%lu ", (u_long)xf->xf_uid); @@ -609,54 +666,19 @@ display(void) while (pos < 26) pos += xprintf(" "); pos += xprintf("%d ", xf->xf_fd); - while (pos < 29) - pos += xprintf(" "); - pos += xprintf("%s", s->protoname); - if (s->vflag & INP_IPV4) - pos += xprintf("4 "); - if (s->vflag & INP_IPV6) - pos += xprintf("6 "); - while (pos < 36) - pos += xprintf(" "); - switch (s->family) { - case AF_INET: - case AF_INET6: - pos += printaddr(s->family, &s->laddr); - if (s->family == AF_INET6 && pos >= 58) - pos += xprintf(" "); - while (pos < 58) - pos += xprintf(" "); - pos += printaddr(s->family, &s->faddr); - break; - case AF_UNIX: - /* server */ - if (s->laddr.ss_len > 0) { - pos += printaddr(s->family, &s->laddr); - break; - } - /* client */ - p = *(void **)&s->faddr; - if (p == NULL) { - pos += xprintf("(not connected)"); - break; - } - pos += xprintf("-> "); - for (hash = 0; hash < HASHSIZE; ++hash) { - for (s = sockhash[hash]; s != NULL; s = s->next) - if (s->pcb == p) - break; - if (s != NULL) - break; - } - if (s == NULL || s->laddr.ss_len == 0) - pos += xprintf("??"); - else - pos += printaddr(s->family, &s->laddr); - break; - default: - abort(); + displaysock(s, pos); + } + for (hash = 0; hash < HASHSIZE; hash++) { + for (s = sockhash[hash]; s != NULL; s = s->next) { + if (s->shown) + continue; + if (!check_ports(s)) + continue; + pos = 0; + pos += xprintf("%-8s %-10s %-5s %-2s ", + "?", "?", "?", "?"); + displaysock(s, pos); } - xprintf("\n"); } } From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 21:48:45 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11A551065670; Wed, 15 Feb 2012 21:48:45 +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 F38678FC15; Wed, 15 Feb 2012 21:48:44 +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 q1FLmiZA083284; Wed, 15 Feb 2012 21:48:44 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FLmi8P083282; Wed, 15 Feb 2012 21:48:44 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202152148.q1FLmi8P083282@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 15 Feb 2012 21:48:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231783 - stable/9/tools/regression/bin/sh/builtins X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 21:48:45 -0000 Author: jilles Date: Wed Feb 15 21:48:44 2012 New Revision: 231783 URL: http://svn.freebsd.org/changeset/base/231783 Log: MFC r229742: sh: Avoid possible echo options in a testcase. Modified: stable/9/tools/regression/bin/sh/builtins/getopts1.0 Directory Properties: stable/9/tools/regression/bin/sh/ (props changed) Modified: stable/9/tools/regression/bin/sh/builtins/getopts1.0 ============================================================================== --- stable/9/tools/regression/bin/sh/builtins/getopts1.0 Wed Feb 15 21:48:29 2012 (r231782) +++ stable/9/tools/regression/bin/sh/builtins/getopts1.0 Wed Feb 15 21:48:44 2012 (r231783) @@ -1,6 +1,6 @@ # $FreeBSD$ -echo '-1-' +printf -- '-1-\n' set -- -abc getopts "ab:" OPTION echo ${OPTION} @@ -11,7 +11,7 @@ echo ${OPTION} # ksh93 20090505; pdksh 5.2.14p2; mksh R39c; bash 4.1 PL7; and zsh 4.3.10. # all recognize that "b" is missing its argument on the *first* iteration # of 'getopts' and do not produce the "a" in $OPTION. -echo '-2-' +printf -- '-2-\n' set -- -ab getopts "ab:" OPTION echo ${OPTION} @@ -19,7 +19,7 @@ getopts "ab:" OPTION echo ${OPTION} # The 'shift' is aimed at causing an error. -echo '-3-' +printf -- '-3-\n' shift 1 getopts "ab:" OPTION echo ${OPTION} From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 21:52:14 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E726F1065670; Wed, 15 Feb 2012 21:52:14 +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 D531B8FC13; Wed, 15 Feb 2012 21:52:14 +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 q1FLqEYC083458; Wed, 15 Feb 2012 21:52:14 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FLqESh083455; Wed, 15 Feb 2012 21:52:14 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202152152.q1FLqESh083455@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 15 Feb 2012 21:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231784 - stable/9/bin/sh X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 21:52:15 -0000 Author: jilles Date: Wed Feb 15 21:52:14 2012 New Revision: 231784 URL: http://svn.freebsd.org/changeset/base/231784 Log: MFC r229219: sh: Remove unused function scopyn(). Modified: stable/9/bin/sh/mystring.c stable/9/bin/sh/mystring.h Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/mystring.c ============================================================================== --- stable/9/bin/sh/mystring.c Wed Feb 15 21:48:44 2012 (r231783) +++ stable/9/bin/sh/mystring.c Wed Feb 15 21:52:14 2012 (r231784) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); * * equal(s1, s2) Return true if strings are equal. * scopy(from, to) Copy a string. - * scopyn(from, to, n) Like scopy, but checks for overflow. * number(s) Convert a string of digits to an integer. * is_number(s) Return true if s is a string of digits. */ @@ -67,24 +66,6 @@ char nullstr[1]; /* zero length string /* - * scopyn - copy a string from "from" to "to", truncating the string - * if necessary. "To" is always nul terminated, even if - * truncation is performed. "Size" is the size of "to". - */ - -void -scopyn(const char *from, char *to, int size) -{ - - while (--size > 0) { - if ((*to++ = *from++) == '\0') - return; - } - *to = '\0'; -} - - -/* * prefix -- see if pfx is a prefix of string. */ Modified: stable/9/bin/sh/mystring.h ============================================================================== --- stable/9/bin/sh/mystring.h Wed Feb 15 21:48:44 2012 (r231783) +++ stable/9/bin/sh/mystring.h Wed Feb 15 21:52:14 2012 (r231784) @@ -35,7 +35,6 @@ #include -void scopyn(const char *, char *, int); int prefix(const char *, const char *); int number(const char *); int is_number(const char *); From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 21:55:49 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27F74106566C; Wed, 15 Feb 2012 21:55:49 +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 161008FC1F; Wed, 15 Feb 2012 21:55:49 +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 q1FLtmri083621; Wed, 15 Feb 2012 21:55:48 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FLtmwF083619; Wed, 15 Feb 2012 21:55:48 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202152155.q1FLtmwF083619@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 15 Feb 2012 21:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231785 - stable/9/tools/regression/bin/test X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 21:55:49 -0000 Author: jilles Date: Wed Feb 15 21:55:48 2012 New Revision: 231785 URL: http://svn.freebsd.org/changeset/base/231785 Log: MFC r228109: test: Add more testcases. The new testcases pass even on old stable/7, but some other implementations manage to get them wrong. Also remove a few duplicate testcases. Modified: stable/9/tools/regression/bin/test/regress.sh Directory Properties: stable/9/tools/regression/bin/test/ (props changed) Modified: stable/9/tools/regression/bin/test/regress.sh ============================================================================== --- stable/9/tools/regression/bin/test/regress.sh Wed Feb 15 21:52:14 2012 (r231784) +++ stable/9/tools/regression/bin/test/regress.sh Wed Feb 15 21:55:48 2012 (r231785) @@ -52,7 +52,7 @@ t () } count=0 -echo "1..97" +echo "1..130" t 0 'b = b' t 0 'b == b' @@ -138,8 +138,6 @@ t 1 '! = a' t 0 '! != -n' t 0 '! -c /etc/passwd' -t 0 '! \( = \)' -t 1 '! \( != \)' t 1 '! = = =' t 0 '! = = \)' t 0 '! "" -o ""' @@ -147,7 +145,6 @@ t 1 '! "x" -o ""' t 1 '! "" -o "x"' t 1 '! "x" -o "x"' t 0 '\( -f /etc/passwd \)' -t 1 '\( ! = \)' t 0 '\( ! "" \)' t 1 '\( ! -e \)' @@ -160,3 +157,40 @@ t 1 '-z y -o y = "#" -o y = x' t 0 '0 -ne 0 -o ! -f /' t 0 '1 -ne 0 -o ! -f /etc/passwd' t 1 '0 -ne 0 -o ! -f /etc/passwd' + +t 0 '-n =' +t 1 '-z =' +t 1 '! =' +t 0 '-n -eq' +t 1 '-z -eq' +t 1 '! -eq' +t 0 '-n -a' +t 1 '-z -a' +t 1 '! -a' +t 0 '-n -o' +t 1 '-z -o' +t 1 '! -o' +t 1 '! -n =' +t 0 '! -z =' +t 0 '! ! =' +t 1 '! -n -eq' +t 0 '! -z -eq' +t 0 '! ! -eq' +t 1 '! -n -a' +t 0 '! -z -a' +t 0 '! ! -a' +t 1 '! -n -o' +t 0 '! -z -o' +t 0 '! ! -o' +t 0 '\( -n = \)' +t 1 '\( -z = \)' +t 1 '\( ! = \)' +t 0 '\( -n -eq \)' +t 1 '\( -z -eq \)' +t 1 '\( ! -eq \)' +t 0 '\( -n -a \)' +t 1 '\( -z -a \)' +t 1 '\( ! -a \)' +t 0 '\( -n -o \)' +t 1 '\( -z -o \)' +t 1 '\( ! -o \)' From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 22:07:09 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDDC1106566B; Wed, 15 Feb 2012 22:07:09 +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 B1ACE8FC0C; Wed, 15 Feb 2012 22:07: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 q1FM79wM084121; Wed, 15 Feb 2012 22:07:09 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FM79Fu084119; Wed, 15 Feb 2012 22:07:09 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202152207.q1FM79Fu084119@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 15 Feb 2012 22:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231786 - stable/9/tools/regression/doat X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 22:07:10 -0000 Author: jilles Date: Wed Feb 15 22:07:09 2012 New Revision: 231786 URL: http://svn.freebsd.org/changeset/base/231786 Log: MFC r226523: Fix some memory errors in *at() regression tests. Modified: stable/9/tools/regression/doat/doat.c Directory Properties: stable/9/tools/regression/doat/ (props changed) Modified: stable/9/tools/regression/doat/doat.c ============================================================================== --- stable/9/tools/regression/doat/doat.c Wed Feb 15 21:55:48 2012 (r231785) +++ stable/9/tools/regression/doat/doat.c Wed Feb 15 22:07:09 2012 (r231786) @@ -103,8 +103,9 @@ setup(void) { int i, error; struct stat sb; + size_t len; - tests = calloc(NUM_OF_TESTS, sizeof(struct test)); + tests = calloc(NUM_OF_TESTS + 1, sizeof(struct test)); if (tests == NULL) { perror(""); exit(0); @@ -116,14 +117,16 @@ setup(void) exit(0); } - absolute_path = realloc(absolute_path, strlen(absolute_path) + 5); + len = strlen(absolute_path); + absolute_path = realloc(absolute_path, + len + 1 + strlen(relative_path) + 1); if (absolute_path == NULL) { perror("realloc"); exit(0); } - absolute_path[strlen(absolute_path)] = '/'; - strcpy(absolute_path + strlen(absolute_path), relative_path); + absolute_path[len] = '/'; + strcpy(absolute_path + len + 1, relative_path); absolute_file = malloc(strlen(absolute_path) + 1 + strlen(file)); bzero(absolute_file, strlen(absolute_path) + 1 + strlen(file)); @@ -145,7 +148,7 @@ setup(void) relative_file[strlen(relative_file)] = '/'; strcpy(relative_file + strlen(relative_path), file); - error = mkdir(relative_path, 666); + error = mkdir(relative_path, 0700); dir_exist = (errno == EEXIST); if (error && errno != EEXIST) { perror("tmp"); @@ -154,7 +157,7 @@ setup(void) error = stat("tmp/foo", &sb); file_exist = (errno != ENOENT); - i = open("tmp/foo", O_RDONLY | O_CREAT); + i = open("tmp/foo", O_RDONLY | O_CREAT, 0666); if (i == -1) { perror("foo"); exit(0); From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 22:45:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48FD91065678; Wed, 15 Feb 2012 22:45:58 +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 365638FC0A; Wed, 15 Feb 2012 22:45:58 +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 q1FMjwGH085725; Wed, 15 Feb 2012 22:45:58 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FMjvY1085714; Wed, 15 Feb 2012 22:45:57 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202152245.q1FMjvY1085714@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 15 Feb 2012 22:45:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231790 - stable/9/bin/sh X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 22:45:58 -0000 Author: jilles Date: Wed Feb 15 22:45:57 2012 New Revision: 231790 URL: http://svn.freebsd.org/changeset/base/231790 Log: MFC r229220: sh: Make various functions static. Modified: stable/9/bin/sh/exec.c stable/9/bin/sh/exec.h stable/9/bin/sh/expand.c stable/9/bin/sh/expand.h stable/9/bin/sh/histedit.c stable/9/bin/sh/input.c stable/9/bin/sh/input.h stable/9/bin/sh/main.c stable/9/bin/sh/main.h stable/9/bin/sh/myhistedit.h Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/exec.c ============================================================================== --- stable/9/bin/sh/exec.c Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/exec.c Wed Feb 15 22:45:57 2012 (r231790) @@ -100,6 +100,7 @@ static void tryexec(char *, char **, cha static void printentry(struct tblentry *, int); static struct tblentry *cmdlookup(const char *, int); static void delete_cmd_entry(void); +static void addcmdentry(const char *, struct cmdentry *); @@ -593,7 +594,7 @@ delete_cmd_entry(void) * the same name. */ -void +static void addcmdentry(const char *name, struct cmdentry *entry) { struct tblentry *cmdp; Modified: stable/9/bin/sh/exec.h ============================================================================== --- stable/9/bin/sh/exec.h Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/exec.h Wed Feb 15 22:45:57 2012 (r231790) @@ -70,7 +70,6 @@ void find_command(const char *, struct c int find_builtin(const char *, int *); void hashcd(void); void changepath(const char *); -void addcmdentry(const char *, struct cmdentry *); void defun(const char *, union node *); int unsetfunc(const char *); int typecmd_impl(int, char **, int, const char *); Modified: stable/9/bin/sh/expand.c ============================================================================== --- stable/9/bin/sh/expand.c Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/expand.c Wed Feb 15 22:45:57 2012 (r231790) @@ -113,6 +113,7 @@ static void expmeta(char *, char *); static void addfname(char *); static struct strlist *expsort(struct strlist *); static struct strlist *msort(struct strlist *, int); +static int patmatch(const char *, const char *, int); static char *cvtnum(int, char *); static int collate_range_cmp(wchar_t, wchar_t); @@ -1435,7 +1436,7 @@ match_charclass(const char *p, wchar_t c * Returns true if the pattern matches the string. */ -int +static int patmatch(const char *pattern, const char *string, int squoted) { const char *p, *q, *end; Modified: stable/9/bin/sh/expand.h ============================================================================== --- stable/9/bin/sh/expand.h Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/expand.h Wed Feb 15 22:45:57 2012 (r231790) @@ -60,6 +60,5 @@ union node; void expandhere(union node *, int); void expandarg(union node *, struct arglist *, int); void expari(int); -int patmatch(const char *, const char *, int); void rmescapes(char *); int casematch(union node *, const char *); Modified: stable/9/bin/sh/histedit.c ============================================================================== --- stable/9/bin/sh/histedit.c Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/histedit.c Wed Feb 15 22:45:57 2012 (r231790) @@ -70,6 +70,8 @@ int displayhist; static FILE *el_in, *el_out, *el_err; static char *fc_replace(const char *, char *, char *); +static int not_fcnumber(const char *); +static int str_to_event(const char *, int); /* * Set history and editing status. Called whenever the status may @@ -425,7 +427,7 @@ fc_replace(const char *s, char *p, char return (dest); } -int +static int not_fcnumber(const char *s) { if (s == NULL) @@ -435,7 +437,7 @@ not_fcnumber(const char *s) return (!is_number(s)); } -int +static int str_to_event(const char *str, int last) { HistEvent he; Modified: stable/9/bin/sh/input.c ============================================================================== --- stable/9/bin/sh/input.c Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/input.c Wed Feb 15 22:45:57 2012 (r231790) @@ -106,6 +106,7 @@ EditLine *el; /* cookie for editline p static void pushfile(void); static int preadfd(void); +static void popstring(void); #ifdef mkinit INCLUDE "input.h" @@ -372,7 +373,7 @@ pushstring(char *s, int len, void *ap) INTON; } -void +static void popstring(void) { struct strpush *sp = parsefile->strpush; Modified: stable/9/bin/sh/input.h ============================================================================== --- stable/9/bin/sh/input.h Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/input.h Wed Feb 15 22:45:57 2012 (r231790) @@ -53,7 +53,6 @@ int preadbuffer(void); int preadateof(void); void pungetc(void); void pushstring(char *, int, void *); -void popstring(void); void setinputfile(const char *, int); void setinputfd(int, int); void setinputstring(char *, int); Modified: stable/9/bin/sh/main.c ============================================================================== --- stable/9/bin/sh/main.c Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/main.c Wed Feb 15 22:45:57 2012 (r231790) @@ -79,6 +79,7 @@ int rootshell; struct jmploc main_handler; int localeisutf8, initial_localeisutf8; +static void cmdloop(int); static void read_profile(char *); static char *find_dot_file(char *); @@ -184,7 +185,7 @@ state4: /* XXX ??? - why isn't this befo * loop; it turns on prompting if the shell is interactive. */ -void +static void cmdloop(int top) { union node *n; Modified: stable/9/bin/sh/main.h ============================================================================== --- stable/9/bin/sh/main.h Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/main.h Wed Feb 15 22:45:57 2012 (r231790) @@ -38,4 +38,3 @@ extern int rootshell; /* true if we aren extern struct jmploc main_handler; /* top level exception handler */ void readcmdfile(const char *); -void cmdloop(int); Modified: stable/9/bin/sh/myhistedit.h ============================================================================== --- stable/9/bin/sh/myhistedit.h Wed Feb 15 22:35:30 2012 (r231789) +++ stable/9/bin/sh/myhistedit.h Wed Feb 15 22:45:57 2012 (r231790) @@ -39,6 +39,4 @@ extern int displayhist; void histedit(void); void sethistsize(const char *); void setterm(const char *); -int not_fcnumber(const char *); -int str_to_event(const char *, int); From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 22:59:15 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE7C21065677; Wed, 15 Feb 2012 22:59:15 +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 9BA248FC19; Wed, 15 Feb 2012 22:59: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 q1FMxFIm086251; Wed, 15 Feb 2012 22:59:15 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FMxFGA086235; Wed, 15 Feb 2012 22:59:15 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202152259.q1FMxFGA086235@svn.freebsd.org> From: Doug Barton Date: Wed, 15 Feb 2012 22:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231792 - in stable/9/etc: . defaults rc.d X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 22:59:15 -0000 Author: dougb Date: Wed Feb 15 22:59:15 2012 New Revision: 231792 URL: http://svn.freebsd.org/changeset/base/231792 Log: MFC r231667: Fix various issues with the NFS and RPC related scripts. Add new functionality to the force_depend method. Modified: stable/9/etc/defaults/rc.conf stable/9/etc/rc.d/amd stable/9/etc/rc.d/apmd stable/9/etc/rc.d/keyserv stable/9/etc/rc.d/lockd stable/9/etc/rc.d/mountd stable/9/etc/rc.d/nfsd stable/9/etc/rc.d/statd stable/9/etc/rc.d/ypbind stable/9/etc/rc.d/yppasswdd stable/9/etc/rc.d/ypserv stable/9/etc/rc.d/ypset stable/9/etc/rc.d/ypupdated stable/9/etc/rc.d/ypxfrd stable/9/etc/rc.subr Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/defaults/rc.conf ============================================================================== --- stable/9/etc/defaults/rc.conf Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/defaults/rc.conf Wed Feb 15 22:59:15 2012 (r231792) @@ -29,6 +29,8 @@ early_late_divider="FILESYSTEMS" # Scrip # stages of the boot process. Make sure you know # the ramifications if you change this. # See rc.conf(5) for more details. +always_force_depends="NO" # Set to check that indicated dependencies are + # running during boot (can increase boot time). swapfile="NO" # Set to name of swapfile if aux swapfile desired. apm_enable="NO" # Set to YES to enable APM BIOS functions (or NO). Modified: stable/9/etc/rc.d/amd ============================================================================== --- stable/9/etc/rc.d/amd Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/amd Wed Feb 15 22:59:15 2012 (r231792) @@ -19,15 +19,8 @@ extra_commands="reload" amd_precmd() { - if ! checkyesno nfs_client_enable; then - force_depend nfsclient || return 1 - fi - - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi + force_depend nfsclient nfs_client || return 1 + force_depend rpcbind || return 1 case ${amd_map_program} in [Nn][Oo] | '') @@ -49,7 +42,6 @@ amd_precmd() command_args="> /var/run/amd.pid 2> /dev/null" ;; esac - return 0 } load_rc_config $name Modified: stable/9/etc/rc.d/apmd ============================================================================== --- stable/9/etc/rc.d/apmd Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/apmd Wed Feb 15 22:59:15 2012 (r231792) @@ -19,24 +19,18 @@ apmd_prestart() { case `${SYSCTL_N} hw.machine_arch` in i386) - # Enable apm if it is not already enabled - if ! checkyesno apm_enable && \ - ! /etc/rc.d/apm forcestatus 1>/dev/null 2>&1 - then - force_depend apm || return 1 - fi + force_depend apm || return 1 # Warn user about acpi apm compatibility support which # does not work with apmd. if [ ! -e /dev/apmctl ]; then - warn "/dev/apmctl not found; kernel is missing apm(4)" + warn "/dev/apmctl not found; kernel is missing apm(4)" fi ;; *) return 1 ;; esac - return 0 } load_rc_config $name Modified: stable/9/etc/rc.d/keyserv ============================================================================== --- stable/9/etc/rc.d/keyserv Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/keyserv Wed Feb 15 22:59:15 2012 (r231792) @@ -19,13 +19,7 @@ start_precmd="keyserv_prestart" keyserv_prestart() { - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi - - return 0 + force_depend rpcbind || return 1 } load_rc_config $name Modified: stable/9/etc/rc.d/lockd ============================================================================== --- stable/9/etc/rc.d/lockd Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/lockd Wed Feb 15 22:59:15 2012 (r231792) @@ -15,28 +15,16 @@ name="lockd" rcvar=rpc_lockd_enable command="/usr/sbin/rpc.${name}" start_precmd='lockd_precmd' -stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable' -status_precmd=$stop_precmd # Make sure that we are either an NFS client or server, and that we get # the correct flags from rc.conf(5). # lockd_precmd() { - local ret - ret=0 - - if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable - then - ret=1 - fi - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || ret=1 - fi + force_depend rpcbind || return 1 + force_depend statd rpc_statd || return 1 + rc_flags=${rpc_lockd_flags} - return ${ret} } load_rc_config $name Modified: stable/9/etc/rc.d/mountd ============================================================================== --- stable/9/etc/rc.d/mountd Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/mountd Wed Feb 15 22:59:15 2012 (r231792) @@ -19,11 +19,7 @@ extra_commands="reload" mountd_precmd() { - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi + force_depend rpcbind || return 1 # mountd flags will differ depending on rc.conf settings # @@ -48,8 +44,8 @@ mountd_precmd() fi rm -f /var/db/mountdtab - ( umask 022 ; > /var/db/mountdtab ) - return 0 + ( umask 022 ; > /var/db/mountdtab ) || + err 1 'Cannot create /var/db/mountdtab' } load_rc_config $name Modified: stable/9/etc/rc.d/nfsd ============================================================================== --- stable/9/etc/rc.d/nfsd Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/nfsd Wed Feb 15 22:59:15 2012 (r231792) @@ -48,31 +48,15 @@ nfsd_precmd() if checkyesno nfsv4_server_enable; then sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null - if ! checkyesno nfsuserd_enable && \ - ! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1 - then - if ! force_depend nfsuserd; then - err 1 "Cannot run nfsuserd" - fi - fi + force_depend nfsuserd || err 1 "Cannot run nfsuserd" else echo 'NFSv4 is disabled' sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null fi fi - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi - - if ! checkyesno mountd_enable && \ - ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1 - then - force_depend mountd || return 1 - fi - return 0 + force_depend rpcbind || return 1 + force_depend mountd || return 1 } run_rc_command "$1" Modified: stable/9/etc/rc.d/statd ============================================================================== --- stable/9/etc/rc.d/statd Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/statd Wed Feb 15 22:59:15 2012 (r231792) @@ -15,28 +15,15 @@ name="statd" rcvar=rpc_statd_enable command="/usr/sbin/rpc.${name}" start_precmd='statd_precmd' -stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable' -status_precmd=$stop_precmd # Make sure that we are either an NFS client or server, and that we get # the correct flags from rc.conf(5). # statd_precmd() { - local ret - ret=0 - - if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable - then - ret=1 - fi - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || ret=1 - fi + force_depend rpcbind || return 1 + rc_flags=${rpc_statd_flags} - return ${ret} } load_rc_config $name Modified: stable/9/etc/rc.d/ypbind ============================================================================== --- stable/9/etc/rc.d/ypbind Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/ypbind Wed Feb 15 22:59:15 2012 (r231792) @@ -11,22 +11,20 @@ . /etc/rc.subr name="ypbind" -command="/usr/sbin/${name}" -start_precmd="ypbind_precmd" +rcvar="nis_client_enable" load_rc_config $name -rcvar="nis_client_enable" + +command="/usr/sbin/${name}" command_args="${nis_client_flags}" +start_precmd="ypbind_precmd" + ypbind_precmd() { local _domain - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi + force_depend rpcbind || return 1 _domain=`domainname` if [ -z "$_domain" ]; then Modified: stable/9/etc/rc.d/yppasswdd ============================================================================== --- stable/9/etc/rc.d/yppasswdd Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/yppasswdd Wed Feb 15 22:59:15 2012 (r231792) @@ -11,27 +11,22 @@ . /etc/rc.subr name="yppasswdd" -command="/usr/sbin/rpc.${name}" -start_precmd="yppasswdd_precmd" +rcvar="nis_yppasswdd_enable" load_rc_config $name -rcvar="nis_yppasswdd_enable" + +command="/usr/sbin/rpc.${name}" command_args="${nis_yppasswdd_flags}" +start_precmd="yppasswdd_precmd" + yppasswdd_precmd() { local _domain - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi - if ! checkyesno nis_server_enable && \ - ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1 - then - force_depend ypserv || return 1 - fi + force_depend rpcbind || return 1 + force_depend ypserv nis_server || return 1 + _domain=`domainname` if [ -z "$_domain" ]; then warn "NIS domainname(1) is not set." Modified: stable/9/etc/rc.d/ypserv ============================================================================== --- stable/9/etc/rc.d/ypserv Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/ypserv Wed Feb 15 22:59:15 2012 (r231792) @@ -11,21 +11,20 @@ name="ypserv" rcvar="nis_server_enable" -command="/usr/sbin/${name}" -start_precmd="ypserv_prestart" load_rc_config $name + +command="/usr/sbin/${name}" command_args="${nis_server_flags}" +start_precmd="ypserv_prestart" + ypserv_prestart() { local _domain - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi + force_depend rpcbind || return 1 + _domain=`domainname` if [ -z "$_domain" ]; then warn "NIS domainname(1) is not set." Modified: stable/9/etc/rc.d/ypset ============================================================================== --- stable/9/etc/rc.d/ypset Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/ypset Wed Feb 15 22:59:15 2012 (r231792) @@ -11,25 +11,20 @@ name="ypset" rcvar="nis_ypset_enable" -command="/usr/sbin/${name}" -start_precmd="ypset_precmd" + load_rc_config $name + +command="/usr/sbin/${name}" command_args="${nis_ypset_flags}" +start_precmd="ypset_precmd" + ypset_precmd() { local _domain - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi - if ! checkyesno nis_client_enable && \ - ! /etc/rc.d/ypbind forcestatus 1>/dev/null 2>&1 - then - force_depend ypbind || return 1 - fi + force_depend rpcbind || return 1 + force_depend ypbind nis_client || return 1 _domain=`domainname` if [ -z "$_domain" ]; then Modified: stable/9/etc/rc.d/ypupdated ============================================================================== --- stable/9/etc/rc.d/ypupdated Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/ypupdated Wed Feb 15 22:59:15 2012 (r231792) @@ -11,6 +11,9 @@ name="ypupdated" rcvar="rpc_ypupdated_enable" + +load_rc_config $name + command="/usr/sbin/rpc.${name}" start_precmd="rpc_ypupdated_precmd" @@ -18,16 +21,8 @@ rpc_ypupdated_precmd() { local _domain - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi - if ! checkyesno nis_server_enable && \ - ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1 - then - force_depend ypserv || return 1 - fi + force_depend rpcbind || return 1 + force_depend ypserv nis_server || return 1 _domain=`domainname` if [ -z "$_domain" ]; then @@ -36,5 +31,4 @@ rpc_ypupdated_precmd() fi } -load_rc_config $name run_rc_command "$1" Modified: stable/9/etc/rc.d/ypxfrd ============================================================================== --- stable/9/etc/rc.d/ypxfrd Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.d/ypxfrd Wed Feb 15 22:59:15 2012 (r231792) @@ -11,25 +11,20 @@ name="ypxfrd" rcvar="nis_ypxfrd_enable" -command="/usr/sbin/rpc.${name}" -start_precmd="ypxfrd_precmd" + load_rc_config $name + +command="/usr/sbin/rpc.${name}" command_args="${nis_ypxfrd_flags}" +start_precmd="ypxfrd_precmd" + ypxfrd_precmd() { local _domain - if ! checkyesno rpcbind_enable && \ - ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 - then - force_depend rpcbind || return 1 - fi - if ! checkyesno nis_server_enable && \ - ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1 - then - force_depend ypserv || return 1 - fi + force_depend rpcbind || return 1 + force_depend ypserv nis_server || return 1 _domain=`domainname` if [ -z "$_domain" ]; then Modified: stable/9/etc/rc.subr ============================================================================== --- stable/9/etc/rc.subr Wed Feb 15 22:49:25 2012 (r231791) +++ stable/9/etc/rc.subr Wed Feb 15 22:59:15 2012 (r231792) @@ -113,22 +113,29 @@ set_rcvar_obsolete() } # -# force_depend script +# force_depend script [rcvar] # Force a service to start. Intended for use by services -# to resolve dependency issues. It is assumed the caller -# has check to make sure this call is necessary +# to resolve dependency issues. # $1 - filename of script, in /etc/rc.d, to run +# $2 - name of the script's rcvar (minus the _enable) # force_depend() { + local _depend _dep_rcvar + _depend="$1" + _dep_rcvar="${2:-$1}_enable" + + [ -n "$rc_fast" ] && ! checkyesno always_force_depends && + checkyesno $_dep_rcvar && return 0 + + /etc/rc.d/${_depend} forcestatus >/dev/null 2>&1 && return 0 info "${name} depends on ${_depend}, which will be forced to start." if ! /etc/rc.d/${_depend} forcestart; then warn "Unable to force ${_depend}. It may already be running." return 1 fi - return 0 } # From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 15 23:02:45 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85719106566B; Wed, 15 Feb 2012 23:02:45 +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 738A78FC0C; Wed, 15 Feb 2012 23:02:45 +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 q1FN2j4h086495; Wed, 15 Feb 2012 23:02:45 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FN2jq9086493; Wed, 15 Feb 2012 23:02:45 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202152302.q1FN2jq9086493@svn.freebsd.org> From: Doug Barton Date: Wed, 15 Feb 2012 23:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231794 - stable/9/share/man/man5 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 23:02:45 -0000 Author: dougb Date: Wed Feb 15 23:02:45 2012 New Revision: 231794 URL: http://svn.freebsd.org/changeset/base/231794 Log: MFC r231667: Add new functionality to the force_depend method. Modified: stable/9/share/man/man5/rc.conf.5 Directory Properties: stable/9/share/man/man5/ (props changed) Modified: stable/9/share/man/man5/rc.conf.5 ============================================================================== --- stable/9/share/man/man5/rc.conf.5 Wed Feb 15 23:00:31 2012 (r231793) +++ stable/9/share/man/man5/rc.conf.5 Wed Feb 15 23:02:45 2012 (r231794) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2012 +.Dd February 11, 2012 .Dt RC.CONF 5 .Os .Sh NAME @@ -149,6 +149,19 @@ and before changing it one should ensure adequate provisions to recover from a failed boot (such as physical contact with the machine, or reliable remote console access). +.It Va always_force_depends +.Pq Vt bool +Various +.Pa rc.d +scripts use the force_depend function to check whether required +services are already running, and to start them if necessary. +By default during boot time this check is bypassed if the +required service is enabled in +.Pa /etc/rc.conf[.local] . +Setting this option will bypass that check at boot time and +always test whether or not the service is actually running. +Enabling this option is likely to increase your boot time if +services are enabled that utilize the force_depend check. .It Va swapfile .Pq Vt str If set to From owner-svn-src-stable-9@FreeBSD.ORG Thu Feb 16 00:46:11 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD57C106564A; Thu, 16 Feb 2012 00:46:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBBF58FC12; Thu, 16 Feb 2012 00:46:11 +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 q1G0kBZ5090352; Thu, 16 Feb 2012 00:46:11 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1G0kBce090350; Thu, 16 Feb 2012 00:46:11 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201202160046.q1G0kBce090350@svn.freebsd.org> From: Ed Maste Date: Thu, 16 Feb 2012 00:46:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231801 - stable/9/sys/dev/ata X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 00:46:12 -0000 Author: emaste Date: Thu Feb 16 00:46:11 2012 New Revision: 231801 URL: http://svn.freebsd.org/changeset/base/231801 Log: MFC r231573: Fix panic after "WARNING - ATA_IDENTIFY taskqueue timeout" When performing a firmware upgrade via atacontrol[1] the subsequent command may time out producing the error message above. When this happens the callout could still be active, and the system would then panic due to a destroyed semaphore. Instead, ensure that the callout is done first, via callout_drain. [1] http://lists.freebsd.org/pipermail/freebsd-current/2012-January/031122.html Modified: stable/9/sys/dev/ata/ata-queue.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/ata/ata-queue.c ============================================================================== --- stable/9/sys/dev/ata/ata-queue.c Thu Feb 16 00:38:35 2012 (r231800) +++ stable/9/sys/dev/ata/ata-queue.c Thu Feb 16 00:46:11 2012 (r231801) @@ -112,6 +112,7 @@ ata_queue_request(struct ata_request *re ATA_DEBUG_RQ(request, "wait for completion"); if (!dumping && sema_timedwait(&request->done, request->timeout * hz * 4)) { + callout_drain(&request->callout); device_printf(request->dev, "WARNING - %s taskqueue timeout " "- completing request directly\n", From owner-svn-src-stable-9@FreeBSD.ORG Thu Feb 16 05:01:10 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9CA2106566B; Thu, 16 Feb 2012 05:01:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 949538FC16; Thu, 16 Feb 2012 05:01: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 q1G51ACB099385; Thu, 16 Feb 2012 05:01:10 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1G51AUM099369; Thu, 16 Feb 2012 05:01:10 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201202160501.q1G51AUM099369@svn.freebsd.org> From: Eitan Adler Date: Thu, 16 Feb 2012 05:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231812 - in stable/9: libexec/tftpd sbin/camcontrol sbin/fsck_ffs sbin/fsirand sbin/gvinum sbin/ifconfig sbin/newfs sbin/ping6 sbin/tunefs usr.bin/brandelf usr.bin/bsdiff/bsdiff usr.bi... X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 05:01:10 -0000 Author: eadler Date: Thu Feb 16 05:01:09 2012 New Revision: 231812 URL: http://svn.freebsd.org/changeset/base/231812 Log: MFC r22990[45] and r229907-r229919: - fix a variety of warnings produced by gcc46 when compiling world Approved by (cperciva) Modified: stable/9/libexec/tftpd/tftp-io.c stable/9/sbin/camcontrol/camcontrol.c stable/9/sbin/camcontrol/modeedit.c stable/9/sbin/fsck_ffs/gjournal.c stable/9/sbin/fsirand/fsirand.c stable/9/sbin/gvinum/gvinum.c stable/9/sbin/ifconfig/ifieee80211.c stable/9/sbin/newfs/mkfs.c stable/9/sbin/ping6/ping6.c stable/9/sbin/tunefs/tunefs.c stable/9/usr.bin/brandelf/brandelf.c stable/9/usr.bin/bsdiff/bsdiff/bsdiff.c stable/9/usr.bin/ncplist/ncplist.c stable/9/usr.bin/netstat/if.c stable/9/usr.bin/split/split.c Directory Properties: stable/9/libexec/tftpd/ (props changed) stable/9/sbin/camcontrol/ (props changed) stable/9/sbin/fsck_ffs/ (props changed) stable/9/sbin/fsirand/ (props changed) stable/9/sbin/geom/ (props changed) stable/9/sbin/gvinum/ (props changed) stable/9/sbin/ifconfig/ (props changed) stable/9/sbin/newfs/ (props changed) stable/9/sbin/ping6/ (props changed) stable/9/sbin/tunefs/ (props changed) stable/9/usr.bin/brandelf/ (props changed) stable/9/usr.bin/bsdiff/ (props changed) stable/9/usr.bin/ncplist/ (props changed) stable/9/usr.bin/netstat/ (props changed) stable/9/usr.bin/split/ (props changed) Modified: stable/9/libexec/tftpd/tftp-io.c ============================================================================== --- stable/9/libexec/tftpd/tftp-io.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/libexec/tftpd/tftp-io.c Thu Feb 16 05:01:09 2012 (r231812) @@ -323,7 +323,6 @@ send_ack(int fp, uint16_t block) { struct tftphdr *tp; int size; - char *bp; char buf[MAXPKTSIZE]; if (debug&DEBUG_PACKETS) @@ -332,7 +331,6 @@ send_ack(int fp, uint16_t block) DROPPACKETn("send_ack", 0); tp = (struct tftphdr *)buf; - bp = buf + 2; size = sizeof(buf) - 2; tp->th_opcode = htons((u_short)ACK); tp->th_block = htons((u_short)block); Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/sbin/camcontrol/camcontrol.c Thu Feb 16 05:01:09 2012 (r231812) @@ -3412,7 +3412,6 @@ ratecontrol(struct cam_device *device, i } if (spi && syncrate != -1) { int prelim_sync_period; - u_int freq; if ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) { warnx("HBA is not capable of changing " @@ -3437,7 +3436,6 @@ ratecontrol(struct cam_device *device, i prelim_sync_period = 10000000 / syncrate; spi->sync_period = scsi_calc_syncparam(prelim_sync_period); - freq = scsi_calc_syncsrate(spi->sync_period); didsettings++; } if (sata && syncrate != -1) { @@ -4050,13 +4048,12 @@ retry: RPL_LUNDATA_LUN_LUN_MASK); break; case RPL_LUNDATA_ATYP_EXTLUN: { - int field_len, field_len_code, eam_code; + int field_len_code, eam_code; eam_code = lundata->luns[i].lundata[j] & RPL_LUNDATA_EXT_EAM_MASK; field_len_code = (lundata->luns[i].lundata[j] & RPL_LUNDATA_EXT_LEN_MASK) >> 4; - field_len = field_len_code * 2; if ((eam_code == RPL_LUNDATA_EXT_EAM_WK) && (field_len_code == 0x00)) { Modified: stable/9/sbin/camcontrol/modeedit.c ============================================================================== --- stable/9/sbin/camcontrol/modeedit.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/sbin/camcontrol/modeedit.c Thu Feb 16 05:01:09 2012 (r231812) @@ -869,7 +869,6 @@ mode_list(struct cam_device *device, int int retry_count, int timeout) { u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ - u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct pagename *nameentry; @@ -895,7 +894,6 @@ mode_list(struct cam_device *device, int /* Locate the next mode page header. */ mph = (struct scsi_mode_page_header *) ((intptr_t)mh + sizeof(*mh) + len); - mode_pars = MODE_PAGE_DATA(mph); mph->page_code &= SMS_PAGE_CODE; nameentry = nameentry_lookup(mph->page_code); Modified: stable/9/sbin/fsck_ffs/gjournal.c ============================================================================== --- stable/9/sbin/fsck_ffs/gjournal.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/sbin/fsck_ffs/gjournal.c Thu Feb 16 05:01:09 2012 (r231812) @@ -399,7 +399,7 @@ gjournal_check(const char *filesys) void *p; struct cgchain *cgc; struct cg *cgp; - uint8_t *inosused, *blksfree; + uint8_t *inosused; ino_t cino, ino; int cg, mode; @@ -438,7 +438,6 @@ gjournal_check(const char *filesys) /* We don't want it to be freed in the meantime. */ busycg(cgc); inosused = cg_inosused(cgp); - blksfree = cg_blksfree(cgp); /* * Now go through the list of all inodes in this cylinder group * to find unreferenced ones. Modified: stable/9/sbin/fsirand/fsirand.c ============================================================================== --- stable/9/sbin/fsirand/fsirand.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/sbin/fsirand/fsirand.c Thu Feb 16 05:01:09 2012 (r231812) @@ -115,7 +115,7 @@ fsirand(char *device) caddr_t inodebuf; ssize_t ibufsize; struct fs *sblock; - ino_t inumber, maxino; + ino_t inumber; ufs2_daddr_t sblockloc, dblk; char sbuf[SBLOCKSIZE], sbuftmp[SBLOCKSIZE]; int i, devfd, n, cg; @@ -165,7 +165,6 @@ fsirand(char *device) fprintf(stderr, "Cannot find file system superblock\n"); return (1); } - maxino = sblock->fs_ncg * sblock->fs_ipg; if (sblock->fs_magic == FS_UFS1_MAGIC && sblock->fs_old_inodefmt < FS_44INODEFMT) { Modified: stable/9/sbin/gvinum/gvinum.c ============================================================================== --- stable/9/sbin/gvinum/gvinum.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/sbin/gvinum/gvinum.c Thu Feb 16 05:01:09 2012 (r231812) @@ -937,14 +937,12 @@ gvinum_parityop(int argc, char **argv, i struct gctl_req *req; int flags, i; const char *errstr; - char *op, *msg; + char *op; if (rebuild) { op = "rebuildparity"; - msg = "Rebuilding"; } else { op = "checkparity"; - msg = "Checking"; } optreset = 1; @@ -1057,9 +1055,8 @@ gvinum_rm(int argc, char **argv) struct gctl_req *req; int flags, i, j; const char *errstr; - char buf[20], *cmd; + char buf[20]; - cmd = argv[0]; flags = 0; optreset = 1; optind = 1; Modified: stable/9/sbin/ifconfig/ifieee80211.c ============================================================================== --- stable/9/sbin/ifconfig/ifieee80211.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/sbin/ifconfig/ifieee80211.c Thu Feb 16 05:01:09 2012 (r231812) @@ -4353,7 +4353,6 @@ ieee80211_status(int s) if (get80211val(s, IEEE80211_IOC_WEP, &wepmode) != -1 && wepmode != IEEE80211_WEP_NOSUP) { - int firstkey; switch (wepmode) { case IEEE80211_WEP_OFF: @@ -4389,7 +4388,6 @@ ieee80211_status(int s) goto end; } - firstkey = 1; for (i = 0; i < num; i++) { struct ieee80211req_key ik; @@ -4403,7 +4401,6 @@ ieee80211_status(int s) if (verbose) LINE_BREAK(); printkey(&ik); - firstkey = 0; } } end: Modified: stable/9/sbin/newfs/mkfs.c ============================================================================== --- stable/9/sbin/newfs/mkfs.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/sbin/newfs/mkfs.c Thu Feb 16 05:01:09 2012 (r231812) @@ -989,9 +989,7 @@ void iput(union dinode *ip, ino_t ino) { ufs2_daddr_t d; - int c; - c = ino_to_cg(&sblock, ino); bread(&disk, part_ofs + fsbtodb(&sblock, cgtod(&sblock, 0)), (char *)&acg, sblock.fs_cgsize); if (acg.cg_magic != CG_MAGIC) { Modified: stable/9/sbin/ping6/ping6.c ============================================================================== --- stable/9/sbin/ping6/ping6.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/sbin/ping6/ping6.c Thu Feb 16 05:01:09 2012 (r231812) @@ -1812,7 +1812,7 @@ pr_ip6opt(void *extbuf, size_t bufsize) struct ip6_hbh *ext; int currentlen; u_int8_t type; - socklen_t extlen, len, origextlen; + socklen_t extlen, len; void *databuf; size_t offset; u_int16_t value2; @@ -1828,7 +1828,6 @@ pr_ip6opt(void *extbuf, size_t bufsize) * subtract the size of a cmsg structure from the buffer size. */ if (bufsize < (extlen + CMSG_SPACE(0))) { - origextlen = extlen; extlen = bufsize - CMSG_SPACE(0); warnx("options truncated, showing only %u (total=%u)", (unsigned int)(extlen / 8 - 1), Modified: stable/9/sbin/tunefs/tunefs.c ============================================================================== --- stable/9/sbin/tunefs/tunefs.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/sbin/tunefs/tunefs.c Thu Feb 16 05:01:09 2012 (r231812) @@ -90,7 +90,7 @@ main(int argc, char *argv[]) int Aflag, aflag, eflag, evalue, fflag, fvalue, jflag, Jflag, Lflag; int lflag, mflag, mvalue, Nflag, nflag, oflag, ovalue, pflag, sflag; int tflag; - int svalue, Sflag, Svalue; + int svalue, Svalue; int ch, found_arg, i; const char *chg[2]; struct ufs_args args; @@ -269,7 +269,6 @@ main(int argc, char *argv[]) if (Svalue < SUJ_MIN) errx(10, "%s must be >= %d (was %s)", name, SUJ_MIN, optarg); - Sflag = 1; break; case 't': Modified: stable/9/usr.bin/brandelf/brandelf.c ============================================================================== --- stable/9/usr.bin/brandelf/brandelf.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/usr.bin/brandelf/brandelf.c Thu Feb 16 05:01:09 2012 (r231812) @@ -64,7 +64,7 @@ main(int argc, char **argv) const char *strtype = "FreeBSD"; int type = ELFOSABI_FREEBSD; int retval = 0; - int ch, change = 0, verbose = 0, force = 0, listed = 0; + int ch, change = 0, force = 0, listed = 0; while ((ch = getopt(argc, argv, "f:lt:v")) != -1) switch (ch) { @@ -84,7 +84,7 @@ main(int argc, char **argv) listed = 1; break; case 'v': - verbose = 1; + /* does nothing */ break; case 't': if (force) Modified: stable/9/usr.bin/bsdiff/bsdiff/bsdiff.c ============================================================================== --- stable/9/usr.bin/bsdiff/bsdiff/bsdiff.c Thu Feb 16 05:00:41 2012 (r231811) +++ stable/9/usr.bin/bsdiff/bsdiff/bsdiff.c Thu Feb 16 05:01:09 2012 (r231812) @@ -272,7 +272,7 @@ int main(int argc,char *argv[]) /* Compute the differences, writing ctrl as we go */ if ((pfbz2 = BZ2_bzWriteOpen(&bz2err, pf, 9, 0, 0)) == NULL) errx(1, "BZ2_bzWriteOpen, bz2err = %d", bz2err); - scan=0;len=0; + scan=0;len=0;pos=0; lastscan=0;lastpos=0;lastoffset=0; while(scan Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E43D106566C; Thu, 16 Feb 2012 09:25:40 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116]) by mx1.freebsd.org (Postfix) with ESMTP id ED7758FC0A; Thu, 16 Feb 2012 09:25:39 +0000 (UTC) Received: from jh (a91-153-115-208.elisa-laajakaista.fi [91.153.115.208]) by gw02.mail.saunalahti.fi (Postfix) with ESMTP id 2D6E41395AF; Thu, 16 Feb 2012 11:25:32 +0200 (EET) Date: Thu, 16 Feb 2012 11:25:31 +0200 From: Jaakko Heinonen To: Eitan Adler Message-ID: <20120216092531.GA64733@jh> References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 09:25:40 -0000 On 2012-02-15, Eitan Adler wrote: > On Wed, Feb 15, 2012 at 11:09 AM, Jaakko Heinonen wrote: > > On 2012-02-15, Eitan Adler wrote: > >> On Wed, Feb 15, 2012 at 10:50 AM, Jaakko Heinonen wrote: > >> > >> > I think this commit incorrectly placed mergeinfo to stable/9/share/. > >> > >> I used the following command: > >> > >>  2811  svn merge -c229831 $FSVN/head/share share > >> > >> Should I have committed somewhere else? > >> http://wiki.freebsd.org/SubversionPrimer/Merging is not particularly > >> helpful for share/ changes. > > > > Looking at previous merges I would have merged it to share/examples. > > I updated the wiki (see #11) and thanks for the help. I think that the mergeinfo from stable/9/share could be just deleted. Unless I am mistaken there hasn't been merges that would place mergeinfo only to stable/9/share after r230653. Could someone confirm that this is the right thing to do? %%% Property changes on: share ___________________________________________________________________ Deleted: svn:mergeinfo Reverse-merged /head/share:r226702,227006,228761,229067,229831,229997,230127,230587,231111,231331 Reverse-merged /vendor/resolver/dist/share:r1540-186085 Reverse-merged /projects/largeSMP/share:r221273-222812,222815-223757 Reverse-merged /projects/quota64/share:r184125-207707 %%% -- Jaakko From owner-svn-src-stable-9@FreeBSD.ORG Thu Feb 16 10:58:15 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B82741065674; Thu, 16 Feb 2012 10:58:15 +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 A1BE78FC0A; Thu, 16 Feb 2012 10:58: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 q1GAwFBf013489; Thu, 16 Feb 2012 10:58:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1GAwFwi013487; Thu, 16 Feb 2012 10:58:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202161058.q1GAwFwi013487@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 16 Feb 2012 10:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231820 - stable/9/libexec/rtld-elf X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 10:58:15 -0000 Author: kib Date: Thu Feb 16 10:58:15 2012 New Revision: 231820 URL: http://svn.freebsd.org/changeset/base/231820 Log: MFC r231582: Add missed EOL when die() was converted to use rtld_fdputstr() instead of errx(). PR: bin/165075 Modified: stable/9/libexec/rtld-elf/rtld.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Thu Feb 16 06:45:51 2012 (r231819) +++ stable/9/libexec/rtld-elf/rtld.c Thu Feb 16 10:58:15 2012 (r231820) @@ -757,6 +757,7 @@ die(void) if (msg == NULL) msg = "Fatal error"; rtld_fdputstr(STDERR_FILENO, msg); + rtld_fdputchar(STDERR_FILENO, '\n'); _exit(1); } From owner-svn-src-stable-9@FreeBSD.ORG Thu Feb 16 19:39:49 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE279106566C; Thu, 16 Feb 2012 19:39:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8317A8FC13; Thu, 16 Feb 2012 19:39:49 +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 q1GJdnWQ031335; Thu, 16 Feb 2012 19:39:49 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1GJdnHk031331; Thu, 16 Feb 2012 19:39:49 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201202161939.q1GJdnHk031331@svn.freebsd.org> From: Eitan Adler Date: Thu, 16 Feb 2012 19:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231832 - stable/9/tools/regression/pipe X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 19:39:49 -0000 Author: eadler Date: Thu Feb 16 19:39:49 2012 New Revision: 231832 URL: http://svn.freebsd.org/changeset/base/231832 Log: MFC r228274: - Fix some uninitialized variables in pipe regression tests that result in failure. PR: misc/161175 Approved by: cperciva Modified: stable/9/tools/regression/pipe/pipe-fstatbug.c stable/9/tools/regression/pipe/pipe-reverse.c stable/9/tools/regression/pipe/pipe-wraparound.c Directory Properties: stable/9/tools/regression/pipe/ (props changed) Modified: stable/9/tools/regression/pipe/pipe-fstatbug.c ============================================================================== --- stable/9/tools/regression/pipe/pipe-fstatbug.c Thu Feb 16 19:10:01 2012 (r231831) +++ stable/9/tools/regression/pipe/pipe-fstatbug.c Thu Feb 16 19:39:49 2012 (r231832) @@ -41,7 +41,7 @@ int main (void) { char buffer[32768], buffer2[32768]; int desc[2]; -int error, successes; +int error, successes = 0; struct stat status; pid_t new_pid; Modified: stable/9/tools/regression/pipe/pipe-reverse.c ============================================================================== --- stable/9/tools/regression/pipe/pipe-reverse.c Thu Feb 16 19:10:01 2012 (r231831) +++ stable/9/tools/regression/pipe/pipe-reverse.c Thu Feb 16 19:39:49 2012 (r231832) @@ -44,6 +44,7 @@ struct stat status; pid_t new_pid; buggy = 0; +total = 0; error = pipe(desc); @@ -52,7 +53,7 @@ if (error) buffer[0] = 'A'; -for (i = 0; i < 65535; i++) { +for (i = 1; i < 65535; i++) { buffer[i] = buffer[i - 1] + 1; if (buffer[i] > 'Z') buffer[i] = 'A'; Modified: stable/9/tools/regression/pipe/pipe-wraparound.c ============================================================================== --- stable/9/tools/regression/pipe/pipe-wraparound.c Thu Feb 16 19:10:01 2012 (r231831) +++ stable/9/tools/regression/pipe/pipe-wraparound.c Thu Feb 16 19:39:49 2012 (r231832) @@ -44,6 +44,7 @@ struct stat status; pid_t new_pid; buggy = 0; +total = 0; error = pipe(desc); @@ -52,7 +53,7 @@ if (error) buffer[0] = 'A'; -for (i = 0; i < 32768; i++) { +for (i = 1; i < 32768; i++) { buffer[i] = buffer[i - 1] + 1; if (buffer[i] > 'Z') buffer[i] = 'A'; From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 00:55:26 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBDAE106566C; Fri, 17 Feb 2012 00:55:26 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA9458FC16; Fri, 17 Feb 2012 00:55:26 +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 q1H0tQZC042423; Fri, 17 Feb 2012 00:55:26 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1H0tQEE042421; Fri, 17 Feb 2012 00:55:26 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201202170055.q1H0tQEE042421@svn.freebsd.org> From: Eitan Adler Date: Fri, 17 Feb 2012 00:55:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231847 - stable/9/lib/libc/gen X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 00:55:26 -0000 Author: eadler Date: Fri Feb 17 00:55:26 2012 New Revision: 231847 URL: http://svn.freebsd.org/changeset/base/231847 Log: MFC r231299: - More accurately document what happens on error. PR: docs/127908 Approved by: cperciva Modified: stable/9/lib/libc/gen/directory.3 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/directory.3 ============================================================================== --- stable/9/lib/libc/gen/directory.3 Fri Feb 17 00:27:48 2012 (r231846) +++ stable/9/lib/libc/gen/directory.3 Fri Feb 17 00:55:26 2012 (r231847) @@ -122,9 +122,12 @@ function returns a pointer to the next directory entry. It returns .Dv NULL -upon reaching the end of the directory or detecting an invalid -.Fn seekdir -operation. +upon reaching the end of the directory or on error. +In the event of an error, +.Va errno +may be set to any of the values documented for the +.Xr getdirentries 2 +system call. .Pp The .Fn readdir_r From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 01:23:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 926A8106564A; Fri, 17 Feb 2012 01:23:58 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 810C18FC19; Fri, 17 Feb 2012 01:23:58 +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 q1H1NwIs043464; Fri, 17 Feb 2012 01:23:58 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1H1NwWU043462; Fri, 17 Feb 2012 01:23:58 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201202170123.q1H1NwWU043462@svn.freebsd.org> From: "Justin T. Gibbs" Date: Fri, 17 Feb 2012 01:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231850 - stable/9/sys/cam/scsi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 01:23:58 -0000 Author: gibbs Date: Fri Feb 17 01:23:58 2012 New Revision: 231850 URL: http://svn.freebsd.org/changeset/base/231850 Log: MFC r231745: Limit the ST3146855LW U320 drive to 55 tags to avoid command timeouts under load. Submitted by: Gelson Borsoi Modified: stable/9/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_xpt.c Fri Feb 17 01:21:08 2012 (r231849) +++ stable/9/sys/cam/scsi/scsi_xpt.c Fri Feb 17 01:23:58 2012 (r231850) @@ -295,6 +295,14 @@ static struct scsi_quirk_entry scsi_quir }, { /* + * Experiences command timeouts under load with a + * tag count higher than 55. + */ + { T_DIRECT, SIP_MEDIA_FIXED, seagate, "ST3146855LW", "*"}, + /*quirks*/0, /*mintags*/2, /*maxtags*/55 + }, + { + /* * Slow when tagged queueing is enabled. Write performance * steadily drops off with more and more concurrent * transactions. Best sequential write performance with From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 01:45:49 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFD3D106566C; Fri, 17 Feb 2012 01:45:49 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC0598FC12; Fri, 17 Feb 2012 01:45:49 +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 q1H1jnsV044176; Fri, 17 Feb 2012 01:45:49 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1H1jnQ3044170; Fri, 17 Feb 2012 01:45:49 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201202170145.q1H1jnQ3044170@svn.freebsd.org> From: "Justin T. Gibbs" Date: Fri, 17 Feb 2012 01:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231851 - in stable/9/sys: dev/xen/blkback dev/xen/blkfront xen/interface/io xen/xenbus X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 01:45:50 -0000 Author: gibbs Date: Fri Feb 17 01:45:49 2012 New Revision: 231851 URL: http://svn.freebsd.org/changeset/base/231851 Log: MFC r231743,r231837,r231839: Xen PV block interface enhancements r231743 ======= Enhance documentation, improve interoperability, and fix defects in FreeBSD's front and back Xen blkif interface drivers. sys/dev/xen/blkfront/block.h: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: Replace FreeBSD specific multi-page ring impelementation with support for both the Citrix and Amazon/RedHat versions of this extension. sys/dev/xen/blkfront/blkfront.c: o Add a per-instance sysctl tree that exposes all negotiated transport parameters (ring pages, max number of requests, max request size, max number of segments). o In blkfront_vdevice_to_unit() add a missing return statement so that we properly identify the unit number for high numbered xvd devices. sys/dev/xen/blkback/blkback.c: o Add static dtrace probes for several events in this driver. o Defer connection shutdown processing until the front-end enters the closed state. This avoids prematurely tearing down the connection when buggy front-ends transition to the closing state, even though the device is open and they veto the close request from the tool stack. o Add nodes for maximum request size and the number of active ring pages to the exising, per-instance, sysctl tree. o Miscelaneous style cleanup. sys/xen/interface/io/blkif.h: o Add extensive documentation of the XenStore nodes used to implement the blkif interface. o Document the startup sequence between a front and back driver. o Add structures and documenatation for the "discard" feature (AKA Trim). o Cleanup some definitions related to FreeBSD's request number/size/segment-limit extension. sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: sys/xen/xenbus/xenbusvar.h: Add the convenience function xenbus_get_otherend_state() and use it to simplify some logic in both block-front and block-back. r231837 ======= sys/dev/xen/blkback/blkback.c: Fix typo in a printf string: "specificed" -> "specified". r231839 ======= Fix a bug in the calculation of the maximum I/O request size. The previous code did not limit the I/O request size based on the maximum number of segments supported by the back-end. In current practice, since the only back-end supporting chained requests is the FreeBSD implementation, this limit was never exceeded. sys/dev/xen/blkfront/block.h: Add two macros, XBF_SEGS_TO_SIZE() and XBF_SIZE_TO_SEGS(), to centralize the logic of reserving a segment to deal with non-page-aligned I/Os. sys/dev/xen/blkfront/blkfront.c: o When negotiating transfer parameters, limit the max_request_size we use and publish, if it is greater than the maximum, unaligned, I/O we can support with the number of segments advertised by the backend. o Don't unilaterally reduce the I/O size published to the disk layer by a single page. max_request_size is already properly limited in the transfer parameter negotiation code. o Fix typos in printf strings: "max_requests_segments" -> "max_request_segments" "specificed" -> "specified" Modified: stable/9/sys/dev/xen/blkback/blkback.c stable/9/sys/dev/xen/blkfront/blkfront.c stable/9/sys/dev/xen/blkfront/block.h stable/9/sys/xen/interface/io/blkif.h stable/9/sys/xen/xenbus/xenbusvar.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/xen/blkback/blkback.c ============================================================================== --- stable/9/sys/dev/xen/blkback/blkback.c Fri Feb 17 01:23:58 2012 (r231850) +++ stable/9/sys/dev/xen/blkback/blkback.c Fri Feb 17 01:45:49 2012 (r231851) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); * a FreeBSD domain to other domains. */ +#include "opt_kdtrace.h" + #include #include #include @@ -63,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -124,7 +127,7 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_XENBLOCKBACK, "xbbd", "Xen Block Back Driver Data"); #ifdef XBB_DEBUG -#define DPRINTF(fmt, args...) \ +#define DPRINTF(fmt, args...) \ printf("xbb(%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) #else #define DPRINTF(fmt, args...) do {} while(0) @@ -134,7 +137,7 @@ MALLOC_DEFINE(M_XENBLOCKBACK, "xbbd", "X * The maximum mapped region size per request we will allow in a negotiated * block-front/back communication channel. */ -#define XBB_MAX_REQUEST_SIZE \ +#define XBB_MAX_REQUEST_SIZE \ MIN(MAXPHYS, BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE) /** @@ -142,9 +145,9 @@ MALLOC_DEFINE(M_XENBLOCKBACK, "xbbd", "X * segment blocks) per request we will allow in a negotiated block-front/back * communication channel. */ -#define XBB_MAX_SEGMENTS_PER_REQUEST \ - (MIN(UIO_MAXIOV, \ - MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ +#define XBB_MAX_SEGMENTS_PER_REQUEST \ + (MIN(UIO_MAXIOV, \ + MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ (XBB_MAX_REQUEST_SIZE / PAGE_SIZE) + 1))) /** @@ -980,9 +983,10 @@ xbb_get_gntaddr(struct xbb_xen_reqlist * static uint8_t * xbb_get_kva(struct xbb_softc *xbb, int nr_pages) { - intptr_t first_clear, num_clear; + intptr_t first_clear; + intptr_t num_clear; uint8_t *free_kva; - int i; + int i; KASSERT(nr_pages != 0, ("xbb_get_kva of zero length")); @@ -1681,19 +1685,19 @@ xbb_dispatch_io(struct xbb_softc *xbb, s req_ring_idx++; switch (xbb->abi) { case BLKIF_PROTOCOL_NATIVE: - sg = BLKRING_GET_SG_REQUEST(&xbb->rings.native, - req_ring_idx); + sg = BLKRING_GET_SEG_BLOCK(&xbb->rings.native, + req_ring_idx); break; case BLKIF_PROTOCOL_X86_32: { - sg = BLKRING_GET_SG_REQUEST(&xbb->rings.x86_32, - req_ring_idx); + sg = BLKRING_GET_SEG_BLOCK(&xbb->rings.x86_32, + req_ring_idx); break; } case BLKIF_PROTOCOL_X86_64: { - sg = BLKRING_GET_SG_REQUEST(&xbb->rings.x86_64, - req_ring_idx); + sg = BLKRING_GET_SEG_BLOCK(&xbb->rings.x86_64, + req_ring_idx); break; } default: @@ -1817,8 +1821,8 @@ xbb_run_queue(void *context, int pending struct xbb_xen_reqlist *reqlist; - xbb = (struct xbb_softc *)context; - rings = &xbb->rings; + xbb = (struct xbb_softc *)context; + rings = &xbb->rings; /* * Work gather and dispatch loop. Note that we have a bias here @@ -2032,6 +2036,13 @@ xbb_intr(void *arg) taskqueue_enqueue(xbb->io_taskqueue, &xbb->io_task); } +SDT_PROVIDER_DEFINE(xbb); +SDT_PROBE_DEFINE1(xbb, kernel, xbb_dispatch_dev, flush, flush, "int"); +SDT_PROBE_DEFINE3(xbb, kernel, xbb_dispatch_dev, read, read, "int", "uint64_t", + "uint64_t"); +SDT_PROBE_DEFINE3(xbb, kernel, xbb_dispatch_dev, write, write, "int", + "uint64_t", "uint64_t"); + /*----------------------------- Backend Handlers -----------------------------*/ /** * Backend handler for character device access. @@ -2087,6 +2098,9 @@ xbb_dispatch_dev(struct xbb_softc *xbb, nreq->pendcnt = 1; + SDT_PROBE1(xbb, kernel, xbb_dispatch_dev, flush, + device_get_unit(xbb->dev)); + (*dev_data->csw->d_strategy)(bio); return (0); @@ -2181,6 +2195,17 @@ xbb_dispatch_dev(struct xbb_softc *xbb, bios[bio_idx]->bio_bcount); } #endif + if (operation == BIO_READ) { + SDT_PROBE3(xbb, kernel, xbb_dispatch_dev, read, + device_get_unit(xbb->dev), + bios[bio_idx]->bio_offset, + bios[bio_idx]->bio_length); + } else if (operation == BIO_WRITE) { + SDT_PROBE3(xbb, kernel, xbb_dispatch_dev, write, + device_get_unit(xbb->dev), + bios[bio_idx]->bio_offset, + bios[bio_idx]->bio_length); + } (*dev_data->csw->d_strategy)(bios[bio_idx]); } @@ -2193,6 +2218,12 @@ fail_free_bios: return (error); } +SDT_PROBE_DEFINE1(xbb, kernel, xbb_dispatch_file, flush, flush, "int"); +SDT_PROBE_DEFINE3(xbb, kernel, xbb_dispatch_file, read, read, "int", "uint64_t", + "uint64_t"); +SDT_PROBE_DEFINE3(xbb, kernel, xbb_dispatch_file, write, write, "int", + "uint64_t", "uint64_t"); + /** * Backend handler for file access. * @@ -2237,6 +2268,9 @@ xbb_dispatch_file(struct xbb_softc *xbb, case BIO_FLUSH: { struct mount *mountpoint; + SDT_PROBE1(xbb, kernel, xbb_dispatch_file, flush, + device_get_unit(xbb->dev)); + vfs_is_locked = VFS_LOCK_GIANT(xbb->vn->v_mount); (void) vn_start_write(xbb->vn, &mountpoint, V_WAIT); @@ -2336,6 +2370,10 @@ xbb_dispatch_file(struct xbb_softc *xbb, switch (operation) { case BIO_READ: + SDT_PROBE3(xbb, kernel, xbb_dispatch_file, read, + device_get_unit(xbb->dev), xuio.uio_offset, + xuio.uio_resid); + vn_lock(xbb->vn, LK_EXCLUSIVE | LK_RETRY); /* @@ -2366,6 +2404,10 @@ xbb_dispatch_file(struct xbb_softc *xbb, case BIO_WRITE: { struct mount *mountpoint; + SDT_PROBE3(xbb, kernel, xbb_dispatch_file, write, + device_get_unit(xbb->dev), xuio.uio_offset, + xuio.uio_resid); + (void)vn_start_write(xbb->vn, &mountpoint, V_WAIT); vn_lock(xbb->vn, LK_EXCLUSIVE | LK_RETRY); @@ -3028,6 +3070,8 @@ xbb_collect_frontend_info(struct xbb_sof const char *otherend_path; int error; u_int ring_idx; + u_int ring_page_order; + size_t ring_size; otherend_path = xenbus_get_otherend_path(xbb->dev); @@ -3035,23 +3079,19 @@ xbb_collect_frontend_info(struct xbb_sof * Protocol defaults valid even if all negotiation fails. */ xbb->ring_config.ring_pages = 1; - xbb->max_requests = BLKIF_MAX_RING_REQUESTS(PAGE_SIZE); xbb->max_request_segments = BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK; xbb->max_request_size = xbb->max_request_segments * PAGE_SIZE; /* * Mandatory data (used in all versions of the protocol) first. */ - error = xs_gather(XST_NIL, otherend_path, - "ring-ref", "%" PRIu32, - &xbb->ring_config.ring_ref[0], - "event-channel", "%" PRIu32, - &xbb->ring_config.evtchn, - NULL); + error = xs_scanf(XST_NIL, otherend_path, + "event-channel", NULL, "%" PRIu32, + &xbb->ring_config.evtchn); if (error != 0) { xenbus_dev_fatal(xbb->dev, error, - "Unable to retrieve ring information from " - "frontend %s. Unable to connect.", + "Unable to retrieve event-channel information " + "from frontend %s. Unable to connect.", xenbus_get_otherend_path(xbb->dev)); return (error); } @@ -3065,10 +3105,20 @@ xbb_collect_frontend_info(struct xbb_sof * we must use independant calls in order to guarantee * we don't miss information in a sparsly populated front-end * tree. + * + * \note xs_scanf() does not update variables for unmatched + * fields. */ + ring_page_order = 0; (void)xs_scanf(XST_NIL, otherend_path, - "ring-pages", NULL, "%u", + "ring-page-order", NULL, "%u", + &ring_page_order); + xbb->ring_config.ring_pages = 1 << ring_page_order; + (void)xs_scanf(XST_NIL, otherend_path, + "num-ring-pages", NULL, "%u", &xbb->ring_config.ring_pages); + ring_size = PAGE_SIZE * xbb->ring_config.ring_pages; + xbb->max_requests = BLKIF_MAX_RING_REQUESTS(ring_size); (void)xs_scanf(XST_NIL, otherend_path, "max-requests", NULL, "%u", @@ -3084,7 +3134,7 @@ xbb_collect_frontend_info(struct xbb_sof if (xbb->ring_config.ring_pages > XBB_MAX_RING_PAGES) { xenbus_dev_fatal(xbb->dev, EINVAL, - "Front-end specificed ring-pages of %u " + "Front-end specified ring-pages of %u " "exceeds backend limit of %zu. " "Unable to connect.", xbb->ring_config.ring_pages, @@ -3092,7 +3142,7 @@ xbb_collect_frontend_info(struct xbb_sof return (EINVAL); } else if (xbb->max_requests > XBB_MAX_REQUESTS) { xenbus_dev_fatal(xbb->dev, EINVAL, - "Front-end specificed max_requests of %u " + "Front-end specified max_requests of %u " "exceeds backend limit of %u. " "Unable to connect.", xbb->max_requests, @@ -3100,7 +3150,7 @@ xbb_collect_frontend_info(struct xbb_sof return (EINVAL); } else if (xbb->max_request_segments > XBB_MAX_SEGMENTS_PER_REQUEST) { xenbus_dev_fatal(xbb->dev, EINVAL, - "Front-end specificed max_requests_segments " + "Front-end specified max_requests_segments " "of %u exceeds backend limit of %u. " "Unable to connect.", xbb->max_request_segments, @@ -3108,7 +3158,7 @@ xbb_collect_frontend_info(struct xbb_sof return (EINVAL); } else if (xbb->max_request_size > XBB_MAX_REQUEST_SIZE) { xenbus_dev_fatal(xbb->dev, EINVAL, - "Front-end specificed max_request_size " + "Front-end specified max_request_size " "of %u exceeds backend limit of %u. " "Unable to connect.", xbb->max_request_size, @@ -3116,22 +3166,39 @@ xbb_collect_frontend_info(struct xbb_sof return (EINVAL); } - /* If using a multi-page ring, pull in the remaining references. */ - for (ring_idx = 1; ring_idx < xbb->ring_config.ring_pages; ring_idx++) { - char ring_ref_name[]= "ring_refXX"; - - snprintf(ring_ref_name, sizeof(ring_ref_name), - "ring-ref%u", ring_idx); - error = xs_scanf(XST_NIL, otherend_path, - ring_ref_name, NULL, "%" PRIu32, - &xbb->ring_config.ring_ref[ring_idx]); + if (xbb->ring_config.ring_pages == 1) { + error = xs_gather(XST_NIL, otherend_path, + "ring-ref", "%" PRIu32, + &xbb->ring_config.ring_ref[0], + NULL); if (error != 0) { xenbus_dev_fatal(xbb->dev, error, - "Failed to retriev grant reference " - "for page %u of shared ring. Unable " - "to connect.", ring_idx); + "Unable to retrieve ring information " + "from frontend %s. Unable to " + "connect.", + xenbus_get_otherend_path(xbb->dev)); return (error); } + } else { + /* Multi-page ring format. */ + for (ring_idx = 0; ring_idx < xbb->ring_config.ring_pages; + ring_idx++) { + char ring_ref_name[]= "ring_refXX"; + + snprintf(ring_ref_name, sizeof(ring_ref_name), + "ring-ref%u", ring_idx); + error = xs_scanf(XST_NIL, otherend_path, + ring_ref_name, NULL, "%" PRIu32, + &xbb->ring_config.ring_ref[ring_idx]); + if (error != 0) { + xenbus_dev_fatal(xbb->dev, error, + "Failed to retriev grant " + "reference for page %u of " + "shared ring. Unable " + "to connect.", ring_idx); + return (error); + } + } } error = xs_gather(XST_NIL, otherend_path, @@ -3197,8 +3264,8 @@ xbb_alloc_requests(struct xbb_softc *xbb static int xbb_alloc_request_lists(struct xbb_softc *xbb) { - int i; struct xbb_xen_reqlist *reqlist; + int i; /* * If no requests can be merged, we need 1 request list per @@ -3318,7 +3385,7 @@ xbb_publish_backend_info(struct xbb_soft static void xbb_connect(struct xbb_softc *xbb) { - int error; + int error; if (xenbus_get_state(xbb->dev) == XenbusStateConnected) return; @@ -3399,7 +3466,8 @@ xbb_connect(struct xbb_softc *xbb) static int xbb_shutdown(struct xbb_softc *xbb) { - int error; + XenbusState frontState; + int error; DPRINTF("\n"); @@ -3413,6 +3481,20 @@ xbb_shutdown(struct xbb_softc *xbb) if ((xbb->flags & XBBF_IN_SHUTDOWN) != 0) return (EAGAIN); + xbb->flags |= XBBF_IN_SHUTDOWN; + mtx_unlock(&xbb->lock); + + if (xenbus_get_state(xbb->dev) < XenbusStateClosing) + xenbus_set_state(xbb->dev, XenbusStateClosing); + + frontState = xenbus_get_otherend_state(xbb->dev); + mtx_lock(&xbb->lock); + xbb->flags &= ~XBBF_IN_SHUTDOWN; + + /* The front can submit I/O until entering the closed state. */ + if (frontState < XenbusStateClosed) + return (EAGAIN); + DPRINTF("\n"); /* Indicate shutdown is in progress. */ @@ -3434,19 +3516,6 @@ xbb_shutdown(struct xbb_softc *xbb) DPRINTF("\n"); - /* - * Before unlocking mutex, set this flag to prevent other threads from - * getting into this function - */ - xbb->flags |= XBBF_IN_SHUTDOWN; - mtx_unlock(&xbb->lock); - - if (xenbus_get_state(xbb->dev) < XenbusStateClosing) - xenbus_set_state(xbb->dev, XenbusStateClosing); - - mtx_lock(&xbb->lock); - xbb->flags &= ~XBBF_IN_SHUTDOWN; - /* Indicate to xbb_detach() that is it safe to proceed. */ wakeup(xbb); @@ -3573,6 +3642,16 @@ xbb_setup_sysctl(struct xbb_softc *xbb) "max_request_segments", CTLFLAG_RD, &xbb->max_request_segments, 0, "maximum number of pages per requests (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "max_request_size", CTLFLAG_RD, + &xbb->max_request_size, 0, + "maximum size in bytes of a request (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "ring_pages", CTLFLAG_RD, + &xbb->ring_config.ring_pages, 0, + "communication channel pages (negotiated)"); } /** @@ -3587,6 +3666,7 @@ xbb_attach(device_t dev) { struct xbb_softc *xbb; int error; + u_int max_ring_page_order; DPRINTF("Attaching to %s\n", xenbus_get_node(dev)); @@ -3621,6 +3701,10 @@ xbb_attach(device_t dev) return (error); } + /* + * Amazon EC2 client compatility. They refer to max-ring-pages + * instead of to max-ring-page-order. + */ error = xs_printf(XST_NIL, xenbus_get_node(xbb->dev), "max-ring-pages", "%zu", XBB_MAX_RING_PAGES); if (error) { @@ -3629,6 +3713,15 @@ xbb_attach(device_t dev) return (error); } + max_ring_page_order = flsl(XBB_MAX_RING_PAGES) - 1; + error = xs_printf(XST_NIL, xenbus_get_node(xbb->dev), + "max-ring-page-order", "%u", max_ring_page_order); + if (error) { + xbb_attach_failed(xbb, error, "writing %s/max-ring-page-order", + xenbus_get_node(xbb->dev)); + return (error); + } + error = xs_printf(XST_NIL, xenbus_get_node(xbb->dev), "max-requests", "%u", XBB_MAX_REQUESTS); if (error) { @@ -3862,12 +3955,16 @@ xbb_frontend_changed(device_t dev, Xenbu xbb_connect(xbb); break; case XenbusStateClosing: + /* + * Frontend has acknowledged Closing request. + * Wait for Closed state. + */ + break; case XenbusStateClosed: mtx_lock(&xbb->lock); xbb_shutdown(xbb); mtx_unlock(&xbb->lock); - if (frontend_state == XenbusStateClosed) - xenbus_set_state(xbb->dev, XenbusStateClosed); + xenbus_set_state(xbb->dev, XenbusStateClosed); break; default: xenbus_dev_fatal(xbb->dev, EINVAL, "saw state %d at frontend", Modified: stable/9/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/9/sys/dev/xen/blkfront/blkfront.c Fri Feb 17 01:23:58 2012 (r231850) +++ stable/9/sys/dev/xen/blkfront/blkfront.c Fri Feb 17 01:45:49 2012 (r231851) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -139,7 +140,7 @@ static int xb_dump(void *, void *, vm_of * with blkfront as the emulated drives, easing transition slightly. */ static void -blkfront_vdevice_to_unit(int vdevice, int *unit, const char **name) +blkfront_vdevice_to_unit(uint32_t vdevice, int *unit, const char **name) { static struct vdev_info { int major; @@ -186,6 +187,7 @@ blkfront_vdevice_to_unit(int vdevice, in if (vdevice & (1 << 28)) { *unit = (vdevice & ((1 << 28) - 1)) >> 8; *name = "xbd"; + return; } for (i = 0; info[i].major; i++) { @@ -407,6 +409,40 @@ blkfront_probe(device_t dev) return (ENXIO); } +static void +xb_setup_sysctl(struct xb_softc *xb) +{ + struct sysctl_ctx_list *sysctl_ctx = NULL; + struct sysctl_oid *sysctl_tree = NULL; + + sysctl_ctx = device_get_sysctl_ctx(xb->xb_dev); + if (sysctl_ctx == NULL) + return; + + sysctl_tree = device_get_sysctl_tree(xb->xb_dev); + if (sysctl_tree == NULL) + return; + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "max_requests", CTLFLAG_RD, &xb->max_requests, -1, + "maximum outstanding requests (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "max_request_segments", CTLFLAG_RD, + &xb->max_request_segments, 0, + "maximum number of pages per requests (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "max_request_size", CTLFLAG_RD, + &xb->max_request_size, 0, + "maximum size in bytes of a request (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "ring_pages", CTLFLAG_RD, + &xb->ring_pages, 0, + "communication channel pages (negotiated)"); +} + /* * Setup supplies the backend dir, virtual device. We place an event * channel and shared frame entries. We watch backend to wait if it's @@ -417,14 +453,14 @@ blkfront_attach(device_t dev) { struct xb_softc *sc; const char *name; + uint32_t vdevice; int error; - int vdevice; int i; int unit; /* FIXME: Use dynamic device id if this is not set. */ error = xs_scanf(XST_NIL, xenbus_get_node(dev), - "virtual-device", NULL, "%i", &vdevice); + "virtual-device", NULL, "%" PRIu32, &vdevice); if (error) { xenbus_dev_fatal(dev, error, "reading virtual-device"); device_printf(dev, "Couldn't determine virtual device.\n"); @@ -449,6 +485,8 @@ blkfront_attach(device_t dev) sc->vdevice = vdevice; sc->connected = BLKIF_STATE_DISCONNECTED; + xb_setup_sysctl(sc); + /* Wait for backend device to publish its protocol capabilities. */ xenbus_set_state(dev, XenbusStateInitialising); @@ -501,6 +539,7 @@ blkfront_initialize(struct xb_softc *sc) { const char *otherend_path; const char *node_path; + uint32_t max_ring_page_order; int error; int i; @@ -513,10 +552,10 @@ blkfront_initialize(struct xb_softc *sc) * Protocol defaults valid even if negotiation for a * setting fails. */ + max_ring_page_order = 0; sc->ring_pages = 1; - sc->max_requests = BLKIF_MAX_RING_REQUESTS(PAGE_SIZE); sc->max_request_segments = BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK; - sc->max_request_size = (sc->max_request_segments - 1) * PAGE_SIZE; + sc->max_request_size = XBF_SEGS_TO_SIZE(sc->max_request_segments); sc->max_request_blocks = BLKIF_SEGS_TO_BLOCKS(sc->max_request_segments); /* @@ -526,13 +565,25 @@ blkfront_initialize(struct xb_softc *sc) * we must use independant calls in order to guarantee * we don't miss information in a sparsly populated back-end * tree. + * + * \note xs_scanf() does not update variables for unmatched + * fields. */ otherend_path = xenbus_get_otherend_path(sc->xb_dev); node_path = xenbus_get_node(sc->xb_dev); + + /* Support both backend schemes for relaying ring page limits. */ + (void)xs_scanf(XST_NIL, otherend_path, + "max-ring-page-order", NULL, "%" PRIu32, + &max_ring_page_order); + sc->ring_pages = 1 << max_ring_page_order; (void)xs_scanf(XST_NIL, otherend_path, "max-ring-pages", NULL, "%" PRIu32, &sc->ring_pages); + if (sc->ring_pages < 1) + sc->ring_pages = 1; + sc->max_requests = BLKIF_MAX_RING_REQUESTS(sc->ring_pages * PAGE_SIZE); (void)xs_scanf(XST_NIL, otherend_path, "max-requests", NULL, "%" PRIu32, &sc->max_requests); @@ -552,6 +603,16 @@ blkfront_initialize(struct xb_softc *sc) sc->ring_pages = XBF_MAX_RING_PAGES; } + if (powerof2(sc->ring_pages) == 0) { + uint32_t new_page_limit; + + new_page_limit = 0x01 << (fls(sc->ring_pages) - 1); + device_printf(sc->xb_dev, "Back-end specified ring-pages of " + "%u is not a power of 2. Limited to %u.\n", + sc->ring_pages, new_page_limit); + sc->ring_pages = new_page_limit; + } + if (sc->max_requests > XBF_MAX_REQUESTS) { device_printf(sc->xb_dev, "Back-end specified max_requests of " "%u limited to front-end limit of %u.\n", @@ -560,8 +621,8 @@ blkfront_initialize(struct xb_softc *sc) } if (sc->max_request_segments > XBF_MAX_SEGMENTS_PER_REQUEST) { - device_printf(sc->xb_dev, "Back-end specificed " - "max_requests_segments of %u limited to " + device_printf(sc->xb_dev, "Back-end specified " + "max_request_segments of %u limited to " "front-end limit of %u.\n", sc->max_request_segments, XBF_MAX_SEGMENTS_PER_REQUEST); @@ -569,12 +630,23 @@ blkfront_initialize(struct xb_softc *sc) } if (sc->max_request_size > XBF_MAX_REQUEST_SIZE) { - device_printf(sc->xb_dev, "Back-end specificed " + device_printf(sc->xb_dev, "Back-end specified " "max_request_size of %u limited to front-end " "limit of %u.\n", sc->max_request_size, XBF_MAX_REQUEST_SIZE); sc->max_request_size = XBF_MAX_REQUEST_SIZE; } + + if (sc->max_request_size > XBF_SEGS_TO_SIZE(sc->max_request_segments)) { + device_printf(sc->xb_dev, "Back-end specified " + "max_request_size of %u limited to front-end " + "limit of %u. (Too few segments.)\n", + sc->max_request_size, + XBF_SEGS_TO_SIZE(sc->max_request_segments)); + sc->max_request_size = + XBF_SEGS_TO_SIZE(sc->max_request_segments); + } + sc->max_request_blocks = BLKIF_SEGS_TO_BLOCKS(sc->max_request_segments); /* Allocate datastructures based on negotiated values. */ @@ -625,11 +697,20 @@ blkfront_initialize(struct xb_softc *sc) if (setup_blkring(sc) != 0) return; + /* Support both backend schemes for relaying ring page limits. */ error = xs_printf(XST_NIL, node_path, - "ring-pages","%u", sc->ring_pages); + "num-ring-pages","%u", sc->ring_pages); if (error) { xenbus_dev_fatal(sc->xb_dev, error, - "writing %s/ring-pages", + "writing %s/num-ring-pages", + node_path); + return; + } + error = xs_printf(XST_NIL, node_path, + "ring-page-order","%u", fls(sc->ring_pages) - 1); + if (error) { + xenbus_dev_fatal(sc->xb_dev, error, + "writing %s/ring-page-order", node_path); return; } @@ -711,25 +792,31 @@ setup_blkring(struct xb_softc *sc) return (error); } } - error = xs_printf(XST_NIL, xenbus_get_node(sc->xb_dev), - "ring-ref","%u", sc->ring_ref[0]); - if (error) { - xenbus_dev_fatal(sc->xb_dev, error, "writing %s/ring-ref", - xenbus_get_node(sc->xb_dev)); - return (error); - } - for (i = 1; i < sc->ring_pages; i++) { - char ring_ref_name[]= "ring_refXX"; - - snprintf(ring_ref_name, sizeof(ring_ref_name), "ring-ref%u", i); + if (sc->ring_pages == 1) { error = xs_printf(XST_NIL, xenbus_get_node(sc->xb_dev), - ring_ref_name, "%u", sc->ring_ref[i]); + "ring-ref", "%u", sc->ring_ref[0]); if (error) { - xenbus_dev_fatal(sc->xb_dev, error, "writing %s/%s", - xenbus_get_node(sc->xb_dev), - ring_ref_name); + xenbus_dev_fatal(sc->xb_dev, error, + "writing %s/ring-ref", + xenbus_get_node(sc->xb_dev)); return (error); } + } else { + for (i = 0; i < sc->ring_pages; i++) { + char ring_ref_name[]= "ring_refXX"; + + snprintf(ring_ref_name, sizeof(ring_ref_name), + "ring-ref%u", i); + error = xs_printf(XST_NIL, xenbus_get_node(sc->xb_dev), + ring_ref_name, "%u", sc->ring_ref[i]); + if (error) { + xenbus_dev_fatal(sc->xb_dev, error, + "writing %s/%s", + xenbus_get_node(sc->xb_dev), + ring_ref_name); + return (error); + } + } } error = bind_listening_port_to_irqhandler( @@ -795,7 +882,7 @@ blkfront_connect(struct xb_softc *sc) unsigned int binfo; int err, feature_barrier; - if( (sc->connected == BLKIF_STATE_CONNECTED) || + if( (sc->connected == BLKIF_STATE_CONNECTED) || (sc->connected == BLKIF_STATE_SUSPENDED) ) return; @@ -923,15 +1010,13 @@ blkif_close(struct disk *dp) return (ENXIO); sc->xb_flags &= ~XB_OPEN; if (--(sc->users) == 0) { - /* Check whether we have been instructed to close. We will - have ignored this request initially, as the device was - still mounted. */ - device_t dev = sc->xb_dev; - XenbusState state = - xenbus_read_driver_state(xenbus_get_otherend_path(dev)); - - if (state == XenbusStateClosing) - blkfront_closing(dev); + /* + * Check whether we have been instructed to close. We will + * have ignored this request initially, as the device was + * still mounted. + */ + if (xenbus_get_otherend_state(sc->xb_dev) == XenbusStateClosing) + blkfront_closing(sc->xb_dev); } return (0); } @@ -1033,7 +1118,7 @@ blkif_queue_cb(void *arg, bus_dma_segmen struct xb_command *cm; blkif_request_t *ring_req; struct blkif_request_segment *sg; - struct blkif_request_segment *last_block_sg; + struct blkif_request_segment *last_block_sg; grant_ref_t *sg_ref; vm_paddr_t buffer_ma; uint64_t fsect, lsect; @@ -1104,12 +1189,12 @@ blkif_queue_cb(void *arg, bus_dma_segmen nsegs--; } block_segs = MIN(nsegs, BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK); - if (block_segs == 0) - break; + if (block_segs == 0) + break; - sg = BLKRING_GET_SG_REQUEST(&sc->ring, sc->ring.req_prod_pvt); + sg = BLKRING_GET_SEG_BLOCK(&sc->ring, sc->ring.req_prod_pvt); sc->ring.req_prod_pvt++; - last_block_sg = sg + block_segs; + last_block_sg = sg + block_segs; } if (cm->operation == BLKIF_OP_READ) Modified: stable/9/sys/dev/xen/blkfront/block.h ============================================================================== --- stable/9/sys/dev/xen/blkfront/block.h Fri Feb 17 01:23:58 2012 (r231850) +++ stable/9/sys/dev/xen/blkfront/block.h Fri Feb 17 01:45:49 2012 (r231851) @@ -35,6 +35,32 @@ #include /** + * Given a number of blkif segments, compute the maximum I/O size supported. + * + * \note This calculation assumes that all but the first and last segments + * of the I/O are fully utilized. + * + * \note We reserve a segement from the maximum supported by the transport to + * guarantee we can handle an unaligned transfer without the need to + * use a bounce buffer. + */ +#define XBF_SEGS_TO_SIZE(segs) \ + (((segs) - 1) * PAGE_SIZE) + +/** + * Compute the maximum number of blkif segments requried to represent + * an I/O of the given size. + * + * \note This calculation assumes that all but the first and last segments + * of the I/O are fully utilized. + * + * \note We reserve a segement to guarantee we can handle an unaligned + * transfer without the need to use a bounce buffer. + */ +#define XBF_SIZE_TO_SEGS(size) \ + ((size / PAGE_SIZE) + 1) + +/** * The maximum number of outstanding requests blocks (request headers plus * additional segment blocks) we will allow in a negotiated block-front/back * communication channel. @@ -44,22 +70,18 @@ /** * The maximum mapped region size per request we will allow in a negotiated * block-front/back communication channel. - * - * \note We reserve a segement from the maximum supported by the transport to - * guarantee we can handle an unaligned transfer without the need to - * use a bounce buffer.. */ -#define XBF_MAX_REQUEST_SIZE \ - MIN(MAXPHYS, (BLKIF_MAX_SEGMENTS_PER_REQUEST - 1) * PAGE_SIZE) +#define XBF_MAX_REQUEST_SIZE \ + MIN(MAXPHYS, XBF_SEGS_TO_SIZE(BLKIF_MAX_SEGMENTS_PER_REQUEST)) /** * The maximum number of segments (within a request header and accompanying * segment blocks) per request we will allow in a negotiated block-front/back * communication channel. */ -#define XBF_MAX_SEGMENTS_PER_REQUEST \ - (MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ - (XBF_MAX_REQUEST_SIZE / PAGE_SIZE) + 1)) +#define XBF_MAX_SEGMENTS_PER_REQUEST \ + (MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ + XBF_SIZE_TO_SEGS(XBF_MAX_REQUEST_SIZE))) /** * The maximum number of shared memory ring pages we will allow in a Modified: stable/9/sys/xen/interface/io/blkif.h ============================================================================== --- stable/9/sys/xen/interface/io/blkif.h Fri Feb 17 01:23:58 2012 (r231850) +++ stable/9/sys/xen/interface/io/blkif.h Fri Feb 17 01:45:49 2012 (r231851) @@ -1,8 +1,8 @@ /****************************************************************************** * blkif.h - * + * * Unified block-device I/O interface for Xen guest OSes. - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the @@ -22,6 +22,7 @@ * DEALINGS IN THE SOFTWARE. * * Copyright (c) 2003-2004, Keir Fraser + * Copyright (c) 2012, Spectra Logic Corporation */ #ifndef __XEN_PUBLIC_IO_BLKIF_H__ @@ -35,7 +36,7 @@ * notification can be made conditional on req_event (i.e., the generic * hold-off mechanism provided by the ring macros). Backends must set * req_event appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()). - * + * * Back->front notifications: When enqueuing a new response, sending a * notification can be made conditional on rsp_event (i.e., the generic * hold-off mechanism provided by the ring macros). Frontends must set @@ -48,37 +49,413 @@ #define blkif_sector_t uint64_t /* + * Feature and Parameter Negotiation + * ================================= + * The two halves of a Xen block driver utilize nodes within the XenStore to + * communicate capabilities and to negotiate operating parameters. This + * section enumerates these nodes which reside in the respective front and + * backend portions of the XenStore, following the XenBus convention. + * + * All data in the XenStore is stored as strings. Nodes specifying numeric + * values are encoded in decimal. Integer value ranges listed below are + * expressed as fixed sized integer types capable of storing the conversion + * of a properly formated node string, without loss of information. + * + * Any specified default value is in effect if the corresponding XenBus node + * is not present in the XenStore. + * + * XenStore nodes in sections marked "PRIVATE" are solely for use by the + * driver side whose XenBus tree contains them. + * + * See the XenBus state transition diagram below for details on when XenBus + * nodes must be published and when they can be queried. + * + ***************************************************************************** + * Backend XenBus Nodes + ***************************************************************************** + * + *------------------ Backend Device Identification (PRIVATE) ------------------ + * + * mode + * Values: "r" (read only), "w" (writable) + * + * The read or write access permissions to the backing store to be + * granted to the frontend. + * + * params + * Values: string + * + * A free formatted string providing sufficient information for the + * backend driver to open the backing device. (e.g. the path to the + * file or block device representing the backing store.) + * + * type + * Values: "file", "phy", "tap" + * + * The type of the backing device/object. + * + *--------------------------------- Features --------------------------------- + * + * feature-barrier + * Values: 0/1 (boolean) + * Default Value: 0 + * + * A value of "1" indicates that the backend can process requests + * containing the BLKIF_OP_WRITE_BARRIER request opcode. Requests + * of this type may still be returned at any time with the + * BLKIF_RSP_EOPNOTSUPP result code. + * + * feature-flush-cache + * Values: 0/1 (boolean) + * Default Value: 0 + * + * A value of "1" indicates that the backend can process requests + * containing the BLKIF_OP_FLUSH_DISKCACHE request opcode. Requests + * of this type may still be returned at any time with the + * BLKIF_RSP_EOPNOTSUPP result code. + * + * feature-discard + * Values: 0/1 (boolean) + * Default Value: 0 + * + * A value of "1" indicates that the backend can process requests + * containing the BLKIF_OP_DISCARD request opcode. Requests + * of this type may still be returned at any time with the + * BLKIF_RSP_EOPNOTSUPP result code. + * + *----------------------- Request Transport Parameters ------------------------ + * + * max-ring-page-order + * Values: + * Default Value: 0 + * Notes: 1, 3 + * + * The maximum supported size of the request ring buffer in units of + * lb(machine pages). (e.g. 0 == 1 page, 1 = 2 pages, 2 == 4 pages, + * etc.). + * + * max-ring-pages + * Values: + * Default Value: 1 + * Notes: 2, 3 + * + * The maximum supported size of the request ring buffer in units of + * machine pages. The value must be a power of 2. + * + * max-requests + * Default Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE) + * Maximum Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages) + * + * The maximum number of concurrent, logical requests that will be + * issued by the backend. + * + * Note: A logical request may span multiple ring entries. + * + * max-request-segments + * Values: + * Default Value: BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 03:03:53 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 8A15D106566C; Fri, 17 Feb 2012 03:03:53 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-150-251.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 8887B152478; Fri, 17 Feb 2012 03:03:50 +0000 (UTC) Message-ID: <4F3DC395.1050009@FreeBSD.org> Date: Thu, 16 Feb 2012 19:03:49 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.1) Gecko/20120213 Thunderbird/10.0.1 MIME-Version: 1.0 To: Jaakko Heinonen References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> <20120216092531.GA64733@jh> In-Reply-To: <20120216092531.GA64733@jh> X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Eitan Adler , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 03:03:53 -0000 On 02/16/2012 01:25, Jaakko Heinonen wrote: > On 2012-02-15, Eitan Adler wrote: >> On Wed, Feb 15, 2012 at 11:09 AM, Jaakko Heinonen wrote: >>> On 2012-02-15, Eitan Adler wrote: >>>> On Wed, Feb 15, 2012 at 10:50 AM, Jaakko Heinonen wrote: >>>> >>>>> I think this commit incorrectly placed mergeinfo to stable/9/share/. >>>> >>>> I used the following command: >>>> >>>> 2811 svn merge -c229831 $FSVN/head/share share >>>> >>>> Should I have committed somewhere else? >>>> http://wiki.freebsd.org/SubversionPrimer/Merging is not particularly >>>> helpful for share/ changes. >>> >>> Looking at previous merges I would have merged it to share/examples. >> >> I updated the wiki (see #11) and thanks for the help. > > I think that the mergeinfo from stable/9/share could be just deleted. > Unless I am mistaken there hasn't been merges that would place mergeinfo > only to stable/9/share after r230653. > > Could someone confirm that this is the right thing to do? The mergeinfo should be placed in the correct location first, but then it can be removed from share/, yes. -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 03:07:44 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10DAB106564A; Fri, 17 Feb 2012 03:07:44 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 46F788FC14; Fri, 17 Feb 2012 03:07:42 +0000 (UTC) Received: by wgbdq11 with SMTP id dq11so2334474wgb.31 for ; Thu, 16 Feb 2012 19:07:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=LWyPm3TUosebDCDpNfzexBPuu2pDLyUoFW1iZ4F6VJ4=; b=CfMX1DZ0MyBuc2w++p+E5nyZSFe6cQgH2yEnQ2kNE/FzjCKkzWEPeB8x6hOoUh/YFJ Hvn6WynRv/wIoXkaMMYmsKUMYIULzu8CdSI0nuhIbRg2LqNtKf4hzl+B8AbW93E7Usla v0rEm5tSw6NoPXAL9nW42bH3WOeWgcdi/n6y0= Received: by 10.180.92.165 with SMTP id cn5mr561488wib.2.1329448061409; Thu, 16 Feb 2012 19:07:41 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.223.15.90 with HTTP; Thu, 16 Feb 2012 19:07:11 -0800 (PST) In-Reply-To: <4F3DC395.1050009@FreeBSD.org> References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> <20120216092531.GA64733@jh> <4F3DC395.1050009@FreeBSD.org> From: Eitan Adler Date: Thu, 16 Feb 2012 22:07:11 -0500 X-Google-Sender-Auth: B0HBZLVK5vvikivhrsboB2sIH4s Message-ID: To: Doug Barton Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlhDBUNSwWbDbOiuSAtTkZyR4p76NWJnZwpBL0FEroU9QICvo0+2jsZv80s1pXYJWgy6cJW Cc: Jaakko Heinonen , src-committers@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 03:07:44 -0000 On Thu, Feb 16, 2012 at 10:03 PM, Doug Barton wrote: > The mergeinfo should be placed in the correct location first, but then > it can be removed from share/, yes. How? -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 03:39:07 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94443106566C; Fri, 17 Feb 2012 03:39:07 +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 693288FC0A; Fri, 17 Feb 2012 03:39: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 q1H3d7Tt048219; Fri, 17 Feb 2012 03:39:07 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1H3d71O048218; Fri, 17 Feb 2012 03:39:07 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202170339.q1H3d71O048218@svn.freebsd.org> From: Doug Barton Date: Fri, 17 Feb 2012 03:39:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231856 - in stable/9/share: . examples/diskless examples/ppp examples/printing X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 03:39:07 -0000 Author: dougb Date: Fri Feb 17 03:39:06 2012 New Revision: 231856 URL: http://svn.freebsd.org/changeset/base/231856 Log: Move mergeinfo from r229831 from share/ to the individual directories in share/examples/. Modified: Directory Properties: stable/9/share/ (props changed) stable/9/share/examples/diskless/ (props changed) stable/9/share/examples/ppp/ (props changed) stable/9/share/examples/printing/ (props changed) From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 03:43:07 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 0DEF4106566C; Fri, 17 Feb 2012 03:43:07 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-150-251.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 8410114DC58; Fri, 17 Feb 2012 03:43:05 +0000 (UTC) Message-ID: <4F3DCCC9.4080908@FreeBSD.org> Date: Thu, 16 Feb 2012 19:43:05 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.1) Gecko/20120213 Thunderbird/10.0.1 MIME-Version: 1.0 To: Eitan Adler References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> <20120216092531.GA64733@jh> <4F3DC395.1050009@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Jaakko Heinonen , src-committers@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 03:43:07 -0000 On 02/16/2012 19:07, Eitan Adler wrote: > On Thu, Feb 16, 2012 at 10:03 PM, Doug Barton wrote: >> The mergeinfo should be placed in the correct location first, but then >> it can be removed from share/, yes. > > How? I went ahead and did it for you. In share/ I did 'svn propedit svn:mergeinfo .' and removed the relevant entry. Then in each of the directories in examples I did, 'svn merge --record-only -c 228931 $REPO/head/share/examples/ppp .' One could argue that they could have been merged into examples/, but usually those directories don't share anything in common (pun intended). Doug -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 03:47:14 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74EFF1065670; Fri, 17 Feb 2012 03:47:14 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id F0DD88FC22; Fri, 17 Feb 2012 03:47:12 +0000 (UTC) Received: by werm13 with SMTP id m13so2523181wer.13 for ; Thu, 16 Feb 2012 19:47:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=zzuT/8cogxnK0NHQKfvItZLlCKjVx7VBSu3YRnKCchQ=; b=SynVejZCnjVqKZN0vCDQrZUH+o0UN+d8rE9h9XM4ahv2JhTQJr+yNlGEw/vLZfd/AP CmLszHAbnNutqxp/s1BDIvEz+kQfvFztcL2u8EGQxbojevoB+UM+LSv0xyqwjbhdSN2F Y2W/qHYFHUsYX68deTPCvBGk8BP3+OjgeXZD0= Received: by 10.180.92.73 with SMTP id ck9mr708452wib.2.1329450432202; Thu, 16 Feb 2012 19:47:12 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.223.15.90 with HTTP; Thu, 16 Feb 2012 19:46:42 -0800 (PST) In-Reply-To: <4F3DCCC9.4080908@FreeBSD.org> References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> <20120216092531.GA64733@jh> <4F3DC395.1050009@FreeBSD.org> <4F3DCCC9.4080908@FreeBSD.org> From: Eitan Adler Date: Thu, 16 Feb 2012 22:46:42 -0500 X-Google-Sender-Auth: lksEiS8CmS0QFzn7XBnktNI1XPE Message-ID: To: Doug Barton Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQmTZMOpgR7upXXzKv5sm3xq04mR2bRFiqbA/5prPmDu3aCexW/zzbKHghau5stwWLD3QHkZ Cc: Jaakko Heinonen , src-committers@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 03:47:14 -0000 On Thu, Feb 16, 2012 at 10:43 PM, Doug Barton wrote: > I went ahead and did it for you. In share/ I did 'svn propedit > svn:mergeinfo .' and removed the relevant entry. Then in each of the > directories in examples I did, 'svn merge --record-only -c 228931 > $REPO/head/share/examples/ppp .' Thank you. > One could argue that they could have been merged into examples/, but > usually those directories don't share anything in common (pun intended). :) -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 06:26:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B7E01065674; Fri, 17 Feb 2012 06:26:12 +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 7058F8FC0C; Fri, 17 Feb 2012 06:26: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 q1H6QCdm053595; Fri, 17 Feb 2012 06:26:12 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1H6QCB6053593; Fri, 17 Feb 2012 06:26:12 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201202170626.q1H6QCB6053593@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 17 Feb 2012 06:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231859 - stable/9/usr.bin/fstat X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 06:26:12 -0000 Author: pluknet Date: Fri Feb 17 06:26:11 2012 New Revision: 231859 URL: http://svn.freebsd.org/changeset/base/231859 Log: MFC r230934: Print the owner process for unix domain sockets when restricted to the specified files. PR: bin/143962 Modified: stable/9/usr.bin/fstat/fstat.c Directory Properties: stable/9/usr.bin/fstat/ (props changed) Modified: stable/9/usr.bin/fstat/fstat.c ============================================================================== --- stable/9/usr.bin/fstat/fstat.c Fri Feb 17 04:26:24 2012 (r231858) +++ stable/9/usr.bin/fstat/fstat.c Fri Feb 17 06:26:11 2012 (r231859) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -224,28 +225,53 @@ static void print_file_info(struct procstat *procstat, struct filestat *fst, const char *uname, const char *cmd, int pid) { + struct sockstat sock; struct vnstat vn; DEVS *d; const char *filename; int error, fsmatch = 0; char errbuf[_POSIX2_LINE_MAX]; + error = 0; filename = NULL; if (checkfile != 0) { - if (fst->fs_type != PS_FST_TYPE_VNODE && - fst->fs_type != PS_FST_TYPE_FIFO) + switch (fst->fs_type) { + case PS_FST_TYPE_VNODE: + case PS_FST_TYPE_FIFO: + error = procstat_get_vnode_info(procstat, fst, &vn, errbuf); + break; + case PS_FST_TYPE_SOCKET: + error = procstat_get_socket_info(procstat, fst, &sock, errbuf); + break; + default: return; - error = procstat_get_vnode_info(procstat, fst, &vn, errbuf); + } if (error != 0) return; for (d = devs; d != NULL; d = d->next) - if (d->fsid == vn.vn_fsid) { - fsmatch = 1; - if ((unsigned)d->ino == vn.vn_fileid) { - filename = d->name; - break; + switch (fst->fs_type) { + case PS_FST_TYPE_VNODE: + case PS_FST_TYPE_FIFO: + if (d->fsid == vn.vn_fsid) { + fsmatch = 1; + if ((unsigned)d->ino == vn.vn_fileid) { + filename = d->name; + break; + } + } + break; + case PS_FST_TYPE_SOCKET: + if (sock.dom_family == AF_UNIX) { + fsmatch = 1; + if (strcmp(((struct sockaddr_un *) + (&sock.sa_local))->sun_path, + d->name) == 0) { + filename = d->name; + break; + } } + break; } if (fsmatch == 0 || (filename == NULL && fsflg == 0)) return; From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 06:33:34 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6723106564A; Fri, 17 Feb 2012 06:33:34 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by mx1.freebsd.org (Postfix) with ESMTP id 517E28FC12; Fri, 17 Feb 2012 06:33:34 +0000 (UTC) Received: from a91-153-116-96.elisa-laajakaista.fi (a91-153-116-96.elisa-laajakaista.fi [91.153.116.96]) by gw01.mail.saunalahti.fi (Postfix) with SMTP id D7CE11514DC; Fri, 17 Feb 2012 08:33:23 +0200 (EET) Date: Fri, 17 Feb 2012 08:33:21 +0200 From: Jaakko Heinonen To: Doug Barton Message-ID: <20120217063321.GA2273@a91-153-116-96.elisa-laajakaista.fi> References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> <20120216092531.GA64733@jh> <4F3DC395.1050009@FreeBSD.org> <4F3DCCC9.4080908@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F3DCCC9.4080908@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@freebsd.org, Eitan Adler , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 06:33:35 -0000 On 2012-02-16, Doug Barton wrote: > On 02/16/2012 19:07, Eitan Adler wrote: > > On Thu, Feb 16, 2012 at 10:03 PM, Doug Barton wrote: > >> The mergeinfo should be placed in the correct location first, but then Why this is necessary? r230653 recorded mergeinfo also to share/examples. A snippet from diff: Modified: svn:mergeinfo Merged /head/share/examples:r229831 > I went ahead and did it for you. In share/ I did 'svn propedit > svn:mergeinfo .' and removed the relevant entry. Then in each of the > directories in examples I did, 'svn merge --record-only -c 228931 > $REPO/head/share/examples/ppp .' Thanks, but stable/9/share still has the svn:mergeinfo property after r231856. It didn't have it before r230653. -- Jaakko From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 06:43:37 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 1C111106566B; Fri, 17 Feb 2012 06:43:37 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-150-251.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 2AA46B4616; Fri, 17 Feb 2012 06:43:36 +0000 (UTC) Message-ID: <4F3DF717.3080406@FreeBSD.org> Date: Thu, 16 Feb 2012 22:43:35 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.1) Gecko/20120213 Thunderbird/10.0.1 MIME-Version: 1.0 To: Jaakko Heinonen References: <201201281948.q0SJmjIL096609@svn.freebsd.org> <20120215155011.GB2279@a91-153-116-96.elisa-laajakaista.fi> <20120215160950.GC2279@a91-153-116-96.elisa-laajakaista.fi> <20120216092531.GA64733@jh> <4F3DC395.1050009@FreeBSD.org> <4F3DCCC9.4080908@FreeBSD.org> <20120217063321.GA2273@a91-153-116-96.elisa-laajakaista.fi> In-Reply-To: <20120217063321.GA2273@a91-153-116-96.elisa-laajakaista.fi> X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Eitan Adler , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org, cperciva@freebsd.org Subject: Re: svn commit: r230653 - in stable/9: lib/libopie share/examples/diskless share/examples/ppp share/examples/printing tools/tools/nanobsd/pcengines/Files/root usr.sbin/pkg_install/add X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 06:43:37 -0000 On 02/16/2012 22:33, Jaakko Heinonen wrote: > Thanks, but stable/9/share still has the svn:mergeinfo property after > r231856. It didn't have it before r230653. Feel free to adjust things to the state you think they should be. -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 10:27:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F09711065674; Fri, 17 Feb 2012 10:27:58 +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 C1DBD8FC1D; Fri, 17 Feb 2012 10:27:58 +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 q1HARw66063137; Fri, 17 Feb 2012 10:27:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1HARwkG063132; Fri, 17 Feb 2012 10:27:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202171027.q1HARwkG063132@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 17 Feb 2012 10:27:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231865 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 10:27:59 -0000 Author: kib Date: Fri Feb 17 10:27:58 2012 New Revision: 231865 URL: http://svn.freebsd.org/changeset/base/231865 Log: MFC r231320: Mark the automatically attached child with PL_FLAG_CHILD in struct lwpinfo flags, for PT_FOLLOWFORK auto-attachment. Modified: stable/9/sys/kern/kern_fork.c stable/9/sys/kern/sys_process.c stable/9/sys/sys/proc.h stable/9/sys/sys/ptrace.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_fork.c ============================================================================== --- stable/9/sys/kern/kern_fork.c Fri Feb 17 08:45:08 2012 (r231864) +++ stable/9/sys/kern/kern_fork.c Fri Feb 17 10:27:58 2012 (r231865) @@ -1035,7 +1035,9 @@ fork_return(struct thread *td, struct tr p->p_oppid = p->p_pptr->p_pid; proc_reparent(p, dbg); sx_xunlock(&proctree_lock); + td->td_dbgflags |= TDB_CHILD; ptracestop(td, SIGSTOP); + td->td_dbgflags &= ~TDB_CHILD; } else { /* * ... otherwise clear the request. Modified: stable/9/sys/kern/sys_process.c ============================================================================== --- stable/9/sys/kern/sys_process.c Fri Feb 17 08:45:08 2012 (r231864) +++ stable/9/sys/kern/sys_process.c Fri Feb 17 10:27:58 2012 (r231865) @@ -1145,6 +1145,8 @@ kern_ptrace(struct thread *td, int req, pl->pl_flags |= PL_FLAG_FORKED; pl->pl_child_pid = td2->td_dbg_forked; } + if (td2->td_dbgflags & TDB_CHILD) + pl->pl_flags |= PL_FLAG_CHILD; pl->pl_sigmask = td2->td_sigmask; pl->pl_siglist = td2->td_siglist; strcpy(pl->pl_tdname, td2->td_name); Modified: stable/9/sys/sys/proc.h ============================================================================== --- stable/9/sys/sys/proc.h Fri Feb 17 08:45:08 2012 (r231864) +++ stable/9/sys/sys/proc.h Fri Feb 17 10:27:58 2012 (r231865) @@ -383,6 +383,7 @@ do { \ process */ #define TDB_STOPATFORK 0x00000080 /* Stop at the return from fork (child only) */ +#define TDB_CHILD 0x00000100 /* New child indicator for ptrace() */ /* * "Private" flags kept in td_pflags: Modified: stable/9/sys/sys/ptrace.h ============================================================================== --- stable/9/sys/sys/ptrace.h Fri Feb 17 08:45:08 2012 (r231864) +++ stable/9/sys/sys/ptrace.h Fri Feb 17 10:27:58 2012 (r231865) @@ -107,6 +107,7 @@ struct ptrace_lwpinfo { #define PL_FLAG_EXEC 0x10 /* exec(2) succeeded */ #define PL_FLAG_SI 0x20 /* siginfo is valid */ #define PL_FLAG_FORKED 0x40 /* new child */ +#define PL_FLAG_CHILD 0x80 /* I am from child */ sigset_t pl_sigmask; /* LWP signal mask */ sigset_t pl_siglist; /* LWP pending signal */ struct __siginfo pl_siginfo; /* siginfo for signal */ From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 10:37:15 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EE22106564A; Fri, 17 Feb 2012 10:37:15 +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 89BB48FC1A; Fri, 17 Feb 2012 10:37: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 q1HAbFlE074472; Fri, 17 Feb 2012 10:37:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1HAbFCS074470; Fri, 17 Feb 2012 10:37:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202171037.q1HAbFCS074470@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 17 Feb 2012 10:37:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231866 - stable/9/sys/amd64/amd64 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 10:37:15 -0000 Author: kib Date: Fri Feb 17 10:37:14 2012 New Revision: 231866 URL: http://svn.freebsd.org/changeset/base/231866 Log: MFC r231441: In cpu_set_user_tls(), consistently set PCB_FULL_IRET pcb flag for both 64bit and 32bit binaries, not for 64bit only. Modified: stable/9/sys/amd64/amd64/vm_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/vm_machdep.c Fri Feb 17 10:27:58 2012 (r231865) +++ stable/9/sys/amd64/amd64/vm_machdep.c Fri Feb 17 10:37:14 2012 (r231866) @@ -498,6 +498,7 @@ cpu_set_user_tls(struct thread *td, void return (EINVAL); pcb = td->td_pcb; + set_pcb_flags(pcb, PCB_FULL_IRET); #ifdef COMPAT_FREEBSD32 if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { pcb->pcb_gsbase = (register_t)tls_base; @@ -505,7 +506,6 @@ cpu_set_user_tls(struct thread *td, void } #endif pcb->pcb_fsbase = (register_t)tls_base; - set_pcb_flags(pcb, PCB_FULL_IRET); return (0); } From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 10:39:29 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 083E5106566B; Fri, 17 Feb 2012 10:39:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE5068FC19; Fri, 17 Feb 2012 10:39: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 q1HAdSlP074582; Fri, 17 Feb 2012 10:39:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1HAdSYU074581; Fri, 17 Feb 2012 10:39:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202171039.q1HAdSYU074581@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 17 Feb 2012 10:39:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231867 - stable/9/tools/test/ptrace X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 10:39:29 -0000 Author: kib Date: Fri Feb 17 10:39:28 2012 New Revision: 231867 URL: http://svn.freebsd.org/changeset/base/231867 Log: MFC r231443: Add a test program for recently added ptrace(2) interfaces. Added: stable/9/tools/test/ptrace/ - copied from r231443, head/tools/test/ptrace/ Modified: Directory Properties: stable/9/tools/test/ (props changed) From owner-svn-src-stable-9@FreeBSD.ORG Fri Feb 17 10:54:09 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4A8C106566C; Fri, 17 Feb 2012 10:54:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF1E58FC13; Fri, 17 Feb 2012 10:54: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 q1HAs9Qm075174; Fri, 17 Feb 2012 10:54:09 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1HAs9Gk075172; Fri, 17 Feb 2012 10:54:09 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201202171054.q1HAs9Gk075172@svn.freebsd.org> From: Michael Tuexen Date: Fri, 17 Feb 2012 10:54:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231870 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 10:54:10 -0000 Author: tuexen Date: Fri Feb 17 10:54:09 2012 New Revision: 231870 URL: http://svn.freebsd.org/changeset/base/231870 Log: MFC 231672: Fix a bug where the wrong protocol overhead was used. This can lead to a deadlock of an association when an IPv6 socket was used to communcate with IPv4 and an ICMPv4 fragmentation needed message was received. While there, simplify the code a bit. Modified: stable/9/sys/netinet/sctp_output.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_output.c ============================================================================== --- stable/9/sys/netinet/sctp_output.c Fri Feb 17 10:51:40 2012 (r231869) +++ stable/9/sys/netinet/sctp_output.c Fri Feb 17 10:54:09 2012 (r231870) @@ -7612,16 +7612,22 @@ sctp_fill_outqueue(struct sctp_tcb *stcb SCTP_TCB_LOCK_ASSERT(stcb); asoc = &stcb->asoc; + switch (net->ro._l_addr.sa.sa_family) { +#ifdef INET + case AF_INET: + goal_mtu = net->mtu - SCTP_MIN_V4_OVERHEAD; + break; +#endif #ifdef INET6 - if (net->ro._l_addr.sin6.sin6_family == AF_INET6) { + case AF_INET6: goal_mtu = net->mtu - SCTP_MIN_OVERHEAD; - } else { - /* ?? not sure what else to do */ - goal_mtu = net->mtu - SCTP_MIN_V4_OVERHEAD; - } -#else - goal_mtu = net->mtu - SCTP_MIN_OVERHEAD; + break; #endif + default: + /* TSNH */ + goal_mtu = net->mtu; + break; + } /* Need an allowance for the data chunk header too */ goal_mtu -= sizeof(struct sctp_data_chunk); @@ -8180,10 +8186,21 @@ again_one_more_time: if (!no_out_cnt) *num_out += ctl_cnt; /* recalc a clean slate and setup */ - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - mtu = (net->mtu - SCTP_MIN_OVERHEAD); - } else { - mtu = (net->mtu - SCTP_MIN_V4_OVERHEAD); + switch (net->ro._l_addr.sa.sa_family) { +#ifdef INET + case AF_INET: + mtu = net->mtu - SCTP_MIN_V4_OVERHEAD; + break; +#endif +#ifdef INET6 + case AF_INET6: + mtu = net->mtu - SCTP_MIN_OVERHEAD; + break; +#endif + default: + /* TSNH */ + mtu = net->mtu; + break; } to_out = 0; no_fragmentflg = 1; @@ -8446,10 +8463,21 @@ again_one_more_time: if (!no_out_cnt) *num_out += ctl_cnt; /* recalc a clean slate and setup */ - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - mtu = (net->mtu - SCTP_MIN_OVERHEAD); - } else { - mtu = (net->mtu - SCTP_MIN_V4_OVERHEAD); + switch (net->ro._l_addr.sa.sa_family) { +#ifdef INET + case AF_INET: + mtu = net->mtu - SCTP_MIN_V4_OVERHEAD; + break; +#endif +#ifdef INET6 + case AF_INET6: + mtu = net->mtu - SCTP_MIN_OVERHEAD; + break; +#endif + default: + /* TSNH */ + mtu = net->mtu; + break; } to_out = 0; no_fragmentflg = 1; @@ -9492,10 +9520,21 @@ sctp_chunk_retransmission(struct sctp_in } /* pick up the net */ net = chk->whoTo; - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - mtu = (net->mtu - SCTP_MIN_OVERHEAD); - } else { + switch (net->ro._l_addr.sa.sa_family) { +#ifdef INET + case AF_INET: mtu = net->mtu - SCTP_MIN_V4_OVERHEAD; + break; +#endif +#ifdef INET6 + case AF_INET6: + mtu = net->mtu - SCTP_MIN_OVERHEAD; + break; +#endif + default: + /* TSNH */ + mtu = net->mtu; + break; } if ((asoc->peers_rwnd < mtu) && (asoc->total_flight > 0)) { @@ -9816,12 +9855,10 @@ one_chunk_around: return (0); } - -static int +static void sctp_timer_validation(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct sctp_association *asoc, - int ret) + struct sctp_association *asoc) { struct sctp_nets *net; @@ -9829,7 +9866,7 @@ sctp_timer_validation(struct sctp_inpcb TAILQ_FOREACH(net, &asoc->nets, sctp_next) { if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { /* Here is a timer */ - return (ret); + return; } } SCTP_TCB_LOCK_ASSERT(stcb); @@ -9840,7 +9877,7 @@ sctp_timer_validation(struct sctp_inpcb } else { sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, asoc->primary_destination); } - return (ret); + return; } void @@ -9950,7 +9987,7 @@ sctp_chunk_output(struct sctp_inpcb *inp #ifdef SCTP_AUDITING_ENABLED sctp_auditing(8, inp, stcb, NULL); #endif - (void)sctp_timer_validation(inp, stcb, asoc, ret); + sctp_timer_validation(inp, stcb, asoc); return; } if (ret < 0) { From owner-svn-src-stable-9@FreeBSD.ORG Sat Feb 18 00:45:59 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C356106564A; Sat, 18 Feb 2012 00:45:59 +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 6AEC38FC12; Sat, 18 Feb 2012 00:45:59 +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 q1I0jxqe003572; Sat, 18 Feb 2012 00:45:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1I0jxSi003569; Sat, 18 Feb 2012 00:45:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202180045.q1I0jxSi003569@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 18 Feb 2012 00:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231887 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2012 00:45:59 -0000 Author: kib Date: Sat Feb 18 00:45:59 2012 New Revision: 231887 URL: http://svn.freebsd.org/changeset/base/231887 Log: MFC r231521: The PTRACESTOP() macro is used only once. Inline the only use and remove the macro. Modified: stable/9/sys/kern/subr_syscall.c stable/9/sys/sys/ptrace.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_syscall.c ============================================================================== --- stable/9/sys/kern/subr_syscall.c Sat Feb 18 00:35:23 2012 (r231886) +++ stable/9/sys/kern/subr_syscall.c Sat Feb 18 00:45:59 2012 (r231887) @@ -85,7 +85,11 @@ syscallenter(struct thread *td, struct s if (error == 0) { STOPEVENT(p, S_SCE, sa->narg); - PTRACESTOP_SC(p, td, S_PT_SCE); + if (p->p_flag & P_TRACED && p->p_stops & S_PT_SCE) { + PROC_LOCK(p); + ptracestop((td), SIGTRAP); + PROC_UNLOCK(p); + } if (td->td_dbgflags & TDB_USERWR) { /* * Reread syscall number and arguments if Modified: stable/9/sys/sys/ptrace.h ============================================================================== --- stable/9/sys/sys/ptrace.h Sat Feb 18 00:35:23 2012 (r231886) +++ stable/9/sys/sys/ptrace.h Sat Feb 18 00:45:59 2012 (r231887) @@ -131,12 +131,6 @@ struct ptrace_vm_entry { #ifdef _KERNEL -#define PTRACESTOP_SC(p, td, flag) \ - if ((p)->p_flag & P_TRACED && (p)->p_stops & (flag)) { \ - PROC_LOCK(p); \ - ptracestop((td), SIGTRAP); \ - PROC_UNLOCK(p); \ - } /* * The flags below are used for ptrace(2) tracing and have no relation * to procfs. They are stored in struct proc's p_stops member. From owner-svn-src-stable-9@FreeBSD.ORG Sat Feb 18 00:49:09 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D27C91065672; Sat, 18 Feb 2012 00:49:09 +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 C17C78FC1A; Sat, 18 Feb 2012 00:49: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 q1I0n97E003768; Sat, 18 Feb 2012 00:49:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1I0n9bf003764; Sat, 18 Feb 2012 00:49:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202180049.q1I0n9bf003764@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 18 Feb 2012 00:49:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231889 - stable/9/sys/vm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2012 00:49:10 -0000 Author: kib Date: Sat Feb 18 00:49:09 2012 New Revision: 231889 URL: http://svn.freebsd.org/changeset/base/231889 Log: MFC r231526: Close a race due to dropping of the map lock between creating map entry for a shared mapping and marking the entry for inheritance. Modified: stable/9/sys/vm/vm_map.c stable/9/sys/vm/vm_map.h stable/9/sys/vm/vm_mmap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_map.c ============================================================================== --- stable/9/sys/vm/vm_map.c Sat Feb 18 00:46:18 2012 (r231888) +++ stable/9/sys/vm/vm_map.c Sat Feb 18 00:49:09 2012 (r231889) @@ -1130,6 +1130,7 @@ vm_map_insert(vm_map_t map, vm_object_t vm_map_entry_t temp_entry; vm_eflags_t protoeflags; struct ucred *cred; + vm_inherit_t inheritance; boolean_t charge_prev_obj; VM_MAP_ASSERT_LOCKED(map); @@ -1173,6 +1174,10 @@ vm_map_insert(vm_map_t map, vm_object_t protoeflags |= MAP_ENTRY_NOSYNC; if (cow & MAP_DISABLE_COREDUMP) protoeflags |= MAP_ENTRY_NOCOREDUMP; + if (cow & MAP_INHERIT_SHARE) + inheritance = VM_INHERIT_SHARE; + else + inheritance = VM_INHERIT_DEFAULT; cred = NULL; KASSERT((object != kmem_object && object != kernel_object) || @@ -1227,7 +1232,7 @@ charged: * can extend the previous map entry to include the * new range as well. */ - if ((prev_entry->inheritance == VM_INHERIT_DEFAULT) && + if ((prev_entry->inheritance == inheritance) && (prev_entry->protection == prot) && (prev_entry->max_protection == max)) { map->size += (end - prev_entry->end); @@ -1276,7 +1281,7 @@ charged: new_entry->offset = offset; new_entry->avail_ssize = 0; - new_entry->inheritance = VM_INHERIT_DEFAULT; + new_entry->inheritance = inheritance; new_entry->protection = prot; new_entry->max_protection = max; new_entry->wired_count = 0; Modified: stable/9/sys/vm/vm_map.h ============================================================================== --- stable/9/sys/vm/vm_map.h Sat Feb 18 00:46:18 2012 (r231888) +++ stable/9/sys/vm/vm_map.h Sat Feb 18 00:49:09 2012 (r231889) @@ -307,7 +307,7 @@ long vmspace_wired_count(struct vmspace /* * Copy-on-write flags for vm_map operations */ -#define MAP_UNUSED_01 0x0001 +#define MAP_INHERIT_SHARE 0x0001 #define MAP_COPY_ON_WRITE 0x0002 #define MAP_NOFAULT 0x0004 #define MAP_PREFAULT 0x0008 Modified: stable/9/sys/vm/vm_mmap.c ============================================================================== --- stable/9/sys/vm/vm_mmap.c Sat Feb 18 00:46:18 2012 (r231888) +++ stable/9/sys/vm/vm_mmap.c Sat Feb 18 00:49:09 2012 (r231889) @@ -1517,6 +1517,9 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, docow |= MAP_DISABLE_SYNCER; if (flags & MAP_NOCORE) docow |= MAP_DISABLE_COREDUMP; + /* Shared memory is also shared with children. */ + if (flags & MAP_SHARED) + docow |= MAP_INHERIT_SHARE; if (flags & MAP_STACK) rv = vm_map_stack(map, *addr, size, prot, maxprot, @@ -1536,13 +1539,6 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, * or named anonymous without other references. */ vm_object_deallocate(object); - } else if (flags & MAP_SHARED) { - /* - * Shared memory is also shared with children. - */ - rv = vm_map_inherit(map, *addr, *addr + size, VM_INHERIT_SHARE); - if (rv != KERN_SUCCESS) - (void) vm_map_remove(map, *addr, *addr + size); } /* From owner-svn-src-stable-9@FreeBSD.ORG Sat Feb 18 16:54:02 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8FF9106566B; Sat, 18 Feb 2012 16:54:02 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0C118FC13; Sat, 18 Feb 2012 16:54: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 q1IGs1no039553; Sat, 18 Feb 2012 16:54:01 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1IGs1Bn039551; Sat, 18 Feb 2012 16:54:01 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201202181654.q1IGs1Bn039551@svn.freebsd.org> From: Jamie Gritton Date: Sat, 18 Feb 2012 16:54:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231896 - stable/9/lib/libc/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2012 16:54:02 -0000 Author: jamie Date: Sat Feb 18 16:54:01 2012 New Revision: 231896 URL: http://svn.freebsd.org/changeset/base/231896 Log: MFC r231236: Acknowledge that jail_attach and jail_remove can return EPERM. Modified: stable/9/lib/libc/sys/jail.2 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/sys/jail.2 ============================================================================== --- stable/9/lib/libc/sys/jail.2 Sat Feb 18 16:06:15 2012 (r231895) +++ stable/9/lib/libc/sys/jail.2 Sat Feb 18 16:54:01 2012 (r231896) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2009 +.Dd February 8, 2012 .Dt JAIL 2 .Os .Sh NAME @@ -400,6 +400,8 @@ and system calls will fail if: .Bl -tag -width Er +.It Bq Er EPERM +A user other than the super-user attempted to attach to or remove a jail. .It Bq Er EINVAL The jail specified by .Fa jid