From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 03:56:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B27D1065672; Sun, 21 Nov 2010 03:56:41 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89DE58FC08; Sun, 21 Nov 2010 03:56:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAL3ufC4035775; Sun, 21 Nov 2010 03:56:41 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAL3ufhK035773; Sun, 21 Nov 2010 03:56:41 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201011210356.oAL3ufhK035773@svn.freebsd.org> From: "David E. O'Brien" Date: Sun, 21 Nov 2010 03:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215605 - head/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 03:56:41 -0000 Author: obrien Date: Sun Nov 21 03:56:41 2010 New Revision: 215605 URL: http://svn.freebsd.org/changeset/base/215605 Log: Add x86 to ALL_ARCH. Modified: head/sys/Makefile Modified: head/sys/Makefile ============================================================================== --- head/sys/Makefile Sun Nov 21 02:00:54 2010 (r215604) +++ head/sys/Makefile Sun Nov 21 03:56:41 2010 (r215605) @@ -14,7 +14,7 @@ CSCOPEDIRS= boot bsm cam cddl compat con netsmb nfs nfsclient nfsserver nlm opencrypto \ pci rpc security sys ufs vm xdr ${CSCOPE_ARCHDIR} .if defined(ALL_ARCH) -CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v +CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v x86 .else CSCOPE_ARCHDIR ?= ${MACHINE} .endif From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 03:58:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3645D106564A; Sun, 21 Nov 2010 03:58:12 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 251A58FC12; Sun, 21 Nov 2010 03:58:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAL3wCQS035839; Sun, 21 Nov 2010 03:58:12 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAL3wCNg035837; Sun, 21 Nov 2010 03:58:12 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201011210358.oAL3wCNg035837@svn.freebsd.org> From: "David E. O'Brien" Date: Sun, 21 Nov 2010 03:58:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215606 - head/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 03:58:12 -0000 Author: obrien Date: Sun Nov 21 03:58:11 2010 New Revision: 215606 URL: http://svn.freebsd.org/changeset/base/215606 Log: Add lex and yacc sources to things cscope'd. Modified: head/sys/Makefile Modified: head/sys/Makefile ============================================================================== --- head/sys/Makefile Sun Nov 21 03:56:41 2010 (r215605) +++ head/sys/Makefile Sun Nov 21 03:58:11 2010 (r215606) @@ -34,7 +34,7 @@ cscope.out: ${.CURDIR}/cscope.files ${.CURDIR}/cscope.files: .PHONY cd ${.CURDIR}; \ - find ${CSCOPEDIRS} -name "*.[chSs]" -a -type f > ${.TARGET} + find ${CSCOPEDIRS} -name "*.[chSsly]" -a -type f > ${.TARGET} cscope-clean: rm -f cscope.files cscope.out cscope.in.out cscope.po.out From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 04:02:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 592B01065694; Sun, 21 Nov 2010 04:02:38 +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 2DEBE8FC0A; Sun, 21 Nov 2010 04:02:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAL42cQT035995; Sun, 21 Nov 2010 04:02:38 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAL42cfQ035993; Sun, 21 Nov 2010 04:02:38 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201011210402.oAL42cfQ035993@svn.freebsd.org> From: Kevin Lo Date: Sun, 21 Nov 2010 04:02:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215607 - head/sbin/devd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 04:02:38 -0000 Author: kevlo Date: Sun Nov 21 04:02:37 2010 New Revision: 215607 URL: http://svn.freebsd.org/changeset/base/215607 Log: Fix missing closedir() Reviewed by: imp Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Sun Nov 21 03:58:11 2010 (r215606) +++ head/sbin/devd/devd.cc Sun Nov 21 04:02:37 2010 (r215607) @@ -422,6 +422,7 @@ config::parse_files_in_dir(const char *d parse_one_file(path); } } + closedir(dirp); } class epv_greater { From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 10:18:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81450106566B; Sun, 21 Nov 2010 10:18:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5607B8FC12; Sun, 21 Nov 2010 10:18:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oALAISor043852; Sun, 21 Nov 2010 10:18:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oALAISLX043850; Sun, 21 Nov 2010 10:18:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011211018.oALAISLX043850@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 21 Nov 2010 10:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215610 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 10:18:28 -0000 Author: kib Date: Sun Nov 21 10:18:28 2010 New Revision: 215610 URL: http://svn.freebsd.org/changeset/base/215610 Log: Eliminate the mab, maf arrays and related variables. The change also fixes off-by-one error in the calculation of mreq. Suggested and reviewed by: alc Tested by: pho MFC after: 5 days Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sun Nov 21 10:00:43 2010 (r215609) +++ head/sys/vm/vm_object.c Sun Nov 21 10:18:28 2010 (r215610) @@ -853,57 +853,40 @@ rescan: static int vm_object_page_collect_flush(vm_object_t object, vm_page_t p, int pagerflags) { - int runlen; - int maxf; - int chkb; - int maxb; - int i, index; - vm_pindex_t pi; - vm_page_t maf[vm_pageout_page_count]; - vm_page_t mab[vm_pageout_page_count]; - vm_page_t ma[vm_pageout_page_count]; - vm_page_t tp, p1; + vm_page_t ma[vm_pageout_page_count], p_first, tp; + int count, i, mreq, runlen; mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); vm_page_lock_assert(p, MA_NOTOWNED); VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - pi = p->pindex; - maxf = 0; - for (i = 1, p1 = p; i < vm_pageout_page_count; i++) { - tp = vm_page_next(p1); + + count = 1; + mreq = 0; + + for (tp = p; count < vm_pageout_page_count; count++) { + tp = vm_page_next(tp); if (tp == NULL || tp->busy != 0 || (tp->oflags & VPO_BUSY) != 0) break; vm_page_test_dirty(tp); if (tp->dirty == 0) break; - maf[i - 1] = p1 = tp; - maxf++; } - maxb = 0; - chkb = vm_pageout_page_count - maxf; - for (i = 1, p1 = p; i < chkb; i++) { - tp = vm_page_prev(p1); + for (p_first = p; count < vm_pageout_page_count; count++) { + tp = vm_page_prev(p_first); if (tp == NULL || tp->busy != 0 || (tp->oflags & VPO_BUSY) != 0) break; vm_page_test_dirty(tp); if (tp->dirty == 0) break; - mab[i - 1] = p1 = tp; - maxb++; + p_first = tp; + mreq++; } - for (i = 0; i < maxb; i++) { - index = (maxb - i) - 1; - ma[index] = mab[i]; - } - ma[maxb] = p; - for (i = 0; i < maxf; i++) { - index = (maxb + i) + 1; - ma[index] = maf[i]; - } + for (tp = p_first, i = 0; i < count; tp = TAILQ_NEXT(tp, listq), i++) + ma[i] = tp; - vm_pageout_flush(ma, maxb + maxf + 1, pagerflags, maxb + 1, &runlen); + vm_pageout_flush(ma, count, pagerflags, mreq, &runlen); return (runlen); } From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 10:55:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA447106564A; Sun, 21 Nov 2010 10:55:16 +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 D90CB8FC13; Sun, 21 Nov 2010 10:55:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oALAtGAV052312; Sun, 21 Nov 2010 10:55:16 GMT (envelope-from mckay@svn.freebsd.org) Received: (from mckay@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oALAtG0q052310; Sun, 21 Nov 2010 10:55:16 GMT (envelope-from mckay@svn.freebsd.org) Message-Id: <201011211055.oALAtG0q052310@svn.freebsd.org> From: Stephen McKay Date: Sun, 21 Nov 2010 10:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215615 - head/usr.bin/xargs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 10:55:17 -0000 Author: mckay Date: Sun Nov 21 10:55:16 2010 New Revision: 215615 URL: http://svn.freebsd.org/changeset/base/215615 Log: xargs can be fooled by exiting children that it did not start, causing it to kick off a new command before the previous has finished, resulting in corrupted (interleaved) output. It is also fooled by non-exiting children it did not start, failing to exit until all extraneous children have exited. This patch makes xargs keep track of children it starts, ignoring pre-existing ones. Modified: head/usr.bin/xargs/xargs.c Modified: head/usr.bin/xargs/xargs.c ============================================================================== --- head/usr.bin/xargs/xargs.c Sun Nov 21 10:52:47 2010 (r215614) +++ head/usr.bin/xargs/xargs.c Sun Nov 21 10:55:16 2010 (r215615) @@ -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() +{ + 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() +{ + return curprocs == 0; +} + +static int +pids_full() +{ + 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() +{ + 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-head@FreeBSD.ORG Sun Nov 21 11:50:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 437EE106564A; Sun, 21 Nov 2010 11:50:17 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3299E8FC0C; Sun, 21 Nov 2010 11:50:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oALBoH7E054099; Sun, 21 Nov 2010 11:50:17 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oALBoHab054097; Sun, 21 Nov 2010 11:50:17 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <201011211150.oALBoHab054097@svn.freebsd.org> From: "Simon L. Nielsen" Date: Sun, 21 Nov 2010 11:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215625 - head/usr.sbin/newsyslog X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 11:50:17 -0000 Author: simon Date: Sun Nov 21 11:50:16 2010 New Revision: 215625 URL: http://svn.freebsd.org/changeset/base/215625 Log: Fix a typo in a comment. MFC after: 3 days Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Sun Nov 21 11:10:09 2010 (r215624) +++ head/usr.sbin/newsyslog/newsyslog.c Sun Nov 21 11:50:16 2010 (r215625) @@ -163,7 +163,7 @@ struct include_entry { struct oldlog_entry { char *fname; /* Filename of the log file */ - time_t t; /* Parses timestamp of the logfile */ + time_t t; /* Parsed timestamp of the logfile */ }; typedef enum { From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 12:20:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06846106564A; Sun, 21 Nov 2010 12:20:54 +0000 (UTC) (envelope-from smckay@internode.on.net) Received: from ipmail05.adl6.internode.on.net (ipmail05.adl6.internode.on.net [150.101.137.143]) by mx1.freebsd.org (Postfix) with ESMTP id 31F948FC18; Sun, 21 Nov 2010 12:20:52 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAPaZ6Ex20Ai9/2dsb2JhbACiZnK7SIVLBA Received: from ppp118-208-8-189.lns20.bne1.internode.on.net (HELO dungeon.home) ([118.208.8.189]) by ipmail05.adl6.internode.on.net with ESMTP; 21 Nov 2010 22:35:32 +1030 Received: from dungeon.home (localhost [127.0.0.1]) by dungeon.home (8.14.3/8.14.3) with ESMTP id oALC4jn0035656; Sun, 21 Nov 2010 22:04:45 +1000 (EST) (envelope-from mckay) Message-Id: <201011211204.oALC4jn0035656@dungeon.home> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201011211055.oALAtG0q052310@svn.freebsd.org> In-Reply-To: <201011211055.oALAtG0q052310@svn.freebsd.org> from Stephen McKay at "Sun, 21 Nov 2010 10:55:16 +0000" Date: Sun, 21 Nov 2010 22:04:45 +1000 From: Stephen McKay Cc: Stephen McKay Subject: Re: svn commit: r215615 - head/usr.bin/xargs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 12:20:54 -0000 On Sunday, 21st November 2010, Stephen McKay wrote: >Log: > xargs can be fooled by exiting children that it did not start, causing > it to kick off a new command before the previous has finished, resulting > in corrupted (interleaved) output. It is also fooled by non-exiting > children it did not start, failing to exit until all extraneous children > have exited. > > This patch makes xargs keep track of children it starts, ignoring > pre-existing ones. This bug is obscure enough that I think I may need to give some more detail on how it is triggered. And the fact it survived 8 years in a commonly used utility may lead some people to believe it doesn't exist. Any program can be exec'd with existing children. One way this can happen is a byproduct of the way some shells spawn piped processes. For example, the following command will result in xargs having find as a child: zsh -c '(find . -type f | xargs md5)' Yes, the parentheses are necessary. Otherwise "find" and "xargs" are just siblings. And the following command runs instantly in sh but takes 30s in csh because the sleep is a child of xargs in the latter and xargs waits for all children to exit before exiting: (sleep 30 & find /COPYRIGHT | xargs ls -l) When parallel mode (-P) was added to xargs in 2002, there was an assumption made that every waitpid() call would return a pid that had been spawned by xargs. This inadvertently transformed the serial case into an occasionally parallel case. If ever an extraneous child exited during a run, xargs would spawn a 2nd command before the 1st had finished. Usually this resulted in output corruption. Further, it was assumed that waitpid() would always complete in a timely manner. This was no longer true because unexpected children don't have to exit just because xargs' work is done, and xargs was waiting for all children to exit. Shells where piped processes never seem to be linked in a parent/child relationship include sh, bash and ksh. Shells where it is common include zsh, tcsh and csh. Bash seems to be popular, so most people would never see this problem interactively, and sh is also immune so no scripts would trigger the bug either. Since zsh is my favourite shell, I was "lucky" enough to accidentally (and repeatedly) use command line syntax that triggered this xargs bug while attempting to verify that some hundreds of gigabytes of essential data had been successfully copied from a failing mirror to safer storage during a hairy upgrade. I had to put a lot of money in the swear jar, but it hasn't made me give up on xargs! Or zsh. :-) Stephen. From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 14:15:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 985301065670; Sun, 21 Nov 2010 14:15:41 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id AB2338FC0C; Sun, 21 Nov 2010 14:15:40 +0000 (UTC) Received: by wyb35 with SMTP id 35so5325854wyb.13 for ; Sun, 21 Nov 2010 06:15:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=sq5+AOEuwbtOXjkTzKFaj4baok4WrIH/mw/SJ0JWuSs=; b=GrZaiwJe0ArsIYDGqO4rmMMUquo7eWRhVnMI4Q8QFk9o7z5KMo7HlEIUhAaTFjLLMn sX/p5We3XkMb7Dcbt1cKHtEpAStg5z3jNpyIY+W23gpgrCqctFwyM/Lwm/NeIROeg225 wRnQuWb4yqZ5u6i9FGMZ5zVOZ597bh/XIU5C0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=A1qWAQGZEC10n/Zl9cvNFVtWbAmKexPnUQtEvznD2Ke5noQb0f21f6nLLlkqQyShYY QE4RCtVwgHccvfqHrOniY5gyK4Akn+WnhNtBwTToGw2g9X5Idwh5aFSVriB0AZpuMgrO R6ZCmkbXhp6HzpMHOO5HzFLUtza/WvAISl7ZQ= MIME-Version: 1.0 Received: by 10.216.175.18 with SMTP id y18mr4514927wel.30.1290348934603; Sun, 21 Nov 2010 06:15:34 -0800 (PST) Sender: yanegomi@gmail.com Received: by 10.216.198.27 with HTTP; Sun, 21 Nov 2010 06:15:34 -0800 (PST) In-Reply-To: <201011211055.oALAtG0q052310@svn.freebsd.org> References: <201011211055.oALAtG0q052310@svn.freebsd.org> Date: Sun, 21 Nov 2010 06:15:34 -0800 X-Google-Sender-Auth: FKG4iTJJi9sX4hmRRnJKIneSq2c Message-ID: From: Garrett Cooper To: Stephen McKay Content-Type: multipart/mixed; boundary=0016e6567d28e22592049590c565 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215615 - head/usr.bin/xargs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 14:15:41 -0000 --0016e6567d28e22592049590c565 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sun, Nov 21, 2010 at 2:55 AM, Stephen McKay wrote: > Author: mckay > Date: Sun Nov 21 10:55:16 2010 > New Revision: 215615 > URL: http://svn.freebsd.org/changeset/base/215615 > > Log: > =A0xargs can be fooled by exiting children that it did not start, causing > =A0it to kick off a new command before the previous has finished, resulti= ng > =A0in corrupted (interleaved) output. =A0It is also fooled by non-exiting > =A0children it did not start, failing to exit until all extraneous childr= en > =A0have exited. > > =A0This patch makes xargs keep track of children it starts, ignoring > =A0pre-existing ones. Unfortunately this broke tinderbox and compile on HEAD. Could you please commit the following patch that fixes the compile and a handful of style(9) violations in the new code? Thanks! -Garrett --0016e6567d28e22592049590c565 Content-Type: text/x-patch; charset=US-ASCII; name="xargs-fix-style.patch" Content-Disposition: attachment; filename="xargs-fix-style.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ggs0fa5d0 SW5kZXg6IHVzci5iaW4veGFyZ3MveGFyZ3MuYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSB1c3IuYmluL3hhcmdz L3hhcmdzLmMJKHJldmlzaW9uIDIxNTYzNikKKysrIHVzci5iaW4veGFyZ3MveGFyZ3MuYwkod29y a2luZyBjb3B5KQpAQCAtNTg2LDE0ICs1ODYsMTQgQEAKIAogCWlmIChwaWRzX2VtcHR5KCkpIHsK IAkJZXJybm8gPSBFQ0hJTEQ7Ci0JCXJldHVybiAtMTsKKwkJcmV0dXJuICgtMSk7CiAJfQogCiAJ d2hpbGUgKChwaWQgPSB3YWl0cGlkKC0xLCBzdGF0dXMsIGJsb2NrID8gMCA6IFdOT0hBTkcpKSA+ IDApCiAJCWlmIChwaWRzX3JlbW92ZShwaWQpKQogCQkJYnJlYWs7CiAKLQlyZXR1cm4gcGlkOwor CXJldHVybiAocGlkKTsKIH0KIAogc3RhdGljIHZvaWQKQEAgLTYyNSwyNyArNjI1LDI3IEBACiAj ZGVmaW5lCU5PUElECSgwKQogCiBzdGF0aWMgdm9pZAotcGlkc19pbml0KCkKK3BpZHNfaW5pdCh2 b2lkKQogewogCWludCBpOwogCiAJaWYgKChjaGlsZHBpZHMgPSBtYWxsb2MobWF4cHJvY3MgKiBz aXplb2YoKmNoaWxkcGlkcykpKSA9PSBOVUxMKQotCSAgICBlcnJ4KDEsICJtYWxsb2MgZmFpbGVk Iik7CisJCWVycngoMSwgIm1hbGxvYyBmYWlsZWQiKTsKIAogCWZvciAoaSA9IDA7IGkgPCBtYXhw cm9jczsgaSsrKQogCQljbGVhcnNsb3QoaSk7CiB9CiAKIHN0YXRpYyBpbnQKLXBpZHNfZW1wdHko KQorcGlkc19lbXB0eSh2b2lkKQogewotCXJldHVybiBjdXJwcm9jcyA9PSAwOworCXJldHVybiAo Y3VycHJvY3MgPT0gMCk7CiB9CiAKIHN0YXRpYyBpbnQKLXBpZHNfZnVsbCgpCitwaWRzX2Z1bGwo dm9pZCkKIHsKLQlyZXR1cm4gY3VycHJvY3MgPj0gbWF4cHJvY3M7CisJcmV0dXJuIChjdXJwcm9j cyA+PSBtYXhwcm9jcyk7CiB9CiAKIHN0YXRpYyB2b2lkCkBAIC02NjQsMjIgKzY2NCwyMiBAQAog CWludCBzbG90OwogCiAJaWYgKChzbG90ID0gZmluZHNsb3QocGlkKSkgPCAwKQotCSAgICByZXR1 cm4gMDsKKwkJcmV0dXJuICgwKTsKIAogCWNsZWFyc2xvdChzbG90KTsKIAljdXJwcm9jcy0tOwot CXJldHVybiAxOworCXJldHVybiAoMSk7CiB9CiAKIHN0YXRpYyBpbnQKLWZpbmRmcmVlc2xvdCgp CitmaW5kZnJlZXNsb3Qodm9pZCkKIHsKIAlpbnQgc2xvdDsKIAogCWlmICgoc2xvdCA9IGZpbmRz bG90KE5PUElEKSkgPCAwKQogCQllcnJ4KDEsICJpbnRlcm5hbCBlcnJvcjogbm8gZnJlZSBwaWQg c2xvdCIpOwogCi0JcmV0dXJuIHNsb3Q7CisJcmV0dXJuIChzbG90KTsKIH0KIAogc3RhdGljIGlu dApAQCAtNjg5LDkgKzY4OSw5IEBACiAKIAlmb3IgKHNsb3QgPSAwOyBzbG90IDwgbWF4cHJvY3M7 IHNsb3QrKykKIAkJaWYgKGNoaWxkcGlkc1tzbG90XSA9PSBwaWQpCi0JCQlyZXR1cm4gc2xvdDsK KwkJCXJldHVybiAoc2xvdCk7CiAKLQlyZXR1cm4gLTE7CisJcmV0dXJuICgtMSk7CiB9CiAKIHN0 YXRpYyB2b2lkCg== --0016e6567d28e22592049590c565-- From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 14:34:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8C141065670; Sun, 21 Nov 2010 14:34:25 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7CB58FC13; Sun, 21 Nov 2010 14:34:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oALEYPaR059861; Sun, 21 Nov 2010 14:34:25 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oALEYPmY059859; Sun, 21 Nov 2010 14:34:25 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201011211434.oALEYPmY059859@svn.freebsd.org> From: Bruce Cran Date: Sun, 21 Nov 2010 14:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215637 - head/usr.sbin/sysinstall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 14:34:25 -0000 Author: brucec Date: Sun Nov 21 14:34:25 2010 New Revision: 215637 URL: http://svn.freebsd.org/changeset/base/215637 Log: dispatch_add_command: Modify the logic so there's only one exit point instead of two. Only insert valid (non-NULL) values into the queue. dispatch_free_command: Ensure that item is not NULL before removing it from the queue and dereferencing the pointer. NULL out free'd pointers to catch any use-after-free bugs. PR: bin/146855 Submitted by: gcooper MFC after: 3 days Modified: head/usr.sbin/sysinstall/dispatch.c Modified: head/usr.sbin/sysinstall/dispatch.c ============================================================================== --- head/usr.sbin/sysinstall/dispatch.c Sun Nov 21 13:41:04 2010 (r215636) +++ head/usr.sbin/sysinstall/dispatch.c Sun Nov 21 14:34:25 2010 (r215637) @@ -136,8 +136,12 @@ typedef struct command_buffer_ { static void dispatch_free_command(command_buffer *item) { - REMQUE(item); - free(item->string); + if (item != NULL) { + REMQUE(item); + free(item->string); + item->string = NULL; + } + free(item); } @@ -155,19 +159,29 @@ dispatch_free_all(qelement *head) static command_buffer * dispatch_add_command(qelement *head, char *string) { - command_buffer *new; + command_buffer *new = NULL; new = malloc(sizeof(command_buffer)); - if (!new) - return NULL; + if (new != NULL) { - new->string = strdup(string); - INSQUEUE(new, head->q_back); + new->string = strdup(string); + + /* + * We failed to copy `string'; clean up the allocated + * resources. + */ + if (new->string == NULL) { + free(new); + new = NULL; + } else { + INSQUEUE(new, head->q_back); + } + } return new; } - + /* * Command processing */ @@ -280,7 +294,7 @@ dispatchCommand(char *str) return i; } - + /* * File processing */ From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 18:51:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C0FB1065695; Sun, 21 Nov 2010 18:51:41 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 442638FC16; Sun, 21 Nov 2010 18:51:40 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 1BB5845B36; Sun, 21 Nov 2010 19:51:38 +0100 (CET) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 7D85745683; Sun, 21 Nov 2010 19:51:32 +0100 (CET) Date: Sun, 21 Nov 2010 19:50:44 +0100 From: Pawel Jakub Dawidek To: "Andrey V. Elsukov" Message-ID: <20101121185044.GA14585@garage.freebsd.pl> References: <201011201603.oAKG3rED017856@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <201011201603.oAKG3rED017856@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215570 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 18:51:41 -0000 --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 20, 2010 at 04:03:53PM +0000, Andrey V. Elsukov wrote: > Author: ae > Date: Sat Nov 20 16:03:53 2010 > New Revision: 215570 > URL: http://svn.freebsd.org/changeset/base/215570 >=20 > Log: > Add to gpart(8) an ability to backup partition table and > restore it from given backup. [...] > + { "backup", 0, gpart_backup, { > + { 'l', "backup_labels", NULL, G_TYPE_BOOL}, > + G_OPT_SENTINEL }, > + "[-l] geom" > + }, My opinion was that it would be more handy to always backup labels, but simply not always restore them. I'd much more prefer an option to restore than to backup. Backup should contains everything and one should be able to filter what to restore at restore time. What do you think? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --C7zPtVaVf+AK4Oqc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzpagMACgkQForvXbEpPzQVMQCgjDPTAHg36VU/XNRQOX+rGqCG hEMAn0RqoaAC97zN49oKg0Ybgzqaep8W =vwsQ -----END PGP SIGNATURE----- --C7zPtVaVf+AK4Oqc-- From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 19:33:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16377106566C; Sun, 21 Nov 2010 19:33:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 056E98FC12; Sun, 21 Nov 2010 19:33:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oALJXJOL066047; Sun, 21 Nov 2010 19:33:19 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oALJXJ97066045; Sun, 21 Nov 2010 19:33:19 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201011211933.oALJXJ97066045@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 21 Nov 2010 19:33:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215641 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 19:33:20 -0000 Author: bz Date: Sun Nov 21 19:33:19 2010 New Revision: 215641 URL: http://svn.freebsd.org/changeset/base/215641 Log: Add a missing ';' and change the debugging sysctl from xint to int. Submitted by: Mikolaj Golub (to.my.trociny gmail.com) MFC after: 3 days Modified: head/sys/net/if_epair.c Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Sun Nov 21 18:04:28 2010 (r215640) +++ head/sys/net/if_epair.c Sun Nov 21 19:33:19 2010 (r215641) @@ -78,7 +78,7 @@ SYSCTL_NODE(_net_link, OID_AUTO, epair, #ifdef EPAIR_DEBUG static int epair_debug = 0; -SYSCTL_XINT(_net_link_epair, OID_AUTO, epair_debug, CTLFLAG_RW, +SYSCTL_INT(_net_link_epair, OID_AUTO, epair_debug, CTLFLAG_RW, &epair_debug, 0, "if_epair(4) debugging."); #define DPRINTF(fmt, arg...) \ if (epair_debug) \ @@ -305,7 +305,7 @@ epair_nh_drainedcpu(u_int cpuid) if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) != 0) { /* Our "hw"q overflew again. */ - epair_dpcpu->epair_drv_flags |= IFF_DRV_OACTIVE + epair_dpcpu->epair_drv_flags |= IFF_DRV_OACTIVE; DPRINTF("hw queue length overflow at %u\n", epair_nh.nh_qlimit); break; From owner-svn-src-head@FreeBSD.ORG Sun Nov 21 21:31:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 376B01065693; Sun, 21 Nov 2010 21:31:30 +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 26A0C8FC19; Sun, 21 Nov 2010 21:31:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oALLVUYo068589; Sun, 21 Nov 2010 21:31:30 GMT (envelope-from mckay@svn.freebsd.org) Received: (from mckay@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oALLVUDx068587; Sun, 21 Nov 2010 21:31:30 GMT (envelope-from mckay@svn.freebsd.org) Message-Id: <201011212131.oALLVUDx068587@svn.freebsd.org> From: Stephen McKay Date: Sun, 21 Nov 2010 21:31:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215642 - head/usr.bin/xargs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2010 21:31:30 -0000 Author: mckay Date: Sun Nov 21 21:31:29 2010 New Revision: 215642 URL: http://svn.freebsd.org/changeset/base/215642 Log: Various syntactic tweaks to satisfy style(9). No change to execution. Submitted by: gcooper@ Modified: head/usr.bin/xargs/xargs.c Modified: head/usr.bin/xargs/xargs.c ============================================================================== --- head/usr.bin/xargs/xargs.c Sun Nov 21 19:33:19 2010 (r215641) +++ head/usr.bin/xargs/xargs.c Sun Nov 21 21:31:29 2010 (r215642) @@ -586,14 +586,14 @@ xwait(int block, int *status) { if (pids_empty()) { errno = ECHILD; - return -1; + return (-1); } while ((pid = waitpid(-1, status, block ? 0 : WNOHANG)) > 0) if (pids_remove(pid)) break; - return pid; + return (pid); } static void @@ -625,27 +625,27 @@ waitchildren(const char *name, int waita #define NOPID (0) static void -pids_init() +pids_init(void) { int i; if ((childpids = malloc(maxprocs * sizeof(*childpids))) == NULL) - errx(1, "malloc failed"); + errx(1, "malloc failed"); for (i = 0; i < maxprocs; i++) clearslot(i); } static int -pids_empty() +pids_empty(void) { - return curprocs == 0; + return (curprocs == 0); } static int -pids_full() +pids_full(void) { - return curprocs >= maxprocs; + return (curprocs >= maxprocs); } static void @@ -664,22 +664,22 @@ pids_remove(pid_t pid) int slot; if ((slot = findslot(pid)) < 0) - return 0; + return (0); clearslot(slot); curprocs--; - return 1; + return (1); } static int -findfreeslot() +findfreeslot(void) { int slot; if ((slot = findslot(NOPID)) < 0) errx(1, "internal error: no free pid slot"); - return slot; + return (slot); } static int @@ -689,9 +689,9 @@ findslot(pid_t pid) for (slot = 0; slot < maxprocs; slot++) if (childpids[slot] == pid) - return slot; + return (slot); - return -1; + return (-1); } static void From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 01:11:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6270106564A; Mon, 22 Nov 2010 01:11:28 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2C178FC0A; Mon, 22 Nov 2010 01:11:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAM1BSKA073620; Mon, 22 Nov 2010 01:11:28 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAM1BSWE073613; Mon, 22 Nov 2010 01:11:28 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201011220111.oAM1BSWE073613@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 22 Nov 2010 01:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215649 - in head/sys: conf dev/usb dev/usb/controller modules/usb/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 01:11:28 -0000 Author: weongyo Date: Mon Nov 22 01:11:28 2010 New Revision: 215649 URL: http://svn.freebsd.org/changeset/base/215649 Log: Adds a USB packet filter feature to the stack that it could capture packets which go through each USB host controllers. Its implementations are almost based on BPF code and very similar with it except it's little bit customized for USB packet only. The userland program usbdump(8) would be committed soon. Discussed with: hps, thompsa, yongari Added: head/sys/dev/usb/usb_pf.c (contents, props changed) head/sys/dev/usb/usb_pf.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_transfer.c head/sys/modules/usb/usb/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Nov 22 00:44:43 2010 (r215648) +++ head/sys/conf/files Mon Nov 22 01:11:28 2010 (r215649) @@ -1779,6 +1779,7 @@ dev/usb/usb_lookup.c optional usb dev/usb/usb_mbuf.c optional usb dev/usb/usb_msctest.c optional usb dev/usb/usb_parse.c optional usb +dev/usb/usb_pf.c optional usb dev/usb/usb_process.c optional usb dev/usb/usb_request.c optional usb dev/usb/usb_transfer.c optional usb Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Mon Nov 22 00:44:43 2010 (r215648) +++ head/sys/dev/usb/controller/usb_controller.c Mon Nov 22 01:11:28 2010 (r215649) @@ -61,6 +61,7 @@ #include #include +#include /* function prototypes */ @@ -547,6 +548,8 @@ usb_bus_mem_alloc_all(struct usb_bus *bu TAILQ_INIT(&bus->intr_q.head); + usbpf_attach(bus, &bus->uif); + #if USB_HAVE_BUSDMA usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags, dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX); @@ -594,5 +597,34 @@ usb_bus_mem_free_all(struct usb_bus *bus usb_dma_tag_unsetup(bus->dma_parent_tag); #endif + usbpf_detach(bus); + mtx_destroy(&bus->bus_mtx); } + +struct usb_bus * +usb_bus_find(const char *name) +{ + struct usb_bus *ubus; + devclass_t dc; + device_t *devlist; + int devcount, error, i; + const char *nameunit; + + dc = devclass_find("usbus"); + if (dc == NULL) + return (NULL); + error = devclass_get_devices(dc, &devlist, &devcount); + if (error != 0) + return (NULL); + for (i = 0; i < devcount; i++) { + nameunit = device_get_nameunit(devlist[i]); + if (!strncmp(name, nameunit, strlen(nameunit))) { + ubus = device_get_ivars(devlist[i]); + free(devlist, M_TEMP); + return (ubus); + } + } + free(devlist, M_TEMP); + return (NULL); +} Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Mon Nov 22 00:44:43 2010 (r215648) +++ head/sys/dev/usb/usb_bus.h Mon Nov 22 01:11:28 2010 (r215649) @@ -86,6 +86,8 @@ struct usb_bus { struct usb_bus_methods *methods; /* filled by HC driver */ struct usb_device **devices; + struct usbpf_if *uif; /* USB Packet Filter */ + usb_power_mask_t hw_power_state; /* see USB_HW_POWER_XXX */ usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; Modified: head/sys/dev/usb/usb_controller.h ============================================================================== --- head/sys/dev/usb/usb_controller.h Mon Nov 22 00:44:43 2010 (r215648) +++ head/sys/dev/usb/usb_controller.h Mon Nov 22 01:11:28 2010 (r215649) @@ -221,5 +221,6 @@ void usb_bus_mem_free_all(struct usb_bus uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); uint16_t usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time); uint8_t usbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len); +struct usb_bus *usb_bus_find(const char *name); #endif /* _USB_CONTROLLER_H_ */ Added: head/sys/dev/usb/usb_pf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/usb_pf.c Mon Nov 22 01:11:28 2010 (r215649) @@ -0,0 +1,1862 @@ +/*- + * Copyright (c) 1990, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * 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. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * All usbpf implementations are extracted from bpf(9) APIs and it's + * specialized for USB packet filtering between the driver and the host + * controller. + */ + +MALLOC_DEFINE(M_USBPF, "USBPktFilter", "USB Packet Filter"); + +/* + * Rotate the packet buffers in descriptor ud. Move the store buffer into the + * hold slot, and the free buffer ino the store slot. Zero the length of the + * new store buffer. Descriptor lock should be held. + */ +#define USBPF_ROTATE_BUFFERS(ud) do { \ + (ud)->ud_hbuf = (ud)->ud_sbuf; \ + (ud)->ud_hlen = (ud)->ud_slen; \ + (ud)->ud_sbuf = (ud)->ud_fbuf; \ + (ud)->ud_slen = 0; \ + (ud)->ud_fbuf = NULL; \ + usbpf_bufheld(ud); \ +} while (0) + +#ifndef __i386__ +#define USBPF_ALIGN +#endif + +#ifndef USBPF_ALIGN +#define USBPF_EXTRACT_SHORT(p) ((u_int16_t)ntohs(*(u_int16_t *)p)) +#define USBPF_EXTRACT_LONG(p) (ntohl(*(u_int32_t *)p)) +#else +#define USBPF_EXTRACT_SHORT(p) \ + ((u_int16_t) \ + ((u_int16_t)*((u_char *)p+0)<<8| \ + (u_int16_t)*((u_char *)p+1)<<0)) +#define USBPF_EXTRACT_LONG(p) \ + ((u_int32_t)*((u_char *)p+0)<<24| \ + (u_int32_t)*((u_char *)p+1)<<16| \ + (u_int32_t)*((u_char *)p+2)<<8| \ + (u_int32_t)*((u_char *)p+3)<<0) +#endif + +/* + * Number of scratch memory words (for USBPF_LD|USBPF_MEM and USBPF_ST). + */ +#define USBPF_MEMWORDS 16 + +/* Values for ud_state */ +#define USBPF_IDLE 0 /* no select in progress */ +#define USBPF_WAITING 1 /* waiting for read timeout in select */ +#define USBPF_TIMED_OUT 2 /* read timeout has expired in select */ + +#define PRIUSB 26 /* interruptible */ + +/* Frame directions */ +enum usbpf_direction { + USBPF_D_IN, /* See incoming frames */ + USBPF_D_INOUT, /* See incoming and outgoing frames */ + USBPF_D_OUT /* See outgoing frames */ +}; + +static void usbpf_append_bytes(struct usbpf_d *, caddr_t, u_int, void *, + u_int); +static void usbpf_attachd(struct usbpf_d *, struct usbpf_if *); +static void usbpf_detachd(struct usbpf_d *); +static int usbpf_canfreebuf(struct usbpf_d *); +static void usbpf_buf_reclaimed(struct usbpf_d *); +static int usbpf_canwritebuf(struct usbpf_d *); + +static d_open_t usbpf_open; +static d_read_t usbpf_read; +static d_write_t usbpf_write; +static d_ioctl_t usbpf_ioctl; +static d_poll_t usbpf_poll; +static d_kqfilter_t usbpf_kqfilter; + +static struct cdevsw usbpf_cdevsw = { + .d_version = D_VERSION, + .d_open = usbpf_open, + .d_read = usbpf_read, + .d_write = usbpf_write, + .d_ioctl = usbpf_ioctl, + .d_poll = usbpf_poll, + .d_name = "usbpf", + .d_kqfilter = usbpf_kqfilter, +}; + +static LIST_HEAD(, usbpf_if) usbpf_iflist; +static struct mtx usbpf_mtx; /* global lock */ +static int usbpf_uifd_cnt; + +static int usbpf_bufsize = 4096; +#define USBPF_MINBUFSIZE 32 +#define USBPF_MAXBUFSIZE 0x80000 +static int usbpf_maxbufsize = USBPF_MAXBUFSIZE; +#define USBPF_MAXINSNS 512 +static int usbpf_maxinsns = USBPF_MAXINSNS; + +static void +usbpf_buffer_init(struct usbpf_d *ud) +{ + + ud->ud_bufsize = usbpf_bufsize; +} + +/* + * Free USBPF kernel buffers on device close. + */ +static void +usbpf_buffer_free(struct usbpf_d *ud) +{ + + if (ud->ud_sbuf != NULL) + free(ud->ud_sbuf, M_USBPF); + if (ud->ud_hbuf != NULL) + free(ud->ud_hbuf, M_USBPF); + if (ud->ud_fbuf != NULL) + free(ud->ud_fbuf, M_USBPF); + +#ifdef INVARIANTS + ud->ud_sbuf = ud->ud_hbuf = ud->ud_fbuf = (caddr_t)~0; +#endif +} + +static void +usbpf_buffer_alloc(struct usbpf_d *ud) +{ + + KASSERT(ud->ud_fbuf == NULL, ("%s: ud_fbuf != NULL", __func__)); + KASSERT(ud->ud_sbuf == NULL, ("%s: ud_sbuf != NULL", __func__)); + KASSERT(ud->ud_hbuf == NULL, ("%s: ud_hbuf != NULL", __func__)); + + ud->ud_fbuf = (caddr_t)malloc(ud->ud_bufsize, M_USBPF, M_WAITOK); + ud->ud_sbuf = (caddr_t)malloc(ud->ud_bufsize, M_USBPF, M_WAITOK); + ud->ud_hbuf = NULL; + ud->ud_slen = 0; + ud->ud_hlen = 0; +} + +/* + * Copy buffer storage to user space in read(). + */ +static int +usbpf_buffer_uiomove(struct usbpf_d *ud, caddr_t buf, u_int len, + struct uio *uio) +{ + + return (uiomove(buf, len, uio)); +} + +/* + * Simple data copy to the current kernel buffer. + */ +static void +usbpf_buffer_append_bytes(struct usbpf_d *ud, caddr_t buf, u_int offset, + void *src, u_int len) +{ + u_char *src_bytes; + + src_bytes = (u_char *)src; + bcopy(src_bytes, buf + offset, len); +} + +/* + * Allocate or resize buffers. + */ +static int +usbpf_buffer_ioctl_sblen(struct usbpf_d *ud, u_int *i) +{ + u_int size; + + USBPFD_LOCK(ud); + if (ud->ud_bif != NULL) { + USBPFD_UNLOCK(ud); + return (EINVAL); + } + size = *i; + if (size > usbpf_maxbufsize) + *i = size = usbpf_maxbufsize; + else if (size < USBPF_MINBUFSIZE) + *i = size = USBPF_MINBUFSIZE; + ud->ud_bufsize = size; + USBPFD_UNLOCK(ud); + return (0); +} + +static const u_short usbpf_code_map[] = { + 0x10ff, /* 0x00-0x0f: 1111111100001000 */ + 0x3070, /* 0x10-0x1f: 0000111000001100 */ + 0x3131, /* 0x20-0x2f: 1000110010001100 */ + 0x3031, /* 0x30-0x3f: 1000110000001100 */ + 0x3131, /* 0x40-0x4f: 1000110010001100 */ + 0x1011, /* 0x50-0x5f: 1000100000001000 */ + 0x1013, /* 0x60-0x6f: 1100100000001000 */ + 0x1010, /* 0x70-0x7f: 0000100000001000 */ + 0x0093, /* 0x80-0x8f: 1100100100000000 */ + 0x0000, /* 0x90-0x9f: 0000000000000000 */ + 0x0000, /* 0xa0-0xaf: 0000000000000000 */ + 0x0002, /* 0xb0-0xbf: 0100000000000000 */ + 0x0000, /* 0xc0-0xcf: 0000000000000000 */ + 0x0000, /* 0xd0-0xdf: 0000000000000000 */ + 0x0000, /* 0xe0-0xef: 0000000000000000 */ + 0x0000 /* 0xf0-0xff: 0000000000000000 */ +}; + +#define USBPF_VALIDATE_CODE(c) \ + ((c) <= 0xff && (usbpf_code_map[(c) >> 4] & (1 << ((c) & 0xf))) != 0) + +/* + * Return true if the 'fcode' is a valid filter program. + * The constraints are that each jump be forward and to a valid + * code. The code must terminate with either an accept or reject. + * + * The kernel needs to be able to verify an application's filter code. + * Otherwise, a bogus program could easily crash the system. + */ +static int +usbpf_validate(const struct usbpf_insn *f, int len) +{ + register int i; + register const struct usbpf_insn *p; + + /* Do not accept negative length filter. */ + if (len < 0) + return (0); + + /* An empty filter means accept all. */ + if (len == 0) + return (1); + + for (i = 0; i < len; ++i) { + p = &f[i]; + /* + * Check that the code is valid. + */ + if (!USBPF_VALIDATE_CODE(p->code)) + return (0); + /* + * Check that that jumps are forward, and within + * the code block. + */ + if (USBPF_CLASS(p->code) == USBPF_JMP) { + register u_int offset; + + if (p->code == (USBPF_JMP|USBPF_JA)) + offset = p->k; + else + offset = p->jt > p->jf ? p->jt : p->jf; + if (offset >= (u_int)(len - i) - 1) + return (0); + continue; + } + /* + * Check that memory operations use valid addresses. + */ + if (p->code == USBPF_ST || p->code == USBPF_STX || + p->code == (USBPF_LD|USBPF_MEM) || + p->code == (USBPF_LDX|USBPF_MEM)) { + if (p->k >= USBPF_MEMWORDS) + return (0); + continue; + } + /* + * Check for constant division by 0. + */ + if (p->code == (USBPF_ALU|USBPF_DIV|USBPF_K) && p->k == 0) + return (0); + } + return (USBPF_CLASS(f[len - 1].code) == USBPF_RET); +} + +#ifdef _KERNEL +#define MINDEX(m, k) \ +{ \ + register int len = m->m_len; \ + \ + while (k >= len) { \ + k -= len; \ + m = m->m_next; \ + if (m == 0) \ + return (0); \ + len = m->m_len; \ + } \ +} + +static u_int16_t m_xhalf(struct mbuf *m, usbpf_u_int32 k, int *err); +static u_int32_t m_xword(struct mbuf *m, usbpf_u_int32 k, int *err); + +static u_int32_t +m_xword(struct mbuf *m, usbpf_u_int32 k, int *err) +{ + size_t len; + u_char *cp, *np; + struct mbuf *m0; + + len = m->m_len; + while (k >= len) { + k -= len; + m = m->m_next; + if (m == 0) + goto bad; + len = m->m_len; + } + cp = mtod(m, u_char *) + k; + if (len - k >= 4) { + *err = 0; + return (USBPF_EXTRACT_LONG(cp)); + } + m0 = m->m_next; + if (m0 == 0 || m0->m_len + len - k < 4) + goto bad; + *err = 0; + np = mtod(m0, u_char *); + switch (len - k) { + case 1: + return (((u_int32_t)cp[0] << 24) | + ((u_int32_t)np[0] << 16) | + ((u_int32_t)np[1] << 8) | + (u_int32_t)np[2]); + + case 2: + return (((u_int32_t)cp[0] << 24) | + ((u_int32_t)cp[1] << 16) | + ((u_int32_t)np[0] << 8) | + (u_int32_t)np[1]); + + default: + return (((u_int32_t)cp[0] << 24) | + ((u_int32_t)cp[1] << 16) | + ((u_int32_t)cp[2] << 8) | + (u_int32_t)np[0]); + } + bad: + *err = 1; + return (0); +} + +static u_int16_t +m_xhalf(struct mbuf *m, usbpf_u_int32 k, int *err) +{ + size_t len; + u_char *cp; + struct mbuf *m0; + + len = m->m_len; + while (k >= len) { + k -= len; + m = m->m_next; + if (m == 0) + goto bad; + len = m->m_len; + } + cp = mtod(m, u_char *) + k; + if (len - k >= 2) { + *err = 0; + return (USBPF_EXTRACT_SHORT(cp)); + } + m0 = m->m_next; + if (m0 == 0) + goto bad; + *err = 0; + return ((cp[0] << 8) | mtod(m0, u_char *)[0]); + bad: + *err = 1; + return (0); +} +#endif + +/* + * Execute the filter program starting at pc on the packet p + * wirelen is the length of the original packet + * buflen is the amount of data present + */ +static u_int +usbpf_filter(const struct usbpf_insn *pc, u_char *p, u_int wirelen, + u_int buflen) +{ + u_int32_t A = 0, X = 0; + usbpf_u_int32 k; + u_int32_t mem[USBPF_MEMWORDS]; + + /* + * XXX temporarily the filter system is disabled because currently it + * could not handle the some machine code properly that leads to + * kernel crash by invalid usage. + */ + return ((u_int)-1); + + if (pc == NULL) + /* + * No filter means accept all. + */ + return ((u_int)-1); + + --pc; + while (1) { + ++pc; + switch (pc->code) { + default: +#ifdef _KERNEL + return (0); +#else + abort(); +#endif + + case USBPF_RET|USBPF_K: + return ((u_int)pc->k); + + case USBPF_RET|USBPF_A: + return ((u_int)A); + + case USBPF_LD|USBPF_W|USBPF_ABS: + k = pc->k; + if (k > buflen || sizeof(int32_t) > buflen - k) { +#ifdef _KERNEL + int merr; + + if (buflen != 0) + return (0); + A = m_xword((struct mbuf *)p, k, &merr); + if (merr != 0) + return (0); + continue; +#else + return (0); +#endif + } +#ifdef USBPF_ALIGN + if (((intptr_t)(p + k) & 3) != 0) + A = USBPF_EXTRACT_LONG(&p[k]); + else +#endif + A = ntohl(*(int32_t *)(p + k)); + continue; + + case USBPF_LD|USBPF_H|USBPF_ABS: + k = pc->k; + if (k > buflen || sizeof(int16_t) > buflen - k) { +#ifdef _KERNEL + int merr; + + if (buflen != 0) + return (0); + A = m_xhalf((struct mbuf *)p, k, &merr); + continue; +#else + return (0); +#endif + } + A = USBPF_EXTRACT_SHORT(&p[k]); + continue; + + case USBPF_LD|USBPF_B|USBPF_ABS: + k = pc->k; + if (k >= buflen) { +#ifdef _KERNEL + struct mbuf *m; + + if (buflen != 0) + return (0); + m = (struct mbuf *)p; + MINDEX(m, k); + A = mtod(m, u_char *)[k]; + continue; +#else + return (0); +#endif + } + A = p[k]; + continue; + + case USBPF_LD|USBPF_W|USBPF_LEN: + A = wirelen; + continue; + + case USBPF_LDX|USBPF_W|USBPF_LEN: + X = wirelen; + continue; + + case USBPF_LD|USBPF_W|USBPF_IND: + k = X + pc->k; + if (pc->k > buflen || X > buflen - pc->k || + sizeof(int32_t) > buflen - k) { +#ifdef _KERNEL + int merr; + + if (buflen != 0) + return (0); + A = m_xword((struct mbuf *)p, k, &merr); + if (merr != 0) + return (0); + continue; +#else + return (0); +#endif + } +#ifdef USBPF_ALIGN + if (((intptr_t)(p + k) & 3) != 0) + A = USBPF_EXTRACT_LONG(&p[k]); + else +#endif + A = ntohl(*(int32_t *)(p + k)); + continue; + + case USBPF_LD|USBPF_H|USBPF_IND: + k = X + pc->k; + if (X > buflen || pc->k > buflen - X || + sizeof(int16_t) > buflen - k) { +#ifdef _KERNEL + int merr; + + if (buflen != 0) + return (0); + A = m_xhalf((struct mbuf *)p, k, &merr); + if (merr != 0) + return (0); + continue; +#else + return (0); +#endif + } + A = USBPF_EXTRACT_SHORT(&p[k]); + continue; + + case USBPF_LD|USBPF_B|USBPF_IND: + k = X + pc->k; + if (pc->k >= buflen || X >= buflen - pc->k) { +#ifdef _KERNEL + struct mbuf *m; + + if (buflen != 0) + return (0); + m = (struct mbuf *)p; + MINDEX(m, k); + A = mtod(m, u_char *)[k]; + continue; +#else + return (0); +#endif + } + A = p[k]; + continue; + + case USBPF_LDX|USBPF_MSH|USBPF_B: + k = pc->k; + if (k >= buflen) { +#ifdef _KERNEL + register struct mbuf *m; + + if (buflen != 0) + return (0); + m = (struct mbuf *)p; + MINDEX(m, k); + X = (mtod(m, u_char *)[k] & 0xf) << 2; + continue; +#else + return (0); +#endif + } + X = (p[pc->k] & 0xf) << 2; + continue; + + case USBPF_LD|USBPF_IMM: + A = pc->k; + continue; + + case USBPF_LDX|USBPF_IMM: + X = pc->k; + continue; + + case USBPF_LD|USBPF_MEM: + A = mem[pc->k]; + continue; + + case USBPF_LDX|USBPF_MEM: + X = mem[pc->k]; + continue; + + case USBPF_ST: + mem[pc->k] = A; + continue; + + case USBPF_STX: + mem[pc->k] = X; + continue; + + case USBPF_JMP|USBPF_JA: + pc += pc->k; + continue; + + case USBPF_JMP|USBPF_JGT|USBPF_K: + pc += (A > pc->k) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JGE|USBPF_K: + pc += (A >= pc->k) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JEQ|USBPF_K: + pc += (A == pc->k) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JSET|USBPF_K: + pc += (A & pc->k) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JGT|USBPF_X: + pc += (A > X) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JGE|USBPF_X: + pc += (A >= X) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JEQ|USBPF_X: + pc += (A == X) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JSET|USBPF_X: + pc += (A & X) ? pc->jt : pc->jf; + continue; + + case USBPF_ALU|USBPF_ADD|USBPF_X: + A += X; + continue; + + case USBPF_ALU|USBPF_SUB|USBPF_X: + A -= X; + continue; + + case USBPF_ALU|USBPF_MUL|USBPF_X: + A *= X; + continue; + + case USBPF_ALU|USBPF_DIV|USBPF_X: + if (X == 0) + return (0); + A /= X; + continue; + + case USBPF_ALU|USBPF_AND|USBPF_X: + A &= X; + continue; + + case USBPF_ALU|USBPF_OR|USBPF_X: + A |= X; + continue; + + case USBPF_ALU|USBPF_LSH|USBPF_X: + A <<= X; + continue; + + case USBPF_ALU|USBPF_RSH|USBPF_X: + A >>= X; + continue; + + case USBPF_ALU|USBPF_ADD|USBPF_K: + A += pc->k; + continue; + + case USBPF_ALU|USBPF_SUB|USBPF_K: + A -= pc->k; + continue; + + case USBPF_ALU|USBPF_MUL|USBPF_K: + A *= pc->k; + continue; + + case USBPF_ALU|USBPF_DIV|USBPF_K: + A /= pc->k; + continue; + + case USBPF_ALU|USBPF_AND|USBPF_K: + A &= pc->k; + continue; + + case USBPF_ALU|USBPF_OR|USBPF_K: + A |= pc->k; + continue; + + case USBPF_ALU|USBPF_LSH|USBPF_K: + A <<= pc->k; + continue; + + case USBPF_ALU|USBPF_RSH|USBPF_K: + A >>= pc->k; + continue; + + case USBPF_ALU|USBPF_NEG: + A = -A; + continue; + + case USBPF_MISC|USBPF_TAX: + X = A; + continue; + + case USBPF_MISC|USBPF_TXA: + A = X; + continue; + } + } +} + +static void +usbpf_free(struct usbpf_d *ud) +{ + + switch (ud->ud_bufmode) { + case USBPF_BUFMODE_BUFFER: + return (usbpf_buffer_free(ud)); + default: + panic("usbpf_buf_free"); + } +} + +/* + * Notify the buffer model that a buffer has moved into the hold position. + */ +static void +usbpf_bufheld(struct usbpf_d *ud) +{ + + USBPFD_LOCK_ASSERT(ud); +} + +/* + * Free buffers currently in use by a descriptor. + * Called on close. + */ +static void +usbpf_freed(struct usbpf_d *ud) +{ + + /* + * We don't need to lock out interrupts since this descriptor has + * been detached from its interface and it yet hasn't been marked + * free. + */ + usbpf_free(ud); + if (ud->ud_rfilter != NULL) + free((caddr_t)ud->ud_rfilter, M_USBPF); + if (ud->ud_wfilter != NULL) + free((caddr_t)ud->ud_wfilter, M_USBPF); + mtx_destroy(&ud->ud_mtx); +} + +/* + * Close the descriptor by detaching it from its interface, + * deallocating its buffers, and marking it free. + */ +static void +usbpf_dtor(void *data) +{ + struct usbpf_d *ud = data; + + USBPFD_LOCK(ud); + if (ud->ud_state == USBPF_WAITING) + callout_stop(&ud->ud_callout); + ud->ud_state = USBPF_IDLE; + USBPFD_UNLOCK(ud); + funsetown(&ud->ud_sigio); + mtx_lock(&usbpf_mtx); + if (ud->ud_bif) + usbpf_detachd(ud); + mtx_unlock(&usbpf_mtx); + selwakeuppri(&ud->ud_sel, PRIUSB); + knlist_destroy(&ud->ud_sel.si_note); + callout_drain(&ud->ud_callout); + usbpf_freed(ud); + free(ud, M_USBPF); +} + +/* + * Open device. Returns ENXIO for illegal minor device number, + * EBUSY if file is open by another process. + */ +/* ARGSUSED */ +static int +usbpf_open(struct cdev *dev, int flags, int fmt, struct thread *td) +{ + struct usbpf_d *ud; + int error; + + ud = malloc(sizeof(*ud), M_USBPF, M_WAITOK | M_ZERO); + error = devfs_set_cdevpriv(ud, usbpf_dtor); + if (error != 0) { + free(ud, M_USBPF); + return (error); + } + + usbpf_buffer_init(ud); + ud->ud_bufmode = USBPF_BUFMODE_BUFFER; + ud->ud_sig = SIGIO; + ud->ud_direction = USBPF_D_INOUT; + ud->ud_pid = td->td_proc->p_pid; + mtx_init(&ud->ud_mtx, devtoname(dev), "usbpf cdev lock", MTX_DEF); + callout_init_mtx(&ud->ud_callout, &ud->ud_mtx, 0); + knlist_init_mtx(&ud->ud_sel.si_note, &ud->ud_mtx); + + return (0); +} + +static int +usbpf_uiomove(struct usbpf_d *ud, caddr_t buf, u_int len, struct uio *uio) +{ + + if (ud->ud_bufmode != USBPF_BUFMODE_BUFFER) + return (EOPNOTSUPP); + return (usbpf_buffer_uiomove(ud, buf, len, uio)); +} + +/* + * usbpf_read - read next chunk of packets from buffers + */ +static int +usbpf_read(struct cdev *dev, struct uio *uio, int ioflag) +{ + struct usbpf_d *ud; + int error; + int non_block; + int timed_out; + + error = devfs_get_cdevpriv((void **)&ud); + if (error != 0) + return (error); + + /* + * Restrict application to use a buffer the same size as + * as kernel buffers. + */ + if (uio->uio_resid != ud->ud_bufsize) + return (EINVAL); + + non_block = ((ioflag & O_NONBLOCK) != 0); + + USBPFD_LOCK(ud); + ud->ud_pid = curthread->td_proc->p_pid; + if (ud->ud_bufmode != USBPF_BUFMODE_BUFFER) { + USBPFD_UNLOCK(ud); + return (EOPNOTSUPP); + } + if (ud->ud_state == USBPF_WAITING) + callout_stop(&ud->ud_callout); + timed_out = (ud->ud_state == USBPF_TIMED_OUT); + ud->ud_state = USBPF_IDLE; + /* + * If the hold buffer is empty, then do a timed sleep, which + * ends when the timeout expires or when enough packets + * have arrived to fill the store buffer. + */ + while (ud->ud_hbuf == NULL) { + if (ud->ud_slen != 0) { + /* + * A packet(s) either arrived since the previous + * read or arrived while we were asleep. + */ + if (ud->ud_immediate || non_block || timed_out) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 01:28:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B746C106566B; Mon, 22 Nov 2010 01:28:29 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A485D8FC28; Mon, 22 Nov 2010 01:28:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAM1STpr074009; Mon, 22 Nov 2010 01:28:29 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAM1ST8m074005; Mon, 22 Nov 2010 01:28:29 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201011220128.oAM1ST8m074005@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 22 Nov 2010 01:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215651 - head/usr.sbin/usbdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 01:28:29 -0000 Author: weongyo Date: Mon Nov 22 01:28:29 2010 New Revision: 215651 URL: http://svn.freebsd.org/changeset/base/215651 Log: Adds usbdump(8) tool that currently it only supports the very basic feature set. It's not connected to the build yet. Reviewed by: hps Added: head/usr.sbin/usbdump/ head/usr.sbin/usbdump/Makefile (contents, props changed) head/usr.sbin/usbdump/usbdump.8 (contents, props changed) head/usr.sbin/usbdump/usbdump.c (contents, props changed) Added: head/usr.sbin/usbdump/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/usbdump/Makefile Mon Nov 22 01:28:29 2010 (r215651) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG= usbdump +SRCS= usbdump.c +MAN= usbdump.8 +WARNS?= 4 + +.include Added: head/usr.sbin/usbdump/usbdump.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/usbdump/usbdump.8 Mon Nov 22 01:28:29 2010 (r215651) @@ -0,0 +1,77 @@ +.\" +.\" Copyright (c) 2010 Weongyo Jeong. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 14, 2010 +.Dt usbdump 8 +.Os +.Sh NAME +.Nm usbdump +.Nd "dump traffic on USB host controller" +.Sh SYNOPSIS +.Nm +.Op Fl i Ar ifname +.Op Fl r Ar file +.Op Fl s Ar snaplen +.Op Fl v +.Op Fl w Ar file +.Sh DESCRIPTION +The +.Nm +utility provides a way to dump USB packets on each host controller. +.Pp +The following options are accepted. +.Bl -tag -width ".Fl f Ar file" +.It Fl i Ar ifname +Listen on USB bus interface. +.It Fl r Ar file +Read the raw packets from file. +.It Fl s Ar snaplen +Snapshot bytes from each packet. +.It Fl v +Enable debugging messages. +When it defined multiple times the verbose level increases. +.It Fl w Ar file +Write the raw packets to file. +.El +.Sh EXAMPLES +Captures the USB raw packets alive on usbus2: +.Pp +.Dl "usbdump -i usbus2 -s 256 -v" +.Pp +Dumps the USB raw packets of usbus2 into the file without packet +size limit: +.Pp +.Dl "usbdump -i usbus2 -s 0 -w /tmp/dump_pkts" +.Pp +Read the USB raw packets from the file: +.Pp +.Dl "usbdump -r /tmp/dump_pkts -v" +.Sh SEE ALSO +.Xr usbconfig 8 +.Sh AUTHORS +.An Weongyo Jeong +.Aq weongyo@FreeBSD.org . Added: head/usr.sbin/usbdump/usbdump.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/usbdump/usbdump.c Mon Nov 22 01:28:29 2010 (r215651) @@ -0,0 +1,542 @@ +/*- + * Copyright (c) 2010 Weongyo Jeong + * 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 + * 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 NONINFRINGEMENT, 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. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct usbcap { + int fd; /* fd for /dev/usbpf */ + u_int bufsize; + char *buffer; + + /* for -w option */ + int wfd; + /* for -r option */ + int rfd; +}; + +struct usbcap_filehdr { + u_int magic; +#define USBCAP_FILEHDR_MAGIC 0x9a90000e + u_char major; + u_char minor; + u_char reserved[26]; +} __packed; + +static int doexit = 0; +static int pkt_captured = 0; +static int verbose = 0; +static const char *i_arg = "usbus0";; +static const char *r_arg = NULL; +static const char *w_arg = NULL; +static const char *errstr_table[USB_ERR_MAX] = { + [USB_ERR_NORMAL_COMPLETION] = "NORMAL_COMPLETION", + [USB_ERR_PENDING_REQUESTS] = "PENDING_REQUESTS", + [USB_ERR_NOT_STARTED] = "NOT_STARTED", + [USB_ERR_INVAL] = "INVAL", + [USB_ERR_NOMEM] = "NOMEM", + [USB_ERR_CANCELLED] = "CANCELLED", + [USB_ERR_BAD_ADDRESS] = "BAD_ADDRESS", + [USB_ERR_BAD_BUFSIZE] = "BAD_BUFSIZE", + [USB_ERR_BAD_FLAG] = "BAD_FLAG", + [USB_ERR_NO_CALLBACK] = "NO_CALLBACK", + [USB_ERR_IN_USE] = "IN_USE", + [USB_ERR_NO_ADDR] = "NO_ADDR", + [USB_ERR_NO_PIPE] = "NO_PIPE", + [USB_ERR_ZERO_NFRAMES] = "ZERO_NFRAMES", + [USB_ERR_ZERO_MAXP] = "ZERO_MAXP", + [USB_ERR_SET_ADDR_FAILED] = "SET_ADDR_FAILED", + [USB_ERR_NO_POWER] = "NO_POWER", + [USB_ERR_TOO_DEEP] = "TOO_DEEP", + [USB_ERR_IOERROR] = "IOERROR", + [USB_ERR_NOT_CONFIGURED] = "NOT_CONFIGURED", + [USB_ERR_TIMEOUT] = "TIMEOUT", + [USB_ERR_SHORT_XFER] = "SHORT_XFER", + [USB_ERR_STALLED] = "STALLED", + [USB_ERR_INTERRUPTED] = "INTERRUPTED", + [USB_ERR_DMA_LOAD_FAILED] = "DMA_LOAD_FAILED", + [USB_ERR_BAD_CONTEXT] = "BAD_CONTEXT", + [USB_ERR_NO_ROOT_HUB] = "NO_ROOT_HUB", + [USB_ERR_NO_INTR_THREAD] = "NO_INTR_THREAD", + [USB_ERR_NOT_LOCKED] = "NOT_LOCKED", +}; + +static const char *xfertype_table[] = { + [UE_CONTROL] = "CTRL", + [UE_ISOCHRONOUS] = "ISOC", + [UE_BULK] = "BULK", + [UE_INTERRUPT] = "INTR" +}; + +static void +handle_sigint(int sig) +{ + + (void)sig; + doexit = 1; +} + +static void +print_flags(u_int32_t flags) +{ +#define PRINTFLAGS(name) \ + if ((flags & USBPF_FLAG_##name) != 0) \ + printf("%s ", #name); + printf(" flags %#x", flags); + printf(" < "); + PRINTFLAGS(FORCE_SHORT_XFER); + PRINTFLAGS(SHORT_XFER_OK); + PRINTFLAGS(SHORT_FRAMES_OK); + PRINTFLAGS(PIPE_BOF); + PRINTFLAGS(PROXY_BUFFER); + PRINTFLAGS(EXT_BUFFER); + PRINTFLAGS(MANUAL_STATUS); + PRINTFLAGS(NO_PIPE_OK); + PRINTFLAGS(STALL_PIPE); + printf(">\n"); +#undef PRINTFLAGS +} + +static void +print_status(u_int32_t status) +{ +#define PRINTSTATUS(name) \ + if ((status & USBPF_STATUS_##name) != 0) \ + printf("%s ", #name); + + printf(" status %#x", status); + printf(" < "); + PRINTSTATUS(OPEN); + PRINTSTATUS(TRANSFERRING); + PRINTSTATUS(DID_DMA_DELAY); + PRINTSTATUS(DID_CLOSE); + PRINTSTATUS(DRAINING); + PRINTSTATUS(STARTED); + PRINTSTATUS(BW_RECLAIMED); + PRINTSTATUS(CONTROL_XFR); + PRINTSTATUS(CONTROL_HDR); + PRINTSTATUS(CONTROL_ACT); + PRINTSTATUS(CONTROL_STALL); + PRINTSTATUS(SHORT_FRAMES_OK); + PRINTSTATUS(SHORT_XFER_OK); +#if USB_HAVE_BUSDMA + PRINTSTATUS(BDMA_ENABLE); + PRINTSTATUS(BDMA_NO_POST_SYNC); + PRINTSTATUS(BDMA_SETUP); +#endif + PRINTSTATUS(ISOCHRONOUS_XFR); + PRINTSTATUS(CURR_DMA_SET); + PRINTSTATUS(CAN_CANCEL_IMMED); + PRINTSTATUS(DOING_CALLBACK); + printf(">\n"); +#undef PRINTSTATUS +} + +/* + * Display a region in traditional hexdump format. + */ +static void +hexdump(const char *region, size_t len) +{ + const char *line; + int x, c; + char lbuf[80]; +#define EMIT(fmt, args...) do { \ + sprintf(lbuf, fmt , ## args); \ + printf("%s", lbuf); \ +} while (0) + + for (line = region; line < (region + len); line += 16) { + EMIT(" %04lx ", (long) (line - region)); + for (x = 0; x < 16; x++) { + if ((line + x) < (region + len)) + EMIT("%02x ", *(const u_int8_t *)(line + x)); + else + EMIT("-- "); + if (x == 7) + EMIT(" "); + } + EMIT(" |"); + for (x = 0; x < 16; x++) { + if ((line + x) < (region + len)) { + c = *(const u_int8_t *)(line + x); + /* !isprint(c) */ + if ((c < ' ') || (c > '~')) + c = '.'; + EMIT("%c", c); + } else + EMIT(" "); + } + EMIT("|\n"); + } +#undef EMIT +} + +static void +print_apacket(const struct usbpf_xhdr *hdr, struct usbpf_pkthdr *up, + const char *payload) +{ + struct tm *tm; + struct timeval tv; + size_t len; + u_int32_t framelen, x; + const char *ptr = payload; + char buf[64]; + + /* A packet from the kernel is based on little endian byte order. */ + up->up_busunit = le32toh(up->up_busunit); + up->up_flags = le32toh(up->up_flags); + up->up_status = le32toh(up->up_status); + up->up_length = le32toh(up->up_length); + up->up_frames = le32toh(up->up_frames); + up->up_error = le32toh(up->up_error); + up->up_interval = le32toh(up->up_interval); + + tv.tv_sec = hdr->uh_tstamp.ut_sec; + tv.tv_usec = hdr->uh_tstamp.ut_frac; + tm = localtime(&tv.tv_sec); + + len = strftime(buf, sizeof(buf), "%H:%M:%S", tm); + printf("%.*s.%06ju", (int)len, buf, tv.tv_usec); + printf(" usbus%d.%d 0x%02x %s %s", up->up_busunit, up->up_address, + up->up_endpoint, + xfertype_table[up->up_xfertype], + up->up_type == USBPF_XFERTAP_SUBMIT ? ">" : "<"); + printf(" (%d/%d)", up->up_frames, up->up_length); + if (up->up_type == USBPF_XFERTAP_DONE) + printf(" %s", errstr_table[up->up_error]); + if (up->up_xfertype == UE_BULK || up->up_xfertype == UE_ISOCHRONOUS) + printf(" %d", up->up_interval); + printf("\n"); + + if (verbose >= 1) { + for (x = 0; x < up->up_frames; x++) { + framelen = le32toh(*((const u_int32_t *)ptr)); + ptr += sizeof(u_int32_t); + printf(" frame[%u] len %d\n", x, framelen); + assert(framelen < (1024 * 4)); + hexdump(ptr, framelen); + ptr += framelen; + } + } + if (verbose >= 2) { + print_flags(up->up_flags); + print_status(up->up_status); + } +} + + +static void +print_packets(char *data, const int datalen) +{ + struct usbpf_pkthdr *up; + const struct usbpf_xhdr *hdr; + u_int32_t framelen, x; + char *ptr, *next; + + for (ptr = data; ptr < (data + datalen); ptr = next) { + hdr = (const struct usbpf_xhdr *)ptr; + up = (struct usbpf_pkthdr *)(ptr + hdr->uh_hdrlen); + next = ptr + USBPF_WORDALIGN(hdr->uh_hdrlen + hdr->uh_caplen); + + ptr = ((char *)up) + sizeof(struct usbpf_pkthdr); + if (w_arg == NULL) + print_apacket(hdr, up, ptr); + pkt_captured++; + for (x = 0; x < up->up_frames; x++) { + framelen = le32toh(*((const u_int32_t *)ptr)); + ptr += sizeof(u_int32_t) + framelen; + } + } +} + +static void +write_packets(struct usbcap *p, const char *data, const int datalen) +{ + int len = htole32(datalen), ret; + + ret = write(p->wfd, &len, sizeof(int)); + assert(ret == sizeof(int)); + ret = write(p->wfd, data, datalen); + assert(ret == datalen); +} + +static void +read_file(struct usbcap *p) +{ + int datalen, ret; + char *data; + + while ((ret = read(p->rfd, &datalen, sizeof(int))) == sizeof(int)) { + datalen = le32toh(datalen); + data = malloc(datalen); + assert(data != NULL); + ret = read(p->rfd, data, datalen); + assert(ret == datalen); + print_packets(data, datalen); + free(data); + } + if (ret == -1) + fprintf(stderr, "read: %s\n", strerror(errno)); +} + +static void +do_loop(struct usbcap *p) +{ + int cc; + + while (doexit == 0) { + cc = read(p->fd, (char *)p->buffer, p->bufsize); + if (cc < 0) { + switch (errno) { + case EINTR: + break; + default: + fprintf(stderr, "read: %s\n", strerror(errno)); + return; + } + continue; + } + if (cc == 0) + continue; + if (w_arg != NULL) + write_packets(p, p->buffer, cc); + print_packets(p->buffer, cc); + } +} + +static void +init_rfile(struct usbcap *p) +{ + struct usbcap_filehdr uf; + int ret; + + p->rfd = open(r_arg, O_RDONLY); + if (p->rfd < 0) { + fprintf(stderr, "open: %s (%s)\n", r_arg, strerror(errno)); + exit(EXIT_FAILURE); + } + ret = read(p->rfd, &uf, sizeof(uf)); + assert(ret == sizeof(uf)); + assert(le32toh(uf.magic) == USBCAP_FILEHDR_MAGIC); + assert(uf.major == 0); + assert(uf.minor == 1); +} + +static void +init_wfile(struct usbcap *p) +{ + struct usbcap_filehdr uf; + int ret; + + p->wfd = open(w_arg, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR); + if (p->wfd < 0) { + fprintf(stderr, "open: %s (%s)\n", w_arg, strerror(errno)); + exit(EXIT_FAILURE); + } + bzero(&uf, sizeof(uf)); + uf.magic = htole32(USBCAP_FILEHDR_MAGIC); + uf.major = 0; + uf.minor = 1; + ret = write(p->wfd, (const void *)&uf, sizeof(uf)); + assert(ret == sizeof(uf)); +} + +static void +usage(void) +{ + +#define FMT " %-14s %s\n" + fprintf(stderr, "usage: usbdump [options]\n"); + fprintf(stderr, FMT, "-i ifname", "Listen on USB bus interface"); + fprintf(stderr, FMT, "-r file", "Read the raw packets from file"); + fprintf(stderr, FMT, "-s snaplen", "Snapshot bytes from each packet"); + fprintf(stderr, FMT, "-v", "Increases the verbose level"); + fprintf(stderr, FMT, "-w file", "Write the raw packets to file"); +#undef FMT + exit(1); +} + +int +main(int argc, char *argv[]) +{ + struct timeval tv; + struct usbpf_insn total_insn; + struct usbpf_program total_prog; + struct usbpf_stat us; + struct usbpf_version uv; + struct usbcap uc, *p = &uc; + struct usbpf_ifreq ufr; + long snapshot = 192; + u_int v; + int fd, o; + const char *optstring; + + bzero(&uc, sizeof(struct usbcap)); + + optstring = "i:r:s:vw:"; + while ((o = getopt(argc, argv, optstring)) != -1) { + switch (o) { + case 'i': + i_arg = optarg; + break; + case 'r': + r_arg = optarg; + init_rfile(p); + break; + case 's': + snapshot = strtol(optarg, NULL, 10); + errno = 0; + if (snapshot == 0 && errno == EINVAL) + usage(); + /* snapeshot == 0 is special */ + if (snapshot == 0) + snapshot = -1; + break; + case 'v': + verbose++; + break; + case 'w': + w_arg = optarg; + init_wfile(p); + break; + default: + usage(); + /* NOTREACHED */ + } + } + + if (r_arg != NULL) { + read_file(p); + exit(EXIT_SUCCESS); + } + + p->fd = fd = open("/dev/usbpf", O_RDONLY); + if (p->fd < 0) { + fprintf(stderr, "(no devices found)\n"); + return (EXIT_FAILURE); + } + + if (ioctl(fd, UIOCVERSION, (caddr_t)&uv) < 0) { + fprintf(stderr, "UIOCVERSION: %s\n", strerror(errno)); + return (EXIT_FAILURE); + } + if (uv.uv_major != USBPF_MAJOR_VERSION || + uv.uv_minor < USBPF_MINOR_VERSION) { + fprintf(stderr, "kernel bpf filter out of date"); + return (EXIT_FAILURE); + } + + if ((ioctl(fd, UIOCGBLEN, (caddr_t)&v) < 0) || v < 65536) + v = 65536; + for ( ; v != 0; v >>= 1) { + (void)ioctl(fd, UIOCSBLEN, (caddr_t)&v); + (void)strncpy(ufr.ufr_name, i_arg, sizeof(ufr.ufr_name)); + if (ioctl(fd, UIOCSETIF, (caddr_t)&ufr) >= 0) + break; + } + if (v == 0) { + fprintf(stderr, "UIOCSBLEN: %s: No buffer size worked", i_arg); + return (EXIT_FAILURE); + } + + if (ioctl(fd, UIOCGBLEN, (caddr_t)&v) < 0) { + fprintf(stderr, "UIOCGBLEN: %s", strerror(errno)); + return (EXIT_FAILURE); + } + + p->bufsize = v; + p->buffer = (u_char *)malloc(p->bufsize); + if (p->buffer == NULL) { + fprintf(stderr, "malloc: %s", strerror(errno)); + return (EXIT_FAILURE); + } + + /* XXX no read filter rules yet so at this moment accept everything */ + total_insn.code = (u_short)(USBPF_RET | USBPF_K); + total_insn.jt = 0; + total_insn.jf = 0; + total_insn.k = snapshot; + + total_prog.uf_len = 1; + total_prog.uf_insns = &total_insn; + if (ioctl(p->fd, UIOCSETF, (caddr_t)&total_prog) < 0) { + fprintf(stderr, "UIOCSETF: %s", strerror(errno)); + return (EXIT_FAILURE); + } + + /* 1 second read timeout */ + tv.tv_sec = 1; + tv.tv_usec = 0; + if (ioctl(p->fd, UIOCSRTIMEOUT, (caddr_t)&tv) < 0) { + fprintf(stderr, "UIOCSRTIMEOUT: %s", strerror(errno)); + return (EXIT_FAILURE); + } + + (void)signal(SIGINT, handle_sigint); + + do_loop(p); + + if (ioctl(fd, UIOCGSTATS, (caddr_t)&us) < 0) { + fprintf(stderr, "UIOCGSTATS: %s", strerror(errno)); + return (EXIT_FAILURE); + } + + /* XXX what's difference between pkt_captured and us.us_recv? */ + printf("\n"); + printf("%d packets captured\n", pkt_captured); + printf("%d packets received by filter\n", us.us_recv); + printf("%d packets dropped by kernel\n", us.us_drop); + + if (p->fd > 0) + close(p->fd); + if (p->rfd > 0) + close(p->rfd); + if (p->wfd > 0) + close(p->wfd); + + return (EXIT_SUCCESS); +} From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 02:42:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18829106564A; Mon, 22 Nov 2010 02:42:03 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0759A8FC16; Mon, 22 Nov 2010 02:42:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAM2g25U075525; Mon, 22 Nov 2010 02:42:02 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAM2g2mE075523; Mon, 22 Nov 2010 02:42:02 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201011220242.oAM2g2mE075523@svn.freebsd.org> From: David Xu Date: Mon, 22 Nov 2010 02:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215652 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 02:42:03 -0000 Author: davidxu Date: Mon Nov 22 02:42:02 2010 New Revision: 215652 URL: http://svn.freebsd.org/changeset/base/215652 Log: Use atomic instruction to set _has_writer, otherwise there is a race causes userland to not wake up a thread sleeping in kernel. MFC after: 3 days Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Mon Nov 22 01:28:29 2010 (r215651) +++ head/sys/kern/kern_umtx.c Mon Nov 22 02:42:02 2010 (r215652) @@ -2839,7 +2839,8 @@ do_sem_wait(struct thread *td, struct _u umtxq_insert(uq); umtxq_unlock(&uq->uq_key); - suword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 1); + if (fuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters)) == 0) + casuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 0, 1); count = fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); if (count != 0) { From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 05:56:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E72971065693; Mon, 22 Nov 2010 05:56:38 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.c2i.net [212.247.154.226]) by mx1.freebsd.org (Postfix) with ESMTP id 159E18FC1B; Mon, 22 Nov 2010 05:56:37 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=4dE6tNKVm/0afO7MQGRPv7y2YwMo4emTIiDjbh74onY= c=1 sm=1 a=NKwv54EsIX4A:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=6I5d2MoRAAAA:8 a=_mao4r0jxctrlBs4NfYA:9 a=bPtm-iMu8rJkG_uZPyBKaKdMj-kA:4 a=pILNOxqGKmIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 52262975; Mon, 22 Nov 2010 06:46:33 +0100 From: Hans Petter Selasky To: Weongyo Jeong Date: Mon, 22 Nov 2010 06:47:21 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201011220111.oAM1BSWE073613@svn.freebsd.org> In-Reply-To: <201011220111.oAM1BSWE073613@svn.freebsd.org> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201011220647.21858.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r215649 - in head/sys: conf dev/usb dev/usb/controller modules/usb/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 05:56:39 -0000 On Monday 22 November 2010 02:11:28 Weongyo Jeong wrote: > Author: weongyo > Date: Mon Nov 22 01:11:28 2010 > New Revision: 215649 > URL: http://svn.freebsd.org/changeset/base/215649 > > Log: > Adds a USB packet filter feature to the stack that it could capture > packets which go through each USB host controllers. Its implementations > are almost based on BPF code and very similar with it except it's > little bit customized for USB packet only. The userland program > usbdump(8) would be committed soon. > > Discussed with: hps, thompsa, yongari > Hi, I plan some follow-up patches to improve the USB PF-solution and to make it a loadable kernel module this week. --HPS From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 06:29:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89CB41065670; Mon, 22 Nov 2010 06:29:01 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 41AB58FC1D; Mon, 22 Nov 2010 06:29:00 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id AD09F117A6; Mon, 22 Nov 2010 16:12:24 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro.local (c-76-120-89-251.hsd1.co.comcast.net [76.120.89.251]) by dommail.onthenet.com.au (MOS 4.1.8-GA) with ESMTP id ARM55875 (AUTH peterg@ptree32.com.au); Mon, 22 Nov 2010 16:12:08 +1000 Message-ID: <4CEA09C4.4020504@freebsd.org> Date: Sun, 21 Nov 2010 23:12:20 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: Hans Petter Selasky References: <201011220111.oAM1BSWE073613@svn.freebsd.org> <201011220647.21858.hselasky@c2i.net> In-Reply-To: <201011220647.21858.hselasky@c2i.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Weongyo Jeong Subject: Re: svn commit: r215649 - in head/sys: conf dev/usb dev/usb/controller modules/usb/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 06:29:01 -0000 > I plan some follow-up patches to improve the USB PF-solution and to make it a > loadable kernel module this week. Could the USB support in libpcap somehow hook into this ? later, Peter. From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 06:55:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7678B106564A; Mon, 22 Nov 2010 06:55:28 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.c2i.net [212.247.154.162]) by mx1.freebsd.org (Postfix) with ESMTP id 6F3468FC0C; Mon, 22 Nov 2010 06:55:26 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=pSMQvMxz67uBPld/2YzXd4n8EUsHq22vR+JpH4ELdfA= c=1 sm=1 a=NKwv54EsIX4A:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=VxGEUZxnoe-wcai3Q88A:9 a=ALdX1tVozKlzWdIJNQDBMYCkBwUA:4 a=pILNOxqGKmIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 51481718; Mon, 22 Nov 2010 07:55:25 +0100 From: Hans Petter Selasky To: Peter Grehan Date: Mon, 22 Nov 2010 07:56:14 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201011220647.21858.hselasky@c2i.net> <4CEA09C4.4020504@freebsd.org> In-Reply-To: <4CEA09C4.4020504@freebsd.org> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201011220756.14093.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Weongyo Jeong Subject: Re: svn commit: r215649 - in head/sys: conf dev/usb dev/usb/controller modules/usb/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 06:55:28 -0000 On Monday 22 November 2010 07:12:20 Peter Grehan wrote: > > I plan some follow-up patches to improve the USB PF-solution and to make > > it a loadable kernel module this week. > > Could the USB support in libpcap somehow hook into this ? > > later, > > Peter. Yes, I plan to look into this, because Wireshark has USB decoding support if I'm not mistaken. If anyone knows about libpcap and how to use it, please contact me! --HPS From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 07:00:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37A1A1065670; Mon, 22 Nov 2010 07:00:48 +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 0C7C78FC19; Mon, 22 Nov 2010 07:00:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAM70lbX081358; Mon, 22 Nov 2010 07:00:47 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAM70lFe081356; Mon, 22 Nov 2010 07:00:47 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201011220700.oAM70lFe081356@svn.freebsd.org> From: Kevin Lo Date: Mon, 22 Nov 2010 07:00:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215658 - head/sbin/ddb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 07:00:48 -0000 Author: kevlo Date: Mon Nov 22 07:00:47 2010 New Revision: 215658 URL: http://svn.freebsd.org/changeset/base/215658 Log: Plug an fd leak Modified: head/sbin/ddb/ddb.c Modified: head/sbin/ddb/ddb.c ============================================================================== --- head/sbin/ddb/ddb.c Mon Nov 22 06:41:05 2010 (r215657) +++ head/sbin/ddb/ddb.c Mon Nov 22 07:00:47 2010 (r215658) @@ -96,6 +96,7 @@ ddb_readfile(char *filename) #endif ddb_main(argc, argv); } + fclose(f); } void From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 09:04:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5854E106567A; Mon, 22 Nov 2010 09:04:29 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46E618FC23; Mon, 22 Nov 2010 09:04:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAM94TCU084167; Mon, 22 Nov 2010 09:04:29 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAM94TWf084165; Mon, 22 Nov 2010 09:04:29 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201011220904.oAM94TWf084165@svn.freebsd.org> From: Colin Percival Date: Mon, 22 Nov 2010 09:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215663 - head/sys/i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 09:04:29 -0000 Author: cperciva Date: Mon Nov 22 09:04:29 2010 New Revision: 215663 URL: http://svn.freebsd.org/changeset/base/215663 Log: In xen_get_timecount, return the full ns-precision time rather than rounding to 1/HZ precision. I have no idea why the rounding was introduced in the first place, but it makes FreeBSD unhappy. Modified: head/sys/i386/xen/clock.c Modified: head/sys/i386/xen/clock.c ============================================================================== --- head/sys/i386/xen/clock.c Mon Nov 22 08:35:06 2010 (r215662) +++ head/sys/i386/xen/clock.c Mon Nov 22 09:04:29 2010 (r215663) @@ -829,7 +829,7 @@ xen_get_timecount(struct timecounter *tc clk = shadow->system_timestamp + get_nsec_offset(shadow); - return (uint32_t)((clk / NS_PER_TICK) * NS_PER_TICK); + return (uint32_t)(clk); } From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 09:07:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49181106566B; Mon, 22 Nov 2010 09:07:00 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 366C08FC22; Mon, 22 Nov 2010 09:07:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAM970wJ084261; Mon, 22 Nov 2010 09:07:00 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAM970To084256; Mon, 22 Nov 2010 09:07:00 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201011220907.oAM970To084256@svn.freebsd.org> From: Alexander Leidinger Date: Mon, 22 Nov 2010 09:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215664 - in head/sys: compat/linux kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 09:07:00 -0000 Author: netchild Date: Mon Nov 22 09:06:59 2010 New Revision: 215664 URL: http://svn.freebsd.org/changeset/base/215664 Log: By using the 32-bit Linux version of Sun's Java Development Kit 1.6 on FreeBSD (amd64), invocations of "javac" (or "java") eventually end with the output of "Killed" and exit code 137. This is caused by: 1. After calling exec() in multithreaded linux program threads are not destroyed and continue running. They get killed after program being executed finishes. 2. linux_exit_group doesn't return correct exit code when called not from group leader. Which happens regularly using sun jvm. The submitters fix this in a similar way to how NetBSD handles this. I took the PRs away from dchagin, who seems to be out of touch of this since a while (no response from him). The patches committed here are from [2], with some little modifications from me to the style. PR: 141439 [1], 144194 [2] Submitted by: Stefan Schmidt , gk Reviewed by: rdivacky (in april 2010) MFC after: 5 days Modified: head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_misc.c head/sys/kern/kern_exit.c Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Mon Nov 22 09:04:29 2010 (r215663) +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 09:06:59 2010 (r215664) @@ -155,7 +155,7 @@ void linux_proc_exit(void *arg __unused, struct proc *p) { struct linux_emuldata *em; - int error; + int error, shared_flags, shared_xstat; struct thread *td = FIRST_THREAD_IN_PROC(p); int *child_clear_tid; struct proc *q, *nq; @@ -187,6 +187,8 @@ linux_proc_exit(void *arg __unused, stru } EMUL_SHARED_WLOCK(&emul_shared_lock); + shared_flags = em->shared->flags; + shared_xstat = em->shared->xstat; LIST_REMOVE(em, threads); em->shared->refs--; @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru } else EMUL_SHARED_WUNLOCK(&emul_shared_lock); + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { + PROC_LOCK(p); + p->p_xstat = shared_xstat; + PROC_UNLOCK(p); + } + if (child_clear_tid != NULL) { struct linux_sys_futex_args cup; int null = 0; @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru if (__predict_false(imgp->sysent == &elf_linux_sysvec && p->p_sysent != &elf_linux_sysvec)) linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); + if (__predict_false(p->p_sysent == &elf_linux_sysvec)) + /* Kill threads regardless of imgp->sysent value */ + linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); if (__predict_false(imgp->sysent != &elf_linux_sysvec && p->p_sysent == &elf_linux_sysvec)) { struct linux_emuldata *em; @@ -334,3 +345,29 @@ linux_set_tid_address(struct thread *td, EMUL_UNLOCK(&emul_lock); return 0; } + +void +linux_kill_threads(struct thread *td, int sig) +{ + struct linux_emuldata *em, *td_em, *tmp_em; + struct proc *sp; + + td_em = em_find(td->td_proc, EMUL_DONTLOCK); + + KASSERT(td_em != NULL, ("linux_kill_threads: emuldata not found.\n")); + + EMUL_SHARED_RLOCK(&emul_shared_lock); + LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) { + if (em->pid == td_em->pid) + continue; + + sp = pfind(em->pid); + if ((sp->p_flag & P_WEXIT) == 0) + psignal(sp, sig); + PROC_UNLOCK(sp); +#ifdef DEBUG + printf(LMSG("linux_kill_threads: kill PID %d\n"), em->pid); +#endif + } + EMUL_SHARED_RUNLOCK(&emul_shared_lock); +} Modified: head/sys/compat/linux/linux_emul.h ============================================================================== --- head/sys/compat/linux/linux_emul.h Mon Nov 22 09:04:29 2010 (r215663) +++ head/sys/compat/linux/linux_emul.h Mon Nov 22 09:06:59 2010 (r215664) @@ -31,8 +31,12 @@ #ifndef _LINUX_EMUL_H_ #define _LINUX_EMUL_H_ +#define EMUL_SHARED_HASXSTAT 0x01 + struct linux_emuldata_shared { int refs; + int flags; + int xstat; pid_t group_pid; LIST_HEAD(, linux_emuldata) threads; /* head of list of linux threads */ @@ -76,6 +80,7 @@ int linux_proc_init(struct thread *, pid void linux_proc_exit(void *, struct proc *); void linux_schedtail(void *, struct proc *); void linux_proc_exec(void *, struct proc *, struct image_params *); +void linux_kill_threads(struct thread *, int); extern struct sx emul_shared_lock; extern struct mtx emul_lock; Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Mon Nov 22 09:04:29 2010 (r215663) +++ head/sys/compat/linux/linux_misc.c Mon Nov 22 09:06:59 2010 (r215664) @@ -1695,34 +1695,23 @@ linux_setdomainname(struct thread *td, s int linux_exit_group(struct thread *td, struct linux_exit_group_args *args) { - struct linux_emuldata *em, *td_em, *tmp_em; - struct proc *sp; + struct linux_emuldata *em; #ifdef DEBUG if (ldebug(exit_group)) printf(ARGS(exit_group, "%i"), args->error_code); #endif - if (linux_use26(td)) { - td_em = em_find(td->td_proc, EMUL_DONTLOCK); - - KASSERT(td_em != NULL, ("exit_group: emuldata not found.\n")); - - EMUL_SHARED_RLOCK(&emul_shared_lock); - LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) { - if (em->pid == td_em->pid) - continue; - - sp = pfind(em->pid); - psignal(sp, SIGKILL); - PROC_UNLOCK(sp); -#ifdef DEBUG - printf(LMSG("linux_sys_exit_group: kill PID %d\n"), em->pid); -#endif - } - - EMUL_SHARED_RUNLOCK(&emul_shared_lock); + em = em_find(td->td_proc, EMUL_DONTLOCK); + if (em->shared->refs > 1) { + EMUL_SHARED_WLOCK(&emul_shared_lock); + em->shared->flags |= EMUL_SHARED_HASXSTAT; + em->shared->xstat = W_EXITCODE(args->error_code, 0); + EMUL_SHARED_WUNLOCK(&emul_shared_lock); + if (linux_use26(td)) + linux_kill_threads(td, SIGKILL); } + /* * XXX: we should send a signal to the parent if * SIGNAL_EXIT_GROUP is set. We ignore that (temporarily?) Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Nov 22 09:04:29 2010 (r215663) +++ head/sys/kern/kern_exit.c Mon Nov 22 09:06:59 2010 (r215664) @@ -200,6 +200,7 @@ exit1(struct thread *td, int rv) while (p->p_lock > 0) msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0); + p->p_xstat = rv; /* Let event handler change exit status */ PROC_UNLOCK(p); /* Drain the limit callout while we don't have the proc locked */ callout_drain(&p->p_limco); @@ -242,6 +243,7 @@ exit1(struct thread *td, int rv) * P_PPWAIT is set; we will wakeup the parent below. */ PROC_LOCK(p); + rv = p->p_xstat; /* Event handler could change exit status */ stopprofclock(p); p->p_flag &= ~(P_TRACED | P_PPWAIT); @@ -424,7 +426,6 @@ exit1(struct thread *td, int rv) /* Save exit status. */ PROC_LOCK(p); - p->p_xstat = rv; p->p_xthread = td; /* Tell the prison that we are gone. */ From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 09:13:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDF8A106567A; Mon, 22 Nov 2010 09:13:25 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC7978FC0A; Mon, 22 Nov 2010 09:13:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAM9DPrV084459; Mon, 22 Nov 2010 09:13:25 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAM9DP3J084457; Mon, 22 Nov 2010 09:13:25 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201011220913.oAM9DP3J084457@svn.freebsd.org> From: Colin Percival Date: Mon, 22 Nov 2010 09:13:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215665 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 09:13:25 -0000 Author: cperciva Date: Mon Nov 22 09:13:25 2010 New Revision: 215665 URL: http://svn.freebsd.org/changeset/base/215665 Log: In tc_windup, handle the case where the previous call to tc_windup was more than 1s earlier. Prior to this commit, the computation of th_scale * delta (which produces a 64-bit value equal to the time since the last tc_windup call in units of 2^(-64) seconds) would overflow and any complete seconds would be lost. We fix this by repeatedly converting tc_frequency units of timecounter to one seconds; this is not exactly correct, since it loses the NTP adjustment, but if we find ourselves going more than 1s at a time between clock interrupts, losing a few seconds worth of NTP adjustments is the least of our problems... Modified: head/sys/kern/kern_tc.c Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Mon Nov 22 09:06:59 2010 (r215664) +++ head/sys/kern/kern_tc.c Mon Nov 22 09:13:25 2010 (r215665) @@ -442,6 +442,16 @@ tc_windup(void) ncount = 0; th->th_offset_count += delta; th->th_offset_count &= th->th_counter->tc_counter_mask; + while (delta > th->th_counter->tc_frequency) { + /* Eat complete unadjusted seconds. */ + delta -= th->th_counter->tc_frequency; + th->th_offset.sec++; + } + if ((delta > th->th_counter->tc_frequency / 2) && + (th->th_scale * delta < (uint64_t)1 << 63)) { + /* The product th_scale * delta just barely overflows. */ + th->th_offset.sec++; + } bintime_addx(&th->th_offset, th->th_scale * delta); /* From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 09:25:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32C5B106566B; Mon, 22 Nov 2010 09:25:33 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBF8B8FC12; Mon, 22 Nov 2010 09:25:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAM9PWmv084818; Mon, 22 Nov 2010 09:25:32 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAM9PWSd084816; Mon, 22 Nov 2010 09:25:32 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201011220925.oAM9PWSd084816@svn.freebsd.org> From: Alexander Leidinger Date: Mon, 22 Nov 2010 09:25:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215666 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 09:25:33 -0000 Author: netchild Date: Mon Nov 22 09:25:32 2010 New Revision: 215666 URL: http://svn.freebsd.org/changeset/base/215666 Log: Remove trailing dot from the unimplemented futex messages to make them consistent with the syscall and ipc messages. Submitted by: arundel MFC after: 3 days Modified: head/sys/compat/linux/linux_futex.c Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Mon Nov 22 09:13:25 2010 (r215665) +++ head/sys/compat/linux/linux_futex.c Mon Nov 22 09:25:32 2010 (r215666) @@ -626,21 +626,21 @@ linux_sys_futex(struct thread *td, struc /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op LINUX_FUTEX_LOCK_PI not implemented.\n"); + "op LINUX_FUTEX_LOCK_PI not implemented\n"); return (ENOSYS); case LINUX_FUTEX_UNLOCK_PI: /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op LINUX_FUTEX_UNLOCK_PI not implemented.\n"); + "op LINUX_FUTEX_UNLOCK_PI not implemented\n"); return (ENOSYS); case LINUX_FUTEX_TRYLOCK_PI: /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op LINUX_FUTEX_TRYLOCK_PI not implemented.\n"); + "op LINUX_FUTEX_TRYLOCK_PI not implemented\n"); return (ENOSYS); case LINUX_FUTEX_REQUEUE: @@ -664,14 +664,14 @@ linux_sys_futex(struct thread *td, struc /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op FUTEX_WAIT_BITSET not implemented.\n"); + "op FUTEX_WAIT_BITSET not implemented\n"); return (ENOSYS); case LINUX_FUTEX_WAIT_REQUEUE_PI: /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op FUTEX_WAIT_REQUEUE_PI not implemented.\n"); + "op FUTEX_WAIT_REQUEUE_PI not implemented\n"); return (ENOSYS); default: From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 09:31:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA4EA106567A; Mon, 22 Nov 2010 09:31:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 1C9888FC0A; Mon, 22 Nov 2010 09:31:38 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id oAM9VZZ4065995 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Nov 2010 11:31:35 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id oAM9VYAX090054; Mon, 22 Nov 2010 11:31:34 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id oAM9VYrk090053; Mon, 22 Nov 2010 11:31:34 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 22 Nov 2010 11:31:34 +0200 From: Kostik Belousov To: Alexander Leidinger Message-ID: <20101122093134.GU2392@deviant.kiev.zoral.com.ua> References: <201011220907.oAM970To084256@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3FdFc4BA+2Jhnmd7" Content-Disposition: inline In-Reply-To: <201011220907.oAM970To084256@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_40, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215664 - in head/sys: compat/linux kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 09:31:39 -0000 --3FdFc4BA+2Jhnmd7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 22, 2010 at 09:07:00AM +0000, Alexander Leidinger wrote: > Author: netchild > Date: Mon Nov 22 09:06:59 2010 > New Revision: 215664 > URL: http://svn.freebsd.org/changeset/base/215664 >=20 > Log: > By using the 32-bit Linux version of Sun's Java Development Kit 1.6 > on FreeBSD (amd64), invocations of "javac" (or "java") eventually > end with the output of "Killed" and exit code 137. > =20 > This is caused by: > 1. After calling exec() in multithreaded linux program threads are not > destroyed and continue running. They get killed after program being > executed finishes. > =20 > 2. linux_exit_group doesn't return correct exit code when called not > from group leader. Which happens regularly using sun jvm. > =20 > The submitters fix this in a similar way to how NetBSD handles this. > =20 > I took the PRs away from dchagin, who seems to be out of touch of > this since a while (no response from him). > =20 > The patches committed here are from [2], with some little modifications > from me to the style. > =20 > PR: 141439 [1], 144194 [2] > Submitted by: Stefan Schmidt , gk > Reviewed by: rdivacky (in april 2010) > MFC after: 5 days >=20 > Modified: > head/sys/compat/linux/linux_emul.c > head/sys/compat/linux/linux_emul.h > head/sys/compat/linux/linux_misc.c > head/sys/kern/kern_exit.c >=20 > Modified: head/sys/compat/linux/linux_emul.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/compat/linux/linux_emul.c Mon Nov 22 09:04:29 2010 (r215663) > +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 09:06:59 2010 (r215664) > @@ -155,7 +155,7 @@ void > linux_proc_exit(void *arg __unused, struct proc *p) > { > struct linux_emuldata *em; > - int error; > + int error, shared_flags, shared_xstat; > struct thread *td =3D FIRST_THREAD_IN_PROC(p); > int *child_clear_tid; > struct proc *q, *nq; > @@ -187,6 +187,8 @@ linux_proc_exit(void *arg __unused, stru > } > =20 > EMUL_SHARED_WLOCK(&emul_shared_lock); > + shared_flags =3D em->shared->flags; > + shared_xstat =3D em->shared->xstat; > LIST_REMOVE(em, threads); > =20 > em->shared->refs--; > @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru > } else=09 > EMUL_SHARED_WUNLOCK(&emul_shared_lock); > =20 > + if ((shared_flags & EMUL_SHARED_HASXSTAT) !=3D 0) { > + PROC_LOCK(p); > + p->p_xstat =3D shared_xstat; > + PROC_UNLOCK(p); > + } Why is process lock taken there ? The assignment to u_short inside the properly aligned structure is atomic on all supported architectures, and the thread that should see side-effect of assignment is the same thread that does assignment. > + > if (child_clear_tid !=3D NULL) { > struct linux_sys_futex_args cup; > int null =3D 0; > @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru > if (__predict_false(imgp->sysent =3D=3D &elf_linux_sysvec > && p->p_sysent !=3D &elf_linux_sysvec)) > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > + if (__predict_false(p->p_sysent =3D=3D &elf_linux_sysvec)) > + /* Kill threads regardless of imgp->sysent value */ > + linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); This is better expressed by if ((p->p_sysent->sv_flags & SV_ABI_MASK) =3D=3D SV_ABI_LINUX) Regardless of this mostly cosmetic issue, this is racy. Other linux thread in the same process might do an execve(3). More, if execve(3) call fails, then you return into the process that lacks all threads except the one that called execve(3). > if (__predict_false(imgp->sysent !=3D &elf_linux_sysvec > && p->p_sysent =3D=3D &elf_linux_sysvec)) { > struct linux_emuldata *em; > @@ -334,3 +345,29 @@ linux_set_tid_address(struct thread *td, > EMUL_UNLOCK(&emul_lock); > return 0; > } > + > +void > +linux_kill_threads(struct thread *td, int sig) > +{ > + struct linux_emuldata *em, *td_em, *tmp_em; > + struct proc *sp; > + > + td_em =3D em_find(td->td_proc, EMUL_DONTLOCK); > + > + KASSERT(td_em !=3D NULL, ("linux_kill_threads: emuldata not found.\n")); > + > + EMUL_SHARED_RLOCK(&emul_shared_lock); > + LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) { > + if (em->pid =3D=3D td_em->pid) > + continue; > + > + sp =3D pfind(em->pid); > + if ((sp->p_flag & P_WEXIT) =3D=3D 0) > + psignal(sp, sig); > + PROC_UNLOCK(sp); > +#ifdef DEBUG > + printf(LMSG("linux_kill_threads: kill PID %d\n"), em->pid); > +#endif > + } > + EMUL_SHARED_RUNLOCK(&emul_shared_lock); > +} >=20 > Modified: head/sys/compat/linux/linux_emul.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/compat/linux/linux_emul.h Mon Nov 22 09:04:29 2010 (r215663) > +++ head/sys/compat/linux/linux_emul.h Mon Nov 22 09:06:59 2010 (r215664) > @@ -31,8 +31,12 @@ > #ifndef _LINUX_EMUL_H_ > #define _LINUX_EMUL_H_ > =20 > +#define EMUL_SHARED_HASXSTAT 0x01 > + > struct linux_emuldata_shared { > int refs; > + int flags; > + int xstat; > pid_t group_pid; > =20 > LIST_HEAD(, linux_emuldata) threads; /* head of list of linux threads */ > @@ -76,6 +80,7 @@ int linux_proc_init(struct thread *, pid > void linux_proc_exit(void *, struct proc *); > void linux_schedtail(void *, struct proc *); > void linux_proc_exec(void *, struct proc *, struct image_params *); > +void linux_kill_threads(struct thread *, int); > =20 > extern struct sx emul_shared_lock; > extern struct mtx emul_lock; >=20 > Modified: head/sys/compat/linux/linux_misc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/compat/linux/linux_misc.c Mon Nov 22 09:04:29 2010 (r215663) > +++ head/sys/compat/linux/linux_misc.c Mon Nov 22 09:06:59 2010 (r215664) > @@ -1695,34 +1695,23 @@ linux_setdomainname(struct thread *td, s > int > linux_exit_group(struct thread *td, struct linux_exit_group_args *args) > { > - struct linux_emuldata *em, *td_em, *tmp_em; > - struct proc *sp; > + struct linux_emuldata *em; > =20 > #ifdef DEBUG > if (ldebug(exit_group)) > printf(ARGS(exit_group, "%i"), args->error_code); > #endif > =20 > - if (linux_use26(td)) { > - td_em =3D em_find(td->td_proc, EMUL_DONTLOCK); > - > - KASSERT(td_em !=3D NULL, ("exit_group: emuldata not found.\n")); > - > - EMUL_SHARED_RLOCK(&emul_shared_lock); > - LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) { > - if (em->pid =3D=3D td_em->pid) > - continue; > - > - sp =3D pfind(em->pid); > - psignal(sp, SIGKILL); > - PROC_UNLOCK(sp); > -#ifdef DEBUG > - printf(LMSG("linux_sys_exit_group: kill PID %d\n"), em->pid); > -#endif > - } > - > - EMUL_SHARED_RUNLOCK(&emul_shared_lock); > + em =3D em_find(td->td_proc, EMUL_DONTLOCK); > + if (em->shared->refs > 1) { > + EMUL_SHARED_WLOCK(&emul_shared_lock); > + em->shared->flags |=3D EMUL_SHARED_HASXSTAT; > + em->shared->xstat =3D W_EXITCODE(args->error_code, 0); > + EMUL_SHARED_WUNLOCK(&emul_shared_lock); > + if (linux_use26(td)) > + linux_kill_threads(td, SIGKILL); > } > + > /* > * XXX: we should send a signal to the parent if > * SIGNAL_EXIT_GROUP is set. We ignore that (temporarily?) >=20 > Modified: head/sys/kern/kern_exit.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/kern_exit.c Mon Nov 22 09:04:29 2010 (r215663) > +++ head/sys/kern/kern_exit.c Mon Nov 22 09:06:59 2010 (r215664) > @@ -200,6 +200,7 @@ exit1(struct thread *td, int rv) > while (p->p_lock > 0) > msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0); > =20 > + p->p_xstat =3D rv; /* Let event handler change exit status */ > PROC_UNLOCK(p); > /* Drain the limit callout while we don't have the proc locked */ > callout_drain(&p->p_limco); > @@ -242,6 +243,7 @@ exit1(struct thread *td, int rv) > * P_PPWAIT is set; we will wakeup the parent below. > */ > PROC_LOCK(p); > + rv =3D p->p_xstat; /* Event handler could change exit status */ > stopprofclock(p); > p->p_flag &=3D ~(P_TRACED | P_PPWAIT); > =20 > @@ -424,7 +426,6 @@ exit1(struct thread *td, int rv) > =20 > /* Save exit status. */ > PROC_LOCK(p); > - p->p_xstat =3D rv; > p->p_xthread =3D td; > =20 > /* Tell the prison that we are gone. */ --3FdFc4BA+2Jhnmd7 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkzqOHYACgkQC3+MBN1Mb4iE9wCfTDLu/MY6N4KTyfM3ipLdSo7i EFcAn3mRk4aupfZEFyzFLPc475oAgZgr =7jWP -----END PGP SIGNATURE----- --3FdFc4BA+2Jhnmd7-- From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 09:37:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A99E1065670; Mon, 22 Nov 2010 09:37:53 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 495A98FC15; Mon, 22 Nov 2010 09:37:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAM9br29085242; Mon, 22 Nov 2010 09:37:53 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAM9braI085240; Mon, 22 Nov 2010 09:37:53 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201011220937.oAM9braI085240@svn.freebsd.org> From: Alexander Leidinger Date: Mon, 22 Nov 2010 09:37:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215669 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 09:37:53 -0000 Author: netchild Date: Mon Nov 22 09:37:52 2010 New Revision: 215669 URL: http://svn.freebsd.org/changeset/base/215669 Log: 1) Add a hint to check for duplicates with optional files. The committed text is a little bit modified to what was submitted. The code example to automate a part of this was proposed by Dmitry Morozovsky. 2) Remove trailing whitespace. Submitted by: arundel Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Nov 22 09:34:38 2010 (r215668) +++ head/ObsoleteFiles.inc Mon Nov 22 09:37:52 2010 (r215669) @@ -13,6 +13,15 @@ # # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# Before you commit changes to this file please check if any entries in +# tools/build/mk/OptionalObsoleteFiles.inc can be removed. The following +# command tells which files are listed more than once regardless of some +# architecture specific conditionals, so you can not blindly trust the +# output: +# ( grep '+=' /usr/src/ObsoleteFiles.inc | sort -u ; \ +# grep '+=' /usr/src/tools/build/mk/OptionalObsoleteFiles.inc | sort -u) | \ +# sort | uniq -d +# # 20101112: vgonel(9) has gone to private API a while ago OLD_FILES+=usr/share/man/man9/vgonel.9.gz @@ -1634,7 +1643,7 @@ OLD_DIRS+=usr/include/c++/3.4 OLD_FILES+=usr/sbin/zfs OLD_FILES+=usr/sbin/zpool # 20070423: rc.bluetooth (examples) removed -OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth +OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth # 20070421: worm.4 removed OLD_FILES+=usr/share/man/man4/worm.4.gz # 20070417: trunk(4) renamed to lagg(4) From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 10:08:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D250F106566C; Mon, 22 Nov 2010 10:08:33 +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 B4D8E8FC1B; Mon, 22 Nov 2010 10:08:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMA8XAD086071; Mon, 22 Nov 2010 10:08:33 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMA8X56086068; Mon, 22 Nov 2010 10:08:33 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201011221008.oAMA8X56086068@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 22 Nov 2010 10:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215671 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 10:08:33 -0000 Author: ae Date: Mon Nov 22 10:08:33 2010 New Revision: 215671 URL: http://svn.freebsd.org/changeset/base/215671 Log: Always dump partition labels with `gpart backup`, but `gpart restore` does restore them only when -l option is specified [1]. Make number of entries field in backup format optional. Document -l and -r options of `gpart show` action. Suggested by: pjd [1] MFC after: 1 week Modified: head/sbin/geom/class/part/geom_part.c head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Mon Nov 22 09:59:10 2010 (r215670) +++ head/sbin/geom/class/part/geom_part.c Mon Nov 22 10:08:33 2010 (r215671) @@ -100,10 +100,8 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "[-b start] [-s size] -t type [-i index] [-l label] [-f flags] geom" }, - { "backup", 0, gpart_backup, { - { 'l', "backup_labels", NULL, G_TYPE_BOOL}, - G_OPT_SENTINEL }, - "[-l] geom" + { "backup", 0, gpart_backup, G_NULL_OPTS, + "geom" }, { "bootcode", 0, gpart_bootcode, { { 'b', GPART_PARAM_BOOTCODE, G_VAL_OPTIONAL, G_TYPE_STRING }, @@ -175,9 +173,10 @@ struct g_command PUBSYM(class_commands)[ }, { "restore", 0, gpart_restore, { { 'F', "force", NULL, G_TYPE_BOOL }, + { 'l', "restore_labels", NULL, G_TYPE_BOOL }, { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "[-F] [-f flags] provider [...]" + "[-lF] [-f flags] provider [...]" }, { "recover", 0, gpart_issue, { { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, @@ -678,7 +677,7 @@ gpart_backup(struct gctl_req *req, unsig const char *s, *scheme; off_t sector, end; off_t length, secsz; - int error, labels, i, windex, wblocks, wtype; + int error, i, windex, wblocks, wtype; if (gctl_get_int(req, "nargs") != 1) errx(EXIT_FAILURE, "Invalid number of arguments."); @@ -696,7 +695,6 @@ gpart_backup(struct gctl_req *req, unsig s = gctl_get_ascii(req, "arg0"); if (s == NULL) abort(); - labels = gctl_get_int(req, "backup_labels"); gp = find_geom(classp, s); if (gp == NULL) errx(EXIT_FAILURE, "No such geom: %s.", s); @@ -734,14 +732,12 @@ gpart_backup(struct gctl_req *req, unsig length = end - sector + 1; } s = find_provcfg(pp, "label"); - printf("%-*s %*s %*jd %*jd", + printf("%-*s %*s %*jd %*jd %s %s\n", windex, find_provcfg(pp, "index"), wtype, find_provcfg(pp, "type"), wblocks, (intmax_t)sector, - wblocks, (intmax_t)length); - if (labels && s != NULL) - printf(" %s", s); - printf(" %s\n", fmtattrib(pp)); + wblocks, (intmax_t)length, + (s != NULL) ? s: "", fmtattrib(pp)); } geom_deletetree(&mesh); } @@ -769,7 +765,7 @@ gpart_restore(struct gctl_req *req, unsi struct ggeom *gp; const char *s, *flags, *errstr, *label; char **ap, *argv[6], line[BUFSIZ], *pline; - int error, forced, i, l, nargs, created; + int error, forced, i, l, nargs, created, rl; intmax_t n; nargs = gctl_get_int(req, "nargs"); @@ -778,6 +774,7 @@ gpart_restore(struct gctl_req *req, unsi forced = gctl_get_int(req, "force"); flags = gctl_get_ascii(req, "flags"); + rl = gctl_get_int(req, "restore_labels"); s = gctl_get_ascii(req, "class"); if (s == NULL) abort(); @@ -829,19 +826,21 @@ gpart_restore(struct gctl_req *req, unsi break; l = ap - &argv[0]; label = pline = NULL; - if (l == 2) { /* create table */ + if (l == 1 || l == 2) { /* create table */ if (created) errx(EXIT_FAILURE, "Incorrect backup format."); - n = atoi(argv[1]); + if (l == 2) + n = strtoimax(argv[1], NULL, 0); for (i = 0; i < nargs; i++) { s = gctl_get_ascii(req, "arg%d", i); r = gctl_get_handle(); - n = strtoimax(argv[1], NULL, 0); gctl_ro_param(r, "class", -1, classp->lg_name); gctl_ro_param(r, "verb", -1, "create"); gctl_ro_param(r, "scheme", -1, argv[0]); - gctl_ro_param(r, "entries", sizeof(n), &n); + if (l == 2) + gctl_ro_param(r, "entries", + sizeof(n), &n); gctl_ro_param(r, "flags", -1, "restore"); gctl_ro_param(r, "arg0", -1, s); errstr = gctl_issue(r); @@ -877,7 +876,7 @@ gpart_restore(struct gctl_req *req, unsi gctl_ro_param(r, "type", -1, argv[1]); gctl_ro_param(r, "start", -1, argv[2]); gctl_ro_param(r, "size", -1, argv[3]); - if (label != NULL) + if (rl != 0 && label != NULL) gctl_ro_param(r, "label", -1, argv[4]); gctl_ro_param(r, "arg0", -1, s); error = gpart_autofill(r); Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Mon Nov 22 09:59:10 2010 (r215670) +++ head/sbin/geom/class/part/gpart.8 Mon Nov 22 10:08:33 2010 (r215671) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2010 +.Dd November 22, 2010 .Dt GPART 8 .Os .Sh NAME @@ -94,7 +94,6 @@ utility: .\" ==== BACKUP ==== .Nm .Cm backup -.Op Fl l .Ar geom .\" ==== BOOTCODE ==== .Nm @@ -149,7 +148,7 @@ utility: .\" ==== RESTORE ==== .Nm .Cm restore -.Op Fl F +.Op Fl lF .Op Fl f Ar flags .Ar provider .Op Ar ... @@ -163,6 +162,7 @@ utility: .\" ==== SHOW ==== .Nm .Cm show +.Op Fl lr .Op Ar geom ... .\" ==== UNDO ==== .Nm @@ -225,12 +225,6 @@ about its use. Dump a partition table to standard output in special format used by .Cm restore action. -.Pp -Additional options include: -.Bl -tag -width 10n -.It Fl l -Dump partition labels for partitioning schemes that support them. -.El .\" ==== BOOTCODE ==== .It Cm bootcode Embed bootstrap code into the partitioning scheme's metadata on the @@ -439,6 +433,8 @@ Additional options include: Destroy partition table on the given .Ar provider before doing restore. +.It Fl l +Restore partition labels for partitioning schemes that support them. .It Fl f Ar flags Additional operational flags. See the section entitled @@ -466,6 +462,14 @@ about its use. .It Cm show Show the current partition information of the specified geoms or all geoms if none are specified. +Additional options include: +.Bl -tag -width 10n +.It Fl l +For partition schemes that support partition labels print them +instead of partition type. +.It Fl r +Show raw partition type instead of symbolic name. +.El .\" ==== UNDO ==== .It Cm undo Revert any pending changes for geom @@ -819,13 +823,13 @@ After having created all required partit Create backup of partition table from .Pa da0 .Bd -literal -offset indent -/sbin/gpart backup -l da0 > da0.backup +/sbin/gpart backup da0 > da0.backup .Ed .Pp Restore partition table from backup to .Pa da0 .Bd -literal -offset indent -/sbin/gpart restore da0 < /mnt/da0.backup +/sbin/gpart restore -l da0 < /mnt/da0.backup .Ed .Pp Clone partition table from From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 10:29:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 933FA106566B; Mon, 22 Nov 2010 10:29:16 +0000 (UTC) (envelope-from netchild@freebsd.org) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2325B8FC19; Mon, 22 Nov 2010 10:29:15 +0000 (UTC) Received: from outgoing.leidinger.net (p5B32EEA9.dip.t-dialin.net [91.50.238.169]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id 2A8C884400E; Mon, 22 Nov 2010 11:13:20 +0100 (CET) Received: from webmail.leidinger.net (unknown [IPv6:fd73:10c7:2053:1::2:102]) by outgoing.leidinger.net (Postfix) with ESMTP id 08D9924C8; Mon, 22 Nov 2010 11:13:16 +0100 (CET) Received: (from www@localhost) by webmail.leidinger.net (8.14.4/8.13.8/Submit) id oAMAD6Nc014376; Mon, 22 Nov 2010 11:13:06 +0100 (CET) (envelope-from netchild@FreeBSD.org) Received: from pslux.ec.europa.eu (pslux.ec.europa.eu [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Mon, 22 Nov 2010 11:13:06 +0100 Message-ID: <20101122111306.16504je0tt7xe5us@webmail.leidinger.net> Date: Mon, 22 Nov 2010 11:13:06 +0100 From: Alexander Leidinger To: Kostik Belousov References: <201011220907.oAM970To084256@svn.freebsd.org> <20101122093134.GU2392@deviant.kiev.zoral.com.ua> In-Reply-To: <20101122093134.GU2392@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: 2A8C884400E.AA2CF X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=1.428, required 6, autolearn=disabled, RDNS_NONE 1.27, TW_MG 0.08, TW_SV 0.08) X-EBL-MailScanner-SpamScore: s X-EBL-MailScanner-From: netchild@freebsd.org X-EBL-MailScanner-Watermark: 1291025601.18835@jDT6E52umj2QxWNHluKRHw X-EBL-Spam-Status: No Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r215664 - in head/sys: compat/linux kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 10:29:16 -0000 Quoting Kostik Belousov (from Mon, 22 Nov 2010 11:31:34 +0200): > On Mon, Nov 22, 2010 at 09:07:00AM +0000, Alexander Leidinger wrote: >> Author: netchild >> Date: Mon Nov 22 09:06:59 2010 >> New Revision: 215664 >> URL: http://svn.freebsd.org/changeset/base/215664 >> >> Log: >> By using the 32-bit Linux version of Sun's Java Development Kit 1.6 >> on FreeBSD (amd64), invocations of "javac" (or "java") eventually >> end with the output of "Killed" and exit code 137. >> @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru >> } else >> EMUL_SHARED_WUNLOCK(&emul_shared_lock); >> >> + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { >> + PROC_LOCK(p); >> + p->p_xstat = shared_xstat; >> + PROC_UNLOCK(p); >> + } > Why is process lock taken there ? The assignment to u_short inside the > properly aligned structure is atomic on all supported architectures, and > the thread that should see side-effect of assignment is the same thread > that does assignment. Change below. >> + >> if (child_clear_tid != NULL) { >> struct linux_sys_futex_args cup; >> int null = 0; >> @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru >> if (__predict_false(imgp->sysent == &elf_linux_sysvec >> && p->p_sysent != &elf_linux_sysvec)) >> linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); >> + if (__predict_false(p->p_sysent == &elf_linux_sysvec)) >> + /* Kill threads regardless of imgp->sysent value */ >> + linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > This is better expressed by > if ((p->p_sysent->sv_flags & SV_ABI_MASK) == SV_ABI_LINUX) Is this OK for you? ---snip--- Index: compat/linux/linux_emul.c =================================================================== --- compat/linux/linux_emul.c (Revision 215664) +++ compat/linux/linux_emul.c (Arbeitskopie) @@ -198,11 +198,8 @@ } else EMUL_SHARED_WUNLOCK(&emul_shared_lock); - if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { - PROC_LOCK(p); + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) p->p_xstat = shared_xstat; - PROC_UNLOCK(p); - } if (child_clear_tid != NULL) { struct linux_sys_futex_args cup; @@ -265,7 +262,8 @@ if (__predict_false(imgp->sysent == &elf_linux_sysvec && p->p_sysent != &elf_linux_sysvec)) linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); - if (__predict_false(p->p_sysent == &elf_linux_sysvec)) + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == + SV_ABI_LINUX)) /* Kill threads regardless of imgp->sysent value */ linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); if (__predict_false(imgp->sysent != &elf_linux_sysvec ---snip--- > Regardless of this mostly cosmetic issue, this is racy. Other > linux thread in the same process might do an execve(3). > More, if execve(3) call fails, then you return into the process > that lacks all threads except the one that called execve(3). How critical is this in your opinion (relative to the issue this patch is fixing)? Do you prefer a backout or do you think the probability that the someone wins the race is low enough? Do you see a solution for the race? Bye, Alexander. -- http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 This generation doesn't have emotional baggage. We have emotional moving vans. -- Bruce Feirstein From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 10:42:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C91AE106564A; Mon, 22 Nov 2010 10:42:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5A73F8FC17; Mon, 22 Nov 2010 10:42:35 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id oAMAgWWb071468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Nov 2010 12:42:32 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id oAMAgWqn090688; Mon, 22 Nov 2010 12:42:32 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id oAMAgWhq090687; Mon, 22 Nov 2010 12:42:32 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 22 Nov 2010 12:42:32 +0200 From: Kostik Belousov To: Alexander Leidinger Message-ID: <20101122104232.GY2392@deviant.kiev.zoral.com.ua> References: <201011220907.oAM970To084256@svn.freebsd.org> <20101122093134.GU2392@deviant.kiev.zoral.com.ua> <20101122111306.16504je0tt7xe5us@webmail.leidinger.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YYyN6dyDU9bDiN2J" Content-Disposition: inline In-Reply-To: <20101122111306.16504je0tt7xe5us@webmail.leidinger.net> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_05, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215664 - in head/sys: compat/linux kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 10:42:36 -0000 --YYyN6dyDU9bDiN2J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 22, 2010 at 11:13:06AM +0100, Alexander Leidinger wrote: > Quoting Kostik Belousov (from Mon, 22 Nov 2010 =20 > 11:31:34 +0200): >=20 > >On Mon, Nov 22, 2010 at 09:07:00AM +0000, Alexander Leidinger wrote: > >>Author: netchild > >>Date: Mon Nov 22 09:06:59 2010 > >>New Revision: 215664 > >>URL: http://svn.freebsd.org/changeset/base/215664 > >> > >>Log: > >> By using the 32-bit Linux version of Sun's Java Development Kit 1.6 > >> on FreeBSD (amd64), invocations of "javac" (or "java") eventually > >> end with the output of "Killed" and exit code 137. >=20 >=20 > >>@@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru > >> } else > >> EMUL_SHARED_WUNLOCK(&emul_shared_lock); > >> > >>+ if ((shared_flags & EMUL_SHARED_HASXSTAT) !=3D 0) { > >>+ PROC_LOCK(p); > >>+ p->p_xstat =3D shared_xstat; > >>+ PROC_UNLOCK(p); > >>+ } > >Why is process lock taken there ? The assignment to u_short inside the > >properly aligned structure is atomic on all supported architectures, and > >the thread that should see side-effect of assignment is the same thread > >that does assignment. >=20 > Change below. >=20 > >>+ > >> if (child_clear_tid !=3D NULL) { > >> struct linux_sys_futex_args cup; > >> int null =3D 0; > >>@@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru > >> if (__predict_false(imgp->sysent =3D=3D &elf_linux_sysvec > >> && p->p_sysent !=3D &elf_linux_sysvec)) > >> linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > >>+ if (__predict_false(p->p_sysent =3D=3D &elf_linux_sysvec)) > >>+ /* Kill threads regardless of imgp->sysent value */ > >>+ linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > >This is better expressed by > > if ((p->p_sysent->sv_flags & SV_ABI_MASK) =3D=3D SV_ABI_LINUX) >=20 > Is this OK for you? > ---snip--- > Index: compat/linux/linux_emul.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- compat/linux/linux_emul.c (Revision 215664) > +++ compat/linux/linux_emul.c (Arbeitskopie) > @@ -198,11 +198,8 @@ > } else > EMUL_SHARED_WUNLOCK(&emul_shared_lock); >=20 > - if ((shared_flags & EMUL_SHARED_HASXSTAT) !=3D 0) { > - PROC_LOCK(p); > + if ((shared_flags & EMUL_SHARED_HASXSTAT) !=3D 0) > p->p_xstat =3D shared_xstat; > - PROC_UNLOCK(p); > - } >=20 > if (child_clear_tid !=3D NULL) { > struct linux_sys_futex_args cup; > @@ -265,7 +262,8 @@ > if (__predict_false(imgp->sysent =3D=3D &elf_linux_sysvec > && p->p_sysent !=3D &elf_linux_sysvec)) > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > - if (__predict_false(p->p_sysent =3D=3D &elf_linux_sysvec)) > + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) =3D=3D > + SV_ABI_LINUX)) > /* Kill threads regardless of imgp->sysent value */ > linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > if (__predict_false(imgp->sysent !=3D &elf_linux_sysvec > ---snip--- Yes. >=20 > >Regardless of this mostly cosmetic issue, this is racy. Other > >linux thread in the same process might do an execve(3). > >More, if execve(3) call fails, then you return into the process > >that lacks all threads except the one that called execve(3). >=20 > How critical is this in your opinion (relative to the issue this patch = =20 > is fixing)? Do you prefer a backout or do you think the probability =20 > that the someone wins the race is low enough? >=20 > Do you see a solution for the race? I did not asked for backout, nor I am asking now. Most likely, the semantic of linux thread groups cannot be implemented by only using event handlers that linux.ko hooks now. How linux handles single-threading when doing execve(2) from multithreaded process ? --YYyN6dyDU9bDiN2J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkzqSRcACgkQC3+MBN1Mb4isEACePbwrVD5CTKib0MUfuA+mq5bb OP4AoPQVUNCtn7peWPyed7S0wXADtaiV =Xxmt -----END PGP SIGNATURE----- --YYyN6dyDU9bDiN2J-- From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 11:11:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5788A1065710; Mon, 22 Nov 2010 11:11:18 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 875AA8FC14; Mon, 22 Nov 2010 11:11:16 +0000 (UTC) Received: by ewy3 with SMTP id 3so3670287ewy.13 for ; Mon, 22 Nov 2010 03:11:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=Hgd+GzJf0uyruABHGlz5rrNrDJDWgJp08XIZQUlqz7k=; b=VymKE0dE7h/pqIfBD8VIhnLndRZzalmMFVa8PwjezTmawOLtaYFpdhZjfxMChnA8io xDFLIUACaWuh8BPNftq9zREP7MV4GsF55rgE/zlOqq2QN/JH1hBLOri+BjgxWGN06JXU iF+/xQkDJOS57Fv4ykGH+v5m/E6VVJB4CORWw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=PxTtzoFli0yv8Z5dNGiHPgiZjKXz2AOhdkjyTXU7H3SBBkAtKiiTdaOoIru0Xdiwt2 x/PmWi14UpB1C3AZxTfip4HT+tKt86bU93AAWSGHB7rrHVKZHS9P6ZczWUN0A15U/Ntd ByLGKgHE9pn5EYYWvitZMbV0ZJ6qQnQuQYS+g= Received: by 10.213.9.140 with SMTP id l12mr7549412ebl.13.1290424276006; Mon, 22 Nov 2010 03:11:16 -0800 (PST) Received: from localhost (lan-78-157-92-5.vln.skynet.lt [78.157.92.5]) by mx.google.com with ESMTPS id v51sm4598495eeh.16.2010.11.22.03.11.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 22 Nov 2010 03:11:15 -0800 (PST) Date: Mon, 22 Nov 2010 13:11:06 +0200 From: Gleb Kurtsou To: Kostik Belousov Message-ID: <20101122111105.GA2561@tops> References: <201011220907.oAM970To084256@svn.freebsd.org> <20101122093134.GU2392@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20101122093134.GU2392@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Alexander Leidinger Subject: Re: svn commit: r215664 - in head/sys: compat/linux kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 11:11:19 -0000 On (22/11/2010 11:31), Kostik Belousov wrote: > On Mon, Nov 22, 2010 at 09:07:00AM +0000, Alexander Leidinger wrote: > > Author: netchild > > Date: Mon Nov 22 09:06:59 2010 > > New Revision: 215664 > > URL: http://svn.freebsd.org/changeset/base/215664 > > > > Log: > > By using the 32-bit Linux version of Sun's Java Development Kit 1.6 > > on FreeBSD (amd64), invocations of "javac" (or "java") eventually > > end with the output of "Killed" and exit code 137. > > > > This is caused by: > > 1. After calling exec() in multithreaded linux program threads are not > > destroyed and continue running. They get killed after program being > > executed finishes. > > > > 2. linux_exit_group doesn't return correct exit code when called not > > from group leader. Which happens regularly using sun jvm. > > > > The submitters fix this in a similar way to how NetBSD handles this. > > > > I took the PRs away from dchagin, who seems to be out of touch of > > this since a while (no response from him). > > > > The patches committed here are from [2], with some little modifications > > from me to the style. > > > > PR: 141439 [1], 144194 [2] > > Submitted by: Stefan Schmidt , gk > > Reviewed by: rdivacky (in april 2010) > > MFC after: 5 days > > > > Modified: > > head/sys/compat/linux/linux_emul.c > > head/sys/compat/linux/linux_emul.h > > head/sys/compat/linux/linux_misc.c > > head/sys/kern/kern_exit.c > > > > Modified: head/sys/compat/linux/linux_emul.c > > ============================================================================== > > --- head/sys/compat/linux/linux_emul.c Mon Nov 22 09:04:29 2010 (r215663) > > +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 09:06:59 2010 (r215664) > > @@ -155,7 +155,7 @@ void > > linux_proc_exit(void *arg __unused, struct proc *p) > > { > > struct linux_emuldata *em; > > - int error; > > + int error, shared_flags, shared_xstat; > > struct thread *td = FIRST_THREAD_IN_PROC(p); > > int *child_clear_tid; > > struct proc *q, *nq; > > @@ -187,6 +187,8 @@ linux_proc_exit(void *arg __unused, stru > > } > > > > EMUL_SHARED_WLOCK(&emul_shared_lock); > > + shared_flags = em->shared->flags; > > + shared_xstat = em->shared->xstat; > > LIST_REMOVE(em, threads); > > > > em->shared->refs--; > > @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru > > } else > > EMUL_SHARED_WUNLOCK(&emul_shared_lock); > > > > + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { > > + PROC_LOCK(p); > > + p->p_xstat = shared_xstat; > > + PROC_UNLOCK(p); > > + } > Why is process lock taken there ? The assignment to u_short inside the > properly aligned structure is atomic on all supported architectures, and > the thread that should see side-effect of assignment is the same thread > that does assignment. > > > + > > if (child_clear_tid != NULL) { > > struct linux_sys_futex_args cup; > > int null = 0; > > @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru > > if (__predict_false(imgp->sysent == &elf_linux_sysvec > > && p->p_sysent != &elf_linux_sysvec)) > > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > > + if (__predict_false(p->p_sysent == &elf_linux_sysvec)) > > + /* Kill threads regardless of imgp->sysent value */ > > + linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > This is better expressed by > if ((p->p_sysent->sv_flags & SV_ABI_MASK) == SV_ABI_LINUX) > > Regardless of this mostly cosmetic issue, this is racy. Other > linux thread in the same process might do an execve(3). > More, if execve(3) call fails, then you return into the process > that lacks all threads except the one that called execve(3). execve(3) races in linuxulator are known, and that's not the only case: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/142082 But fixing it is not easy, as you've noted in other email current hook mechanism is not good enough for it. From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 11:24:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D91D010656A4; Mon, 22 Nov 2010 11:24:11 +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 AA17B8FC17; Mon, 22 Nov 2010 11:24:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMBOBCq090402; Mon, 22 Nov 2010 11:24:11 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMBOB9M090400; Mon, 22 Nov 2010 11:24:11 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201011221124.oAMBOB9M090400@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 22 Nov 2010 11:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215672 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 11:24:12 -0000 Author: ae Date: Mon Nov 22 11:24:11 2010 New Revision: 215672 URL: http://svn.freebsd.org/changeset/base/215672 Log: Add SIGINT handler to `gpart restore` action. MFC after: 1 week Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Mon Nov 22 10:08:33 2010 (r215671) +++ head/sbin/geom/class/part/geom_part.c Mon Nov 22 11:24:11 2010 (r215672) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -61,6 +62,7 @@ uint32_t PUBSYM(version) = 0; static char sstart[32]; static char ssize[32]; +volatile sig_atomic_t undo_restore; #define GPART_AUTOFILL "*" #define GPART_FLAGS "C" @@ -757,12 +759,19 @@ skip_line(const char *p) } static void +gpart_sighndl(int sig __unused) +{ + undo_restore = 1; +} + +static void gpart_restore(struct gctl_req *req, unsigned int fl __unused) { struct gmesh mesh; struct gclass *classp; struct gctl_req *r; struct ggeom *gp; + struct sigaction si_sa; const char *s, *flags, *errstr, *label; char **ap, *argv[6], line[BUFSIZ], *pline; int error, forced, i, l, nargs, created, rl; @@ -786,6 +795,13 @@ gpart_restore(struct gctl_req *req, unsi geom_deletetree(&mesh); errx(EXIT_FAILURE, "Class %s not found.", s); } + + sigemptyset(&si_sa.sa_mask); + si_sa.sa_flags = 0; + si_sa.sa_handler = gpart_sighndl; + if (sigaction(SIGINT, &si_sa, 0) == -1) + err(EXIT_FAILURE, "sigaction SIGINT"); + if (forced) { /* destroy existent partition table before restore */ for (i = 0; i < nargs; i++) { @@ -811,7 +827,8 @@ gpart_restore(struct gctl_req *req, unsi } } created = 0; - while (fgets(line, sizeof(line) - 1, stdin)) { + while (undo_restore == 0 && + fgets(line, sizeof(line) - 1, stdin) != NULL) { /* Format of backup entries: * * [label] ['['attrib[,attrib]']'] @@ -920,6 +937,8 @@ gpart_restore(struct gctl_req *req, unsi } } } + if (undo_restore) + goto backout; /* commit changes if needed */ if (strchr(flags, 'C') != NULL) { for (i = 0; i < nargs; i++) { From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 12:32:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B34E510656FA; Mon, 22 Nov 2010 12:32:19 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A24218FC19; Mon, 22 Nov 2010 12:32:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMCWJ5K091863; Mon, 22 Nov 2010 12:32:19 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMCWJn7091860; Mon, 22 Nov 2010 12:32:19 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201011221232.oAMCWJn7091860@svn.freebsd.org> From: Marko Zec Date: Mon, 22 Nov 2010 12:32:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215673 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 12:32:19 -0000 Author: zec Date: Mon Nov 22 12:32:19 2010 New Revision: 215673 URL: http://svn.freebsd.org/changeset/base/215673 Log: Allow for MTU sizes of up to ETHER_MAX_LEN_JUMBO (i.e. 9018) bytes to be configured on ng_eiface ifnets. The default MTU remains unchanged at 1500 bytes. Mark ng_eiface ifnets as IFCAP_VLAN_MTU capable, so that the associated vlan(4) ifnets may use full-sized Ethernet MTUs (1500 bytes). MFC after: 3 days Modified: head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_eiface.h Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Mon Nov 22 11:24:11 2010 (r215672) +++ head/sys/netgraph/ng_eiface.c Mon Nov 22 12:32:19 2010 (r215673) @@ -371,6 +371,8 @@ ng_eiface_constructor(node_p node) ifp->if_ioctl = ng_eiface_ioctl; ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = (IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST); + ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU; + ifp->if_capenable = IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU; /* Give this node the same name as the interface (if possible) */ if (ng_name_node(node, ifp->if_xname) != 0) Modified: head/sys/netgraph/ng_eiface.h ============================================================================== --- head/sys/netgraph/ng_eiface.h Mon Nov 22 11:24:11 2010 (r215672) +++ head/sys/netgraph/ng_eiface.h Mon Nov 22 12:32:19 2010 (r215673) @@ -46,7 +46,7 @@ /* MTU bounds */ #define NG_EIFACE_MTU_MIN 72 -#define NG_EIFACE_MTU_MAX 2312 +#define NG_EIFACE_MTU_MAX ETHER_MAX_LEN_JUMBO #define NG_EIFACE_MTU_DEFAULT 1500 /* Netgraph commands */ From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 12:33:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CB7B106566B; Mon, 22 Nov 2010 12:33:48 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 516898FC24; Mon, 22 Nov 2010 12:33:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMCXmqS091944; Mon, 22 Nov 2010 12:33:48 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMCXmLL091942; Mon, 22 Nov 2010 12:33:48 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201011221233.oAMCXmLL091942@svn.freebsd.org> From: Bruce Cran Date: Mon, 22 Nov 2010 12:33:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215674 - head/sbin/devd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 12:33:48 -0000 Author: brucec Date: Mon Nov 22 12:33:48 2010 New Revision: 215674 URL: http://svn.freebsd.org/changeset/base/215674 Log: Don't generate input() since it's not used. Modified: head/sbin/devd/token.l Modified: head/sbin/devd/token.l ============================================================================== --- head/sbin/devd/token.l Mon Nov 22 12:32:19 2010 (r215673) +++ head/sbin/devd/token.l Mon Nov 22 12:33:48 2010 (r215674) @@ -38,6 +38,7 @@ int lineno = 1; #define YY_NO_UNPUT +#define YY_NO_INPUT static void update_lineno(const char *cp) From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 12:42:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A6E41065673; Mon, 22 Nov 2010 12:42:33 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08E9E8FC1D; Mon, 22 Nov 2010 12:42:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMCgWKh092146; Mon, 22 Nov 2010 12:42:32 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMCgW9O092144; Mon, 22 Nov 2010 12:42:32 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201011221242.oAMCgW9O092144@svn.freebsd.org> From: Alexander Leidinger Date: Mon, 22 Nov 2010 12:42:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215675 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 12:42:33 -0000 Author: netchild Date: Mon Nov 22 12:42:32 2010 New Revision: 215675 URL: http://svn.freebsd.org/changeset/base/215675 Log: Do not take the process lock. The assignment to u_short inside the properly aligned structure is atomic on all supported architectures, and the thread that should see side-effect of assignment is the same thread that does assignment. Use a more appropriate conditional to detect the linux ABI. Suggested by: kib X-MFC: together with r215664 Modified: head/sys/compat/linux/linux_emul.c Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Mon Nov 22 12:33:48 2010 (r215674) +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 12:42:32 2010 (r215675) @@ -198,11 +198,8 @@ linux_proc_exit(void *arg __unused, stru } else EMUL_SHARED_WUNLOCK(&emul_shared_lock); - if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { - PROC_LOCK(p); + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) p->p_xstat = shared_xstat; - PROC_UNLOCK(p); - } if (child_clear_tid != NULL) { struct linux_sys_futex_args cup; @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru if (__predict_false(imgp->sysent == &elf_linux_sysvec && p->p_sysent != &elf_linux_sysvec)) linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); - if (__predict_false(p->p_sysent == &elf_linux_sysvec)) + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == + SV_ABI_LINUX)) /* Kill threads regardless of imgp->sysent value */ linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); if (__predict_false(imgp->sysent != &elf_linux_sysvec From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 12:51:13 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDD3A106566C; Mon, 22 Nov 2010 12:51:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 71A668FC08; Mon, 22 Nov 2010 12:51:11 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id oAMCp6UY082001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Nov 2010 14:51:06 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id oAMCp6BA091600; Mon, 22 Nov 2010 14:51:06 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id oAMCp6Lc091599; Mon, 22 Nov 2010 14:51:06 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 22 Nov 2010 14:51:06 +0200 From: Kostik Belousov To: Alexander Leidinger Message-ID: <20101122125106.GZ2392@deviant.kiev.zoral.com.ua> References: <201011221242.oAMCgW9O092144@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="unlXUuABvvRmijn5" Content-Disposition: inline In-Reply-To: <201011221242.oAMCgW9O092144@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_20, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215675 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 12:51:13 -0000 --unlXUuABvvRmijn5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 22, 2010 at 12:42:32PM +0000, Alexander Leidinger wrote: > Author: netchild > Date: Mon Nov 22 12:42:32 2010 > New Revision: 215675 > URL: http://svn.freebsd.org/changeset/base/215675 >=20 > Log: > Do not take the process lock. The assignment to u_short inside the > properly aligned structure is atomic on all supported architectures, and > the thread that should see side-effect of assignment is the same thread > that does assignment. > =20 > Use a more appropriate conditional to detect the linux ABI. > =20 > Suggested by: kib > X-MFC: together with r215664 >=20 > Modified: > head/sys/compat/linux/linux_emul.c >=20 > Modified: head/sys/compat/linux/linux_emul.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/compat/linux/linux_emul.c Mon Nov 22 12:33:48 2010 (r215674) > +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 12:42:32 2010 (r215675) > @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru > if (__predict_false(imgp->sysent =3D=3D &elf_linux_sysvec > && p->p_sysent !=3D &elf_linux_sysvec)) > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > - if (__predict_false(p->p_sysent =3D=3D &elf_linux_sysvec)) > + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) =3D=3D > + SV_ABI_LINUX)) > /* Kill threads regardless of imgp->sysent value */ > linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > if (__predict_false(imgp->sysent !=3D &elf_linux_sysvec There are several similar comparisons around the patched one. I am still quite curious for the reason of all __predict() obfuscations that are countless in the linuxolator. We are not oblidged to emulate this aspect of Linux. --unlXUuABvvRmijn5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkzqZzkACgkQC3+MBN1Mb4j44gCfSP/cgcK+dGdlgipC7wGIRPUb WKQAoN1r2j9mOup3dXw3PAXiGF9PmLi7 =9M8k -----END PGP SIGNATURE----- --unlXUuABvvRmijn5-- From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 14:16:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7634C106564A; Mon, 22 Nov 2010 14:16:22 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62D048FC0A; Mon, 22 Nov 2010 14:16:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMEGMV8094023; Mon, 22 Nov 2010 14:16:22 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMEGMAY094015; Mon, 22 Nov 2010 14:16:22 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201011221416.oAMEGMAY094015@svn.freebsd.org> From: Bruce Cran Date: Mon, 22 Nov 2010 14:16:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215676 - in head: sbin/hastd usr.bin/colldef usr.sbin/apmd usr.sbin/bluetooth/bthidd usr.sbin/bluetooth/hcsecd usr.sbin/config usr.sbin/kbdcontrol X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 14:16:22 -0000 Author: brucec Date: Mon Nov 22 14:16:22 2010 New Revision: 215676 URL: http://svn.freebsd.org/changeset/base/215676 Log: Don't generate input() since it's not used. Modified: head/sbin/hastd/Makefile head/usr.bin/colldef/Makefile head/usr.sbin/apmd/apmdlex.l head/usr.sbin/bluetooth/bthidd/lexer.l head/usr.sbin/bluetooth/hcsecd/lexer.l head/usr.sbin/config/lang.l head/usr.sbin/kbdcontrol/lex.l Modified: head/sbin/hastd/Makefile ============================================================================== --- head/sbin/hastd/Makefile Mon Nov 22 12:42:32 2010 (r215675) +++ head/sbin/hastd/Makefile Mon Nov 22 14:16:22 2010 (r215676) @@ -25,6 +25,7 @@ CFLAGS+=-DINET6 .endif # This is needed to have WARNS > 1. CFLAGS+=-DYY_NO_UNPUT +CFLAGS+=-DYY_NO_INPUT DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL} LDADD= -lgeom -lbsdxml -lsbuf -ll -lpthread -lutil Modified: head/usr.bin/colldef/Makefile ============================================================================== --- head/usr.bin/colldef/Makefile Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.bin/colldef/Makefile Mon Nov 22 14:16:22 2010 (r215676) @@ -4,7 +4,7 @@ PROG= colldef SRCS= parse.y scan.l y.tab.h LFLAGS= -8 -i CFLAGS+=-I. -I${.CURDIR} -I${.CURDIR}/../../lib/libc/locale -CFLAGS+=-DCOLLATE_DEBUG -DYY_NO_UNPUT +CFLAGS+=-DCOLLATE_DEBUG -DYY_NO_UNPUT -DYY_NO_INPUT LDADD= -ll DPADD= ${LIBL} Modified: head/usr.sbin/apmd/apmdlex.l ============================================================================== --- head/usr.sbin/apmd/apmdlex.l Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.sbin/apmd/apmdlex.l Mon Nov 22 14:16:22 2010 (r215676) @@ -38,6 +38,7 @@ /* We don't need it, avoid the warning. */ #define YY_NO_UNPUT +#define YY_NO_INPUT int lineno; int first_time; Modified: head/usr.sbin/bluetooth/bthidd/lexer.l ============================================================================== --- head/usr.sbin/bluetooth/bthidd/lexer.l Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.sbin/bluetooth/bthidd/lexer.l Mon Nov 22 14:16:22 2010 (r215676) @@ -39,7 +39,7 @@ int yylex (void); %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput noinput delim [ \t\n] ws {delim}+ Modified: head/usr.sbin/bluetooth/hcsecd/lexer.l ============================================================================== --- head/usr.sbin/bluetooth/hcsecd/lexer.l Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.sbin/bluetooth/hcsecd/lexer.l Mon Nov 22 14:16:22 2010 (r215676) @@ -34,7 +34,7 @@ #include "parser.h" %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput noinput delim [ \t\n] ws {delim}+ Modified: head/usr.sbin/config/lang.l ============================================================================== --- head/usr.sbin/config/lang.l Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.sbin/config/lang.l Mon Nov 22 14:16:22 2010 (r215676) @@ -39,6 +39,7 @@ #include "config.h" #define YY_NO_UNPUT +#define YY_NO_INPUT /* * Data for returning to previous files from include files. Modified: head/usr.sbin/kbdcontrol/lex.l ============================================================================== --- head/usr.sbin/kbdcontrol/lex.l Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.sbin/kbdcontrol/lex.l Mon Nov 22 14:16:22 2010 (r215676) @@ -32,6 +32,7 @@ #include "lex.h" #define YY_NO_UNPUT +#define YY_NO_INPUT %} From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 14:16:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73B401065673; Mon, 22 Nov 2010 14:16:23 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62DDE8FC13; Mon, 22 Nov 2010 14:16:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMEGNiL094056; Mon, 22 Nov 2010 14:16:23 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMEGNkC094054; Mon, 22 Nov 2010 14:16:23 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201011221416.oAMEGNkC094054@svn.freebsd.org> From: Marko Zec Date: Mon, 22 Nov 2010 14:16:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215677 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 14:16:23 -0000 Author: zec Date: Mon Nov 22 14:16:23 2010 New Revision: 215677 URL: http://svn.freebsd.org/changeset/base/215677 Log: Remove an apparently redundant CURVNET_SET() / CURVNET_RESTORE() pair. MFC after: 3 days Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Mon Nov 22 14:16:22 2010 (r215676) +++ head/sys/netinet/if_ether.c Mon Nov 22 14:16:23 2010 (r215677) @@ -154,12 +154,10 @@ arp_ifscrub(struct ifnet *ifp, uint32_t addr4.sin_len = sizeof(addr4); addr4.sin_family = AF_INET; addr4.sin_addr.s_addr = addr; - CURVNET_SET(ifp->if_vnet); IF_AFDATA_LOCK(ifp); lla_lookup(LLTABLE(ifp), (LLE_DELETE | LLE_IFADDR), (struct sockaddr *)&addr4); IF_AFDATA_UNLOCK(ifp); - CURVNET_RESTORE(); } #endif From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 14:36:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED870106564A; Mon, 22 Nov 2010 14:36:04 +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 DCCA98FC1C; Mon, 22 Nov 2010 14:36:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMEa4QD094718; Mon, 22 Nov 2010 14:36:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMEa4TH094716; Mon, 22 Nov 2010 14:36:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011221436.oAMEa4TH094716@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Nov 2010 14:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215678 - head/usr.sbin/mptutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 14:36:05 -0000 Author: jhb Date: Mon Nov 22 14:36:04 2010 New Revision: 215678 URL: http://svn.freebsd.org/changeset/base/215678 Log: Similar to mfiutil, drop local definition of powerof2() and use version from instead. Modified: head/usr.sbin/mptutil/mpt_config.c Modified: head/usr.sbin/mptutil/mpt_config.c ============================================================================== --- head/usr.sbin/mptutil/mpt_config.c Mon Nov 22 14:16:23 2010 (r215677) +++ head/usr.sbin/mptutil/mpt_config.c Mon Nov 22 14:36:04 2010 (r215678) @@ -50,8 +50,6 @@ __RCSID("$FreeBSD$"); static void dump_config(CONFIG_PAGE_RAID_VOL_0 *vol); #endif -#define powerof2(x) ((((x)-1)&(x))==0) - static long dehumanize(const char *value) { From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 14:42:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DC34106566B; Mon, 22 Nov 2010 14:42:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28A308FC19; Mon, 22 Nov 2010 14:42:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMEgEYc094897; Mon, 22 Nov 2010 14:42:14 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMEgD9j094882; Mon, 22 Nov 2010 14:42:13 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201011221442.oAMEgD9j094882@svn.freebsd.org> From: Attilio Rao Date: Mon, 22 Nov 2010 14:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215679 - in head: contrib/binutils/bfd contrib/binutils/binutils contrib/binutils/include/elf contrib/file contrib/gdb/gdb gnu/usr.bin/gdb/libgdb sys/compat/freebsd32 sys/kern sys/sys ... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 14:42:14 -0000 Author: attilio Date: Mon Nov 22 14:42:13 2010 New Revision: 215679 URL: http://svn.freebsd.org/changeset/base/215679 Log: Add the ability for GDB to printout the thread name along with other thread specific informations. In order to do that, and in order to avoid KBI breakage with existing infrastructure the following semantic is implemented: - For live programs, a new member to the PT_LWPINFO is added (pl_tdname) - For cores, a new ELF note is added (NT_THRMISC) that can be used for storing thread specific, miscellaneous, informations. Right now it is just popluated with a thread name. GDB, then, retrieves the correct informations from the corefile via the BFD interface, as it groks the ELF notes and create appropriate pseudo-sections. Sponsored by: Sandvine Incorporated Tested by: gianni Discussed with: dim, kan, kib MFC after: 2 weeks Modified: head/contrib/binutils/bfd/elf-bfd.h head/contrib/binutils/bfd/elf.c head/contrib/binutils/binutils/readelf.c head/contrib/binutils/include/elf/common.h head/contrib/file/readelf.h head/contrib/gdb/gdb/fbsd-proc.c head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c head/sys/compat/freebsd32/freebsd32.h head/sys/kern/imgact_elf.c head/sys/kern/sys_process.c head/sys/sys/elf_common.h head/sys/sys/procfs.h head/sys/sys/ptrace.h head/usr.bin/gcore/elfcore.c Modified: head/contrib/binutils/bfd/elf-bfd.h ============================================================================== --- head/contrib/binutils/bfd/elf-bfd.h Mon Nov 22 14:36:04 2010 (r215678) +++ head/contrib/binutils/bfd/elf-bfd.h Mon Nov 22 14:42:13 2010 (r215679) @@ -1673,6 +1673,8 @@ extern char * elfcore_write_pstatus (bfd *, char *, int *, long, int, const void *); extern char *elfcore_write_prfpreg (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_thrmisc + (bfd *, char *, int *, const char *, int); extern char *elfcore_write_prxfpreg (bfd *, char *, int *, const void *, int); extern char *elfcore_write_lwpstatus Modified: head/contrib/binutils/bfd/elf.c ============================================================================== --- head/contrib/binutils/bfd/elf.c Mon Nov 22 14:36:04 2010 (r215678) +++ head/contrib/binutils/bfd/elf.c Mon Nov 22 14:42:13 2010 (r215679) @@ -6316,6 +6316,12 @@ _bfd_elf_rel_vtable_reloc_fn #ifdef HAVE_SYS_PROCFS_H # include + +/* Define HAVE_THRMISC_T for consistency with other similar GNU-type stubs. */ +#undef HAVE_THRMISC_T +#if defined (THRMISC_VERSION) +#define HAVE_THRMISC_T 1 +#endif #endif /* FIXME: this is kinda wrong, but it's what gdb wants. */ @@ -6497,6 +6503,16 @@ elfcore_grok_prxfpreg (bfd *abfd, Elf_In return elfcore_make_note_pseudosection (abfd, ".reg-xfp", note); } +#if defined (HAVE_THRMISC_T) + +static bfd_boolean +elfcore_grok_thrmisc (bfd *abfd, Elf_Internal_Note *note) +{ + return elfcore_make_note_pseudosection (abfd, ".tname", note); +} + +#endif /* defined (HAVE_THRMISC_T) */ + #if defined (HAVE_PRPSINFO_T) typedef prpsinfo_t elfcore_psinfo_t; #if defined (HAVE_PRPSINFO32_T) /* Sparc64 cross Sparc32 */ @@ -6863,6 +6879,12 @@ elfcore_grok_note (bfd *abfd, Elf_Intern return TRUE; } + +#if defined (HAVE_THRMISC_T) + case NT_THRMISC: + return elfcore_grok_thrmisc (abfd, note); +#endif + } } @@ -7245,6 +7267,22 @@ elfcore_write_prfpreg (bfd *abfd, } char * +elfcore_write_thrmisc (bfd *abfd, + char *buf, + int *bufsiz, + const char *tname, + int size) +{ +#if defined (HAVE_THRMISC_T) + char *note_name = "CORE"; + return elfcore_write_note (abfd, buf, bufsiz, + note_name, NT_THRMISC, tname, size); +#else + return buf; +#endif +} + +char * elfcore_write_prxfpreg (bfd *abfd, char *buf, int *bufsiz, Modified: head/contrib/binutils/binutils/readelf.c ============================================================================== --- head/contrib/binutils/binutils/readelf.c Mon Nov 22 14:36:04 2010 (r215678) +++ head/contrib/binutils/binutils/readelf.c Mon Nov 22 14:42:13 2010 (r215679) @@ -9908,6 +9908,7 @@ get_note_type (unsigned e_type) case NT_PSTATUS: return _("NT_PSTATUS (pstatus structure)"); case NT_FPREGS: return _("NT_FPREGS (floating point registers)"); case NT_PSINFO: return _("NT_PSINFO (psinfo structure)"); + case NT_THRMISC: return _("NT_THRMISC (thrmisc structure)"); case NT_LWPSTATUS: return _("NT_LWPSTATUS (lwpstatus_t structure)"); case NT_LWPSINFO: return _("NT_LWPSINFO (lwpsinfo_t structure)"); case NT_WIN32PSTATUS: return _("NT_WIN32PSTATUS (win32_pstatus structure)"); Modified: head/contrib/binutils/include/elf/common.h ============================================================================== --- head/contrib/binutils/include/elf/common.h Mon Nov 22 14:36:04 2010 (r215678) +++ head/contrib/binutils/include/elf/common.h Mon Nov 22 14:42:13 2010 (r215679) @@ -366,6 +366,7 @@ #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ #define NT_TASKSTRUCT 4 /* Contains copy of task struct */ #define NT_AUXV 6 /* Contains copy of Elfxx_auxv_t */ +#define NT_THRMISC 7 /* Contains copy of thrmisc struct */ #define NT_PRXFPREG 0x46e62b7f /* Contains a user_xfpregs_struct; */ /* note name must be "LINUX". */ Modified: head/contrib/file/readelf.h ============================================================================== --- head/contrib/file/readelf.h Mon Nov 22 14:36:04 2010 (r215678) +++ head/contrib/file/readelf.h Mon Nov 22 14:42:13 2010 (r215679) @@ -224,6 +224,7 @@ typedef struct { #define NT_TASKSTRUCT 4 #define NT_PLATFORM 5 #define NT_AUXV 6 +#define NT_THRMISC 7 /* Note types used in executables */ /* NetBSD executables (name = "NetBSD") */ Modified: head/contrib/gdb/gdb/fbsd-proc.c ============================================================================== --- head/contrib/gdb/gdb/fbsd-proc.c Mon Nov 22 14:36:04 2010 (r215678) +++ head/contrib/gdb/gdb/fbsd-proc.c Mon Nov 22 14:42:13 2010 (r215679) @@ -124,6 +124,7 @@ fbsd_make_corefile_notes (bfd *obfd, int fpregset_t fpregs; char *note_data = NULL; Elf_Internal_Ehdr *i_ehdrp; + char fakename; /* Put a "FreeBSD" label in the ELF header. */ i_ehdrp = elf_elfheader (obfd); @@ -138,6 +139,10 @@ fbsd_make_corefile_notes (bfd *obfd, int note_data = elfcore_write_prfpreg (obfd, note_data, note_size, &fpregs, sizeof (fpregs)); + fakename = '\0'; + note_data = elfcore_write_thrmisc (obfd, note_data, note_size, + &fakename, sizeof (fakename)); + if (get_exec_file (0)) { char *fname = strrchr (get_exec_file (0), '/') + 1; Modified: head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c ============================================================================== --- head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c Mon Nov 22 14:36:04 2010 (r215678) +++ head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c Mon Nov 22 14:42:13 2010 (r215679) @@ -426,6 +426,46 @@ fbsd_thread_deactivate (void) init_thread_list (); } +static char * +fbsd_thread_get_name (lwpid_t lwpid) +{ + static char last_thr_name[MAXCOMLEN + 1]; + char section_name[32]; + struct ptrace_lwpinfo lwpinfo; + bfd_size_type size; + struct bfd_section *section; + + if (target_has_execution) + { + if (ptrace (PT_LWPINFO, lwpid, (caddr_t)&lwpinfo, sizeof (lwpinfo)) == -1) + goto fail; + strncpy (last_thr_name, lwpinfo.pl_tdname, sizeof (last_thr_name) - 1); + } + else + { + snprintf (section_name, sizeof (section_name), ".tname/%u", lwpid); + section = bfd_get_section_by_name (core_bfd, section_name); + if (! section) + goto fail; + + /* Section size fix-up. */ + size = bfd_section_size (core_bfd, section); + if (size > sizeof (last_thr_name)) + size = sizeof (last_thr_name); + + if (! bfd_get_section_contents (core_bfd, section, last_thr_name, + (file_ptr)0, size)) + goto fail; + if (last_thr_name[0] == '\0') + goto fail; + } + last_thr_name[sizeof (last_thr_name) - 1] = '\0'; + return last_thr_name; +fail: + strcpy (last_thr_name, ""); + return last_thr_name; +} + static void fbsd_thread_new_objfile (struct objfile *objfile) { @@ -1158,7 +1198,7 @@ fbsd_thread_find_new_threads (void) static char * fbsd_thread_pid_to_str (ptid_t ptid) { - static char buf[64]; + static char buf[64 + MAXCOMLEN]; if (IS_THREAD (ptid)) { @@ -1178,8 +1218,9 @@ fbsd_thread_pid_to_str (ptid_t ptid) if (ti.ti_lid != 0) { - snprintf (buf, sizeof (buf), "Thread %llx (LWP %d)", - (unsigned long long)th.th_thread, ti.ti_lid); + snprintf (buf, sizeof (buf), "Thread %llx (LWP %d/%s)", + (unsigned long long)th.th_thread, ti.ti_lid, + fbsd_thread_get_name (ti.ti_lid)); } else { Modified: head/sys/compat/freebsd32/freebsd32.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32.h Mon Nov 22 14:36:04 2010 (r215678) +++ head/sys/compat/freebsd32/freebsd32.h Mon Nov 22 14:42:13 2010 (r215679) @@ -240,6 +240,11 @@ struct prpsinfo32 { char pr_psargs[PRARGSZ+1]; }; +struct thrmisc32 { + char pr_tname[MAXCOMLEN+1]; + u_int _pad; +}; + struct mq_attr32 { int mq_flags; int mq_maxmsg; Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Mon Nov 22 14:36:04 2010 (r215678) +++ head/sys/kern/imgact_elf.c Mon Nov 22 14:42:13 2010 (r215679) @@ -1316,12 +1316,14 @@ typedef struct prpsinfo32 elf_prpsinfo_t typedef struct fpreg32 elf_prfpregset_t; typedef struct fpreg32 elf_fpregset_t; typedef struct reg32 elf_gregset_t; +typedef struct thrmisc32 elf_thrmisc_t; #else typedef prstatus_t elf_prstatus_t; typedef prpsinfo_t elf_prpsinfo_t; typedef prfpregset_t elf_prfpregset_t; typedef prfpregset_t elf_fpregset_t; typedef gregset_t elf_gregset_t; +typedef thrmisc_t elf_thrmisc_t; #endif static void @@ -1331,10 +1333,12 @@ __elfN(puthdr)(struct thread *td, void * elf_prstatus_t status; elf_prfpregset_t fpregset; elf_prpsinfo_t psinfo; + elf_thrmisc_t thrmisc; } *tempdata; elf_prstatus_t *status; elf_prfpregset_t *fpregset; elf_prpsinfo_t *psinfo; + elf_thrmisc_t *thrmisc; struct proc *p; struct thread *thr; size_t ehoff, noteoff, notesz, phoff; @@ -1357,11 +1361,13 @@ __elfN(puthdr)(struct thread *td, void * status = &tempdata->status; fpregset = &tempdata->fpregset; psinfo = &tempdata->psinfo; + thrmisc = &tempdata->thrmisc; } else { tempdata = NULL; status = NULL; fpregset = NULL; psinfo = NULL; + thrmisc = NULL; } if (dst != NULL) { @@ -1401,11 +1407,15 @@ __elfN(puthdr)(struct thread *td, void * fill_regs(thr, &status->pr_reg); fill_fpregs(thr, fpregset); #endif + memset(&thrmisc->_pad, 0, sizeof (thrmisc->_pad)); + strcpy(thrmisc->pr_tname, thr->td_name); } __elfN(putnote)(dst, off, "FreeBSD", NT_PRSTATUS, status, sizeof *status); __elfN(putnote)(dst, off, "FreeBSD", NT_FPREGSET, fpregset, sizeof *fpregset); + __elfN(putnote)(dst, off, "FreeBSD", NT_THRMISC, thrmisc, + sizeof *thrmisc); /* * Allow for MD specific notes, as well as any MD * specific preparations for writing MI notes. Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Nov 22 14:36:04 2010 (r215678) +++ head/sys/kern/sys_process.c Mon Nov 22 14:42:13 2010 (r215679) @@ -93,6 +93,7 @@ struct ptrace_lwpinfo32 { sigset_t pl_sigmask; /* LWP signal mask */ sigset_t pl_siglist; /* LWP pending signal */ struct siginfo32 pl_siginfo; /* siginfo for signal */ + char pl_tdname[MAXCOMLEN + 1]; /* LWP name. */ }; #endif @@ -520,6 +521,7 @@ ptrace_lwpinfo_to32(const struct ptrace_ pl32->pl_sigmask = pl->pl_sigmask; pl32->pl_siglist = pl->pl_siglist; siginfo_to_siginfo32(&pl->pl_siginfo, &pl32->pl_siginfo); + strcpy(pl32->pl_tdname, pl->pl_tdname); } #endif /* COMPAT_FREEBSD32 */ @@ -1164,6 +1166,7 @@ kern_ptrace(struct thread *td, int req, pl->pl_flags |= PL_FLAG_EXEC; pl->pl_sigmask = td2->td_sigmask; pl->pl_siglist = td2->td_siglist; + strcpy(pl->pl_tdname, td2->td_name); #ifdef COMPAT_FREEBSD32 if (wrap32) ptrace_lwpinfo_to32(pl, pl32); Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Mon Nov 22 14:36:04 2010 (r215678) +++ head/sys/sys/elf_common.h Mon Nov 22 14:42:13 2010 (r215679) @@ -479,6 +479,7 @@ typedef struct { #define NT_PRSTATUS 1 /* Process status. */ #define NT_FPREGSET 2 /* Floating point registers. */ #define NT_PRPSINFO 3 /* Process state info. */ +#define NT_THRMISC 7 /* Thread miscellaneous info. */ /* Symbol Binding - ELFNN_ST_BIND - st_info */ #define STB_LOCAL 0 /* Local symbol */ Modified: head/sys/sys/procfs.h ============================================================================== --- head/sys/sys/procfs.h Mon Nov 22 14:36:04 2010 (r215678) +++ head/sys/sys/procfs.h Mon Nov 22 14:42:13 2010 (r215679) @@ -80,6 +80,13 @@ typedef struct prpsinfo { char pr_psargs[PRARGSZ+1]; /* Arguments, null terminated (1) */ } prpsinfo_t; +#define THRMISC_VERSION 1 /* Current version of thrmisc_t */ + +typedef struct thrmisc { + char pr_tname[MAXCOMLEN+1]; /* Thread name, null terminated (1) */ + u_int _pad; /* Convenience pad, 0-filled (1) */ +} thrmisc_t; + typedef uint64_t psaddr_t; /* An address in the target process. */ #endif /* _SYS_PROCFS_H_ */ Modified: head/sys/sys/ptrace.h ============================================================================== --- head/sys/sys/ptrace.h Mon Nov 22 14:36:04 2010 (r215678) +++ head/sys/sys/ptrace.h Mon Nov 22 14:42:13 2010 (r215679) @@ -34,6 +34,7 @@ #define _SYS_PTRACE_H_ #include +#include #include #define PT_TRACE_ME 0 /* child declares it's being traced */ @@ -106,6 +107,7 @@ struct ptrace_lwpinfo { sigset_t pl_sigmask; /* LWP signal mask */ sigset_t pl_siglist; /* LWP pending signal */ struct __siginfo pl_siginfo; /* siginfo for signal */ + char pl_tdname[MAXCOMLEN + 1]; /* LWP name */ }; /* Argument structure for PT_VM_ENTRY. */ Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Mon Nov 22 14:36:04 2010 (r215678) +++ head/usr.bin/gcore/elfcore.c Mon Nov 22 14:42:13 2010 (r215679) @@ -284,10 +284,12 @@ elf_getstatus(pid_t pid, prpsinfo_t *psi static void elf_puthdr(pid_t pid, vm_map_entry_t map, void *dst, size_t *off, int numsegs) { + struct ptrace_lwpinfo lwpinfo; struct { prstatus_t status; prfpregset_t fpregset; prpsinfo_t psinfo; + thrmisc_t thrmisc; } *tempdata; size_t ehoff; size_t phoff; @@ -300,6 +302,7 @@ elf_puthdr(pid_t pid, vm_map_entry_t map prstatus_t *status; prfpregset_t *fpregset; prpsinfo_t *psinfo; + thrmisc_t *thrmisc; ehoff = *off; *off += sizeof(Elf_Ehdr); @@ -315,11 +318,13 @@ elf_puthdr(pid_t pid, vm_map_entry_t map status = &tempdata->status; fpregset = &tempdata->fpregset; psinfo = &tempdata->psinfo; + thrmisc = &tempdata->thrmisc; } else { tempdata = NULL; status = NULL; fpregset = NULL; psinfo = NULL; + thrmisc = NULL; } errno = 0; @@ -356,11 +361,17 @@ elf_puthdr(pid_t pid, vm_map_entry_t map ptrace(PT_GETREGS, tids[i], (void *)&status->pr_reg, 0); ptrace(PT_GETFPREGS, tids[i], (void *)fpregset, 0); + ptrace(PT_LWPINFO, tids[i], (void *)&lwpinfo, + sizeof(lwpinfo)); + memset(&thrmisc->_pad, 0, sizeof(thrmisc->_pad)); + strcpy(thrmisc->pr_tname, lwpinfo.pl_tdname); } elf_putnote(dst, off, "FreeBSD", NT_PRSTATUS, status, sizeof *status); elf_putnote(dst, off, "FreeBSD", NT_FPREGSET, fpregset, sizeof *fpregset); + elf_putnote(dst, off, "FreeBSD", NT_THRMISC, thrmisc, + sizeof *thrmisc); } notesz = *off - noteoff; From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 14:45:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45D46106566C; Mon, 22 Nov 2010 14:45:17 +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 347378FC08; Mon, 22 Nov 2010 14:45:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMEjHrc095025; Mon, 22 Nov 2010 14:45:17 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMEjHL4095023; Mon, 22 Nov 2010 14:45:17 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201011221445.oAMEjHL4095023@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 22 Nov 2010 14:45:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215680 - head/lib/libpam/modules/pam_unix X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 14:45:17 -0000 Author: des Date: Mon Nov 22 14:45:16 2010 New Revision: 215680 URL: http://svn.freebsd.org/changeset/base/215680 Log: Add for ctime(), which we accidentally picked up through . Submitted by: Garrett Cooper MFC after: 3 days Modified: head/lib/libpam/modules/pam_unix/pam_unix.c Modified: head/lib/libpam/modules/pam_unix/pam_unix.c ============================================================================== --- head/lib/libpam/modules/pam_unix/pam_unix.c Mon Nov 22 14:42:13 2010 (r215679) +++ head/lib/libpam/modules/pam_unix/pam_unix.c Mon Nov 22 14:45:16 2010 (r215680) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 14:53:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDA461065757; Mon, 22 Nov 2010 14:53:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8CF568FC13; Mon, 22 Nov 2010 14:53:41 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 40E2F46B09; Mon, 22 Nov 2010 09:53:41 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4806F8A027; Mon, 22 Nov 2010 09:53:40 -0500 (EST) From: John Baldwin To: Attilio Rao Date: Mon, 22 Nov 2010 09:31:00 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20101102; KDE/4.4.5; amd64; ; ) References: <201011191943.oAJJhv3i087205@svn.freebsd.org> <201011191642.00761.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201011220931.00320.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 22 Nov 2010 09:53:40 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215544 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 14:53:41 -0000 On Friday, November 19, 2010 5:32:00 pm Attilio Rao wrote: > 2010/11/19 John Baldwin : > > On Friday, November 19, 2010 4:27:27 pm Attilio Rao wrote: > >> 2010/11/19 John Baldwin : > >> > On Friday, November 19, 2010 2:43:57 pm Attilio Rao wrote: > >> >> Author: attilio > >> >> Date: Fri Nov 19 19:43:56 2010 > >> >> New Revision: 215544 > >> >> URL: http://svn.freebsd.org/changeset/base/215544 > >> >> > >> >> Log: > >> >> Scan the list in reverse order for the shutdown handlers of loaded modules. > >> >> This way, when there is a dependency between two modules, the handler of the > >> >> latter probed runs first. > >> >> > >> >> This is a similar approach as the modules are unloaded in the same > >> >> linkerfile. > >> >> > >> >> Sponsored by: Sandvine Incorporated > >> >> Submitted by: Nima Misaghian > >> >> MFC after: 1 week > >> >> > >> >> Modified: > >> >> head/sys/kern/kern_module.c > >> >> > >> >> Modified: head/sys/kern/kern_module.c > >> >> ============================================================================== > >> >> --- head/sys/kern/kern_module.c Fri Nov 19 18:59:35 2010 (r215543) > >> >> +++ head/sys/kern/kern_module.c Fri Nov 19 19:43:56 2010 (r215544) > >> >> @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); > >> >> > >> >> static MALLOC_DEFINE(M_MODULE, "module", "module data structures"); > >> >> > >> >> -typedef TAILQ_HEAD(, module) modulelist_t; > >> >> +typedef TAILQ_HEAD(modulelst, module) modulelist_t; > >> > > >> > Is modulelist already taken? If not, we should probably just retire > >> > 'modulelist_t' and replace it with 'struct modulelist'. > >> > >> Note that I used modulelst, not modulelist. > >> Probabilly, if you think the name may be still confusing, we can > >> pickup one another further. > > > > Yes, I'd much prefer 'modulelist' with the extra 'i' as it is more readable. > > If you go that route, I think you can drop modulelist_t since style(9) > > discourages foo_t types unless they are required by a standard. > > I think that this patch should make it? Works for me, thanks. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 14:53:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E53B410657FB; Mon, 22 Nov 2010 14:53:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 22CB88FC18; Mon, 22 Nov 2010 14:53:43 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 863A946B03; Mon, 22 Nov 2010 09:53:42 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4D4DD8A029; Mon, 22 Nov 2010 09:53:41 -0500 (EST) From: John Baldwin To: Attilio Rao Date: Mon, 22 Nov 2010 09:32:48 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20101102; KDE/4.4.5; amd64; ; ) References: <201011191943.oAJJhv3i087205@svn.freebsd.org> <201011191716.03279.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201011220932.48629.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 22 Nov 2010 09:53:41 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jung-uk Kim Subject: Re: svn commit: r215544 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 14:53:44 -0000 On Friday, November 19, 2010 5:41:00 pm Attilio Rao wrote: > 2010/11/19 John Baldwin : > > On Friday, November 19, 2010 5:03:25 pm Jung-uk Kim wrote: > >> On Friday 19 November 2010 04:46 pm, John Baldwin wrote: > >> > On Friday, November 19, 2010 4:31:44 pm Attilio Rao wrote: > >> > > 2010/11/19 John Baldwin : > >> > > > On Friday, November 19, 2010 4:09:28 pm Jung-uk Kim wrote: > >> > > >> On Friday 19 November 2010 02:43 pm, Attilio Rao wrote: > >> > > >> > Author: attilio > >> > > >> > Date: Fri Nov 19 19:43:56 2010 > >> > > >> > New Revision: 215544 > >> > > >> > URL: http://svn.freebsd.org/changeset/base/215544 > >> > > >> > > >> > > >> > Log: > >> > > >> > Scan the list in reverse order for the shutdown handlers > >> > > >> > of loaded modules. This way, when there is a dependency > >> > > >> > between two modules, the handler of the latter probed runs > >> > > >> > first. > >> > > >> > > >> > > >> > This is a similar approach as the modules are unloaded in > >> > > >> > the same linkerfile. > >> > > >> > > >> > > >> > Sponsored by: Sandvine Incorporated > >> > > >> > Submitted by: Nima Misaghian >> > > >> > dot com> MFC after: 1 week > >> > > >> > >> > > >> Hmm... It is not directly related but I was thinking about > >> > > >> doing similar things for sys/kern/subr_bus.c. What do you > >> > > >> think about the attached patch? > >> > > > > >> > > > Hmm, the patches for suspend and resume that I had for this > >> > > > took the opposite order, they did suspend in forward order, but > >> > > > resume in backwards order. Like so: > >> > > > > >> > > > --- //depot/vendor/freebsd/src/sys/kern/subr_bus.c > >> > > > 2010-11-17 22:30:24.000000000 0000 +++ > >> > > > //depot/user/jhb/acpipci/kern/subr_bus.c 2010-11-19 > >> > > > 17:19:02.000000000 00 @@ -3426,9 +3429,9 @@ > >> > > > TAILQ_FOREACH(child, &dev->children, link) { > >> > > > error = DEVICE_SUSPEND(child); > >> > > > if (error) { > >> > > > - for (child2 = > >> > > > TAILQ_FIRST(&dev->children); - > >> > > > child2 && child2 != child; - child2 > >> > > > = TAILQ_NEXT(child2, link)) + for (child2 > >> > > > = TAILQ_PREV(child, device_list, link); + > >> > > > child2 != NULL; > >> > > > + child2 = TAILQ_PREV(child2, > >> > > > device_list, link)) DEVICE_RESUME(child2); > >> > > > return (error); > >> > > > } > >> > > > @@ -3447,7 +3450,7 @@ > >> > > > { > >> > > > device_t child; > >> > > > > >> > > > - TAILQ_FOREACH(child, &dev->children, link) { > >> > > > + TAILQ_FOREACH_REVERSE(child, &dev->children, > >> > > > device_list, link) { DEVICE_RESUME(child); > >> > > > /* if resume fails, there's nothing we can > >> > > > usefully do... */ } > >> > > > > >> > > > (Likely mangled whitespace.) > >> > > > > >> > > > I couldn't convince myself which order was "more" correct for > >> > > > suspend and resume. > >> > > > >> > > Considering loading in starting point, I think suspend should go > >> > > in reverse logic and resume in the same module load logic. > >> > > So that dependent modules are suspended first and resumed after. > >> > > Don't you agree? > >> > > >> > These are devices, and the ordering here is the order of sibling > >> > devices on a given bus. That is, if you have a PCI bus with two em > >> > interfaces, does it really matter if em0 suspends before em1 vs > >> > after em1? I think it actually doesn't matter. The passes from > >> > the multipass boot probe might make some sense to order on. > >> > However, I don't think the order of siblings on a bus is meaningful > >> > for suspend and resume (which is why I've never committed the above > >> > patches). > >> > > >> > Specifically, there is no dependency relationship between siblings > >> > on a bus. Certain buses may in fact have a dependency order of > >> > sorts (vgapci0 comes to mind), but those buses should manage that. > >> > There is no generic dependency between siblings that should be > >> > encoded into subr_bus.c > >> > >> Generally siblings don't interact with each other directly, no. > >> However, some modern chipsets *do* have strong relationship. For > >> example, some chipsets reference SMB controller to get current > >> configuration, e.g., function A depends on function B on the same > >> chip. > > > > That may be true, but that is not generic to all buses and devices. > > That isn't even really generic to PCI. If there are specific instances > > where there are dependencies, the drivers for that hardware should > > manage that. If specific buses have specific orders, then they can > > manage that order explicitly in their own suspend and resume routines. > > However, I don't see a valid reason for enforcing a particular order > > among siblings for all devices. We certainly do enforce some orders > > with respect to children and parents (parents attach first and resume > > first, children detach first and suspend first, PCI even mandates this > > for powering down a bus), but the same is not true for siblings. > > However, it would be good if any ordering is maintained between > devices linked via MODDEPEND stuff. > It happens they may also be sibillings, and not havign parent-child > relationship in some cases, but I'm also wondering if maybe they > should ensure consistency in their code itself rather than relying > strongly on ordering by the PCi/whatever subsystem? Almost all of those devices have parent -> child relationships, not sibling relationships (e.g. NIC drivers that depend on certain phy drivers). Do you have a specific example of drivers that have dependencies where the current order is not correct? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 15:15:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08179106566B; Mon, 22 Nov 2010 15:15:12 +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 CFCC28FC0A; Mon, 22 Nov 2010 15:15:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMFFBVl095830; Mon, 22 Nov 2010 15:15:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMFFBPJ095829; Mon, 22 Nov 2010 15:15:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011221515.oAMFFBPJ095829@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Nov 2010 15:15:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215681 - in head/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/x86emu dev/xen/xenpci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 15:15:12 -0000 Author: jhb Date: Mon Nov 22 15:15:11 2010 New Revision: 215681 URL: http://svn.freebsd.org/changeset/base/215681 Log: Remove some bogus, self-referential mergeinfo. Modified: Directory Properties: head/sys/ (props changed) head/sys/amd64/include/xen/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) head/sys/contrib/x86emu/ (props changed) head/sys/dev/xen/xenpci/ (props changed) From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 15:26:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DB7F106564A; Mon, 22 Nov 2010 15:26:47 +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 729778FC14; Mon, 22 Nov 2010 15:26:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMFQlH7096121; Mon, 22 Nov 2010 15:26:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMFQlkj096120; Mon, 22 Nov 2010 15:26:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011221526.oAMFQlkj096120@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Nov 2010 15:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215682 - head/sys/dev/xen/xenpci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 15:26:47 -0000 Author: jhb Date: Mon Nov 22 15:26:47 2010 New Revision: 215682 URL: http://svn.freebsd.org/changeset/base/215682 Log: Purge mergeinfo on sys/dev/xen/xenpci. The only unique mergeinfo compared to head was not useful (it came in with the merge from /user/dfr/xenhvm/7 and that mergeinfo is still present at sys/) and not worth keeping an extra set of mergeinfo around in the kernel. Modified: Directory Properties: head/sys/dev/xen/xenpci/ (props changed) From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 15:28:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67FC1106566C; Mon, 22 Nov 2010 15:28:54 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56EE98FC13; Mon, 22 Nov 2010 15:28:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMFSsEQ096196; Mon, 22 Nov 2010 15:28:54 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMFSsuM096194; Mon, 22 Nov 2010 15:28:54 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201011221528.oAMFSsuM096194@svn.freebsd.org> From: Attilio Rao Date: Mon, 22 Nov 2010 15:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215683 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 15:28:54 -0000 Author: attilio Date: Mon Nov 22 15:28:54 2010 New Revision: 215683 URL: http://svn.freebsd.org/changeset/base/215683 Log: Style fix. Sponsored by: Sandvine Incorporated Requested by: jhb Reviewed by: jhb MFC after: 1 week X-MFC: 215544 Modified: head/sys/kern/kern_module.c Modified: head/sys/kern/kern_module.c ============================================================================== --- head/sys/kern/kern_module.c Mon Nov 22 15:26:47 2010 (r215682) +++ head/sys/kern/kern_module.c Mon Nov 22 15:28:54 2010 (r215683) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_MODULE, "module", "module data structures"); -typedef TAILQ_HEAD(modulelst, module) modulelist_t; struct module { TAILQ_ENTRY(module) link; /* chain together all modules */ TAILQ_ENTRY(module) flink; /* all modules in a file */ @@ -61,7 +60,7 @@ struct module { #define MOD_EVENT(mod, type) (mod)->handler((mod), (type), (mod)->arg) -static modulelist_t modules; +static TAILQ_HEAD(modulelist, module) modules; struct sx modules_sx; static int nextid = 1; static void module_shutdown(void *, int); @@ -101,7 +100,7 @@ module_shutdown(void *arg1, int arg2) return; mtx_lock(&Giant); MOD_SLOCK; - TAILQ_FOREACH_REVERSE(mod, &modules, modulelst, link) + TAILQ_FOREACH_REVERSE(mod, &modules, modulelist, link) MOD_EVENT(mod, MOD_SHUTDOWN); MOD_SUNLOCK; mtx_unlock(&Giant); From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 15:30:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C614106564A; Mon, 22 Nov 2010 15:30:00 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id EF52F8FC08; Mon, 22 Nov 2010 15:29:59 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 9C67846B03; Mon, 22 Nov 2010 10:29:59 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B34428A009; Mon, 22 Nov 2010 10:29:47 -0500 (EST) From: John Baldwin To: Kostik Belousov Date: Mon, 22 Nov 2010 10:29:28 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20101102; KDE/4.4.5; amd64; ; ) References: <201011221242.oAMCgW9O092144@svn.freebsd.org> <20101122125106.GZ2392@deviant.kiev.zoral.com.ua> In-Reply-To: <20101122125106.GZ2392@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201011221029.29119.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 22 Nov 2010 10:29:47 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Alexander Leidinger Subject: Re: svn commit: r215675 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 15:30:00 -0000 On Monday, November 22, 2010 7:51:06 am Kostik Belousov wrote: > On Mon, Nov 22, 2010 at 12:42:32PM +0000, Alexander Leidinger wrote: > > Author: netchild > > Date: Mon Nov 22 12:42:32 2010 > > New Revision: 215675 > > URL: http://svn.freebsd.org/changeset/base/215675 > > > > Log: > > Do not take the process lock. The assignment to u_short inside the > > properly aligned structure is atomic on all supported architectures, and > > the thread that should see side-effect of assignment is the same thread > > that does assignment. > > > > Use a more appropriate conditional to detect the linux ABI. > > > > Suggested by: kib > > X-MFC: together with r215664 > > > > Modified: > > head/sys/compat/linux/linux_emul.c > > > > Modified: head/sys/compat/linux/linux_emul.c > > ============================================================================== > > --- head/sys/compat/linux/linux_emul.c Mon Nov 22 12:33:48 2010 (r215674) > > +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 12:42:32 2010 (r215675) > > @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru > > if (__predict_false(imgp->sysent == &elf_linux_sysvec > > && p->p_sysent != &elf_linux_sysvec)) > > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > > - if (__predict_false(p->p_sysent == &elf_linux_sysvec)) > > + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == > > + SV_ABI_LINUX)) > > /* Kill threads regardless of imgp->sysent value */ > > linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > > if (__predict_false(imgp->sysent != &elf_linux_sysvec > There are several similar comparisons around the patched one. > > I am still quite curious for the reason of all __predict() obfuscations > that are countless in the linuxolator. We are not oblidged to emulate > this aspect of Linux. I think we should only have __predict() obfuscation if there is a benchmark showing an indisputable performance gain. Otherwise it is just cruft making the code hard to read. I suspect that a Linux app calling execve() is not a sufficient critical path to warrant any of these. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 16:43:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51EA3106566B; Mon, 22 Nov 2010 16:43:06 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40B918FC12; Mon, 22 Nov 2010 16:43:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMGh6px098025; Mon, 22 Nov 2010 16:43:06 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMGh691098023; Mon, 22 Nov 2010 16:43:06 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <201011221643.oAMGh691098023@svn.freebsd.org> From: Andrew Gallatin Date: Mon, 22 Nov 2010 16:43:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215686 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 16:43:06 -0000 Author: gallatin Date: Mon Nov 22 16:43:05 2010 New Revision: 215686 URL: http://svn.freebsd.org/changeset/base/215686 Log: Fix a TSO checksum bug on mxge(4): The Myri10GE NIC will assume all TSO frames contain partial checksum, and will emit TSO segments with bad TCP checksums if a TSO frame contains a full checksum. The mxge driver takes care to make sure that TSO is disabled when checksum offload is disabled for this reason. However, modules that modify packet contents (like pf) may end up completing a checksum on a TSO frame, leading to the NIC emitting TSO segments with bad checksums. To workaround this, restore the partial checksum in the mxge driver when we're fed a TSO frame with a full checksum. Reported by: Bob Healey MFC after: 3 days Modified: head/sys/dev/mxge/if_mxge.c Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Mon Nov 22 16:10:54 2010 (r215685) +++ head/sys/dev/mxge/if_mxge.c Mon Nov 22 16:43:05 2010 (r215686) @@ -1855,9 +1855,20 @@ mxge_encap_tso(struct mxge_slice_state * tcp = (struct tcphdr *)((char *)ip + (ip->ip_hl << 2)); cum_len = -(ip_off + ((ip->ip_hl + tcp->th_off) << 2)); + cksum_offset = ip_off + (ip->ip_hl << 2); /* TSO implies checksum offload on this hardware */ - cksum_offset = ip_off + (ip->ip_hl << 2); + if (__predict_false((m->m_pkthdr.csum_flags & (CSUM_TCP)) == 0)) { + /* + * If packet has full TCP csum, replace it with pseudo hdr + * sum that the NIC expects, otherwise the NIC will emit + * packets with bad TCP checksums. + */ + m->m_pkthdr.csum_flags = CSUM_TCP; + m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); + tcp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, + htons(IPPROTO_TCP + (m->m_pkthdr.len - cksum_offset))); + } flags = MXGEFW_FLAGS_TSO_HDR | MXGEFW_FLAGS_FIRST; From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 16:47:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECAE01065672; Mon, 22 Nov 2010 16:47:53 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBC9C8FC0C; Mon, 22 Nov 2010 16:47:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMGlrYf098188; Mon, 22 Nov 2010 16:47:53 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMGlrEB098185; Mon, 22 Nov 2010 16:47:53 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201011221647.oAMGlrEB098185@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 22 Nov 2010 16:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215687 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 16:47:54 -0000 Author: jh Date: Mon Nov 22 16:47:53 2010 New Revision: 215687 URL: http://svn.freebsd.org/changeset/base/215687 Log: Use g_eventlock to protect against losing wakeups in the g_event process and replace tsleep(9) with msleep(9) which doesn't use a timeout. The previously used timeout caused the event process to wake up ten times per second on an idle system. one_event() is now called with the topology lock held and it returns with both the topology and event locks held when there are no more events in the queue. Reported by: mav, Marius Nünnerich Reviewed by: freebsd-geom Modified: head/sys/geom/geom_event.c head/sys/geom/geom_kern.c Modified: head/sys/geom/geom_event.c ============================================================================== --- head/sys/geom/geom_event.c Mon Nov 22 16:43:05 2010 (r215686) +++ head/sys/geom/geom_event.c Mon Nov 22 16:47:53 2010 (r215687) @@ -183,33 +183,27 @@ one_event(void) struct g_event *ep; struct g_provider *pp; - g_topology_lock(); - for (;;) { - mtx_lock(&g_eventlock); - TAILQ_FOREACH(pp, &g_doorstep, orphan) { - if (pp->nstart == pp->nend) - break; - } - if (pp != NULL) { - G_VALID_PROVIDER(pp); - TAILQ_REMOVE(&g_doorstep, pp, orphan); - } - mtx_unlock(&g_eventlock); - if (pp == NULL) + g_topology_assert(); + mtx_lock(&g_eventlock); + TAILQ_FOREACH(pp, &g_doorstep, orphan) { + if (pp->nstart == pp->nend) break; + } + if (pp != NULL) { + G_VALID_PROVIDER(pp); + TAILQ_REMOVE(&g_doorstep, pp, orphan); + mtx_unlock(&g_eventlock); g_orphan_register(pp); + return (1); } - mtx_lock(&g_eventlock); + ep = TAILQ_FIRST(&g_events); if (ep == NULL) { wakeup(&g_pending_events); - mtx_unlock(&g_eventlock); - g_topology_unlock(); return (0); } if (ep->flag & EV_INPROGRESS) { mtx_unlock(&g_eventlock); - g_topology_unlock(); return (1); } ep->flag |= EV_INPROGRESS; @@ -228,7 +222,6 @@ one_event(void) mtx_unlock(&g_eventlock); g_free(ep); } - g_topology_unlock(); return (1); } @@ -237,16 +230,27 @@ g_run_events() { int i; - while (one_event()) - ; - g_topology_lock(); - i = g_wither_work; - while (i) { - i = g_wither_washer(); - g_wither_work = i & 1; - i &= 2; + for (;;) { + g_topology_lock(); + while (one_event()) + ; + mtx_assert(&g_eventlock, MA_OWNED); + i = g_wither_work; + if (i) { + mtx_unlock(&g_eventlock); + while (i) { + i = g_wither_washer(); + g_wither_work = i & 1; + i &= 2; + } + g_topology_unlock(); + } else { + g_topology_unlock(); + msleep(&g_wait_event, &g_eventlock, PRIBIO | PDROP, + "-", 0); + } } - g_topology_unlock(); + /* NOTREACHED */ } void @@ -338,9 +342,12 @@ g_post_event(g_event_t *func, void *arg, } void -g_do_wither() { +g_do_wither() +{ + mtx_lock(&g_eventlock); g_wither_work = 1; + mtx_unlock(&g_eventlock); wakeup(&g_wait_event); } Modified: head/sys/geom/geom_kern.c ============================================================================== --- head/sys/geom/geom_kern.c Mon Nov 22 16:43:05 2010 (r215686) +++ head/sys/geom/geom_kern.c Mon Nov 22 16:47:53 2010 (r215687) @@ -137,10 +137,8 @@ g_event_procbody(void) thread_lock(tp); sched_prio(tp, PRIBIO); thread_unlock(tp); - for(;;) { - g_run_events(); - tsleep(&g_wait_event, PRIBIO, "-", hz/10); - } + g_run_events(); + /* NOTREACHED */ } static struct kproc_desc g_event_kp = { From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 17:46:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7922106566C; Mon, 22 Nov 2010 17:46:24 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from mail1.sandvine.com (Mail1.sandvine.com [64.7.137.134]) by mx1.freebsd.org (Postfix) with ESMTP id 819648FC12; Mon, 22 Nov 2010 17:46:24 +0000 (UTC) Received: from labgw2.phaedrus.sandvine.com (192.168.222.22) by WTL-EXCH-1.sandvine.com (192.168.196.31) with Microsoft SMTP Server id 14.0.694.0; Mon, 22 Nov 2010 12:46:23 -0500 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 10332) id 8837833C00; Mon, 22 Nov 2010 12:46:23 -0500 (EST) Date: Mon, 22 Nov 2010 12:46:23 -0500 From: Ed Maste To: Attilio Rao Message-ID: <20101122174623.GA93150@sandvine.com> References: <201011221442.oAMEgD9j094882@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <201011221442.oAMEgD9j094882@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215679 - in head: contrib/binutils/bfd contrib/binutils/binutils contrib/binutils/include/elf contrib/file contrib/gdb/gdb gnu/usr.bin/gdb/libgdb sys/compat/freebsd32 sys/kern sys/sys ... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 17:46:24 -0000 On Mon, Nov 22, 2010 at 02:42:13PM +0000, Attilio Rao wrote: > Author: attilio > Date: Mon Nov 22 14:42:13 2010 > New Revision: 215679 > URL: http://svn.freebsd.org/changeset/base/215679 > > Log: > Add the ability for GDB to printout the thread name along with other > thread specific informations. This change is particularly useful if one has a heavily threaded app that uses pthread_set_name_np() to set its thread names. This is an example of the output you get with stock GDB: (gdb) info threads 12 Thread 2a4041c0 (LWP 100184) 0x29e91fe3 in memset () 11 Thread 2a404700 (LWP 100190) 0x29e2be33 in poll () 10 Thread 2a404c40 (LWP 100191) 0x29ed85e7 in _umtx_op_err () And with this change: (gdb) info threads 41 Thread 0x9d80000 (LWP 100259/initial thread) 0x6a3f23ff in nanosleep () 40 Thread 0x9f48600 (LWP 100315/EventLoop) 0x6a38e427 in _umtx_op () 39 Thread 0x9f48800 (LWP 100321/ntfy) 0x6a38e427 in _umtx_op () -Ed From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 18:23:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60F80106564A; Mon, 22 Nov 2010 18:23:45 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B6368FC0C; Mon, 22 Nov 2010 18:23:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMINjGm001074; Mon, 22 Nov 2010 18:23:45 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMINilN001035; Mon, 22 Nov 2010 18:23:44 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <201011221823.oAMINilN001035@svn.freebsd.org> From: "Simon L. Nielsen" Date: Mon, 22 Nov 2010 18:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215697 - in head/crypto/openssl: . apps crypto crypto/aes crypto/aes/asm crypto/asn1 crypto/bio crypto/bn crypto/cms crypto/conf crypto/des crypto/dsa crypto/ec crypto/ecdh crypto/ecds... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 18:23:45 -0000 Author: simon Date: Mon Nov 22 18:23:44 2010 New Revision: 215697 URL: http://svn.freebsd.org/changeset/base/215697 Log: Merge OpenSSL 0.9.8p into head. Security: CVE-2010-3864 Security: http://www.openssl.org/news/secadv_20101116.txt Modified: head/crypto/openssl/CHANGES head/crypto/openssl/Configure head/crypto/openssl/FAQ head/crypto/openssl/Makefile head/crypto/openssl/NEWS head/crypto/openssl/PROBLEMS head/crypto/openssl/README head/crypto/openssl/apps/apps.c head/crypto/openssl/apps/dh.c head/crypto/openssl/apps/dhparam.c head/crypto/openssl/apps/dsaparam.c head/crypto/openssl/apps/ec.c head/crypto/openssl/apps/ecparam.c head/crypto/openssl/apps/enc.c head/crypto/openssl/apps/gendh.c head/crypto/openssl/apps/gendsa.c head/crypto/openssl/apps/genrsa.c head/crypto/openssl/apps/pkcs7.c head/crypto/openssl/apps/rand.c head/crypto/openssl/apps/s_server.c head/crypto/openssl/apps/s_socket.c head/crypto/openssl/apps/speed.c head/crypto/openssl/apps/x509.c head/crypto/openssl/crypto/aes/aes_wrap.c head/crypto/openssl/crypto/aes/asm/aes-x86_64.pl head/crypto/openssl/crypto/asn1/a_int.c head/crypto/openssl/crypto/asn1/n_pkey.c head/crypto/openssl/crypto/asn1/t_crl.c head/crypto/openssl/crypto/asn1/tasn_dec.c head/crypto/openssl/crypto/asn1/x_x509.c head/crypto/openssl/crypto/bio/b_sock.c head/crypto/openssl/crypto/bio/bf_nbio.c head/crypto/openssl/crypto/bio/bio_lib.c head/crypto/openssl/crypto/bio/bss_acpt.c head/crypto/openssl/crypto/bio/bss_sock.c head/crypto/openssl/crypto/bn/bn_exp2.c head/crypto/openssl/crypto/bn/bn_mul.c head/crypto/openssl/crypto/cms/cms_asn1.c head/crypto/openssl/crypto/conf/conf_def.c head/crypto/openssl/crypto/des/rpc_des.h head/crypto/openssl/crypto/dsa/dsa_gen.c head/crypto/openssl/crypto/dsa/dsa_ossl.c head/crypto/openssl/crypto/ec/ec2_mult.c head/crypto/openssl/crypto/ec/ec_mult.c head/crypto/openssl/crypto/ecdh/ech_lib.c head/crypto/openssl/crypto/ecdsa/ecs_lib.c head/crypto/openssl/crypto/engine/eng_list.c head/crypto/openssl/crypto/err/err_prn.c head/crypto/openssl/crypto/evp/bio_b64.c head/crypto/openssl/crypto/evp/enc_min.c head/crypto/openssl/crypto/evp/encode.c head/crypto/openssl/crypto/evp/evp_pbe.c head/crypto/openssl/crypto/hmac/hmac.c head/crypto/openssl/crypto/md32_common.h head/crypto/openssl/crypto/o_init.c head/crypto/openssl/crypto/ocsp/ocsp_ht.c head/crypto/openssl/crypto/ocsp/ocsp_prn.c head/crypto/openssl/crypto/opensslv.h head/crypto/openssl/crypto/pem/pem_lib.c head/crypto/openssl/crypto/pkcs12/p12_key.c head/crypto/openssl/crypto/pkcs12/p12_npas.c head/crypto/openssl/crypto/pkcs7/pk7_doit.c head/crypto/openssl/crypto/pkcs7/pk7_lib.c head/crypto/openssl/crypto/pkcs7/pk7_mime.c head/crypto/openssl/crypto/pqueue/pqueue.c head/crypto/openssl/crypto/rand/rand_nw.c head/crypto/openssl/crypto/rand/randfile.c head/crypto/openssl/crypto/rsa/rsa_eay.c head/crypto/openssl/crypto/x509/x509.h head/crypto/openssl/crypto/x509/x509_vfy.c head/crypto/openssl/crypto/x509/x_all.c head/crypto/openssl/crypto/x509v3/v3_ncons.c head/crypto/openssl/crypto/x509v3/v3_pci.c head/crypto/openssl/doc/apps/smime.pod head/crypto/openssl/doc/crypto/ASN1_OBJECT_new.pod head/crypto/openssl/doc/crypto/ASN1_STRING_length.pod head/crypto/openssl/doc/crypto/ASN1_STRING_new.pod head/crypto/openssl/doc/crypto/ASN1_generate_nconf.pod head/crypto/openssl/doc/crypto/BIO_f_buffer.pod head/crypto/openssl/doc/crypto/BIO_should_retry.pod head/crypto/openssl/doc/crypto/CRYPTO_set_ex_data.pod head/crypto/openssl/doc/crypto/OBJ_nid2obj.pod head/crypto/openssl/doc/crypto/PKCS7_decrypt.pod head/crypto/openssl/doc/crypto/PKCS7_encrypt.pod head/crypto/openssl/doc/crypto/PKCS7_sign.pod head/crypto/openssl/doc/crypto/PKCS7_verify.pod head/crypto/openssl/doc/crypto/SMIME_read_PKCS7.pod head/crypto/openssl/doc/crypto/SMIME_write_PKCS7.pod head/crypto/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod head/crypto/openssl/doc/crypto/X509_NAME_add_entry_by_txt.pod head/crypto/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod head/crypto/openssl/doc/crypto/X509_new.pod head/crypto/openssl/doc/crypto/bn_internal.pod head/crypto/openssl/doc/crypto/ui_compat.pod head/crypto/openssl/doc/ssl/SSL_library_init.pod head/crypto/openssl/e_os.h head/crypto/openssl/engines/e_chil.c head/crypto/openssl/engines/e_cswift.c head/crypto/openssl/engines/e_ubsec.c head/crypto/openssl/fips/mkfipsscr.pl head/crypto/openssl/openssl.spec head/crypto/openssl/ssl/d1_both.c head/crypto/openssl/ssl/d1_clnt.c head/crypto/openssl/ssl/d1_enc.c head/crypto/openssl/ssl/d1_lib.c head/crypto/openssl/ssl/d1_pkt.c head/crypto/openssl/ssl/dtls1.h head/crypto/openssl/ssl/s23_clnt.c head/crypto/openssl/ssl/s23_lib.c head/crypto/openssl/ssl/s2_srvr.c head/crypto/openssl/ssl/s3_both.c head/crypto/openssl/ssl/s3_clnt.c head/crypto/openssl/ssl/s3_enc.c head/crypto/openssl/ssl/ssl_algs.c head/crypto/openssl/ssl/ssl_asn1.c head/crypto/openssl/ssl/ssl_cert.c head/crypto/openssl/ssl/ssl_ciph.c head/crypto/openssl/ssl/ssl_lib.c head/crypto/openssl/ssl/ssltest.c head/crypto/openssl/ssl/t1_enc.c head/crypto/openssl/ssl/t1_lib.c head/crypto/openssl/test/cms-test.pl head/crypto/openssl/tools/c_rehash head/crypto/openssl/tools/c_rehash.in head/crypto/openssl/util/libeay.num head/crypto/openssl/util/mkdef.pl head/crypto/openssl/util/pl/VC-32.pl Directory Properties: head/crypto/openssl/ (props changed) Modified: head/crypto/openssl/CHANGES ============================================================================== --- head/crypto/openssl/CHANGES Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/CHANGES Mon Nov 22 18:23:44 2010 (r215697) @@ -2,6 +2,51 @@ OpenSSL CHANGES _______________ + Changes between 0.9.8o and 0.9.8p [16 Nov 2010] + + *) Fix extension code to avoid race conditions which can result in a buffer + overrun vulnerability: resumed sessions must not be modified as they can + be shared by multiple threads. CVE-2010-3864 + [Steve Henson] + + *) Fix for double free bug in ssl/s3_clnt.c CVE-2010-2939 + [Steve Henson] + + *) Don't reencode certificate when calculating signature: cache and use + the original encoding instead. This makes signature verification of + some broken encodings work correctly. + [Steve Henson] + + *) ec2_GF2m_simple_mul bugfix: compute correct result if the output EC_POINT + is also one of the inputs. + [Emilia Käsper (Google)] + + *) Don't repeatedly append PBE algorithms to table if they already exist. + Sort table on each new add. This effectively makes the table read only + after all algorithms are added and subsequent calls to PKCS12_pbe_add + etc are non-op. + [Steve Henson] + + Changes between 0.9.8n and 0.9.8o [01 Jun 2010] + + [NB: OpenSSL 0.9.8o and later 0.9.8 patch levels were released after + OpenSSL 1.0.0.] + + *) Correct a typo in the CMS ASN1 module which can result in invalid memory + access or freeing data twice (CVE-2010-0742) + [Steve Henson, Ronald Moesbergen ] + + *) Add SHA2 algorithms to SSL_library_init(). SHA2 is becoming far more + common in certificates and some applications which only call + SSL_library_init and not OpenSSL_add_all_algorithms() will fail. + [Steve Henson] + + *) VMS fixes: + Reduce copying into .apps and .test in makevms.com + Don't try to use blank CA certificate in CA.com + Allow use of C files from original directories in maketests.com + [Steven M. Schweda" ] + Changes between 0.9.8m and 0.9.8n [24 Mar 2010] *) When rejecting SSL/TLS records due to an incorrect version number, never Modified: head/crypto/openssl/Configure ============================================================================== --- head/crypto/openssl/Configure Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/Configure Mon Nov 22 18:23:44 2010 (r215697) @@ -1812,11 +1812,11 @@ EOF (system $make_command.$make_targets) == 0 or exit $? if $make_targets ne ""; if ( $perl =~ m@^/@) { - &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";'); + &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";'); &dofile("apps/CA.pl",$perl,'^#!/', '#!%s'); } else { # No path for Perl known ... - &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";'); + &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";'); &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s'); } if ($depflags ne $default_depflags && !$make_depend) { Modified: head/crypto/openssl/FAQ ============================================================================== --- head/crypto/openssl/FAQ Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/FAQ Mon Nov 22 18:23:44 2010 (r215697) @@ -70,6 +70,7 @@ OpenSSL - Frequently Asked Questions * I think I've detected a memory leak, is this a bug? * Why does Valgrind complain about the use of uninitialized data? * Why doesn't a memory BIO work when a file does? +* Where are the declarations and implementations of d2i_X509() etc? =============================================================================== @@ -78,7 +79,7 @@ OpenSSL - Frequently Asked Questions * Which is the current version of OpenSSL? The current version is available from . -OpenSSL 0.9.8n was released on Mar 24th, 2010. +OpenSSL 1.0.0b was released on Nov 16th, 2010. In addition to the current stable release, you can also access daily snapshots of the OpenSSL development version at . +. Note that the online documents refer +to the very latest development versions of OpenSSL and may include features +not present in released versions. If in doubt refer to the documentation +that came with the version of OpenSSL you are using. For information on parts of libcrypto that are not yet documented, you might want to read Ariel Glenn's documentation on SSLeay 0.9, OpenSSL's @@ -717,8 +721,10 @@ file. Multi-threaded applications must provide two callback functions to OpenSSL by calling CRYPTO_set_locking_callback() and -CRYPTO_set_id_callback(). This is described in the threads(3) -manpage. +CRYPTO_set_id_callback(), for all versions of OpenSSL up to and +including 0.9.8[abc...]. As of version 1.0.0, CRYPTO_set_id_callback() +and associated APIs are deprecated by CRYPTO_THREADID_set_callback() +and friends. This is described in the threads(3) manpage. * I've compiled a program under Windows and it crashes: why? @@ -962,4 +968,15 @@ is needed. This must be done by calling: See the manual pages for more details. +* Where are the declarations and implementations of d2i_X509() etc? + +These are defined and implemented by macros of the form: + + + DECLARE_ASN1_FUNCTIONS(X509) and IMPLEMENT_ASN1_FUNCTIONS(X509) + +The implementation passes an ASN1 "template" defining the structure into an +ASN1 interpreter using generalised functions such as ASN1_item_d2i(). + + =============================================================================== Modified: head/crypto/openssl/Makefile ============================================================================== --- head/crypto/openssl/Makefile Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/Makefile Mon Nov 22 18:23:44 2010 (r215697) @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=0.9.8n +VERSION=0.9.8p MAJOR=0 MINOR=9.8 SHLIB_VERSION_NUMBER=0.9.8 Modified: head/crypto/openssl/NEWS ============================================================================== --- head/crypto/openssl/NEWS Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/NEWS Mon Nov 22 18:23:44 2010 (r215697) @@ -5,6 +5,18 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p: + + o Fix for security issue CVE-2010-3864. + + Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o: + + o Fix for security issue CVE-2010-0742. + o Various DTLS fixes. + o Recognise SHA2 certificates if only SSL algorithms added. + o Fix for no-rc4 compilation. + o Chil ENGINE unload workaround. + Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n: o CFB cipher definition fixes. Modified: head/crypto/openssl/PROBLEMS ============================================================================== --- head/crypto/openssl/PROBLEMS Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/PROBLEMS Mon Nov 22 18:23:44 2010 (r215697) @@ -36,7 +36,9 @@ may differ on your machine. As long as Apple doesn't fix the problem with ld, this problem building -OpenSSL will remain as is. +OpenSSL will remain as is. Well, the problem was addressed in 0.9.8f by +passing -Wl,-search_paths_first, but it's unknown if the flag was +supported from the initial MacOS X release. * Parallell make leads to errors Modified: head/crypto/openssl/README ============================================================================== --- head/crypto/openssl/README Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/README Mon Nov 22 18:23:44 2010 (r215697) @@ -1,5 +1,5 @@ - OpenSSL 0.9.8n + OpenSSL 0.9.8p 16 Nov 2010 Copyright (c) 1998-2009 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson Modified: head/crypto/openssl/apps/apps.c ============================================================================== --- head/crypto/openssl/apps/apps.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/apps.c Mon Nov 22 18:23:44 2010 (r215697) @@ -351,13 +351,12 @@ void program_name(char *in, char *out, i int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) { - int num,len,i; + int num,i; char *p; *argc=0; *argv=NULL; - len=strlen(buf); i=0; if (arg->count == 0) { @@ -866,10 +865,17 @@ EVP_PKEY *load_key(BIO *err, const char if (format == FORMAT_ENGINE) { if (!e) - BIO_printf(bio_err,"no engine specified\n"); + BIO_printf(err,"no engine specified\n"); else + { pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + if (!pkey) + { + BIO_printf(err,"cannot load %s from engine\n",key_descrip); + ERR_print_errors(err); + } + } goto end; } #endif @@ -919,8 +925,11 @@ EVP_PKEY *load_key(BIO *err, const char } end: if (key != NULL) BIO_free(key); - if (pkey == NULL) + if (pkey == NULL) + { BIO_printf(err,"unable to load %s\n", key_descrip); + ERR_print_errors(err); + } return(pkey); } Modified: head/crypto/openssl/apps/dh.c ============================================================================== --- head/crypto/openssl/apps/dh.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/dh.c Mon Nov 22 18:23:44 2010 (r215697) @@ -88,9 +88,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif DH *dh=NULL; int i,badops=0,text=0; BIO *in=NULL,*out=NULL; @@ -189,7 +186,7 @@ bad: ERR_load_crypto_strings(); #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif in=BIO_new(BIO_s_file()); Modified: head/crypto/openssl/apps/dhparam.c ============================================================================== --- head/crypto/openssl/apps/dhparam.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/dhparam.c Mon Nov 22 18:23:44 2010 (r215697) @@ -149,9 +149,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif DH *dh=NULL; int i,badops=0,text=0; #ifndef OPENSSL_NO_DSA @@ -270,7 +267,7 @@ bad: ERR_load_crypto_strings(); #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if (g && !num) Modified: head/crypto/openssl/apps/dsaparam.c ============================================================================== --- head/crypto/openssl/apps/dsaparam.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/dsaparam.c Mon Nov 22 18:23:44 2010 (r215697) @@ -111,9 +111,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif DSA *dsa=NULL; int i,badops=0,text=0; BIO *in=NULL,*out=NULL; @@ -278,7 +275,7 @@ bad: } #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if (need_rand) @@ -357,12 +354,10 @@ bad: if (C) { unsigned char *data; - int l,len,bits_p,bits_q,bits_g; + int l,len,bits_p; len=BN_num_bytes(dsa->p); bits_p=BN_num_bits(dsa->p); - bits_q=BN_num_bits(dsa->q); - bits_g=BN_num_bits(dsa->g); data=(unsigned char *)OPENSSL_malloc(len+20); if (data == NULL) { Modified: head/crypto/openssl/apps/ec.c ============================================================================== --- head/crypto/openssl/apps/ec.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/ec.c Mon Nov 22 18:23:44 2010 (r215697) @@ -85,9 +85,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif int ret = 1; EC_KEY *eckey = NULL; const EC_GROUP *group; @@ -254,7 +251,7 @@ bad: ERR_load_crypto_strings(); #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) Modified: head/crypto/openssl/apps/ecparam.c ============================================================================== --- head/crypto/openssl/apps/ecparam.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/ecparam.c Mon Nov 22 18:23:44 2010 (r215697) @@ -129,9 +129,6 @@ int MAIN(int argc, char **argv) char *infile = NULL, *outfile = NULL, *prog; BIO *in = NULL, *out = NULL; int informat, outformat, noout = 0, C = 0, ret = 1; -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif char *engine = NULL; BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, @@ -340,7 +337,7 @@ bad: } #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if (list_curves) Modified: head/crypto/openssl/apps/enc.c ============================================================================== --- head/crypto/openssl/apps/enc.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/enc.c Mon Nov 22 18:23:44 2010 (r215697) @@ -100,9 +100,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif static const char magic[]="Salted__"; char mbuf[sizeof magic-1]; char *strbuf=NULL; @@ -311,7 +308,7 @@ bad: } #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if (md && (dgst=EVP_get_digestbyname(md)) == NULL) Modified: head/crypto/openssl/apps/gendh.c ============================================================================== --- head/crypto/openssl/apps/gendh.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/gendh.c Mon Nov 22 18:23:44 2010 (r215697) @@ -89,9 +89,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { BN_GENCB cb; -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif DH *dh=NULL; int ret=1,num=DEFBITS; int g=2; @@ -163,7 +160,7 @@ bad: } #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif out=BIO_new(BIO_s_file()); Modified: head/crypto/openssl/apps/gendsa.c ============================================================================== --- head/crypto/openssl/apps/gendsa.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/gendsa.c Mon Nov 22 18:23:44 2010 (r215697) @@ -78,9 +78,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif DSA *dsa=NULL; int ret=1; char *outfile=NULL; @@ -206,7 +203,7 @@ bad: } #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) { Modified: head/crypto/openssl/apps/genrsa.c ============================================================================== --- head/crypto/openssl/apps/genrsa.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/genrsa.c Mon Nov 22 18:23:44 2010 (r215697) @@ -89,9 +89,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { BN_GENCB cb; -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif int ret=1; int i,num=DEFBITS; long l; @@ -235,7 +232,7 @@ bad: } #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif if (outfile == NULL) Modified: head/crypto/openssl/apps/pkcs7.c ============================================================================== --- head/crypto/openssl/apps/pkcs7.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/pkcs7.c Mon Nov 22 18:23:44 2010 (r215697) @@ -82,9 +82,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif PKCS7 *p7=NULL; int i,badops=0; BIO *in=NULL,*out=NULL; @@ -180,7 +177,7 @@ bad: ERR_load_crypto_strings(); #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif in=BIO_new(BIO_s_file()); Modified: head/crypto/openssl/apps/rand.c ============================================================================== --- head/crypto/openssl/apps/rand.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/rand.c Mon Nov 22 18:23:44 2010 (r215697) @@ -77,9 +77,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif int i, r, ret = 1; int badopt; char *outfile = NULL; @@ -178,7 +175,7 @@ int MAIN(int argc, char **argv) } #ifndef OPENSSL_NO_ENGINE - e = setup_engine(bio_err, engine, 0); + setup_engine(bio_err, engine, 0); #endif app_RAND_load_file(NULL, bio_err, (inrand != NULL)); Modified: head/crypto/openssl/apps/s_server.c ============================================================================== --- head/crypto/openssl/apps/s_server.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/s_server.c Mon Nov 22 18:23:44 2010 (r215697) @@ -2075,12 +2075,14 @@ static int www_body(char *hostname, int { char *buf=NULL; int ret=1; - int i,j,k,blank,dot; + int i,j,k,dot; struct stat st_buf; SSL *con; SSL_CIPHER *c; BIO *io,*ssl_bio,*sbio; +#ifdef RENEG long total_bytes; +#endif buf=OPENSSL_malloc(bufsize); if (buf == NULL) return(0); @@ -2151,7 +2153,6 @@ static int www_body(char *hostname, int SSL_set_msg_callback_arg(con, bio_s_out); } - blank=0; for (;;) { if (hack) @@ -2388,7 +2389,9 @@ static int www_body(char *hostname, int BIO_puts(io,"HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n"); } /* send the file */ +#ifdef RENEG total_bytes=0; +#endif for (;;) { i=BIO_read(file,buf,bufsize); Modified: head/crypto/openssl/apps/s_socket.c ============================================================================== --- head/crypto/openssl/apps/s_socket.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/s_socket.c Mon Nov 22 18:23:44 2010 (r215697) @@ -329,7 +329,7 @@ static int init_server_long(int *sock, i { int ret=0; struct sockaddr_in server; - int s= -1,i; + int s= -1; if (!ssl_sock_init()) return(0); @@ -368,7 +368,6 @@ static int init_server_long(int *sock, i } /* Make it 128 for linux */ if (type==SOCK_STREAM && listen(s,128) == -1) goto err; - i=0; *sock=s; ret=1; err: @@ -386,7 +385,7 @@ static int init_server(int *sock, int po static int do_accept(int acc_sock, int *sock, char **host) { - int ret,i; + int ret; struct hostent *h1,*h2; static struct sockaddr_in from; int len; @@ -409,6 +408,7 @@ redoit: if (ret == INVALID_SOCKET) { #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) + int i; i=WSAGetLastError(); BIO_printf(bio_err,"accept error %d\n",i); #else @@ -463,7 +463,6 @@ redoit: BIO_printf(bio_err,"gethostbyname failure\n"); return(0); } - i=0; if (h2->h_addrtype != AF_INET) { BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n"); Modified: head/crypto/openssl/apps/speed.c ============================================================================== --- head/crypto/openssl/apps/speed.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/speed.c Mon Nov 22 18:23:44 2010 (r215697) @@ -500,9 +500,6 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { -#ifndef OPENSSL_NO_ENGINE - ENGINE *e = NULL; -#endif unsigned char *buf=NULL,*buf2=NULL; int mret=1; long count=0,save_count=0; @@ -593,7 +590,6 @@ int MAIN(int argc, char **argv) unsigned char DES_iv[8]; unsigned char iv[2*MAX_BLOCK_SIZE/8]; #ifndef OPENSSL_NO_DES - DES_cblock *buf_as_des_cblock = NULL; static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; @@ -806,9 +802,6 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err,"out of memory\n"); goto end; } -#ifndef OPENSSL_NO_DES - buf_as_des_cblock = (DES_cblock *)buf; -#endif if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL) { BIO_printf(bio_err,"out of memory\n"); @@ -883,7 +876,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err,"no engine given\n"); goto end; } - e = setup_engine(bio_err, *argv, 0); + setup_engine(bio_err, *argv, 0); /* j will be increased again further down. We just don't want speed to confuse an engine with an algorithm, especially when none is given (which @@ -1388,7 +1381,8 @@ int MAIN(int argc, char **argv) count*=2; Time_F(START); for (it=count; it; it--) - DES_ecb_encrypt(buf_as_des_cblock,buf_as_des_cblock, + DES_ecb_encrypt((DES_cblock *)buf, + (DES_cblock *)buf, &sch,DES_ENCRYPT); d=Time_F(STOP); } while (d <3); Modified: head/crypto/openssl/apps/x509.c ============================================================================== --- head/crypto/openssl/apps/x509.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/apps/x509.c Mon Nov 22 18:23:44 2010 (r215697) @@ -539,7 +539,6 @@ bad: if (reqfile) { EVP_PKEY *pkey; - X509_CINF *ci; BIO *in; if (!sign_flag && !CA_flag) @@ -607,7 +606,6 @@ bad: print_name(bio_err, "subject=", X509_REQ_get_subject_name(req), nmflag); if ((x=X509_new()) == NULL) goto end; - ci=x->cert_info; if (sno == NULL) { Modified: head/crypto/openssl/crypto/aes/aes_wrap.c ============================================================================== --- head/crypto/openssl/crypto/aes/aes_wrap.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/aes/aes_wrap.c Mon Nov 22 18:23:44 2010 (r215697) @@ -85,9 +85,9 @@ int AES_wrap_key(AES_KEY *key, const uns A[7] ^= (unsigned char)(t & 0xff); if (t > 0xff) { - A[6] ^= (unsigned char)((t & 0xff) >> 8); - A[5] ^= (unsigned char)((t & 0xff) >> 16); - A[4] ^= (unsigned char)((t & 0xff) >> 24); + A[6] ^= (unsigned char)((t >> 8) & 0xff); + A[5] ^= (unsigned char)((t >> 16) & 0xff); + A[4] ^= (unsigned char)((t >> 24) & 0xff); } memcpy(R, B + 8, 8); } @@ -119,9 +119,9 @@ int AES_unwrap_key(AES_KEY *key, const u A[7] ^= (unsigned char)(t & 0xff); if (t > 0xff) { - A[6] ^= (unsigned char)((t & 0xff) >> 8); - A[5] ^= (unsigned char)((t & 0xff) >> 16); - A[4] ^= (unsigned char)((t & 0xff) >> 24); + A[6] ^= (unsigned char)((t >> 8) & 0xff); + A[5] ^= (unsigned char)((t >> 16) & 0xff); + A[4] ^= (unsigned char)((t >> 24) & 0xff); } memcpy(B + 8, R, 8); AES_decrypt(B, B, key); Modified: head/crypto/openssl/crypto/aes/asm/aes-x86_64.pl ============================================================================== --- head/crypto/openssl/crypto/aes/asm/aes-x86_64.pl Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/aes/asm/aes-x86_64.pl Mon Nov 22 18:23:44 2010 (r215697) @@ -751,7 +751,19 @@ $code.=<<___; AES_set_encrypt_key: push %rbx push %rbp + sub \$8,%rsp + call _x86_64_AES_set_encrypt_key + + mov 8(%rsp),%rbp + mov 16(%rsp),%rbx + add \$24,%rsp + ret +.size AES_set_encrypt_key,.-AES_set_encrypt_key + +.type _x86_64_AES_set_encrypt_key,\@abi-omnipotent +.align 16 +_x86_64_AES_set_encrypt_key: mov %esi,%ecx # %ecx=bits mov %rdi,%rsi # %rsi=userKey mov %rdx,%rdi # %rdi=key @@ -938,10 +950,8 @@ $code.=<<___; .Lbadpointer: mov \$-1,%rax .Lexit: - pop %rbp - pop %rbx - ret -.size AES_set_encrypt_key,.-AES_set_encrypt_key + .byte 0xf3,0xc3 # rep ret +.size _x86_64_AES_set_encrypt_key,.-_x86_64_AES_set_encrypt_key ___ sub deckey() @@ -973,15 +983,14 @@ $code.=<<___; .type AES_set_decrypt_key,\@function,3 .align 16 AES_set_decrypt_key: - push %rdx - call AES_set_encrypt_key - cmp \$0,%eax - je .Lproceed - lea 24(%rsp),%rsp - ret -.Lproceed: + push %rbx + push %rbp + push %rdx # save key schedule + + call _x86_64_AES_set_encrypt_key mov (%rsp),%r8 # restore key schedule - mov %rbx,(%rsp) + cmp \$0,%eax + jne .Labort mov 240(%r8),%ecx # pull number of rounds xor %rdi,%rdi @@ -1023,7 +1032,10 @@ $code.=<<___; jnz .Lpermute xor %rax,%rax - pop %rbx +.Labort: + mov 8(%rsp),%rbp + mov 16(%rsp),%rbx + add \$24,%rsp ret .size AES_set_decrypt_key,.-AES_set_decrypt_key ___ Modified: head/crypto/openssl/crypto/asn1/a_int.c ============================================================================== --- head/crypto/openssl/crypto/asn1/a_int.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/asn1/a_int.c Mon Nov 22 18:23:44 2010 (r215697) @@ -273,7 +273,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INT { ASN1_INTEGER *ret=NULL; const unsigned char *p; - unsigned char *to,*s; + unsigned char *s; long len; int inf,tag,xclass; int i; @@ -308,7 +308,6 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INT i=ERR_R_MALLOC_FAILURE; goto err; } - to=s; ret->type=V_ASN1_INTEGER; if(len) { if ((*p == 0) && (len != 1)) Modified: head/crypto/openssl/crypto/asn1/n_pkey.c ============================================================================== --- head/crypto/openssl/crypto/asn1/n_pkey.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/asn1/n_pkey.c Mon Nov 22 18:23:44 2010 (r215697) @@ -242,7 +242,7 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned int sgckey) { RSA *ret=NULL; - const unsigned char *p, *kp; + const unsigned char *p; NETSCAPE_ENCRYPTED_PKEY *enckey = NULL; p = *pp; @@ -265,7 +265,6 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned ASN1err(ASN1_F_D2I_RSA_NET,ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM); goto err; } - kp = enckey->enckey->digest->data; if (cb == NULL) cb=EVP_read_pw_string; if ((ret=d2i_RSA_NET_2(a, enckey->enckey->digest,cb, sgckey)) == NULL) goto err; Modified: head/crypto/openssl/crypto/asn1/t_crl.c ============================================================================== --- head/crypto/openssl/crypto/asn1/t_crl.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/asn1/t_crl.c Mon Nov 22 18:23:44 2010 (r215697) @@ -87,7 +87,7 @@ int X509_CRL_print(BIO *out, X509_CRL *x STACK_OF(X509_REVOKED) *rev; X509_REVOKED *r; long l; - int i, n; + int i; char *p; BIO_printf(out, "Certificate Revocation List (CRL):\n"); @@ -107,7 +107,6 @@ int X509_CRL_print(BIO *out, X509_CRL *x else BIO_printf(out,"NONE"); BIO_printf(out,"\n"); - n=X509_CRL_get_ext_count(x); X509V3_extensions_print(out, "CRL extensions", x->crl->extensions, 0, 8); Modified: head/crypto/openssl/crypto/asn1/tasn_dec.c ============================================================================== --- head/crypto/openssl/crypto/asn1/tasn_dec.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/asn1/tasn_dec.c Mon Nov 22 18:23:44 2010 (r215697) @@ -166,7 +166,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, int i; int otag; int ret = 0; - ASN1_VALUE *pchval, **pchptr, *ptmpval; + ASN1_VALUE **pchptr, *ptmpval; if (!pval) return 0; if (aux && aux->asn1_cb) @@ -317,7 +317,6 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, goto err; } /* CHOICE type, try each possibility in turn */ - pchval = NULL; p = *in; for (i = 0, tt=it->templates; i < it->tcount; i++, tt++) { Modified: head/crypto/openssl/crypto/asn1/x_x509.c ============================================================================== --- head/crypto/openssl/crypto/asn1/x_x509.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/asn1/x_x509.c Mon Nov 22 18:23:44 2010 (r215697) @@ -63,7 +63,7 @@ #include #include -ASN1_SEQUENCE(X509_CINF) = { +ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = { ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0), ASN1_SIMPLE(X509_CINF, serialNumber, ASN1_INTEGER), ASN1_SIMPLE(X509_CINF, signature, X509_ALGOR), @@ -74,7 +74,7 @@ ASN1_SEQUENCE(X509_CINF) = { ASN1_IMP_OPT(X509_CINF, issuerUID, ASN1_BIT_STRING, 1), ASN1_IMP_OPT(X509_CINF, subjectUID, ASN1_BIT_STRING, 2), ASN1_EXP_SEQUENCE_OF_OPT(X509_CINF, extensions, X509_EXTENSION, 3) -} ASN1_SEQUENCE_END(X509_CINF) +} ASN1_SEQUENCE_END_enc(X509_CINF, X509_CINF) IMPLEMENT_ASN1_FUNCTIONS(X509_CINF) /* X509 top level structure needs a bit of customisation */ Modified: head/crypto/openssl/crypto/bio/b_sock.c ============================================================================== --- head/crypto/openssl/crypto/bio/b_sock.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/bio/b_sock.c Mon Nov 22 18:23:44 2010 (r215697) @@ -659,7 +659,14 @@ again: #ifdef SO_REUSEADDR err_num=get_last_socket_error(); if ((bind_mode == BIO_BIND_REUSEADDR_IF_UNUSED) && +#ifdef OPENSSL_SYS_WINDOWS + /* Some versions of Windows define EADDRINUSE to + * a dummy value. + */ + (err_num == WSAEADDRINUSE)) +#else (err_num == EADDRINUSE)) +#endif { memcpy((char *)&client,(char *)&server,sizeof(server)); if (strcmp(h,"*") == 0) Modified: head/crypto/openssl/crypto/bio/bf_nbio.c ============================================================================== --- head/crypto/openssl/crypto/bio/bf_nbio.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/bio/bf_nbio.c Mon Nov 22 18:23:44 2010 (r215697) @@ -125,7 +125,6 @@ static int nbiof_free(BIO *a) static int nbiof_read(BIO *b, char *out, int outl) { - NBIO_TEST *nt; int ret=0; #if 1 int num; @@ -134,7 +133,6 @@ static int nbiof_read(BIO *b, char *out, if (out == NULL) return(0); if (b->next_bio == NULL) return(0); - nt=(NBIO_TEST *)b->ptr; BIO_clear_retry_flags(b); #if 1 Modified: head/crypto/openssl/crypto/bio/bio_lib.c ============================================================================== --- head/crypto/openssl/crypto/bio/bio_lib.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/bio/bio_lib.c Mon Nov 22 18:23:44 2010 (r215697) @@ -110,7 +110,7 @@ int BIO_set(BIO *bio, BIO_METHOD *method int BIO_free(BIO *a) { - int ret=0,i; + int i; if (a == NULL) return(0); @@ -133,7 +133,7 @@ int BIO_free(BIO *a) CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data); if ((a->method == NULL) || (a->method->destroy == NULL)) return(1); - ret=a->method->destroy(a); + a->method->destroy(a); OPENSSL_free(a); return(1); } Modified: head/crypto/openssl/crypto/bio/bss_acpt.c ============================================================================== --- head/crypto/openssl/crypto/bio/bss_acpt.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/bio/bss_acpt.c Mon Nov 22 18:23:44 2010 (r215697) @@ -340,7 +340,6 @@ static int acpt_write(BIO *b, const char static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr) { - BIO *dbio; int *ip; long ret=1; BIO_ACCEPT *data; @@ -437,8 +436,8 @@ static long acpt_ctrl(BIO *b, int cmd, l ret=(long)data->bind_mode; break; case BIO_CTRL_DUP: - dbio=(BIO *)ptr; -/* if (data->param_port) EAY EAY +/* dbio=(BIO *)ptr; + if (data->param_port) EAY EAY BIO_set_port(dbio,data->param_port); if (data->param_hostname) BIO_set_hostname(dbio,data->param_hostname); Modified: head/crypto/openssl/crypto/bio/bss_sock.c ============================================================================== --- head/crypto/openssl/crypto/bio/bss_sock.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/bio/bss_sock.c Mon Nov 22 18:23:44 2010 (r215697) @@ -172,15 +172,6 @@ static long sock_ctrl(BIO *b, int cmd, l switch (cmd) { - case BIO_CTRL_RESET: - num=0; - case BIO_C_FILE_SEEK: - ret=0; - break; - case BIO_C_FILE_TELL: - case BIO_CTRL_INFO: - ret=0; - break; case BIO_C_SET_FD: sock_free(b); b->num= *((int *)ptr); @@ -203,10 +194,6 @@ static long sock_ctrl(BIO *b, int cmd, l case BIO_CTRL_SET_CLOSE: b->shutdown=(int)num; break; - case BIO_CTRL_PENDING: - case BIO_CTRL_WPENDING: - ret=0; - break; case BIO_CTRL_DUP: case BIO_CTRL_FLUSH: ret=1; Modified: head/crypto/openssl/crypto/bn/bn_exp2.c ============================================================================== --- head/crypto/openssl/crypto/bn/bn_exp2.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/bn/bn_exp2.c Mon Nov 22 18:23:44 2010 (r215697) @@ -301,7 +301,8 @@ int BN_mod_exp2_mont(BIGNUM *rr, const B r_is_one = 0; } } - BN_from_montgomery(rr,r,mont,ctx); + if (!BN_from_montgomery(rr,r,mont,ctx)) + goto err; ret=1; err: if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont); Modified: head/crypto/openssl/crypto/bn/bn_mul.c ============================================================================== --- head/crypto/openssl/crypto/bn/bn_mul.c Mon Nov 22 17:39:18 2010 (r215696) +++ head/crypto/openssl/crypto/bn/bn_mul.c Mon Nov 22 18:23:44 2010 (r215697) @@ -551,7 +551,7 @@ void bn_mul_part_recursive(BN_ULONG *r, int tna, int tnb, BN_ULONG *t) { int i,j,n2=n*2; - int c1,c2,neg,zero; + int c1,c2,neg; BN_ULONG ln,lo,*p; # ifdef BN_COUNT @@ -567,7 +567,7 @@ void bn_mul_part_recursive(BN_ULONG *r, /* r=(a[0]-a[1])*(b[1]-b[0]) */ c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna); c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n); - zero=neg=0; + neg=0; switch (c1*3+c2) { case -4: @@ -575,7 +575,6 @@ void bn_mul_part_recursive(BN_ULONG *r, bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */ break; case -3: - zero=1; /* break; */ case -2: bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */ @@ -585,7 +584,6 @@ void bn_mul_part_recursive(BN_ULONG *r, case -1: case 0: case 1: - zero=1; /* break; */ case 2: bn_sub_part_words(t, a, &(a[n]),tna,n-tna); /* + */ @@ -593,7 +591,6 @@ void bn_mul_part_recursive(BN_ULONG *r, neg=1; break; case 3: - zero=1; /* break; */ case 4: bn_sub_part_words(t, a, &(a[n]),tna,n-tna); @@ -1012,7 +1009,6 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, c { if (i >= -1 && i <= 1) { - int sav_j =0; /* Find out the power of two lower or equal to the longest of the two numbers */ if (i >= 0) @@ -1023,7 +1019,6 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, c { j = BN_num_bits_word((BN_ULONG)bl); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 18:29:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5AC21065679; Mon, 22 Nov 2010 18:29:01 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F6988FC1B; Mon, 22 Nov 2010 18:29:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMIT1MV001224; Mon, 22 Nov 2010 18:29:01 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMIT1RN001213; Mon, 22 Nov 2010 18:29:01 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <201011221829.oAMIT1RN001213@svn.freebsd.org> From: "Simon L. Nielsen" Date: Mon, 22 Nov 2010 18:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215698 - in head/secure: lib/libcrypto lib/libcrypto/man lib/libssl/man usr.bin/openssl/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 18:29:01 -0000 Author: simon Date: Mon Nov 22 18:29:00 2010 New Revision: 215698 URL: http://svn.freebsd.org/changeset/base/215698 Log: Regenerate manual pages for OpenSSL 0.9.8p. Modified: head/secure/lib/libcrypto/Makefile.inc head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 head/secure/lib/libcrypto/man/ASN1_STRING_length.3 head/secure/lib/libcrypto/man/ASN1_STRING_new.3 head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 head/secure/lib/libcrypto/man/ASN1_generate_nconf.3 head/secure/lib/libcrypto/man/BIO_ctrl.3 head/secure/lib/libcrypto/man/BIO_f_base64.3 head/secure/lib/libcrypto/man/BIO_f_buffer.3 head/secure/lib/libcrypto/man/BIO_f_cipher.3 head/secure/lib/libcrypto/man/BIO_f_md.3 head/secure/lib/libcrypto/man/BIO_f_null.3 head/secure/lib/libcrypto/man/BIO_f_ssl.3 head/secure/lib/libcrypto/man/BIO_find_type.3 head/secure/lib/libcrypto/man/BIO_new.3 head/secure/lib/libcrypto/man/BIO_push.3 head/secure/lib/libcrypto/man/BIO_read.3 head/secure/lib/libcrypto/man/BIO_s_accept.3 head/secure/lib/libcrypto/man/BIO_s_bio.3 head/secure/lib/libcrypto/man/BIO_s_connect.3 head/secure/lib/libcrypto/man/BIO_s_fd.3 head/secure/lib/libcrypto/man/BIO_s_file.3 head/secure/lib/libcrypto/man/BIO_s_mem.3 head/secure/lib/libcrypto/man/BIO_s_null.3 head/secure/lib/libcrypto/man/BIO_s_socket.3 head/secure/lib/libcrypto/man/BIO_set_callback.3 head/secure/lib/libcrypto/man/BIO_should_retry.3 head/secure/lib/libcrypto/man/BN_BLINDING_new.3 head/secure/lib/libcrypto/man/BN_CTX_new.3 head/secure/lib/libcrypto/man/BN_CTX_start.3 head/secure/lib/libcrypto/man/BN_add.3 head/secure/lib/libcrypto/man/BN_add_word.3 head/secure/lib/libcrypto/man/BN_bn2bin.3 head/secure/lib/libcrypto/man/BN_cmp.3 head/secure/lib/libcrypto/man/BN_copy.3 head/secure/lib/libcrypto/man/BN_generate_prime.3 head/secure/lib/libcrypto/man/BN_mod_inverse.3 head/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 head/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 head/secure/lib/libcrypto/man/BN_new.3 head/secure/lib/libcrypto/man/BN_num_bytes.3 head/secure/lib/libcrypto/man/BN_rand.3 head/secure/lib/libcrypto/man/BN_set_bit.3 head/secure/lib/libcrypto/man/BN_swap.3 head/secure/lib/libcrypto/man/BN_zero.3 head/secure/lib/libcrypto/man/CONF_modules_free.3 head/secure/lib/libcrypto/man/CONF_modules_load_file.3 head/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 head/secure/lib/libcrypto/man/DH_generate_key.3 head/secure/lib/libcrypto/man/DH_generate_parameters.3 head/secure/lib/libcrypto/man/DH_get_ex_new_index.3 head/secure/lib/libcrypto/man/DH_new.3 head/secure/lib/libcrypto/man/DH_set_method.3 head/secure/lib/libcrypto/man/DH_size.3 head/secure/lib/libcrypto/man/DSA_SIG_new.3 head/secure/lib/libcrypto/man/DSA_do_sign.3 head/secure/lib/libcrypto/man/DSA_dup_DH.3 head/secure/lib/libcrypto/man/DSA_generate_key.3 head/secure/lib/libcrypto/man/DSA_generate_parameters.3 head/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 head/secure/lib/libcrypto/man/DSA_new.3 head/secure/lib/libcrypto/man/DSA_set_method.3 head/secure/lib/libcrypto/man/DSA_sign.3 head/secure/lib/libcrypto/man/DSA_size.3 head/secure/lib/libcrypto/man/ERR_GET_LIB.3 head/secure/lib/libcrypto/man/ERR_clear_error.3 head/secure/lib/libcrypto/man/ERR_error_string.3 head/secure/lib/libcrypto/man/ERR_get_error.3 head/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 head/secure/lib/libcrypto/man/ERR_load_strings.3 head/secure/lib/libcrypto/man/ERR_print_errors.3 head/secure/lib/libcrypto/man/ERR_put_error.3 head/secure/lib/libcrypto/man/ERR_remove_state.3 head/secure/lib/libcrypto/man/ERR_set_mark.3 head/secure/lib/libcrypto/man/EVP_BytesToKey.3 head/secure/lib/libcrypto/man/EVP_DigestInit.3 head/secure/lib/libcrypto/man/EVP_EncryptInit.3 head/secure/lib/libcrypto/man/EVP_OpenInit.3 head/secure/lib/libcrypto/man/EVP_PKEY_new.3 head/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 head/secure/lib/libcrypto/man/EVP_SealInit.3 head/secure/lib/libcrypto/man/EVP_SignInit.3 head/secure/lib/libcrypto/man/EVP_VerifyInit.3 head/secure/lib/libcrypto/man/OBJ_nid2obj.3 head/secure/lib/libcrypto/man/OPENSSL_Applink.3 head/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 head/secure/lib/libcrypto/man/OPENSSL_config.3 head/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 head/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 head/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 head/secure/lib/libcrypto/man/PKCS12_create.3 head/secure/lib/libcrypto/man/PKCS12_parse.3 head/secure/lib/libcrypto/man/PKCS7_decrypt.3 head/secure/lib/libcrypto/man/PKCS7_encrypt.3 head/secure/lib/libcrypto/man/PKCS7_sign.3 head/secure/lib/libcrypto/man/PKCS7_verify.3 head/secure/lib/libcrypto/man/RAND_add.3 head/secure/lib/libcrypto/man/RAND_bytes.3 head/secure/lib/libcrypto/man/RAND_cleanup.3 head/secure/lib/libcrypto/man/RAND_egd.3 head/secure/lib/libcrypto/man/RAND_load_file.3 head/secure/lib/libcrypto/man/RAND_set_rand_method.3 head/secure/lib/libcrypto/man/RSA_blinding_on.3 head/secure/lib/libcrypto/man/RSA_check_key.3 head/secure/lib/libcrypto/man/RSA_generate_key.3 head/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 head/secure/lib/libcrypto/man/RSA_new.3 head/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 head/secure/lib/libcrypto/man/RSA_print.3 head/secure/lib/libcrypto/man/RSA_private_encrypt.3 head/secure/lib/libcrypto/man/RSA_public_encrypt.3 head/secure/lib/libcrypto/man/RSA_set_method.3 head/secure/lib/libcrypto/man/RSA_sign.3 head/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 head/secure/lib/libcrypto/man/RSA_size.3 head/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 head/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 head/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 head/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 head/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 head/secure/lib/libcrypto/man/X509_NAME_print_ex.3 head/secure/lib/libcrypto/man/X509_new.3 head/secure/lib/libcrypto/man/bio.3 head/secure/lib/libcrypto/man/blowfish.3 head/secure/lib/libcrypto/man/bn.3 head/secure/lib/libcrypto/man/bn_internal.3 head/secure/lib/libcrypto/man/buffer.3 head/secure/lib/libcrypto/man/crypto.3 head/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 head/secure/lib/libcrypto/man/d2i_DHparams.3 head/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 head/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 head/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 head/secure/lib/libcrypto/man/d2i_X509.3 head/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 head/secure/lib/libcrypto/man/d2i_X509_CRL.3 head/secure/lib/libcrypto/man/d2i_X509_NAME.3 head/secure/lib/libcrypto/man/d2i_X509_REQ.3 head/secure/lib/libcrypto/man/d2i_X509_SIG.3 head/secure/lib/libcrypto/man/des.3 head/secure/lib/libcrypto/man/dh.3 head/secure/lib/libcrypto/man/dsa.3 head/secure/lib/libcrypto/man/ecdsa.3 head/secure/lib/libcrypto/man/engine.3 head/secure/lib/libcrypto/man/err.3 head/secure/lib/libcrypto/man/evp.3 head/secure/lib/libcrypto/man/hmac.3 head/secure/lib/libcrypto/man/lh_stats.3 head/secure/lib/libcrypto/man/lhash.3 head/secure/lib/libcrypto/man/md5.3 head/secure/lib/libcrypto/man/mdc2.3 head/secure/lib/libcrypto/man/pem.3 head/secure/lib/libcrypto/man/rand.3 head/secure/lib/libcrypto/man/rc4.3 head/secure/lib/libcrypto/man/ripemd.3 head/secure/lib/libcrypto/man/rsa.3 head/secure/lib/libcrypto/man/sha.3 head/secure/lib/libcrypto/man/threads.3 head/secure/lib/libcrypto/man/ui.3 head/secure/lib/libcrypto/man/ui_compat.3 head/secure/lib/libcrypto/man/x509.3 head/secure/lib/libssl/man/SSL_CIPHER_get_name.3 head/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 head/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 head/secure/lib/libssl/man/SSL_CTX_add_session.3 head/secure/lib/libssl/man/SSL_CTX_ctrl.3 head/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 head/secure/lib/libssl/man/SSL_CTX_free.3 head/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 head/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 head/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 head/secure/lib/libssl/man/SSL_CTX_new.3 head/secure/lib/libssl/man/SSL_CTX_sess_number.3 head/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 head/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 head/secure/lib/libssl/man/SSL_CTX_sessions.3 head/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 head/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 head/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 head/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 head/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 head/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 head/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 head/secure/lib/libssl/man/SSL_CTX_set_mode.3 head/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_options.3 head/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 head/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 head/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 head/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 head/secure/lib/libssl/man/SSL_CTX_set_timeout.3 head/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_verify.3 head/secure/lib/libssl/man/SSL_CTX_use_certificate.3 head/secure/lib/libssl/man/SSL_SESSION_free.3 head/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 head/secure/lib/libssl/man/SSL_SESSION_get_time.3 head/secure/lib/libssl/man/SSL_accept.3 head/secure/lib/libssl/man/SSL_alert_type_string.3 head/secure/lib/libssl/man/SSL_clear.3 head/secure/lib/libssl/man/SSL_connect.3 head/secure/lib/libssl/man/SSL_do_handshake.3 head/secure/lib/libssl/man/SSL_free.3 head/secure/lib/libssl/man/SSL_get_SSL_CTX.3 head/secure/lib/libssl/man/SSL_get_ciphers.3 head/secure/lib/libssl/man/SSL_get_client_CA_list.3 head/secure/lib/libssl/man/SSL_get_current_cipher.3 head/secure/lib/libssl/man/SSL_get_default_timeout.3 head/secure/lib/libssl/man/SSL_get_error.3 head/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 head/secure/lib/libssl/man/SSL_get_ex_new_index.3 head/secure/lib/libssl/man/SSL_get_fd.3 head/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 head/secure/lib/libssl/man/SSL_get_peer_certificate.3 head/secure/lib/libssl/man/SSL_get_rbio.3 head/secure/lib/libssl/man/SSL_get_session.3 head/secure/lib/libssl/man/SSL_get_verify_result.3 head/secure/lib/libssl/man/SSL_get_version.3 head/secure/lib/libssl/man/SSL_library_init.3 head/secure/lib/libssl/man/SSL_load_client_CA_file.3 head/secure/lib/libssl/man/SSL_new.3 head/secure/lib/libssl/man/SSL_pending.3 head/secure/lib/libssl/man/SSL_read.3 head/secure/lib/libssl/man/SSL_rstate_string.3 head/secure/lib/libssl/man/SSL_session_reused.3 head/secure/lib/libssl/man/SSL_set_bio.3 head/secure/lib/libssl/man/SSL_set_connect_state.3 head/secure/lib/libssl/man/SSL_set_fd.3 head/secure/lib/libssl/man/SSL_set_session.3 head/secure/lib/libssl/man/SSL_set_shutdown.3 head/secure/lib/libssl/man/SSL_set_verify_result.3 head/secure/lib/libssl/man/SSL_shutdown.3 head/secure/lib/libssl/man/SSL_state_string.3 head/secure/lib/libssl/man/SSL_want.3 head/secure/lib/libssl/man/SSL_write.3 head/secure/lib/libssl/man/d2i_SSL_SESSION.3 head/secure/lib/libssl/man/ssl.3 head/secure/usr.bin/openssl/man/CA.pl.1 head/secure/usr.bin/openssl/man/asn1parse.1 head/secure/usr.bin/openssl/man/ca.1 head/secure/usr.bin/openssl/man/ciphers.1 head/secure/usr.bin/openssl/man/crl.1 head/secure/usr.bin/openssl/man/crl2pkcs7.1 head/secure/usr.bin/openssl/man/dgst.1 head/secure/usr.bin/openssl/man/dhparam.1 head/secure/usr.bin/openssl/man/dsa.1 head/secure/usr.bin/openssl/man/dsaparam.1 head/secure/usr.bin/openssl/man/ec.1 head/secure/usr.bin/openssl/man/ecparam.1 head/secure/usr.bin/openssl/man/enc.1 head/secure/usr.bin/openssl/man/errstr.1 head/secure/usr.bin/openssl/man/gendsa.1 head/secure/usr.bin/openssl/man/genrsa.1 head/secure/usr.bin/openssl/man/nseq.1 head/secure/usr.bin/openssl/man/ocsp.1 head/secure/usr.bin/openssl/man/openssl.1 head/secure/usr.bin/openssl/man/passwd.1 head/secure/usr.bin/openssl/man/pkcs12.1 head/secure/usr.bin/openssl/man/pkcs7.1 head/secure/usr.bin/openssl/man/pkcs8.1 head/secure/usr.bin/openssl/man/rand.1 head/secure/usr.bin/openssl/man/req.1 head/secure/usr.bin/openssl/man/rsa.1 head/secure/usr.bin/openssl/man/rsautl.1 head/secure/usr.bin/openssl/man/s_client.1 head/secure/usr.bin/openssl/man/s_server.1 head/secure/usr.bin/openssl/man/s_time.1 head/secure/usr.bin/openssl/man/sess_id.1 head/secure/usr.bin/openssl/man/smime.1 head/secure/usr.bin/openssl/man/speed.1 head/secure/usr.bin/openssl/man/spkac.1 head/secure/usr.bin/openssl/man/verify.1 head/secure/usr.bin/openssl/man/version.1 head/secure/usr.bin/openssl/man/x509.1 head/secure/usr.bin/openssl/man/x509v3_config.1 Modified: head/secure/lib/libcrypto/Makefile.inc ============================================================================== --- head/secure/lib/libcrypto/Makefile.inc Mon Nov 22 18:23:44 2010 (r215697) +++ head/secure/lib/libcrypto/Makefile.inc Mon Nov 22 18:29:00 2010 (r215698) @@ -3,8 +3,8 @@ .include # OpenSSL version used for manual page generation -OPENSSL_VER= 0.9.8n -OPENSSL_DATE= 2010-03-24 +OPENSSL_VER= 0.9.8p +OPENSSL_DATE= 2010-11-16 LCRYPTO_SRC= ${.CURDIR}/../../../crypto/openssl LCRYPTO_DOC= ${.CURDIR}/../../../crypto/openssl/doc Modified: head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 ============================================================================== --- head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 Mon Nov 22 18:23:44 2010 (r215697) +++ head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 Mon Nov 22 18:29:00 2010 (r215698) @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -25,11 +17,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -48,22 +40,25 @@ . ds R" '' 'br\} .\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.if \nF \{\ +.ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na +.el \{\ +. de IX +.. +.\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,12 +124,18 @@ .\" ======================================================================== .\" .IX Title "ASN1_OBJECT_new 3" -.TH ASN1_OBJECT_new 3 "2010-03-24" "0.9.8n" "OpenSSL" +.TH ASN1_OBJECT_new 3 "2010-11-16" "0.9.8p" "OpenSSL" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh .SH "NAME" ASN1_OBJECT_new, ASN1_OBJECT_free, \- object allocation functions .SH "SYNOPSIS" .IX Header "SYNOPSIS" -.Vb 2 +.Vb 1 +\& #include +\& \& ASN1_OBJECT *ASN1_OBJECT_new(void); \& void ASN1_OBJECT_free(ASN1_OBJECT *a); .Ve Modified: head/secure/lib/libcrypto/man/ASN1_STRING_length.3 ============================================================================== --- head/secure/lib/libcrypto/man/ASN1_STRING_length.3 Mon Nov 22 18:23:44 2010 (r215697) +++ head/secure/lib/libcrypto/man/ASN1_STRING_length.3 Mon Nov 22 18:29:00 2010 (r215698) @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -25,11 +17,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -48,22 +40,25 @@ . ds R" '' 'br\} .\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.if \nF \{\ +.ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na +.el \{\ +. de IX +.. +.\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,35 +124,31 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_length 3" -.TH ASN1_STRING_length 3 "2010-03-24" "0.9.8n" "OpenSSL" +.TH ASN1_STRING_length 3 "2010-11-16" "0.9.8p" "OpenSSL" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh .SH "NAME" ASN1_STRING_dup, ASN1_STRING_cmp, ASN1_STRING_set, ASN1_STRING_length, ASN1_STRING_length_set, ASN1_STRING_type, ASN1_STRING_data \- ASN1_STRING utility functions .SH "SYNOPSIS" .IX Header "SYNOPSIS" -.Vb 2 +.Vb 1 +\& #include +\& \& int ASN1_STRING_length(ASN1_STRING *x); \& unsigned char * ASN1_STRING_data(ASN1_STRING *x); -.Ve -.PP -.Vb 1 +\& \& ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); -.Ve -.PP -.Vb 1 +\& \& int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); -.Ve -.PP -.Vb 1 +\& \& int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); -.Ve -.PP -.Vb 1 +\& \& int ASN1_STRING_type(ASN1_STRING *x); -.Ve -.PP -.Vb 1 +\& \& int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); .Ve .SH "DESCRIPTION" Modified: head/secure/lib/libcrypto/man/ASN1_STRING_new.3 ============================================================================== --- head/secure/lib/libcrypto/man/ASN1_STRING_new.3 Mon Nov 22 18:23:44 2010 (r215697) +++ head/secure/lib/libcrypto/man/ASN1_STRING_new.3 Mon Nov 22 18:29:00 2010 (r215698) @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -25,11 +17,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -48,22 +40,25 @@ . ds R" '' 'br\} .\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.if \nF \{\ +.ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na +.el \{\ +. de IX +.. +.\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,13 +124,19 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_new 3" -.TH ASN1_STRING_new 3 "2010-03-24" "0.9.8n" "OpenSSL" +.TH ASN1_STRING_new 3 "2010-11-16" "0.9.8p" "OpenSSL" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh .SH "NAME" ASN1_STRING_new, ASN1_STRING_type_new, ASN1_STRING_free \- ASN1_STRING allocation functions .SH "SYNOPSIS" .IX Header "SYNOPSIS" -.Vb 3 +.Vb 1 +\& #include +\& \& ASN1_STRING * ASN1_STRING_new(void); \& ASN1_STRING * ASN1_STRING_type_new(int type); \& void ASN1_STRING_free(ASN1_STRING *a); Modified: head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 ============================================================================== --- head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 Mon Nov 22 18:23:44 2010 (r215697) +++ head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 Mon Nov 22 18:29:00 2010 (r215698) @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -25,11 +17,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -48,22 +40,25 @@ . ds R" '' 'br\} .\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.if \nF \{\ +.ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na +.el \{\ +. de IX +.. +.\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,16 +124,18 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_print_ex 3" -.TH ASN1_STRING_print_ex 3 "2010-03-24" "0.9.8n" "OpenSSL" +.TH ASN1_STRING_print_ex 3 "2010-11-16" "0.9.8p" "OpenSSL" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh .SH "NAME" ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp \- ASN1_STRING output routines. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include -.Ve -.PP -.Vb 3 +\& \& int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); \& int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); \& int ASN1_STRING_print(BIO *out, ASN1_STRING *str); Modified: head/secure/lib/libcrypto/man/ASN1_generate_nconf.3 ============================================================================== --- head/secure/lib/libcrypto/man/ASN1_generate_nconf.3 Mon Nov 22 18:23:44 2010 (r215697) +++ head/secure/lib/libcrypto/man/ASN1_generate_nconf.3 Mon Nov 22 18:29:00 2010 (r215698) @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -25,11 +17,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -48,22 +40,25 @@ . ds R" '' 'br\} .\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.if \nF \{\ +.ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na +.el \{\ +. de IX +.. +.\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,12 +124,18 @@ .\" ======================================================================== .\" .IX Title "ASN1_generate_nconf 3" -.TH ASN1_generate_nconf 3 "2010-03-24" "0.9.8n" "OpenSSL" +.TH ASN1_generate_nconf 3 "2010-11-16" "0.9.8p" "OpenSSL" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh .SH "NAME" ASN1_generate_nconf, ASN1_generate_v3 \- ASN1 generation functions .SH "SYNOPSIS" .IX Header "SYNOPSIS" -.Vb 2 +.Vb 1 +\& #include +\& \& ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); \& ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); .Ve @@ -161,7 +162,7 @@ is: That is zero or more comma separated modifiers followed by a type followed by an optional colon and a value. The formats of \fBtype\fR, \&\fBvalue\fR and \fBmodifier\fR are explained below. -.Sh "\s-1SUPPORTED\s0 \s-1TYPES\s0" +.SS "\s-1SUPPORTED\s0 \s-1TYPES\s0" .IX Subsection "SUPPORTED TYPES" The supported types are listed below. Unless otherwise specified only the \fB\s-1ASCII\s0\fR format is permissible. @@ -170,7 +171,7 @@ only the \fB\s-1ASCII\s0\fR format is pe This encodes a boolean type. The \fBvalue\fR string is mandatory and should be \fB\s-1TRUE\s0\fR or \fB\s-1FALSE\s0\fR. Additionally \fB\s-1TRUE\s0\fR, \fBtrue\fR, \fBY\fR, \&\fBy\fR, \fB\s-1YES\s0\fR, \fByes\fR, \fB\s-1FALSE\s0\fR, \fBfalse\fR, \fBN\fR, \fBn\fR, \fB\s-1NO\s0\fR and \fBno\fR -are acceptable. +are acceptable. .IP "\fB\s-1NULL\s0\fR" 2 .IX Item "NULL" Encode the \fB\s-1NULL\s0\fR type, the \fBvalue\fR string must not be present. @@ -191,11 +192,11 @@ a short name, a long name or numerical f .IP "\fB\s-1UTCTIME\s0\fR, \fB\s-1UTC\s0\fR" 2 .IX Item "UTCTIME, UTC" Encodes an \s-1ASN1\s0 \fBUTCTime\fR structure, the value should be in -the format \fB\s-1YYMMDDHHMMSSZ\s0\fR. +the format \fB\s-1YYMMDDHHMMSSZ\s0\fR. .IP "\fB\s-1GENERALIZEDTIME\s0\fR, \fB\s-1GENTIME\s0\fR" 2 .IX Item "GENERALIZEDTIME, GENTIME" Encodes an \s-1ASN1\s0 \fBGeneralizedTime\fR structure, the value should be in -the format \fB\s-1YYYYMMDDHHMMSSZ\s0\fR. +the format \fB\s-1YYYYMMDDHHMMSSZ\s0\fR. .IP "\fB\s-1OCTETSTRING\s0\fR, \fB\s-1OCT\s0\fR" 2 .IX Item "OCTETSTRING, OCT" Encodes an \s-1ASN1\s0 \fB\s-1OCTET\s0 \s-1STRING\s0\fR. \fBvalue\fR represents the contents @@ -220,7 +221,7 @@ should be a section name which will cont field names in the section are ignored and the values are in the generated string format. If \fBvalue\fR is absent then an empty \s-1SEQUENCE\s0 will be encoded. -.Sh "\s-1MODIFIERS\s0" +.SS "\s-1MODIFIERS\s0" .IX Subsection "MODIFIERS" Modifiers affect the following structure, they can be used to add \s-1EXPLICIT\s0 or \s-1IMPLICIT\s0 tagging, add wrappers or to change @@ -285,13 +286,9 @@ A more complex example using a config fi .PP .Vb 1 \& asn1 = SEQUENCE:seq_section -.Ve -.PP -.Vb 1 +\& \& [seq_section] -.Ve -.PP -.Vb 3 +\& \& field1 = BOOLEAN:TRUE \& field2 = OID:commonName \& field3 = UTF8:Third field @@ -306,43 +303,27 @@ for clarity): \& asn1=SEQUENCE:private_key \& [private_key] \& version=INTEGER:0 -.Ve -.PP -.Vb 2 +\& \& n=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\e \& D4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9 -.Ve -.PP -.Vb 1 +\& \& e=INTEGER:0x010001 -.Ve -.PP -.Vb 2 +\& \& d=INTEGER:0x6F05EAD2F27FFAEC84BEC360C4B928FD5F3A9865D0FCAAD291E2A52F4A\e \& F810DC6373278C006A0ABBA27DC8C63BF97F7E666E27C5284D7D3B1FFFE16B7A87B51D -.Ve -.PP -.Vb 2 +\& \& p=INTEGER:0xF3929B9435608F8A22C208D86795271D54EBDFB09DDEF539AB083DA912\e \& D4BD57 -.Ve -.PP -.Vb 2 +\& \& q=INTEGER:0xC50016F89DFF2561347ED1186A46E150E28BF2D0F539A1594BBD7FE467\e \& 46EC4F -.Ve -.PP -.Vb 2 +\& \& exp1=INTEGER:0x9E7D4326C924AFC1DEA40B45650134966D6F9DFA3A7F9D698CD4ABEA\e \& 9C0A39B9 -.Ve -.PP -.Vb 2 +\& \& exp2=INTEGER:0xBA84003BB95355AFB7C50DF140C60513D0BA51D637272E355E397779\e \& E7B2458F -.Ve -.PP -.Vb 2 +\& \& coeff=INTEGER:0x30B9E4F2AFA5AC679F920FC83F1F2DF1BAF1779CF989447FABC2F5\e \& 628657053A .Ve @@ -353,31 +334,23 @@ structure: .Vb 2 \& # Start with a SEQUENCE \& asn1=SEQUENCE:pubkeyinfo -.Ve -.PP -.Vb 5 +\& \& # pubkeyinfo contains an algorithm identifier and the public key wrapped \& # in a BIT STRING \& [pubkeyinfo] \& algorithm=SEQUENCE:rsa_alg \& pubkey=BITWRAP,SEQUENCE:rsapubkey -.Ve -.PP -.Vb 4 +\& \& # algorithm ID for RSA is just an OID and a NULL \& [rsa_alg] \& algorithm=OID:rsaEncryption \& parameter=NULL -.Ve -.PP -.Vb 4 +\& \& # Actual public key: modulus and exponent \& [rsapubkey] \& n=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\e \& D4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9 -.Ve -.PP -.Vb 1 +\& \& e=INTEGER:0x010001 .Ve .SH "RETURN VALUES" Modified: head/secure/lib/libcrypto/man/BIO_ctrl.3 ============================================================================== --- head/secure/lib/libcrypto/man/BIO_ctrl.3 Mon Nov 22 18:23:44 2010 (r215697) +++ head/secure/lib/libcrypto/man/BIO_ctrl.3 Mon Nov 22 18:29:00 2010 (r215698) @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -25,11 +17,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -48,22 +40,25 @@ . ds R" '' 'br\} .\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.if \nF \{\ +.ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na +.el \{\ +. de IX +.. +.\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,7 +124,11 @@ .\" ======================================================================== .\" .IX Title "BIO_ctrl 3" -.TH BIO_ctrl 3 "2010-03-24" "0.9.8n" "OpenSSL" +.TH BIO_ctrl 3 "2010-11-16" "0.9.8p" "OpenSSL" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh .SH "NAME" BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, @@ -139,16 +138,12 @@ BIO_get_info_callback, BIO_set_info_call .IX Header "SYNOPSIS" .Vb 1 \& #include -.Ve -.PP -.Vb 4 +\& \& long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); \& long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); \& char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); \& long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); -.Ve -.PP -.Vb 11 +\& \& int BIO_reset(BIO *b); \& int BIO_seek(BIO *b, int ofs); \& int BIO_tell(BIO *b); @@ -160,14 +155,10 @@ BIO_get_info_callback, BIO_set_info_call \& int BIO_wpending(BIO *b); \& size_t BIO_ctrl_pending(BIO *b); \& size_t BIO_ctrl_wpending(BIO *b); -.Ve -.PP -.Vb 2 +\& \& int BIO_get_info_callback(BIO *b,bio_info_cb **cbp); \& int BIO_set_info_callback(BIO *b,bio_info_cb *cb); -.Ve -.PP -.Vb 1 +\& \& typedef void bio_info_cb(BIO *b, int oper, const char *ptr, int arg1, long arg2, long arg3); .Ve .SH "DESCRIPTION" @@ -255,7 +246,7 @@ operation. Some of the return values are ambiguous and care should be taken. In particular a return value of 0 can be returned if an operation is not supported, if an error occurred, if \s-1EOF\s0 has not been reached and in -the case of \fIBIO_seek()\fR on a file \s-1BIO\s0 for a successful operation. +the case of \fIBIO_seek()\fR on a file \s-1BIO\s0 for a successful operation. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1TBA\s0 Modified: head/secure/lib/libcrypto/man/BIO_f_base64.3 ============================================================================== --- head/secure/lib/libcrypto/man/BIO_f_base64.3 Mon Nov 22 18:23:44 2010 (r215697) +++ head/secure/lib/libcrypto/man/BIO_f_base64.3 Mon Nov 22 18:29:00 2010 (r215698) @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -25,11 +17,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -48,22 +40,25 @@ . ds R" '' 'br\} .\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.if \nF \{\ +.ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na +.el \{\ +. de IX +.. +.\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,7 +124,11 @@ .\" ======================================================================== .\" .IX Title "BIO_f_base64 3" -.TH BIO_f_base64 3 "2010-03-24" "0.9.8n" "OpenSSL" +.TH BIO_f_base64 3 "2010-11-16" "0.9.8p" "OpenSSL" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh .SH "NAME" BIO_f_base64 \- base64 BIO filter .SH "SYNOPSIS" @@ -137,9 +136,7 @@ BIO_f_base64 \- base64 BIO filter .Vb 2 \& #include \& #include -.Ve -.PP -.Vb 1 +\& \& BIO_METHOD * BIO_f_base64(void); .Ve .SH "DESCRIPTION" @@ -148,7 +145,7 @@ BIO_f_base64 \- base64 BIO filter \&\s-1BIO\s0 that base64 encodes any data written through it and decodes any data read through it. .PP -Base64 BIOs do not support \fIBIO_gets()\fR or \fIBIO_puts()\fR. +Base64 BIOs do not support \fIBIO_gets()\fR or \fIBIO_puts()\fR. .PP \&\fIBIO_flush()\fR on a base64 \s-1BIO\s0 that is being written through is used to signal that no more data is to be encoded: this is used @@ -172,17 +169,13 @@ to standard output: .Vb 2 \& BIO *bio, *b64; \& char message[] = "Hello World \en"; -.Ve -.PP -.Vb 5 +\& \& b64 = BIO_new(BIO_f_base64()); \& bio = BIO_new_fp(stdout, BIO_NOCLOSE); \& bio = BIO_push(b64, bio); \& BIO_write(bio, message, strlen(message)); \& BIO_flush(bio); -.Ve -.PP -.Vb 1 +\& \& BIO_free_all(bio); .Ve .PP @@ -193,18 +186,14 @@ data to standard output: \& BIO *bio, *b64, *bio_out; \& char inbuf[512]; \& int inlen; -.Ve -.PP -.Vb 6 +\& \& b64 = BIO_new(BIO_f_base64()); \& bio = BIO_new_fp(stdin, BIO_NOCLOSE); \& bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); \& bio = BIO_push(b64, bio); \& while((inlen = BIO_read(bio, inbuf, 512)) > 0) \& BIO_write(bio_out, inbuf, inlen); -.Ve -.PP -.Vb 1 +\& \& BIO_free_all(bio); .Ve .SH "BUGS" Modified: head/secure/lib/libcrypto/man/BIO_f_buffer.3 ============================================================================== --- head/secure/lib/libcrypto/man/BIO_f_buffer.3 Mon Nov 22 18:23:44 2010 (r215697) +++ head/secure/lib/libcrypto/man/BIO_f_buffer.3 Mon Nov 22 18:29:00 2010 (r215698) @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -25,11 +17,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -48,22 +40,25 @@ . ds R" '' 'br\} .\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.if \nF \{\ +.ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na +.el \{\ +. de IX +.. +.\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,20 +124,20 @@ .\" ======================================================================== .\" .IX Title "BIO_f_buffer 3" -.TH BIO_f_buffer 3 "2010-03-24" "0.9.8n" "OpenSSL" +.TH BIO_f_buffer 3 "2010-11-16" "0.9.8p" "OpenSSL" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh .SH "NAME" BIO_f_buffer \- buffering BIO .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include -.Ve -.PP -.Vb 1 +\& \& BIO_METHOD * BIO_f_buffer(void); -.Ve *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 19:01:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D373106567A; Mon, 22 Nov 2010 19:01:48 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C5418FC1A; Mon, 22 Nov 2010 19:01:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMJ1mkl002254; Mon, 22 Nov 2010 19:01:48 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMJ1m5X002252; Mon, 22 Nov 2010 19:01:48 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201011221901.oAMJ1m5X002252@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 22 Nov 2010 19:01:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215699 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 19:01:48 -0000 Author: bschmidt Date: Mon Nov 22 19:01:47 2010 New Revision: 215699 URL: http://svn.freebsd.org/changeset/base/215699 Log: The meshid element is memcpy()'ed into se_meshid if included in either beacon or probe-response frames. Fix the condition by checking for the the array's content instead of the always existing array itself. Reviewed by: rpaulo, stefanf MFC after: 3 days Modified: head/sys/net80211/ieee80211_scan_sta.c Modified: head/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sta.c Mon Nov 22 18:29:00 2010 (r215698) +++ head/sys/net80211/ieee80211_scan_sta.c Mon Nov 22 19:01:47 2010 (r215699) @@ -1013,7 +1013,7 @@ match_bss(struct ieee80211vap *vap, */ if (se->se_capinfo & (IEEE80211_CAPINFO_IBSS|IEEE80211_CAPINFO_ESS)) fail |= MATCH_CAPINFO; - else if (&se->se_meshid == NULL) + else if (se->se_meshid[0] != IEEE80211_ELEMID_MESHID) fail |= MATCH_MESH_NOID; else if (ms->ms_idlen != 0 && match_id(se->se_meshid, ms->ms_id, ms->ms_idlen)) From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 19:21:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABDDB10657A8; Mon, 22 Nov 2010 19:21:14 +0000 (UTC) (envelope-from erik@cederstrand.dk) Received: from csmtp2.one.com (csmtp2.one.com [91.198.169.22]) by mx1.freebsd.org (Postfix) with ESMTP id 51CB28FC13; Mon, 22 Nov 2010 19:21:14 +0000 (UTC) Received: from macfeast.lan (0x573b9942.cpe.ge-1-2-0-1101.ronqu1.customer.tele.dk [87.59.153.66]) by csmtp2.one.com (Postfix) with ESMTPA id 365AED58F5912; Mon, 22 Nov 2010 19:02:07 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: multipart/signed; boundary=Apple-Mail-1-760198070; protocol="application/pkcs7-signature"; micalg=sha1 From: Erik Cederstrand In-Reply-To: <201011221242.oAMCgW9O092144@svn.freebsd.org> Date: Mon, 22 Nov 2010 20:02:06 +0100 Message-Id: <32292B2D-6D71-4AA5-A0AE-41E2D713293A@cederstrand.dk> References: <201011221242.oAMCgW9O092144@svn.freebsd.org> To: Alexander Leidinger X-Mailer: Apple Mail (2.1082) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215675 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 19:21:14 -0000 --Apple-Mail-1-760198070 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Den 22/11/2010 kl. 13.42 skrev Alexander Leidinger: > Author: netchild > Date: Mon Nov 22 12:42:32 2010 > New Revision: 215675 > URL: http://svn.freebsd.org/changeset/base/215675 >=20 > Log: > Do not take the process lock. The assignment to u_short inside the > properly aligned structure is atomic on all supported architectures, = and > the thread that should see side-effect of assignment is the same = thread > that does assignment. >=20 > Use a more appropriate conditional to detect the linux ABI. >=20 > Suggested by: kib > X-MFC: together with r215664 >=20 > Modified: > head/sys/compat/linux/linux_emul.c >=20 > Modified: head/sys/compat/linux/linux_emul.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/compat/linux/linux_emul.c Mon Nov 22 12:33:48 2010 = (r215674) > +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 12:42:32 2010 = (r215675) > @@ -198,11 +198,8 @@ linux_proc_exit(void *arg __unused, stru > } else=09 > EMUL_SHARED_WUNLOCK(&emul_shared_lock); >=20 > - if ((shared_flags & EMUL_SHARED_HASXSTAT) !=3D 0) { > - PROC_LOCK(p); > + if ((shared_flags & EMUL_SHARED_HASXSTAT) !=3D 0) > p->p_xstat =3D shared_xstat; > - PROC_UNLOCK(p); > - } >=20 > if (child_clear_tid !=3D NULL) { > struct linux_sys_futex_args cup; > @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru > if (__predict_false(imgp->sysent =3D=3D &elf_linux_sysvec > && p->p_sysent !=3D &elf_linux_sysvec)) > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > - if (__predict_false(p->p_sysent =3D=3D &elf_linux_sysvec)) > + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) =3D=3D > + SV_ABI_LINUX)) > /* Kill threads regardless of imgp->sysent value */ > linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > if (__predict_false(imgp->sysent !=3D &elf_linux_sysvec This breaks make buildkernel for me (8.1 RELEASE host): = /usr/home/erik/freebsd/head/src/sys/modules/linux/../../compat/linux/linux= _emul.c: In function 'linux_proc_exec': = /usr/home/erik/freebsd/head/src/sys/modules/linux/../../compat/linux/linux= _emul.c:265: error: dereferencing pointer to incomplete type = /usr/home/erik/freebsd/head/src/sys/modules/linux/../../compat/linux/linux= _emul.c:265: error: 'SV_ABI_MASK' undeclared (first use in this = function) Erik= --Apple-Mail-1-760198070-- From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 19:32:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09883106566B; Mon, 22 Nov 2010 19:32:55 +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 E93228FC12; Mon, 22 Nov 2010 19:32:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMJWslR003144; Mon, 22 Nov 2010 19:32:54 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMJWsPs003103; Mon, 22 Nov 2010 19:32:54 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201011221932.oAMJWsPs003103@svn.freebsd.org> From: Dimitry Andric Date: Mon, 22 Nov 2010 19:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215701 - in head/sys: kern mips/mips mips/rmi net netgraph netinet netinet/ipfw netinet6 netipsec powerpc/aim powerpc/booke sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 19:32:55 -0000 Author: dim Date: Mon Nov 22 19:32:54 2010 New Revision: 215701 URL: http://svn.freebsd.org/changeset/base/215701 Log: After some off-list discussion, revert a number of changes to the DPCPU_DEFINE and VNET_DEFINE macros, as these cause problems for various people working on the affected files. A better long-term solution is still being considered. This reversal may give some modules empty set_pcpu or set_vnet sections, but these are harmless. Changes reverted: ------------------------------------------------------------------------ r215318 | dim | 2010-11-14 21:40:55 +0100 (Sun, 14 Nov 2010) | 4 lines Instead of unconditionally emitting .globl's for the __start_set_xxx and __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu sections are actually defined. ------------------------------------------------------------------------ r215317 | dim | 2010-11-14 21:38:11 +0100 (Sun, 14 Nov 2010) | 3 lines Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout the tree. ------------------------------------------------------------------------ r215316 | dim | 2010-11-14 21:23:02 +0100 (Sun, 14 Nov 2010) | 2 lines Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE. Modified: head/sys/kern/kern_clock.c head/sys/kern/kern_clocksource.c head/sys/kern/sched_4bsd.c head/sys/kern/subr_pcpu.c head/sys/mips/mips/tick.c head/sys/mips/rmi/tick.c head/sys/net/flowtable.c head/sys/net/if.c head/sys/net/if_clone.c head/sys/net/if_ethersubr.c head/sys/net/if_gif.c head/sys/net/if_llatbl.c head/sys/net/if_loop.c head/sys/net/route.c head/sys/net/vnet.c head/sys/net/vnet.h head/sys/netgraph/ng_base.c head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_iface.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_pcb.c head/sys/netinet/in_rmx.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_input.c head/sys/netinet/ip_ipsec.c head/sys/netinet/ip_mroute.c head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_dynamic.c head/sys/netinet/ipfw/ip_fw_nat.c head/sys/netinet/ipfw/ip_fw_pfil.c head/sys/netinet/siftr.c head/sys/netinet/tcp_hostcache.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timewait.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_ipsec.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/scope6.c head/sys/netinet6/send.c head/sys/netipsec/key.c head/sys/netipsec/keysock.c head/sys/netipsec/xform_esp.c head/sys/powerpc/aim/clock.c head/sys/powerpc/booke/clock.c head/sys/sys/cdefs.h head/sys/sys/linker_set.h head/sys/sys/pcpu.h Modified: head/sys/kern/kern_clock.c ============================================================================== --- head/sys/kern/kern_clock.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/kern/kern_clock.c Mon Nov 22 19:32:54 2010 (r215701) @@ -373,7 +373,7 @@ int profprocs; int ticks; int psratio; -STATIC_DPCPU_DEFINE(int, pcputicks); /* Per-CPU version of ticks. */ +static DPCPU_DEFINE(int, pcputicks); /* Per-CPU version of ticks. */ static int global_hardclock_run = 0; /* Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/kern/kern_clocksource.c Mon Nov 22 19:32:54 2010 (r215701) @@ -135,7 +135,7 @@ struct pcpu_state { int idle; /* This CPU is in idle mode. */ }; -STATIC_DPCPU_DEFINE(struct pcpu_state, timerstate); +static DPCPU_DEFINE(struct pcpu_state, timerstate); #define FREQ2BT(freq, bt) \ { \ Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/kern/sched_4bsd.c Mon Nov 22 19:32:54 2010 (r215701) @@ -161,7 +161,7 @@ struct pcpuidlestat { u_int idlecalls; u_int oldidlecalls; }; -STATIC_DPCPU_DEFINE(struct pcpuidlestat, idlestat); +static DPCPU_DEFINE(struct pcpuidlestat, idlestat); static void setup_runqs(void) Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/kern/subr_pcpu.c Mon Nov 22 19:32:54 2010 (r215701) @@ -70,7 +70,7 @@ struct dpcpu_free { TAILQ_ENTRY(dpcpu_free) df_link; }; -STATIC_DPCPU_DEFINE(char, modspace[DPCPU_MODMIN]); +static DPCPU_DEFINE(char, modspace[DPCPU_MODMIN]); static TAILQ_HEAD(, dpcpu_free) dpcpu_head = TAILQ_HEAD_INITIALIZER(dpcpu_head); static struct sx dpcpu_lock; uintptr_t dpcpu_off[MAXCPU]; Modified: head/sys/mips/mips/tick.c ============================================================================== --- head/sys/mips/mips/tick.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/mips/mips/tick.c Mon Nov 22 19:32:54 2010 (r215701) @@ -57,13 +57,13 @@ uint64_t counter_freq; struct timecounter *platform_timecounter; -STATIC_DPCPU_DEFINE(uint32_t, cycles_per_tick); +static DPCPU_DEFINE(uint32_t, cycles_per_tick); static uint32_t cycles_per_usec; -STATIC_DPCPU_DEFINE(volatile uint32_t, counter_upper); -STATIC_DPCPU_DEFINE(volatile uint32_t, counter_lower_last); -STATIC_DPCPU_DEFINE(uint32_t, compare_ticks); -STATIC_DPCPU_DEFINE(uint32_t, lost_ticks); +static DPCPU_DEFINE(volatile uint32_t, counter_upper); +static DPCPU_DEFINE(volatile uint32_t, counter_lower_last); +static DPCPU_DEFINE(uint32_t, compare_ticks); +static DPCPU_DEFINE(uint32_t, lost_ticks); struct clock_softc { int intr_rid; Modified: head/sys/mips/rmi/tick.c ============================================================================== --- head/sys/mips/rmi/tick.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/mips/rmi/tick.c Mon Nov 22 19:32:54 2010 (r215701) @@ -59,13 +59,13 @@ uint64_t counter_freq; struct timecounter *platform_timecounter; -STATIC_DPCPU_DEFINE(uint32_t, cycles_per_tick); +static DPCPU_DEFINE(uint32_t, cycles_per_tick); static uint32_t cycles_per_usec; -STATIC_DPCPU_DEFINE(volatile uint32_t, counter_upper); -STATIC_DPCPU_DEFINE(volatile uint32_t, counter_lower_last); -STATIC_DPCPU_DEFINE(uint32_t, compare_ticks); -STATIC_DPCPU_DEFINE(uint32_t, lost_ticks); +static DPCPU_DEFINE(volatile uint32_t, counter_upper); +static DPCPU_DEFINE(volatile uint32_t, counter_lower_last); +static DPCPU_DEFINE(uint32_t, compare_ticks); +static DPCPU_DEFINE(uint32_t, lost_ticks); struct clock_softc { int intr_rid; Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/flowtable.c Mon Nov 22 19:32:54 2010 (r215701) @@ -184,10 +184,10 @@ struct flowtable { } __aligned(CACHE_LINE_SIZE); static struct proc *flowcleanerproc; -STATIC_VNET_DEFINE(struct flowtable *, flow_list_head); -STATIC_VNET_DEFINE(uint32_t, flow_hashjitter); -STATIC_VNET_DEFINE(uma_zone_t, flow_ipv4_zone); -STATIC_VNET_DEFINE(uma_zone_t, flow_ipv6_zone); +static VNET_DEFINE(struct flowtable *, flow_list_head); +static VNET_DEFINE(uint32_t, flow_hashjitter); +static VNET_DEFINE(uma_zone_t, flow_ipv4_zone); +static VNET_DEFINE(uma_zone_t, flow_ipv6_zone); #define V_flow_list_head VNET(flow_list_head) #define V_flow_hashjitter VNET(flow_hashjitter) @@ -230,13 +230,13 @@ do { \ * - idetach() cleanup for options VIMAGE builds. */ VNET_DEFINE(int, flowtable_enable) = 1; -STATIC_VNET_DEFINE(int, flowtable_debug); -STATIC_VNET_DEFINE(int, flowtable_syn_expire) = SYN_IDLE; -STATIC_VNET_DEFINE(int, flowtable_udp_expire) = UDP_IDLE; -STATIC_VNET_DEFINE(int, flowtable_fin_wait_expire) = FIN_WAIT_IDLE; -STATIC_VNET_DEFINE(int, flowtable_tcp_expire) = TCP_IDLE; -STATIC_VNET_DEFINE(int, flowtable_nmbflows); -STATIC_VNET_DEFINE(int, flowtable_ready) = 0; +static VNET_DEFINE(int, flowtable_debug); +static VNET_DEFINE(int, flowtable_syn_expire) = SYN_IDLE; +static VNET_DEFINE(int, flowtable_udp_expire) = UDP_IDLE; +static VNET_DEFINE(int, flowtable_fin_wait_expire) = FIN_WAIT_IDLE; +static VNET_DEFINE(int, flowtable_tcp_expire) = TCP_IDLE; +static VNET_DEFINE(int, flowtable_nmbflows); +static VNET_DEFINE(int, flowtable_ready) = 0; #define V_flowtable_enable VNET(flowtable_enable) #define V_flowtable_debug VNET(flowtable_debug) Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/if.c Mon Nov 22 19:32:54 2010 (r215701) @@ -183,7 +183,7 @@ int ifqmaxlen = IFQ_MAXLEN; VNET_DEFINE(struct ifnethead, ifnet); /* depend on static init XXX */ VNET_DEFINE(struct ifgrouphead, ifg_head); -STATIC_VNET_DEFINE(int, if_indexlim) = 8; +static VNET_DEFINE(int, if_indexlim) = 8; /* Table of ifnet by index. */ VNET_DEFINE(struct ifindex_entry *, ifindex_table); Modified: head/sys/net/if_clone.c ============================================================================== --- head/sys/net/if_clone.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/if_clone.c Mon Nov 22 19:32:54 2010 (r215701) @@ -56,7 +56,7 @@ static int if_clone_createif(struct if_c caddr_t params); static struct mtx if_cloners_mtx; -STATIC_VNET_DEFINE(int, if_cloners_count); +static VNET_DEFINE(int, if_cloners_count); VNET_DEFINE(LIST_HEAD(, if_clone), if_cloners); #define V_if_cloners_count VNET(if_cloners_count) Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/if_ethersubr.c Mon Nov 22 19:32:54 2010 (r215701) @@ -144,7 +144,7 @@ MALLOC_DEFINE(M_ARPCOM, "arpcom", "802.* #if defined(INET) || defined(INET6) int ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst, int shared); -STATIC_VNET_DEFINE(int, ether_ipfw); +static VNET_DEFINE(int, ether_ipfw); #define V_ether_ipfw VNET(ether_ipfw) #endif Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/if_gif.c Mon Nov 22 19:32:54 2010 (r215701) @@ -94,7 +94,7 @@ */ static struct mtx gif_mtx; static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface"); -STATIC_VNET_DEFINE(LIST_HEAD(, gif_softc), gif_softc_list); +static VNET_DEFINE(LIST_HEAD(, gif_softc), gif_softc_list); #define V_gif_softc_list VNET(gif_softc_list) void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, int af); @@ -124,7 +124,7 @@ SYSCTL_NODE(_net_link, IFT_GIF, gif, CTL */ #define MAX_GIF_NEST 1 #endif -STATIC_VNET_DEFINE(int, max_gif_nesting) = MAX_GIF_NEST; +static VNET_DEFINE(int, max_gif_nesting) = MAX_GIF_NEST; #define V_max_gif_nesting VNET(max_gif_nesting) SYSCTL_VNET_INT(_net_link_gif, OID_AUTO, max_nesting, CTLFLAG_RW, &VNET_NAME(max_gif_nesting), 0, "Max nested tunnels"); @@ -135,9 +135,9 @@ SYSCTL_VNET_INT(_net_link_gif, OID_AUTO, * we allow control over this check here. */ #ifdef XBONEHACK -STATIC_VNET_DEFINE(int, parallel_tunnels) = 1; +static VNET_DEFINE(int, parallel_tunnels) = 1; #else -STATIC_VNET_DEFINE(int, parallel_tunnels) = 0; +static VNET_DEFINE(int, parallel_tunnels) = 0; #endif #define V_parallel_tunnels VNET(parallel_tunnels) SYSCTL_VNET_INT(_net_link_gif, OID_AUTO, parallel_tunnels, CTLFLAG_RW, Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/if_llatbl.c Mon Nov 22 19:32:54 2010 (r215701) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_LLTABLE, "lltable", "link level address tables"); -STATIC_VNET_DEFINE(SLIST_HEAD(, lltable), lltables); +static VNET_DEFINE(SLIST_HEAD(, lltable), lltables); #define V_lltables VNET(lltables) extern void arprequest(struct ifnet *, struct in_addr *, struct in_addr *, Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/if_loop.c Mon Nov 22 19:32:54 2010 (r215701) @@ -106,8 +106,8 @@ static void lo_clone_destroy(struct ifne VNET_DEFINE(struct ifnet *, loif); /* Used externally */ #ifdef VIMAGE -STATIC_VNET_DEFINE(struct ifc_simple_data, lo_cloner_data); -STATIC_VNET_DEFINE(struct if_clone, lo_cloner); +static VNET_DEFINE(struct ifc_simple_data, lo_cloner_data); +static VNET_DEFINE(struct if_clone, lo_cloner); #define V_lo_cloner_data VNET(lo_cloner_data) #define V_lo_cloner VNET(lo_cloner) #endif Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/route.c Mon Nov 22 19:32:54 2010 (r215701) @@ -113,7 +113,7 @@ VNET_DEFINE(int, rttrash); /* routes no */ #define RNTORT(p) ((struct rtentry *)(p)) -STATIC_VNET_DEFINE(uma_zone_t, rtzone); /* Routing table UMA zone. */ +static VNET_DEFINE(uma_zone_t, rtzone); /* Routing table UMA zone. */ #define V_rtzone VNET(rtzone) #if 0 Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/vnet.c Mon Nov 22 19:32:54 2010 (r215701) @@ -177,7 +177,7 @@ MALLOC_DEFINE(M_VNET_DATA, "vnet_data", * Space to store virtualized global variables from loadable kernel modules, * and the free list to manage it. */ -STATIC_VNET_DEFINE(char, modspace[VNET_MODMIN]); +static VNET_DEFINE(char, modspace[VNET_MODMIN]); /* * Global lists of subsystem constructor and destructors for vnets. They are Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/net/vnet.h Mon Nov 22 19:32:54 2010 (r215701) @@ -95,7 +95,9 @@ struct vnet { * Location of the kernel's 'set_vnet' linker set. */ extern uintptr_t *__start_set_vnet; +__GLOBL(__start_set_vnet); extern uintptr_t *__stop_set_vnet; +__GLOBL(__stop_set_vnet); #define VNET_START (uintptr_t)&__start_set_vnet #define VNET_STOP (uintptr_t)&__stop_set_vnet @@ -193,14 +195,9 @@ extern struct sx vnet_sxlock; */ #define VNET_NAME(n) vnet_entry_##n #define VNET_DECLARE(t, n) extern t VNET_NAME(n) -#define VNET_DEFINE(t, n) \ - __GLOBL("__start_" VNET_SETNAME); \ - __GLOBL("__stop_" VNET_SETNAME); \ - t VNET_NAME(n) __section(VNET_SETNAME) __used -#define STATIC_VNET_DEFINE(t, n) \ - VNET_DEFINE(static t, n) -#define _VNET_PTR(b, n) \ - (__typeof(VNET_NAME(n))*)((b) + (uintptr_t)&VNET_NAME(n)) +#define VNET_DEFINE(t, n) t VNET_NAME(n) __section(VNET_SETNAME) __used +#define _VNET_PTR(b, n) (__typeof(VNET_NAME(n))*) \ + ((b) + (uintptr_t)&VNET_NAME(n)) #define _VNET(b, n) (*_VNET_PTR(b, n)) @@ -374,11 +371,10 @@ do { \ * Versions of the VNET macros that compile to normal global variables and * standard sysctl definitions. */ -#define VNET_NAME(n) n -#define VNET_DECLARE(t, n) extern t n -#define VNET_DEFINE(t, n) t n -#define STATIC_VNET_DEFINE(t, n) static t n -#define _VNET_PTR(b, n) &VNET_NAME(n) +#define VNET_NAME(n) n +#define VNET_DECLARE(t, n) extern t n +#define VNET_DEFINE(t, n) t n +#define _VNET_PTR(b, n) &VNET_NAME(n) /* * Virtualized global variable accessor macros. Modified: head/sys/netgraph/ng_base.c ============================================================================== --- head/sys/netgraph/ng_base.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netgraph/ng_base.c Mon Nov 22 19:32:54 2010 (r215701) @@ -171,7 +171,7 @@ static struct mtx ng_typelist_mtx; /* 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]); +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; @@ -189,7 +189,7 @@ static struct mtx ng_idhash_mtx; } \ } while (0) -STATIC_VNET_DEFINE(LIST_HEAD(, ng_node), ng_name_hash[NG_NAME_HASH_SIZE]); +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; @@ -359,7 +359,7 @@ ng_alloc_node(void) #define TRAP_ERROR() #endif -STATIC_VNET_DEFINE(ng_ID_t, nextID) = 1; +static VNET_DEFINE(ng_ID_t, nextID) = 1; #define V_nextID VNET(nextID) #ifdef INVARIANTS Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netgraph/ng_eiface.c Mon Nov 22 19:32:54 2010 (r215701) @@ -114,7 +114,7 @@ static struct ng_type typestruct = { }; NETGRAPH_INIT(eiface, &typestruct); -STATIC_VNET_DEFINE(struct unrhdr *, ng_eiface_unit); +static VNET_DEFINE(struct unrhdr *, ng_eiface_unit); #define V_ng_eiface_unit VNET(ng_eiface_unit) /************************************************************************ Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netgraph/ng_iface.c Mon Nov 22 19:32:54 2010 (r215701) @@ -210,7 +210,7 @@ static struct ng_type typestruct = { }; NETGRAPH_INIT(iface, &typestruct); -STATIC_VNET_DEFINE(struct unrhdr *, ng_iface_unit); +static VNET_DEFINE(struct unrhdr *, ng_iface_unit); #define V_ng_iface_unit VNET(ng_iface_unit) /************************************************************************ Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/if_ether.c Mon Nov 22 19:32:54 2010 (r215701) @@ -81,17 +81,17 @@ SYSCTL_NODE(_net_link_ether, PF_INET, in SYSCTL_NODE(_net_link_ether, PF_ARP, arp, CTLFLAG_RW, 0, ""); /* timer values */ -STATIC_VNET_DEFINE(int, arpt_keep) = (20*60); /* once resolved, good for 20 +static VNET_DEFINE(int, arpt_keep) = (20*60); /* once resolved, good for 20 * minutes */ -STATIC_VNET_DEFINE(int, arp_maxtries) = 5; +static VNET_DEFINE(int, arp_maxtries) = 5; VNET_DEFINE(int, useloopback) = 1; /* use loopback interface for * local traffic */ -STATIC_VNET_DEFINE(int, arp_proxyall) = 0; -STATIC_VNET_DEFINE(int, arpt_down) = 20; /* keep incomplete entries for +static VNET_DEFINE(int, arp_proxyall) = 0; +static VNET_DEFINE(int, arpt_down) = 20; /* keep incomplete entries for * 20 seconds */ VNET_DEFINE(struct arpstat, arpstat); /* ARP statistics, see if_arp.h */ -STATIC_VNET_DEFINE(int, arp_maxhold) = 1; +static VNET_DEFINE(int, arp_maxhold) = 1; #define V_arpt_keep VNET(arpt_keep) #define V_arpt_down VNET(arpt_down) Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/igmp.c Mon Nov 22 19:32:54 2010 (r215701) @@ -206,11 +206,11 @@ MALLOC_DEFINE(M_IGMP, "igmp", "igmp stat * FUTURE: Stop using IFP_TO_IA/INADDR_ANY, and use source address selection * policy to control the address used by IGMP on the link. */ -STATIC_VNET_DEFINE(int, interface_timers_running); /* IGMPv3 general +static VNET_DEFINE(int, interface_timers_running); /* IGMPv3 general * query response */ -STATIC_VNET_DEFINE(int, state_change_timers_running); /* IGMPv3 state-change +static VNET_DEFINE(int, state_change_timers_running); /* IGMPv3 state-change * retransmit */ -STATIC_VNET_DEFINE(int, current_state_timers_running); /* IGMPv1/v2 host +static VNET_DEFINE(int, current_state_timers_running); /* IGMPv1/v2 host * report; IGMPv3 g/sg * query response */ @@ -218,24 +218,24 @@ STATIC_VNET_DEFINE(int, current_state_ti #define V_state_change_timers_running VNET(state_change_timers_running) #define V_current_state_timers_running VNET(current_state_timers_running) -STATIC_VNET_DEFINE(LIST_HEAD(, igmp_ifinfo), igi_head); -STATIC_VNET_DEFINE(struct igmpstat, igmpstat) = { +static VNET_DEFINE(LIST_HEAD(, igmp_ifinfo), igi_head); +static VNET_DEFINE(struct igmpstat, igmpstat) = { .igps_version = IGPS_VERSION_3, .igps_len = sizeof(struct igmpstat), }; -STATIC_VNET_DEFINE(struct timeval, igmp_gsrdelay) = {10, 0}; +static VNET_DEFINE(struct timeval, igmp_gsrdelay) = {10, 0}; #define V_igi_head VNET(igi_head) #define V_igmpstat VNET(igmpstat) #define V_igmp_gsrdelay VNET(igmp_gsrdelay) -STATIC_VNET_DEFINE(int, igmp_recvifkludge) = 1; -STATIC_VNET_DEFINE(int, igmp_sendra) = 1; -STATIC_VNET_DEFINE(int, igmp_sendlocal) = 1; -STATIC_VNET_DEFINE(int, igmp_v1enable) = 1; -STATIC_VNET_DEFINE(int, igmp_v2enable) = 1; -STATIC_VNET_DEFINE(int, igmp_legacysupp); -STATIC_VNET_DEFINE(int, igmp_default_version) = IGMP_VERSION_3; +static VNET_DEFINE(int, igmp_recvifkludge) = 1; +static VNET_DEFINE(int, igmp_sendra) = 1; +static VNET_DEFINE(int, igmp_sendlocal) = 1; +static VNET_DEFINE(int, igmp_v1enable) = 1; +static VNET_DEFINE(int, igmp_v2enable) = 1; +static VNET_DEFINE(int, igmp_legacysupp); +static VNET_DEFINE(int, igmp_default_version) = IGMP_VERSION_3; #define V_igmp_recvifkludge VNET(igmp_recvifkludge) #define V_igmp_sendra VNET(igmp_sendra) Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/in.c Mon Nov 22 19:32:54 2010 (r215701) @@ -76,12 +76,12 @@ static int in_ifinit(struct ifnet *, struct in_ifaddr *, struct sockaddr_in *, int); static void in_purgemaddrs(struct ifnet *); -STATIC_VNET_DEFINE(int, subnetsarelocal); +static VNET_DEFINE(int, subnetsarelocal); #define V_subnetsarelocal VNET(subnetsarelocal) SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, subnets_are_local, CTLFLAG_RW, &VNET_NAME(subnetsarelocal), 0, "Treat all subnets as directly connected"); -STATIC_VNET_DEFINE(int, sameprefixcarponly); +static VNET_DEFINE(int, sameprefixcarponly); #define V_sameprefixcarponly VNET(sameprefixcarponly) SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, same_prefix_carp_only, CTLFLAG_RW, &VNET_NAME(sameprefixcarponly), 0, Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/in_pcb.c Mon Nov 22 19:32:54 2010 (r215701) @@ -108,7 +108,7 @@ VNET_DEFINE(int, ipport_randomcps) = 10; VNET_DEFINE(int, ipport_randomtime) = 45; /* user controlled via sysctl */ VNET_DEFINE(int, ipport_stoprandom); /* toggled by ipport_tick */ VNET_DEFINE(int, ipport_tcpallocs); -STATIC_VNET_DEFINE(int, ipport_tcplastcount); +static VNET_DEFINE(int, ipport_tcplastcount); #define V_ipport_tcplastcount VNET(ipport_tcplastcount) Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/in_rmx.c Mon Nov 22 19:32:54 2010 (r215701) @@ -132,21 +132,21 @@ in_matroute(void *v_arg, struct radix_no return rn; } -STATIC_VNET_DEFINE(int, rtq_reallyold) = 60*60; /* one hour is "really old" */ +static VNET_DEFINE(int, rtq_reallyold) = 60*60; /* one hour is "really old" */ #define V_rtq_reallyold VNET(rtq_reallyold) SYSCTL_VNET_INT(_net_inet_ip, IPCTL_RTEXPIRE, rtexpire, CTLFLAG_RW, &VNET_NAME(rtq_reallyold), 0, "Default expiration time on dynamically learned routes"); /* never automatically crank down to less */ -STATIC_VNET_DEFINE(int, rtq_minreallyold) = 10; +static VNET_DEFINE(int, rtq_minreallyold) = 10; #define V_rtq_minreallyold VNET(rtq_minreallyold) SYSCTL_VNET_INT(_net_inet_ip, IPCTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW, &VNET_NAME(rtq_minreallyold), 0, "Minimum time to attempt to hold onto dynamically learned routes"); /* 128 cached routes is "too many" */ -STATIC_VNET_DEFINE(int, rtq_toomany) = 128; +static VNET_DEFINE(int, rtq_toomany) = 128; #define V_rtq_toomany VNET(rtq_toomany) SYSCTL_VNET_INT(_net_inet_ip, IPCTL_RTMAXCACHE, rtmaxcache, CTLFLAG_RW, &VNET_NAME(rtq_toomany), 0, @@ -240,8 +240,8 @@ in_rtqkill(struct radix_node *rn, void * } #define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ -STATIC_VNET_DEFINE(int, rtq_timeout) = RTQ_TIMEOUT; -STATIC_VNET_DEFINE(struct callout, rtq_timer); +static VNET_DEFINE(int, rtq_timeout) = RTQ_TIMEOUT; +static VNET_DEFINE(struct callout, rtq_timer); #define V_rtq_timeout VNET(rtq_timeout) #define V_rtq_timer VNET(rtq_timer) Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ip_divert.c Mon Nov 22 19:32:54 2010 (r215701) @@ -105,8 +105,8 @@ __FBSDID("$FreeBSD$"); */ /* Internal variables. */ -STATIC_VNET_DEFINE(struct inpcbhead, divcb); -STATIC_VNET_DEFINE(struct inpcbinfo, divcbinfo); +static VNET_DEFINE(struct inpcbhead, divcb); +static VNET_DEFINE(struct inpcbinfo, divcbinfo); #define V_divcb VNET(divcb) #define V_divcbinfo VNET(divcbinfo) Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ip_fastfwd.c Mon Nov 22 19:32:54 2010 (r215701) @@ -106,7 +106,7 @@ __FBSDID("$FreeBSD$"); #include -STATIC_VNET_DEFINE(int, ipfastforward_active); +static VNET_DEFINE(int, ipfastforward_active); #define V_ipfastforward_active VNET(ipfastforward_active) SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, fastforwarding, CTLFLAG_RW, Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ip_icmp.c Mon Nov 22 19:32:54 2010 (r215701) @@ -80,55 +80,55 @@ VNET_DEFINE(struct icmpstat, icmpstat); SYSCTL_VNET_STRUCT(_net_inet_icmp, ICMPCTL_STATS, stats, CTLFLAG_RW, &VNET_NAME(icmpstat), icmpstat, ""); -STATIC_VNET_DEFINE(int, icmpmaskrepl) = 0; +static VNET_DEFINE(int, icmpmaskrepl) = 0; #define V_icmpmaskrepl VNET(icmpmaskrepl) SYSCTL_VNET_INT(_net_inet_icmp, ICMPCTL_MASKREPL, maskrepl, CTLFLAG_RW, &VNET_NAME(icmpmaskrepl), 0, "Reply to ICMP Address Mask Request packets."); -STATIC_VNET_DEFINE(u_int, icmpmaskfake) = 0; +static VNET_DEFINE(u_int, icmpmaskfake) = 0; #define V_icmpmaskfake VNET(icmpmaskfake) SYSCTL_VNET_UINT(_net_inet_icmp, OID_AUTO, maskfake, CTLFLAG_RW, &VNET_NAME(icmpmaskfake), 0, "Fake reply to ICMP Address Mask Request packets."); -STATIC_VNET_DEFINE(int, drop_redirect) = 0; +static VNET_DEFINE(int, drop_redirect) = 0; #define V_drop_redirect VNET(drop_redirect) SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, drop_redirect, CTLFLAG_RW, &VNET_NAME(drop_redirect), 0, "Ignore ICMP redirects"); -STATIC_VNET_DEFINE(int, log_redirect) = 0; +static VNET_DEFINE(int, log_redirect) = 0; #define V_log_redirect VNET(log_redirect) SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, log_redirect, CTLFLAG_RW, &VNET_NAME(log_redirect), 0, "Log ICMP redirects to the console"); -STATIC_VNET_DEFINE(int, icmplim) = 200; +static VNET_DEFINE(int, icmplim) = 200; #define V_icmplim VNET(icmplim) SYSCTL_VNET_INT(_net_inet_icmp, ICMPCTL_ICMPLIM, icmplim, CTLFLAG_RW, &VNET_NAME(icmplim), 0, "Maximum number of ICMP responses per second"); -STATIC_VNET_DEFINE(int, icmplim_output) = 1; +static VNET_DEFINE(int, icmplim_output) = 1; #define V_icmplim_output VNET(icmplim_output) SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, icmplim_output, CTLFLAG_RW, &VNET_NAME(icmplim_output), 0, "Enable rate limiting of ICMP responses"); -STATIC_VNET_DEFINE(char, reply_src[IFNAMSIZ]); +static VNET_DEFINE(char, reply_src[IFNAMSIZ]); #define V_reply_src VNET(reply_src) SYSCTL_VNET_STRING(_net_inet_icmp, OID_AUTO, reply_src, CTLFLAG_RW, &VNET_NAME(reply_src), IFNAMSIZ, "icmp reply source for non-local packets."); -STATIC_VNET_DEFINE(int, icmp_rfi) = 0; +static VNET_DEFINE(int, icmp_rfi) = 0; #define V_icmp_rfi VNET(icmp_rfi) SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, reply_from_interface, CTLFLAG_RW, &VNET_NAME(icmp_rfi), 0, "ICMP reply from incoming interface for non-local packets"); -STATIC_VNET_DEFINE(int, icmp_quotelen) = 8; +static VNET_DEFINE(int, icmp_quotelen) = 8; #define V_icmp_quotelen VNET(icmp_quotelen) SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, quotelen, CTLFLAG_RW, &VNET_NAME(icmp_quotelen), 0, @@ -137,7 +137,7 @@ SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO /* * ICMP broadcast echo sysctl */ -STATIC_VNET_DEFINE(int, icmpbmcastecho) = 0; +static VNET_DEFINE(int, icmpbmcastecho) = 0; #define V_icmpbmcastecho VNET(icmpbmcastecho) SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, bmcastecho, CTLFLAG_RW, &VNET_NAME(icmpbmcastecho), 0, Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ip_input.c Mon Nov 22 19:32:54 2010 (r215701) @@ -96,7 +96,7 @@ SYSCTL_VNET_INT(_net_inet_ip, IPCTL_FORW &VNET_NAME(ipforwarding), 0, "Enable IP forwarding between interfaces"); -STATIC_VNET_DEFINE(int, ipsendredirects) = 1; /* XXX */ +static VNET_DEFINE(int, ipsendredirects) = 1; /* XXX */ #define V_ipsendredirects VNET(ipsendredirects) SYSCTL_VNET_INT(_net_inet_ip, IPCTL_SENDREDIRECTS, redirect, CTLFLAG_RW, &VNET_NAME(ipsendredirects), 0, @@ -107,13 +107,13 @@ SYSCTL_VNET_INT(_net_inet_ip, IPCTL_DEFT &VNET_NAME(ip_defttl), 0, "Maximum TTL on IP packets"); -STATIC_VNET_DEFINE(int, ip_keepfaith); +static VNET_DEFINE(int, ip_keepfaith); #define V_ip_keepfaith VNET(ip_keepfaith) SYSCTL_VNET_INT(_net_inet_ip, IPCTL_KEEPFAITH, keepfaith, CTLFLAG_RW, &VNET_NAME(ip_keepfaith), 0, "Enable packet capture for FAITH IPv4->IPv6 translater daemon"); -STATIC_VNET_DEFINE(int, ip_sendsourcequench); +static VNET_DEFINE(int, ip_sendsourcequench); #define V_ip_sendsourcequench VNET(ip_sendsourcequench) SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, sendsourcequench, CTLFLAG_RW, &VNET_NAME(ip_sendsourcequench), 0, @@ -137,7 +137,7 @@ SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, * to the loopback interface instead of the interface where the * packets for those addresses are received. */ -STATIC_VNET_DEFINE(int, ip_checkinterface); +static VNET_DEFINE(int, ip_checkinterface); #define V_ip_checkinterface VNET(ip_checkinterface) SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, check_interface, CTLFLAG_RW, &VNET_NAME(ip_checkinterface), 0, @@ -164,8 +164,8 @@ SYSCTL_VNET_STRUCT(_net_inet_ip, IPCTL_S &VNET_NAME(ipstat), ipstat, "IP statistics (struct ipstat, netinet/ip_var.h)"); -STATIC_VNET_DEFINE(uma_zone_t, ipq_zone); -STATIC_VNET_DEFINE(TAILQ_HEAD(ipqhead, ipq), ipq[IPREASS_NHASH]); +static VNET_DEFINE(uma_zone_t, ipq_zone); +static VNET_DEFINE(TAILQ_HEAD(ipqhead, ipq), ipq[IPREASS_NHASH]); static struct mtx ipqlock; #define V_ipq_zone VNET(ipq_zone) @@ -180,15 +180,15 @@ static void maxnipq_update(void); static void ipq_zone_change(void *); static void ip_drain_locked(void); -STATIC_VNET_DEFINE(int, maxnipq); /* Administrative limit on # reass queues. */ -STATIC_VNET_DEFINE(int, nipq); /* Total # of reass queues */ +static VNET_DEFINE(int, maxnipq); /* Administrative limit on # reass queues. */ +static VNET_DEFINE(int, nipq); /* Total # of reass queues */ #define V_maxnipq VNET(maxnipq) #define V_nipq VNET(nipq) SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, fragpackets, CTLFLAG_RD, &VNET_NAME(nipq), 0, "Current number of IPv4 fragment reassembly queue entries"); -STATIC_VNET_DEFINE(int, maxfragsperpacket); +static VNET_DEFINE(int, maxfragsperpacket); #define V_maxfragsperpacket VNET(maxfragsperpacket) SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, maxfragsperpacket, CTLFLAG_RW, &VNET_NAME(maxfragsperpacket), 0, @@ -209,7 +209,7 @@ SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, #endif #ifdef FLOWTABLE -STATIC_VNET_DEFINE(int, ip_output_flowtable_size) = 2048; +static VNET_DEFINE(int, ip_output_flowtable_size) = 2048; VNET_DEFINE(struct flowtable *, ip_ft); #define V_ip_output_flowtable_size VNET(ip_output_flowtable_size) @@ -1719,7 +1719,7 @@ makedummy: * locking. This code remains in ip_input.c as ip_mroute.c is optionally * compiled. */ -STATIC_VNET_DEFINE(int, ip_rsvp_on); +static VNET_DEFINE(int, ip_rsvp_on); VNET_DEFINE(struct socket *, ip_rsvpd); #define V_ip_rsvp_on VNET(ip_rsvp_on) Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ip_ipsec.c Mon Nov 22 19:32:54 2010 (r215701) @@ -72,9 +72,9 @@ extern struct protosw inetsw[]; #ifdef IPSEC #ifdef IPSEC_FILTERTUNNEL -STATIC_VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 1; +static VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 1; #else -STATIC_VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 0; +static VNET_DEFINE(int, ip4_ipsec_filtertunnel) = 0; #endif #define V_ip4_ipsec_filtertunnel VNET(ip4_ipsec_filtertunnel) Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ip_mroute.c Mon Nov 22 19:32:54 2010 (r215701) @@ -121,7 +121,7 @@ __FBSDID("$FreeBSD$"); #define VIFI_INVALID ((vifi_t) -1) #define M_HASCL(m) ((m)->m_flags & M_EXT) -STATIC_VNET_DEFINE(uint32_t, last_tv_sec); /* last time we processed this */ +static VNET_DEFINE(uint32_t, last_tv_sec); /* last time we processed this */ #define V_last_tv_sec VNET(last_tv_sec) static MALLOC_DEFINE(M_MRTABLE, "mroutetbl", "multicast forwarding cache"); @@ -145,14 +145,14 @@ static struct mtx mrouter_mtx; static int ip_mrouter_cnt; /* # of vnets with active mrouters */ static int ip_mrouter_unloading; /* Allow no more V_ip_mrouter sockets */ -STATIC_VNET_DEFINE(struct mrtstat, mrtstat); +static VNET_DEFINE(struct mrtstat, mrtstat); #define V_mrtstat VNET(mrtstat) SYSCTL_VNET_STRUCT(_net_inet_ip, OID_AUTO, mrtstat, CTLFLAG_RW, &VNET_NAME(mrtstat), mrtstat, "IPv4 Multicast Forwarding Statistics (struct mrtstat, " "netinet/ip_mroute.h)"); -STATIC_VNET_DEFINE(u_long, mfchash); +static VNET_DEFINE(u_long, mfchash); #define V_mfchash VNET(mfchash) #define MFCHASH(a, g) \ ((((a).s_addr >> 20) ^ ((a).s_addr >> 10) ^ (a).s_addr ^ \ @@ -160,9 +160,9 @@ STATIC_VNET_DEFINE(u_long, mfchash); #define MFCHASHSIZE 256 static u_long mfchashsize; /* Hash size */ -STATIC_VNET_DEFINE(u_char *, nexpire); /* 0..mfchashsize-1 */ +static VNET_DEFINE(u_char *, nexpire); /* 0..mfchashsize-1 */ #define V_nexpire VNET(nexpire) -STATIC_VNET_DEFINE(LIST_HEAD(mfchashhdr, mfc)*, mfchashtbl); +static VNET_DEFINE(LIST_HEAD(mfchashhdr, mfc)*, mfchashtbl); #define V_mfchashtbl VNET(mfchashtbl) static struct mtx mfc_mtx; @@ -173,9 +173,9 @@ static struct mtx mfc_mtx; mtx_init(&mfc_mtx, "IPv4 multicast forwarding cache", NULL, MTX_DEF) #define MFC_LOCK_DESTROY() mtx_destroy(&mfc_mtx) -STATIC_VNET_DEFINE(vifi_t, numvifs); +static VNET_DEFINE(vifi_t, numvifs); #define V_numvifs VNET(numvifs) -STATIC_VNET_DEFINE(struct vif, viftable[MAXVIFS]); +static VNET_DEFINE(struct vif, viftable[MAXVIFS]); #define V_viftable VNET(viftable) SYSCTL_VNET_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_RD, &VNET_NAME(viftable), sizeof(V_viftable), "S,vif[MAXVIFS]", @@ -191,7 +191,7 @@ static struct mtx vif_mtx; static eventhandler_tag if_detach_event_tag = NULL; -STATIC_VNET_DEFINE(struct callout, expire_upcalls_ch); +static VNET_DEFINE(struct callout, expire_upcalls_ch); #define V_expire_upcalls_ch VNET(expire_upcalls_ch) #define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ @@ -206,9 +206,9 @@ static MALLOC_DEFINE(M_BWMETER, "bwmeter * expiration time. Periodically, the entries are analysed and processed. */ #define BW_METER_BUCKETS 1024 -STATIC_VNET_DEFINE(struct bw_meter*, bw_meter_timers[BW_METER_BUCKETS]); +static VNET_DEFINE(struct bw_meter*, bw_meter_timers[BW_METER_BUCKETS]); #define V_bw_meter_timers VNET(bw_meter_timers) -STATIC_VNET_DEFINE(struct callout, bw_meter_ch); +static VNET_DEFINE(struct callout, bw_meter_ch); #define V_bw_meter_ch VNET(bw_meter_ch) #define BW_METER_PERIOD (hz) /* periodical handling of bw meters */ @@ -216,16 +216,16 @@ STATIC_VNET_DEFINE(struct callout, bw_me * Pending upcalls are stored in a vector which is flushed when * full, or periodically */ -STATIC_VNET_DEFINE(struct bw_upcall, bw_upcalls[BW_UPCALLS_MAX]); +static VNET_DEFINE(struct bw_upcall, bw_upcalls[BW_UPCALLS_MAX]); #define V_bw_upcalls VNET(bw_upcalls) -STATIC_VNET_DEFINE(u_int, bw_upcalls_n); /* # of pending upcalls */ +static VNET_DEFINE(u_int, bw_upcalls_n); /* # of pending upcalls */ #define V_bw_upcalls_n VNET(bw_upcalls_n) -STATIC_VNET_DEFINE(struct callout, bw_upcalls_ch); +static VNET_DEFINE(struct callout, bw_upcalls_ch); #define V_bw_upcalls_ch VNET(bw_upcalls_ch) #define BW_UPCALLS_PERIOD (hz) /* periodical flush of bw upcalls */ -STATIC_VNET_DEFINE(struct pimstat, pimstat); +static VNET_DEFINE(struct pimstat, pimstat); #define V_pimstat VNET(pimstat) SYSCTL_NODE(_net_inet, IPPROTO_PIM, pim, CTLFLAG_RW, 0, "PIM"); @@ -296,9 +296,9 @@ static struct pim_encap_pimhdr pim_encap 0 /* flags */ }; -STATIC_VNET_DEFINE(vifi_t, reg_vif_num) = VIFI_INVALID; +static VNET_DEFINE(vifi_t, reg_vif_num) = VIFI_INVALID; #define V_reg_vif_num VNET(reg_vif_num) -STATIC_VNET_DEFINE(struct ifnet, multicast_register_if); +static VNET_DEFINE(struct ifnet, multicast_register_if); #define V_multicast_register_if VNET(multicast_register_if) /* @@ -367,9 +367,9 @@ static const uint32_t mrt_api_support = MRT_MFC_FLAGS_BORDER_VIF | MRT_MFC_RP | MRT_MFC_BW_UPCALL); -STATIC_VNET_DEFINE(uint32_t, mrt_api_config); +static VNET_DEFINE(uint32_t, mrt_api_config); #define V_mrt_api_config VNET(mrt_api_config) -STATIC_VNET_DEFINE(int, pim_assert_enabled); +static VNET_DEFINE(int, pim_assert_enabled); #define V_pim_assert_enabled VNET(pim_assert_enabled) static struct timeval pim_assert_interval = { 3, 0 }; /* Rate limit */ Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ipfw/ip_fw2.c Mon Nov 22 19:32:54 2010 (r215701) @@ -100,10 +100,10 @@ __FBSDID("$FreeBSD$"); */ /* ipfw_vnet_ready controls when we are open for business */ -STATIC_VNET_DEFINE(int, ipfw_vnet_ready) = 0; +static VNET_DEFINE(int, ipfw_vnet_ready) = 0; #define V_ipfw_vnet_ready VNET(ipfw_vnet_ready) -STATIC_VNET_DEFINE(int, fw_deny_unknown_exthdrs); +static VNET_DEFINE(int, fw_deny_unknown_exthdrs); #define V_fw_deny_unknown_exthdrs VNET(fw_deny_unknown_exthdrs) #ifdef IPFIREWALL_DEFAULT_TO_ACCEPT Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_dynamic.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ipfw/ip_fw_dynamic.c Mon Nov 22 19:32:54 2010 (r215701) @@ -118,10 +118,10 @@ __FBSDID("$FreeBSD$"); /* * Static variables followed by global ones */ -STATIC_VNET_DEFINE(ipfw_dyn_rule **, ipfw_dyn_v); -STATIC_VNET_DEFINE(u_int32_t, dyn_buckets); -STATIC_VNET_DEFINE(u_int32_t, curr_dyn_buckets); -STATIC_VNET_DEFINE(struct callout, ipfw_timeout); +static VNET_DEFINE(ipfw_dyn_rule **, ipfw_dyn_v); +static VNET_DEFINE(u_int32_t, dyn_buckets); +static VNET_DEFINE(u_int32_t, curr_dyn_buckets); +static VNET_DEFINE(struct callout, ipfw_timeout); #define V_ipfw_dyn_v VNET(ipfw_dyn_v) #define V_dyn_buckets VNET(dyn_buckets) #define V_curr_dyn_buckets VNET(curr_dyn_buckets) @@ -150,12 +150,12 @@ ipfw_dyn_unlock(void) /* * Timeouts for various events in handing dynamic rules. */ -STATIC_VNET_DEFINE(u_int32_t, dyn_ack_lifetime); -STATIC_VNET_DEFINE(u_int32_t, dyn_syn_lifetime); -STATIC_VNET_DEFINE(u_int32_t, dyn_fin_lifetime); -STATIC_VNET_DEFINE(u_int32_t, dyn_rst_lifetime); -STATIC_VNET_DEFINE(u_int32_t, dyn_udp_lifetime); -STATIC_VNET_DEFINE(u_int32_t, dyn_short_lifetime); +static VNET_DEFINE(u_int32_t, dyn_ack_lifetime); +static VNET_DEFINE(u_int32_t, dyn_syn_lifetime); +static VNET_DEFINE(u_int32_t, dyn_fin_lifetime); +static VNET_DEFINE(u_int32_t, dyn_rst_lifetime); +static VNET_DEFINE(u_int32_t, dyn_udp_lifetime); +static VNET_DEFINE(u_int32_t, dyn_short_lifetime); #define V_dyn_ack_lifetime VNET(dyn_ack_lifetime) #define V_dyn_syn_lifetime VNET(dyn_syn_lifetime) @@ -172,16 +172,16 @@ STATIC_VNET_DEFINE(u_int32_t, dyn_short_ * than dyn_keepalive_period. */ -STATIC_VNET_DEFINE(u_int32_t, dyn_keepalive_interval); -STATIC_VNET_DEFINE(u_int32_t, dyn_keepalive_period); -STATIC_VNET_DEFINE(u_int32_t, dyn_keepalive); +static VNET_DEFINE(u_int32_t, dyn_keepalive_interval); +static VNET_DEFINE(u_int32_t, dyn_keepalive_period); +static VNET_DEFINE(u_int32_t, dyn_keepalive); #define V_dyn_keepalive_interval VNET(dyn_keepalive_interval) #define V_dyn_keepalive_period VNET(dyn_keepalive_period) #define V_dyn_keepalive VNET(dyn_keepalive) -STATIC_VNET_DEFINE(u_int32_t, dyn_count); /* # of dynamic rules */ -STATIC_VNET_DEFINE(u_int32_t, dyn_max); /* max # of dynamic rules */ +static VNET_DEFINE(u_int32_t, dyn_count); /* # of dynamic rules */ +static VNET_DEFINE(u_int32_t, dyn_max); /* max # of dynamic rules */ #define V_dyn_count VNET(dyn_count) #define V_dyn_max VNET(dyn_max) Modified: head/sys/netinet/ipfw/ip_fw_nat.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_nat.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ipfw/ip_fw_nat.c Mon Nov 22 19:32:54 2010 (r215701) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include /* XXX for in_cksum */ -STATIC_VNET_DEFINE(eventhandler_tag, ifaddr_event_tag); +static VNET_DEFINE(eventhandler_tag, ifaddr_event_tag); #define V_ifaddr_event_tag VNET(ifaddr_event_tag) static void Modified: head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_pfil.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/ipfw/ip_fw_pfil.c Mon Nov 22 19:32:54 2010 (r215701) @@ -63,11 +63,11 @@ __FBSDID("$FreeBSD$"); #include -STATIC_VNET_DEFINE(int, fw_enable) = 1; +static VNET_DEFINE(int, fw_enable) = 1; #define V_fw_enable VNET(fw_enable) #ifdef INET6 -STATIC_VNET_DEFINE(int, fw6_enable) = 1; +static VNET_DEFINE(int, fw6_enable) = 1; #define V_fw6_enable VNET(fw6_enable) #endif Modified: head/sys/netinet/siftr.c ============================================================================== --- head/sys/netinet/siftr.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/siftr.c Mon Nov 22 19:32:54 2010 (r215701) @@ -260,7 +260,7 @@ struct siftr_stats uint32_t nskip_out_dejavu; }; -STATIC_DPCPU_DEFINE(struct siftr_stats, ss); +static DPCPU_DEFINE(struct siftr_stats, ss); static volatile unsigned int siftr_exit_pkt_manager_thread = 0; static unsigned int siftr_enabled = 0; Modified: head/sys/netinet/tcp_hostcache.c ============================================================================== --- head/sys/netinet/tcp_hostcache.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/tcp_hostcache.c Mon Nov 22 19:32:54 2010 (r215701) @@ -106,10 +106,10 @@ __FBSDID("$FreeBSD$"); #define TCP_HOSTCACHE_EXPIRE 60*60 /* one hour */ #define TCP_HOSTCACHE_PRUNE 5*60 /* every 5 minutes */ -STATIC_VNET_DEFINE(struct tcp_hostcache, tcp_hostcache); +static VNET_DEFINE(struct tcp_hostcache, tcp_hostcache); #define V_tcp_hostcache VNET(tcp_hostcache) -STATIC_VNET_DEFINE(struct callout, tcp_hc_callout); +static VNET_DEFINE(struct callout, tcp_hc_callout); #define V_tcp_hc_callout VNET(tcp_hc_callout) static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *); Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/tcp_reass.c Mon Nov 22 19:32:54 2010 (r215701) @@ -80,25 +80,25 @@ static int tcp_reass_sysctl_qsize(SYSCTL SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -STATIC_VNET_DEFINE(int, tcp_reass_maxseg) = 0; +static VNET_DEFINE(int, tcp_reass_maxseg) = 0; #define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, &VNET_NAME(tcp_reass_maxseg), 0, &tcp_reass_sysctl_maxseg, "I", "Global maximum number of TCP Segments in Reassembly Queue"); -STATIC_VNET_DEFINE(int, tcp_reass_qsize) = 0; +static VNET_DEFINE(int, tcp_reass_qsize) = 0; #define V_tcp_reass_qsize VNET(tcp_reass_qsize) SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, &VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -STATIC_VNET_DEFINE(int, tcp_reass_overflows) = 0; +static VNET_DEFINE(int, tcp_reass_overflows) = 0; #define V_tcp_reass_overflows VNET(tcp_reass_overflows) SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, &VNET_NAME(tcp_reass_overflows), 0, "Global number of TCP Segment Reassembly Queue Overflows"); -STATIC_VNET_DEFINE(uma_zone_t, tcp_reass_zone); +static VNET_DEFINE(uma_zone_t, tcp_reass_zone); #define V_tcp_reass_zone VNET(tcp_reass_zone) /* Initialize TCP reassembly queue */ Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/tcp_subr.c Mon Nov 22 19:32:54 2010 (r215701) @@ -193,13 +193,13 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_t SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, pcbcount, CTLFLAG_RD, &VNET_NAME(tcbinfo.ipi_count), 0, "Number of active PCBs"); -STATIC_VNET_DEFINE(int, icmp_may_rst) = 1; +static VNET_DEFINE(int, icmp_may_rst) = 1; #define V_icmp_may_rst VNET(icmp_may_rst) SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, icmp_may_rst, CTLFLAG_RW, &VNET_NAME(icmp_may_rst), 0, "Certain ICMP unreachable messages may abort connections in SYN_SENT"); -STATIC_VNET_DEFINE(int, tcp_isn_reseed_interval) = 0; +static VNET_DEFINE(int, tcp_isn_reseed_interval) = 0; #define V_tcp_isn_reseed_interval VNET(tcp_isn_reseed_interval) SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, isn_reseed_interval, CTLFLAG_RW, &VNET_NAME(tcp_isn_reseed_interval), 0, @@ -241,7 +241,7 @@ struct tcpcb_mem { struct cc_var ccv; }; -STATIC_VNET_DEFINE(uma_zone_t, tcpcb_zone); +static VNET_DEFINE(uma_zone_t, tcpcb_zone); #define V_tcpcb_zone VNET(tcpcb_zone) MALLOC_DEFINE(M_TCPLOG, "tcplog", "TCP address and flags print buffers"); @@ -1514,10 +1514,10 @@ tcp6_ctlinput(int cmd, struct sockaddr * #define ISN_STATIC_INCREMENT 4096 #define ISN_RANDOM_INCREMENT (4096 - 1) -STATIC_VNET_DEFINE(u_char, isn_secret[32]); -STATIC_VNET_DEFINE(int, isn_last_reseed); -STATIC_VNET_DEFINE(u_int32_t, isn_offset); -STATIC_VNET_DEFINE(u_int32_t, isn_offset_old); +static VNET_DEFINE(u_char, isn_secret[32]); +static VNET_DEFINE(int, isn_last_reseed); +static VNET_DEFINE(u_int32_t, isn_offset); +static VNET_DEFINE(u_int32_t, isn_offset_old); #define V_isn_secret VNET(isn_secret) #define V_isn_last_reseed VNET(isn_last_reseed) Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Mon Nov 22 19:02:30 2010 (r215700) +++ head/sys/netinet/tcp_syncache.c Mon Nov 22 19:32:54 2010 (r215701) @@ -97,13 +97,13 @@ __FBSDID("$FreeBSD$"); #include -STATIC_VNET_DEFINE(int, tcp_syncookies) = 1; +static VNET_DEFINE(int, tcp_syncookies) = 1; #define V_tcp_syncookies VNET(tcp_syncookies) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 19:40:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34C5C106576B; Mon, 22 Nov 2010 19:40:28 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23E1E8FC17; Mon, 22 Nov 2010 19:40:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMJeSxd003334; Mon, 22 Nov 2010 19:40:28 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMJeSin003332; Mon, 22 Nov 2010 19:40:28 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201011221940.oAMJeSin003332@svn.freebsd.org> From: Bruce Cran Date: Mon, 22 Nov 2010 19:40:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215702 - head/sbin/routed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 19:40:28 -0000 Author: brucec Date: Mon Nov 22 19:40:27 2010 New Revision: 215702 URL: http://svn.freebsd.org/changeset/base/215702 Log: Fix use of AND operator: should be bitwise instead of logical. Modified: head/sbin/routed/parms.c Modified: head/sbin/routed/parms.c ============================================================================== --- head/sbin/routed/parms.c Mon Nov 22 19:32:54 2010 (r215701) +++ head/sbin/routed/parms.c Mon Nov 22 19:40:27 2010 (r215702) @@ -876,11 +876,11 @@ check_parms(struct parm *new) if ((0 != (new->parm_int_state & GROUP_IS_SOL_OUT) && 0 != (parmp->parm_int_state & GROUP_IS_SOL_OUT) && 0 != ((new->parm_int_state ^ parmp->parm_int_state) - && GROUP_IS_SOL_OUT)) + & GROUP_IS_SOL_OUT)) || (0 != (new->parm_int_state & GROUP_IS_ADV_OUT) && 0 != (parmp->parm_int_state & GROUP_IS_ADV_OUT) && 0 != ((new->parm_int_state ^ parmp->parm_int_state) - && GROUP_IS_ADV_OUT)) + & GROUP_IS_ADV_OUT)) || (new->parm_rdisc_pref != 0 && parmp->parm_rdisc_pref != 0 && new->parm_rdisc_pref != parmp->parm_rdisc_pref) From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 19:52:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED47F1065670; Mon, 22 Nov 2010 19:52:44 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAA748FC12; Mon, 22 Nov 2010 19:52:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMJqiRY003621; Mon, 22 Nov 2010 19:52:44 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMJqir5003618; Mon, 22 Nov 2010 19:52:44 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201011221952.oAMJqir5003618@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 22 Nov 2010 19:52:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215703 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 19:52:45 -0000 Author: jkim Date: Mon Nov 22 19:52:44 2010 New Revision: 215703 URL: http://svn.freebsd.org/changeset/base/215703 Log: - Disable caches and flush caches/TLBs when we update PAT as we do for MTRR. Flushing TLBs is required to ensure cache coherency according to the AMD64 architecture manual. Flushing caches is only required when changing from a cacheable memory type (WB, WP, or WT) to an uncacheable type (WC, UC, or UC-). Since this function is only used once per processor during startup, there is no need to take any shortcuts. - Leave PAT indices 0-3 at the default of WB, WT, UC-, and UC. Program 5 as WP (from default WT) and 6 as WC (from default UC-). Leave 4 and 7 at the default of WB and UC. This is to avoid transition from a cacheable memory type to an uncacheable type to minimize possible cache incoherency. Since we perform flushing caches and TLBs now, this change may not be necessary any more but we do not want to take any chances. - Remove Apple hardware specific quirks. With the above changes, it seems this hack is no longer needed. - Improve pmap_cache_bits() with an array to map PAT memory type to index. This array is initialized early from pmap_init_pat(), so that we do not need to handle special cases in the function any more. Now this function is identical on both amd64 and i386. Reviewed by: jhb Tested by: RM (reuf_m at hotmail dot com) Ryszard Czekaj (rychoo at freeshell dot net) army.of.root (army dot of dot root at googlemail dot com) MFC after: 3 days Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Nov 22 19:40:27 2010 (r215702) +++ head/sys/amd64/amd64/pmap.c Mon Nov 22 19:52:44 2010 (r215703) @@ -180,14 +180,20 @@ static vm_paddr_t dmaplimit; vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS; pt_entry_t pg_nx; -static int pat_works = 0; /* Is page attribute table sane? */ - SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); +static int pat_works = 1; +TUNABLE_INT("vm.pmap.pat_works", &pat_works); +SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RDTUN, &pat_works, 1, + "Is page attribute table fully functional?"); + static int pg_ps_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0, "Are large page mappings enabled?"); +#define PAT_INDEX_SIZE 8 +static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ + static u_int64_t KPTphys; /* phys addr of kernel level 1 */ static u_int64_t KPDphys; /* phys addr of kernel level 2 */ u_int64_t KPDPphys; /* phys addr of kernel level 3 */ @@ -608,31 +614,24 @@ pmap_bootstrap(vm_paddr_t *firstaddr) void pmap_init_pat(void) { + int pat_table[PAT_INDEX_SIZE]; uint64_t pat_msr; - char *sysenv; - static int pat_tested = 0; + u_long cr0, cr4; + int i; /* Bail if this CPU doesn't implement PAT. */ - if (!(cpu_feature & CPUID_PAT)) + if ((cpu_feature & CPUID_PAT) == 0) panic("no PAT??"); - /* - * Some Apple Macs based on nVidia chipsets cannot enter ACPI mode - * via SMI# when we use upper 4 PAT entries for unknown reason. - */ - if (!pat_tested) { - pat_works = 1; - sysenv = getenv("smbios.system.product"); - if (sysenv != NULL) { - if (strncmp(sysenv, "MacBook5,1", 10) == 0 || - strncmp(sysenv, "MacBookPro5,5", 13) == 0 || - strncmp(sysenv, "Macmini3,1", 10) == 0 || - strncmp(sysenv, "iMac9,1", 7) == 0) - pat_works = 0; - freeenv(sysenv); - } - pat_tested = 1; - } + /* Set default PAT index table. */ + for (i = 0; i < PAT_INDEX_SIZE; i++) + pat_table[i] = -1; + pat_table[PAT_WRITE_BACK] = 0; + pat_table[PAT_WRITE_THROUGH] = 1; + pat_table[PAT_UNCACHEABLE] = 3; + pat_table[PAT_WRITE_COMBINING] = 3; + pat_table[PAT_WRITE_PROTECTED] = 3; + pat_table[PAT_UNCACHED] = 3; /* Initialize default PAT entries. */ pat_msr = PAT_VALUE(0, PAT_WRITE_BACK) | @@ -647,20 +646,48 @@ pmap_init_pat(void) if (pat_works) { /* * Leave the indices 0-3 at the default of WB, WT, UC-, and UC. - * Program 4 and 5 as WP and WC. - * Leave 6 and 7 as UC- and UC. + * Program 5 and 6 as WP and WC. + * Leave 4 and 7 as WB and UC. */ - pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); - pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | - PAT_VALUE(5, PAT_WRITE_COMBINING); + pat_msr &= ~(PAT_MASK(5) | PAT_MASK(6)); + pat_msr |= PAT_VALUE(5, PAT_WRITE_PROTECTED) | + PAT_VALUE(6, PAT_WRITE_COMBINING); + pat_table[PAT_UNCACHED] = 2; + pat_table[PAT_WRITE_PROTECTED] = 5; + pat_table[PAT_WRITE_COMBINING] = 6; } else { /* * Just replace PAT Index 2 with WC instead of UC-. */ pat_msr &= ~PAT_MASK(2); pat_msr |= PAT_VALUE(2, PAT_WRITE_COMBINING); + pat_table[PAT_WRITE_COMBINING] = 2; } + + /* Disable PGE. */ + cr4 = rcr4(); + load_cr4(cr4 & ~CR4_PGE); + + /* Disable caches (CD = 1, NW = 0). */ + cr0 = rcr0(); + load_cr0((cr0 & ~CR0_NW) | CR0_CD); + + /* Flushes caches and TLBs. */ + wbinvd(); + invltlb(); + + /* Update PAT and index table. */ wrmsr(MSR_PAT, pat_msr); + for (i = 0; i < PAT_INDEX_SIZE; i++) + pat_index[i] = pat_table[i]; + + /* Flush caches and TLBs again. */ + wbinvd(); + invltlb(); + + /* Restore caches and PGE. */ + load_cr0(cr0); + load_cr4(cr4); } /* @@ -811,63 +838,24 @@ SYSCTL_ULONG(_vm_pmap_pdpe, OID_AUTO, de static int pmap_cache_bits(int mode, boolean_t is_pde) { - int pat_flag, pat_index, cache_bits; + int cache_bits, pat_flag, pat_idx; + + if (mode < 0 || mode >= PAT_INDEX_SIZE || pat_index[mode] < 0) + panic("Unknown caching mode %d\n", mode); /* The PAT bit is different for PTE's and PDE's. */ pat_flag = is_pde ? PG_PDE_PAT : PG_PTE_PAT; /* Map the caching mode to a PAT index. */ - if (pat_works) { - switch (mode) { - case PAT_UNCACHEABLE: - pat_index = 3; - break; - case PAT_WRITE_THROUGH: - pat_index = 1; - break; - case PAT_WRITE_BACK: - pat_index = 0; - break; - case PAT_UNCACHED: - pat_index = 2; - break; - case PAT_WRITE_COMBINING: - pat_index = 5; - break; - case PAT_WRITE_PROTECTED: - pat_index = 4; - break; - default: - panic("Unknown caching mode %d\n", mode); - } - } else { - switch (mode) { - case PAT_UNCACHED: - case PAT_UNCACHEABLE: - case PAT_WRITE_PROTECTED: - pat_index = 3; - break; - case PAT_WRITE_THROUGH: - pat_index = 1; - break; - case PAT_WRITE_BACK: - pat_index = 0; - break; - case PAT_WRITE_COMBINING: - pat_index = 2; - break; - default: - panic("Unknown caching mode %d\n", mode); - } - } + pat_idx = pat_index[mode]; /* Map the 3-bit index value into the PAT, PCD, and PWT bits. */ cache_bits = 0; - if (pat_index & 0x4) + if (pat_idx & 0x4) cache_bits |= pat_flag; - if (pat_index & 0x2) + if (pat_idx & 0x2) cache_bits |= PG_NC_PCD; - if (pat_index & 0x1) + if (pat_idx & 0x1) cache_bits |= PG_NC_PWT; return (cache_bits); } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Mon Nov 22 19:40:27 2010 (r215702) +++ head/sys/i386/i386/pmap.c Mon Nov 22 19:52:44 2010 (r215703) @@ -217,14 +217,20 @@ pt_entry_t pg_nx; static uma_zone_t pdptzone; #endif -static int pat_works = 0; /* Is page attribute table sane? */ - SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); +static int pat_works = 1; +TUNABLE_INT("vm.pmap.pat_works", &pat_works); +SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RDTUN, &pat_works, 1, + "Is page attribute table fully functional?"); + static int pg_ps_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0, "Are large page mappings enabled?"); +#define PAT_INDEX_SIZE 8 +static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ + /* * Data for the pv entry allocation mechanism */ @@ -490,13 +496,28 @@ pmap_bootstrap(vm_paddr_t firstaddr) void pmap_init_pat(void) { + int pat_table[PAT_INDEX_SIZE]; uint64_t pat_msr; - char *sysenv; - static int pat_tested = 0; + u_long cr0, cr4; + int i; + + /* Set default PAT index table. */ + for (i = 0; i < PAT_INDEX_SIZE; i++) + pat_table[i] = -1; + pat_table[PAT_WRITE_BACK] = 0; + pat_table[PAT_WRITE_THROUGH] = 1; + pat_table[PAT_UNCACHEABLE] = 3; + pat_table[PAT_WRITE_COMBINING] = 3; + pat_table[PAT_WRITE_PROTECTED] = 3; + pat_table[PAT_UNCACHED] = 3; /* Bail if this CPU doesn't implement PAT. */ - if (!(cpu_feature & CPUID_PAT)) + if ((cpu_feature & CPUID_PAT) == 0) { + for (i = 0; i < PAT_INDEX_SIZE; i++) + pat_index[i] = pat_table[i]; + pat_works = 0; return; + } /* * Due to some Intel errata, we can only safely use the lower 4 @@ -508,27 +529,10 @@ pmap_init_pat(void) * * Intel Pentium IV Processor Specification Update * Errata N46 (PAT Index MSB May Be Calculated Incorrectly) - * - * Some Apple Macs based on nVidia chipsets cannot enter ACPI mode - * via SMI# when we use upper 4 PAT entries for unknown reason. */ - if (!pat_tested) { - if (cpu_vendor_id != CPU_VENDOR_INTEL || - (CPUID_TO_FAMILY(cpu_id) == 6 && - CPUID_TO_MODEL(cpu_id) >= 0xe)) { - pat_works = 1; - sysenv = getenv("smbios.system.product"); - if (sysenv != NULL) { - if (strncmp(sysenv, "MacBook5,1", 10) == 0 || - strncmp(sysenv, "MacBookPro5,5", 13) == 0 || - strncmp(sysenv, "Macmini3,1", 10) == 0 || - strncmp(sysenv, "iMac9,1", 7) == 0) - pat_works = 0; - freeenv(sysenv); - } - } - pat_tested = 1; - } + if (cpu_vendor_id == CPU_VENDOR_INTEL && + !(CPUID_TO_FAMILY(cpu_id) == 6 && CPUID_TO_MODEL(cpu_id) >= 0xe)) + pat_works = 0; /* Initialize default PAT entries. */ pat_msr = PAT_VALUE(0, PAT_WRITE_BACK) | @@ -543,20 +547,48 @@ pmap_init_pat(void) if (pat_works) { /* * Leave the indices 0-3 at the default of WB, WT, UC-, and UC. - * Program 4 and 5 as WP and WC. - * Leave 6 and 7 as UC- and UC. + * Program 5 and 6 as WP and WC. + * Leave 4 and 7 as WB and UC. */ - pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); - pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | - PAT_VALUE(5, PAT_WRITE_COMBINING); + pat_msr &= ~(PAT_MASK(5) | PAT_MASK(6)); + pat_msr |= PAT_VALUE(5, PAT_WRITE_PROTECTED) | + PAT_VALUE(6, PAT_WRITE_COMBINING); + pat_table[PAT_UNCACHED] = 2; + pat_table[PAT_WRITE_PROTECTED] = 5; + pat_table[PAT_WRITE_COMBINING] = 6; } else { /* * Just replace PAT Index 2 with WC instead of UC-. */ pat_msr &= ~PAT_MASK(2); pat_msr |= PAT_VALUE(2, PAT_WRITE_COMBINING); + pat_table[PAT_WRITE_COMBINING] = 2; } + + /* Disable PGE. */ + cr4 = rcr4(); + load_cr4(cr4 & ~CR4_PGE); + + /* Disable caches (CD = 1, NW = 0). */ + cr0 = rcr0(); + load_cr0((cr0 & ~CR0_NW) | CR0_CD); + + /* Flushes caches and TLBs. */ + wbinvd(); + invltlb(); + + /* Update PAT and index table. */ wrmsr(MSR_PAT, pat_msr); + for (i = 0; i < PAT_INDEX_SIZE; i++) + pat_index[i] = pat_table[i]; + + /* Flush caches and TLBs again. */ + wbinvd(); + invltlb(); + + /* Restore caches and PGE. */ + load_cr0(cr0); + load_cr4(cr4); } /* @@ -792,78 +824,24 @@ SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, pro int pmap_cache_bits(int mode, boolean_t is_pde) { - int pat_flag, pat_index, cache_bits; + int cache_bits, pat_flag, pat_idx; + + if (mode < 0 || mode >= PAT_INDEX_SIZE || pat_index[mode] < 0) + panic("Unknown caching mode %d\n", mode); /* The PAT bit is different for PTE's and PDE's. */ pat_flag = is_pde ? PG_PDE_PAT : PG_PTE_PAT; - /* If we don't support PAT, map extended modes to older ones. */ - if (!(cpu_feature & CPUID_PAT)) { - switch (mode) { - case PAT_UNCACHEABLE: - case PAT_WRITE_THROUGH: - case PAT_WRITE_BACK: - break; - case PAT_UNCACHED: - case PAT_WRITE_COMBINING: - case PAT_WRITE_PROTECTED: - mode = PAT_UNCACHEABLE; - break; - } - } - /* Map the caching mode to a PAT index. */ - if (pat_works) { - switch (mode) { - case PAT_UNCACHEABLE: - pat_index = 3; - break; - case PAT_WRITE_THROUGH: - pat_index = 1; - break; - case PAT_WRITE_BACK: - pat_index = 0; - break; - case PAT_UNCACHED: - pat_index = 2; - break; - case PAT_WRITE_COMBINING: - pat_index = 5; - break; - case PAT_WRITE_PROTECTED: - pat_index = 4; - break; - default: - panic("Unknown caching mode %d\n", mode); - } - } else { - switch (mode) { - case PAT_UNCACHED: - case PAT_UNCACHEABLE: - case PAT_WRITE_PROTECTED: - pat_index = 3; - break; - case PAT_WRITE_THROUGH: - pat_index = 1; - break; - case PAT_WRITE_BACK: - pat_index = 0; - break; - case PAT_WRITE_COMBINING: - pat_index = 2; - break; - default: - panic("Unknown caching mode %d\n", mode); - } - } + pat_idx = pat_index[mode]; /* Map the 3-bit index value into the PAT, PCD, and PWT bits. */ cache_bits = 0; - if (pat_index & 0x4) + if (pat_idx & 0x4) cache_bits |= pat_flag; - if (pat_index & 0x2) + if (pat_idx & 0x2) cache_bits |= PG_NC_PCD; - if (pat_index & 0x1) + if (pat_idx & 0x1) cache_bits |= PG_NC_PWT; return (cache_bits); } From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 20:10:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D1CE1065670; Mon, 22 Nov 2010 20:10:49 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ECADD8FC13; Mon, 22 Nov 2010 20:10:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMKAmcd004153; Mon, 22 Nov 2010 20:10:48 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMKAmVc004141; Mon, 22 Nov 2010 20:10:48 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201011222010.oAMKAmVc004141@svn.freebsd.org> From: Bruce Cran Date: Mon, 22 Nov 2010 20:10:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215704 - in head: bin/sh sbin/bsdlabel sbin/geom/class/eli sbin/geom/class/part sbin/geom/class/virstor sbin/growfs sbin/gvinum sbin/hastctl sbin/mknod usr.bin/ar usr.bin/bc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 20:10:49 -0000 Author: brucec Date: Mon Nov 22 20:10:48 2010 New Revision: 215704 URL: http://svn.freebsd.org/changeset/base/215704 Log: Fix some more warnings found by clang. Modified: head/bin/sh/arith_lex.l head/sbin/bsdlabel/bsdlabel.c head/sbin/geom/class/eli/geom_eli.c head/sbin/geom/class/part/geom_part.c head/sbin/geom/class/virstor/geom_virstor.c head/sbin/growfs/debug.c head/sbin/gvinum/gvinum.c head/sbin/hastctl/Makefile head/sbin/mknod/mknod.c head/usr.bin/ar/acplex.l head/usr.bin/bc/scan.l Modified: head/bin/sh/arith_lex.l ============================================================================== --- head/bin/sh/arith_lex.l Mon Nov 22 19:52:44 2010 (r215703) +++ head/bin/sh/arith_lex.l Mon Nov 22 20:10:48 2010 (r215704) @@ -55,6 +55,7 @@ int yylex(void); #define YY_INPUT(buf,result,max) \ result = (*buf = *arith_buf++) ? 1 : YY_NULL; #define YY_NO_UNPUT +#define YY_NO_INPUT %} %% Modified: head/sbin/bsdlabel/bsdlabel.c ============================================================================== --- head/sbin/bsdlabel/bsdlabel.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/bsdlabel/bsdlabel.c Mon Nov 22 20:10:48 2010 (r215704) @@ -515,7 +515,7 @@ readlabel(int flag) f = open(specname, O_RDONLY); if (f < 0) - err(1, specname); + err(1, "%s", specname); if (is_file) get_file_parms(f); else { Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/geom/class/eli/geom_eli.c Mon Nov 22 20:10:48 2010 (r215704) @@ -374,7 +374,7 @@ eli_genkey_files(struct gctl_req *req, b if (!gctl_has_param(req, argname)) return (i); - file = gctl_get_ascii(req, argname); + file = gctl_get_ascii(req, "%s", argname); assert(file != NULL); if (strcmp(file, "-") == 0) Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/geom/class/part/geom_part.c Mon Nov 22 20:10:48 2010 (r215704) @@ -614,7 +614,7 @@ static int gpart_show_hasopt(struct gctl_req *req, const char *opt, const char *elt) { - if (!gctl_get_int(req, opt)) + if (!gctl_get_int(req, "%s", opt)) return (0); if (elt != NULL) Modified: head/sbin/geom/class/virstor/geom_virstor.c ============================================================================== --- head/sbin/geom/class/virstor/geom_virstor.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/geom/class/virstor/geom_virstor.c Mon Nov 22 20:10:48 2010 (r215704) @@ -276,7 +276,7 @@ virstor_label(struct gctl_req *req) msize = secsize = 0; for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); ssize = g_get_sectorsize(name); if (ssize == 0) fprintf(stderr, "%s for %s\n", strerror(errno), name); @@ -336,7 +336,7 @@ virstor_label(struct gctl_req *req) for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); if (verbose) printf(" %s", name); @@ -417,7 +417,7 @@ virstor_label(struct gctl_req *req) /* Ok, store metadata. */ for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); msize = g_get_mediasize(name); ssize = g_get_sectorsize(name); @@ -434,7 +434,7 @@ virstor_label(struct gctl_req *req) if (verbose) printf("(%u chunks) ", md.chunk_count); /* Check to make sure last sector is unused */ - if ((off_t)(md.chunk_count * md.md_chunk_size) > msize-ssize) + if ((off_t)(md.chunk_count * md.md_chunk_size) > (off_t)(msize-ssize)) md.chunk_count--; md.chunk_next = 0; if (i != 1) { @@ -499,7 +499,7 @@ virstor_clear(struct gctl_req *req) } for (i = 0; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); error = g_metadata_clear(name, G_VIRSTOR_MAGIC); if (error != 0) { @@ -564,7 +564,7 @@ virstor_dump(struct gctl_req *req) } for (i = 0; i < nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); error = g_metadata_read(name, (u_char *) & tmpmd, sizeof(tmpmd), G_VIRSTOR_MAGIC); Modified: head/sbin/growfs/debug.c ============================================================================== --- head/sbin/growfs/debug.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/growfs/debug.c Mon Nov 22 20:10:48 2010 (r215704) @@ -281,7 +281,7 @@ dbg_dump_fs(struct fs *sb, const char *c */ fprintf(dbg_log, "maxbsize int32_t 0x%08x\n", sb->fs_maxbsize); - fprintf(dbg_log, "unrefs int64_t 0x%08x\n", + fprintf(dbg_log, "unrefs int64_t 0x%08jx\n", sb->fs_unrefs); fprintf(dbg_log, "sblockloc int64_t 0x%08x%08x\n", ((unsigned int *)&(sb->fs_sblockloc))[1], Modified: head/sbin/gvinum/gvinum.c ============================================================================== --- head/sbin/gvinum/gvinum.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/gvinum/gvinum.c Mon Nov 22 20:10:48 2010 (r215704) @@ -1427,5 +1427,5 @@ printconfig(FILE *of, char *comment) if (*comment != '\0') fprintf(of, "# Current configuration:\n"); - fprintf(of, buf); + fprintf(of, "%s", buf); } Modified: head/sbin/hastctl/Makefile ============================================================================== --- head/sbin/hastctl/Makefile Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/hastctl/Makefile Mon Nov 22 20:10:48 2010 (r215704) @@ -24,6 +24,7 @@ CFLAGS+=-DINET6 .endif # This is needed to have WARNS > 1. CFLAGS+=-DYY_NO_UNPUT +CFLAGS+=-DYY_NO_INPUT DPADD= ${LIBL} LDADD= -ll Modified: head/sbin/mknod/mknod.c ============================================================================== --- head/sbin/mknod/mknod.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/mknod/mknod.c Mon Nov 22 20:10:48 2010 (r215704) @@ -139,7 +139,7 @@ main(int argc, char **argv) errx(1, "%s: non-numeric minor number", argv[4]); range_error |= errno; dev = makedev(mymajor, myminor); - if (range_error || major(dev) != (u_int) mymajor || + if (range_error || major(dev) != mymajor || (long)(u_int)minor(dev) != myminor) errx(1, "major or minor number too large"); } else { Modified: head/usr.bin/ar/acplex.l ============================================================================== --- head/usr.bin/ar/acplex.l Mon Nov 22 19:52:44 2010 (r215703) +++ head/usr.bin/ar/acplex.l Mon Nov 22 20:10:48 2010 (r215704) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include "y.tab.h" #define YY_NO_UNPUT +#define YY_NO_INPUT int lineno = 1; int yylex(void); Modified: head/usr.bin/bc/scan.l ============================================================================== --- head/usr.bin/bc/scan.l Mon Nov 22 19:52:44 2010 (r215703) +++ head/usr.bin/bc/scan.l Mon Nov 22 20:10:48 2010 (r215704) @@ -46,6 +46,7 @@ static void init_strbuf(void); static void add_str(const char *); static int bc_yyinput(char *, int); +#define YY_NO_INPUT #undef YY_INPUT #define YY_INPUT(buf,retval,max) \ (retval = bc_yyinput(buf, max)) From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 20:18:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02414106566C; Mon, 22 Nov 2010 20:18:47 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E555F8FC17; Mon, 22 Nov 2010 20:18:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMKIkc0004409; Mon, 22 Nov 2010 20:18:46 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMKIkUa004407; Mon, 22 Nov 2010 20:18:46 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201011222018.oAMKIkUa004407@svn.freebsd.org> From: Bruce Cran Date: Mon, 22 Nov 2010 20:18:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215705 - head/usr.bin/ldd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 20:18:47 -0000 Author: brucec Date: Mon Nov 22 20:18:46 2010 New Revision: 215705 URL: http://svn.freebsd.org/changeset/base/215705 Log: hdr.elf.e_ident[EI_OSABI] is not a bitmask so '==' should been used. Reported by: Artem Belevich Modified: head/usr.bin/ldd/ldd.c Modified: head/usr.bin/ldd/ldd.c ============================================================================== --- head/usr.bin/ldd/ldd.c Mon Nov 22 20:10:48 2010 (r215704) +++ head/usr.bin/ldd/ldd.c Mon Nov 22 20:18:46 2010 (r215705) @@ -331,7 +331,7 @@ is_executable(const char *fname, int fd, return (0); } if (hdr.elf32.e_type == ET_DYN) { - if (hdr.elf32.e_ident[EI_OSABI] & ELFOSABI_FREEBSD) { + if (hdr.elf32.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) { *is_shlib = 1; return (1); } @@ -373,7 +373,7 @@ is_executable(const char *fname, int fd, return (0); } if (hdr.elf.e_type == ET_DYN) { - if (hdr.elf.e_ident[EI_OSABI] & ELFOSABI_FREEBSD) { + if (hdr.elf.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) { *is_shlib = 1; return (1); } From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 20:23:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FBDE1065694; Mon, 22 Nov 2010 20:23:18 +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 6EEC98FC25; Mon, 22 Nov 2010 20:23:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMKNImH004544; Mon, 22 Nov 2010 20:23:18 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMKNI4c004542; Mon, 22 Nov 2010 20:23:18 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201011222023.oAMKNI4c004542@svn.freebsd.org> From: Dimitry Andric Date: Mon, 22 Nov 2010 20:23:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215706 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 20:23:18 -0000 Author: dim Date: Mon Nov 22 20:23:18 2010 New Revision: 215706 URL: http://svn.freebsd.org/changeset/base/215706 Log: Fix linux kernel module breakage introduced in r215675, by including . Noticed by: many Pointy hat to: netchild Modified: head/sys/compat/linux/linux_emul.c Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Mon Nov 22 20:18:46 2010 (r215705) +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 20:23:18 2010 (r215706) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 20:39:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA0DC1065673; Mon, 22 Nov 2010 20:39:29 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B894D8FC13; Mon, 22 Nov 2010 20:39:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMKdT9l004982; Mon, 22 Nov 2010 20:39:29 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMKdTkL004980; Mon, 22 Nov 2010 20:39:29 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201011222039.oAMKdTkL004980@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 22 Nov 2010 20:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215707 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 20:39:29 -0000 Author: bschmidt Date: Mon Nov 22 20:39:29 2010 New Revision: 215707 URL: http://svn.freebsd.org/changeset/base/215707 Log: Prefer pmap_extract() over pmap_kextract() as done in MmIsAddressValid(). According to the comment for MmIsAddressValid() there are issues on PAE kernels using pmap_kextract(). Submitted by: Paul B Mahol Modified: head/sys/compat/ndis/subr_ntoskrnl.c Modified: head/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- head/sys/compat/ndis/subr_ntoskrnl.c Mon Nov 22 20:23:18 2010 (r215706) +++ head/sys/compat/ndis/subr_ntoskrnl.c Mon Nov 22 20:39:29 2010 (r215707) @@ -2544,6 +2544,12 @@ MmUnmapLockedPages(vaddr, buf) * here, but it doesn't. */ +static uint64_t +MmGetPhysicalAddress(void *base) +{ + return (pmap_extract(kernel_map->pmap, (vm_offset_t)base)); +} + uint8_t MmIsAddressValid(vaddr) void *vaddr; @@ -4241,12 +4247,12 @@ image_patch_table ntoskrnl_functbl[] = { IMPORT_SFUNC(MmAllocateContiguousMemorySpecifyCache, 5 + 3), IMPORT_SFUNC(MmFreeContiguousMemory, 1), IMPORT_SFUNC(MmFreeContiguousMemorySpecifyCache, 3), - IMPORT_SFUNC_MAP(MmGetPhysicalAddress, pmap_kextract, 1), IMPORT_SFUNC(MmSizeOfMdl, 1), IMPORT_SFUNC(MmMapLockedPages, 2), IMPORT_SFUNC(MmMapLockedPagesSpecifyCache, 6), IMPORT_SFUNC(MmUnmapLockedPages, 2), IMPORT_SFUNC(MmBuildMdlForNonPagedPool, 1), + IMPORT_SFUNC(MmGetPhysicalAddress, 1), IMPORT_SFUNC(MmIsAddressValid, 1), IMPORT_SFUNC(MmMapIoSpace, 3 + 1), IMPORT_SFUNC(MmUnmapIoSpace, 2), From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 20:46:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C92E5106566C; Mon, 22 Nov 2010 20:46:38 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B73798FC15; Mon, 22 Nov 2010 20:46:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMKkcML005218; Mon, 22 Nov 2010 20:46:38 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMKkcF3005213; Mon, 22 Nov 2010 20:46:38 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201011222046.oAMKkcF3005213@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 22 Nov 2010 20:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215708 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 20:46:38 -0000 Author: bschmidt Date: Mon Nov 22 20:46:38 2010 New Revision: 215708 URL: http://svn.freebsd.org/changeset/base/215708 Log: Resurrect amd64 support. - Many drivers on amd64 are picking system uptime, interrupt time and ticks via global data structure instead of calling functions for performance reasons. For now just patch such address so driver will not trigger page fault when trying to access such data. In future, additional callout may be added to update data in periodic intervals. - On amd64 we need to allocate "shadow space" on stack before calling any function. Submitted by: Paul B Mahol Modified: head/sys/compat/ndis/kern_windrv.c head/sys/compat/ndis/ntoskrnl_var.h head/sys/compat/ndis/subr_ntoskrnl.c head/sys/compat/ndis/winx64_wrap.S Modified: head/sys/compat/ndis/kern_windrv.c ============================================================================== --- head/sys/compat/ndis/kern_windrv.c Mon Nov 22 20:39:29 2010 (r215707) +++ head/sys/compat/ndis/kern_windrv.c Mon Nov 22 20:46:38 2010 (r215708) @@ -311,6 +311,24 @@ windrv_unload(mod, img, len) #define WINDRV_LOADED htonl(0x42534F44) +#ifdef __amd64__ +static void +patch_user_shared_data_address(vm_offset_t img, size_t len) +{ + unsigned long i, n, max_addr, *addr; + + n = len - sizeof(unsigned long); + max_addr = KI_USER_SHARED_DATA + sizeof(kuser_shared_data); + for (i = 0; i < n; i++) { + addr = (unsigned long *)(img + i); + if (*addr >= KI_USER_SHARED_DATA && *addr < max_addr) { + *addr -= KI_USER_SHARED_DATA; + *addr += (unsigned long)&kuser_shared_data; + } + } +} +#endif + /* * Loader routine for actual Windows driver modules, ultimately * calls the driver's DriverEntry() routine. @@ -363,6 +381,10 @@ windrv_load(mod, img, len, bustype, devl return (ENOEXEC); } +#ifdef __amd64__ + patch_user_shared_data_address(img, len); +#endif + /* Dynamically link USBD.SYS -- optional */ if (pe_get_import_descriptor(img, &imp_desc, "USBD") == 0) { if (pe_patch_imports(img, "USBD", usbd_functbl)) Modified: head/sys/compat/ndis/ntoskrnl_var.h ============================================================================== --- head/sys/compat/ndis/ntoskrnl_var.h Mon Nov 22 20:39:29 2010 (r215707) +++ head/sys/compat/ndis/ntoskrnl_var.h Mon Nov 22 20:46:38 2010 (r215708) @@ -605,6 +605,65 @@ struct kinterrupt { typedef struct kinterrupt kinterrupt; +struct ksystem_time { + uint32_t low_part; + int32_t high1_time; + int32_t high2_time; +}; + +enum nt_product_type { + NT_PRODUCT_WIN_NT = 1, + NT_PRODUCT_LAN_MAN_NT, + NT_PRODUCT_SERVER +}; + +enum alt_arch_type { + STANDARD_DESIGN, + NEC98x86, + END_ALTERNATIVES +}; + +struct kuser_shared_data { + uint32_t tick_count; + uint32_t tick_count_multiplier; + volatile struct ksystem_time interrupt_time; + volatile struct ksystem_time system_time; + volatile struct ksystem_time time_zone_bias; + uint16_t image_number_low; + uint16_t image_number_high; + int16_t nt_system_root[260]; + uint32_t max_stack_trace_depth; + uint32_t crypto_exponent; + uint32_t time_zone_id; + uint32_t large_page_min; + uint32_t reserved2[7]; + enum nt_product_type nt_product_type; + uint8_t product_type_is_valid; + uint32_t nt_major_version; + uint32_t nt_minor_version; + uint8_t processor_features[64]; + uint32_t reserved1; + uint32_t reserved3; + volatile uint32_t time_slip; + enum alt_arch_type alt_arch_type; + int64_t system_expiration_date; + uint32_t suite_mask; + uint8_t kdbg_enabled; + volatile uint32_t active_console; + volatile uint32_t dismount_count; + uint32_t com_plus_package; + uint32_t last_system_rit_event_tick_count; + uint32_t num_phys_pages; + uint8_t safe_boot_mode; + uint32_t trace_log; + uint64_t fill0; + uint64_t sys_call[4]; + union { + volatile struct ksystem_time tick_count; + volatile uint64_t tick_count_quad; + } tick; +}; + /* * In Windows, there are Physical Device Objects (PDOs) and * Functional Device Objects (FDOs). Physical Device Objects are @@ -1324,6 +1383,9 @@ struct drvdb_ent { }; extern image_patch_table ntoskrnl_functbl[]; +#ifdef __amd64__ +extern struct kuser_shared_data kuser_shared_data; +#endif typedef void (*funcptr)(void); typedef int (*matchfuncptr)(interface_type, void *, void *); @@ -1438,6 +1500,7 @@ extern void IoQueueWorkItem(io_workitem * routines live in the HAL. We try to imitate this behavior. */ #ifdef __i386__ +#define KI_USER_SHARED_DATA 0xffdf0000 #define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) #define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) #define KeRaiseIrql(a, b) *(b) = KfRaiseIrql(a) @@ -1447,6 +1510,7 @@ extern void IoQueueWorkItem(io_workitem #endif /* __i386__ */ #ifdef __amd64__ +#define KI_USER_SHARED_DATA 0xfffff78000000000UL #define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) #define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) Modified: head/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- head/sys/compat/ndis/subr_ntoskrnl.c Mon Nov 22 20:39:29 2010 (r215707) +++ head/sys/compat/ndis/subr_ntoskrnl.c Mon Nov 22 20:46:38 2010 (r215708) @@ -121,6 +121,7 @@ typedef struct callout_entry callout_ent static struct list_entry ntoskrnl_calllist; static struct mtx ntoskrnl_calllock; +struct kuser_shared_data kuser_shared_data; static struct list_entry ntoskrnl_intlist; static kspin_lock ntoskrnl_intlock; Modified: head/sys/compat/ndis/winx64_wrap.S ============================================================================== --- head/sys/compat/ndis/winx64_wrap.S Mon Nov 22 20:39:29 2010 (r215707) +++ head/sys/compat/ndis/winx64_wrap.S Mon Nov 22 20:46:38 2010 (r215708) @@ -125,26 +125,26 @@ x86_64_wrap_end: */ ENTRY(x86_64_call1) - subq $8,%rsp + subq $40,%rsp mov %rsi,%rcx call *%rdi - addq $8,%rsp + addq $40,%rsp ret ENTRY(x86_64_call2) - subq $24,%rsp + subq $40,%rsp mov %rsi,%rcx /* %rdx is already correct */ call *%rdi - addq $24,%rsp + addq $40,%rsp ret ENTRY(x86_64_call3) - subq $24,%rsp + subq $40,%rsp mov %rcx,%r8 mov %rsi,%rcx call *%rdi - addq $24,%rsp + addq $40,%rsp ret ENTRY(x86_64_call4) @@ -157,13 +157,13 @@ ENTRY(x86_64_call4) ret ENTRY(x86_64_call5) - subq $40,%rsp + subq $48,%rsp mov %r9,32(%rsp) mov %r8,%r9 mov %rcx,%r8 mov %rsi,%rcx call *%rdi - addq $40,%rsp + addq $48,%rsp ret ENTRY(x86_64_call6) From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 20:57:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 251D61065696; Mon, 22 Nov 2010 20:57:45 +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 13C9D8FC33; Mon, 22 Nov 2010 20:57:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMKvi1q005657; Mon, 22 Nov 2010 20:57:44 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMKviao005655; Mon, 22 Nov 2010 20:57:44 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011222057.oAMKviao005655@svn.freebsd.org> From: Marius Strobl Date: Mon, 22 Nov 2010 20:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215711 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 20:57:45 -0000 Author: marius Date: Mon Nov 22 20:57:44 2010 New Revision: 215711 URL: http://svn.freebsd.org/changeset/base/215711 Log: Add missing newlines. MFC after: 3 days Modified: head/sys/dev/mii/mii.c Modified: head/sys/dev/mii/mii.c ============================================================================== --- head/sys/dev/mii/mii.c Mon Nov 22 20:52:18 2010 (r215710) +++ head/sys/dev/mii/mii.c Mon Nov 22 20:57:44 2010 (r215711) @@ -137,7 +137,7 @@ miibus_attach(device_t dev) free(children, M_TEMP); } if (nchildren == 0) { - device_printf(dev, "cannot get children"); + device_printf(dev, "cannot get children\n"); return (ENXIO); } ivars = device_get_ivars(dev); @@ -311,12 +311,12 @@ mii_attach(device_t dev, device_t *miibu int bmsr, first, i, nchildren, offset, phymax, phymin, rv; if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) { - printf("%s: phyloc and offloc specified", __func__); + printf("%s: phyloc and offloc specified\n", __func__); return (EINVAL); } if (offloc != MII_OFFSET_ANY && (offloc < 0 || offloc >= MII_NPHY)) { - printf("%s: ivalid offloc %d", __func__, offloc); + printf("%s: ivalid offloc %d\n", __func__, offloc); return (EINVAL); } @@ -325,7 +325,7 @@ mii_attach(device_t dev, device_t *miibu phymax = MII_NPHY - 1; } else { if (phyloc < 0 || phyloc >= MII_NPHY) { - printf("%s: ivalid phyloc %d", __func__, phyloc); + printf("%s: ivalid phyloc %d\n", __func__, phyloc); return (EINVAL); } phymin = phymax = phyloc; @@ -352,7 +352,7 @@ mii_attach(device_t dev, device_t *miibu if (ivars->ifp != ifp || ivars->ifmedia_upd != ifmedia_upd || ivars->ifmedia_sts != ifmedia_sts || ivars->mii_flags != flags) { - printf("%s: non-matching invariant", __func__); + printf("%s: non-matching invariant\n", __func__); return (EINVAL); } /* From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 21:08:14 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F546106566B; Mon, 22 Nov 2010 21:08:14 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [IPv6:2001:470:a803::1]) by mx1.freebsd.org (Postfix) with ESMTP id 8906A8FC14; Mon, 22 Nov 2010 21:08:11 +0000 (UTC) Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 8D925A58ADA; Tue, 23 Nov 2010 05:08:05 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by mail.geekcn.org (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with LMTP id 2CTu6hjOXRwY; Tue, 23 Nov 2010 05:07:59 +0800 (CST) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id 89DB8A585E3; Tue, 23 Nov 2010 05:07:57 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=cWOL9Utjmy2E/C/XufvF59hBwOaEm4FaDinoptNYlDfgghUfqtl3kRAUjZGGnuoRN +Sk9d6wY2c90wNP0cTWcw== Message-ID: <4CEADBA8.7090101@delphij.net> Date: Mon, 22 Nov 2010 13:07:52 -0800 From: Xin LI Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.15) Gecko/20101028 Thunderbird/3.0.10 ThunderBrowse/3.3.2 MIME-Version: 1.0 To: Bernhard Schmidt References: <201011222046.oAMKkcF3005213@svn.freebsd.org> In-Reply-To: <201011222046.oAMKkcF3005213@svn.freebsd.org> X-Enigmail-Version: 1.0.1 OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r215708 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 21:08:14 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 11/22/10 12:46, Bernhard Schmidt wrote: > Author: bschmidt > Date: Mon Nov 22 20:46:38 2010 > New Revision: 215708 > URL: http://svn.freebsd.org/changeset/base/215708 > > Log: > Resurrect amd64 support. > - Many drivers on amd64 are picking system uptime, interrupt time and ticks > via global data structure instead of calling functions for performance > reasons. For now just patch such address so driver will not trigger page > fault when trying to access such data. In future, additional callout may > be added to update data in periodic intervals. > - On amd64 we need to allocate "shadow space" on stack before calling any > function. > > Submitted by: Paul B Mahol Will this be MFC'ed? Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iQEcBAEBCAAGBQJM6tuoAAoJEATO+BI/yjfByfcH/15/qNeim1VF5aUK9h6LWPM0 04dB6K3fu3oKEUNY8bD/w06lZZzTPUW/VNrm+bA6/8gKNxP4MgJunty69kmR6tEG xH67RPz/lVmCMU7zNFByFTGltZVSvyyxrsceD6ZylBaSChBV5UoKBMdDE6cOuPbR D5V/yVxlwJaJkhtoRN/GbKlEyZkDs6pGmhzSRKOptr0n4PZjpiHVlXAxhlZkpILB qITYNGvPjyL/3a3nKMz+eBVMqUofjPsDkmCvvApLQumL7FFSCvLGGHnfqe3Pl5Zq nG5ajDia1wnD2nWdbsFoADv69+T3YYhB8wHwvQ/yGV+h+5NExKjovz4l7AZyEjg= =gImO -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 21:13:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68CA1106564A; Mon, 22 Nov 2010 21:13:42 +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 578D08FC13; Mon, 22 Nov 2010 21:13:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMLDg1X006087; Mon, 22 Nov 2010 21:13:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMLDgwj006085; Mon, 22 Nov 2010 21:13:42 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011222113.oAMLDgwj006085@svn.freebsd.org> From: Marius Strobl Date: Mon, 22 Nov 2010 21:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215713 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 21:13:42 -0000 Author: marius Date: Mon Nov 22 21:13:42 2010 New Revision: 215713 URL: http://svn.freebsd.org/changeset/base/215713 Log: Given that unlike f.e. rgephy(4) this driver doesn't explicitly start an autonegotiation along with manual media selection and ukphy_status() also only reports flow control status when BMCR_AUTOEN is set (at least with gentbi(4) determining the flow control status results in false-positives when not set), use MIIF_NOMANPAUSE. Modified: head/sys/dev/mii/ukphy.c Modified: head/sys/dev/mii/ukphy.c ============================================================================== --- head/sys/dev/mii/ukphy.c Mon Nov 22 21:12:20 2010 (r215712) +++ head/sys/dev/mii/ukphy.c Mon Nov 22 21:13:42 2010 (r215713) @@ -136,6 +136,8 @@ ukphy_attach(device_t dev) sc->mii_service = ukphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 21:20:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F131E106566C; Mon, 22 Nov 2010 21:20:11 +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 DFEFF8FC12; Mon, 22 Nov 2010 21:20:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMLKBGI006295; Mon, 22 Nov 2010 21:20:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMLKBRX006292; Mon, 22 Nov 2010 21:20:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011222120.oAMLKBRX006292@svn.freebsd.org> From: Marius Strobl Date: Mon, 22 Nov 2010 21:20:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215714 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 21:20:12 -0000 Author: marius Date: Mon Nov 22 21:20:11 2010 New Revision: 215714 URL: http://svn.freebsd.org/changeset/base/215714 Log: Given that unlike f.e. rgephy(4) these drivers doen't explicitly start an autonegotiation along with manual media selection and also only report flow control status when BMCR_AUTOEN is set (at least with gentbi(4) determining the flow control status results in false-positives when not set), use MIIF_NOMANPAUSE. Modified: head/sys/dev/mii/gentbi.c head/sys/dev/mii/nsgphy.c Modified: head/sys/dev/mii/gentbi.c ============================================================================== --- head/sys/dev/mii/gentbi.c Mon Nov 22 21:13:42 2010 (r215713) +++ head/sys/dev/mii/gentbi.c Mon Nov 22 21:20:11 2010 (r215714) @@ -172,6 +172,8 @@ gentbi_attach(device_t dev) sc->mii_service = gentbi_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + mii_phy_reset(sc); /* Modified: head/sys/dev/mii/nsgphy.c ============================================================================== --- head/sys/dev/mii/nsgphy.c Mon Nov 22 21:13:42 2010 (r215713) +++ head/sys/dev/mii/nsgphy.c Mon Nov 22 21:20:11 2010 (r215714) @@ -135,6 +135,8 @@ nsgphy_attach(device_t dev) sc->mii_service = nsgphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + mii_phy_reset(sc); /* From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 21:24:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEAAE1065675; Mon, 22 Nov 2010 21:24:29 +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 B30C88FC0A; Mon, 22 Nov 2010 21:24:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMLOTQL006485; Mon, 22 Nov 2010 21:24:29 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMLOTGY006481; Mon, 22 Nov 2010 21:24:29 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011222124.oAMLOTGY006481@svn.freebsd.org> From: Marius Strobl Date: Mon, 22 Nov 2010 21:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215716 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 21:24:30 -0000 Author: marius Date: Mon Nov 22 21:24:29 2010 New Revision: 215716 URL: http://svn.freebsd.org/changeset/base/215716 Log: Add support for flow control. Obtained from: NetBSD (partially) Modified: head/sys/dev/mii/bmtphy.c head/sys/dev/mii/inphy.c head/sys/dev/mii/nsphyter.c Modified: head/sys/dev/mii/bmtphy.c ============================================================================== --- head/sys/dev/mii/bmtphy.c Mon Nov 22 21:22:08 2010 (r215715) +++ head/sys/dev/mii/bmtphy.c Mon Nov 22 21:24:29 2010 (r215716) @@ -153,6 +153,8 @@ bmtphy_attach(device_t dev) sc->mii_service = bmtphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; @@ -243,7 +245,8 @@ bmtphy_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_10_T; if (aux_csr & AUX_CSR_FDX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; } else Modified: head/sys/dev/mii/inphy.c ============================================================================== --- head/sys/dev/mii/inphy.c Mon Nov 22 21:22:08 2010 (r215715) +++ head/sys/dev/mii/inphy.c Mon Nov 22 21:24:29 2010 (r215716) @@ -113,6 +113,8 @@ inphy_attach(device_t dev) sc->mii_service = inphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + ifmedia_add(&mii->mii_media, IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), MII_MEDIA_100_TX, NULL); @@ -197,7 +199,8 @@ inphy_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_10_T; if (scr & SCR_FDX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; } else Modified: head/sys/dev/mii/nsphyter.c ============================================================================== --- head/sys/dev/mii/nsphyter.c Mon Nov 22 21:22:08 2010 (r215715) +++ head/sys/dev/mii/nsphyter.c Mon Nov 22 21:24:29 2010 (r215716) @@ -143,6 +143,8 @@ nsphyter_attach(device_t dev) sc->mii_service = nsphyter_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + #if 1 #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -242,12 +244,8 @@ nsphyter_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_100_TX; if ((physts & PHYSTS_DUPLEX) != 0) -#ifdef notyet mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc); -#else - mii->mii_media_active |= IFM_FDX; -#endif else mii->mii_media_active |= IFM_HDX; } else From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 21:27:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6532F1065679; Mon, 22 Nov 2010 21:27:45 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id EA4C08FC08; Mon, 22 Nov 2010 21:27:44 +0000 (UTC) Received: by gwj20 with SMTP id 20so4610728gwj.13 for ; Mon, 22 Nov 2010 13:27:44 -0800 (PST) Received: by 10.223.111.134 with SMTP id s6mr5735256fap.21.1290461263455; Mon, 22 Nov 2010 13:27:43 -0800 (PST) Received: from maja.lab.techwires.net (p54B4DFDE.dip.t-dialin.net [84.180.223.222]) by mx.google.com with ESMTPS id y1sm1542394fak.15.2010.11.22.13.27.40 (version=SSLv3 cipher=RC4-MD5); Mon, 22 Nov 2010 13:27:41 -0800 (PST) Sender: Bernhard Schmidt From: Bernhard Schmidt To: d@delphij.net Date: Mon, 22 Nov 2010 22:28:00 +0100 User-Agent: KMail/1.12.4 (FreeBSD/9.0-CURRENT; KDE/4.3.5; amd64; ; ) References: <201011222046.oAMKkcF3005213@svn.freebsd.org> <4CEADBA8.7090101@delphij.net> In-Reply-To: <4CEADBA8.7090101@delphij.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201011222228.00984.bschmidt@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215708 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 21:27:45 -0000 On Monday 22 November 2010 22:07:52 Xin LI wrote: > On 11/22/10 12:46, Bernhard Schmidt wrote: > > Author: bschmidt > > Date: Mon Nov 22 20:46:38 2010 > > New Revision: 215708 > > URL: http://svn.freebsd.org/changeset/base/215708 > > > > Log: > > Resurrect amd64 support. > > - Many drivers on amd64 are picking system uptime, interrupt time and > > ticks via global data structure instead of calling functions for > > performance reasons. For now just patch such address so driver will not > > trigger page fault when trying to access such data. In future, additional > > callout may be added to update data in periodic intervals. > > - On amd64 we need to allocate "shadow space" on stack before calling > > any function. > > > > Submitted by: Paul B Mahol > > Will this be MFC'ed? I hope I can squeeze it in before the freeze, so yes. Given the current state of ndis on amd64 it definitely won't make things worse. -- Bernhard From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 21:39:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A461A106566C; Mon, 22 Nov 2010 21:39:35 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78CE58FC15; Mon, 22 Nov 2010 21:39:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMLdZs9006853; Mon, 22 Nov 2010 21:39:35 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMLdZon006852; Mon, 22 Nov 2010 21:39:35 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011222139.oAMLdZon006852@svn.freebsd.org> From: Ulrich Spoerlein Date: Mon, 22 Nov 2010 21:39:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215717 - head/usr.sbin/kernbb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 21:39:35 -0000 Author: uqs Date: Mon Nov 22 21:39:35 2010 New Revision: 215717 URL: http://svn.freebsd.org/changeset/base/215717 Log: Remove kernbb(8) from the source tree. It's been broken for several years and with all the binutils/toolchain changes in flight, it might make more sense to put efforts into dtrace and hwpmc instead. Discussed with: phk PR: bin/83558 Deleted: head/usr.sbin/kernbb/ From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 21:58:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1E1E106564A; Mon, 22 Nov 2010 21:58:00 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96BB48FC08; Mon, 22 Nov 2010 21:58:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMLw07n007395; Mon, 22 Nov 2010 21:58:00 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMLw0AH007393; Mon, 22 Nov 2010 21:58:00 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201011222158.oAMLw0AH007393@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 22 Nov 2010 21:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215719 - head/sys/dev/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 21:58:00 -0000 Author: jkim Date: Mon Nov 22 21:58:00 2010 New Revision: 215719 URL: http://svn.freebsd.org/changeset/base/215719 Log: Resume critical PCI devices (and their children) first, then everything else later. This give us better chance to catch device driver problems. Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Mon Nov 22 21:43:45 2010 (r215718) +++ head/sys/dev/pci/pci.c Mon Nov 22 21:58:00 2010 (r215719) @@ -3022,8 +3022,35 @@ pci_resume(device_t dev) if (!device_is_attached(child)) pci_cfg_save(child, dinfo, 1); } + + /* + * Resume critical devices first, then everything else later. + */ + for (i = 0; i < numdevs; i++) { + child = devlist[i]; + switch (pci_get_class(child)) { + case PCIC_DISPLAY: + case PCIC_MEMORY: + case PCIC_BRIDGE: + case PCIC_BASEPERIPH: + DEVICE_RESUME(child); + break; + } + } + for (i = 0; i < numdevs; i++) { + child = devlist[i]; + switch (pci_get_class(child)) { + case PCIC_DISPLAY: + case PCIC_MEMORY: + case PCIC_BRIDGE: + case PCIC_BASEPERIPH: + break; + default: + DEVICE_RESUME(child); + } + } free(devlist, M_TEMP); - return (bus_generic_resume(dev)); + return (0); } static void From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 22:03:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F8081065672; Mon, 22 Nov 2010 22:03:12 +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 0DCE38FC14; Mon, 22 Nov 2010 22:03:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMM3B56007570; Mon, 22 Nov 2010 22:03:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMM3BT0007567; Mon, 22 Nov 2010 22:03:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011222203.oAMM3BT0007567@svn.freebsd.org> From: Marius Strobl Date: Mon, 22 Nov 2010 22:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215720 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 22:03:12 -0000 Author: marius Date: Mon Nov 22 22:03:11 2010 New Revision: 215720 URL: http://svn.freebsd.org/changeset/base/215720 Log: - Also probe BCM5214 and BCM5222. - Add some DSP init code for BCM5221. The values derived from Apple's GMAC driver and the same init code also exists in Linux's sungem_phy driver. - Only read media status bits when they are valid. Obtained from: NetBSD, OpenBSD Modified: head/sys/dev/mii/bmtphy.c head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/bmtphy.c ============================================================================== --- head/sys/dev/mii/bmtphy.c Mon Nov 22 21:58:00 2010 (r215719) +++ head/sys/dev/mii/bmtphy.c Mon Nov 22 22:03:11 2010 (r215720) @@ -85,6 +85,11 @@ __FBSDID("$FreeBSD$"); static int bmtphy_probe(device_t); static int bmtphy_attach(device_t); +struct bmtphy_softc { + struct mii_softc mii_sc; + int mii_model; +}; + static device_method_t bmtphy_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bmtphy_probe), @@ -100,18 +105,21 @@ static devclass_t bmtphy_devclass; static driver_t bmtphy_driver = { "bmtphy", bmtphy_methods, - sizeof(struct mii_softc) + sizeof(struct bmtphy_softc) }; DRIVER_MODULE(bmtphy, miibus, bmtphy_driver, bmtphy_devclass, 0, 0); static int bmtphy_service(struct mii_softc *, struct mii_data *, int); static void bmtphy_status(struct mii_softc *); +static void bmtphy_reset(struct mii_softc *); static const struct mii_phydesc bmtphys_dp[] = { MII_PHY_DESC(BROADCOM, BCM4401), MII_PHY_DESC(BROADCOM, BCM5201), + MII_PHY_DESC(BROADCOM, BCM5214), MII_PHY_DESC(BROADCOM, BCM5221), + MII_PHY_DESC(BROADCOM, BCM5222), MII_PHY_END }; @@ -137,11 +145,13 @@ bmtphy_probe(device_t dev) static int bmtphy_attach(device_t dev) { - struct mii_softc *sc; - struct mii_attach_args *ma; - struct mii_data *mii; + struct bmtphy_softc *bsc; + struct mii_softc *sc; + struct mii_attach_args *ma; + struct mii_data *mii; - sc = device_get_softc(dev); + bsc = device_get_softc(dev); + sc = &bsc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); mii = ma->mii_data; @@ -155,7 +165,9 @@ bmtphy_attach(device_t dev) sc->mii_flags |= MIIF_NOMANPAUSE; - mii_phy_reset(sc); + bsc->mii_model = MII_MODEL(ma->mii_id2); + + bmtphy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); @@ -196,16 +208,15 @@ bmtphy_service(struct mii_softc *sc, str /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); } static void bmtphy_status(struct mii_softc *sc) { - struct mii_data *mii; - struct ifmedia_entry *ife; - int bmsr, bmcr, aux_csr; + struct mii_data *mii; + struct ifmedia_entry *ife; + int bmsr, bmcr, aux_csr; mii = sc->mii_pdata; ife = mii->mii_media.ifm_cur; @@ -214,7 +225,6 @@ bmtphy_status(struct mii_softc *sc) mii->mii_media_active = IFM_ETHER; bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); - aux_csr = PHY_READ(sc, MII_BMTPHY_AUX_CSR); if (bmsr & BMSR_LINK) mii->mii_media_status |= IFM_ACTIVE; @@ -240,6 +250,7 @@ bmtphy_status(struct mii_softc *sc) return; } + aux_csr = PHY_READ(sc, MII_BMTPHY_AUX_CSR); if (aux_csr & AUX_CSR_SPEED) mii->mii_media_active |= IFM_100_TX; else @@ -252,3 +263,32 @@ bmtphy_status(struct mii_softc *sc) } else mii->mii_media_active = ife->ifm_media; } + +static void +bmtphy_reset(struct mii_softc *sc) +{ + struct bmtphy_softc *bsc; + u_int16_t data; + + bsc = (struct bmtphy_softc *)sc; + + mii_phy_reset(sc); + + if (bsc->mii_model == MII_MODEL_BROADCOM_BCM5221) { + /* Enable shadow register mode. */ + data = PHY_READ(sc, 0x1f); + PHY_WRITE(sc, 0x1f, data | 0x0080); + + /* Enable APD (Auto PowerDetect). */ + data = PHY_READ(sc, MII_BMTPHY_AUX2); + PHY_WRITE(sc, MII_BMTPHY_AUX2, data | 0x0020); + + /* Enable clocks across APD for Auto-MDIX functionality. */ + data = PHY_READ(sc, MII_BMTPHY_INTR); + PHY_WRITE(sc, MII_BMTPHY_INTR, data | 0x0004); + + /* Disable shadow register mode. */ + data = PHY_READ(sc, 0x1f); + PHY_WRITE(sc, 0x1f, data & ~0x0080); + } +} Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Mon Nov 22 21:58:00 2010 (r215719) +++ head/sys/dev/mii/miidevs Mon Nov 22 22:03:11 2010 (r215720) @@ -128,7 +128,9 @@ model ATHEROS F1_7 0x0007 Atheros F1 10 model BROADCOM 3C905B 0x0012 3c905B 10/100 internal PHY model BROADCOM 3C905C 0x0017 3c905C 10/100 internal PHY model BROADCOM BCM5201 0x0021 BCM5201 10/100baseTX PHY +model BROADCOM BCM5214 0x0028 BCM5214 Quad 10/100 PHY model BROADCOM BCM5221 0x001e BCM5221 10/100baseTX PHY +model BROADCOM BCM5222 0x0032 BCM5222 Dual 10/100 PHY model BROADCOM BCM4401 0x0036 BCM4401 10/100baseTX PHY model xxBROADCOM BCM5400 0x0004 Broadcom 1000baseTX PHY model xxBROADCOM BCM5401 0x0005 BCM5401 10/100/1000baseTX PHY From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 22:05:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 64E12106566B; Mon, 22 Nov 2010 22:05:26 +0000 (UTC) Date: Mon, 22 Nov 2010 22:05:26 +0000 From: Alexander Best To: Ulrich Spoerlein Message-ID: <20101122220526.GA63950@freebsd.org> References: <201011222139.oAMLdZon006852@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201011222139.oAMLdZon006852@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215717 - head/usr.sbin/kernbb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 22:05:26 -0000 On Mon Nov 22 10, Ulrich Spoerlein wrote: > Author: uqs > Date: Mon Nov 22 21:39:35 2010 > New Revision: 215717 > URL: http://svn.freebsd.org/changeset/base/215717 > > Log: > Remove kernbb(8) from the source tree. > > It's been broken for several years and with all the binutils/toolchain > changes in flight, it might make more sense to put efforts into dtrace and > hwpmc instead. thanks. :) what about the BB-profiling sections in sys/{amd64,i386}/{amd64,i386}/support.S? do they need to stay? cheers. alex > > Discussed with: phk > PR: bin/83558 > > Deleted: > head/usr.sbin/kernbb/ -- a13x From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 22:06:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E429106566B; Mon, 22 Nov 2010 22:06:30 +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 8C3138FC12; Mon, 22 Nov 2010 22:06:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMM6Uvc007670; Mon, 22 Nov 2010 22:06:30 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMM6URo007668; Mon, 22 Nov 2010 22:06:30 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011222206.oAMM6URo007668@svn.freebsd.org> From: Marius Strobl Date: Mon, 22 Nov 2010 22:06:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215721 - head/sys/dev/cas X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 22:06:30 -0000 Author: marius Date: Mon Nov 22 22:06:30 2010 New Revision: 215721 URL: http://svn.freebsd.org/changeset/base/215721 Log: - Fix and enable support for flow control. - Fix compilation with CAS_DEBUG defined. Modified: head/sys/dev/cas/if_cas.c Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Mon Nov 22 22:03:11 2010 (r215720) +++ head/sys/dev/cas/if_cas.c Mon Nov 22 22:06:30 2010 (r215721) @@ -346,7 +346,7 @@ cas_attach(struct cas_softc *sc) } error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, - MII_PHY_ANY, MII_OFFSET_ANY, 0); + MII_PHY_ANY, MII_OFFSET_ANY, MIIF_DOPAUSE); } /* * Fall back on an internal PHY if no external PHY was found. @@ -366,7 +366,7 @@ cas_attach(struct cas_softc *sc) } error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, - MII_PHY_ANY, MII_OFFSET_ANY, 0); + MII_PHY_ANY, MII_OFFSET_ANY, MIIF_DOPAUSE); } } else { /* @@ -388,7 +388,7 @@ cas_attach(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, - CAS_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); + CAS_PHYAD_EXTERNAL, MII_OFFSET_ANY, MIIF_DOPAUSE); } if (error != 0) { device_printf(sc->sc_dev, "attaching PHYs failed\n"); @@ -1093,8 +1093,7 @@ cas_init_locked(struct cas_softc *sc) /* Set the PAUSE thresholds. We use the maximum OFF threshold. */ CAS_WRITE_4(sc, CAS_RX_PTHRS, - ((111 * 64) << CAS_RX_PTHRS_XOFF_SHFT) | - ((15 * 64) << CAS_RX_PTHRS_XON_SHFT)); + (111 << CAS_RX_PTHRS_XOFF_SHFT) | (15 << CAS_RX_PTHRS_XON_SHFT)); /* RX blanking */ CAS_WRITE_4(sc, CAS_RX_BLANK, @@ -1339,7 +1338,7 @@ cas_init_regs(struct cas_softc *sc) CAS_WRITE_4(sc, CAS_MAC_PREAMBLE_LEN, 0x7); CAS_WRITE_4(sc, CAS_MAC_JAM_SIZE, 0x4); CAS_WRITE_4(sc, CAS_MAC_ATTEMPT_LIMIT, 0x10); - CAS_WRITE_4(sc, CAS_MAC_CTRL_TYPE, 0x8088); + CAS_WRITE_4(sc, CAS_MAC_CTRL_TYPE, 0x8808); /* random number seed */ CAS_WRITE_4(sc, CAS_MAC_RANDOM_SEED, @@ -1572,11 +1571,11 @@ cas_tint(struct cas_softc *sc) } #ifdef CAS_DEBUG - CTR4(KTR_CAS, "%s: CAS_TX_STATE_MACHINE %x CAS_TX_DESC_BASE %llx " + CTR5(KTR_CAS, "%s: CAS_TX_SM1 %x CAS_TX_SM2 %x CAS_TX_DESC_BASE %llx " "CAS_TX_COMP3 %x", - __func__, CAS_READ_4(sc, CAS_TX_STATE_MACHINE), - ((long long)CAS_READ_4(sc, CAS_TX_DESC_BASE_HI3) << 32) | - CAS_READ_4(sc, CAS_TX_DESC_BASE_LO3), + __func__, CAS_READ_4(sc, CAS_TX_SM1), CAS_READ_4(sc, CAS_TX_SM2), + ((long long)CAS_READ_4(sc, CAS_TX_DESC3_BASE_HI) << 32) | + CAS_READ_4(sc, CAS_TX_DESC3_BASE_LO), CAS_READ_4(sc, CAS_TX_COMP3)); #endif @@ -1638,7 +1637,7 @@ cas_rint(struct cas_softc *sc) rxhead = CAS_READ_4(sc, CAS_RX_COMP_HEAD); #ifdef CAS_DEBUG CTR4(KTR_CAS, "%s: sc->sc_rxcptr %d, sc->sc_rxdptr %d, head %d", - __func__, sc->rxcptr, sc->sc_rxdptr, rxhead); + __func__, sc->sc_rxcptr, sc->sc_rxdptr, rxhead); #endif skip = 0; CAS_CDSYNC(sc, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -1865,7 +1864,7 @@ cas_rint(struct cas_softc *sc) #ifdef CAS_DEBUG CTR4(KTR_CAS, "%s: done sc->sc_rxcptr %d, sc->sc_rxdptr %d, head %d", - __func__, sc->rxcptr, sc->sc_rxdptr, + __func__, sc->sc_rxcptr, sc->sc_rxdptr, CAS_READ_4(sc, CAS_RX_COMP_HEAD)); #endif } @@ -1988,7 +1987,7 @@ cas_intr_task(void *arg, int pending __u #ifdef CAS_DEBUG CTR4(KTR_CAS, "%s: %s: cplt %x, status %x", device_get_name(sc->sc_dev), __func__, - (status >> CAS_STATUS_TX_COMP3_SHIFT), (u_int)status); + (status >> CAS_STATUS_TX_COMP3_SHFT), (u_int)status); /* * PCS interrupts must be cleared, otherwise no traffic is passed! @@ -2100,15 +2099,15 @@ cas_watchdog(struct cas_softc *sc) #ifdef CAS_DEBUG CTR4(KTR_CAS, - "%s: CAS_RX_CONFIG %x CAS_MAC_RX_STATUS %x CAS_MAC_RX_CONFIG %x", - __func__, CAS_READ_4(sc, CAS_RX_CONFIG), + "%s: CAS_RX_CONF %x CAS_MAC_RX_STATUS %x CAS_MAC_RX_CONF %x", + __func__, CAS_READ_4(sc, CAS_RX_CONF), CAS_READ_4(sc, CAS_MAC_RX_STATUS), - CAS_READ_4(sc, CAS_MAC_RX_CONFIG)); + CAS_READ_4(sc, CAS_MAC_RX_CONF)); CTR4(KTR_CAS, - "%s: CAS_TX_CONFIG %x CAS_MAC_TX_STATUS %x CAS_MAC_TX_CONFIG %x", - __func__, CAS_READ_4(sc, CAS_TX_CONFIG), + "%s: CAS_TX_CONF %x CAS_MAC_TX_STATUS %x CAS_MAC_TX_CONF %x", + __func__, CAS_READ_4(sc, CAS_TX_CONF), CAS_READ_4(sc, CAS_MAC_TX_STATUS), - CAS_READ_4(sc, CAS_MAC_TX_CONFIG)); + CAS_READ_4(sc, CAS_MAC_TX_CONF)); #endif if (sc->sc_wdog_timer == 0 || --sc->sc_wdog_timer != 0) @@ -2356,14 +2355,12 @@ cas_mii_statchg(device_t dev) v = CAS_READ_4(sc, CAS_MAC_CTRL_CONF) & ~(CAS_MAC_CTRL_CONF_TXP | CAS_MAC_CTRL_CONF_RXP); -#ifdef notyet if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) v |= CAS_MAC_CTRL_CONF_RXP; if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) v |= CAS_MAC_CTRL_CONF_TXP; -#endif CAS_WRITE_4(sc, CAS_MAC_CTRL_CONF, v); /* From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 22:13:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 329CE106566C; Mon, 22 Nov 2010 22:13:27 +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 158368FC14; Mon, 22 Nov 2010 22:13:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMMDQld007958; Mon, 22 Nov 2010 22:13:26 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMMDQRB007956; Mon, 22 Nov 2010 22:13:26 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011222213.oAMMDQRB007956@svn.freebsd.org> From: Marius Strobl Date: Mon, 22 Nov 2010 22:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215722 - head/sys/dev/gem X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 22:13:27 -0000 Author: marius Date: Mon Nov 22 22:13:26 2010 New Revision: 215722 URL: http://svn.freebsd.org/changeset/base/215722 Log: - Fix and enable support for flow control. - Partially revert r172334; as it turns out the DELAYs in gem_reset_{r,t}x() are actually necessary although bus space barriers and gem_bitwait() are used, otherwise the controller may trigger an IOMMU errors on at least sparc64. This is in line with what Linux and OpenSolaris do. Modified: head/sys/dev/gem/if_gem.c Modified: head/sys/dev/gem/if_gem.c ============================================================================== --- head/sys/dev/gem/if_gem.c Mon Nov 22 22:06:30 2010 (r215721) +++ head/sys/dev/gem/if_gem.c Mon Nov 22 22:13:26 2010 (r215722) @@ -302,7 +302,7 @@ gem_attach(struct gem_softc *sc) } error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, - MII_OFFSET_ANY, 0); + MII_OFFSET_ANY, MIIF_DOPAUSE); } /* @@ -330,7 +330,7 @@ gem_attach(struct gem_softc *sc) } error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, - MII_OFFSET_ANY, 0); + MII_OFFSET_ANY, MIIF_DOPAUSE); } /* @@ -352,7 +352,7 @@ gem_attach(struct gem_softc *sc) sc->sc_flags |= GEM_SERDES; error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, - GEM_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); + GEM_PHYAD_EXTERNAL, MII_OFFSET_ANY, MIIF_DOPAUSE); } if (error != 0) { device_printf(sc->sc_dev, "attaching PHYs failed\n"); @@ -712,6 +712,9 @@ gem_reset_rx(struct gem_softc *sc) if (!GEM_BANK1_BITWAIT(sc, GEM_RX_CONFIG, GEM_RX_CONFIG_RXDMA_EN, 0)) device_printf(sc->sc_dev, "cannot disable RX DMA\n"); + /* Wait 5ms extra. */ + DELAY(5000); + /* Finally, reset the ERX. */ GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_RX); GEM_BANK2_BARRIER(sc, GEM_RESET, 4, @@ -784,6 +787,9 @@ gem_reset_tx(struct gem_softc *sc) if (!GEM_BANK1_BITWAIT(sc, GEM_TX_CONFIG, GEM_TX_CONFIG_TXDMA_EN, 0)) device_printf(sc->sc_dev, "cannot disable TX DMA\n"); + /* Wait 5ms extra. */ + DELAY(5000); + /* Finally, reset the ETX. */ GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_TX); GEM_BANK2_BARRIER(sc, GEM_RESET, 4, @@ -1239,7 +1245,7 @@ gem_init_regs(struct gem_softc *sc) GEM_BANK1_WRITE_4(sc, GEM_MAC_PREAMBLE_LEN, 0x7); GEM_BANK1_WRITE_4(sc, GEM_MAC_JAM_SIZE, 0x4); GEM_BANK1_WRITE_4(sc, GEM_MAC_ATTEMPT_LIMIT, 0x10); - GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_TYPE, 0x8088); + GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_TYPE, 0x8808); /* random number seed */ GEM_BANK1_WRITE_4(sc, GEM_MAC_RANDOM_SEED, @@ -2039,14 +2045,12 @@ gem_mii_statchg(device_t dev) v = GEM_BANK1_READ_4(sc, GEM_MAC_CONTROL_CONFIG) & ~(GEM_MAC_CC_RX_PAUSE | GEM_MAC_CC_TX_PAUSE); -#ifdef notyet if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) v |= GEM_MAC_CC_RX_PAUSE; if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) v |= GEM_MAC_CC_TX_PAUSE; -#endif GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_CONFIG, v); if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_FDX) == 0 && From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 22:26:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 083BE106566C; Mon, 22 Nov 2010 22:26:35 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (muon.cran.org.uk [IPv6:2a01:348:0:15:5d59:5c40:0:1]) by mx1.freebsd.org (Postfix) with ESMTP id BDD548FC16; Mon, 22 Nov 2010 22:26:34 +0000 (UTC) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id 1F89CE7217; Mon, 22 Nov 2010 22:26:34 +0000 (GMT) Received: from core.draftnet (client-86-29-107-54.glfd.adsl.virginmedia.com [86.29.107.54]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA; Mon, 22 Nov 2010 22:26:32 +0000 (GMT) Date: Mon, 22 Nov 2010 22:26:15 +0000 From: Bruce Cran To: "George V. Neville-Neil" Message-ID: <20101122222615.16aa6bf7@core.draftnet> In-Reply-To: <201011171855.oAHItD95001085@svn.freebsd.org> References: <201011171855.oAHItD95001085@svn.freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215434 - in head: sys/netinet usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 22:26:35 -0000 On Wed, 17 Nov 2010 18:55:13 +0000 (UTC) "George V. Neville-Neil" wrote: > Author: gnn > Date: Wed Nov 17 18:55:12 2010 > New Revision: 215434 > URL: http://svn.freebsd.org/changeset/base/215434 > > Log: > Add new, per connection, statistics for TCP, including: > Retransmitted Packets > Zero Window Advertisements > Out of Order Receives I don't know if it was this checkin that broke it, but netstat now fails to print a newline between the headers and the first line of connection data. -- Bruce Cran From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 22:55:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63595106566B; Mon, 22 Nov 2010 22:55:43 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51B378FC13; Mon, 22 Nov 2010 22:55:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMMth0o008969; Mon, 22 Nov 2010 22:55:43 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMMth2u008967; Mon, 22 Nov 2010 22:55:43 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201011222255.oAMMth2u008967@svn.freebsd.org> From: "George V. Neville-Neil" Date: Mon, 22 Nov 2010 22:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215724 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 22:55:43 -0000 Author: gnn Date: Mon Nov 22 22:55:43 2010 New Revision: 215724 URL: http://svn.freebsd.org/changeset/base/215724 Log: Restore the (state) and \n printout when not using -T. Pointed out by: brucec@ MFC after: 3 weeks Modified: head/usr.bin/netstat/inet.c Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Mon Nov 22 22:41:43 2010 (r215723) +++ head/usr.bin/netstat/inet.c Mon Nov 22 22:55:43 2010 (r215724) @@ -428,13 +428,14 @@ protopr(u_long off, const char *name, in "2msl", "delack", "rcvtime", "(state)"); } - if (!xflag && !Tflag) + if (!xflag && !Tflag) { printf((Aflag && !Wflag) ? "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s" : "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s", "Proto", "Recv-Q", "Send-Q", "Local Address", "Foreign Address"); - + printf("(state)\n"); + } first = 0; } if (Lflag && so->so_qlimit == 0) From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 23:04:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E637106564A; Mon, 22 Nov 2010 23:04:25 +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 6CCA58FC13; Mon, 22 Nov 2010 23:04:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMN4P2I009215; Mon, 22 Nov 2010 23:04:25 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMN4P4e009213; Mon, 22 Nov 2010 23:04:25 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011222304.oAMN4P4e009213@svn.freebsd.org> From: Alexander Motin Date: Mon, 22 Nov 2010 23:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215725 - head/sys/dev/ahci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 23:04:25 -0000 Author: mav Date: Mon Nov 22 23:04:25 2010 New Revision: 215725 URL: http://svn.freebsd.org/changeset/base/215725 Log: Fix small typo. Submitted by: Artem Belevich Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Mon Nov 22 22:55:43 2010 (r215724) +++ head/sys/dev/ahci/ahci.c Mon Nov 22 23:04:25 2010 (r215725) @@ -858,7 +858,7 @@ ahci_ch_attach(device_t dev) ch->caps = ctlr->caps; ch->caps2 = ctlr->caps2; ch->quirks = ctlr->quirks; - ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1, + ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1; mtx_init(&ch->mtx, "AHCI channel lock", NULL, MTX_DEF); resource_int_value(device_get_name(dev), device_get_unit(dev), "pm_level", &ch->pm_level); From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 23:35:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA3FF106566C; Mon, 22 Nov 2010 23:35:29 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD0058FC17; Mon, 22 Nov 2010 23:35:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMNZTJn009957; Mon, 22 Nov 2010 23:35:29 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMNZTeI009955; Mon, 22 Nov 2010 23:35:29 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201011222335.oAMNZTeI009955@svn.freebsd.org> From: Marko Zec Date: Mon, 22 Nov 2010 23:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215726 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 23:35:30 -0000 Author: zec Date: Mon Nov 22 23:35:29 2010 New Revision: 215726 URL: http://svn.freebsd.org/changeset/base/215726 Log: Allow for vlan(4) ifnets to have overlapping unit numbers if they are created in separated vnets. As a side-effect of having a separated if_cloner instance for each vnet, all vlan ifnets created in a vnet will be automatically destroyed when vnet teardown is initiated. Disallow SIOCSETVLAN and SIOCGETVLAN ioctls on vlan ifnets which are associated with physical ifnets residing in parent vnets. This is an interim vlan-specific solution which will be superseded by a more generic if_cloner V_irtualization change from p4. For nooptions VIMAGE builds, this should be a no-op change. Discussed with: bz MFC after: 3 days Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Mon Nov 22 23:04:25 2010 (r215725) +++ head/sys/net/if_vlan.c Mon Nov 22 23:35:29 2010 (r215726) @@ -206,6 +206,11 @@ static void vlan_iflladdr(void *arg, st static struct if_clone vlan_cloner = IFC_CLONE_INITIALIZER(VLANNAME, NULL, IF_MAXUNIT, NULL, vlan_clone_match, vlan_clone_create, vlan_clone_destroy); +#ifdef VIMAGE +static VNET_DEFINE(struct if_clone, vlan_cloner); +#define V_vlan_cloner VNET(vlan_cloner) +#endif + #ifndef VLAN_ARRAY #define HASH(n, m) ((((n) >> 8) ^ ((n) >> 4) ^ (n)) & (m)) @@ -588,7 +593,9 @@ vlan_modevent(module_t mod, int type, vo vlan_input_p = vlan_input; vlan_link_state_p = vlan_link_state; vlan_trunk_cap_p = vlan_trunk_capabilities; +#ifndef VIMAGE if_clone_attach(&vlan_cloner); +#endif if (bootverbose) printf("vlan: initialized, using " #ifdef VLAN_ARRAY @@ -600,7 +607,9 @@ vlan_modevent(module_t mod, int type, vo "\n"); break; case MOD_UNLOAD: +#ifndef VIMAGE if_clone_detach(&vlan_cloner); +#endif EVENTHANDLER_DEREGISTER(ifnet_departure_event, ifdetach_tag); EVENTHANDLER_DEREGISTER(iflladdr_event, iflladdr_tag); vlan_input_p = NULL; @@ -625,6 +634,27 @@ static moduledata_t vlan_mod = { DECLARE_MODULE(if_vlan, vlan_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_vlan, 3); +#ifdef VIMAGE +static void +vnet_vlan_init(const void *unused __unused) +{ + + V_vlan_cloner = vlan_cloner; + if_clone_attach(&V_vlan_cloner); +} +VNET_SYSINIT(vnet_vlan_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_vlan_init, NULL); + +static void +vnet_vlan_uninit(const void *unused __unused) +{ + + if_clone_detach(&V_vlan_cloner); +} +VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, + vnet_vlan_uninit, NULL); +#endif + static struct ifnet * vlan_clone_match_ethertag(struct if_clone *ifc, const char *name, int *tag) { @@ -1432,6 +1462,12 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd break; case SIOCSETVLAN: +#ifdef VIMAGE + if (ifp->if_vnet != ifp->if_home_vnet) { + error = EPERM; + break; + } +#endif error = copyin(ifr->ifr_data, &vlr, sizeof(vlr)); if (error) break; @@ -1461,6 +1497,12 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd break; case SIOCGETVLAN: +#ifdef VIMAGE + if (ifp->if_vnet != ifp->if_home_vnet) { + error = EPERM; + break; + } +#endif bzero(&vlr, sizeof(vlr)); VLAN_LOCK(); if (TRUNK(ifv) != NULL) { From owner-svn-src-head@FreeBSD.ORG Mon Nov 22 23:49:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93B87106564A; Mon, 22 Nov 2010 23:49:06 +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 824E38FC08; Mon, 22 Nov 2010 23:49:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAMNn6cP010256; Mon, 22 Nov 2010 23:49:06 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAMNn6Ro010254; Mon, 22 Nov 2010 23:49:06 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201011222349.oAMNn6Ro010254@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 22 Nov 2010 23:49:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215727 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 23:49:06 -0000 Author: jilles Date: Mon Nov 22 23:49:06 2010 New Revision: 215727 URL: http://svn.freebsd.org/changeset/base/215727 Log: sh: Fix confusing behaviour if chdir succeeded but getcwd failed in cd -P. If getcwd fails, do not treat this as an error, but print a warning and unset PWD. This is similar to the behaviour when starting the shell in a directory whose name cannot be determined. Modified: head/bin/sh/cd.c Modified: head/bin/sh/cd.c ============================================================================== --- head/bin/sh/cd.c Mon Nov 22 23:35:29 2010 (r215726) +++ head/bin/sh/cd.c Mon Nov 22 23:49:06 2010 (r215727) @@ -219,10 +219,13 @@ cdphysical(char *dest) char *p; INTOFF; - if (chdir(dest) < 0 || (p = findcwd(NULL)) == NULL) { + if (chdir(dest) < 0) { INTON; return (-1); } + p = findcwd(NULL); + if (p == NULL) + out2fmt_flush("cd: warning: failed to get name of current directory\n"); updatepwd(p); INTON; return (0); @@ -304,7 +307,7 @@ updatepwd(char *dir) if (prevdir) ckfree(prevdir); prevdir = curdir; - curdir = savestr(dir); + curdir = dir ? savestr(dir) : NULL; setvar("PWD", curdir, VEXPORT); setvar("OLDPWD", prevdir, VEXPORT); } From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 04:50:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AAEF1065670; Tue, 23 Nov 2010 04:50:01 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 866A68FC19; Tue, 23 Nov 2010 04:50:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAN4o1jR017078; Tue, 23 Nov 2010 04:50:01 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAN4o1wb017076; Tue, 23 Nov 2010 04:50:01 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201011230450.oAN4o1wb017076@svn.freebsd.org> From: Colin Percival Date: Tue, 23 Nov 2010 04:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215732 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 04:50:01 -0000 Author: cperciva Date: Tue Nov 23 04:50:01 2010 New Revision: 215732 URL: http://svn.freebsd.org/changeset/base/215732 Log: Add parentheses for clarity. The parentheses around the two terms of the && are unnecessary but I'm leaving them in for the sake of avoiding confusion (I confuse easily). Submitted by: bde Modified: head/sys/kern/kern_tc.c Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Tue Nov 23 03:53:53 2010 (r215731) +++ head/sys/kern/kern_tc.c Tue Nov 23 04:50:01 2010 (r215732) @@ -448,7 +448,7 @@ tc_windup(void) th->th_offset.sec++; } if ((delta > th->th_counter->tc_frequency / 2) && - (th->th_scale * delta < (uint64_t)1 << 63)) { + (th->th_scale * delta < ((uint64_t)1 << 63))) { /* The product th_scale * delta just barely overflows. */ th->th_offset.sec++; } From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 06:31:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32E27106566C; Tue, 23 Nov 2010 06:31:10 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 158CA8FC0A; Tue, 23 Nov 2010 06:31:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAN6V9eB019126; Tue, 23 Nov 2010 06:31:09 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAN6V9S7019124; Tue, 23 Nov 2010 06:31:09 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201011230631.oAN6V9S7019124@svn.freebsd.org> From: Maxim Konovalov Date: Tue, 23 Nov 2010 06:31:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215733 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 06:31:10 -0000 Author: maxim Date: Tue Nov 23 06:31:09 2010 New Revision: 215733 URL: http://svn.freebsd.org/changeset/base/215733 Log: o NetBSD 5.1 added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Tue Nov 23 04:50:01 2010 (r215732) +++ head/share/misc/bsd-family-tree Tue Nov 23 06:31:09 2010 (r215733) @@ -228,20 +228,20 @@ FreeBSD 5.2 | | | FreeBSD 7.1 | | | | | | | | | DragonFly 2.2.0 | FreeBSD 7.2 | NetBSD 5.0 OpenBSD 4.5 | - | \ | | | | - | | | | | DragonFly 2.4.0 - | | | | OpenBSD 4.6 | - | | | | | | - *--FreeBSD | | | | | - | 8.0 | | | | | - | | FreeBSD | | | | - | | 7.3 | | | DragonFly 2.6.0 - | | | | OpenBSD 4.7 | - | FreeBSD | | | | - | 8.1 | | | | - | | | | | DragonFly 2.8.0 - | | | | OpenBSD 4.8 | - | V | | | | + | \ | | | | | + | | | | | | DragonFly 2.4.0 + | | | | | OpenBSD 4.6 | + | | | | | | | + *--FreeBSD | | | | | | + | 8.0 | | | | | | + | | FreeBSD | | | | | + | | 7.3 | | | | DragonFly 2.6.0 + | | | | | OpenBSD 4.7 | + | FreeBSD | | | | | + | 8.1 | | | | | + | | | | | | DragonFly 2.8.0 + | | | | | OpenBSD 4.8 | + | V | | NetBSD 5.1 | | | | | | | FreeBSD 9 -current | NetBSD -current OpenBSD -current | | | | | | @@ -523,6 +523,7 @@ OpenBSD 4.7 2010-05-19 [OBD] FreeBSD 8.1 2010-07-24 [FBD] DragonFly 2.8.0 2010-10-30 [DFB] OpenBSD 4.8 2010-11-01 [OBD] +NetBSD 5.1 2010-11-19 [NBD] Bibliography ------------------------ From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 08:15:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 929491065672; Tue, 23 Nov 2010 08:15:14 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 662828FC25; Tue, 23 Nov 2010 08:15:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAN8FEmh021372; Tue, 23 Nov 2010 08:15:14 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAN8FEwg021369; Tue, 23 Nov 2010 08:15:14 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <201011230815.oAN8FEwg021369@svn.freebsd.org> From: Nick Hibma Date: Tue, 23 Nov 2010 08:15:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215734 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 08:15:14 -0000 Author: n_hibma Date: Tue Nov 23 08:15:14 2010 New Revision: 215734 URL: http://svn.freebsd.org/changeset/base/215734 Log: Make the Huawei E1820 work (Emile Coetzee). Shorten the descriptive strings for Huawei devices. The vendor or operator name should not be included in the device name. Submitted by: Emile Coetzee MFC after: 3 days Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Tue Nov 23 06:31:09 2010 (r215733) +++ head/sys/dev/usb/serial/u3g.c Tue Nov 23 08:15:14 2010 (r215734) @@ -281,12 +281,12 @@ static const struct usb_device_id u3g_de U3G_DEV(HUAWEI, E143D, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E143E, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E143F, U3GINIT_HUAWEI), - U3G_DEV(HUAWEI, E14AC, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E180V, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, MOBILE, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E1752, U3GINIT_HUAWEISCSI), + U3G_DEV(HUAWEI, E1820, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, K3765, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, K3765_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(KYOCERA2, CDMA_MSM_K, 0), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Nov 23 06:31:09 2010 (r215733) +++ head/sys/dev/usb/usbdevs Tue Nov 23 08:15:14 2010 (r215734) @@ -1789,8 +1789,8 @@ product HTC LEGENDINTERNET 0x0ffe HTC Le /* HUAWEI products */ product HUAWEI MOBILE 0x1001 Huawei Mobile -product HUAWEI E220 0x1003 Huawei HSDPA modem -product HUAWEI E220BIS 0x1004 Huawei HSDPA modem +product HUAWEI E220 0x1003 HSDPA modem +product HUAWEI E220BIS 0x1004 HSDPA modem product HUAWEI E1401 0x1401 3G modem product HUAWEI E1402 0x1402 3G modem product HUAWEI E1403 0x1403 3G modem @@ -1802,7 +1802,7 @@ product HUAWEI E1408 0x1408 3G modem product HUAWEI E1409 0x1409 3G modem product HUAWEI E140A 0x140a 3G modem product HUAWEI E140B 0x140b 3G modem -product HUAWEI E180V 0x140c Huawei Mobile E180V +product HUAWEI E180V 0x140c E180V product HUAWEI E140D 0x140d 3G modem product HUAWEI E140E 0x140e 3G modem product HUAWEI E140F 0x140f 3G modem @@ -1856,8 +1856,8 @@ product HUAWEI E143E 0x143e 3G modem product HUAWEI E143F 0x143f 3G modem product HUAWEI E1752 0x1446 3G modem product HUAWEI K3765 0x1465 3G modem -product HUAWEI E14AC 0x14ac 3G modem -product HUAWEI K3765_INIT 0x1520 HUAWEI Mobile K3765 Initial +product HUAWEI E1820 0x14ac E1820 HSPA+ USB Slider +product HUAWEI K3765_INIT 0x1520 K3765 Initial /* HUAWEI 3com products */ product HUAWEI3COM WUB320G 0x0009 Aolynk WUB320g From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 08:26:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 578081065672; Tue, 23 Nov 2010 08:26:45 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id 944958FC2B; Tue, 23 Nov 2010 08:26:44 +0000 (UTC) Received: from outgoing.leidinger.net (p57B3A216.dip.t-dialin.net [87.179.162.22]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id 9CCD184400F; Tue, 23 Nov 2010 09:26:41 +0100 (CET) Received: from webmail.leidinger.net (unknown [IPv6:fd73:10c7:2053:1::2:102]) by outgoing.leidinger.net (Postfix) with ESMTP id CAE0E25C0; Tue, 23 Nov 2010 09:26:37 +0100 (CET) Received: (from www@localhost) by webmail.leidinger.net (8.14.4/8.13.8/Submit) id oAN8QWfm028129; Tue, 23 Nov 2010 09:26:32 +0100 (CET) (envelope-from Alexander@Leidinger.net) Received: from pslux.ec.europa.eu (pslux.ec.europa.eu [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Tue, 23 Nov 2010 09:26:32 +0100 Message-ID: <20101123092632.130310qq4z17lf40@webmail.leidinger.net> Date: Tue, 23 Nov 2010 09:26:32 +0100 From: Alexander Leidinger To: Dimitry Andric References: <201011222023.oAMKNI4c004542@svn.freebsd.org> In-Reply-To: <201011222023.oAMKNI4c004542@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: 9CCD184400F.A1853 X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=1.351, required 6, autolearn=disabled, RDNS_NONE 1.27, TW_SV 0.08) X-EBL-MailScanner-SpamScore: s X-EBL-MailScanner-From: alexander@leidinger.net X-EBL-MailScanner-Watermark: 1291105601.8629@E6cJc5en09a2IEQah9NOzg X-EBL-Spam-Status: No Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r215706 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 08:26:45 -0000 Quoting Dimitry Andric (from Mon, 22 Nov 2010 20:23:18 +0000 (UTC)): > Author: dim > Date: Mon Nov 22 20:23:18 2010 > New Revision: 215706 > URL: http://svn.freebsd.org/changeset/base/215706 > > Log: > Fix linux kernel module breakage introduced in r215675, by including > . Thanks! > Noticed by: many > Pointy hat to: netchild > > Modified: > head/sys/compat/linux/linux_emul.c Bye, Alexander. -- "I keep seeing spots in front of my eyes." "Did you ever see a doctor?" "No, just spots." http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 12:47:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEBCE10656AA; Tue, 23 Nov 2010 12:47:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C2B48FC08; Tue, 23 Nov 2010 12:47:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANClF7g030531; Tue, 23 Nov 2010 12:47:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANClFDV030528; Tue, 23 Nov 2010 12:47:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011231247.oANClFDV030528@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 23 Nov 2010 12:47:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215741 - head/sys/compat/ia32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 12:47:15 -0000 Author: kib Date: Tue Nov 23 12:47:15 2010 New Revision: 215741 URL: http://svn.freebsd.org/changeset/base/215741 Log: Add include guards. MFC after: 3 days Modified: head/sys/compat/ia32/ia32_signal.h head/sys/compat/ia32/ia32_util.h Modified: head/sys/compat/ia32/ia32_signal.h ============================================================================== --- head/sys/compat/ia32/ia32_signal.h Tue Nov 23 11:41:40 2010 (r215740) +++ head/sys/compat/ia32/ia32_signal.h Tue Nov 23 12:47:15 2010 (r215741) @@ -29,6 +29,9 @@ * $FreeBSD$ */ +#ifndef _COMPAT_IA32_IA32_SIGNAL_H +#define _COMPAT_IA32_IA32_SIGNAL_H + struct ia32_mcontext { u_int32_t mc_onstack; /* XXX - sigcontext compat. */ u_int32_t mc_gs; /* machine state (struct trapframe) */ @@ -188,3 +191,5 @@ extern int sz_freebsd4_ia32_sigcode; extern void ia32_sendsig(sig_t, struct ksiginfo *, sigset_t *); extern void ia32_setregs(struct thread *td, struct image_params *imgp, u_long stack); + +#endif Modified: head/sys/compat/ia32/ia32_util.h ============================================================================== --- head/sys/compat/ia32/ia32_util.h Tue Nov 23 11:41:40 2010 (r215740) +++ head/sys/compat/ia32/ia32_util.h Tue Nov 23 12:47:15 2010 (r215741) @@ -28,6 +28,9 @@ * $FreeBSD$ */ +#ifndef _COMPAT_IA32_IA32_UTIL_H +#define _COMPAT_IA32_IA32_UTIL_H + #include #include #include @@ -51,3 +54,5 @@ struct syscall_args; int ia32_fetch_syscall_args(struct thread *td, struct syscall_args *sa); void ia32_set_syscall_retval(struct thread *, int); + +#endif From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 12:51:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5551D106566C; Tue, 23 Nov 2010 12:51:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4430C8FC18; Tue, 23 Nov 2010 12:51:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANCp90x030640; Tue, 23 Nov 2010 12:51:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANCp9aR030638; Tue, 23 Nov 2010 12:51:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011231251.oANCp9aR030638@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 23 Nov 2010 12:51:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215742 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 12:51:09 -0000 Author: kib Date: Tue Nov 23 12:51:08 2010 New Revision: 215742 URL: http://svn.freebsd.org/changeset/base/215742 Log: Add PT_GNU_STACK definition. MFC after: 3 days Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Tue Nov 23 12:47:15 2010 (r215741) +++ head/sys/sys/elf_common.h Tue Nov 23 12:51:08 2010 (r215742) @@ -325,6 +325,7 @@ typedef struct { #define PT_LOOS 0x60000000 /* First OS-specific. */ #define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */ #define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_STACK 0x6474e551 #define PT_LOSUNW 0x6ffffffa #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */ From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 13:49:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECA80106564A; Tue, 23 Nov 2010 13:49:15 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C05788FC0C; Tue, 23 Nov 2010 13:49:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANDnFk6032225; Tue, 23 Nov 2010 13:49:15 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANDnFl2032222; Tue, 23 Nov 2010 13:49:15 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201011231349.oANDnFl2032222@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 23 Nov 2010 13:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215747 - in head/sys: compat/freebsd32 kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 13:49:16 -0000 Author: pluknet Date: Tue Nov 23 13:49:15 2010 New Revision: 215747 URL: http://svn.freebsd.org/changeset/base/215747 Log: Update MNT_ROOTFS comments after changes in the root mount logic. Reported by: arundel Suggested by: marcel (phrasing) Approved by: kib (mentor) Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/vfs_mount.c Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Nov 23 13:37:42 2010 (r215746) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Nov 23 13:49:15 2010 (r215747) @@ -2365,7 +2365,8 @@ freebsd32_nmount(struct thread *td, * Filter out MNT_ROOTFS. We do not want clients of nmount() in * userspace to set this flag, but we must filter it out if we want * MNT_UPDATE on the root file system to work. - * MNT_ROOTFS should only be set in the kernel in vfs_mountroot_try(). + * MNT_ROOTFS should only be set by the kernel when mounting its + * root file system. */ uap->flags &= ~MNT_ROOTFS; Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Tue Nov 23 13:37:42 2010 (r215746) +++ head/sys/kern/vfs_mount.c Tue Nov 23 13:49:15 2010 (r215747) @@ -383,7 +383,8 @@ nmount(td, uap) * Filter out MNT_ROOTFS. We do not want clients of nmount() in * userspace to set this flag, but we must filter it out if we want * MNT_UPDATE on the root file system to work. - * MNT_ROOTFS should only be set in the kernel in vfs_mountroot_try(). + * MNT_ROOTFS should only be set by the kernel when mounting its + * root file system. */ uap->flags &= ~MNT_ROOTFS; @@ -720,7 +721,8 @@ mount(td, uap) * Filter out MNT_ROOTFS. We do not want clients of mount() in * userspace to set this flag, but we must filter it out if we want * MNT_UPDATE on the root file system to work. - * MNT_ROOTFS should only be set in the kernel in vfs_mountroot_try(). + * MNT_ROOTFS should only be set by the kernel when mounting its + * root file system. */ uap->flags &= ~MNT_ROOTFS; From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 13:55:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 336A11065672; Tue, 23 Nov 2010 13:55:31 +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 21B428FC16; Tue, 23 Nov 2010 13:55:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANDtVQC032421; Tue, 23 Nov 2010 13:55:31 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANDtV0D032418; Tue, 23 Nov 2010 13:55:31 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011231355.oANDtV0D032418@svn.freebsd.org> From: Andriy Gapon Date: Tue, 23 Nov 2010 13:55:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215748 - in head/sys: amd64/include i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 13:55:31 -0000 Author: avg Date: Tue Nov 23 13:55:30 2010 New Revision: 215748 URL: http://svn.freebsd.org/changeset/base/215748 Log: specialreg.h: add definitions for some useful bits found in CPUID.6 EAX and ECX CPUID.6 is defined as Thermal and Power Management Leaf by both Intel and AMD. Reviewed by: jhb MFC after: 7 days Modified: head/sys/amd64/include/specialreg.h head/sys/i386/include/specialreg.h Modified: head/sys/amd64/include/specialreg.h ============================================================================== --- head/sys/amd64/include/specialreg.h Tue Nov 23 13:49:15 2010 (r215747) +++ head/sys/amd64/include/specialreg.h Tue Nov 23 13:55:30 2010 (r215748) @@ -136,6 +136,15 @@ #define CPUID2_AESNI 0x02000000 /* + * Important bits in the Thermal and Power Management flags + * CPUID.6 EAX and ECX. + */ +#define CPUTPM1_SENSOR 0x00000001 +#define CPUTPM1_TURBO 0x00000002 +#define CPUTPM1_ARAT 0x00000004 +#define CPUTPM2_EFFREQ 0x00000001 + +/* * Important bits in the AMD extended cpuid flags */ #define AMDID_SYSCALL 0x00000800 Modified: head/sys/i386/include/specialreg.h ============================================================================== --- head/sys/i386/include/specialreg.h Tue Nov 23 13:49:15 2010 (r215747) +++ head/sys/i386/include/specialreg.h Tue Nov 23 13:55:30 2010 (r215748) @@ -133,6 +133,15 @@ #define CPUID2_AESNI 0x02000000 /* + * Important bits in the Thermal and Power Management flags + * CPUID.6 EAX and ECX. + */ +#define CPUTPM1_SENSOR 0x00000001 +#define CPUTPM1_TURBO 0x00000002 +#define CPUTPM1_ARAT 0x00000004 +#define CPUTPM2_EFFREQ 0x00000001 + +/* * Important bits in the AMD extended cpuid flags */ #define AMDID_SYSCALL 0x00000800 From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 14:30:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6F91106566C; Tue, 23 Nov 2010 14:30:22 +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 D58ED8FC15; Tue, 23 Nov 2010 14:30:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANEUMWC033368; Tue, 23 Nov 2010 14:30:22 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANEUMs4033366; Tue, 23 Nov 2010 14:30:22 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011231430.oANEUMs4033366@svn.freebsd.org> From: Andriy Gapon Date: Tue, 23 Nov 2010 14:30:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215750 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 14:30:23 -0000 Author: avg Date: Tue Nov 23 14:30:22 2010 New Revision: 215750 URL: http://svn.freebsd.org/changeset/base/215750 Log: taskqueue: drop unused tq_name field tq_name was used write-only and besides it was just a pointer, so it could point to some garbage in a temporary buffer that's gone. This change shouldn't change KPI/KBI as struct taskqueue is private to subr_taskqueue.c. If we find a need for tq_name it can be resurrected at any moment. taskqueue_create() interface is preserved for this purpose. Suggested by: jhb MFC after: 10 days Modified: head/sys/kern/subr_taskqueue.c Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Tue Nov 23 14:13:12 2010 (r215749) +++ head/sys/kern/subr_taskqueue.c Tue Nov 23 14:30:22 2010 (r215750) @@ -53,7 +53,6 @@ struct taskqueue_busy { struct taskqueue { STAILQ_HEAD(, task) tq_queue; - const char *tq_name; taskqueue_enqueue_fn tq_enqueue; void *tq_context; TAILQ_HEAD(, taskqueue_busy) tq_active; @@ -94,7 +93,7 @@ TQ_SLEEP(struct taskqueue *tq, void *p, } static struct taskqueue * -_taskqueue_create(const char *name, int mflags, +_taskqueue_create(const char *name __unused, int mflags, taskqueue_enqueue_fn enqueue, void *context, int mtxflags, const char *mtxname) { @@ -106,7 +105,6 @@ _taskqueue_create(const char *name, int STAILQ_INIT(&queue->tq_queue); TAILQ_INIT(&queue->tq_active); - queue->tq_name = name; queue->tq_enqueue = enqueue; queue->tq_context = context; queue->tq_spin = (mtxflags & MTX_SPIN) != 0; From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 14:36:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 182241065694; Tue, 23 Nov 2010 14:36:15 +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 068048FC16; Tue, 23 Nov 2010 14:36:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANEaER2033557; Tue, 23 Nov 2010 14:36:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANEaEtb033555; Tue, 23 Nov 2010 14:36:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011231436.oANEaEtb033555@svn.freebsd.org> From: Andriy Gapon Date: Tue, 23 Nov 2010 14:36:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215751 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 14:36:15 -0000 Author: avg Date: Tue Nov 23 14:36:14 2010 New Revision: 215751 URL: http://svn.freebsd.org/changeset/base/215751 Log: x86/local_apic: use newly added ARAT bit definition ARAT: APIC-Timer-always-running feature. Suggested by: mav MFC after: 12 days Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Tue Nov 23 14:30:22 2010 (r215750) +++ head/sys/x86/x86/local_apic.c Tue Nov 23 14:36:14 2010 (r215751) @@ -251,7 +251,7 @@ lapic_init(vm_paddr_t addr) /* Intel CPUID 0x06 EAX[2] set if APIC timer runs in C3. */ if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_high >= 6) { do_cpuid(0x06, regs); - if (regs[0] & 0x4) + if ((regs[0] & CPUTPM1_ARAT) != 0) arat = 1; } bzero(&lapic_et, sizeof(lapic_et)); From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 15:08:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D36F1065670; Tue, 23 Nov 2010 15:08:56 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55A268FC17; Tue, 23 Nov 2010 15:08:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANF8uHf034279; Tue, 23 Nov 2010 15:08:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANF8ulx034277; Tue, 23 Nov 2010 15:08:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201011231508.oANF8ulx034277@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 23 Nov 2010 15:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215752 - head/usr.bin/locate/locate X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 15:08:56 -0000 Author: nwhitehorn Date: Tue Nov 23 15:08:56 2010 New Revision: 215752 URL: http://svn.freebsd.org/changeset/base/215752 Log: Properly use SCHAR_MAX instead of CHAR_MAX for 0x7f. This fixes operation of locate(1) on systems on which char is unsigned by default (ARM and PowerPC). Reported by: Paul Mather MFC after: 4 days Modified: head/usr.bin/locate/locate/locate.h Modified: head/usr.bin/locate/locate/locate.h ============================================================================== --- head/usr.bin/locate/locate/locate.h Tue Nov 23 14:36:14 2010 (r215751) +++ head/usr.bin/locate/locate/locate.h Tue Nov 23 15:08:56 2010 (r215752) @@ -48,15 +48,15 @@ #define LDC_MAX 28 /* 128-255 bigram codes (128 most common, as determined by 'updatedb') */ -#define BIGRAM_MIN (UCHAR_MAX - CHAR_MAX) +#define BIGRAM_MIN (UCHAR_MAX - SCHAR_MAX) #define BIGRAM_MAX UCHAR_MAX /* 32-127 single character (printable) ascii residue (ie, literal) */ #define ASCII_MIN 32 -#define ASCII_MAX CHAR_MAX +#define ASCII_MAX SCHAR_MAX -/* #define TO7BIT(x) (x = ( ((u_char)x) & CHAR_MAX )) */ -#define TO7BIT(x) (x = x & CHAR_MAX ) +/* #define TO7BIT(x) (x = ( ((u_char)x) & SCHAR_MAX )) */ +#define TO7BIT(x) (x = x & SCHAR_MAX ) #if UCHAR_MAX >= 4096 From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 16:12:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85E281065672; Tue, 23 Nov 2010 16:12:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 592378FC16; Tue, 23 Nov 2010 16:12:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANGCZbs035601; Tue, 23 Nov 2010 16:12:35 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANGCZEl035596; Tue, 23 Nov 2010 16:12:35 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201011231612.oANGCZEl035596@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 23 Nov 2010 16:12:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215753 - in head/sys/amd64: acpica amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 16:12:35 -0000 Author: jkim Date: Tue Nov 23 16:12:35 2010 New Revision: 215753 URL: http://svn.freebsd.org/changeset/base/215753 Log: Reinitialize PAT MSR via pmap_init_pat() while resuming. This function does better job since r215703 and it is safer now. Modified: head/sys/amd64/acpica/acpi_switch.S head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/acpica/acpi_wakeup.c head/sys/amd64/amd64/mp_machdep.c Modified: head/sys/amd64/acpica/acpi_switch.S ============================================================================== --- head/sys/amd64/acpica/acpi_switch.S Tue Nov 23 15:08:56 2010 (r215752) +++ head/sys/amd64/acpica/acpi_switch.S Tue Nov 23 16:12:35 2010 (r215753) @@ -76,12 +76,6 @@ ENTRY(acpi_restorecpu) movl WAKEUP_CTX(efer), %eax wrmsr - /* Restore PAT. */ - movl $MSR_PAT, %ecx - movl WAKEUP_CTX(pat), %eax - movl 4 + WAKEUP_CTX(pat), %edx - wrmsr - /* Restore fast syscall stuff. */ movl $MSR_STAR, %ecx movl WAKEUP_CTX(star), %eax Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Tue Nov 23 15:08:56 2010 (r215752) +++ head/sys/amd64/acpica/acpi_wakecode.S Tue Nov 23 16:12:35 2010 (r215753) @@ -274,8 +274,6 @@ wakeup_gdt: ALIGN_DATA wakeup_efer: .quad 0 -wakeup_pat: - .quad 0 wakeup_star: .quad 0 wakeup_lstar: Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Tue Nov 23 15:08:56 2010 (r215752) +++ head/sys/amd64/acpica/acpi_wakeup.c Tue Nov 23 16:12:35 2010 (r215753) @@ -278,6 +278,7 @@ acpi_sleep_machdep(struct acpi_softc *sc for (;;) ia32_pause(); } else { + pmap_init_pat(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); #ifdef SMP @@ -372,7 +373,6 @@ acpi_install_wakeup_handler(struct acpi_ WAKECODE_FIXUP(wakeup_ctx, vm_offset_t, WAKECODE_VADDR(sc) + wakeup_ctx); WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER)); - WAKECODE_FIXUP(wakeup_pat, uint64_t, rdmsr(MSR_PAT)); WAKECODE_FIXUP(wakeup_star, uint64_t, rdmsr(MSR_STAR)); WAKECODE_FIXUP(wakeup_lstar, uint64_t, rdmsr(MSR_LSTAR)); WAKECODE_FIXUP(wakeup_cstar, uint64_t, rdmsr(MSR_CSTAR)); Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Tue Nov 23 15:08:56 2010 (r215752) +++ head/sys/amd64/amd64/mp_machdep.c Tue Nov 23 16:12:35 2010 (r215753) @@ -1410,6 +1410,7 @@ cpususpend_handler(void) wbinvd(); atomic_set_int(&stopped_cpus, cpumask); } else { + pmap_init_pat(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); } From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 17:28:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11C94106564A; Tue, 23 Nov 2010 17:28:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F37378FC0A; Tue, 23 Nov 2010 17:28:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANHSN5R037482; Tue, 23 Nov 2010 17:28:23 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANHSNhw037479; Tue, 23 Nov 2010 17:28:23 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201011231728.oANHSNhw037479@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 23 Nov 2010 17:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215754 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 17:28:24 -0000 Author: jkim Date: Tue Nov 23 17:28:23 2010 New Revision: 215754 URL: http://svn.freebsd.org/changeset/base/215754 Log: Remove a stale tunable introduced in r215703. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Nov 23 16:12:35 2010 (r215753) +++ head/sys/amd64/amd64/pmap.c Tue Nov 23 17:28:23 2010 (r215754) @@ -183,8 +183,7 @@ pt_entry_t pg_nx; SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); static int pat_works = 1; -TUNABLE_INT("vm.pmap.pat_works", &pat_works); -SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RDTUN, &pat_works, 1, +SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RD, &pat_works, 1, "Is page attribute table fully functional?"); static int pg_ps_enabled = 1; Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Nov 23 16:12:35 2010 (r215753) +++ head/sys/i386/i386/pmap.c Tue Nov 23 17:28:23 2010 (r215754) @@ -220,8 +220,7 @@ static uma_zone_t pdptzone; SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); static int pat_works = 1; -TUNABLE_INT("vm.pmap.pat_works", &pat_works); -SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RDTUN, &pat_works, 1, +SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RD, &pat_works, 1, "Is page attribute table fully functional?"); static int pg_ps_enabled = 1; From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 18:52:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8D411065675; Tue, 23 Nov 2010 18:52:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A73038FC2D; Tue, 23 Nov 2010 18:52:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANIqRD7039613; Tue, 23 Nov 2010 18:52:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANIqRqA039611; Tue, 23 Nov 2010 18:52:27 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201011231852.oANIqRqA039611@svn.freebsd.org> From: Attilio Rao Date: Tue, 23 Nov 2010 18:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215758 - head/sys/boot/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 18:52:27 -0000 Author: attilio Date: Tue Nov 23 18:52:27 2010 New Revision: 215758 URL: http://svn.freebsd.org/changeset/base/215758 Log: Make this printfoutput more verbose. Sponsored by: Sandvine Incorporated Submitted by: Sandvine Incorporated MFC after: 3 days Modified: head/sys/boot/common/load_elf.c Modified: head/sys/boot/common/load_elf.c ============================================================================== --- head/sys/boot/common/load_elf.c Tue Nov 23 18:48:57 2010 (r215757) +++ head/sys/boot/common/load_elf.c Tue Nov 23 18:52:27 2010 (r215758) @@ -453,7 +453,8 @@ __elfN(loadimage)(struct preloaded_file } result = archsw.arch_readin(ef->fd, lastaddr, shdr[i].sh_size); if (result < 0 || (size_t)result != shdr[i].sh_size) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped!"); + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped! (%ju - %ju)", (uintmax_t)result, + (uintmax_t)shdr[i].sh_size); lastaddr = ssym; ssym = 0; goto nosyms; From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 20:23:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D56F4106564A; Tue, 23 Nov 2010 20:23:25 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3A4A8FC08; Tue, 23 Nov 2010 20:23:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANKNPid041955; Tue, 23 Nov 2010 20:23:25 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANKNPME041953; Tue, 23 Nov 2010 20:23:25 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201011232023.oANKNPME041953@svn.freebsd.org> From: Weongyo Jeong Date: Tue, 23 Nov 2010 20:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215764 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 20:23:25 -0000 Author: weongyo Date: Tue Nov 23 20:23:25 2010 New Revision: 215764 URL: http://svn.freebsd.org/changeset/base/215764 Log: Fixes a kernel crash when usb module is reloaded after unload that it didn't destroy the cdev properly. Pointy hat to: me Reported by: Brandon Gooch , jkim Modified: head/sys/dev/usb/usb_pf.c Modified: head/sys/dev/usb/usb_pf.c ============================================================================== --- head/sys/dev/usb/usb_pf.c Tue Nov 23 19:23:47 2010 (r215763) +++ head/sys/dev/usb/usb_pf.c Tue Nov 23 20:23:25 2010 (r215764) @@ -141,6 +141,7 @@ static struct cdevsw usbpf_cdevsw = { .d_kqfilter = usbpf_kqfilter, }; +static struct cdev *usbpf_cdev; static LIST_HEAD(, usbpf_if) usbpf_iflist; static struct mtx usbpf_mtx; /* global lock */ static int usbpf_uifd_cnt; @@ -1850,13 +1851,26 @@ usbpf_append_bytes(struct usbpf_d *ud, c static void usbpf_drvinit(void *unused) { - struct cdev *dev; mtx_init(&usbpf_mtx, "USB packet filter global lock", NULL, MTX_DEF); LIST_INIT(&usbpf_iflist); - dev = make_dev(&usbpf_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "usbpf"); + usbpf_cdev = make_dev(&usbpf_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, + "usbpf"); +} + +static void +usbpf_drvuninit(void) +{ + + if (usbpf_cdev != NULL) { + destroy_dev(usbpf_cdev); + usbpf_cdev = NULL; + } + mtx_destroy(&usbpf_mtx); } SYSINIT(usbpf_dev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, usbpf_drvinit, NULL); +SYSUNINIT(usbpf_undev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, usbpf_drvuninit, NULL); + From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 20:28:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D65491065693; Tue, 23 Nov 2010 20:28:21 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA22C8FC12; Tue, 23 Nov 2010 20:28:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANKSLpR042090; Tue, 23 Nov 2010 20:28:21 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANKSLfA042088; Tue, 23 Nov 2010 20:28:21 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <201011232028.oANKSLfA042088@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 23 Nov 2010 20:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215765 - head/tools/tools/sysbuild X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 20:28:21 -0000 Author: phk Date: Tue Nov 23 20:28:21 2010 New Revision: 215765 URL: http://svn.freebsd.org/changeset/base/215765 Log: Improve the ports-dependency resolver by truncating the recursion if we already did the target port, and by leaving behind a /tmp/_.plist.dot which documents which ports pulled in what other ports. Modified: head/tools/tools/sysbuild/sysbuild.sh Modified: head/tools/tools/sysbuild/sysbuild.sh ============================================================================== --- head/tools/tools/sysbuild/sysbuild.sh Tue Nov 23 20:23:25 2010 (r215764) +++ head/tools/tools/sysbuild/sysbuild.sh Tue Nov 23 20:28:21 2010 (r215765) @@ -163,29 +163,45 @@ log_it() ( ports_recurse() ( set +x + t=$1 + shift + if [ "x$t" = "x." ] ; then + true > /tmp/_.plist + true > /tmp/_.plist.tdone + echo 'digraph {' > /tmp/_.plist.dot + fi + if grep -q "^$t\$" /tmp/_.plist.tdone ; then + return + fi + echo "$t" >> /tmp/_.plist.tdone for d do if [ ! -d $d ] ; then echo "Missing port $d" 1>&2 exit 2 fi + if [ "x$t" != "x." ] ; then + echo "\"$t\" -> \"$d\"" >> /tmp/_.plist.dot + fi if grep -q "^$d\$" /tmp/_.plist ; then true else ( cd $d - ports_recurse `make -V _DEPEND_DIRS ${PORTS_OPTS}` + ports_recurse $d `make -V _DEPEND_DIRS ${PORTS_OPTS}` ) - echo $d >> /tmp/_.plist + echo "$d" >> /tmp/_.plist fi done + if [ "x$t" = "x." ] ; then + echo '}' >> /tmp/_.plist.dot + fi ) ports_build() ( set +x - true > /tmp/_.plist - ports_recurse $PORTS_WE_WANT + ports_recurse . $PORTS_WE_WANT # Now build & install them for p in `cat /tmp/_.plist` @@ -226,10 +242,12 @@ ports_build() ( ports_prefetch() ( ( set +x - true > /tmp/_.plist - ports_recurse $PORTS_WE_WANT - true > /mnt/_.prefetch + echo "Building /tmp/_.plist" >> /mnt/_.prefetch + + ports_recurse . $PORTS_WE_WANT + + echo "Completed /tmp/_.plist" >> /mnt/_.prefetch # Now checksump/fetch them for p in `cat /tmp/_.plist` do @@ -244,6 +262,15 @@ ports_prefetch() ( make checksum $PORTS_OPTS || true fi ) > /mnt/_.prefetch.$b 2>&1 + ( + cd $p + if make checksum $PORTS_OPTS > /dev/null 2>&1 ; then + rm -f /mnt/_.prefetch.$b + echo "OK $p" >> /mnt/_.prefetch + else + echo "BAD $p" >> /mnt/_.prefetch + fi + ) done ) ) From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 20:46:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FC311065698; Tue, 23 Nov 2010 20:46:06 +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 6E4158FC08; Tue, 23 Nov 2010 20:46:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANKk61Y042758; Tue, 23 Nov 2010 20:46:06 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANKk6Q1042756; Tue, 23 Nov 2010 20:46:06 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201011232046.oANKk6Q1042756@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 23 Nov 2010 20:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215766 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 20:46:06 -0000 Author: jilles Date: Tue Nov 23 20:46:06 2010 New Revision: 215766 URL: http://svn.freebsd.org/changeset/base/215766 Log: sh: Pass multiple bytes at a time to lex. This speeds up the expansion/arith6.0 test considerably. Modified: head/bin/sh/arith_lex.l Modified: head/bin/sh/arith_lex.l ============================================================================== --- head/bin/sh/arith_lex.l Tue Nov 23 20:28:21 2010 (r215765) +++ head/bin/sh/arith_lex.l Tue Nov 23 20:46:06 2010 (r215766) @@ -53,7 +53,15 @@ int yylex(void); #undef YY_INPUT #define YY_INPUT(buf,result,max) \ - result = (*buf = *arith_buf++) ? 1 : YY_NULL; + do { \ + result = strnlen(arith_buf, max); \ + if (result == 0) \ + result = YY_NULL; \ + else { \ + memcpy(buf, arith_buf, result); \ + arith_buf += result; \ + } \ + } while (0); #define YY_NO_UNPUT #define YY_NO_INPUT %} From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 20:47:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F85C106564A; Tue, 23 Nov 2010 20:47:39 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DFD08FC13; Tue, 23 Nov 2010 20:47:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANKldhS042980; Tue, 23 Nov 2010 20:47:39 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANKldem042977; Tue, 23 Nov 2010 20:47:39 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <201011232047.oANKldem042977@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 23 Nov 2010 20:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215767 - head/tools/tools/sysbuild X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 20:47:39 -0000 Author: phk Date: Tue Nov 23 20:47:39 2010 New Revision: 215767 URL: http://svn.freebsd.org/changeset/base/215767 Log: Optimize the ports recurser a bit more. Modified: head/tools/tools/sysbuild/sysbuild.sh Modified: head/tools/tools/sysbuild/sysbuild.sh ============================================================================== --- head/tools/tools/sysbuild/sysbuild.sh Tue Nov 23 20:46:06 2010 (r215766) +++ head/tools/tools/sysbuild/sysbuild.sh Tue Nov 23 20:47:39 2010 (r215767) @@ -185,6 +185,8 @@ ports_recurse() ( fi if grep -q "^$d\$" /tmp/_.plist ; then true + elif grep -q "^$d\$" /tmp/_.plist.tdone ; then + true else ( cd $d @@ -438,7 +440,7 @@ if [ "x${REMOTEDISTFILES}" != "x" ] ; th fi log_it copy ports config files -(cd / ; find var/db/ports -print | cpio -dumpv /mnt ) +(cd / ; find var/db/ports -print | cpio -dumpv /mnt > /dev/null 2>&1) log_it "Start prefetch of ports distfiles" ports_prefetch & From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 21:09:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7614106567A; Tue, 23 Nov 2010 21:09:42 +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 8B2928FC18; Tue, 23 Nov 2010 21:09:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANL9gFK043772; Tue, 23 Nov 2010 21:09:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANL9gnQ043769; Tue, 23 Nov 2010 21:09:42 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011232109.oANL9gnQ043769@svn.freebsd.org> From: Marius Strobl Date: Tue, 23 Nov 2010 21:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215768 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 21:09:42 -0000 Author: marius Date: Tue Nov 23 21:09:42 2010 New Revision: 215768 URL: http://svn.freebsd.org/changeset/base/215768 Log: - Sprinkle const on tables. - Remove an alpha remnant. - Minor comment and style fixes. Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Nov 23 20:47:39 2010 (r215767) +++ head/sys/dev/fxp/if_fxp.c Tue Nov 23 21:09:42 2010 (r215768) @@ -107,11 +107,11 @@ static int tx_threshold = 64; /* * The configuration byte map has several undefined fields which * must be one or must be zero. Set up a template for these bits. - * The actual configuration is performed in fxp_init. + * The actual configuration is performed in fxp_init_body. * * See struct fxp_cb_config for the bit definitions. */ -static u_char fxp_cb_config_template[] = { +static const u_char const fxp_cb_config_template[] = { 0x0, 0x0, /* cb_status */ 0x0, 0x0, /* cb_command */ 0x0, 0x0, 0x0, 0x0, /* link_addr */ @@ -155,7 +155,7 @@ static u_char fxp_cb_config_template[] = * particular variants, but we don't currently differentiate between * them. */ -static struct fxp_ident fxp_ident_table[] = { +static const struct fxp_ident const fxp_ident_table[] = { { 0x1029, -1, 0, "Intel 82559 PCI/CardBus Pro/100" }, { 0x1030, -1, 0, "Intel 82559 Pro/100 Ethernet" }, { 0x1031, -1, 3, "Intel 82801CAM (ICH3) Pro/100 VE Ethernet" }, @@ -217,7 +217,7 @@ static int fxp_shutdown(device_t dev); static int fxp_suspend(device_t dev); static int fxp_resume(device_t dev); -static struct fxp_ident *fxp_find_ident(device_t dev); +static const struct fxp_ident *fxp_find_ident(device_t dev); static void fxp_intr(void *xsc); static void fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp, struct mbuf *m, uint16_t status, int pos); @@ -366,12 +366,12 @@ fxp_dma_wait(struct fxp_softc *sc, volat device_printf(sc->dev, "DMA timeout\n"); } -static struct fxp_ident * +static const struct fxp_ident * fxp_find_ident(device_t dev) { uint16_t devid; uint8_t revid; - struct fxp_ident *ident; + const struct fxp_ident *ident; if (pci_get_vendor(dev) == FXP_VENDORID_INTEL) { devid = pci_get_device(dev); @@ -392,7 +392,7 @@ fxp_find_ident(device_t dev) static int fxp_probe(device_t dev) { - struct fxp_ident *ident; + const struct fxp_ident *ident; ident = fxp_find_ident(dev); if (ident != NULL) { @@ -1614,21 +1614,7 @@ fxp_encap(struct fxp_softc *sc, struct m /* * Advance the end of list forward. */ - -#ifdef __alpha__ - /* - * On platforms which can't access memory in 16-bit - * granularities, we must prevent the card from DMA'ing - * up the status while we update the command field. - * This could cause us to overwrite the completion status. - * XXX This is probably bogus and we're _not_ looking - * for atomicity here. - */ - atomic_clear_16(&sc->fxp_desc.tx_last->tx_cb->cb_command, - htole16(FXP_CB_COMMAND_S)); -#else sc->fxp_desc.tx_last->tx_cb->cb_command &= htole16(~FXP_CB_COMMAND_S); -#endif /*__alpha__*/ sc->fxp_desc.tx_last = txp; /* @@ -2985,13 +2971,13 @@ static uint32_t fxp_ucode_d102e[] = D102 #define UCODE(x) x, sizeof(x)/sizeof(uint32_t) -struct ucode { +static const struct ucode { uint32_t revision; uint32_t *ucode; int length; u_short int_delay_offset; u_short bundle_max_offset; -} ucode_table[] = { +} const ucode_table[] = { { FXP_REV_82558_A4, UCODE(fxp_ucode_d101a), D101_CPUSAVER_DWORD, 0 }, { FXP_REV_82558_B0, UCODE(fxp_ucode_d101b0), D101_CPUSAVER_DWORD, 0 }, { FXP_REV_82559_A0, UCODE(fxp_ucode_d101ma), @@ -3010,7 +2996,7 @@ struct ucode { static void fxp_load_ucode(struct fxp_softc *sc) { - struct ucode *uc; + const struct ucode *uc; struct fxp_cb_ucode *cbp; int i; @@ -3177,11 +3163,13 @@ sysctl_int_range(SYSCTL_HANDLER_ARGS, in static int sysctl_hw_fxp_int_delay(SYSCTL_HANDLER_ARGS) { + return (sysctl_int_range(oidp, arg1, arg2, req, 300, 3000)); } static int sysctl_hw_fxp_bundle_max(SYSCTL_HANDLER_ARGS) { + return (sysctl_int_range(oidp, arg1, arg2, req, 1, 0xffff)); } Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Tue Nov 23 20:47:39 2010 (r215767) +++ head/sys/dev/fxp/if_fxpvar.h Tue Nov 23 21:09:42 2010 (r215768) @@ -146,7 +146,7 @@ struct fxp_ident { uint16_t devid; int16_t revid; /* -1 matches anything */ uint8_t ich; - char *name; + const char *name; }; struct fxp_hwstats { @@ -182,7 +182,7 @@ struct fxp_softc { struct resource *fxp_res[2]; /* I/O and IRQ resources */ struct resource_spec *fxp_spec; /* the resource spec we used */ void *ih; /* interrupt handler cookie */ - struct fxp_ident *ident; + const struct fxp_ident *ident; struct mtx sc_mtx; bus_dma_tag_t fxp_txmtag; /* bus DMA tag for Tx mbufs */ bus_dma_tag_t fxp_rxmtag; /* bus DMA tag for Rx mbufs */ From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 21:21:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DB25106564A; Tue, 23 Nov 2010 21:21:56 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C2008FC14; Tue, 23 Nov 2010 21:21:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANLLuiR044262; Tue, 23 Nov 2010 21:21:56 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANLLuDc044260; Tue, 23 Nov 2010 21:21:56 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <201011232121.oANLLuDc044260@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 23 Nov 2010 21:21:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215770 - head/tools/tools/sysbuild X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 21:21:56 -0000 Author: phk Date: Tue Nov 23 21:21:56 2010 New Revision: 215770 URL: http://svn.freebsd.org/changeset/base/215770 Log: Don't checksum distfiles twice if they match the first time. Modified: head/tools/tools/sysbuild/sysbuild.sh Modified: head/tools/tools/sysbuild/sysbuild.sh ============================================================================== --- head/tools/tools/sysbuild/sysbuild.sh Tue Nov 23 21:20:27 2010 (r215769) +++ head/tools/tools/sysbuild/sysbuild.sh Tue Nov 23 21:21:56 2010 (r215770) @@ -253,26 +253,24 @@ ports_prefetch() ( # Now checksump/fetch them for p in `cat /tmp/_.plist` do - echo "Prefetching $p" >> /mnt/_.prefetch b=`echo $p | tr / _` ( cd $p if make checksum $PORTS_OPTS ; then - true - else - make distclean - make checksum $PORTS_OPTS || true + rm -f /mnt/_.prefetch.$b + echo "OK $p" >> /mnt/_.prefetch + exit 0 fi - ) > /mnt/_.prefetch.$b 2>&1 - ( - cd $p + make distclean + make checksum $PORTS_OPTS || true + if make checksum $PORTS_OPTS > /dev/null 2>&1 ; then rm -f /mnt/_.prefetch.$b echo "OK $p" >> /mnt/_.prefetch else echo "BAD $p" >> /mnt/_.prefetch fi - ) + ) > /mnt/_.prefetch.$b 2>&1 done ) ) From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 21:49:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70034106564A; Tue, 23 Nov 2010 21:49:32 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D9D38FC17; Tue, 23 Nov 2010 21:49:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANLnWk2045336; Tue, 23 Nov 2010 21:49:32 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANLnW2i045332; Tue, 23 Nov 2010 21:49:32 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201011232149.oANLnW2i045332@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 23 Nov 2010 21:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215779 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 21:49:32 -0000 Author: bschmidt Date: Tue Nov 23 21:49:32 2010 New Revision: 215779 URL: http://svn.freebsd.org/changeset/base/215779 Log: Add a few functions used in newer drivers. Fix RtlCompareMemory() while here. Submitted by: Paul B Mahol Modified: head/sys/compat/ndis/ntoskrnl_var.h head/sys/compat/ndis/subr_ndis.c head/sys/compat/ndis/subr_ntoskrnl.c Modified: head/sys/compat/ndis/ntoskrnl_var.h ============================================================================== --- head/sys/compat/ndis/ntoskrnl_var.h Tue Nov 23 21:45:14 2010 (r215778) +++ head/sys/compat/ndis/ntoskrnl_var.h Tue Nov 23 21:49:32 2010 (r215779) @@ -1282,6 +1282,7 @@ typedef struct driver_object driver_obje #define STATUS_PENDING 0x00000103 #define STATUS_FAILURE 0xC0000001 #define STATUS_NOT_IMPLEMENTED 0xC0000002 +#define STATUS_ACCESS_VIOLATION 0xC0000005 #define STATUS_INVALID_PARAMETER 0xC000000D #define STATUS_INVALID_DEVICE_REQUEST 0xC0000010 #define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016 Modified: head/sys/compat/ndis/subr_ndis.c ============================================================================== --- head/sys/compat/ndis/subr_ndis.c Tue Nov 23 21:45:14 2010 (r215778) +++ head/sys/compat/ndis/subr_ndis.c Tue Nov 23 21:49:32 2010 (r215779) @@ -254,6 +254,7 @@ static uint8_t void *, void *); static void NdisGetCurrentSystemTime(uint64_t *); static void NdisGetSystemUpTime(uint32_t *); +static uint32_t NdisGetVersion(void); static void NdisInitializeString(unicode_string *, char *); static void NdisInitAnsiString(ansi_string *, char *); static void NdisInitUnicodeString(unicode_string *, uint16_t *); @@ -274,6 +275,7 @@ static void NdisMapFile(ndis_status *, v static void NdisUnmapFile(ndis_handle); static void NdisCloseFile(ndis_handle); static uint8_t NdisSystemProcessorCount(void); +static void NdisGetCurrentProcessorCounts(uint32_t *, uint32_t *, uint32_t *); static void NdisMIndicateStatusComplete(ndis_handle); static void NdisMIndicateStatus(ndis_handle, ndis_status, void *, uint32_t); @@ -2067,6 +2069,12 @@ NdisInterlockedDecrement(addend) return (*addend); } +static uint32_t +NdisGetVersion(void) +{ + return (0x00050001); +} + static void NdisInitializeEvent(event) ndis_event *event; @@ -2950,6 +2958,20 @@ NdisSystemProcessorCount() return (mp_ncpus); } +static void +NdisGetCurrentProcessorCounts(idle_count, kernel_and_user, index) + uint32_t *idle_count; + uint32_t *kernel_and_user; + uint32_t *index; +{ + struct pcpu *pcpu; + + pcpu = pcpu_find(curthread->td_oncpu); + *index = pcpu->pc_cpuid; + *idle_count = pcpu->pc_cp_time[CP_IDLE]; + *kernel_and_user = pcpu->pc_cp_time[CP_INTR]; +} + typedef void (*ndis_statusdone_handler)(ndis_handle); typedef void (*ndis_status_handler)(ndis_handle, ndis_status, void *, uint32_t); @@ -3207,6 +3229,7 @@ image_patch_table ndis_functbl[] = { IMPORT_SFUNC(NdisMIndicateStatusComplete, 1), IMPORT_SFUNC(NdisMIndicateStatus, 4), IMPORT_SFUNC(NdisSystemProcessorCount, 0), + IMPORT_SFUNC(NdisGetCurrentProcessorCounts, 3), IMPORT_SFUNC(NdisUnchainBufferAtBack, 2), IMPORT_SFUNC(NdisGetFirstBufferFromPacket, 5), IMPORT_SFUNC(NdisGetFirstBufferFromPacketSafe, 6), @@ -3224,6 +3247,7 @@ image_patch_table ndis_functbl[] = { IMPORT_SFUNC(NdisFreeString, 1), IMPORT_SFUNC(NdisGetCurrentSystemTime, 1), IMPORT_SFUNC(NdisGetSystemUpTime, 1), + IMPORT_SFUNC(NdisGetVersion, 0), IMPORT_SFUNC(NdisMSynchronizeWithInterrupt, 3), IMPORT_SFUNC(NdisMAllocateSharedMemoryAsync, 4), IMPORT_SFUNC(NdisInterlockedInsertHeadList, 3), Modified: head/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- head/sys/compat/ndis/subr_ntoskrnl.c Tue Nov 23 21:45:14 2010 (r215778) +++ head/sys/compat/ndis/subr_ntoskrnl.c Tue Nov 23 21:49:32 2010 (r215779) @@ -128,6 +128,7 @@ static kspin_lock ntoskrnl_intlock; static uint8_t RtlEqualUnicodeString(unicode_string *, unicode_string *, uint8_t); +static void RtlCopyString(ansi_string *, const ansi_string *); static void RtlCopyUnicodeString(unicode_string *, unicode_string *); static irp *IoBuildSynchronousFsdRequest(uint32_t, device_object *, @@ -181,6 +182,7 @@ static uint64_t _aullshr(uint64_t, uint8 static uint64_t _aullshl(uint64_t, uint8_t); static slist_entry *ntoskrnl_pushsl(slist_header *, slist_entry *); static slist_entry *ntoskrnl_popsl(slist_header *); +static void ExFreePoolWithTag(void *, uint32_t); static void ExInitializePagedLookasideList(paged_lookaside_list *, lookaside_alloc_func *, lookaside_free_func *, uint32_t, size_t, uint32_t, uint16_t); @@ -210,6 +212,10 @@ static void *MmMapLockedPagesSpecifyCach static void MmUnmapLockedPages(void *, mdl *); static device_t ntoskrnl_finddev(device_t, uint64_t, struct resource **); static void RtlZeroMemory(void *, size_t); +static void RtlSecureZeroMemory(void *, size_t); +static void RtlFillMemory(void *, size_t, uint8_t); +static void RtlMoveMemory(void *, const void *, size_t); +static ndis_status RtlCharToInteger(const char *, uint32_t, uint32_t *); static void RtlCopyMemory(void *, const void *, size_t); static size_t RtlCompareMemory(const void *, const void *, size_t); static ndis_status RtlUnicodeStringToInteger(unicode_string *, @@ -538,6 +544,20 @@ RtlEqualUnicodeString(unicode_string *st } static void +RtlCopyString(dst, src) + ansi_string *dst; + const ansi_string *src; +{ + if (src != NULL && src->as_buf != NULL && dst->as_buf != NULL) { + dst->as_len = min(src->as_len, dst->as_maxlen); + memcpy(dst->as_buf, src->as_buf, dst->as_len); + if (dst->as_len < dst->as_maxlen) + dst->as_buf[dst->as_len] = 0; + } else + dst->as_len = 0; +} + +static void RtlCopyUnicodeString(dest, src) unicode_string *dest; unicode_string *src; @@ -650,6 +670,14 @@ ExAllocatePoolWithTag(pooltype, len, tag return (buf); } +static void +ExFreePoolWithTag(buf, tag) + void *buf; + uint32_t tag; +{ + ExFreePool(buf); +} + void ExFreePool(buf) void *buf; @@ -2056,6 +2084,13 @@ ntoskrnl_pushsl(head, entry) return (oldhead); } +static void +InitializeSListHead(head) + slist_header *head; +{ + memset(head, 0, sizeof(*head)); +} + static slist_entry * ntoskrnl_popsl(head) slist_header *head; @@ -2725,6 +2760,59 @@ ntoskrnl_workitem_thread(arg) return; /* notreached */ } +static ndis_status +RtlCharToInteger(src, base, val) + const char *src; + uint32_t base; + uint32_t *val; +{ + int negative = 0; + uint32_t res; + + if (!src || !val) + return (STATUS_ACCESS_VIOLATION); + while (*src != '\0' && *src <= ' ') + src++; + if (*src == '+') + src++; + else if (*src == '-') { + src++; + negative = 1; + } + if (base == 0) { + base = 10; + if (*src == '0') { + src++; + if (*src == 'b') { + base = 2; + src++; + } else if (*src == 'o') { + base = 8; + src++; + } else if (*src == 'x') { + base = 16; + src++; + } + } + } else if (!(base == 2 || base == 8 || base == 10 || base == 16)) + return (STATUS_INVALID_PARAMETER); + + for (res = 0; *src; src++) { + int v; + if (isdigit(*src)) + v = *src - '0'; + else if (isxdigit(*src)) + v = tolower(*src) - 'a' + 10; + else + v = base; + if (v >= base) + return (STATUS_INVALID_PARAMETER); + res = res * base + v; + } + *val = negative ? -res : res; + return (STATUS_SUCCESS); +} + static void ntoskrnl_destroy_workitem_threads(void) { @@ -2905,6 +2993,32 @@ RtlZeroMemory(dst, len) } static void +RtlSecureZeroMemory(dst, len) + void *dst; + size_t len; +{ + memset(dst, 0, len); +} + +static void +RtlFillMemory(dst, len, c) + void *dst; + size_t len; + uint8_t c; +{ + memset(dst, c, len); +} + +static void +RtlMoveMemory(dst, src, len) + void *dst; + const void *src; + size_t len; +{ + memmove(dst, src, len); +} + +static void RtlCopyMemory(dst, src, len) void *dst; const void *src; @@ -2919,17 +3033,14 @@ RtlCompareMemory(s1, s2, len) const void *s2; size_t len; { - size_t i, total = 0; + size_t i; uint8_t *m1, *m2; m1 = __DECONST(char *, s1); m2 = __DECONST(char *, s2); - for (i = 0; i < len; i++) { - if (m1[i] == m2[i]) - total++; - } - return (total); + for (i = 0; i < len && m1[i] == m2[i]; i++); + return (i); } void @@ -4124,7 +4235,12 @@ dummy() image_patch_table ntoskrnl_functbl[] = { IMPORT_SFUNC(RtlZeroMemory, 2), + IMPORT_SFUNC(RtlSecureZeroMemory, 2), + IMPORT_SFUNC(RtlFillMemory, 3), + IMPORT_SFUNC(RtlMoveMemory, 3), + IMPORT_SFUNC(RtlCharToInteger, 3), IMPORT_SFUNC(RtlCopyMemory, 3), + IMPORT_SFUNC(RtlCopyString, 2), IMPORT_SFUNC(RtlCompareMemory, 3), IMPORT_SFUNC(RtlEqualUnicodeString, 3), IMPORT_SFUNC(RtlCopyUnicodeString, 2), @@ -4211,6 +4327,7 @@ image_patch_table ntoskrnl_functbl[] = { IMPORT_SFUNC(ExInitializeNPagedLookasideList, 7), IMPORT_SFUNC(ExDeleteNPagedLookasideList, 1), IMPORT_FFUNC(InterlockedPopEntrySList, 1), + IMPORT_FFUNC(InitializeSListHead, 1), IMPORT_FFUNC(InterlockedPushEntrySList, 2), IMPORT_SFUNC(ExQueryDepthSList, 1), IMPORT_FFUNC_MAP(ExpInterlockedPopEntrySList, @@ -4220,6 +4337,7 @@ image_patch_table ntoskrnl_functbl[] = { IMPORT_FFUNC(ExInterlockedPopEntrySList, 2), IMPORT_FFUNC(ExInterlockedPushEntrySList, 3), IMPORT_SFUNC(ExAllocatePoolWithTag, 3), + IMPORT_SFUNC(ExFreePoolWithTag, 2), IMPORT_SFUNC(ExFreePool, 1), #ifdef __i386__ IMPORT_FFUNC(KefAcquireSpinLockAtDpcLevel, 1), From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 22:07:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C46941065674; Tue, 23 Nov 2010 22:07:10 +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 B22188FC1A; Tue, 23 Nov 2010 22:07:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANM7A1h045732; Tue, 23 Nov 2010 22:07:10 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANM7A1s045725; Tue, 23 Nov 2010 22:07:10 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011232207.oANM7A1s045725@svn.freebsd.org> From: Marius Strobl Date: Tue, 23 Nov 2010 22:07:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215780 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 22:07:10 -0000 Author: marius Date: Tue Nov 23 22:07:10 2010 New Revision: 215780 URL: http://svn.freebsd.org/changeset/base/215780 Log: Remove the description of the link0 link option, since r215297 the master media option generally should be used instead. Actually I think the lists of media types should be removed from the manual pages of MAC drivers altogether and users just pointed to the output of `ifconfig -m` instead; even before r215297 there were several outdated descriptions, technically it's wrong most of the time as not the MAC drivers support these media types but actually the PHY drivers do and it generally doesn't make sense to maintain these lists in every manual page of a driver as the media is auto-detected. Modified: head/share/man/man4/bge.4 head/share/man/man4/msk.4 head/share/man/man4/nge.4 head/share/man/man4/sk.4 head/share/man/man4/stge.4 head/share/man/man4/vge.4 Modified: head/share/man/man4/bge.4 ============================================================================== --- head/share/man/man4/bge.4 Tue Nov 23 21:49:32 2010 (r215779) +++ head/share/man/man4/bge.4 Tue Nov 23 22:07:10 2010 (r215780) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2010 +.Dd November 23, 2010 .Dt BGE 4 .Os .Sh NAME @@ -144,27 +144,6 @@ Force full duplex operation. Force half duplex operation. .El .Pp -The -.Nm -driver also supports one special link option for 1000baseTX cards: -.Bl -tag -width ".Cm link0" -.It Cm link0 -With 1000baseTX cards, establishing a link between two ports requires -that one port be configured as a master and the other a slave. -With autonegotiation, -the master/slave settings will be chosen automatically. -However when manually selecting the link state, it is necessary to -force one side of the link to be a master and the other a slave. -The -.Nm -driver configures the ports as slaves by default. -Setting the -.Cm link0 -flag with -.Xr ifconfig 8 -will set a port as a master instead. -.El -.Pp For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE Modified: head/share/man/man4/msk.4 ============================================================================== --- head/share/man/man4/msk.4 Tue Nov 23 21:49:32 2010 (r215779) +++ head/share/man/man4/msk.4 Tue Nov 23 22:07:10 2010 (r215780) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2010 +.Dd November 23, 2010 .Dt MSK 4 .Os .Sh NAME @@ -125,27 +125,6 @@ Force full duplex operation. Force half duplex operation. .El .Pp -The -.Nm -driver also supports one special link option for 1000baseTX cards: -.Bl -tag -width ".Cm link0" -.It Cm link0 -With 1000baseTX cards, establishing a link between two ports requires -that one port is configured as master and the other one as slave. -With autonegotiation, -the master/slave settings will be chosen automatically. -However when manually selecting the link state, it is necessary to -force one side of the link to be a master and the other a slave. -The -.Nm -driver configures the ports as slaves by default. -Setting the -.Cm link0 -flag with -.Xr ifconfig 8 -will set a port as a master instead. -.El -.Pp For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE Modified: head/share/man/man4/nge.4 ============================================================================== --- head/share/man/man4/nge.4 Tue Nov 23 21:49:32 2010 (r215779) +++ head/share/man/man4/nge.4 Tue Nov 23 22:07:10 2010 (r215780) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 21, 2009 +.Dd November 23, 2010 .Dt NGE 4 .Os .Sh NAME @@ -131,27 +131,6 @@ Force full duplex operation. Force half duplex operation. .El .Pp -The -.Nm -driver also supports one special link option for 1000baseTX cards: -.Bl -tag -width link0 -.It Cm link0 -With 1000baseTX cards, establishing a link between two ports requires -that one port be configured as a master and the other a slave. -With autonegotiation, -the master/slave settings will be chosen automatically. -However when manually selecting the link state, it is necessary to -force one side of the link to be a master and the other a slave. -The -.Nm -driver configures the ports as slaves by default. -Setting the -.Cm link0 -flag with -.Xr ifconfig 8 -will set a port as a master instead. -.El -.Pp For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE Modified: head/share/man/man4/sk.4 ============================================================================== --- head/share/man/man4/sk.4 Tue Nov 23 21:49:32 2010 (r215779) +++ head/share/man/man4/sk.4 Tue Nov 23 22:07:10 2010 (r215780) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 23, 2009 +.Dd November 23, 2010 .Dt SK 4 .Os .Sh NAME @@ -132,27 +132,6 @@ Force full duplex operation Force half duplex operation. .El .Pp -The -.Nm -driver also supports one special link option for 1000baseTX cards: -.Bl -tag -width xxxxxxxxxxxxxxxxxxxx -.It link0 -With 1000baseTX cards, establishing a link between two ports requires -that one port is configured as master and the other one as slave. -With autonegotiation, -the master/slave settings will be chosen automatically. -However when manually selecting the link state, it is necessary to -force one side of the link to be a master and the other a slave. -The -.Nm -driver configures the ports as slaves by default. -Setting the -.Ar link0 -flag with -.Xr ifconfig 8 -will set a port as a master instead. -.El -.Pp For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE Modified: head/share/man/man4/stge.4 ============================================================================== --- head/share/man/man4/stge.4 Tue Nov 23 21:49:32 2010 (r215779) +++ head/share/man/man4/stge.4 Tue Nov 23 22:07:10 2010 (r215780) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 25, 2006 +.Dd November 23, 2010 .Dt STGE 4 .Os .Sh NAME @@ -129,27 +129,6 @@ Force full duplex operation. Force half duplex operation. .El .Pp -The -.Nm -driver also supports one special link option for 1000baseTX cards: -.Bl -tag -width ".Cm link0" -.It Cm link0 -With 1000baseTX cards, establishing a link between two ports requires -that one port is configured as master and the other one as slave. -With autonegotiation, -the master/slave settings will be chosen automatically. -However when manually selecting the link state, it is necessary to -force one side of the link to be a master and the other a slave. -The -.Nm -driver configures the ports as slaves by default. -Setting the -.Cm link0 -flag with -.Xr ifconfig 8 -will set a port as a master instead. -.El -.Pp For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE Modified: head/share/man/man4/vge.4 ============================================================================== --- head/share/man/man4/vge.4 Tue Nov 23 21:49:32 2010 (r215779) +++ head/share/man/man4/vge.4 Tue Nov 23 22:07:10 2010 (r215780) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 18, 2009 +.Dd November 23, 2010 .Dt VGE 4 .Os .Sh NAME @@ -137,27 +137,6 @@ Force full duplex operation. Force half duplex operation. .El .Pp -The -.Nm -driver also supports one special link option for 1000baseTX cards: -.Bl -tag -width ".Cm link0" -.It Cm link0 -With 1000baseTX cards, establishing a link between two ports requires -that one port be configured as a master and the other a slave. -With autonegotiation, -the master/slave settings will be chosen automatically. -However when manually selecting the link state, it is necessary to -force one side of the link to be a master and the other a slave. -The -.Nm -driver configures the ports as slaves by default. -Setting the -.Cm link0 -flag with -.Xr ifconfig 8 -will set a port as a master instead. -.El -.Pp For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 22:12:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AC9C106567A; Tue, 23 Nov 2010 22:12:02 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78A1F8FC12; Tue, 23 Nov 2010 22:12:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANMC2Le045868; Tue, 23 Nov 2010 22:12:02 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANMC2EK045865; Tue, 23 Nov 2010 22:12:02 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201011232212.oANMC2EK045865@svn.freebsd.org> From: Jack F Vogel Date: Tue, 23 Nov 2010 22:12:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215781 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 22:12:02 -0000 Author: jfv Date: Tue Nov 23 22:12:02 2010 New Revision: 215781 URL: http://svn.freebsd.org/changeset/base/215781 Log: - New 82580 devices supported - Fixes from John Baldwin: vlan shadow tables made per/interface, make vlan hw setup only happen when capability enabled, and finally, make a tuneable interrupt rate. Thanks John! - Tweaked watchdog handling to avoid any false positives, now detection is in the TX clean path, with only the final check and init happening in the local timer. - limit queues to 8 for all devices, with 82576 or 82580 on larger machines it can get greater than this, and it seems mostly a resource waste to do so. Even 8 might be high but it can be manually reduced. - use 2k, 4k and now 9k clusters based on the MTU size. - rework the igb_refresh_mbuf() code, its important to make sure the descriptor is rewritten even when reusing mbufs since writeback clobbers things. MFC: in a few days, this delta needs to get to 8.2 Modified: head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_igb.h Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Tue Nov 23 22:07:10 2010 (r215780) +++ head/sys/dev/e1000/if_igb.c Tue Nov 23 22:12:02 2010 (r215781) @@ -99,7 +99,7 @@ int igb_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char igb_driver_version[] = "version - 2.0.4"; +char igb_driver_version[] = "version - 2.0.7"; /********************************************************************* @@ -137,6 +137,10 @@ static igb_vendor_info_t igb_vendor_info { 0x8086, E1000_DEV_ID_82580_SGMII, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82580_COPPER_DUAL, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82580_QUAD_FIBER, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_DH89XXCC_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_DH89XXCC_SGMII, PCI_ANY_ID, PCI_ANY_ID, 0}, /* required last entry */ { 0, 0, 0, 0, 0} }; @@ -307,11 +311,19 @@ static int igb_enable_msix = 1; TUNABLE_INT("hw.igb.enable_msix", &igb_enable_msix); /* - * Header split has seemed to be beneficial in - * many circumstances tested, however there have - * been some stability issues, so the default is - * off. - */ +** Tuneable Interrupt rate +*/ +static int igb_max_interrupt_rate = 8000; +TUNABLE_INT("hw.igb.max_interrupt_rate", &igb_max_interrupt_rate); + +/* +** Header split causes the packet header to +** be dma'd to a seperate mbuf from the payload. +** this can have memory alignment benefits. But +** another plus is that small packets often fit +** into the header and thus use no cluster. Its +** a very workload dependent type feature. +*/ static bool igb_header_split = FALSE; TUNABLE_INT("hw.igb.hdr_split", &igb_header_split); @@ -330,15 +342,6 @@ TUNABLE_INT("hw.igb.rx_process_limit", & static int igb_fc_setting = e1000_fc_full; TUNABLE_INT("hw.igb.fc_setting", &igb_fc_setting); -/* -** Shadow VFTA table, this is needed because -** the real filter table gets cleared during -** a soft reset and the driver needs to be able -** to repopulate it. -*/ -static u32 igb_shadow_vfta[IGB_VFTA_SIZE]; - - /********************************************************************* * Device identification routine * @@ -818,7 +821,7 @@ igb_start_locked(struct tx_ring *txr, st /* Set watchdog on */ txr->watchdog_time = ticks; - txr->watchdog_check = TRUE; + txr->queue_status = IGB_QUEUE_WORKING; } } @@ -922,7 +925,7 @@ igb_mq_start_locked(struct ifnet *ifp, s } if (enq > 0) { /* Set the watchdog */ - txr->watchdog_check = TRUE; + txr->queue_status = IGB_QUEUE_WORKING; txr->watchdog_time = ticks; } return (err); @@ -1049,6 +1052,11 @@ igb_ioctl(struct ifnet *ifp, u_long comm } break; case SIOCSIFMEDIA: + /* + ** As the speed/duplex settings are being + ** changed, we need toreset the PHY. + */ + adapter->hw.phy.reset_disable = FALSE; /* Check SOL/IDER usage */ IGB_CORE_LOCK(adapter); if (e1000_check_reset_block(&adapter->hw)) { @@ -1161,19 +1169,6 @@ igb_init_locked(struct adapter *adapter) E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); - /* Use real VLAN Filter support? */ - if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { - if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) - /* Use real VLAN Filter support */ - igb_setup_vlan_hw_support(adapter); - else { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } - } - /* Set hardware offload abilities */ ifp->if_hwassist = 0; if (ifp->if_capenable & IFCAP_TXCSUM) { @@ -1201,10 +1196,12 @@ igb_init_locked(struct adapter *adapter) ** Figure out the desired mbuf pool ** for doing jumbo/packetsplit */ - if (ifp->if_mtu > ETHERMTU) + if (adapter->max_frame_size <= 2048) + adapter->rx_mbuf_sz = MCLBYTES; + else if (adapter->max_frame_size <= 4096) adapter->rx_mbuf_sz = MJUMPAGESIZE; else - adapter->rx_mbuf_sz = MCLBYTES; + adapter->rx_mbuf_sz = MJUM9BYTES; /* Prepare receive descriptors and buffers */ if (igb_setup_receive_structures(adapter)) { @@ -1213,6 +1210,19 @@ igb_init_locked(struct adapter *adapter) } igb_initialize_receive_units(adapter); + /* Use real VLAN Filter support? */ + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + /* Use real VLAN Filter support */ + igb_setup_vlan_hw_support(adapter); + else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + } + } + /* Don't lose promiscuous settings */ igb_set_promisc(adapter); @@ -1225,9 +1235,6 @@ igb_init_locked(struct adapter *adapter) if (adapter->msix > 1) /* Set up queue routing */ igb_configure_queues(adapter); - /* Set up VLAN tag offload and filter */ - igb_setup_vlan_hw_support(adapter); - /* this clears any pending interrupts */ E1000_READ_REG(&adapter->hw, E1000_ICR); #ifdef DEVICE_POLLING @@ -1627,11 +1634,6 @@ igb_media_change(struct ifnet *ifp) device_printf(adapter->dev, "Unsupported media type\n"); } - /* As the speed/duplex settings my have changed we need to - * reset the PHY. - */ - adapter->hw.phy.reset_disable = FALSE; - igb_init_locked(adapter); IGB_CORE_UNLOCK(adapter); @@ -1947,18 +1949,9 @@ igb_local_timer(void *arg) /* ** Watchdog: check for time since any descriptor was cleaned */ - for (int i = 0; i < adapter->num_queues; i++, txr++) { - IGB_TX_LOCK(txr); - if ((txr->watchdog_check == FALSE) || - (txr->tx_avail == adapter->num_tx_desc)) { - IGB_TX_UNLOCK(txr); - continue; - } - if ((ticks - txr->watchdog_time) > IGB_WATCHDOG) + for (int i = 0; i < adapter->num_queues; i++, txr++) + if (txr->queue_status == IGB_QUEUE_HUNG) goto timeout; - IGB_TX_UNLOCK(txr); - } - out: callout_reset(&adapter->timer, hz, igb_local_timer, adapter); return; @@ -1973,7 +1966,6 @@ timeout: txr->me, txr->tx_avail, txr->next_to_clean); adapter->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; adapter->watchdog_events++; - IGB_TX_UNLOCK(txr); igb_init_locked(adapter); } @@ -2037,7 +2029,7 @@ igb_update_link_status(struct adapter *a if_link_state_change(ifp, LINK_STATE_DOWN); /* Turn off watchdogs */ for (int i = 0; i < adapter->num_queues; i++, txr++) - txr->watchdog_check = FALSE; + txr->queue_status = IGB_QUEUE_IDLE; } } @@ -2069,7 +2061,7 @@ igb_stop(void *arg) /* Unarm watchdog timer. */ for (int i = 0; i < adapter->num_queues; i++, txr++) { IGB_TX_LOCK(txr); - txr->watchdog_check = FALSE; + txr->queue_status = IGB_QUEUE_IDLE; IGB_TX_UNLOCK(txr); } @@ -2280,8 +2272,7 @@ igb_configure_queues(struct adapter *ada { struct e1000_hw *hw = &adapter->hw; struct igb_queue *que; - u32 tmp, ivar = 0; - u32 newitr = IGB_DEFAULT_ITR; + u32 tmp, ivar = 0, newitr = 0; /* First turn on RSS capability */ if (adapter->hw.mac.type > e1000_82575) @@ -2398,6 +2389,9 @@ igb_configure_queues(struct adapter *ada } /* Set the starting interrupt rate */ + if (igb_max_interrupt_rate > 0) + newitr = (4000000 / igb_max_interrupt_rate) & 0x7FFC; + if (hw->mac.type == e1000_82575) newitr |= newitr << 16; else @@ -2509,6 +2503,8 @@ igb_setup_msix(struct adapter *adapter) /* Manual override */ if (igb_num_queues != 0) queues = igb_num_queues; + if (queues > 8) /* max queues */ + queues = 8; /* Can have max of 4 queues on 82575 */ if ((adapter->hw.mac.type == e1000_82575) && (queues > 4)) @@ -2636,7 +2632,7 @@ igb_reset(struct adapter *adapter) fc->send_xon = TRUE; /* Set Flow control, use the tunable location if sane */ - if ((igb_fc_setting >= 0) || (igb_fc_setting < 4)) + if ((igb_fc_setting >= 0) && (igb_fc_setting < 4)) fc->requested_mode = igb_fc_setting; else fc->requested_mode = e1000_fc_none; @@ -2728,10 +2724,11 @@ igb_setup_interface(device_t dev, struct ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; ifp->if_capabilities |= IFCAP_TSO4; ifp->if_capabilities |= IFCAP_JUMBO_MTU; - if (igb_header_split) - ifp->if_capabilities |= IFCAP_LRO; - ifp->if_capenable = ifp->if_capabilities; + + /* Don't enable LRO by default */ + ifp->if_capabilities |= IFCAP_LRO; + #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; #endif @@ -3172,7 +3169,7 @@ igb_initialize_transmit_units(struct ada E1000_READ_REG(hw, E1000_TDBAL(i)), E1000_READ_REG(hw, E1000_TDLEN(i))); - txr->watchdog_check = FALSE; + txr->queue_status = IGB_QUEUE_IDLE; txdctl |= IGB_TX_PTHRESH; txdctl |= IGB_TX_HTHRESH << 8; @@ -3184,14 +3181,14 @@ igb_initialize_transmit_units(struct ada if (adapter->hw.mac.type == e1000_vfadapt) return; + e1000_config_collision_dist(hw); + /* Program the Transmit Control Register */ tctl = E1000_READ_REG(hw, E1000_TCTL); tctl &= ~E1000_TCTL_CT; tctl |= (E1000_TCTL_PSP | E1000_TCTL_RTLC | E1000_TCTL_EN | (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT)); - e1000_config_collision_dist(hw); - /* This write will effectively turn on the transmit unit. */ E1000_WRITE_REG(hw, E1000_TCTL, tctl); } @@ -3500,16 +3497,19 @@ static bool igb_txeof(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; - int first, last, done; + int first, last, done, processed; struct igb_tx_buffer *tx_buffer; struct e1000_tx_desc *tx_desc, *eop_desc; struct ifnet *ifp = adapter->ifp; IGB_TX_LOCK_ASSERT(txr); - if (txr->tx_avail == adapter->num_tx_desc) + if (txr->tx_avail == adapter->num_tx_desc) { + txr->queue_status = IGB_QUEUE_IDLE; return FALSE; + } + processed = 0; first = txr->next_to_clean; tx_desc = &txr->tx_base[first]; tx_buffer = &txr->tx_buffers[first]; @@ -3536,6 +3536,7 @@ igb_txeof(struct tx_ring *txr) tx_desc->lower.data = 0; tx_desc->buffer_addr = 0; ++txr->tx_avail; + ++processed; if (tx_buffer->m_head) { txr->bytes += @@ -3575,6 +3576,15 @@ igb_txeof(struct tx_ring *txr) txr->next_to_clean = first; + /* + ** Watchdog calculation, we know there's + ** work outstanding or the first return + ** would have been taken, so none processed + ** for too long indicates a hang. + */ + if ((!processed) && ((ticks - txr->watchdog_time) > IGB_WATCHDOG)) + txr->queue_status = IGB_QUEUE_HUNG; + /* * If we have enough room, clear IFF_DRV_OACTIVE * to tell the stack that it is OK to send packets. @@ -3583,7 +3593,7 @@ igb_txeof(struct tx_ring *txr) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; /* All clean, turn off the watchdog */ if (txr->tx_avail == adapter->num_tx_desc) { - txr->watchdog_check = FALSE; + txr->queue_status = IGB_QUEUE_IDLE; return (FALSE); } } @@ -3615,51 +3625,59 @@ igb_refresh_mbufs(struct rx_ring *rxr, i cleaned = -1; /* Signify no completions */ while (i != limit) { rxbuf = &rxr->rx_buffers[i]; - if ((rxbuf->m_head == NULL) && (rxr->hdr_split)) { + /* No hdr mbuf used with header split off */ + if (rxr->hdr_split == FALSE) + goto no_split; + if (rxbuf->m_head == NULL) { mh = m_gethdr(M_DONTWAIT, MT_DATA); if (mh == NULL) goto update; - mh->m_pkthdr.len = mh->m_len = MHLEN; - mh->m_len = MHLEN; - mh->m_flags |= M_PKTHDR; - m_adj(mh, ETHER_ALIGN); - /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->htag, - rxbuf->hmap, mh, hseg, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - printf("GET BUF: dmamap load" - " failure - %d\n", error); - m_free(mh); - goto update; - } - rxbuf->m_head = mh; - bus_dmamap_sync(rxr->htag, rxbuf->hmap, - BUS_DMASYNC_PREREAD); - rxr->rx_base[i].read.hdr_addr = - htole64(hseg[0].ds_addr); - } + } else + mh = rxbuf->m_head; + mh->m_pkthdr.len = mh->m_len = MHLEN; + mh->m_len = MHLEN; + mh->m_flags |= M_PKTHDR; + /* Get the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->htag, + rxbuf->hmap, mh, hseg, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("Refresh mbufs: hdr dmamap load" + " failure - %d\n", error); + m_free(mh); + rxbuf->m_head = NULL; + goto update; + } + rxbuf->m_head = mh; + bus_dmamap_sync(rxr->htag, rxbuf->hmap, + BUS_DMASYNC_PREREAD); + rxr->rx_base[i].read.hdr_addr = + htole64(hseg[0].ds_addr); +no_split: if (rxbuf->m_pack == NULL) { mp = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (mp == NULL) goto update; - mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; - /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->ptag, - rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - printf("GET BUF: dmamap load" - " failure - %d\n", error); - m_free(mp); - goto update; - } - rxbuf->m_pack = mp; - bus_dmamap_sync(rxr->ptag, rxbuf->pmap, - BUS_DMASYNC_PREREAD); - rxr->rx_base[i].read.pkt_addr = - htole64(pseg[0].ds_addr); + } else + mp = rxbuf->m_pack; + + mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; + /* Get the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->ptag, + rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("Refresh mbufs: payload dmamap load" + " failure - %d\n", error); + m_free(mp); + rxbuf->m_pack = NULL; + goto update; } + rxbuf->m_pack = mp; + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + BUS_DMASYNC_PREREAD); + rxr->rx_base[i].read.pkt_addr = + htole64(pseg[0].ds_addr); cleaned = i; /* Calculate next index */ @@ -3722,9 +3740,9 @@ igb_allocate_receive_buffers(struct rx_r BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MJUMPAGESIZE, /* maxsize */ + MJUM9BYTES, /* maxsize */ 1, /* nsegments */ - MJUMPAGESIZE, /* maxsegsize */ + MJUM9BYTES, /* maxsegsize */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ @@ -3826,7 +3844,7 @@ igb_setup_receive_ring(struct rx_ring *r rxr->hdr_split = TRUE; /* Now replenish the ring mbufs */ - for (int j = 0; j != adapter->num_rx_desc; ++j) { + for (int j = 0; j < adapter->num_rx_desc; ++j) { struct mbuf *mh, *mp; rxbuf = &rxr->rx_buffers[j]; @@ -3897,8 +3915,8 @@ skip_head: ** are undesireable in similar setups. */ if (ifp->if_capenable & IFCAP_LRO) { - int err = tcp_lro_init(lro); - if (err) { + error = tcp_lro_init(lro); + if (error) { device_printf(dev, "LRO Initialization failed!\n"); goto fail; } @@ -3940,7 +3958,9 @@ fail: */ for (int j = 0; j > i; ++j) { rxr = &adapter->rx_rings[i]; + IGB_RX_LOCK(rxr); igb_free_receive_ring(rxr); + IGB_RX_UNLOCK(rxr); } return (ENOBUFS); @@ -3983,9 +4003,13 @@ igb_initialize_receive_units(struct adap */ if (ifp->if_mtu > ETHERMTU) { rctl |= E1000_RCTL_LPE; - srrctl |= 4096 >> E1000_SRRCTL_BSIZEPKT_SHIFT; - rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX; - + if (adapter->rx_mbuf_sz == MJUMPAGESIZE) { + srrctl |= 4096 >> E1000_SRRCTL_BSIZEPKT_SHIFT; + rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX; + } else if (adapter->rx_mbuf_sz > MJUMPAGESIZE) { + srrctl |= 8192 >> E1000_SRRCTL_BSIZEPKT_SHIFT; + rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX; + } /* Set maximum packet len */ psize = adapter->max_frame_size; /* are we on a vlan? */ @@ -4194,11 +4218,11 @@ igb_free_receive_buffers(struct rx_ring static __inline void igb_rx_discard(struct rx_ring *rxr, int i) { - struct adapter *adapter = rxr->adapter; struct igb_rx_buf *rbuf; - struct mbuf *mh, *mp; rbuf = &rxr->rx_buffers[i]; + + /* Partially received? Free the chain */ if (rxr->fmp != NULL) { rxr->fmp->m_flags |= M_PKTHDR; m_freem(rxr->fmp); @@ -4206,19 +4230,23 @@ igb_rx_discard(struct rx_ring *rxr, int rxr->lmp = NULL; } - mh = rbuf->m_head; - mp = rbuf->m_pack; + /* + ** With advanced descriptors the writeback + ** clobbers the buffer addrs, so its easier + ** to just free the existing mbufs and take + ** the normal refresh path to get new buffers + ** and mapping. + */ + if (rbuf->m_head) { + m_free(rbuf->m_head); + rbuf->m_head = NULL; + } - /* Reuse loaded DMA map and just update mbuf chain */ - if (mh) { /* with no hdr split would be null */ - mh->m_len = MHLEN; - mh->m_flags |= M_PKTHDR; - mh->m_next = NULL; + if (rbuf->m_pack) { + m_free(rbuf->m_pack); + rbuf->m_pack = NULL; } - mp->m_len = mp->m_pkthdr.len = adapter->rx_mbuf_sz; - mp->m_data = mp->m_ext.ext_buf; - mp->m_next = NULL; return; } @@ -4333,10 +4361,9 @@ igb_rxeof(struct igb_queue *que, int cou E1000_RXDADV_HDRBUFLEN_SHIFT; if (hlen > IGB_HDR_BUF) hlen = IGB_HDR_BUF; - /* Handle the header mbuf */ mh = rxr->rx_buffers[i].m_head; mh->m_len = hlen; - /* clear buf info for refresh */ + /* clear buf pointer for refresh */ rxbuf->m_head = NULL; /* ** Get the payload length, this @@ -4347,7 +4374,7 @@ igb_rxeof(struct igb_queue *que, int cou mp = rxr->rx_buffers[i].m_pack; mp->m_len = plen; mh->m_next = mp; - /* clear buf info for refresh */ + /* clear buf pointer */ rxbuf->m_pack = NULL; rxr->rx_split_packets++; } @@ -4368,7 +4395,7 @@ igb_rxeof(struct igb_queue *que, int cou /* Initial frame - setup */ if (rxr->fmp == NULL) { mh->m_pkthdr.len = mh->m_len; - /* Store the first mbuf */ + /* Save the head of the chain */ rxr->fmp = mh; rxr->lmp = mh; if (mp != NULL) { @@ -4533,12 +4560,15 @@ igb_register_vlan(void *arg, struct ifne if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; + IGB_CORE_LOCK(adapter); index = (vtag >> 5) & 0x7F; bit = vtag & 0x1F; - igb_shadow_vfta[index] |= (1 << bit); + adapter->shadow_vfta[index] |= (1 << bit); ++adapter->num_vlans; /* Re-init to load the changes */ - igb_init(adapter); + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + igb_init_locked(adapter); + IGB_CORE_UNLOCK(adapter); } /* @@ -4557,12 +4587,15 @@ igb_unregister_vlan(void *arg, struct if if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; + IGB_CORE_LOCK(adapter); index = (vtag >> 5) & 0x7F; bit = vtag & 0x1F; - igb_shadow_vfta[index] &= ~(1 << bit); + adapter->shadow_vfta[index] &= ~(1 << bit); --adapter->num_vlans; /* Re-init to load the changes */ - igb_init(adapter); + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + igb_init_locked(adapter); + IGB_CORE_UNLOCK(adapter); } static void @@ -4585,12 +4618,13 @@ igb_setup_vlan_hw_support(struct adapter ** we need to repopulate it now. */ for (int i = 0; i < IGB_VFTA_SIZE; i++) - if (igb_shadow_vfta[i] != 0) { + if (adapter->shadow_vfta[i] != 0) { if (hw->mac.type == e1000_vfadapt) - e1000_vfta_set_vf(hw, igb_shadow_vfta[i], TRUE); + e1000_vfta_set_vf(hw, + adapter->shadow_vfta[i], TRUE); else E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, - i, igb_shadow_vfta[i]); + i, adapter->shadow_vfta[i]); } if (hw->mac.type == e1000_vfadapt) @@ -4994,6 +5028,28 @@ igb_sysctl_reg_handler(SYSCTL_HANDLER_AR } /* +** Tuneable interrupt rate handler +*/ +static int +igb_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS) +{ + struct igb_queue *que = ((struct igb_queue *)oidp->oid_arg1); + int error; + u32 reg, usec, rate; + + reg = E1000_READ_REG(&que->adapter->hw, E1000_EITR(que->msix)); + usec = ((reg & 0x7FFC) >> 2); + if (usec > 0) + rate = 1000000 / usec; + else + rate = 0; + error = sysctl_handle_int(oidp, &rate, 0, req); + if (error || !req->newptr) + return error; + return 0; +} + +/* * Add sysctl variables, one per statistic, to the system. */ static void @@ -5065,6 +5121,12 @@ igb_add_hw_stats(struct adapter *adapter CTLFLAG_RD, NULL, "Queue Name"); queue_list = SYSCTL_CHILDREN(queue_node); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "interrupt_rate", + CTLFLAG_RD, &adapter->queues[i], + sizeof(&adapter->queues[i]), + igb_sysctl_interrupt_rate_handler, + "IU", "Interrupt Rate"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head", CTLFLAG_RD, adapter, E1000_TDH(txr->me), igb_sysctl_reg_handler, "IU", Modified: head/sys/dev/e1000/if_igb.h ============================================================================== --- head/sys/dev/e1000/if_igb.h Tue Nov 23 22:07:10 2010 (r215780) +++ head/sys/dev/e1000/if_igb.h Tue Nov 23 22:12:02 2010 (r215781) @@ -190,6 +190,9 @@ #define IGB_TX_BUFFER_SIZE ((uint32_t) 1514) #define IGB_FC_PAUSE_TIME 0x0680 #define IGB_EEPROM_APME 0x400; +#define IGB_QUEUE_IDLE 0 +#define IGB_QUEUE_WORKING 1 +#define IGB_QUEUE_HUNG 2 /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be @@ -237,7 +240,7 @@ /* Define the starting Interrupt rate per Queue */ #define IGB_INTS_PER_SEC 8000 -#define IGB_DEFAULT_ITR 1000000000/(IGB_INTS_PER_SEC * 256) +#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) #define IGB_LINK_ITR 2000 @@ -300,7 +303,7 @@ struct tx_ring { u32 bytes; u32 packets; - bool watchdog_check; + int queue_status; int watchdog_time; int tdt; int tdh; @@ -384,7 +387,15 @@ struct adapter { int wol; int has_manage; - /* Info about the board itself */ + /* + ** Shadow VFTA table, this is needed because + ** the real vlan filter table gets cleared during + ** a soft reset and the driver needs to be able + ** to repopulate it. + */ + u32 shadow_vfta[IGB_VFTA_SIZE]; + + /* Info about the interface */ u8 link_active; u16 link_speed; u16 link_duplex; From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 22:17:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE7041065673; Tue, 23 Nov 2010 22:17:06 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD4A38FC1C; Tue, 23 Nov 2010 22:17:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANMH6pT046047; Tue, 23 Nov 2010 22:17:06 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANMH6gt046045; Tue, 23 Nov 2010 22:17:06 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201011232217.oANMH6gt046045@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 23 Nov 2010 22:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215782 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 22:17:06 -0000 Author: bschmidt Date: Tue Nov 23 22:17:06 2010 New Revision: 215782 URL: http://svn.freebsd.org/changeset/base/215782 Log: Add prototype for InitializeSListHead(). Modified: head/sys/compat/ndis/subr_ntoskrnl.c Modified: head/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- head/sys/compat/ndis/subr_ntoskrnl.c Tue Nov 23 22:12:02 2010 (r215781) +++ head/sys/compat/ndis/subr_ntoskrnl.c Tue Nov 23 22:17:06 2010 (r215782) @@ -181,6 +181,7 @@ static uint64_t _aullrem(uint64_t, uint6 static uint64_t _aullshr(uint64_t, uint8_t); static uint64_t _aullshl(uint64_t, uint8_t); static slist_entry *ntoskrnl_pushsl(slist_header *, slist_entry *); +static void InitializeSListHead(slist_header *); static slist_entry *ntoskrnl_popsl(slist_header *); static void ExFreePoolWithTag(void *, uint32_t); static void ExInitializePagedLookasideList(paged_lookaside_list *, From owner-svn-src-head@FreeBSD.ORG Tue Nov 23 22:17:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45581106566C; Tue, 23 Nov 2010 22:17:40 +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 330658FC19; Tue, 23 Nov 2010 22:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oANMHeAE046095; Tue, 23 Nov 2010 22:17:40 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oANMHeZW046086; Tue, 23 Nov 2010 22:17:40 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201011232217.oANMHeZW046086@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 23 Nov 2010 22:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215783 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2010 22:17:40 -0000 Author: jilles Date: Tue Nov 23 22:17:39 2010 New Revision: 215783 URL: http://svn.freebsd.org/changeset/base/215783 Log: sh: Code size optimizations to "stack string" memory allocation: * Prefer one CHECKSTRSPACE with multiple USTPUTC to multiple STPUTC. * Add STPUTS macro (based on function) and use it instead of loops that add nul-terminated strings to the stack string. No functional change is intended, but code size is about 1K less on i386. Modified: head/bin/sh/cd.c head/bin/sh/eval.c head/bin/sh/expand.c head/bin/sh/histedit.c head/bin/sh/memalloc.c head/bin/sh/memalloc.h head/bin/sh/miscbltin.c head/bin/sh/parser.c Modified: head/bin/sh/cd.c ============================================================================== --- head/bin/sh/cd.c Tue Nov 23 22:17:06 2010 (r215782) +++ head/bin/sh/cd.c Tue Nov 23 22:17:39 2010 (r215783) @@ -192,8 +192,7 @@ cdlogical(char *dest) STPUTC('/', p); first = 0; component = q; - while (*q) - STPUTC(*q++, p); + STPUTS(q, p); if (equal(component, "..")) continue; STACKSTRNUL(p); @@ -273,10 +272,8 @@ findcwd(char *dir) scopy(dir, cdcomppath); STARTSTACKSTR(new); if (*dir != '/') { - p = curdir; - while (*p) - STPUTC(*p++, new); - if (p[-1] == '/') + STPUTS(curdir, new); + if (STTOPC(new) == '/') STUNPUTC(new); } while ((p = getcomponent()) != NULL) { @@ -284,8 +281,7 @@ findcwd(char *dir) while (new > stackblock() && (STUNPUTC(new), *new) != '/'); } else if (*p != '\0' && ! equal(p, ".")) { STPUTC('/', new); - while (*p) - STPUTC(*p++, new); + STPUTS(p, new); } } if (new == stackblock()) Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Tue Nov 23 22:17:06 2010 (r215782) +++ head/bin/sh/eval.c Tue Nov 23 22:17:39 2010 (r215783) @@ -135,8 +135,7 @@ evalcmd(int argc, char **argv) STARTSTACKSTR(concat); ap = argv + 2; for (;;) { - while (*p) - STPUTC(*p++, concat); + STPUTS(p, concat); if ((p = *ap++) == NULL) break; STPUTC(' ', concat); Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Tue Nov 23 22:17:06 2010 (r215782) +++ head/bin/sh/expand.c Tue Nov 23 22:17:39 2010 (r215783) @@ -225,6 +225,7 @@ argstr(char *p, int flag) if (*p == '~' && (flag & (EXP_TILDE | EXP_VARTILDE))) p = exptilde(p, flag); for (;;) { + CHECKSTRSPACE(2, expdest); switch (c = *p++) { case '\0': case CTLENDVAR: @@ -235,16 +236,16 @@ argstr(char *p, int flag) if (p[0] == CTLVAR && p[2] == '@' && p[3] == '=') break; if ((flag & EXP_FULL) != 0) - STPUTC(c, expdest); + USTPUTC(c, expdest); break; case CTLQUOTEEND: lit_quoted = 0; break; case CTLESC: if (quotes) - STPUTC(c, expdest); + USTPUTC(c, expdest); c = *p++; - STPUTC(c, expdest); + USTPUTC(c, expdest); if (split_lit && !lit_quoted) recordregion(expdest - stackblock() - (quotes ? 2 : 1), @@ -267,7 +268,7 @@ argstr(char *p, int flag) * sort of a hack - expand tildes in variable * assignments (after the first '=' and after ':'s). */ - STPUTC(c, expdest); + USTPUTC(c, expdest); if (split_lit && !lit_quoted) recordregion(expdest - stackblock() - 1, expdest - stackblock(), 0); @@ -279,7 +280,7 @@ argstr(char *p, int flag) } break; default: - STPUTC(c, expdest); + USTPUTC(c, expdest); if (split_lit && !lit_quoted) recordregion(expdest - stackblock() - 1, expdest - stackblock(), 0); @@ -902,8 +903,7 @@ varvalue(char *name, int quoted, int sub STPUTC(*p++, expdest); \ } \ } else \ - while (*p) \ - STPUTC(*p++, expdest); \ + STPUTS(p, expdest); \ } while (0) @@ -1573,8 +1573,7 @@ cvtnum(int num, char *buf) if (neg) *--p = '-'; - while (*p) - STPUTC(*p++, buf); + STPUTS(p, buf); return buf; } Modified: head/bin/sh/histedit.c ============================================================================== --- head/bin/sh/histedit.c Tue Nov 23 22:17:06 2010 (r215782) +++ head/bin/sh/histedit.c Tue Nov 23 22:17:39 2010 (r215783) @@ -411,8 +411,7 @@ fc_replace(const char *s, char *p, char STARTSTACKSTR(dest); while (*s) { if (*s == *p && strncmp(s, p, plen) == 0) { - while (*r) - STPUTC(*r++, dest); + STPUTS(r, dest); s += plen; *p = '\0'; /* so no more matches */ } else Modified: head/bin/sh/memalloc.c ============================================================================== --- head/bin/sh/memalloc.c Tue Nov 23 22:17:06 2010 (r215782) +++ head/bin/sh/memalloc.c Tue Nov 23 22:17:39 2010 (r215783) @@ -340,3 +340,20 @@ ungrabstackstr(char *s, char *p) stacknxt = s; sstrnleft = stacknleft - (p - s); } + + +char * +stputbin(const char *data, int len, char *p) +{ + int i; + + for (i = 0; i < len; i++) + STPUTC(data[i], p); + return (p); +} + +char * +stputs(const char *data, char *p) +{ + return (stputbin(data, strlen(data), p)); +} Modified: head/bin/sh/memalloc.h ============================================================================== --- head/bin/sh/memalloc.h Tue Nov 23 22:17:06 2010 (r215782) +++ head/bin/sh/memalloc.h Tue Nov 23 22:17:39 2010 (r215783) @@ -61,6 +61,8 @@ void grabstackblock(int); char *growstackstr(void); char *makestrspace(void); void ungrabstackstr(char *, char *); +char *stputbin(const char *data, int len, char *p); +char *stputs(const char *data, char *p); @@ -82,3 +84,5 @@ void ungrabstackstr(char *, char *); #define STTOPC(p) p[-1] #define STADJUST(amount, p) (p += (amount), sstrnleft -= (amount)) #define grabstackstr(p) stalloc(stackblocksize() - sstrnleft) +#define STPUTBIN(s, len, p) p = stputbin((s), (len), p) +#define STPUTS(s, p) p = stputs((s), p) Modified: head/bin/sh/miscbltin.c ============================================================================== --- head/bin/sh/miscbltin.c Tue Nov 23 22:17:06 2010 (r215782) +++ head/bin/sh/miscbltin.c Tue Nov 23 22:17:39 2010 (r215783) @@ -172,11 +172,12 @@ readcmd(int argc __unused, char **argv _ } if (c == '\0') continue; + CHECKSTRSPACE(1, p); if (backslash) { backslash = 0; startword = 0; if (c != '\n') - STPUTC(c, p); + USTPUTC(c, p); continue; } if (!rflag && c == '\\') { @@ -194,14 +195,14 @@ readcmd(int argc __unused, char **argv _ if (is_ifs == 1) { /* Ignore leading IFS whitespace */ if (saveall) - STPUTC(c, p); + USTPUTC(c, p); continue; } if (is_ifs == 2 && startword == 1) { /* Only one non-whitespace IFS per word */ startword = 2; if (saveall) - STPUTC(c, p); + USTPUTC(c, p); continue; } } @@ -212,7 +213,7 @@ readcmd(int argc __unused, char **argv _ if (saveall) /* Not just a spare terminator */ saveall++; - STPUTC(c, p); + USTPUTC(c, p); continue; } @@ -222,7 +223,7 @@ readcmd(int argc __unused, char **argv _ if (ap[1] == NULL) { /* Last variable needs all IFS chars */ saveall++; - STPUTC(c, p); + USTPUTC(c, p); continue; } Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Tue Nov 23 22:17:06 2010 (r215782) +++ head/bin/sh/parser.c Tue Nov 23 22:17:39 2010 (r215783) @@ -1017,6 +1017,7 @@ parsebackq(char *out, struct nodelist ** setprompt(2); needprompt = 0; } + CHECKSTRSPACE(2, oout); switch (c = pgetc()) { case '`': goto done; @@ -1031,14 +1032,14 @@ parsebackq(char *out, struct nodelist ** /* * If eating a newline, avoid putting * the newline into the new character - * stream (via the STPUTC after the + * stream (via the USTPUTC after the * switch). */ continue; } if (c != '\\' && c != '`' && c != '$' && (!dblquote || c != '"')) - STPUTC('\\', oout); + USTPUTC('\\', oout); break; case '\n': @@ -1054,10 +1055,10 @@ parsebackq(char *out, struct nodelist ** default: break; } - STPUTC(c, oout); + USTPUTC(c, oout); } done: - STPUTC('\0', oout); + USTPUTC('\0', oout); olen = oout - stackblock(); INTOFF; ostr = ckmalloc(olen); @@ -1444,7 +1445,6 @@ parsesub: { char *p; static const char types[] = "}-+?="; int bracketed_name = 0; /* used to handle ${[0-9]*} variables */ - int i; int linno; int length; @@ -1498,8 +1498,7 @@ parsesub: { linno -= funclinno - 1; snprintf(buf, sizeof(buf), "%d", linno); STADJUST(-6, out); - for (i = 0; buf[i] != '\0'; i++) - STPUTC(buf[i], out); + STPUTS(buf, out); flags |= VSLINENO; } } else if (is_digit(c)) { From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 00:05:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B25BA106566C; Wed, 24 Nov 2010 00:05:19 +0000 (UTC) (envelope-from yar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65F0F8FC1A; Wed, 24 Nov 2010 00:05:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAO05Jok048534; Wed, 24 Nov 2010 00:05:19 GMT (envelope-from yar@svn.freebsd.org) Received: (from yar@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAO05JvW048532; Wed, 24 Nov 2010 00:05:19 GMT (envelope-from yar@svn.freebsd.org) Message-Id: <201011240005.oAO05JvW048532@svn.freebsd.org> From: Yar Tikhiy Date: Wed, 24 Nov 2010 00:05:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215786 - head/usr.sbin/iostat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 00:05:19 -0000 Author: yar Date: Wed Nov 24 00:05:19 2010 New Revision: 215786 URL: http://svn.freebsd.org/changeset/base/215786 Log: Clarify a few details about iostat(8) behavior: - The default repeat count for iostat(8) is 1 unless there was a -w on the command line. - A -x display doesn't include TTY or CPU stats by default but they can be turned on with a -T or -C, respectively. Submitted by: arundel (initial version) Reviewed by: arundel MFC after: 1 week Modified: head/usr.sbin/iostat/iostat.8 Modified: head/usr.sbin/iostat/iostat.8 ============================================================================== --- head/usr.sbin/iostat/iostat.8 Wed Nov 24 00:00:32 2010 (r215785) +++ head/usr.sbin/iostat/iostat.8 Wed Nov 24 00:05:19 2010 (r215786) @@ -60,7 +60,7 @@ .\" .\" @(#)iostat.8 8.1 (Berkeley) 6/6/93 .\" -.Dd April 17, 2006 +.Dd November 24, 2010 .Dt IOSTAT 8 .Os .Sh NAME @@ -102,11 +102,18 @@ Repeat the display times. If no repeat .Ar count -is specified, the default is infinity. +is specified, the default depends on whether +.Fl w +is specified. +With +.Fl w +the default repeat count is infinity, otherwise it is 1. .It Fl C Display CPU statistics. This is on by default, unless .Fl d +or +.Fl x is specified. .It Fl d Display only device statistics. @@ -231,6 +238,8 @@ output, up to the number of devices that Display TTY statistics. This is on by default, unless .Fl d +or +.Fl x is specified. .It Fl w Pause @@ -255,6 +264,11 @@ so your mileage may vary. .It Fl x Show extended disk statistics. Each disk is displayed on a line of its own with all available statistics. +If this flag is turned on, only disk statistics will be displayed, unless +.Fl C +or +.Fl T +is also specified to enable the display of CPU or TTY statistics. .It Fl z If .Fl x From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 01:13:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FB191065672; Wed, 24 Nov 2010 01:13:55 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EB448FC08; Wed, 24 Nov 2010 01:13:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAO1Dt2b050257; Wed, 24 Nov 2010 01:13:55 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAO1DtJC050254; Wed, 24 Nov 2010 01:13:55 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201011240113.oAO1DtJC050254@svn.freebsd.org> From: Jack F Vogel Date: Wed, 24 Nov 2010 01:13:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215789 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 01:13:55 -0000 Author: jfv Date: Wed Nov 24 01:13:55 2010 New Revision: 215789 URL: http://svn.freebsd.org/changeset/base/215789 Log: Add shared code glue for new 82580 devices. Modified: head/sys/dev/e1000/e1000_api.c head/sys/dev/e1000/e1000_hw.h Modified: head/sys/dev/e1000/e1000_api.c ============================================================================== --- head/sys/dev/e1000/e1000_api.c Wed Nov 24 01:03:03 2010 (r215788) +++ head/sys/dev/e1000/e1000_api.c Wed Nov 24 01:13:55 2010 (r215789) @@ -312,6 +312,8 @@ s32 e1000_set_mac_type(struct e1000_hw * case E1000_DEV_ID_82580_SGMII: case E1000_DEV_ID_82580_COPPER_DUAL: case E1000_DEV_ID_82580_QUAD_FIBER: + case E1000_DEV_ID_DH89XXCC_SGMII: + case E1000_DEV_ID_DH89XXCC_SERDES: mac->type = e1000_82580; break; case E1000_DEV_ID_82576_VF: Modified: head/sys/dev/e1000/e1000_hw.h ============================================================================== --- head/sys/dev/e1000/e1000_hw.h Wed Nov 24 01:03:03 2010 (r215788) +++ head/sys/dev/e1000/e1000_hw.h Wed Nov 24 01:13:55 2010 (r215789) @@ -150,6 +150,8 @@ struct e1000_hw; #define E1000_DEV_ID_82580_SGMII 0x1511 #define E1000_DEV_ID_82580_COPPER_DUAL 0x1516 #define E1000_DEV_ID_82580_QUAD_FIBER 0x1527 +#define E1000_DEV_ID_DH89XXCC_SGMII 0x0436 +#define E1000_DEV_ID_DH89XXCC_SERDES 0x0438 #define E1000_REVISION_0 0 #define E1000_REVISION_1 1 #define E1000_REVISION_2 2 From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 05:24:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1AF7106566B; Wed, 24 Nov 2010 05:24:36 +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 BFEFA8FC16; Wed, 24 Nov 2010 05:24:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAO5OaY5056037; Wed, 24 Nov 2010 05:24:36 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAO5OaxE056035; Wed, 24 Nov 2010 05:24:36 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201011240524.oAO5OaxE056035@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 24 Nov 2010 05:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215790 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 05:24:37 -0000 Author: glebius Date: Wed Nov 24 05:24:36 2010 New Revision: 215790 URL: http://svn.freebsd.org/changeset/base/215790 Log: Redo r166423. It is important not only skip freeing multicast entires when underlying interface is detached, but also purge pointers to them, to avoid double-free in future. Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Wed Nov 24 01:13:55 2010 (r215789) +++ head/sys/netinet/ip_carp.c Wed Nov 24 05:24:36 2010 (r215790) @@ -218,7 +218,7 @@ static void carp_set_state(struct carp_s static int carp_addrcount(struct carp_if *, struct in_ifaddr *, int); enum { CARP_COUNT_MASTER, CARP_COUNT_RUNNING }; -static void carp_multicast_cleanup(struct carp_softc *); +static void carp_multicast_cleanup(struct carp_softc *, int dofree); static int carp_set_addr(struct carp_softc *, struct sockaddr_in *); static int carp_del_addr(struct carp_softc *, struct sockaddr_in *); static void carp_carpdev_state_locked(struct carp_if *); @@ -227,7 +227,7 @@ static void carp_sc_state_locked(struct static void carp_send_na(struct carp_softc *); static int carp_set_addr6(struct carp_softc *, struct sockaddr_in6 *); static int carp_del_addr6(struct carp_softc *, struct sockaddr_in6 *); -static void carp_multicast6_cleanup(struct carp_softc *); +static void carp_multicast6_cleanup(struct carp_softc *, int dofree); #endif static LIST_HEAD(, carp_softc) carpif_list; @@ -466,9 +466,11 @@ carp_clone_destroy(struct ifnet *ifp) /* * This function can be called on CARP interface destroy path, * and in case of the removal of the underlying interface as - * well. We differentiate these two cases. In the latter case - * we do not cleanup our multicast memberships, since they - * are already freed. Also, in the latter case we do not + * well. We differentiate these two cases: in case of destruction + * of the underlying interface, we do not cleanup our multicast + * memberships, since they are already freed. But we purge pointers + * to multicast structures, since they are no longer valid, to + * avoid panic in future calls to carpdetach(). Also, we do not * release the lock on return, because the function will be * called once more, for another CARP instance on the same * interface. @@ -493,10 +495,9 @@ carpdetach(struct carp_softc *sc, int un carp_set_state(sc, INIT); SC2IFP(sc)->if_flags &= ~IFF_UP; carp_setrun(sc, 0); - if (unlock) - carp_multicast_cleanup(sc); + carp_multicast_cleanup(sc, unlock); #ifdef INET6 - carp_multicast6_cleanup(sc); + carp_multicast6_cleanup(sc, unlock); #endif if (sc->sc_carpdev != NULL) { @@ -1444,7 +1445,7 @@ carp_setrun(struct carp_softc *sc, sa_fa } static void -carp_multicast_cleanup(struct carp_softc *sc) +carp_multicast_cleanup(struct carp_softc *sc, int dofree) { struct ip_moptions *imo = &sc->sc_imo; u_int16_t n = imo->imo_num_memberships; @@ -1452,7 +1453,8 @@ carp_multicast_cleanup(struct carp_softc /* Clean up our own multicast memberships */ while (n-- > 0) { if (imo->imo_membership[n] != NULL) { - in_delmulti(imo->imo_membership[n]); + if (dofree) + in_delmulti(imo->imo_membership[n]); imo->imo_membership[n] = NULL; } } @@ -1464,14 +1466,15 @@ carp_multicast_cleanup(struct carp_softc #ifdef INET6 static void -carp_multicast6_cleanup(struct carp_softc *sc) +carp_multicast6_cleanup(struct carp_softc *sc, int dofree) { struct ip6_moptions *im6o = &sc->sc_im6o; u_int16_t n = im6o->im6o_num_memberships; while (n-- > 0) { if (im6o->im6o_membership[n] != NULL) { - in6_mc_leave(im6o->im6o_membership[n], NULL); + if (dofree) + in6_mc_leave(im6o->im6o_membership[n], NULL); im6o->im6o_membership[n] = NULL; } } @@ -1831,7 +1834,7 @@ carp_set_addr6(struct carp_softc *sc, st cleanup: if (!sc->sc_naddrs6) - carp_multicast6_cleanup(sc); + carp_multicast6_cleanup(sc, 1); ifa_free(&ia->ia_ifa); return (error); } @@ -1849,7 +1852,7 @@ carp_del_addr6(struct carp_softc *sc, st SC2IFP(sc)->if_flags &= ~IFF_UP; SC2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING; sc->sc_vhid = -1; - carp_multicast6_cleanup(sc); + carp_multicast6_cleanup(sc, 1); TAILQ_REMOVE(&cif->vhif_vrs, sc, sc_list); if (!--cif->vhif_nvrs) { CARP_LOCK_DESTROY(cif); From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 05:50:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2082F1065670; Wed, 24 Nov 2010 05:50:20 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F6B08FC14; Wed, 24 Nov 2010 05:50:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAO5oJdM056658; Wed, 24 Nov 2010 05:50:19 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAO5oJYi056656; Wed, 24 Nov 2010 05:50:19 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201011240550.oAO5oJYi056656@svn.freebsd.org> From: Maxim Konovalov Date: Wed, 24 Nov 2010 05:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215792 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 05:50:20 -0000 Author: maxim Date: Wed Nov 24 05:50:19 2010 New Revision: 215792 URL: http://svn.freebsd.org/changeset/base/215792 Log: o Swap descriptions for net.bpf.bufsize and net.bpf.maxbufsize. PR: misc/152531 MFC after: 1 week Modified: head/sys/net/bpf_buffer.c Modified: head/sys/net/bpf_buffer.c ============================================================================== --- head/sys/net/bpf_buffer.c Wed Nov 24 05:37:12 2010 (r215791) +++ head/sys/net/bpf_buffer.c Wed Nov 24 05:50:19 2010 (r215792) @@ -88,10 +88,10 @@ __FBSDID("$FreeBSD$"); static int bpf_bufsize = 4096; SYSCTL_INT(_net_bpf, OID_AUTO, bufsize, CTLFLAG_RW, - &bpf_bufsize, 0, "Maximum capture buffer size in bytes"); + &bpf_bufsize, 0, "Default capture buffer size in bytes"); static int bpf_maxbufsize = BPF_MAXBUFSIZE; SYSCTL_INT(_net_bpf, OID_AUTO, maxbufsize, CTLFLAG_RW, - &bpf_maxbufsize, 0, "Default capture buffer in bytes"); + &bpf_maxbufsize, 0, "Maximum capture buffer in bytes"); void bpf_buffer_alloc(struct bpf_d *d) From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 12:25:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED967106566C; Wed, 24 Nov 2010 12:25:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC8228FC17; Wed, 24 Nov 2010 12:25:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOCPH4g070025; Wed, 24 Nov 2010 12:25:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOCPHXj070023; Wed, 24 Nov 2010 12:25:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011241225.oAOCPHXj070023@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 24 Nov 2010 12:25:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215796 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 12:25:18 -0000 Author: kib Date: Wed Nov 24 12:25:17 2010 New Revision: 215796 URL: http://svn.freebsd.org/changeset/base/215796 Log: After the sleep caused by encountering a busy page, relookup the page. Submitted and reviewed by: alc Reprted and tested by: pho MFC after: 5 days Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Nov 24 09:36:36 2010 (r215795) +++ head/sys/vm/vm_object.c Wed Nov 24 12:25:17 2010 (r215796) @@ -821,9 +821,11 @@ rescan: np = TAILQ_NEXT(p, listq); if (p->valid == 0) continue; - while (vm_page_sleep_if_busy(p, TRUE, "vpcwai")) { + if (vm_page_sleep_if_busy(p, TRUE, "vpcwai")) { if (object->generation != curgeneration) goto rescan; + np = vm_page_find_least(object, pi); + continue; } vm_page_test_dirty(p); if (p->dirty == 0) From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 12:30:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B60AF106567A; Wed, 24 Nov 2010 12:30:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4E658FC15; Wed, 24 Nov 2010 12:30:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOCUfrA070178; Wed, 24 Nov 2010 12:30:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOCUflT070176; Wed, 24 Nov 2010 12:30:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011241230.oAOCUflT070176@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 24 Nov 2010 12:30:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215797 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 12:30:41 -0000 Author: kib Date: Wed Nov 24 12:30:41 2010 New Revision: 215797 URL: http://svn.freebsd.org/changeset/base/215797 Log: Allow shared-locked vnode to be passed to vunref(9). When shared-locked vnode is supplied as an argument to vunref(9) and resulting usecount is 0, set VI_OWEINACT and do not try to upgrade vnode lock. The later could cause vnode unlock, allowing the vnode to be reclaimed meantime. Tested by: pho MFC after: 1 week Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Nov 24 12:25:17 2010 (r215796) +++ head/sys/kern/vfs_subr.c Wed Nov 24 12:30:41 2010 (r215797) @@ -2186,7 +2186,7 @@ vputx(struct vnode *vp, int func) KASSERT(vp != NULL, ("vputx: null vp")); if (func == VPUTX_VUNREF) - ASSERT_VOP_ELOCKED(vp, "vunref"); + ASSERT_VOP_LOCKED(vp, "vunref"); else if (func == VPUTX_VPUT) ASSERT_VOP_LOCKED(vp, "vput"); else @@ -2224,12 +2224,22 @@ vputx(struct vnode *vp, int func) * as VI_DOINGINACT to avoid recursion. */ vp->v_iflag |= VI_OWEINACT; - if (func == VPUTX_VRELE) { + switch (func) { + case VPUTX_VRELE: error = vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK); VI_LOCK(vp); - } else if (func == VPUTX_VPUT && VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { - error = VOP_LOCK(vp, LK_UPGRADE | LK_INTERLOCK | LK_NOWAIT); - VI_LOCK(vp); + break; + case VPUTX_VPUT: + if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { + error = VOP_LOCK(vp, LK_UPGRADE | LK_INTERLOCK | + LK_NOWAIT); + VI_LOCK(vp); + } + break; + case VPUTX_VUNREF: + if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) + error = EBUSY; + break; } if (vp->v_usecount > 0) vp->v_iflag &= ~VI_OWEINACT; From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 12:34:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1A45106564A; Wed, 24 Nov 2010 12:34:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 908538FC1D; Wed, 24 Nov 2010 12:34:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOCYP56070304; Wed, 24 Nov 2010 12:34:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOCYPqY070302; Wed, 24 Nov 2010 12:34:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011241234.oAOCYPqY070302@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 24 Nov 2010 12:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215798 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 12:34:25 -0000 Author: kib Date: Wed Nov 24 12:34:25 2010 New Revision: 215798 URL: http://svn.freebsd.org/changeset/base/215798 Log: Remove the note about possible unlocking during vunref(9). It might only happen if VOP_INACTIVATE() drops the vnode lock, which is quite unreasonable behaviour for filesystem, and should not be mentioned in the description of VFS primitives. MFC after: 1 week Modified: head/share/man/man9/vrele.9 Modified: head/share/man/man9/vrele.9 ============================================================================== --- head/share/man/man9/vrele.9 Wed Nov 24 12:30:41 2010 (r215797) +++ head/share/man/man9/vrele.9 Wed Nov 24 12:34:25 2010 (r215798) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2010 +.Dd November 20, 2010 .Dt VRELE 9 .Os .Sh NAME @@ -74,10 +74,6 @@ with less overhead. The .Fn vunref function takes a locked vnode as argument, and returns with the vnode locked. -Nonetheless, the -.Fn vunref -might drop the vnode lock during the operation, so caller should not expect -that non-doomed vnode is still non-doomed after the function returned. .Pp Any code in the system which signified its use of a vnode by usecount should call one of the listed function to decrement use counter. From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 15:25:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DAC9106564A; Wed, 24 Nov 2010 15:25:18 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 416468FC13; Wed, 24 Nov 2010 15:25:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOFPIJj074224; Wed, 24 Nov 2010 15:25:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOFPIVB074220; Wed, 24 Nov 2010 15:25:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201011241525.oAOFPIVB074220@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 24 Nov 2010 15:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215799 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 15:25:18 -0000 Author: pjd Date: Wed Nov 24 15:25:17 2010 New Revision: 215799 URL: http://svn.freebsd.org/changeset/base/215799 Log: Add gptboot_enable rc variable, which allows to turn gptboot reporting off in case user wants to implement his own actions and doesn't want the attributes to vanish. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com MFC after: 3 days Modified: head/etc/defaults/rc.conf head/etc/rc.d/gptboot head/share/man/man5/rc.conf.5 Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Wed Nov 24 12:34:25 2010 (r215798) +++ head/etc/defaults/rc.conf Wed Nov 24 15:25:17 2010 (r215799) @@ -58,6 +58,8 @@ rc_conf_files="/etc/rc.conf /etc/rc.conf # ZFS support zfs_enable="NO" # Set to YES to automatically mount ZFS file systems +gptboot_enable="YES" # GPT boot success/failure reporting. + # Experimental - test before enabling gbde_autoattach_all="NO" # YES automatically mounts gbde devices from fstab gbde_devices="NO" # Devices to automatically attach (list, or AUTO) Modified: head/etc/rc.d/gptboot ============================================================================== --- head/etc/rc.d/gptboot Wed Nov 24 12:34:25 2010 (r215798) +++ head/etc/rc.d/gptboot Wed Nov 24 15:25:17 2010 (r215799) @@ -34,6 +34,7 @@ . /etc/rc.subr name="gptboot" +rcvar=`set_rcvar` start_cmd="gptboot_report" gptboot_report() Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Wed Nov 24 12:34:25 2010 (r215798) +++ head/share/man/man5/rc.conf.5 Wed Nov 24 15:25:17 2010 (r215799) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2010 +.Dd November 24, 2010 .Dt RC.CONF 5 .Os .Sh NAME @@ -1575,6 +1575,17 @@ If set to .Pa /etc/rc.d/zfs will attempt to automatically mount ZFS file systems and initialize ZFS volumes (ZVOLs). +.It Va gptboot_enable +.Pq Vt bool +If set to +.Dq Li YES , +.Pa /etc/rc.d/gptboot +will log if the system successfully (or not) booted from a GPT partition, +which had the +.Ar bootonce +attribute set using +.Xr gpart 8 +utility. .It Va gbde_autoattach_all .Pq Vt bool If set to From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 15:56:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CD181065670; Wed, 24 Nov 2010 15:56:48 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id DD4E88FC0C; Wed, 24 Nov 2010 15:56:47 +0000 (UTC) Received: by gxk8 with SMTP id 8so696791gxk.13 for ; Wed, 24 Nov 2010 07:56:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=ZdNsp+qE8xu4SzqtXO0KHbKCKDoFe4VBl9HUFPUQENk=; b=HzexaOJ1nBraawzm72dX8vAv0aVESkGe1tAqGQqdBvSMUCFQmVkAd4+l2PRoNpJ8G4 hyCPr1nakSuUGlqEx2l1SU9VncC+YAtPxLhgVhEaGCawYxyeg2oBo4pPQEMg8OjLu0gi ZIQmdP9N68shUeOlHkmBUX2aa0KTUobhvfh1I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=HgOXSOYtfT5zxzF0orbIoUhMPr14OZV+SaGvaM0lBqi//Yz9BtMzHPO7+Itte0U7e4 gNXVb00aLE48/84o/qq0VDAaEnOBHLYcsEQ7xrIf4EX0Aowz9p4lGOuRXGdjvSPdJFHD xr/lHEGMaM68F02hb45uCnMapo9+XyRvzgP7s= MIME-Version: 1.0 Received: by 10.150.11.5 with SMTP id 5mr1087523ybk.370.1290614206973; Wed, 24 Nov 2010 07:56:46 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.151.39.12 with HTTP; Wed, 24 Nov 2010 07:56:46 -0800 (PST) In-Reply-To: <201011241230.oAOCUflT070176@svn.freebsd.org> References: <201011241230.oAOCUflT070176@svn.freebsd.org> Date: Wed, 24 Nov 2010 10:56:46 -0500 X-Google-Sender-Auth: 5ZXhQ_Du16dG4GIIxoASDgRkM9A Message-ID: From: Attilio Rao To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215797 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 15:56:48 -0000 2010/11/24 Konstantin Belousov : > Author: kib > Date: Wed Nov 24 12:30:41 2010 > New Revision: 215797 > URL: http://svn.freebsd.org/changeset/base/215797 > > Log: > =C2=A0Allow shared-locked vnode to be passed to vunref(9). > =C2=A0When shared-locked vnode is supplied as an argument to vunref(9) an= d > =C2=A0resulting usecount is 0, set VI_OWEINACT and do not try to upgrade = vnode > =C2=A0lock. The later could cause vnode unlock, allowing the vnode to be > =C2=A0reclaimed meantime. Thanks a lot, I really appreciate that. The story here is that kib really wanted to commit another patch aiming for the vnode lock upgrade with a modify to lockmgr that I wasn't happy with (or more specifically that I really wished could be carried on in a different way). As this is a time-critical fix for him, that is probabilly a better comprom= ise. I'll try to find some time and go with the full patchset I have in mind, changing this to using upgrade. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 16:03:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED062106566B; Wed, 24 Nov 2010 16:02:58 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA5108FC0A; Wed, 24 Nov 2010 16:02:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOG2w4T075130; Wed, 24 Nov 2010 16:02:58 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOG2wkr075128; Wed, 24 Nov 2010 16:02:58 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201011241602.oAOG2wkr075128@svn.freebsd.org> From: Marko Zec Date: Wed, 24 Nov 2010 16:02:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215800 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 16:03:00 -0000 Author: zec Date: Wed Nov 24 16:02:58 2010 New Revision: 215800 URL: http://svn.freebsd.org/changeset/base/215800 Log: Simplify ng_pipe locking model by relying on the netgraph framework to provide serialization of calls into the node, which is accomplished by markng the node as single-threaded (NGF_FORCE_WRITER). The price we pay is that each ng_pipe instance now has its own callout handler which polls for queued frames on each clock tick, as long as the pipe has any frames in its internal queues. OTOH, we got rid of the global ng_pipe mutex, so from now on multiple ng_pipe instances can operate in parallel. This change also fixes counting of forwarded frames when an ng_pipe node is not enforcing any packet impairments. While here, attempt to improve adherance to style(9) throughout otherwise mostly unreadable code. MFC after: 3 days Modified: head/sys/netgraph/ng_pipe.c Modified: head/sys/netgraph/ng_pipe.c ============================================================================== --- head/sys/netgraph/ng_pipe.c Wed Nov 24 15:25:17 2010 (r215799) +++ head/sys/netgraph/ng_pipe.c Wed Nov 24 16:02:58 2010 (r215800) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2008 University of Zagreb + * Copyright (c) 2004-2010 University of Zagreb * Copyright (c) 2007-2008 FreeBSD Foundation * * This software was developed by the University of Zagreb and the @@ -62,8 +62,6 @@ static MALLOC_DEFINE(M_NG_PIPE, "ng_pipe", "ng_pipe"); -struct mtx ng_pipe_giant; - /* Packet header struct */ struct ngp_hdr { TAILQ_ENTRY(ngp_hdr) ngp_link; /* next pkt in queue */ @@ -88,7 +86,6 @@ struct hookinfo { int noqueue; /* bypass any processing */ TAILQ_HEAD(, ngp_fifo) fifo_head; /* FIFO queues */ TAILQ_HEAD(, ngp_hdr) qout_head; /* delay queue head */ - LIST_ENTRY(hookinfo) active_le; /* active hooks */ struct timeval qin_utime; struct ng_pipe_hookcfg cfg; struct ng_pipe_hookrun run; @@ -103,6 +100,8 @@ struct node_priv { u_int32_t header_offset; struct hookinfo lower; struct hookinfo upper; + struct callout timer; + int timer_scheduled; }; typedef struct node_priv *priv_p; @@ -131,17 +130,9 @@ typedef struct node_priv *priv_p; static void parse_cfg(struct ng_pipe_hookcfg *, struct ng_pipe_hookcfg *, struct hookinfo *, priv_p); static void pipe_dequeue(struct hookinfo *, struct timeval *); -static void pipe_scheduler(void *); -static void pipe_poll(void); +static void ngp_callout(node_p, hook_p, void *, int); static int ngp_modevent(module_t, int, void *); -/* linked list of active "pipe" hooks */ -static LIST_HEAD(, hookinfo) active_head; -static int active_gen_id = 0; - -/* timeout handle for pipe_scheduler */ -static struct callout polling_timer; - /* zone for storing ngp_hdr-s */ static uma_zone_t ngp_zone; @@ -267,6 +258,11 @@ ngp_constructor(node_p node) return (ENOMEM); NG_NODE_SET_PRIVATE(node, priv); + /* Mark node as single-threaded */ + NG_NODE_FORCE_WRITER(node); + + ng_callout_init(&priv->timer); + return (0); } @@ -310,8 +306,6 @@ ngp_rcvmsg(node_p node, item_p item, hoo struct ng_pipe_cfg *cfg; int error = 0; - mtx_lock(&ng_pipe_giant); - NGI_GET_MSG(item, msg); switch (msg->header.typecookie) { case NGM_PIPE_COOKIE: @@ -326,7 +320,7 @@ ngp_rcvmsg(node_p node, item_p item, hoo error = ENOMEM; break; } - stats = (struct ng_pipe_stats *)resp->data; + stats = (struct ng_pipe_stats *) resp->data; bcopy(&priv->upper.stats, &stats->downstream, sizeof(stats->downstream)); bcopy(&priv->lower.stats, &stats->upstream, @@ -345,7 +339,7 @@ ngp_rcvmsg(node_p node, item_p item, hoo error = ENOMEM; break; } - run = (struct ng_pipe_run *)resp->data; + run = (struct ng_pipe_run *) resp->data; bcopy(&priv->upper.run, &run->downstream, sizeof(run->downstream)); bcopy(&priv->lower.run, &run->upstream, @@ -357,7 +351,7 @@ ngp_rcvmsg(node_p node, item_p item, hoo error = ENOMEM; break; } - cfg = (struct ng_pipe_cfg *)resp->data; + cfg = (struct ng_pipe_cfg *) resp->data; bcopy(&priv->upper.cfg, &cfg->downstream, sizeof(cfg->downstream)); bcopy(&priv->lower.cfg, &cfg->upstream, @@ -374,7 +368,7 @@ ngp_rcvmsg(node_p node, item_p item, hoo cfg->bandwidth = 0; break; case NGM_PIPE_SET_CFG: - cfg = (struct ng_pipe_cfg *)msg->data; + cfg = (struct ng_pipe_cfg *) msg->data; if (msg->header.arglen != sizeof(*cfg)) { error = EINVAL; break; @@ -401,7 +395,8 @@ ngp_rcvmsg(node_p node, item_p item, hoo if (cfg->overhead == -1) priv->overhead = 0; - else if (cfg->overhead > 0 && cfg->overhead < 256) + else if (cfg->overhead > 0 && + cfg->overhead < MAX_OHSIZE) priv->overhead = cfg->overhead; if (cfg->header_offset == -1) @@ -411,9 +406,9 @@ ngp_rcvmsg(node_p node, item_p item, hoo priv->header_offset = cfg->header_offset; parse_cfg(&priv->upper.cfg, &cfg->downstream, - &priv->upper, priv); + &priv->upper, priv); parse_cfg(&priv->lower.cfg, &cfg->upstream, - &priv->lower, priv); + &priv->lower, priv); break; default: error = EINVAL; @@ -427,8 +422,6 @@ ngp_rcvmsg(node_p node, item_p item, hoo NG_RESPOND_MSG(error, node, item, resp); NG_FREE_MSG(msg); - mtx_unlock(&ng_pipe_giant); - return (error); } @@ -449,9 +442,9 @@ parse_cfg(struct ng_pipe_hookcfg *curren uint32_t fsize, i; if (hinfo->ber_p == NULL) - hinfo->ber_p = malloc(\ - (MAX_FSIZE + MAX_OHSIZE)*sizeof(uint64_t), \ - M_NG_PIPE, M_NOWAIT); + hinfo->ber_p = + malloc((MAX_FSIZE + MAX_OHSIZE) * sizeof(uint64_t), + M_NG_PIPE, M_NOWAIT); current->ber = new->ber; /* @@ -467,10 +460,10 @@ parse_cfg(struct ng_pipe_hookcfg *curren p = one; for (fsize = 0; fsize < MAX_FSIZE + MAX_OHSIZE; fsize++) { hinfo->ber_p[fsize] = p; - for (i=0; i<8; i++) - p = (p*(p0&0xffff)>>48) + \ - (p*((p0>>16)&0xffff)>>32) + \ - (p*(p0>>32)>>16); + for (i = 0; i < 8; i++) + p = (p * (p0 & 0xffff) >> 48) + + (p * ((p0 >> 16) & 0xffff) >> 32) + + (p * (p0 >> 32) >> 16); } } @@ -575,25 +568,42 @@ ngp_rcvdata(hook_p hook, item_p item) struct ngp_fifo *ngp_f = NULL, *ngp_f1; struct ngp_hdr *ngp_h = NULL; struct mbuf *m; - int hash; + int hash, plen; int error = 0; - if (hinfo->noqueue) { + /* + * Shortcut from inbound to outbound hook when neither of + * bandwidth, delay, BER or duplication probability is + * configured, nor we have queued frames to drain. + */ + if (hinfo->run.qin_frames == 0 && hinfo->run.qout_frames == 0 && + hinfo->noqueue) { struct hookinfo *dest; if (hinfo == &priv->lower) dest = &priv->upper; else dest = &priv->lower; + + /* Send the frame. */ + plen = NGI_M(item)->m_pkthdr.len; NG_FWD_ITEM_HOOK(error, item, dest->hook); - return error; + + /* Update stats. */ + if (error) { + hinfo->stats.out_disc_frames++; + hinfo->stats.out_disc_octets += plen; + } else { + hinfo->stats.fwd_frames++; + hinfo->stats.fwd_octets += plen; + } + + return (error); } - mtx_lock(&ng_pipe_giant); microuptime(now); /* - * Attach us to the list of active ng_pipes if this was an empty - * one before, and also update the queue service deadline time. + * If this was an empty queue, update service deadline time. */ if (hinfo->run.qin_frames == 0) { struct timeval *when = &hinfo->qin_utime; @@ -602,8 +612,6 @@ ngp_rcvdata(hook_p hook, item_p item) when->tv_sec = now->tv_sec; when->tv_usec = now->tv_usec; } - if (hinfo->run.qout_frames == 0) - LIST_INSERT_HEAD(&active_head, hinfo, active_le); } /* Populate the packet header */ @@ -702,9 +710,7 @@ ngp_rcvdata(hook_p hook, item_p item) } /* - * Try to start the dequeuing process immediately. We must - * hold the ng_pipe_giant lock here and pipe_dequeue() will - * release it + * Try to start the dequeuing process immediately. */ pipe_dequeue(hinfo, now); @@ -720,27 +726,21 @@ ngp_rcvdata(hook_p hook, item_p item) * to outbound (delay) queue; * 4) Loop to 2) until bandwidth quota for this timeslice is reached, or * inbound queue is flushed completely; - * 5) Extract the first frame from the outbound queue, if it's time has - * come. Queue the frame for transmission on the outbound hook; - * 6) Loop to 5) until outbound queue is flushed completely, or the next - * frame in the queue is not scheduled to be dequeued yet; - * 7) Transimit all frames queued in 5) - * - * Note: the caller must hold the ng_pipe_giant lock; this function - * returns with the lock released. + * 5) Dequeue frames from the outbound queue and send them downstream until + * outbound queue is flushed completely, or the next frame in the queue + * is not due to be dequeued yet */ static void pipe_dequeue(struct hookinfo *hinfo, struct timeval *now) { static uint64_t rand, oldrand; - const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hinfo->hook)); + const node_p node = NG_HOOK_NODE(hinfo->hook); + const priv_p priv = NG_NODE_PRIVATE(node); struct hookinfo *dest; struct ngp_fifo *ngp_f, *ngp_f1; struct ngp_hdr *ngp_h; struct timeval *when; - struct mbuf *q_head = NULL; - struct mbuf *q_tail = NULL; struct mbuf *m; - int error = 0; + int plen, error = 0; /* Which one is the destination hook? */ if (hinfo == &priv->lower) @@ -791,13 +791,13 @@ pipe_dequeue(struct hookinfo *hinfo, str /* Calculate the serialization delay */ if (hinfo->cfg.bandwidth) { - hinfo->qin_utime.tv_usec += ((uint64_t) m->m_pkthdr.len - + priv->overhead ) * - 8000000 / hinfo->cfg.bandwidth; + hinfo->qin_utime.tv_usec += + ((uint64_t) m->m_pkthdr.len + priv->overhead ) * + 8000000 / hinfo->cfg.bandwidth; hinfo->qin_utime.tv_sec += - hinfo->qin_utime.tv_usec / 1000000; + hinfo->qin_utime.tv_usec / 1000000; hinfo->qin_utime.tv_usec = - hinfo->qin_utime.tv_usec % 1000000; + hinfo->qin_utime.tv_usec % 1000000; } when = &ngp_h->when; when->tv_sec = hinfo->qin_utime.tv_sec; @@ -853,95 +853,57 @@ pipe_dequeue(struct hookinfo *hinfo, str /* Delay queue processing */ while ((ngp_h = TAILQ_FIRST(&hinfo->qout_head))) { - struct mbuf *m = ngp_h->m; - when = &ngp_h->when; + m = ngp_h->m; if (when->tv_sec > now->tv_sec || (when->tv_sec == now->tv_sec && when->tv_usec > now->tv_usec)) break; /* Update outbound queue stats */ - hinfo->stats.fwd_frames++; - hinfo->stats.fwd_octets += m->m_pkthdr.len; + plen = m->m_pkthdr.len; hinfo->run.qout_frames--; - hinfo->run.qout_octets -= m->m_pkthdr.len; + hinfo->run.qout_octets -= plen; /* Dequeue the packet from qout */ TAILQ_REMOVE(&hinfo->qout_head, ngp_h, ngp_link); uma_zfree(ngp_zone, ngp_h); - /* Enqueue locally for sending downstream */ - if (q_head == NULL) - q_head = m; - if (q_tail) - q_tail->m_nextpkt = m; - q_tail = m; - m->m_nextpkt = NULL; - } - - /* If both queues are empty detach us from the list of active queues */ - if (hinfo->run.qin_frames + hinfo->run.qout_frames == 0) { - LIST_REMOVE(hinfo, active_le); - active_gen_id++; + NG_SEND_DATA(error, dest->hook, m, meta); + if (error) { + hinfo->stats.out_disc_frames++; + hinfo->stats.out_disc_octets += plen; + } else { + hinfo->stats.fwd_frames++; + hinfo->stats.fwd_octets += plen; + } } - mtx_unlock(&ng_pipe_giant); - - while ((m = q_head) != NULL) { - q_head = m->m_nextpkt; - m->m_nextpkt = NULL; - NG_SEND_DATA(error, dest->hook, m, meta); + if ((hinfo->run.qin_frames != 0 || hinfo->run.qout_frames != 0) && + !priv->timer_scheduled) { + ng_callout(&priv->timer, node, NULL, 1, ngp_callout, NULL, 0); + priv->timer_scheduled = 1; } } - /* - * This routine is called on every clock tick. We poll all nodes/hooks + * This routine is called on every clock tick. We poll connected hooks * for queued frames by calling pipe_dequeue(). */ static void -pipe_scheduler(void *arg) +ngp_callout(node_p node, hook_p hook, void *arg1, int arg2) { - pipe_poll(); - - /* Reschedule */ - callout_reset(&polling_timer, 1, &pipe_scheduler, NULL); -} - - -/* - * Traverse the list of all active hooks and attempt to dequeue - * some packets. Hooks with empty queues are not traversed since - * they are not linked into this list. - */ -static void -pipe_poll(void) -{ - struct hookinfo *hinfo; + const priv_p priv = NG_NODE_PRIVATE(node); struct timeval now; - int old_gen_id = active_gen_id; - - mtx_lock(&ng_pipe_giant); + + priv->timer_scheduled = 0; microuptime(&now); - LIST_FOREACH(hinfo, &active_head, active_le) { - CURVNET_SET(NG_HOOK_NODE(hinfo->hook)->nd_vnet); - pipe_dequeue(hinfo, &now); - CURVNET_RESTORE(); - mtx_lock(&ng_pipe_giant); - if (old_gen_id != active_gen_id) { - /* the list was updated; restart traversing */ - hinfo = LIST_FIRST(&active_head); - if (hinfo == NULL) - break; - old_gen_id = active_gen_id; - continue; - } - } - mtx_unlock(&ng_pipe_giant); + if (priv->upper.hook != NULL) + pipe_dequeue(&priv->upper, &now); + if (priv->lower.hook != NULL) + pipe_dequeue(&priv->lower, &now); } - /* * Shutdown processing * @@ -955,6 +917,8 @@ ngp_shutdown(node_p node) { const priv_p priv = NG_NODE_PRIVATE(node); + if (priv->timer_scheduled) + ng_uncallout(&priv->timer, node); if (priv->lower.hook && priv->upper.hook) ng_bypass(priv->lower.hook, priv->upper.hook); else { @@ -978,9 +942,6 @@ ngp_disconnect(hook_p hook) struct hookinfo *const hinfo = NG_HOOK_PRIVATE(hook); struct ngp_fifo *ngp_f; struct ngp_hdr *ngp_h; - int removed = 0; - - mtx_lock(&ng_pipe_giant); KASSERT(hinfo != NULL, ("%s: null info", __FUNCTION__)); hinfo->hook = NULL; @@ -991,7 +952,6 @@ ngp_disconnect(hook_p hook) TAILQ_REMOVE(&ngp_f->packet_head, ngp_h, ngp_link); m_freem(ngp_h->m); uma_zfree(ngp_zone, ngp_h); - removed++; } TAILQ_REMOVE(&hinfo->fifo_head, ngp_f, fifo_le); uma_zfree(ngp_zone, ngp_f); @@ -1002,27 +962,12 @@ ngp_disconnect(hook_p hook) TAILQ_REMOVE(&hinfo->qout_head, ngp_h, ngp_link); m_freem(ngp_h->m); uma_zfree(ngp_zone, ngp_h); - removed++; } - /* - * Both queues should be empty by now, so detach us from - * the list of active queues - */ - if (removed) { - LIST_REMOVE(hinfo, active_le); - active_gen_id++; - } - if (hinfo->run.qin_frames + hinfo->run.qout_frames != removed) - printf("Mismatch: queued=%d but removed=%d !?!", - hinfo->run.qin_frames + hinfo->run.qout_frames, removed); - /* Release the packet loss probability table (BER) */ if (hinfo->ber_p) free(hinfo->ber_p, M_NG_PIPE); - mtx_unlock(&ng_pipe_giant); - return (0); } @@ -1038,16 +983,9 @@ ngp_modevent(module_t mod, int type, voi UMA_ALIGN_PTR, 0); if (ngp_zone == NULL) panic("ng_pipe: couldn't allocate descriptor zone"); - - mtx_init(&ng_pipe_giant, "ng_pipe_giant", NULL, MTX_DEF); - LIST_INIT(&active_head); - callout_init(&polling_timer, CALLOUT_MPSAFE); - callout_reset(&polling_timer, 1, &pipe_scheduler, NULL); break; case MOD_UNLOAD: - callout_drain(&polling_timer); uma_zdestroy(ngp_zone); - mtx_destroy(&ng_pipe_giant); break; default: error = EOPNOTSUPP; From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 18:35:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D3C71065670; Wed, 24 Nov 2010 18:35:11 +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 8C5AC8FC15; Wed, 24 Nov 2010 18:35:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOIZBC1079682; Wed, 24 Nov 2010 18:35:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOIZBtO079680; Wed, 24 Nov 2010 18:35:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201011241835.oAOIZBtO079680@svn.freebsd.org> From: Dimitry Andric Date: Wed, 24 Nov 2010 18:35:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215801 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 18:35:11 -0000 Author: dim Date: Wed Nov 24 18:35:11 2010 New Revision: 215801 URL: http://svn.freebsd.org/changeset/base/215801 Log: Change ambiguous (or invalid, depending on how strict you want to be :) assembly instruction "movw %rcx,2(%rax)" to "movw %cx,2(%rax)", since the intent was to move 16 bits of data, in this case. Found by: clang Reviewed by: kib Modified: head/sys/amd64/amd64/cpu_switch.S Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Wed Nov 24 16:02:58 2010 (r215800) +++ head/sys/amd64/amd64/cpu_switch.S Wed Nov 24 18:35:11 2010 (r215801) @@ -276,7 +276,7 @@ load_dr: do_tss: movq %rdx,PCPU(TSSP) movq %rdx,%rcx movq PCPU(TSS),%rax - movw %rcx,2(%rax) + movw %cx,2(%rax) shrq $16,%rcx movb %cl,4(%rax) shrq $8,%rcx From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 19:11:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1B7A106564A; Wed, 24 Nov 2010 19:11:32 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF5A08FC1A; Wed, 24 Nov 2010 19:11:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOJBWmO080480; Wed, 24 Nov 2010 19:11:32 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOJBWSK080475; Wed, 24 Nov 2010 19:11:32 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201011241911.oAOJBWSK080475@svn.freebsd.org> From: Weongyo Jeong Date: Wed, 24 Nov 2010 19:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215802 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 19:11:33 -0000 Author: weongyo Date: Wed Nov 24 19:11:32 2010 New Revision: 215802 URL: http://svn.freebsd.org/changeset/base/215802 Log: Removes all duplicated code with BPF that it's greatly simplified and take all benefits whenever BPF code is improved. Pointed by: jkim Reviewed by: thompsa Modified: head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_pf.c head/sys/dev/usb/usb_pf.h Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Wed Nov 24 18:35:11 2010 (r215801) +++ head/sys/dev/usb/controller/usb_controller.c Wed Nov 24 19:11:32 2010 (r215802) @@ -548,7 +548,7 @@ usb_bus_mem_alloc_all(struct usb_bus *bu TAILQ_INIT(&bus->intr_q.head); - usbpf_attach(bus, &bus->uif); + usbpf_attach(bus); #if USB_HAVE_BUSDMA usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags, Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Wed Nov 24 18:35:11 2010 (r215801) +++ head/sys/dev/usb/usb_bus.h Wed Nov 24 19:11:32 2010 (r215802) @@ -86,7 +86,7 @@ struct usb_bus { struct usb_bus_methods *methods; /* filled by HC driver */ struct usb_device **devices; - struct usbpf_if *uif; /* USB Packet Filter */ + struct ifnet *ifp; /* only for USB Packet Filter */ usb_power_mask_t hw_power_state; /* see USB_HW_POWER_XXX */ usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; Modified: head/sys/dev/usb/usb_pf.c ============================================================================== --- head/sys/dev/usb/usb_pf.c Wed Nov 24 18:35:11 2010 (r215801) +++ head/sys/dev/usb/usb_pf.c Wed Nov 24 19:11:32 2010 (r215802) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -55,1624 +57,39 @@ __FBSDID("$FreeBSD$"); #include #include -/* - * All usbpf implementations are extracted from bpf(9) APIs and it's - * specialized for USB packet filtering between the driver and the host - * controller. - */ - -MALLOC_DEFINE(M_USBPF, "USBPktFilter", "USB Packet Filter"); - -/* - * Rotate the packet buffers in descriptor ud. Move the store buffer into the - * hold slot, and the free buffer ino the store slot. Zero the length of the - * new store buffer. Descriptor lock should be held. - */ -#define USBPF_ROTATE_BUFFERS(ud) do { \ - (ud)->ud_hbuf = (ud)->ud_sbuf; \ - (ud)->ud_hlen = (ud)->ud_slen; \ - (ud)->ud_sbuf = (ud)->ud_fbuf; \ - (ud)->ud_slen = 0; \ - (ud)->ud_fbuf = NULL; \ - usbpf_bufheld(ud); \ -} while (0) - -#ifndef __i386__ -#define USBPF_ALIGN -#endif - -#ifndef USBPF_ALIGN -#define USBPF_EXTRACT_SHORT(p) ((u_int16_t)ntohs(*(u_int16_t *)p)) -#define USBPF_EXTRACT_LONG(p) (ntohl(*(u_int32_t *)p)) -#else -#define USBPF_EXTRACT_SHORT(p) \ - ((u_int16_t) \ - ((u_int16_t)*((u_char *)p+0)<<8| \ - (u_int16_t)*((u_char *)p+1)<<0)) -#define USBPF_EXTRACT_LONG(p) \ - ((u_int32_t)*((u_char *)p+0)<<24| \ - (u_int32_t)*((u_char *)p+1)<<16| \ - (u_int32_t)*((u_char *)p+2)<<8| \ - (u_int32_t)*((u_char *)p+3)<<0) -#endif - -/* - * Number of scratch memory words (for USBPF_LD|USBPF_MEM and USBPF_ST). - */ -#define USBPF_MEMWORDS 16 - -/* Values for ud_state */ -#define USBPF_IDLE 0 /* no select in progress */ -#define USBPF_WAITING 1 /* waiting for read timeout in select */ -#define USBPF_TIMED_OUT 2 /* read timeout has expired in select */ - -#define PRIUSB 26 /* interruptible */ - -/* Frame directions */ -enum usbpf_direction { - USBPF_D_IN, /* See incoming frames */ - USBPF_D_INOUT, /* See incoming and outgoing frames */ - USBPF_D_OUT /* See outgoing frames */ -}; - -static void usbpf_append_bytes(struct usbpf_d *, caddr_t, u_int, void *, - u_int); -static void usbpf_attachd(struct usbpf_d *, struct usbpf_if *); -static void usbpf_detachd(struct usbpf_d *); -static int usbpf_canfreebuf(struct usbpf_d *); -static void usbpf_buf_reclaimed(struct usbpf_d *); -static int usbpf_canwritebuf(struct usbpf_d *); - -static d_open_t usbpf_open; -static d_read_t usbpf_read; -static d_write_t usbpf_write; -static d_ioctl_t usbpf_ioctl; -static d_poll_t usbpf_poll; -static d_kqfilter_t usbpf_kqfilter; - -static struct cdevsw usbpf_cdevsw = { - .d_version = D_VERSION, - .d_open = usbpf_open, - .d_read = usbpf_read, - .d_write = usbpf_write, - .d_ioctl = usbpf_ioctl, - .d_poll = usbpf_poll, - .d_name = "usbpf", - .d_kqfilter = usbpf_kqfilter, -}; - -static struct cdev *usbpf_cdev; -static LIST_HEAD(, usbpf_if) usbpf_iflist; -static struct mtx usbpf_mtx; /* global lock */ -static int usbpf_uifd_cnt; - -static int usbpf_bufsize = 4096; -#define USBPF_MINBUFSIZE 32 -#define USBPF_MAXBUFSIZE 0x80000 -static int usbpf_maxbufsize = USBPF_MAXBUFSIZE; -#define USBPF_MAXINSNS 512 -static int usbpf_maxinsns = USBPF_MAXINSNS; - -static void -usbpf_buffer_init(struct usbpf_d *ud) -{ - - ud->ud_bufsize = usbpf_bufsize; -} - -/* - * Free USBPF kernel buffers on device close. - */ -static void -usbpf_buffer_free(struct usbpf_d *ud) -{ - - if (ud->ud_sbuf != NULL) - free(ud->ud_sbuf, M_USBPF); - if (ud->ud_hbuf != NULL) - free(ud->ud_hbuf, M_USBPF); - if (ud->ud_fbuf != NULL) - free(ud->ud_fbuf, M_USBPF); - -#ifdef INVARIANTS - ud->ud_sbuf = ud->ud_hbuf = ud->ud_fbuf = (caddr_t)~0; -#endif -} - -static void -usbpf_buffer_alloc(struct usbpf_d *ud) -{ - - KASSERT(ud->ud_fbuf == NULL, ("%s: ud_fbuf != NULL", __func__)); - KASSERT(ud->ud_sbuf == NULL, ("%s: ud_sbuf != NULL", __func__)); - KASSERT(ud->ud_hbuf == NULL, ("%s: ud_hbuf != NULL", __func__)); - - ud->ud_fbuf = (caddr_t)malloc(ud->ud_bufsize, M_USBPF, M_WAITOK); - ud->ud_sbuf = (caddr_t)malloc(ud->ud_bufsize, M_USBPF, M_WAITOK); - ud->ud_hbuf = NULL; - ud->ud_slen = 0; - ud->ud_hlen = 0; -} - -/* - * Copy buffer storage to user space in read(). - */ -static int -usbpf_buffer_uiomove(struct usbpf_d *ud, caddr_t buf, u_int len, - struct uio *uio) -{ - - return (uiomove(buf, len, uio)); -} - -/* - * Simple data copy to the current kernel buffer. - */ -static void -usbpf_buffer_append_bytes(struct usbpf_d *ud, caddr_t buf, u_int offset, - void *src, u_int len) -{ - u_char *src_bytes; - - src_bytes = (u_char *)src; - bcopy(src_bytes, buf + offset, len); -} - -/* - * Allocate or resize buffers. - */ -static int -usbpf_buffer_ioctl_sblen(struct usbpf_d *ud, u_int *i) -{ - u_int size; - - USBPFD_LOCK(ud); - if (ud->ud_bif != NULL) { - USBPFD_UNLOCK(ud); - return (EINVAL); - } - size = *i; - if (size > usbpf_maxbufsize) - *i = size = usbpf_maxbufsize; - else if (size < USBPF_MINBUFSIZE) - *i = size = USBPF_MINBUFSIZE; - ud->ud_bufsize = size; - USBPFD_UNLOCK(ud); - return (0); -} - -static const u_short usbpf_code_map[] = { - 0x10ff, /* 0x00-0x0f: 1111111100001000 */ - 0x3070, /* 0x10-0x1f: 0000111000001100 */ - 0x3131, /* 0x20-0x2f: 1000110010001100 */ - 0x3031, /* 0x30-0x3f: 1000110000001100 */ - 0x3131, /* 0x40-0x4f: 1000110010001100 */ - 0x1011, /* 0x50-0x5f: 1000100000001000 */ - 0x1013, /* 0x60-0x6f: 1100100000001000 */ - 0x1010, /* 0x70-0x7f: 0000100000001000 */ - 0x0093, /* 0x80-0x8f: 1100100100000000 */ - 0x0000, /* 0x90-0x9f: 0000000000000000 */ - 0x0000, /* 0xa0-0xaf: 0000000000000000 */ - 0x0002, /* 0xb0-0xbf: 0100000000000000 */ - 0x0000, /* 0xc0-0xcf: 0000000000000000 */ - 0x0000, /* 0xd0-0xdf: 0000000000000000 */ - 0x0000, /* 0xe0-0xef: 0000000000000000 */ - 0x0000 /* 0xf0-0xff: 0000000000000000 */ -}; - -#define USBPF_VALIDATE_CODE(c) \ - ((c) <= 0xff && (usbpf_code_map[(c) >> 4] & (1 << ((c) & 0xf))) != 0) - -/* - * Return true if the 'fcode' is a valid filter program. - * The constraints are that each jump be forward and to a valid - * code. The code must terminate with either an accept or reject. - * - * The kernel needs to be able to verify an application's filter code. - * Otherwise, a bogus program could easily crash the system. - */ -static int -usbpf_validate(const struct usbpf_insn *f, int len) -{ - register int i; - register const struct usbpf_insn *p; - - /* Do not accept negative length filter. */ - if (len < 0) - return (0); - - /* An empty filter means accept all. */ - if (len == 0) - return (1); - - for (i = 0; i < len; ++i) { - p = &f[i]; - /* - * Check that the code is valid. - */ - if (!USBPF_VALIDATE_CODE(p->code)) - return (0); - /* - * Check that that jumps are forward, and within - * the code block. - */ - if (USBPF_CLASS(p->code) == USBPF_JMP) { - register u_int offset; - - if (p->code == (USBPF_JMP|USBPF_JA)) - offset = p->k; - else - offset = p->jt > p->jf ? p->jt : p->jf; - if (offset >= (u_int)(len - i) - 1) - return (0); - continue; - } - /* - * Check that memory operations use valid addresses. - */ - if (p->code == USBPF_ST || p->code == USBPF_STX || - p->code == (USBPF_LD|USBPF_MEM) || - p->code == (USBPF_LDX|USBPF_MEM)) { - if (p->k >= USBPF_MEMWORDS) - return (0); - continue; - } - /* - * Check for constant division by 0. - */ - if (p->code == (USBPF_ALU|USBPF_DIV|USBPF_K) && p->k == 0) - return (0); - } - return (USBPF_CLASS(f[len - 1].code) == USBPF_RET); -} - -#ifdef _KERNEL -#define MINDEX(m, k) \ -{ \ - register int len = m->m_len; \ - \ - while (k >= len) { \ - k -= len; \ - m = m->m_next; \ - if (m == 0) \ - return (0); \ - len = m->m_len; \ - } \ -} - -static u_int16_t m_xhalf(struct mbuf *m, usbpf_u_int32 k, int *err); -static u_int32_t m_xword(struct mbuf *m, usbpf_u_int32 k, int *err); - -static u_int32_t -m_xword(struct mbuf *m, usbpf_u_int32 k, int *err) -{ - size_t len; - u_char *cp, *np; - struct mbuf *m0; - - len = m->m_len; - while (k >= len) { - k -= len; - m = m->m_next; - if (m == 0) - goto bad; - len = m->m_len; - } - cp = mtod(m, u_char *) + k; - if (len - k >= 4) { - *err = 0; - return (USBPF_EXTRACT_LONG(cp)); - } - m0 = m->m_next; - if (m0 == 0 || m0->m_len + len - k < 4) - goto bad; - *err = 0; - np = mtod(m0, u_char *); - switch (len - k) { - case 1: - return (((u_int32_t)cp[0] << 24) | - ((u_int32_t)np[0] << 16) | - ((u_int32_t)np[1] << 8) | - (u_int32_t)np[2]); - - case 2: - return (((u_int32_t)cp[0] << 24) | - ((u_int32_t)cp[1] << 16) | - ((u_int32_t)np[0] << 8) | - (u_int32_t)np[1]); - - default: - return (((u_int32_t)cp[0] << 24) | - ((u_int32_t)cp[1] << 16) | - ((u_int32_t)cp[2] << 8) | - (u_int32_t)np[0]); - } - bad: - *err = 1; - return (0); -} - -static u_int16_t -m_xhalf(struct mbuf *m, usbpf_u_int32 k, int *err) -{ - size_t len; - u_char *cp; - struct mbuf *m0; - - len = m->m_len; - while (k >= len) { - k -= len; - m = m->m_next; - if (m == 0) - goto bad; - len = m->m_len; - } - cp = mtod(m, u_char *) + k; - if (len - k >= 2) { - *err = 0; - return (USBPF_EXTRACT_SHORT(cp)); - } - m0 = m->m_next; - if (m0 == 0) - goto bad; - *err = 0; - return ((cp[0] << 8) | mtod(m0, u_char *)[0]); - bad: - *err = 1; - return (0); -} -#endif - -/* - * Execute the filter program starting at pc on the packet p - * wirelen is the length of the original packet - * buflen is the amount of data present - */ -static u_int -usbpf_filter(const struct usbpf_insn *pc, u_char *p, u_int wirelen, - u_int buflen) -{ - u_int32_t A = 0, X = 0; - usbpf_u_int32 k; - u_int32_t mem[USBPF_MEMWORDS]; - - /* - * XXX temporarily the filter system is disabled because currently it - * could not handle the some machine code properly that leads to - * kernel crash by invalid usage. - */ - return ((u_int)-1); - - if (pc == NULL) - /* - * No filter means accept all. - */ - return ((u_int)-1); - - --pc; - while (1) { - ++pc; - switch (pc->code) { - default: -#ifdef _KERNEL - return (0); -#else - abort(); -#endif - - case USBPF_RET|USBPF_K: - return ((u_int)pc->k); - - case USBPF_RET|USBPF_A: - return ((u_int)A); - - case USBPF_LD|USBPF_W|USBPF_ABS: - k = pc->k; - if (k > buflen || sizeof(int32_t) > buflen - k) { -#ifdef _KERNEL - int merr; - - if (buflen != 0) - return (0); - A = m_xword((struct mbuf *)p, k, &merr); - if (merr != 0) - return (0); - continue; -#else - return (0); -#endif - } -#ifdef USBPF_ALIGN - if (((intptr_t)(p + k) & 3) != 0) - A = USBPF_EXTRACT_LONG(&p[k]); - else -#endif - A = ntohl(*(int32_t *)(p + k)); - continue; - - case USBPF_LD|USBPF_H|USBPF_ABS: - k = pc->k; - if (k > buflen || sizeof(int16_t) > buflen - k) { -#ifdef _KERNEL - int merr; - - if (buflen != 0) - return (0); - A = m_xhalf((struct mbuf *)p, k, &merr); - continue; -#else - return (0); -#endif - } - A = USBPF_EXTRACT_SHORT(&p[k]); - continue; - - case USBPF_LD|USBPF_B|USBPF_ABS: - k = pc->k; - if (k >= buflen) { -#ifdef _KERNEL - struct mbuf *m; - - if (buflen != 0) - return (0); - m = (struct mbuf *)p; - MINDEX(m, k); - A = mtod(m, u_char *)[k]; - continue; -#else - return (0); -#endif - } - A = p[k]; - continue; - - case USBPF_LD|USBPF_W|USBPF_LEN: - A = wirelen; - continue; - - case USBPF_LDX|USBPF_W|USBPF_LEN: - X = wirelen; - continue; - - case USBPF_LD|USBPF_W|USBPF_IND: - k = X + pc->k; - if (pc->k > buflen || X > buflen - pc->k || - sizeof(int32_t) > buflen - k) { -#ifdef _KERNEL - int merr; - - if (buflen != 0) - return (0); - A = m_xword((struct mbuf *)p, k, &merr); - if (merr != 0) - return (0); - continue; -#else - return (0); -#endif - } -#ifdef USBPF_ALIGN - if (((intptr_t)(p + k) & 3) != 0) - A = USBPF_EXTRACT_LONG(&p[k]); - else -#endif - A = ntohl(*(int32_t *)(p + k)); - continue; - - case USBPF_LD|USBPF_H|USBPF_IND: - k = X + pc->k; - if (X > buflen || pc->k > buflen - X || - sizeof(int16_t) > buflen - k) { -#ifdef _KERNEL - int merr; - - if (buflen != 0) - return (0); - A = m_xhalf((struct mbuf *)p, k, &merr); - if (merr != 0) - return (0); - continue; -#else - return (0); -#endif - } - A = USBPF_EXTRACT_SHORT(&p[k]); - continue; - - case USBPF_LD|USBPF_B|USBPF_IND: - k = X + pc->k; - if (pc->k >= buflen || X >= buflen - pc->k) { -#ifdef _KERNEL - struct mbuf *m; - - if (buflen != 0) - return (0); - m = (struct mbuf *)p; - MINDEX(m, k); - A = mtod(m, u_char *)[k]; - continue; -#else - return (0); -#endif - } - A = p[k]; - continue; - - case USBPF_LDX|USBPF_MSH|USBPF_B: - k = pc->k; - if (k >= buflen) { -#ifdef _KERNEL - register struct mbuf *m; - - if (buflen != 0) - return (0); - m = (struct mbuf *)p; - MINDEX(m, k); - X = (mtod(m, u_char *)[k] & 0xf) << 2; - continue; -#else - return (0); -#endif - } - X = (p[pc->k] & 0xf) << 2; - continue; - - case USBPF_LD|USBPF_IMM: - A = pc->k; - continue; - - case USBPF_LDX|USBPF_IMM: - X = pc->k; - continue; - - case USBPF_LD|USBPF_MEM: - A = mem[pc->k]; - continue; - - case USBPF_LDX|USBPF_MEM: - X = mem[pc->k]; - continue; - - case USBPF_ST: - mem[pc->k] = A; - continue; - - case USBPF_STX: - mem[pc->k] = X; - continue; - - case USBPF_JMP|USBPF_JA: - pc += pc->k; - continue; - - case USBPF_JMP|USBPF_JGT|USBPF_K: - pc += (A > pc->k) ? pc->jt : pc->jf; - continue; - - case USBPF_JMP|USBPF_JGE|USBPF_K: - pc += (A >= pc->k) ? pc->jt : pc->jf; - continue; - - case USBPF_JMP|USBPF_JEQ|USBPF_K: - pc += (A == pc->k) ? pc->jt : pc->jf; - continue; - - case USBPF_JMP|USBPF_JSET|USBPF_K: - pc += (A & pc->k) ? pc->jt : pc->jf; - continue; - - case USBPF_JMP|USBPF_JGT|USBPF_X: - pc += (A > X) ? pc->jt : pc->jf; - continue; - - case USBPF_JMP|USBPF_JGE|USBPF_X: - pc += (A >= X) ? pc->jt : pc->jf; - continue; - - case USBPF_JMP|USBPF_JEQ|USBPF_X: - pc += (A == X) ? pc->jt : pc->jf; - continue; - - case USBPF_JMP|USBPF_JSET|USBPF_X: - pc += (A & X) ? pc->jt : pc->jf; - continue; - - case USBPF_ALU|USBPF_ADD|USBPF_X: - A += X; - continue; - - case USBPF_ALU|USBPF_SUB|USBPF_X: - A -= X; - continue; - - case USBPF_ALU|USBPF_MUL|USBPF_X: - A *= X; - continue; - - case USBPF_ALU|USBPF_DIV|USBPF_X: - if (X == 0) - return (0); - A /= X; - continue; - - case USBPF_ALU|USBPF_AND|USBPF_X: - A &= X; - continue; - - case USBPF_ALU|USBPF_OR|USBPF_X: - A |= X; - continue; - - case USBPF_ALU|USBPF_LSH|USBPF_X: - A <<= X; - continue; - - case USBPF_ALU|USBPF_RSH|USBPF_X: - A >>= X; - continue; - - case USBPF_ALU|USBPF_ADD|USBPF_K: - A += pc->k; - continue; - - case USBPF_ALU|USBPF_SUB|USBPF_K: - A -= pc->k; - continue; - - case USBPF_ALU|USBPF_MUL|USBPF_K: - A *= pc->k; - continue; - - case USBPF_ALU|USBPF_DIV|USBPF_K: - A /= pc->k; - continue; - - case USBPF_ALU|USBPF_AND|USBPF_K: - A &= pc->k; - continue; - - case USBPF_ALU|USBPF_OR|USBPF_K: - A |= pc->k; - continue; - - case USBPF_ALU|USBPF_LSH|USBPF_K: - A <<= pc->k; - continue; - - case USBPF_ALU|USBPF_RSH|USBPF_K: - A >>= pc->k; - continue; - - case USBPF_ALU|USBPF_NEG: - A = -A; - continue; - - case USBPF_MISC|USBPF_TAX: - X = A; - continue; - - case USBPF_MISC|USBPF_TXA: - A = X; - continue; - } - } -} - -static void -usbpf_free(struct usbpf_d *ud) -{ - - switch (ud->ud_bufmode) { - case USBPF_BUFMODE_BUFFER: - return (usbpf_buffer_free(ud)); - default: - panic("usbpf_buf_free"); - } -} - -/* - * Notify the buffer model that a buffer has moved into the hold position. - */ -static void -usbpf_bufheld(struct usbpf_d *ud) -{ - - USBPFD_LOCK_ASSERT(ud); -} - -/* - * Free buffers currently in use by a descriptor. - * Called on close. - */ -static void -usbpf_freed(struct usbpf_d *ud) -{ - - /* - * We don't need to lock out interrupts since this descriptor has - * been detached from its interface and it yet hasn't been marked - * free. - */ - usbpf_free(ud); - if (ud->ud_rfilter != NULL) - free((caddr_t)ud->ud_rfilter, M_USBPF); - if (ud->ud_wfilter != NULL) - free((caddr_t)ud->ud_wfilter, M_USBPF); - mtx_destroy(&ud->ud_mtx); -} - -/* - * Close the descriptor by detaching it from its interface, - * deallocating its buffers, and marking it free. - */ -static void -usbpf_dtor(void *data) -{ - struct usbpf_d *ud = data; - - USBPFD_LOCK(ud); - if (ud->ud_state == USBPF_WAITING) - callout_stop(&ud->ud_callout); - ud->ud_state = USBPF_IDLE; - USBPFD_UNLOCK(ud); - funsetown(&ud->ud_sigio); - mtx_lock(&usbpf_mtx); - if (ud->ud_bif) - usbpf_detachd(ud); - mtx_unlock(&usbpf_mtx); - selwakeuppri(&ud->ud_sel, PRIUSB); - knlist_destroy(&ud->ud_sel.si_note); - callout_drain(&ud->ud_callout); - usbpf_freed(ud); - free(ud, M_USBPF); -} - -/* - * Open device. Returns ENXIO for illegal minor device number, - * EBUSY if file is open by another process. - */ -/* ARGSUSED */ -static int -usbpf_open(struct cdev *dev, int flags, int fmt, struct thread *td) -{ - struct usbpf_d *ud; - int error; - - ud = malloc(sizeof(*ud), M_USBPF, M_WAITOK | M_ZERO); - error = devfs_set_cdevpriv(ud, usbpf_dtor); - if (error != 0) { - free(ud, M_USBPF); - return (error); - } - - usbpf_buffer_init(ud); - ud->ud_bufmode = USBPF_BUFMODE_BUFFER; - ud->ud_sig = SIGIO; - ud->ud_direction = USBPF_D_INOUT; - ud->ud_pid = td->td_proc->p_pid; - mtx_init(&ud->ud_mtx, devtoname(dev), "usbpf cdev lock", MTX_DEF); - callout_init_mtx(&ud->ud_callout, &ud->ud_mtx, 0); - knlist_init_mtx(&ud->ud_sel.si_note, &ud->ud_mtx); - - return (0); -} - -static int -usbpf_uiomove(struct usbpf_d *ud, caddr_t buf, u_int len, struct uio *uio) -{ - - if (ud->ud_bufmode != USBPF_BUFMODE_BUFFER) - return (EOPNOTSUPP); - return (usbpf_buffer_uiomove(ud, buf, len, uio)); -} - -/* - * usbpf_read - read next chunk of packets from buffers - */ -static int -usbpf_read(struct cdev *dev, struct uio *uio, int ioflag) -{ - struct usbpf_d *ud; - int error; - int non_block; - int timed_out; - - error = devfs_get_cdevpriv((void **)&ud); - if (error != 0) - return (error); - - /* - * Restrict application to use a buffer the same size as - * as kernel buffers. - */ - if (uio->uio_resid != ud->ud_bufsize) - return (EINVAL); - - non_block = ((ioflag & O_NONBLOCK) != 0); - - USBPFD_LOCK(ud); - ud->ud_pid = curthread->td_proc->p_pid; - if (ud->ud_bufmode != USBPF_BUFMODE_BUFFER) { - USBPFD_UNLOCK(ud); - return (EOPNOTSUPP); - } - if (ud->ud_state == USBPF_WAITING) - callout_stop(&ud->ud_callout); - timed_out = (ud->ud_state == USBPF_TIMED_OUT); - ud->ud_state = USBPF_IDLE; - /* - * If the hold buffer is empty, then do a timed sleep, which - * ends when the timeout expires or when enough packets - * have arrived to fill the store buffer. - */ - while (ud->ud_hbuf == NULL) { - if (ud->ud_slen != 0) { - /* - * A packet(s) either arrived since the previous - * read or arrived while we were asleep. - */ - if (ud->ud_immediate || non_block || timed_out) { - /* - * Rotate the buffers and return what's here - * if we are in immediate mode, non-blocking - * flag is set, or this descriptor timed out. - */ - USBPF_ROTATE_BUFFERS(ud); - break; - } - } - - /* - * No data is available, check to see if the usbpf device - * is still pointed at a real interface. If not, return - * ENXIO so that the userland process knows to rebind - * it before using it again. - */ - if (ud->ud_bif == NULL) { - USBPFD_UNLOCK(ud); - return (ENXIO); - } - - if (non_block) { - USBPFD_UNLOCK(ud); - return (EWOULDBLOCK); - } - error = msleep(ud, &ud->ud_mtx, PRIUSB|PCATCH, - "uff", ud->ud_rtout); - if (error == EINTR || error == ERESTART) { - USBPFD_UNLOCK(ud); - return (error); - } - if (error == EWOULDBLOCK) { - /* - * On a timeout, return what's in the buffer, - * which may be nothing. If there is something - * in the store buffer, we can rotate the buffers. - */ - if (ud->ud_hbuf) - /* - * We filled up the buffer in between - * getting the timeout and arriving - * here, so we don't need to rotate. - */ - break; - - if (ud->ud_slen == 0) { - USBPFD_UNLOCK(ud); - return (0); - } - USBPF_ROTATE_BUFFERS(ud); - break; - } - } - /* - * At this point, we know we have something in the hold slot. - */ - USBPFD_UNLOCK(ud); - - /* - * Move data from hold buffer into user space. - * We know the entire buffer is transferred since - * we checked above that the read buffer is usbpf_bufsize bytes. - * - * XXXRW: More synchronization needed here: what if a second thread - * issues a read on the same fd at the same time? Don't want this - * getting invalidated. - */ - error = usbpf_uiomove(ud, ud->ud_hbuf, ud->ud_hlen, uio); - - USBPFD_LOCK(ud); - ud->ud_fbuf = ud->ud_hbuf; - ud->ud_hbuf = NULL; - ud->ud_hlen = 0; - usbpf_buf_reclaimed(ud); - USBPFD_UNLOCK(ud); - - return (error); -} - -static int -usbpf_write(struct cdev *dev, struct uio *uio, int ioflag) -{ - - /* NOT IMPLEMENTED */ - return (ENOSYS); -} - -static int -usbpf_ioctl_sblen(struct usbpf_d *ud, u_int *i) -{ - - if (ud->ud_bufmode != USBPF_BUFMODE_BUFFER) - return (EOPNOTSUPP); - return (usbpf_buffer_ioctl_sblen(ud, i)); -} - -/* - * Reset a descriptor by flushing its packet buffer and clearing the receive - * and drop counts. This is doable for kernel-only buffers, but with - * zero-copy buffers, we can't write to (or rotate) buffers that are - * currently owned by userspace. It would be nice if we could encapsulate - * this logic in the buffer code rather than here. - */ -static void -usbpf_reset_d(struct usbpf_d *ud) -{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 19:15:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18455106566C; Wed, 24 Nov 2010 19:15:27 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 065DC8FC08; Wed, 24 Nov 2010 19:15:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOJFQG3080594; Wed, 24 Nov 2010 19:15:26 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOJFQZ4080592; Wed, 24 Nov 2010 19:15:26 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201011241915.oAOJFQZ4080592@svn.freebsd.org> From: Weongyo Jeong Date: Wed, 24 Nov 2010 19:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215803 - head/usr.sbin/usbdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 19:15:27 -0000 Author: weongyo Date: Wed Nov 24 19:15:26 2010 New Revision: 215803 URL: http://svn.freebsd.org/changeset/base/215803 Log: As a refection of r215802 it should use BPF interfaces because the duplication code of USB pf is removed. Modified: head/usr.sbin/usbdump/usbdump.c Modified: head/usr.sbin/usbdump/usbdump.c ============================================================================== --- head/usr.sbin/usbdump/usbdump.c Wed Nov 24 19:11:32 2010 (r215802) +++ head/usr.sbin/usbdump/usbdump.c Wed Nov 24 19:15:26 2010 (r215803) @@ -32,8 +32,11 @@ #include #include #include +#include #include #include +#include +#include #include #include #include @@ -216,7 +219,7 @@ hexdump(const char *region, size_t len) } static void -print_apacket(const struct usbpf_xhdr *hdr, struct usbpf_pkthdr *up, +print_apacket(const struct bpf_xhdr *hdr, struct usbpf_pkthdr *up, const char *payload) { struct tm *tm; @@ -235,8 +238,8 @@ print_apacket(const struct usbpf_xhdr *h up->up_error = le32toh(up->up_error); up->up_interval = le32toh(up->up_interval); - tv.tv_sec = hdr->uh_tstamp.ut_sec; - tv.tv_usec = hdr->uh_tstamp.ut_frac; + tv.tv_sec = hdr->bh_tstamp.bt_sec; + tv.tv_usec = hdr->bh_tstamp.bt_frac; tm = localtime(&tv.tv_sec); len = strftime(buf, sizeof(buf), "%H:%M:%S", tm); @@ -267,20 +270,19 @@ print_apacket(const struct usbpf_xhdr *h print_status(up->up_status); } } - static void print_packets(char *data, const int datalen) { struct usbpf_pkthdr *up; - const struct usbpf_xhdr *hdr; + const struct bpf_xhdr *hdr; u_int32_t framelen, x; char *ptr, *next; for (ptr = data; ptr < (data + datalen); ptr = next) { - hdr = (const struct usbpf_xhdr *)ptr; - up = (struct usbpf_pkthdr *)(ptr + hdr->uh_hdrlen); - next = ptr + USBPF_WORDALIGN(hdr->uh_hdrlen + hdr->uh_caplen); + hdr = (const struct bpf_xhdr *)ptr; + up = (struct usbpf_pkthdr *)(ptr + hdr->bh_hdrlen); + next = ptr + BPF_WORDALIGN(hdr->bh_hdrlen + hdr->bh_caplen); ptr = ((char *)up) + sizeof(struct usbpf_pkthdr); if (w_arg == NULL) @@ -404,12 +406,12 @@ int main(int argc, char *argv[]) { struct timeval tv; - struct usbpf_insn total_insn; - struct usbpf_program total_prog; - struct usbpf_stat us; - struct usbpf_version uv; + struct bpf_insn total_insn; + struct bpf_program total_prog; + struct bpf_stat us; + struct bpf_version bv; struct usbcap uc, *p = &uc; - struct usbpf_ifreq ufr; + struct ifreq ifr; long snapshot = 192; u_int v; int fd, o; @@ -454,37 +456,37 @@ main(int argc, char *argv[]) exit(EXIT_SUCCESS); } - p->fd = fd = open("/dev/usbpf", O_RDONLY); + p->fd = fd = open("/dev/bpf", O_RDONLY); if (p->fd < 0) { fprintf(stderr, "(no devices found)\n"); return (EXIT_FAILURE); } - if (ioctl(fd, UIOCVERSION, (caddr_t)&uv) < 0) { - fprintf(stderr, "UIOCVERSION: %s\n", strerror(errno)); + if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0) { + fprintf(stderr, "BIOCVERSION: %s\n", strerror(errno)); return (EXIT_FAILURE); } - if (uv.uv_major != USBPF_MAJOR_VERSION || - uv.uv_minor < USBPF_MINOR_VERSION) { + if (bv.bv_major != BPF_MAJOR_VERSION || + bv.bv_minor < BPF_MINOR_VERSION) { fprintf(stderr, "kernel bpf filter out of date"); return (EXIT_FAILURE); } - if ((ioctl(fd, UIOCGBLEN, (caddr_t)&v) < 0) || v < 65536) - v = 65536; + if ((ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0) || v < 4096) + v = 4096; for ( ; v != 0; v >>= 1) { - (void)ioctl(fd, UIOCSBLEN, (caddr_t)&v); - (void)strncpy(ufr.ufr_name, i_arg, sizeof(ufr.ufr_name)); - if (ioctl(fd, UIOCSETIF, (caddr_t)&ufr) >= 0) + (void)ioctl(fd, BIOCSBLEN, (caddr_t)&v); + (void)strncpy(ifr.ifr_name, i_arg, sizeof(ifr.ifr_name)); + if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) >= 0) break; } if (v == 0) { - fprintf(stderr, "UIOCSBLEN: %s: No buffer size worked", i_arg); + fprintf(stderr, "BIOCSBLEN: %s: No buffer size worked", i_arg); return (EXIT_FAILURE); } - if (ioctl(fd, UIOCGBLEN, (caddr_t)&v) < 0) { - fprintf(stderr, "UIOCGBLEN: %s", strerror(errno)); + if (ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0) { + fprintf(stderr, "BIOCGBLEN: %s", strerror(errno)); return (EXIT_FAILURE); } @@ -496,23 +498,23 @@ main(int argc, char *argv[]) } /* XXX no read filter rules yet so at this moment accept everything */ - total_insn.code = (u_short)(USBPF_RET | USBPF_K); + total_insn.code = (u_short)(BPF_RET | BPF_K); total_insn.jt = 0; total_insn.jf = 0; total_insn.k = snapshot; - total_prog.uf_len = 1; - total_prog.uf_insns = &total_insn; - if (ioctl(p->fd, UIOCSETF, (caddr_t)&total_prog) < 0) { - fprintf(stderr, "UIOCSETF: %s", strerror(errno)); + total_prog.bf_len = 1; + total_prog.bf_insns = &total_insn; + if (ioctl(p->fd, BIOCSETF, (caddr_t)&total_prog) < 0) { + fprintf(stderr, "BIOCSETF: %s", strerror(errno)); return (EXIT_FAILURE); } /* 1 second read timeout */ tv.tv_sec = 1; tv.tv_usec = 0; - if (ioctl(p->fd, UIOCSRTIMEOUT, (caddr_t)&tv) < 0) { - fprintf(stderr, "UIOCSRTIMEOUT: %s", strerror(errno)); + if (ioctl(p->fd, BIOCSRTIMEOUT, (caddr_t)&tv) < 0) { + fprintf(stderr, "BIOCSRTIMEOUT: %s", strerror(errno)); return (EXIT_FAILURE); } @@ -520,16 +522,16 @@ main(int argc, char *argv[]) do_loop(p); - if (ioctl(fd, UIOCGSTATS, (caddr_t)&us) < 0) { - fprintf(stderr, "UIOCGSTATS: %s", strerror(errno)); + if (ioctl(fd, BIOCGSTATS, (caddr_t)&us) < 0) { + fprintf(stderr, "BIOCGSTATS: %s", strerror(errno)); return (EXIT_FAILURE); } /* XXX what's difference between pkt_captured and us.us_recv? */ printf("\n"); printf("%d packets captured\n", pkt_captured); - printf("%d packets received by filter\n", us.us_recv); - printf("%d packets dropped by kernel\n", us.us_drop); + printf("%d packets received by filter\n", us.bs_recv); + printf("%d packets dropped by kernel\n", us.bs_drop); if (p->fd > 0) close(p->fd); From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 19:18:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 453A6106566C; Wed, 24 Nov 2010 19:18:06 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe04.c2i.net [212.247.154.98]) by mx1.freebsd.org (Postfix) with ESMTP id 3B55B8FC14; Wed, 24 Nov 2010 19:18:04 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=gl0LPzB4YDQuuzpDoHYit7deEV0cOo++Sg28kyvF6vg= c=1 sm=1 a=xlHmSYMFaZ4A:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=6I5d2MoRAAAA:8 a=u_qTXgK1rxrCaSGE3PMA:9 a=o50_dDCc9sb7idZgRhDWXX4k_vwA:4 a=pILNOxqGKmIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe04.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 53041460; Wed, 24 Nov 2010 20:18:03 +0100 From: Hans Petter Selasky To: Weongyo Jeong Date: Wed, 24 Nov 2010 20:18:48 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201011241915.oAOJFQZ4080592@svn.freebsd.org> In-Reply-To: <201011241915.oAOJFQZ4080592@svn.freebsd.org> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201011242018.48397.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r215803 - head/usr.sbin/usbdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 19:18:06 -0000 On Wednesday 24 November 2010 20:15:26 Weongyo Jeong wrote: > Author: weongyo > Date: Wed Nov 24 19:15:26 2010 > New Revision: 215803 > URL: http://svn.freebsd.org/changeset/base/215803 > > Log: > As a refection of r215802 it should use BPF interfaces because the > duplication code of USB pf is removed. > > Modified: > head/usr.sbin/usbdump/usbdump.c > A comment: We need to do something about slow printout of captured USB packets. I noticed 20% CPU usage when printing via the TXT version to a file.txt. But 1% CPU usage when simply saving the stream. Is this something you plan to do? --HPS From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 19:21:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86BF3106564A; Wed, 24 Nov 2010 19:21:12 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe03.c2i.net [212.247.154.66]) by mx1.freebsd.org (Postfix) with ESMTP id 7B7678FC0C; Wed, 24 Nov 2010 19:21:11 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=drJD7N2WYgraSrvx4WFOmF+tWOmhzpnKhDnOdsziBzQ= c=1 sm=1 a=8TIkKnxdTboA:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=6I5d2MoRAAAA:8 a=iceBnK8SPEqwnxxv0rEA:9 a=yD3sG3oClKs1kXDzuNIA:7 a=NHnZ_TLe6YRg1DucRG15wM9b7voA:4 a=pILNOxqGKmIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe03.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 53623085; Wed, 24 Nov 2010 20:21:10 +0100 From: Hans Petter Selasky To: Weongyo Jeong Date: Wed, 24 Nov 2010 20:21:55 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201011241911.oAOJBWSK080475@svn.freebsd.org> In-Reply-To: <201011241911.oAOJBWSK080475@svn.freebsd.org> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201011242021.55305.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r215802 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 19:21:12 -0000 On Wednesday 24 November 2010 20:11:32 Weongyo Jeong wrote: > Author: weongyo > Date: Wed Nov 24 19:11:32 2010 > New Revision: 215802 > URL: http://svn.freebsd.org/changeset/base/215802 > > Log: > Removes all duplicated code with BPF that it's greatly simplified and > take all benefits whenever BPF code is improved. > > Pointed by: jkim > Reviewed by: thompsa > > Modified: > head/sys/dev/usb/controller/usb_controller.c > head/sys/dev/usb/usb_bus.h > head/sys/dev/usb/usb_pf.c > head/sys/dev/usb/usb_pf.h > Should the Copyright be updated aswell. We are no longer using enet.c code in usb_pf.c ? * Copyright (c) 1990, 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from the Stanford/CMU enet packet filter, * (net/enet.c) distributed as part of 4.3BSD, and code contributed * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence * Berkeley Laboratory. --HPS From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 19:42:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 284921065670; Wed, 24 Nov 2010 19:42:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id DABA18FC19; Wed, 24 Nov 2010 19:42:03 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:9c8:7244:543f:bf5] (unknown [IPv6:2001:7b8:3a7:0:9c8:7244:543f:bf5]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 13AC15C5A; Wed, 24 Nov 2010 20:42:02 +0100 (CET) Message-ID: <4CED6A8D.4080707@FreeBSD.org> Date: Wed, 24 Nov 2010 20:42:05 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13pre) Gecko/20101118 Lanikai/3.1.7pre MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201011241835.oAOIZBtO079680@svn.freebsd.org> In-Reply-To: <201011241835.oAOIZBtO079680@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r215801 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 19:42:04 -0000 On 2010-11-24 19:35, Dimitry Andric wrote: > Author: dim > Date: Wed Nov 24 18:35:11 2010 > New Revision: 215801 > URL: http://svn.freebsd.org/changeset/base/215801 > > Log: > Change ambiguous (or invalid, depending on how strict you want to be :) > assembly instruction "movw %rcx,2(%rax)" to "movw %cx,2(%rax)", since > the intent was to move 16 bits of data, in this case. > > Found by: clang > Reviewed by: kib MFC after: 1 week From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 21:43:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 382281065670; Wed, 24 Nov 2010 21:43:37 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26D3C8FC13; Wed, 24 Nov 2010 21:43:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOLhbV1083838; Wed, 24 Nov 2010 21:43:37 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOLhbqB083836; Wed, 24 Nov 2010 21:43:37 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201011242143.oAOLhbqB083836@svn.freebsd.org> From: Weongyo Jeong Date: Wed, 24 Nov 2010 21:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215804 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 21:43:37 -0000 Author: weongyo Date: Wed Nov 24 21:43:36 2010 New Revision: 215804 URL: http://svn.freebsd.org/changeset/base/215804 Log: Fixes a compiler warning when it's compiled with INVARIANTS. Pointy hat to: me Modified: head/sys/dev/usb/usb_pf.c Modified: head/sys/dev/usb/usb_pf.c ============================================================================== --- head/sys/dev/usb/usb_pf.c Wed Nov 24 19:15:26 2010 (r215803) +++ head/sys/dev/usb/usb_pf.c Wed Nov 24 21:43:36 2010 (r215804) @@ -67,7 +67,7 @@ usbpf_attach(struct usb_bus *ubus) if_attach(ifp); KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN, - ("wrong USB pf header length (%d)", sizeof(struct usbpf_pkthdr))); + ("wrong USB pf header length (%zd)", sizeof(struct usbpf_pkthdr))); /* * XXX According to the specification of DLT_USB, it indicates packets From owner-svn-src-head@FreeBSD.ORG Wed Nov 24 22:24:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E2F5106564A; Wed, 24 Nov 2010 22:24:08 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C8A28FC14; Wed, 24 Nov 2010 22:24:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAOMO8K1085093; Wed, 24 Nov 2010 22:24:08 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAOMO8Cu085091; Wed, 24 Nov 2010 22:24:08 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201011242224.oAOMO8Cu085091@svn.freebsd.org> From: Jack F Vogel Date: Wed, 24 Nov 2010 22:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215808 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 22:24:08 -0000 Author: jfv Date: Wed Nov 24 22:24:07 2010 New Revision: 215808 URL: http://svn.freebsd.org/changeset/base/215808 Log: The purpose of this change is to add a routine to disable ASPM L0S and L1 LINK states on 82573, 82574, and 82583. The theory is that this is behind certain hangs being experienced by some customers. Also included a small optimization in the rxeof routine that was in my internal code. Change the PBA size for pchlan, it was incorrect. MFC after: 3 days Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Wed Nov 24 21:58:15 2010 (r215807) +++ head/sys/dev/e1000/if_em.c Wed Nov 24 22:24:07 2010 (r215808) @@ -93,7 +93,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.1.7"; +char em_driver_version[] = "7.1.8"; /********************************************************************* * PCI Device ID Table @@ -272,6 +272,7 @@ static void em_get_wakeup(device_t); static void em_enable_wakeup(device_t); static int em_enable_phy_wakeup(struct adapter *); static void em_led_func(void *, int); +static void em_disable_aspm(struct adapter *); static int em_irq_fast(void *); @@ -1229,9 +1230,9 @@ em_init_locked(struct adapter *adapter) break; case e1000_ich9lan: case e1000_ich10lan: - case e1000_pchlan: pba = E1000_PBA_10K; break; + case e1000_pchlan: case e1000_pch2lan: pba = E1000_PBA_26K; break; @@ -2762,6 +2763,7 @@ em_reset(struct adapter *adapter) /* Issue a global reset */ e1000_reset_hw(hw); E1000_WRITE_REG(hw, E1000_WUC, 0); + em_disable_aspm(adapter); if (e1000_init_hw(hw) < 0) { device_printf(dev, "Hardware Initialization Failed\n"); @@ -4205,68 +4207,66 @@ em_rxeof(struct rx_ring *rxr, int count, len = le16toh(cur->length); eop = (status & E1000_RXD_STAT_EOP) != 0; - count--; - if (((cur->errors & E1000_RXD_ERR_FRAME_ERR_MASK) == 0) && - (rxr->discard == FALSE)) { + if ((rxr->discard == TRUE) || (cur->errors & + E1000_RXD_ERR_FRAME_ERR_MASK)) { + ifp->if_ierrors++; + ++rxr->rx_discarded; + if (!eop) /* Catch subsequent segs */ + rxr->discard = TRUE; + else + rxr->discard = FALSE; + em_rx_discard(rxr, i); + goto next_desc; + } - /* Assign correct length to the current fragment */ - mp = rxr->rx_buffers[i].m_head; - mp->m_len = len; - - /* Trigger for refresh */ - rxr->rx_buffers[i].m_head = NULL; - - if (rxr->fmp == NULL) { - mp->m_pkthdr.len = len; - rxr->fmp = mp; /* Store the first mbuf */ - rxr->lmp = mp; - } else { - /* Chain mbuf's together */ - mp->m_flags &= ~M_PKTHDR; - rxr->lmp->m_next = mp; - rxr->lmp = rxr->lmp->m_next; - rxr->fmp->m_pkthdr.len += len; - } + /* Assign correct length to the current fragment */ + mp = rxr->rx_buffers[i].m_head; + mp->m_len = len; - if (eop) { - rxr->fmp->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; - em_receive_checksum(cur, rxr->fmp); + /* Trigger for refresh */ + rxr->rx_buffers[i].m_head = NULL; + + /* First segment? */ + if (rxr->fmp == NULL) { + mp->m_pkthdr.len = len; + rxr->fmp = rxr->lmp = mp; + } else { + /* Chain mbuf's together */ + mp->m_flags &= ~M_PKTHDR; + rxr->lmp->m_next = mp; + rxr->lmp = mp; + rxr->fmp->m_pkthdr.len += len; + } + + if (eop) { + --count; + sendmp = rxr->fmp; + sendmp->m_pkthdr.rcvif = ifp; + ifp->if_ipackets++; + em_receive_checksum(cur, sendmp); #ifndef __NO_STRICT_ALIGNMENT - if (adapter->max_frame_size > - (MCLBYTES - ETHER_ALIGN) && - em_fixup_rx(rxr) != 0) - goto skip; + if (adapter->max_frame_size > + (MCLBYTES - ETHER_ALIGN) && + em_fixup_rx(rxr) != 0) + goto skip; #endif - if (status & E1000_RXD_STAT_VP) { - rxr->fmp->m_pkthdr.ether_vtag = - (le16toh(cur->special) & - E1000_RXD_SPC_VLAN_MASK); - rxr->fmp->m_flags |= M_VLANTAG; - } + if (status & E1000_RXD_STAT_VP) { + sendmp->m_pkthdr.ether_vtag = + (le16toh(cur->special) & + E1000_RXD_SPC_VLAN_MASK); + sendmp->m_flags |= M_VLANTAG; + } #ifdef EM_MULTIQUEUE - rxr->fmp->m_pkthdr.flowid = rxr->msix; - rxr->fmp->m_flags |= M_FLOWID; + sendmp->m_pkthdr.flowid = rxr->msix; + sendmp->m_flags |= M_FLOWID; #endif #ifndef __NO_STRICT_ALIGNMENT skip: #endif - sendmp = rxr->fmp; - rxr->fmp = NULL; - rxr->lmp = NULL; - } - } else { - ifp->if_ierrors++; - ++rxr->rx_discarded; - if (!eop) /* Catch subsequent segs */ - rxr->discard = TRUE; - else - rxr->discard = FALSE; - em_rx_discard(rxr, i); - sendmp = NULL; + rxr->fmp = rxr->lmp = NULL; } - +next_desc: /* Zero out the receive descriptors status. */ cur->status = 0; ++rxdone; /* cumulative for POLL */ @@ -4293,10 +4293,7 @@ skip: } /* Catch any remaining refresh work */ - if (processed != 0) { - em_refresh_mbufs(rxr, i); - processed = 0; - } + em_refresh_mbufs(rxr, i); rxr->next_to_check = i; if (done != NULL) @@ -4878,6 +4875,37 @@ em_led_func(void *arg, int onoff) EM_CORE_UNLOCK(adapter); } +/* +** Disable the L0S and L1 LINK states +*/ +static void +em_disable_aspm(struct adapter *adapter) +{ + int base, reg; + u16 link_cap,link_ctrl; + device_t dev = adapter->dev; + + switch (adapter->hw.mac.type) { + case e1000_82573: + case e1000_82574: + case e1000_82583: + break; + default: + return; + } + if (pci_find_extcap(dev, PCIY_EXPRESS, &base) != 0) + return; + reg = base + PCIR_EXPRESS_LINK_CAP; + link_cap = pci_read_config(dev, reg, 2); + if ((link_cap & PCIM_LINK_CAP_ASPM) == 0) + return; + reg = base + PCIR_EXPRESS_LINK_CTL; + link_ctrl = pci_read_config(dev, reg, 2); + link_ctrl &= 0xFFFC; /* turn off bit 1 and 2 */ + pci_write_config(dev, reg, link_ctrl, 2); + return; +} + /********************************************************************** * * Update the board statistics counters. From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 03:02:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19B4510656A5; Thu, 25 Nov 2010 03:02:54 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07DA88FC27; Thu, 25 Nov 2010 03:02:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAP32rsO091760; Thu, 25 Nov 2010 03:02:53 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAP32r6R091758; Thu, 25 Nov 2010 03:02:53 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201011250302.oAP32r6R091758@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 25 Nov 2010 03:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215810 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 03:02:54 -0000 Author: weongyo Date: Thu Nov 25 03:02:53 2010 New Revision: 215810 URL: http://svn.freebsd.org/changeset/base/215810 Log: Assigning the unit number for each interfaces could not use ubus->parent because it could differ depending on the host controller type. It could lead the duplicate unit number assignment. Modified: head/sys/dev/usb/usb_pf.c Modified: head/sys/dev/usb/usb_pf.c ============================================================================== --- head/sys/dev/usb/usb_pf.c Wed Nov 24 22:44:10 2010 (r215809) +++ head/sys/dev/usb/usb_pf.c Thu Nov 25 03:02:53 2010 (r215810) @@ -61,9 +61,10 @@ void usbpf_attach(struct usb_bus *ubus) { struct ifnet *ifp; + devclass_t dc = devclass_find("usbus"); ifp = ubus->ifp = if_alloc(IFT_USB); - if_initname(ifp, "usbus", device_get_unit(ubus->parent)); + if_initname(ifp, "usbus", devclass_get_count(dc)); if_attach(ifp); KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN, From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 03:16:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67637106564A; Thu, 25 Nov 2010 03:16:31 +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 55B6D8FC12; Thu, 25 Nov 2010 03:16:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAP3GVmH092175; Thu, 25 Nov 2010 03:16:31 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAP3GVvK092173; Thu, 25 Nov 2010 03:16:31 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201011250316.oAP3GVvK092173@svn.freebsd.org> From: Ed Maste Date: Thu, 25 Nov 2010 03:16:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215811 - head/sys/boot/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 03:16:31 -0000 Author: emaste Date: Thu Nov 25 03:16:31 2010 New Revision: 215811 URL: http://svn.freebsd.org/changeset/base/215811 Log: Give a bit of a hint of the failure (read != expected) but don't make the error message needlessly more verbose. Discussed with: attilio Modified: head/sys/boot/common/load_elf.c Modified: head/sys/boot/common/load_elf.c ============================================================================== --- head/sys/boot/common/load_elf.c Thu Nov 25 03:02:53 2010 (r215810) +++ head/sys/boot/common/load_elf.c Thu Nov 25 03:16:31 2010 (r215811) @@ -453,7 +453,7 @@ __elfN(loadimage)(struct preloaded_file } result = archsw.arch_readin(ef->fd, lastaddr, shdr[i].sh_size); if (result < 0 || (size_t)result != shdr[i].sh_size) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped! (%ju - %ju)", (uintmax_t)result, + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped! (%ju != %ju)", (uintmax_t)result, (uintmax_t)shdr[i].sh_size); lastaddr = ssym; ssym = 0; From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 03:30:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE9A6106566B; Thu, 25 Nov 2010 03:30:43 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C27488FC17; Thu, 25 Nov 2010 03:30:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAP3Uh6s092473; Thu, 25 Nov 2010 03:30:43 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAP3UhAG092470; Thu, 25 Nov 2010 03:30:43 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201011250330.oAP3UhAG092470@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 25 Nov 2010 03:30:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215812 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 03:30:44 -0000 Author: weongyo Date: Thu Nov 25 03:30:43 2010 New Revision: 215812 URL: http://svn.freebsd.org/changeset/base/215812 Log: Handles the unit number correctly that the previous commit had a problem (wrong unit number for a host controller) when the module is load / unloaded repeatly. Attaching the USB pf is moved to usbus device's attach. Pointed by: yongari Modified: head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/usb_pf.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Thu Nov 25 03:16:31 2010 (r215811) +++ head/sys/dev/usb/controller/usb_controller.c Thu Nov 25 03:30:43 2010 (r215812) @@ -207,6 +207,8 @@ usb_detach(device_t dev) usb_proc_free(&bus->control_xfer_proc); + usbpf_detach(bus); + return (0); } @@ -435,6 +437,8 @@ usb_attach_sub(device_t dev, struct usb_ usb_devclass_ptr = devclass_find("usbus"); mtx_unlock(&Giant); + usbpf_attach(bus); + /* Initialise USB process messages */ bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore; bus->explore_msg[0].bus = bus; @@ -548,8 +552,6 @@ usb_bus_mem_alloc_all(struct usb_bus *bu TAILQ_INIT(&bus->intr_q.head); - usbpf_attach(bus); - #if USB_HAVE_BUSDMA usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags, dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX); @@ -597,8 +599,6 @@ usb_bus_mem_free_all(struct usb_bus *bus usb_dma_tag_unsetup(bus->dma_parent_tag); #endif - usbpf_detach(bus); - mtx_destroy(&bus->bus_mtx); } Modified: head/sys/dev/usb/usb_pf.c ============================================================================== --- head/sys/dev/usb/usb_pf.c Thu Nov 25 03:16:31 2010 (r215811) +++ head/sys/dev/usb/usb_pf.c Thu Nov 25 03:30:43 2010 (r215812) @@ -61,10 +61,9 @@ void usbpf_attach(struct usb_bus *ubus) { struct ifnet *ifp; - devclass_t dc = devclass_find("usbus"); ifp = ubus->ifp = if_alloc(IFT_USB); - if_initname(ifp, "usbus", devclass_get_count(dc)); + if_initname(ifp, "usbus", device_get_unit(ubus->bdev)); if_attach(ifp); KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN, From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 04:45:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2646106566C; Thu, 25 Nov 2010 04:45:31 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B09878FC0A; Thu, 25 Nov 2010 04:45:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAP4jVE0093972; Thu, 25 Nov 2010 04:45:31 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAP4jVJH093970; Thu, 25 Nov 2010 04:45:31 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201011250445.oAP4jVJH093970@svn.freebsd.org> From: Colin Percival Date: Thu, 25 Nov 2010 04:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215813 - head/sys/i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 04:45:31 -0000 Author: cperciva Date: Thu Nov 25 04:45:31 2010 New Revision: 215813 URL: http://svn.freebsd.org/changeset/base/215813 Log: Remove vestigal debugging code which, in fork-heavy workloads, can cause a 30x slowdown. Modified: head/sys/i386/xen/xen_machdep.c Modified: head/sys/i386/xen/xen_machdep.c ============================================================================== --- head/sys/i386/xen/xen_machdep.c Thu Nov 25 03:30:43 2010 (r215812) +++ head/sys/i386/xen/xen_machdep.c Thu Nov 25 04:45:31 2010 (r215813) @@ -482,7 +482,6 @@ xen_pt_pin(vm_paddr_t ma) struct mmuext_op op; op.cmd = MMUEXT_PIN_L1_TABLE; op.arg1.mfn = ma >> PAGE_SHIFT; - printk("xen_pt_pin(): mfn=%x\n", op.arg1.mfn); xen_flush_queue(); PANIC_IF(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); } From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 05:32:19 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E55A41065672; Thu, 25 Nov 2010 05:32:18 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 6DD248FC17; Thu, 25 Nov 2010 05:32:18 +0000 (UTC) Received: from c122-106-145-124.carlnfd1.nsw.optusnet.com.au (c122-106-145-124.carlnfd1.nsw.optusnet.com.au [122.106.145.124]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id oAP5WD7I015003 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Nov 2010 16:32:14 +1100 Date: Thu, 25 Nov 2010 16:32:13 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste In-Reply-To: <201011250316.oAP3GVvK092173@svn.freebsd.org> Message-ID: <20101125155736.G1888@besplex.bde.org> References: <201011250316.oAP3GVvK092173@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r215811 - head/sys/boot/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 05:32:19 -0000 On Thu, 25 Nov 2010, Ed Maste wrote: > Log: > Give a bit of a hint of the failure (read != expected) but don't make > the error message needlessly more verbose. > > Discussed with: attilio Any chance of not making the source code needlessly verbose and full of style and type bugs? > Modified: head/sys/boot/common/load_elf.c > ============================================================================== > --- head/sys/boot/common/load_elf.c Thu Nov 25 03:02:53 2010 (r215810) > +++ head/sys/boot/common/load_elf.c Thu Nov 25 03:16:31 2010 (r215811) > @@ -453,7 +453,7 @@ __elfN(loadimage)(struct preloaded_file > } > result = archsw.arch_readin(ef->fd, lastaddr, shdr[i].sh_size); > if (result < 0 || (size_t)result != shdr[i].sh_size) { > - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped! (%ju - %ju)", (uintmax_t)result, > + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped! (%ju != %ju)", (uintmax_t)result, > (uintmax_t)shdr[i].sh_size); > lastaddr = ssym; > ssym = 0; This code is obviously not concerned about space or time optimizations, else it wouldn't use uintmax_t, but it uses __XSTRING(__ELF_WORD_SIZE) to convert an integer to a string at compile time. This makes it more verbose and helps give it a style bug (a too-long line). Recent commits expanded the style bug by lengthening the line to print another arg, despite the careful line splitting for the other arg. The cast to size_t at the start of this code is bogus. It assumes that the type of sh_size is no smaller than that of size_t, but if you assume that then you can assume it in the printf too and cast everything to size_t (*). This assumption may be valid, but elf itself uses careful type definitions (not involving size_t) to avoid such assumptions. Assuming this in the diagnostic printf is less risky than assuming it in the error checking. (*) Casting `result' to either uintmax_t or size_t in the printf is wrong, since `result' is a signed type and one of the error cases reported by this diagnostic is when result < 0. `result' actually has type ssize_t, and it can be -1 after a read error. ssize_t is somewhat inconsistent with typeof(sh_size), but good enough. Variables of type ssize_t should by printed using %zd and not mispromoted to uintmax_t for printing with %ju. I think this code uses libstand printf, which supports %zd. These and other fixes fixes give something like: if (result < 0 || (Elf_mumble))result != shdr[i].sh_size) { printf( "\nelf%d_loadimage: could not read symbols (%zd != %ju) -- skipped", __ELF_WORD_SIZE, result, (uintmax_t)shdr[i].sh_size); other fixes: - I couldn't find anything good for Elf_mumble. Elf declarations seem to actively inhibit declaring the types of things in a size-independent way. sh_size is declared as type Elf32_Word or ELf64_Xword. - the strange leading newline with no trailing newline is preserved - the string is still long so it needs outdenting to fit - rephrase message to put the error info before the action. - fix rendering of the dash symbol - remove shouting (!). More rephrasing or different termination may be needed if the string is expanded, as encouraged by its not having a trailing newline. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 08:31:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BFC21065672; Thu, 25 Nov 2010 08:31:24 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id 61C238FC08; Thu, 25 Nov 2010 08:31:22 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=yevn+QCjI6xy199BDvBOOiO14qYvyLq62he9tTtU3M8= c=1 sm=1 a=TEzOOrCWXzgA:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=6I5d2MoRAAAA:8 a=8TywCXDdWmK-7wZfpzUA:9 a=dUY03yq56rRi4QQVbaQA:7 a=DT8SCCgO5Jxfp-osezyYPwXGZxYA:4 a=pILNOxqGKmIA:10 a=wAwLPL-YCJS2XH5U:21 a=0iSz37en5HAzGZg8:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 53538773; Thu, 25 Nov 2010 09:31:20 +0100 From: Hans Petter Selasky To: Weongyo Jeong Date: Thu, 25 Nov 2010 09:32:04 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201011250302.oAP32r6R091758@svn.freebsd.org> In-Reply-To: <201011250302.oAP32r6R091758@svn.freebsd.org> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201011250932.04579.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r215810 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 08:31:24 -0000 On Thursday 25 November 2010 04:02:53 Weongyo Jeong wrote: > Author: weongyo > Date: Thu Nov 25 03:02:53 2010 > New Revision: 215810 > URL: http://svn.freebsd.org/changeset/base/215810 > > Log: > Assigning the unit number for each interfaces could not use ubus->parent > because it could differ depending on the host controller type. It could > lead the duplicate unit number assignment. > > Modified: > head/sys/dev/usb/usb_pf.c > > Modified: head/sys/dev/usb/usb_pf.c > =========================================================================== > === --- head/sys/dev/usb/usb_pf.c Wed Nov 24 22:44:10 2010 (r215809) > +++ head/sys/dev/usb/usb_pf.c Thu Nov 25 03:02:53 2010 (r215810) > @@ -61,9 +61,10 @@ void > usbpf_attach(struct usb_bus *ubus) > { > struct ifnet *ifp; > + devclass_t dc = devclass_find("usbus"); > > ifp = ubus->ifp = if_alloc(IFT_USB); > - if_initname(ifp, "usbus", device_get_unit(ubus->parent)); > + if_initname(ifp, "usbus", devclass_get_count(dc)); > if_attach(ifp); > > KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN, I think you will get a multiple unit number if you unload+load a driver like EHCI/OHCI/UHCI. I suggest that you only make one ifp instance and route all traffic through that one. --HPS From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 08:32:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3547B1065693; Thu, 25 Nov 2010 08:32:11 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id 2D10D8FC1E; Thu, 25 Nov 2010 08:32:09 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=yevn+QCjI6xy199BDvBOOiO14qYvyLq62he9tTtU3M8= c=1 sm=1 a=66BwjV4OQYgA:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=6I5d2MoRAAAA:8 a=ET1TI6MP39LMKkfRPOEA:9 a=rjuETav2lvSFxux6WfYA:7 a=eAZtwzHOOHa9GSgQlcL0U3cDo6YA:4 a=pILNOxqGKmIA:10 a=loB-QriZlXLibcsn:21 a=_uSYTEJV7auFVk6E:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 53539354; Thu, 25 Nov 2010 09:32:08 +0100 From: Hans Petter Selasky To: Weongyo Jeong Date: Thu, 25 Nov 2010 09:32:54 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201011250330.oAP3UhAG092470@svn.freebsd.org> In-Reply-To: <201011250330.oAP3UhAG092470@svn.freebsd.org> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201011250932.54119.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r215812 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 08:32:11 -0000 On Thursday 25 November 2010 04:30:43 Weongyo Jeong wrote: > Author: weongyo > Date: Thu Nov 25 03:30:43 2010 > New Revision: 215812 > URL: http://svn.freebsd.org/changeset/base/215812 > > Log: > Handles the unit number correctly that the previous commit had a problem > (wrong unit number for a host controller) when the module is load / > unloaded repeatly. Attaching the USB pf is moved to usbus device's > attach. > > Pointed by: yongari > > Modified: > head/sys/dev/usb/controller/usb_controller.c > head/sys/dev/usb/usb_pf.c > > Modified: head/sys/dev/usb/controller/usb_controller.c > =========================================================================== > === --- head/sys/dev/usb/controller/usb_controller.c Thu Nov 25 03:16:31 > 2010 (r215811) +++ head/sys/dev/usb/controller/usb_controller.c Thu Nov 25 > 03:30:43 2010 (r215812) @@ -207,6 +207,8 @@ usb_detach(device_t dev) > > usb_proc_free(&bus->control_xfer_proc); > > + usbpf_detach(bus); > + > return (0); > } > > @@ -435,6 +437,8 @@ usb_attach_sub(device_t dev, struct usb_ > usb_devclass_ptr = devclass_find("usbus"); > mtx_unlock(&Giant); > > + usbpf_attach(bus); > + > /* Initialise USB process messages */ > bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore; > bus->explore_msg[0].bus = bus; > @@ -548,8 +552,6 @@ usb_bus_mem_alloc_all(struct usb_bus *bu > > TAILQ_INIT(&bus->intr_q.head); > > - usbpf_attach(bus); > - > #if USB_HAVE_BUSDMA > usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags, > dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX); > @@ -597,8 +599,6 @@ usb_bus_mem_free_all(struct usb_bus *bus > usb_dma_tag_unsetup(bus->dma_parent_tag); > #endif > > - usbpf_detach(bus); > - > mtx_destroy(&bus->bus_mtx); > } > > > Modified: head/sys/dev/usb/usb_pf.c > =========================================================================== > === --- head/sys/dev/usb/usb_pf.c Thu Nov 25 03:16:31 2010 (r215811) > +++ head/sys/dev/usb/usb_pf.c Thu Nov 25 03:30:43 2010 (r215812) > @@ -61,10 +61,9 @@ void > usbpf_attach(struct usb_bus *ubus) > { > struct ifnet *ifp; > - devclass_t dc = devclass_find("usbus"); > > ifp = ubus->ifp = if_alloc(IFT_USB); > - if_initname(ifp, "usbus", devclass_get_count(dc)); > + if_initname(ifp, "usbus", device_get_unit(ubus->bdev)); > if_attach(ifp); > > KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN, Ok. This will work. --HPS From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 13:39:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29AD9106564A; Thu, 25 Nov 2010 13:39:56 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 170228FC14; Thu, 25 Nov 2010 13:39:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPDduTS006992; Thu, 25 Nov 2010 13:39:56 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPDdu6x006986; Thu, 25 Nov 2010 13:39:56 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201011251339.oAPDdu6x006986@svn.freebsd.org> From: Randall Stewart Date: Thu, 25 Nov 2010 13:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215817 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 13:39:56 -0000 Author: rrs Date: Thu Nov 25 13:39:55 2010 New Revision: 215817 URL: http://svn.freebsd.org/changeset/base/215817 Log: Adds new dtrace for cwnd functions and lay's groundwork for future dtrace points (rwnd flightsize etc). MFC after: 2 months Added: head/sys/netinet/sctp_dtrace_declare.h (contents, props changed) head/sys/netinet/sctp_dtrace_define.h (contents, props changed) Modified: head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_uio.h Modified: head/sys/netinet/sctp_cc_functions.c ============================================================================== --- head/sys/netinet/sctp_cc_functions.c Thu Nov 25 12:10:59 2010 (r215816) +++ head/sys/netinet/sctp_cc_functions.c Thu Nov 25 13:39:55 2010 (r215817) @@ -42,6 +42,7 @@ #include #include #include +#include #include __FBSDID("$FreeBSD$"); @@ -63,6 +64,9 @@ sctp_set_initial_cc_param(struct sctp_tc net->cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; net->ssthresh = assoc->peers_rwnd; + SDT_PROBE(sctp, cwnd, net, init, + stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, + 0, net->cwnd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); @@ -98,6 +102,9 @@ sctp_cwnd_update_after_fr(struct sctp_tc net->ssthresh = 2 * net->mtu; } net->cwnd = net->ssthresh; + SDT_PROBE(sctp, cwnd, net, fr, + stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, + old_cwnd, net->cwnd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_FR); @@ -155,6 +162,7 @@ sctp_cwnd_update_after_sack(struct sctp_ int accum_moved, int reneged_all, int will_exit) { struct sctp_nets *net; + int old_cwnd; /******************************/ /* update cwnd and Early FR */ @@ -246,7 +254,11 @@ sctp_cwnd_update_after_sack(struct sctp_ (asoc->sctp_cmt_pf > 0) && ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) { net->dest_state &= ~SCTP_ADDR_PF; + old_cwnd = net->cwnd; net->cwnd = net->mtu * asoc->sctp_cmt_pf; + SDT_PROBE(sctp, cwnd, net, ack, + stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, + old_cwnd, net->cwnd); SCTPDBG(SCTP_DEBUG_INDATA1, "Destination %p moved from PF to reachable with cwnd %d.\n", net, net->cwnd); /* @@ -290,13 +302,26 @@ sctp_cwnd_update_after_sack(struct sctp_ /* We are in slow start */ if (net->flight_size + net->net_ack >= net->cwnd) { if (net->net_ack > (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable))) { + old_cwnd = net->cwnd; net->cwnd += (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable)); + SDT_PROBE(sctp, cwnd, net, ack, + stcb->asoc.my_vtag, + ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), + net, + old_cwnd, net->cwnd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, net->mtu, SCTP_CWND_LOG_FROM_SS); } } else { + old_cwnd = net->cwnd; net->cwnd += net->net_ack; + SDT_PROBE(sctp, cwnd, net, ack, + stcb->asoc.my_vtag, + ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), + net, + old_cwnd, net->cwnd); + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, net->net_ack, SCTP_CWND_LOG_FROM_SS); @@ -318,7 +343,13 @@ sctp_cwnd_update_after_sack(struct sctp_ if ((net->flight_size + net->net_ack >= net->cwnd) && (net->partial_bytes_acked >= net->cwnd)) { net->partial_bytes_acked -= net->cwnd; + old_cwnd = net->cwnd; net->cwnd += net->mtu; + SDT_PROBE(sctp, cwnd, net, ack, + stcb->asoc.my_vtag, + ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), + net, + old_cwnd, net->cwnd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, net->mtu, SCTP_CWND_LOG_FROM_CA); @@ -364,7 +395,11 @@ sctp_cwnd_update_after_timeout(struct sc net->ssthresh = max(net->cwnd / 2, 4 * net->mtu); net->cwnd = net->mtu; net->partial_bytes_acked = 0; - + SDT_PROBE(sctp, cwnd, net, to, + stcb->asoc.my_vtag, + ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), + net, + old_cwnd, net->cwnd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX); } @@ -383,6 +418,11 @@ sctp_cwnd_update_after_ecn_echo(struct s net->RTO <<= 1; } net->cwnd = net->ssthresh; + SDT_PROBE(sctp, cwnd, net, ecn, + stcb->asoc.my_vtag, + ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), + net, + old_cwnd, net->cwnd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); } @@ -492,6 +532,11 @@ sctp_cwnd_update_after_packet_dropped(st } if (net->cwnd - old_cwnd != 0) { /* log only changes */ + SDT_PROBE(sctp, cwnd, net, pd, + stcb->asoc.my_vtag, + ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), + net, + old_cwnd, net->cwnd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); @@ -508,7 +553,11 @@ sctp_cwnd_update_after_output(struct sct if (net->ssthresh < net->cwnd) net->ssthresh = net->cwnd; net->cwnd = (net->flight_size + (burst_limit * net->mtu)); - + SDT_PROBE(sctp, cwnd, net, bl, + stcb->asoc.my_vtag, + ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), + net, + old_cwnd, net->cwnd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_BRST); } @@ -530,6 +579,11 @@ sctp_cwnd_update_after_fr_timer(struct s if (net->cwnd < net->ssthresh) /* still in SS move to CA */ net->ssthresh = net->cwnd - 1; + SDT_PROBE(sctp, cwnd, net, fr, + stcb->asoc.my_vtag, + ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), + net, + old_cwnd, net->cwnd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, (old_cwnd - net->cwnd), SCTP_CWND_LOG_FROM_FR); } Added: head/sys/netinet/sctp_dtrace_declare.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/sctp_dtrace_declare.h Thu Nov 25 13:39:55 2010 (r215817) @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 2010, by Randall Stewart & Michael Tuexen, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * a) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * b) 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. + * + * c) Neither the name of Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); +#ifndef __sctp_dtrace_declare_h__ +#include "opt_kdtrace.h" +#include +#include + +/* Declare the SCTP provider */ +SDT_PROVIDER_DECLARE(sctp); + +/* The probes we have so far: */ + +/* One to track a net's cwnd */ +/* initial */ +SDT_PROBE_DECLARE(sctp, cwnd, net, init); +/* update at a ack -- increase */ +SDT_PROBE_DECLARE(sctp, cwnd, net, ack); +/* update at a fast retransmit -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, fr); +/* update at a time-out -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, to); +/* update at a burst-limit -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, bl); +/* update at a ECN -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, ecn); +/* update at a Packet-Drop -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, pd); + +/* One to track an associations rwnd */ +SDT_PROBE_DECLARE(sctp, rwnd, assoc, val); + +/* One to track a net's flight size */ +SDT_PROBE_DECLARE(sctp, flightsize, net, val); + +/* One to track an associations flight size */ +SDT_PROBE_DECLARE(sctp, flightsize, assoc, val); + + + + + + +#endif Added: head/sys/netinet/sctp_dtrace_define.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/sctp_dtrace_define.h Thu Nov 25 13:39:55 2010 (r215817) @@ -0,0 +1,201 @@ +/*- + * Copyright (c) 2010, by Randall Stewart & Michael Tuexen, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * a) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * b) 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. + * + * c) Neither the name of Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); +#ifndef __sctp_dtrace_define_h__ +#include "opt_kdtrace.h" +#include +#include + +SDT_PROVIDER_DEFINE(sctp); + +/********************************************************/ +/* Cwnd probe - tracks changes in the congestion window on a netp */ +/********************************************************/ +/* Initial */ +SDT_PROBE_DEFINE(sctp, cwnd, net, init, init); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 1, "uint32_t"); +/* The pointer to the struct sctp_nets * changing */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 2, "uintptr_t"); +/* The old value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 3, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 4, "int"); + + +/* ACK-INCREASE */ +SDT_PROBE_DEFINE(sctp, cwnd, net, ack, ack); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 1, "uint32_t"); +/* The pointer to the struct sctp_nets * changing */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 2, "uintptr_t"); +/* The old value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 3, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 4, "int"); + +/* FastRetransmit-DECREASE */ +SDT_PROBE_DEFINE(sctp, cwnd, net, fr, fr); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 1, "uint32_t"); +/* The pointer to the struct sctp_nets * changing */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 2, "uintptr_t"); +/* The old value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 3, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 4, "int"); + + +/* TimeOut-DECREASE */ +SDT_PROBE_DEFINE(sctp, cwnd, net, to, to); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 1, "uint32_t"); +/* The pointer to the struct sctp_nets * changing */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 2, "uintptr_t"); +/* The old value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 3, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 4, "int"); + + +/* BurstLimit-DECREASE */ +SDT_PROBE_DEFINE(sctp, cwnd, net, bl, bl); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 1, "uint32_t"); +/* The pointer to the struct sctp_nets * changing */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 2, "uintptr_t"); +/* The old value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 3, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 4, "int"); + + +/* ECN-DECREASE */ +SDT_PROBE_DEFINE(sctp, cwnd, net, ecn, ecn); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 1, "uint32_t"); +/* The pointer to the struct sctp_nets * changing */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 2, "uintptr_t"); +/* The old value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 3, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 4, "int"); + + +/* PacketDrop-DECREASE */ +SDT_PROBE_DEFINE(sctp, cwnd, net, pd, pd); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 1, "uint32_t"); +/* The pointer to the struct sctp_nets * changing */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 2, "uintptr_t"); +/* The old value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 3, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 4, "int"); + + + +/********************************************************/ +/* Rwnd probe - tracks changes in the receiver window for an assoc */ +/********************************************************/ +SDT_PROBE_DEFINE(sctp, rwnd, assoc, val, val); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, rwnd, assoc, val, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, rwnd, assoc, val, 1, "uint32_t"); +/* The up/down amount */ +SDT_PROBE_ARGTYPE(sctp, rwnd, assoc, val, 2, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, rwnd, assoc, val, 3, "int"); + +/********************************************************/ +/* flight probe - tracks changes in the flight size on a net or assoc */ +/********************************************************/ +SDT_PROBE_DEFINE(sctp, flightsize, net, val, val); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 1, "uint32_t"); +/* The pointer to the struct sctp_nets * changing */ +SDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 2, "uintptr_t"); +/* The up/down amount */ +SDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 3, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 4, "int"); +/********************************************************/ +/* The total flight version */ +/********************************************************/ +SDT_PROBE_DEFINE(sctp, flightsize, assoc, val, val); +/* The Vtag for this end */ +SDT_PROBE_ARGTYPE(sctp, flightsize, assoc, val, 0, "uint32_t"); +/* The port number of the local side << 16 | port number of remote + * in network byte order. + */ +SDT_PROBE_ARGTYPE(sctp, flightsize, assoc, val, 1, "uint32_t"); +/* The up/down amount */ +SDT_PROBE_ARGTYPE(sctp, flightsize, assoc, val, 2, "int"); +/* The new value of the cwnd */ +SDT_PROBE_ARGTYPE(sctp, flightsize, assoc, val, 3, "int"); + +#endif Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Thu Nov 25 12:10:59 2010 (r215816) +++ head/sys/netinet/sctp_pcb.c Thu Nov 25 13:39:55 2010 (r215817) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/netinet/sctp_uio.h ============================================================================== --- head/sys/netinet/sctp_uio.h Thu Nov 25 12:10:59 2010 (r215816) +++ head/sys/netinet/sctp_uio.h Thu Nov 25 13:39:55 2010 (r215817) @@ -942,7 +942,7 @@ struct sctpstat { uint32_t sctps_wu_sacks_sent; /* Window Update only sacks sent */ uint32_t sctps_sends_with_flags; /* number of sends with * sinfo_flags !=0 */ - uint32_t sctps_sends_with_unord; /* number of unordered sends */ + uint32_t sctps_sends_with_unord; /* number of unordered sends */ uint32_t sctps_sends_with_eof; /* number of sends with EOF flag set */ uint32_t sctps_sends_with_abort; /* number of sends with ABORT * flag set */ From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 15:05:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69B5C106566C; Thu, 25 Nov 2010 15:05:22 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DA998FC0C; Thu, 25 Nov 2010 15:05:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPF5MKR008864; Thu, 25 Nov 2010 15:05:22 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPF5M9Q008861; Thu, 25 Nov 2010 15:05:22 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201011251505.oAPF5M9Q008861@svn.freebsd.org> From: Colin Percival Date: Thu, 25 Nov 2010 15:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215818 - in head/sys/i386: include/xen xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 15:05:22 -0000 Author: cperciva Date: Thu Nov 25 15:05:21 2010 New Revision: 215818 URL: http://svn.freebsd.org/changeset/base/215818 Log: 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. Modified: head/sys/i386/include/xen/hypercall.h head/sys/i386/xen/xen_machdep.c Modified: head/sys/i386/include/xen/hypercall.h ============================================================================== --- head/sys/i386/include/xen/hypercall.h Thu Nov 25 13:39:55 2010 (r215817) +++ head/sys/i386/include/xen/hypercall.h Thu Nov 25 15:05:21 2010 (r215818) @@ -234,8 +234,9 @@ HYPERVISOR_memory_op( return _hypercall2(int, memory_op, cmd, arg); } +int HYPERVISOR_multicall(multicall_entry_t *, int); static inline int -HYPERVISOR_multicall( +_HYPERVISOR_multicall( void *call_list, int nr_calls) { return _hypercall2(int, multicall, call_list, nr_calls); Modified: head/sys/i386/xen/xen_machdep.c ============================================================================== --- head/sys/i386/xen/xen_machdep.c Thu Nov 25 13:39:55 2010 (r215817) +++ head/sys/i386/xen/xen_machdep.c Thu Nov 25 15:05:21 2010 (r215818) @@ -1177,6 +1177,27 @@ trap_info_t trap_table[] = { { 0, 0, 0, 0 } }; +/* Perform a multicall and check that individual calls succeeded. */ +int +HYPERVISOR_multicall(struct multicall_entry * call_list, int nr_calls) +{ + int ret = 0; + int i; + + /* Perform the multicall. */ + PANIC_IF(_HYPERVISOR_multicall(call_list, nr_calls)); + + /* Check the results of individual hypercalls. */ + for (i = 0; i < nr_calls; i++) + if (unlikely(call_list[i].result < 0)) + ret++; + if (unlikely(ret > 0)) + panic("%d multicall(s) failed: cpu %d\n", + ret, smp_processor_id()); + + /* If we didn't panic already, everything succeeded. */ + return (0); +} /********** CODE WORTH KEEPING ABOVE HERE *****************/ From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 15:41:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDB03106566B; Thu, 25 Nov 2010 15:41:34 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC4248FC0C; Thu, 25 Nov 2010 15:41:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPFfYFE009623; Thu, 25 Nov 2010 15:41:34 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPFfYfD009621; Thu, 25 Nov 2010 15:41:34 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201011251541.oAPFfYfD009621@svn.freebsd.org> From: Colin Percival Date: Thu, 25 Nov 2010 15:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215819 - head/sys/i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 15:41:34 -0000 Author: cperciva Date: Thu Nov 25 15:41:34 2010 New Revision: 215819 URL: http://svn.freebsd.org/changeset/base/215819 Log: Work around paging bug. Somehow we seem to be ending up with entries in the TLB which don't correspond to ptes with PG_V set; prior to this commit I'm sometimes getting the wrong data when pages are loaded into the buffer cache (they're being loaded, but the missing TLB invalidation is causing the wrong data to be visible). Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Thu Nov 25 15:05:21 2010 (r215818) +++ head/sys/i386/xen/pmap.c Thu Nov 25 15:41:34 2010 (r215819) @@ -1292,7 +1292,19 @@ pmap_qenter(vm_offset_t sva, vm_page_t * mclp->args[0] = va; mclp->args[1] = (uint32_t)(pa & 0xffffffff); mclp->args[2] = (uint32_t)(pa >> 32); +#if 0 mclp->args[3] = (*pte & PG_V) ? UVMF_INVLPG|UVMF_ALL : 0; +#else + /* + * Somehow we seem to be ending up with pages which are in + * the TLB in spite of not having PG_V set, resulting in + * pages newly loaded into the bufcache not showing up + * immediately (i.e., accessing them provides the old data). + * As a workaround, always perform a TLB flush, even if the + * old page didn't have PG_V. + */ + mclp->args[3] = UVMF_INVLPG|UVMF_ALL; +#endif va += PAGE_SIZE; pte++; From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 15:42:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2AE81065697; Thu, 25 Nov 2010 15:42:33 +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 916E98FC16; Thu, 25 Nov 2010 15:42:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPFgXeq009678; Thu, 25 Nov 2010 15:42:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPFgXuR009675; Thu, 25 Nov 2010 15:42:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011251542.oAPFgXuR009675@svn.freebsd.org> From: John Baldwin Date: Thu, 25 Nov 2010 15:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215820 - in head/sys: dev/pci i386/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 15:42:33 -0000 Author: jhb Date: Thu Nov 25 15:42:33 2010 New Revision: 215820 URL: http://svn.freebsd.org/changeset/base/215820 Log: Add device IDs for two more ServerWorks Host-PCI bridges so that we can read their starting PCI bus number for older systems that do not support ACPI (or have a broken _BBN method). PR: kern/148108 MFC after: 1 week Modified: head/sys/dev/pci/pci_pci.c head/sys/i386/pci/pci_bus.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Thu Nov 25 15:41:34 2010 (r215819) +++ head/sys/dev/pci/pci_pci.c Thu Nov 25 15:42:33 2010 (r215820) @@ -860,7 +860,9 @@ host_pcib_get_busno(pci_read_config_fn r case 0x00171166: case 0x01011166: case 0x010f1014: + case 0x01101166: case 0x02011166: + case 0x02251166: case 0x03021014: *busnum = read_config(bus, slot, func, 0x44, 1); break; Modified: head/sys/i386/pci/pci_bus.c ============================================================================== --- head/sys/i386/pci/pci_bus.c Thu Nov 25 15:41:34 2010 (r215819) +++ head/sys/i386/pci/pci_bus.c Thu Nov 25 15:42:33 2010 (r215820) @@ -204,6 +204,9 @@ legacy_pcib_is_host_bridge(int bus, int break; } break; + case 0x1A308086: + s = "Intel 82845 Host to PCI bridge"; + break; /* AMD -- vendor 0x1022 */ case 0x30001022: @@ -304,6 +307,8 @@ legacy_pcib_is_host_bridge(int bus, int case 0x00171166: /* FALLTHROUGH */ case 0x01011166: + case 0x01101166: + case 0x02251166: s = "ServerWorks host to PCI bridge(unknown chipset)"; *busnum = legacy_pcib_read_config(0, bus, slot, func, 0x44, 1); break; From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 15:56:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB99A1065670; Thu, 25 Nov 2010 15:56:05 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA72E8FC1E; Thu, 25 Nov 2010 15:56:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPFu5U1009991; Thu, 25 Nov 2010 15:56:05 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPFu5Lg009989; Thu, 25 Nov 2010 15:56:05 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201011251556.oAPFu5Lg009989@svn.freebsd.org> From: Attilio Rao Date: Thu, 25 Nov 2010 15:56:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215821 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 15:56:05 -0000 Author: attilio Date: Thu Nov 25 15:56:05 2010 New Revision: 215821 URL: http://svn.freebsd.org/changeset/base/215821 Log: Add a missing CTL description from CVS revision 1.147. Sponsored by: Sandvine Incorporated Discussed with: Jeremie Le Hen MFC after: 3 days Modified: head/sys/sys/sysctl.h Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Thu Nov 25 15:42:33 2010 (r215820) +++ head/sys/sys/sysctl.h Thu Nov 25 15:56:05 2010 (r215821) @@ -452,6 +452,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e { "logsigexit", CTLTYPE_INT }, \ { "iov_max", CTLTYPE_INT }, \ { "hostuuid", CTLTYPE_STRING }, \ + { "arc4rand", CTLTYPE_OPAQUE }, \ } /* From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 18:14:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58BB91065670; Thu, 25 Nov 2010 18:14:18 +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 472318FC17; Thu, 25 Nov 2010 18:14:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPIEIrT012919; Thu, 25 Nov 2010 18:14:18 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPIEI4M012917; Thu, 25 Nov 2010 18:14:18 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201011251814.oAPIEI4M012917@svn.freebsd.org> From: Dimitry Andric Date: Thu, 25 Nov 2010 18:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215823 - head/sys/i386/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 18:14:18 -0000 Author: dim Date: Thu Nov 25 18:14:18 2010 New Revision: 215823 URL: http://svn.freebsd.org/changeset/base/215823 Log: Use unambiguous inline assembly to load a float variable. GNU as silently converts 'fld' to 'flds', without taking the actual variable type into account (!), but clang's integrated assembler rightfully complains about it. Discussed with: cperciva Modified: head/sys/i386/isa/npx.c Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Thu Nov 25 16:21:56 2010 (r215822) +++ head/sys/i386/isa/npx.c Thu Nov 25 18:14:18 2010 (r215823) @@ -938,7 +938,7 @@ fpu_clean_state(void) * the x87 stack, but we don't care since we're about to call * fxrstor() anyway. */ - __asm __volatile("ffree %%st(7); fld %0" : : "m" (dummy_variable)); + __asm __volatile("ffree %%st(7); flds %0" : : "m" (dummy_variable)); } #endif /* CPU_ENABLE_SSE */ From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 18:20:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B118F1065672; Thu, 25 Nov 2010 18:20: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 9F9428FC33; Thu, 25 Nov 2010 18:20:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPIKSKZ013197; Thu, 25 Nov 2010 18:20:28 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPIKSn8013195; Thu, 25 Nov 2010 18:20:28 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201011251820.oAPIKSn8013195@svn.freebsd.org> From: Doug Barton Date: Thu, 25 Nov 2010 18:20:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215824 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 18:20:28 -0000 Author: dougb Date: Thu Nov 25 18:20:28 2010 New Revision: 215824 URL: http://svn.freebsd.org/changeset/base/215824 Log: Add a sync to the shutdown step. In the common case this will be harmless at worst. On a heavily loaded server it will give the fs a chance to do its business without the axe hanging over its head. Submitted by: ivoras Modified: head/etc/rc.d/mountcritlocal Modified: head/etc/rc.d/mountcritlocal ============================================================================== --- head/etc/rc.d/mountcritlocal Thu Nov 25 18:14:18 2010 (r215823) +++ head/etc/rc.d/mountcritlocal Thu Nov 25 18:20:28 2010 (r215824) @@ -5,13 +5,13 @@ # PROVIDE: mountcritlocal # REQUIRE: root hostid_save mdconfig -# KEYWORD: nojail +# KEYWORD: nojail shutdown . /etc/rc.subr name="mountcritlocal" start_cmd="mountcritlocal_start" -stop_cmd=":" +stop_cmd=sync mountcritlocal_start() { From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 19:05:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFCF71065670; Thu, 25 Nov 2010 19:05:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDB4A8FC0C; Thu, 25 Nov 2010 19:05:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPJ5HUO014876; Thu, 25 Nov 2010 19:05:17 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPJ5HRr014874; Thu, 25 Nov 2010 19:05:17 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201011251905.oAPJ5HRr014874@svn.freebsd.org> From: Xin LI Date: Thu, 25 Nov 2010 19:05:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215835 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 19:05:17 -0000 Author: delphij Date: Thu Nov 25 19:05:17 2010 New Revision: 215835 URL: http://svn.freebsd.org/changeset/base/215835 Log: Add a HARDWARE section. MFC after: 2 weeks Modified: head/share/man/man4/et.4 Modified: head/share/man/man4/et.4 ============================================================================== --- head/share/man/man4/et.4 Thu Nov 25 18:50:59 2010 (r215834) +++ head/share/man/man4/et.4 Thu Nov 25 19:05:17 2010 (r215835) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2008 +.Dd November 25, 2010 .Dt ET 4 .Os .Sh NAME @@ -122,6 +122,11 @@ Note that the 1000baseT media type is on if it is supported by the adapter. For more information on configuring this device, see .Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports Agere ET1310 10/100/Gigabit +Ethernet adapters. .Sh TUNABLES .Bl -tag -width ".Va hw.et.rx_intr_npkts" .It Va hw.et.rx_intr_npkts From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 19:22:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5082F1065673; Thu, 25 Nov 2010 19:22:25 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7E58FC19; Thu, 25 Nov 2010 19:22:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPJMP73015222; Thu, 25 Nov 2010 19:22:25 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPJMPMd015220; Thu, 25 Nov 2010 19:22:25 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011251922.oAPJMPMd015220@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 25 Nov 2010 19:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215836 - head/usr.bin/calendar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 19:22:25 -0000 Author: uqs Date: Thu Nov 25 19:22:24 2010 New Revision: 215836 URL: http://svn.freebsd.org/changeset/base/215836 Log: Pet make checkdpadd. Modified: head/usr.bin/calendar/Makefile Modified: head/usr.bin/calendar/Makefile ============================================================================== --- head/usr.bin/calendar/Makefile Thu Nov 25 19:05:17 2010 (r215835) +++ head/usr.bin/calendar/Makefile Thu Nov 25 19:22:24 2010 (r215836) @@ -4,6 +4,7 @@ PROG= calendar SRCS= calendar.c locale.c events.c dates.c parsedata.c io.c day.c \ ostern.c paskha.c pom.c sunpos.c +DPADD= ${LIBM} LDADD= -lm INTER= de_AT.ISO_8859-15 de_DE.ISO8859-1 fr_FR.ISO8859-1 \ hr_HR.ISO8859-2 hu_HU.ISO8859-2 ru_RU.KOI8-R uk_UA.KOI8-U From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 19:33:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE0701065694; Thu, 25 Nov 2010 19:33:39 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABD8D8FC13; Thu, 25 Nov 2010 19:33:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPJXdmH015469; Thu, 25 Nov 2010 19:33:39 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPJXdIW015467; Thu, 25 Nov 2010 19:33:39 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201011251933.oAPJXdIW015467@svn.freebsd.org> From: Xin LI Date: Thu, 25 Nov 2010 19:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215837 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 19:33:39 -0000 Author: delphij Date: Thu Nov 25 19:33:39 2010 New Revision: 215837 URL: http://svn.freebsd.org/changeset/base/215837 Log: Update manual page with respect to latest driver. While I'm there remove ARC-1180 which doesn't seem to exist. Modified: head/share/man/man4/arcmsr.4 Modified: head/share/man/man4/arcmsr.4 ============================================================================== --- head/share/man/man4/arcmsr.4 Thu Nov 25 19:22:24 2010 (r215836) +++ head/share/man/man4/arcmsr.4 Thu Nov 25 19:33:39 2010 (r215837) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd March 28, 2008 +.Dd November 25, 2010 .Dt ARCMSR 4 .Os .Sh NAME .Nm arcmsr -.Nd Areca SATA II RAID Controller driver +.Nd Areca RAID Controller driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -50,11 +50,11 @@ arcmsr_load="YES" .Sh DESCRIPTION The .Nm -driver provides support for the Areca ARC-11xx and ARC-12xx series of SATA II -RAID controllers. +driver provides support for the Areca ARC-11xx, ARC-12xx, ARC-13xx, +ARC-16xx and ARC-18xx series of SAS and SATA RAID controllers. These controllers feature RAID-0, 1, 3, 5, 6, and 10 and JBOD acceleration for up to 16 SATA drives. -Raid level and stripe level +RAID level and stripe level migration, online capacity expansion, hot insertion/removal, automatic failover and rebuild, and SMART are also supported. Access to the arrays is provided @@ -82,8 +82,6 @@ ARC-1160 .It ARC-1170 .It -ARC-1180 -.It ARC-1110ML .It ARC-1120ML @@ -92,14 +90,28 @@ ARC-1130ML .It ARC-1160ML .It +ARC-1200 +.It +ARC-1201 +.It ARC-1210 .It +ARC-1212 +.It ARC-1220 .It +ARC-1222 +.It ARC-1230 .It +ARC-1231 +.It ARC-1260 .It +ARC-1261 +.It +ARC-1270 +.It ARC-1280 .It ARC-1210ML @@ -111,6 +123,16 @@ ARC-1231ML ARC-1261ML .It ARC-1280ML +.It +ARC-1380 +.It +ARC-1381 +.It +ARC-1680 +.It +ARC-1681 +.It +ARC-1880 .El .Sh FILES .Bl -tag -width ".Pa /dev/arcmsr?" -compact From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 20:05:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC8B7106564A; Thu, 25 Nov 2010 20:05:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA5598FC12; Thu, 25 Nov 2010 20:05:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPK5BAf016131; Thu, 25 Nov 2010 20:05:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPK5Box016129; Thu, 25 Nov 2010 20:05:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011252005.oAPK5Box016129@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 25 Nov 2010 20:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215838 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 20:05:12 -0000 Author: kib Date: Thu Nov 25 20:05:11 2010 New Revision: 215838 URL: http://svn.freebsd.org/changeset/base/215838 Log: Account i/o done on cdevs. Reported and tested by: Adam Vande More MFC after: 1 week Modified: head/sys/kern/kern_physio.c Modified: head/sys/kern/kern_physio.c ============================================================================== --- head/sys/kern/kern_physio.c Thu Nov 25 19:33:39 2010 (r215837) +++ head/sys/kern/kern_physio.c Thu Nov 25 20:05:11 2010 (r215838) @@ -57,10 +57,13 @@ physio(struct cdev *dev, struct uio *uio for (i = 0; i < uio->uio_iovcnt; i++) { while (uio->uio_iov[i].iov_len) { bp->b_flags = 0; - if (uio->uio_rw == UIO_READ) + if (uio->uio_rw == UIO_READ) { bp->b_iocmd = BIO_READ; - else + curthread->td_ru.ru_inblock++; + } else { bp->b_iocmd = BIO_WRITE; + curthread->td_ru.ru_oublock++; + } bp->b_iodone = bdone; bp->b_data = uio->uio_iov[i].iov_base; bp->b_bcount = uio->uio_iov[i].iov_len; From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 20:29:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C37FC106566C; Thu, 25 Nov 2010 20:29:14 +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 AFCA48FC17; Thu, 25 Nov 2010 20:29:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPKTEt8016708; Thu, 25 Nov 2010 20:29:14 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPKTER5016700; Thu, 25 Nov 2010 20:29:14 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201011252029.oAPKTER5016700@svn.freebsd.org> From: Dimitry Andric Date: Thu, 25 Nov 2010 20:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215840 - in head/contrib/gcc: . config config/ia64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 20:29:14 -0000 Author: dim Date: Thu Nov 25 20:29:14 2010 New Revision: 215840 URL: http://svn.freebsd.org/changeset/base/215840 Log: Apply backported fix for gcc PR 20218. This makes __attribute__ ((visibility ("hidden"))) work properly, and fixes building devel/glib20 with newer binutils. Silence from: current@ Modified: head/contrib/gcc/cgraphunit.c head/contrib/gcc/config/elfos.h head/contrib/gcc/config/ia64/hpux.h head/contrib/gcc/config/ia64/ia64.c head/contrib/gcc/output.h head/contrib/gcc/toplev.c head/contrib/gcc/varasm.c Modified: head/contrib/gcc/cgraphunit.c ============================================================================== --- head/contrib/gcc/cgraphunit.c Thu Nov 25 20:09:56 2010 (r215839) +++ head/contrib/gcc/cgraphunit.c Thu Nov 25 20:29:14 2010 (r215840) @@ -1536,8 +1536,6 @@ cgraph_optimize (void) return; } - process_pending_assemble_externals (); - /* Frontend may output common variables after the unit has been finalized. It is safe to deal with them here as they are always zero initialized. */ cgraph_varpool_analyze_pending_decls (); Modified: head/contrib/gcc/config/elfos.h ============================================================================== --- head/contrib/gcc/config/elfos.h Thu Nov 25 20:09:56 2010 (r215839) +++ head/contrib/gcc/config/elfos.h Thu Nov 25 20:29:14 2010 (r215840) @@ -496,3 +496,13 @@ Boston, MA 02110-1301, USA. */ fprintf ((FILE), "\"\n"); \ } \ while (0) + +/* A C statement (sans semicolon) to output to the stdio stream STREAM + any text necessary for declaring the name of an external symbol + named NAME whch is referenced in this compilation but not defined. + It is needed to properly support non-default visibility. */ + +#ifndef ASM_OUTPUT_EXTERNAL +#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ + default_elf_asm_output_external (FILE, DECL, NAME) +#endif Modified: head/contrib/gcc/config/ia64/hpux.h ============================================================================== --- head/contrib/gcc/config/ia64/hpux.h Thu Nov 25 20:09:56 2010 (r215839) +++ head/contrib/gcc/config/ia64/hpux.h Thu Nov 25 20:29:14 2010 (r215840) @@ -144,10 +144,6 @@ do { \ definitions, so do not use them in gthr-posix.h. */ #define GTHREAD_USE_WEAK 0 -/* Put out the needed function declarations at the end. */ - -#define TARGET_ASM_FILE_END ia64_hpux_file_end - #undef CTORS_SECTION_ASM_OP #define CTORS_SECTION_ASM_OP "\t.section\t.init_array,\t\"aw\",\"init_array\"" Modified: head/contrib/gcc/config/ia64/ia64.c ============================================================================== --- head/contrib/gcc/config/ia64/ia64.c Thu Nov 25 20:09:56 2010 (r215839) +++ head/contrib/gcc/config/ia64/ia64.c Thu Nov 25 20:29:14 2010 (r215840) @@ -250,10 +250,6 @@ static section *ia64_select_rtx_section static void ia64_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED; static unsigned int ia64_section_type_flags (tree, const char *, int); -static void ia64_hpux_add_extern_decl (tree decl) - ATTRIBUTE_UNUSED; -static void ia64_hpux_file_end (void) - ATTRIBUTE_UNUSED; static void ia64_init_libfuncs (void) ATTRIBUTE_UNUSED; static void ia64_hpux_init_libfuncs (void) @@ -5015,49 +5011,6 @@ ia64_secondary_reload_class (enum reg_cl } -/* Emit text to declare externally defined variables and functions, because - the Intel assembler does not support undefined externals. */ - -void -ia64_asm_output_external (FILE *file, tree decl, const char *name) -{ - int save_referenced; - - /* GNU as does not need anything here, but the HP linker does need - something for external functions. */ - - if (TARGET_GNU_AS - && (!TARGET_HPUX_LD - || TREE_CODE (decl) != FUNCTION_DECL - || strstr (name, "__builtin_") == name)) - return; - - /* ??? The Intel assembler creates a reference that needs to be satisfied by - the linker when we do this, so we need to be careful not to do this for - builtin functions which have no library equivalent. Unfortunately, we - can't tell here whether or not a function will actually be called by - expand_expr, so we pull in library functions even if we may not need - them later. */ - if (! strcmp (name, "__builtin_next_arg") - || ! strcmp (name, "alloca") - || ! strcmp (name, "__builtin_constant_p") - || ! strcmp (name, "__builtin_args_info")) - return; - - if (TARGET_HPUX_LD) - ia64_hpux_add_extern_decl (decl); - else - { - /* assemble_name will set TREE_SYMBOL_REFERENCED, so we must save and - restore it. */ - save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)); - if (TREE_CODE (decl) == FUNCTION_DECL) - ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function"); - (*targetm.asm_out.globalize_label) (file, name); - TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) = save_referenced; - } -} - /* Parse the -mfixed-range= option string. */ static void @@ -9223,55 +9176,33 @@ ia64_hpux_function_arg_padding (enum mac return DEFAULT_FUNCTION_ARG_PADDING (mode, type); } -/* Linked list of all external functions that are to be emitted by GCC. - We output the name if and only if TREE_SYMBOL_REFERENCED is set in - order to avoid putting out names that are never really used. */ - -struct extern_func_list GTY(()) -{ - struct extern_func_list *next; - tree decl; -}; - -static GTY(()) struct extern_func_list *extern_func_head; - -static void -ia64_hpux_add_extern_decl (tree decl) -{ - struct extern_func_list *p = ggc_alloc (sizeof (struct extern_func_list)); - - p->decl = decl; - p->next = extern_func_head; - extern_func_head = p; -} - -/* Print out the list of used global functions. */ +/* Emit text to declare externally defined variables and functions, because + the Intel assembler does not support undefined externals. */ -static void -ia64_hpux_file_end (void) +void +ia64_asm_output_external (FILE *file, tree decl, const char *name) { - struct extern_func_list *p; - - for (p = extern_func_head; p; p = p->next) - { - tree decl = p->decl; - tree id = DECL_ASSEMBLER_NAME (decl); - - gcc_assert (id); - - if (!TREE_ASM_WRITTEN (decl) && TREE_SYMBOL_REFERENCED (id)) - { - const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); - - TREE_ASM_WRITTEN (decl) = 1; - (*targetm.asm_out.globalize_label) (asm_out_file, name); - fputs (TYPE_ASM_OP, asm_out_file); - assemble_name (asm_out_file, name); - fprintf (asm_out_file, "," TYPE_OPERAND_FMT "\n", "function"); - } + /* We output the name if and only if TREE_SYMBOL_REFERENCED is + set in order to avoid putting out names that are never really + used. */ + if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) + { + /* maybe_assemble_visibility will return 1 if the assembler + visibility directive is outputed. */ + int need_visibility = ((*targetm.binds_local_p) (decl) + && maybe_assemble_visibility (decl)); + + /* GNU as does not need anything here, but the HP linker does + need something for external functions. */ + if ((TARGET_HPUX_LD || !TARGET_GNU_AS) + && TREE_CODE (decl) == FUNCTION_DECL) + { + ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function"); + (*targetm.asm_out.globalize_label) (file, name); + } + else if (need_visibility && !TARGET_GNU_AS) + (*targetm.asm_out.globalize_label) (file, name); } - - extern_func_head = 0; } /* Set SImode div/mod functions, init_integral_libfuncs only initializes Modified: head/contrib/gcc/output.h ============================================================================== --- head/contrib/gcc/output.h Thu Nov 25 20:09:56 2010 (r215839) +++ head/contrib/gcc/output.h Thu Nov 25 20:29:14 2010 (r215840) @@ -200,9 +200,9 @@ extern void assemble_variable (tree, int DONT_OUTPUT_DATA is from assemble_variable. */ extern void align_variable (tree decl, bool dont_output_data); -/* Output something to declare an external symbol to the assembler. - (Most assemblers don't need this, so we normally output nothing.) - Do nothing if DECL is not external. */ +/* Queue for outputing something to declare an external symbol to the + assembler. (Most assemblers don't need this, so we normally output + nothing.) Do nothing if DECL is not external. */ extern void assemble_external (tree); /* Assemble code to leave SIZE bytes of zeros. */ @@ -607,6 +607,10 @@ extern void default_file_start (void); extern void file_end_indicate_exec_stack (void); extern bool default_valid_pointer_mode (enum machine_mode); +extern void default_elf_asm_output_external (FILE *file, tree, + const char *); +extern int maybe_assemble_visibility (tree); + extern int default_address_cost (rtx); /* dbxout helper functions */ Modified: head/contrib/gcc/toplev.c ============================================================================== --- head/contrib/gcc/toplev.c Thu Nov 25 20:09:56 2010 (r215839) +++ head/contrib/gcc/toplev.c Thu Nov 25 20:29:14 2010 (r215840) @@ -1080,9 +1080,7 @@ compile_file (void) dw2_output_indirect_constants (); - /* Flush any pending external directives. cgraph did this for - assemble_external calls from the front end, but the RTL - expander can also generate them. */ + /* Flush any pending external directives. */ process_pending_assemble_externals (); /* Attach a special .ident directive to the end of the file to identify Modified: head/contrib/gcc/varasm.c ============================================================================== --- head/contrib/gcc/varasm.c Thu Nov 25 20:09:56 2010 (r215839) +++ head/contrib/gcc/varasm.c Thu Nov 25 20:29:14 2010 (r215840) @@ -126,7 +126,6 @@ static unsigned HOST_WIDE_INT array_size static unsigned min_align (unsigned, unsigned); static void output_constructor (tree, unsigned HOST_WIDE_INT, unsigned int); static void globalize_decl (tree); -static void maybe_assemble_visibility (tree); #ifdef BSS_SECTION_ASM_OP #ifdef ASM_OUTPUT_BSS static void asm_output_bss (FILE *, tree, const char *, @@ -1957,11 +1956,10 @@ assemble_external (tree decl ATTRIBUTE_U if (!DECL_P (decl) || !DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl)) return; - if (flag_unit_at_a_time) - pending_assemble_externals = tree_cons (0, decl, - pending_assemble_externals); - else - assemble_external_real (decl); + /* We want to output external symbols at very last to check if they + are references or not. */ + pending_assemble_externals = tree_cons (0, decl, + pending_assemble_externals); #endif } @@ -5064,13 +5062,18 @@ default_assemble_visibility (tree decl, /* A helper function to call assemble_visibility when needed for a decl. */ -static void +int maybe_assemble_visibility (tree decl) { enum symbol_visibility vis = DECL_VISIBILITY (decl); if (vis != VISIBILITY_DEFAULT) - targetm.asm_out.visibility (decl, vis); + { + targetm.asm_out.visibility (decl, vis); + return 1; + } + else + return 0; } /* Returns 1 if the target configuration supports defining public symbols @@ -6224,4 +6227,19 @@ output_object_blocks (void) htab_traverse (object_block_htab, output_object_block_htab, NULL); } +/* Emit text to declare externally defined symbols. It is needed to + properly support non-default visibility. */ +void +default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED, + tree decl, + const char *name ATTRIBUTE_UNUSED) +{ + /* We output the name if and only if TREE_SYMBOL_REFERENCED is + set in order to avoid putting out names that are never really + used. */ + if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) + && targetm.binds_local_p (decl)) + maybe_assemble_visibility (decl); +} + #include "gt-varasm.h" From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 20:35:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46811106566B; Thu, 25 Nov 2010 20:35:50 +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 345588FC0C; Thu, 25 Nov 2010 20:35:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPKZoww016945; Thu, 25 Nov 2010 20:35:50 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPKZoNB016943; Thu, 25 Nov 2010 20:35:50 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201011252035.oAPKZoNB016943@svn.freebsd.org> From: Dimitry Andric Date: Thu, 25 Nov 2010 20:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215841 - head/contrib/gcc/config/ia64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 20:35:50 -0000 Author: dim Date: Thu Nov 25 20:35:49 2010 New Revision: 215841 URL: http://svn.freebsd.org/changeset/base/215841 Log: Now that the fix for gcc PR 20218 is applied, and hidden attributes actually work, linking of libgcc_s.so.1 on ia64 will fail with: unwind-ia64.So(.text+0x1762): In function `_Unwind_FindEnclosingFunction': : undefined reference to `_Unwind_FindTableEntry' unwind-ia64.So(.text+0x1d82): In function `uw_frame_state_for': : undefined reference to `_Unwind_FindTableEntry' /usr/bin/ld: libgcc_s.so.1: hidden symbol `_Unwind_FindTableEntry' isn't defined Repair this by not hiding the _Unwind_FindTableEntry symbol; on FreeBSD, it is in libc, not in libgcc. Silence from: current@ Modified: head/contrib/gcc/config/ia64/unwind-ia64.h Modified: head/contrib/gcc/config/ia64/unwind-ia64.h ============================================================================== --- head/contrib/gcc/config/ia64/unwind-ia64.h Thu Nov 25 20:29:14 2010 (r215840) +++ head/contrib/gcc/config/ia64/unwind-ia64.h Thu Nov 25 20:35:49 2010 (r215841) @@ -19,6 +19,13 @@ the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifdef __FreeBSD__ +/* On FreeBSD, _Unwind_FindTableEntry is in libc, and must not be hidden here. */ +#define ATTRIBUTE_HIDDEN +#else +#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) +#endif + struct unw_table_entry { unsigned long start_offset; @@ -29,4 +36,4 @@ struct unw_table_entry extern struct unw_table_entry * _Unwind_FindTableEntry (void *pc, unsigned long *segment_base, unsigned long *gp) - __attribute__ ((__visibility__ ("hidden"))); + ATTRIBUTE_HIDDEN; From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 21:51:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14496106566C; Thu, 25 Nov 2010 21:51:44 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 025D38FC0C; Thu, 25 Nov 2010 21:51:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPLph99018583; Thu, 25 Nov 2010 21:51:43 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPLphxd018581; Thu, 25 Nov 2010 21:51:43 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201011252151.oAPLphxd018581@svn.freebsd.org> From: Brian Somers Date: Thu, 25 Nov 2010 21:51:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215843 - head/sys/dev/asr X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 21:51:44 -0000 Author: brian Date: Thu Nov 25 21:51:43 2010 New Revision: 215843 URL: http://svn.freebsd.org/changeset/base/215843 Log: Don't zero 'Info' after setting it up in the ASR_IOCTL_COMPAT case. MFC after: 2 days Modified: head/sys/dev/asr/asr.c Modified: head/sys/dev/asr/asr.c ============================================================================== --- head/sys/dev/asr/asr.c Thu Nov 25 21:42:36 2010 (r215842) +++ head/sys/dev/asr/asr.c Thu Nov 25 21:51:43 2010 (r215843) @@ -3708,9 +3708,9 @@ asr_ioctl(struct cdev *dev, u_long cmd, Info.drive1CMOS = j; Info.numDrives = *((char *)ptok(0x475)); -#endif /* ASR_IOCTL_COMPAT */ - +#else /* ASR_IOCTL_COMPAT */ bzero(&Info, sizeof(Info)); +#endif /* ASR_IOCTL_COMPAT */ Info.processorFamily = ASR_sig.dsProcessorFamily; #if defined(__i386__) From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 22:06:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B3D41065670; Thu, 25 Nov 2010 22:06:08 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 290998FC08; Thu, 25 Nov 2010 22:06:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPM68e8018994; Thu, 25 Nov 2010 22:06:08 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPM68sj018992; Thu, 25 Nov 2010 22:06:08 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201011252206.oAPM68sj018992@svn.freebsd.org> From: Colin Percival Date: Thu, 25 Nov 2010 22:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215844 - head/sys/i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 22:06:08 -0000 Author: cperciva Date: Thu Nov 25 22:06:07 2010 New Revision: 215844 URL: http://svn.freebsd.org/changeset/base/215844 Log: Revert r215819 and fix the bug properly. In pmap_qremove, paging table updates were being queued by pmap_kremove, but the queue wasn't being flushed; as a result, the updates didn't happen until *after* the call to pmap_invalidate_range, and old entries could stick around in the TLB. Adding a PT_UPDATES_FLUSH() call immediately before pmap_invalidate_range ensures that after the invalidation the TLB will be repopulated with the correct new entries. Thanks to: kib, avg, alc Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Thu Nov 25 21:51:43 2010 (r215843) +++ head/sys/i386/xen/pmap.c Thu Nov 25 22:06:07 2010 (r215844) @@ -1292,19 +1292,7 @@ pmap_qenter(vm_offset_t sva, vm_page_t * mclp->args[0] = va; mclp->args[1] = (uint32_t)(pa & 0xffffffff); mclp->args[2] = (uint32_t)(pa >> 32); -#if 0 mclp->args[3] = (*pte & PG_V) ? UVMF_INVLPG|UVMF_ALL : 0; -#else - /* - * Somehow we seem to be ending up with pages which are in - * the TLB in spite of not having PG_V set, resulting in - * pages newly loaded into the bufcache not showing up - * immediately (i.e., accessing them provides the old data). - * As a workaround, always perform a TLB flush, even if the - * old page didn't have PG_V. - */ - mclp->args[3] = UVMF_INVLPG|UVMF_ALL; -#endif va += PAGE_SIZE; pte++; @@ -1348,6 +1336,7 @@ pmap_qremove(vm_offset_t sva, int count) pmap_kremove(va); va += PAGE_SIZE; } + PT_UPDATES_FLUSH(); pmap_invalidate_range(kernel_pmap, sva, va); critical_exit(); vm_page_unlock_queues(); From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 22:19:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3887106566B; Thu, 25 Nov 2010 22:19:40 +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 59EBC8FC0C; Thu, 25 Nov 2010 22:19:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPMJeda019351; Thu, 25 Nov 2010 22:19:40 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPMJea9019349; Thu, 25 Nov 2010 22:19:40 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201011252219.oAPMJea9019349@svn.freebsd.org> From: Dimitry Andric Date: Thu, 25 Nov 2010 22:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215845 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 22:19:40 -0000 Author: dim Date: Thu Nov 25 22:19:40 2010 New Revision: 215845 URL: http://svn.freebsd.org/changeset/base/215845 Log: Apply the same fix as in r215823 to sys/amd64/amd64/fpu.c: use unambiguous inline assembly to load a float variable. Modified: head/sys/amd64/amd64/fpu.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Thu Nov 25 22:06:07 2010 (r215844) +++ head/sys/amd64/amd64/fpu.c Thu Nov 25 22:19:40 2010 (r215845) @@ -567,7 +567,7 @@ fpu_clean_state(void) * the x87 stack, but we don't care since we're about to call * fxrstor() anyway. */ - __asm __volatile("ffree %%st(7); fld %0" : : "m" (dummy_variable)); + __asm __volatile("ffree %%st(7); flds %0" : : "m" (dummy_variable)); } /* From owner-svn-src-head@FreeBSD.ORG Thu Nov 25 22:56:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68154106564A; Thu, 25 Nov 2010 22:56:27 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BAC78FC12; Thu, 25 Nov 2010 22:56:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAPMuRLa020182; Thu, 25 Nov 2010 22:56:27 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAPMuR11020179; Thu, 25 Nov 2010 22:56:27 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201011252256.oAPMuR11020179@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 25 Nov 2010 22:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215846 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 22:56:27 -0000 Author: weongyo Date: Thu Nov 25 22:56:26 2010 New Revision: 215846 URL: http://svn.freebsd.org/changeset/base/215846 Log: Removes a unused function `usb_bus_find'. Modified: head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/usb_controller.h Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Thu Nov 25 22:19:40 2010 (r215845) +++ head/sys/dev/usb/controller/usb_controller.c Thu Nov 25 22:56:26 2010 (r215846) @@ -602,29 +602,3 @@ usb_bus_mem_free_all(struct usb_bus *bus mtx_destroy(&bus->bus_mtx); } -struct usb_bus * -usb_bus_find(const char *name) -{ - struct usb_bus *ubus; - devclass_t dc; - device_t *devlist; - int devcount, error, i; - const char *nameunit; - - dc = devclass_find("usbus"); - if (dc == NULL) - return (NULL); - error = devclass_get_devices(dc, &devlist, &devcount); - if (error != 0) - return (NULL); - for (i = 0; i < devcount; i++) { - nameunit = device_get_nameunit(devlist[i]); - if (!strncmp(name, nameunit, strlen(nameunit))) { - ubus = device_get_ivars(devlist[i]); - free(devlist, M_TEMP); - return (ubus); - } - } - free(devlist, M_TEMP); - return (NULL); -} Modified: head/sys/dev/usb/usb_controller.h ============================================================================== --- head/sys/dev/usb/usb_controller.h Thu Nov 25 22:19:40 2010 (r215845) +++ head/sys/dev/usb/usb_controller.h Thu Nov 25 22:56:26 2010 (r215846) @@ -221,6 +221,5 @@ void usb_bus_mem_free_all(struct usb_bus uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); uint16_t usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time); uint8_t usbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len); -struct usb_bus *usb_bus_find(const char *name); #endif /* _USB_CONTROLLER_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 01:48:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 451CA106566B; Fri, 26 Nov 2010 01:48:30 +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 33F5A8FC1C; Fri, 26 Nov 2010 01:48:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQ1mUG0023561; Fri, 26 Nov 2010 01:48:30 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQ1mUmR023558; Fri, 26 Nov 2010 01:48:30 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011260148.oAQ1mUmR023558@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 26 Nov 2010 01:48:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215847 - head/sys/dev/jme X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 01:48:30 -0000 Author: yongari Date: Fri Nov 26 01:48:29 2010 New Revision: 215847 URL: http://svn.freebsd.org/changeset/base/215847 Log: Disable retrying RX descriptor loading. The counter is used to set number of retry to be performed whenever controller found RX descriptor was empty. RX empty interrupt is generated only when the retry counter is over. Experimentation shows retrying RX descriptor loading increased number of dropped frames under flow-control enabled environments so disable it and have controller generate RX empty interrupt as fast as it can. While I'm here fix RXCSR_DESC_RT_CNT macro. Modified: head/sys/dev/jme/if_jmereg.h Modified: head/sys/dev/jme/if_jmereg.h ============================================================================== --- head/sys/dev/jme/if_jmereg.h Thu Nov 25 22:56:26 2010 (r215846) +++ head/sys/dev/jme/if_jmereg.h Fri Nov 26 01:48:29 2010 (r215847) @@ -275,8 +275,8 @@ #define RXCSR_RXQ2 2 #define RXCSR_RXQ3 3 #define RXCSR_DESC_RT_CNT(x) \ - ((((x) / 4) << RXCSR_DESC_RT_CNT_SHIFT) & RXCSR_DESC_RT_CNT_MASK) -#define RXCSR_DESC_RT_CNT_DEFAULT 32 + (((x) << RXCSR_DESC_RT_CNT_SHIFT) & RXCSR_DESC_RT_CNT_MASK) +#define RXCSR_DESC_RT_CNT_DEFAULT 0 /* Rx queue descriptor base address. 16bytes alignment needed. */ #define JME_RXDBA_LO 0x0024 From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 01:58:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4E3F1065679; Fri, 26 Nov 2010 01:58:25 +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 882BB8FC2A; Fri, 26 Nov 2010 01:58:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQ1wP95023838; Fri, 26 Nov 2010 01:58:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQ1wPVY023836; Fri, 26 Nov 2010 01:58:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011260158.oAQ1wPVY023836@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 26 Nov 2010 01:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215848 - head/sys/dev/jme X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 01:58:25 -0000 Author: yongari Date: Fri Nov 26 01:58:25 2010 New Revision: 215848 URL: http://svn.freebsd.org/changeset/base/215848 Log: Allocate 1 MSI/MSI-X vector. Originally jme(4) was designed to support multi-queue but the hardware limitation made it hard to implement supporting multi-queue. Allocating more than necessary vectors is resource waste and it can be added back when we implement multi-queue support. Modified: head/sys/dev/jme/if_jme.c Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Fri Nov 26 01:48:29 2010 (r215847) +++ head/sys/dev/jme/if_jme.c Fri Nov 26 01:58:25 2010 (r215848) @@ -201,13 +201,6 @@ static struct resource_spec jme_irq_spec static struct resource_spec jme_irq_spec_msi[] = { { SYS_RES_IRQ, 1, RF_ACTIVE }, - { SYS_RES_IRQ, 2, RF_ACTIVE }, - { SYS_RES_IRQ, 3, RF_ACTIVE }, - { SYS_RES_IRQ, 4, RF_ACTIVE }, - { SYS_RES_IRQ, 5, RF_ACTIVE }, - { SYS_RES_IRQ, 6, RF_ACTIVE }, - { SYS_RES_IRQ, 7, RF_ACTIVE }, - { SYS_RES_IRQ, 8, RF_ACTIVE }, { -1, 0, 0 } }; @@ -578,11 +571,16 @@ jme_attach(device_t dev) device_printf(dev, "MSI count : %d\n", msic); } + /* Use 1 MSI/MSI-X. */ + if (msixc > 1) + msixc = 1; + if (msic > 1) + msic = 1; /* Prefer MSIX over MSI. */ if (msix_disable == 0 || msi_disable == 0) { - if (msix_disable == 0 && msixc == JME_MSIX_MESSAGES && + if (msix_disable == 0 && msixc > 0 && pci_alloc_msix(dev, &msixc) == 0) { - if (msic == JME_MSIX_MESSAGES) { + if (msixc == 1) { device_printf(dev, "Using %d MSIX messages.\n", msixc); sc->jme_flags |= JME_FLAG_MSIX; @@ -591,9 +589,8 @@ jme_attach(device_t dev) pci_release_msi(dev); } if (msi_disable == 0 && (sc->jme_flags & JME_FLAG_MSIX) == 0 && - msic == JME_MSI_MESSAGES && - pci_alloc_msi(dev, &msic) == 0) { - if (msic == JME_MSI_MESSAGES) { + msic > 0 && pci_alloc_msi(dev, &msic) == 0) { + if (msic == 1) { device_printf(dev, "Using %d MSI messages.\n", msic); sc->jme_flags |= JME_FLAG_MSI; @@ -786,13 +783,7 @@ jme_attach(device_t dev) taskqueue_start_threads(&sc->jme_tq, 1, PI_NET, "%s taskq", device_get_nameunit(sc->jme_dev)); - if ((sc->jme_flags & JME_FLAG_MSIX) != 0) - msic = JME_MSIX_MESSAGES; - else if ((sc->jme_flags & JME_FLAG_MSI) != 0) - msic = JME_MSI_MESSAGES; - else - msic = 1; - for (i = 0; i < msic; i++) { + for (i = 0; i < 1; i++) { error = bus_setup_intr(dev, sc->jme_irq[i], INTR_TYPE_NET | INTR_MPSAFE, jme_intr, NULL, sc, &sc->jme_intrhand[i]); @@ -820,7 +811,7 @@ jme_detach(device_t dev) { struct jme_softc *sc; struct ifnet *ifp; - int i, msic; + int i; sc = device_get_softc(dev); @@ -855,14 +846,7 @@ jme_detach(device_t dev) sc->jme_ifp = NULL; } - msic = 1; - if ((sc->jme_flags & JME_FLAG_MSIX) != 0) - msic = JME_MSIX_MESSAGES; - else if ((sc->jme_flags & JME_FLAG_MSI) != 0) - msic = JME_MSI_MESSAGES; - else - msic = 1; - for (i = 0; i < msic; i++) { + for (i = 0; i < 1; i++) { if (sc->jme_intrhand[i] != NULL) { bus_teardown_intr(dev, sc->jme_irq[i], sc->jme_intrhand[i]); From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 02:01:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 517D41065693; Fri, 26 Nov 2010 02:01:17 +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 403DA8FC16; Fri, 26 Nov 2010 02:01:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQ21Hg4023957; Fri, 26 Nov 2010 02:01:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQ21H8l023955; Fri, 26 Nov 2010 02:01:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011260201.oAQ21H8l023955@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 26 Nov 2010 02:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215849 - head/sys/dev/jme X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 02:01:17 -0000 Author: yongari Date: Fri Nov 26 02:01:16 2010 New Revision: 215849 URL: http://svn.freebsd.org/changeset/base/215849 Log: Enable ethernet flow-control on all jme(4) controllers. Modified: head/sys/dev/jme/if_jme.c Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Fri Nov 26 01:58:25 2010 (r215848) +++ head/sys/dev/jme/if_jme.c Fri Nov 26 02:01:16 2010 (r215849) @@ -732,7 +732,7 @@ jme_attach(device_t dev) /* Set up MII bus. */ error = mii_attach(dev, &sc->jme_miibus, ifp, jme_mediachange, jme_mediastatus, BMSR_DEFCAPMASK, sc->jme_phyaddr, MII_OFFSET_ANY, - 0); + MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -2016,12 +2016,10 @@ jme_mac_config(struct jme_softc *sc) txmac &= ~(TXMAC_COLL_ENB | TXMAC_CARRIER_SENSE | TXMAC_BACKOFF | TXMAC_CARRIER_EXT | TXMAC_FRAME_BURST); -#ifdef notyet if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) txpause |= TXPFC_PAUSE_ENB; if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) rxmac |= RXMAC_FC_ENB; -#endif /* Disable retry transmit timer/retry limit. */ CSR_WRITE_4(sc, JME_TXTRHD, CSR_READ_4(sc, JME_TXTRHD) & ~(TXTRHD_RT_PERIOD_ENB | TXTRHD_RT_LIMIT_ENB)); From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 02:10:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF07A1065740; Fri, 26 Nov 2010 02:10:56 +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 ADA5A8FC0C; Fri, 26 Nov 2010 02:10:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQ2AuH6024160; Fri, 26 Nov 2010 02:10:56 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQ2AuB1024158; Fri, 26 Nov 2010 02:10:56 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011260210.oAQ2AuB1024158@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 26 Nov 2010 02:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215850 - head/sys/dev/alc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 02:10:56 -0000 Author: yongari Date: Fri Nov 26 02:10:56 2010 New Revision: 215850 URL: http://svn.freebsd.org/changeset/base/215850 Log: Enable ethernet flow-control on all alc(4) controllers. This change should reduce a lot of dropped frames under high network load. Modified: head/sys/dev/alc/if_alc.c Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Fri Nov 26 02:01:16 2010 (r215849) +++ head/sys/dev/alc/if_alc.c Fri Nov 26 02:10:56 2010 (r215850) @@ -974,7 +974,7 @@ alc_attach(device_t dev) /* Set up MII bus. */ error = mii_attach(dev, &sc->alc_miibus, ifp, alc_mediachange, alc_mediastatus, BMSR_DEFCAPMASK, sc->alc_phyaddr, MII_OFFSET_ANY, - 0); + MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -2475,12 +2475,10 @@ alc_mac_config(struct alc_softc *sc) } if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { reg |= MAC_CFG_FULL_DUPLEX; -#ifdef notyet if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) reg |= MAC_CFG_TX_FC; if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) reg |= MAC_CFG_RX_FC; -#endif } CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 04:26:37 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 689121065670; Fri, 26 Nov 2010 04:26:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 037A48FC14; Fri, 26 Nov 2010 04:26:36 +0000 (UTC) Received: from c122-106-145-124.carlnfd1.nsw.optusnet.com.au (c122-106-145-124.carlnfd1.nsw.optusnet.com.au [122.106.145.124]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id oAQ4QWnC012551 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 26 Nov 2010 15:26:35 +1100 Date: Fri, 26 Nov 2010 15:26:32 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao In-Reply-To: <201011251556.oAPFu5Lg009989@svn.freebsd.org> Message-ID: <20101126144637.S1417@besplex.bde.org> References: <201011251556.oAPFu5Lg009989@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r215821 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 04:26:37 -0000 On Thu, 25 Nov 2010, Attilio Rao wrote: > Log: > Add a missing CTL description from CVS revision 1.147. This compounds the bugs in rev.1.147. The description wasn't really missing, since the whole table (CTL_KERN_NAMES) is historical garbage that probably shouldn't exist and certainly shouldn't be added to. > Modified: head/sys/sys/sysctl.h > ============================================================================== > --- head/sys/sys/sysctl.h Thu Nov 25 15:42:33 2010 (r215820) > +++ head/sys/sys/sysctl.h Thu Nov 25 15:56:05 2010 (r215821) > @@ -452,6 +452,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e > { "logsigexit", CTLTYPE_INT }, \ > { "iov_max", CTLTYPE_INT }, \ > { "hostuuid", CTLTYPE_STRING }, \ > + { "arc4rand", CTLTYPE_OPAQUE }, \ > } > > /* > The error in rev.1.147 was adding the corresponding sysctl number KERN_ARND 12 years after hard-allocation of sysctl numbers were deprecated and 10 years after they became obsolete. OID_AUTO should have been used in the sysctl declaration, and sysctl.h shouldn't have been touched. Fortunately, KERN_ARND is still not documented in either sysctl.8 or sysctl.3, so it is properly unusable. The sysctl by name "arc4rand" is also undocumented in these man pages. Documentation of the numbers and names in the above man pages seems to stop at logsigexit in sysctl.8 and before that in sysctl.3 (sysctl.8 is easier to use for this comparison but harder to use normally since its strings are mostly unsorted in the same historical order as the numbers). The previous mistakes "hostuid" and "iov_max" visible in the above list are also still not documented in either of these man pages. Some historical dates: 1995: OID_AUTO 1997: sysctlbyname() (before this, OID_AUTO sysctls were only easy to use via sysctl(8) 1998: KERN_LOGSIGEXIT 2007: KERN_ARND 2010: "arc4rand". Bruce From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 08:11:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8046106566B; Fri, 26 Nov 2010 08:11:43 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C619C8FC14; Fri, 26 Nov 2010 08:11:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQ8Bhi1031941; Fri, 26 Nov 2010 08:11:43 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQ8BhnL031938; Fri, 26 Nov 2010 08:11:43 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011260811.oAQ8BhnL031938@svn.freebsd.org> From: Ulrich Spoerlein Date: Fri, 26 Nov 2010 08:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215854 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 08:11:43 -0000 Author: uqs Date: Fri Nov 26 08:11:43 2010 New Revision: 215854 URL: http://svn.freebsd.org/changeset/base/215854 Log: Remove kernel support for BB profiling, now that kernbb(8) is gone, too. PR: bin/83558 Reviewed by: jkim Modified: head/sys/amd64/amd64/support.S head/sys/i386/i386/support.s Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Fri Nov 26 05:29:19 2010 (r215853) +++ head/sys/amd64/amd64/support.S Fri Nov 26 08:11:43 2010 (r215854) @@ -700,25 +700,6 @@ ENTRY(longjmp) END(longjmp) /* - * Support for BB-profiling (gcc -a). The kernbb program will extract - * the data from the kernel. - */ - - .data - ALIGN_DATA - .globl bbhead -bbhead: - .quad 0 - - .text -NON_GPROF_ENTRY(__bb_init_func) - movq $1,(%rdi) - movq bbhead,%rax - movq %rax,32(%rdi) - movq %rdi,bbhead - NON_GPROF_RET - -/* * Support for reading MSRs in the safe manner. */ ENTRY(rdmsr_safe) Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Fri Nov 26 05:29:19 2010 (r215853) +++ head/sys/i386/i386/support.s Fri Nov 26 08:11:43 2010 (r215854) @@ -790,26 +790,6 @@ ENTRY(longjmp) END(longjmp) /* - * Support for BB-profiling (gcc -a). The kernbb program will extract - * the data from the kernel. - */ - - .data - ALIGN_DATA - .globl bbhead -bbhead: - .long 0 - - .text -NON_GPROF_ENTRY(__bb_init_func) - movl 4(%esp),%eax - movl $1,(%eax) - movl bbhead,%edx - movl %edx,16(%eax) - movl %eax,bbhead - NON_GPROF_RET - -/* * Support for reading MSRs in the safe manner. */ ENTRY(rdmsr_safe) From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 10:59:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9023106564A; Fri, 26 Nov 2010 10:59:20 +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 A60E98FC0A; Fri, 26 Nov 2010 10:59:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQAxKbL036957; Fri, 26 Nov 2010 10:59:20 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQAxKso036953; Fri, 26 Nov 2010 10:59:20 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201011261059.oAQAxKso036953@svn.freebsd.org> From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:59:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215856 - in head/sys: amd64/include i386/include x86/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 10:59:20 -0000 Author: tijl Date: Fri Nov 26 10:59:20 2010 New Revision: 215856 URL: http://svn.freebsd.org/changeset/base/215856 Log: Merge amd64/i386 _align.h by aligning on the size of register_t (copied from powerpc). Reviewed by: imp, jhb Approved by: kib (mentor) Added: head/sys/x86/include/_align.h - copied, changed from r215854, head/sys/powerpc/include/_align.h Modified: head/sys/amd64/include/_align.h head/sys/i386/include/_align.h Modified: head/sys/amd64/include/_align.h ============================================================================== --- head/sys/amd64/include/_align.h Fri Nov 26 10:57:52 2010 (r215855) +++ head/sys/amd64/include/_align.h Fri Nov 26 10:59:20 2010 (r215856) @@ -1,53 +1,6 @@ /*- - * Copyright (c) 2002 David E. O'Brien. All rights reserved. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. - * - * @(#)param.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _AMD64_INCLUDE__ALIGN_H_ -#define _AMD64_INCLUDE__ALIGN_H_ - -/* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is u_long and - * must be cast to any desired pointer type. - */ -#define _ALIGNBYTES (sizeof(long) - 1) -#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) - -#endif /* !_AMD64_INCLUDE__ALIGN_H_ */ +#include Modified: head/sys/i386/include/_align.h ============================================================================== --- head/sys/i386/include/_align.h Fri Nov 26 10:57:52 2010 (r215855) +++ head/sys/i386/include/_align.h Fri Nov 26 10:59:20 2010 (r215856) @@ -1,47 +1,6 @@ /*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * 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. - * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. - * - * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _I386_INCLUDE__ALIGN_H_ -#define _I386_INCLUDE__ALIGN_H_ - -/* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is unsigned int - * and must be cast to any desired pointer type. - */ -#define _ALIGNBYTES (sizeof(int) - 1) -#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) - -#endif /* !_I386_INCLUDE__ALIGN_H_ */ +#include Copied and modified: head/sys/x86/include/_align.h (from r215854, head/sys/powerpc/include/_align.h) ============================================================================== --- head/sys/powerpc/include/_align.h Fri Nov 26 08:11:43 2010 (r215854, copy source) +++ head/sys/x86/include/_align.h Fri Nov 26 10:59:20 2010 (r215856) @@ -38,8 +38,8 @@ * $FreeBSD$ */ -#ifndef _POWERPC_INCLUDE__ALIGN_H_ -#define _POWERPC_INCLUDE__ALIGN_H_ +#ifndef _X86_INCLUDE__ALIGN_H_ +#define _X86_INCLUDE__ALIGN_H_ /* * Round p (pointer or byte index) up to a correctly-aligned value @@ -49,4 +49,4 @@ #define _ALIGNBYTES (sizeof(register_t) - 1) #define _ALIGN(p) (((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) -#endif /* !_POWERPC_INCLUDE__ALIGN_H_ */ +#endif /* !_X86_INCLUDE__ALIGN_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 11:57:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D318E106566B; Fri, 26 Nov 2010 11:57:45 +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 A6DC58FC14; Fri, 26 Nov 2010 11:57:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQBvjPi038473; Fri, 26 Nov 2010 11:57:45 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQBvjGP038471; Fri, 26 Nov 2010 11:57:45 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201011261157.oAQBvjGP038471@svn.freebsd.org> From: Tijl Coosemans Date: Fri, 26 Nov 2010 11:57:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215863 - head/sys/pc98/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 11:57:45 -0000 Author: tijl Date: Fri Nov 26 11:57:45 2010 New Revision: 215863 URL: http://svn.freebsd.org/changeset/base/215863 Log: Include x86/_align.h directly instead of including the i386 header. Approved by: kib (mentor) Modified: head/sys/pc98/include/_align.h Modified: head/sys/pc98/include/_align.h ============================================================================== --- head/sys/pc98/include/_align.h Fri Nov 26 11:55:51 2010 (r215862) +++ head/sys/pc98/include/_align.h Fri Nov 26 11:57:45 2010 (r215863) @@ -1,29 +1,6 @@ /*- - * Copyright (c) 2005 TAKAHASHI Yoshihiro. - * 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$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#include +#include From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 14:35:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA362106566C; Fri, 26 Nov 2010 14:35:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D816C8FC15; Fri, 26 Nov 2010 14:35:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQEZKdK047257; Fri, 26 Nov 2010 14:35:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQEZKxk047253; Fri, 26 Nov 2010 14:35:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011261435.oAQEZKxk047253@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 26 Nov 2010 14:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215864 - head/sys/crypto/via X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 14:35:21 -0000 Author: kib Date: Fri Nov 26 14:35:20 2010 New Revision: 215864 URL: http://svn.freebsd.org/changeset/base/215864 Log: MFaesni r215427: Only save FPU context when not executing in the context of the crypto thread. Tested by: Mike Tancsa MFC after: 1 week Modified: head/sys/crypto/via/padlock.c head/sys/crypto/via/padlock_cipher.c head/sys/crypto/via/padlock_hash.c Modified: head/sys/crypto/via/padlock.c ============================================================================== --- head/sys/crypto/via/padlock.c Fri Nov 26 11:57:45 2010 (r215863) +++ head/sys/crypto/via/padlock.c Fri Nov 26 14:35:20 2010 (r215864) @@ -170,7 +170,7 @@ padlock_newsession(device_t dev, uint32_ struct padlock_session *ses = NULL; struct cryptoini *encini, *macini; struct thread *td; - int error; + int error, saved_ctx; if (sidp == NULL || cri == NULL) return (EINVAL); @@ -238,10 +238,18 @@ padlock_newsession(device_t dev, uint32_ if (macini != NULL) { td = curthread; - error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); + if (!is_fpu_kern_thread(0)) { + error = fpu_kern_enter(td, &ses->ses_fpu_ctx, + FPU_KERN_NORMAL); + saved_ctx = 1; + } else { + error = 0; + saved_ctx = 0; + } if (error == 0) { error = padlock_hash_setup(ses, macini); - fpu_kern_leave(td, &ses->ses_fpu_ctx); + if (saved_ctx) + fpu_kern_leave(td, &ses->ses_fpu_ctx); } if (error != 0) { padlock_freesession_one(sc, ses, 0); Modified: head/sys/crypto/via/padlock_cipher.c ============================================================================== --- head/sys/crypto/via/padlock_cipher.c Fri Nov 26 11:57:45 2010 (r215863) +++ head/sys/crypto/via/padlock_cipher.c Fri Nov 26 14:35:20 2010 (r215864) @@ -205,7 +205,7 @@ padlock_cipher_process(struct padlock_se struct thread *td; u_char *buf, *abuf; uint32_t *key; - int allocated, error; + int allocated, error, saved_ctx; buf = padlock_cipher_alloc(enccrd, crp, &allocated); if (buf == NULL) @@ -250,14 +250,21 @@ padlock_cipher_process(struct padlock_se } td = curthread; - error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); + if (!is_fpu_kern_thread(0)) { + error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); + saved_ctx = 1; + } else { + error = 0; + saved_ctx = 0; + } if (error != 0) goto out; padlock_cbc(abuf, abuf, enccrd->crd_len / AES_BLOCK_LEN, key, cw, ses->ses_iv); - fpu_kern_leave(td, &ses->ses_fpu_ctx); + if (saved_ctx) + fpu_kern_leave(td, &ses->ses_fpu_ctx); if (allocated) { crypto_copyback(crp->crp_flags, crp->crp_buf, enccrd->crd_skip, Modified: head/sys/crypto/via/padlock_hash.c ============================================================================== --- head/sys/crypto/via/padlock_hash.c Fri Nov 26 11:57:45 2010 (r215863) +++ head/sys/crypto/via/padlock_hash.c Fri Nov 26 14:35:20 2010 (r215864) @@ -366,17 +366,24 @@ padlock_hash_process(struct padlock_sess struct cryptop *crp) { struct thread *td; - int error; + int error, saved_ctx; td = curthread; - error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); + if (!is_fpu_kern_thread(0)) { + error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); + saved_ctx = 1; + } else { + error = 0; + saved_ctx = 0; + } if (error != 0) return (error); if ((maccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) padlock_hash_key_setup(ses, maccrd->crd_key, maccrd->crd_klen); error = padlock_authcompute(ses, maccrd, crp->crp_buf, crp->crp_flags); - fpu_kern_leave(td, &ses->ses_fpu_ctx); + if (saved_ctx) + fpu_kern_leave(td, &ses->ses_fpu_ctx); return (error); } From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 14:50:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD638106566C; Fri, 26 Nov 2010 14:50:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 990F98FC0A; Fri, 26 Nov 2010 14:50:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQEogU5048338; Fri, 26 Nov 2010 14:50:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQEogmq048328; Fri, 26 Nov 2010 14:50:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011261450.oAQEogmq048328@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 26 Nov 2010 14:50:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215865 - in head/sys: amd64/amd64 amd64/ia32 amd64/include i386/i386 i386/include i386/isa pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 14:50:42 -0000 Author: kib Date: Fri Nov 26 14:50:42 2010 New Revision: 215865 URL: http://svn.freebsd.org/changeset/base/215865 Log: Remove npxgetregs(), npxsetregs(), fpugetregs() and fpusetregs() functions, they are unused. Remove 'user' from npxgetuserregs() etc. names. For {npx,fpu}{get,set}regs(), always use pcb->pcb_user_save for FPU context storage. This eliminates the need for ugly copying with overwrite of the newly added and reserved fields in ucontext on i386 to satisfy alignment requirements for fpusave() and fpurstor(). pc98 version was copied from i386. Suggested and reviewed by: bde Tested by: pho (i386 and amd64) MFC after: 1 week Modified: head/sys/amd64/amd64/fpu.c head/sys/amd64/amd64/machdep.c head/sys/amd64/ia32/ia32_reg.c head/sys/amd64/ia32/ia32_signal.c head/sys/amd64/include/fpu.h head/sys/i386/i386/machdep.c head/sys/i386/include/npx.h head/sys/i386/isa/npx.c head/sys/pc98/pc98/machdep.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Fri Nov 26 14:35:20 2010 (r215864) +++ head/sys/amd64/amd64/fpu.c Fri Nov 26 14:50:42 2010 (r215865) @@ -426,9 +426,7 @@ fpudna(void) fxrstor(&fpu_initialstate); if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__) fldcw(pcb->pcb_initial_fpucw); - pcb->pcb_flags |= PCB_FPUINITDONE; - if (PCB_USER_FPU(pcb)) - pcb->pcb_flags |= PCB_USERFPUINITDONE; + fpuuserinited(curthread); } else fxrstor(pcb->pcb_save); critical_exit(); @@ -448,60 +446,50 @@ fpudrop() } /* - * Get the state of the FPU without dropping ownership (if possible). - * It returns the FPU ownership status. + * Get the user state of the FPU into pcb->pcb_user_save without + * dropping ownership (if possible). It returns the FPU ownership + * status. */ int -fpugetuserregs(struct thread *td, struct savefpu *addr) +fpugetregs(struct thread *td) { struct pcb *pcb; pcb = td->td_pcb; if ((pcb->pcb_flags & PCB_USERFPUINITDONE) == 0) { - bcopy(&fpu_initialstate, addr, sizeof(fpu_initialstate)); - addr->sv_env.en_cw = pcb->pcb_initial_fpucw; - return (_MC_FPOWNED_NONE); + bcopy(&fpu_initialstate, &pcb->pcb_user_save, + sizeof(fpu_initialstate)); + pcb->pcb_user_save.sv_env.en_cw = pcb->pcb_initial_fpucw; + fpuuserinited(td); + return (_MC_FPOWNED_PCB); } critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { - fxsave(addr); + fxsave(&pcb->pcb_user_save); critical_exit(); return (_MC_FPOWNED_FPU); } else { critical_exit(); - bcopy(&pcb->pcb_user_save, addr, sizeof(*addr)); return (_MC_FPOWNED_PCB); } } -int -fpugetregs(struct thread *td, struct savefpu *addr) +void +fpuuserinited(struct thread *td) { struct pcb *pcb; pcb = td->td_pcb; - if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) { - bcopy(&fpu_initialstate, addr, sizeof(fpu_initialstate)); - addr->sv_env.en_cw = pcb->pcb_initial_fpucw; - return (_MC_FPOWNED_NONE); - } - critical_enter(); - if (td == PCPU_GET(fpcurthread)) { - fxsave(addr); - critical_exit(); - return (_MC_FPOWNED_FPU); - } else { - critical_exit(); - bcopy(pcb->pcb_save, addr, sizeof(*addr)); - return (_MC_FPOWNED_PCB); - } + if (PCB_USER_FPU(pcb)) + pcb->pcb_flags |= PCB_FPUINITDONE; + pcb->pcb_flags |= PCB_USERFPUINITDONE; } /* * Set the state of the FPU. */ void -fpusetuserregs(struct thread *td, struct savefpu *addr) +fpusetregs(struct thread *td, struct savefpu *addr) { struct pcb *pcb; @@ -514,31 +502,10 @@ fpusetuserregs(struct thread *td, struct } else { critical_exit(); bcopy(addr, &td->td_pcb->pcb_user_save, sizeof(*addr)); - if (PCB_USER_FPU(pcb)) - pcb->pcb_flags |= PCB_FPUINITDONE; - pcb->pcb_flags |= PCB_USERFPUINITDONE; + fpuuserinited(td); } } -void -fpusetregs(struct thread *td, struct savefpu *addr) -{ - struct pcb *pcb; - - pcb = td->td_pcb; - critical_enter(); - if (td == PCPU_GET(fpcurthread)) { - fxrstor(addr); - critical_exit(); - } else { - critical_exit(); - bcopy(addr, td->td_pcb->pcb_save, sizeof(*addr)); - } - if (PCB_USER_FPU(pcb)) - pcb->pcb_flags |= PCB_USERFPUINITDONE; - pcb->pcb_flags |= PCB_FPUINITDONE; -} - /* * On AuthenticAMD processors, the fxrstor instruction does not restore * the x87's stored last instruction pointer, last data pointer, and last Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Fri Nov 26 14:35:20 2010 (r215864) +++ head/sys/amd64/amd64/machdep.c Fri Nov 26 14:50:42 2010 (r215865) @@ -1975,6 +1975,8 @@ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { + KASSERT(TD_IS_SUSPENDED(td), ("not suspended thread %p", td)); + fpugetregs(td); fill_fpregs_xmm(&td->td_pcb->pcb_user_save, fpregs); return (0); } @@ -1985,6 +1987,7 @@ set_fpregs(struct thread *td, struct fpr { set_fpregs_xmm(fpregs, &td->td_pcb->pcb_user_save); + fpuuserinited(td); return (0); } @@ -2099,8 +2102,9 @@ static void get_fpcontext(struct thread *td, mcontext_t *mcp) { - mcp->mc_ownedfp = fpugetuserregs(td, - (struct savefpu *)&mcp->mc_fpstate); + mcp->mc_ownedfp = fpugetregs(td); + bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate, + sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); } @@ -2120,7 +2124,7 @@ set_fpcontext(struct thread *td, const m mcp->mc_ownedfp == _MC_FPOWNED_PCB) { fpstate = (struct savefpu *)&mcp->mc_fpstate; fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask; - fpusetuserregs(td, fpstate); + fpusetregs(td, fpstate); } else return (EINVAL); return (0); Modified: head/sys/amd64/ia32/ia32_reg.c ============================================================================== --- head/sys/amd64/ia32/ia32_reg.c Fri Nov 26 14:35:20 2010 (r215864) +++ head/sys/amd64/ia32/ia32_reg.c Fri Nov 26 14:50:42 2010 (r215865) @@ -145,13 +145,18 @@ set_regs32(struct thread *td, struct reg int fill_fpregs32(struct thread *td, struct fpreg32 *regs) { - struct save87 *sv_87 = (struct save87 *)regs; - struct env87 *penv_87 = &sv_87->sv_env; - struct savefpu *sv_fpu = &td->td_pcb->pcb_user_save; - struct envxmm *penv_xmm = &sv_fpu->sv_env; + struct savefpu *sv_fpu; + struct save87 *sv_87; + struct env87 *penv_87; + struct envxmm *penv_xmm; int i; bzero(regs, sizeof(*regs)); + sv_87 = (struct save87 *)regs; + penv_87 = &sv_87->sv_env; + fpugetregs(td); + sv_fpu = &td->td_pcb->pcb_user_save; + penv_xmm = &sv_fpu->sv_env; /* FPU control/status */ penv_87->en_cw = penv_xmm->en_cw; @@ -200,6 +205,7 @@ set_fpregs32(struct thread *td, struct f sv_fpu->sv_fp[i].fp_acc = sv_87->sv_ac[i]; for (i = 8; i < 16; ++i) bzero(&sv_fpu->sv_fp[i].fp_acc, sizeof(sv_fpu->sv_fp[i].fp_acc)); + fpuuserinited(td); return (0); } Modified: head/sys/amd64/ia32/ia32_signal.c ============================================================================== --- head/sys/amd64/ia32/ia32_signal.c Fri Nov 26 14:35:20 2010 (r215864) +++ head/sys/amd64/ia32/ia32_signal.c Fri Nov 26 14:50:42 2010 (r215865) @@ -99,8 +99,9 @@ ia32_get_fpcontext(struct thread *td, st * 64bit instruction and data pointers. Ignore the difference * for now, it should be irrelevant for most applications. */ - mcp->mc_ownedfp = fpugetuserregs(td, - (struct savefpu *)&mcp->mc_fpstate); + mcp->mc_ownedfp = fpugetregs(td); + bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate, + sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); } @@ -117,7 +118,7 @@ ia32_set_fpcontext(struct thread *td, co fpstate_drop(td); else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || mcp->mc_ownedfp == _MC_FPOWNED_PCB) { - fpusetuserregs(td, (struct savefpu *)&mcp->mc_fpstate); + fpusetregs(td, (struct savefpu *)&mcp->mc_fpstate); } else return (EINVAL); return (0); Modified: head/sys/amd64/include/fpu.h ============================================================================== --- head/sys/amd64/include/fpu.h Fri Nov 26 14:35:20 2010 (r215864) +++ head/sys/amd64/include/fpu.h Fri Nov 26 14:50:42 2010 (r215865) @@ -112,12 +112,11 @@ void fpudna(void); void fpudrop(void); void fpuexit(struct thread *td); int fpuformat(void); -int fpugetregs(struct thread *td, struct savefpu *addr); -int fpugetuserregs(struct thread *td, struct savefpu *addr); +int fpugetregs(struct thread *td); void fpuinit(void); void fpusetregs(struct thread *td, struct savefpu *addr); -void fpusetuserregs(struct thread *td, struct savefpu *addr); int fputrap(void); +void fpuuserinited(struct thread *td); int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags); int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Fri Nov 26 14:35:20 2010 (r215864) +++ head/sys/i386/i386/machdep.c Fri Nov 26 14:50:42 2010 (r215865) @@ -633,13 +633,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sf.sf_uc.uc_mcontext.mc_gs = rgs(); bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs)); sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ - - /* - * The get_fpcontext() call must be placed before assignments - * to mc_fsbase and mc_gsbase due to the alignment-override - * code in get_fpcontext() that possibly clobbers 12 bytes of - * mcontext after mc_fpstate. - */ get_fpcontext(td, &sf.sf_uc.uc_mcontext); fpstate_drop(td); /* @@ -3209,28 +3202,33 @@ set_fpregs_xmm(sv_87, sv_xmm) int fill_fpregs(struct thread *td, struct fpreg *fpregs) { + + KASSERT(TD_IS_SUSPENDED(td), ("not suspended thread %p", td)); + npxgetregs(td); #ifdef CPU_ENABLE_SSE - if (cpu_fxsr) { + if (cpu_fxsr) fill_fpregs_xmm(&td->td_pcb->pcb_user_save.sv_xmm, - (struct save87 *)fpregs); - return (0); - } + (struct save87 *)fpregs); + else #endif /* CPU_ENABLE_SSE */ - bcopy(&td->td_pcb->pcb_user_save.sv_87, fpregs, sizeof *fpregs); + bcopy(&td->td_pcb->pcb_user_save.sv_87, fpregs, + sizeof(*fpregs)); return (0); } int set_fpregs(struct thread *td, struct fpreg *fpregs) { + #ifdef CPU_ENABLE_SSE - if (cpu_fxsr) { + if (cpu_fxsr) set_fpregs_xmm((struct save87 *)fpregs, &td->td_pcb->pcb_user_save.sv_xmm); - return (0); - } + else #endif /* CPU_ENABLE_SSE */ - bcopy(fpregs, &td->td_pcb->pcb_user_save.sv_87, sizeof *fpregs); + bcopy(fpregs, &td->td_pcb->pcb_user_save.sv_87, + sizeof(*fpregs)); + npxuserinited(td); return (0); } @@ -3272,13 +3270,6 @@ get_mcontext(struct thread *td, mcontext mcp->mc_esp = tp->tf_esp; mcp->mc_ss = tp->tf_ss; mcp->mc_len = sizeof(*mcp); - - /* - * The get_fpcontext() call must be placed before assignments - * to mc_fsbase and mc_gsbase due to the alignment-override - * code in get_fpcontext() that possibly clobbers 12 bytes of - * mcontext after mc_fpstate. - */ get_fpcontext(td, mcp); sdp = &td->td_pcb->pcb_fsd; mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; @@ -3329,39 +3320,14 @@ set_mcontext(struct thread *td, const mc static void get_fpcontext(struct thread *td, mcontext_t *mcp) { + #ifndef DEV_NPX mcp->mc_fpformat = _MC_FPFMT_NODEV; mcp->mc_ownedfp = _MC_FPOWNED_NONE; #else - union savefpu *addr; - - /* - * XXX mc_fpstate might be misaligned, since its declaration is not - * unportabilized using __attribute__((aligned(16))) like the - * declaration of struct savemm, and anyway, alignment doesn't work - * for auto variables since we don't use gcc's pessimal stack - * alignment. Work around this by abusing the spare fields after - * mcp->mc_fpstate. - * - * XXX unpessimize most cases by only aligning when fxsave might be - * called, although this requires knowing too much about - * npxgetuserregs()'s internals. - */ - addr = (union savefpu *)&mcp->mc_fpstate; - if (td == PCPU_GET(fpcurthread) && -#ifdef CPU_ENABLE_SSE - cpu_fxsr && -#endif - ((uintptr_t)(void *)addr & 0xF)) { - do - addr = (void *)((char *)addr + 4); - while ((uintptr_t)(void *)addr & 0xF); - } - mcp->mc_ownedfp = npxgetuserregs(td, addr); - if (addr != (union savefpu *)&mcp->mc_fpstate) { - bcopy(addr, &mcp->mc_fpstate, sizeof(mcp->mc_fpstate)); - bzero(&mcp->mc_spare2, sizeof(mcp->mc_spare2)); - } + mcp->mc_ownedfp = npxgetregs(td); + bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate, + sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = npxformat(); #endif } @@ -3369,7 +3335,6 @@ get_fpcontext(struct thread *td, mcontex static int set_fpcontext(struct thread *td, const mcontext_t *mcp) { - union savefpu *addr; if (mcp->mc_fpformat == _MC_FPFMT_NODEV) return (0); @@ -3381,30 +3346,14 @@ set_fpcontext(struct thread *td, const m fpstate_drop(td); else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || mcp->mc_ownedfp == _MC_FPOWNED_PCB) { - /* XXX align as above. */ - addr = (union savefpu *)&mcp->mc_fpstate; - if (td == PCPU_GET(fpcurthread) && -#ifdef CPU_ENABLE_SSE - cpu_fxsr && -#endif - ((uintptr_t)(void *)addr & 0xF)) { - do - addr = (void *)((char *)addr + 4); - while ((uintptr_t)(void *)addr & 0xF); - bcopy(&mcp->mc_fpstate, addr, sizeof(mcp->mc_fpstate)); - } #ifdef DEV_NPX #ifdef CPU_ENABLE_SSE if (cpu_fxsr) - addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; + ((union savefpu *)&mcp->mc_fpstate)->sv_xmm.sv_env. + en_mxcsr &= cpu_mxcsr_mask; #endif - npxsetuserregs(td, addr); + npxsetregs(td, (union savefpu *)&mcp->mc_fpstate); #endif - /* - * Don't bother putting things back where they were in the - * misaligned case, since we know that the caller won't use - * them again. - */ } else return (EINVAL); return (0); @@ -3422,12 +3371,12 @@ fpstate_drop(struct thread *td) #endif /* * XXX force a full drop of the npx. The above only drops it if we - * owned it. npxgetuserregs() has the same bug in the !cpu_fxsr case. + * owned it. npxgetregs() has the same bug in the !cpu_fxsr case. * - * XXX I don't much like npxgetuserregs()'s semantics of doing a full + * XXX I don't much like npxgetregs()'s semantics of doing a full * drop. Dropping only to the pcb matches fnsave's behaviour. * We only need to drop to !PCB_INITDONE in sendsig(). But - * sendsig() is the only caller of npxgetuserregs()... perhaps we just + * sendsig() is the only caller of npxgetregs()... perhaps we just * have too many layers. */ curthread->td_pcb->pcb_flags &= ~(PCB_NPXINITDONE | Modified: head/sys/i386/include/npx.h ============================================================================== --- head/sys/i386/include/npx.h Fri Nov 26 14:35:20 2010 (r215864) +++ head/sys/i386/include/npx.h Fri Nov 26 14:50:42 2010 (r215865) @@ -151,13 +151,12 @@ int npxdna(void); void npxdrop(void); void npxexit(struct thread *td); int npxformat(void); -int npxgetregs(struct thread *td, union savefpu *addr); -int npxgetuserregs(struct thread *td, union savefpu *addr); +int npxgetregs(struct thread *td); void npxinit(void); void npxsave(union savefpu *addr); void npxsetregs(struct thread *td, union savefpu *addr); -void npxsetuserregs(struct thread *td, union savefpu *addr); int npxtrap(void); +void npxuserinited(struct thread *); int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags); int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Fri Nov 26 14:35:20 2010 (r215864) +++ head/sys/i386/isa/npx.c Fri Nov 26 14:50:42 2010 (r215865) @@ -684,9 +684,7 @@ npxdna(void) fpurstor(&npx_initialstate); if (pcb->pcb_initial_npxcw != __INITIAL_NPXCW__) fldcw(pcb->pcb_initial_npxcw); - pcb->pcb_flags |= PCB_NPXINITDONE; - if (PCB_USER_FPU(pcb)) - pcb->pcb_flags |= PCB_NPXUSERINITDONE; + npxuserinited(curthread); } else { /* * The following fpurstor() may cause an IRQ13 when the @@ -767,11 +765,12 @@ npxdrop() } /* - * Get the state of the FPU without dropping ownership (if possible). - * It returns the FPU ownership status. + * Get the user state of the FPU into pcb->pcb_user_save without + * dropping ownership (if possible). It returns the FPU ownership + * status. */ int -npxgetregs(struct thread *td, union savefpu *addr) +npxgetregs(struct thread *td) { struct pcb *pcb; @@ -780,48 +779,15 @@ npxgetregs(struct thread *td, union save pcb = td->td_pcb; if ((pcb->pcb_flags & PCB_NPXINITDONE) == 0) { - bcopy(&npx_initialstate, addr, sizeof(npx_initialstate)); - SET_FPU_CW(addr, pcb->pcb_initial_npxcw); - return (_MC_FPOWNED_NONE); - } - critical_enter(); - if (td == PCPU_GET(fpcurthread)) { - fpusave(addr); -#ifdef CPU_ENABLE_SSE - if (!cpu_fxsr) -#endif - /* - * fnsave initializes the FPU and destroys whatever - * context it contains. Make sure the FPU owner - * starts with a clean state next time. - */ - npxdrop(); - critical_exit(); - return (_MC_FPOWNED_FPU); - } else { - critical_exit(); - bcopy(pcb->pcb_save, addr, sizeof(*addr)); + bcopy(&npx_initialstate, &pcb->pcb_user_save, + sizeof(npx_initialstate)); + SET_FPU_CW(&pcb->pcb_user_save, pcb->pcb_initial_npxcw); + npxuserinited(td); return (_MC_FPOWNED_PCB); } -} - -int -npxgetuserregs(struct thread *td, union savefpu *addr) -{ - struct pcb *pcb; - - if (!hw_float) - return (_MC_FPOWNED_NONE); - - pcb = td->td_pcb; - if ((pcb->pcb_flags & PCB_NPXUSERINITDONE) == 0) { - bcopy(&npx_initialstate, addr, sizeof(npx_initialstate)); - SET_FPU_CW(addr, pcb->pcb_initial_npxcw); - return (_MC_FPOWNED_NONE); - } critical_enter(); - if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { - fpusave(addr); + if (td == PCPU_GET(fpcurthread)) { + fpusave(&pcb->pcb_user_save); #ifdef CPU_ENABLE_SSE if (!cpu_fxsr) #endif @@ -835,42 +801,24 @@ npxgetuserregs(struct thread *td, union return (_MC_FPOWNED_FPU); } else { critical_exit(); - bcopy(&pcb->pcb_user_save, addr, sizeof(*addr)); return (_MC_FPOWNED_PCB); } } -/* - * Set the state of the FPU. - */ void -npxsetregs(struct thread *td, union savefpu *addr) +npxuserinited(struct thread *td) { struct pcb *pcb; - if (!hw_float) - return; - pcb = td->td_pcb; - critical_enter(); - if (td == PCPU_GET(fpcurthread)) { -#ifdef CPU_ENABLE_SSE - if (!cpu_fxsr) -#endif - fnclex(); /* As in npxdrop(). */ - fpurstor(addr); - critical_exit(); - } else { - critical_exit(); - bcopy(addr, pcb->pcb_save, sizeof(*addr)); - } if (PCB_USER_FPU(pcb)) - pcb->pcb_flags |= PCB_NPXUSERINITDONE; - pcb->pcb_flags |= PCB_NPXINITDONE; + pcb->pcb_flags |= PCB_NPXINITDONE; + pcb->pcb_flags |= PCB_NPXUSERINITDONE; } + void -npxsetuserregs(struct thread *td, union savefpu *addr) +npxsetregs(struct thread *td, union savefpu *addr) { struct pcb *pcb; @@ -884,15 +832,17 @@ npxsetuserregs(struct thread *td, union if (!cpu_fxsr) #endif fnclex(); /* As in npxdrop(). */ - fpurstor(addr); + if (((uintptr_t)addr & 0xf) != 0) { + bcopy(addr, &pcb->pcb_user_save, sizeof(*addr)); + fpurstor(&pcb->pcb_user_save); + } else + fpurstor(addr); critical_exit(); pcb->pcb_flags |= PCB_NPXUSERINITDONE | PCB_NPXINITDONE; } else { critical_exit(); bcopy(addr, &pcb->pcb_user_save, sizeof(*addr)); - if (PCB_USER_FPU(pcb)) - pcb->pcb_flags |= PCB_NPXINITDONE; - pcb->pcb_flags |= PCB_NPXUSERINITDONE; + npxuserinited(td); } } Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Fri Nov 26 14:35:20 2010 (r215864) +++ head/sys/pc98/pc98/machdep.c Fri Nov 26 14:50:42 2010 (r215865) @@ -568,13 +568,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sf.sf_uc.uc_mcontext.mc_gs = rgs(); bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs)); sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ - - /* - * The get_fpcontext() call must be placed before assignments - * to mc_fsbase and mc_gsbase due to the alignment-override - * code in get_fpcontext() that possibly clobbers 12 bytes of - * mcontext after mc_fpstate. - */ get_fpcontext(td, &sf.sf_uc.uc_mcontext); fpstate_drop(td); /* @@ -2553,28 +2546,33 @@ set_fpregs_xmm(sv_87, sv_xmm) int fill_fpregs(struct thread *td, struct fpreg *fpregs) { + + KASSERT(TD_IS_SUSPENDED(td), ("not suspended thread %p", td)); + npxgetregs(td); #ifdef CPU_ENABLE_SSE - if (cpu_fxsr) { - fill_fpregs_xmm(&td->td_pcb->pcb_save->sv_xmm, - (struct save87 *)fpregs); - return (0); - } + if (cpu_fxsr) + fill_fpregs_xmm(&td->td_pcb->pcb_user_save.sv_xmm, + (struct save87 *)fpregs); + else #endif /* CPU_ENABLE_SSE */ - bcopy(&td->td_pcb->pcb_save->sv_87, fpregs, sizeof *fpregs); + bcopy(&td->td_pcb->pcb_user_save.sv_87, fpregs, + sizeof(*fpregs)); return (0); } int set_fpregs(struct thread *td, struct fpreg *fpregs) { + #ifdef CPU_ENABLE_SSE - if (cpu_fxsr) { + if (cpu_fxsr) set_fpregs_xmm((struct save87 *)fpregs, - &td->td_pcb->pcb_save->sv_xmm); - return (0); - } + &td->td_pcb->pcb_user_save.sv_xmm); + else #endif /* CPU_ENABLE_SSE */ - bcopy(fpregs, &td->td_pcb->pcb_save->sv_87, sizeof *fpregs); + bcopy(fpregs, &td->td_pcb->pcb_user_save.sv_87, + sizeof(*fpregs)); + npxuserinited(td); return (0); } @@ -2616,13 +2614,6 @@ get_mcontext(struct thread *td, mcontext mcp->mc_esp = tp->tf_esp; mcp->mc_ss = tp->tf_ss; mcp->mc_len = sizeof(*mcp); - - /* - * The get_fpcontext() call must be placed before assignments - * to mc_fsbase and mc_gsbase due to the alignment-override - * code in get_fpcontext() that possibly clobbers 12 bytes of - * mcontext after mc_fpstate. - */ get_fpcontext(td, mcp); sdp = &td->td_pcb->pcb_fsd; mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; @@ -2673,39 +2664,14 @@ set_mcontext(struct thread *td, const mc static void get_fpcontext(struct thread *td, mcontext_t *mcp) { + #ifndef DEV_NPX mcp->mc_fpformat = _MC_FPFMT_NODEV; mcp->mc_ownedfp = _MC_FPOWNED_NONE; #else - union savefpu *addr; - - /* - * XXX mc_fpstate might be misaligned, since its declaration is not - * unportabilized using __attribute__((aligned(16))) like the - * declaration of struct savemm, and anyway, alignment doesn't work - * for auto variables since we don't use gcc's pessimal stack - * alignment. Work around this by abusing the spare fields after - * mcp->mc_fpstate. - * - * XXX unpessimize most cases by only aligning when fxsave might be - * called, although this requires knowing too much about - * npxgetuserregs()'s internals. - */ - addr = (union savefpu *)&mcp->mc_fpstate; - if (td == PCPU_GET(fpcurthread) && -#ifdef CPU_ENABLE_SSE - cpu_fxsr && -#endif - ((uintptr_t)(void *)addr & 0xF)) { - do - addr = (void *)((char *)addr + 4); - while ((uintptr_t)(void *)addr & 0xF); - } - mcp->mc_ownedfp = npxgetuserregs(td, addr); - if (addr != (union savefpu *)&mcp->mc_fpstate) { - bcopy(addr, &mcp->mc_fpstate, sizeof(mcp->mc_fpstate)); - bzero(&mcp->mc_spare2, sizeof(mcp->mc_spare2)); - } + mcp->mc_ownedfp = npxgetregs(td); + bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate, + sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = npxformat(); #endif } @@ -2713,7 +2679,6 @@ get_fpcontext(struct thread *td, mcontex static int set_fpcontext(struct thread *td, const mcontext_t *mcp) { - union savefpu *addr; if (mcp->mc_fpformat == _MC_FPFMT_NODEV) return (0); @@ -2725,30 +2690,14 @@ set_fpcontext(struct thread *td, const m fpstate_drop(td); else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || mcp->mc_ownedfp == _MC_FPOWNED_PCB) { - /* XXX align as above. */ - addr = (union savefpu *)&mcp->mc_fpstate; - if (td == PCPU_GET(fpcurthread) && -#ifdef CPU_ENABLE_SSE - cpu_fxsr && -#endif - ((uintptr_t)(void *)addr & 0xF)) { - do - addr = (void *)((char *)addr + 4); - while ((uintptr_t)(void *)addr & 0xF); - bcopy(&mcp->mc_fpstate, addr, sizeof(mcp->mc_fpstate)); - } #ifdef DEV_NPX #ifdef CPU_ENABLE_SSE if (cpu_fxsr) - addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; + ((union savefpu *)&mcp->mc_fpstate)->sv_xmm.sv_env. + en_mxcsr &= cpu_mxcsr_mask; #endif - npxsetuserregs(td, addr); + npxsetregs(td, (union savefpu *)&mcp->mc_fpstate); #endif - /* - * Don't bother putting things back where they were in the - * misaligned case, since we know that the caller won't use - * them again. - */ } else return (EINVAL); return (0); @@ -2765,12 +2714,12 @@ fpstate_drop(struct thread *td) #endif /* * XXX force a full drop of the npx. The above only drops it if we - * owned it. npxusergetregs() has the same bug in the !cpu_fxsr case. + * owned it. npxgetregs() has the same bug in the !cpu_fxsr case. * - * XXX I don't much like npxgetuserregs()'s semantics of doing a full + * XXX I don't much like npxgetregs()'s semantics of doing a full * drop. Dropping only to the pcb matches fnsave's behaviour. * We only need to drop to !PCB_INITDONE in sendsig(). But - * sendsig() is the only caller of npxgetuserregs()... perhaps we just + * sendsig() is the only caller of npxgetregs()... perhaps we just * have too many layers. */ curthread->td_pcb->pcb_flags &= ~(PCB_NPXINITDONE | From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 15:35:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AAE2106566B; Fri, 26 Nov 2010 15:35:09 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08E688FC08; Fri, 26 Nov 2010 15:35:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQFZ8PD051261; Fri, 26 Nov 2010 15:35:08 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQFZ8FT051259; Fri, 26 Nov 2010 15:35:08 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201011261535.oAQFZ8FT051259@svn.freebsd.org> From: Attilio Rao Date: Fri, 26 Nov 2010 15:35:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215868 - head/sys/dev/ichwd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 15:35:09 -0000 Author: attilio Date: Fri Nov 26 15:35:08 2010 New Revision: 215868 URL: http://svn.freebsd.org/changeset/base/215868 Log: - Advertise when the reboot came from a watchdog-induced reset. - Fix a bug where TCO_BOOT_STS was supposed to be cleared after TCO_SECOND_TO_STS and not before. Sponsored by: Sandvine Incorporated Submitted by: Mark Johnston Reviewed by: des MFC after: 10 days Modified: head/sys/dev/ichwd/ichwd.c Modified: head/sys/dev/ichwd/ichwd.c ============================================================================== --- head/sys/dev/ichwd/ichwd.c Fri Nov 26 15:33:09 2010 (r215867) +++ head/sys/dev/ichwd/ichwd.c Fri Nov 26 15:35:08 2010 (r215868) @@ -225,12 +225,12 @@ ichwd_sts_reset(struct ichwd_softc *sc) * by writing a 1, not a 0. */ ichwd_write_tco_2(sc, TCO1_STS, TCO_TIMEOUT); - /* - * XXX The datasheet says that TCO_SECOND_TO_STS must be cleared - * before TCO_BOOT_STS, not the other way around. + /* + * According to Intel's docs, clearing SECOND_TO_STS and BOOT_STS must + * be done in two separate operations. */ - ichwd_write_tco_2(sc, TCO2_STS, TCO_BOOT_STS); ichwd_write_tco_2(sc, TCO2_STS, TCO_SECOND_TO_STS); + ichwd_write_tco_2(sc, TCO2_STS, TCO_BOOT_STS); } /* @@ -520,11 +520,12 @@ ichwd_attach(device_t dev) device_get_desc(dev), sc->ich_version); /* - * XXX we should check the status registers (specifically, the - * TCO_SECOND_TO_STS bit in the TCO2_STS register) to see if we - * just came back from a watchdog-induced reset, and let the user - * know. + * Determine if we are coming up after a watchdog-induced reset. + * This bit is cleared in ichwd_sts_reset(). */ + if ((ich_read_tco_2(sc, TCO2_STS) & TCO_SECOND_TO_STS) != 0) + device_printf(dev, + "resuming after hardware watchdog timeout\n"); /* reset the watchdog status registers */ ichwd_sts_reset(sc); From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 19:36:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2890E1065694; Fri, 26 Nov 2010 19:36:27 +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 16DC18FC0A; Fri, 26 Nov 2010 19:36:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQJaQ6D070440; Fri, 26 Nov 2010 19:36:26 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQJaQob070436; Fri, 26 Nov 2010 19:36:26 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201011261936.oAQJaQob070436@svn.freebsd.org> From: Alan Cox Date: Fri, 26 Nov 2010 19:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215878 - in head/sys/amd64: amd64 include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 19:36:27 -0000 Author: alc Date: Fri Nov 26 19:36:26 2010 New Revision: 215878 URL: http://svn.freebsd.org/changeset/base/215878 Log: Make the size of the direct map easily configurable. Changing NDMPML4E now suffices. Increase the size of the direct map to 1TB. An earler version of this patch was tested by sbruno@. Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/amd64/include/vmparam.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Nov 26 18:44:01 2010 (r215877) +++ head/sys/amd64/amd64/pmap.c Fri Nov 26 19:36:26 2010 (r215878) @@ -452,6 +452,8 @@ allocpages(vm_paddr_t *firstaddr, int n) return (ret); } +CTASSERT(powerof2(NDMPML4E)); + static void create_pagetables(vm_paddr_t *firstaddr) { @@ -532,9 +534,12 @@ create_pagetables(vm_paddr_t *firstaddr) ((pdp_entry_t *)KPML4phys)[PML4PML4I] = KPML4phys; ((pdp_entry_t *)KPML4phys)[PML4PML4I] |= PG_RW | PG_V | PG_U; - /* Connect the Direct Map slot up to the PML4 */ - ((pdp_entry_t *)KPML4phys)[DMPML4I] = DMPDPphys; - ((pdp_entry_t *)KPML4phys)[DMPML4I] |= PG_RW | PG_V | PG_U; + /* Connect the Direct Map slot(s) up to the PML4. */ + for (i = 0; i < NDMPML4E; i++) { + ((pdp_entry_t *)KPML4phys)[DMPML4I + i] = DMPDPphys + + (i << PAGE_SHIFT); + ((pdp_entry_t *)KPML4phys)[DMPML4I + i] |= PG_RW | PG_V | PG_U; + } /* Connect the KVA slot up to the PML4 */ ((pdp_entry_t *)KPML4phys)[KPML4I] = KPDPphys; @@ -1589,6 +1594,7 @@ pmap_pinit(pmap_t pmap) { vm_page_t pml4pg; static vm_pindex_t color; + int i; PMAP_LOCK_INIT(pmap); @@ -1606,7 +1612,10 @@ pmap_pinit(pmap_t pmap) /* Wire in kernel global address entries. */ pmap->pm_pml4[KPML4I] = KPDPphys | PG_RW | PG_V | PG_U; - pmap->pm_pml4[DMPML4I] = DMPDPphys | PG_RW | PG_V | PG_U; + for (i = 0; i < NDMPML4E; i++) { + pmap->pm_pml4[DMPML4I + i] = (DMPDPphys + (i << PAGE_SHIFT)) | + PG_RW | PG_V | PG_U; + } /* install self-referential address mapping entry(s) */ pmap->pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | PG_V | PG_RW | PG_A | PG_M; @@ -1855,6 +1864,7 @@ void pmap_release(pmap_t pmap) { vm_page_t m; + int i; KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", @@ -1865,7 +1875,8 @@ pmap_release(pmap_t pmap) m = PHYS_TO_VM_PAGE(pmap->pm_pml4[PML4PML4I] & PG_FRAME); pmap->pm_pml4[KPML4I] = 0; /* KVA */ - pmap->pm_pml4[DMPML4I] = 0; /* Direct Map */ + for (i = 0; i < NDMPML4E; i++) /* Direct Map */ + pmap->pm_pml4[DMPML4I + i] = 0; pmap->pm_pml4[PML4PML4I] = 0; /* Recursive Mapping */ m->wire_count--; Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Fri Nov 26 18:44:01 2010 (r215877) +++ head/sys/amd64/include/pmap.h Fri Nov 26 19:36:26 2010 (r215878) @@ -125,15 +125,21 @@ #define NUPDPE (NUPML4E*NPDPEPG)/* number of userland PDP pages */ #define NUPDE (NUPDPE*NPDEPG) /* number of userland PD entries */ -#define NDMPML4E 1 /* number of dmap PML4 slots */ +/* + * NDMPML4E is the number of PML4 entries that are used to implement the + * direct map. It must be a power of two. + */ +#define NDMPML4E 2 /* - * The *PDI values control the layout of virtual memory + * The *PDI values control the layout of virtual memory. The starting address + * of the direct map, which is controlled by DMPML4I, must be a multiple of + * its size. (See the PHYS_TO_DMAP() and DMAP_TO_PHYS() macros.) */ #define PML4PML4I (NPML4EPG/2) /* Index of recursive pml4 mapping */ #define KPML4I (NPML4EPG-1) /* Top 512GB for KVM */ -#define DMPML4I (KPML4I-1) /* Next 512GB down for direct map */ +#define DMPML4I rounddown(KPML4I - NDMPML4E, NDMPML4E) /* Below KVM */ #define KPDPI (NPDPEPG-2) /* kernbase at -2GB */ Modified: head/sys/amd64/include/vmparam.h ============================================================================== --- head/sys/amd64/include/vmparam.h Fri Nov 26 18:44:01 2010 (r215877) +++ head/sys/amd64/include/vmparam.h Fri Nov 26 19:36:26 2010 (r215878) @@ -163,8 +163,9 @@ * 0x0000000000000000 - 0x00007fffffffffff user map * 0x0000800000000000 - 0xffff7fffffffffff does not exist (hole) * 0xffff800000000000 - 0xffff804020100fff recursive page table (512GB slot) - * 0xffff804020101000 - 0xfffffeffffffffff unused - * 0xffffff0000000000 - 0xffffff7fffffffff 512GB direct map mappings + * 0xffff804020101000 - 0xfffffdffffffffff unused + * 0xfffffe0000000000 - 0xfffffeffffffffff 1TB direct map + * 0xffffff0000000000 - 0xffffff7fffffffff unused * 0xffffff8000000000 - 0xffffffffffffffff 512GB kernel map * * Within the kernel map: @@ -176,7 +177,7 @@ #define VM_MIN_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG-512, 0, 0) #define DMAP_MIN_ADDRESS KVADDR(DMPML4I, 0, 0, 0) -#define DMAP_MAX_ADDRESS KVADDR(DMPML4I+1, 0, 0, 0) +#define DMAP_MAX_ADDRESS KVADDR(DMPML4I + NDMPML4E, 0, 0, 0) #define KERNBASE KVADDR(KPML4I, KPDPI, 0, 0) From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 20:34:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C90E81065670; Fri, 26 Nov 2010 20:34:43 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D5498FC08; Fri, 26 Nov 2010 20:34:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQKYhra075017; Fri, 26 Nov 2010 20:34:43 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQKYh1S075014; Fri, 26 Nov 2010 20:34:43 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011262034.oAQKYh1S075014@svn.freebsd.org> From: Ulrich Spoerlein Date: Fri, 26 Nov 2010 20:34:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215880 - head/contrib/traceroute X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 20:34:43 -0000 Author: uqs Date: Fri Nov 26 20:34:43 2010 New Revision: 215880 URL: http://svn.freebsd.org/changeset/base/215880 Log: Remove clause 3 and 4 from TNF licenses. Obtained from: NetBSD Approved by: core Modified: head/contrib/traceroute/as.c head/contrib/traceroute/as.h Modified: head/contrib/traceroute/as.c ============================================================================== --- head/contrib/traceroute/as.c Fri Nov 26 19:48:27 2010 (r215879) +++ head/contrib/traceroute/as.c Fri Nov 26 20:34:43 2010 (r215880) @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/contrib/traceroute/as.h ============================================================================== --- head/contrib/traceroute/as.h Fri Nov 26 19:48:27 2010 (r215879) +++ head/contrib/traceroute/as.h Fri Nov 26 20:34:43 2010 (r215880) @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 21:41:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B29BD1065696; Fri, 26 Nov 2010 21:41:42 +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 A169C8FC13; Fri, 26 Nov 2010 21:41:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQLfgtc083242; Fri, 26 Nov 2010 21:41:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQLfgGj083240; Fri, 26 Nov 2010 21:41:42 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011262141.oAQLfgGj083240@svn.freebsd.org> From: Marius Strobl Date: Fri, 26 Nov 2010 21:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215905 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 21:41:42 -0000 Author: marius Date: Fri Nov 26 21:41:42 2010 New Revision: 215905 URL: http://svn.freebsd.org/changeset/base/215905 Log: Ensure Bay flow control is disabled as we're going to use IEEE 802.3 annex 31B full duplex flow control instead. Modified: head/sys/dev/mii/inphy.c Modified: head/sys/dev/mii/inphy.c ============================================================================== --- head/sys/dev/mii/inphy.c Fri Nov 26 21:39:11 2010 (r215904) +++ head/sys/dev/mii/inphy.c Fri Nov 26 21:41:42 2010 (r215905) @@ -77,6 +77,7 @@ DRIVER_MODULE(inphy, miibus, inphy_drive static int inphy_service(struct mii_softc *, struct mii_data *, int); static void inphy_status(struct mii_softc *); +static void inphy_reset(struct mii_softc *); static const struct mii_phydesc inphys[] = { MII_PHY_DESC(INTEL, I82553C), @@ -119,7 +120,7 @@ inphy_attach(device_t dev) IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), MII_MEDIA_100_TX, NULL); - mii_phy_reset(sc); + inphy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); @@ -206,3 +207,14 @@ inphy_status(struct mii_softc *sc) } else mii->mii_media_active = ife->ifm_media; } + +static void +inphy_reset(struct mii_softc *sc) +{ + + mii_phy_reset(sc); + + /* Ensure Bay flow control is disabled. */ + PHY_WRITE(sc, MII_INPHY_SCR, + PHY_READ(sc, MII_INPHY_SCR) & ~SCR_FLOWCTL); +} From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 21:52:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7142106567A; Fri, 26 Nov 2010 21:52:33 +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 C4DC58FC08; Fri, 26 Nov 2010 21:52:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQLqX6a085152; Fri, 26 Nov 2010 21:52:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQLqXqj085148; Fri, 26 Nov 2010 21:52:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011262152.oAQLqXqj085148@svn.freebsd.org> From: Marius Strobl Date: Fri, 26 Nov 2010 21:52:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215906 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 21:52:34 -0000 Author: marius Date: Fri Nov 26 21:52:33 2010 New Revision: 215906 URL: http://svn.freebsd.org/changeset/base/215906 Log: Fix and implement missing parts of flow control support. This also removes the dev.fxp.%d.noflow tunable as the same effect can now be achieved with ifconfig(8) by setting the flowcontrol media option as desired (besides the tunable never having a chance to actually enable flow control support so far). In joint forces with: yongari Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpreg.h head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Fri Nov 26 21:41:42 2010 (r215905) +++ head/sys/dev/fxp/if_fxp.c Fri Nov 26 21:52:33 2010 (r215906) @@ -224,7 +224,7 @@ static void fxp_rxcsum(struct fxp_softc static int fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, uint8_t statack, int count); static void fxp_init(void *xsc); -static void fxp_init_body(struct fxp_softc *sc); +static void fxp_init_body(struct fxp_softc *sc, int); static void fxp_tick(void *xsc); static void fxp_start(struct ifnet *ifp); static void fxp_start_body(struct ifnet *ifp); @@ -261,6 +261,7 @@ static void fxp_serial_ifmedia_sts(stru static int fxp_miibus_readreg(device_t dev, int phy, int reg); static int fxp_miibus_writereg(device_t dev, int phy, int reg, int value); +static void fxp_miibus_statchg(device_t dev); static void fxp_load_ucode(struct fxp_softc *sc); static void fxp_update_stats(struct fxp_softc *sc); static void fxp_sysctl_node(struct fxp_softc *sc); @@ -286,6 +287,7 @@ static device_method_t fxp_methods[] = { /* MII interface */ DEVMETHOD(miibus_readreg, fxp_miibus_readreg), DEVMETHOD(miibus_writereg, fxp_miibus_writereg), + DEVMETHOD(miibus_statchg, fxp_miibus_statchg), { 0, 0 } }; @@ -329,8 +331,8 @@ fxp_scb_wait(struct fxp_softc *sc) while (CSR_READ_1(sc, FXP_CSR_SCB_COMMAND) && --i) DELAY(2); if (i == 0) { - flowctl.b[0] = CSR_READ_1(sc, FXP_CSR_FLOWCONTROL); - flowctl.b[1] = CSR_READ_1(sc, FXP_CSR_FLOWCONTROL + 1); + flowctl.b[0] = CSR_READ_1(sc, FXP_CSR_FC_THRESH); + flowctl.b[1] = CSR_READ_1(sc, FXP_CSR_FC_STATUS); device_printf(sc->dev, "SCB timeout: 0x%x 0x%x 0x%x 0x%x\n", CSR_READ_1(sc, FXP_CSR_SCB_COMMAND), CSR_READ_1(sc, FXP_CSR_SCB_STATACK), @@ -426,8 +428,7 @@ fxp_attach(device_t dev) uint32_t val; uint16_t data, myea[ETHER_ADDR_LEN / 2]; u_char eaddr[ETHER_ADDR_LEN]; - int i, pmc, prefer_iomap; - int error; + int error, flags, i, pmc, prefer_iomap; error = 0; sc = device_get_softc(dev); @@ -807,11 +808,14 @@ fxp_attach(device_t dev) /* * i82557 wedge when isolating all of their PHYs. */ + flags = MIIF_NOISOLATE; + if (sc->revision >= FXP_REV_82558_A4) + flags |= MIIF_DOPAUSE; error = mii_attach(dev, &sc->miibus, ifp, fxp_ifmedia_upd, fxp_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, - MII_OFFSET_ANY, MIIF_NOISOLATE); + MII_OFFSET_ANY, flags); if (error != 0) { - device_printf(dev, "attaching PHYs failed\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } } @@ -894,7 +898,7 @@ fxp_attach(device_t dev) FXP_LOCK(sc); /* Clear wakeup events. */ CSR_WRITE_1(sc, FXP_CSR_PMDR, CSR_READ_1(sc, FXP_CSR_PMDR)); - fxp_init_body(sc); + fxp_init_body(sc, 1); fxp_stop(sc); FXP_UNLOCK(sc); } @@ -1056,7 +1060,7 @@ fxp_suspend(device_t dev) pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; sc->flags |= FXP_FLAG_WOL; /* Reconfigure hardware to accept magic frames. */ - fxp_init_body(sc); + fxp_init_body(sc, 1); } pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); } @@ -1098,7 +1102,7 @@ fxp_resume(device_t dev) /* reinitialize interface if necessary */ if (ifp->if_flags & IFF_UP) - fxp_init_body(sc); + fxp_init_body(sc, 1); sc->suspended = 0; @@ -2106,7 +2110,7 @@ fxp_tick(void *xsc) if (sc->rx_idle_secs > FXP_MAX_RX_IDLE) { sc->rx_idle_secs = 0; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) - fxp_init_body(sc); + fxp_init_body(sc, 1); return; } /* @@ -2204,7 +2208,7 @@ fxp_watchdog(struct fxp_softc *sc) device_printf(sc->dev, "device timeout\n"); sc->ifp->if_oerrors++; - fxp_init_body(sc); + fxp_init_body(sc, 1); } /* @@ -2218,7 +2222,7 @@ fxp_init(void *xsc) struct fxp_softc *sc = xsc; FXP_LOCK(sc); - fxp_init_body(sc); + fxp_init_body(sc, 1); FXP_UNLOCK(sc); } @@ -2227,9 +2231,10 @@ fxp_init(void *xsc) * softc lock held. */ static void -fxp_init_body(struct fxp_softc *sc) +fxp_init_body(struct fxp_softc *sc, int setmedia) { struct ifnet *ifp = sc->ifp; + struct mii_data *mii; struct fxp_cb_config *cbp; struct fxp_cb_ias *cb_ias; struct fxp_cb_tx *tcbp; @@ -2364,7 +2369,7 @@ fxp_init_body(struct fxp_softc *sc) cbp->vlan_strip_en = ((sc->flags & FXP_FLAG_EXT_RFA) != 0 && (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) ? 1 : 0; - if (sc->tunable_noflow || sc->revision == FXP_REV_82557) { + if (sc->revision == FXP_REV_82557) { /* * The 82557 has no hardware flow control, the values * below are the defaults for the chip. @@ -2378,12 +2383,30 @@ fxp_init_body(struct fxp_softc *sc) cbp->fc_filter = 0; cbp->pri_fc_loc = 1; } else { - cbp->fc_delay_lsb = 0x1f; - cbp->fc_delay_msb = 0x01; + /* Set pause RX FIFO threshold to 1KB. */ + CSR_WRITE_1(sc, FXP_CSR_FC_THRESH, 1); + /* Set pause time. */ + cbp->fc_delay_lsb = 0xff; + cbp->fc_delay_msb = 0xff; cbp->pri_fc_thresh = 3; - cbp->tx_fc_dis = 0; /* enable transmit FC */ - cbp->rx_fc_restop = 1; /* enable FC restop frames */ - cbp->rx_fc_restart = 1; /* enable FC restart frames */ + mii = device_get_softc(sc->miibus); + if ((IFM_OPTIONS(mii->mii_media_active) & + IFM_ETH_TXPAUSE) != 0) + /* enable transmit FC */ + cbp->tx_fc_dis = 0; + else + /* disable transmit FC */ + cbp->tx_fc_dis = 1; + if ((IFM_OPTIONS(mii->mii_media_active) & + IFM_ETH_RXPAUSE) != 0) { + /* enable FC restart/restop frames */ + cbp->rx_fc_restart = 1; + cbp->rx_fc_restop = 1; + } else { + /* disable FC restart/restop frames */ + cbp->rx_fc_restart = 0; + cbp->rx_fc_restop = 0; + } cbp->fc_filter = !prm; /* drop FC frames to host */ cbp->pri_fc_loc = 1; /* FC pri location (byte31) */ } @@ -2482,10 +2505,7 @@ fxp_init_body(struct fxp_softc *sc) CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->fxp_desc.rx_head->rx_addr); fxp_scb_cmd(sc, FXP_SCB_COMMAND_RU_START); - /* - * Set current media. - */ - if (sc->miibus != NULL) + if (sc->miibus != NULL && setmedia != 0) mii_mediachg(device_get_softc(sc->miibus)); ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -2742,6 +2762,31 @@ fxp_miibus_writereg(device_t dev, int ph return (0); } +static void +fxp_miibus_statchg(device_t dev) +{ + struct fxp_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + + sc = device_get_softc(dev); + mii = device_get_softc(sc->miibus); + ifp = sc->ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + (mii->mii_media_status & (IFM_AVALID | IFM_ACTIVE)) != + (IFM_AVALID | IFM_ACTIVE)) + return; + + /* + * Call fxp_init_body in order to adjust the flow control settings. + * Note that the 82557 doesn't support hardware flow control. + */ + if (sc->revision == FXP_REV_82557) + return; + fxp_init_body(sc, 0); +} + static int fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { @@ -2763,9 +2808,9 @@ fxp_ioctl(struct ifnet *ifp, u_long comm if (((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) && ((ifp->if_flags ^ sc->if_flags) & (IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0) - fxp_init_body(sc); + fxp_init_body(sc, 1); else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - fxp_init_body(sc); + fxp_init_body(sc, 1); } else { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) fxp_stop(sc); @@ -2867,7 +2912,7 @@ fxp_ioctl(struct ifnet *ifp, u_long comm reinit++; } if (reinit > 0 && ifp->if_flags & IFF_UP) - fxp_init_body(sc); + fxp_init_body(sc, 1); FXP_UNLOCK(sc); VLAN_CAPABILITIES(ifp); break; @@ -3058,22 +3103,16 @@ fxp_sysctl_node(struct fxp_softc *sc) "FXP driver receive interrupt microcode bundle size limit"); SYSCTL_ADD_INT(ctx, child,OID_AUTO, "rnr", CTLFLAG_RD, &sc->rnr, 0, "FXP RNR events"); - SYSCTL_ADD_INT(ctx, child, - OID_AUTO, "noflow", CTLFLAG_RW, &sc->tunable_noflow, 0, - "FXP flow control disabled"); /* * Pull in device tunables. */ sc->tunable_int_delay = TUNABLE_INT_DELAY; sc->tunable_bundle_max = TUNABLE_BUNDLE_MAX; - sc->tunable_noflow = 1; (void) resource_int_value(device_get_name(sc->dev), device_get_unit(sc->dev), "int_delay", &sc->tunable_int_delay); (void) resource_int_value(device_get_name(sc->dev), device_get_unit(sc->dev), "bundle_max", &sc->tunable_bundle_max); - (void) resource_int_value(device_get_name(sc->dev), - device_get_unit(sc->dev), "noflow", &sc->tunable_noflow); sc->rnr = 0; hsp = &sc->fxp_hwstats; Modified: head/sys/dev/fxp/if_fxpreg.h ============================================================================== --- head/sys/dev/fxp/if_fxpreg.h Fri Nov 26 21:41:42 2010 (r215905) +++ head/sys/dev/fxp/if_fxpreg.h Fri Nov 26 21:52:33 2010 (r215906) @@ -45,7 +45,8 @@ #define FXP_CSR_FLASHCONTROL 12 /* flash control (2 bytes) */ #define FXP_CSR_EEPROMCONTROL 14 /* eeprom control (2 bytes) */ #define FXP_CSR_MDICONTROL 16 /* mdi control (4 bytes) */ -#define FXP_CSR_FLOWCONTROL 0x19 /* flow control (2 bytes) */ +#define FXP_CSR_FC_THRESH 0x19 /* flow control (1 byte) */ +#define FXP_CSR_FC_STATUS 0x1A /* flow control status (1 byte) */ #define FXP_CSR_PMDR 0x1B /* power management driver (1 byte) */ #define FXP_CSR_GENCONTROL 0x1C /* general control (1 byte) */ Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Fri Nov 26 21:41:42 2010 (r215905) +++ head/sys/dev/fxp/if_fxpvar.h Fri Nov 26 21:52:33 2010 (r215906) @@ -210,7 +210,6 @@ struct fxp_softc { device_t dev; int tunable_int_delay; /* interrupt delay value for ucode */ int tunable_bundle_max; /* max # frames per interrupt (ucode) */ - int tunable_noflow; /* flow control disabled */ int rnr; /* RNR events */ int eeprom_size; /* size of serial EEPROM */ int suspended; /* 0 = normal 1 = suspended or dead */ From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 21:57:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B472106564A; Fri, 26 Nov 2010 21:57:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A1AF8FC13; Fri, 26 Nov 2010 21:57:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQLv29I085969; Fri, 26 Nov 2010 21:57:02 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQLv2Wc085967; Fri, 26 Nov 2010 21:57:02 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011262157.oAQLv2Wc085967@svn.freebsd.org> From: Marius Strobl Date: Fri, 26 Nov 2010 21:57:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215907 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 21:57:02 -0000 Author: marius Date: Fri Nov 26 21:57:01 2010 New Revision: 215907 URL: http://svn.freebsd.org/changeset/base/215907 Log: Remove the description of the dev.fxp.%d.noflow tunable as it was removed in r215906 and the flowcontrol media option now should be set as desired via ifconfig(8) instead. Modified: head/share/man/man4/fxp.4 Modified: head/share/man/man4/fxp.4 ============================================================================== --- head/share/man/man4/fxp.4 Fri Nov 26 21:52:33 2010 (r215906) +++ head/share/man/man4/fxp.4 Fri Nov 26 21:57:01 2010 (r215907) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 12, 2010 +.Dd November 26, 2010 .Dt FXP 4 .Os .Sh NAME @@ -166,9 +166,6 @@ Number of packets that will be bundled, generated. This is only effective if the Intel microcode is loaded. The accepted range is 1 to 65535, the default is 6. -.It Va dev.fxp.%d.noflow -Controls whether flow control should be used or not. -The default is 1 (no flow control). .El .Sh SYSCTL VARIABLES The following variables are available as From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 22:36:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4A33106566C; Fri, 26 Nov 2010 22:36:47 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9254D8FC08; Fri, 26 Nov 2010 22:36:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQMalUj092404; Fri, 26 Nov 2010 22:36:47 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQMalSI092402; Fri, 26 Nov 2010 22:36:47 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201011262236.oAQMalSI092402@svn.freebsd.org> From: Jack F Vogel Date: Fri, 26 Nov 2010 22:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215910 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 22:36:47 -0000 Author: jfv Date: Fri Nov 26 22:36:47 2010 New Revision: 215910 URL: http://svn.freebsd.org/changeset/base/215910 Log: Unwanted extra call to set_vlan_hw added back by mistake. Modified: head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Fri Nov 26 22:31:56 2010 (r215909) +++ head/sys/dev/e1000/if_lem.c Fri Nov 26 22:36:47 2010 (r215910) @@ -1128,9 +1128,6 @@ lem_init_locked(struct adapter *adapter) /* Setup VLAN support, basic and offload if available */ E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); - /* Use real VLAN Filter support */ - lem_setup_vlan_hw_support(adapter); - /* Set hardware offload abilities */ ifp->if_hwassist = 0; if (adapter->hw.mac.type >= e1000_82543) { From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 22:46:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C3B4106564A; Fri, 26 Nov 2010 22:46:33 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 099978FC1D; Fri, 26 Nov 2010 22:46:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQMkXVn093935; Fri, 26 Nov 2010 22:46:33 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQMkWL2093929; Fri, 26 Nov 2010 22:46:32 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201011262246.oAQMkWL2093929@svn.freebsd.org> From: Jack F Vogel Date: Fri, 26 Nov 2010 22:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215911 - in head/sys: conf dev/ixgbe modules/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 22:46:33 -0000 Author: jfv Date: Fri Nov 26 22:46:32 2010 New Revision: 215911 URL: http://svn.freebsd.org/changeset/base/215911 Log: Update ixgbe driver to verion 2.3.6 - This adds a VM SRIOV interface, ixv, it is however transparent to the user, it links with the ixgbe.ko, but when ixgbe is loaded in a virtualized guest with SRIOV configured this will be detected. - Sync shared code to latest - Many bug fixes and improvements, thanks to everyone who has been using the driver and reporting issues. Added: head/sys/dev/ixgbe/ixgbe_mbx.c (contents, props changed) head/sys/dev/ixgbe/ixgbe_mbx.h (contents, props changed) head/sys/dev/ixgbe/ixgbe_vf.c (contents, props changed) head/sys/dev/ixgbe/ixgbe_vf.h (contents, props changed) head/sys/dev/ixgbe/ixv.c (contents, props changed) head/sys/dev/ixgbe/ixv.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h head/sys/dev/ixgbe/ixgbe_82598.c head/sys/dev/ixgbe/ixgbe_82599.c head/sys/dev/ixgbe/ixgbe_api.c head/sys/dev/ixgbe/ixgbe_api.h head/sys/dev/ixgbe/ixgbe_common.c head/sys/dev/ixgbe/ixgbe_common.h head/sys/dev/ixgbe/ixgbe_osdep.h head/sys/dev/ixgbe/ixgbe_phy.c head/sys/dev/ixgbe/ixgbe_phy.h head/sys/dev/ixgbe/ixgbe_type.h head/sys/modules/ixgbe/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Nov 26 22:36:47 2010 (r215910) +++ head/sys/conf/files Fri Nov 26 22:46:32 2010 (r215911) @@ -1252,12 +1252,18 @@ dev/ixgb/ixgb_ee.c optional ixgb dev/ixgb/ixgb_hw.c optional ixgb dev/ixgbe/ixgbe.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/ixgbe/ixv.c optional ixgbe inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_phy.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_api.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_common.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/ixgbe/ixgbe_mbx.c optional ixgbe inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/ixgbe/ixgbe_vf.c optional ixgbe inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_82598.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_82599.c optional ixgbe inet \ Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 26 22:36:47 2010 (r215910) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 26 22:46:32 2010 (r215911) @@ -46,7 +46,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.2.3"; +char ixgbe_driver_version[] = "2.3.6"; /********************************************************************* * PCI Device ID Table @@ -78,6 +78,8 @@ static ixgbe_vendor_info_t ixgbe_vendor_ {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_CX4, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_T3_LOM, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_COMBO_BACKPLANE, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_BACKPLANE_FCOE, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0}, /* required last entry */ {0, 0, 0, 0, 0} }; @@ -119,7 +121,7 @@ static int ixgbe_allocate_queues(struct static int ixgbe_setup_msix(struct adapter *); static void ixgbe_free_pci_resources(struct adapter *); static void ixgbe_local_timer(void *); -static int ixgbe_setup_interface(device_t, struct adapter *); +static void ixgbe_setup_interface(device_t, struct adapter *); static void ixgbe_config_link(struct adapter *); static int ixgbe_allocate_transmit_buffers(struct tx_ring *); @@ -144,7 +146,6 @@ static bool ixgbe_txeof(struct tx_ring * static bool ixgbe_rxeof(struct ix_queue *, int); static void ixgbe_rx_checksum(u32, struct mbuf *, u32); static void ixgbe_set_promisc(struct adapter *); -static void ixgbe_disable_promisc(struct adapter *); static void ixgbe_set_multi(struct adapter *); static void ixgbe_print_hw_stats(struct adapter *); static void ixgbe_print_debug_info(struct adapter *); @@ -212,7 +213,7 @@ static driver_t ixgbe_driver = { "ix", ixgbe_methods, sizeof(struct adapter), }; -static devclass_t ixgbe_devclass; +devclass_t ixgbe_devclass; DRIVER_MODULE(ixgbe, pci, ixgbe_driver, ixgbe_devclass, 0, 0); MODULE_DEPEND(ixgbe, pci, 1, 1, 1); @@ -257,7 +258,7 @@ TUNABLE_INT("hw.ixgbe.enable_msix", &ixg /* * Header split: this causes the hardware to DMA - * the header into a separate mbuf from the payload, + * the header into a seperate mbuf from the payload, * it can be a performance win in some workloads, but * in others it actually hurts, its off by default. */ @@ -289,13 +290,6 @@ TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd); static int ixgbe_total_ports; /* -** Shadow VFTA table, this is needed because -** the real filter table gets cleared during -** a soft reset and we need to repopulate it. -*/ -static u32 ixgbe_shadow_vfta[IXGBE_VFTA_SIZE]; - -/* ** The number of scatter-gather segments ** differs for 82598 and 82599, default to ** the former. @@ -446,6 +440,7 @@ ixgbe_attach(device_t dev) ixgbe_num_segs = IXGBE_82599_SCATTER; adapter->optics = IFM_10G_T; default: + ixgbe_num_segs = IXGBE_82599_SCATTER; break; } @@ -524,15 +519,6 @@ ixgbe_attach(device_t dev) goto err_out; } - /* Allocate multicast array memory. */ - adapter->mta = malloc(sizeof(u8) * IXGBE_ETH_LENGTH_OF_ADDRESS * - MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); - if (adapter->mta == NULL) { - device_printf(dev, "Can not allocate multicast setup array\n"); - error = ENOMEM; - goto err_late; - } - /* Initialize the shared code */ error = ixgbe_init_shared_code(hw); if (error == IXGBE_ERR_SFP_NOT_PRESENT) { @@ -595,8 +581,7 @@ ixgbe_attach(device_t dev) goto err_late; /* Setup OS specific network interface */ - if (ixgbe_setup_interface(dev, adapter) != 0) - goto err_late; + ixgbe_setup_interface(dev, adapter); /* Sysctl for limiting the amount of work done in the taskqueue */ ixgbe_add_rx_process_limit(adapter, "rx_processing_limit", @@ -642,10 +627,7 @@ err_late: ixgbe_free_transmit_structures(adapter); ixgbe_free_receive_structures(adapter); err_out: - if (adapter->ifp != NULL) - if_free(adapter->ifp); ixgbe_free_pci_resources(adapter); - free(adapter->mta, M_DEVBUF); return (error); } @@ -716,7 +698,6 @@ ixgbe_detach(device_t dev) ixgbe_free_transmit_structures(adapter); ixgbe_free_receive_structures(adapter); - free(adapter->mta, M_DEVBUF); IXGBE_CORE_LOCK_DESTROY(adapter); return (0); @@ -780,8 +761,8 @@ ixgbe_start_locked(struct tx_ring *txr, ETHER_BPF_MTAP(ifp, m_head); /* Set watchdog on */ - txr->watchdog_check = TRUE; txr->watchdog_time = ticks; + txr->queue_status = IXGBE_QUEUE_WORKING; } return; @@ -851,6 +832,10 @@ ixgbe_mq_start_locked(struct ifnet *ifp, return (err); } + /* Call cleanup if number of TX descriptors low */ + if (txr->tx_avail <= IXGBE_TX_CLEANUP_THRESHOLD) + ixgbe_txeof(txr); + enqueued = 0; if (m == NULL) { next = drbr_dequeue(ifp, txr->br); @@ -883,7 +868,7 @@ ixgbe_mq_start_locked(struct ifnet *ifp, if (enqueued > 0) { /* Set watchdog on */ - txr->watchdog_check = TRUE; + txr->queue_status = IXGBE_QUEUE_WORKING; txr->watchdog_time = ticks; } @@ -948,7 +933,6 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) { if ((ifp->if_flags ^ adapter->if_flags) & (IFF_PROMISC | IFF_ALLMULTI)) { - ixgbe_disable_promisc(adapter); ixgbe_set_promisc(adapter); } } else @@ -987,6 +971,8 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c ifp->if_capenable ^= IFCAP_LRO; if (mask & IFCAP_VLAN_HWTAGGING) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if (mask & IFCAP_VLAN_HWFILTER) + ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { IXGBE_CORE_LOCK(adapter); ixgbe_init_locked(adapter); @@ -1041,6 +1027,18 @@ ixgbe_init_locked(struct adapter *adapte ixgbe_set_rar(hw, 0, hw->mac.addr, 0, 1); hw->addr_ctrl.rar_used_count = 1; + /* Set the various hardware offload abilities */ + ifp->if_hwassist = 0; + if (ifp->if_capenable & IFCAP_TSO4) + ifp->if_hwassist |= CSUM_TSO; + if (ifp->if_capenable & IFCAP_TXCSUM) { + ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); +#if __FreeBSD_version >= 800000 + if (hw->mac.type == ixgbe_mac_82599EB) + ifp->if_hwassist |= CSUM_SCTP; +#endif + } + /* Prepare transmit descriptors and buffers */ if (ixgbe_setup_transmit_structures(adapter)) { device_printf(dev,"Could not setup transmit structures\n"); @@ -1058,10 +1056,12 @@ ixgbe_init_locked(struct adapter *adapte ** Determine the correct mbuf pool ** for doing jumbo/headersplit */ - if (ifp->if_mtu > ETHERMTU) + if (adapter->max_frame_size <= 2048) + adapter->rx_mbuf_sz = MCLBYTES; + else if (adapter->max_frame_size <= 4096) adapter->rx_mbuf_sz = MJUMPAGESIZE; else - adapter->rx_mbuf_sz = MCLBYTES; + adapter->rx_mbuf_sz = MJUM9BYTES; /* Prepare receive descriptors and buffers */ if (ixgbe_setup_receive_structures(adapter)) { @@ -1092,18 +1092,6 @@ ixgbe_init_locked(struct adapter *adapte } IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie); - /* Set the various hardware offload abilities */ - ifp->if_hwassist = 0; - if (ifp->if_capenable & IFCAP_TSO4) - ifp->if_hwassist |= CSUM_TSO; - if (ifp->if_capenable & IFCAP_TXCSUM) { - ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); -#if __FreeBSD_version >= 800000 - if (hw->mac.type == ixgbe_mac_82599EB) - ifp->if_hwassist |= CSUM_SCTP; -#endif - } - /* Set MTU size */ if (ifp->if_mtu > ETHERMTU) { mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD); @@ -1146,7 +1134,7 @@ ixgbe_init_locked(struct adapter *adapte IXGBE_WRITE_REG(hw, IXGBE_RDT(i), adapter->num_rx_desc - 1); } - /* Set up VLAN offloads and filter */ + /* Set up VLAN support and filter */ ixgbe_setup_vlan_hw_support(adapter); /* Enable Receive engine */ @@ -1760,10 +1748,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m ++txr->total_packets; IXGBE_WRITE_REG(&adapter->hw, IXGBE_TDT(txr->me), i); - /* Do a clean if descriptors are low */ - if (txr->tx_avail <= IXGBE_TX_CLEANUP_THRESHOLD) - ixgbe_txeof(txr); - return (0); xmit_fail: @@ -1775,11 +1759,13 @@ xmit_fail: static void ixgbe_set_promisc(struct adapter *adapter) { - u_int32_t reg_rctl; struct ifnet *ifp = adapter->ifp; reg_rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); + reg_rctl &= (~IXGBE_FCTRL_UPE); + reg_rctl &= (~IXGBE_FCTRL_MPE); + IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, reg_rctl); if (ifp->if_flags & IFF_PROMISC) { reg_rctl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); @@ -1792,20 +1778,6 @@ ixgbe_set_promisc(struct adapter *adapte return; } -static void -ixgbe_disable_promisc(struct adapter * adapter) -{ - u_int32_t reg_rctl; - - reg_rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); - - reg_rctl &= (~IXGBE_FCTRL_UPE); - reg_rctl &= (~IXGBE_FCTRL_MPE); - IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, reg_rctl); - - return; -} - /********************************************************************* * Multicast Update @@ -1819,7 +1791,7 @@ static void ixgbe_set_multi(struct adapter *adapter) { u32 fctrl; - u8 *mta; + u8 mta[MAX_NUM_MULTICAST_ADDRESSES * IXGBE_ETH_LENGTH_OF_ADDRESS]; u8 *update_ptr; struct ifmultiaddr *ifma; int mcnt = 0; @@ -1827,10 +1799,6 @@ ixgbe_set_multi(struct adapter *adapter) IOCTL_DEBUGOUT("ixgbe_set_multi: begin"); - mta = adapter->mta; - bzero(mta, sizeof(u8) * IXGBE_ETH_LENGTH_OF_ADDRESS * - MAX_NUM_MULTICAST_ADDRESSES); - fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); if (ifp->if_flags & IFF_PROMISC) @@ -1923,19 +1891,14 @@ ixgbe_local_timer(void *arg) */ if (IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & IXGBE_TFCS_TXOFF) goto out; + /* - ** Check for time since any descriptor was cleaned + ** Check status on the TX queues for a hang */ - for (int i = 0; i < adapter->num_queues; i++, txr++) { - IXGBE_TX_LOCK(txr); - if (txr->watchdog_check == FALSE) { - IXGBE_TX_UNLOCK(txr); - continue; - } - if ((ticks - txr->watchdog_time) > IXGBE_WATCHDOG) + for (int i = 0; i < adapter->num_queues; i++, txr++) + if (txr->queue_status == IXGBE_QUEUE_HUNG) goto hung; - IXGBE_TX_UNLOCK(txr); - } + out: ixgbe_rearm_queues(adapter, adapter->que_mask); callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter); @@ -1985,7 +1948,7 @@ ixgbe_update_link_status(struct adapter adapter->link_active = FALSE; for (int i = 0; i < adapter->num_queues; i++, txr++) - txr->watchdog_check = FALSE; + txr->queue_status = IXGBE_QUEUE_IDLE; } } @@ -2005,6 +1968,7 @@ ixgbe_stop(void *arg) { struct ifnet *ifp; struct adapter *adapter = arg; + struct ixgbe_hw *hw = &adapter->hw; ifp = adapter->ifp; mtx_assert(&adapter->core_mtx, MA_OWNED); @@ -2015,9 +1979,12 @@ ixgbe_stop(void *arg) /* Tell the stack that the interface is no longer active */ ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - ixgbe_reset_hw(&adapter->hw); - adapter->hw.adapter_stopped = FALSE; - ixgbe_stop_adapter(&adapter->hw); + ixgbe_reset_hw(hw); + hw->adapter_stopped = FALSE; + ixgbe_stop_adapter(hw); + /* Turn off the laser */ + if (hw->phy.multispeed_fiber) + ixgbe_disable_tx_laser(hw); callout_stop(&adapter->timer); /* reprogram the RAR[0] in case user changed it. */ @@ -2242,6 +2209,9 @@ ixgbe_setup_msix(struct adapter *adapter if (ixgbe_num_queues != 0) queues = ixgbe_num_queues; + /* Set max queues to 8 */ + else if (queues > 8) + queues = 8; /* ** Want one vector (RX/TX pair) per queue @@ -2375,7 +2345,7 @@ mem: * Setup networking device structure and register an interface. * **********************************************************************/ -static int +static void ixgbe_setup_interface(device_t dev, struct adapter *adapter) { struct ixgbe_hw *hw = &adapter->hw; @@ -2384,10 +2354,8 @@ ixgbe_setup_interface(device_t dev, stru INIT_DEBUGOUT("ixgbe_setup_interface: begin"); ifp = adapter->ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) { - device_printf(dev, "can not allocate ifnet structure\n"); - return (-1); - } + if (ifp == NULL) + panic("%s: can not if_alloc()\n", device_get_nameunit(dev)); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; ifp->if_baudrate = 1000000000; @@ -2414,10 +2382,22 @@ ixgbe_setup_interface(device_t dev, stru ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM; ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_LRO; - + ifp->if_capabilities |= IFCAP_JUMBO_MTU; ifp->if_capenable = ifp->if_capabilities; + /* Don't enable LRO by default */ + ifp->if_capabilities |= IFCAP_LRO; + + /* + ** Dont turn this on by default, if vlans are + ** created on another pseudo device (eg. lagg) + ** then vlan events are not passed thru, breaking + ** operation, but with HW FILTER off it works. If + ** using vlans directly on the em driver you can + ** enable this and get full hardware tag filtering. + */ + ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; + /* * Specify the media types supported by this adapter and register * callbacks to update media and link information @@ -2435,7 +2415,7 @@ ixgbe_setup_interface(device_t dev, stru ifmedia_add(&adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&adapter->media, IFM_ETHER | IFM_AUTO); - return (0); + return; } static void @@ -2450,6 +2430,7 @@ ixgbe_config_link(struct adapter *adapte if (sfp) { if (hw->phy.multispeed_fiber) { hw->mac.ops.setup_sfp(hw); + ixgbe_enable_tx_laser(hw); taskqueue_enqueue(adapter->tq, &adapter->msf_task); } else taskqueue_enqueue(adapter->tq, &adapter->mod_task); @@ -2856,7 +2837,7 @@ ixgbe_initialize_transmit_units(struct a /* Setup Transmit Descriptor Cmd Settings */ txr->txd_cmd = IXGBE_TXD_CMD_IFCS; - txr->watchdog_check = FALSE; + txr->queue_status = IXGBE_QUEUE_IDLE; /* Disable Head Writeback */ switch (hw->mac.type) { @@ -3195,7 +3176,7 @@ ixgbe_atr(struct tx_ring *txr, struct mb { struct adapter *adapter = txr->adapter; struct ix_queue *que; - struct ixgbe_atr_input atr_input; + union ixgbe_atr_input atr_input; struct ip *ip; struct tcphdr *th; struct udphdr *uh; @@ -3239,7 +3220,7 @@ ixgbe_atr(struct tx_ring *txr, struct mb return; } - memset(&atr_input, 0, sizeof(struct ixgbe_atr_input)); + memset(&atr_input, 0, sizeof(union ixgbe_atr_input)); vlan_id = htole16(mp->m_pkthdr.ether_vtag); src_ipv4_addr = ip->ip_src.s_addr; @@ -3274,15 +3255,18 @@ ixgbe_txeof(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; struct ifnet *ifp = adapter->ifp; - u32 first, last, done; + u32 first, last, done, processed; struct ixgbe_tx_buf *tx_buffer; struct ixgbe_legacy_tx_desc *tx_desc, *eop_desc; mtx_assert(&txr->tx_mtx, MA_OWNED); - if (txr->tx_avail == adapter->num_tx_desc) + if (txr->tx_avail == adapter->num_tx_desc) { + txr->queue_status = IXGBE_QUEUE_IDLE; return FALSE; + } + processed = 0; first = txr->next_to_clean; tx_buffer = &txr->tx_buffers[first]; /* For cleanup we just use legacy struct */ @@ -3314,6 +3298,7 @@ ixgbe_txeof(struct tx_ring *txr) tx_desc->lower.data = 0; tx_desc->buffer_addr = 0; ++txr->tx_avail; + ++processed; if (tx_buffer->m_head) { txr->bytes += @@ -3356,6 +3341,15 @@ ixgbe_txeof(struct tx_ring *txr) txr->next_to_clean = first; /* + ** Watchdog calculation, we know there's + ** work outstanding or the first return + ** would have been taken, so none processed + ** for too long indicates a hang. + */ + if ((!processed) && ((ticks - txr->watchdog_time) > IXGBE_WATCHDOG)) + txr->queue_status = IXGBE_QUEUE_HUNG; + + /* * If we have enough room, clear IFF_DRV_OACTIVE to tell the stack that * it is OK to send packets. If there are no pending descriptors, * clear the timeout. Otherwise, if some descriptors have been freed, @@ -3364,7 +3358,7 @@ ixgbe_txeof(struct tx_ring *txr) if (txr->tx_avail > IXGBE_TX_CLEANUP_THRESHOLD) { ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (txr->tx_avail == adapter->num_tx_desc) { - txr->watchdog_check = FALSE; + txr->queue_status = IXGBE_QUEUE_IDLE; return FALSE; } } @@ -3395,51 +3389,59 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, cleaned = -1; /* Signify no completions */ while (i != limit) { rxbuf = &rxr->rx_buffers[i]; - if ((rxbuf->m_head == NULL) && (rxr->hdr_split)) { + if (rxr->hdr_split == FALSE) + goto no_split; + + if (rxbuf->m_head == NULL) { mh = m_gethdr(M_DONTWAIT, MT_DATA); if (mh == NULL) goto update; - mh->m_pkthdr.len = mh->m_len = MHLEN; - mh->m_len = MHLEN; - mh->m_flags |= M_PKTHDR; - m_adj(mh, ETHER_ALIGN); - /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->htag, - rxbuf->hmap, mh, hseg, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - printf("GET BUF: dmamap load" - " failure - %d\n", error); - m_free(mh); - goto update; - } - rxbuf->m_head = mh; - bus_dmamap_sync(rxr->htag, rxbuf->hmap, - BUS_DMASYNC_PREREAD); - rxr->rx_base[i].read.hdr_addr = - htole64(hseg[0].ds_addr); + } else + mh = rxbuf->m_head; + + mh->m_pkthdr.len = mh->m_len = MHLEN; + mh->m_len = MHLEN; + mh->m_flags |= M_PKTHDR; + /* Get the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->htag, + rxbuf->hmap, mh, hseg, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("Refresh mbufs: hdr dmamap load" + " failure - %d\n", error); + m_free(mh); + rxbuf->m_head = NULL; + goto update; } + rxbuf->m_head = mh; + bus_dmamap_sync(rxr->htag, rxbuf->hmap, + BUS_DMASYNC_PREREAD); + rxr->rx_base[i].read.hdr_addr = htole64(hseg[0].ds_addr); +no_split: if (rxbuf->m_pack == NULL) { mp = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (mp == NULL) goto update; - mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; - /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->ptag, - rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - printf("GET BUF: dmamap load" - " failure - %d\n", error); - m_free(mp); - goto update; - } - rxbuf->m_pack = mp; - bus_dmamap_sync(rxr->ptag, rxbuf->pmap, - BUS_DMASYNC_PREREAD); - rxr->rx_base[i].read.pkt_addr = - htole64(pseg[0].ds_addr); + } else + mp = rxbuf->m_pack; + + mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; + /* Get the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->ptag, + rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + printf("Refresh mbufs: payload dmamap load" + " failure - %d\n", error); + m_free(mp); + rxbuf->m_pack = NULL; + goto update; } + rxbuf->m_pack = mp; + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + BUS_DMASYNC_PREREAD); + rxr->rx_base[i].read.pkt_addr = + htole64(pseg[0].ds_addr); cleaned = i; /* Calculate next index */ @@ -3501,9 +3503,9 @@ ixgbe_allocate_receive_buffers(struct rx BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MJUMPAGESIZE, /* maxsize */ + MJUM9BYTES, /* maxsize */ 1, /* nsegments */ - MJUMPAGESIZE, /* maxsegsize */ + MJUM9BYTES, /* maxsegsize */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ @@ -3661,7 +3663,7 @@ ixgbe_setup_receive_ring(struct rx_ring rxbuf = &rxr->rx_buffers[j]; /* - ** Don't allocate mbufs if not + ** Dont allocate mbufs if not ** doing header split, its wasteful */ if (rxr->hdr_split == FALSE) @@ -4027,25 +4029,33 @@ ixgbe_rx_input(struct rx_ring *rxr, stru static __inline void ixgbe_rx_discard(struct rx_ring *rxr, int i) { - struct adapter *adapter = rxr->adapter; struct ixgbe_rx_buf *rbuf; - struct mbuf *mh, *mp; rbuf = &rxr->rx_buffers[i]; - if (rbuf->fmp != NULL) /* Partial chain ? */ + + if (rbuf->fmp != NULL) {/* Partial chain ? */ + rbuf->fmp->m_flags |= M_PKTHDR; m_freem(rbuf->fmp); + rbuf->fmp = NULL; + } - mh = rbuf->m_head; - mp = rbuf->m_pack; + /* + ** With advanced descriptors the writeback + ** clobbers the buffer addrs, so its easier + ** to just free the existing mbufs and take + ** the normal refresh path to get new buffers + ** and mapping. + */ + if (rbuf->m_head) { + m_free(rbuf->m_head); + rbuf->m_head = NULL; + } + + if (rbuf->m_pack) { + m_free(rbuf->m_pack); + rbuf->m_pack = NULL; + } - /* Reuse loaded DMA map and just update mbuf chain */ - mh->m_len = MHLEN; - mh->m_flags |= M_PKTHDR; - mh->m_next = NULL; - - mp->m_len = mp->m_pkthdr.len = adapter->rx_mbuf_sz; - mp->m_data = mp->m_ext.ext_buf; - mp->m_next = NULL; return; } @@ -4110,15 +4120,15 @@ ixgbe_rxeof(struct ix_queue *que, int co vtag = le16toh(cur->wb.upper.vlan); eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0); - /* Make sure all parts of a bad packet are discarded */ + /* Make sure bad packets are discarded */ if (((staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) || (rxr->discard)) { ifp->if_ierrors++; rxr->rx_discarded++; - if (!eop) - rxr->discard = TRUE; - else + if (eop) rxr->discard = FALSE; + else + rxr->discard = TRUE; ixgbe_rx_discard(rxr, i); goto next_desc; } @@ -4129,7 +4139,7 @@ ixgbe_rxeof(struct ix_queue *que, int co ** not be fragmented across sequential ** descriptors, rather the next descriptor ** is indicated in bits of the descriptor. - ** This also means that we might process + ** This also means that we might proceses ** more than one packet at a time, something ** that has never been true before, it ** required eliminating global chain pointers @@ -4210,7 +4220,8 @@ ixgbe_rxeof(struct ix_queue *que, int co } else { /* Singlet, prepare to send */ sendmp = mh; - if (staterr & IXGBE_RXD_STAT_VP) { + if ((adapter->num_vlans) && + (staterr & IXGBE_RXD_STAT_VP)) { sendmp->m_pkthdr.ether_vtag = vtag; sendmp->m_flags |= M_VLANTAG; } @@ -4376,12 +4387,13 @@ ixgbe_register_vlan(void *arg, struct if if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; + IXGBE_CORE_LOCK(adapter); index = (vtag >> 5) & 0x7F; bit = vtag & 0x1F; - ixgbe_shadow_vfta[index] |= (1 << bit); + adapter->shadow_vfta[index] |= (1 << bit); ++adapter->num_vlans; - /* Re-init to load the changes */ - ixgbe_init(adapter); + ixgbe_init_locked(adapter); + IXGBE_CORE_UNLOCK(adapter); } /* @@ -4401,17 +4413,20 @@ ixgbe_unregister_vlan(void *arg, struct if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; + IXGBE_CORE_LOCK(adapter); index = (vtag >> 5) & 0x7F; bit = vtag & 0x1F; - ixgbe_shadow_vfta[index] &= ~(1 << bit); + adapter->shadow_vfta[index] &= ~(1 << bit); --adapter->num_vlans; /* Re-init to load the changes */ - ixgbe_init(adapter); + ixgbe_init_locked(adapter); + IXGBE_CORE_UNLOCK(adapter); } static void ixgbe_setup_vlan_hw_support(struct adapter *adapter) { + struct ifnet *ifp = adapter->ifp; struct ixgbe_hw *hw = &adapter->hw; u32 ctrl; @@ -4430,14 +4445,16 @@ ixgbe_setup_vlan_hw_support(struct adapt ** we need to repopulate it now. */ for (int i = 0; i < IXGBE_VFTA_SIZE; i++) - if (ixgbe_shadow_vfta[i] != 0) + if (adapter->shadow_vfta[i] != 0) IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), - ixgbe_shadow_vfta[i]); + adapter->shadow_vfta[i]); - /* Enable the Filter Table */ ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); - ctrl &= ~IXGBE_VLNCTRL_CFIEN; - ctrl |= IXGBE_VLNCTRL_VFE; + /* Enable the Filter Table if enabled */ + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) { + ctrl &= ~IXGBE_VLNCTRL_CFIEN; + ctrl |= IXGBE_VLNCTRL_VFE; + } if (hw->mac.type == ixgbe_mac_82598EB) ctrl |= IXGBE_VLNCTRL_VME; IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); @@ -4478,14 +4495,14 @@ ixgbe_enable_intr(struct adapter *adapte /* With RSS we use auto clear */ if (adapter->msix_mem) { mask = IXGBE_EIMS_ENABLE_MASK; - /* Don't autoclear Link */ + /* Dont autoclear Link */ mask &= ~IXGBE_EIMS_OTHER; mask &= ~IXGBE_EIMS_LSC; IXGBE_WRITE_REG(hw, IXGBE_EIAC, mask); } /* - ** Now enable all queues, this is done separately to + ** Now enable all queues, this is done seperately to ** allow for handling the extended (beyond 32) MSIX ** vectors that can be used by 82599 */ Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Fri Nov 26 22:36:47 2010 (r215910) +++ head/sys/dev/ixgbe/ixgbe.h Fri Nov 26 22:46:32 2010 (r215911) @@ -179,6 +179,9 @@ #define IXGBE_RX_HDR 128 #define IXGBE_VFTA_SIZE 128 #define IXGBE_BR_SIZE 4096 +#define IXGBE_QUEUE_IDLE 0 +#define IXGBE_QUEUE_WORKING 1 +#define IXGBE_QUEUE_HUNG 2 /* Offload bits in mbuf flag */ #if __FreeBSD_version >= 800000 @@ -205,11 +208,6 @@ #define IXGBE_BULK_LATENCY 1200 #define IXGBE_LINK_ITR 2000 -/* Header split args for get_bug */ -#define IXGBE_CLEAN_HDR 1 -#define IXGBE_CLEAN_PKT 2 -#define IXGBE_CLEAN_ALL 3 - /* ***************************************************************************** * vendor_info_array @@ -280,7 +278,7 @@ struct tx_ring { struct adapter *adapter; struct mtx tx_mtx; u32 me; - bool watchdog_check; + int queue_status; int watchdog_time; union ixgbe_adv_tx_desc *tx_base; struct ixgbe_dma_alloc txdma; @@ -374,7 +372,15 @@ struct adapter { u16 num_vlans; u16 num_queues; - /* Info about the board itself */ + /* + ** Shadow VFTA table, this is needed because + ** the real vlan filter table gets cleared during + ** a soft reset and the driver needs to be able + ** to repopulate it. + */ + u32 shadow_vfta[IXGBE_VFTA_SIZE]; + + /* Info about the interface */ u32 optics; int advertise; /* link speeds */ bool link_active; @@ -421,8 +427,6 @@ struct adapter { u64 que_mask; u32 rx_process_limit; - /* Multicast array memory */ - u8 *mta; /* Misc stats maintained by the driver */ unsigned long dropped_pkts; unsigned long mbuf_defrag_failed; Modified: head/sys/dev/ixgbe/ixgbe_82598.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_82598.c Fri Nov 26 22:36:47 2010 (r215910) +++ head/sys/dev/ixgbe/ixgbe_82598.c Fri Nov 26 22:46:32 2010 (r215911) @@ -73,7 +73,6 @@ u32 ixgbe_get_supported_physical_layer_8 s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw); void ixgbe_set_lan_id_multi_port_pcie_82598(struct ixgbe_hw *hw); void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw); -static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw); /** * ixgbe_set_pcie_completion_timeout - set pci-e completion timeout @@ -186,6 +185,7 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw mac->mcft_size = 128; mac->vft_size = 128; mac->num_rar_entries = 16; + mac->rx_pb_size = 512; mac->max_tx_queues = 32; mac->max_rx_queues = 64; mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw); @@ -196,6 +196,7 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw /* Link */ mac->ops.check_link = &ixgbe_check_mac_link_82598; mac->ops.setup_link = &ixgbe_setup_mac_link_82598; + mac->ops.flap_tx_laser = NULL; mac->ops.get_link_capabilities = &ixgbe_get_link_capabilities_82598; @@ -385,11 +386,14 @@ static enum ixgbe_media_type ixgbe_get_m DEBUGFUNC("ixgbe_get_media_type_82598"); /* Detect if there is a copper PHY attached. */ - if (hw->phy.type == ixgbe_phy_cu_unknown || - hw->phy.type == ixgbe_phy_tn || - hw->phy.type == ixgbe_phy_aq) { + switch (hw->phy.type) { + case ixgbe_phy_cu_unknown: + case ixgbe_phy_tn: + case ixgbe_phy_aq: media_type = ixgbe_media_type_copper; goto out; + default: + break; } /* Media type for I82598 is based on device ID */ @@ -436,6 +440,7 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_h u32 fctrl_reg; u32 rmcs_reg; u32 reg; + u32 rx_pba_size; u32 link_speed = 0; bool link_up; @@ -463,7 +468,7 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_h /* Negotiate the fc mode to use */ ret_val = ixgbe_fc_autoneg(hw); - if (ret_val) + if (ret_val == IXGBE_ERR_FLOW_CONTROL) goto out; /* Disable any previous flow control settings */ @@ -485,7 +490,8 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_h */ switch (hw->fc.current_mode) { case ixgbe_fc_none: - /* Flow control is disabled by software override or autoneg. + /* + * Flow control is disabled by software override or autoneg. * The code below will actually disable it in the HW. */ break; @@ -526,16 +532,19 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_h /* Set up and enable Rx high/low water mark thresholds, enable XON. */ if (hw->fc.current_mode & ixgbe_fc_tx_pause) { - if (hw->fc.send_xon) { - IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), - (hw->fc.low_water | IXGBE_FCRTL_XONE)); - } else { - IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), - hw->fc.low_water); - } + rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(packetbuf_num)); + rx_pba_size >>= IXGBE_RXPBSIZE_SHIFT; + + reg = (rx_pba_size - hw->fc.low_water) << 6; + if (hw->fc.send_xon) + reg |= IXGBE_FCRTL_XONE; + + IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), reg); - IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num), - (hw->fc.high_water | IXGBE_FCRTH_FCEN)); + reg = (rx_pba_size - hw->fc.high_water) << 6; + reg |= IXGBE_FCRTH_FCEN; + + IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num), reg); } /* Configure pause time (2 TCs per register) */ @@ -560,7 +569,7 @@ out: * Restarts the link. Performs autonegotiation if needed. **/ static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw, - bool autoneg_wait_to_complete) + bool autoneg_wait_to_complete) { u32 autoc_reg; u32 links_reg; @@ -601,6 +610,41 @@ static s32 ixgbe_start_mac_link_82598(st } /** + * ixgbe_validate_link_ready - Function looks for phy link + * @hw: pointer to hardware structure + * + * Function indicates success when phy link is available. If phy is not ready + * within 5 seconds of MAC indicating link, the function returns error. + **/ +static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw) +{ + u32 timeout; + u16 an_reg; + + if (hw->device_id != IXGBE_DEV_ID_82598AT2) + return IXGBE_SUCCESS; + + for (timeout = 0; + timeout < IXGBE_VALIDATE_LINK_READY_TIMEOUT; timeout++) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 23:44:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D7931065673 for ; Fri, 26 Nov 2010 23:44:32 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx23.fluidhosting.com [204.14.89.6]) by mx1.freebsd.org (Postfix) with ESMTP id 222C38FC44 for ; Fri, 26 Nov 2010 23:44:31 +0000 (UTC) Received: (qmail 20081 invoked by uid 399); 26 Nov 2010 23:44:31 -0000 Received: from localhost (HELO doug-optiplex.ka9q.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 26 Nov 2010 23:44:31 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4CF0465D.3040501@FreeBSD.org> Date: Fri, 26 Nov 2010 15:44:29 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101028 Thunderbird/3.1.6 MIME-Version: 1.0 To: Attilio Rao References: <201011261535.oAQFZ8FT051259@svn.freebsd.org> In-Reply-To: <201011261535.oAQFZ8FT051259@svn.freebsd.org> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215868 - head/sys/dev/ichwd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 23:44:32 -0000 The tinderbox seems to think that this broke the build. Doug On 11/26/2010 07:35, Attilio Rao wrote: > Author: attilio > Date: Fri Nov 26 15:35:08 2010 > New Revision: 215868 > URL: http://svn.freebsd.org/changeset/base/215868 > > Log: > - Advertise when the reboot came from a watchdog-induced reset. > - Fix a bug where TCO_BOOT_STS was supposed to be cleared after > TCO_SECOND_TO_STS and not before. > > Sponsored by: Sandvine Incorporated > Submitted by: Mark Johnston > Reviewed by: des > MFC after: 10 days > > Modified: > head/sys/dev/ichwd/ichwd.c > > Modified: head/sys/dev/ichwd/ichwd.c > ============================================================================== > --- head/sys/dev/ichwd/ichwd.c Fri Nov 26 15:33:09 2010 (r215867) > +++ head/sys/dev/ichwd/ichwd.c Fri Nov 26 15:35:08 2010 (r215868) > @@ -225,12 +225,12 @@ ichwd_sts_reset(struct ichwd_softc *sc) > * by writing a 1, not a 0. > */ > ichwd_write_tco_2(sc, TCO1_STS, TCO_TIMEOUT); > - /* > - * XXX The datasheet says that TCO_SECOND_TO_STS must be cleared > - * before TCO_BOOT_STS, not the other way around. > + /* > + * According to Intel's docs, clearing SECOND_TO_STS and BOOT_STS must > + * be done in two separate operations. > */ > - ichwd_write_tco_2(sc, TCO2_STS, TCO_BOOT_STS); > ichwd_write_tco_2(sc, TCO2_STS, TCO_SECOND_TO_STS); > + ichwd_write_tco_2(sc, TCO2_STS, TCO_BOOT_STS); > } > > /* > @@ -520,11 +520,12 @@ ichwd_attach(device_t dev) > device_get_desc(dev), sc->ich_version); > > /* > - * XXX we should check the status registers (specifically, the > - * TCO_SECOND_TO_STS bit in the TCO2_STS register) to see if we > - * just came back from a watchdog-induced reset, and let the user > - * know. > + * Determine if we are coming up after a watchdog-induced reset. > + * This bit is cleared in ichwd_sts_reset(). > */ > + if ((ich_read_tco_2(sc, TCO2_STS)& TCO_SECOND_TO_STS) != 0) > + device_printf(dev, > + "resuming after hardware watchdog timeout\n"); > > /* reset the watchdog status registers */ > ichwd_sts_reset(sc); > -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Fri Nov 26 23:57:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FAF51065672; Fri, 26 Nov 2010 23:57:14 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DD168FC15; Fri, 26 Nov 2010 23:57:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQNvEEd098872; Fri, 26 Nov 2010 23:57:14 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQNvDIU098870; Fri, 26 Nov 2010 23:57:14 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201011262357.oAQNvDIU098870@svn.freebsd.org> From: Jack F Vogel Date: Fri, 26 Nov 2010 23:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215913 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 23:57:16 -0000 Author: jfv Date: Fri Nov 26 23:57:13 2010 New Revision: 215913 URL: http://svn.freebsd.org/changeset/base/215913 Log: A couple fixes got clobbered, putting them back. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 26 22:50:58 2010 (r215912) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 26 23:57:13 2010 (r215913) @@ -120,9 +120,9 @@ static int ixgbe_allocate_legacy(st static int ixgbe_allocate_queues(struct adapter *); static int ixgbe_setup_msix(struct adapter *); static void ixgbe_free_pci_resources(struct adapter *); -static void ixgbe_local_timer(void *); -static void ixgbe_setup_interface(device_t, struct adapter *); -static void ixgbe_config_link(struct adapter *); +static void ixgbe_local_timer(void *); +static int ixgbe_setup_interface(device_t, struct adapter *); +static void ixgbe_config_link(struct adapter *); static int ixgbe_allocate_transmit_buffers(struct tx_ring *); static int ixgbe_setup_transmit_structures(struct adapter *); @@ -258,7 +258,7 @@ TUNABLE_INT("hw.ixgbe.enable_msix", &ixg /* * Header split: this causes the hardware to DMA - * the header into a seperate mbuf from the payload, + * the header into a separate mbuf from the payload, * it can be a performance win in some workloads, but * in others it actually hurts, its off by default. */ @@ -519,6 +519,15 @@ ixgbe_attach(device_t dev) goto err_out; } + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u8) * IXGBE_ETH_LENGTH_OF_ADDRESS * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); + error = ENOMEM; + goto err_late; + } + /* Initialize the shared code */ error = ixgbe_init_shared_code(hw); if (error == IXGBE_ERR_SFP_NOT_PRESENT) { @@ -581,7 +590,8 @@ ixgbe_attach(device_t dev) goto err_late; /* Setup OS specific network interface */ - ixgbe_setup_interface(dev, adapter); + if (ixgbe_setup_interface(dev, adapter) != 0) + goto err_late; /* Sysctl for limiting the amount of work done in the taskqueue */ ixgbe_add_rx_process_limit(adapter, "rx_processing_limit", @@ -627,7 +637,10 @@ err_late: ixgbe_free_transmit_structures(adapter); ixgbe_free_receive_structures(adapter); err_out: + if (adapter->ifp != NULL) + if_free(adapter->ifp); ixgbe_free_pci_resources(adapter); + free(adapter->mta, M_DEVBUF); return (error); } @@ -698,6 +711,7 @@ ixgbe_detach(device_t dev) ixgbe_free_transmit_structures(adapter); ixgbe_free_receive_structures(adapter); + free(adapter->mta, M_DEVBUF); IXGBE_CORE_LOCK_DESTROY(adapter); return (0); @@ -1791,7 +1805,7 @@ static void ixgbe_set_multi(struct adapter *adapter) { u32 fctrl; - u8 mta[MAX_NUM_MULTICAST_ADDRESSES * IXGBE_ETH_LENGTH_OF_ADDRESS]; + u8 *mta; u8 *update_ptr; struct ifmultiaddr *ifma; int mcnt = 0; @@ -1799,6 +1813,10 @@ ixgbe_set_multi(struct adapter *adapter) IOCTL_DEBUGOUT("ixgbe_set_multi: begin"); + mta = adapter->mta; + bzero(mta, sizeof(u8) * IXGBE_ETH_LENGTH_OF_ADDRESS * + MAX_NUM_MULTICAST_ADDRESSES); + fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); if (ifp->if_flags & IFF_PROMISC) @@ -2345,7 +2363,7 @@ mem: * Setup networking device structure and register an interface. * **********************************************************************/ -static void +static int ixgbe_setup_interface(device_t dev, struct adapter *adapter) { struct ixgbe_hw *hw = &adapter->hw; @@ -2354,8 +2372,10 @@ ixgbe_setup_interface(device_t dev, stru INIT_DEBUGOUT("ixgbe_setup_interface: begin"); ifp = adapter->ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) - panic("%s: can not if_alloc()\n", device_get_nameunit(dev)); + if (ifp == NULL) { + device_printf(dev, "can not allocate ifnet structure\n"); + return (-1); + } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; ifp->if_baudrate = 1000000000; @@ -2415,7 +2435,7 @@ ixgbe_setup_interface(device_t dev, stru ifmedia_add(&adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&adapter->media, IFM_ETHER | IFM_AUTO); - return; + return (0); } static void @@ -3663,7 +3683,7 @@ ixgbe_setup_receive_ring(struct rx_ring rxbuf = &rxr->rx_buffers[j]; /* - ** Dont allocate mbufs if not + ** Don't allocate mbufs if not ** doing header split, its wasteful */ if (rxr->hdr_split == FALSE) @@ -4495,14 +4515,14 @@ ixgbe_enable_intr(struct adapter *adapte /* With RSS we use auto clear */ if (adapter->msix_mem) { mask = IXGBE_EIMS_ENABLE_MASK; - /* Dont autoclear Link */ + /* Don't autoclear Link */ mask &= ~IXGBE_EIMS_OTHER; mask &= ~IXGBE_EIMS_LSC; IXGBE_WRITE_REG(hw, IXGBE_EIAC, mask); } /* - ** Now enable all queues, this is done seperately to + ** Now enable all queues, this is done separately to ** allow for handling the extended (beyond 32) MSIX ** vectors that can be used by 82599 */ From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 00:00:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1858106571C; Sat, 27 Nov 2010 00:00:33 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A09958FC0A; Sat, 27 Nov 2010 00:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAR00XYo099063; Sat, 27 Nov 2010 00:00:33 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAR00XVX099060; Sat, 27 Nov 2010 00:00:33 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201011270000.oAR00XVX099060@svn.freebsd.org> From: Jack F Vogel Date: Sat, 27 Nov 2010 00:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215914 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 00:00:33 -0000 Author: jfv Date: Sat Nov 27 00:00:33 2010 New Revision: 215914 URL: http://svn.freebsd.org/changeset/base/215914 Log: and the header... Modified: head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Fri Nov 26 23:57:13 2010 (r215913) +++ head/sys/dev/ixgbe/ixgbe.h Sat Nov 27 00:00:33 2010 (r215914) @@ -427,6 +427,9 @@ struct adapter { u64 que_mask; u32 rx_process_limit; + /* Multicast array memory */ + u8 *mta; + /* Misc stats maintained by the driver */ unsigned long dropped_pkts; unsigned long mbuf_defrag_failed; From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 00:26:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17C39106564A; Sat, 27 Nov 2010 00:26:20 +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 067F08FC13; Sat, 27 Nov 2010 00:26:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAR0QJHJ000817; Sat, 27 Nov 2010 00:26:19 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAR0QJoh000815; Sat, 27 Nov 2010 00:26:19 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201011270026.oAR0QJoh000815@svn.freebsd.org> From: Ed Maste Date: Sat, 27 Nov 2010 00:26:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215918 - head/sys/dev/ichwd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 00:26:20 -0000 Author: emaste Date: Sat Nov 27 00:26:19 2010 New Revision: 215918 URL: http://svn.freebsd.org/changeset/base/215918 Log: Fix build by correcting function name. Pointed out by dougb. Modified: head/sys/dev/ichwd/ichwd.c Modified: head/sys/dev/ichwd/ichwd.c ============================================================================== --- head/sys/dev/ichwd/ichwd.c Sat Nov 27 00:26:08 2010 (r215917) +++ head/sys/dev/ichwd/ichwd.c Sat Nov 27 00:26:19 2010 (r215918) @@ -523,7 +523,7 @@ ichwd_attach(device_t dev) * Determine if we are coming up after a watchdog-induced reset. * This bit is cleared in ichwd_sts_reset(). */ - if ((ich_read_tco_2(sc, TCO2_STS) & TCO_SECOND_TO_STS) != 0) + if ((ichwd_read_tco_2(sc, TCO2_STS) & TCO_SECOND_TO_STS) != 0) device_printf(dev, "resuming after hardware watchdog timeout\n"); From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 01:26:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB8341065670; Sat, 27 Nov 2010 01:26:59 +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 9A0428FC14; Sat, 27 Nov 2010 01:26:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAR1Qxse003818; Sat, 27 Nov 2010 01:26:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAR1QxWZ003815; Sat, 27 Nov 2010 01:26:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011270126.oAR1QxWZ003815@svn.freebsd.org> From: Marius Strobl Date: Sat, 27 Nov 2010 01:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215923 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 01:26:59 -0000 Author: marius Date: Sat Nov 27 01:26:59 2010 New Revision: 215923 URL: http://svn.freebsd.org/changeset/base/215923 Log: Allow pause support advertisement to be turned off again. Submitted by: yongari (ip1000phy(4)) Modified: head/sys/dev/mii/e1000phy.c head/sys/dev/mii/ip1000phy.c Modified: head/sys/dev/mii/e1000phy.c ============================================================================== --- head/sys/dev/mii/e1000phy.c Sat Nov 27 01:09:54 2010 (r215922) +++ head/sys/dev/mii/e1000phy.c Sat Nov 27 01:26:59 2010 (r215923) @@ -497,6 +497,7 @@ e1000phy_mii_phy_auto(struct e1000phy_so sc = &esc->mii_sc; if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { reg = PHY_READ(sc, E1000_AR); + reg &= ~(E1000_AR_PAUSE | E1000_AR_ASM_DIR); reg |= E1000_AR_10T | E1000_AR_10T_FD | E1000_AR_100TX | E1000_AR_100TX_FD; if ((media & IFM_FLOW) != 0 || Modified: head/sys/dev/mii/ip1000phy.c ============================================================================== --- head/sys/dev/mii/ip1000phy.c Sat Nov 27 01:09:54 2010 (r215922) +++ head/sys/dev/mii/ip1000phy.c Sat Nov 27 01:26:59 2010 (r215923) @@ -347,6 +347,7 @@ ip1000phy_mii_phy_auto(struct mii_softc reg = 0; if (isc->model == MII_MODEL_ICPLUS_IP1001) { reg = PHY_READ(sc, IP1000PHY_MII_ANAR); + reg &= ~(IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE); reg |= IP1000PHY_ANAR_NP; } reg |= IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX | From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 01:34:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FBDF106564A; Sat, 27 Nov 2010 01:34:10 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F08F98FC17; Sat, 27 Nov 2010 01:34:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAR1Y9d4004142; Sat, 27 Nov 2010 01:34:09 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAR1Y9K6004140; Sat, 27 Nov 2010 01:34:09 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201011270134.oAR1Y9K6004140@svn.freebsd.org> From: Jack F Vogel Date: Sat, 27 Nov 2010 01:34:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215924 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 01:34:10 -0000 Author: jfv Date: Sat Nov 27 01:34:09 2010 New Revision: 215924 URL: http://svn.freebsd.org/changeset/base/215924 Log: Interrupt handler, and stats changes from Michael Tuexen, thanks Michael! Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Sat Nov 27 01:26:59 2010 (r215923) +++ head/sys/dev/ixgbe/ixgbe.c Sat Nov 27 01:34:09 2010 (r215924) @@ -147,13 +147,9 @@ static bool ixgbe_rxeof(struct ix_queue static void ixgbe_rx_checksum(u32, struct mbuf *, u32); static void ixgbe_set_promisc(struct adapter *); static void ixgbe_set_multi(struct adapter *); -static void ixgbe_print_hw_stats(struct adapter *); -static void ixgbe_print_debug_info(struct adapter *); static void ixgbe_update_link_status(struct adapter *); static void ixgbe_refresh_mbufs(struct rx_ring *, int); static int ixgbe_xmit(struct tx_ring *, struct mbuf **); -static int ixgbe_sysctl_stats(SYSCTL_HANDLER_ARGS); -static int ixgbe_sysctl_debug(SYSCTL_HANDLER_ARGS); static int ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS); static int ixgbe_set_advertise(SYSCTL_HANDLER_ARGS); static int ixgbe_dma_malloc(struct adapter *, bus_size_t, @@ -171,6 +167,8 @@ static void ixgbe_setup_vlan_hw_support( static void ixgbe_register_vlan(void *, struct ifnet *, u16); static void ixgbe_unregister_vlan(void *, struct ifnet *, u16); +static void ixgbe_add_hw_stats(struct adapter *adapter); + static __inline void ixgbe_rx_discard(struct rx_ring *, int); static __inline void ixgbe_rx_input(struct rx_ring *, struct ifnet *, struct mbuf *, u32); @@ -232,6 +230,9 @@ MODULE_DEPEND(ixgbe, ether, 1, 1, 1); static int ixgbe_enable_aim = TRUE; TUNABLE_INT("hw.ixgbe.enable_aim", &ixgbe_enable_aim); +static int ixgbe_max_interrupt_rate = (8000000 / IXGBE_LOW_LATENCY); +TUNABLE_INT("hw.ixgbe.max_interrupt_rate", &ixgbe_max_interrupt_rate); + /* How many packets rxeof tries to clean at a time */ static int ixgbe_rx_process_limit = 128; TUNABLE_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit); @@ -445,15 +446,6 @@ ixgbe_attach(device_t dev) } /* SYSCTL APIs */ - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "stats", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_sysctl_stats, "I", "Statistics"); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "debug", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_sysctl_debug, "I", "Debug Info"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -631,6 +623,8 @@ ixgbe_attach(device_t dev) ctrl_ext |= IXGBE_CTRL_EXT_DRV_LOAD; IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); + ixgbe_add_hw_stats(adapter); + INIT_DEBUGOUT("ixgbe_attach: end"); return (0); err_late: @@ -1885,7 +1879,6 @@ static void ixgbe_local_timer(void *arg) { struct adapter *adapter = arg; - struct ifnet *ifp = adapter->ifp; device_t dev = adapter->dev; struct tx_ring *txr = adapter->tx_rings; @@ -1899,10 +1892,6 @@ ixgbe_local_timer(void *arg) ixgbe_update_link_status(adapter); ixgbe_update_stats_counters(adapter); - /* Debug display */ - if (ixgbe_display_debug_stats && ifp->if_drv_flags & IFF_DRV_RUNNING) - ixgbe_print_hw_stats(adapter); - /* * If the interface has been paused * then don't do the watchdog check @@ -1918,7 +1907,7 @@ ixgbe_local_timer(void *arg) goto hung; out: - ixgbe_rearm_queues(adapter, adapter->que_mask); + ixgbe_rearm_queues(adapter, adapter->que_mask); callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter); return; @@ -4623,6 +4612,12 @@ static void ixgbe_configure_ivars(struct adapter *adapter) { struct ix_queue *que = adapter->queues; + u32 newitr; + + if (ixgbe_max_interrupt_rate > 0) + newitr = (8000000 / ixgbe_max_interrupt_rate) & 0x0FF8; + else + newitr = 0; for (int i = 0; i < adapter->num_queues; i++, que++) { /* First the RX queue entry */ @@ -4631,7 +4626,7 @@ ixgbe_configure_ivars(struct adapter *ad ixgbe_set_ivar(adapter, i, que->msix, 1); /* Set an Initial EITR value */ IXGBE_WRITE_REG(&adapter->hw, - IXGBE_EITR(que->msix), IXGBE_LOW_LATENCY); + IXGBE_EITR(que->msix), newitr); } /* For the Link interrupt */ @@ -4768,6 +4763,9 @@ ixgbe_update_stats_counters(struct adapt u64 total_missed_rx = 0; adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); + adapter->stats.illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC); + adapter->stats.errbc += IXGBE_READ_REG(hw, IXGBE_ERRBC); + adapter->stats.mspdc += IXGBE_READ_REG(hw, IXGBE_MSPDC); for (int i = 0; i < 8; i++) { u32 mp; @@ -4779,20 +4777,45 @@ ixgbe_update_stats_counters(struct adapt /* Running comprehensive total for stats display */ total_missed_rx += adapter->stats.mpc[i]; if (hw->mac.type == ixgbe_mac_82598EB) - adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i)); + adapter->stats.rnbc[i] += + IXGBE_READ_REG(hw, IXGBE_RNBC(i)); + adapter->stats.pxontxc[i] += + IXGBE_READ_REG(hw, IXGBE_PXONTXC(i)); + adapter->stats.pxonrxc[i] += + IXGBE_READ_REG(hw, IXGBE_PXONRXC(i)); + adapter->stats.pxofftxc[i] += + IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i)); + adapter->stats.pxoffrxc[i] += + IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(i)); + adapter->stats.pxon2offc[i] += + IXGBE_READ_REG(hw, IXGBE_PXON2OFFCNT(i)); + } + for (int i = 0; i < 16; i++) { + adapter->stats.qprc[i] += IXGBE_READ_REG(hw, IXGBE_QPRC(i)); + adapter->stats.qptc[i] += IXGBE_READ_REG(hw, IXGBE_QPTC(i)); + adapter->stats.qbrc[i] += IXGBE_READ_REG(hw, IXGBE_QBRC(i)); + adapter->stats.qbrc[i] += + ((u64)IXGBE_READ_REG(hw, IXGBE_QBRC(i)) << 32); + adapter->stats.qbtc[i] += IXGBE_READ_REG(hw, IXGBE_QBTC(i)); + adapter->stats.qbtc[i] += + ((u64)IXGBE_READ_REG(hw, IXGBE_QBTC(i)) << 32); + adapter->stats.qprdc[i] += IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); } + adapter->stats.mlfc += IXGBE_READ_REG(hw, IXGBE_MLFC); + adapter->stats.mrfc += IXGBE_READ_REG(hw, IXGBE_MRFC); + adapter->stats.rlec += IXGBE_READ_REG(hw, IXGBE_RLEC); /* Hardware workaround, gprc counts missed packets */ adapter->stats.gprc += IXGBE_READ_REG(hw, IXGBE_GPRC); adapter->stats.gprc -= missed_rx; if (hw->mac.type == ixgbe_mac_82599EB) { - adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCL); - IXGBE_READ_REG(hw, IXGBE_GORCH); /* clears register */ - adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL); - IXGBE_READ_REG(hw, IXGBE_GOTCH); /* clears register */ - adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORL); - IXGBE_READ_REG(hw, IXGBE_TORH); /* clears register */ + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCL) + + ((u64)IXGBE_READ_REG(hw, IXGBE_GORCH) << 32); + adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL) + + ((u64)IXGBE_READ_REG(hw, IXGBE_GOTCH) << 32); + adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORL) + + ((u64)IXGBE_READ_REG(hw, IXGBE_TORH) << 32); adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); } else { @@ -4813,14 +4836,12 @@ ixgbe_update_stats_counters(struct adapt adapter->stats.mprc += IXGBE_READ_REG(hw, IXGBE_MPRC); adapter->stats.mprc -= bprc; - adapter->stats.roc += IXGBE_READ_REG(hw, IXGBE_ROC); adapter->stats.prc64 += IXGBE_READ_REG(hw, IXGBE_PRC64); adapter->stats.prc127 += IXGBE_READ_REG(hw, IXGBE_PRC127); adapter->stats.prc255 += IXGBE_READ_REG(hw, IXGBE_PRC255); adapter->stats.prc511 += IXGBE_READ_REG(hw, IXGBE_PRC511); adapter->stats.prc1023 += IXGBE_READ_REG(hw, IXGBE_PRC1023); adapter->stats.prc1522 += IXGBE_READ_REG(hw, IXGBE_PRC1522); - adapter->stats.rlec += IXGBE_READ_REG(hw, IXGBE_RLEC); lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC); adapter->stats.lxontxc += lxon; @@ -4838,14 +4859,27 @@ ixgbe_update_stats_counters(struct adapt adapter->stats.ruc += IXGBE_READ_REG(hw, IXGBE_RUC); adapter->stats.rfc += IXGBE_READ_REG(hw, IXGBE_RFC); + adapter->stats.roc += IXGBE_READ_REG(hw, IXGBE_ROC); adapter->stats.rjc += IXGBE_READ_REG(hw, IXGBE_RJC); + adapter->stats.mngprc += IXGBE_READ_REG(hw, IXGBE_MNGPRC); + adapter->stats.mngpdc += IXGBE_READ_REG(hw, IXGBE_MNGPDC); + adapter->stats.mngptc += IXGBE_READ_REG(hw, IXGBE_MNGPTC); adapter->stats.tpr += IXGBE_READ_REG(hw, IXGBE_TPR); + adapter->stats.tpt += IXGBE_READ_REG(hw, IXGBE_TPT); adapter->stats.ptc127 += IXGBE_READ_REG(hw, IXGBE_PTC127); adapter->stats.ptc255 += IXGBE_READ_REG(hw, IXGBE_PTC255); adapter->stats.ptc511 += IXGBE_READ_REG(hw, IXGBE_PTC511); adapter->stats.ptc1023 += IXGBE_READ_REG(hw, IXGBE_PTC1023); adapter->stats.ptc1522 += IXGBE_READ_REG(hw, IXGBE_PTC1522); adapter->stats.bptc += IXGBE_READ_REG(hw, IXGBE_BPTC); + adapter->stats.xec += IXGBE_READ_REG(hw, IXGBE_XEC); + adapter->stats.fccrc += IXGBE_READ_REG(hw, IXGBE_FCCRC); + adapter->stats.fclast += IXGBE_READ_REG(hw, IXGBE_FCLAST); + adapter->stats.fcoerpdc += IXGBE_READ_REG(hw, IXGBE_FCOERPDC); + adapter->stats.fcoeprc += IXGBE_READ_REG(hw, IXGBE_FCOEPRC); + adapter->stats.fcoeptc += IXGBE_READ_REG(hw, IXGBE_FCOEPTC); + adapter->stats.fcoedwrc += IXGBE_READ_REG(hw, IXGBE_FCOEDWRC); + adapter->stats.fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC); /* Fill out the OS statistics structure */ @@ -4861,147 +4895,372 @@ ixgbe_update_stats_counters(struct adapt adapter->stats.rlec; } - -/********************************************************************** - * - * This routine is called only when ixgbe_display_debug_stats is enabled. - * This routine provides a way to take a look at important statistics - * maintained by the driver and hardware. - * - **********************************************************************/ -static void -ixgbe_print_hw_stats(struct adapter * adapter) +/** ixgbe_sysctl_tdh_handler - Handler function + * Retrieves the TDH value from the hardware + */ +static int +ixgbe_sysctl_tdh_handler(SYSCTL_HANDLER_ARGS) { - device_t dev = adapter->dev; - + int error; - device_printf(dev,"Std Mbuf Failed = %lu\n", - adapter->mbuf_defrag_failed); - device_printf(dev,"Missed Packets = %llu\n", - (long long)adapter->stats.mpc[0]); - device_printf(dev,"Receive length errors = %llu\n", - ((long long)adapter->stats.roc + - (long long)adapter->stats.ruc)); - device_printf(dev,"Crc errors = %llu\n", - (long long)adapter->stats.crcerrs); - device_printf(dev,"Driver dropped packets = %lu\n", - adapter->dropped_pkts); - device_printf(dev, "watchdog timeouts = %ld\n", - adapter->watchdog_events); - - device_printf(dev,"XON Rcvd = %llu\n", - (long long)adapter->stats.lxonrxc); - device_printf(dev,"XON Xmtd = %llu\n", - (long long)adapter->stats.lxontxc); - device_printf(dev,"XOFF Rcvd = %llu\n", - (long long)adapter->stats.lxoffrxc); - device_printf(dev,"XOFF Xmtd = %llu\n", - (long long)adapter->stats.lxofftxc); - - device_printf(dev,"Total Packets Rcvd = %llu\n", - (long long)adapter->stats.tpr); - device_printf(dev,"Good Packets Rcvd = %llu\n", - (long long)adapter->stats.gprc); - device_printf(dev,"Good Packets Xmtd = %llu\n", - (long long)adapter->stats.gptc); - device_printf(dev,"TSO Transmissions = %lu\n", - adapter->tso_tx); + struct tx_ring *txr = ((struct tx_ring *)oidp->oid_arg1); + if (!txr) return 0; - return; + unsigned val = IXGBE_READ_REG(&txr->adapter->hw, IXGBE_TDH(txr->me)); + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr) + return error; + return 0; } -/********************************************************************** - * - * This routine is called only when em_display_debug_stats is enabled. - * This routine provides a way to take a look at important statistics - * maintained by the driver and hardware. - * - **********************************************************************/ -static void -ixgbe_print_debug_info(struct adapter *adapter) +/** ixgbe_sysctl_tdt_handler - Handler function + * Retrieves the TDT value from the hardware + */ +static int +ixgbe_sysctl_tdt_handler(SYSCTL_HANDLER_ARGS) { - device_t dev = adapter->dev; - struct ixgbe_hw *hw = &adapter->hw; - struct ix_queue *que = adapter->queues; - struct rx_ring *rxr; - struct tx_ring *txr; - struct lro_ctrl *lro; - - device_printf(dev,"Error Byte Count = %u \n", - IXGBE_READ_REG(hw, IXGBE_ERRBC)); + int error; - for (int i = 0; i < adapter->num_queues; i++, que++) { - txr = que->txr; - rxr = que->rxr; - lro = &rxr->lro; - device_printf(dev,"QUE(%d) IRQs Handled: %lu\n", - que->msix, (long)que->irqs); - device_printf(dev,"RX[%d]: rdh = %d, hw rdt = %d\n", - i, IXGBE_READ_REG(hw, IXGBE_RDH(i)), - IXGBE_READ_REG(hw, IXGBE_RDT(i))); - device_printf(dev,"TX[%d] tdh = %d, hw tdt = %d\n", i, - IXGBE_READ_REG(hw, IXGBE_TDH(i)), - IXGBE_READ_REG(hw, IXGBE_TDT(i))); - device_printf(dev,"RX(%d) Packets Received: %lld\n", - rxr->me, (long long)rxr->rx_packets); - device_printf(dev,"RX(%d) Split RX Packets: %lld\n", - rxr->me, (long long)rxr->rx_split_packets); - device_printf(dev,"RX(%d) Bytes Received: %lu\n", - rxr->me, (long)rxr->rx_bytes); - device_printf(dev,"RX(%d) LRO Queued= %d\n", - rxr->me, lro->lro_queued); - device_printf(dev,"RX(%d) LRO Flushed= %d\n", - rxr->me, lro->lro_flushed); - device_printf(dev,"RX(%d) HW LRO Merges= %lu\n", - rxr->me, (long)rxr->rsc_num); - device_printf(dev,"TX(%d) Packets Sent: %lu\n", - txr->me, (long)txr->total_packets); - device_printf(dev,"TX(%d) NO Desc Avail: %lu\n", - txr->me, (long)txr->no_desc_avail); - } + struct tx_ring *txr = ((struct tx_ring *)oidp->oid_arg1); + if (!txr) return 0; - device_printf(dev,"Link IRQ Handled: %lu\n", - (long)adapter->link_irq); - return; + unsigned val = IXGBE_READ_REG(&txr->adapter->hw, IXGBE_TDT(txr->me)); + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr) + return error; + return 0; } -static int -ixgbe_sysctl_stats(SYSCTL_HANDLER_ARGS) +/** ixgbe_sysctl_rdh_handler - Handler function + * Retrieves the RDH value from the hardware + */ +static int +ixgbe_sysctl_rdh_handler(SYSCTL_HANDLER_ARGS) { - int error; - int result; - struct adapter *adapter; + int error; - result = -1; - error = sysctl_handle_int(oidp, &result, 0, req); + struct rx_ring *rxr = ((struct rx_ring *)oidp->oid_arg1); + if (!rxr) return 0; + unsigned val = IXGBE_READ_REG(&rxr->adapter->hw, IXGBE_RDH(rxr->me)); + error = sysctl_handle_int(oidp, &val, 0, req); if (error || !req->newptr) - return (error); + return error; + return 0; +} - if (result == 1) { - adapter = (struct adapter *) arg1; - ixgbe_print_hw_stats(adapter); - } - return error; +/** ixgbe_sysctl_rdt_handler - Handler function + * Retrieves the RDT value from the hardware + */ +static int +ixgbe_sysctl_rdt_handler(SYSCTL_HANDLER_ARGS) +{ + int error; + + struct rx_ring *rxr = ((struct rx_ring *)oidp->oid_arg1); + if (!rxr) return 0; + + unsigned val = IXGBE_READ_REG(&rxr->adapter->hw, IXGBE_RDT(rxr->me)); + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr) + return error; + return 0; } static int -ixgbe_sysctl_debug(SYSCTL_HANDLER_ARGS) +ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS) { - int error, result; - struct adapter *adapter; - - result = -1; - error = sysctl_handle_int(oidp, &result, 0, req); + int error; + struct ix_queue *que = ((struct ix_queue *)oidp->oid_arg1); + unsigned int reg, usec, rate; + reg = IXGBE_READ_REG(&que->adapter->hw, IXGBE_EITR(que->msix)); + usec = ((reg & 0x0FF8) >> 3); + if (usec > 0) + rate = 1000000 / usec; + else + rate = 0; + error = sysctl_handle_int(oidp, &rate, 0, req); if (error || !req->newptr) - return (error); + return error; + return 0; +} + +/* + * Add sysctl variables, one per statistic, to the system. + */ +static void +ixgbe_add_hw_stats(struct adapter *adapter) +{ + + device_t dev = adapter->dev; - if (result == 1) { - adapter = (struct adapter *) arg1; - ixgbe_print_debug_info(adapter); + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); + struct sysctl_oid *tree = device_get_sysctl_tree(dev); + struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); + struct ixgbe_hw_stats *stats = &adapter->stats; + + struct sysctl_oid *stat_node, *queue_node; + struct sysctl_oid_list *stat_list, *queue_list; + +#define QUEUE_NAME_LEN 32 + char namebuf[QUEUE_NAME_LEN]; + + /* Driver Statistics */ + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", + CTLFLAG_RD, &adapter->dropped_pkts, + "Driver dropped packets"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_defrag_failed", + CTLFLAG_RD, &adapter->mbuf_defrag_failed, + "m_defrag() failed"); +#if 0 + /* These counters are not updated by the software */ + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_header_failed", + CTLFLAG_RD, &adapter->mbuf_header_failed, + "???"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_packet_failed", + CTLFLAG_RD, &adapter->mbuf_packet_failed, + "???"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "no_tx_map_avail", + CTLFLAG_RD, &adapter->no_tx_map_avail, + "???"); +#endif + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "no_tx_dma_setup", + CTLFLAG_RD, &adapter->no_tx_dma_setup, + "Driver tx dma failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_events", + CTLFLAG_RD, &adapter->watchdog_events, + "Watchdog timeouts"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tso_tx", + CTLFLAG_RD, &adapter->tso_tx, + "TSO"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq", + CTLFLAG_RD, &adapter->link_irq, + "Link MSIX IRQ Handled"); + + for (int i = 0; i < adapter->num_queues; i++, txr++) { + snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i); + queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, + CTLFLAG_RD, NULL, "Queue Name"); + queue_list = SYSCTL_CHILDREN(queue_node); + + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "interrupt_rate", + CTLFLAG_RD, &adapter->queues[i], sizeof(&adapter->queues[i]), + ixgbe_sysctl_interrupt_rate_handler, "IU", + "Interrupt Rate"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head", + CTLFLAG_RD, txr, sizeof(txr), + ixgbe_sysctl_tdh_handler, "IU", + "Transmit Descriptor Head"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_tail", + CTLFLAG_RD, txr, sizeof(txr), + ixgbe_sysctl_tdt_handler, "IU", + "Transmit Descriptor Tail"); + SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "no_desc_avail", + CTLFLAG_RD, &txr->no_desc_avail, + "Queue No Descriptor Available"); + SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "tx_packets", + CTLFLAG_RD, &txr->total_packets, + "Queue Packets Transmitted"); } - return error; + + for (int i = 0; i < adapter->num_queues; i++, rxr++) { + snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i); + queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, + CTLFLAG_RD, NULL, "Queue Name"); + queue_list = SYSCTL_CHILDREN(queue_node); + + struct lro_ctrl *lro = &rxr->lro; + + snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i); + queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, + CTLFLAG_RD, NULL, "Queue Name"); + queue_list = SYSCTL_CHILDREN(queue_node); + + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head", + CTLFLAG_RD, rxr, sizeof(rxr), + ixgbe_sysctl_rdh_handler, "IU", + "Receive Descriptor Head"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_tail", + CTLFLAG_RD, rxr, sizeof(rxr), + ixgbe_sysctl_rdt_handler, "IU", + "Receive Descriptor Tail"); + SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "rx_packets", + CTLFLAG_RD, &rxr->rx_packets, + "Queue Packets Received"); + SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "rx_bytes", + CTLFLAG_RD, &rxr->rx_bytes, + "Queue Bytes Received"); + SYSCTL_ADD_UINT(ctx, queue_list, OID_AUTO, "lro_queued", + CTLFLAG_RD, &lro->lro_queued, 0, + "LRO Queued"); + SYSCTL_ADD_UINT(ctx, queue_list, OID_AUTO, "lro_flushed", + CTLFLAG_RD, &lro->lro_flushed, 0, + "LRO Flushed"); + } + + /* MAC stats get the own sub node */ + + stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac_stats", + CTLFLAG_RD, NULL, "MAC Statistics"); + stat_list = SYSCTL_CHILDREN(stat_node); + + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "crc_errs", + CTLFLAG_RD, &stats->crcerrs, + "CRC Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "ill_errs", + CTLFLAG_RD, &stats->illerrc, + "Illegal Byte Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "byte_errs", + CTLFLAG_RD, &stats->errbc, + "Byte Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "short_discards", + CTLFLAG_RD, &stats->mspdc, + "MAC Short Packets Discarded"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "local_faults", + CTLFLAG_RD, &stats->mlfc, + "MAC Local Faults"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "remote_faults", + CTLFLAG_RD, &stats->mrfc, + "MAC Remote Faults"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rec_len_errs", + CTLFLAG_RD, &stats->rlec, + "Receive Length Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "link_xon_txd", + CTLFLAG_RD, &stats->lxontxc, + "Link XON Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "link_xon_rcvd", + CTLFLAG_RD, &stats->lxontxc, + "Link XON Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "link_xoff_txd", + CTLFLAG_RD, &stats->lxofftxc, + "Link XOFF Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "link_xoff_rcvd", + CTLFLAG_RD, &stats->lxofftxc, + "Link XOFF Received"); + + /* Packet Reception Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_octets_rcvd", + CTLFLAG_RD, &stats->tor, + "Total Octets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_rcvd", + CTLFLAG_RD, &stats->gorc, + "Good Octets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_rcvd", + CTLFLAG_RD, &stats->tpr, + "Total Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_rcvd", + CTLFLAG_RD, &stats->gprc, + "Good Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_rcvd", + CTLFLAG_RD, &stats->mprc, + "Multicast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_rcvd", + CTLFLAG_RD, &stats->bprc, + "Broadcast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_64", + CTLFLAG_RD, &stats->prc64, + "64 byte frames received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_65_127", + CTLFLAG_RD, &stats->prc127, + "65-127 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_128_255", + CTLFLAG_RD, &stats->prc255, + "128-255 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_256_511", + CTLFLAG_RD, &stats->prc511, + "256-511 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_512_1023", + CTLFLAG_RD, &stats->prc1023, + "512-1023 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_1024_1522", + CTLFLAG_RD, &stats->prc1522, + "1023-1522 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_undersized", + CTLFLAG_RD, &stats->ruc, + "Receive Undersized"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_fragmented", + CTLFLAG_RD, &stats->rfc, + "Fragmented Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_oversized", + CTLFLAG_RD, &stats->roc, + "Oversized Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_jabberd", + CTLFLAG_RD, &stats->rjc, + "Received Jabber"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "management_pkts_rcvd", + CTLFLAG_RD, &stats->mngprc, + "Management Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "management_pkts_drpd", + CTLFLAG_RD, &stats->mngptc, + "Management Packets Dropped"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "checksum_errs", + CTLFLAG_RD, &stats->xec, + "Checksum Errors"); + + /* Packet Transmission Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", + CTLFLAG_RD, &stats->gotc, + "Good Octets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_txd", + CTLFLAG_RD, &stats->tpt, + "Total Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_txd", + CTLFLAG_RD, &stats->gptc, + "Good Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_txd", + CTLFLAG_RD, &stats->bptc, + "Broadcast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_txd", + CTLFLAG_RD, &stats->mptc, + "Multicast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "management_pkts_txd", + CTLFLAG_RD, &stats->mngptc, + "Management Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_64", + CTLFLAG_RD, &stats->ptc64, + "64 byte frames transmitted "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_65_127", + CTLFLAG_RD, &stats->ptc127, + "65-127 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_128_255", + CTLFLAG_RD, &stats->ptc255, + "128-255 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_256_511", + CTLFLAG_RD, &stats->ptc511, + "256-511 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_512_1023", + CTLFLAG_RD, &stats->ptc1023, + "512-1023 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_1024_1522", + CTLFLAG_RD, &stats->ptc1522, + "1024-1522 byte frames transmitted"); + + /* FC Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "fc_crc", + CTLFLAG_RD, &stats->fccrc, + "FC CRC Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "fc_last", + CTLFLAG_RD, &stats->fclast, + "FC Last Error"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "fc_drpd", + CTLFLAG_RD, &stats->fcoerpdc, + "FCoE Packets Dropped"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "fc_pkts_rcvd", + CTLFLAG_RD, &stats->fcoeprc, + "FCoE Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "fc_pkts_txd", + CTLFLAG_RD, &stats->fcoeptc, + "FCoE Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "fc_dword_rcvd", + CTLFLAG_RD, &stats->fcoedwrc, + "FCoE DWords Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "fc_dword_txd", + CTLFLAG_RD, &stats->fcoedwtc, + "FCoE DWords Transmitted"); } /* From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 07:03:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57D86106566C; Sat, 27 Nov 2010 07:03:32 +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 45BE98FC17; Sat, 27 Nov 2010 07:03:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAR73Wf0019240; Sat, 27 Nov 2010 07:03:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAR73WP9019238; Sat, 27 Nov 2010 07:03:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011270703.oAR73WP9019238@svn.freebsd.org> From: Alexander Motin Date: Sat, 27 Nov 2010 07:03:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215936 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 07:03:32 -0000 Author: mav Date: Sat Nov 27 07:03:31 2010 New Revision: 215936 URL: http://svn.freebsd.org/changeset/base/215936 Log: Do hard reset before soft reset for SATA channels. Soft reset reported to be not enough to restore device readiness in some situations. Tested by: Roger Hammerstein on ServerWorks HT1000. Modified: head/sys/dev/ata/chipsets/ata-serverworks.c Modified: head/sys/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-serverworks.c Sat Nov 27 06:35:15 2010 (r215935) +++ head/sys/dev/ata/chipsets/ata-serverworks.c Sat Nov 27 07:03:31 2010 (r215936) @@ -405,7 +405,7 @@ ata_serverworks_sata_reset(device_t dev) { struct ata_channel *ch = device_get_softc(dev); - if (ata_sata_phy_reset(dev, -1, 1)) + if (ata_sata_phy_reset(dev, -1, 0)) ata_generic_reset(dev); else ch->devices = 0; From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 09:26:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FBEB106564A; Sat, 27 Nov 2010 09:26:47 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02FE18FC13; Sat, 27 Nov 2010 09:26:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAR9Qkm8033225; Sat, 27 Nov 2010 09:26:46 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAR9Qk4C033221; Sat, 27 Nov 2010 09:26:46 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011270926.oAR9Qk4C033221@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 27 Nov 2010 09:26:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215937 - in head: contrib/traceroute contrib/traceroute/lbl usr.sbin/traceroute X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 09:26:47 -0000 Author: uqs Date: Sat Nov 27 09:26:46 2010 New Revision: 215937 URL: http://svn.freebsd.org/changeset/base/215937 Log: Remove unused traceroute(8) contrib code from head It still lives on under vendor/traceroute. Deleted: head/contrib/traceroute/Makefile.in head/contrib/traceroute/aclocal.m4 head/contrib/traceroute/acsite.m4 head/contrib/traceroute/config.guess head/contrib/traceroute/config.sub head/contrib/traceroute/configure head/contrib/traceroute/configure.in head/contrib/traceroute/findsaddr-generic.c head/contrib/traceroute/findsaddr-linux.c head/contrib/traceroute/findsaddr-mib.c head/contrib/traceroute/install-sh head/contrib/traceroute/lbl/gnuc.h head/contrib/traceroute/lbl/os-solaris2.h head/contrib/traceroute/lbl/os-sunos4.h head/contrib/traceroute/mkdep head/contrib/traceroute/strerror.c head/contrib/traceroute/usleep.c Modified: head/contrib/traceroute/ifaddrlist.c head/contrib/traceroute/traceroute.c head/usr.sbin/traceroute/Makefile Modified: head/contrib/traceroute/ifaddrlist.c ============================================================================== --- head/contrib/traceroute/ifaddrlist.c Sat Nov 27 07:03:31 2010 (r215936) +++ head/contrib/traceroute/ifaddrlist.c Sat Nov 27 09:26:46 2010 (r215937) @@ -61,11 +61,6 @@ struct rtentry; #include #include -#include "gnuc.h" -#ifdef HAVE_OS_PROTO_H -#include "os-proto.h" -#endif - #include "ifaddrlist.h" /* Modified: head/contrib/traceroute/traceroute.c ============================================================================== --- head/contrib/traceroute/traceroute.c Sat Nov 27 07:03:31 2010 (r215936) +++ head/contrib/traceroute/traceroute.c Sat Nov 27 09:26:46 2010 (r215937) @@ -245,11 +245,6 @@ static const char rcsid[] = #include #include -#include "gnuc.h" -#ifdef HAVE_OS_PROTO_H -#include "os-proto.h" -#endif - /* rfc1716 */ #ifndef ICMP_UNREACH_FILTER_PROHIB #define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohibited filter */ Modified: head/usr.sbin/traceroute/Makefile ============================================================================== --- head/usr.sbin/traceroute/Makefile Sat Nov 27 07:03:31 2010 (r215936) +++ head/usr.sbin/traceroute/Makefile Sat Nov 27 09:26:46 2010 (r215937) @@ -29,7 +29,7 @@ DPADD= ${LIBIPSEC} LDADD= -lipsec .endif -CFLAGS+= -I${TRACEROUTE_DISTDIR}/lbl -I${TRACEROUTE_DISTDIR} +CFLAGS+= -I${TRACEROUTE_DISTDIR} WARNS?= 0 From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 13:35:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6D52106564A; Sat, 27 Nov 2010 13:35:19 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99D6C8FC0C; Sat, 27 Nov 2010 13:35:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oARDZJg3060649; Sat, 27 Nov 2010 13:35:19 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oARDZJRR060646; Sat, 27 Nov 2010 13:35:19 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201011271335.oARDZJRR060646@svn.freebsd.org> From: "Jayachandran C." Date: Sat, 27 Nov 2010 13:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215939 - head/sys/mips/rmi/dev/nlge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 13:35:19 -0000 Author: jchandra Date: Sat Nov 27 13:35:19 2010 New Revision: 215939 URL: http://svn.freebsd.org/changeset/base/215939 Log: Use if_transmit method instead of if_start, this avoids the interface queue lock. Use the hardware IP checksum verification on receive. Submitted by: Sriram Gorti (srgorti at netlogicmicro dot com) Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c head/sys/mips/rmi/dev/nlge/if_nlge.h Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Sat Nov 27 12:26:40 2010 (r215938) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Sat Nov 27 13:35:19 2010 (r215939) @@ -137,7 +137,7 @@ static int nlge_suspend(device_t); static int nlge_resume(device_t); static void nlge_init(void *); static int nlge_ioctl(struct ifnet *, u_long, caddr_t); -static void nlge_start(struct ifnet *); +static int nlge_tx(struct ifnet *ifp, struct mbuf *m); static void nlge_rx(struct nlge_softc *sc, vm_paddr_t paddr, int len); static int nlge_mii_write(struct device *, int, int, int); @@ -199,7 +199,8 @@ static void nlge_set_port_attribs(struct struct xlr_gmac_port *); static void nlge_mac_set_rx_mode(struct nlge_softc *sc); static void nlge_sgmii_init(struct nlge_softc *sc); -static void nlge_start_locked(struct ifnet *ifp, struct nlge_softc *sc); +static int nlge_start_locked(struct ifnet *ifp, struct nlge_softc *sc, + struct mbuf *m); static int prepare_fmn_message(struct nlge_softc *sc, struct msgrng_msg *msg, uint32_t *n_entries, struct mbuf *m_head, @@ -209,9 +210,6 @@ static void release_tx_desc(vm_paddr_t static int send_fmn_msg_tx(struct nlge_softc *, struct msgrng_msg *, uint32_t n_entries); -static void -nl_tx_q_wakeup(void *addr); - //#define DEBUG #ifdef DEBUG static int mac_debug = 1; @@ -309,6 +307,8 @@ static uma_zone_t nl_tx_desc_zone; static int flow_classification = 0; TUNABLE_INT("hw.nlge.flow_classification", &flow_classification); +#define NLGE_HW_CHKSUM 1 + static __inline void atomic_incr_long(unsigned long *addr) { @@ -431,10 +431,6 @@ nlna_attach(device_t dev) XLR_CACHELINE_SIZE, 0); } - /* Other per NA s/w initialization */ - callout_init(&sc->tx_thr, CALLOUT_MPSAFE); - callout_reset(&sc->tx_thr, hz, nl_tx_q_wakeup, sc); - /* Enable NA interrupts */ nlna_setup_intr(sc); @@ -697,8 +693,6 @@ nlge_msgring_handler(int bucket, int siz NLGE_LOCK(sc); if (ifp->if_drv_flags & IFF_DRV_OACTIVE){ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - callout_reset(&na_sc->tx_thr, hz, - nl_tx_q_wakeup, na_sc); } NLGE_UNLOCK(sc); } else { @@ -717,97 +711,76 @@ nlge_msgring_handler(int bucket, int siz } -static void -nlge_start(struct ifnet *ifp) +static int +nlge_tx(struct ifnet *ifp, struct mbuf *m) { - struct nlge_softc *sc; - - sc = ifp->if_softc; - //NLGE_LOCK(sc); - nlge_start_locked(ifp, sc); - //NLGE_UNLOCK(sc); + return (nlge_start_locked(ifp, ifp->if_softc, m)); } -static void -nl_tx_q_wakeup(void *addr) -{ - struct nlna_softc *na_sc; - struct nlge_softc *sc; - int i; - - na_sc = (struct nlna_softc *) addr; - for (i = 0; i < XLR_MAX_MACS; i++) { - sc = na_sc->child_sc[i]; - if (sc == NULL) - continue; - nlge_start_locked(sc->nlge_if, sc); - } - callout_reset(&na_sc->tx_thr, 5 * hz, nl_tx_q_wakeup, na_sc); -} - -static void -nlge_start_locked(struct ifnet *ifp, struct nlge_softc *sc) +static int +nlge_start_locked(struct ifnet *ifp, struct nlge_softc *sc, struct mbuf *m) { struct msgrng_msg msg; - struct mbuf *m; struct nlge_tx_desc *tx_desc; uint64_t fr_stid; uint32_t cpu; uint32_t n_entries; uint32_t tid; - int ret; + int error, ret; + + if (m == NULL) + return (0); + + tx_desc = NULL; + error = 0; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING) || + ifp->if_drv_flags & IFF_DRV_OACTIVE) { + error = ENXIO; + goto fail; // note: mbuf will get free'd + } cpu = xlr_core_id(); tid = xlr_thr_id(); /* H/w threads [0, 2] --> bucket 6 and [1, 3] --> bucket 7 */ fr_stid = cpu * 8 + 6 + (tid % 2); - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - return; - } - - do { - /* - * First, remove some freeback messages before transmitting - * any new packets. However, cap the number of messages - * drained to permit this thread to continue with its - * transmission. - * - * Mask for buckets {6, 7} is 0xc0 - */ - xlr_msgring_handler(0xc0, 4); + /* + * First, remove some freeback messages before transmitting + * any new packets. However, cap the number of messages + * drained to permit this thread to continue with its + * transmission. + * + * Mask for buckets {6, 7} is 0xc0 + */ + xlr_msgring_handler(0xc0, 4); - /* Grab a packet off the queue. */ - IF_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) { - return; - } - - tx_desc = NULL; - ret = prepare_fmn_message(sc, &msg, &n_entries, m, fr_stid, &tx_desc); - if (ret) { - goto fail; - } - ret = send_fmn_msg_tx(sc, &msg, n_entries); - if (ret != 0) { - goto fail; - } - } while(1); + ret = prepare_fmn_message(sc, &msg, &n_entries, m, fr_stid, &tx_desc); + if (ret) { + error = (ret == 2) ? ENOBUFS : ENOTSUP; + goto fail; + } + ret = send_fmn_msg_tx(sc, &msg, n_entries); + if (ret != 0) { + error = EBUSY; + goto fail; + } - return; + return (0); fail: if (tx_desc != NULL) { uma_zfree(nl_tx_desc_zone, tx_desc); } if (m != NULL) { - NLGE_LOCK(sc); - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - NLGE_UNLOCK(sc); - IF_PREPEND(&ifp->if_snd, m); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + NLGE_LOCK(sc); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + NLGE_UNLOCK(sc); + } + m_freem(m); atomic_incr_long(&ifp->if_iqdrops); } - return; + return (error); } static void @@ -833,8 +806,24 @@ nlge_rx(struct nlge_softc *sc, vm_paddr_ ifp = sc->nlge_if; +#ifdef NLGE_HW_CHKSUM + m->m_pkthdr.csum_flags = CSUM_IP_CHECKED; + if (m->m_data[10] & 0x2) { + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + if (m->m_data[10] & 0x1) { + m->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | + CSUM_PSEUDO_HDR); + m->m_pkthdr.csum_data = htons(0xffff); + } + } + m->m_data += NLGE_PREPAD_LEN; + len -= NLGE_PREPAD_LEN; +#else + m->m_pkthdr.csum_flags = 0; +#endif + /* align the data */ - m->m_data += BYTE_OFFSET; + m->m_data += BYTE_OFFSET ; m->m_pkthdr.len = m->m_len = len; m->m_pkthdr.rcvif = ifp; @@ -1294,8 +1283,10 @@ nlna_config_parser(struct nlna_softc *sc */ NLGE_WRITE(sc->base, R_L2TYPE_0, 0x01); +#ifndef NLGE_HW_CHKSUM if (!flow_classification) return; +#endif /* Use 7bit CRChash for flow classification with 127 as CRC polynomial*/ NLGE_WRITE(sc->base, R_PARSERCONFIGREG, ((0x7f << 8) | (1 << 1))); @@ -1307,13 +1298,17 @@ nlna_config_parser(struct nlna_softc *sc (0x0800 << 0)); NLGE_WRITE(sc->base, R_L3CTABLE + 1, (9 << 25) | (1 << 21) | (12 << 14) | (4 << 10) | (16 << 4) | 4); +#ifdef NLGE_HW_CHKSUM + device_printf(sc->nlna_dev, "Enabled h/w support to compute TCP/IP" + " checksum\n"); +#endif /* Configure to extract SRC port and Dest port for TCP and UDP pkts */ NLGE_WRITE(sc->base, R_L4CTABLE, 6); - NLGE_WRITE(sc->base, R_L4CTABLE+2, 17); + NLGE_WRITE(sc->base, R_L4CTABLE + 2, 17); val = ((0 << 21) | (2 << 17) | (2 << 11) | (2 << 7)); - NLGE_WRITE(sc->base, R_L4CTABLE+1, val); - NLGE_WRITE(sc->base, R_L4CTABLE+3, val); + NLGE_WRITE(sc->base, R_L4CTABLE + 1, val); + NLGE_WRITE(sc->base, R_L4CTABLE + 3, val); } static void @@ -1756,8 +1751,11 @@ nlge_hw_init(struct nlge_softc *sc) /* each packet buffer is 1536 bytes */ NLGE_WRITE(base, R_DESC_PACK_CTRL, - (1 << O_DESC_PACK_CTRL__MaxEntry) | - (MAX_FRAME_SIZE << O_DESC_PACK_CTRL__RegularSize)); + (1 << O_DESC_PACK_CTRL__MaxEntry) | +#ifdef NLGE_HW_CHKSUM + (1 << O_DESC_PACK_CTRL__PrePadEnable) | +#endif + (MAX_FRAME_SIZE << O_DESC_PACK_CTRL__RegularSize)); NLGE_WRITE(base, R_STATCTRL, ((1 << O_STATCTRL__Sten) | (1 << O_STATCTRL__ClrCnt))); NLGE_WRITE(base, R_L2ALLOCCTRL, 0xffffffff); @@ -1879,7 +1877,6 @@ nlge_if_init(struct nlge_softc *sc) ifp->if_capabilities = 0; ifp->if_capenable = ifp->if_capabilities; ifp->if_ioctl = nlge_ioctl; - ifp->if_start = nlge_start; ifp->if_init = nlge_init; ifp->if_hwassist = 0; ifp->if_snd.ifq_drv_maxlen = RGE_TX_Q_SIZE; @@ -1895,6 +1892,9 @@ nlge_if_init(struct nlge_softc *sc) ether_ifattach(ifp, sc->dev_addr); + /* override if_transmit : per ifnet(9), do it after if_attach */ + ifp->if_transmit = nlge_tx; + fail: return (error); } Modified: head/sys/mips/rmi/dev/nlge/if_nlge.h ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.h Sat Nov 27 12:26:40 2010 (r215938) +++ head/sys/mips/rmi/dev/nlge/if_nlge.h Sat Nov 27 13:35:19 2010 (r215939) @@ -985,8 +985,10 @@ #define MAC_B2B_IPG 88 +#define NLGE_PREPAD_LEN 32 + /* frame sizes need to be cacheline aligned */ -#define MAX_FRAME_SIZE 1536 +#define MAX_FRAME_SIZE (1536 + NLGE_PREPAD_LEN) #define MAX_FRAME_SIZE_JUMBO 9216 #define RGE_TX_THRESHOLD_BYTES ETHER_MAX_LEN @@ -1019,7 +1021,6 @@ #define PHY_STATUS_RETRIES 25000 - /* Structs representing hardware data structures */ struct size_1_desc { uint64_t entry0; @@ -1110,7 +1111,6 @@ struct nlna_softc { int mac_type; xlr_reg_t *base; - struct callout tx_thr; struct fr_desc *frin_spill; struct fr_desc *frout_spill; union rx_tx_desc *class_0_spill; From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 15:41:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C6D8106566C; Sat, 27 Nov 2010 15:41:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1ADBB8FC08; Sat, 27 Nov 2010 15:41:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oARFfiJb070245; Sat, 27 Nov 2010 15:41:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oARFfikt070243; Sat, 27 Nov 2010 15:41:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011271541.oARFfikt070243@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 27 Nov 2010 15:41:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215942 - head/sys/crypto/aesni X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 15:41:45 -0000 Author: kib Date: Sat Nov 27 15:41:44 2010 New Revision: 215942 URL: http://svn.freebsd.org/changeset/base/215942 Log: Remove DEBUG sections. MFC after: 3 days Modified: head/sys/crypto/aesni/aesni_wrap.c Modified: head/sys/crypto/aesni/aesni_wrap.c ============================================================================== --- head/sys/crypto/aesni/aesni_wrap.c Sat Nov 27 13:53:21 2010 (r215941) +++ head/sys/crypto/aesni/aesni_wrap.c Sat Nov 27 15:41:44 2010 (r215942) @@ -37,22 +37,6 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_AESNI); -#ifdef DEBUG -static void -ps_len(const char *string, const uint8_t *data, int length) -{ - int i; - - printf("%-12s[0x", string); - for(i = 0; i < length; i++) { - if (i % AES_BLOCK_LEN == 0 && i > 0) - printf("+"); - printf("%02x", data[i]); - } - printf("]\n"); -} -#endif - void aesni_encrypt_cbc(int rounds, const void *key_schedule, size_t len, const uint8_t *from, uint8_t *to, const uint8_t iv[AES_BLOCK_LEN]) @@ -60,11 +44,6 @@ aesni_encrypt_cbc(int rounds, const void const uint8_t *ivp; size_t i; -#ifdef DEBUG - ps_len("AES CBC encrypt iv:", iv, AES_BLOCK_LEN); - ps_len("from:", from, len); -#endif - len /= AES_BLOCK_LEN; ivp = iv; for (i = 0; i < len; i++) { @@ -73,9 +52,6 @@ aesni_encrypt_cbc(int rounds, const void from += AES_BLOCK_LEN; to += AES_BLOCK_LEN; } -#ifdef DEBUG - ps_len("to:", to - len * AES_BLOCK_LEN, len * AES_BLOCK_LEN); -#endif } void From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 20:27:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41AD0106566C; Sat, 27 Nov 2010 20:27:08 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 310B38FC15; Sat, 27 Nov 2010 20:27:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oARKR8TC095144; Sat, 27 Nov 2010 20:27:08 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oARKR85u095142; Sat, 27 Nov 2010 20:27:08 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201011272027.oARKR85u095142@svn.freebsd.org> From: Peter Holm Date: Sat, 27 Nov 2010 20:27:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215950 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 20:27:08 -0000 Author: pho Date: Sat Nov 27 20:27:07 2010 New Revision: 215950 URL: http://svn.freebsd.org/changeset/base/215950 Log: First step in fixing the handle_workitem_freeblocks panic. In collaboration with: kib Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sat Nov 27 19:47:58 2010 (r215949) +++ head/sys/ufs/ffs/ffs_softdep.c Sat Nov 27 20:27:07 2010 (r215950) @@ -6024,11 +6024,12 @@ handle_complete_freeblocks(freeblks) vput(vp); } - KASSERT(freeblks->fb_chkcnt == 0 || - ((fs->fs_flags & FS_UNCLEAN) != 0 && (flags & LK_NOWAIT) == 0), - ("handle_workitem_freeblocks: inode %ju block count %jd\n", - (uintmax_t)freeblks->fb_previousinum, - (intmax_t)freeblks->fb_chkcnt)); + if (!(freeblks->fb_chkcnt == 0 || + ((fs->fs_flags & FS_UNCLEAN) != 0 && (flags & LK_NOWAIT) == 0))) + printf( + "handle_workitem_freeblocks: inode %ju block count %jd\n", + (uintmax_t)freeblks->fb_previousinum, + (intmax_t)freeblks->fb_chkcnt); ACQUIRE_LOCK(&lk); /* From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 20:33:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25A67106566B; Sat, 27 Nov 2010 20:33:08 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD2E18FC0A; Sat, 27 Nov 2010 20:33:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oARKX8Px095788; Sat, 27 Nov 2010 20:33:08 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oARKX8QY095786; Sat, 27 Nov 2010 20:33:08 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201011272033.oARKX8QY095786@svn.freebsd.org> From: Matt Jacob Date: Sat, 27 Nov 2010 20:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215951 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 20:33:09 -0000 Author: mjacob Date: Sat Nov 27 20:33:08 2010 New Revision: 215951 URL: http://svn.freebsd.org/changeset/base/215951 Log: Partially revert 208119. We were overwriting tunable settings. Obtained from: Oleg Sharoyko MFC after: 1 week Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Sat Nov 27 20:27:07 2010 (r215950) +++ head/sys/dev/isp/isp_freebsd.c Sat Nov 27 20:33:08 2010 (r215951) @@ -141,9 +141,6 @@ isp_attach_chan(ispsoftc_t *isp, struct fc->path = path; fc->isp = isp; fc->ready = 1; - fc->gone_device_time = isp_gone_device_time; - fc->loop_down_limit = isp_loop_down_limit; - fc->hysteresis = isp_fabric_hysteresis; callout_init_mtx(&fc->ldt, &isp->isp_osinfo.lock, 0); callout_init_mtx(&fc->gdt, &isp->isp_osinfo.lock, 0); From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 20:38:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26C3F106566B; Sat, 27 Nov 2010 20:38:27 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 161158FC08; Sat, 27 Nov 2010 20:38:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oARKcQ72096406; Sat, 27 Nov 2010 20:38:26 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oARKcQtt096403; Sat, 27 Nov 2010 20:38:26 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201011272038.oARKcQtt096403@svn.freebsd.org> From: Matt Jacob Date: Sat, 27 Nov 2010 20:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215952 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 20:38:27 -0000 Author: mjacob Date: Sat Nov 27 20:38:26 2010 New Revision: 215952 URL: http://svn.freebsd.org/changeset/base/215952 Log: Add ISP_INTERNAL_TARGET as an option for isp(4). Modified: head/sys/conf/NOTES head/sys/conf/options Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Nov 27 20:33:08 2010 (r215951) +++ head/sys/conf/NOTES Sat Nov 27 20:38:26 2010 (r215952) @@ -1573,6 +1573,8 @@ options ISP_TARGET_MODE=1 # initiator=2 # both=3 (not supported currently) # +# ISP_INTERNAL_TARGET (trivial internal disk target, for testing) +# options ISP_DEFAULT_ROLES=2 # Options used in dev/sym/ (Symbios SCSI driver). Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Nov 27 20:33:08 2010 (r215951) +++ head/sys/conf/options Sat Nov 27 20:38:26 2010 (r215952) @@ -345,6 +345,7 @@ SCSI_NCR_MYADDR opt_ncr.h ISP_TARGET_MODE opt_isp.h ISP_FW_CRASH_DUMP opt_isp.h ISP_DEFAULT_ROLES opt_isp.h +ISP_INTERNAL_TARGET opt_isp.h # Options used only in dev/iscsi ISCSI_INITIATOR_DEBUG opt_iscsi_initiator.h From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 21:35:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AFE9106566C; Sat, 27 Nov 2010 21:35:16 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69D3B8FC13; Sat, 27 Nov 2010 21:35:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oARLZGlK002374; Sat, 27 Nov 2010 21:35:16 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oARLZGxR002372; Sat, 27 Nov 2010 21:35:16 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201011272135.oARLZGxR002372@svn.freebsd.org> From: Bruce Cran Date: Sat, 27 Nov 2010 21:35:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215955 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 21:35:16 -0000 Author: brucec Date: Sat Nov 27 21:35:16 2010 New Revision: 215955 URL: http://svn.freebsd.org/changeset/base/215955 Log: Fix typo. Modified: head/usr.bin/netstat/inet6.c Modified: head/usr.bin/netstat/inet6.c ============================================================================== --- head/usr.bin/netstat/inet6.c Sat Nov 27 21:20:51 2010 (r215954) +++ head/usr.bin/netstat/inet6.c Sat Nov 27 21:35:16 2010 (r215955) @@ -438,7 +438,7 @@ ip6_stats(u_long off, const char *name, printf("\t\t%ju two or more ext mbuf\n", (uintmax_t)ip6stat.ip6s_mext2m); p(ip6s_exthdrtoolong, - "\t%ju packet%s whose headers are not continuous\n"); + "\t%ju packet%s whose headers are not contiguous\n"); p(ip6s_nogif, "\t%ju tunneling packet%s that can't find gif\n"); p(ip6s_toomanyhdr, "\t%ju packet%s discarded because of too many headers\n"); From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 21:51:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D77E1065670; Sat, 27 Nov 2010 21:51:40 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B9248FC0C; Sat, 27 Nov 2010 21:51:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oARLpeJN004376; Sat, 27 Nov 2010 21:51:40 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oARLpec2004370; Sat, 27 Nov 2010 21:51:40 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201011272151.oARLpec2004370@svn.freebsd.org> From: Bruce Cran Date: Sat, 27 Nov 2010 21:51:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215956 - in head/sys: netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 21:51:40 -0000 Author: brucec Date: Sat Nov 27 21:51:39 2010 New Revision: 215956 URL: http://svn.freebsd.org/changeset/base/215956 Log: Fix more continuous/contiguous typos (cf. r215955) Modified: head/sys/netinet/ip6.h head/sys/netinet6/in6_cksum.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_output.c head/sys/netinet6/ip6_var.h Modified: head/sys/netinet/ip6.h ============================================================================== --- head/sys/netinet/ip6.h Sat Nov 27 21:35:16 2010 (r215955) +++ head/sys/netinet/ip6.h Sat Nov 27 21:51:39 2010 (r215956) @@ -263,7 +263,7 @@ struct ip6_frag { /* * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the * target header (including IPv6 itself, extension headers and - * TCP/UDP/ICMP6 headers) are continuous. KAME requires drivers + * TCP/UDP/ICMP6 headers) are contiguous. KAME requires drivers * to store incoming data into one internal mbuf or one or more external * mbufs(never into two or more internal mbufs). Thus, the third case is * supposed to never be matched but is prepared just in case. Modified: head/sys/netinet6/in6_cksum.c ============================================================================== --- head/sys/netinet6/in6_cksum.c Sat Nov 27 21:35:16 2010 (r215955) +++ head/sys/netinet6/in6_cksum.c Sat Nov 27 21:51:39 2010 (r215956) @@ -81,7 +81,7 @@ __FBSDID("$FreeBSD$"); #define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; (void)ADDCARRY(sum);} /* - * m MUST contain a continuous IP6 header. + * m MUST contain a contiguous IP6 header. * off is an offset where TCP/UDP/ICMP6 header starts. * len is a total length of a transport segment. * (e.g. TCP header + TCP payload) Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Sat Nov 27 21:35:16 2010 (r215955) +++ head/sys/netinet6/ip6_input.c Sat Nov 27 21:51:39 2010 (r215956) @@ -1058,7 +1058,7 @@ ip6_hopopts_input(u_int32_t *plenp, u_in * * The function assumes that hbh header is located right after the IPv6 header * (RFC2460 p7), opthead is pointer into data content in m, and opthead to - * opthead + hbhlen is located in continuous memory region. + * opthead + hbhlen is located in contiguous memory region. */ int ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, @@ -1191,7 +1191,7 @@ ip6_process_hopopts(struct mbuf *m, u_in * Unknown option processing. * The third argument `off' is the offset from the IPv6 header to the option, * which is necessary if the IPv6 header the and option header and IPv6 header - * is not continuous in order to return an ICMPv6 error. + * is not contiguous in order to return an ICMPv6 error. */ int ip6_unknown_opt(u_int8_t *optp, struct mbuf *m, int off) Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sat Nov 27 21:35:16 2010 (r215955) +++ head/sys/netinet6/ip6_output.c Sat Nov 27 21:51:39 2010 (r215956) @@ -814,13 +814,13 @@ again: #ifdef DIAGNOSTIC if ((hbh->ip6h_len + 1) << 3 > exthdrs.ip6e_hbh->m_len) - panic("ip6e_hbh is not continuous"); + panic("ip6e_hbh is not contiguous"); #endif /* * XXX: if we have to send an ICMPv6 error to the sender, * we need the M_LOOP flag since icmp6_error() expects * the IPv6 and the hop-by-hop options header are - * continuous unless the flag is set. + * contiguous unless the flag is set. */ m->m_flags |= M_LOOP; m->m_pkthdr.rcvif = ifp; Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Sat Nov 27 21:35:16 2010 (r215955) +++ head/sys/netinet6/ip6_var.h Sat Nov 27 21:51:39 2010 (r215956) @@ -209,7 +209,7 @@ struct ip6stat { u_quad_t ip6s_m2m[32]; /* two or more mbuf */ u_quad_t ip6s_mext1; /* one ext mbuf */ u_quad_t ip6s_mext2m; /* two or more ext mbuf */ - u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */ + u_quad_t ip6s_exthdrtoolong; /* ext hdr are not contiguous */ u_quad_t ip6s_nogif; /* no match gif found */ u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */ From owner-svn-src-head@FreeBSD.ORG Sat Nov 27 22:42:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4866A106564A; Sat, 27 Nov 2010 22:42:42 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C1DB8FC14; Sat, 27 Nov 2010 22:42:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oARMggWF011287; Sat, 27 Nov 2010 22:42:42 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oARMggVb011285; Sat, 27 Nov 2010 22:42:42 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201011272242.oARMggVb011285@svn.freebsd.org> From: Juli Mallett Date: Sat, 27 Nov 2010 22:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215957 - head/sys/mips/cavium/octe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 22:42:42 -0000 Author: jmallett Date: Sat Nov 27 22:42:41 2010 New Revision: 215957 URL: http://svn.freebsd.org/changeset/base/215957 Log: Use if_transmit to avoid ifq locking in transmit path. Modified: head/sys/mips/cavium/octe/octe.c Modified: head/sys/mips/cavium/octe/octe.c ============================================================================== --- head/sys/mips/cavium/octe/octe.c Sat Nov 27 21:51:39 2010 (r215956) +++ head/sys/mips/cavium/octe/octe.c Sat Nov 27 22:42:41 2010 (r215957) @@ -90,7 +90,7 @@ static int octe_miibus_writereg(device_ static void octe_init(void *); static void octe_stop(void *); -static void octe_start(struct ifnet *); +static int octe_transmit(struct ifnet *, struct mbuf *); static int octe_mii_medchange(struct ifnet *); static void octe_mii_medstat(struct ifnet *, struct ifmediareq *); @@ -185,7 +185,6 @@ octe_attach(device_t dev) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_ALLMULTI; ifp->if_init = octe_init; ifp->if_ioctl = octe_ioctl; - ifp->if_start = octe_start; priv->if_flags = ifp->if_flags; @@ -198,6 +197,8 @@ octe_attach(device_t dev) ether_ifattach(ifp, priv->mac); + ifp->if_transmit = octe_transmit; + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_HWCSUM; ifp->if_capenable = ifp->if_capabilities; @@ -317,38 +318,26 @@ octe_stop(void *arg) ifp->if_drv_flags &= ~IFF_DRV_RUNNING; } -static void -octe_start(struct ifnet *ifp) +static int +octe_transmit(struct ifnet *ifp, struct mbuf *m) { cvm_oct_private_t *priv; - struct mbuf *m; int error; priv = ifp->if_softc; - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) - return; - - OCTE_TX_LOCK(priv); - while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - IFQ_DRV_DEQUEUE(&ifp->if_snd, m); - - OCTE_TX_UNLOCK(priv); - - if (priv->queue != -1) { - error = cvm_oct_xmit(m, ifp); - } else { - error = cvm_oct_xmit_pow(m, ifp); - } - - if (error != 0) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - return; - } + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) { + m_freem(m); + return (0); + } - OCTE_TX_LOCK(priv); + if (priv->queue != -1) { + error = cvm_oct_xmit(m, ifp); + } else { + error = cvm_oct_xmit_pow(m, ifp); } - OCTE_TX_UNLOCK(priv); + return (error); } static int