From owner-svn-src-stable-8@FreeBSD.ORG Sun Feb 12 05:01:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2864A106564A; Sun, 12 Feb 2012 05:01:50 +0000 (UTC) (envelope-from mckay@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D6768FC0A; Sun, 12 Feb 2012 05: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 q1C51nw8065895; Sun, 12 Feb 2012 05:01:49 GMT (envelope-from mckay@svn.freebsd.org) Received: (from mckay@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1C51noc065893; Sun, 12 Feb 2012 05:01:49 GMT (envelope-from mckay@svn.freebsd.org) Message-Id: <201202120501.q1C51noc065893@svn.freebsd.org> From: Stephen McKay Date: Sun, 12 Feb 2012 05:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231542 - stable/8/usr.bin/xargs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 05:01:50 -0000 Author: mckay Date: Sun Feb 12 05:01:49 2012 New Revision: 231542 URL: http://svn.freebsd.org/changeset/base/231542 Log: MFC r215615, r215642: Fix several misbehaviours by making xargs keep track of its child processes. Modified: stable/8/usr.bin/xargs/xargs.c Directory Properties: stable/8/usr.bin/xargs/ (props changed) Modified: stable/8/usr.bin/xargs/xargs.c ============================================================================== --- stable/8/usr.bin/xargs/xargs.c Sun Feb 12 01:07:15 2012 (r231541) +++ stable/8/usr.bin/xargs/xargs.c Sun Feb 12 05:01:49 2012 (r231542) @@ -73,7 +73,16 @@ static int prompt(void); static void run(char **); static void usage(void); void strnsubst(char **, const char *, const char *, size_t); +static pid_t xwait(int block, int *status); static void waitchildren(const char *, int); +static void pids_init(void); +static int pids_empty(void); +static int pids_full(void); +static void pids_add(pid_t pid); +static int pids_remove(pid_t pid); +static int findslot(pid_t pid); +static int findfreeslot(void); +static void clearslot(int slot); static char echo[] = _PATH_ECHO; static char **av, **bxp, **ep, **endxp, **xp; @@ -82,6 +91,7 @@ static const char *eofstr; static int count, insingle, indouble, oflag, pflag, tflag, Rflag, rval, zflag; static int cnt, Iflag, jfound, Lflag, Sflag, wasquoted, xflag; static int curprocs, maxprocs; +static pid_t *childpids; static volatile int childerr; @@ -205,6 +215,8 @@ main(int argc, char *argv[]) if (replstr != NULL && *replstr == '\0') errx(1, "replstr may not be empty"); + pids_init(); + /* * Allocate pointers for the utility name, the utility arguments, * the maximum arguments to be read from stdin and the trailing @@ -556,19 +568,41 @@ exec: childerr = errno; _exit(1); } - curprocs++; + pids_add(pid); waitchildren(*argv, 0); } +/* + * Wait for a tracked child to exit and return its pid and exit status. + * + * Ignores (discards) all untracked child processes. + * Returns -1 and sets errno to ECHILD if no tracked children exist. + * If block is set, waits indefinitely for a child process to exit. + * If block is not set and no children have exited, returns 0 immediately. + */ +static pid_t +xwait(int block, int *status) { + pid_t pid; + + if (pids_empty()) { + errno = ECHILD; + return (-1); + } + + while ((pid = waitpid(-1, status, block ? 0 : WNOHANG)) > 0) + if (pids_remove(pid)) + break; + + return (pid); +} + static void waitchildren(const char *name, int waitall) { pid_t pid; int status; - while ((pid = waitpid(-1, &status, !waitall && curprocs < maxprocs ? - WNOHANG : 0)) > 0) { - curprocs--; + while ((pid = xwait(waitall || pids_full(), &status)) > 0) { /* If we couldn't invoke the utility, exit. */ if (childerr != 0) { errno = childerr; @@ -583,8 +617,87 @@ waitchildren(const char *name, int waita if (WEXITSTATUS(status)) rval = 1; } + if (pid == -1 && errno != ECHILD) - err(1, "wait3"); + err(1, "waitpid"); +} + +#define NOPID (0) + +static void +pids_init(void) +{ + int i; + + if ((childpids = malloc(maxprocs * sizeof(*childpids))) == NULL) + errx(1, "malloc failed"); + + for (i = 0; i < maxprocs; i++) + clearslot(i); +} + +static int +pids_empty(void) +{ + return (curprocs == 0); +} + +static int +pids_full(void) +{ + return (curprocs >= maxprocs); +} + +static void +pids_add(pid_t pid) +{ + int slot; + + slot = findfreeslot(); + childpids[slot] = pid; + curprocs++; +} + +static int +pids_remove(pid_t pid) +{ + int slot; + + if ((slot = findslot(pid)) < 0) + return (0); + + clearslot(slot); + curprocs--; + return (1); +} + +static int +findfreeslot(void) +{ + int slot; + + if ((slot = findslot(NOPID)) < 0) + errx(1, "internal error: no free pid slot"); + + return (slot); +} + +static int +findslot(pid_t pid) +{ + int slot; + + for (slot = 0; slot < maxprocs; slot++) + if (childpids[slot] == pid) + return (slot); + + return (-1); +} + +static void +clearslot(int slot) +{ + childpids[slot] = NOPID; } /* From owner-svn-src-stable-8@FreeBSD.ORG Sun Feb 12 06:41:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7459B106566B; Sun, 12 Feb 2012 06:41:30 +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 47FD78FC13; Sun, 12 Feb 2012 06:41:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1C6fU5l069106; Sun, 12 Feb 2012 06:41:30 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1C6fUIN069104; Sun, 12 Feb 2012 06:41:30 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202120641.q1C6fUIN069104@svn.freebsd.org> From: Rick Macklem Date: Sun, 12 Feb 2012 06:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231547 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 06:41:30 -0000 Author: rmacklem Date: Sun Feb 12 06:41:29 2012 New Revision: 231547 URL: http://svn.freebsd.org/changeset/base/231547 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/8/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Sun Feb 12 06:27:59 2012 (r231546) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Sun Feb 12 06:41:29 2012 (r231547) @@ -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-8@FreeBSD.ORG Sun Feb 12 07:53:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B27A106564A; Sun, 12 Feb 2012 07:53:03 +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 595138FC15; Sun, 12 Feb 2012 07:53: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 q1C7r3Fs071432; Sun, 12 Feb 2012 07:53:03 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1C7r3JZ071430; Sun, 12 Feb 2012 07:53:03 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202120753.q1C7r3JZ071430@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 12 Feb 2012 07:53:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231551 - stable/8/lib/libkvm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 07:53:03 -0000 Author: trociny Date: Sun Feb 12 07:53:02 2012 New Revision: 231551 URL: http://svn.freebsd.org/changeset/base/231551 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/8/lib/libkvm/kvm_proc.c Directory Properties: stable/8/lib/libkvm/ (props changed) Modified: stable/8/lib/libkvm/kvm_proc.c ============================================================================== --- stable/8/lib/libkvm/kvm_proc.c Sun Feb 12 07:52:14 2012 (r231550) +++ stable/8/lib/libkvm/kvm_proc.c Sun Feb 12 07:53:02 2012 (r231551) @@ -471,7 +471,7 @@ kvm_getprocs(kd, op, arg, cnt) int *cnt; { int mib[4], st, nprocs; - size_t size; + size_t size, osize; int temp_op; if (kd->procbase != 0) { @@ -521,10 +521,11 @@ kvm_getprocs(kd, op, arg, cnt) _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-8@FreeBSD.ORG Sun Feb 12 07:56:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F8C810656D3; Sun, 12 Feb 2012 07:56:08 +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 7D7508FC0C; Sun, 12 Feb 2012 07:56:08 +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 q1C7u8iX071643; Sun, 12 Feb 2012 07:56:08 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1C7u8sv071641; Sun, 12 Feb 2012 07:56:08 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202120756.q1C7u8sv071641@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 12 Feb 2012 07:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231554 - stable/8/usr.bin/sockstat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 07:56:08 -0000 Author: trociny Date: Sun Feb 12 07:56:07 2012 New Revision: 231554 URL: http://svn.freebsd.org/changeset/base/231554 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/8/usr.bin/sockstat/sockstat.c Directory Properties: stable/8/usr.bin/sockstat/ (props changed) Modified: stable/8/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/8/usr.bin/sockstat/sockstat.c Sun Feb 12 07:55:33 2012 (r231553) +++ stable/8/usr.bin/sockstat/sockstat.c Sun Feb 12 07:56:07 2012 (r231554) @@ -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-8@FreeBSD.ORG Sun Feb 12 07:59:25 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 828901065672; Sun, 12 Feb 2012 07:59:25 +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 709838FC14; Sun, 12 Feb 2012 07:59:25 +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 q1C7xPl3071843; Sun, 12 Feb 2012 07:59:25 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1C7xPhH071841; Sun, 12 Feb 2012 07:59:25 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202120759.q1C7xPhH071841@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 12 Feb 2012 07:59:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231557 - stable/8/sbin/hastd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 07:59:25 -0000 Author: trociny Date: Sun Feb 12 07:59:25 2012 New Revision: 231557 URL: http://svn.freebsd.org/changeset/base/231557 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/8/sbin/hastd/primary.c Directory Properties: stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastd/primary.c ============================================================================== --- stable/8/sbin/hastd/primary.c Sun Feb 12 07:57:58 2012 (r231556) +++ stable/8/sbin/hastd/primary.c Sun Feb 12 07:59:25 2012 (r231557) @@ -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-8@FreeBSD.ORG Sun Feb 12 14:56:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74F6F106568A; Sun, 12 Feb 2012 14:56:41 +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 6340D8FC0C; Sun, 12 Feb 2012 14:56:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1CEufUV089161; Sun, 12 Feb 2012 14:56:41 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1CEufw3089159; Sun, 12 Feb 2012 14:56:41 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202121456.q1CEufw3089159@svn.freebsd.org> From: Dimitry Andric Date: Sun, 12 Feb 2012 14:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231561 - stable/8/usr.bin/rpcgen X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 14:56:41 -0000 Author: dim Date: Sun Feb 12 14:56:40 2012 New Revision: 231561 URL: http://svn.freebsd.org/changeset/base/231561 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/8/usr.bin/rpcgen/rpc_main.c Directory Properties: stable/8/usr.bin/rpcgen/ (props changed) Modified: stable/8/usr.bin/rpcgen/rpc_main.c ============================================================================== --- stable/8/usr.bin/rpcgen/rpc_main.c Sun Feb 12 14:56:31 2012 (r231560) +++ stable/8/usr.bin/rpcgen/rpc_main.c Sun Feb 12 14:56:40 2012 (r231561) @@ -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-8@FreeBSD.ORG Sun Feb 12 23:12:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85CDA106564A; Sun, 12 Feb 2012 23:12:47 +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 707698FC08; Sun, 12 Feb 2012 23:12:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1CNClJi005137; Sun, 12 Feb 2012 23:12:47 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1CNClnX005135; Sun, 12 Feb 2012 23:12:47 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201202122312.q1CNClnX005135@svn.freebsd.org> From: Brooks Davis Date: Sun, 12 Feb 2012 23:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231567 - stable/8/lib/libc/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 23:12:47 -0000 Author: brooks Date: Sun Feb 12 23:12:47 2012 New Revision: 231567 URL: http://svn.freebsd.org/changeset/base/231567 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/8/lib/libc/net/eui64.3 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/net/eui64.3 ============================================================================== --- stable/8/lib/libc/net/eui64.3 Sun Feb 12 23:07:45 2012 (r231566) +++ stable/8/lib/libc/net/eui64.3 Sun Feb 12 23:12:47 2012 (r231567) @@ -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-8@FreeBSD.ORG Mon Feb 13 10:24:23 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69369106564A; Mon, 13 Feb 2012 10:24:23 +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 4CD9F8FC0C; Mon, 13 Feb 2012 10:24: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 q1DAONlD038122; Mon, 13 Feb 2012 10:24:23 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DAONOr038119; Mon, 13 Feb 2012 10:24:23 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201202131024.q1DAONOr038119@svn.freebsd.org> From: Tijl Coosemans Date: Mon, 13 Feb 2012 10:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231577 - stable/8/usr.bin/hexdump X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 10:24:23 -0000 Author: tijl Date: Mon Feb 13 10:24:22 2012 New Revision: 231577 URL: http://svn.freebsd.org/changeset/base/231577 Log: MFC r228636: Correct a logic error in usr.bin/hexdump/conv.c, found by clang. Whenever the conv_c() function encounters an incomplete multibyte char, it peeks ahead. It also sets p to peekbuf, to indicate it is still processing the incomplete character. However, on the next retry, it compares buf against peekbuf, which always returns false, since both buf and peekbuf are local char arrays, whose addresses are never the same. Fix this by comparing against p instead, which was the intention. Also turn peekbuf into an array of u_char, to prevent conversion warnings. 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/8/usr.bin/hexdump/conv.c stable/8/usr.bin/hexdump/parse.c Directory Properties: stable/8/usr.bin/hexdump/ (props changed) Modified: stable/8/usr.bin/hexdump/conv.c ============================================================================== --- stable/8/usr.bin/hexdump/conv.c Mon Feb 13 07:47:36 2012 (r231576) +++ stable/8/usr.bin/hexdump/conv.c Mon Feb 13 10:24:22 2012 (r231577) @@ -57,7 +57,7 @@ conv_c(PR *pr, u_char *p, size_t bufsize wchar_t wc; size_t clen, oclen; int converr, pad, width; - char peekbuf[MB_LEN_MAX]; + u_char peekbuf[MB_LEN_MAX]; if (pr->mbleft > 0) { str = "**"; @@ -107,7 +107,7 @@ retry: if (clen == 0) clen = 1; else if (clen == (size_t)-1 || (clen == (size_t)-2 && - buf == peekbuf)) { + p == peekbuf)) { memset(&pr->mbstate, 0, sizeof(pr->mbstate)); wc = *p; clen = 1; Modified: stable/8/usr.bin/hexdump/parse.c ============================================================================== --- stable/8/usr.bin/hexdump/parse.c Mon Feb 13 07:47:36 2012 (r231576) +++ stable/8/usr.bin/hexdump/parse.c Mon Feb 13 10:24:22 2012 (r231577) @@ -259,7 +259,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'; @@ -453,13 +455,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'; @@ -486,6 +489,11 @@ escape(char *p1) *p2 = *p1; break; } + } else { + *p2 = *p1; + if (*p1 == '\0') + return; + } } } From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 13 16:43:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93A721065673; Mon, 13 Feb 2012 16:43:30 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FF478FC17; Mon, 13 Feb 2012 16:43:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1DGhUaK052164; Mon, 13 Feb 2012 16:43:30 GMT (envelope-from markm@svn.freebsd.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DGhUDI052150; Mon, 13 Feb 2012 16:43:30 GMT (envelope-from markm@svn.freebsd.org) Message-Id: <201202131643.q1DGhUDI052150@svn.freebsd.org> From: Mark Murray Date: Mon, 13 Feb 2012 16:43:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231588 - in stable/8/lib: libcrypt libmd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 16:43:30 -0000 Author: markm Date: Mon Feb 13 16:43:29 2012 New Revision: 231588 URL: http://svn.freebsd.org/changeset/base/231588 Log: MFC: sha256 ($5$) and sha512 ($6$) crypt(3) types. PR: misc/124164 Delayed by: markm Added: stable/8/lib/libcrypt/crypt-sha256.c - copied, changed from r220497, head/lib/libcrypt/crypt-sha256.c stable/8/lib/libcrypt/crypt-sha512.c - copied, changed from r220497, head/lib/libcrypt/crypt-sha512.c stable/8/lib/libmd/sha512.3 - copied unchanged from r220496, head/lib/libmd/sha512.3 stable/8/lib/libmd/sha512.h - copied unchanged from r220496, head/lib/libmd/sha512.h stable/8/lib/libmd/sha512c.c - copied unchanged from r220496, head/lib/libmd/sha512c.c Modified: stable/8/lib/libcrypt/Makefile stable/8/lib/libcrypt/crypt.c stable/8/lib/libcrypt/crypt.h stable/8/lib/libcrypt/misc.c stable/8/lib/libmd/Makefile stable/8/lib/libmd/mddriver.c stable/8/lib/libmd/rmddriver.c stable/8/lib/libmd/shadriver.c Directory Properties: stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/libcrypt/ (props changed) stable/8/lib/libmd/ (props changed) Modified: stable/8/lib/libcrypt/Makefile ============================================================================== --- stable/8/lib/libcrypt/Makefile Mon Feb 13 15:21:12 2012 (r231587) +++ stable/8/lib/libcrypt/Makefile Mon Feb 13 16:43:29 2012 (r231588) @@ -12,7 +12,9 @@ LIB= crypt .PATH: ${.CURDIR}/../libmd SRCS= crypt.c misc.c \ crypt-md5.c md5c.c \ - crypt-nthash.c md4c.c + crypt-nthash.c md4c.c \ + crypt-sha256.c sha256c.c \ + crypt-sha512.c sha512c.c MAN= crypt.3 MLINKS= crypt.3 crypt_get_format.3 crypt.3 crypt_set_format.3 CFLAGS+= -I${.CURDIR}/../libmd -I${.CURDIR}/../libutil @@ -29,7 +31,9 @@ CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BL SRCS+= auth.c property.c .for sym in auth_getval property_find properties_read properties_free \ MD4Init MD4Final MD4Update MD4Pad \ - MD5Init MD5Final MD5Update MD5Pad + MD5Init MD5Final MD5Update MD5Pad \ + SHA256_Init SHA256_Final SHA256_Update \ + SHA512_Init SHA512_Final SHA512_Update CFLAGS+= -D${sym}=__${sym} .endfor Copied and modified: stable/8/lib/libcrypt/crypt-sha256.c (from r220497, head/lib/libcrypt/crypt-sha256.c) ============================================================================== --- head/lib/libcrypt/crypt-sha256.c Sat Apr 9 14:02:04 2011 (r220497, copy source) +++ stable/8/lib/libcrypt/crypt-sha256.c Mon Feb 13 16:43:29 2012 (r231588) @@ -60,7 +60,7 @@ static const char sha256_rounds_prefix[] #define ROUNDS_MAX 999999999 static char * -sha256_crypt_r(const char *key, const char *salt, char *buffer, int buflen) +crypt_sha256_r(const char *key, const char *salt, char *buffer, int buflen) { u_long srounds; int n; @@ -268,12 +268,12 @@ sha256_crypt_r(const char *key, const ch /* This entry point is equivalent to crypt(3). */ char * -sha256_crypt(const char *key, const char *salt) +crypt_sha256(const char *key, const char *salt) { /* We don't want to have an arbitrary limit in the size of the * password. We can compute an upper bound for the size of the * result in advance and so we can prepare the buffer we pass to - * `sha256_crypt_r'. */ + * `crypt_sha256_r'. */ static char *buffer; static int buflen; int needed; @@ -293,7 +293,7 @@ sha256_crypt(const char *key, const char buflen = needed; } - return sha256_crypt_r(key, salt, buffer, buflen); + return crypt_sha256_r(key, salt, buffer, buflen); } #ifdef TEST @@ -459,7 +459,7 @@ main(void) } for (cnt = 0; cnt < ntests2; ++cnt) { - char *cp = sha256_crypt(tests2[cnt].input, tests2[cnt].salt); + char *cp = crypt_sha256(tests2[cnt].input, tests2[cnt].salt); if (strcmp(cp, tests2[cnt].expected) != 0) { printf("test %d: expected \"%s\", got \"%s\"\n", Copied and modified: stable/8/lib/libcrypt/crypt-sha512.c (from r220497, head/lib/libcrypt/crypt-sha512.c) ============================================================================== --- head/lib/libcrypt/crypt-sha512.c Sat Apr 9 14:02:04 2011 (r220497, copy source) +++ stable/8/lib/libcrypt/crypt-sha512.c Mon Feb 13 16:43:29 2012 (r231588) @@ -60,7 +60,7 @@ static const char sha512_rounds_prefix[] #define ROUNDS_MAX 999999999 static char * -sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) +crypt_sha512_r(const char *key, const char *salt, char *buffer, int buflen) { u_long srounds; int n; @@ -280,12 +280,12 @@ sha512_crypt_r(const char *key, const ch /* This entry point is equivalent to crypt(3). */ char * -sha512_crypt(const char *key, const char *salt) +crypt_sha512(const char *key, const char *salt) { /* We don't want to have an arbitrary limit in the size of the * password. We can compute an upper bound for the size of the * result in advance and so we can prepare the buffer we pass to - * `sha512_crypt_r'. */ + * `crypt_sha512_r'. */ static char *buffer; static int buflen; int needed; @@ -305,7 +305,7 @@ sha512_crypt(const char *key, const char buflen = needed; } - return sha512_crypt_r(key, salt, buffer, buflen); + return crypt_sha512_r(key, salt, buffer, buflen); } #ifdef TEST @@ -482,7 +482,7 @@ main(void) } for (cnt = 0; cnt < ntests2; ++cnt) { - char *cp = sha512_crypt(tests2[cnt].input, tests2[cnt].salt); + char *cp = crypt_sha512(tests2[cnt].input, tests2[cnt].salt); if (strcmp(cp, tests2[cnt].expected) != 0) { printf("test %d: expected \"%s\", got \"%s\"\n", Modified: stable/8/lib/libcrypt/crypt.c ============================================================================== --- stable/8/lib/libcrypt/crypt.c Mon Feb 13 15:21:12 2012 (r231587) +++ stable/8/lib/libcrypt/crypt.c Mon Feb 13 16:43:29 2012 (r231588) @@ -63,6 +63,16 @@ static const struct { "$3$" }, { + "sha256", + crypt_sha256, + "$5$" + }, + { + "sha512", + crypt_sha512, + "$6$" + }, + { NULL, NULL, NULL Modified: stable/8/lib/libcrypt/crypt.h ============================================================================== --- stable/8/lib/libcrypt/crypt.h Mon Feb 13 15:21:12 2012 (r231587) +++ stable/8/lib/libcrypt/crypt.h Mon Feb 13 16:43:29 2012 (r231588) @@ -36,5 +36,8 @@ char *crypt_des(const char *pw, const ch char *crypt_md5(const char *pw, const char *salt); char *crypt_nthash(const char *pw, const char *salt); char *crypt_blowfish(const char *pw, const char *salt); +char *crypt_sha256 (const char *pw, const char *salt); +char *crypt_sha512 (const char *pw, const char *salt); extern void _crypt_to64(char *s, u_long v, int n); +extern void b64_from_24bit(uint8_t B2, uint8_t B1, uint8_t B0, int n, int *buflen, char **cp); Modified: stable/8/lib/libcrypt/misc.c ============================================================================== --- stable/8/lib/libcrypt/misc.c Mon Feb 13 15:21:12 2012 (r231587) +++ stable/8/lib/libcrypt/misc.c Mon Feb 13 16:43:29 2012 (r231588) @@ -45,3 +45,19 @@ _crypt_to64(char *s, u_long v, int n) v >>= 6; } } + +void +b64_from_24bit(uint8_t B2, uint8_t B1, uint8_t B0, int n, int *buflen, char **cp) +{ + uint32_t w; + int i; + + w = (B2 << 16) | (B1 << 8) | B0; + for (i = 0; i < n; i++) { + **cp = itoa64[w&0x3f]; + (*cp)++; + if ((*buflen)-- < 0) + break; + w >>= 6; + } +} Modified: stable/8/lib/libmd/Makefile ============================================================================== --- stable/8/lib/libmd/Makefile Mon Feb 13 15:21:12 2012 (r231587) +++ stable/8/lib/libmd/Makefile Mon Feb 13 16:43:29 2012 (r231588) @@ -5,10 +5,11 @@ SHLIBDIR?= /lib SRCS= md2c.c md4c.c md5c.c md2hl.c md4hl.c md5hl.c \ rmd160c.c rmd160hl.c \ sha0c.c sha0hl.c sha1c.c sha1hl.c \ - sha256c.c sha256hl.c -INCS= md2.h md4.h md5.h ripemd.h sha.h sha256.h + sha256c.c sha256hl.c \ + sha512c.c sha512hl.c +INCS= md2.h md4.h md5.h ripemd.h sha.h sha256.h sha512.h -MAN+= md2.3 md4.3 md5.3 ripemd.3 sha.3 sha256.3 +MAN+= md2.3 md4.3 md5.3 ripemd.3 sha.3 sha256.3 sha512.3 MLINKS+=md2.3 MD2Init.3 md2.3 MD2Update.3 md2.3 MD2Final.3 MLINKS+=md2.3 MD2End.3 md2.3 MD2File.3 md2.3 MD2FileChunk.3 MLINKS+=md2.3 MD2Data.3 @@ -32,10 +33,15 @@ MLINKS+=sha256.3 SHA256_Init.3 sha256.3 MLINKS+=sha256.3 SHA256_Final.3 sha256.3 SHA256_End.3 MLINKS+=sha256.3 SHA256_File.3 sha256.3 SHA256_FileChunk.3 MLINKS+=sha256.3 SHA256_Data.3 +MLINKS+=sha512.3 SHA512_Init.3 sha512.3 SHA512_Update.3 +MLINKS+=sha512.3 SHA512_Final.3 sha512.3 SHA512_End.3 +MLINKS+=sha512.3 SHA512_File.3 sha512.3 SHA512_FileChunk.3 +MLINKS+=sha512.3 SHA512_Data.3 CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \ rmd160.ref rmd160hl.c rmddriver \ sha0.ref sha0hl.c sha1.ref sha1hl.c shadriver \ - sha256.ref sha256hl.c + sha256.ref sha256hl.c sha512.ref sha512hl.c + CFLAGS+= -I${.CURDIR} .PATH: ${.CURDIR}/${MACHINE_ARCH} @@ -76,6 +82,12 @@ sha256hl.c: mdXhl.c -e 's/SHA256__/SHA256_/g' \ ${.ALLSRC}) > ${.TARGET} +sha512hl.c: mdXhl.c + (echo '#define LENGTH 64'; \ + sed -e 's/mdX/sha512/g' -e 's/MDX/SHA512_/g' \ + -e 's/SHA512__/SHA512_/g' \ + ${.ALLSRC}) > ${.TARGET} + rmd160hl.c: mdXhl.c (echo '#define LENGTH 20'; \ sed -e 's/mdX/ripemd/g' -e 's/MDX/RIPEMD160_/g' \ @@ -105,8 +117,10 @@ md4.ref: @echo 'MD4 ("abc") = a448017aaf21d8525fc10ae87aa6729d' >> ${.TARGET} @echo 'MD4 ("message digest") = d9130a8164549fe818874806e1c7014b' >> ${.TARGET} @echo 'MD4 ("abcdefghijklmnopqrstuvwxyz") = d79e1c308aa5bbcdeea8ed63df412da9' >> ${.TARGET} - @echo 'MD4 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 043f8582f241db351ce627e153e7f0e4' >> ${.TARGET} - @echo 'MD4 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = e33b4ddc9c38f2199c3e7b164fcc0536' >> ${.TARGET} + @echo 'MD4 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '043f8582f241db351ce627e153e7f0e4' >> ${.TARGET} + @echo 'MD4 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + 'e33b4ddc9c38f2199c3e7b164fcc0536' >> ${.TARGET} md5.ref: echo 'MD5 test suite:' > ${.TARGET} @@ -119,54 +133,74 @@ md5.ref: @echo 'MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 57edf4a22be3c955ac49da2e2107b67a' >> ${.TARGET} sha0.ref: - (echo 'SHA-0 test suite:'; \ - echo 'SHA-0 ("") = f96cea198ad1dd5617ac084a3d92c6107708c0ef'; \ - echo 'SHA-0 ("abc") = 0164b8a914cd2a5e74c4f7ff082c4d97f1edf880'; \ - echo 'SHA-0 ("message digest") =' \ - 'c1b0f222d150ebb9aa36a40cafdc8bcbed830b14'; \ - echo 'SHA-0 ("abcdefghijklmnopqrstuvwxyz") =' \ - 'b40ce07a430cfd3c033039b9fe9afec95dc1bdcd'; \ - echo 'SHA-0 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ - '79e966f7a3a990df33e40e3d7f8f18d2caebadfa'; \ - echo 'SHA-0 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ - '4aa29d14d171522ece47bee8957e35a41f3e9cff' ) > ${.TARGET} + echo 'SHA-0 test suite:' > ${.TARGET} + @echo 'SHA-0 ("") = f96cea198ad1dd5617ac084a3d92c6107708c0ef' >> ${.TARGET} + @echo 'SHA-0 ("abc") = 0164b8a914cd2a5e74c4f7ff082c4d97f1edf880' >> ${.TARGET} + @echo 'SHA-0 ("message digest") =' \ + 'c1b0f222d150ebb9aa36a40cafdc8bcbed830b14' >> ${.TARGET} + @echo 'SHA-0 ("abcdefghijklmnopqrstuvwxyz") =' \ + 'b40ce07a430cfd3c033039b9fe9afec95dc1bdcd' >> ${.TARGET} + @echo 'SHA-0 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '79e966f7a3a990df33e40e3d7f8f18d2caebadfa' >> ${.TARGET} + @echo 'SHA-0 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + '4aa29d14d171522ece47bee8957e35a41f3e9cff' >> ${.TARGET} sha1.ref: - (echo 'SHA-1 test suite:'; \ - echo 'SHA-1 ("") = da39a3ee5e6b4b0d3255bfef95601890afd80709'; \ - echo 'SHA-1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d'; \ - echo 'SHA-1 ("message digest") =' \ - 'c12252ceda8be8994d5fa0290a47231c1d16aae3'; \ - echo 'SHA-1 ("abcdefghijklmnopqrstuvwxyz") =' \ - '32d10c7b8cf96570ca04ce37f2a19d84240d3a89'; \ - echo 'SHA-1 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ - '761c457bf73b14d27e9e9265c46f4b4dda11f940'; \ - echo 'SHA-1 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ - '50abf5706a150990a08b2c5ea40fa0e585554732' ) > ${.TARGET} + echo 'SHA-1 test suite:' > ${.TARGET} + @echo 'SHA-1 ("") = da39a3ee5e6b4b0d3255bfef95601890afd80709' >> ${.TARGET} + @echo 'SHA-1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d' >> ${.TARGET} + @echo 'SHA-1 ("message digest") =' \ + 'c12252ceda8be8994d5fa0290a47231c1d16aae3' >> ${.TARGET} + @echo 'SHA-1 ("abcdefghijklmnopqrstuvwxyz") =' \ + '32d10c7b8cf96570ca04ce37f2a19d84240d3a89' >> ${.TARGET} + @echo 'SHA-1 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '761c457bf73b14d27e9e9265c46f4b4dda11f940' >> ${.TARGET} + @echo 'SHA-1 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + '50abf5706a150990a08b2c5ea40fa0e585554732' >> ${.TARGET} sha256.ref: echo 'SHA-256 test suite:' > ${.TARGET} @echo 'SHA-256 ("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' >> ${.TARGET} - @echo 'SHA-256 ("abc") = ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' >> ${.TARGET} - @echo 'SHA-256 ("message digest") = f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650' >> ${.TARGET} - @echo 'SHA-256 ("abcdefghijklmnopqrstuvwxyz") = 71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73' >> ${.TARGET} - @echo 'SHA-256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0' >> ${.TARGET} - @echo 'SHA-256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e' >> ${.TARGET} + @echo 'SHA-256 ("abc") =' \ + 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' >> ${.TARGET} + @echo 'SHA-256 ("message digest") =' \ + 'f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650' >> ${.TARGET} + @echo 'SHA-256 ("abcdefghijklmnopqrstuvwxyz") =' \ + '71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73' >> ${.TARGET} + @echo 'SHA-256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + 'db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0' >> ${.TARGET} + @echo 'SHA-256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + 'f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e' >> ${.TARGET} + +sha512.ref: + echo 'SHA-512 test suite:' > ${.TARGET} + @echo 'SHA-512 ("") =' \ + 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e' >> ${.TARGET} + @echo 'SHA-512 ("abc") =' \ + 'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f' >> ${.TARGET} + @echo 'SHA-512 ("message digest") =' \ + '107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c' >> ${.TARGET} + @echo 'SHA-512 ("abcdefghijklmnopqrstuvwxyz") =' \ + '4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1' >> ${.TARGET} + @echo 'SHA-512 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894' >> ${.TARGET} + @echo 'SHA-512 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + '72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843' >> ${.TARGET} rmd160.ref: - (echo 'RIPEMD160 test suite:'; \ - echo 'RIPEMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31'; \ - echo 'RIPEMD160 ("abc") = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc'; \ - echo 'RIPEMD160 ("message digest") =' \ - '5d0689ef49d2fae572b881b123a85ffa21595f36'; \ - echo 'RIPEMD160 ("abcdefghijklmnopqrstuvwxyz") =' \ - 'f71c27109c692c1b56bbdceb5b9d2865b3708dbc'; \ - echo 'RIPEMD160 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ - 'b0e20b6e3116640286ed3a87a5713079b21f5189'; \ - echo 'RIPEMD160 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ - '9b752e45573d4b39f4dbd3323cab82bf63326bfb' ) > ${.TARGET} + echo 'RIPEMD160 test suite:' > ${.TARGET} + @echo 'RIPEMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31' >> ${.TARGET} + @echo 'RIPEMD160 ("abc") = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc' >> ${.TARGET} + @echo 'RIPEMD160 ("message digest") =' \ + '5d0689ef49d2fae572b881b123a85ffa21595f36' >> ${.TARGET} + @echo 'RIPEMD160 ("abcdefghijklmnopqrstuvwxyz") =' \ + 'f71c27109c692c1b56bbdceb5b9d2865b3708dbc' >> ${.TARGET} + @echo 'RIPEMD160 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + 'b0e20b6e3116640286ed3a87a5713079b21f5189' >> ${.TARGET} + @echo 'RIPEMD160 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + '9b752e45573d4b39f4dbd3323cab82bf63326bfb' >> ${.TARGET} -test: md2.ref md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref +test: md2.ref md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha512.ref @${ECHO} if any of these test fail, the code produces wrong results @${ECHO} and should NOT be used. ${CC} ${CFLAGS} ${LDFLAGS} -DMD=2 -o mddriver ${.CURDIR}/mddriver.c ./libmd.a @@ -192,6 +226,9 @@ test: md2.ref md4.ref md5.ref sha0.ref r ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=256 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha256.ref - @${ECHO} SHA-256 passed test + ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=512 -o shadriver ${.CURDIR}/shadriver.c libmd.a + ./shadriver | cmp sha512.ref - + @${ECHO} SHA-512 passed test -rm -f shadriver .include Modified: stable/8/lib/libmd/mddriver.c ============================================================================== --- stable/8/lib/libmd/mddriver.c Mon Feb 13 15:21:12 2012 (r231587) +++ stable/8/lib/libmd/mddriver.c Mon Feb 13 16:43:29 2012 (r231588) @@ -1,33 +1,31 @@ -/* MDDRIVER.C - test driver for MD2, MD4 and MD5 - */ +/* MDDRIVER.C - test driver for MD2, MD4 and MD5 */ + +/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All rights + * reserved. + * + * RSA Data Security, Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for + * any particular purpose. It is provided "as is" without express or implied + * warranty of any kind. + * + * These notices must be retained in any copies of any part of this + * documentation and/or software. */ #include __FBSDID("$FreeBSD$"); -/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All - rights reserved. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -/* The following makes MD default to MD5 if it has not already been - defined with C compiler flags. - */ -#ifndef MD -#define MD 5 -#endif - #include #include #include #include + +/* The following makes MD default to MD5 if it has not already been defined + * with C compiler flags. */ +#ifndef MD +#define MD 5 +#endif + #if MD == 2 #include "md2.h" #define MDData MD2Data @@ -41,32 +39,31 @@ __FBSDID("$FreeBSD$"); #define MDData MD5Data #endif -/* Digests a string and prints the result. - */ -static void MDString (string) -char *string; +/* Digests a string and prints the result. */ +static void +MDString(char *string) { - char buf[33]; + char buf[33]; - printf ("MD%d (\"%s\") = %s\n", - MD, string, MDData(string,strlen(string),buf)); + printf("MD%d (\"%s\") = %s\n", + MD, string, MDData(string, strlen(string), buf)); } -/* Digests a reference suite of strings and prints the results. - */ -main() +/* Digests a reference suite of strings and prints the results. */ +int +main(void) { - printf ("MD%d test suite:\n", MD); + printf("MD%d test suite:\n", MD); + + MDString(""); + MDString("a"); + MDString("abc"); + MDString("message digest"); + MDString("abcdefghijklmnopqrstuvwxyz"); + MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz0123456789"); + MDString("1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890"); - MDString (""); - MDString ("a"); - MDString ("abc"); - MDString ("message digest"); - MDString ("abcdefghijklmnopqrstuvwxyz"); - MDString - ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); - MDString - ("1234567890123456789012345678901234567890\ -1234567890123456789012345678901234567890"); - return 0; + return 0; } Modified: stable/8/lib/libmd/rmddriver.c ============================================================================== --- stable/8/lib/libmd/rmddriver.c Mon Feb 13 15:21:12 2012 (r231587) +++ stable/8/lib/libmd/rmddriver.c Mon Feb 13 16:43:29 2012 (r231588) @@ -1,53 +1,51 @@ -/* RIPEMD160DRIVER.C - test driver for RIPEMD160 - */ +/* RIPEMD160DRIVER.C - test driver for RIPEMD160 */ + +/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All rights + * reserved. + * + * RSA Data Security, Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for + * any particular purpose. It is provided "as is" without express or implied + * warranty of any kind. + * + * These notices must be retained in any copies of any part of this + * documentation and/or software. */ #include __FBSDID("$FreeBSD$"); -/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All - rights reserved. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - #include #include #include #include + #include "ripemd.h" -/* Digests a string and prints the result. - */ -static void RIPEMD160String (string) -char *string; +/* Digests a string and prints the result. */ +static void +RIPEMD160String(char *string) { - char buf[2*20+1]; + char buf[2*20 + 1]; - printf ("RIPEMD160 (\"%s\") = %s\n", - string, RIPEMD160_Data(string,strlen(string),buf)); + printf("RIPEMD160 (\"%s\") = %s\n", + string, RIPEMD160_Data(string, strlen(string), buf)); } -/* Digests a reference suite of strings and prints the results. - */ -main() +/* Digests a reference suite of strings and prints the results. */ +int +main(void) { - printf ("RIPEMD160 test suite:\n"); + printf("RIPEMD160 test suite:\n"); + + RIPEMD160String(""); + RIPEMD160String("abc"); + RIPEMD160String("message digest"); + RIPEMD160String("abcdefghijklmnopqrstuvwxyz"); + RIPEMD160String("ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz0123456789"); + RIPEMD160String("1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890"); - RIPEMD160String (""); - RIPEMD160String ("abc"); - RIPEMD160String ("message digest"); - RIPEMD160String ("abcdefghijklmnopqrstuvwxyz"); - RIPEMD160String - ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); - RIPEMD160String - ("1234567890123456789012345678901234567890\ -1234567890123456789012345678901234567890"); - return 0; + return 0; } Copied: stable/8/lib/libmd/sha512.3 (from r220496, head/lib/libmd/sha512.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libmd/sha512.3 Mon Feb 13 16:43:29 2012 (r231588, copy of r220496, head/lib/libmd/sha512.3) @@ -0,0 +1,139 @@ +.\" +.\" ---------------------------------------------------------------------------- +.\" "THE BEER-WARE LICENSE" (Revision 42): +.\" wrote this file. As long as you retain this notice you +.\" can do whatever you want with this stuff. If we meet some day, and you think +.\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp +.\" ---------------------------------------------------------------------------- +.\" +.\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp +.\" $FreeBSD$ +.\" +.Dd April 1, 2011 +.Dt SHA512 3 +.Os +.Sh NAME +.Nm SHA512_Init , +.Nm SHA512_Update , +.Nm SHA512_Final , +.Nm SHA512_End , +.Nm SHA512_File , +.Nm SHA512_FileChunk , +.Nm SHA512_Data +.Nd calculate the FIPS 180-2 ``SHA-512'' message digest +.Sh LIBRARY +.Lb libmd +.Sh SYNOPSIS +.In sys/types.h +.In sha512.h +.Ft void +.Fn SHA512_Init "SHA512_CTX *context" +.Ft void +.Fn SHA512_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len" +.Ft void +.Fn SHA512_Final "unsigned char digest[64]" "SHA512_CTX *context" +.Ft "char *" +.Fn SHA512_End "SHA512_CTX *context" "char *buf" +.Ft "char *" +.Fn SHA512_File "const char *filename" "char *buf" +.Ft "char *" +.Fn SHA512_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" +.Ft "char *" +.Fn SHA512_Data "const unsigned char *data" "unsigned int len" "char *buf" +.Sh DESCRIPTION +The +.Li SHA512_ +functions calculate a 512-bit cryptographic checksum (digest) +for any number of input bytes. +A cryptographic checksum is a one-way +hash function; that is, it is computationally impractical to find +the input corresponding to a particular output. +This net result is +a +.Dq fingerprint +of the input-data, which does not disclose the actual input. +.Pp +The +.Fn SHA512_Init , +.Fn SHA512_Update , +and +.Fn SHA512_Final +functions are the core functions. +Allocate an +.Vt SHA512_CTX , +initialize it with +.Fn SHA512_Init , +run over the data with +.Fn SHA512_Update , +and finally extract the result using +.Fn SHA512_Final . +.Pp +.Fn SHA512_End +is a wrapper for +.Fn SHA512_Final +which converts the return value to a 65-character +(including the terminating '\e0') +.Tn ASCII +string which represents the 512 bits in hexadecimal. +.Pp +.Fn SHA512_File +calculates the digest of a file, and uses +.Fn SHA512_End +to return the result. +If the file cannot be opened, a null pointer is returned. +.Fn SHA512_FileChunk +is similar to +.Fn SHA512_File , +but it only calculates the digest over a byte-range of the file specified, +starting at +.Fa offset +and spanning +.Fa length +bytes. +If the +.Fa length +parameter is specified as 0, or more than the length of the remaining part +of the file, +.Fn SHA512_FileChunk +calculates the digest from +.Fa offset +to the end of file. +.Fn SHA512_Data +calculates the digest of a chunk of data in memory, and uses +.Fn SHA512_End +to return the result. +.Pp +When using +.Fn SHA512_End , +.Fn SHA512_File , +or +.Fn SHA512_Data , +the +.Fa buf +argument can be a null pointer, in which case the returned string +is allocated with +.Xr malloc 3 +and subsequently must be explicitly deallocated using +.Xr free 3 +after use. +If the +.Fa buf +argument is non-null it must point to at least 65 characters of buffer space. +.Sh SEE ALSO +.Xr md2 3 , +.Xr md4 3 , +.Xr md5 3 , +.Xr ripemd 3 , +.Xr sha 3 +.Sh HISTORY +These functions appeared in +.Fx 4.0 . +.Sh AUTHORS +The core hash routines were implemented by Colin Percival based on +the published +.Tn FIPS 180-2 +standard. +.Sh BUGS +No method is known to exist which finds two files having the same hash value, +nor to find a file with a specific hash value. +There is on the other hand no guarantee that such a method does not exist. Copied: stable/8/lib/libmd/sha512.h (from r220496, head/lib/libmd/sha512.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libmd/sha512.h Mon Feb 13 16:43:29 2012 (r231588, copy of r220496, head/lib/libmd/sha512.h) @@ -0,0 +1,50 @@ +/*- + * Copyright 2005 Colin Percival + * 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$ + */ + +#ifndef _SHA512_H_ +#define _SHA512_H_ + +#include + +typedef struct SHA512Context { + uint64_t state[8]; + uint64_t count[2]; + unsigned char buf[128]; +} SHA512_CTX; + +__BEGIN_DECLS +void SHA512_Init(SHA512_CTX *); +void SHA512_Update(SHA512_CTX *, const void *, size_t); +void SHA512_Final(unsigned char [64], SHA512_CTX *); +char *SHA512_End(SHA512_CTX *, char *); +char *SHA512_File(const char *, char *); +char *SHA512_FileChunk(const char *, char *, off_t, off_t); +char *SHA512_Data(const void *, unsigned int, char *); +__END_DECLS + +#endif /* !_SHA512_H_ */ Copied: stable/8/lib/libmd/sha512c.c (from r220496, head/lib/libmd/sha512c.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libmd/sha512c.c Mon Feb 13 16:43:29 2012 (r231588, copy of r220496, head/lib/libmd/sha512c.c) @@ -0,0 +1,320 @@ +/*- + * Copyright 2005 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +#include "sha512.h" + +#if BYTE_ORDER == BIG_ENDIAN + +/* Copy a vector of big-endian uint64_t into a vector of bytes */ +#define be64enc_vect(dst, src, len) \ + memcpy((void *)dst, (const void *)src, (size_t)len) + +/* Copy a vector of bytes into a vector of big-endian uint64_t */ +#define be64dec_vect(dst, src, len) \ + memcpy((void *)dst, (const void *)src, (size_t)len) + +#else /* BYTE_ORDER != BIG_ENDIAN */ + +/* + * Encode a length len/4 vector of (uint64_t) into a length len vector of + * (unsigned char) in big-endian form. Assumes len is a multiple of 8. + */ +static void +be64enc_vect(unsigned char *dst, const uint64_t *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 8; i++) + be64enc(dst + i * 8, src[i]); +} + +/* + * Decode a big-endian length len vector of (unsigned char) into a length + * len/4 vector of (uint64_t). Assumes len is a multiple of 8. + */ +static void +be64dec_vect(uint64_t *dst, const unsigned char *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 8; i++) + dst[i] = be64dec(src + i * 8); +} + +#endif /* BYTE_ORDER != BIG_ENDIAN */ + +/* Elementary functions used by SHA512 */ +#define Ch(x, y, z) ((x & (y ^ z)) ^ z) +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define SHR(x, n) (x >> n) +#define ROTR(x, n) ((x >> n) | (x << (64 - n))) +#define S0(x) (ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39)) +#define S1(x) (ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41)) +#define s0(x) (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7)) +#define s1(x) (ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6)) + +/* SHA512 round function */ +#define RND(a, b, c, d, e, f, g, h, k) \ + t0 = h + S1(e) + Ch(e, f, g) + k; \ + t1 = S0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; + +/* Adjusted round function for rotating state */ +#define RNDr(S, W, i, k) \ + RND(S[(80 - i) % 8], S[(81 - i) % 8], \ + S[(82 - i) % 8], S[(83 - i) % 8], \ + S[(84 - i) % 8], S[(85 - i) % 8], \ + S[(86 - i) % 8], S[(87 - i) % 8], \ + W[i] + k) + +/* + * SHA512 block compression function. The 512-bit state is transformed via + * the 512-bit input block to produce a new state. + */ +static void +SHA512_Transform(uint64_t * state, const unsigned char block[128]) +{ + uint64_t W[80]; + uint64_t S[8]; + uint64_t t0, t1; + int i; + + /* 1. Prepare message schedule W. */ + be64dec_vect(W, block, 128); + for (i = 16; i < 80; i++) + W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; + + /* 2. Initialize working variables. */ + memcpy(S, state, 64); + + /* 3. Mix. */ + RNDr(S, W, 0, 0x428a2f98d728ae22ULL); + RNDr(S, W, 1, 0x7137449123ef65cdULL); + RNDr(S, W, 2, 0xb5c0fbcfec4d3b2fULL); + RNDr(S, W, 3, 0xe9b5dba58189dbbcULL); + RNDr(S, W, 4, 0x3956c25bf348b538ULL); + RNDr(S, W, 5, 0x59f111f1b605d019ULL); + RNDr(S, W, 6, 0x923f82a4af194f9bULL); + RNDr(S, W, 7, 0xab1c5ed5da6d8118ULL); + RNDr(S, W, 8, 0xd807aa98a3030242ULL); + RNDr(S, W, 9, 0x12835b0145706fbeULL); + RNDr(S, W, 10, 0x243185be4ee4b28cULL); + RNDr(S, W, 11, 0x550c7dc3d5ffb4e2ULL); + RNDr(S, W, 12, 0x72be5d74f27b896fULL); + RNDr(S, W, 13, 0x80deb1fe3b1696b1ULL); + RNDr(S, W, 14, 0x9bdc06a725c71235ULL); + RNDr(S, W, 15, 0xc19bf174cf692694ULL); + RNDr(S, W, 16, 0xe49b69c19ef14ad2ULL); + RNDr(S, W, 17, 0xefbe4786384f25e3ULL); + RNDr(S, W, 18, 0x0fc19dc68b8cd5b5ULL); + RNDr(S, W, 19, 0x240ca1cc77ac9c65ULL); + RNDr(S, W, 20, 0x2de92c6f592b0275ULL); + RNDr(S, W, 21, 0x4a7484aa6ea6e483ULL); + RNDr(S, W, 22, 0x5cb0a9dcbd41fbd4ULL); + RNDr(S, W, 23, 0x76f988da831153b5ULL); + RNDr(S, W, 24, 0x983e5152ee66dfabULL); + RNDr(S, W, 25, 0xa831c66d2db43210ULL); + RNDr(S, W, 26, 0xb00327c898fb213fULL); + RNDr(S, W, 27, 0xbf597fc7beef0ee4ULL); + RNDr(S, W, 28, 0xc6e00bf33da88fc2ULL); + RNDr(S, W, 29, 0xd5a79147930aa725ULL); + RNDr(S, W, 30, 0x06ca6351e003826fULL); + RNDr(S, W, 31, 0x142929670a0e6e70ULL); + RNDr(S, W, 32, 0x27b70a8546d22ffcULL); + RNDr(S, W, 33, 0x2e1b21385c26c926ULL); + RNDr(S, W, 34, 0x4d2c6dfc5ac42aedULL); + RNDr(S, W, 35, 0x53380d139d95b3dfULL); + RNDr(S, W, 36, 0x650a73548baf63deULL); + RNDr(S, W, 37, 0x766a0abb3c77b2a8ULL); + RNDr(S, W, 38, 0x81c2c92e47edaee6ULL); + RNDr(S, W, 39, 0x92722c851482353bULL); + RNDr(S, W, 40, 0xa2bfe8a14cf10364ULL); + RNDr(S, W, 41, 0xa81a664bbc423001ULL); + RNDr(S, W, 42, 0xc24b8b70d0f89791ULL); + RNDr(S, W, 43, 0xc76c51a30654be30ULL); + RNDr(S, W, 44, 0xd192e819d6ef5218ULL); + RNDr(S, W, 45, 0xd69906245565a910ULL); + RNDr(S, W, 46, 0xf40e35855771202aULL); + RNDr(S, W, 47, 0x106aa07032bbd1b8ULL); + RNDr(S, W, 48, 0x19a4c116b8d2d0c8ULL); + RNDr(S, W, 49, 0x1e376c085141ab53ULL); + RNDr(S, W, 50, 0x2748774cdf8eeb99ULL); + RNDr(S, W, 51, 0x34b0bcb5e19b48a8ULL); + RNDr(S, W, 52, 0x391c0cb3c5c95a63ULL); + RNDr(S, W, 53, 0x4ed8aa4ae3418acbULL); + RNDr(S, W, 54, 0x5b9cca4f7763e373ULL); + RNDr(S, W, 55, 0x682e6ff3d6b2b8a3ULL); + RNDr(S, W, 56, 0x748f82ee5defb2fcULL); + RNDr(S, W, 57, 0x78a5636f43172f60ULL); + RNDr(S, W, 58, 0x84c87814a1f0ab72ULL); + RNDr(S, W, 59, 0x8cc702081a6439ecULL); + RNDr(S, W, 60, 0x90befffa23631e28ULL); + RNDr(S, W, 61, 0xa4506cebde82bde9ULL); + RNDr(S, W, 62, 0xbef9a3f7b2c67915ULL); + RNDr(S, W, 63, 0xc67178f2e372532bULL); + RNDr(S, W, 64, 0xca273eceea26619cULL); + RNDr(S, W, 65, 0xd186b8c721c0c207ULL); + RNDr(S, W, 66, 0xeada7dd6cde0eb1eULL); + RNDr(S, W, 67, 0xf57d4f7fee6ed178ULL); + RNDr(S, W, 68, 0x06f067aa72176fbaULL); + RNDr(S, W, 69, 0x0a637dc5a2c898a6ULL); + RNDr(S, W, 70, 0x113f9804bef90daeULL); + RNDr(S, W, 71, 0x1b710b35131c471bULL); + RNDr(S, W, 72, 0x28db77f523047d84ULL); + RNDr(S, W, 73, 0x32caab7b40c72493ULL); + RNDr(S, W, 74, 0x3c9ebe0a15c9bebcULL); + RNDr(S, W, 75, 0x431d67c49c100d4cULL); + RNDr(S, W, 76, 0x4cc5d4becb3e42b6ULL); + RNDr(S, W, 77, 0x597f299cfc657e2aULL); + RNDr(S, W, 78, 0x5fcb6fab3ad6faecULL); + RNDr(S, W, 79, 0x6c44198c4a475817ULL); + + /* 4. Mix local working variables into global state */ + for (i = 0; i < 8; i++) + state[i] += S[i]; +} + +static unsigned char PAD[128] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* Add padding and terminating bit-count. */ +static void +SHA512_Pad(SHA512_CTX * ctx) +{ + unsigned char len[16]; + uint64_t r, plen; + + /* + * Convert length to a vector of bytes -- we do this now rather + * than later because the length will change after we pad. + */ + be64enc_vect(len, ctx->count, 16); + + /* Add 1--128 bytes so that the resulting length is 112 mod 128 */ + r = (ctx->count[1] >> 3) & 0x7f; + plen = (r < 112) ? (112 - r) : (240 - r); + SHA512_Update(ctx, PAD, (size_t)plen); + + /* Add the terminating bit-count */ + SHA512_Update(ctx, len, 16); +} + +/* SHA-512 initialization. Begins a SHA-512 operation. */ +void +SHA512_Init(SHA512_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0x6a09e667f3bcc908ULL; + ctx->state[1] = 0xbb67ae8584caa73bULL; + ctx->state[2] = 0x3c6ef372fe94f82bULL; + ctx->state[3] = 0xa54ff53a5f1d36f1ULL; + ctx->state[4] = 0x510e527fade682d1ULL; + ctx->state[5] = 0x9b05688c2b3e6c1fULL; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 13 18:10:13 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4DD1106564A; Mon, 13 Feb 2012 18:10:13 +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 926AE8FC18; Mon, 13 Feb 2012 18:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1DIADLY054895; Mon, 13 Feb 2012 18:10:13 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DIADaY054892; Mon, 13 Feb 2012 18:10:13 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201202131810.q1DIADaY054892@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 13 Feb 2012 18:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231590 - stable/8/release/picobsd/build X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 18:10:13 -0000 Author: luigi Date: Mon Feb 13 18:10:13 2012 New Revision: 231590 URL: http://svn.freebsd.org/changeset/base/231590 Log: MFC: cross-arch support for picobsd Modified: stable/8/release/picobsd/build/Makefile.conf stable/8/release/picobsd/build/picobsd Modified: stable/8/release/picobsd/build/Makefile.conf ============================================================================== --- stable/8/release/picobsd/build/Makefile.conf Mon Feb 13 16:48:49 2012 (r231589) +++ stable/8/release/picobsd/build/Makefile.conf Mon Feb 13 18:10:13 2012 (r231590) @@ -13,15 +13,16 @@ BINMAKE?=make SRC?=/usr/src CONFIG?=config MODULES?=-DNO_MODULES # do not build them as a default +KERNCONF ?= PICOBSD # caller will set MODULES to empty if modules are needed. # Indeed, it can be used to specify other Makefile options as well. # These 3 variables determine where the kernel is built. # If config were smart enough, we could place the config -# file in some other place than ${SRC}/sys/i386/conf, but +# file in some other place than ${SRC}/sys/${TARGET_ARCH}/conf, but # at the moment (Oct.2001) this is not possible yet. -CONF=${SRC}/sys/i386/conf +CONF=${SRC}/sys/${TARGET_ARCH}/conf #CONF=${BUILDDIR}/conf # XXX does not work yet CONFFILE=PICOBSD-${name} @@ -45,10 +46,10 @@ ${COMPILE}: ${CONF}/${CONFFILE} (cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \ cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} depend ) -${CONF}/${CONFFILE}: PICOBSD +${CONF}/${CONFFILE}: ${KERNCONF} # -mkdir -p ${CONF} # XXX not needed yet. cp ${.OODATE} ${.TARGET} - if [ -f PICOBSD.hints ] ; then cp PICOBSD.hints ${CONF}/PICOBSD.hints ; fi + [ -f PICOBSD.hints ] && cp PICOBSD.hints ${CONF}/ # This part creates crunch1.conf and crunch.mk from crunch.conf ${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf Modified: stable/8/release/picobsd/build/picobsd ============================================================================== --- stable/8/release/picobsd/build/picobsd Mon Feb 13 16:48:49 2012 (r231589) +++ stable/8/release/picobsd/build/picobsd Mon Feb 13 18:10:13 2012 (r231590) @@ -67,7 +67,7 @@ # SRC points to your FreeBSD source tree. # l_usrtree points to the /usr subdir for the source tree. # Normally /usr or ${SRC}/../usr -# l_objtree points to the obj tree. Normally ${l_usrtree}/obj-pico +# l_objtree points to the obj tree. Normally ${l_usrtree}/obj-pico-${o_arch} # c_label is either bsdlabel or disklabel # PICO_TREE is where standard picobsd stuff resides. # Normally ${SRC}/release/picobsd @@ -105,11 +105,6 @@ set_defaults() { # no arguments EDITOR=${EDITOR:-vi} fd_size=${fd_size:-1440} - o_use_loader="yes" # use /boot/loader - # You should not change it unless you are really short - # of space, and your kernel is small enough that the - # bootblocks manage to load it. - o_all_in_mfs="yes" # put all files in mfs so you can boot # and run the image via diskless boot. o_clean="" # set if you want to clean prev.builds. @@ -121,6 +116,7 @@ set_defaults() { # no arguments o_no_devfs= # default is use devfs. # You should only set it when building 4.x images o_do_modules="" # do not build modules + o_arch=`uname -m` # default to amd64 or i386 ... SRC="/usr/src" # default location for sources c_startdir=`pwd` # directory where we start @@ -165,20 +161,30 @@ set_defaults() { # no arguments # and also to build a specific target create_includes_and_libraries2() { # opt_dir opt_target local no - log "create_includes_and_libraries2() for ${SRC}" + log "create_includes_and_libraries2() for ${SRC} $1" if [ ${OSVERSION} -ge 600000 ] ; then no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" else no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R" fi - MAKEOBJDIRPREFIX=${l_objtree} - export MAKEOBJDIRPREFIX ( cd ${SRC}; # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld if [ -d "$1" ] ; then - cd $1 ; ${BINMAKE} $2 # specific target, e.g. ld-elf.so + cd $1 ; ${BINMAKE} ${o_par} $2 # specific target, e.g. ld-elf.so else - ${BINMAKE} _+_= $no toolchain _includes _libraries + MAKEOBJDIRPREFIX=${l_objtree} + export MAKEOBJDIRPREFIX + # export WITH_RESCUE=yes # build crunchide + # ${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries + ( + # eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V BMAKEENV` + eval "export XMAKE=\"`cd ${SRC}; make -f Makefile -V XMAKE`\"" + ${BINMAKE} ${o_par} _+_= $no toolchain + ) + eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` + ${BINMAKE} ${o_par} _+_= $no _includes _libraries + [ ${o_arch} != `uname -m` ] && \ + (cd ${l_objtree}; ln -s . ${o_arch}.${o_arch} || true ) fi ) } @@ -241,16 +247,19 @@ set_type() { # the_type the_site name="" # clear in case of errors for i in ${c_startdir}/${a} ${PICO_TREE}/${a} ; do log "set_type: checking $i" - [ -d $i -a -f $i/PICOBSD -a -f $i/crunch.conf ] || continue - set -- `cat $i/PICOBSD | \ + [ -d $i -a -f $i/crunch.conf ] || continue + # look for a kernel config file, privilege arch-specific + l_kernconf=$i/PICOBSD.${o_arch} + [ -f $l_kernconf ] || l_kernconf=$i/PICOBSD + [ -f $l_kernconf ] || continue + set -- `cat $l_kernconf | \ awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}'` [ x"$1" != "x" ] || continue - MFS_SIZE=$1 ; init_name=$2 - mfs_inodes=$3 ; fd_inodes=$4 + MFS_SIZE=$1 name=`(cd $i ; pwd) ` name=`basename $name` MY_TREE=$i - BUILDDIR=${c_startdir}/build_dir-${name} + BUILDDIR=${c_startdir}/build_dir-${name}-${o_arch} log "Matching file $name in $i" return ; done @@ -327,10 +336,7 @@ main_dialog() { K "edit Kernel config file" \ E "Edit crunch.conf file" \ S "MFS Size: ${MFS_SIZE}kB" \ - I "Init type: ${init_name}" \ F "Floppy size: ${fd_size}kB" \ - M "MFS bytes per inode: ${mfs_inodes}" \ - U "UFS bytes per inode: ${fd_inodes}" \ $ "Site-info: ${SITE}" \ Q "Quit" \ 2> ${c_reply} @@ -348,12 +354,6 @@ main_dialog() { { dialog --menu "Setup the type of configuration" 12 70 5 $l \ 2> ${c_reply} && set_type "`cat ${c_reply}`" ${SITE} ; } || true ;; - I) - { dialog --menu "Choose your init(8) program" \ - 10 70 2 init "Standard init (requires getty)" \ - oinit "small init from TinyWare" 2> ${c_reply} \ - && init_name=`cat ${c_reply}` ; } || true - ;; K) ${EDITOR} ${MY_TREE}/PICOBSD ;; @@ -385,20 +385,6 @@ this as small as possible. " 10 70 2> ${ 2> ${c_reply} && fd_size=`cat ${c_reply}` ; } || true ;; - M) - { dialog --title "MFS bytes per inode:" --inputbox \ - "Enter MFS bytes per inode (typically 4096..65536). \ - A larger value means fewer inodes but more space on MFS" \ - 10 70 2> ${c_reply} && mfs_inodes=`cat ${c_reply}` ; } || true - ;; - - U) - { dialog --title "Floppy bytes per inode:" --inputbox \ - "Enter floppy bytes per inode (typically 3072..65536). \ - A larger value means fewer inodes but more space on the floppy." \ - 10 70 2> ${c_reply} && fd_inodes=`cat ${c_reply}` ; } || true - ;; - N) break 2 ;; @@ -451,8 +437,10 @@ do_kernel() { # OK log "do_kernel() Preparing kernel \"$name\" in $MY_TREE" (cd $MY_TREE; export name SRC BUILDDIR # used in this makefile ; # export CONFIG + export WARNS CWARNFLAGS [ "${o_do_modules}" = "yes" ] && export MODULES="" - ${BINMAKE} -v -f ${PICO_TREE}/build/Makefile.conf ) || \ + ${BINMAKE} ${o_par} KERNCONF=${l_kernconf} \ + -v -f ${PICO_TREE}/build/Makefile.conf ) || \ fail $? missing_kernel } @@ -563,7 +551,7 @@ do_links() { # rootdir varname # find_progs is a helper function to locate the named programs # or libraries in ${o_objdir} or ${_SHLIBDIRPREFIX}, # and return the full pathnames. -# Called as "find_progs [-L libpath] [-P binpath] prog1 prog2 ... " +# Called as "find_progs [[-L libpath] [-P binpath]] prog1 prog2 ... " # On return it sets ${u_progs} to the list of programs, and ${u_libs} # to the list of shared libraries used. # @@ -586,23 +574,32 @@ do_links() { # rootdir varname # } find_progs() { # programs - local i - local oo=${o_objdir:-${_SHLIBDIRPREFIX}} # default objdir - local lp=$oo/lib # default lib.prefix - local o="" # additional objdir + local pass i old_libs="" tmp o="" if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path - o=$2; shift; shift - lp="$lp:$o/lib:$o/usr/lib:$o/usr/local/lib" - o="-P $o" + o="-P $2"; shift; shift fi - u_libs="" - u_progs="`find_progs_helper $*`" - log "looking for libs for <$u_progs> in $lp" + # Result returned in global variables + u_libs="" ; u_progs="`find_progs_helper $*`" [ -z "${u_progs}" ] && return 1 # not found, error - i="`( LD_LIBRARY_PATH=$lp ldd ${u_progs} ) | \ - grep -v '^/' | awk '{print $1}' | sort | uniq`" - u_libs="`find_progs_helper $o $i`" + # use objdump to find libraries. Iterate to fetch recursive + # dependencies. + tmp="${u_progs}" ; pass=1 + while [ $pass -lt 10 ] ; do + pass=$(($pass + 1)) + i="`objdump -x ${tmp} | \ + awk '$1 == "NEEDED" { print $2 }' | sort | uniq`" + if [ "$old_libs" = "$i" ] ; then + log "libraries for: $my_progs ($u_progs) are ($i) $u_libs" + log "--- done find_progs ---" return 0 + else + # logverbose "old--- $old_libs --- new +++ $i +++" + fi + u_libs="`find_progs_helper $o $i`" + old_libs="$i" + tmp="$tmp $u_libs" + done + log "WARNING: Too many passes, giving up" } find_progs_helper() { # programs @@ -635,8 +632,12 @@ find_progs_helper() { # programs [ -d "${ldir}/${i}" ] && places="${places} ${ldir}/${i}" done fi + for i in $progs ; do + # full pathnames are just listed + [ -f "$i" ] && echo $i && continue + find ${places} -maxdepth 3 -type f -name ${i} | head -1 + done # use maxdepth 3 because some libs are way down - find ${places} -maxdepth 3 -type f \( ${names} \) } # Populate the memory filesystem with binaries and non-variable @@ -786,7 +787,6 @@ populate_mfs_tree() { final_cleanup() { log "final_cleanup()" rm -rf ${c_mnt} ${c_reply} 2> /dev/null || true - rm -f ${c_reply} } # fail errno errcode @@ -855,17 +855,6 @@ fill_floppy_image() { fi log "Labeling floppy image" - b2=${BUILDDIR}/boot2 # modified boot2 - cp -f ${c_boot2} ${b2} - chmod 0644 ${b2} - - if [ ${o_use_loader} = "no" ] ; then - log "patch ${c_boot2} to boot /kernel right away" - set `strings -at d ${b2} | grep "/boot/loader"` - echo -e "/kernel\0\0\0\0\0" | \ - dd of=${b2} obs=$1 oseek=1 conv=notrunc 2>/dev/null - fi - chmod 0444 ${b2} dst=${BUILDDIR}/image.tree rm -rf ${dst} @@ -891,17 +880,13 @@ fill_floppy_image() { log "not loading mfs, size ${mfs_size} img ${imgsize}" fi log "Compress with kgzip and copy to floppy image" - if [ ${o_use_loader} = "no" ] ; then - kgzip -o kernel.gz kernel - cp -p kernel.gz ${dst}/kernel || fail $? no_space "copying kernel" - else - gzip kernel + mkdir -p ${dst}/boot/kernel + # XXX update loader.conf echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader" - cp -p kernel.gz ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel" - fi + gzip -c kernel > ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel" # now transfer the floppy tree. If it is already in mfs, dont bother. if [ "${o_all_in_mfs}" != "yes" ] ; then @@ -951,10 +936,13 @@ fill_floppy_image() { # so we skip 276 from the source, and 276+512=788 from dst # the old style blocks used 512 and 1024 respectively - dd if=${b2} iseek=1 ibs=276 2> /dev/null | \ + dd if=${c_boot2} iseek=1 ibs=276 2> /dev/null | \ dd of=${BUILDDIR}/${c_img} oseek=1 obs=788 conv=notrunc 2>/dev/null log "done disk image" # XXX (log "Fixing permissions"; cd ${dst}; chown -R root *) + # leave build stuff if verbose + [ ${o_verbose} -gt 0 ] && return + rm -rf ${BUILDDIR}/floppy.tree || true # cleanup # df -ik ${dst} | colrm 70 > .build.reply rm -rf ${dst} @@ -973,7 +961,7 @@ set_build_parameters() { else l_usrtree=${USR:-${SRC}/../usr} fi - l_objtree=${l_usrtree}/obj-pico + l_objtree=${l_usrtree}/obj-pico-${o_arch} PICO_TREE=${PICO_TREE:-${SRC}/release/picobsd} set `grep "#define[\t ]__FreeBSD_version" ${SRC}/sys/sys/param.h` @@ -981,8 +969,11 @@ set_build_parameters() { log "OSVERSION is ${OSVERSION}" if [ ${OSVERSION} -ge 500035 ] ; then export MAKEOBJDIRPREFIX=${l_objtree} + export TARGET_ARCH=${o_arch} TARGET=${o_arch} + # XXX why change machine_arch ? + #-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m` + # export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers" eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\"" - eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` fi if [ "${o_init_src}" != "" ] ; then @@ -991,6 +982,8 @@ set_build_parameters() { else create_includes_and_libraries2 fi + else + eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` fi if [ ${OSVERSION} -lt 500035 ] ; then # Create the right LIBS and CFLAGS for further builds. @@ -1020,26 +1013,33 @@ set_build_parameters() { # Main entry of the script. Initialize variables, parse command line # arguments. +# o_par="-j 8" # parallel make and other make options + set_defaults while [ true ]; do log "Parsing $1" case $1 in + --par) + o_par="-j 8" + ;; + --src) # set the source path instead of /usr/src SRC=`realpath $2` shift ;; - --init) + + --init) # run a partial buildworld on the source tree o_init_src="YES" ;; - --floppy_size) - fd_size=$2 + --arch) # override the target architecture + o_arch=$2 shift ;; - --no_loader) # omit /boot/loader, just rely on boot2 - # (it may have problems with kernels > 4MB) - o_use_loader="no" + --floppy_size) # image size + fd_size=$2 + shift ;; --all_in_mfs) @@ -1053,6 +1053,7 @@ while [ true ]; do --modules) # also build kernel modules o_do_modules="yes" ;; + -n) o_interactive="NO" ;; From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 13 18:57:36 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E74191065670; Mon, 13 Feb 2012 18:57:36 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D628E8FC0C; Mon, 13 Feb 2012 18:57:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1DIvano056841; Mon, 13 Feb 2012 18:57:36 GMT (envelope-from se@svn.freebsd.org) Received: (from se@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DIvaEN056839; Mon, 13 Feb 2012 18:57:36 GMT (envelope-from se@svn.freebsd.org) Message-Id: <201202131857.q1DIvaEN056839@svn.freebsd.org> From: Stefan Esser Date: Mon, 13 Feb 2012 18:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231595 - stable/8/share/mk X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 18:57:37 -0000 Author: se Date: Mon Feb 13 18:57:36 2012 New Revision: 231595 URL: http://svn.freebsd.org/changeset/base/231595 Log: MFC r223596: Add macros to specify owner, group and mode of config files for installation. Modified: stable/8/share/mk/bsd.own.mk Directory Properties: stable/8/share/mk/ (props changed) Modified: stable/8/share/mk/bsd.own.mk ============================================================================== --- stable/8/share/mk/bsd.own.mk Mon Feb 13 18:56:34 2012 (r231594) +++ stable/8/share/mk/bsd.own.mk Mon Feb 13 18:57:36 2012 (r231595) @@ -61,6 +61,15 @@ # SHAREMODE ASCII text file mode. [${NOBINMODE}] # # +# CONFDIR Base path for configuration files. [/etc] +# +# CONFOWN Configuration file owner. [root] +# +# CONFGRP Configuration file group. [wheel] +# +# CONFMODE Configuration file mode. [644] +# +# # DOCDIR Base path for system documentation (e.g. PSD, USD, # handbook, FAQ etc.). [${SHAREDIR}/doc] # @@ -142,6 +151,11 @@ SHAREOWN?= root SHAREGRP?= wheel SHAREMODE?= ${NOBINMODE} +CONFDIR?= /etc +CONFOWN?= root +CONFGRP?= wheel +CONFMODE?= 644 + MANDIR?= ${SHAREDIR}/man/man MANOWN?= ${SHAREOWN} MANGRP?= ${SHAREGRP} From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 13 19:18:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF7AF1065692; Mon, 13 Feb 2012 19:18:08 +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 947218FC0C; Mon, 13 Feb 2012 19:18:08 +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 q1DJI86V057581; Mon, 13 Feb 2012 19:18:08 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJI8YV057576; Mon, 13 Feb 2012 19:18:08 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131918.q1DJI8YV057576@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231598 - in stable/8/sys/dev: cxgb cxgbe X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:18:08 -0000 Author: np Date: Mon Feb 13 19:18:08 2012 New Revision: 231598 URL: http://svn.freebsd.org/changeset/base/231598 Log: MFC r231116: Remove if_start from cxgb and cxgbe. Modified: stable/8/sys/dev/cxgb/cxgb_adapter.h stable/8/sys/dev/cxgb/cxgb_main.c stable/8/sys/dev/cxgb/cxgb_sge.c stable/8/sys/dev/cxgbe/t4_main.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_adapter.h Mon Feb 13 19:17:43 2012 (r231597) +++ stable/8/sys/dev/cxgb/cxgb_adapter.h Mon Feb 13 19:18:08 2012 (r231598) @@ -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/8/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_main.c Mon Feb 13 19:17:43 2012 (r231597) +++ stable/8/sys/dev/cxgb/cxgb_main.c Mon Feb 13 19:18:08 2012 (r231598) @@ -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_UINT(_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/8/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_sge.c Mon Feb 13 19:17:43 2012 (r231597) +++ stable/8/sys/dev/cxgb/cxgb_sge.c Mon Feb 13 19:18:08 2012 (r231598) @@ -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/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:17:43 2012 (r231597) +++ stable/8/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:18:08 2012 (r231598) @@ -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-8@FreeBSD.ORG Mon Feb 13 19:25:59 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C02141065670; Mon, 13 Feb 2012 19:25:59 +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 48BCC8FC21; Mon, 13 Feb 2012 19:25: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 q1DJPxbt057939; Mon, 13 Feb 2012 19:25:59 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJPx8B057936; Mon, 13 Feb 2012 19:25:59 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131925.q1DJPx8B057936@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:25:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231600 - stable/8/sys/dev/cxgbe X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:25:59 -0000 Author: np Date: Mon Feb 13 19:25:58 2012 New Revision: 231600 URL: http://svn.freebsd.org/changeset/base/231600 Log: MFC r231120: Acquire the adapter lock before updating fields of the filter structure. Modified: stable/8/sys/dev/cxgbe/t4_main.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:25:37 2012 (r231599) +++ stable/8/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:25:58 2012 (r231600) @@ -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-8@FreeBSD.ORG Mon Feb 13 19:31:33 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C0CE106566C; Mon, 13 Feb 2012 19:31:33 +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 104BC8FC16; Mon, 13 Feb 2012 19:31: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 q1DJVWcQ058254; Mon, 13 Feb 2012 19:31:32 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJVWhS058252; Mon, 13 Feb 2012 19:31:32 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131931.q1DJVWhS058252@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231602 - stable/8/sys/dev/cxgbe X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:31:33 -0000 Author: np Date: Mon Feb 13 19:31:32 2012 New Revision: 231602 URL: http://svn.freebsd.org/changeset/base/231602 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/8/sys/dev/cxgbe/t4_main.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:31:16 2012 (r231601) +++ stable/8/sys/dev/cxgbe/t4_main.c Mon Feb 13 19:31:32 2012 (r231602) @@ -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-8@FreeBSD.ORG Mon Feb 13 19:36:01 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36B171065672; Mon, 13 Feb 2012 19:36: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 256E48FC17; Mon, 13 Feb 2012 19:36: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 q1DJa0St058555; Mon, 13 Feb 2012 19:36:01 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJa0FN058553; Mon, 13 Feb 2012 19:36:00 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131936.q1DJa0FN058553@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:36:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231605 - stable/8/sys/dev/cxgb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:36:01 -0000 Author: np Date: Mon Feb 13 19:36:00 2012 New Revision: 231605 URL: http://svn.freebsd.org/changeset/base/231605 Log: MFC r231175: Allocate the BAR for userspace doorbells after the is_offload check is functional. Modified: stable/8/sys/dev/cxgb/cxgb_main.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_main.c Mon Feb 13 19:35:38 2012 (r231604) +++ stable/8/sys/dev/cxgb/cxgb_main.c Mon Feb 13 19:36:00 2012 (r231605) @@ -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-8@FreeBSD.ORG Mon Feb 13 19:41:31 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83D4D106564A; Mon, 13 Feb 2012 19:41:31 +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 726408FC16; Mon, 13 Feb 2012 19:41: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 q1DJfVG8058880; Mon, 13 Feb 2012 19:41:31 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJfVr5058878; Mon, 13 Feb 2012 19:41:31 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201202131941.q1DJfVr5058878@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 13 Feb 2012 19:41:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231608 - stable/8/sys/dev/cxgbe/common X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:41:31 -0000 Author: np Date: Mon Feb 13 19:41:31 2012 New Revision: 231608 URL: http://svn.freebsd.org/changeset/base/231608 Log: MFC r231592: Use the non-sleeping variang of t4_wr_mbox in code that can be called with locks held. Modified: stable/8/sys/dev/cxgbe/common/t4_hw.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/8/sys/dev/cxgbe/common/t4_hw.c Mon Feb 13 19:41:01 2012 (r231607) +++ stable/8/sys/dev/cxgbe/common/t4_hw.c Mon Feb 13 19:41:31 2012 (r231608) @@ -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-8@FreeBSD.ORG Mon Feb 13 19:49:46 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F2FF1065670; Mon, 13 Feb 2012 19:49:46 +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 3D0FB8FC1A; Mon, 13 Feb 2012 19:49: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 q1DJnkX4059181; Mon, 13 Feb 2012 19:49:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJnkci059179; Mon, 13 Feb 2012 19:49:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202131949.q1DJnkci059179@svn.freebsd.org> From: John Baldwin Date: Mon, 13 Feb 2012 19:49:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231609 - in stable/8/release: doc/share/misc picobsd/floppy.tree/sbin X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:49:46 -0000 Author: jhb Date: Mon Feb 13 19:49:45 2012 New Revision: 231609 URL: http://svn.freebsd.org/changeset/base/231609 Log: MFC 230332: Add support for the Em command. This restores a missing 'not' in the description of snd_emu10kx(4). Modified: stable/8/release/doc/share/misc/man2hwnotes.pl Directory Properties: stable/8/release/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/picobsd/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (props changed) stable/8/release/picobsd/qemu/ (props changed) stable/8/release/picobsd/tinyware/login/ (props changed) stable/8/release/powerpc/ (props changed) Modified: stable/8/release/doc/share/misc/man2hwnotes.pl ============================================================================== --- stable/8/release/doc/share/misc/man2hwnotes.pl Mon Feb 13 19:41:31 2012 (r231608) +++ stable/8/release/doc/share/misc/man2hwnotes.pl Mon Feb 13 19:49:45 2012 (r231609) @@ -320,6 +320,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-8@FreeBSD.ORG Mon Feb 13 19:52:19 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6818D1065706; Mon, 13 Feb 2012 19:52:19 +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 56DD08FC1A; Mon, 13 Feb 2012 19:52:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1DJqJdm059376; Mon, 13 Feb 2012 19:52:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DJqJKq059374; Mon, 13 Feb 2012 19:52:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202131952.q1DJqJKq059374@svn.freebsd.org> From: John Baldwin Date: Mon, 13 Feb 2012 19:52:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231611 - stable/8/sys/dev/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 19:52:19 -0000 Author: jhb Date: Mon Feb 13 19:52:18 2012 New Revision: 231611 URL: http://svn.freebsd.org/changeset/base/231611 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/8/sys/dev/pci/pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Mon Feb 13 19:51:59 2012 (r231610) +++ stable/8/sys/dev/pci/pci.c Mon Feb 13 19:52:18 2012 (r231611) @@ -1076,11 +1076,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-8@FreeBSD.ORG Mon Feb 13 20:59:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7C86106566C; Mon, 13 Feb 2012 20:59:58 +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 B14EB8FC13; Mon, 13 Feb 2012 20:59: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 q1DKxwDC061725; Mon, 13 Feb 2012 20:59:58 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1DKxwYM061722; Mon, 13 Feb 2012 20:59:58 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202132059.q1DKxwYM061722@svn.freebsd.org> From: Dimitry Andric Date: Mon, 13 Feb 2012 20:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231613 - stable/8/usr.bin/rpcgen X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2012 20:59:58 -0000 Author: dim Date: Mon Feb 13 20:59:58 2012 New Revision: 231613 URL: http://svn.freebsd.org/changeset/base/231613 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/8/usr.bin/rpcgen/rpc_main.c stable/8/usr.bin/rpcgen/rpcgen.1 Directory Properties: stable/8/usr.bin/rpcgen/ (props changed) Modified: stable/8/usr.bin/rpcgen/rpc_main.c ============================================================================== --- stable/8/usr.bin/rpcgen/rpc_main.c Mon Feb 13 20:59:20 2012 (r231612) +++ stable/8/usr.bin/rpcgen/rpc_main.c Mon Feb 13 20:59:58 2012 (r231613) @@ -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/8/usr.bin/rpcgen/rpcgen.1 ============================================================================== --- stable/8/usr.bin/rpcgen/rpcgen.1 Mon Feb 13 20:59:20 2012 (r231612) +++ stable/8/usr.bin/rpcgen/rpcgen.1 Mon Feb 13 20:59:58 2012 (r231613) @@ -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-8@FreeBSD.ORG Tue Feb 14 00:55:00 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DE1C10657C2; Tue, 14 Feb 2012 00:55:00 +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 267C78FC19; Tue, 14 Feb 2012 00:55: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 q1E0t0QU070290; Tue, 14 Feb 2012 00:55:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E0sxrN070284; Tue, 14 Feb 2012 00:54:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202140054.q1E0sxrN070284@svn.freebsd.org> From: Marius Strobl Date: Tue, 14 Feb 2012 00:54:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231624 - stable/8/sys/dev/mpt X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 00:55:00 -0000 Author: marius Date: Tue Feb 14 00:54:59 2012 New Revision: 231624 URL: http://svn.freebsd.org/changeset/base/231624 Log: MFC: r231518 Remove extra newlines from panic messages. Modified: stable/8/sys/dev/mpt/mpt.c stable/8/sys/dev/mpt/mpt.h stable/8/sys/dev/mpt/mpt_cam.c stable/8/sys/dev/mpt/mpt_pci.c stable/8/sys/dev/mpt/mpt_reg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/mpt/mpt.c ============================================================================== --- stable/8/sys/dev/mpt/mpt.c Tue Feb 14 00:54:50 2012 (r231623) +++ stable/8/sys/dev/mpt/mpt.c Tue Feb 14 00:54:59 2012 (r231624) @@ -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/8/sys/dev/mpt/mpt.h ============================================================================== --- stable/8/sys/dev/mpt/mpt.h Tue Feb 14 00:54:50 2012 (r231623) +++ stable/8/sys/dev/mpt/mpt.h Tue Feb 14 00:54:59 2012 (r231624) @@ -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/8/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_cam.c Tue Feb 14 00:54:50 2012 (r231623) +++ stable/8/sys/dev/mpt/mpt_cam.c Tue Feb 14 00:54:59 2012 (r231624) @@ -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/8/sys/dev/mpt/mpt_pci.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_pci.c Tue Feb 14 00:54:50 2012 (r231623) +++ stable/8/sys/dev/mpt/mpt_pci.c Tue Feb 14 00:54:59 2012 (r231624) @@ -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/8/sys/dev/mpt/mpt_reg.h ============================================================================== --- stable/8/sys/dev/mpt/mpt_reg.h Tue Feb 14 00:54:50 2012 (r231623) +++ stable/8/sys/dev/mpt/mpt_reg.h Tue Feb 14 00:54:59 2012 (r231624) @@ -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-8@FreeBSD.ORG Tue Feb 14 01:08:16 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CE941065672; Tue, 14 Feb 2012 01:08:16 +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 6729F8FC0C; Tue, 14 Feb 2012 01:08: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 q1E18G9u070912; Tue, 14 Feb 2012 01:08:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E18GAK070906; Tue, 14 Feb 2012 01:08:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202140108.q1E18GAK070906@svn.freebsd.org> From: Marius Strobl Date: Tue, 14 Feb 2012 01:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231627 - stable/8/sys/dev/mpt X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 01:08:16 -0000 Author: marius Date: Tue Feb 14 01:08:16 2012 New Revision: 231627 URL: http://svn.freebsd.org/changeset/base/231627 Log: Forced commit to denote that the commit message of r231624 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/8/sys/dev/mpt/mpt.c stable/8/sys/dev/mpt/mpt.h stable/8/sys/dev/mpt/mpt_cam.c stable/8/sys/dev/mpt/mpt_pci.c stable/8/sys/dev/mpt/mpt_reg.h Modified: stable/8/sys/dev/mpt/mpt.c ============================================================================== Modified: stable/8/sys/dev/mpt/mpt.h ============================================================================== Modified: stable/8/sys/dev/mpt/mpt_cam.c ============================================================================== Modified: stable/8/sys/dev/mpt/mpt_pci.c ============================================================================== Modified: stable/8/sys/dev/mpt/mpt_reg.h ============================================================================== From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 14 01:15:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0E741065672; Tue, 14 Feb 2012 01:15:26 +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 DA1AF8FC17; Tue, 14 Feb 2012 01: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 q1E1FQnX071328; Tue, 14 Feb 2012 01:15:26 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E1FQDS071324; Tue, 14 Feb 2012 01:15:26 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202140115.q1E1FQDS071324@svn.freebsd.org> From: Marius Strobl Date: Tue, 14 Feb 2012 01:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231630 - stable/8/sys/dev/mpt X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 01:15:27 -0000 Author: marius Date: Tue Feb 14 01:15:26 2012 New Revision: 231630 URL: http://svn.freebsd.org/changeset/base/231630 Log: MFC: r231228 Remove extra newlines from panic messages. Modified: stable/8/sys/dev/mpt/mpt.c stable/8/sys/dev/mpt/mpt.h stable/8/sys/dev/mpt/mpt_cam.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/mpt/mpt.c ============================================================================== --- stable/8/sys/dev/mpt/mpt.c Tue Feb 14 01:15:01 2012 (r231629) +++ stable/8/sys/dev/mpt/mpt.c Tue Feb 14 01:15:26 2012 (r231630) @@ -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/8/sys/dev/mpt/mpt.h ============================================================================== --- stable/8/sys/dev/mpt/mpt.h Tue Feb 14 01:15:01 2012 (r231629) +++ stable/8/sys/dev/mpt/mpt.h Tue Feb 14 01:15:26 2012 (r231630) @@ -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/8/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_cam.c Tue Feb 14 01:15:01 2012 (r231629) +++ stable/8/sys/dev/mpt/mpt_cam.c Tue Feb 14 01:15:26 2012 (r231630) @@ -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); @@ -3654,7 +3654,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 */ @@ -4553,7 +4553,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) { @@ -5457,7 +5457,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; @@ -5519,7 +5519,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, @@ -5591,7 +5591,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-8@FreeBSD.ORG Tue Feb 14 05:12:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4F831065677; Tue, 14 Feb 2012 05:12:52 +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 B4A028FC1B; Tue, 14 Feb 2012 05:12:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1E5Cqik079143; Tue, 14 Feb 2012 05:12:52 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E5Cqt6079140; Tue, 14 Feb 2012 05:12:52 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202140512.q1E5Cqt6079140@svn.freebsd.org> From: Rick Macklem Date: Tue, 14 Feb 2012 05:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231637 - in stable/8/sys: fs/nfsclient nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 05:12:53 -0000 Author: rmacklem Date: Tue Feb 14 05:12:52 2012 New Revision: 231637 URL: http://svn.freebsd.org/changeset/base/231637 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/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/nfsclient/nfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Tue Feb 14 04:48:36 2012 (r231636) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Tue Feb 14 05:12:52 2012 (r231637) @@ -985,6 +985,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/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Tue Feb 14 04:48:36 2012 (r231636) +++ stable/8/sys/nfsclient/nfs_vfsops.c Tue Feb 14 05:12:52 2012 (r231637) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1104,6 +1105,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-8@FreeBSD.ORG Tue Feb 14 06:42:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD3F4106566C; Tue, 14 Feb 2012 06:42:43 +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 AC9DF8FC0A; Tue, 14 Feb 2012 06:42:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1E6gh7v082641; Tue, 14 Feb 2012 06:42:43 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E6ghdI082639; Tue, 14 Feb 2012 06:42:43 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201202140642.q1E6ghdI082639@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 14 Feb 2012 06:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231639 - stable/8/etc/devd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 06:42:44 -0000 Author: hselasky Date: Tue Feb 14 06:42:43 2012 New Revision: 231639 URL: http://svn.freebsd.org/changeset/base/231639 Log: MFC r231575: Update /etc/devd/usb.conf Modified: stable/8/etc/devd/usb.conf Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/devd/usb.conf ============================================================================== --- stable/8/etc/devd/usb.conf Tue Feb 14 06:40:58 2012 (r231638) +++ stable/8/etc/devd/usb.conf Tue Feb 14 06:42:43 2012 (r231639) @@ -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-8@FreeBSD.ORG Tue Feb 14 07:13:10 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60938106566C; Tue, 14 Feb 2012 07:13:10 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A3AD8FC14; Tue, 14 Feb 2012 07:13: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 q1E7DAW1083642; Tue, 14 Feb 2012 07:13:10 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E7DA7S083640; Tue, 14 Feb 2012 07:13:10 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201202140713.q1E7DA7S083640@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 14 Feb 2012 07:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231641 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 07:13:10 -0000 Author: ae Date: Tue Feb 14 07:13:09 2012 New Revision: 231641 URL: http://svn.freebsd.org/changeset/base/231641 Log: MFC r231349: Let's be more realistic and limit maximum number of partition to 4k. Modified: stable/8/sys/geom/part/g_part_apm.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part_apm.c ============================================================================== --- stable/8/sys/geom/part/g_part_apm.c Tue Feb 14 07:12:46 2012 (r231640) +++ stable/8/sys/geom/part/g_part_apm.c Tue Feb 14 07:13:09 2012 (r231641) @@ -99,7 +99,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-8@FreeBSD.ORG Tue Feb 14 07:24:44 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D38291065672; Tue, 14 Feb 2012 07:24:44 +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 BA3648FC08; Tue, 14 Feb 2012 07:24: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 q1E7Oi5t084128; Tue, 14 Feb 2012 07:24:44 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E7Oihb084125; Tue, 14 Feb 2012 07:24:44 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201202140724.q1E7Oihb084125@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 14 Feb 2012 07:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231644 - in stable/8/sys: geom/part sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 07:24:44 -0000 Author: ae Date: Tue Feb 14 07:24:44 2012 New Revision: 231644 URL: http://svn.freebsd.org/changeset/base/231644 Log: MFC r231367: Add alias for the partition with type 0x42 to the MBR scheme. Modified: stable/8/sys/geom/part/g_part_mbr.c stable/8/sys/sys/diskmbr.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part_mbr.c ============================================================================== --- stable/8/sys/geom/part/g_part_mbr.c Tue Feb 14 07:24:22 2012 (r231643) +++ stable/8/sys/geom/part/g_part_mbr.c Tue Feb 14 07:24:44 2012 (r231644) @@ -116,6 +116,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/8/sys/sys/diskmbr.h ============================================================================== --- stable/8/sys/sys/diskmbr.h Tue Feb 14 07:24:22 2012 (r231643) +++ stable/8/sys/sys/diskmbr.h Tue Feb 14 07:24:44 2012 (r231644) @@ -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-8@FreeBSD.ORG Tue Feb 14 09:36:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 388F9106566B; Tue, 14 Feb 2012 09:36: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 079118FC0A; Tue, 14 Feb 2012 09:36: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 q1E9a2jq088933; Tue, 14 Feb 2012 09:36:02 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1E9a2j1088929; Tue, 14 Feb 2012 09:36:02 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201202140936.q1E9a2j1088929@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 14 Feb 2012 09:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231649 - in stable/8: sbin/ifconfig sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 09:36:03 -0000 Author: luigi Date: Tue Feb 14 09:36:02 2012 New Revision: 231649 URL: http://svn.freebsd.org/changeset/base/231649 Log: MFC: reserve an IFCAP bit for netmap, instruct ifconfig to parse the information (just a change on the format string suffices), and put a comment on if_var.h to tell that if_pspare[0] may be used to point to the netmap structure. Modified: stable/8/sbin/ifconfig/ifconfig.c stable/8/sys/net/if.h stable/8/sys/net/if_var.h Modified: stable/8/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/8/sbin/ifconfig/ifconfig.c Tue Feb 14 09:29:37 2012 (r231648) +++ stable/8/sbin/ifconfig/ifconfig.c Tue Feb 14 09:36:02 2012 (r231649) @@ -867,7 +867,7 @@ unsetifdescr(const char *val, int value, #define IFCAPBITS \ "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ -"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE" +"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" /* * Print the status of the interface. If an address family was Modified: stable/8/sys/net/if.h ============================================================================== --- stable/8/sys/net/if.h Tue Feb 14 09:29:37 2012 (r231648) +++ stable/8/sys/net/if.h Tue Feb 14 09:36:02 2012 (r231649) @@ -220,6 +220,7 @@ struct if_data { #define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */ #define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */ #define IFCAP_LINKSTATE 0x80000 /* the runtime link state is dynamic */ +#define IFCAP_NETMAP 0x100000 /* netmap mode supported/enabled */ #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) #define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) Modified: stable/8/sys/net/if_var.h ============================================================================== --- stable/8/sys/net/if_var.h Tue Feb 14 09:29:37 2012 (r231648) +++ stable/8/sys/net/if_var.h Tue Feb 14 09:36:02 2012 (r231649) @@ -206,7 +206,7 @@ struct ifnet { */ char if_cspare[3]; char *if_description; /* interface description */ - void *if_pspare[7]; + void *if_pspare[7]; /* 1 netmap, 6 TBD */ int if_ispare[3]; u_int if_fib; /* interface FIB */ }; From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 14 10:17:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DCB91065670; Tue, 14 Feb 2012 10:17: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 5624B8FC12; Tue, 14 Feb 2012 10:17: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 q1EAHFS3092536; Tue, 14 Feb 2012 10:17:15 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EAHEMV092468; Tue, 14 Feb 2012 10:17:14 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202141017.q1EAHEMV092468@svn.freebsd.org> From: Doug Barton Date: Tue, 14 Feb 2012 10:17:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231655 - stable/8/etc/rc.d X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 10:17:15 -0000 Author: dougb Date: Tue Feb 14 10:17:14 2012 New Revision: 231655 URL: http://svn.freebsd.org/changeset/base/231655 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/8/etc/rc.d/accounting stable/8/etc/rc.d/amd stable/8/etc/rc.d/apm stable/8/etc/rc.d/apmd stable/8/etc/rc.d/bootparams stable/8/etc/rc.d/bsnmpd stable/8/etc/rc.d/bthidd stable/8/etc/rc.d/cleanvar stable/8/etc/rc.d/cleartmp stable/8/etc/rc.d/cron stable/8/etc/rc.d/ddb stable/8/etc/rc.d/devd stable/8/etc/rc.d/dmesg stable/8/etc/rc.d/ftp-proxy stable/8/etc/rc.d/ftpd stable/8/etc/rc.d/gptboot stable/8/etc/rc.d/hastd stable/8/etc/rc.d/hcsecd stable/8/etc/rc.d/hostapd stable/8/etc/rc.d/inetd stable/8/etc/rc.d/ip6addrctl stable/8/etc/rc.d/ipfilter stable/8/etc/rc.d/ipfs stable/8/etc/rc.d/ipmon stable/8/etc/rc.d/ipnat stable/8/etc/rc.d/ipsec stable/8/etc/rc.d/ipxrouted stable/8/etc/rc.d/jail stable/8/etc/rc.d/keyserv stable/8/etc/rc.d/lpd stable/8/etc/rc.d/mountd stable/8/etc/rc.d/moused stable/8/etc/rc.d/mroute6d stable/8/etc/rc.d/mrouted stable/8/etc/rc.d/natd stable/8/etc/rc.d/netwait stable/8/etc/rc.d/network_ipv6 stable/8/etc/rc.d/newsyslog stable/8/etc/rc.d/nfscbd stable/8/etc/rc.d/nfsd stable/8/etc/rc.d/nfsuserd stable/8/etc/rc.d/nscd stable/8/etc/rc.d/ntpd stable/8/etc/rc.d/ntpdate stable/8/etc/rc.d/pf stable/8/etc/rc.d/pflog stable/8/etc/rc.d/pfsync stable/8/etc/rc.d/powerd stable/8/etc/rc.d/ppp stable/8/etc/rc.d/pppoed stable/8/etc/rc.d/quota stable/8/etc/rc.d/rarpd stable/8/etc/rc.d/rfcomm_pppd_server stable/8/etc/rc.d/route6d stable/8/etc/rc.d/routed stable/8/etc/rc.d/rpcbind stable/8/etc/rc.d/rtadvd stable/8/etc/rc.d/rtsold stable/8/etc/rc.d/rwho stable/8/etc/rc.d/sdpd stable/8/etc/rc.d/sendmail stable/8/etc/rc.d/sshd stable/8/etc/rc.d/syslogd stable/8/etc/rc.d/timed stable/8/etc/rc.d/ubthidhci stable/8/etc/rc.d/virecover stable/8/etc/rc.d/watchdogd Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.d/accounting ============================================================================== --- stable/8/etc/rc.d/accounting Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/accounting Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/amd ============================================================================== --- stable/8/etc/rc.d/amd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/amd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/apm ============================================================================== --- stable/8/etc/rc.d/apm Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/apm Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/apmd ============================================================================== --- stable/8/etc/rc.d/apmd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/apmd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/bootparams ============================================================================== --- stable/8/etc/rc.d/bootparams Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/bootparams Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/bsnmpd ============================================================================== --- stable/8/etc/rc.d/bsnmpd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/bsnmpd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/bthidd ============================================================================== --- stable/8/etc/rc.d/bthidd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/bthidd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/cleanvar ============================================================================== --- stable/8/etc/rc.d/cleanvar Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/cleanvar Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/cleartmp ============================================================================== --- stable/8/etc/rc.d/cleartmp Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/cleartmp Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/cron ============================================================================== --- stable/8/etc/rc.d/cron Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/cron Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ddb ============================================================================== --- stable/8/etc/rc.d/ddb Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ddb Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/devd ============================================================================== --- stable/8/etc/rc.d/devd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/devd Tue Feb 14 10:17:14 2012 (r231655) @@ -11,7 +11,7 @@ . /etc/rc.subr name="devd" -rcvar=`set_rcvar` +rcvar="devd_enable" command="/sbin/${name}" start_precmd=${name}_prestart Modified: stable/8/etc/rc.d/dmesg ============================================================================== --- stable/8/etc/rc.d/dmesg Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/dmesg Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ftp-proxy ============================================================================== --- stable/8/etc/rc.d/ftp-proxy Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ftp-proxy Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ftpd ============================================================================== --- stable/8/etc/rc.d/ftpd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ftpd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/gptboot ============================================================================== --- stable/8/etc/rc.d/gptboot Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/gptboot Tue Feb 14 10:17:14 2012 (r231655) @@ -34,7 +34,7 @@ . /etc/rc.subr name="gptboot" -rcvar=`set_rcvar` +rcvar="gptboot_enable" start_cmd="gptboot_report" gptboot_report() Modified: stable/8/etc/rc.d/hastd ============================================================================== --- stable/8/etc/rc.d/hastd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/hastd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/hcsecd ============================================================================== --- stable/8/etc/rc.d/hcsecd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/hcsecd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/hostapd ============================================================================== --- stable/8/etc/rc.d/hostapd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/hostapd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/inetd ============================================================================== --- stable/8/etc/rc.d/inetd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/inetd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ip6addrctl ============================================================================== --- stable/8/etc/rc.d/ip6addrctl Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ip6addrctl Tue Feb 14 10:17:14 2012 (r231655) @@ -11,7 +11,7 @@ . /etc/rc.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/8/etc/rc.d/ipfilter ============================================================================== --- stable/8/etc/rc.d/ipfilter Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ipfilter Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ipfs ============================================================================== --- stable/8/etc/rc.d/ipfs Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ipfs Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ipmon ============================================================================== --- stable/8/etc/rc.d/ipmon Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ipmon Tue Feb 14 10:17:14 2012 (r231655) @@ -11,7 +11,7 @@ . /etc/rc.subr name="ipmon" -rcvar=`set_rcvar` +rcvar="ipmon_enable" command="/sbin/${name}" start_precmd="ipmon_precmd" Modified: stable/8/etc/rc.d/ipnat ============================================================================== --- stable/8/etc/rc.d/ipnat Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ipnat Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ipsec ============================================================================== --- stable/8/etc/rc.d/ipsec Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ipsec Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ipxrouted ============================================================================== --- stable/8/etc/rc.d/ipxrouted Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ipxrouted Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/jail ============================================================================== --- stable/8/etc/rc.d/jail Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/jail Tue Feb 14 10:17:14 2012 (r231655) @@ -17,7 +17,7 @@ . /etc/rc.subr name="jail" -rcvar=`set_rcvar` +rcvar="jail_enable" start_cmd="jail_start" stop_cmd="jail_stop" Modified: stable/8/etc/rc.d/keyserv ============================================================================== --- stable/8/etc/rc.d/keyserv Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/keyserv Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/lpd ============================================================================== --- stable/8/etc/rc.d/lpd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/lpd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/mountd ============================================================================== --- stable/8/etc/rc.d/mountd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/mountd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/moused ============================================================================== --- stable/8/etc/rc.d/moused Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/moused Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/mroute6d ============================================================================== --- stable/8/etc/rc.d/mroute6d Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/mroute6d Tue Feb 14 10:17:14 2012 (r231655) @@ -10,7 +10,7 @@ . /etc/rc.subr name="mroute6d" -rcvar=`set_rcvar` +rcvar="mroute6d_enable" command="/usr/local/sbin/pim6dd" load_rc_config $name Modified: stable/8/etc/rc.d/mrouted ============================================================================== --- stable/8/etc/rc.d/mrouted Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/mrouted Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/natd ============================================================================== --- stable/8/etc/rc.d/natd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/natd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/netwait ============================================================================== --- stable/8/etc/rc.d/netwait Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/netwait Tue Feb 14 10:17:14 2012 (r231655) @@ -14,7 +14,7 @@ . /etc/rc.subr name="netwait" -rcvar=`set_rcvar` +rcvar="netwait_enable" start_cmd="${name}_start" stop_cmd=":" Modified: stable/8/etc/rc.d/network_ipv6 ============================================================================== --- stable/8/etc/rc.d/network_ipv6 Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/network_ipv6 Tue Feb 14 10:17:14 2012 (r231655) @@ -36,7 +36,7 @@ . /etc/network.subr name="network_ipv6" -rcvar=`set_rcvar ipv6` +rcvar="ipv6_enable" start_cmd="network_ipv6_start" network_ipv6_start() Modified: stable/8/etc/rc.d/newsyslog ============================================================================== --- stable/8/etc/rc.d/newsyslog Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/newsyslog Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/nfscbd ============================================================================== --- stable/8/etc/rc.d/nfscbd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/nfscbd Tue Feb 14 10:17:14 2012 (r231655) @@ -10,7 +10,7 @@ . /etc/rc.subr name="nfscbd" -rcvar=`set_rcvar` +rcvar="nfscbd_enable" command="/usr/sbin/${name}" sig_stop="USR1" Modified: stable/8/etc/rc.d/nfsd ============================================================================== --- stable/8/etc/rc.d/nfsd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/nfsd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/nfsuserd ============================================================================== --- stable/8/etc/rc.d/nfsuserd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/nfsuserd Tue Feb 14 10:17:14 2012 (r231655) @@ -10,7 +10,7 @@ . /etc/rc.subr name="nfsuserd" -rcvar=`set_rcvar` +rcvar="nfsuserd_enable" command="/usr/sbin/${name}" sig_stop="USR1" Modified: stable/8/etc/rc.d/nscd ============================================================================== --- stable/8/etc/rc.d/nscd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/nscd Tue Feb 14 10:17:14 2012 (r231655) @@ -19,7 +19,7 @@ . /etc/rc.subr name="nscd" -rcvar=`set_rcvar` +rcvar="nscd_enable" command=/usr/sbin/nscd extra_commands="flush" Modified: stable/8/etc/rc.d/ntpd ============================================================================== --- stable/8/etc/rc.d/ntpd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ntpd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ntpdate ============================================================================== --- stable/8/etc/rc.d/ntpdate Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ntpdate Tue Feb 14 10:17:14 2012 (r231655) @@ -10,7 +10,7 @@ . /etc/rc.subr name="ntpdate" -rcvar=`set_rcvar` +rcvar="ntpdate_enable" stop_cmd=":" start_cmd="ntpdate_start" Modified: stable/8/etc/rc.d/pf ============================================================================== --- stable/8/etc/rc.d/pf Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/pf Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/pflog ============================================================================== --- stable/8/etc/rc.d/pflog Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/pflog Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/pfsync ============================================================================== --- stable/8/etc/rc.d/pfsync Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/pfsync Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/powerd ============================================================================== --- stable/8/etc/rc.d/powerd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/powerd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ppp ============================================================================== --- stable/8/etc/rc.d/ppp Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ppp Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/pppoed ============================================================================== --- stable/8/etc/rc.d/pppoed Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/pppoed Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/quota ============================================================================== --- stable/8/etc/rc.d/quota Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/quota Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/rarpd ============================================================================== --- stable/8/etc/rc.d/rarpd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/rarpd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/rfcomm_pppd_server ============================================================================== --- stable/8/etc/rc.d/rfcomm_pppd_server Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/rfcomm_pppd_server Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/route6d ============================================================================== --- stable/8/etc/rc.d/route6d Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/route6d Tue Feb 14 10:17:14 2012 (r231655) @@ -10,6 +10,7 @@ . /etc/rc.subr name="route6d" +rcvar="ipv6_router_enable" # XXX - Executable may be in a different location. The $name variable # is different from the variable in rc.conf(5) so the @@ -18,7 +19,6 @@ name="route6d" # load_rc_config $name -rcvar="ipv6_router_enable" command="${ipv6_router:-/usr/sbin/${name}}" eval ${name}_flags=\"${ipv6_router_flags}\" Modified: stable/8/etc/rc.d/routed ============================================================================== --- stable/8/etc/rc.d/routed Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/routed Tue Feb 14 10:17:14 2012 (r231655) @@ -10,13 +10,13 @@ . /etc/rc.subr name="routed" +rcvar="router_enable" # XXX - Executable may be in a different location. The $name variable # is different from the variable in rc.conf(5) so the # subroutines in rc.subr won't catch it. # load_rc_config $name -rcvar="router_enable" command="${router:-/sbin/${name}}" eval ${name}_flags=\"${router_flags}\" run_rc_command "$1" Modified: stable/8/etc/rc.d/rpcbind ============================================================================== --- stable/8/etc/rc.d/rpcbind Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/rpcbind Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/rtadvd ============================================================================== --- stable/8/etc/rc.d/rtadvd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/rtadvd Tue Feb 14 10:17:14 2012 (r231655) @@ -11,7 +11,7 @@ . /etc/rc.subr name="rtadvd" -rcvar=`set_rcvar` +rcvar="rtadvd_enable" command="/usr/sbin/${name}" start_precmd="rtadvd_precmd" Modified: stable/8/etc/rc.d/rtsold ============================================================================== --- stable/8/etc/rc.d/rtsold Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/rtsold Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/rwho ============================================================================== --- stable/8/etc/rc.d/rwho Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/rwho Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/sdpd ============================================================================== --- stable/8/etc/rc.d/sdpd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/sdpd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/sendmail ============================================================================== --- stable/8/etc/rc.d/sendmail Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/sendmail Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/sshd ============================================================================== --- stable/8/etc/rc.d/sshd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/sshd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/syslogd ============================================================================== --- stable/8/etc/rc.d/syslogd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/syslogd Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/timed ============================================================================== --- stable/8/etc/rc.d/timed Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/timed Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/ubthidhci ============================================================================== --- stable/8/etc/rc.d/ubthidhci Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/ubthidhci Tue Feb 14 10:17:14 2012 (r231655) @@ -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/8/etc/rc.d/virecover ============================================================================== --- stable/8/etc/rc.d/virecover Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/virecover Tue Feb 14 10:17:14 2012 (r231655) @@ -12,7 +12,7 @@ . /etc/rc.subr name="virecover" -rcvar="`set_rcvar`" +rcvar="virecover_enable" stop_cmd=":" start_cmd="virecover_start" Modified: stable/8/etc/rc.d/watchdogd ============================================================================== --- stable/8/etc/rc.d/watchdogd Tue Feb 14 10:17:03 2012 (r231654) +++ stable/8/etc/rc.d/watchdogd Tue Feb 14 10:17:14 2012 (r231655) @@ -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-8@FreeBSD.ORG Tue Feb 14 10:19:28 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51B3D1065670; Tue, 14 Feb 2012 10:19:28 +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 3BE478FC16; Tue, 14 Feb 2012 10:19: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 q1EAJS3S092810; Tue, 14 Feb 2012 10:19:28 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EAJSpT092808; Tue, 14 Feb 2012 10:19:28 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202141019.q1EAJSpT092808@svn.freebsd.org> From: Doug Barton Date: Tue, 14 Feb 2012 10:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231658 - stable/8/etc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 10:19:28 -0000 Author: dougb Date: Tue Feb 14 10:19:27 2012 New Revision: 231658 URL: http://svn.freebsd.org/changeset/base/231658 Log: MFC r230374: If we're booting there is no need to waste time determining if the service is running or not. Modified: stable/8/etc/rc.subr Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Tue Feb 14 10:18:49 2012 (r231657) +++ stable/8/etc/rc.subr Tue Feb 14 10:19:27 2012 (r231658) @@ -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-8@FreeBSD.ORG Tue Feb 14 10:29:49 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56C09106566C; Tue, 14 Feb 2012 10:29:49 +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 2505F8FC0C; Tue, 14 Feb 2012 10:29: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 q1EATnHJ093400; Tue, 14 Feb 2012 10:29:49 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EATmtO093396; Tue, 14 Feb 2012 10:29:48 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202141029.q1EATmtO093396@svn.freebsd.org> From: Doug Barton Date: Tue, 14 Feb 2012 10:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231661 - in stable/8: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 10:29:49 -0000 Author: dougb Date: Tue Feb 14 10:29:48 2012 New Revision: 231661 URL: http://svn.freebsd.org/changeset/base/231661 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/8/etc/defaults/rc.conf stable/8/etc/rc.d/devfs stable/8/share/man/man5/rc.conf.5 Directory Properties: stable/8/etc/ (props changed) stable/8/share/man/man5/ (props changed) Modified: stable/8/etc/defaults/rc.conf ============================================================================== --- stable/8/etc/defaults/rc.conf Tue Feb 14 10:29:32 2012 (r231660) +++ stable/8/etc/defaults/rc.conf Tue Feb 14 10:29:48 2012 (r231661) @@ -634,6 +634,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/8/etc/rc.d/devfs ============================================================================== --- stable/8/etc/rc.d/devfs Tue Feb 14 10:29:32 2012 (r231660) +++ stable/8/etc/rc.d/devfs Tue Feb 14 10:29:48 2012 (r231661) @@ -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/8/share/man/man5/rc.conf.5 ============================================================================== --- stable/8/share/man/man5/rc.conf.5 Tue Feb 14 10:29:32 2012 (r231660) +++ stable/8/share/man/man5/rc.conf.5 Tue Feb 14 10:29:48 2012 (r231661) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2011 +.Dd February 8, 2012 .Dt RC.CONF 5 .Os .Sh NAME @@ -3388,6 +3388,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. @@ -4242,6 +4261,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-8@FreeBSD.ORG Tue Feb 14 10:34:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAF121065676; Tue, 14 Feb 2012 10:34: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 9513D8FC1D; Tue, 14 Feb 2012 10:34: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 q1EAYF8X093775; Tue, 14 Feb 2012 10:34:15 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EAYFR5093772; Tue, 14 Feb 2012 10:34:15 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202141034.q1EAYFR5093772@svn.freebsd.org> From: Doug Barton Date: Tue, 14 Feb 2012 10:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231665 - stable/8/etc/rc.d X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 10:34:15 -0000 Author: dougb Date: Tue Feb 14 10:34:15 2012 New Revision: 231665 URL: http://svn.freebsd.org/changeset/base/231665 Log: MFC r231507: Move addswap to run right after kld (aka early in the second stage), as it did previously. Modified: stable/8/etc/rc.d/addswap stable/8/etc/rc.d/var Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.d/addswap ============================================================================== --- stable/8/etc/rc.d/addswap Tue Feb 14 10:33:57 2012 (r231664) +++ stable/8/etc/rc.d/addswap Tue Feb 14 10:34:15 2012 (r231665) @@ -6,7 +6,7 @@ # # PROVIDE: addswap -# REQUIRE: FILESYSTEMS +# REQUIRE: FILESYSTEMS kld # KEYWORD: nojail . /etc/rc.subr Modified: stable/8/etc/rc.d/var ============================================================================== --- stable/8/etc/rc.d/var Tue Feb 14 10:33:57 2012 (r231664) +++ stable/8/etc/rc.d/var Tue Feb 14 10:34:15 2012 (r231665) @@ -28,7 +28,7 @@ # # PROVIDE: var -# REQUIRE: FILESYSTEMS kld +# REQUIRE: FILESYSTEMS kld addswap . /etc/rc.subr From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 14 12:47:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E492A106564A; Tue, 14 Feb 2012 12:47:57 +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 B7D798FC0A; Tue, 14 Feb 2012 12:47: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 q1EClv5K098974; Tue, 14 Feb 2012 12:47:57 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EClvFs098970; Tue, 14 Feb 2012 12:47:57 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201202141247.q1EClvFs098970@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 14 Feb 2012 12:47:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231677 - in stable/8: etc etc/rc.d share/man/man8 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 12:47:58 -0000 Author: des Date: Tue Feb 14 12:47:57 2012 New Revision: 231677 URL: http://svn.freebsd.org/changeset/base/231677 Log: MFH r230007, r230388: document quiet*, fix devd/dhclient interaction. Modified: stable/8/etc/rc.d/dhclient stable/8/etc/rc.subr stable/8/share/man/man8/rc.subr.8 Directory Properties: stable/8/etc/ (props changed) stable/8/share/man/ (props changed) stable/8/share/man/man8/ (props changed) Modified: stable/8/etc/rc.d/dhclient ============================================================================== --- stable/8/etc/rc.d/dhclient Tue Feb 14 12:43:33 2012 (r231676) +++ stable/8/etc/rc.d/dhclient Tue Feb 14 12:47:57 2012 (r231677) @@ -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/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Tue Feb 14 12:43:33 2012 (r231676) +++ stable/8/etc/rc.subr Tue Feb 14 12:47:57 2012 (r231677) @@ -1121,7 +1121,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/8/share/man/man8/rc.subr.8 ============================================================================== --- stable/8/share/man/man8/rc.subr.8 Tue Feb 14 12:43:33 2012 (r231676) +++ stable/8/share/man/man8/rc.subr.8 Tue Feb 14 12:47:57 2012 (r231677) @@ -375,7 +375,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 @@ -463,6 +463,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-8@FreeBSD.ORG Tue Feb 14 14:18:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61623106564A; Tue, 14 Feb 2012 14:18:29 +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 4DF9E8FC1E; Tue, 14 Feb 2012 14:18:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1EEITuv002211; Tue, 14 Feb 2012 14:18:29 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EEITEG002204; Tue, 14 Feb 2012 14:18:29 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202141418.q1EEITEG002204@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 14 Feb 2012 14:18:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231680 - stable/8/sys/dev/mps X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 14:18:29 -0000 Author: ken Date: Tue Feb 14 14:18:28 2012 New Revision: 231680 URL: http://svn.freebsd.org/changeset/base/231680 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/8/sys/dev/mps/mps.c stable/8/sys/dev/mps/mps_sas.c stable/8/sys/dev/mps/mps_sas.h stable/8/sys/dev/mps/mps_sas_lsi.c stable/8/sys/dev/mps/mps_user.c stable/8/sys/dev/mps/mpsvar.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/mps/mps.c ============================================================================== --- stable/8/sys/dev/mps/mps.c Tue Feb 14 14:17:46 2012 (r231679) +++ stable/8/sys/dev/mps/mps.c Tue Feb 14 14:18:28 2012 (r231680) @@ -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/8/sys/dev/mps/mps_sas.c ============================================================================== --- stable/8/sys/dev/mps/mps_sas.c Tue Feb 14 14:17:46 2012 (r231679) +++ stable/8/sys/dev/mps/mps_sas.c Tue Feb 14 14:18:28 2012 (r231680) @@ -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/8/sys/dev/mps/mps_sas.h ============================================================================== --- stable/8/sys/dev/mps/mps_sas.h Tue Feb 14 14:17:46 2012 (r231679) +++ stable/8/sys/dev/mps/mps_sas.h Tue Feb 14 14:18:28 2012 (r231680) @@ -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/8/sys/dev/mps/mps_sas_lsi.c ============================================================================== --- stable/8/sys/dev/mps/mps_sas_lsi.c Tue Feb 14 14:17:46 2012 (r231679) +++ stable/8/sys/dev/mps/mps_sas_lsi.c Tue Feb 14 14:18:28 2012 (r231680) @@ -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/8/sys/dev/mps/mps_user.c ============================================================================== --- stable/8/sys/dev/mps/mps_user.c Tue Feb 14 14:17:46 2012 (r231679) +++ stable/8/sys/dev/mps/mps_user.c Tue Feb 14 14:18:28 2012 (r231680) @@ -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/8/sys/dev/mps/mpsvar.h ============================================================================== --- stable/8/sys/dev/mps/mpsvar.h Tue Feb 14 14:17:46 2012 (r231679) +++ stable/8/sys/dev/mps/mpsvar.h Tue Feb 14 14:18:28 2012 (r231680) @@ -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-8@FreeBSD.ORG Tue Feb 14 14:19:53 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0764106566B; Tue, 14 Feb 2012 14:19:53 +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 9CF008FC0A; Tue, 14 Feb 2012 14:19: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 q1EEJrYG002294; Tue, 14 Feb 2012 14:19:53 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EEJr0N002288; Tue, 14 Feb 2012 14:19:53 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201202141419.q1EEJr0N002288@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 14 Feb 2012 14:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231681 - in stable/8/sys: conf dev/oce modules modules/oce X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 14:19:53 -0000 Author: luigi Date: Tue Feb 14 14:19:53 2012 New Revision: 231681 URL: http://svn.freebsd.org/changeset/base/231681 Log: MFC: bring in the "oce" driver for Emulex OneConnect 10 Gbit adapters. Same code as in HEAD and stable/9 Added: stable/8/sys/dev/oce/ stable/8/sys/dev/oce/oce_hw.c (contents, props changed) stable/8/sys/dev/oce/oce_hw.h (contents, props changed) stable/8/sys/dev/oce/oce_if.c (contents, props changed) stable/8/sys/dev/oce/oce_if.h (contents, props changed) stable/8/sys/dev/oce/oce_mbox.c (contents, props changed) stable/8/sys/dev/oce/oce_queue.c (contents, props changed) stable/8/sys/dev/oce/oce_sysctl.c (contents, props changed) stable/8/sys/dev/oce/oce_util.c (contents, props changed) stable/8/sys/modules/oce/ stable/8/sys/modules/oce/Makefile (contents, props changed) Modified: stable/8/sys/conf/NOTES stable/8/sys/conf/files stable/8/sys/modules/Makefile Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Tue Feb 14 14:18:28 2012 (r231680) +++ stable/8/sys/conf/NOTES Tue Feb 14 14:19:53 2012 (r231681) @@ -1924,6 +1924,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 @@ -2062,6 +2063,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/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Tue Feb 14 14:18:28 2012 (r231680) +++ stable/8/sys/conf/files Tue Feb 14 14:19:53 2012 (r231681) @@ -1401,6 +1401,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/8/sys/dev/oce/oce_hw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/oce/oce_hw.c Tue Feb 14 14:19:53 2012 (r231681) @@ -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/8/sys/dev/oce/oce_hw.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/oce/oce_hw.h Tue Feb 14 14:19:53 2012 (r231681) @@ -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-8@FreeBSD.ORG Tue Feb 14 15:17:59 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75254106567D; Tue, 14 Feb 2012 15:17:59 +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 493C28FC0C; Tue, 14 Feb 2012 15:17: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 q1EFHxu5005167; Tue, 14 Feb 2012 15:17:59 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EFHxoW005164; Tue, 14 Feb 2012 15:17:59 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201202141517.q1EFHxoW005164@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 14 Feb 2012 15:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231685 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 15:17:59 -0000 Author: bz Date: Tue Feb 14 15:17:58 2012 New Revision: 231685 URL: http://svn.freebsd.org/changeset/base/231685 Log: MFC 229547: Mark a couple of file local functions static and stop exporting them. Discussed with: rwatson Modified: stable/8/sys/netinet6/nd6.h stable/8/sys/netinet6/nd6_rtr.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet6/nd6.h ============================================================================== --- stable/8/sys/netinet6/nd6.h Tue Feb 14 15:17:48 2012 (r231684) +++ stable/8/sys/netinet6/nd6.h Tue Feb 14 15:17:58 2012 (r231685) @@ -435,15 +435,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/8/sys/netinet6/nd6_rtr.c ============================================================================== --- stable/8/sys/netinet6/nd6_rtr.c Tue Feb 14 15:17:48 2012 (r231684) +++ stable/8/sys/netinet6/nd6_rtr.c Tue Feb 14 15:17:58 2012 (r231685) @@ -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); @@ -455,7 +458,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; @@ -1551,7 +1554,7 @@ pfxlist_onlink_check() } } -int +static int nd6_prefix_onlink(struct nd_prefix *pr) { struct ifaddr *ifa; @@ -1676,7 +1679,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-8@FreeBSD.ORG Tue Feb 14 15:56:02 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD563106566C; Tue, 14 Feb 2012 15:56:02 +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 C787B8FC1D; Tue, 14 Feb 2012 15:56: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 q1EFu2Qp006512; Tue, 14 Feb 2012 15:56:02 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EFu2Q9006483; Tue, 14 Feb 2012 15:56:02 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201202141556.q1EFu2Q9006483@svn.freebsd.org> From: Jim Harris Date: Tue, 14 Feb 2012 15:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231688 - in stable/8: . 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-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 15:56:03 -0000 Author: jimharris Date: Tue Feb 14 15:56:01 2012 New Revision: 231688 URL: http://svn.freebsd.org/changeset/base/231688 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/8/share/man/man4/isci.4 - copied unchanged from r230843, head/share/man/man4/isci.4 stable/8/sys/dev/isci/ - copied from r230843, head/sys/dev/isci/ stable/8/sys/modules/isci/ - copied from r230843, head/sys/modules/isci/ Modified: stable/8/MAINTAINERS (contents, props changed) stable/8/share/man/man4/Makefile stable/8/sys/amd64/conf/GENERIC stable/8/sys/amd64/conf/NOTES stable/8/sys/conf/files.amd64 stable/8/sys/conf/files.i386 stable/8/sys/conf/options.amd64 stable/8/sys/conf/options.i386 stable/8/sys/dev/isci/isci.h (contents, props changed) stable/8/sys/dev/isci/isci_io_request.c (contents, props changed) stable/8/sys/dev/isci/isci_remote_device.c (contents, props changed) stable/8/sys/dev/isci/scil/sati_abort_task_set.c (contents, props changed) stable/8/sys/dev/isci/scil/scic_sds_controller.c (contents, props changed) stable/8/sys/dev/isci/scil/scic_sds_stp_request.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_controller.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_controller_state_handlers.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_domain.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_io_request.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_remote_device.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_smp_io_request.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_smp_remote_device.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_stp_io_request.c (contents, props changed) stable/8/sys/dev/isci/scil/scif_sas_stp_task_request.c (contents, props changed) stable/8/sys/i386/conf/GENERIC stable/8/sys/i386/conf/NOTES stable/8/sys/modules/Makefile stable/8/sys/modules/isci/Makefile (contents, props changed) Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/isci/README (props changed) stable/8/sys/dev/isci/environment.h (props changed) stable/8/sys/dev/isci/isci.c (props changed) stable/8/sys/dev/isci/isci_controller.c (props changed) stable/8/sys/dev/isci/isci_domain.c (props changed) stable/8/sys/dev/isci/isci_interrupt.c (props changed) stable/8/sys/dev/isci/isci_logger.c (props changed) stable/8/sys/dev/isci/isci_oem_parameters.c (props changed) stable/8/sys/dev/isci/isci_sysctl.c (props changed) stable/8/sys/dev/isci/isci_task_request.c (props changed) stable/8/sys/dev/isci/isci_timer.c (props changed) stable/8/sys/dev/isci/sci_environment.h (props changed) stable/8/sys/dev/isci/scil/intel_ata.h (props changed) stable/8/sys/dev/isci/scil/intel_pci.h (props changed) stable/8/sys/dev/isci/scil/intel_sas.h (props changed) stable/8/sys/dev/isci/scil/intel_sat.h (props changed) stable/8/sys/dev/isci/scil/intel_sata.h (props changed) stable/8/sys/dev/isci/scil/intel_scsi.h (props changed) stable/8/sys/dev/isci/scil/sati.c (props changed) stable/8/sys/dev/isci/scil/sati.h (props changed) stable/8/sys/dev/isci/scil/sati_abort_task_set.h (props changed) stable/8/sys/dev/isci/scil/sati_atapi.c (props changed) stable/8/sys/dev/isci/scil/sati_atapi.h (props changed) stable/8/sys/dev/isci/scil/sati_callbacks.h (props changed) stable/8/sys/dev/isci/scil/sati_design.h (props changed) stable/8/sys/dev/isci/scil/sati_device.c (props changed) stable/8/sys/dev/isci/scil/sati_device.h (props changed) stable/8/sys/dev/isci/scil/sati_inquiry.c (props changed) stable/8/sys/dev/isci/scil/sati_inquiry.h (props changed) stable/8/sys/dev/isci/scil/sati_log_sense.c (props changed) stable/8/sys/dev/isci/scil/sati_log_sense.h (props changed) stable/8/sys/dev/isci/scil/sati_lun_reset.c (props changed) stable/8/sys/dev/isci/scil/sati_lun_reset.h (props changed) stable/8/sys/dev/isci/scil/sati_mode_pages.c (props changed) stable/8/sys/dev/isci/scil/sati_mode_pages.h (props changed) stable/8/sys/dev/isci/scil/sati_mode_select.c (props changed) stable/8/sys/dev/isci/scil/sati_mode_select.h (props changed) stable/8/sys/dev/isci/scil/sati_mode_sense.c (props changed) stable/8/sys/dev/isci/scil/sati_mode_sense.h (props changed) stable/8/sys/dev/isci/scil/sati_mode_sense_10.c (props changed) stable/8/sys/dev/isci/scil/sati_mode_sense_10.h (props changed) stable/8/sys/dev/isci/scil/sati_mode_sense_6.c (props changed) stable/8/sys/dev/isci/scil/sati_mode_sense_6.h (props changed) stable/8/sys/dev/isci/scil/sati_move.c (props changed) stable/8/sys/dev/isci/scil/sati_move.h (props changed) stable/8/sys/dev/isci/scil/sati_passthrough.c (props changed) stable/8/sys/dev/isci/scil/sati_passthrough.h (props changed) stable/8/sys/dev/isci/scil/sati_read.c (props changed) stable/8/sys/dev/isci/scil/sati_read.h (props changed) stable/8/sys/dev/isci/scil/sati_read_buffer.c (props changed) stable/8/sys/dev/isci/scil/sati_read_buffer.h (props changed) stable/8/sys/dev/isci/scil/sati_read_capacity.c (props changed) stable/8/sys/dev/isci/scil/sati_read_capacity.h (props changed) stable/8/sys/dev/isci/scil/sati_reassign_blocks.c (props changed) stable/8/sys/dev/isci/scil/sati_reassign_blocks.h (props changed) stable/8/sys/dev/isci/scil/sati_report_luns.c (props changed) stable/8/sys/dev/isci/scil/sati_report_luns.h (props changed) stable/8/sys/dev/isci/scil/sati_request_sense.c (props changed) stable/8/sys/dev/isci/scil/sati_request_sense.h (props changed) stable/8/sys/dev/isci/scil/sati_start_stop_unit.c (props changed) stable/8/sys/dev/isci/scil/sati_start_stop_unit.h (props changed) stable/8/sys/dev/isci/scil/sati_synchronize_cache.c (props changed) stable/8/sys/dev/isci/scil/sati_synchronize_cache.h (props changed) stable/8/sys/dev/isci/scil/sati_test_unit_ready.c (props changed) stable/8/sys/dev/isci/scil/sati_test_unit_ready.h (props changed) stable/8/sys/dev/isci/scil/sati_translator_sequence.h (props changed) stable/8/sys/dev/isci/scil/sati_types.h (props changed) stable/8/sys/dev/isci/scil/sati_unmap.c (props changed) stable/8/sys/dev/isci/scil/sati_unmap.h (props changed) stable/8/sys/dev/isci/scil/sati_util.c (props changed) stable/8/sys/dev/isci/scil/sati_util.h (props changed) stable/8/sys/dev/isci/scil/sati_verify.c (props changed) stable/8/sys/dev/isci/scil/sati_verify.h (props changed) stable/8/sys/dev/isci/scil/sati_write.c (props changed) stable/8/sys/dev/isci/scil/sati_write.h (props changed) stable/8/sys/dev/isci/scil/sati_write_and_verify.c (props changed) stable/8/sys/dev/isci/scil/sati_write_and_verify.h (props changed) stable/8/sys/dev/isci/scil/sati_write_buffer.c (props changed) stable/8/sys/dev/isci/scil/sati_write_buffer.h (props changed) stable/8/sys/dev/isci/scil/sati_write_long.c (props changed) stable/8/sys/dev/isci/scil/sati_write_long.h (props changed) stable/8/sys/dev/isci/scil/sci_abstract_list.c (props changed) stable/8/sys/dev/isci/scil/sci_abstract_list.h (props changed) stable/8/sys/dev/isci/scil/sci_base_controller.c (props changed) stable/8/sys/dev/isci/scil/sci_base_controller.h (props changed) stable/8/sys/dev/isci/scil/sci_base_domain.c (props changed) stable/8/sys/dev/isci/scil/sci_base_domain.h (props changed) stable/8/sys/dev/isci/scil/sci_base_iterator.c (props changed) stable/8/sys/dev/isci/scil/sci_base_iterator.h (props changed) stable/8/sys/dev/isci/scil/sci_base_library.c (props changed) stable/8/sys/dev/isci/scil/sci_base_library.h (props changed) stable/8/sys/dev/isci/scil/sci_base_logger.c (props changed) stable/8/sys/dev/isci/scil/sci_base_logger.h (props changed) stable/8/sys/dev/isci/scil/sci_base_memory_descriptor_list.c (props changed) stable/8/sys/dev/isci/scil/sci_base_memory_descriptor_list.h (props changed) stable/8/sys/dev/isci/scil/sci_base_memory_descriptor_list_decorator.c (props changed) stable/8/sys/dev/isci/scil/sci_base_object.c (props changed) stable/8/sys/dev/isci/scil/sci_base_object.h (props changed) stable/8/sys/dev/isci/scil/sci_base_observer.c (props changed) stable/8/sys/dev/isci/scil/sci_base_observer.h (props changed) stable/8/sys/dev/isci/scil/sci_base_phy.c (props changed) stable/8/sys/dev/isci/scil/sci_base_phy.h (props changed) stable/8/sys/dev/isci/scil/sci_base_port.c (props changed) stable/8/sys/dev/isci/scil/sci_base_port.h (props changed) stable/8/sys/dev/isci/scil/sci_base_remote_device.c (props changed) stable/8/sys/dev/isci/scil/sci_base_remote_device.h (props changed) stable/8/sys/dev/isci/scil/sci_base_request.c (props changed) stable/8/sys/dev/isci/scil/sci_base_request.h (props changed) stable/8/sys/dev/isci/scil/sci_base_state.h (props changed) stable/8/sys/dev/isci/scil/sci_base_state_machine.c (props changed) stable/8/sys/dev/isci/scil/sci_base_state_machine.h (props changed) stable/8/sys/dev/isci/scil/sci_base_state_machine_logger.c (props changed) stable/8/sys/dev/isci/scil/sci_base_state_machine_logger.h (props changed) stable/8/sys/dev/isci/scil/sci_base_state_machine_observer.c (props changed) stable/8/sys/dev/isci/scil/sci_base_state_machine_observer.h (props changed) stable/8/sys/dev/isci/scil/sci_base_subject.c (props changed) stable/8/sys/dev/isci/scil/sci_base_subject.h (props changed) stable/8/sys/dev/isci/scil/sci_controller.h (props changed) stable/8/sys/dev/isci/scil/sci_controller_constants.h (props changed) stable/8/sys/dev/isci/scil/sci_fast_list.h (props changed) stable/8/sys/dev/isci/scil/sci_iterator.h (props changed) stable/8/sys/dev/isci/scil/sci_library.h (props changed) stable/8/sys/dev/isci/scil/sci_logger.h (props changed) stable/8/sys/dev/isci/scil/sci_memory_descriptor_list.h (props changed) stable/8/sys/dev/isci/scil/sci_memory_descriptor_list_decorator.h (props changed) stable/8/sys/dev/isci/scil/sci_object.h (props changed) stable/8/sys/dev/isci/scil/sci_overview.h (props changed) stable/8/sys/dev/isci/scil/sci_pool.h (props changed) stable/8/sys/dev/isci/scil/sci_simple_list.h (props changed) stable/8/sys/dev/isci/scil/sci_status.h (props changed) stable/8/sys/dev/isci/scil/sci_types.h (props changed) stable/8/sys/dev/isci/scil/sci_util.c (props changed) stable/8/sys/dev/isci/scil/sci_util.h (props changed) stable/8/sys/dev/isci/scil/scic_config_parameters.h (props changed) stable/8/sys/dev/isci/scil/scic_controller.h (props changed) stable/8/sys/dev/isci/scil/scic_io_request.h (props changed) stable/8/sys/dev/isci/scil/scic_library.h (props changed) stable/8/sys/dev/isci/scil/scic_logger.h (props changed) stable/8/sys/dev/isci/scil/scic_overview.h (props changed) stable/8/sys/dev/isci/scil/scic_phy.h (props changed) stable/8/sys/dev/isci/scil/scic_port.h (props changed) stable/8/sys/dev/isci/scil/scic_remote_device.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_controller.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_controller_registers.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_library.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_library.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_logger.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_pci.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_pci.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_phy.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_phy.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_phy_registers.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_port.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_port.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_port_configuration_agent.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_port_configuration_agent.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_port_registers.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_remote_device.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_remote_device.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_remote_node_context.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_remote_node_context.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_remote_node_table.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_remote_node_table.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_request.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_request.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_sgpio.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_smp_remote_device.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_smp_request.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_smp_request.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_ssp_request.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_stp_packet_request.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_stp_packet_request.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_stp_pio_request.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_stp_remote_device.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_stp_request.h (props changed) stable/8/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.c (props changed) stable/8/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.h (props changed) stable/8/sys/dev/isci/scil/scic_sgpio.h (props changed) stable/8/sys/dev/isci/scil/scic_task_request.h (props changed) stable/8/sys/dev/isci/scil/scic_user_callback.h (props changed) stable/8/sys/dev/isci/scil/scif_config_parameters.h (props changed) stable/8/sys/dev/isci/scil/scif_controller.h (props changed) stable/8/sys/dev/isci/scil/scif_domain.h (props changed) stable/8/sys/dev/isci/scil/scif_io_request.h (props changed) stable/8/sys/dev/isci/scil/scif_library.h (props changed) stable/8/sys/dev/isci/scil/scif_logger.h (props changed) stable/8/sys/dev/isci/scil/scif_overview.h (props changed) stable/8/sys/dev/isci/scil/scif_remote_device.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_constants.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_controller.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_controller_states.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_design.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_domain.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_domain_state_handlers.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_domain_states.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_high_priority_request_queue.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_high_priority_request_queue.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_internal_io_request.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_internal_io_request.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_io_request.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_io_request_state_handlers.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_io_request_states.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_library.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_library.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_logger.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_remote_device.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_remote_device_ready_substate_handlers.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_remote_device_starting_substate_handlers.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_remote_device_starting_substates.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_remote_device_state_handlers.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_remote_device_states.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_request.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_request.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_sati_binding.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_smp_activity_clear_affiliation.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_smp_io_request.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_smp_phy.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_smp_phy.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_smp_remote_device.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_stp_io_request.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_stp_remote_device.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_stp_remote_device.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_stp_task_request.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_task_request.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_task_request.h (props changed) stable/8/sys/dev/isci/scil/scif_sas_task_request_state_handlers.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_task_request_states.c (props changed) stable/8/sys/dev/isci/scil/scif_sas_timer.c (props changed) stable/8/sys/dev/isci/scil/scif_task_request.h (props changed) stable/8/sys/dev/isci/scil/scif_user_callback.h (props changed) stable/8/sys/dev/isci/scil/scu_bios_definitions.h (props changed) stable/8/sys/dev/isci/scil/scu_completion_codes.h (props changed) stable/8/sys/dev/isci/scil/scu_constants.h (props changed) stable/8/sys/dev/isci/scil/scu_event_codes.h (props changed) stable/8/sys/dev/isci/scil/scu_registers.h (props changed) stable/8/sys/dev/isci/scil/scu_remote_node_context.h (props changed) stable/8/sys/dev/isci/scil/scu_task_context.h (props changed) stable/8/sys/dev/isci/scil/scu_unsolicited_frame.h (props changed) stable/8/sys/dev/isci/scil/scu_viit_data.h (props changed) stable/8/sys/dev/isci/types.h (props changed) Modified: stable/8/MAINTAINERS ============================================================================== --- stable/8/MAINTAINERS Tue Feb 14 15:28:19 2012 (r231687) +++ stable/8/MAINTAINERS Tue Feb 14 15:56:01 2012 (r231688) @@ -124,6 +124,7 @@ usr.bin/bluetooth emax Pre-commit review usr.sbin/bluetooth emax Pre-commit review preferred. gnu/usr.bin/send-pr bugmaster Pre-commit review requested. ncurses rafan Heads-up appreciated, try not to break it. +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/8/share/man/man4/Makefile ============================================================================== --- stable/8/share/man/man4/Makefile Tue Feb 14 15:28:19 2012 (r231687) +++ stable/8/share/man/man4/Makefile Tue Feb 14 15:56:01 2012 (r231688) @@ -171,6 +171,7 @@ MAN= aac.4 \ ipsec.4 \ ipw.4 \ ipwfw.4 \ + isci.4 \ iscsi_initiator.4 \ isp.4 \ ispfw.4 \ Copied: stable/8/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/8/share/man/man4/isci.4 Tue Feb 14 15:56:01 2012 (r231688, 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/8/sys/amd64/conf/GENERIC ============================================================================== --- stable/8/sys/amd64/conf/GENERIC Tue Feb 14 15:28:19 2012 (r231687) +++ stable/8/sys/amd64/conf/GENERIC Tue Feb 14 15:56:01 2012 (r231688) @@ -122,6 +122,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 # SCSI peripherals device scbus # SCSI bus (required for SCSI) Modified: stable/8/sys/amd64/conf/NOTES ============================================================================== --- stable/8/sys/amd64/conf/NOTES Tue Feb 14 15:28:19 2012 (r231687) +++ stable/8/sys/amd64/conf/NOTES Tue Feb 14 15:56:01 2012 (r231688) @@ -410,6 +410,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/8/sys/conf/files.amd64 ============================================================================== --- stable/8/sys/conf/files.amd64 Tue Feb 14 15:28:19 2012 (r231687) +++ stable/8/sys/conf/files.amd64 Tue Feb 14 15:56:01 2012 (r231688) @@ -240,6 +240,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/link_elf_obj.c standard Modified: stable/8/sys/conf/files.i386 ============================================================================== --- stable/8/sys/conf/files.i386 Tue Feb 14 15:28:19 2012 (r231687) +++ stable/8/sys/conf/files.i386 Tue Feb 14 15:56:01 2012 (r231688) @@ -247,6 +247,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/OsdEnvironment.c optional acpi i386/acpica/acpi_machdep.c optional acpi i386/acpica/acpi_wakeup.c optional acpi Modified: stable/8/sys/conf/options.amd64 ============================================================================== --- stable/8/sys/conf/options.amd64 Tue Feb 14 15:28:19 2012 (r231687) +++ stable/8/sys/conf/options.amd64 Tue Feb 14 15:56:01 2012 (r231688) @@ -64,3 +64,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/8/sys/conf/options.i386 ============================================================================== --- stable/8/sys/conf/options.i386 Tue Feb 14 15:28:19 2012 (r231687) +++ stable/8/sys/conf/options.i386 Tue Feb 14 15:56:01 2012 (r231688) @@ -119,3 +119,7 @@ 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/8/sys/dev/isci/isci.h ============================================================================== --- head/sys/dev/isci/isci.h Tue Jan 31 19:38:18 2012 (r230843) +++ stable/8/sys/dev/isci/isci.h Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/sys/dev/isci/isci_io_request.c ============================================================================== --- head/sys/dev/isci/isci_io_request.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/8/sys/dev/isci/isci_io_request.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/sys/dev/isci/isci_remote_device.c ============================================================================== --- head/sys/dev/isci/isci_remote_device.c Tue Jan 31 19:38:18 2012 (r230843) +++ stable/8/sys/dev/isci/isci_remote_device.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/sati_abort_task_set.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scic_sds_controller.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scic_sds_stp_request.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_controller.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_controller_state_handlers.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_domain.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_io_request.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_remote_device.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_smp_io_request.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_smp_remote_device.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_stp_io_request.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/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/8/sys/dev/isci/scil/scif_sas_stp_task_request.c Tue Feb 14 15:56:01 2012 (r231688) @@ -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/8/sys/i386/conf/GENERIC ============================================================================== --- stable/8/sys/i386/conf/GENERIC Tue Feb 14 15:28:19 2012 (r231687) +++ stable/8/sys/i386/conf/GENERIC Tue Feb 14 15:56:01 2012 (r231688) @@ -129,6 +129,7 @@ device bt # Buslogic/Mylex MultiMaster *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 14 16:47:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0CEB1065674; Tue, 14 Feb 2012 16:47:52 +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 BF1458FC1A; Tue, 14 Feb 2012 16:47:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1EGlqRe008368; Tue, 14 Feb 2012 16:47:52 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EGlqt0008366; Tue, 14 Feb 2012 16:47:52 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202141647.q1EGlqt0008366@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 14 Feb 2012 16:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231691 - stable/8/sys/dev/mps X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 16:47:52 -0000 Author: ken Date: Tue Feb 14 16:47:52 2012 New Revision: 231691 URL: http://svn.freebsd.org/changeset/base/231691 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/8/sys/dev/mps/mps_pci.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/mps/mps_pci.c ============================================================================== --- stable/8/sys/dev/mps/mps_pci.c Tue Feb 14 16:46:59 2012 (r231690) +++ stable/8/sys/dev/mps/mps_pci.c Tue Feb 14 16:47:52 2012 (r231691) @@ -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-8@FreeBSD.ORG Tue Feb 14 17:16:45 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B577E106579C; Tue, 14 Feb 2012 17:16: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 A365C8FC1B; Tue, 14 Feb 2012 17:16: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 q1EHGjpU009513; Tue, 14 Feb 2012 17:16:45 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EHGjqd009511; Tue, 14 Feb 2012 17:16:45 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201202141716.q1EHGjqd009511@svn.freebsd.org> From: Jim Harris Date: Tue, 14 Feb 2012 17:16:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231694 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 17:16:45 -0000 Author: jimharris Date: Tue Feb 14 17:16:45 2012 New Revision: 231694 URL: http://svn.freebsd.org/changeset/base/231694 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/8/share/man/man4/isci.4 (contents, props changed) Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/isci.4 ============================================================================== --- stable/8/share/man/man4/isci.4 Tue Feb 14 17:11:34 2012 (r231693) +++ stable/8/share/man/man4/isci.4 Tue Feb 14 17:16:45 2012 (r231694) @@ -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-8@FreeBSD.ORG Tue Feb 14 17:35:45 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 101E01065670; Tue, 14 Feb 2012 17:35:45 +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 F0E048FC18; Tue, 14 Feb 2012 17:35: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 q1EHZiQn010211; Tue, 14 Feb 2012 17:35:44 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EHZiju010205; Tue, 14 Feb 2012 17:35:44 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201202141735.q1EHZiju010205@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 14 Feb 2012 17:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231696 - in stable/8/sys: kern netgraph X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 17:35:45 -0000 Author: glebius Date: Tue Feb 14 17:35:44 2012 New Revision: 231696 URL: http://svn.freebsd.org/changeset/base/231696 Log: Merge netgraph related fixes and enhancements from head/. Revisions merged: r223754,224031,226829,229003,230213,230480, 230486-230487,231585. r223754 to ng_base: - Use refcount(9) API to manage node and hook refcounting. r224031 to ng_socket: In ng_attach_cntl() first allocate things that may fail, and then do the rest of initialization. This simplifies code and fixes a double free in failure scenario. r226829 to ng_base: - If KDB & NETGRAPH_DEBUG are on, print traces on discovered failed invariants. - Reduce tautology in NETGRAPH_DEBUG output. r229003 to ng_base: style(9), whitespace and spelling nits. r230213 to ng_socket: Remove some disabled NOTYET code. Probability of enabling it is low, if anyone wants, he/she can take it from svn. r230480 to 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 to hashinit(9): 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. r230487,r231585 to 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. Tested by: Eugene Grosbein, Mike Tancsa Modified: stable/8/sys/kern/kern_subr.c stable/8/sys/netgraph/netgraph.h stable/8/sys/netgraph/ng_base.c stable/8/sys/netgraph/ng_socket.c stable/8/sys/netgraph/ng_socketvar.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_subr.c ============================================================================== --- stable/8/sys/kern/kern_subr.c Tue Feb 14 17:18:45 2012 (r231695) +++ stable/8/sys/kern/kern_subr.c Tue Feb 14 17:35:44 2012 (r231696) @@ -373,9 +373,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)); @@ -416,8 +414,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); } @@ -436,8 +433,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/8/sys/netgraph/netgraph.h ============================================================================== --- stable/8/sys/netgraph/netgraph.h Tue Feb 14 17:18:45 2012 (r231695) +++ stable/8/sys/netgraph/netgraph.h Tue Feb 14 17:35:44 2012 (r231696) @@ -53,9 +53,11 @@ #include #include #include +#include #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_netgraph.h" +#include "opt_kdb.h" #endif /* debugging options */ @@ -137,7 +139,7 @@ struct ng_hook { * If you can't do it with these you probably shouldn;t be doing it. */ void ng_unref_hook(hook_p hook); /* don't move this */ -#define _NG_HOOK_REF(hook) atomic_add_int(&(hook)->hk_refs, 1) +#define _NG_HOOK_REF(hook) refcount_acquire(&(hook)->hk_refs) #define _NG_HOOK_NAME(hook) ((hook)->hk_name) #define _NG_HOOK_UNREF(hook) ng_unref_hook(hook) #define _NG_HOOK_SET_PRIVATE(hook, val) do {(hook)->hk_private = val;} while (0) @@ -189,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; @@ -400,7 +402,7 @@ int ng_unref_node(node_p node); /* don't #define _NG_NODE_NAME(node) ((node)->nd_name + 0) #define _NG_NODE_HAS_NAME(node) ((node)->nd_name[0] + 0) #define _NG_NODE_ID(node) ((node)->nd_ID + 0) -#define _NG_NODE_REF(node) atomic_add_int(&(node)->nd_refs, 1) +#define _NG_NODE_REF(node) refcount_acquire(&(node)->nd_refs) #define _NG_NODE_UNREF(node) ng_unref_node(node) #define _NG_NODE_SET_PRIVATE(node, val) do {(node)->nd_private = val;} while (0) #define _NG_NODE_PRIVATE(node) ((node)->nd_private) @@ -457,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/8/sys/netgraph/ng_base.c ============================================================================== --- stable/8/sys/netgraph/ng_base.c Tue Feb 14 17:18:45 2012 (r231695) +++ stable/8/sys/netgraph/ng_base.c Tue Feb 14 17:35:44 2012 (r231696) @@ -1,7 +1,3 @@ -/* - * ng_base.c - */ - /*- * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. @@ -54,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -61,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -167,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) \ @@ -192,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; \ @@ -202,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); @@ -330,18 +341,18 @@ ng_alloc_node(void) #define NG_FREE_HOOK(hook) \ do { \ - mtx_lock(&ng_nodelist_mtx); \ + mtx_lock(&ng_nodelist_mtx); \ LIST_INSERT_HEAD(&ng_freehooks, hook, hk_hooks); \ hook->hk_magic = 0; \ - mtx_unlock(&ng_nodelist_mtx); \ + mtx_unlock(&ng_nodelist_mtx); \ } while (0) #define NG_FREE_NODE(node) \ do { \ - mtx_lock(&ng_nodelist_mtx); \ + mtx_lock(&ng_nodelist_mtx); \ LIST_INSERT_HEAD(&ng_freenodes, node, nd_nodes); \ node->nd_magic = 0; \ - mtx_unlock(&ng_nodelist_mtx); \ + mtx_unlock(&ng_nodelist_mtx); \ } while (0) #else /* NETGRAPH_DEBUG */ /*----------------------------------------------*/ @@ -651,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 */ @@ -667,9 +678,9 @@ ng_make_node_common(struct ng_type *type break; } } - LIST_INSERT_HEAD(&V_ng_ID_hash[NG_IDHASH_FN(node->nd_ID)], - node, nd_idnodes); - mtx_unlock(&ng_idhash_mtx); + LIST_INSERT_HEAD(&V_ng_ID_hash[NG_IDHASH_FN(node->nd_ID)], node, + nd_idnodes); + IDHASH_WUNLOCK(); /* Done */ *nodepp = node; @@ -771,33 +782,39 @@ ng_rmnode(node_p node, hook_p dummy1, vo /* * Remove a reference to the node, possibly the last. * deadnode always acts as it it were the last. + * + * XXX: in head this function is void, since it isn't + * safe to trust its value. But for API compatibility + * here it is left int, and in case of non-last reference + * count it returns a large positive value. */ int ng_unref_node(node_p node) { - int v; - if (node == &ng_deadnode) { + if (node == &ng_deadnode) return (0); - } - - v = atomic_fetchadd_int(&node->nd_refs, -1); - if (v == 1) { /* we were the last */ + 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); + + /* XXX */ + return (0); } - return (v - 1); + + /* XXX */ + return (42); } /************************************************************************ @@ -807,11 +824,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); } @@ -826,7 +843,7 @@ ng_node2ID(node_p node) ************************************************************************/ /* - * Assign a node a name. Once assigned, the name cannot be changed. + * Assign a node a name. */ int ng_name_node(node_p node, const char *name) @@ -860,10 +877,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); } @@ -898,16 +915,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); } @@ -923,27 +939,21 @@ ng_decodeidname(const char *name) u_long val; /* Check for proper length, brackets, no leading junk */ - if ((len < 3) - || (name[0] != '[') - || (name[len - 1] != ']') - || (!isxdigit(name[1]))) { + if ((len < 3) || (name[0] != '[') || (name[len - 1] != ']') || + (!isxdigit(name[1]))) return ((ng_ID_t)0); - } /* Decode number */ val = strtoul(name + 1, &eptr, 16); - if ((eptr - name != len - 1) - || (val == ULONG_MAX) - || (val == 0)) { + if ((eptr - name != len - 1) || (val == ULONG_MAX) || (val == 0)) return ((ng_ID_t)0); - } - return (ng_ID_t)val; + + return ((ng_ID_t)val); } /* * Remove a name from a node. This should only be called * when shutting down and removing the node. - * IF we allow name changing this may be more resurrected. */ void ng_unname(node_p node) @@ -963,15 +973,11 @@ ng_unname(node_p node) void ng_unref_hook(hook_p hook) { - int v; - if (hook == &ng_deadhook) { + if (hook == &ng_deadhook) return; - } - - v = atomic_fetchadd_int(&hook->hk_refs, -1); - if (v == 1) { /* we were the last */ + if (refcount_release(&hook->hk_refs)) { /* we were the last */ if (_NG_HOOK_NODE(hook)) /* it'll probably be ng_deadnode */ _NG_NODE_UNREF((_NG_HOOK_NODE(hook))); NG_FREE_HOOK(hook); @@ -1051,8 +1057,8 @@ ng_findhook(node_p node, const char *nam if (node->nd_type->findhook != NULL) return (*node->nd_type->findhook)(node, name); LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { - if (NG_HOOK_IS_VALID(hook) - && (strcmp(NG_HOOK_NAME(hook), name) == 0)) + if (NG_HOOK_IS_VALID(hook) && + (strcmp(NG_HOOK_NAME(hook), name) == 0)) return (hook); } return (NULL); @@ -1188,12 +1194,12 @@ ng_newtype(struct ng_type *tp) const size_t namelen = strlen(tp->name); /* Check version and type name fields */ - if ((tp->version != NG_ABI_VERSION) - || (namelen == 0) - || (namelen >= NG_TYPESIZ)) { + if ((tp->version != NG_ABI_VERSION) || (namelen == 0) || + (namelen >= NG_TYPESIZ)) { TRAP_ERROR(); if (tp->version != NG_ABI_VERSION) { - printf("Netgraph: Node type rejected. ABI mismatch. Suggest recompile\n"); + printf("Netgraph: Node type rejected. ABI mismatch. " + "Suggest recompile\n"); } return (EINVAL); } @@ -1206,10 +1212,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); } @@ -1227,9 +1233,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); } @@ -1241,12 +1247,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); } @@ -1641,8 +1647,8 @@ ng_path_parse(char *addr, char **nodep, * return the destination node. */ int -ng_path2noderef(node_p here, const char *address, - node_p *destp, hook_p *lasthook) +ng_path2noderef(node_p here, const char *address, node_p *destp, + hook_p *lasthook) { char fullpath[NG_PATHSIZ]; char *nodename, *path; @@ -1721,10 +1727,9 @@ ng_path2noderef(node_p here, const char mtx_lock(&ng_topo_mtx); /* Can't get there from here... */ - if (hook == NULL - || NG_HOOK_PEER(hook) == NULL - || NG_HOOK_NOT_VALID(hook) - || NG_HOOK_NOT_VALID(NG_HOOK_PEER(hook))) { + if (hook == NULL || NG_HOOK_PEER(hook) == NULL || + NG_HOOK_NOT_VALID(hook) || + NG_HOOK_NOT_VALID(NG_HOOK_PEER(hook))) { TRAP_ERROR(); NG_NODE_UNREF(node); mtx_unlock(&ng_topo_mtx); @@ -1888,9 +1893,9 @@ ng_dequeue(node_p node, int *rw) long t = ngq->q_flags; if (t & WRITER_ACTIVE) { /* There is writer, reader can't proceed. */ - CTR4(KTR_NET, "%20s: node [%x] (%p) queued reader " - "can't proceed; queue flags 0x%lx", __func__, - node->nd_ID, node, t); + CTR4(KTR_NET, "%20s: node [%x] (%p) queued " + "reader can't proceed; queue flags 0x%lx", + __func__, node->nd_ID, node, t); return (NULL); } if (atomic_cmpset_acq_int(&ngq->q_flags, t, @@ -1906,9 +1911,9 @@ ng_dequeue(node_p node, int *rw) *rw = NGQRW_W; } else { /* There is somebody other, writer can't proceed. */ - CTR4(KTR_NET, "%20s: node [%x] (%p) queued writer " - "can't proceed; queue flags 0x%lx", __func__, - node->nd_ID, node, ngq->q_flags); + CTR4(KTR_NET, "%20s: node [%x] (%p) queued writer can't " + "proceed; queue flags 0x%lx", __func__, node->nd_ID, node, + ngq->q_flags); return (NULL); } @@ -1920,10 +1925,9 @@ ng_dequeue(node_p node, int *rw) STAILQ_REMOVE_HEAD(&ngq->queue, el_next); if (STAILQ_EMPTY(&ngq->queue)) atomic_clear_int(&ngq->q_flags, OP_PENDING); - CTR6(KTR_NET, "%20s: node [%x] (%p) returning item %p as %s; " - "queue flags 0x%lx", __func__, - node->nd_ID, node, item, *rw ? "WRITER" : "READER" , - ngq->q_flags); + CTR6(KTR_NET, "%20s: node [%x] (%p) returning item %p as %s; queue " + "flags 0x%lx", __func__, node->nd_ID, node, item, *rw ? "WRITER" : + "READER", ngq->q_flags); return (item); } @@ -1947,7 +1951,7 @@ ng_queue_rw(node_p node, item_p item, i CTR5(KTR_NET, "%20s: node [%x] (%p) queued item %p as %s", __func__, node->nd_ID, node, item, rw ? "WRITER" : "READER" ); - + /* * We can take the worklist lock with the node locked * BUT NOT THE REVERSE! @@ -1965,12 +1969,12 @@ ng_acquire_read(node_p node, item_p item ("%s: working on deadnode", __func__)); /* Reader needs node without writer and pending items. */ - while (1) { + for (;;) { long t = node->nd_input_queue.q_flags; if (t & NGQ_RMASK) break; /* Node is not ready for reader. */ - if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, - t, t + READER_INCREMENT)) { + if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, t, + t + READER_INCREMENT)) { /* Successfully grabbed node */ CTR4(KTR_NET, "%20s: node [%x] (%p) acquired item %p", __func__, node->nd_ID, node, item); @@ -1993,8 +1997,8 @@ ng_acquire_write(node_p node, item_p ite ("%s: working on deadnode", __func__)); /* Writer needs completely idle node. */ - if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, - 0, WRITER_ACTIVE)) { + if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, 0, + WRITER_ACTIVE)) { /* Successfully grabbed node */ CTR4(KTR_NET, "%20s: node [%x] (%p) acquired item %p", __func__, node->nd_ID, node, item); @@ -2038,11 +2042,10 @@ ng_upgrade_write(node_p node, item_p ite ng_apply_item(node, item, 0); /* - * Having acted on the item, atomically - * down grade back to READER and finish up + * Having acted on the item, atomically + * downgrade back to READER and finish up. */ - atomic_add_int(&ngq->q_flags, - READER_INCREMENT - WRITER_ACTIVE); + atomic_add_int(&ngq->q_flags, READER_INCREMENT - WRITER_ACTIVE); /* Our caller will call ng_leave_read() */ return; @@ -2210,11 +2213,10 @@ ng_snd_item(item_p item, int flags) size_t st, su, sl; GET_STACK_USAGE(st, su); sl = st - su; - if ((sl * 4 < st) || - ((sl * 2 < st) && ((node->nd_flags & NGF_HI_STACK) || - (hook && (hook->hk_flags & HK_HI_STACK))))) { + if ((sl * 4 < st) || ((sl * 2 < st) && + ((node->nd_flags & NGF_HI_STACK) || (hook && + (hook->hk_flags & HK_HI_STACK))))) queue = 1; - } #endif } @@ -2316,10 +2318,10 @@ ng_apply_item(node_p node, item_p item, } /* * If no receive method, just silently drop it. - * Give preference to the hook over-ride method + * Give preference to the hook over-ride method. */ - if ((!(rcvdata = hook->hk_rcvdata)) - && (!(rcvdata = NG_HOOK_NODE(hook)->nd_type->rcvdata))) { + if ((!(rcvdata = hook->hk_rcvdata)) && + (!(rcvdata = NG_HOOK_NODE(hook)->nd_type->rcvdata))) { error = 0; NG_FREE_ITEM(item); break; @@ -2539,8 +2541,8 @@ ng_generic_msg(node_p here, item_p item, hook_p hook; /* Get response struct */ - NG_MKRESPONSE(resp, msg, sizeof(*hl) - + (nhooks * sizeof(struct linkinfo)), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*hl) + + (nhooks * sizeof(struct linkinfo)), M_NOWAIT); if (resp == NULL) { error = ENOMEM; break; @@ -2588,7 +2590,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) { @@ -2598,12 +2600,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); + NG_MKRESPONSE(resp, msg, sizeof(*nl) + + (num * sizeof(struct nodeinfo)), M_NOWAIT); if (resp == NULL) { + NAMEHASH_RUNLOCK(); error = ENOMEM; break; } @@ -2611,7 +2613,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 = @@ -2621,20 +2622,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; } @@ -2644,17 +2642,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); + NG_MKRESPONSE(resp, msg, sizeof(*tl) + + (num * sizeof(struct typeinfo)), M_NOWAIT); if (resp == NULL) { + TYPELIST_RUNLOCK(); error = ENOMEM; break; } @@ -2662,20 +2659,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; } @@ -2708,16 +2700,16 @@ ng_generic_msg(node_p here, item_p item, bcopy(binary, ascii, sizeof(*binary)); /* Find command by matching typecookie and command number */ - for (c = here->nd_type->cmdlist; - c != NULL && c->name != NULL; c++) { - if (binary->header.typecookie == c->cookie - && binary->header.cmd == c->cmd) + for (c = here->nd_type->cmdlist; c != NULL && c->name != NULL; + c++) { + if (binary->header.typecookie == c->cookie && + binary->header.cmd == c->cmd) break; } if (c == NULL || c->name == NULL) { for (c = ng_generic_cmds; c->name != NULL; c++) { - if (binary->header.typecookie == c->cookie - && binary->header.cmd == c->cmd) + if (binary->header.typecookie == c->cookie && + binary->header.cmd == c->cmd) break; } if (c->name == NULL) { @@ -2811,8 +2803,8 @@ ng_generic_msg(node_p here, item_p item, if (argstype == NULL) { bufSize = 0; } else { - if ((error = ng_parse(argstype, ascii->data, - &off, (u_char *)binary->data, &bufSize)) != 0) { + if ((error = ng_parse(argstype, ascii->data, &off, + (u_char *)binary->data, &bufSize)) != 0) { NG_FREE_MSG(resp); break; } @@ -2843,7 +2835,7 @@ ng_generic_msg(node_p here, item_p item, } /* * Sometimes a generic message may be statically allocated - * to avoid problems with allocating when in tight memeory situations. + * to avoid problems with allocating when in tight memory situations. * Don't free it if it is so. * I break them appart here, because erros may cause a free if the item * in which case we'd be doing it twice. @@ -2877,7 +2869,7 @@ SYSCTL_INT(_net_graph, OID_AUTO, maxdata #ifdef NETGRAPH_DEBUG static TAILQ_HEAD(, ng_item) ng_itemlist = TAILQ_HEAD_INITIALIZER(ng_itemlist); -static int allocated; /* number of items malloc'd */ +static int allocated; /* number of items malloc'd */ #endif /* @@ -2895,7 +2887,7 @@ ng_alloc_item(int type, int flags) KASSERT(((type & ~NGQF_TYPE) == 0), ("%s: incorrect item type: %d", __func__, type)); - item = uma_zalloc((type == NGQF_DATA)?ng_qdzone:ng_qzone, + item = uma_zalloc((type == NGQF_DATA) ? ng_qdzone : ng_qzone, ((flags & NG_WAITOK) ? M_WAITOK : M_NOWAIT) | M_ZERO); if (item) { @@ -2951,8 +2943,8 @@ ng_free_item(item_p item) allocated--; mtx_unlock(&ngq_mtx); #endif - uma_zfree(((item->el_flags & NGQF_TYPE) == NGQF_DATA)? - ng_qdzone:ng_qzone, item); + uma_zfree(((item->el_flags & NGQF_TYPE) == NGQF_DATA) ? + ng_qdzone : ng_qzone, item); } /* @@ -2997,51 +2989,40 @@ int ng_mod_event(module_t mod, int event, void *data) { struct ng_type *const type = data; - int s, error = 0; + int error = 0; switch (event) { case MOD_LOAD: /* Register new netgraph node type */ - s = splnet(); - if ((error = ng_newtype(type)) != 0) { - splx(s); + if ((error = ng_newtype(type)) != 0) break; - } /* 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(); } - splx(s); break; case MOD_UNLOAD: - s = splnet(); if (type->refs > 1) { /* make sure no nodes exist! */ error = EBUSY; } else { - if (type->refs == 0) { - /* failed load, nothing to undo */ - splx(s); + if (type->refs == 0) /* failed load, nothing to undo */ break; - } if (type->mod_event != NULL) { /* check with type */ error = (*type->mod_event)(mod, event, data); - if (error != 0) { /* type refuses.. */ - splx(s); + if (error != 0) /* type refuses.. */ break; - } } - mtx_lock(&ng_typelist_mtx); + TYPELIST_WLOCK(); LIST_REMOVE(type, types); - mtx_unlock(&ng_typelist_mtx); + TYPELIST_WUNLOCK(); } - splx(s); break; default: @@ -3054,7 +3035,7 @@ ng_mod_event(module_t mod, int event, vo return (error); } -#ifdef VIMAGE +#ifdef VIMAGE static void vnet_netgraph_uninit(const void *unused __unused) { @@ -3063,7 +3044,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) { @@ -3074,14 +3055,14 @@ 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) { if (node == last_killed) { /* This should never happen */ - printf("ng node %s needs" - "NGF_REALLY_DIE\n", node->nd_name); + printf("ng node %s needs NGF_REALLY_DIE\n", + node->nd_name); if (node->nd_flags & NGF_REALLY_DIE) panic("ng node %s won't die", node->nd_name); @@ -3112,12 +3093,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 @@ -3129,8 +3107,9 @@ ngb_mod_event(module_t mod, int event, v ng_qzone = uma_zcreate("NetGraph items", sizeof(struct ng_item), NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0); uma_zone_set_max(ng_qzone, maxalloc); - ng_qdzone = uma_zcreate("NetGraph data items", sizeof(struct ng_item), - NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0); + ng_qdzone = uma_zcreate("NetGraph data items", + sizeof(struct ng_item), NULL, NULL, NULL, NULL, + UMA_ALIGN_CACHE, 0); uma_zone_set_max(ng_qdzone, maxdata); /* Autoconfigure number of threads. */ if (numthreads <= 0) @@ -3176,6 +3155,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 } } @@ -3190,6 +3172,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 } } @@ -3365,7 +3350,7 @@ ng_worklist_add(node_p node) * then put us on. */ node->nd_input_queue.q_flags2 |= NGQ2_WORKQ; - NG_NODE_REF(node); /* XXX fafe in mutex? */ + NG_NODE_REF(node); /* XXX safe in mutex? */ NG_WORKLIST_LOCK(); STAILQ_INSERT_TAIL(&ng_worklist, node, nd_input_queue.q_work); NG_WORKLIST_UNLOCK(); @@ -3493,8 +3478,7 @@ ng_address_hook(node_p here, item_p item * that the peer node is present, though maybe invalid. */ mtx_lock(&ng_topo_mtx); - if ((hook == NULL) || - NG_HOOK_NOT_VALID(hook) || + if ((hook == NULL) || NG_HOOK_NOT_VALID(hook) || NG_HOOK_NOT_VALID(peer = NG_HOOK_PEER(hook)) || NG_NODE_NOT_VALID(peernode = NG_PEER_NODE(hook))) { NG_FREE_ITEM(item); @@ -3786,4 +3770,3 @@ ng_macro_test(item_p item) NG_FWD_MSG_HOOK(error, node, item, hook, retaddr); } #endif /* TESTING */ - Modified: stable/8/sys/netgraph/ng_socket.c ============================================================================== --- stable/8/sys/netgraph/ng_socket.c Tue Feb 14 17:18:45 2012 (r231695) +++ stable/8/sys/netgraph/ng_socket.c Tue Feb 14 17:35:44 2012 (r231696) @@ -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; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 14 19:09:02 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81BFB1065686; Tue, 14 Feb 2012 19:09:02 +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 703398FC23; Tue, 14 Feb 2012 19:09: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 q1EJ92XX013663; Tue, 14 Feb 2012 19:09:02 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EJ92ob013661; Tue, 14 Feb 2012 19:09:02 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202141909.q1EJ92ob013661@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 14 Feb 2012 19:09:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231701 - stable/8/sbin/hastd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 19:09:02 -0000 Author: trociny Date: Tue Feb 14 19:09:01 2012 New Revision: 231701 URL: http://svn.freebsd.org/changeset/base/231701 Log: MFC r231525 (pjd): Nice range comparison. Modified: stable/8/sbin/hastd/rangelock.c Directory Properties: stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastd/rangelock.c ============================================================================== --- stable/8/sbin/hastd/rangelock.c Tue Feb 14 19:08:21 2012 (r231700) +++ stable/8/sbin/hastd/rangelock.c Tue Feb 14 19:09:01 2012 (r231701) @@ -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-8@FreeBSD.ORG Tue Feb 14 19:48:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2683106566B; Tue, 14 Feb 2012 19:48:57 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0F4E8FC0A; Tue, 14 Feb 2012 19:48: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 q1EJmvtq015136; Tue, 14 Feb 2012 19:48:57 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EJmv0L015134; Tue, 14 Feb 2012 19:48:57 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201202141948.q1EJmv0L015134@svn.freebsd.org> From: Kai Wang Date: Tue, 14 Feb 2012 19:48:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231703 - stable/8/lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 19:48:57 -0000 Author: kaiw Date: Tue Feb 14 19:48:57 2012 New Revision: 231703 URL: http://svn.freebsd.org/changeset/base/231703 Log: MFC r221595: For zero-sized sections, set the `d_buf` field of the `Elf_Data` descriptor returned by `elf_rawdata()` to NULL. Modified: stable/8/lib/libelf/elf_data.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_data.c ============================================================================== --- stable/8/lib/libelf/elf_data.c Tue Feb 14 19:36:35 2012 (r231702) +++ stable/8/lib/libelf/elf_data.c Tue Feb 14 19:48:57 2012 (r231703) @@ -223,7 +223,8 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = sh_type == SHT_NOBITS ? NULL : e->e_rawfile + sh_offset; + d->d_buf = (sh_type == SHT_NOBITS || sh_size == 0) ? NULL : + e->e_rawfile + sh_offset; d->d_off = 0; d->d_align = sh_align; d->d_size = sh_size; From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 14 19:49:07 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DABED1065676; Tue, 14 Feb 2012 19:49:07 +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 C59B08FC08; Tue, 14 Feb 2012 19:49: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 q1EJn7tL015210; Tue, 14 Feb 2012 19:49:07 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EJn77O015186; Tue, 14 Feb 2012 19:49:07 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202141949.q1EJn77O015186@svn.freebsd.org> From: Dimitry Andric Date: Tue, 14 Feb 2012 19:49:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231704 - in stable/8: 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-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 19:49:08 -0000 Author: dim Date: Tue Feb 14 19:49:06 2012 New Revision: 231704 URL: http://svn.freebsd.org/changeset/base/231704 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/8/include/rpc/Makefile stable/8/include/rpcsvc/Makefile stable/8/lib/libc/rpc/Makefile.inc stable/8/lib/libc/yp/Makefile.inc stable/8/lib/librpcsvc/Makefile stable/8/lib/libypclnt/Makefile stable/8/libexec/ypxfr/Makefile stable/8/release/picobsd/tinyware/passwd/Makefile stable/8/sys/conf/files stable/8/sys/modules/kgssapi/Makefile stable/8/sys/modules/kgssapi_krb5/Makefile stable/8/usr.sbin/amd/Makefile.inc stable/8/usr.sbin/bootparamd/bootparamd/Makefile stable/8/usr.sbin/bootparamd/callbootd/Makefile stable/8/usr.sbin/gssd/Makefile stable/8/usr.sbin/keyserv/Makefile stable/8/usr.sbin/rpc.lockd/Makefile stable/8/usr.sbin/rpc.statd/Makefile stable/8/usr.sbin/rpc.yppasswdd/Makefile stable/8/usr.sbin/rpc.ypupdated/Makefile stable/8/usr.sbin/rpc.ypxfrd/Makefile stable/8/usr.sbin/yppush/Makefile stable/8/usr.sbin/ypserv/Makefile Directory Properties: stable/8/include/ (props changed) stable/8/lib/libc/ (props changed) stable/8/lib/librpcsvc/ (props changed) stable/8/lib/libypclnt/ (props changed) stable/8/libexec/ypxfr/ (props changed) stable/8/release/picobsd/tinyware/passwd/ (props changed) stable/8/sys/ (props changed) stable/8/usr.sbin/amd/ (props changed) stable/8/usr.sbin/bootparamd/ (props changed) stable/8/usr.sbin/gssd/ (props changed) stable/8/usr.sbin/keyserv/ (props changed) stable/8/usr.sbin/rpc.lockd/ (props changed) stable/8/usr.sbin/rpc.statd/ (props changed) stable/8/usr.sbin/rpc.yppasswdd/ (props changed) stable/8/usr.sbin/rpc.ypupdated/ (props changed) stable/8/usr.sbin/rpc.ypxfrd/ (props changed) stable/8/usr.sbin/yppush/ (props changed) stable/8/usr.sbin/ypserv/ (props changed) Modified: stable/8/include/rpc/Makefile ============================================================================== --- stable/8/include/rpc/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/include/rpc/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -3,7 +3,7 @@ .SUFFIXES: .x -RPCCOM = rpcgen -C +RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -C HDRS= rpcb_prot.h Modified: stable/8/include/rpcsvc/Makefile ============================================================================== --- stable/8/include/rpcsvc/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/include/rpcsvc/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/lib/libc/rpc/Makefile.inc ============================================================================== --- stable/8/lib/libc/rpc/Makefile.inc Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/lib/libc/rpc/Makefile.inc Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/lib/libc/yp/Makefile.inc ============================================================================== --- stable/8/lib/libc/yp/Makefile.inc Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/lib/libc/yp/Makefile.inc Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/lib/librpcsvc/Makefile ============================================================================== --- stable/8/lib/librpcsvc/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/lib/librpcsvc/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/lib/libypclnt/Makefile ============================================================================== --- stable/8/lib/libypclnt/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/lib/libypclnt/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -23,7 +23,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/8/libexec/ypxfr/Makefile ============================================================================== --- stable/8/libexec/ypxfr/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/libexec/ypxfr/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -19,7 +19,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/8/release/picobsd/tinyware/passwd/Makefile ============================================================================== --- stable/8/release/picobsd/tinyware/passwd/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/release/picobsd/tinyware/passwd/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/sys/conf/files Tue Feb 14 19:49:06 2012 (r231704) @@ -2289,17 +2289,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/8/sys/modules/kgssapi/Makefile ============================================================================== --- stable/8/sys/modules/kgssapi/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/sys/modules/kgssapi/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/sys/modules/kgssapi_krb5/Makefile ============================================================================== --- stable/8/sys/modules/kgssapi_krb5/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/sys/modules/kgssapi_krb5/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/usr.sbin/amd/Makefile.inc ============================================================================== --- stable/8/usr.sbin/amd/Makefile.inc Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/amd/Makefile.inc Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/usr.sbin/bootparamd/bootparamd/Makefile ============================================================================== --- stable/8/usr.sbin/bootparamd/bootparamd/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/bootparamd/bootparamd/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/usr.sbin/bootparamd/callbootd/Makefile ============================================================================== --- stable/8/usr.sbin/bootparamd/callbootd/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/bootparamd/callbootd/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/usr.sbin/gssd/Makefile ============================================================================== --- stable/8/usr.sbin/gssd/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/gssd/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/usr.sbin/keyserv/Makefile ============================================================================== --- stable/8/usr.sbin/keyserv/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/keyserv/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/usr.sbin/rpc.lockd/Makefile ============================================================================== --- stable/8/usr.sbin/rpc.lockd/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/rpc.lockd/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/usr.sbin/rpc.statd/Makefile ============================================================================== --- stable/8/usr.sbin/rpc.statd/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/rpc.statd/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/usr.sbin/rpc.yppasswdd/Makefile ============================================================================== --- stable/8/usr.sbin/rpc.yppasswdd/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/rpc.yppasswdd/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -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/8/usr.sbin/rpc.ypupdated/Makefile ============================================================================== --- stable/8/usr.sbin/rpc.ypupdated/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/rpc.ypupdated/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -17,7 +17,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/8/usr.sbin/rpc.ypxfrd/Makefile ============================================================================== --- stable/8/usr.sbin/rpc.ypxfrd/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/rpc.ypxfrd/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -15,7 +15,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/8/usr.sbin/yppush/Makefile ============================================================================== --- stable/8/usr.sbin/yppush/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/yppush/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -12,7 +12,7 @@ GENSRCS=yp.h yp_clnt.c yppush_svc.c CFLAGS+= -I. -I${.CURDIR}/../../libexec/ypxfr -RPCGEN= rpcgen -C +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C CLEANFILES= ${GENSRCS} Modified: stable/8/usr.sbin/ypserv/Makefile ============================================================================== --- stable/8/usr.sbin/ypserv/Makefile Tue Feb 14 19:48:57 2012 (r231703) +++ stable/8/usr.sbin/ypserv/Makefile Tue Feb 14 19:49:06 2012 (r231704) @@ -15,7 +15,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-8@FreeBSD.ORG Tue Feb 14 19:50:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2B71106566B; Tue, 14 Feb 2012 19:50:41 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D166B8FC1B; Tue, 14 Feb 2012 19:50:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1EJoffm015368; Tue, 14 Feb 2012 19:50:41 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EJofuU015365; Tue, 14 Feb 2012 19:50:41 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201202141950.q1EJofuU015365@svn.freebsd.org> From: Kai Wang Date: Tue, 14 Feb 2012 19:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231706 - stable/8/lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 19:50:42 -0000 Author: kaiw Date: Tue Feb 14 19:50:41 2012 New Revision: 231706 URL: http://svn.freebsd.org/changeset/base/231706 Log: MFC r221598: Document the behavior of `elf_getdata()` and `elf_rawdata()` with zero-sized ELF sections. Modified: stable/8/lib/libelf/elf_getdata.3 Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_getdata.3 ============================================================================== --- stable/8/lib/libelf/elf_getdata.3 Tue Feb 14 19:49:36 2012 (r231705) +++ stable/8/lib/libelf/elf_getdata.3 Tue Feb 14 19:50:41 2012 (r231706) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006,2008,2010 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006,2008,2010-2011 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2010 +.Dd January 26, 2011 .Dt ELF_GETDATA 3 .Os .Sh NAME @@ -142,9 +142,10 @@ always returns .Vt Elf_Data structures of type .Dv ELF_T_BYTE . -.Ss Special handling of SHT_NOBITS sections +.Ss Special handling of zero-sized and SHT_NOBITS sections For sections of type -.Dv SHT_NOBITS , +.Dv SHT_NOBITS, +and for zero-sized sections, the functions .Fn elf_getdata and From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 14 22:49:35 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4096E1065675; Tue, 14 Feb 2012 22:49:35 +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 2C1AF8FC16; Tue, 14 Feb 2012 22:49:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1EMnZOq022859; Tue, 14 Feb 2012 22:49:35 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1EMnZ6S022850; Tue, 14 Feb 2012 22:49:35 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201202142249.q1EMnZ6S022850@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 14 Feb 2012 22:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231717 - in stable/8: share/man/man4 sys/conf sys/dev/netmap sys/net tools/tools/netmap X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 22:49:35 -0000 Author: luigi Date: Tue Feb 14 22:49:34 2012 New Revision: 231717 URL: http://svn.freebsd.org/changeset/base/231717 Log: MFC: bring in the core netmap code (disconnected from the build). As usual, device driver patches will come separately. Added: stable/8/share/man/man4/netmap.4 (contents, props changed) stable/8/sys/dev/netmap/ stable/8/sys/dev/netmap/if_em_netmap.h (contents, props changed) stable/8/sys/dev/netmap/if_igb_netmap.h (contents, props changed) stable/8/sys/dev/netmap/if_lem_netmap.h (contents, props changed) stable/8/sys/dev/netmap/if_re_netmap.h (contents, props changed) stable/8/sys/dev/netmap/ixgbe_netmap.h (contents, props changed) stable/8/sys/dev/netmap/netmap.c (contents, props changed) stable/8/sys/dev/netmap/netmap_kern.h (contents, props changed) stable/8/sys/net/netmap.h (contents, props changed) stable/8/sys/net/netmap_user.h (contents, props changed) stable/8/tools/tools/netmap/ stable/8/tools/tools/netmap/Makefile (contents, props changed) stable/8/tools/tools/netmap/README (contents, props changed) stable/8/tools/tools/netmap/bridge.c (contents, props changed) stable/8/tools/tools/netmap/click-test.cfg (contents, props changed) stable/8/tools/tools/netmap/pcap.c (contents, props changed) stable/8/tools/tools/netmap/pkt-gen.c (contents, props changed) Modified: stable/8/share/man/man4/Makefile stable/8/sys/conf/NOTES stable/8/sys/conf/files stable/8/sys/conf/options Modified: stable/8/share/man/man4/Makefile ============================================================================== --- stable/8/share/man/man4/Makefile Tue Feb 14 22:27:43 2012 (r231716) +++ stable/8/share/man/man4/Makefile Tue Feb 14 22:49:34 2012 (r231717) @@ -246,6 +246,7 @@ MAN= aac.4 \ net80211.4 \ netgraph.4 \ netintro.4 \ + netmap.4 \ ${_nfe.4} \ ${_nfsmb.4} \ ng_async.4 \ Added: stable/8/share/man/man4/netmap.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man4/netmap.4 Tue Feb 14 22:49:34 2012 (r231717) @@ -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/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Tue Feb 14 22:27:43 2012 (r231716) +++ stable/8/sys/conf/NOTES Tue Feb 14 22:49:34 2012 (r231717) @@ -780,6 +780,12 @@ device sppp # simultaneous BPF clients programs runnable. 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/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Tue Feb 14 22:27:43 2012 (r231716) +++ stable/8/sys/conf/files Tue Feb 14 22:49:34 2012 (r231717) @@ -1385,6 +1385,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 dev/nxge/xgehal/xgehal-device.c optional nxge Modified: stable/8/sys/conf/options ============================================================================== --- stable/8/sys/conf/options Tue Feb 14 22:27:43 2012 (r231716) +++ stable/8/sys/conf/options Tue Feb 14 22:49:34 2012 (r231717) @@ -680,6 +680,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_PTY opt_tty.h Added: stable/8/sys/dev/netmap/if_em_netmap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/netmap/if_em_netmap.h Tue Feb 14 22:49:34 2012 (r231717) @@ -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/8/sys/dev/netmap/if_igb_netmap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/netmap/if_igb_netmap.h Tue Feb 14 22:49:34 2012 (r231717) @@ -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-8@FreeBSD.ORG Wed Feb 15 01:40:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 550541065672; Wed, 15 Feb 2012 01:40:15 +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 3DC258FC08; Wed, 15 Feb 2012 01:40: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 q1F1eFux028908; Wed, 15 Feb 2012 01:40:15 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F1eFQo028897; Wed, 15 Feb 2012 01:40:15 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201202150140.q1F1eFQo028897@svn.freebsd.org> From: Glen Barber Date: Wed, 15 Feb 2012 01:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231719 - in stable/8/share/man: man4 man5 man7 man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 01:40:15 -0000 Author: gjb (doc committer) Date: Wed Feb 15 01:40:14 2012 New Revision: 231719 URL: http://svn.freebsd.org/changeset/base/231719 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) - - lmc(4): Netgraph(4) -> netgraph(4) - - security(7): rc.conf(8) -> rc.conf(5) - - 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/8/share/man/man4/ada.4 stable/8/share/man/man4/cd.4 stable/8/share/man/man4/da.4 stable/8/share/man/man4/lmc.4 stable/8/share/man/man4/sbp.4 stable/8/share/man/man4/u3g.4 stable/8/share/man/man4/usb_quirk.4 stable/8/share/man/man5/portindex.5 stable/8/share/man/man7/security.7 stable/8/share/man/man9/DEVICE_PROBE.9 Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man4/ada.4 ============================================================================== --- stable/8/share/man/man4/ada.4 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man4/ada.4 Wed Feb 15 01:40:14 2012 (r231719) @@ -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/8/share/man/man4/cd.4 ============================================================================== --- stable/8/share/man/man4/cd.4 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man4/cd.4 Wed Feb 15 01:40:14 2012 (r231719) @@ -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/8/share/man/man4/da.4 ============================================================================== --- stable/8/share/man/man4/da.4 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man4/da.4 Wed Feb 15 01:40:14 2012 (r231719) @@ -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/8/share/man/man4/lmc.4 ============================================================================== --- stable/8/share/man/man4/lmc.4 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man4/lmc.4 Wed Feb 15 01:40:14 2012 (r231719) @@ -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/8/share/man/man4/sbp.4 ============================================================================== --- stable/8/share/man/man4/sbp.4 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man4/sbp.4 Wed Feb 15 01:40:14 2012 (r231719) @@ -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/8/share/man/man4/u3g.4 ============================================================================== --- stable/8/share/man/man4/u3g.4 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man4/u3g.4 Wed Feb 15 01:40:14 2012 (r231719) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 7, 2008 +.Dd February 8, 2012 .Dt U3G 4 .Os .Sh NAME @@ -87,7 +87,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 @@ -96,7 +96,7 @@ and .Xr ucom 4 , .Xr usb 4 , .Xr usb_quirk 4 , -.Xr usbconfig 5 +.Xr usbconfig 8 .Sh HISTORY The .Nm Modified: stable/8/share/man/man4/usb_quirk.4 ============================================================================== --- stable/8/share/man/man4/usb_quirk.4 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man4/usb_quirk.4 Wed Feb 15 01:40:14 2012 (r231719) @@ -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/8/share/man/man5/portindex.5 ============================================================================== --- stable/8/share/man/man5/portindex.5 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man5/portindex.5 Wed Feb 15 01:40:14 2012 (r231719) @@ -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/8/share/man/man7/security.7 ============================================================================== --- stable/8/share/man/man7/security.7 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man7/security.7 Wed Feb 15 01:40:14 2012 (r231719) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 8, 2006 +.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/8/share/man/man9/DEVICE_PROBE.9 ============================================================================== --- stable/8/share/man/man9/DEVICE_PROBE.9 Wed Feb 15 01:39:04 2012 (r231718) +++ stable/8/share/man/man9/DEVICE_PROBE.9 Wed Feb 15 01:40:14 2012 (r231719) @@ -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-8@FreeBSD.ORG Wed Feb 15 01:53:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 088811065687; Wed, 15 Feb 2012 01:53:47 +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 7E2A98FC2A; Wed, 15 Feb 2012 01:53: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 q1F1rkOd029531; Wed, 15 Feb 2012 01:53:46 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F1rki6029527; Wed, 15 Feb 2012 01:53:46 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201202150153.q1F1rki6029527@svn.freebsd.org> From: Glen Barber Date: Wed, 15 Feb 2012 01:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231722 - in stable/8: etc/defaults etc/periodic/daily share/man/man5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 01:53:47 -0000 Author: gjb (doc committer) Date: Wed Feb 15 01:53:46 2012 New Revision: 231722 URL: http://svn.freebsd.org/changeset/base/231722 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/8/etc/defaults/periodic.conf stable/8/etc/periodic/daily/404.status-zfs stable/8/share/man/man5/periodic.conf.5 Directory Properties: stable/8/etc/ (props changed) stable/8/share/man/man5/ (props changed) Modified: stable/8/etc/defaults/periodic.conf ============================================================================== --- stable/8/etc/defaults/periodic.conf Wed Feb 15 01:52:59 2012 (r231721) +++ stable/8/etc/defaults/periodic.conf Wed Feb 15 01:53:46 2012 (r231722) @@ -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/8/etc/periodic/daily/404.status-zfs ============================================================================== --- stable/8/etc/periodic/daily/404.status-zfs Wed Feb 15 01:52:59 2012 (r231721) +++ stable/8/etc/periodic/daily/404.status-zfs Wed Feb 15 01:53:46 2012 (r231722) @@ -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/8/share/man/man5/periodic.conf.5 ============================================================================== --- stable/8/share/man/man5/periodic.conf.5 Wed Feb 15 01:52:59 2012 (r231721) +++ stable/8/share/man/man5/periodic.conf.5 Wed Feb 15 01:53:46 2012 (r231722) @@ -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-8@FreeBSD.ORG Wed Feb 15 03:34:45 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AAE6106564A; Wed, 15 Feb 2012 03:34:45 +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 436168FC13; Wed, 15 Feb 2012 03:34: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 q1F3YjlL033381; Wed, 15 Feb 2012 03:34:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F3Yj9L033379; Wed, 15 Feb 2012 03:34:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150334.q1F3Yj9L033379@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 03:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231726 - stable/8/sys/dev/et X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 03:34:45 -0000 Author: yongari Date: Wed Feb 15 03:34:44 2012 New Revision: 231726 URL: http://svn.freebsd.org/changeset/base/231726 Log: MFC r229940: style. No functional changes. Modified: stable/8/sys/dev/et/if_et.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Wed Feb 15 03:33:48 2012 (r231725) +++ stable/8/sys/dev/et/if_et.c Wed Feb 15 03:34:44 2012 (r231726) @@ -364,8 +364,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); @@ -402,8 +403,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); @@ -413,10 +415,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); @@ -456,10 +459,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); @@ -594,10 +598,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) mii_phy_reset(miisc); return (mii_mediachg(mii)); @@ -606,9 +612,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); @@ -639,10 +646,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); @@ -758,6 +766,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 | @@ -1164,10 +1173,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) @@ -1269,10 +1279,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) { @@ -1296,6 +1310,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; @@ -1425,8 +1440,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); @@ -1457,6 +1473,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); @@ -1471,6 +1488,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); @@ -1599,10 +1617,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. @@ -1717,8 +1736,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; @@ -1731,12 +1750,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); @@ -1787,8 +1808,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); @@ -1800,6 +1821,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); @@ -1807,6 +1829,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)); @@ -1822,8 +1845,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 */ @@ -1859,6 +1882,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); @@ -1874,8 +1899,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; @@ -1893,6 +1918,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]; @@ -1959,6 +1986,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); @@ -1977,12 +2005,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); @@ -1998,6 +2026,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); } @@ -2275,10 +2304,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); @@ -2540,10 +2570,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) @@ -2565,10 +2597,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-8@FreeBSD.ORG Wed Feb 15 03:43:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C05441065677; Wed, 15 Feb 2012 03:43: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 3A0D98FC1A; Wed, 15 Feb 2012 03:43: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 q1F3h4KJ033813; Wed, 15 Feb 2012 03:43:04 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F3h4ll033811; Wed, 15 Feb 2012 03:43:04 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150343.q1F3h4ll033811@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 03:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231729 - stable/8/sys/dev/re X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 03:43:04 -0000 Author: yongari Date: Wed Feb 15 03:43:03 2012 New Revision: 231729 URL: http://svn.freebsd.org/changeset/base/231729 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/8/sys/dev/re/if_re.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/re/if_re.c ============================================================================== --- stable/8/sys/dev/re/if_re.c Wed Feb 15 03:41:48 2012 (r231728) +++ stable/8/sys/dev/re/if_re.c Wed Feb 15 03:43:03 2012 (r231729) @@ -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-8@FreeBSD.ORG Wed Feb 15 03:49:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7EFB1065673; Wed, 15 Feb 2012 03:49:50 +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 A229E8FC15; Wed, 15 Feb 2012 03:49: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 q1F3no23034177; Wed, 15 Feb 2012 03:49:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F3noPj034175; Wed, 15 Feb 2012 03:49:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150349.q1F3noPj034175@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 03:49:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231732 - stable/8/sys/dev/re X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 03:49:50 -0000 Author: yongari Date: Wed Feb 15 03:49:50 2012 New Revision: 231732 URL: http://svn.freebsd.org/changeset/base/231732 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/8/sys/dev/re/if_re.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/re/if_re.c ============================================================================== --- stable/8/sys/dev/re/if_re.c Wed Feb 15 03:48:22 2012 (r231731) +++ stable/8/sys/dev/re/if_re.c Wed Feb 15 03:49:50 2012 (r231732) @@ -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-8@FreeBSD.ORG Wed Feb 15 04:03:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B7BF10656D2; Wed, 15 Feb 2012 04:03: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 5B5C08FC15; Wed, 15 Feb 2012 04:03: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 q1F43ghq034910; Wed, 15 Feb 2012 04:03:42 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F43gID034907; Wed, 15 Feb 2012 04:03:42 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150403.q1F43gID034907@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 04:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231735 - stable/8/sys/dev/bge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 04:03:42 -0000 Author: yongari Date: Wed Feb 15 04:03:41 2012 New Revision: 231735 URL: http://svn.freebsd.org/changeset/base/231735 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/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Wed Feb 15 04:02:41 2012 (r231734) +++ stable/8/sys/dev/bge/if_bge.c Wed Feb 15 04:03:41 2012 (r231735) @@ -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/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Wed Feb 15 04:02:41 2012 (r231734) +++ stable/8/sys/dev/bge/if_bgereg.h Wed Feb 15 04:03:41 2012 (r231735) @@ -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-8@FreeBSD.ORG Wed Feb 15 04:09:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72455106567A; Wed, 15 Feb 2012 04:09:24 +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 5C2D18FC1B; Wed, 15 Feb 2012 04:09:24 +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 q1F49O9L035285; Wed, 15 Feb 2012 04:09:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F49OrO035283; Wed, 15 Feb 2012 04:09:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202150409.q1F49OrO035283@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 15 Feb 2012 04:09:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231738 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 04:09:24 -0000 Author: yongari Date: Wed Feb 15 04:09:23 2012 New Revision: 231738 URL: http://svn.freebsd.org/changeset/base/231738 Log: MFC r230288,230339: r230288: Document dev.bge.%d.msi_disable tunable. r230339: Reflect tunable name change made in r230337. Modified: stable/8/share/man/man4/bge.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/bge.4 ============================================================================== --- stable/8/share/man/man4/bge.4 Wed Feb 15 04:09:04 2012 (r231737) +++ stable/8/share/man/man4/bge.4 Wed Feb 15 04:09:23 2012 (r231738) @@ -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. Disabled 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-8@FreeBSD.ORG Wed Feb 15 05:35:37 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4EC71065672; Wed, 15 Feb 2012 05:35:37 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FE938FC0A; Wed, 15 Feb 2012 05:35: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 q1F5Zb9n039141; Wed, 15 Feb 2012 05:35:37 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F5ZbZs039139; Wed, 15 Feb 2012 05:35:37 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202150535.q1F5ZbZs039139@svn.freebsd.org> From: Kevin Lo Date: Wed, 15 Feb 2012 05:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231740 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 05:35:37 -0000 Author: kevlo Date: Wed Feb 15 05:35:37 2012 New Revision: 231740 URL: http://svn.freebsd.org/changeset/base/231740 Log: MFC r224703: In rtinit1(), before rtrequest1_fib() is called, info.rti_flags is initialized by flags (function argument) or-ed with ifa->ifa_flags. If both NIC has a loopback route to itself, so IFA_RTSELF is set on ifa(s). As IFA_RTSELF is defined by RTF_HOST, rtrequest1_fib() is called with RTF_HOST flag even if netmask is not NULL. Consequently, netmask is set to zero in rtrequest1_fib(), and request to add network route is changed under hands to request to add host route. Tested by: Andrew Boyer Submitted by: Svatopluk Kraus Modified: stable/8/sys/net/route.c Modified: stable/8/sys/net/route.c ============================================================================== --- stable/8/sys/net/route.c Wed Feb 15 04:09:43 2012 (r231739) +++ stable/8/sys/net/route.c Wed Feb 15 05:35:37 2012 (r231740) @@ -1483,7 +1483,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int */ bzero((caddr_t)&info, sizeof(info)); info.rti_ifa = ifa; - info.rti_flags = flags | ifa->ifa_flags; + info.rti_flags = flags | (ifa->ifa_flags & ~IFA_RTSELF); info.rti_info[RTAX_DST] = dst; /* * doing this for compatibility reasons From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 15 05:37:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A9221065670; Wed, 15 Feb 2012 05:37:42 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9B878FC22; Wed, 15 Feb 2012 05:37:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1F5bf97039243; Wed, 15 Feb 2012 05:37:41 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F5bfAx039241; Wed, 15 Feb 2012 05:37:41 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202150537.q1F5bfAx039241@svn.freebsd.org> From: Kevin Lo Date: Wed, 15 Feb 2012 05:37:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231741 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 05:37:42 -0000 Author: kevlo Date: Wed Feb 15 05:37:41 2012 New Revision: 231741 URL: http://svn.freebsd.org/changeset/base/231741 Log: MFC r224747: If RTF_HOST flag is specified, then we are interested in destination address. PR: kern/159600 Submitted by: Svatopluk Kraus Modified: stable/8/sys/netinet/in.c Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Wed Feb 15 05:35:37 2012 (r231740) +++ stable/8/sys/netinet/in.c Wed Feb 15 05:37:41 2012 (r231741) @@ -1043,7 +1043,7 @@ in_addprefix(struct in_ifaddr *target, i IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (rtinitflags(ia)) { - p = ia->ia_addr.sin_addr; + p = ia->ia_dstaddr.sin_addr; if (prefix.s_addr != p.s_addr) continue; From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 15 06:16:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2D75106566C; Wed, 15 Feb 2012 06:16:52 +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 BC7798FC12; Wed, 15 Feb 2012 06:16:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1F6Gqg7040584; Wed, 15 Feb 2012 06:16:52 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F6GqVf040582; Wed, 15 Feb 2012 06:16:52 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201202150616.q1F6GqVf040582@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 15 Feb 2012 06:16:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231742 - stable/8/sys/dev/netmap X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 06:16:52 -0000 Author: luigi Date: Wed Feb 15 06:16:52 2012 New Revision: 231742 URL: http://svn.freebsd.org/changeset/base/231742 Log: use 4096 instead of PAGE_SIZE to determine the initial size of the memory allocated for netmap. Apparently the previous value fails with an integer overflow on stable/8-IA64 (4M pages ? curious that it does not fail on stable/9 and head) Modified: stable/8/sys/dev/netmap/netmap.c Modified: stable/8/sys/dev/netmap/netmap.c ============================================================================== --- stable/8/sys/dev/netmap/netmap.c Wed Feb 15 05:37:41 2012 (r231741) +++ stable/8/sys/dev/netmap/netmap.c Wed Feb 15 06:16:52 2012 (r231742) @@ -133,7 +133,7 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, no_pen * At the moment the block is contiguous, but we can easily * restrict our demand to smaller units (16..64k) */ -#define NETMAP_MEMORY_SIZE (64 * 1024 * PAGE_SIZE) +#define NETMAP_MEMORY_SIZE (64 * 1024 * 4096) static void * netmap_malloc(size_t size, const char *msg); static void netmap_free(void *addr, const char *msg); From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 15 09:32:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B5CF1065674; Wed, 15 Feb 2012 09:32:41 +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 153BE8FC16; Wed, 15 Feb 2012 09:32:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1F9WewZ047320; Wed, 15 Feb 2012 09:32:40 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F9WeXd047318; Wed, 15 Feb 2012 09:32:40 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201202150932.q1F9WeXd047318@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 15 Feb 2012 09:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231747 - stable/8/lib/libipsec X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 09:32:41 -0000 Author: bz Date: Wed Feb 15 09:32:40 2012 New Revision: 231747 URL: http://svn.freebsd.org/changeset/base/231747 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/8/lib/libipsec/pfkey.c Directory Properties: stable/8/lib/libipsec/ (props changed) Modified: stable/8/lib/libipsec/pfkey.c ============================================================================== --- stable/8/lib/libipsec/pfkey.c Wed Feb 15 09:32:20 2012 (r231746) +++ stable/8/lib/libipsec/pfkey.c Wed Feb 15 09:32:40 2012 (r231747) @@ -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-8@FreeBSD.ORG Wed Feb 15 09:53:20 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD2BF106564A; Wed, 15 Feb 2012 09:53:20 +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 C7CE68FC14; Wed, 15 Feb 2012 09:53: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 q1F9rKOV048223; Wed, 15 Feb 2012 09:53:20 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1F9rK80048220; Wed, 15 Feb 2012 09:53:20 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201202150953.q1F9rK80048220@svn.freebsd.org> From: Andriy Gapon Date: Wed, 15 Feb 2012 09:53:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231750 - stable/8/etc/rc.d X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 09:53:21 -0000 Author: avg Date: Wed Feb 15 09:53:20 2012 New Revision: 231750 URL: http://svn.freebsd.org/changeset/base/231750 Log: MFC r231563: start watchdogd before most of other daemons/servers Modified: stable/8/etc/rc.d/SERVERS stable/8/etc/rc.d/watchdogd Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.d/SERVERS ============================================================================== --- stable/8/etc/rc.d/SERVERS Wed Feb 15 09:52:09 2012 (r231749) +++ stable/8/etc/rc.d/SERVERS Wed Feb 15 09:53:20 2012 (r231750) @@ -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/8/etc/rc.d/watchdogd ============================================================================== --- stable/8/etc/rc.d/watchdogd Wed Feb 15 09:52:09 2012 (r231749) +++ stable/8/etc/rc.d/watchdogd Wed Feb 15 09:53:20 2012 (r231750) @@ -28,7 +28,7 @@ # # PROVIDE: watchdogd -# REQUIRE: DAEMON cleanvar +# REQUIRE: FILESYSTEMS cleanvar syslogd # KEYWORD: nojail shutdown . /etc/rc.subr From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 15 10:15:16 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7EE91065677; Wed, 15 Feb 2012 10:15:16 +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 87FB08FC0C; Wed, 15 Feb 2012 10:15: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 q1FAFGLl056049; Wed, 15 Feb 2012 10:15:16 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FAFGmj056046; Wed, 15 Feb 2012 10:15:16 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201202151015.q1FAFGmj056046@svn.freebsd.org> From: Max Khon Date: Wed, 15 Feb 2012 10:15:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231753 - stable/8/sys/netgraph X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 10:15:16 -0000 Author: fjoe Date: Wed Feb 15 10:15:15 2012 New Revision: 231753 URL: http://svn.freebsd.org/changeset/base/231753 Log: MFC r231543: - Use fixed-width integer types. - Prefer to use C99 stdint types. This fixes ng_cisco on 64-bit architectures. Modified: stable/8/sys/netgraph/ng_cisco.c stable/8/sys/netgraph/ng_cisco.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netgraph/ng_cisco.c ============================================================================== --- stable/8/sys/netgraph/ng_cisco.c Wed Feb 15 10:08:13 2012 (r231752) +++ stable/8/sys/netgraph/ng_cisco.c Wed Feb 15 10:15:15 2012 (r231753) @@ -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; @@ -273,7 +273,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; } @@ -604,7 +604,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); @@ -627,8 +627,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/8/sys/netgraph/ng_cisco.h ============================================================================== --- stable/8/sys/netgraph/ng_cisco.h Wed Feb 15 10:08:13 2012 (r231752) +++ stable/8/sys/netgraph/ng_cisco.h Wed Feb 15 10:15:15 2012 (r231753) @@ -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-8@FreeBSD.ORG Wed Feb 15 13:36:07 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B370106566C; Wed, 15 Feb 2012 13:36:07 +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 854D38FC22; Wed, 15 Feb 2012 13:36: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 q1FDa7E8064030; Wed, 15 Feb 2012 13:36:07 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FDa7Ul064028; Wed, 15 Feb 2012 13:36:07 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201202151336.q1FDa7Ul064028@svn.freebsd.org> From: Takahashi Yoshihiro Date: Wed, 15 Feb 2012 13:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231757 - stable/8/sys/pc98/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 13:36:07 -0000 Author: nyan Date: Wed Feb 15 13:36:06 2012 New Revision: 231757 URL: http://svn.freebsd.org/changeset/base/231757 Log: MFC: r231273 - Disable the olpt driver. Because it conflicts with the ppc/lpt driver. - Remove obsolete comment. Modified: stable/8/sys/pc98/conf/GENERIC Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/pc98/conf/GENERIC ============================================================================== --- stable/8/sys/pc98/conf/GENERIC Wed Feb 15 13:32:56 2012 (r231756) +++ stable/8/sys/pc98/conf/GENERIC Wed Feb 15 13:36:06 2012 (r231757) @@ -171,8 +171,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-8@FreeBSD.ORG Wed Feb 15 14:23:02 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 866291065670; Wed, 15 Feb 2012 14:23:02 +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 6B7398FC08; Wed, 15 Feb 2012 14:23: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 q1FEN21C065707; Wed, 15 Feb 2012 14:23:02 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FEN2Gj065696; Wed, 15 Feb 2012 14:23:02 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202151423.q1FEN2Gj065696@svn.freebsd.org> From: "Kenneth D. Merry" Date: Wed, 15 Feb 2012 14:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231759 - in stable/8: share/man/man4 sys/amd64/conf sys/conf sys/dev/acpica sys/dev/esp sys/dev/twa sys/dev/xen/balloon sys/dev/xen/blkback sys/dev/xen/blkfront sys/dev/xen/console sys... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 14:23:02 -0000 Author: ken Date: Wed Feb 15 14:23:01 2012 New Revision: 231759 URL: http://svn.freebsd.org/changeset/base/231759 Log: MFC r215818, r216405, r216437, r216448, r216956, r221827, r222975, r223059, r225343, r225704, r225705, r225706, r225707, r225709, r226029, r220647, r230183, r230587, r230916, r228526, r230879: Bring Xen support in stable/8 up to parity with head. Almost all outstanding Xen support differences between head and stable/8 are included, except for the just added r231743. r215818 | cperciva | 2010-11-25 08:05:21 -0700 (Thu, 25 Nov 2010) | 5 lines Rename HYPERVISOR_multicall (which performs the multicall hypercall) to _HYPERVISOR_multicall, and create a new HYPERVISOR_multicall function which invokes _HYPERVISOR_multicall and checks that the individual hypercalls all succeeded. r216405 | rwatson | 2010-12-13 05:15:46 -0700 (Mon, 13 Dec 2010) | 7 lines Add options NO_ADAPTIVE_SX to the XENHVM kernel configuration, matching its similar disabling of adaptive mutexes and rwlocks. The existing comment on why this is the case also applies to sx locks. MFC after: 3 days Discussed with: attilio r216437 | gibbs | 2010-12-14 10:23:49 -0700 (Tue, 14 Dec 2010) | 2 lines Remove spurious printf left over from debugging our XenStore support. r216448 | gibbs | 2010-12-14 13:57:40 -0700 (Tue, 14 Dec 2010) | 4 lines Fix a typo in a comment. Noticed by: Attila Nagy r216956 | rwatson | 2011-01-04 07:49:54 -0700 (Tue, 04 Jan 2011) | 8 lines Make "options XENHVM" compile for i386, not just amd64 -- a largely mechanical change. This opens the door for using PV device drivers under Xen HVM on i386, as well as more general harmonisation of i386 and amd64 Xen support in FreeBSD. Reviewed by: cperciva MFC after: 3 weeks r221827 | mav | 2011-05-12 21:40:16 -0600 (Thu, 12 May 2011) | 2 lines Fix msleep() usage in Xen balloon driver to not wake up on every HZ tick. r222975 | gibbs | 2011-06-10 22:59:01 -0600 (Fri, 10 Jun 2011) | 63 lines Monitor and emit events for XenStore changes to XenBus trees of the devices we manage. These changes can be due to writes we make ourselves or due to changes made by the control domain. The goal of these changes is to insure that all state transitions can be detected regardless of their source and to allow common device policies (e.g. "onlined" backend devices) to be centralized in the XenBus bus code. sys/xen/xenbus/xenbusvar.h: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbus_if.m: Add a new method for XenBus drivers "localend_changed". This method is invoked whenever a write is detected to a device's XenBus tree. The default implementation of this method is a no-op. sys/xen/xenbus/xenbus_if.m: sys/dev/xen/netfront/netfront.c: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: Change the signature of the "otherend_changed" method. This notification cannot fail, so it should return void. sys/xen/xenbus/xenbusb_back.c: Add "online" device handling to the XenBus Back Bus support code. An online backend device remains active after a front-end detaches as a reconnect is expected to occur in the near future. sys/xen/interface/io/xenbus.h: Add comment block further explaining the meaning and driver responsibilities associated with the XenBus Closed state. sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: sys/xen/xenbus/xenbusb_back.c: sys/xen/xenbus/xenbusb_front.c: sys/xen/xenbus/xenbusb_if.m: o Register a XenStore watch against the local XenBus tree for all devices. o Cache the string length of the path to our local tree. o Allow the xenbus front and back drivers to hook/filter both local and otherend watch processing. o Update the device ivar version of "state" when we detect a XenStore update of that node. sys/dev/xen/control/control.c: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: sys/xen/xenbus/xenbusvar.h: sys/xen/xenstore/xenstorevar.h: Allow clients of the XenStore watch mechanism to attach a single uintptr_t worth of client data to the watch. This removes the need to carefully place client watch data within enclosing objects so that a cast or offsetof calculation can be used to convert from watch to enclosing object. Sponsored by: Spectra Logic Corporation MFC after: 1 week r223059 | gibbs | 2011-06-13 14:36:29 -0600 (Mon, 13 Jun 2011) | 36 lines Several enhancements to the Xen block back driver. sys/dev/xen/blkback/blkback.c: o Implement front-end request coalescing. This greatly improves the performance of front-end clients that are unaware of the dynamic request-size/number of requests negotiation available in the FreeBSD backend driver. This required a large restructuring in how this driver records in-flight transactions and how those transactions are mapped into kernel KVA. For example, the driver now includes a mini "KVA manager" that allocates ranges of contiguous KVA to patches of requests that are physically contiguous in the backing store so that a single bio or UIO segment can be used to represent the I/O. o Refuse to open any backend files or devices if the system has yet to mount root. This avoids a panic. o Properly handle "onlined" devices. An "onlined" backend device stays attached to its backing store across front-end disconnections. This feature is intended to reduce latency when a front-end does a hand-off to another driver (e.g. PV aware bootloader to OS kernel) or during a VM reboot. o Harden the driver against a pathological/buggy front-end by carefully vetting front-end XenStore data such as the front-end state. o Add sysctls that report the negotiated number of segments per-request and the number of requests that can be concurrently in flight. Submitted by: kdm Reviewed by: gibbs Sponsored by: Spectra Logic Corporation MFC after: 1 week r225343 | rwatson | 2011-09-02 11:36:01 -0600 (Fri, 02 Sep 2011) | 7 lines Add support for alternative break-to-debugger support on the Xen console. This should help debug boot-time hangs experienced in 9.0-BETA. MFC after: 3 weeks Tested by: sbruno Approved by: re (kib) r225704 | gibbs | 2011-09-20 17:44:34 -0600 (Tue, 20 Sep 2011) | 29 lines Properly handle suspend/resume events in the Xen device framework. Sponsored by: BQ Internet sys/xen/xenbus/xenbusb.c: o In xenbusb_resume(), publish the state transition of the resuming device into XenbusStateIntiailising so that the remote peer can see it. Recording the state locally is not sufficient to trigger a re-connect sequence. o In xenbusb_resume(), defer new-bus resume processing until after the remote peer's XenStore address has been updated. The drivers may need to refer to this information during resume processing. sys/xen/xenbus/xenbusb_back.c: sys/xen/xenbus/xenbusb_front.c: Register xenbusb_resume() rather than bus_generic_resume() as the handler for device_resume events. sys/xen/xenstore/xenstore.c: o Fix grammer in a comment. o In xs_suspend(), pass suspend events on to the child devices (e.g. xenbusb_front/back, that are attached to the XenStore. Approved by: re MFC after: 1 week r225705 | gibbs | 2011-09-20 18:02:44 -0600 (Tue, 20 Sep 2011) | 35 lines Add suspend/resume support to the Xen blkfront driver. Sponsored by: BQ Internet sys/dev/xen/blkfront/block.h: sys/dev/xen/blkfront/blkfront.c: Remove now unused blkif_vdev_t from the blkfront soft. sys/dev/xen/blkfront/blkfront.c: o In blkfront_suspend(), indicate the desire to suspend by changing the softc connected state to SUSPENDED, and then wait for any I/O pending on the remote peer to drain. Cancel suspend processing if I/O does not drain within 30 seconds. o Enable and update blkfront_resume(). Since I/O is drained prior to the suspension of the VM, the complicated recovery process performed by other Xen blkfront implementations is avoided. We simply tear down the connection to our old peer, and then re-connect. o In blkif_initialize(), fix a resource leak and botched return if we cannot allocate shadow memory for our requests. o In blkfront_backend_changed(), correct our response to the XenbusStateInitialised state. This state indicates that our backend peer has published sufficient data for blkfront to publish ring information and other XenStore data, not that a connection can occur. Blkfront now will only perform connection processing in response to the XenbusStateConnected state. This corrects an issue where blkfront connected before the backend was ready during resume processing. Approved by: re MFC after: 1 week r225706 | gibbs | 2011-09-20 18:06:02 -0600 (Tue, 20 Sep 2011) | 11 lines [ Forced commit. Actual changes accidentally included in r225704 ] sys/dev/xen/control/control.c: Fix locking violations in Xen HVM suspend processing and have it perform similar actions to those performed during an ACPI triggered suspend. Sponsored by: BQ Internet Approved by: re MFC after: 1 week r225707 | gibbs | 2011-09-20 18:08:25 -0600 (Tue, 20 Sep 2011) | 21 lines Correct suspend/resume support in the Netfront driver. Sponsored by: BQ Internet sys/dev/xen/netfront/netfront.c: o Implement netfront_suspend(), a specialized suspend handler for the netfront driver. This routine simply disables the carrier so the driver is idle during system suspend processing. o Fix a leak when re-initializing LRO during a link reset. o In netif_release_tx_bufs(), when cleaning up the grant references for our TX ring, use gnttab_end_foreign_access_ref instead of attempting to grant the page again. o In netif_release_tx_bufs(), we do not track mbufs associated with mbuf chains, but instead just free each mbuf directly. Use m_free(), not m_freem(), to avoid double frees of mbufs. o Refactor some code to enhance clarity. Approved by: re MFC after: 1 week r225709 | gibbs | 2011-09-20 18:15:29 -0600 (Tue, 20 Sep 2011) | 19 lines Update netfront so that it queries and honors published back-end features. sys/dev/xen/netfront/netfront.c: o Add xn_query_features() which reads the XenStore and records the TSO, LRO, and chained ring-request support of the backend. o Rename xn_configure_lro() to xn_configure_features() and use this routine to manage the setup of TSO, LRO, and checksum offload. o In create_netdev(), initialize if_capabilities and if_hwassist to the capabilities found on all backends. Delegate configuration of if_capenable and the TSO flag if if_hwassist to xn_configure_features(). Reported by: Hugo Silva (fix inspired by patch provided) Approved by: re MFC after: 1 week r226029 | jkim | 2011-10-04 17:53:47 -0600 (Tue, 04 Oct 2011) | 2 lines Add strnlen() to libkern. r220647 | jkim | 2011-04-14 16:17:39 -0600 (Thu, 14 Apr 2011) | 4 lines Add event handlers for (ACPI) suspend/resume events. Suspend event handlers are invoked right before device drivers go into sleep state and resume event handlers are invoked right after all device drivers are waken up. r230183 | cperciva | 2012-01-15 19:38:45 -0700 (Sun, 15 Jan 2012) | 3 lines Make XENHVM work on i386. The __ffs() function counts bits starting from zero, unlike ffs(3), which starts counting from 1. 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 MFC after: 1 week 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 MFC after: 3 days r228526 | kevlo | 2011-12-14 23:29:13 -0700 (Wed, 14 Dec 2011) | 2 lines s/timout/timeout r230879 | ken | 2012-02-01 13:19:33 -0700 (Wed, 01 Feb 2012) | 4 lines Add the GSO prefix descriptor define. MFC after: 3 days Added: stable/8/share/man/man4/xnb.4 - copied unchanged from r230587, head/share/man/man4/xnb.4 stable/8/sys/dev/xen/netback/netback_unit_tests.c - copied unchanged from r230587, head/sys/dev/xen/netback/netback_unit_tests.c stable/8/sys/libkern/strnlen.c - copied unchanged from r226029, head/sys/libkern/strnlen.c Modified: stable/8/share/man/man4/Makefile stable/8/sys/amd64/conf/XENHVM stable/8/sys/conf/files stable/8/sys/dev/acpica/acpi.c stable/8/sys/dev/esp/ncr53c9x.c stable/8/sys/dev/twa/tw_osl.h stable/8/sys/dev/xen/balloon/balloon.c stable/8/sys/dev/xen/blkback/blkback.c stable/8/sys/dev/xen/blkfront/blkfront.c stable/8/sys/dev/xen/blkfront/block.h stable/8/sys/dev/xen/console/console.c stable/8/sys/dev/xen/control/control.c stable/8/sys/dev/xen/netback/netback.c stable/8/sys/dev/xen/netfront/netfront.c stable/8/sys/dev/xen/xenpci/evtchn.c stable/8/sys/i386/include/pcpu.h stable/8/sys/i386/include/pmap.h stable/8/sys/i386/include/xen/hypercall.h stable/8/sys/i386/include/xen/xen-os.h stable/8/sys/i386/include/xen/xenpmap.h stable/8/sys/i386/include/xen/xenvar.h stable/8/sys/i386/xen/xen_machdep.c stable/8/sys/kern/subr_scanf.c stable/8/sys/kern/uipc_mbuf.c stable/8/sys/sys/eventhandler.h stable/8/sys/sys/libkern.h stable/8/sys/xen/interface/io/netif.h stable/8/sys/xen/interface/io/xenbus.h stable/8/sys/xen/xenbus/xenbus.c stable/8/sys/xen/xenbus/xenbus_if.m stable/8/sys/xen/xenbus/xenbusb.c stable/8/sys/xen/xenbus/xenbusb.h stable/8/sys/xen/xenbus/xenbusb_back.c stable/8/sys/xen/xenbus/xenbusb_front.c stable/8/sys/xen/xenbus/xenbusb_if.m stable/8/sys/xen/xenbus/xenbusvar.h stable/8/sys/xen/xenstore/xenstore.c stable/8/sys/xen/xenstore/xenstorevar.h Directory Properties: stable/8/ (props changed) stable/8/share/ (props changed) stable/8/share/man/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/share/man/man4/Makefile ============================================================================== --- stable/8/share/man/man4/Makefile Wed Feb 15 13:40:10 2012 (r231758) +++ stable/8/share/man/man4/Makefile Wed Feb 15 14:23:01 2012 (r231759) @@ -508,6 +508,7 @@ MAN= aac.4 \ ${_xen.4} \ xhci.4 \ xl.4 \ + ${_xnb.4} \ xpt.4 \ zero.4 \ zyd.4 @@ -696,6 +697,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/8/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/8/share/man/man4/xnb.4 Wed Feb 15 14:23:01 2012 (r231759, 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/8/sys/amd64/conf/XENHVM ============================================================================== --- stable/8/sys/amd64/conf/XENHVM Wed Feb 15 13:40:10 2012 (r231758) +++ stable/8/sys/amd64/conf/XENHVM Wed Feb 15 14:23:01 2012 (r231759) @@ -17,6 +17,7 @@ makeoptions MODULES_OVERRIDE="" # options NO_ADAPTIVE_MUTEXES options NO_ADAPTIVE_RWLOCKS +options NO_ADAPTIVE_SX # Xen HVM support options XENHVM Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Wed Feb 15 13:40:10 2012 (r231758) +++ stable/8/sys/conf/files Wed Feb 15 14:23:01 2012 (r231759) @@ -2377,6 +2377,7 @@ libkern/strlcpy.c standard libkern/strlen.c standard libkern/strncmp.c standard libkern/strncpy.c standard +libkern/strnlen.c standard libkern/strsep.c standard libkern/strspn.c standard libkern/strstr.c standard @@ -3040,6 +3041,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/8/sys/dev/acpica/acpi.c ============================================================================== --- stable/8/sys/dev/acpica/acpi.c Wed Feb 15 13:40:10 2012 (r231758) +++ stable/8/sys/dev/acpica/acpi.c Wed Feb 15 14:23:01 2012 (r231759) @@ -2538,6 +2538,8 @@ acpi_EnterSleepState(struct acpi_softc * return_ACPI_STATUS (AE_OK); } + EVENTHANDLER_INVOKE(power_suspend); + if (smp_started) { thread_lock(curthread); sched_bind(curthread, 0); @@ -2629,6 +2631,8 @@ backout: thread_unlock(curthread); } + EVENTHANDLER_INVOKE(power_resume); + /* Allow another sleep request after a while. */ timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME); Modified: stable/8/sys/dev/esp/ncr53c9x.c ============================================================================== --- stable/8/sys/dev/esp/ncr53c9x.c Wed Feb 15 13:40:10 2012 (r231758) +++ stable/8/sys/dev/esp/ncr53c9x.c Wed Feb 15 14:23:01 2012 (r231759) @@ -316,7 +316,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *s * The recommended timeout is 250ms. This register is loaded * with a value calculated as follows, from the docs: * - * (timout period) x (CLK frequency) + * (timeout period) x (CLK frequency) * reg = ------------------------------------- * 8192 x (Clock Conversion Factor) * Modified: stable/8/sys/dev/twa/tw_osl.h ============================================================================== --- stable/8/sys/dev/twa/tw_osl.h Wed Feb 15 13:40:10 2012 (r231758) +++ stable/8/sys/dev/twa/tw_osl.h Wed Feb 15 14:23:01 2012 (r231759) @@ -153,7 +153,7 @@ struct twa_softc { struct mtx sim_lock_handle;/* sim lock shared with cam */ struct mtx *sim_lock;/* ptr to sim lock */ - struct callout watchdog_callout[2]; /* For command timout */ + struct callout watchdog_callout[2]; /* For command timeout */ TW_UINT32 watchdog_index; #ifdef TW_OSL_DEBUG Modified: stable/8/sys/dev/xen/balloon/balloon.c ============================================================================== --- stable/8/sys/dev/xen/balloon/balloon.c Wed Feb 15 13:40:10 2012 (r231758) +++ stable/8/sys/dev/xen/balloon/balloon.c Wed Feb 15 14:23:01 2012 (r231759) @@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include @@ -147,12 +147,6 @@ balloon_retrieve(void) return page; } -static void -balloon_alarm(void *unused) -{ - wakeup(balloon_process); -} - static unsigned long current_target(void) { @@ -378,6 +372,8 @@ balloon_process(void *unused) mtx_lock(&balloon_mutex); for (;;) { + int sleep_time; + do { credit = current_target() - bs.current_pages; if (credit > 0) @@ -389,9 +385,12 @@ balloon_process(void *unused) /* Schedule more work if there is some still to be done. */ if (current_target() != bs.current_pages) - timeout(balloon_alarm, NULL, ticks + hz); + sleep_time = hz; + else + sleep_time = 0; - msleep(balloon_process, &balloon_mutex, 0, "balloon", -1); + msleep(balloon_process, &balloon_mutex, 0, "balloon", + sleep_time); } mtx_unlock(&balloon_mutex); } @@ -474,9 +473,6 @@ balloon_init(void *arg) bs.hard_limit = ~0UL; kproc_create(balloon_process, NULL, NULL, 0, 0, "balloon"); -// init_timer(&balloon_timer); -// balloon_timer.data = 0; -// balloon_timer.function = balloon_alarm; #ifndef XENHVM /* Initialise the balloon with excess memory space. */ Modified: stable/8/sys/dev/xen/blkback/blkback.c ============================================================================== --- stable/8/sys/dev/xen/blkback/blkback.c Wed Feb 15 13:40:10 2012 (r231758) +++ stable/8/sys/dev/xen/blkback/blkback.c Wed Feb 15 14:23:01 2012 (r231759) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2010 Spectra Logic Corporation + * Copyright (c) 2009-2011 Spectra Logic Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include @@ -153,9 +155,19 @@ MALLOC_DEFINE(M_XENBLOCKBACK, "xbbd", "X #define XBB_MAX_RING_PAGES \ BLKIF_RING_PAGES(BLKIF_SEGS_TO_BLOCKS(XBB_MAX_SEGMENTS_PER_REQUEST) \ * XBB_MAX_REQUESTS) +/** + * The maximum number of ring pages that we can allow per request list. + * We limit this to the maximum number of segments per request, because + * that is already a reasonable number of segments to aggregate. This + * number should never be smaller than XBB_MAX_SEGMENTS_PER_REQUEST, + * because that would leave situations where we can't dispatch even one + * large request. + */ +#define XBB_MAX_SEGMENTS_PER_REQLIST XBB_MAX_SEGMENTS_PER_REQUEST /*--------------------------- Forward Declarations ---------------------------*/ struct xbb_softc; +struct xbb_xen_req; static void xbb_attach_failed(struct xbb_softc *xbb, int err, const char *fmt, ...) __attribute__((format(printf, 3, 4))); @@ -163,16 +175,15 @@ static int xbb_shutdown(struct xbb_soft static int xbb_detach(device_t dev); /*------------------------------ Data Structures -----------------------------*/ -/** - * \brief Object tracking an in-flight I/O from a Xen VBD consumer. - */ -struct xbb_xen_req { - /** - * Linked list links used to aggregate idle request in the - * request free pool (xbb->request_free_slist). - */ - SLIST_ENTRY(xbb_xen_req) links; +STAILQ_HEAD(xbb_xen_req_list, xbb_xen_req); + +typedef enum { + XBB_REQLIST_NONE = 0x00, + XBB_REQLIST_MAPPED = 0x01 +} xbb_reqlist_flags; + +struct xbb_xen_reqlist { /** * Back reference to the parent block back instance for this * request. Used during bio_done handling. @@ -180,17 +191,71 @@ struct xbb_xen_req { struct xbb_softc *xbb; /** - * The remote domain's identifier for this I/O request. + * BLKIF_OP code for this request. */ - uint64_t id; + int operation; + + /** + * Set to BLKIF_RSP_* to indicate request status. + * + * This field allows an error status to be recorded even if the + * delivery of this status must be deferred. Deferred reporting + * is necessary, for example, when an error is detected during + * completion processing of one bio when other bios for this + * request are still outstanding. + */ + int status; + + /** + * Number of 512 byte sectors not transferred. + */ + int residual_512b_sectors; + + /** + * Starting sector number of the first request in the list. + */ + off_t starting_sector_number; + + /** + * If we're going to coalesce, the next contiguous sector would be + * this one. + */ + off_t next_contig_sector; + + /** + * Number of child requests in the list. + */ + int num_children; + + /** + * Number of I/O requests dispatched to the backend. + */ + int pendcnt; + + /** + * Total number of segments for requests in the list. + */ + int nr_segments; + + /** + * Flags for this particular request list. + */ + xbb_reqlist_flags flags; /** * Kernel virtual address space reserved for this request - * structure and used to map the remote domain's pages for + * list structure and used to map the remote domain's pages for * this I/O, into our domain's address space. */ uint8_t *kva; + /** + * Base, psuedo-physical address, corresponding to the start + * of this request's kva region. + */ + uint64_t gnt_base; + + #ifdef XBB_USE_BOUNCE_BUFFERS /** * Pre-allocated domain local memory used to proxy remote @@ -200,53 +265,91 @@ struct xbb_xen_req { #endif /** - * Base, psuedo-physical address, corresponding to the start - * of this request's kva region. + * Array of grant handles (one per page) used to map this request. */ - uint64_t gnt_base; + grant_handle_t *gnt_handles; + + /** + * Device statistics request ordering type (ordered or simple). + */ + devstat_tag_type ds_tag_type; + + /** + * Device statistics request type (read, write, no_data). + */ + devstat_trans_flags ds_trans_type; + + /** + * The start time for this request. + */ + struct bintime ds_t0; + + /** + * Linked list of contiguous requests with the same operation type. + */ + struct xbb_xen_req_list contig_req_list; + + /** + * Linked list links used to aggregate idle requests in the + * request list free pool (xbb->reqlist_free_stailq) and pending + * requests waiting for execution (xbb->reqlist_pending_stailq). + */ + STAILQ_ENTRY(xbb_xen_reqlist) links; +}; + +STAILQ_HEAD(xbb_xen_reqlist_list, xbb_xen_reqlist); + +/** + * \brief Object tracking an in-flight I/O from a Xen VBD consumer. + */ +struct xbb_xen_req { + /** + * Linked list links used to aggregate requests into a reqlist + * and to store them in the request free pool. + */ + STAILQ_ENTRY(xbb_xen_req) links; + + /** + * The remote domain's identifier for this I/O request. + */ + uint64_t id; /** * The number of pages currently mapped for this request. */ - int nr_pages; + int nr_pages; /** * The number of 512 byte sectors comprising this requests. */ - int nr_512b_sectors; + int nr_512b_sectors; /** * The number of struct bio requests still outstanding for this * request on the backend device. This field is only used for * device (rather than file) backed I/O. */ - int pendcnt; + int pendcnt; /** * BLKIF_OP code for this request. */ - int operation; + int operation; /** - * BLKIF_RSP status code for this request. - * - * This field allows an error status to be recorded even if the - * delivery of this status must be deferred. Deferred reporting - * is necessary, for example, when an error is detected during - * completion processing of one bio when other bios for this - * request are still outstanding. + * Storage used for non-native ring requests. */ - int status; + blkif_request_t ring_req_storage; /** - * Device statistics request ordering type (ordered or simple). + * Pointer to the Xen request in the ring. */ - devstat_tag_type ds_tag_type; + blkif_request_t *ring_req; /** - * Device statistics request type (read, write, no_data). + * Consumer index for this request. */ - devstat_trans_flags ds_trans_type; + RING_IDX req_ring_idx; /** * The start time for this request. @@ -254,9 +357,9 @@ struct xbb_xen_req { struct bintime ds_t0; /** - * Array of grant handles (one per page) used to map this request. + * Pointer back to our parent request list. */ - grant_handle_t *gnt_handles; + struct xbb_xen_reqlist *reqlist; }; SLIST_HEAD(xbb_xen_req_slist, xbb_xen_req); @@ -321,7 +424,10 @@ typedef enum XBBF_RESOURCE_SHORTAGE = 0x04, /** Connection teardown in progress. */ - XBBF_SHUTDOWN = 0x08 + XBBF_SHUTDOWN = 0x08, + + /** A thread is already performing shutdown processing. */ + XBBF_IN_SHUTDOWN = 0x10 } xbb_flag_t; /** Backend device type. */ @@ -399,7 +505,7 @@ struct xbb_file_data { * Only a single file based request is outstanding per-xbb instance, * so we only need one of these. */ - struct iovec xiovecs[XBB_MAX_SEGMENTS_PER_REQUEST]; + struct iovec xiovecs[XBB_MAX_SEGMENTS_PER_REQLIST]; #ifdef XBB_USE_BOUNCE_BUFFERS /** @@ -411,7 +517,7 @@ struct xbb_file_data { * bounce-out the read data. This array serves as the temporary * storage for this saved data. */ - struct iovec saved_xiovecs[XBB_MAX_SEGMENTS_PER_REQUEST]; + struct iovec saved_xiovecs[XBB_MAX_SEGMENTS_PER_REQLIST]; /** * \brief Array of memoized bounce buffer kva offsets used @@ -422,7 +528,7 @@ struct xbb_file_data { * the request sg elements is unavoidable. We memoize the computed * bounce address here to reduce the cost of the second walk. */ - void *xiovecs_vaddr[XBB_MAX_SEGMENTS_PER_REQUEST]; + void *xiovecs_vaddr[XBB_MAX_SEGMENTS_PER_REQLIST]; #endif /* XBB_USE_BOUNCE_BUFFERS */ }; @@ -437,9 +543,9 @@ union xbb_backend_data { /** * Function signature of backend specific I/O handlers. */ -typedef int (*xbb_dispatch_t)(struct xbb_softc *xbb, blkif_request_t *ring_req, - struct xbb_xen_req *req, int nseg, - int operation, int flags); +typedef int (*xbb_dispatch_t)(struct xbb_softc *xbb, + struct xbb_xen_reqlist *reqlist, int operation, + int flags); /** * Per-instance configuration data. @@ -467,14 +573,23 @@ struct xbb_softc { xbb_dispatch_t dispatch_io; /** The number of requests outstanding on the backend device/file. */ - u_int active_request_count; + int active_request_count; /** Free pool of request tracking structures. */ - struct xbb_xen_req_slist request_free_slist; + struct xbb_xen_req_list request_free_stailq; /** Array, sized at connection time, of request tracking structures. */ struct xbb_xen_req *requests; + /** Free pool of request list structures. */ + struct xbb_xen_reqlist_list reqlist_free_stailq; + + /** List of pending request lists awaiting execution. */ + struct xbb_xen_reqlist_list reqlist_pending_stailq; + + /** Array, sized at connection time, of request list structures. */ + struct xbb_xen_reqlist *request_lists; + /** * Global pool of kva used for mapping remote domain ring * and I/O transaction data. @@ -487,6 +602,15 @@ struct xbb_softc { /** The size of the global kva pool. */ int kva_size; + /** The size of the KVA area used for request lists. */ + int reqlist_kva_size; + + /** The number of pages of KVA used for request lists */ + int reqlist_kva_pages; + + /** Bitmap of free KVA pages */ + bitstr_t *kva_free; + /** * \brief Cached value of the front-end's domain id. * @@ -508,12 +632,12 @@ struct xbb_softc { int abi; /** - * \brief The maximum number of requests allowed to be in - * flight at a time. + * \brief The maximum number of requests and request lists allowed + * to be in flight at a time. * * This value is negotiated via the XenStore. */ - uint32_t max_requests; + u_int max_requests; /** * \brief The maximum number of segments (1 page per segment) @@ -521,7 +645,15 @@ struct xbb_softc { * * This value is negotiated via the XenStore. */ - uint32_t max_request_segments; + u_int max_request_segments; + + /** + * \brief Maximum number of segments per request list. + * + * This value is derived from and will generally be larger than + * max_request_segments. + */ + u_int max_reqlist_segments; /** * The maximum size of any request to this back-end @@ -529,7 +661,13 @@ struct xbb_softc { * * This value is negotiated via the XenStore. */ - uint32_t max_request_size; + u_int max_request_size; + + /** + * The maximum size of any request list. This is derived directly + * from max_reqlist_segments. + */ + u_int max_reqlist_size; /** Various configuration and state bit flags. */ xbb_flag_t flags; @@ -574,6 +712,7 @@ struct xbb_softc { struct vnode *vn; union xbb_backend_data backend; + /** The native sector size of the backend. */ u_int sector_size; @@ -598,7 +737,14 @@ struct xbb_softc { * * Ring processing is serialized so we only need one of these. */ - struct xbb_sg xbb_sgs[XBB_MAX_SEGMENTS_PER_REQUEST]; + struct xbb_sg xbb_sgs[XBB_MAX_SEGMENTS_PER_REQLIST]; + + /** + * Temporary grant table map used in xbb_dispatch_io(). When + * XBB_MAX_SEGMENTS_PER_REQLIST gets large, keeping this on the + * stack could cause a stack overflow. + */ + struct gnttab_map_grant_ref maps[XBB_MAX_SEGMENTS_PER_REQLIST]; /** Mutex protecting per-instance data. */ struct mtx lock; @@ -614,8 +760,51 @@ struct xbb_softc { int pseudo_phys_res_id; #endif - /** I/O statistics. */ + /** + * I/O statistics from BlockBack dispatch down. These are + * coalesced requests, and we start them right before execution. + */ struct devstat *xbb_stats; + + /** + * I/O statistics coming into BlockBack. These are the requests as + * we get them from BlockFront. They are started as soon as we + * receive a request, and completed when the I/O is complete. + */ + struct devstat *xbb_stats_in; + + /** Disable sending flush to the backend */ + int disable_flush; + + /** Send a real flush for every N flush requests */ + int flush_interval; + + /** Count of flush requests in the interval */ + int flush_count; + + /** Don't coalesce requests if this is set */ + int no_coalesce_reqs; + + /** Number of requests we have received */ + uint64_t reqs_received; + + /** Number of requests we have completed*/ + uint64_t reqs_completed; + + /** How many forced dispatches (i.e. without coalescing) have happend */ + uint64_t forced_dispatch; + + /** How many normal dispatches have happend */ + uint64_t normal_dispatch; + + /** How many total dispatches have happend */ + uint64_t total_dispatch; + + /** How many times we have run out of KVA */ + uint64_t kva_shortages; + + /** How many times we have run out of request structures */ + uint64_t request_shortages; }; /*---------------------------- Request Processing ----------------------------*/ @@ -633,21 +822,14 @@ xbb_get_req(struct xbb_softc *xbb) struct xbb_xen_req *req; req = NULL; - mtx_lock(&xbb->lock); - /* - * Do not allow new requests to be allocated while we - * are shutting down. - */ - if ((xbb->flags & XBBF_SHUTDOWN) == 0) { - if ((req = SLIST_FIRST(&xbb->request_free_slist)) != NULL) { - SLIST_REMOVE_HEAD(&xbb->request_free_slist, links); - xbb->active_request_count++; - } else { - xbb->flags |= XBBF_RESOURCE_SHORTAGE; - } + mtx_assert(&xbb->lock, MA_OWNED); + + if ((req = STAILQ_FIRST(&xbb->request_free_stailq)) != NULL) { + STAILQ_REMOVE_HEAD(&xbb->request_free_stailq, links); + xbb->active_request_count++; } - mtx_unlock(&xbb->lock); + return (req); } @@ -660,34 +842,40 @@ xbb_get_req(struct xbb_softc *xbb) static inline void xbb_release_req(struct xbb_softc *xbb, struct xbb_xen_req *req) { - int wake_thread; + mtx_assert(&xbb->lock, MA_OWNED); - mtx_lock(&xbb->lock); - wake_thread = xbb->flags & XBBF_RESOURCE_SHORTAGE; - xbb->flags &= ~XBBF_RESOURCE_SHORTAGE; - SLIST_INSERT_HEAD(&xbb->request_free_slist, req, links); + STAILQ_INSERT_HEAD(&xbb->request_free_stailq, req, links); xbb->active_request_count--; - if ((xbb->flags & XBBF_SHUTDOWN) != 0) { - /* - * Shutdown is in progress. See if we can - * progress further now that one more request - * has completed and been returned to the - * free pool. - */ - xbb_shutdown(xbb); - } - mtx_unlock(&xbb->lock); + KASSERT(xbb->active_request_count >= 0, + ("xbb_release_req: negative active count")); +} - if (wake_thread != 0) - taskqueue_enqueue(xbb->io_taskqueue, &xbb->io_task); +/** + * Return an xbb_xen_req_list of allocated xbb_xen_reqs to the free pool. + * + * \param xbb Per-instance xbb configuration structure. + * \param req_list The list of requests to free. + * \param nreqs The number of items in the list. + */ +static inline void +xbb_release_reqs(struct xbb_softc *xbb, struct xbb_xen_req_list *req_list, + int nreqs) +{ + mtx_assert(&xbb->lock, MA_OWNED); + + STAILQ_CONCAT(&xbb->request_free_stailq, req_list); + xbb->active_request_count -= nreqs; + + KASSERT(xbb->active_request_count >= 0, + ("xbb_release_reqs: negative active count")); } /** * Given a page index and 512b sector offset within that page, * calculate an offset into a request's kva region. * - * \param req The request structure whose kva region will be accessed. + * \param reqlist The request structure whose kva region will be accessed. * \param pagenr The page index used to compute the kva offset. * \param sector The 512b sector index used to compute the page relative * kva offset. @@ -695,9 +883,9 @@ xbb_release_req(struct xbb_softc *xbb, s * \return The computed global KVA offset. */ static inline uint8_t * -xbb_req_vaddr(struct xbb_xen_req *req, int pagenr, int sector) +xbb_reqlist_vaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) { - return (req->kva + (PAGE_SIZE * pagenr) + (sector << 9)); + return (reqlist->kva + (PAGE_SIZE * pagenr) + (sector << 9)); } #ifdef XBB_USE_BOUNCE_BUFFERS @@ -705,7 +893,7 @@ xbb_req_vaddr(struct xbb_xen_req *req, i * Given a page index and 512b sector offset within that page, * calculate an offset into a request's local bounce memory region. * - * \param req The request structure whose bounce region will be accessed. + * \param reqlist The request structure whose bounce region will be accessed. * \param pagenr The page index used to compute the bounce offset. * \param sector The 512b sector index used to compute the page relative * bounce offset. @@ -713,9 +901,9 @@ xbb_req_vaddr(struct xbb_xen_req *req, i * \return The computed global bounce buffer address. */ static inline uint8_t * -xbb_req_bounce_addr(struct xbb_xen_req *req, int pagenr, int sector) +xbb_reqlist_bounce_addr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) { - return (req->bounce + (PAGE_SIZE * pagenr) + (sector << 9)); + return (reqlist->bounce + (PAGE_SIZE * pagenr) + (sector << 9)); } #endif @@ -724,7 +912,7 @@ xbb_req_bounce_addr(struct xbb_xen_req * * calculate an offset into the request's memory region that the * underlying backend device/file should use for I/O. * - * \param req The request structure whose I/O region will be accessed. + * \param reqlist The request structure whose I/O region will be accessed. * \param pagenr The page index used to compute the I/O offset. * \param sector The 512b sector index used to compute the page relative * I/O offset. @@ -736,12 +924,12 @@ xbb_req_bounce_addr(struct xbb_xen_req * * this request. */ static inline uint8_t * -xbb_req_ioaddr(struct xbb_xen_req *req, int pagenr, int sector) +xbb_reqlist_ioaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) { #ifdef XBB_USE_BOUNCE_BUFFERS - return (xbb_req_bounce_addr(req, pagenr, sector)); + return (xbb_reqlist_bounce_addr(reqlist, pagenr, sector)); #else - return (xbb_req_vaddr(req, pagenr, sector)); + return (xbb_reqlist_vaddr(reqlist, pagenr, sector)); #endif } @@ -750,7 +938,7 @@ xbb_req_ioaddr(struct xbb_xen_req *req, * an offset into the local psuedo-physical address space used to map a * front-end's request data into a request. * - * \param req The request structure whose pseudo-physical region + * \param reqlist The request list structure whose pseudo-physical region * will be accessed. * \param pagenr The page index used to compute the pseudo-physical offset. * \param sector The 512b sector index used to compute the page relative @@ -763,10 +951,126 @@ xbb_req_ioaddr(struct xbb_xen_req *req, * this request. */ static inline uintptr_t -xbb_req_gntaddr(struct xbb_xen_req *req, int pagenr, int sector) +xbb_get_gntaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector) { - return ((uintptr_t)(req->gnt_base - + (PAGE_SIZE * pagenr) + (sector << 9))); + struct xbb_softc *xbb; + + xbb = reqlist->xbb; + + return ((uintptr_t)(xbb->gnt_base_addr + + (uintptr_t)(reqlist->kva - xbb->kva) + + (PAGE_SIZE * pagenr) + (sector << 9))); +} + +/** + * Get Kernel Virtual Address space for mapping requests. + * + * \param xbb Per-instance xbb configuration structure. + * \param nr_pages Number of pages needed. + * \param check_only If set, check for free KVA but don't allocate it. + * \param have_lock If set, xbb lock is already held. + * + * \return On success, a pointer to the allocated KVA region. Otherwise NULL. + * + * Note: This should be unnecessary once we have either chaining or + * scatter/gather support for struct bio. At that point we'll be able to + * put multiple addresses and lengths in one bio/bio chain and won't need + * to map everything into one virtual segment. + */ +static uint8_t * +xbb_get_kva(struct xbb_softc *xbb, int nr_pages) +{ + intptr_t first_clear, num_clear; + uint8_t *free_kva; + int i; + + KASSERT(nr_pages != 0, ("xbb_get_kva of zero length")); + + first_clear = 0; + free_kva = NULL; + + mtx_lock(&xbb->lock); + + /* + * Look for the first available page. If there are none, we're done. + */ + bit_ffc(xbb->kva_free, xbb->reqlist_kva_pages, &first_clear); + + if (first_clear == -1) + goto bailout; + + /* + * Starting at the first available page, look for consecutive free + * pages that will satisfy the user's request. + */ + for (i = first_clear, num_clear = 0; i < xbb->reqlist_kva_pages; i++) { + /* + * If this is true, the page is used, so we have to reset + * the number of clear pages and the first clear page + * (since it pointed to a region with an insufficient number + * of clear pages). + */ + if (bit_test(xbb->kva_free, i)) { + num_clear = 0; + first_clear = -1; + continue; + } + + if (first_clear == -1) + first_clear = i; + + /* + * If this is true, we've found a large enough free region + * to satisfy the request. + */ + if (++num_clear == nr_pages) { + + bit_nset(xbb->kva_free, first_clear, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 15 14:31:46 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 763D4106567D; Wed, 15 Feb 2012 14:31:46 +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 60B108FC23; Wed, 15 Feb 2012 14:31: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 q1FEVkaL066185; Wed, 15 Feb 2012 14:31:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FEVkIF066183; Wed, 15 Feb 2012 14:31:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201202151431.q1FEVkIF066183@svn.freebsd.org> From: Alexander Motin Date: Wed, 15 Feb 2012 14:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231763 - stable/8/sys/dev/sound/pcm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 14:31:46 -0000 Author: mav Date: Wed Feb 15 14:31:45 2012 New Revision: 231763 URL: http://svn.freebsd.org/changeset/base/231763 Log: MFC r231762: 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/8/sys/dev/sound/pcm/sound.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pcm/sound.c ============================================================================== --- stable/8/sys/dev/sound/pcm/sound.c Wed Feb 15 14:30:04 2012 (r231762) +++ stable/8/sys/dev/sound/pcm/sound.c Wed Feb 15 14:31:45 2012 (r231763) @@ -1397,7 +1397,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; @@ -1406,6 +1405,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-8@FreeBSD.ORG Wed Feb 15 15:45:05 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 172E81065676; Wed, 15 Feb 2012 15:45:05 +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 B784E8FC17; Wed, 15 Feb 2012 15:45:04 +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 92AF5151D98; Wed, 15 Feb 2012 17:29:51 +0200 (EET) Date: Wed, 15 Feb 2012 17:29:49 +0200 From: Jaakko Heinonen To: Kevin Lo Message-ID: <20120215152949.GA2279@a91-153-116-96.elisa-laajakaista.fi> References: <201202150537.q1F5bfAx039241@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201202150537.q1F5bfAx039241@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-8@freebsd.org Subject: Re: svn commit: r231741 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 15:45:05 -0000 On 2012-02-15, Kevin Lo wrote: > Log: > MFC r224747: > > If RTF_HOST flag is specified, then we are interested in destination > address. > > PR: kern/159600 > Submitted by: Svatopluk Kraus > > Modified: > stable/8/sys/netinet/in.c It seems that that this commit didn't record mergeinfo. The same applies to r231740. -- Jaakko From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 15 16:58:09 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A46C106564A; Wed, 15 Feb 2012 16:58:09 +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 677C88FC15; Wed, 15 Feb 2012 16:58: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 q1FGw9HJ071325; Wed, 15 Feb 2012 16:58:09 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FGw97d071319; Wed, 15 Feb 2012 16:58:09 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201202151658.q1FGw97d071319@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 15 Feb 2012 16:58:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231769 - in stable/8: lib/libc/gen sys/net sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 16:58:09 -0000 Author: bz Date: Wed Feb 15 16:58:08 2012 New Revision: 231769 URL: http://svn.freebsd.org/changeset/base/231769 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. Modified: stable/8/lib/libc/gen/sysctl.3 stable/8/sys/net/if.h stable/8/sys/net/rtsock.c stable/8/sys/sys/param.h stable/8/sys/sys/socket.h Directory Properties: stable/8/lib/libc/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/lib/libc/gen/sysctl.3 ============================================================================== --- stable/8/lib/libc/gen/sysctl.3 Wed Feb 15 16:56:52 2012 (r231768) +++ stable/8/lib/libc/gen/sysctl.3 Wed Feb 15 16:58:08 2012 (r231769) @@ -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 @@ -555,6 +555,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 @@ -562,6 +563,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/8/sys/net/if.h ============================================================================== --- stable/8/sys/net/if.h Wed Feb 15 16:56:52 2012 (r231768) +++ stable/8/sys/net/if.h Wed Feb 15 16:58:08 2012 (r231769) @@ -233,6 +233,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 */ @@ -245,8 +246,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 */ @@ -259,6 +286,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/8/sys/net/rtsock.c ============================================================================== --- stable/8/sys/net/rtsock.c Wed Feb 15 16:56:52 2012 (r231768) +++ stable/8/sys/net/rtsock.c Wed Feb 15 16:58:08 2012 (r231769) @@ -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"); @@ -1008,6 +1035,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) { @@ -1075,6 +1105,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) { @@ -1088,17 +1121,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: @@ -1528,6 +1575,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; @@ -1546,32 +1714,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; } @@ -1586,14 +1732,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; } @@ -1723,6 +1867,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) break; case NET_RT_IFLIST: + case NET_RT_IFLISTL: error = sysctl_iflist(af, &w); break; Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Wed Feb 15 16:56:52 2012 (r231768) +++ stable/8/sys/sys/param.h Wed Feb 15 16:58:08 2012 (r231769) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 802516 /* Master, propagated to newvers */ +#define __FreeBSD_version 802517 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/8/sys/sys/socket.h ============================================================================== --- stable/8/sys/sys/socket.h Wed Feb 15 16:56:52 2012 (r231768) +++ stable/8/sys/sys/socket.h Wed Feb 15 16:58:08 2012 (r231769) @@ -416,7 +416,9 @@ struct sockaddr_storage { #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 }, \ @@ -424,6 +426,7 @@ struct sockaddr_storage { { "flags", CTLTYPE_STRUCT }, \ { "iflist", CTLTYPE_STRUCT }, \ { "ifmalist", CTLTYPE_STRUCT }, \ + { "iflistl", CTLTYPE_STRUCT }, \ } #endif /* __BSD_VISIBLE */ From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 15 17:09:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB4C5106564A; Wed, 15 Feb 2012 17:09: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 A94888FC17; Wed, 15 Feb 2012 17:09: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 q1FH9QpS071864; Wed, 15 Feb 2012 17:09:26 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FH9QPC071861; Wed, 15 Feb 2012 17:09:26 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201202151709.q1FH9QPC071861@svn.freebsd.org> From: Alan Cox Date: Wed, 15 Feb 2012 17:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231771 - in stable/8/sys: fs/nfsserver nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 17:09:26 -0000 Author: alc Date: Wed Feb 15 17:09:26 2012 New Revision: 231771 URL: http://svn.freebsd.org/changeset/base/231771 Log: Partial merge of r218345: Unless "cnt" exceeded MAX_COMMIT_COUNT, nfsrv_commit() and nfsvno_fsync() were incorrectly calling vm_object_page_clean(). They were passing the length of the range rather than the ending offset of the range. Reviewed by: kib Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/nfsserver/nfs_serv.c Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Wed Feb 15 16:59:24 2012 (r231770) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Wed Feb 15 17:09:26 2012 (r231771) @@ -1293,7 +1293,8 @@ nfsvno_fsync(struct vnode *vp, u_int64_t if (vp->v_object && (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) { VM_OBJECT_LOCK(vp->v_object); - vm_object_page_clean(vp->v_object, off / PAGE_SIZE, (cnt + PAGE_MASK) / PAGE_SIZE, OBJPC_SYNC); + vm_object_page_clean(vp->v_object, OFF_TO_IDX(off), + OFF_TO_IDX(off + cnt + PAGE_MASK), OBJPC_SYNC); VM_OBJECT_UNLOCK(vp->v_object); } Modified: stable/8/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/8/sys/nfsserver/nfs_serv.c Wed Feb 15 16:59:24 2012 (r231770) +++ stable/8/sys/nfsserver/nfs_serv.c Wed Feb 15 17:09:26 2012 (r231771) @@ -3489,7 +3489,8 @@ nfsrv_commit(struct nfsrv_descript *nfsd if (vp->v_object && (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) { VM_OBJECT_LOCK(vp->v_object); - vm_object_page_clean(vp->v_object, off / PAGE_SIZE, (cnt + PAGE_MASK) / PAGE_SIZE, OBJPC_SYNC); + vm_object_page_clean(vp->v_object, OFF_TO_IDX(off), + OFF_TO_IDX(off + cnt + PAGE_MASK), OBJPC_SYNC); VM_OBJECT_UNLOCK(vp->v_object); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 15 18:07:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0F6E1065673; Wed, 15 Feb 2012 18:07:24 +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 BFA1A8FC0A; Wed, 15 Feb 2012 18:07:24 +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 q1FI7Ojj074412; Wed, 15 Feb 2012 18:07:24 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FI7O39074410; Wed, 15 Feb 2012 18:07:24 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201202151807.q1FI7O39074410@svn.freebsd.org> From: Alan Cox Date: Wed, 15 Feb 2012 18:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231774 - stable/8/sys/fs/tmpfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 18:07:24 -0000 Author: alc Date: Wed Feb 15 18:07:24 2012 New Revision: 231774 URL: http://svn.freebsd.org/changeset/base/231774 Log: MFC r218949 Eliminate two dubious attempts at optimizing the implementation of a file's last accessed, modified, and changed times. Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Wed Feb 15 17:46:16 2012 (r231773) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Wed Feb 15 18:07:24 2012 (r231774) @@ -265,19 +265,12 @@ tmpfs_close(struct vop_close_args *v) { struct vnode *vp = v->a_vp; - struct tmpfs_node *node; - MPASS(VOP_ISLOCKED(vp)); - node = VP_TO_TMPFS_NODE(vp); - - if (node->tn_links > 0) { - /* Update node times. No need to do it if the node has - * been deleted, because it will vanish after we return. */ - tmpfs_update(vp); - } + /* Update node times. */ + tmpfs_update(vp); - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -822,8 +815,7 @@ tmpfs_remove(struct vop_remove_args *v) * reclaimed. */ tmpfs_free_dirent(tmp, de, TRUE); - if (node->tn_links > 0) - node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED; + node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED; error = 0; out: From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 15 18:18:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 751871065673; Wed, 15 Feb 2012 18:18:30 +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 63B208FC19; Wed, 15 Feb 2012 18:18:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1FIIUsK074934; Wed, 15 Feb 2012 18:18:30 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FIIUmr074932; Wed, 15 Feb 2012 18:18:30 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201202151818.q1FIIUmr074932@svn.freebsd.org> From: Alan Cox Date: Wed, 15 Feb 2012 18:18:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231776 - stable/8/sys/fs/tmpfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 18:18:30 -0000 Author: alc Date: Wed Feb 15 18:18:29 2012 New Revision: 231776 URL: http://svn.freebsd.org/changeset/base/231776 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/8/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Wed Feb 15 18:15:26 2012 (r231775) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Wed Feb 15 18:18:29 2012 (r231776) @@ -437,7 +437,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); @@ -638,7 +638,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-8@FreeBSD.ORG Wed Feb 15 22:35:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F9131065675; Wed, 15 Feb 2012 22:35:30 +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 5D1A78FC0C; Wed, 15 Feb 2012 22:35:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1FMZUuR085321; Wed, 15 Feb 2012 22:35:30 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FMZUqx085318; Wed, 15 Feb 2012 22:35:30 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202152235.q1FMZUqx085318@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 15 Feb 2012 22:35:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231789 - stable/8/usr.bin/sockstat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 22:35:30 -0000 Author: jilles Date: Wed Feb 15 22:35:30 2012 New Revision: 231789 URL: http://svn.freebsd.org/changeset/base/231789 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/8/usr.bin/sockstat/sockstat.1 stable/8/usr.bin/sockstat/sockstat.c Directory Properties: stable/8/usr.bin/sockstat/ (props changed) Modified: stable/8/usr.bin/sockstat/sockstat.1 ============================================================================== --- stable/8/usr.bin/sockstat/sockstat.1 Wed Feb 15 22:26:51 2012 (r231788) +++ stable/8/usr.bin/sockstat/sockstat.1 Wed Feb 15 22:35:30 2012 (r231789) @@ -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 , Modified: stable/8/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/8/usr.bin/sockstat/sockstat.c Wed Feb 15 22:26:51 2012 (r231788) +++ stable/8/usr.bin/sockstat/sockstat.c Wed Feb 15 22:35:30 2012 (r231789) @@ -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-8@FreeBSD.ORG Wed Feb 15 23:00:31 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92E76106566B; Wed, 15 Feb 2012 23:00:31 +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 7FCC18FC18; Wed, 15 Feb 2012 23:00: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 q1FN0VJX086369; Wed, 15 Feb 2012 23:00:31 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FN0VsS086353; Wed, 15 Feb 2012 23:00:31 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202152300.q1FN0VsS086353@svn.freebsd.org> From: Doug Barton Date: Wed, 15 Feb 2012 23:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231793 - in stable/8/etc: . defaults rc.d X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 23:00:31 -0000 Author: dougb Date: Wed Feb 15 23:00:31 2012 New Revision: 231793 URL: http://svn.freebsd.org/changeset/base/231793 Log: MFC r231667: Fix various issues with the NFS and RPC related scripts. Add new functionality to the force_depend method. Modified: stable/8/etc/defaults/rc.conf stable/8/etc/rc.d/amd stable/8/etc/rc.d/apmd stable/8/etc/rc.d/keyserv stable/8/etc/rc.d/lockd stable/8/etc/rc.d/mountd stable/8/etc/rc.d/nfsd stable/8/etc/rc.d/statd stable/8/etc/rc.d/ypbind stable/8/etc/rc.d/yppasswdd stable/8/etc/rc.d/ypserv stable/8/etc/rc.d/ypset stable/8/etc/rc.d/ypupdated stable/8/etc/rc.d/ypxfrd stable/8/etc/rc.subr Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/defaults/rc.conf ============================================================================== --- stable/8/etc/defaults/rc.conf Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/defaults/rc.conf Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/amd ============================================================================== --- stable/8/etc/rc.d/amd Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/amd Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/apmd ============================================================================== --- stable/8/etc/rc.d/apmd Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/apmd Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/keyserv ============================================================================== --- stable/8/etc/rc.d/keyserv Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/keyserv Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/lockd ============================================================================== --- stable/8/etc/rc.d/lockd Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/lockd Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/mountd ============================================================================== --- stable/8/etc/rc.d/mountd Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/mountd Wed Feb 15 23:00:31 2012 (r231793) @@ -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 # @@ -49,8 +45,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/8/etc/rc.d/nfsd ============================================================================== --- stable/8/etc/rc.d/nfsd Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/nfsd Wed Feb 15 23:00:31 2012 (r231793) @@ -43,18 +43,8 @@ nfsd_precmd() 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/8/etc/rc.d/statd ============================================================================== --- stable/8/etc/rc.d/statd Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/statd Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/ypbind ============================================================================== --- stable/8/etc/rc.d/ypbind Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/ypbind Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/yppasswdd ============================================================================== --- stable/8/etc/rc.d/yppasswdd Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/yppasswdd Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/ypserv ============================================================================== --- stable/8/etc/rc.d/ypserv Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/ypserv Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/ypset ============================================================================== --- stable/8/etc/rc.d/ypset Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/ypset Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/ypupdated ============================================================================== --- stable/8/etc/rc.d/ypupdated Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/ypupdated Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.d/ypxfrd ============================================================================== --- stable/8/etc/rc.d/ypxfrd Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.d/ypxfrd Wed Feb 15 23:00:31 2012 (r231793) @@ -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/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Wed Feb 15 22:59:15 2012 (r231792) +++ stable/8/etc/rc.subr Wed Feb 15 23:00:31 2012 (r231793) @@ -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-8@FreeBSD.ORG Wed Feb 15 23:03:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8D9B106567B; Wed, 15 Feb 2012 23:03:30 +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 D702B8FC1D; Wed, 15 Feb 2012 23:03:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1FN3UQJ086570; Wed, 15 Feb 2012 23:03:30 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1FN3Uww086568; Wed, 15 Feb 2012 23:03:30 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201202152303.q1FN3Uww086568@svn.freebsd.org> From: Doug Barton Date: Wed, 15 Feb 2012 23:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231795 - stable/8/share/man/man5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 23:03:31 -0000 Author: dougb Date: Wed Feb 15 23:03:30 2012 New Revision: 231795 URL: http://svn.freebsd.org/changeset/base/231795 Log: MFC r231667: Add new functionality to the force_depend method. Modified: stable/8/share/man/man5/rc.conf.5 Directory Properties: stable/8/share/man/man5/ (props changed) Modified: stable/8/share/man/man5/rc.conf.5 ============================================================================== --- stable/8/share/man/man5/rc.conf.5 Wed Feb 15 23:02:45 2012 (r231794) +++ stable/8/share/man/man5/rc.conf.5 Wed Feb 15 23:03:30 2012 (r231795) @@ -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-8@FreeBSD.ORG Thu Feb 16 00:38:35 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7872E1065674; Thu, 16 Feb 2012 00:38:35 +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 66D498FC1B; Thu, 16 Feb 2012 00:38:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1G0cZVG089929; Thu, 16 Feb 2012 00:38:35 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1G0cZrl089927; Thu, 16 Feb 2012 00:38:35 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201202160038.q1G0cZrl089927@svn.freebsd.org> From: Ed Maste Date: Thu, 16 Feb 2012 00:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231800 - stable/8/sys/dev/ata X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 00:38:35 -0000 Author: emaste Date: Thu Feb 16 00:38:35 2012 New Revision: 231800 URL: http://svn.freebsd.org/changeset/base/231800 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/8/sys/dev/ata/ata-queue.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/ata/ata-queue.c ============================================================================== --- stable/8/sys/dev/ata/ata-queue.c Thu Feb 16 00:25:17 2012 (r231799) +++ stable/8/sys/dev/ata/ata-queue.c Thu Feb 16 00:38:35 2012 (r231800) @@ -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-8@FreeBSD.ORG Thu Feb 16 01:32:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C9FB106564A; Thu, 16 Feb 2012 01:32:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18DC78FC19; Thu, 16 Feb 2012 01:32:24 +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 q1G1WOeT092237; Thu, 16 Feb 2012 01:32:24 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1G1WOh6092231; Thu, 16 Feb 2012 01:32:24 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201202160132.q1G1WOh6092231@svn.freebsd.org> From: Hiroki Sato Date: Thu, 16 Feb 2012 01:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231802 - in stable/8/usr.sbin: . rtadvctl rtadvd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 01:32:24 -0000 Author: hrs Date: Thu Feb 16 01:32:23 2012 New Revision: 231802 URL: http://svn.freebsd.org/changeset/base/231802 Log: MFC r222732,222771,222820,222824,222972,223752,224006,224144,224148,225519,22568 3,228990: - Implement RDNSS and DNSSL options (RFC 6106, IPv6 Router Advertisement Options for DNS Configuration). - rtadvd(8) now supports "noifprefix" to disable gathering on-link prefixes from interfaces when no "addr" is specified[2]. An entry in rtadvd.conf with "noifprefix" + no "addr" generates an RA message with no prefix information option. - rtadvd(8) now supports RTM_IFANNOUNCE message to fix crashes when an interface is added or removed. - Implement burst unsolicited RA sending into the internal RA timer framework when AdvSendAdvertisements and/or configuration entries are changed as described in RFC 4861 6.2.4. This fixes issues that make termination of the rtadvd(8) daemon take very long time. - rtadvd(8) now accepts non-existent interfaces as well in the command line. - Add control socket support and rtadvctl(8) utility to show the RA information in rtadvd(8). Dumping by SIGUSR1 has been removed in favor of it. Added: stable/8/usr.sbin/rtadvctl/Makefile (contents, props changed) stable/8/usr.sbin/rtadvctl/rtadvctl.8 (contents, props changed) stable/8/usr.sbin/rtadvctl/rtadvctl.c (contents, props changed) stable/8/usr.sbin/rtadvd/control.c - copied, changed from r224640, head/usr.sbin/rtadvd/control.c stable/8/usr.sbin/rtadvd/control.h - copied, changed from r224640, head/usr.sbin/rtadvd/control.h stable/8/usr.sbin/rtadvd/control_client.c - copied, changed from r224640, head/usr.sbin/rtadvd/control_client.c stable/8/usr.sbin/rtadvd/control_client.h - copied, changed from r224640, head/usr.sbin/rtadvd/control_client.h stable/8/usr.sbin/rtadvd/control_server.c - copied, changed from r224640, head/usr.sbin/rtadvd/control_server.c stable/8/usr.sbin/rtadvd/control_server.h - copied, changed from r224640, head/usr.sbin/rtadvd/control_server.h stable/8/usr.sbin/rtadvd/timer_subr.c - copied unchanged from r224640, head/usr.sbin/rtadvd/timer_subr.c stable/8/usr.sbin/rtadvd/timer_subr.h - copied unchanged from r224640, head/usr.sbin/rtadvd/timer_subr.h Directory Properties: stable/8/usr.sbin/rtadvctl/ (props changed) Deleted: stable/8/usr.sbin/rtadvd/dump.c stable/8/usr.sbin/rtadvd/dump.h Modified: stable/8/usr.sbin/Makefile stable/8/usr.sbin/rtadvd/Makefile stable/8/usr.sbin/rtadvd/advcap.c stable/8/usr.sbin/rtadvd/config.c stable/8/usr.sbin/rtadvd/config.h stable/8/usr.sbin/rtadvd/if.c stable/8/usr.sbin/rtadvd/if.h stable/8/usr.sbin/rtadvd/pathnames.h stable/8/usr.sbin/rtadvd/rrenum.c stable/8/usr.sbin/rtadvd/rrenum.h stable/8/usr.sbin/rtadvd/rtadvd.8 stable/8/usr.sbin/rtadvd/rtadvd.c stable/8/usr.sbin/rtadvd/rtadvd.conf stable/8/usr.sbin/rtadvd/rtadvd.conf.5 stable/8/usr.sbin/rtadvd/rtadvd.h stable/8/usr.sbin/rtadvd/timer.c stable/8/usr.sbin/rtadvd/timer.h Directory Properties: stable/8/usr.sbin/rtadvd/ (props changed) Modified: stable/8/usr.sbin/Makefile ============================================================================== --- stable/8/usr.sbin/Makefile Thu Feb 16 00:46:11 2012 (r231801) +++ stable/8/usr.sbin/Makefile Thu Feb 16 01:32:23 2012 (r231802) @@ -160,6 +160,7 @@ SUBDIR= ${_ac} \ ${_rpc.ypupdated} \ ${_rpc.ypxfrd} \ ${_rrenumd} \ + ${_rtadvctl} \ ${_rtadvd} \ rtprio \ ${_rtsold} \ @@ -284,6 +285,7 @@ _ndp= ndp _rip6query= rip6query _route6d= route6d _rrenumd= rrenumd +_rtadvctl= rtadvctl _rtadvd= rtadvd _rtsold= rtsold _traceroute6= traceroute6 Added: stable/8/usr.sbin/rtadvctl/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.sbin/rtadvctl/Makefile Thu Feb 16 01:32:23 2012 (r231802) @@ -0,0 +1,13 @@ +# $FreeBSD$ +# +.PATH: ${.CURDIR}/../rtadvd + +PROG= rtadvctl +MAN= rtadvctl.8 + +SRCS= rtadvctl.c control.c control_client.c if.c timer_subr.c + +CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../rtadvd +WARNS?= 1 + +.include Added: stable/8/usr.sbin/rtadvctl/rtadvctl.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.sbin/rtadvctl/rtadvctl.8 Thu Feb 16 01:32:23 2012 (r231802) @@ -0,0 +1,104 @@ +.\" Copyright (C) 2011 Hiroki Sato . +.\" 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 PROJECT 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 +.\" PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 16, 2011 +.Dt RTADVCTL 8 +.Os +.Sh NAME +.Nm rtadvctl +.Nd control program for +.Xr rtadvd 8 daemon +.Sh SYNOPSIS +.Nm +.Op Fl v +.Ar subcommand +.Op Ar interface ... +.Sh DESCRIPTION +.Nm +is a utility that communicates with +.Xr rtadvd 8 +daemon and displays information about Router Advertisement messages being +sent on each interface. +.Pp +This utility provides several options and subcommands. +The options are as follows: +.Bl -tag -width indent +.\" +.It Fl v +Increase verbosity level. +When specified once, the +.Nm +utility shows additional information about prefixes, RDNSS, and DNSSL +options. +When given twice, it additionally shows information about +inactive interfaces and some statistics. +.El +.Pp +The subcommands are as follows: +.Bl -tag -width indent +.\" +.It reload Op interfaces... +Specifies to reload the configuration file. If one or more +.Ar interface +is specified, configuration entries for the interfaces will be reloaded +selectively. +.It enable interfaces... +Specifies to mark the interface as enable and to try to reload the +configuration entry. +This subcommand is useful for dynamically-added interfaces. +.Pp +The +.Xr rtadvd 8 +daemon marks an interface as enable if the interface exists and the +configuration file has a valid entry for that when it is invoked. +.It disable interfaces... +Specifies to mark the interface as disable. +.It shutdown +Makes the +.Xr rtadvd 8 +daemon shut down. +Note that the +.Xr rtadvd 8 +daemon will send several RAs with zero lifetime to invalidate the old +information on each interface. +It will take at most nine seconds. +.It show Op interfaces... +Displays information on Router Advertisement messages being sent +on each interface. +.El +.Sh SEE ALSO +.Xr rtadvd 8 , +.Xr rtadvd.conf 5 +.Sh HISTORY +The +.Nm +command first appeared in +.Fx 9.0 . +.Sh AUTHORS +.Nm +was written by +.An "Hiroki Sato" Aq hrs@FreeBSD.org . Added: stable/8/usr.sbin/rtadvctl/rtadvctl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.sbin/rtadvctl/rtadvctl.c Thu Feb 16 01:32:23 2012 (r231802) @@ -0,0 +1,925 @@ +/*- + * Copyright (C) 2011 Hiroki Sato + * 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 PROJECT 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 PROJECT 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$ + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pathnames.h" +#include "rtadvd.h" +#include "if.h" +#include "timer_subr.h" +#include "timer.h" +#include "control.h" +#include "control_client.h" + +#define RA_IFSTATUS_INACTIVE 0 +#define RA_IFSTATUS_RA_RECV 1 +#define RA_IFSTATUS_RA_SEND 2 + +static int vflag = LOG_ERR; + +static void usage(void); + +static int action_propset(char *); +static int action_propget(char *, struct ctrl_msg_pl *); +static int action_plgeneric(int, char *, char *); + +static int action_enable(int, char **); +static int action_disable(int, char **); +static int action_reload(int, char **); +static int action_echo(int, char **); +static int action_version(int, char **); +static int action_shutdown(int, char **); + +static int action_show(int, char **); +static int action_show_prefix(struct prefix *); +static int action_show_rtinfo(struct rtinfo *); +static int action_show_rdnss(void *); +static int action_show_dnssl(void *); + +static int csock_client_open(struct sockinfo *); +static size_t dname_labeldec(char *, size_t, const char *); +static void mysyslog(int, const char *, ...); + +static const char *rtpref_str[] = { + "medium", /* 00 */ + "high", /* 01 */ + "rsv", /* 10 */ + "low" /* 11 */ +}; + +static struct dispatch_table { + const char *dt_comm; + int (*dt_act)(int, char **); +} dtable[] = { + { "show", action_show }, + { "reload", action_reload }, + { "shutdown", action_shutdown }, + { "enable", action_enable }, + { "disable", action_disable }, + { NULL, NULL }, + { "echo", action_echo }, + { "version", action_version }, + { NULL, NULL }, +}; + +static char errmsgbuf[1024]; +static char *errmsg = NULL; + +static void +mysyslog(int priority, const char * restrict fmt, ...) +{ + va_list ap; + + if (vflag >= priority) { + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); + } +} + +static void +usage(void) +{ + int i; + + for (i = 0; (size_t)i < sizeof(dtable)/sizeof(dtable[0]); i++) { + if (dtable[i].dt_comm == NULL) + break; + printf("%s\n", dtable[i].dt_comm); + } + + exit(1); +} + +int +main(int argc, char *argv[]) +{ + int i; + int ch; + int (*action)(int, char **) = NULL; + int error; + + while ((ch = getopt(argc, argv, "Dv")) != -1) { + switch (ch) { + case 'D': + vflag = LOG_DEBUG; + break; + case 'v': + vflag++; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; + + if (argc == 0) + usage(); + + for (i = 0; (size_t)i < sizeof(dtable)/sizeof(dtable[0]); i++) { + if (dtable[i].dt_comm == NULL || + strcmp(dtable[i].dt_comm, argv[0]) == 0) { + action = dtable[i].dt_act; + break; + } + } + + if (action == NULL) + usage(); + + error = (dtable[i].dt_act)(--argc, ++argv); + if (error) { + fprintf(stderr, "%s failed", dtable[i].dt_comm); + if (errmsg != NULL) + fprintf(stderr, ": %s", errmsg); + fprintf(stderr, ".\n"); + } + + return (error); +} + +static int +csock_client_open(struct sockinfo *s) +{ + struct sockaddr_un sun; + + if ((s->si_fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) + err(1, "cannot open control socket."); + + memset(&sun, 0, sizeof(sun)); + sun.sun_family = AF_UNIX; + sun.sun_len = sizeof(sun); + strlcpy(sun.sun_path, s->si_name, sizeof(sun.sun_path)); + + if (connect(s->si_fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) + err(1, "connect: %s", s->si_name); + + mysyslog(LOG_DEBUG, + "<%s> connected to %s", __func__, sun.sun_path); + + return (0); +} + +static int +action_plgeneric(int action, char *plstr, char *buf) +{ + struct ctrl_msg_hdr *cm; + struct ctrl_msg_pl cp; + struct sockinfo *s; + char *msg; + char *p; + char *q; + + s = &ctrlsock; + csock_client_open(s); + + cm = (struct ctrl_msg_hdr *)buf; + msg = (char *)buf + sizeof(*cm); + + cm->cm_version = CM_VERSION; + cm->cm_type = action; + cm->cm_len = sizeof(*cm); + + if (plstr != NULL) { + memset(&cp, 0, sizeof(cp)); + p = strchr(plstr, ':'); + q = strchr(plstr, '='); + if (p != NULL && q != NULL && p > q) + return (1); + + if (p == NULL) { /* No : */ + cp.cp_ifname = NULL; + cp.cp_key = plstr; + } else if (p == plstr) { /* empty */ + cp.cp_ifname = NULL; + cp.cp_key = plstr + 1; + } else { + *p++ = '\0'; + cp.cp_ifname = plstr; + cp.cp_key = p; + } + if (q == NULL) + cp.cp_val = NULL; + else { + *q++ = '\0'; + cp.cp_val = q; + } + cm->cm_len += cm_pl2bin(msg, &cp); + + mysyslog(LOG_DEBUG, "<%s> key=%s, val_len=%d, ifname=%s", + __func__,cp.cp_key, cp.cp_val_len, cp.cp_ifname); + } + + return (cm_handler_client(s->si_fd, CM_STATE_MSG_DISPATCH, buf)); +} + +static int +action_propget(char *argv, struct ctrl_msg_pl *cp) +{ + int error; + struct ctrl_msg_hdr *cm; + char buf[CM_MSG_MAXLEN]; + char *msg; + + memset(cp, 0, sizeof(*cp)); + cm = (struct ctrl_msg_hdr *)buf; + msg = (char *)buf + sizeof(*cm); + + error = action_plgeneric(CM_TYPE_REQ_GET_PROP, argv, buf); + if (error || cm->cm_len <= sizeof(*cm)) + return (1); + + cm_bin2pl(msg, cp); + mysyslog(LOG_DEBUG, "<%s> type=%d, len=%d", + __func__, cm->cm_type, cm->cm_len); + mysyslog(LOG_DEBUG, "<%s> key=%s, val_len=%d, ifname=%s", + __func__,cp->cp_key, cp->cp_val_len, cp->cp_ifname); + + return (0); +} + +static int +action_propset(char *argv) +{ + char buf[CM_MSG_MAXLEN]; + + return (action_plgeneric(CM_TYPE_REQ_SET_PROP, argv, buf)); +} + +static int +action_disable(int argc, char **argv) +{ + char *action_argv; + char argv_disable[IFNAMSIZ + sizeof(":disable=")]; + int i; + int error; + + if (argc < 1) + return (1); + + error = 0; + for (i = 0; i < argc; i++) { + sprintf(argv_disable, "%s:disable=", argv[i]); + action_argv = argv_disable; + error += action_propset(action_argv); + } + + return (error); +} + +static int +action_enable(int argc, char **argv) +{ + char *action_argv; + char argv_enable[IFNAMSIZ + sizeof(":enable=")]; + int i; + int error; + + if (argc < 1) + return (1); + + error = 0; + for (i = 0; i < argc; i++) { + sprintf(argv_enable, "%s:enable=", argv[i]); + action_argv = argv_enable; + error += action_propset(action_argv); + } + + return (error); +} + +static int +action_reload(int argc, char **argv) +{ + char *action_argv; + char argv_reload[IFNAMSIZ + sizeof(":reload=")]; + int i; + int error; + + if (argc == 0) { + action_argv = strdup(":reload="); + return (action_propset(action_argv)); + } + + error = 0; + for (i = 0; i < argc; i++) { + sprintf(argv_reload, "%s:reload=", argv[i]); + action_argv = argv_reload; + error += action_propset(action_argv); + } + + return (error); +} + +static int +action_echo(int argc __unused, char **argv __unused) +{ + char *action_argv; + + action_argv = strdup("echo"); + return (action_propset(action_argv)); +} + +static int +action_shutdown(int argc __unused, char **argv __unused) +{ + char *action_argv; + + action_argv = strdup("shutdown"); + return (action_propset(action_argv)); +} + +/* XXX */ +static int +action_version(int argc __unused, char **argv __unused) +{ + char *action_argv; + struct ctrl_msg_pl cp; + int error; + + action_argv = strdup(":version="); + error = action_propget(action_argv, &cp); + if (error) + return (error); + + printf("version=%s\n", cp.cp_val); + return (0); +} + +static int +action_show(int argc, char **argv) +{ + char *action_argv; + char argv_ifilist[sizeof(":ifilist=")] = ":ifilist="; + char argv_ifi[IFNAMSIZ + sizeof(":ifi=")]; + char argv_rai[IFNAMSIZ + sizeof(":rai=")]; + char argv_rti[IFNAMSIZ + sizeof(":rti=")]; + char argv_pfx[IFNAMSIZ + sizeof(":pfx=")]; + char argv_ifi_ra_timer[IFNAMSIZ + sizeof(":ifi_ra_timer=")]; + char argv_rdnss[IFNAMSIZ + sizeof(":rdnss=")]; + char argv_dnssl[IFNAMSIZ + sizeof(":dnssl=")]; + char ssbuf[SSBUFLEN]; + + struct ctrl_msg_pl cp; + struct ifinfo *ifi; + TAILQ_HEAD(, ifinfo) ifl = TAILQ_HEAD_INITIALIZER(ifl); + char *endp; + char *p; + int error; + int i; + int len; + + if (argc == 0) { + action_argv = argv_ifilist; + error = action_propget(action_argv, &cp); + if (error) + return (error); + + p = cp.cp_val; + endp = p + cp.cp_val_len; + while (p < endp) { + ifi = malloc(sizeof(*ifi)); + if (ifi == NULL) + return (1); + memset(ifi, 0, sizeof(*ifi)); + + strcpy(ifi->ifi_ifname, p); + ifi->ifi_ifindex = if_nametoindex(ifi->ifi_ifname); + TAILQ_INSERT_TAIL(&ifl, ifi, ifi_next); + p += strlen(ifi->ifi_ifname) + 1; + } + } else { + for (i = 0; i < argc; i++) { + ifi = malloc(sizeof(*ifi)); + if (ifi == NULL) + return (1); + memset(ifi, 0, sizeof(*ifi)); + + strcpy(ifi->ifi_ifname, argv[i]); + ifi->ifi_ifindex = if_nametoindex(ifi->ifi_ifname); + if (ifi->ifi_ifindex == 0) { + sprintf(errmsgbuf, "invalid interface %s", + ifi->ifi_ifname); + errmsg = errmsgbuf; + return (1); + } + + TAILQ_INSERT_TAIL(&ifl, ifi, ifi_next); + } + } + + TAILQ_FOREACH(ifi, &ifl, ifi_next) { + struct ifinfo *ifi_s; + struct rtadvd_timer *rat; + struct rainfo *rai; + struct rtinfo *rti; + struct prefix *pfx; + int c; + int ra_ifstatus; + + sprintf(argv_ifi, "%s:ifi=", ifi->ifi_ifname); + action_argv = argv_ifi; + error = action_propget(action_argv, &cp); + if (error) + return (error); + ifi_s = (struct ifinfo *)cp.cp_val; + + if (!(ifi_s->ifi_persist) && vflag < LOG_NOTICE) + continue; + + printf("%s: flags=<", ifi->ifi_ifname); + + c = 0; + if (ifi_s->ifi_ifindex == 0) + c += printf("NONEXISTENT"); + else + c += printf("%s", (ifi_s->ifi_flags & IFF_UP) ? + "UP" : "DOWN"); + switch (ifi_s->ifi_state) { + case IFI_STATE_CONFIGURED: + c += printf("%s%s", (c) ? "," : "", "CONFIGURED"); + break; + case IFI_STATE_TRANSITIVE: + c += printf("%s%s", (c) ? "," : "", "TRANSITIVE"); + break; + } + if (ifi_s->ifi_persist) + c += printf("%s%s", (c) ? "," : "", "PERSIST"); + printf(">"); + + ra_ifstatus = RA_IFSTATUS_INACTIVE; + if ((ifi_s->ifi_flags & IFF_UP) && + ((ifi_s->ifi_state == IFI_STATE_CONFIGURED) || + (ifi_s->ifi_state == IFI_STATE_TRANSITIVE))) { +#if (__FreeBSD_version < 900000) + /* + * RA_RECV: !ip6.forwarding && ip6.accept_rtadv + * RA_SEND: ip6.forwarding + */ + if (getinet6sysctl(IPV6CTL_FORWARDING) == 0) { + if (getinet6sysctl(IPV6CTL_ACCEPT_RTADV)) + ra_ifstatus = RA_IFSTATUS_RA_RECV; + else + ra_ifstatus = RA_IFSTATUS_INACTIVE; + } else + ra_ifstatus = RA_IFSTATUS_RA_SEND; +#else + /* + * RA_RECV: ND6_IFF_ACCEPT_RTADV + * RA_SEND: ip6.forwarding + */ + if (ifi_s->ifi_nd_flags & ND6_IFF_ACCEPT_RTADV) + ra_ifstatus = RA_IFSTATUS_RA_RECV; + else if (getinet6sysctl(IPV6CTL_FORWARDING)) + ra_ifstatus = RA_IFSTATUS_RA_SEND; + else + ra_ifstatus = RA_IFSTATUS_INACTIVE; +#endif + } + + c = 0; + printf(" status=<"); + if (ra_ifstatus == RA_IFSTATUS_INACTIVE) + printf("%s%s", (c) ? "," : "", "INACTIVE"); + else if (ra_ifstatus == RA_IFSTATUS_RA_RECV) + printf("%s%s", (c) ? "," : "", "RA_RECV"); + else if (ra_ifstatus == RA_IFSTATUS_RA_SEND) + printf("%s%s", (c) ? "," : "", "RA_SEND"); + printf("> "); + + switch (ifi_s->ifi_state) { + case IFI_STATE_CONFIGURED: + case IFI_STATE_TRANSITIVE: + break; + default: + printf("\n"); + continue; + } + + printf("mtu %d\n", ifi_s->ifi_phymtu); + + sprintf(argv_rai, "%s:rai=", ifi->ifi_ifname); + action_argv = argv_rai; + + error = action_propget(action_argv, &cp); + if (error) + continue; + + rai = (struct rainfo *)cp.cp_val; + + printf("\tDefaultLifetime: %s", + sec2str(rai->rai_lifetime, ssbuf)); + if (ra_ifstatus != RA_IFSTATUS_RA_SEND && + rai->rai_lifetime == 0) + printf(" (RAs will be sent with zero lifetime)"); + + printf("\n"); + + printf("\tMinAdvInterval/MaxAdvInterval: "); + printf("%s/", sec2str(rai->rai_mininterval, ssbuf)); + printf("%s\n", sec2str(rai->rai_maxinterval, ssbuf)); + if (rai->rai_linkmtu) + printf("\tAdvLinkMTU: %d", rai->rai_linkmtu); + else + printf("\tAdvLinkMTU: "); + + printf(", "); + + printf("Flags: "); + if (rai->rai_managedflg || rai->rai_otherflg) { + printf("%s", rai->rai_managedflg ? "M" : ""); + printf("%s", rai->rai_otherflg ? "O" : ""); + } else + printf(""); + + printf(", "); + + printf("Preference: %s\n", + rtpref_str[(rai->rai_rtpref >> 3) & 0xff]); + + printf("\tReachableTime: %s, ", + sec2str(rai->rai_reachabletime, ssbuf)); + printf("RetransTimer: %s, " + "CurHopLimit: %d\n", + sec2str(rai->rai_retranstimer, ssbuf), + rai->rai_hoplimit); + printf("\tAdvIfPrefixes: %s\n", + rai->rai_advifprefix ? "yes" : "no"); + + /* RA timer */ + rat = NULL; + if (ifi_s->ifi_ra_timer != NULL) { + sprintf(argv_ifi_ra_timer, "%s:ifi_ra_timer=", + ifi->ifi_ifname); + action_argv = argv_ifi_ra_timer; + + error = action_propget(action_argv, &cp); + if (error) + return (error); + + rat = (struct rtadvd_timer *)cp.cp_val; + } + printf("\tNext RA send: %s", + (rat == NULL) ? "never\n" : + ctime((time_t *)&rat->rat_tm.tv_sec)); + printf("\tLast RA sent: %s", + (ifi_s->ifi_ra_lastsent.tv_sec == 0) ? "never\n" : + ctime((time_t *)&ifi_s->ifi_ra_lastsent.tv_sec)); + if (rai->rai_clockskew) + printf("\tClock skew: %" PRIu16 "sec\n", + rai->rai_clockskew); + + if (vflag < LOG_WARNING) + continue; + + /* route information */ + sprintf(argv_rti, "%s:rti=", ifi->ifi_ifname); + action_argv = argv_rti; + error = action_propget(action_argv, &cp); + if (error) + return (error); + + rti = (struct rtinfo *)cp.cp_val; + len = cp.cp_val_len / sizeof(*rti); + if (len > 0) { + printf("\tRoute Info:\n"); + + for (i = 0; i < len; i++) + action_show_rtinfo(&rti[i]); + } + + /* prefix information */ + sprintf(argv_pfx, "%s:pfx=", ifi->ifi_ifname); + action_argv = argv_pfx; + + error = action_propget(action_argv, &cp); + if (error) + continue; + + pfx = (struct prefix *)cp.cp_val; + len = cp.cp_val_len / sizeof(*pfx); + + if (len > 0) { + printf("\tPrefixes (%d):\n", len); + + for (i = 0; i < len; i++) + action_show_prefix(&pfx[i]); + } + + /* RDNSS information */ + sprintf(argv_rdnss, "%s:rdnss=", ifi->ifi_ifname); + action_argv = argv_rdnss; + + error = action_propget(action_argv, &cp); + if (error) + continue; + + len = *((uint16_t *)cp.cp_val); + + if (len > 0) { + printf("\tRDNSS entries:\n"); + action_show_rdnss(cp.cp_val); + } + + /* DNSSL information */ + sprintf(argv_dnssl, "%s:dnssl=", ifi->ifi_ifname); + action_argv = argv_dnssl; + + error = action_propget(action_argv, &cp); + if (error) + continue; + + len = *((uint16_t *)cp.cp_val); + + if (len > 0) { + printf("\tDNSSL entries:\n"); + action_show_dnssl(cp.cp_val); + } + + if (vflag < LOG_NOTICE) + continue; + + printf("\n"); + + printf("\tCounters\n" + "\t RA burst counts: %" PRIu16 " (interval: %s)\n" + "\t RS wait counts: %" PRIu16 "\n", + ifi_s->ifi_burstcount, + sec2str(ifi_s->ifi_burstinterval, ssbuf), + ifi_s->ifi_rs_waitcount); + + printf("\tOutputs\n" + "\t RA: %" PRIu64 "\n", ifi_s->ifi_raoutput); + + printf("\tInputs\n" + "\t RA: %" PRIu64 " (normal)\n" + "\t RA: %" PRIu64 " (inconsistent)\n" + "\t RS: %" PRIu64 "\n", + ifi_s->ifi_rainput, + ifi_s->ifi_rainconsistent, + ifi_s->ifi_rsinput); + + printf("\n"); + +#if 0 /* Not implemented yet */ + printf("\tReceived RAs:\n"); +#endif + } + + return (0); +} + +static int +action_show_rtinfo(struct rtinfo *rti) +{ + char ntopbuf[INET6_ADDRSTRLEN]; + char ssbuf[SSBUFLEN]; + + printf("\t %s/%d (pref: %s, ltime: %s)\n", + inet_ntop(AF_INET6, &rti->rti_prefix, + ntopbuf, sizeof(ntopbuf)), + rti->rti_prefixlen, + rtpref_str[0xff & (rti->rti_rtpref >> 3)], + (rti->rti_ltime == ND6_INFINITE_LIFETIME) ? + "infinity" : sec2str(rti->rti_ltime, ssbuf)); + + return (0); +} + +static int +action_show_prefix(struct prefix *pfx) +{ + char ntopbuf[INET6_ADDRSTRLEN]; + char ssbuf[SSBUFLEN]; + struct timeval now; + + gettimeofday(&now, NULL); + printf("\t %s/%d", inet_ntop(AF_INET6, &pfx->pfx_prefix, + ntopbuf, sizeof(ntopbuf)), pfx->pfx_prefixlen); + + printf(" ("); + switch (pfx->pfx_origin) { + case PREFIX_FROM_KERNEL: + printf("KERNEL"); + break; + case PREFIX_FROM_CONFIG: + printf("CONFIG"); + break; + case PREFIX_FROM_DYNAMIC: + printf("DYNAMIC"); + break; + } + + printf(","); + + printf(" vltime=%s", + (pfx->pfx_validlifetime == ND6_INFINITE_LIFETIME) ? + "infinity" : sec2str(pfx->pfx_validlifetime, ssbuf)); + + if (pfx->pfx_vltimeexpire > 0) + printf("(expire: %s)", + ((long)pfx->pfx_vltimeexpire > now.tv_sec) ? + sec2str(pfx->pfx_vltimeexpire - now.tv_sec, ssbuf) : + "0"); + + printf(","); + + printf(" pltime=%s", + (pfx->pfx_preflifetime == ND6_INFINITE_LIFETIME) ? + "infinity" : sec2str(pfx->pfx_preflifetime, ssbuf)); + + if (pfx->pfx_pltimeexpire > 0) + printf("(expire %s)", + ((long)pfx->pfx_pltimeexpire > now.tv_sec) ? + sec2str(pfx->pfx_pltimeexpire - now.tv_sec, ssbuf) : + "0"); + + printf(","); + + printf(" flags="); + if (pfx->pfx_onlinkflg || pfx->pfx_autoconfflg) { + printf("%s", pfx->pfx_onlinkflg ? "L" : ""); + printf("%s", pfx->pfx_autoconfflg ? "A" : ""); + } else + printf(""); + + if (pfx->pfx_timer) { + struct timeval *rest; + + rest = rtadvd_timer_rest(pfx->pfx_timer); + if (rest) { /* XXX: what if not? */ + printf(" expire=%s", sec2str(rest->tv_sec, ssbuf)); + } + } + + printf(")\n"); + + return (0); +} + +static int +action_show_rdnss(void *msg) +{ + struct rdnss *rdn; + struct rdnss_addr *rda; + uint16_t *rdn_cnt; + uint16_t *rda_cnt; + int i; + int j; + char *p; + uint32_t ltime; + char ntopbuf[INET6_ADDRSTRLEN]; + char ssbuf[SSBUFLEN]; + + p = msg; + rdn_cnt = (uint16_t *)p; + p += sizeof(*rdn_cnt); + + if (*rdn_cnt > 0) { + for (i = 0; i < *rdn_cnt; i++) { + rdn = (struct rdnss *)p; + ltime = rdn->rd_ltime; + p += sizeof(*rdn); + + rda_cnt = (uint16_t *)p; + p += sizeof(*rda_cnt); + if (*rda_cnt > 0) + for (j = 0; j < *rda_cnt; j++) { + rda = (struct rdnss_addr *)p; + printf("\t %s (ltime=%s)\n", + inet_ntop(AF_INET6, + &rda->ra_dns, + ntopbuf, + sizeof(ntopbuf)), + sec2str(ltime, ssbuf)); + p += sizeof(*rda); + } + } + } + + return (0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Thu Feb 16 01:41:35 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24BBB106566C; Thu, 16 Feb 2012 01:41:35 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1384E8FC08; Thu, 16 Feb 2012 01:41:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1G1fYGZ092585; Thu, 16 Feb 2012 01:41:34 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1G1fYqM092582; Thu, 16 Feb 2012 01:41:34 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201202160141.q1G1fYqM092582@svn.freebsd.org> From: Hiroki Sato Date: Thu, 16 Feb 2012 01:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231803 - stable/8/etc/rc.d X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 01:41:35 -0000 Author: hrs Date: Thu Feb 16 01:41:34 2012 New Revision: 231803 URL: http://svn.freebsd.org/changeset/base/231803 Log: Add static routes to ::ffff:0.0.0.0/96 and ::0.0.0.0/96 unconditionally when the kernel supports PF_INET6. PR: kern/161899 Modified: stable/8/etc/rc.d/network_ipv6 stable/8/etc/rc.d/routing Modified: stable/8/etc/rc.d/network_ipv6 ============================================================================== --- stable/8/etc/rc.d/network_ipv6 Thu Feb 16 01:32:23 2012 (r231802) +++ stable/8/etc/rc.d/network_ipv6 Thu Feb 16 01:41:34 2012 (r231803) @@ -41,10 +41,6 @@ start_cmd="network_ipv6_start" network_ipv6_start() { - # disallow "internal" addresses to appear on the wire - route add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject - route add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject - case ${ipv6_network_interfaces} in [Aa][Uu][Tt][Oo]) # Get a list of network interfaces Modified: stable/8/etc/rc.d/routing ============================================================================== --- stable/8/etc/rc.d/routing Thu Feb 16 01:32:23 2012 (r231802) +++ stable/8/etc/rc.d/routing Thu Feb 16 01:41:34 2012 (r231803) @@ -57,6 +57,14 @@ static_start() atmconfig natm add ${route_args} done fi + + # Disallow "internal" addresses to appear on the wire if inet6 + # is enabled. + if afexists inet6; then + # disallow "internal" addresses to appear on the wire + route add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject + route add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject + fi } _ropts_initdone= From owner-svn-src-stable-8@FreeBSD.ORG Thu Feb 16 03:10:49 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B61D106566B; Thu, 16 Feb 2012 03:10:49 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 699418FC14; Thu, 16 Feb 2012 03:10: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 q1G3An6m095814; Thu, 16 Feb 2012 03:10:49 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1G3AnpE095812; Thu, 16 Feb 2012 03:10:49 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201202160310.q1G3AnpE095812@svn.freebsd.org> From: Ken Smith Date: Thu, 16 Feb 2012 03:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231807 - stable/8/gnu/usr.bin/groff/tmac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 03:10:49 -0000 Author: kensmith Date: Thu Feb 16 03:10:48 2012 New Revision: 231807 URL: http://svn.freebsd.org/changeset/base/231807 Log: Switch the default operating system version printed in the manual pages. Approved by: re (implicit) Modified: stable/8/gnu/usr.bin/groff/tmac/mdoc.local Modified: stable/8/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- stable/8/gnu/usr.bin/groff/tmac/mdoc.local Thu Feb 16 03:05:03 2012 (r231806) +++ stable/8/gnu/usr.bin/groff/tmac/mdoc.local Thu Feb 16 03:10:48 2012 (r231807) @@ -70,7 +70,7 @@ .ds doc-volume-as-arm arm . .\" Default .Os value -.ds doc-default-operating-system FreeBSD\~8.2 +.ds doc-default-operating-system FreeBSD\~8.3 . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-7.4 7.4 From owner-svn-src-stable-8@FreeBSD.ORG Thu Feb 16 03:13:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12EC4106564A; Thu, 16 Feb 2012 03:13:54 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 017A78FC19; Thu, 16 Feb 2012 03:13:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1G3DrlA095946; Thu, 16 Feb 2012 03:13:53 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1G3DrBI095944; Thu, 16 Feb 2012 03:13:53 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201202160313.q1G3DrBI095944@svn.freebsd.org> From: Ken Smith Date: Thu, 16 Feb 2012 03:13:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231808 - stable/8/release X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 03:13:54 -0000 Author: kensmith Date: Thu Feb 16 03:13:53 2012 New Revision: 231808 URL: http://svn.freebsd.org/changeset/base/231808 Log: Bump the version number from 8.2 to 8.3. Approved by: re (implicit) Modified: stable/8/release/Makefile Modified: stable/8/release/Makefile ============================================================================== --- stable/8/release/Makefile Thu Feb 16 03:10:48 2012 (r231807) +++ stable/8/release/Makefile Thu Feb 16 03:13:53 2012 (r231808) @@ -24,11 +24,11 @@ # Set these, release builder! # # Fixed version: -#BUILDNAME=8.2-STABLE +#BUILDNAME=8.3-STABLE # # Automatic SNAP versioning: DATE != date +%Y%m%d -BASE = 8.2 +BASE = 8.3 BUILDNAME?=${BASE}-${DATE}-SNAP # #CHROOTDIR=/junk/release From owner-svn-src-stable-8@FreeBSD.ORG Thu Feb 16 03:18:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4400B106564A; Thu, 16 Feb 2012 03:18:29 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3276D8FC0A; Thu, 16 Feb 2012 03:18:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1G3ITb1096143; Thu, 16 Feb 2012 03:18:29 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1G3ISA5096141; Thu, 16 Feb 2012 03:18:28 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201202160318.q1G3ISA5096141@svn.freebsd.org> From: Ken Smith Date: Thu, 16 Feb 2012 03:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231809 - stable/8/sys/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 03:18:29 -0000 Author: kensmith Date: Thu Feb 16 03:18:28 2012 New Revision: 231809 URL: http://svn.freebsd.org/changeset/base/231809 Log: Identify as 8.3-PRERELEASE. Approved by: re (implicit) Modified: stable/8/sys/conf/newvers.sh Modified: stable/8/sys/conf/newvers.sh ============================================================================== --- stable/8/sys/conf/newvers.sh Thu Feb 16 03:13:53 2012 (r231808) +++ stable/8/sys/conf/newvers.sh Thu Feb 16 03:18:28 2012 (r231809) @@ -31,8 +31,8 @@ # $FreeBSD$ TYPE="FreeBSD" -REVISION="8.2" -BRANCH="STABLE" +REVISION="8.3" +BRANCH="PRERELEASE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable-8@FreeBSD.ORG Thu Feb 16 06:11:00 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5C70106564A; Thu, 16 Feb 2012 06:11:00 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFA388FC0A; Thu, 16 Feb 2012 06:11: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 q1G6B0qr001860; Thu, 16 Feb 2012 06:11:00 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1G6B0e6001858; Thu, 16 Feb 2012 06:11:00 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201202160611.q1G6B0e6001858@svn.freebsd.org> From: Hiroki Sato Date: Thu, 16 Feb 2012 06:11:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231818 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 06:11:01 -0000 Author: hrs Date: Thu Feb 16 06:11:00 2012 New Revision: 231818 URL: http://svn.freebsd.org/changeset/base/231818 Log: MFC r222732: Add ND_OPT_{RDNSS,DNSSL} for Router Advertisement option in RFC 6016. Approved by: re (implicit) Modified: stable/8/sys/netinet/icmp6.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/icmp6.h ============================================================================== --- stable/8/sys/netinet/icmp6.h Thu Feb 16 05:17:06 2012 (r231817) +++ stable/8/sys/netinet/icmp6.h Thu Feb 16 06:11:00 2012 (r231818) @@ -297,8 +297,9 @@ struct nd_opt_hdr { /* Neighbor discove #define ND_OPT_PREFIX_INFORMATION 3 #define ND_OPT_REDIRECTED_HEADER 4 #define ND_OPT_MTU 5 - -#define ND_OPT_ROUTE_INFO 200 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */ +#define ND_OPT_ROUTE_INFO 24 /* RFC 4191 */ +#define ND_OPT_RDNSS 25 /* RFC 6016 */ +#define ND_OPT_DNSSL 31 /* RFC 6016 */ struct nd_opt_prefix_info { /* prefix information */ u_int8_t nd_opt_pi_type; @@ -338,6 +339,22 @@ struct nd_opt_route_info { /* route info /* prefix follows */ } __packed; +struct nd_opt_rdnss { /* RDNSS option (RFC 6106) */ + u_int8_t nd_opt_rdnss_type; + u_int8_t nd_opt_rdnss_len; + u_int16_t nd_opt_rdnss_reserved; + u_int32_t nd_opt_rdnss_lifetime; + /* followed by list of recursive DNS servers */ +} __packed; + +struct nd_opt_dnssl { /* DNSSL option (RFC 6106) */ + u_int8_t nd_opt_dnssl_type; + u_int8_t nd_opt_dnssl_len; + u_int16_t nd_opt_dnssl_reserved; + u_int32_t nd_opt_dnssl_lifetime; + /* followed by list of DNS search domains */ +} __packed; + /* * icmp6 namelookup */