From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 10 01:42:47 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BAC61065688; Mon, 10 Nov 2008 01:42:47 +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 825028FC08; Mon, 10 Nov 2008 01:42:47 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAA1glEe055602; Mon, 10 Nov 2008 01:42:47 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAA1glCJ055598; Mon, 10 Nov 2008 01:42:47 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <200811100142.mAA1glCJ055598@svn.freebsd.org> From: David Xu Date: Mon, 10 Nov 2008 01:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184806 - in stable/7: include sys/kern sys/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Nov 2008 01:42:47 -0000 Author: davidxu Date: Mon Nov 10 01:42:46 2008 New Revision: 184806 URL: http://svn.freebsd.org/changeset/base/184806 Log: MFC: Add POSIX clock id CLOCK_THREAD_CPUTIME_ID support. Approved by: re (kib) Modified: stable/7/include/time.h stable/7/include/unistd.h stable/7/sys/kern/kern_time.c stable/7/sys/sys/time.h Modified: stable/7/include/time.h ============================================================================== --- stable/7/include/time.h Mon Nov 10 01:24:19 2008 (r184805) +++ stable/7/include/time.h Mon Nov 10 01:42:46 2008 (r184806) @@ -108,6 +108,7 @@ typedef __timer_t timer_t; #define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */ #define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ #define CLOCK_SECOND 13 /* FreeBSD-specific. */ +#define CLOCK_THREAD_CPUTIME_ID 14 #endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */ #if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 Modified: stable/7/include/unistd.h ============================================================================== --- stable/7/include/unistd.h Mon Nov 10 01:24:19 2008 (r184805) +++ stable/7/include/unistd.h Mon Nov 10 01:42:46 2008 (r184806) @@ -111,7 +111,7 @@ typedef __useconds_t useconds_t; #define _POSIX_SPIN_LOCKS 200112L #define _POSIX_THREAD_ATTR_STACKADDR 200112L #define _POSIX_THREAD_ATTR_STACKSIZE 200112L -#define _POSIX_THREAD_CPUTIME -1 +#define _POSIX_THREAD_CPUTIME 200112L #define _POSIX_THREAD_PRIO_INHERIT 200112L #define _POSIX_THREAD_PRIO_PROTECT 200112L #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L Modified: stable/7/sys/kern/kern_time.c ============================================================================== --- stable/7/sys/kern/kern_time.c Mon Nov 10 01:24:19 2008 (r184805) +++ stable/7/sys/kern/kern_time.c Mon Nov 10 01:42:46 2008 (r184806) @@ -201,6 +201,7 @@ kern_clock_gettime(struct thread *td, cl { struct timeval sys, user; struct proc *p; + uint64_t runtime, curtime, switchtime; p = td->td_proc; switch (clock_id) { @@ -242,6 +243,16 @@ kern_clock_gettime(struct thread *td, cl ats->tv_sec = time_second; ats->tv_nsec = 0; break; + case CLOCK_THREAD_CPUTIME_ID: + critical_enter(); + switchtime = PCPU_GET(switchtime); + curtime = cpu_ticks(); + runtime = td->td_runtime; + critical_exit(); + runtime = cputick2usec(runtime + curtime - switchtime); + ats->tv_sec = runtime / 1000000; + ats->tv_nsec = runtime % 1000000 * 1000; + break; default: return (EINVAL); } Modified: stable/7/sys/sys/time.h ============================================================================== --- stable/7/sys/sys/time.h Mon Nov 10 01:24:19 2008 (r184805) +++ stable/7/sys/sys/time.h Mon Nov 10 01:42:46 2008 (r184806) @@ -246,6 +246,7 @@ struct clockinfo { #define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */ #define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ #define CLOCK_SECOND 13 /* FreeBSD-specific. */ +#define CLOCK_THREAD_CPUTIME_ID 14 #endif #ifndef TIMER_ABSTIME From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 10 12:39:58 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE5C91065686 for ; Mon, 10 Nov 2008 12:39:58 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.189]) by mx1.freebsd.org (Postfix) with ESMTP id 6FD6F8FC19 for ; Mon, 10 Nov 2008 12:39:58 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: by nf-out-0910.google.com with SMTP id h3so1117355nfh.33 for ; Mon, 10 Nov 2008 04:39:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-pgp-agent:x-mailer; bh=2FyDX9nYJIbtl93Od5uHOg6OYsKe4GSnRTWYvfxFyas=; b=yA7Dp2AxG8sR6F9iEbv+5sE4MPCZa4EHTb1rk0con74WvYfBQrRgH4NBKPPZjKeQtu iF66lyYSAfmoJU+v1g3IdUf6ki3ckJuiIQaGvWly1cMhgdSK55L37vMP9eW+CxO7dJTF up/GPxNJ9CWSUBAEdUAnT0sShDEBMO1vwJdv0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-pgp-agent:x-mailer; b=K/P8XrxiGgwzUvh4dve0bIwqRAt64BRYKOu2/AkAGbjd4CaMkvAr9wMNL7vfibaKw3 3okunx2s3U6kn9RrG5vBo3K9lvMk4n8TktDg6SLKOrO1lf5OSQWvdzJFFpe3QQoSN6fV o/yhtXm3q13VSnEiiP7ymZhZyFpOJV1COLX6A= Received: by 10.103.252.17 with SMTP id e17mr3648064mus.14.1226318872422; Mon, 10 Nov 2008 04:07:52 -0800 (PST) Received: from ndenev.cmotd.com (blah.sun-fish.com [217.18.249.150]) by mx.google.com with ESMTPS id u9sm30883850muf.9.2008.11.10.04.07.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 10 Nov 2008 04:07:49 -0800 (PST) Message-Id: <217D0CE9-905B-4AAC-81E7-AE7AA8A00866@gmail.com> From: Nikolay Denev To: David Xu In-Reply-To: <200811100142.mAA1glCJ055598@svn.freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Mon, 10 Nov 2008 14:07:45 +0200 References: <200811100142.mAA1glCJ055598@svn.freebsd.org> X-Pgp-Agent: GPGMail d53 (v53, Leopard) X-Mailer: Apple Mail (2.929.2) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r184806 - in stable/7: include sys/kern sys/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Nov 2008 12:39:59 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10 Nov, 2008, at 03:42 , David Xu wrote: > Author: davidxu > Date: Mon Nov 10 01:42:46 2008 > New Revision: 184806 > URL: http://svn.freebsd.org/changeset/base/184806 > > Log: > MFC: > Add POSIX clock id CLOCK_THREAD_CPUTIME_ID support. > > Approved by: re (kib) Thanks! - -- Regards, Nikolay Denev -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (Darwin) iEYEARECAAYFAkkYJBEACgkQHNAJ/fLbfrkh+gCgvT3i9t4Ulle7cJx4Us8NxfZS mqAAn0V+t6DFTDEuOCN4Mnrj4TR8d48K =GQgC -----END PGP SIGNATURE----- From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 10 17:30:49 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB49C1065672; Mon, 10 Nov 2008 17:30:49 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98EFD8FC20; Mon, 10 Nov 2008 17:30:49 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAAHUncE076012; Mon, 10 Nov 2008 17:30:49 GMT (envelope-from jasone@svn.freebsd.org) Received: (from jasone@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAAHUnIt076010; Mon, 10 Nov 2008 17:30:49 GMT (envelope-from jasone@svn.freebsd.org) Message-Id: <200811101730.mAAHUnIt076010@svn.freebsd.org> From: Jason Evans Date: Mon, 10 Nov 2008 17:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184819 - in stable/7/lib/libc: . stdlib X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Nov 2008 17:30:49 -0000 Author: jasone Date: Mon Nov 10 17:30:49 2008 New Revision: 184819 URL: http://svn.freebsd.org/changeset/base/184819 Log: MFC: Revert to preferring mmap(2) over sbrk(2) when mapping memory, due to potential extreme contention in the kernel for multi-threaded applications on SMP systems. Approved by: re (kib) Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdlib/malloc.3 stable/7/lib/libc/stdlib/malloc.c Modified: stable/7/lib/libc/stdlib/malloc.3 ============================================================================== --- stable/7/lib/libc/stdlib/malloc.3 Mon Nov 10 16:44:25 2008 (r184818) +++ stable/7/lib/libc/stdlib/malloc.3 Mon Nov 10 17:30:49 2008 (r184819) @@ -250,7 +250,7 @@ If both the .Dq D and .Dq M -options are enabled, the allocator prefers the DSS over anonymous mappings, +options are enabled, the allocator prefers anonymous mappings over the DSS, but allocation only fails if memory cannot be acquired via either method. If neither option is enabled, then the .Dq M Modified: stable/7/lib/libc/stdlib/malloc.c ============================================================================== --- stable/7/lib/libc/stdlib/malloc.c Mon Nov 10 16:44:25 2008 (r184818) +++ stable/7/lib/libc/stdlib/malloc.c Mon Nov 10 17:30:49 2008 (r184819) @@ -1275,11 +1275,6 @@ base_pages_alloc(size_t minsize) { #ifdef MALLOC_DSS - if (opt_dss) { - if (base_pages_alloc_dss(minsize) == false) - return (false); - } - if (opt_mmap && minsize != 0) #endif { @@ -1287,6 +1282,14 @@ base_pages_alloc(size_t minsize) return (false); } +#ifdef MALLOC_DSS + if (opt_dss) { + if (base_pages_alloc_dss(minsize) == false) + return (false); + } + +#endif + return (true); } @@ -1709,6 +1712,15 @@ chunk_alloc(size_t size, bool zero) assert((size & chunksize_mask) == 0); #ifdef MALLOC_DSS + if (opt_mmap) +#endif + { + ret = chunk_alloc_mmap(size); + if (ret != NULL) + goto RETURN; + } + +#ifdef MALLOC_DSS if (opt_dss) { ret = chunk_recycle_dss(size, zero); if (ret != NULL) { @@ -1719,14 +1731,7 @@ chunk_alloc(size_t size, bool zero) if (ret != NULL) goto RETURN; } - - if (opt_mmap) #endif - { - ret = chunk_alloc_mmap(size); - if (ret != NULL) - goto RETURN; - } /* All strategies for allocation failed. */ ret = NULL; From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 10 18:24:12 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B5041065677; Mon, 10 Nov 2008 18:24:12 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 186D88FC0C; Mon, 10 Nov 2008 18:24:12 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAAIOCMm077221; Mon, 10 Nov 2008 18:24:12 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAAIOBdY077218; Mon, 10 Nov 2008 18:24:11 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200811101824.mAAIOBdY077218@svn.freebsd.org> From: Robert Watson Date: Mon, 10 Nov 2008 18:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184823 - in stable/7/sys: . modules/cxgb netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Nov 2008 18:24:12 -0000 Author: rwatson Date: Mon Nov 10 18:24:11 2008 New Revision: 184823 URL: http://svn.freebsd.org/changeset/base/184823 Log: Merge r184298 from head to stable/7: Remove endearing but syntactically unnecessary "return;" statements directly before the final closeing brackets of some TCP functions. Approved by: re (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/modules/cxgb/ (props changed) stable/7/sys/netinet/tcp_input.c stable/7/sys/netinet/tcp_sack.c stable/7/sys/netinet/tcp_syncache.c Modified: stable/7/sys/netinet/tcp_input.c ============================================================================== --- stable/7/sys/netinet/tcp_input.c Mon Nov 10 18:09:52 2008 (r184822) +++ stable/7/sys/netinet/tcp_input.c Mon Nov 10 18:24:11 2008 (r184823) @@ -878,7 +878,6 @@ drop: free(s, M_TCPLOG); if (m != NULL) m_freem(m); - return; } static void @@ -2445,7 +2444,6 @@ drop: if (headlocked) INP_INFO_WUNLOCK(&tcbinfo); m_freem(m); - return; } /* @@ -2504,7 +2502,6 @@ tcp_dropwithreset(struct mbuf *m, struct return; drop: m_freem(m); - return; } /* Modified: stable/7/sys/netinet/tcp_sack.c ============================================================================== --- stable/7/sys/netinet/tcp_sack.c Mon Nov 10 18:09:52 2008 (r184822) +++ stable/7/sys/netinet/tcp_sack.c Mon Nov 10 18:24:11 2008 (r184823) @@ -677,5 +677,4 @@ tcp_sack_adjust(struct tcpcb *tp) if (SEQ_LT(tp->snd_nxt, cur->end)) return; tp->snd_nxt = tp->snd_fack; - return; } Modified: stable/7/sys/netinet/tcp_syncache.c ============================================================================== --- stable/7/sys/netinet/tcp_syncache.c Mon Nov 10 18:09:52 2008 (r184822) +++ stable/7/sys/netinet/tcp_syncache.c Mon Nov 10 18:24:11 2008 (r184823) @@ -1297,7 +1297,6 @@ done: #endif *lsop = NULL; m_freem(m); - return; } static int @@ -1624,7 +1623,6 @@ syncookie_generate(struct syncache_head } tcpstat.tcps_sc_sendcookie++; - return; } static struct syncache * From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 10 22:40:17 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BA301065678; Mon, 10 Nov 2008 22:40: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 EA9B48FC18; Mon, 10 Nov 2008 22:40:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAAMeHQM084288; Mon, 10 Nov 2008 22:40:17 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAAMeGfs084286; Mon, 10 Nov 2008 22:40:16 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811102240.mAAMeGfs084286@svn.freebsd.org> From: Xin LI Date: Mon, 10 Nov 2008 22:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184826 - in stable/7/sys: . dev/bce X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Nov 2008 22:40:17 -0000 Author: delphij Date: Mon Nov 10 22:40:16 2008 New Revision: 184826 URL: http://svn.freebsd.org/changeset/base/184826 Log: Merge the following bce(4) changes: r176448,178132,178853,179436,179695,179771,182293 r176448 (davidch) - Added loose RX MTU functionality to allow frames larger than 1500 bytes to be accepted even though the interface MTU is set to 1500. - Implemented new TCP header splitting/jumbo frame support which uses two chains for receive traffic rather than the original single receive chain. - Added additional debug support code. r178132 (davidch) - Fixed a problem with the send chain consumer index which would cause TX traffic to sit in the send chain until a received packet kick started the interrupt handler. This would cause extremely slow performance when used with NFS over UDP. - Removed untested polling code. - Updated copyright year in the file header. - Removed inadvertent ^M's created by DOS text editor. r178853 (scottl) The BCE chips appear to have an undocumented requirement that RX frames be aligned on an 8 byte boundary. Prior to rev 1.36 (now r176448) this wasn't a problem because mbuf clusters tend be naturally aligned. The switch to using split buffers with the first buffer being the embedded data area of the mbuf has broken this assumption, at least on i386, causing a complete failure of RX functionality. Fix this for now by using a full cluster for the first RX buffer. A more sophisticated approach could be done with the old buffer scheme to realign the m_data pointer with m_adj(), but I'm also not clear on performance benefits of this old scheme or the performance implications of adding an m_adj() call to every allocation. r179436 (jhb) Trim an extra semi-colon. r179695 (davidch) - Fixed kern/123696 by increasing firmware timeout value from 100 to 1000. - Fixed a problem on i386 architecture when using split header/jumbo frame firmware caused by hardware alignment requirements. - Added #define BCE_USE_SPLIT_HEADER to allow the feature to be enabled/disabled. Enabled by default. PR: kern/123696 r179771 (davidch) - Added support for BCM5709 and BCM5716 controllers. r182293 (davidch) - Updated support for 5716. - Added some additional code for debug builds. - Fixed a problem printing physical memory on 64bit system during debugging. - Modified some of the context memory and mailbox register names to more clearly distinguish their use. - Added memory barriers for Intel CPUs when accessing host memory data structures which are written by hardware. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/bce/if_bcefw.h stable/7/sys/dev/bce/if_bcereg.h Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Mon Nov 10 22:06:24 2008 (r184825) +++ stable/7/sys/dev/bce/if_bce.c Mon Nov 10 22:40:16 2008 (r184826) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2007 Broadcom Corporation + * Copyright (c) 2006-2008 Broadcom Corporation * David Christensen . All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,13 +34,19 @@ __FBSDID("$FreeBSD$"); /* * The following controllers are supported by this driver: * BCM5706C A2, A3 + * BCM5706S A2, A3 * BCM5708C B1, B2 + * BCM5708S B1, B2 + * BCM5709C A1, C0 + * BCM5716 C0 * * The following controllers are not supported by this driver: - * BCM5706C A0, A1 - * BCM5706S A0, A1, A2, A3 - * BCM5708C A0, B0 - * BCM5708S A0, B0, B1, B2 + * BCM5706C A0, A1 (pre-production) + * BCM5706S A0, A1 (pre-production) + * BCM5708C A0, B0 (pre-production) + * BCM5708S A0, B0 (pre-production) + * BCM5709C A0 B0, B1, B2 (pre-production) + * BCM5709S A0, A1, B0, B1, B2, C0 (pre-production) */ #include "opt_bce.h" @@ -80,6 +86,12 @@ __FBSDID("$FreeBSD$"); int bce_debug_bootcode_running_failure = 0; #endif +/****************************************************************************/ +/* BCE Build Time Options */ +/****************************************************************************/ +#define BCE_USE_SPLIT_HEADER 1 +/* #define BCE_NVRAM_WRITE_SUPPORT 1 */ + /****************************************************************************/ /* PCI Device ID Table */ @@ -110,6 +122,19 @@ static struct bce_type bce_devs[] = { /* BCM5708S controllers and OEM boards. */ { BRCM_VENDORID, BRCM_DEVICEID_BCM5708S, PCI_ANY_ID, PCI_ANY_ID, "Broadcom NetXtreme II BCM5708 1000Base-SX" }, + + /* BCM5709C controllers and OEM boards. */ + { BRCM_VENDORID, BRCM_DEVICEID_BCM5709, PCI_ANY_ID, PCI_ANY_ID, + "Broadcom NetXtreme II BCM5709 1000Base-T" }, + + /* BCM5709S controllers and OEM boards. */ + { BRCM_VENDORID, BRCM_DEVICEID_BCM5709S, PCI_ANY_ID, PCI_ANY_ID, + "Broadcom NetXtreme II BCM5709 1000Base-SX" }, + + /* BCM5716 controllers and OEM boards. */ + { BRCM_VENDORID, BRCM_DEVICEID_BCM5716, PCI_ANY_ID, PCI_ANY_ID, + "Broadcom NetXtreme II BCM5716 1000Base-T" }, + { 0, 0, 0, 0, NULL } }; @@ -119,91 +144,110 @@ static struct bce_type bce_devs[] = { /****************************************************************************/ static struct flash_spec flash_table[] = { +#define BUFFERED_FLAGS (BCE_NV_BUFFERED | BCE_NV_TRANSLATE) +#define NONBUFFERED_FLAGS (BCE_NV_WREN) + /* Slow EEPROM */ {0x00000000, 0x40830380, 0x009f0081, 0xa184a053, 0xaf000400, - 1, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, + BUFFERED_FLAGS, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE, "EEPROM - slow"}, /* Expansion entry 0001 */ {0x08000002, 0x4b808201, 0x00050081, 0x03840253, 0xaf020406, - 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, SAIFUN_FLASH_BYTE_ADDR_MASK, 0, "Entry 0001"}, /* Saifun SA25F010 (non-buffered flash) */ /* strap, cfg1, & write1 need updates */ {0x04000001, 0x47808201, 0x00050081, 0x03840253, 0xaf020406, - 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*2, "Non-buffered flash (128kB)"}, /* Saifun SA25F020 (non-buffered flash) */ /* strap, cfg1, & write1 need updates */ {0x0c000003, 0x4f808201, 0x00050081, 0x03840253, 0xaf020406, - 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE*4, "Non-buffered flash (256kB)"}, /* Expansion entry 0100 */ {0x11000000, 0x53808201, 0x00050081, 0x03840253, 0xaf020406, - 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, SAIFUN_FLASH_BYTE_ADDR_MASK, 0, "Entry 0100"}, /* Entry 0101: ST M45PE10 (non-buffered flash, TetonII B0) */ {0x19000002, 0x5b808201, 0x000500db, 0x03840253, 0xaf020406, - 0, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*2, "Entry 0101: ST M45PE10 (128kB non-bufferred)"}, /* Entry 0110: ST M45PE20 (non-buffered flash)*/ {0x15000001, 0x57808201, 0x000500db, 0x03840253, 0xaf020406, - 0, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, ST_MICRO_FLASH_PAGE_BITS, ST_MICRO_FLASH_PAGE_SIZE, ST_MICRO_FLASH_BYTE_ADDR_MASK, ST_MICRO_FLASH_BASE_TOTAL_SIZE*4, "Entry 0110: ST M45PE20 (256kB non-bufferred)"}, /* Saifun SA25F005 (non-buffered flash) */ /* strap, cfg1, & write1 need updates */ {0x1d000003, 0x5f808201, 0x00050081, 0x03840253, 0xaf020406, - 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, SAIFUN_FLASH_BYTE_ADDR_MASK, SAIFUN_FLASH_BASE_TOTAL_SIZE, "Non-buffered flash (64kB)"}, /* Fast EEPROM */ {0x22000000, 0x62808380, 0x009f0081, 0xa184a053, 0xaf000400, - 1, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, + BUFFERED_FLAGS, SEEPROM_PAGE_BITS, SEEPROM_PAGE_SIZE, SEEPROM_BYTE_ADDR_MASK, SEEPROM_TOTAL_SIZE, "EEPROM - fast"}, /* Expansion entry 1001 */ {0x2a000002, 0x6b808201, 0x00050081, 0x03840253, 0xaf020406, - 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, SAIFUN_FLASH_BYTE_ADDR_MASK, 0, "Entry 1001"}, /* Expansion entry 1010 */ {0x26000001, 0x67808201, 0x00050081, 0x03840253, 0xaf020406, - 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, SAIFUN_FLASH_BYTE_ADDR_MASK, 0, "Entry 1010"}, /* ATMEL AT45DB011B (buffered flash) */ {0x2e000003, 0x6e808273, 0x00570081, 0x68848353, 0xaf000400, - 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, + BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE, "Buffered flash (128kB)"}, /* Expansion entry 1100 */ {0x33000000, 0x73808201, 0x00050081, 0x03840253, 0xaf020406, - 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, SAIFUN_FLASH_BYTE_ADDR_MASK, 0, "Entry 1100"}, /* Expansion entry 1101 */ {0x3b000002, 0x7b808201, 0x00050081, 0x03840253, 0xaf020406, - 0, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, + NONBUFFERED_FLAGS, SAIFUN_FLASH_PAGE_BITS, SAIFUN_FLASH_PAGE_SIZE, SAIFUN_FLASH_BYTE_ADDR_MASK, 0, "Entry 1101"}, /* Ateml Expansion entry 1110 */ {0x37000001, 0x76808273, 0x00570081, 0x68848353, 0xaf000400, - 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, + BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, BUFFERED_FLASH_BYTE_ADDR_MASK, 0, "Entry 1110 (Atmel)"}, /* ATMEL AT45DB021B (buffered flash) */ {0x3f000003, 0x7e808273, 0x00570081, 0x68848353, 0xaf000400, - 1, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, + BUFFERED_FLAGS, BUFFERED_FLASH_PAGE_BITS, BUFFERED_FLASH_PAGE_SIZE, BUFFERED_FLASH_BYTE_ADDR_MASK, BUFFERED_FLASH_TOTAL_SIZE*2, "Buffered flash (256kB)"}, }; +/* + * The BCM5709 controllers transparently handle the + * differences between Atmel 264 byte pages and all + * flash devices which use 256 byte pages, so no + * logical-to-physical mapping is required in the + * driver. + */ +static struct flash_spec flash_5709 = { + .flags = BCE_NV_BUFFERED, + .page_bits = BCM5709_FLASH_PAGE_BITS, + .page_size = BCM5709_FLASH_PAGE_SIZE, + .addr_mask = BCM5709_FLASH_BYTE_ADDR_MASK, + .total_size = BUFFERED_FLASH_TOTAL_SIZE * 2, + .name = "5709/5716 buffered flash (256kB)", +}; + /****************************************************************************/ /* FreeBSD device entry points. */ @@ -218,19 +262,41 @@ static int bce_shutdown (device_t); /* BCE Debug Data Structure Dump Routines */ /****************************************************************************/ #ifdef BCE_DEBUG +static u32 bce_reg_rd (struct bce_softc *, u32); +static void bce_reg_wr (struct bce_softc *, u32, u32); +static void bce_reg_wr16 (struct bce_softc *, u32, u16); +static u32 bce_ctx_rd (struct bce_softc *, u32, u32); +static void bce_dump_enet (struct bce_softc *, struct mbuf *); static void bce_dump_mbuf (struct bce_softc *, struct mbuf *); -static void bce_dump_tx_mbuf_chain (struct bce_softc *, int, int); -static void bce_dump_rx_mbuf_chain (struct bce_softc *, int, int); +static void bce_dump_tx_mbuf_chain (struct bce_softc *, u16, int); +static void bce_dump_rx_mbuf_chain (struct bce_softc *, u16, int); +#ifdef BCE_USE_SPLIT_HEADER +static void bce_dump_pg_mbuf_chain (struct bce_softc *, u16, int); +#endif static void bce_dump_txbd (struct bce_softc *, int, struct tx_bd *); static void bce_dump_rxbd (struct bce_softc *, int, struct rx_bd *); +#ifdef BCE_USE_SPLIT_HEADER +static void bce_dump_pgbd (struct bce_softc *, int, struct rx_bd *); +#endif static void bce_dump_l2fhdr (struct bce_softc *, int, struct l2_fhdr *); -static void bce_dump_tx_chain (struct bce_softc *, int, int); -static void bce_dump_rx_chain (struct bce_softc *, int, int); +static void bce_dump_ctx (struct bce_softc *, u16); +static void bce_dump_ftqs (struct bce_softc *); +static void bce_dump_tx_chain (struct bce_softc *, u16, int); +static void bce_dump_rx_chain (struct bce_softc *, u16, int); +#ifdef BCE_USE_SPLIT_HEADER +static void bce_dump_pg_chain (struct bce_softc *, u16, int); +#endif static void bce_dump_status_block (struct bce_softc *); static void bce_dump_stats_block (struct bce_softc *); static void bce_dump_driver_state (struct bce_softc *); static void bce_dump_hw_state (struct bce_softc *); +static void bce_dump_mq_regs (struct bce_softc *); static void bce_dump_bc_state (struct bce_softc *); +static void bce_dump_txp_state (struct bce_softc *, int); +static void bce_dump_rxp_state (struct bce_softc *, int); +static void bce_dump_tpat_state (struct bce_softc *, int); +static void bce_dump_cp_state (struct bce_softc *, int); +static void bce_dump_com_state (struct bce_softc *, int); static void bce_breakpoint (struct bce_softc *); #endif @@ -268,6 +334,7 @@ static int bce_nvram_write (struct bc /****************************************************************************/ /* */ /****************************************************************************/ +static void bce_get_media (struct bce_softc *); static void bce_dma_map_addr (void *, bus_dma_segment_t *, int, int); static int bce_dma_alloc (device_t); static void bce_dma_free (struct bce_softc *); @@ -279,19 +346,34 @@ static void bce_release_resources (struc static int bce_fw_sync (struct bce_softc *, u32); static void bce_load_rv2p_fw (struct bce_softc *, u32 *, u32, u32); static void bce_load_cpu_fw (struct bce_softc *, struct cpu_reg *, struct fw_info *); +static void bce_init_rxp_cpu (struct bce_softc *); +static void bce_init_txp_cpu (struct bce_softc *); +static void bce_init_tpat_cpu (struct bce_softc *); +static void bce_init_cp_cpu (struct bce_softc *); +static void bce_init_com_cpu (struct bce_softc *); static void bce_init_cpus (struct bce_softc *); +static void bce_print_adapter_info (struct bce_softc *); +static void bce_probe_pci_caps (device_t, struct bce_softc *); static void bce_stop (struct bce_softc *); static int bce_reset (struct bce_softc *, u32); static int bce_chipinit (struct bce_softc *); static int bce_blockinit (struct bce_softc *); -static int bce_get_buf (struct bce_softc *, struct mbuf *, u16 *, u16 *, u32 *); static int bce_init_tx_chain (struct bce_softc *); -static void bce_fill_rx_chain (struct bce_softc *); +static void bce_free_tx_chain (struct bce_softc *); + +static int bce_get_rx_buf (struct bce_softc *, struct mbuf *, u16 *, u16 *, u32 *); static int bce_init_rx_chain (struct bce_softc *); +static void bce_fill_rx_chain (struct bce_softc *); static void bce_free_rx_chain (struct bce_softc *); -static void bce_free_tx_chain (struct bce_softc *); + +#ifdef BCE_USE_SPLIT_HEADER +static int bce_get_pg_buf (struct bce_softc *, struct mbuf *, u16 *, u16 *); +static int bce_init_pg_chain (struct bce_softc *); +static void bce_fill_pg_chain (struct bce_softc *); +static void bce_free_pg_chain (struct bce_softc *); +#endif static int bce_tx_encap (struct bce_softc *, struct mbuf **); static void bce_start_locked (struct ifnet *); @@ -305,19 +387,16 @@ static void bce_init_locked (struct bc static void bce_init (void *); static void bce_mgmt_init_locked (struct bce_softc *sc); -static void bce_init_context (struct bce_softc *); +static void bce_init_ctx (struct bce_softc *); static void bce_get_mac_addr (struct bce_softc *); static void bce_set_mac_addr (struct bce_softc *); static void bce_phy_intr (struct bce_softc *); +static inline u16 bce_get_hw_rx_cons(struct bce_softc *); static void bce_rx_intr (struct bce_softc *); static void bce_tx_intr (struct bce_softc *); static void bce_disable_intr (struct bce_softc *); -static void bce_enable_intr (struct bce_softc *); +static void bce_enable_intr (struct bce_softc *, int); -#ifdef DEVICE_POLLING -static void bce_poll_locked (struct ifnet *, enum poll_cmd, int); -static void bce_poll (struct ifnet *, enum poll_cmd, int); -#endif static void bce_intr (void *); static void bce_set_rx_mode (struct bce_softc *); static void bce_stats_update (struct bce_softc *); @@ -330,20 +409,28 @@ static void bce_add_sysctls (struct bc /* FreeBSD device dispatch table. */ /****************************************************************************/ static device_method_t bce_methods[] = { - /* Device interface */ + /* Device interface (device_if.h) */ DEVMETHOD(device_probe, bce_probe), DEVMETHOD(device_attach, bce_attach), DEVMETHOD(device_detach, bce_detach), DEVMETHOD(device_shutdown, bce_shutdown), +/* Supported by device interface but not used here. */ +/* DEVMETHOD(device_identify, bce_identify), */ +/* DEVMETHOD(device_suspend, bce_suspend), */ +/* DEVMETHOD(device_resume, bce_resume), */ +/* DEVMETHOD(device_quiesce, bce_quiesce), */ - /* bus interface */ + /* Bus interface (bus_if.h) */ DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ + /* MII interface (miibus_if.h) */ DEVMETHOD(miibus_readreg, bce_miibus_read_reg), DEVMETHOD(miibus_writereg, bce_miibus_write_reg), DEVMETHOD(miibus_statchg, bce_miibus_statchg), +/* Supported by MII interface but not used here. */ +/* DEVMETHOD(miibus_linkchg, bce_miibus_linkchg), */ +/* DEVMETHOD(miibus_mediainit, bce_miibus_mediainit), */ { 0, 0 } }; @@ -367,19 +454,26 @@ DRIVER_MODULE(miibus, bce, miibus_driver /****************************************************************************/ /* Tunable device values */ /****************************************************************************/ -static int bce_tso_enable = TRUE; -static int bce_msi_enable = 1; +SYSCTL_NODE(_hw, OID_AUTO, bce, CTLFLAG_RD, 0, "bce driver parameters"); /* Allowable values are TRUE or FALSE */ +static int bce_tso_enable = TRUE; TUNABLE_INT("hw.bce.tso_enable", &bce_tso_enable); -/* Allowable values are 0 (IRQ only) and 1 (IRQ or MSI) */ -TUNABLE_INT("hw.bce.msi_enable", &bce_msi_enable); - -SYSCTL_NODE(_hw, OID_AUTO, bce, CTLFLAG_RD, 0, "bce driver parameters"); SYSCTL_UINT(_hw_bce, OID_AUTO, tso_enable, CTLFLAG_RDTUN, &bce_tso_enable, 0, "TSO Enable/Disable"); + +/* Allowable values are 0 (IRQ), 1 (MSI/IRQ), and 2 (MSI-X/MSI/IRQ) */ +/* ToDo: Add MSI-X support. */ +static int bce_msi_enable = 1; +TUNABLE_INT("hw.bce.msi_enable", &bce_msi_enable); SYSCTL_UINT(_hw_bce, OID_AUTO, msi_enable, CTLFLAG_RDTUN, &bce_msi_enable, 0, -"MSI | INTx selector"); +"MSI-X|MSI|INTx selector"); + +/* ToDo: Add tunable to enable/disable strict MTU handling. */ +/* Currently allows "loose" RX MTU checking (i.e. sets the */ +/* H/W RX MTU to the size of the largest receive buffer, or */ +/* 2048 bytes). */ + /****************************************************************************/ /* Device probe function. */ @@ -411,14 +505,14 @@ bce_probe(device_t dev) svid = pci_get_subvendor(dev); sdid = pci_get_subdevice(dev); - DBPRINT(sc, BCE_VERBOSE_LOAD, + DBPRINT(sc, BCE_EXTREME_LOAD, "%s(); VID = 0x%04X, DID = 0x%04X, SVID = 0x%04X, " "SDID = 0x%04X\n", __FUNCTION__, vid, did, svid, sdid); /* Look through the list of known devices for a match. */ while(t->bce_name != NULL) { - if ((vid == t->bce_vid) && (did == t->bce_did) && + if ((vid == t->bce_vid) && (did == t->bce_did) && ((svid == t->bce_svid) || (t->bce_svid == PCI_ANY_ID)) && ((sdid == t->bce_sdid) || (t->bce_sdid == PCI_ANY_ID))) { @@ -428,7 +522,7 @@ bce_probe(device_t dev) return(ENOMEM); /* Print out the device identity. */ - snprintf(descbuf, BCE_DEVDESC_MAX, "%s (%c%d)", + snprintf(descbuf, BCE_DEVDESC_MAX, "%s (%c%d)", t->bce_name, (((pci_read_config(dev, PCIR_REVID, 4) & 0xf0) >> 4) + 'A'), (pci_read_config(dev, PCIR_REVID, 4) & 0xf)); @@ -445,6 +539,109 @@ bce_probe(device_t dev) /****************************************************************************/ +/* PCI Capabilities Probe Function. */ +/* */ +/* Walks the PCI capabiites list for the device to find what features are */ +/* supported. */ +/* */ +/* Returns: */ +/* None. */ +/****************************************************************************/ +static void +bce_print_adapter_info(struct bce_softc *sc) +{ + DBENTER(BCE_VERBOSE_LOAD); + + BCE_PRINTF("ASIC (0x%08X); ", sc->bce_chipid); + printf("Rev (%c%d); ", ((BCE_CHIP_ID(sc) & 0xf000) >> 12) + 'A', + ((BCE_CHIP_ID(sc) & 0x0ff0) >> 4)); + + /* Bus info. */ + if (sc->bce_flags & BCE_PCIE_FLAG) { + printf("Bus (PCIe x%d, ", sc->link_width); + switch (sc->link_speed) { + case 1: printf("2.5Gbps); "); break; + case 2: printf("5Gbps); "); break; + default: printf("Unknown link speed); "); + } + } else { + printf("Bus (PCI%s, %s, %dMHz); ", + ((sc->bce_flags & BCE_PCIX_FLAG) ? "-X" : ""), + ((sc->bce_flags & BCE_PCI_32BIT_FLAG) ? "32-bit" : "64-bit"), + sc->bus_speed_mhz); + } + + /* Firmware version and device features. */ + printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver); +#ifdef BCE_USE_SPLIT_HEADER + printf("SPLT "); +#endif + if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) + printf("MFW "); + if (sc->bce_flags & BCE_USING_MSI_FLAG) + printf("MSI "); + if (sc->bce_flags & BCE_USING_MSIX_FLAG) + printf("MSI-X "); + if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) + printf("2.5G "); + printf(")\n"); + + DBEXIT(BCE_VERBOSE_LOAD); +} + + +/****************************************************************************/ +/* PCI Capabilities Probe Function. */ +/* */ +/* Walks the PCI capabiites list for the device to find what features are */ +/* supported. */ +/* */ +/* Returns: */ +/* None. */ +/****************************************************************************/ +static void +bce_probe_pci_caps(device_t dev, struct bce_softc *sc) +{ + u32 reg; + + DBENTER(BCE_VERBOSE_LOAD); + + /* Check if PCI-X capability is enabled. */ + if (pci_find_extcap(dev, PCIY_PCIX, ®) == 0) { + if (reg != 0) + sc->bce_cap_flags |= BCE_PCIX_CAPABLE_FLAG; + } + + /* Check if PCIe capability is enabled. */ + if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { + if (reg != 0) { + u16 link_status = pci_read_config(dev, reg + 0x12, 2); + DBPRINT(sc, BCE_INFO_LOAD, "PCIe link_status = 0x%08X\n", + link_status); + sc->link_speed = link_status & 0xf; + sc->link_width = (link_status >> 4) & 0x3f; + sc->bce_cap_flags |= BCE_PCIE_CAPABLE_FLAG; + sc->bce_flags |= BCE_PCIE_FLAG; + } + } + + /* Check if MSI capability is enabled. */ + if (pci_find_extcap(dev, PCIY_MSI, ®) == 0) { + if (reg != 0) + sc->bce_cap_flags |= BCE_MSI_CAPABLE_FLAG; + } + + /* Check if MSI-X capability is enabled. */ + if (pci_find_extcap(dev, PCIY_MSIX, ®) == 0) { + if (reg != 0) + sc->bce_cap_flags |= BCE_MSIX_CAPABLE_FLAG; + } + + DBEXIT(BCE_VERBOSE_LOAD); +} + + +/****************************************************************************/ /* Device attach function. */ /* */ /* Allocates device resources, performs secondary chip identification, */ @@ -460,21 +657,19 @@ bce_attach(device_t dev) struct bce_softc *sc; struct ifnet *ifp; u32 val; - int count, mbuf, rid, rc = 0; + int error, rid, rc = 0; sc = device_get_softc(dev); sc->bce_dev = dev; - DBPRINT(sc, BCE_VERBOSE_RESET, "Entering %s()\n", __FUNCTION__); + DBENTER(BCE_VERBOSE_LOAD | BCE_VERBOSE_RESET); - mbuf = device_get_unit(dev); + sc->bce_unit = device_get_unit(dev); /* Set initial device and PHY flags */ sc->bce_flags = 0; sc->bce_phy_flags = 0; - sc->bce_unit = mbuf; - pci_enable_busmaster(dev); /* Allocate PCI memory resources. */ @@ -483,7 +678,7 @@ bce_attach(device_t dev) &rid, RF_ACTIVE | PCI_RF_DENSE); if (sc->bce_res_mem == NULL) { - BCE_PRINTF("%s(%d): PCI memory allocation failed\n", + BCE_PRINTF("%s(%d): PCI memory allocation failed\n", __FILE__, __LINE__); rc = ENXIO; goto bce_attach_fail; @@ -494,25 +689,74 @@ bce_attach(device_t dev) sc->bce_bhandle = rman_get_bushandle(sc->bce_res_mem); sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res_mem); - /* If MSI is enabled in the driver, get the vector count. */ - count = bce_msi_enable ? pci_msi_count(dev) : 0; + bce_probe_pci_caps(dev, sc); - /* Allocate PCI IRQ resources. */ - if (count == 1 && pci_alloc_msi(dev, &count) == 0 && count == 1) { - rid = 1; - sc->bce_flags |= BCE_USING_MSI_FLAG; - DBPRINT(sc, BCE_VERBOSE_LOAD, - "Allocating %d MSI interrupt(s)\n", count); - } else { + rid = 1; +#if 0 + /* Try allocating MSI-X interrupts. */ + if ((sc->bce_cap_flags & BCE_MSIX_CAPABLE_FLAG) && + (bce_msi_enable >= 2) && + ((sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE)) != NULL)) { + + msi_needed = sc->bce_msi_count = 1; + + if (((error = pci_alloc_msix(dev, &sc->bce_msi_count)) != 0) || + (sc->bce_msi_count != msi_needed)) { + BCE_PRINTF("%s(%d): MSI-X allocation failed! Requested = %d," + "Received = %d, error = %d\n", __FILE__, __LINE__, + msi_needed, sc->bce_msi_count, error); + sc->bce_msi_count = 0; + pci_release_msi(dev); + bus_release_resource(dev, SYS_RES_MEMORY, rid, + sc->bce_res_irq); + sc->bce_res_irq = NULL; + } else { + DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI-X interrupt.\n", + __FUNCTION__); + sc->bce_flags |= BCE_USING_MSIX_FLAG; + sc->bce_intr = bce_intr; + } + } +#endif + + /* Try allocating a MSI interrupt. */ + if ((sc->bce_cap_flags & BCE_MSI_CAPABLE_FLAG) && + (bce_msi_enable >= 1) && (sc->bce_msi_count == 0)) { + sc->bce_msi_count = 1; + if ((error = pci_alloc_msi(dev, &sc->bce_msi_count)) != 0) { + BCE_PRINTF("%s(%d): MSI allocation failed! error = %d\n", + __FILE__, __LINE__, error); + sc->bce_msi_count = 0; + pci_release_msi(dev); + } else { + DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI interrupt.\n", + __FUNCTION__); + sc->bce_flags |= BCE_USING_MSI_FLAG; + if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) || + (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) + sc->bce_flags |= BCE_ONE_SHOT_MSI_FLAG; + sc->bce_irq_rid = 1; + sc->bce_intr = bce_intr; + } + } + + /* Try allocating a legacy interrupt. */ + if (sc->bce_msi_count == 0) { + DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using INTx interrupt.\n", + __FUNCTION__); rid = 0; - DBPRINT(sc, BCE_VERBOSE_LOAD, "Allocating IRQ interrupt\n"); + sc->bce_intr = bce_intr; } - sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_SHAREABLE | RF_ACTIVE); + sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &rid, RF_SHAREABLE | RF_ACTIVE); + + sc->bce_irq_rid = rid; + /* Report any IRQ allocation errors. */ if (sc->bce_res_irq == NULL) { - BCE_PRINTF("%s(%d): PCI map interrupt failed!\n", + BCE_PRINTF("%s(%d): PCI map interrupt failed!\n", __FILE__, __LINE__); rc = ENXIO; goto bce_attach_fail; @@ -540,18 +784,22 @@ bce_attach(device_t dev) case BCE_CHIP_ID_5706_A1: case BCE_CHIP_ID_5708_A0: case BCE_CHIP_ID_5708_B0: + case BCE_CHIP_ID_5709_A0: + case BCE_CHIP_ID_5709_B0: + case BCE_CHIP_ID_5709_B1: + case BCE_CHIP_ID_5709_B2: BCE_PRINTF("%s(%d): Unsupported controller revision (%c%d)!\n", - __FILE__, __LINE__, + __FILE__, __LINE__, (((pci_read_config(dev, PCIR_REVID, 4) & 0xf0) >> 4) + 'A'), (pci_read_config(dev, PCIR_REVID, 4) & 0xf)); rc = ENODEV; goto bce_attach_fail; } - /* - * The embedded PCIe to PCI-X bridge (EPB) - * in the 5708 cannot address memory above - * 40 bits (E7_5708CB1_23043 & E6_5708SB1_23043). + /* + * The embedded PCIe to PCI-X bridge (EPB) + * in the 5708 cannot address memory above + * 40 bits (E7_5708CB1_23043 & E6_5708SB1_23043). */ if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5708) sc->max_bus_addr = BCE_BUS_SPACE_MAXADDR; @@ -565,25 +813,23 @@ bce_attach(device_t dev) */ val = REG_RD_IND(sc, BCE_SHM_HDR_SIGNATURE); if ((val & BCE_SHM_HDR_SIGNATURE_SIG_MASK) == BCE_SHM_HDR_SIGNATURE_SIG) - sc->bce_shmem_base = REG_RD_IND(sc, BCE_SHM_HDR_ADDR_0); + /* Multi-port devices use different offsets in shared memory. */ + sc->bce_shmem_base = REG_RD_IND(sc, BCE_SHM_HDR_ADDR_0 + + (pci_get_function(sc->bce_dev) << 2)); else sc->bce_shmem_base = HOST_VIEW_SHMEM_BASE; - DBPRINT(sc, BCE_VERBOSE_FIRMWARE, "%s(): bce_shmem_base = 0x%08X\n", + DBPRINT(sc, BCE_VERBOSE_FIRMWARE, "%s(): bce_shmem_base = 0x%08X\n", __FUNCTION__, sc->bce_shmem_base); - sc->bce_fw_ver = REG_RD_IND(sc, sc->bce_shmem_base + + /* Fetch the bootcode revision. */ + sc->bce_fw_ver = REG_RD_IND(sc, sc->bce_shmem_base + BCE_DEV_INFO_BC_REV); - DBPRINT(sc, BCE_INFO_FIRMWARE, "%s(): bce_fw_ver = 0x%08X\n", - __FUNCTION__, sc->bce_fw_ver); /* Check if any management firmware is running. */ val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_PORT_FEATURE); - if (val & (BCE_PORT_FEATURE_ASF_ENABLED | BCE_PORT_FEATURE_IMD_ENABLED)) { + if (val & (BCE_PORT_FEATURE_ASF_ENABLED | BCE_PORT_FEATURE_IMD_ENABLED)) sc->bce_flags |= BCE_MFW_ENABLE_FLAG; - DBPRINT(sc, BCE_INFO_LOAD, "%s(): BCE_MFW_ENABLE_FLAG\n", - __FUNCTION__); - } /* Get PCI bus information (speed and type). */ val = REG_RD(sc, BCE_PCICFG_MISC_STATUS); @@ -632,7 +878,7 @@ bce_attach(device_t dev) /* Reset the controller and announce to bootcode that driver is present. */ if (bce_reset(sc, BCE_DRV_MSG_CODE_RESET)) { - BCE_PRINTF("%s(%d): Controller reset failed!\n", + BCE_PRINTF("%s(%d): Controller reset failed!\n", __FILE__, __LINE__); rc = ENXIO; goto bce_attach_fail; @@ -662,7 +908,7 @@ bce_attach(device_t dev) * should be ready before generating an * interrupt while ticks control how long * a BD can sit in the chain before - * generating an interrupt. Set the default + * generating an interrupt. Set the default * values for the RX and TX chains. */ @@ -693,33 +939,14 @@ bce_attach(device_t dev) /* Update statistics once every second. */ sc->bce_stats_ticks = 1000000 & 0xffff00; - /* - * The SerDes based NetXtreme II controllers - * that support 2.5Gb operation (currently - * 5708S) use a PHY at address 2, otherwise - * the PHY is present at address 1. - */ - sc->bce_phy_addr = 1; - - if (BCE_CHIP_BOND_ID(sc) & BCE_CHIP_BOND_ID_SERDES_BIT) { - sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; - sc->bce_flags |= BCE_NO_WOL_FLAG; - if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) { - sc->bce_phy_addr = 2; - val = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_SHARED_HW_CFG_CONFIG); - if (val & BCE_SHARED_HW_CFG_PHY_2_5G) { - sc->bce_phy_flags |= BCE_PHY_2_5G_CAPABLE_FLAG; - DBPRINT(sc, BCE_INFO_LOAD, "Found 2.5Gb capable adapter\n"); - } - } - } + /* Find the media type for the adapter. */ + bce_get_media(sc); /* Store data needed by PHY driver for backplane applications */ sc->bce_shared_hw_cfg = REG_RD_IND(sc, sc->bce_shmem_base + BCE_SHARED_HW_CFG_CONFIG); sc->bce_port_hw_cfg = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_SHARED_HW_CFG_CONFIG); + BCE_PORT_HW_CFG_CONFIG); /* Allocate DMA memory resources. */ if (bce_dma_alloc(dev)) { @@ -732,7 +959,7 @@ bce_attach(device_t dev) /* Allocate an ifnet structure. */ ifp = sc->bce_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { - BCE_PRINTF("%s(%d): Interface allocation failed!\n", + BCE_PRINTF("%s(%d): Interface allocation failed!\n", __FILE__, __LINE__); rc = ENXIO; goto bce_attach_fail; @@ -757,10 +984,24 @@ bce_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; - /* Assume a standard 1500 byte MTU size for mbuf allocations. */ - sc->mbuf_alloc_size = MCLBYTES; -#ifdef DEVICE_POLLING - ifp->if_capabilities |= IFCAP_POLLING; + /* + * Assume standard mbuf sizes for buffer allocation. + * This may change later if the MTU size is set to + * something other than 1500. + */ +#ifdef BCE_USE_SPLIT_HEADER + sc->rx_bd_mbuf_alloc_size = MHLEN; + /* Make sure offset is 16 byte aligned for hardware. */ + sc->rx_bd_mbuf_align_pad = roundup2((MSIZE - MHLEN), 16) - + (MSIZE - MHLEN); + sc->rx_bd_mbuf_data_len = sc->rx_bd_mbuf_alloc_size - + sc->rx_bd_mbuf_align_pad; + sc->pg_bd_mbuf_alloc_size = MCLBYTES; +#else + sc->rx_bd_mbuf_alloc_size = MCLBYTES; + sc->rx_bd_mbuf_align_pad = roundup2(MCLBYTES, 16) - MCLBYTES; + sc->rx_bd_mbuf_data_len = sc->rx_bd_mbuf_alloc_size - + sc->rx_bd_mbuf_align_pad; #endif ifp->if_snd.ifq_drv_maxlen = USABLE_TX_BD; @@ -775,7 +1016,7 @@ bce_attach(device_t dev) /* Check for an MII child bus by probing the PHY. */ if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd, bce_ifmedia_sts)) { - BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n", + BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n", __FILE__, __LINE__); rc = ENXIO; goto bce_attach_fail; @@ -793,30 +1034,31 @@ bce_attach(device_t dev) #endif /* Hookup IRQ last. */ - rc = bus_setup_intr(dev, sc->bce_res_irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, - bce_intr, sc, &sc->bce_intrhand); + rc = bus_setup_intr(dev, sc->bce_res_irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL, bce_intr, sc, &sc->bce_intrhand); if (rc) { - BCE_PRINTF("%s(%d): Failed to setup IRQ!\n", + BCE_PRINTF("%s(%d): Failed to setup IRQ!\n", __FILE__, __LINE__); bce_detach(dev); goto bce_attach_exit; } - /* - * At this point we've acquired all the resources + /* + * At this point we've acquired all the resources * we need to run so there's no turning back, we're * cleared for launch. */ /* Print some important debugging info. */ - DBRUN(BCE_INFO, bce_dump_driver_state(sc)); + DBRUNMSG(BCE_INFO, bce_dump_driver_state(sc)); /* Add the supported sysctls to the kernel. */ bce_add_sysctls(sc); BCE_LOCK(sc); - /* + + /* * The chip reset earlier notified the bootcode that * a driver is present. We now need to start our pulse * routine so that the bootcode is reminded that we're @@ -828,21 +1070,9 @@ bce_attach(device_t dev) BCE_UNLOCK(sc); /* Finally, print some useful adapter info */ - BCE_PRINTF("ASIC (0x%08X); ", sc->bce_chipid); - printf("Rev (%c%d); ", ((BCE_CHIP_ID(sc) & 0xf000) >> 12) + 'A', - ((BCE_CHIP_ID(sc) & 0x0ff0) >> 4)); - printf("Bus (PCI%s, %s, %dMHz); ", - ((sc->bce_flags & BCE_PCIX_FLAG) ? "-X" : ""), - ((sc->bce_flags & BCE_PCI_32BIT_FLAG) ? "32-bit" : "64-bit"), - sc->bus_speed_mhz); - printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver); - if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) - printf("MFW "); - if (sc->bce_flags & BCE_USING_MSI_FLAG) - printf("MSI "); - if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) - printf("2.5G "); - printf(")\n"); + bce_print_adapter_info(sc); + DBPRINT(sc, BCE_FATAL, "%s(): sc = %p\n", + __FUNCTION__, sc); goto bce_attach_exit; @@ -851,7 +1081,7 @@ bce_attach_fail: bce_attach_exit: - DBPRINT(sc, BCE_VERBOSE_RESET, "Exiting %s()\n", __FUNCTION__); + DBEXIT(BCE_VERBOSE_LOAD | BCE_VERBOSE_RESET); return(rc); } @@ -872,26 +1102,23 @@ bce_detach(device_t dev) struct ifnet *ifp; u32 msg; - DBPRINT(sc, BCE_VERBOSE_RESET, "Entering %s()\n", __FUNCTION__); + DBENTER(BCE_VERBOSE_UNLOAD | BCE_VERBOSE_RESET); ifp = sc->bce_ifp; -#ifdef DEVICE_POLLING - if (ifp->if_capenable & IFCAP_POLLING) - ether_poll_deregister(ifp); -#endif + /* Stop and reset the controller. */ + BCE_LOCK(sc); /* Stop the pulse so the bootcode can go to driver absent state. */ callout_stop(&sc->bce_pulse_callout); - /* Stop and reset the controller. */ - BCE_LOCK(sc); bce_stop(sc); if (sc->bce_flags & BCE_NO_WOL_FLAG) msg = BCE_DRV_MSG_CODE_UNLOAD_LNK_DN; else msg = BCE_DRV_MSG_CODE_UNLOAD; bce_reset(sc, msg); + BCE_UNLOCK(sc); ether_ifdetach(ifp); @@ -903,7 +1130,7 @@ bce_detach(device_t dev) /* Release all remaining resources. */ bce_release_resources(sc); - DBPRINT(sc, BCE_VERBOSE_RESET, "Exiting %s()\n", __FUNCTION__); + DBEXIT(BCE_VERBOSE_UNLOAD | BCE_VERBOSE_RESET); return(0); } @@ -923,7 +1150,7 @@ bce_shutdown(device_t dev) struct bce_softc *sc = device_get_softc(dev); u32 msg; - DBPRINT(sc, BCE_VERBOSE_SPECIAL, "Entering %s()\n", __FUNCTION__); + DBENTER(BCE_VERBOSE); BCE_LOCK(sc); bce_stop(sc); @@ -933,13 +1160,60 @@ bce_shutdown(device_t dev) msg = BCE_DRV_MSG_CODE_UNLOAD; bce_reset(sc, msg); BCE_UNLOCK(sc); - - DBPRINT(sc, BCE_VERBOSE_SPECIAL, "Exiting %s()\n", __FUNCTION__); + + DBEXIT(BCE_VERBOSE); return (0); } +#ifdef BCE_DEBUG +/****************************************************************************/ +/* Register read. */ +/* */ +/* Returns: */ +/* The value of the register. */ +/****************************************************************************/ +static u32 +bce_reg_rd(struct bce_softc *sc, u32 offset) +{ + u32 val = bus_space_read_4(sc->bce_btag, sc->bce_bhandle, offset); + DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n", + __FUNCTION__, offset, val); + return val; +} + + +/****************************************************************************/ +/* Register write (16 bit). */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_reg_wr16(struct bce_softc *sc, u32 offset, u16 val) +{ + DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%04X\n", + __FUNCTION__, offset, val); + bus_space_write_2(sc->bce_btag, sc->bce_bhandle, offset, val); +} + + +/****************************************************************************/ +/* Register write. */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_reg_wr(struct bce_softc *sc, u32 offset, u32 val) +{ + DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n", + __FUNCTION__, offset, val); + bus_space_write_4(sc->bce_btag, sc->bce_bhandle, offset, val); +} +#endif + /****************************************************************************/ /* Indirect register read. */ /* */ @@ -961,7 +1235,7 @@ bce_reg_rd_ind(struct bce_softc *sc, u32 { u32 val; val = pci_read_config(dev, BCE_PCICFG_REG_WINDOW, 4); - DBPRINT(sc, BCE_EXCESSIVE, "%s(); offset = 0x%08X, val = 0x%08X\n", + DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n", __FUNCTION__, offset, val); return val; } @@ -987,7 +1261,7 @@ bce_reg_wr_ind(struct bce_softc *sc, u32 device_t dev; dev = sc->bce_dev; - DBPRINT(sc, BCE_EXCESSIVE, "%s(); offset = 0x%08X, val = 0x%08X\n", + DBPRINT(sc, BCE_INSANE_REG, "%s(); offset = 0x%08X, val = 0x%08X\n", __FUNCTION__, offset, val); pci_write_config(dev, BCE_PCICFG_REG_WINDOW_ADDRESS, offset, 4); @@ -995,6 +1269,58 @@ bce_reg_wr_ind(struct bce_softc *sc, u32 } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Tue Nov 11 17:12:27 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 029FF1065692; Tue, 11 Nov 2008 17:12:27 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F28CC8FC20; Tue, 11 Nov 2008 17:12:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mABHCQVM007374; Tue, 11 Nov 2008 17:12:26 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mABHCQZK007373; Tue, 11 Nov 2008 17:12:26 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200811111712.mABHCQZK007373@svn.freebsd.org> From: Robert Watson Date: Tue, 11 Nov 2008 17:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184853 - in stable/7/sys: . modules/cxgb netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2008 17:12:27 -0000 Author: rwatson Date: Tue Nov 11 17:12:26 2008 New Revision: 184853 URL: http://svn.freebsd.org/changeset/base/184853 Log: Merge r184304 from head to stable/7: In both dropwithreset paths in tcp_input.c, drop the tcbinfo lock sooner to decomplicate locking and eliminate the need for a rather chatty comment about why we have to handle the global lock in a special way for the benefit of ipfw and pf cred rules. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/modules/cxgb/ (props changed) stable/7/sys/netinet/tcp_input.c Modified: stable/7/sys/netinet/tcp_input.c ============================================================================== --- stable/7/sys/netinet/tcp_input.c Tue Nov 11 17:10:24 2008 (r184852) +++ stable/7/sys/netinet/tcp_input.c Tue Nov 11 17:12:26 2008 (r184853) @@ -849,19 +849,12 @@ findpcb: dropwithreset: INP_INFO_WLOCK_ASSERT(&tcbinfo); + INP_INFO_WUNLOCK(&tcbinfo); - /* - * If inp is non-NULL, we call tcp_dropwithreset() holding both inpcb - * and global locks. However, if NULL, we must hold neither as - * firewalls may acquire the global lock in order to look for a - * matching inpcb. - */ if (inp != NULL) { tcp_dropwithreset(m, th, tp, tlen, rstreason); INP_WUNLOCK(inp); - } - INP_INFO_WUNLOCK(&tcbinfo); - if (inp == NULL) + } else tcp_dropwithreset(m, th, NULL, tlen, rstreason); m = NULL; /* mbuf chain got consumed. */ goto drop; @@ -2414,19 +2407,12 @@ dropafterack: dropwithreset: KASSERT(headlocked, ("%s: dropwithreset: head not locked", __func__)); + INP_INFO_WUNLOCK(&tcbinfo); - /* - * If tp is non-NULL, we call tcp_dropwithreset() holding both inpcb - * and global locks. However, if NULL, we must hold neither as - * firewalls may acquire the global lock in order to look for a - * matching inpcb. - */ if (tp != NULL) { tcp_dropwithreset(m, th, tp, tlen, rstreason); INP_WUNLOCK(tp->t_inpcb); - } - INP_INFO_WUNLOCK(&tcbinfo); - if (tp == NULL) + } else tcp_dropwithreset(m, th, NULL, tlen, rstreason); return; From owner-svn-src-stable-7@FreeBSD.ORG Wed Nov 12 07:07:27 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E489A106568A; Wed, 12 Nov 2008 07:07:27 +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 D746A8FC25; Wed, 12 Nov 2008 07:07:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAC77Rq3022683; Wed, 12 Nov 2008 07:07:27 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAC77RUI022682; Wed, 12 Nov 2008 07:07:27 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811120707.mAC77RUI022682@svn.freebsd.org> From: Xin LI Date: Wed, 12 Nov 2008 07:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184862 - in stable/7/sys: . dev/et X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Nov 2008 07:07:28 -0000 Author: delphij Date: Wed Nov 12 07:07:27 2008 New Revision: 184862 URL: http://svn.freebsd.org/changeset/base/184862 Log: MFC revision 1801453: Don't leak DMA map if not freed. Submitted by: kevlo Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/et/if_et.c Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Wed Nov 12 04:45:09 2008 (r184861) +++ stable/7/sys/dev/et/if_et.c Wed Nov 12 07:07:27 2008 (r184862) @@ -1326,6 +1326,8 @@ et_free_rx_ring(struct et_softc *sc) struct et_rxbuf *rb = &rbd->rbd_buf[i]; if (rb->rb_mbuf != NULL) { + bus_dmamap_unload(sc->sc_mbuf_dtag, + rb->rb_dmap); m_freem(rb->rb_mbuf); rb->rb_mbuf = NULL; } From owner-svn-src-stable-7@FreeBSD.ORG Wed Nov 12 09:35:58 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 306C71065670; Wed, 12 Nov 2008 09:35:58 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 21A728FC1F; Wed, 12 Nov 2008 09:35:58 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAC9ZvRI025504; Wed, 12 Nov 2008 09:35:57 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAC9Zvoc025503; Wed, 12 Nov 2008 09:35:57 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <200811120935.mAC9Zvoc025503@svn.freebsd.org> From: Joerg Wunsch Date: Wed, 12 Nov 2008 09:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184867 - stable/7/bin/chio X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Nov 2008 09:35:58 -0000 Author: joerg Date: Wed Nov 12 09:35:57 2008 New Revision: 184867 URL: http://svn.freebsd.org/changeset/base/184867 Log: (MFC r184484) When running a "chio return" operation using a physical source unit rather than a voltag name, do not set the CESR_VOLTAGS flags in the CHIOGSTATUS command requesting the current status. As voltags are an optional feature that must be handled as "reserved" by media changers not implementing the feature, always setting CESR_VOLTAGS resulted in the command being aborted with an `Invalid field in CDB', and consequently the "chio return" failed, for media changers that do not support voltags. Approved by: re (kib) Modified: stable/7/bin/chio/ (props changed) stable/7/bin/chio/chio.c Modified: stable/7/bin/chio/chio.c ============================================================================== --- stable/7/bin/chio/chio.c Wed Nov 12 09:04:44 2008 (r184866) +++ stable/7/bin/chio/chio.c Wed Nov 12 09:35:57 2008 (r184867) @@ -69,7 +69,7 @@ static const char *bits_to_string(ces_st static void find_element(char *, uint16_t *, uint16_t *); static struct changer_element_status *get_element_status - (unsigned int, unsigned int); + (unsigned int, unsigned int, int); static int do_move(const char *, int, char **); static int do_exchange(const char *, int, char **); @@ -969,7 +969,8 @@ do_return(const char *cname, int argc, c ++argv; --argc; /* Get the status */ - ces = get_element_status((unsigned int)type, (unsigned int)element); + ces = get_element_status((unsigned int)type, (unsigned int)element, + CHET_VT == type); if (NULL == ces) errx(1, "%s: null element status pointer", cname); @@ -1004,7 +1005,7 @@ usage: * should free() it when done. */ static struct changer_element_status * -get_element_status(unsigned int type, unsigned int element) +get_element_status(unsigned int type, unsigned int element, int use_voltags) { struct changer_element_status_request cesr; struct changer_element_status *ces; @@ -1020,7 +1021,8 @@ get_element_status(unsigned int type, un cesr.cesr_element_type = (uint16_t)type; cesr.cesr_element_base = (uint16_t)element; cesr.cesr_element_count = 1; /* Only this one element */ - cesr.cesr_flags |= CESR_VOLTAGS; /* Grab voltags as well */ + if (use_voltags) + cesr.cesr_flags |= CESR_VOLTAGS; /* Grab voltags as well */ cesr.cesr_element_status = ces; if (ioctl(changer_fd, CHIOGSTATUS, (char *)&cesr) == -1) { From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 02:35:29 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBC501065673; Thu, 13 Nov 2008 02:35:29 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C598B8FC08; Thu, 13 Nov 2008 02:35:29 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAD2ZTF4046904; Thu, 13 Nov 2008 02:35:29 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAD2ZTUi046903; Thu, 13 Nov 2008 02:35:29 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200811130235.mAD2ZTUi046903@svn.freebsd.org> From: Peter Wemm Date: Thu, 13 Nov 2008 02:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184907 - in stable/7/sys: . compat/freebsd32 modules/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 02:35:30 -0000 Author: peter Date: Thu Nov 13 02:35:29 2008 New Revision: 184907 URL: http://svn.freebsd.org/changeset/base/184907 Log: MFC 184828,184829: Fix si_addr in 32 bit signals. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/compat/freebsd32/freebsd32_misc.c stable/7/sys/modules/cxgb/ (props changed) Modified: stable/7/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/7/sys/compat/freebsd32/freebsd32_misc.c Thu Nov 13 02:22:29 2008 (r184906) +++ stable/7/sys/compat/freebsd32/freebsd32_misc.c Thu Nov 13 02:35:29 2008 (r184907) @@ -2389,7 +2389,7 @@ siginfo_to_siginfo32(siginfo_t *src, str dst->si_pid = src->si_pid; dst->si_uid = src->si_uid; dst->si_status = src->si_status; - dst->si_addr = dst->si_addr; + dst->si_addr = (uintptr_t)src->si_addr; dst->si_value.sigval_int = src->si_value.sival_int; dst->si_timerid = src->si_timerid; dst->si_overrun = src->si_overrun; From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 11:00:15 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D32E106567E; Thu, 13 Nov 2008 11:00:15 +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 3CBE58FC14; Thu, 13 Nov 2008 11:00:15 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADB0F45057298; Thu, 13 Nov 2008 11:00:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADB0FHg057297; Thu, 13 Nov 2008 11:00:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811131100.mADB0FHg057297@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 13 Nov 2008 11:00:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184918 - in stable/7/sys: . dev/mii modules/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 11:00:15 -0000 Author: yongari Date: Thu Nov 13 11:00:15 2008 New Revision: 184918 URL: http://svn.freebsd.org/changeset/base/184918 Log: MFC r184253: Use auto-negotiation for manual media type selection. This fixes establishment of 10/100Mbps link on Atheros AR8121(L1E). Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/mii/atphy.c stable/7/sys/modules/cxgb/ (props changed) Modified: stable/7/sys/dev/mii/atphy.c ============================================================================== --- stable/7/sys/dev/mii/atphy.c Thu Nov 13 10:40:13 2008 (r184917) +++ stable/7/sys/dev/mii/atphy.c Thu Nov 13 11:00:15 2008 (r184918) @@ -217,7 +217,8 @@ atphy_service(struct mii_softc *sc, stru /* * Reset the PHY so all changes take effect. */ - PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_RESET); + PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_RESET | BMCR_AUTOEN | + BMCR_STARTNEG); done: break; From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 15:00:41 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 896E71065752; Thu, 13 Nov 2008 15:00:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B0538FC0A; Thu, 13 Nov 2008 15:00:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADF0eSH061784; Thu, 13 Nov 2008 15:00:40 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADF0esO061783; Thu, 13 Nov 2008 15:00:40 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811131500.mADF0esO061783@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 13 Nov 2008 15:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184924 - in stable/7/sys: . compat/linux modules/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 15:00:41 -0000 Author: kib Date: Thu Nov 13 15:00:40 2008 New Revision: 184924 URL: http://svn.freebsd.org/changeset/base/184924 Log: MFC r184501: The code in linux_proc_exit() contains a race when multiple linux based processes exits at the same time. The linux_emuldata structure is freed but p->p_emuldata is left as a dangling pointer to the just freed memory. The check for W_EXIT in the loop scanning the child processes isn't safe since the state of the child process can change right afterwards. Lock the process and check the W_EXIT before delivering signal. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linux/linux_emul.c stable/7/sys/modules/cxgb/ (props changed) Modified: stable/7/sys/compat/linux/linux_emul.c ============================================================================== --- stable/7/sys/compat/linux/linux_emul.c Thu Nov 13 15:00:34 2008 (r184923) +++ stable/7/sys/compat/linux/linux_emul.c Thu Nov 13 15:00:40 2008 (r184924) @@ -232,11 +232,11 @@ linux_proc_exit(void *arg __unused, stru continue; em = em_find(q, EMUL_DOLOCK); KASSERT(em != NULL, ("linux_reparent: emuldata not found: %i\n", q->p_pid)); - if (em->pdeath_signal != 0) { - PROC_LOCK(q); + PROC_LOCK(q); + if ((q->p_flag & P_WEXIT) == 0 && em->pdeath_signal != 0) { psignal(q, em->pdeath_signal); - PROC_UNLOCK(q); } + PROC_UNLOCK(q); EMUL_UNLOCK(&emul_lock); } sx_xunlock(&proctree_lock); From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 15:27:48 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AEC510656FB; Thu, 13 Nov 2008 15:27:48 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5AA348FC12; Thu, 13 Nov 2008 15:27:48 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADFRmv7062407; Thu, 13 Nov 2008 15:27:48 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADFRmMs062402; Thu, 13 Nov 2008 15:27:48 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200811131527.mADFRmMs062402@svn.freebsd.org> From: Rui Paulo Date: Thu, 13 Nov 2008 15:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184928 - in stable/7: contrib/traceroute usr.sbin/traceroute X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 15:27:48 -0000 Author: rpaulo Date: Thu Nov 13 15:27:48 2008 New Revision: 184928 URL: http://svn.freebsd.org/changeset/base/184928 Log: MFC r176428: Add AS lookup functionality. On each hop we query a whois server to find the corresponding AS for that IP (-a switch). We can also choose a different whois server with the -A switch. The default is whois.radb.net. Obtained from: NetBSD Approved by: re Added: stable/7/contrib/traceroute/as.c (contents, props changed) stable/7/contrib/traceroute/as.h (contents, props changed) Modified: stable/7/contrib/traceroute/traceroute.8 stable/7/contrib/traceroute/traceroute.c stable/7/usr.sbin/traceroute/Makefile Added: stable/7/contrib/traceroute/as.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/contrib/traceroute/as.c Thu Nov 13 15:27:48 2008 (r184928) @@ -0,0 +1,242 @@ +/* $FreeBSD$ */ +/* $NetBSD: as.c,v 1.1 2001/11/04 23:14:36 atatat Exp $ */ + +/* + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Andrew Brown. + * + * 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 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 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "as.h" + +#define DEFAULT_AS_SERVER "whois.radb.net" +#undef AS_DEBUG_FILE + +struct aslookup { + FILE *as_f; +#ifdef AS_DEBUG_FILE + FILE *as_debug; +#endif /* AS_DEBUG_FILE */ +}; + +void * +as_setup(server) + char *server; +{ + struct aslookup *asn; + struct hostent *he = NULL; + struct servent *se; + struct sockaddr_in in; + FILE *f; + int s; + + if (server == NULL) + server = DEFAULT_AS_SERVER; + + (void)memset(&in, 0, sizeof(in)); + in.sin_family = AF_INET; + in.sin_len = sizeof(in); + if ((se = getservbyname("whois", "tcp")) == NULL) { + warnx("warning: whois/tcp service not found"); + in.sin_port = ntohs(43); + } else + in.sin_port = se->s_port; + + if (inet_aton(server, &in.sin_addr) == 0 && + ((he = gethostbyname(server)) == NULL || + he->h_addr == NULL)) { + warnx("%s: %s", server, hstrerror(h_errno)); + return (NULL); + } + + if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) { + warn("socket"); + return (NULL); + } + + do { + if (he != NULL) { + memcpy(&in.sin_addr, he->h_addr, he->h_length); + he->h_addr_list++; + } + if (connect(s, (struct sockaddr *)&in, sizeof(in)) == 0) + break; + if (he == NULL || he->h_addr == NULL) { + close(s); + s = -1; + break; + } + } while (1); + + if (s == -1) { + warn("connect"); + return (NULL); + } + + f = fdopen(s, "r+"); + (void)fprintf(f, "!!\n"); + (void)fflush(f); + + asn = malloc(sizeof(struct aslookup)); + if (asn == NULL) + (void)fclose(f); + else + asn->as_f = f; + +#ifdef AS_DEBUG_FILE + asn->as_debug = fopen(AS_DEBUG_FILE, "w"); + if (asn->as_debug) { + (void)fprintf(asn->as_debug, ">> !!\n"); + (void)fflush(asn->as_debug); + } +#endif /* AS_DEBUG_FILE */ + + return (asn); +} + +int +as_lookup(_asn, addr) + void *_asn; + struct in_addr *addr; +{ + struct aslookup *asn = _asn; + char buf[1024]; + int as, rc, dlen; + + as = rc = dlen = 0; + (void)fprintf(asn->as_f, "!r%s/32,l\n", inet_ntoa(*addr)); + (void)fflush(asn->as_f); + +#ifdef AS_DEBUG_FILE + if (asn->as_debug) { + (void)fprintf(asn->as_debug, ">> !r%s/32,l\n", + inet_ntoa(*addr)); + (void)fflush(asn->as_debug); + } +#endif /* AS_DEBUG_FILE */ + + while (fgets(buf, sizeof(buf), asn->as_f) != NULL) { + buf[sizeof(buf) - 1] = '\0'; + +#ifdef AS_DEBUG_FILE + if (asn->as_debug) { + (void)fprintf(asn->as_debug, "<< %s", buf); + (void)fflush(asn->as_debug); + } +#endif /* AS_DEBUG_FILE */ + + if (rc == 0) { + rc = buf[0]; + switch (rc) { + case 'A': + /* A - followed by # bytes of answer */ + sscanf(buf, "A%d\n", &dlen); +#ifdef AS_DEBUG_FILE + if (asn->as_debug) { + (void)fprintf(asn->as_debug, + "dlen: %d\n", dlen); + (void)fflush(asn->as_debug); + } +#endif /* AS_DEBUG_FILE */ + break; + case 'C': + case 'D': + case 'E': + case 'F': + /* C - no data returned */ + /* D - key not found */ + /* E - multiple copies of key */ + /* F - some other error */ + break; + } + if (rc == 'A') + /* skip to next input line */ + continue; + } + + if (dlen == 0) + /* out of data, next char read is end code */ + rc = buf[0]; + if (rc != 'A') + /* either an error off the bat, or a done code */ + break; + + /* data received, thank you */ + dlen -= strlen(buf); + + /* origin line is the interesting bit */ + if (as == 0 && strncasecmp(buf, "origin:", 7) == 0) { + sscanf(buf + 7, " AS%d", &as); +#ifdef AS_DEBUG_FILE + if (asn->as_debug) { + (void)fprintf(asn->as_debug, "as: %d\n", as); + (void)fflush(asn->as_debug); + } +#endif /* AS_DEBUG_FILE */ + } + } + + return (as); +} + +void +as_shutdown(_asn) + void *_asn; +{ + struct aslookup *asn = _asn; + + (void)fprintf(asn->as_f, "!q\n"); + (void)fclose(asn->as_f); + +#ifdef AS_DEBUG_FILE + if (asn->as_debug) { + (void)fprintf(asn->as_debug, ">> !q\n"); + (void)fclose(asn->as_debug); + } +#endif /* AS_DEBUG_FILE */ + + free(asn); +} Added: stable/7/contrib/traceroute/as.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/contrib/traceroute/as.h Thu Nov 13 15:27:48 2008 (r184928) @@ -0,0 +1,42 @@ +/* $FreeBSD$ */ +/* $NetBSD: as.h,v 1.1 2001/11/04 23:14:36 atatat Exp $ */ + +/* + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Andrew Brown. + * + * 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 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 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 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. + */ + +void *as_setup __P((char *)); +int as_lookup __P((void *, struct in_addr *)); +void as_shutdown __P((void *)); Modified: stable/7/contrib/traceroute/traceroute.8 ============================================================================== --- stable/7/contrib/traceroute/traceroute.8 Thu Nov 13 15:15:19 2008 (r184927) +++ stable/7/contrib/traceroute/traceroute.8 Thu Nov 13 15:27:48 2008 (r184928) @@ -16,7 +16,7 @@ .\" $Id: traceroute.8,v 1.19 2000/09/21 08:44:19 leres Exp $ .\" $FreeBSD$ .\" -.TH TRACEROUTE 8 "21 September 2000" +.TH TRACEROUTE 8 "19 February 2008" .UC 6 .SH NAME traceroute \- print the route packets take to network host @@ -24,7 +24,7 @@ traceroute \- print the route packets ta .na .B traceroute [ -.B \-dDeFISnrvx +.B \-adDeFISnrvx ] [ .B \-f .I first_ttl @@ -71,6 +71,9 @@ traceroute \- print the route packets ta .B \-w .I waittime ] [ +.B \-A +.I as_server +] [ .B \-z .I pausemsecs ] @@ -98,6 +101,13 @@ name. .PP Other options are: .TP +.B \-a +Turn on AS# lookups for each hop encountered. +.TP +.B -A +Turn on AS# lookups and use the given server instead of the +default. +.TP .B \-e Firewall evasion mode. Use fixed destination ports for UDP and TCP probes. @@ -443,3 +453,7 @@ should listen for a RST from the destina router that's filtering packets), but this is not implemented yet. .PP Please send bug reports to traceroute@ee.lbl.gov. +.PP +The AS number capability reports information that may sometimes be +inaccurate due to discrepancies between the contents of the +routing database server and the current state of the Internet. Modified: stable/7/contrib/traceroute/traceroute.c ============================================================================== --- stable/7/contrib/traceroute/traceroute.c Thu Nov 13 15:15:19 2008 (r184927) +++ stable/7/contrib/traceroute/traceroute.c Thu Nov 13 15:27:48 2008 (r184928) @@ -263,6 +263,7 @@ static const char rcsid[] = #include "findsaddr.h" #include "ifaddrlist.h" +#include "as.h" #include "traceroute.h" /* Maximum number of gateways (include room for one noop) */ @@ -350,6 +351,9 @@ int options; /* socket options */ int verbose; int waittime = 5; /* time to wait for response (in seconds) */ int nflag; /* print addresses numerically */ +int as_path; /* print as numbers for each hop */ +char *as_server = NULL; +void *asn; #ifdef CANT_HACK_IPCKSUM int doipcksum = 0; /* don't calculate ip checksums by default */ #else @@ -535,9 +539,17 @@ main(int argc, char **argv) prog = argv[0]; opterr = 0; - while ((op = getopt(argc, argv, "edDFInrSvxf:g:i:M:m:P:p:q:s:t:w:z:")) != EOF) + while ((op = getopt(argc, argv, "aA:edDFInrSvxf:g:i:M:m:P:p:q:s:t:w:z:")) != EOF) switch (op) { - + case 'a': + as_path = 1; + break; + + case 'A': + as_path = 1; + as_server = optarg; + break; + case 'd': options |= SO_DEBUG; break; @@ -913,6 +925,16 @@ main(int argc, char **argv) exit (1); } + if (as_path) { + asn = as_setup(as_server); + if (asn == NULL) { + Fprintf(stderr, "%s: as_setup failed, AS# lookups" + " disabled\n", prog); + (void)fflush(stderr); + as_path = 0; + } + } + #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) if (setpolicy(sndsock, "in bypass") < 0) errx(1, "%s", ipsec_strerror()); @@ -1118,6 +1140,8 @@ main(int argc, char **argv) (unreachable > 0 && unreachable >= nprobes - 1)) break; } + if (as_path) + as_shutdown(asn); exit(0); } @@ -1458,6 +1482,9 @@ print(register u_char *buf, register int hlen = ip->ip_hl << 2; cc -= hlen; + if (as_path) + Printf(" [AS%d]", as_lookup(asn, &from->sin_addr)); + if (nflag) Printf(" %s", inet_ntoa(from->sin_addr)); else @@ -1764,8 +1791,8 @@ usage(void) Fprintf(stderr, "Version %s\n", version); Fprintf(stderr, - "Usage: %s [-dDeFInrSvx] [-f first_ttl] [-g gateway] [-i iface]\n" + "Usage: %s [-adDeFInrSvx] [-f first_ttl] [-g gateway] [-i iface]\n" "\t[-m max_ttl] [-p port] [-P proto] [-q nqueries] [-s src_addr]\n" - "\t[-t tos] [-w waittime] [-z pausemsecs] host [packetlen]\n", prog); + "\t[-t tos] [-w waittime] [-A as_server] [-z pausemsecs] host [packetlen]\n", prog); exit(1); } Modified: stable/7/usr.sbin/traceroute/Makefile ============================================================================== --- stable/7/usr.sbin/traceroute/Makefile Thu Nov 13 15:15:19 2008 (r184927) +++ stable/7/usr.sbin/traceroute/Makefile Thu Nov 13 15:27:48 2008 (r184928) @@ -5,7 +5,7 @@ TRACEROUTE_DISTDIR?= ${.CURDIR}/../../co PROG= traceroute MAN= traceroute.8 -SRCS= version.c traceroute.c ifaddrlist.c findsaddr-socket.c +SRCS= as.c version.c traceroute.c ifaddrlist.c findsaddr-socket.c BINOWN= root BINMODE=4555 CLEANFILES= version.c From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 16:02:12 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C43F3106568F; Thu, 13 Nov 2008 16:02:12 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F2AC8FC1B; Thu, 13 Nov 2008 16:02:12 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADG2CcB063105; Thu, 13 Nov 2008 16:02:12 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADG2CuA063104; Thu, 13 Nov 2008 16:02:12 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200811131602.mADG2CuA063104@svn.freebsd.org> From: Rui Paulo Date: Thu, 13 Nov 2008 16:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184929 - stable/7/contrib X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 16:02:12 -0000 Author: rpaulo Date: Thu Nov 13 16:02:12 2008 New Revision: 184929 URL: http://svn.freebsd.org/changeset/base/184929 Log: Record MFC r176428. Approved by: re (implicit) Modified: stable/7/contrib/ (props changed) From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 16:03:44 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0385D1065690; Thu, 13 Nov 2008 16:03:44 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2E868FC1A; Thu, 13 Nov 2008 16:03:43 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADG3hOP063174; Thu, 13 Nov 2008 16:03:43 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADG3h8e063173; Thu, 13 Nov 2008 16:03:43 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200811131603.mADG3h8e063173@svn.freebsd.org> From: Rui Paulo Date: Thu, 13 Nov 2008 16:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184930 - stable/7/usr.sbin X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 16:03:44 -0000 Author: rpaulo Date: Thu Nov 13 16:03:43 2008 New Revision: 184930 URL: http://svn.freebsd.org/changeset/base/184930 Log: Record MFC r176428. Approved by: re (implicit) Modified: stable/7/usr.sbin/ (props changed) From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 16:17:51 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 429421065679; Thu, 13 Nov 2008 16:17:51 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DC108FC1C; Thu, 13 Nov 2008 16:17:51 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADGHp95063545; Thu, 13 Nov 2008 16:17:51 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADGHpi1063544; Thu, 13 Nov 2008 16:17:51 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200811131617.mADGHpi1063544@svn.freebsd.org> From: Rui Paulo Date: Thu, 13 Nov 2008 16:17:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184931 - in stable/7/usr.sbin: . traceroute X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 16:17:51 -0000 Author: rpaulo Date: Thu Nov 13 16:17:50 2008 New Revision: 184931 URL: http://svn.freebsd.org/changeset/base/184931 Log: Reverse botched mergeinfo for r176428. Approved by: re (implicit) Modified: stable/7/usr.sbin/ (props changed) stable/7/usr.sbin/traceroute/ (props changed) From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 20:46:10 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14BD5106568E; Thu, 13 Nov 2008 20:46:10 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2E0C8FC17; Thu, 13 Nov 2008 20:46:09 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADKkAkc068589; Thu, 13 Nov 2008 20:46:10 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADKk7nd068519; Thu, 13 Nov 2008 20:46:07 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200811132046.mADKk7nd068519@svn.freebsd.org> From: Peter Wemm Date: Thu, 13 Nov 2008 20:46:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184939 - in stable/7/lib/libc: . amd64 amd64/gen amd64/stdlib amd64/string amd64/sys i386 i386/gen i386/stdlib i386/string i386/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 20:46:10 -0000 Author: peter Date: Thu Nov 13 20:46:07 2008 New Revision: 184939 URL: http://svn.freebsd.org/changeset/base/184939 Log: MFC: 184547,184548: add END() macros for Assembler code in libc. This causes the symbol table to include the size of the function. Approved by: re (kib) Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/amd64/SYS.h stable/7/lib/libc/amd64/gen/_setjmp.S stable/7/lib/libc/amd64/gen/fabs.S stable/7/lib/libc/amd64/gen/modf.S stable/7/lib/libc/amd64/gen/rfork_thread.S stable/7/lib/libc/amd64/gen/setjmp.S stable/7/lib/libc/amd64/gen/sigsetjmp.S stable/7/lib/libc/amd64/stdlib/div.S stable/7/lib/libc/amd64/stdlib/ldiv.S stable/7/lib/libc/amd64/stdlib/lldiv.S stable/7/lib/libc/amd64/string/bcmp.S stable/7/lib/libc/amd64/string/bcopy.S stable/7/lib/libc/amd64/string/bzero.S stable/7/lib/libc/amd64/string/memcmp.S stable/7/lib/libc/amd64/string/memset.S stable/7/lib/libc/amd64/string/strcat.S stable/7/lib/libc/amd64/string/strcmp.S stable/7/lib/libc/amd64/string/strcpy.S stable/7/lib/libc/amd64/sys/brk.S stable/7/lib/libc/amd64/sys/exect.S stable/7/lib/libc/amd64/sys/getcontext.S stable/7/lib/libc/amd64/sys/pipe.S stable/7/lib/libc/amd64/sys/ptrace.S stable/7/lib/libc/amd64/sys/reboot.S stable/7/lib/libc/amd64/sys/sbrk.S stable/7/lib/libc/amd64/sys/setlogin.S stable/7/lib/libc/amd64/sys/vfork.S stable/7/lib/libc/i386/SYS.h stable/7/lib/libc/i386/gen/_ctx_start.S stable/7/lib/libc/i386/gen/_setjmp.S stable/7/lib/libc/i386/gen/fabs.S stable/7/lib/libc/i386/gen/modf.S stable/7/lib/libc/i386/gen/rfork_thread.S stable/7/lib/libc/i386/gen/setjmp.S stable/7/lib/libc/i386/gen/sigsetjmp.S stable/7/lib/libc/i386/stdlib/abs.S stable/7/lib/libc/i386/stdlib/div.S stable/7/lib/libc/i386/stdlib/labs.S stable/7/lib/libc/i386/stdlib/ldiv.S stable/7/lib/libc/i386/string/bcmp.S stable/7/lib/libc/i386/string/bcopy.S stable/7/lib/libc/i386/string/bzero.S stable/7/lib/libc/i386/string/ffs.S stable/7/lib/libc/i386/string/index.S stable/7/lib/libc/i386/string/memchr.S stable/7/lib/libc/i386/string/memcmp.S stable/7/lib/libc/i386/string/memset.S stable/7/lib/libc/i386/string/rindex.S stable/7/lib/libc/i386/string/strcat.S stable/7/lib/libc/i386/string/strchr.S stable/7/lib/libc/i386/string/strcmp.S stable/7/lib/libc/i386/string/strcpy.S stable/7/lib/libc/i386/string/strlen.S stable/7/lib/libc/i386/string/strncmp.S stable/7/lib/libc/i386/string/strrchr.S stable/7/lib/libc/i386/string/swab.S stable/7/lib/libc/i386/string/wcschr.S stable/7/lib/libc/i386/string/wcscmp.S stable/7/lib/libc/i386/string/wcslen.S stable/7/lib/libc/i386/string/wmemchr.S stable/7/lib/libc/i386/sys/Ovfork.S stable/7/lib/libc/i386/sys/brk.S stable/7/lib/libc/i386/sys/exect.S stable/7/lib/libc/i386/sys/getcontext.S stable/7/lib/libc/i386/sys/pipe.S stable/7/lib/libc/i386/sys/ptrace.S stable/7/lib/libc/i386/sys/reboot.S stable/7/lib/libc/i386/sys/sbrk.S stable/7/lib/libc/i386/sys/setlogin.S stable/7/lib/libc/i386/sys/syscall.S Modified: stable/7/lib/libc/amd64/SYS.h ============================================================================== --- stable/7/lib/libc/amd64/SYS.h Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/SYS.h Thu Nov 13 20:46:07 2008 (r184939) @@ -43,13 +43,15 @@ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ - 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx + 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx; \ + END(__CONCAT(__sys_,x)) #define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret ; \ - 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx + 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx; \ + END(__CONCAT(__sys_,x)) #else #define RSYSCALL(x) ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(x); \ @@ -57,13 +59,15 @@ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ - 2: jmp HIDENAME(cerror) + 2: jmp HIDENAME(cerror); \ + END(__CONCAT(__sys_,x)) #define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ - 2: jmp HIDENAME(cerror) + 2: jmp HIDENAME(cerror); \ + END(__CONCAT(__sys_,x)) #endif #define KERNCALL movq %rcx, %r10; syscall Modified: stable/7/lib/libc/amd64/gen/_setjmp.S ============================================================================== --- stable/7/lib/libc/amd64/gen/_setjmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/gen/_setjmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -60,6 +60,7 @@ ENTRY(_setjmp) fnstcw 64(%rax) /* 8; fpu cw */ xorq %rax,%rax ret +END(_setjmp) .weak CNAME(_longjmp) .set CNAME(_longjmp),CNAME(___longjmp) @@ -81,3 +82,4 @@ ENTRY(___longjmp) incq %rax 1: movq %rcx,0(%rsp) ret +END(___longjmp) Modified: stable/7/lib/libc/amd64/gen/fabs.S ============================================================================== --- stable/7/lib/libc/amd64/gen/fabs.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/gen/fabs.S Thu Nov 13 20:46:07 2008 (r184939) @@ -37,6 +37,7 @@ ENTRY(fabs) movsd signbit(%rip), %xmm0 andnpd %xmm1, %xmm0 ret +END(fabs) .data signbit: Modified: stable/7/lib/libc/amd64/gen/modf.S ============================================================================== --- stable/7/lib/libc/amd64/gen/modf.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/gen/modf.S Thu Nov 13 20:46:07 2008 (r184939) @@ -86,3 +86,4 @@ ENTRY(modf) movsd -8(%rsp),%xmm0 ret +END(modf) Modified: stable/7/lib/libc/amd64/gen/rfork_thread.S ============================================================================== --- stable/7/lib/libc/amd64/gen/rfork_thread.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/gen/rfork_thread.S Thu Nov 13 20:46:07 2008 (r184939) @@ -99,3 +99,4 @@ ENTRY(rfork_thread) #else jmp HIDENAME(cerror) #endif +END(rfork_thread) Modified: stable/7/lib/libc/amd64/gen/setjmp.S ============================================================================== --- stable/7/lib/libc/amd64/gen/setjmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/gen/setjmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -69,6 +69,7 @@ ENTRY(setjmp) fnstcw 64(%rcx) /* 8; fpu cw */ xorq %rax,%rax ret +END(setjmp) .weak CNAME(longjmp) .set CNAME(longjmp),CNAME(__longjmp) @@ -99,3 +100,4 @@ ENTRY(__longjmp) incq %rax 1: movq %rcx,0(%rsp) ret +END(__longjmp) Modified: stable/7/lib/libc/amd64/gen/sigsetjmp.S ============================================================================== --- stable/7/lib/libc/amd64/gen/sigsetjmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/gen/sigsetjmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -77,6 +77,7 @@ ENTRY(sigsetjmp) fnstcw 64(%rcx) /* 8; fpu cw */ xorq %rax,%rax ret +END(sigsetjmp) .weak CNAME(siglongjmp) .set CNAME(siglongjmp),CNAME(__siglongjmp) @@ -109,3 +110,4 @@ ENTRY(__siglongjmp) incq %rax 1: movq %rcx,0(%rsp) ret +END(__siglongjmp) Modified: stable/7/lib/libc/amd64/stdlib/div.S ============================================================================== --- stable/7/lib/libc/amd64/stdlib/div.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/stdlib/div.S Thu Nov 13 20:46:07 2008 (r184939) @@ -15,3 +15,4 @@ ENTRY(div) salq $32,%rdx orq %rdx,%rax ret +END(div) Modified: stable/7/lib/libc/amd64/stdlib/ldiv.S ============================================================================== --- stable/7/lib/libc/amd64/stdlib/ldiv.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/stdlib/ldiv.S Thu Nov 13 20:46:07 2008 (r184939) @@ -13,3 +13,4 @@ ENTRY(ldiv) cqto idivq %rsi ret +END(ldiv) Modified: stable/7/lib/libc/amd64/stdlib/lldiv.S ============================================================================== --- stable/7/lib/libc/amd64/stdlib/lldiv.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/stdlib/lldiv.S Thu Nov 13 20:46:07 2008 (r184939) @@ -13,3 +13,4 @@ ENTRY(lldiv) cqto idivq %rsi ret +END(lldiv) Modified: stable/7/lib/libc/amd64/string/bcmp.S ============================================================================== --- stable/7/lib/libc/amd64/string/bcmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/string/bcmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -22,3 +22,4 @@ L1: setne %al movsbl %al,%eax ret +END(bcmp) Modified: stable/7/lib/libc/amd64/string/bcopy.S ============================================================================== --- stable/7/lib/libc/amd64/string/bcopy.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/string/bcopy.S Thu Nov 13 20:46:07 2008 (r184939) @@ -86,3 +86,12 @@ ENTRY(bcopy) movsq cld ret +#ifdef MEMCOPY +END(memcpy) +#else +#ifdef MEMMOVE +END(memmove) +#else +END(bcopy) +#endif +#endif Modified: stable/7/lib/libc/amd64/string/bzero.S ============================================================================== --- stable/7/lib/libc/amd64/string/bzero.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/string/bzero.S Thu Nov 13 20:46:07 2008 (r184939) @@ -41,3 +41,4 @@ L1: movq %rsi,%rcx /* zero remainder by stosb ret +END(bzero) Modified: stable/7/lib/libc/amd64/string/memcmp.S ============================================================================== --- stable/7/lib/libc/amd64/string/memcmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/string/memcmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -39,3 +39,4 @@ L6: xorl %eax,%eax /* Perform unsigned movb -1(%rsi),%dl subl %edx,%eax ret +END(memcmp) Modified: stable/7/lib/libc/amd64/string/memset.S ============================================================================== --- stable/7/lib/libc/amd64/string/memset.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/string/memset.S Thu Nov 13 20:46:07 2008 (r184939) @@ -58,3 +58,4 @@ L1: rep movq %r11,%rax ret +END(memset) Modified: stable/7/lib/libc/amd64/string/strcat.S ============================================================================== --- stable/7/lib/libc/amd64/string/strcat.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/string/strcat.S Thu Nov 13 20:46:07 2008 (r184939) @@ -163,3 +163,4 @@ ENTRY(strcat) .Ldone: ret +END(strcat) Modified: stable/7/lib/libc/amd64/string/strcmp.S ============================================================================== --- stable/7/lib/libc/amd64/string/strcmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/string/strcmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -71,3 +71,4 @@ ENTRY(strcmp) movzbq %dl,%rdx subq %rdx,%rax ret +END(strcmp) Modified: stable/7/lib/libc/amd64/string/strcpy.S ============================================================================== --- stable/7/lib/libc/amd64/string/strcpy.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/string/strcpy.S Thu Nov 13 20:46:07 2008 (r184939) @@ -109,3 +109,4 @@ ENTRY(strcpy) .Ldone: ret +END(strcpy) Modified: stable/7/lib/libc/amd64/sys/brk.S ============================================================================== --- stable/7/lib/libc/amd64/sys/brk.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/sys/brk.S Thu Nov 13 20:46:07 2008 (r184939) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); ENTRY(_brk) pushq %rdi jmp ok +END(_brk) ENTRY(brk) pushq %rdi @@ -81,3 +82,4 @@ err: #else jmp HIDENAME(cerror) #endif +END(brk) Modified: stable/7/lib/libc/amd64/sys/exect.S ============================================================================== --- stable/7/lib/libc/amd64/sys/exect.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/sys/exect.S Thu Nov 13 20:46:07 2008 (r184939) @@ -53,3 +53,4 @@ ENTRY(exect) #else jmp HIDENAME(cerror) #endif +END(exect) Modified: stable/7/lib/libc/amd64/sys/getcontext.S ============================================================================== --- stable/7/lib/libc/amd64/sys/getcontext.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/sys/getcontext.S Thu Nov 13 20:46:07 2008 (r184939) @@ -52,3 +52,4 @@ ENTRY(__sys_getcontext) #else jmp HIDENAME(cerror) #endif +END(__sys_getcontext) Modified: stable/7/lib/libc/amd64/sys/pipe.S ============================================================================== --- stable/7/lib/libc/amd64/sys/pipe.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/sys/pipe.S Thu Nov 13 20:46:07 2008 (r184939) @@ -57,3 +57,4 @@ ENTRY(__sys_pipe) #else jmp HIDENAME(cerror) #endif +END(__sys_pipe) Modified: stable/7/lib/libc/amd64/sys/ptrace.S ============================================================================== --- stable/7/lib/libc/amd64/sys/ptrace.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/sys/ptrace.S Thu Nov 13 20:46:07 2008 (r184939) @@ -57,3 +57,4 @@ err: #else jmp HIDENAME(cerror) #endif +END(ptrace) Modified: stable/7/lib/libc/amd64/sys/reboot.S ============================================================================== --- stable/7/lib/libc/amd64/sys/reboot.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/sys/reboot.S Thu Nov 13 20:46:07 2008 (r184939) @@ -54,3 +54,4 @@ ENTRY(__sys_reboot) #else jmp HIDENAME(cerror) #endif +END(__sys_reboot) Modified: stable/7/lib/libc/amd64/sys/sbrk.S ============================================================================== --- stable/7/lib/libc/amd64/sys/sbrk.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/sys/sbrk.S Thu Nov 13 20:46:07 2008 (r184939) @@ -85,3 +85,4 @@ err: #else jmp HIDENAME(cerror) #endif +END(sbrk) Modified: stable/7/lib/libc/amd64/sys/setlogin.S ============================================================================== --- stable/7/lib/libc/amd64/sys/setlogin.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/sys/setlogin.S Thu Nov 13 20:46:07 2008 (r184939) @@ -62,3 +62,4 @@ ENTRY(__sys_setlogin) #else jmp HIDENAME(cerror) #endif +END(__sys_setlogin) Modified: stable/7/lib/libc/amd64/sys/vfork.S ============================================================================== --- stable/7/lib/libc/amd64/sys/vfork.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/amd64/sys/vfork.S Thu Nov 13 20:46:07 2008 (r184939) @@ -56,3 +56,4 @@ ENTRY(__sys_vfork) #else jmp HIDENAME(cerror) #endif +END(__sys_vfork) Modified: stable/7/lib/libc/i386/SYS.h ============================================================================== --- stable/7/lib/libc/i386/SYS.h Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/SYS.h Thu Nov 13 20:46:07 2008 (r184939) @@ -44,13 +44,14 @@ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b -#define RSYSCALL(x) SYSCALL(x); ret +#define RSYSCALL(x) SYSCALL(x); ret; END(__CONCAT(__sys_,x)) #define PSEUDO(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \ ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ - mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b; ret + mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b; ret; \ + END(__CONCAT(__sys_,x)) /* gas messes up offset -- although we don't currently need it, do for BCS */ #define LCALL(x,y) .byte 0x9a ; .long y; .word x Modified: stable/7/lib/libc/i386/gen/_ctx_start.S ============================================================================== --- stable/7/lib/libc/i386/gen/_ctx_start.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/gen/_ctx_start.S Thu Nov 13 20:46:07 2008 (r184939) @@ -49,3 +49,4 @@ ENTRY(_ctx_start) call PIC_PLT(_ctx_done) /* should never return */ call PIC_PLT(abort) /* fubar */ ret +END(_ctx_start) Modified: stable/7/lib/libc/i386/gen/_setjmp.S ============================================================================== --- stable/7/lib/libc/i386/gen/_setjmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/gen/_setjmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -58,6 +58,7 @@ ENTRY(_setjmp) fnstcw 24(%eax) xorl %eax,%eax ret +END(_setjmp) .weak CNAME(_longjmp) .set CNAME(_longjmp),CNAME(___longjmp) @@ -77,3 +78,4 @@ ENTRY(___longjmp) incl %eax 1: movl %ecx,0(%esp) ret +END(___longjmp) Modified: stable/7/lib/libc/i386/gen/fabs.S ============================================================================== --- stable/7/lib/libc/i386/gen/fabs.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/gen/fabs.S Thu Nov 13 20:46:07 2008 (r184939) @@ -40,3 +40,4 @@ ENTRY(fabs) fldl 4(%esp) fabs ret +END(fabs) Modified: stable/7/lib/libc/i386/gen/modf.S ============================================================================== --- stable/7/lib/libc/i386/gen/modf.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/gen/modf.S Thu Nov 13 20:46:07 2008 (r184939) @@ -82,3 +82,4 @@ ENTRY(modf) fdivp /* return +/- 0 for +/- Inf, NaN for NaN */ leave ret +END(modf) Modified: stable/7/lib/libc/i386/gen/rfork_thread.S ============================================================================== --- stable/7/lib/libc/i386/gen/rfork_thread.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/gen/rfork_thread.S Thu Nov 13 20:46:07 2008 (r184939) @@ -115,3 +115,4 @@ ENTRY(rfork_thread) popl %ebp PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(rfork_thread) Modified: stable/7/lib/libc/i386/gen/setjmp.S ============================================================================== --- stable/7/lib/libc/i386/gen/setjmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/gen/setjmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -69,6 +69,7 @@ ENTRY(setjmp) fnstcw 24(%ecx) xorl %eax,%eax ret +END(setjmp) .weak CNAME(longjmp) .set CNAME(longjmp),CNAME(__longjmp) @@ -97,3 +98,4 @@ ENTRY(__longjmp) incl %eax 1: movl %ecx,0(%esp) ret +END(__longjmp) Modified: stable/7/lib/libc/i386/gen/sigsetjmp.S ============================================================================== --- stable/7/lib/libc/i386/gen/sigsetjmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/gen/sigsetjmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -78,10 +78,11 @@ ENTRY(sigsetjmp) fnstcw 24(%ecx) xorl %eax,%eax ret +END(sigsetjmp) .weak CNAME(siglongjmp); - .set CNAME(siglongjmp),CNAME(__siglongjmp); -ENTRY(__siglongjmp); + .set CNAME(siglongjmp),CNAME(__siglongjmp) +ENTRY(__siglongjmp) movl 4(%esp),%edx cmpl $0,44(%edx) jz 2f @@ -108,3 +109,4 @@ ENTRY(__siglongjmp); incl %eax 1: movl %ecx,0(%esp) ret +END(__siglongjmp) Modified: stable/7/lib/libc/i386/stdlib/abs.S ============================================================================== --- stable/7/lib/libc/i386/stdlib/abs.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/stdlib/abs.S Thu Nov 13 20:46:07 2008 (r184939) @@ -44,3 +44,4 @@ ENTRY(abs) jns 1f negl %eax 1: ret +END(abs) Modified: stable/7/lib/libc/i386/stdlib/div.S ============================================================================== --- stable/7/lib/libc/i386/stdlib/div.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/stdlib/div.S Thu Nov 13 20:46:07 2008 (r184939) @@ -36,3 +36,4 @@ ENTRY(div) movl %eax,4(%esp) movl %edx,8(%esp) ret +END(div) Modified: stable/7/lib/libc/i386/stdlib/labs.S ============================================================================== --- stable/7/lib/libc/i386/stdlib/labs.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/stdlib/labs.S Thu Nov 13 20:46:07 2008 (r184939) @@ -44,3 +44,4 @@ ENTRY(labs) jns 1f negl %eax 1: ret +END(labs) Modified: stable/7/lib/libc/i386/stdlib/ldiv.S ============================================================================== --- stable/7/lib/libc/i386/stdlib/ldiv.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/stdlib/ldiv.S Thu Nov 13 20:46:07 2008 (r184939) @@ -39,3 +39,4 @@ ENTRY(ldiv) movl %eax,4(%esp) movl %edx,8(%esp) ret +END(ldiv) Modified: stable/7/lib/libc/i386/string/bcmp.S ============================================================================== --- stable/7/lib/libc/i386/string/bcmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/bcmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -61,3 +61,4 @@ L1: popl %esi popl %edi ret +END(bcmp) Modified: stable/7/lib/libc/i386/string/bcopy.S ============================================================================== --- stable/7/lib/libc/i386/string/bcopy.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/bcopy.S Thu Nov 13 20:46:07 2008 (r184939) @@ -97,3 +97,12 @@ ENTRY(bcopy) popl %esi cld ret +#ifdef MEMCOPY +END(memcpy) +#else +#ifdef MEMMOVE +END(memmove) +#else +END(bcopy) +#endif +#endif Modified: stable/7/lib/libc/i386/string/bzero.S ============================================================================== --- stable/7/lib/libc/i386/string/bzero.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/bzero.S Thu Nov 13 20:46:07 2008 (r184939) @@ -79,3 +79,4 @@ L1: rep popl %ebx popl %edi ret +END(bzero) Modified: stable/7/lib/libc/i386/string/ffs.S ============================================================================== --- stable/7/lib/libc/i386/string/ffs.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/ffs.S Thu Nov 13 20:46:07 2008 (r184939) @@ -51,3 +51,4 @@ ENTRY(ffs) .align 2 L1: xorl %eax,%eax /* clear result */ ret +END(ffs) Modified: stable/7/lib/libc/i386/string/index.S ============================================================================== --- stable/7/lib/libc/i386/string/index.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/index.S Thu Nov 13 20:46:07 2008 (r184939) @@ -61,3 +61,4 @@ L1: L2: popl %ebx ret +END(index) Modified: stable/7/lib/libc/i386/string/memchr.S ============================================================================== --- stable/7/lib/libc/i386/string/memchr.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/memchr.S Thu Nov 13 20:46:07 2008 (r184939) @@ -56,3 +56,4 @@ ENTRY(memchr) L1: xorl %eax,%eax popl %edi ret +END(memchr) Modified: stable/7/lib/libc/i386/string/memcmp.S ============================================================================== --- stable/7/lib/libc/i386/string/memcmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/memcmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -73,3 +73,4 @@ L6: movzbl -1(%edi),%eax /* Perform un popl %esi popl %edi ret +END(memcmp) Modified: stable/7/lib/libc/i386/string/memset.S ============================================================================== --- stable/7/lib/libc/i386/string/memset.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/memset.S Thu Nov 13 20:46:07 2008 (r184939) @@ -87,3 +87,4 @@ L1: rep popl %ebx popl %edi ret +END(memset) Modified: stable/7/lib/libc/i386/string/rindex.S ============================================================================== --- stable/7/lib/libc/i386/string/rindex.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/rindex.S Thu Nov 13 20:46:07 2008 (r184939) @@ -62,3 +62,4 @@ L2: jne L1 popl %ebx ret +END(rindex) Modified: stable/7/lib/libc/i386/string/strcat.S ============================================================================== --- stable/7/lib/libc/i386/string/strcat.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/strcat.S Thu Nov 13 20:46:07 2008 (r184939) @@ -98,3 +98,4 @@ L1: movb (%edx),%al /* unroll loop, but L2: popl %eax /* pop destination address */ popl %edi /* restore edi */ ret +END(strcat) Modified: stable/7/lib/libc/i386/string/strchr.S ============================================================================== --- stable/7/lib/libc/i386/string/strchr.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/strchr.S Thu Nov 13 20:46:07 2008 (r184939) @@ -61,3 +61,4 @@ L1: L2: popl %ebx ret +END(strchr) Modified: stable/7/lib/libc/i386/string/strcmp.S ============================================================================== --- stable/7/lib/libc/i386/string/strcmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/strcmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -117,3 +117,4 @@ L3: movzbl (%eax),%eax movzbl (%edx),%edx subl %edx,%eax ret +END(strcmp) Modified: stable/7/lib/libc/i386/string/strcpy.S ============================================================================== --- stable/7/lib/libc/i386/string/strcpy.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/strcpy.S Thu Nov 13 20:46:07 2008 (r184939) @@ -87,3 +87,4 @@ L1: movb (%edx),%al /* unroll loop, but jne L1 L2: popl %eax /* pop dst address */ ret +END(strcpy) Modified: stable/7/lib/libc/i386/string/strlen.S ============================================================================== --- stable/7/lib/libc/i386/string/strlen.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/strlen.S Thu Nov 13 20:46:07 2008 (r184939) @@ -51,3 +51,4 @@ ENTRY(strlen) leal -1(%ecx),%eax /* and subtracting one */ popl %edi ret +END(strlen) Modified: stable/7/lib/libc/i386/string/strncmp.S ============================================================================== --- stable/7/lib/libc/i386/string/strncmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/strncmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -164,3 +164,4 @@ L3: movzbl (%eax),%eax /* unsigned comp L4: xorl %eax,%eax popl %ebx ret +END(strncmp) Modified: stable/7/lib/libc/i386/string/strrchr.S ============================================================================== --- stable/7/lib/libc/i386/string/strrchr.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/strrchr.S Thu Nov 13 20:46:07 2008 (r184939) @@ -62,3 +62,4 @@ L2: jne L1 popl %ebx ret +END(strrchr) Modified: stable/7/lib/libc/i386/string/swab.S ============================================================================== --- stable/7/lib/libc/i386/string/swab.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/swab.S Thu Nov 13 20:46:07 2008 (r184939) @@ -97,3 +97,4 @@ L3: lodsw L4: popl %edi popl %esi ret +END(swab) Modified: stable/7/lib/libc/i386/string/wcschr.S ============================================================================== --- stable/7/lib/libc/i386/string/wcschr.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/wcschr.S Thu Nov 13 20:46:07 2008 (r184939) @@ -74,3 +74,4 @@ found0: popl %ebx no: popl %ebx xorl %eax,%eax ret +END(wcschr) Modified: stable/7/lib/libc/i386/string/wcscmp.S ============================================================================== --- stable/7/lib/libc/i386/string/wcscmp.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/wcscmp.S Thu Nov 13 20:46:07 2008 (r184939) @@ -77,3 +77,4 @@ no0: subl (%esi),%eax popl %esi popl %edi ret +END(wcscmp) Modified: stable/7/lib/libc/i386/string/wcslen.S ============================================================================== --- stable/7/lib/libc/i386/string/wcslen.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/wcslen.S Thu Nov 13 20:46:07 2008 (r184939) @@ -66,3 +66,4 @@ found2: incl %eax found1: incl %eax found0: popl %ebx ret +END(wcslen) Modified: stable/7/lib/libc/i386/string/wmemchr.S ============================================================================== --- stable/7/lib/libc/i386/string/wmemchr.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/string/wmemchr.S Thu Nov 13 20:46:07 2008 (r184939) @@ -103,3 +103,4 @@ no: xorl %eax,%eax popl %ebx popl %edi ret +END(wmemchr) Modified: stable/7/lib/libc/i386/sys/Ovfork.S ============================================================================== --- stable/7/lib/libc/i386/sys/Ovfork.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/Ovfork.S Thu Nov 13 20:46:07 2008 (r184939) @@ -52,3 +52,4 @@ ENTRY(__sys_vfork) pushl %ecx PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(__sys_vfork) Modified: stable/7/lib/libc/i386/sys/brk.S ============================================================================== --- stable/7/lib/libc/i386/sys/brk.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/brk.S Thu Nov 13 20:46:07 2008 (r184939) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); .globl HIDENAME(minbrk) ENTRY(_brk) jmp ok +END(_brk) ENTRY(brk) #ifdef PIC @@ -84,3 +85,4 @@ ok: err: jmp HIDENAME(cerror) #endif +END(brk) Modified: stable/7/lib/libc/i386/sys/exect.S ============================================================================== --- stable/7/lib/libc/i386/sys/exect.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/exect.S Thu Nov 13 20:46:07 2008 (r184939) @@ -49,3 +49,4 @@ ENTRY(exect) KERNCALL PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) /* exect(file, argv, env); */ +END(exect) Modified: stable/7/lib/libc/i386/sys/getcontext.S ============================================================================== --- stable/7/lib/libc/i386/sys/getcontext.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/getcontext.S Thu Nov 13 20:46:07 2008 (r184939) @@ -48,3 +48,4 @@ ENTRY(__sys_getcontext) 1: PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(__sys_getcontext) Modified: stable/7/lib/libc/i386/sys/pipe.S ============================================================================== --- stable/7/lib/libc/i386/sys/pipe.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/pipe.S Thu Nov 13 20:46:07 2008 (r184939) @@ -44,3 +44,4 @@ SYSCALL(pipe) movl %edx,4(%ecx) movl $0,%eax ret +END(pipe) Modified: stable/7/lib/libc/i386/sys/ptrace.S ============================================================================== --- stable/7/lib/libc/i386/sys/ptrace.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/ptrace.S Thu Nov 13 20:46:07 2008 (r184939) @@ -55,3 +55,4 @@ ENTRY(ptrace) err: PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(ptrace) Modified: stable/7/lib/libc/i386/sys/reboot.S ============================================================================== --- stable/7/lib/libc/i386/sys/reboot.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/reboot.S Thu Nov 13 20:46:07 2008 (r184939) @@ -40,3 +40,4 @@ __FBSDID("$FreeBSD$"); SYSCALL(reboot) iret +END(reboot) Modified: stable/7/lib/libc/i386/sys/sbrk.S ============================================================================== --- stable/7/lib/libc/i386/sys/sbrk.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/sbrk.S Thu Nov 13 20:46:07 2008 (r184939) @@ -88,3 +88,4 @@ back: err: jmp HIDENAME(cerror) #endif /* PIC */ +END(sbrk) Modified: stable/7/lib/libc/i386/sys/setlogin.S ============================================================================== --- stable/7/lib/libc/i386/sys/setlogin.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/setlogin.S Thu Nov 13 20:46:07 2008 (r184939) @@ -52,3 +52,4 @@ SYSCALL(setlogin) movl $0,CNAME(_logname_valid) #endif ret /* setlogin(name) */ +END(setlogin) Modified: stable/7/lib/libc/i386/sys/syscall.S ============================================================================== --- stable/7/lib/libc/i386/sys/syscall.S Thu Nov 13 20:40:38 2008 (r184938) +++ stable/7/lib/libc/i386/sys/syscall.S Thu Nov 13 20:46:07 2008 (r184939) @@ -50,3 +50,4 @@ ENTRY(syscall) 1: PIC_PROLOGUE jmp PIC_PLT(HIDENAME(cerror)) +END(syscall) From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 21:11:34 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E318B106564A; Thu, 13 Nov 2008 21:11:34 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4A748FC18; Thu, 13 Nov 2008 21:11:34 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADLBY2Y069095; Thu, 13 Nov 2008 21:11:34 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADLBYqu069094; Thu, 13 Nov 2008 21:11:34 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200811132111.mADLBYqu069094@svn.freebsd.org> From: Rui Paulo Date: Thu, 13 Nov 2008 21:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184940 - in stable/7/contrib: . traceroute X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 21:11:35 -0000 Author: rpaulo Date: Thu Nov 13 21:11:34 2008 New Revision: 184940 URL: http://svn.freebsd.org/changeset/base/184940 Log: Reverse botched mergeinfo for r176428. Approved by: re (implicit) Modified: stable/7/contrib/ (props changed) stable/7/contrib/traceroute/ (props changed) From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 13 22:34:33 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B42D1065672; Thu, 13 Nov 2008 22:34: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 50F618FC17; Thu, 13 Nov 2008 22:34:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mADMYXSm071581; Thu, 13 Nov 2008 22:34:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mADMYXL9071580; Thu, 13 Nov 2008 22:34:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811132234.mADMYXL9071580@svn.freebsd.org> From: John Baldwin Date: Thu, 13 Nov 2008 22:34:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184944 - in stable/7/sys: . kern modules/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 22:34:33 -0000 Author: jhb Date: Thu Nov 13 22:34:33 2008 New Revision: 184944 URL: http://svn.freebsd.org/changeset/base/184944 Log: MFC: Adjust the license statement to more closely match a standard 3-clause BSD license. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/kern/subr_smp.c stable/7/sys/modules/cxgb/ (props changed) Modified: stable/7/sys/kern/subr_smp.c ============================================================================== --- stable/7/sys/kern/subr_smp.c Thu Nov 13 21:49:07 2008 (r184943) +++ stable/7/sys/kern/subr_smp.c Thu Nov 13 22:34:33 2008 (r184944) @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2001 - * John Baldwin . All rights reserved. + * Copyright (c) 2001, John Baldwin . + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,21 +10,21 @@ * 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 author nor the names of any co-contributors + * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY JOHN BALDWIN AND CONTRIBUTORS ``AS IS'' AND + * 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 JOHN BALDWIN OR THE VOICES IN HIS HEAD - * 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. + * 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. */ /* From owner-svn-src-stable-7@FreeBSD.ORG Fri Nov 14 11:00:36 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69E7F1065670; Fri, 14 Nov 2008 11:00:36 +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 59AA78FC12; Fri, 14 Nov 2008 11:00:36 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAEB0aWJ089926; Fri, 14 Nov 2008 11:00:36 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAEB0Zh8089899; Fri, 14 Nov 2008 11:00:35 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200811141100.mAEB0Zh8089899@svn.freebsd.org> From: Doug Barton Date: Fri, 14 Nov 2008 11:00:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184967 - in stable/7: contrib/bind9 contrib/bind9/bin/dig contrib/bind9/bin/named contrib/bind9/bin/rndc contrib/bind9/doc/arm contrib/bind9/lib/bind contrib/bind9/lib/bind9 contrib/bi... X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Nov 2008 11:00:36 -0000 Author: dougb Date: Fri Nov 14 11:00:34 2008 New Revision: 184967 URL: http://svn.freebsd.org/changeset/base/184967 Log: MFC the BIND 9.4.2-P2 update Approved by: re (kib) Modified: stable/7/contrib/bind9/ (props changed) stable/7/contrib/bind9/CHANGES stable/7/contrib/bind9/COPYRIGHT stable/7/contrib/bind9/bin/dig/dighost.c stable/7/contrib/bind9/bin/named/client.c stable/7/contrib/bind9/bin/named/config.c stable/7/contrib/bind9/bin/named/controlconf.c stable/7/contrib/bind9/bin/named/interfacemgr.c stable/7/contrib/bind9/bin/named/lwresd.c stable/7/contrib/bind9/bin/named/named.conf.docbook stable/7/contrib/bind9/bin/named/server.c stable/7/contrib/bind9/bin/rndc/rndc.c stable/7/contrib/bind9/configure.in stable/7/contrib/bind9/doc/arm/Bv9ARM-book.xml stable/7/contrib/bind9/lib/bind/configure.in stable/7/contrib/bind9/lib/bind9/check.c stable/7/contrib/bind9/lib/dns/api stable/7/contrib/bind9/lib/dns/dispatch.c stable/7/contrib/bind9/lib/dns/include/dns/dispatch.h stable/7/contrib/bind9/lib/dns/request.c stable/7/contrib/bind9/lib/dns/resolver.c stable/7/contrib/bind9/lib/dns/xfrin.c stable/7/contrib/bind9/lib/isc/api stable/7/contrib/bind9/lib/isc/include/isc/resource.h stable/7/contrib/bind9/lib/isc/include/isc/socket.h stable/7/contrib/bind9/lib/isc/include/isc/timer.h stable/7/contrib/bind9/lib/isc/timer.c stable/7/contrib/bind9/lib/isc/unix/app.c stable/7/contrib/bind9/lib/isc/unix/resource.c stable/7/contrib/bind9/lib/isc/unix/socket.c stable/7/contrib/bind9/lib/isc/unix/socket_p.h stable/7/contrib/bind9/lib/isccfg/api stable/7/contrib/bind9/lib/isccfg/namedconf.c stable/7/contrib/bind9/version stable/7/lib/bind/ (props changed) stable/7/lib/bind/config.h Modified: stable/7/contrib/bind9/CHANGES ============================================================================== --- stable/7/contrib/bind9/CHANGES Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/CHANGES Fri Nov 14 11:00:34 2008 (r184967) @@ -1,3 +1,47 @@ + --- 9.4.2-P2 released --- + +2406. [bug] Some operating systems have FD_SETSIZE set to a + low value by default, which can cause resource + exhaustion when many simultaneous connections are + open. Linux in particular makes it difficult to + increase this value. To use more sockets with + select(), set ISC_SOCKET_FDSETSIZE. Example: + STD_CDEFINES="-DISC_SOCKET_FDSETSIZE=4096" ./configure + (This should not be necessary in most cases, and + never for an authoritative-only server.) [RT #18328] + +2404. [port] hpux: files unlimited support. + +2403. [bug] TSIG context leak. [RT #18341] + +2402. [port] Support Solaris 2.11 and over. [RT #18362] + +2401. [bug] Expect to get E[MN]FILE errno internal_accept() + (from accept() or fcntl() system calls). [RT #18358] + +2399. [bug] Abort timeout queries to reduce the number of open + UDP sockets. [RT #18367] + +2398. [bug] Improve file descriptor management. New, + temporary, named.conf option reserved-sockets, + default 512. [RT #18344] + +2396. [bug] Don't set SO_REUSEADDR for randomized ports. + [RT #18336] + +2395. [port] Avoid warning and no effect from "files unlimited" + on Linux when running as root. [RT #18335] + +2394. [bug] Default configuration options set the limit for + open files to 'unlimited' as described in the + documentation. [RT #18331] + +2392. [bug] remove 'grep -q' from acl test script, some platforms + don't support it. [RT #18253] + +2322. [port] MacOS: work around the limitation of setrlimit() + for RLIMIT_NOFILE. [RT #17526] + --- 9.4.2-P1 released --- 2375. [security] Fully randomize UDP query ports to improve @@ -33,7 +77,7 @@ [RT #17113] 2249. [bug] Only set Authentic Data bit if client requested - DNSSEC, per RFC 3655 [RT #17175] + DNSSEC, per RFC 3655 [RT #17175] 2248. [cleanup] Fix several errors reported by Coverity. [RT #17160] Modified: stable/7/contrib/bind9/COPYRIGHT ============================================================================== --- stable/7/contrib/bind9/COPYRIGHT Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/COPYRIGHT Fri Nov 14 11:00:34 2008 (r184967) @@ -1,4 +1,4 @@ -Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") +Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") Copyright (C) 1996-2003 Internet Software Consortium. Permission to use, copy, modify, and/or distribute this software for any @@ -13,7 +13,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -$Id: COPYRIGHT,v 1.9.18.4 2007/08/28 07:19:54 tbox Exp $ +$Id: COPYRIGHT,v 1.9.18.4.10.1 2008/07/23 07:28:54 tbox Exp $ Portions Copyright (C) 1996-2001 Nominum, Inc. Modified: stable/7/contrib/bind9/bin/dig/dighost.c ============================================================================== --- stable/7/contrib/bind9/bin/dig/dighost.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/bin/dig/dighost.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.259.18.43 2007/08/28 07:19:55 tbox Exp $ */ +/* $Id: dighost.c,v 1.259.18.43.10.3 2008/07/23 23:16:43 marka Exp $ */ /*! \file * \note @@ -2217,14 +2217,15 @@ send_tcp_connect(dig_query_t *query) { sockcount++; debug("sockcount=%d", sockcount); if (specified_source) - result = isc_socket_bind(query->sock, &bind_address); + result = isc_socket_bind(query->sock, &bind_address, + ISC_SOCKET_REUSEADDRESS); else { if ((isc_sockaddr_pf(&query->sockaddr) == AF_INET) && have_ipv4) isc_sockaddr_any(&bind_any); else isc_sockaddr_any6(&bind_any); - result = isc_socket_bind(query->sock, &bind_any); + result = isc_socket_bind(query->sock, &bind_any, 0); } check_result(result, "isc_socket_bind"); bringup_timer(query, TCP_TIMEOUT); @@ -2271,11 +2272,12 @@ send_udp(dig_query_t *query) { sockcount++; debug("sockcount=%d", sockcount); if (specified_source) { - result = isc_socket_bind(query->sock, &bind_address); + result = isc_socket_bind(query->sock, &bind_address, + ISC_SOCKET_REUSEADDRESS); } else { isc_sockaddr_anyofpf(&bind_any, isc_sockaddr_pf(&query->sockaddr)); - result = isc_socket_bind(query->sock, &bind_any); + result = isc_socket_bind(query->sock, &bind_any, 0); } check_result(result, "isc_socket_bind"); Modified: stable/7/contrib/bind9/bin/named/client.c ============================================================================== --- stable/7/contrib/bind9/bin/named/client.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/bin/named/client.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: client.c,v 1.219.18.28.10.1 2008/05/22 21:28:04 each Exp $ */ +/* $Id: client.c,v 1.219.18.28.10.2 2008/07/23 07:28:54 tbox Exp $ */ #include Modified: stable/7/contrib/bind9/bin/named/config.c ============================================================================== --- stable/7/contrib/bind9/bin/named/config.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/bin/named/config.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2001-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.c,v 1.47.18.32 2007/09/13 05:04:01 each Exp $ */ +/* $Id: config.c,v 1.47.18.32.10.3 2008/07/23 23:48:17 tbox Exp $ */ /*! \file */ @@ -52,7 +52,7 @@ options {\n\ #ifndef WIN32 " coresize default;\n\ datasize default;\n\ - files default;\n\ + files unlimited;\n\ stacksize default;\n" #endif " deallocate-on-exit true;\n\ @@ -99,6 +99,7 @@ options {\n\ use-ixfr true;\n\ edns-udp-size 4096;\n\ max-udp-size 4096;\n\ + reserved-sockets 512;\n\ \n\ /* view */\n\ allow-notify {none;};\n\ Modified: stable/7/contrib/bind9/bin/named/controlconf.c ============================================================================== --- stable/7/contrib/bind9/bin/named/controlconf.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/bin/named/controlconf.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2001-2003 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: controlconf.c,v 1.40.18.10 2006/12/07 04:53:02 marka Exp $ */ +/* $Id: controlconf.c,v 1.40.18.10.40.3 2008/07/23 23:16:43 marka Exp $ */ /*! \file */ @@ -1151,8 +1151,8 @@ add_listener(ns_controls_t *cp, controll type, &listener->sock); if (result == ISC_R_SUCCESS) - result = isc_socket_bind(listener->sock, - &listener->address); + result = isc_socket_bind(listener->sock, &listener->address, + ISC_SOCKET_REUSEADDRESS); if (result == ISC_R_SUCCESS && type == isc_sockettype_unix) { listener->perm = cfg_obj_asuint32(cfg_tuple_get(control, Modified: stable/7/contrib/bind9/bin/named/interfacemgr.c ============================================================================== --- stable/7/contrib/bind9/bin/named/interfacemgr.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/bin/named/interfacemgr.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: interfacemgr.c,v 1.76.18.8 2006/07/20 01:10:30 marka Exp $ */ +/* $Id: interfacemgr.c,v 1.76.18.8.44.3 2008/07/23 23:16:43 marka Exp $ */ /*! \file */ @@ -307,7 +307,8 @@ ns_interface_accepttcp(ns_interface_t *i #ifndef ISC_ALLOW_MAPPED isc_socket_ipv6only(ifp->tcpsocket, ISC_TRUE); #endif - result = isc_socket_bind(ifp->tcpsocket, &ifp->addr); + result = isc_socket_bind(ifp->tcpsocket, &ifp->addr, + ISC_SOCKET_REUSEADDRESS); if (result != ISC_R_SUCCESS) { isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR, "binding TCP socket: %s", Modified: stable/7/contrib/bind9/bin/named/lwresd.c ============================================================================== --- stable/7/contrib/bind9/bin/named/lwresd.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/bin/named/lwresd.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lwresd.c,v 1.46.18.7 2006/03/02 00:37:21 marka Exp $ */ +/* $Id: lwresd.c,v 1.46.18.7.52.3 2008/07/23 23:16:43 marka Exp $ */ /*! \file * \brief @@ -576,7 +576,8 @@ listener_bind(ns_lwreslistener_t *listen return (result); } - result = isc_socket_bind(sock, &listener->address); + result = isc_socket_bind(sock, &listener->address, + ISC_SOCKET_REUSEADDRESS); if (result != ISC_R_SUCCESS) { char socktext[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_format(&listener->address, socktext, Modified: stable/7/contrib/bind9/bin/named/named.conf.docbook ============================================================================== --- stable/7/contrib/bind9/bin/named/named.conf.docbook Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/bin/named/named.conf.docbook Fri Nov 14 11:00:34 2008 (r184967) @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" []> - + Aug 13, 2004 @@ -40,6 +40,7 @@ 2005 2006 2007 + 2008 Internet Systems Consortium, Inc. ("ISC") @@ -201,6 +202,7 @@ options { port integer; querylog boolean; recursing-file quoted_string; + reserved-sockets integer; random-device quoted_string; recursive-clients integer; serial-query-rate integer; Modified: stable/7/contrib/bind9/bin/named/server.c ============================================================================== --- stable/7/contrib/bind9/bin/named/server.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/bin/named/server.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.419.18.57.10.1 2008/05/22 21:28:04 each Exp $ */ +/* $Id: server.c,v 1.419.18.57.10.3 2008/07/23 12:04:32 marka Exp $ */ /*! \file */ @@ -2696,27 +2696,29 @@ static isc_result_t load_configuration(const char *filename, ns_server_t *server, isc_boolean_t first_time) { - isc_result_t result; - isc_interval_t interval; - cfg_parser_t *parser = NULL; + cfg_aclconfctx_t aclconfctx; cfg_obj_t *config; - const cfg_obj_t *options; - const cfg_obj_t *views; + cfg_parser_t *parser = NULL; + const cfg_listelt_t *element; + const cfg_obj_t *builtin_views; + const cfg_obj_t *maps[3]; const cfg_obj_t *obj; + const cfg_obj_t *options; const cfg_obj_t *v4ports, *v6ports; - const cfg_obj_t *maps[3]; - const cfg_obj_t *builtin_views; - const cfg_listelt_t *element; + const cfg_obj_t *views; dns_view_t *view = NULL; dns_view_t *view_next; - dns_viewlist_t viewlist; dns_viewlist_t tmpviewlist; - cfg_aclconfctx_t aclconfctx; - isc_uint32_t interface_interval; - isc_uint32_t heartbeat_interval; - isc_uint32_t udpsize; + dns_viewlist_t viewlist; in_port_t listen_port; int i; + isc_interval_t interval; + isc_resourcevalue_t files; + isc_result_t result; + isc_uint32_t heartbeat_interval; + isc_uint32_t interface_interval; + isc_uint32_t reserved; + isc_uint32_t udpsize; cfg_aclconfctx_init(&aclconfctx); ISC_LIST_INIT(viewlist); @@ -2797,6 +2799,43 @@ load_configuration(const char *filename, set_limits(maps); /* + * Sanity check on "files" limit. + */ + result = isc_resource_curlimit(isc_resource_openfiles, &files); + if (result == ISC_R_SUCCESS && files < FD_SETSIZE) { + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, + NS_LOGMODULE_SERVER, ISC_LOG_WARNING, + "the 'files' limit (%" ISC_PRINT_QUADFORMAT "u) " + "is less than FD_SETSIZE (%d), increase " + "'files' in named.conf or recompile with a " + "smaller FD_SETSIZE.", files, FD_SETSIZE); + if (files > FD_SETSIZE) + files = FD_SETSIZE; + } else + files = FD_SETSIZE; + + /* + * Set the number of socket reserved for TCP, stdio etc. + */ + obj = NULL; + result = ns_config_get(maps, "reserved-sockets", &obj); + INSIST(result == ISC_R_SUCCESS); + reserved = cfg_obj_asuint32(obj); + if (files < 128U) /* Prevent underflow. */ + reserved = 0; + else if (reserved > files - 128U) /* Mimimum UDP space. */ + reserved = files - 128; + if (reserved < 128U) /* Mimimum TCP/stdio space. */ + reserved = 128; + if (reserved + 128U > files) { + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, + NS_LOGMODULE_SERVER, ISC_LOG_WARNING, + "less than 128 UDP sockets available after " + "applying 'reserved-sockets' and 'files'"); + } + isc__socketmgr_setreserved(ns_g_socketmgr, reserved); + + /* * Configure various server options. */ configure_server_quota(maps, "transfers-out", &server->xfroutquota); Modified: stable/7/contrib/bind9/bin/rndc/rndc.c ============================================================================== --- stable/7/contrib/bind9/bin/rndc/rndc.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/bin/rndc/rndc.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rndc.c,v 1.96.18.17 2006/08/04 03:03:41 marka Exp $ */ +/* $Id: rndc.c,v 1.96.18.17.42.3 2008/07/23 23:16:43 marka Exp $ */ /*! \file */ @@ -400,10 +400,10 @@ rndc_startconnect(isc_sockaddr_t *addr, DO("create socket", isc_socket_create(socketmgr, pf, type, &sock)); switch (isc_sockaddr_pf(addr)) { case AF_INET: - DO("bind socket", isc_socket_bind(sock, &local4)); + DO("bind socket", isc_socket_bind(sock, &local4, 0)); break; case AF_INET6: - DO("bind socket", isc_socket_bind(sock, &local6)); + DO("bind socket", isc_socket_bind(sock, &local6, 0)); break; default: break; Modified: stable/7/contrib/bind9/configure.in ============================================================================== --- stable/7/contrib/bind9/configure.in Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/configure.in Fri Nov 14 11:00:34 2008 (r184967) @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl AC_DIVERT_POP()dnl -AC_REVISION($Revision: 1.355.18.71 $) +AC_REVISION($Revision: 1.355.18.71.8.2 $) AC_INIT(lib/dns/name.c) AC_PREREQ(2.59) @@ -1839,7 +1839,7 @@ case "$host" in [*-solaris2.[89]]) hack_shutup_pthreadonceinit=yes ;; - *-solaris2.10) + *-solaris2.1[0-9]) hack_shutup_pthreadonceinit=yes ;; esac Modified: stable/7/contrib/bind9/doc/arm/Bv9ARM-book.xml ============================================================================== --- stable/7/contrib/bind9/doc/arm/Bv9ARM-book.xml Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/doc/arm/Bv9ARM-book.xml Fri Nov 14 11:00:34 2008 (r184967) @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" []> - + BIND 9 Administrator Reference Manual @@ -28,6 +28,7 @@ 2005 2006 2007 + 2008 Internet Systems Consortium, Inc. ("ISC") @@ -4441,6 +4442,7 @@ category notify { null; }; max-transfer-idle-in number; max-transfer-idle-out number; tcp-clients number; + reserved-sockets number; recursive-clients number; serial-query-rate number; serial-queries number; @@ -6606,6 +6608,23 @@ query-source-v6 address * port *; + reserved-sockets + + + The number of file descriptors reserved for TCP, stdio, + etc. This needs to be big enough to cover the number of + interfaces named listens on, tcp-clients as well as + to provide room for outgoing TCP queries and incoming zone + transfers. The default is 512. + The minimum value is 128 and the + maximum value is 128 less than + 'files' or FD_SETSIZE (whichever is smaller). This + option may be removed in the future. + + + + + max-cache-size Modified: stable/7/contrib/bind9/lib/bind/configure.in ============================================================================== --- stable/7/contrib/bind9/lib/bind/configure.in Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/bind/configure.in Fri Nov 14 11:00:34 2008 (r184967) @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001, 2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -AC_REVISION($Revision: 1.90.18.34 $) +AC_REVISION($Revision: 1.90.18.34.10.2 $) AC_INIT(resolv/herror.c) AC_PREREQ(2.13) @@ -2590,7 +2590,7 @@ case "$host" in *-solaris2.9) hack_shutup_in6addr_init_macros=yes ;; - *-solaris2.10) + *-solaris2.1[0-9]) hack_shutup_in6addr_init_macros=yes ;; esac Modified: stable/7/contrib/bind9/lib/bind9/check.c ============================================================================== --- stable/7/contrib/bind9/lib/bind9/check.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/bind9/check.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1015,10 +1015,10 @@ check_zoneconf(const cfg_obj_t *zconfig, isc_buffer_add(&b, strlen(zname)); tresult = dns_name_fromtext(dns_fixedname_name(&fixedname), &b, dns_rootname, ISC_TRUE, NULL); - if (tresult != ISC_R_SUCCESS) { + if (result != ISC_R_SUCCESS) { cfg_obj_log(zconfig, logctx, ISC_LOG_ERROR, "zone '%s': is not a valid name", zname); - result = ISC_R_FAILURE; + tresult = ISC_R_FAILURE; } else { char namebuf[DNS_NAME_FORMATSIZE]; Modified: stable/7/contrib/bind9/lib/dns/api ============================================================================== --- stable/7/contrib/bind9/lib/dns/api Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/dns/api Fri Nov 14 11:00:34 2008 (r184967) @@ -1,3 +1,3 @@ LIBINTERFACE = 35 -LIBREVISION = 0 +LIBREVISION = 1 LIBAGE = 0 Modified: stable/7/contrib/bind9/lib/dns/dispatch.c ============================================================================== --- stable/7/contrib/bind9/lib/dns/dispatch.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/dns/dispatch.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dispatch.c,v 1.116.18.19.12.1 2008/05/22 21:28:06 each Exp $ */ +/* $Id: dispatch.c,v 1.116.18.19.12.5 2008/07/23 23:16:43 marka Exp $ */ /*! \file */ @@ -276,7 +276,26 @@ request_log(dns_dispatch_t *disp, dns_di } /* - * ARC4 random number generator obtained from OpenBSD + * ARC4 random number generator derived from OpenBSD. + * Only dispatch_arc4random() and dispatch_arc4uniformrandom() are expected + * to be called from general dispatch routines; the rest of them are subroutines + * for these two. + * + * The original copyright follows: + * Copyright (c) 1996, David Mazieres + * Copyright (c) 2008, Damien Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ static void dispatch_arc4init(arc4ctx_t *actx) { @@ -1172,7 +1191,7 @@ destroy_mgr(dns_dispatchmgr_t **mgrp) { static isc_result_t create_socket(isc_socketmgr_t *mgr, isc_sockaddr_t *local, - isc_socket_t **sockp) + unsigned int options, isc_socket_t **sockp) { isc_socket_t *sock; isc_result_t result; @@ -1186,7 +1205,7 @@ create_socket(isc_socketmgr_t *mgr, isc_ #ifndef ISC_ALLOW_MAPPED isc_socket_ipv6only(sock, ISC_TRUE); #endif - result = isc_socket_bind(sock, local); + result = isc_socket_bind(sock, local, options); if (result != ISC_R_SUCCESS) { isc_socket_detach(&sock); return (result); @@ -1917,7 +1936,7 @@ dispatch_createudp(dns_dispatchmgr_t *mg attributes &= ~DNS_DISPATCHATTR_RANDOMPORT; goto getsocket; } - result = create_socket(sockmgr, &localaddr_bound, &sock); + result = create_socket(sockmgr, &localaddr_bound, 0, &sock); if (result == ISC_R_ADDRINUSE) { if (++k == 1024) attributes &= ~DNS_DISPATCHATTR_RANDOMPORT; @@ -1925,7 +1944,8 @@ dispatch_createudp(dns_dispatchmgr_t *mg } localport = prt; } else - result = create_socket(sockmgr, localaddr, &sock); + result = create_socket(sockmgr, localaddr, + ISC_SOCKET_REUSEADDRESS, &sock); if (result != ISC_R_SUCCESS) goto deallocate_dispatch; if ((attributes & DNS_DISPATCHATTR_RANDOMPORT) == 0 && Modified: stable/7/contrib/bind9/lib/dns/include/dns/dispatch.h ============================================================================== --- stable/7/contrib/bind9/lib/dns/include/dns/dispatch.h Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/dns/include/dns/dispatch.h Fri Nov 14 11:00:34 2008 (r184967) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dispatch.h,v 1.48.18.5.12.1 2008/05/22 21:28:06 each Exp $ */ +/* $Id: dispatch.h,v 1.48.18.5.12.2 2008/07/23 07:28:56 tbox Exp $ */ #ifndef DNS_DISPATCH_H #define DNS_DISPATCH_H 1 Modified: stable/7/contrib/bind9/lib/dns/request.c ============================================================================== --- stable/7/contrib/bind9/lib/dns/request.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/dns/request.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2002 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: request.c,v 1.72.18.5 2006/08/21 00:40:53 marka Exp $ */ +/* $Id: request.c,v 1.72.18.5.42.2 2008/07/23 07:28:56 tbox Exp $ */ /*! \file */ @@ -518,11 +518,11 @@ create_tcp_dispatch(dns_requestmgr_t *re if (srcaddr == NULL) { isc_sockaddr_anyofpf(&bind_any, isc_sockaddr_pf(destaddr)); - result = isc_socket_bind(socket, &bind_any); + result = isc_socket_bind(socket, &bind_any, 0); } else { src = *srcaddr; isc_sockaddr_setport(&src, 0); - result = isc_socket_bind(socket, &src); + result = isc_socket_bind(socket, &src, 0); } if (result != ISC_R_SUCCESS) goto cleanup; Modified: stable/7/contrib/bind9/lib/dns/resolver.c ============================================================================== --- stable/7/contrib/bind9/lib/dns/resolver.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/dns/resolver.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.284.18.66.8.1 2008/05/22 21:28:06 each Exp $ */ +/* $Id: resolver.c,v 1.284.18.66.8.4 2008/07/24 05:00:48 jinmei Exp $ */ /*! \file */ @@ -1123,7 +1123,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddr goto cleanup_query; #ifndef BROKEN_TCP_BIND_BEFORE_CONNECT - result = isc_socket_bind(query->tcpsocket, &addr); + result = isc_socket_bind(query->tcpsocket, &addr, 0); if (result != ISC_R_SUCCESS) goto cleanup_socket; #endif @@ -2689,6 +2689,8 @@ fctx_destroy(fetchctx_t *fctx) { static void fctx_timeout(isc_task_t *task, isc_event_t *event) { fetchctx_t *fctx = event->ev_arg; + isc_timerevent_t *tevent = (isc_timerevent_t *)event; + resquery_t *query; REQUIRE(VALID_FCTX(fctx)); @@ -2704,8 +2706,18 @@ fctx_timeout(isc_task_t *task, isc_event fctx->timeouts++; /* * We could cancel the running queries here, or we could let - * them keep going. Right now we choose the latter... - */ + * them keep going. Since we normally use separate sockets for + * different queries, we adopt the former approach to reduce + * the number of open sockets: cancel the oldest query if it + * expired after the query had started (this is usually the + * case but is not always so, depending on the task schedule + * timing). + */ + query = ISC_LIST_HEAD(fctx->queries); + if (query != NULL && + isc_time_compare(&tevent->due, &query->start) >= 0) { + fctx_cancelquery(&query, NULL, NULL, ISC_TRUE); + } fctx->attributes &= ~FCTX_ATTR_ADDRWAIT; /* * Our timer has triggered. Reestablish the fctx lifetime Modified: stable/7/contrib/bind9/lib/dns/xfrin.c ============================================================================== --- stable/7/contrib/bind9/lib/dns/xfrin.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/dns/xfrin.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: xfrin.c,v 1.135.18.16 2007/10/31 01:59:47 marka Exp $ */ +/* $Id: xfrin.c,v 1.135.18.16.10.3 2008/07/23 23:16:43 marka Exp $ */ /*! \file */ @@ -862,7 +862,8 @@ xfrin_start(dns_xfrin_ctx_t *xfr) { isc_sockettype_tcp, &xfr->socket)); #ifndef BROKEN_TCP_BIND_BEFORE_CONNECT - CHECK(isc_socket_bind(xfr->socket, &xfr->sourceaddr)); + CHECK(isc_socket_bind(xfr->socket, &xfr->sourceaddr, + ISC_SOCKET_REUSEADDRESS)); #endif CHECK(isc_socket_connect(xfr->socket, &xfr->masteraddr, xfr->task, xfrin_connect_done, xfr)); Modified: stable/7/contrib/bind9/lib/isc/api ============================================================================== --- stable/7/contrib/bind9/lib/isc/api Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/isc/api Fri Nov 14 11:00:34 2008 (r184967) @@ -1,3 +1,3 @@ -LIBINTERFACE = 32 -LIBREVISION = 5 +LIBINTERFACE = 35 +LIBREVISION = 0 LIBAGE = 0 Modified: stable/7/contrib/bind9/lib/isc/include/isc/resource.h ============================================================================== --- stable/7/contrib/bind9/lib/isc/include/isc/resource.h Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/isc/include/isc/resource.h Fri Nov 14 11:00:34 2008 (r184967) @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resource.h,v 1.5.18.2 2005/04/29 00:17:02 marka Exp $ */ +/* $Id: resource.h,v 1.5.18.2.52.2 2008/07/23 23:48:17 tbox Exp $ */ #ifndef ISC_RESOURCE_H #define ISC_RESOURCE_H 1 @@ -81,6 +81,19 @@ isc_resource_getlimit(isc_resource_t res *\li #ISC_R_NOTIMPLEMENTED 'resource' is not a type known by the OS. */ +isc_result_t +isc_resource_curlimit(isc_resource_t resource, isc_resourcevalue_t *value); +/* + * Get the current limit on a resource. + * + * Requires: + * 'resource' is a valid member of the isc_resource_t enumeration. + * + * Returns: + * ISC_R_SUCCESS Success. + * ISC_R_NOTIMPLEMENTED 'resource' is not a type known by the OS. + */ + ISC_LANG_ENDDECLS #endif /* ISC_RESOURCE_H */ Modified: stable/7/contrib/bind9/lib/isc/include/isc/socket.h ============================================================================== --- stable/7/contrib/bind9/lib/isc/include/isc/socket.h Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/isc/include/isc/socket.h Fri Nov 14 11:00:34 2008 (r184967) @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.h,v 1.57.18.6 2006/06/07 00:29:45 marka Exp $ */ +/* $Id: socket.h,v 1.57.18.6.46.4 2008/07/23 23:16:43 marka Exp $ */ #ifndef ISC_SOCKET_H #define ISC_SOCKET_H 1 @@ -77,6 +77,12 @@ ISC_LANG_BEGINDECLS */ #define ISC_SOCKET_MAXSCATTERGATHER 8 +/*% + * In isc_socket_bind() set socket option SO_REUSEADDR prior to calling + * bind() if a non zero port is specified (AF_INET and AF_INET6). + */ +#define ISC_SOCKET_REUSEADDRESS 0x01U + /*** *** Types ***/ @@ -312,7 +318,8 @@ isc_socket_detach(isc_socket_t **socketp */ isc_result_t -isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *addressp); +isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *addressp, + unsigned int options); /*%< * Bind 'socket' to '*addressp'. * @@ -747,6 +754,12 @@ isc_socket_permunix(isc_sockaddr_t *sock * \li #ISC_R_FAILURE */ +void +isc__socketmgr_setreserved(isc_socketmgr_t *mgr, isc_uint32_t); +/*%< + * Temporary. For use by named only. + */ + ISC_LANG_ENDDECLS #endif /* ISC_SOCKET_H */ Modified: stable/7/contrib/bind9/lib/isc/include/isc/timer.h ============================================================================== --- stable/7/contrib/bind9/lib/isc/include/isc/timer.h Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/isc/include/isc/timer.h Fri Nov 14 11:00:34 2008 (r184967) @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer.h,v 1.31.18.3 2005/10/26 06:50:50 marka Exp $ */ +/* $Id: timer.h,v 1.31.18.3.52.2 2008/07/24 23:48:09 tbox Exp $ */ #ifndef ISC_TIMER_H #define ISC_TIMER_H 1 @@ -76,6 +76,7 @@ #include #include #include +#include ISC_LANG_BEGINDECLS @@ -93,6 +94,7 @@ typedef enum { typedef struct isc_timerevent { struct isc_event common; + isc_time_t due; } isc_timerevent_t; #define ISC_TIMEREVENT_FIRSTEVENT (ISC_EVENTCLASS_TIMER + 0) Modified: stable/7/contrib/bind9/lib/isc/timer.c ============================================================================== --- stable/7/contrib/bind9/lib/isc/timer.c Fri Nov 14 10:59:36 2008 (r184966) +++ stable/7/contrib/bind9/lib/isc/timer.c Fri Nov 14 11:00:34 2008 (r184967) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer.c,v 1.73.18.7 2007/10/24 23:46:26 tbox Exp $ */ +/* $Id: timer.c,v 1.73.18.7.10.3 2008/07/29 18:35:53 jinmei Exp $ */ /*! \file */ @@ -577,7 +577,7 @@ isc_timer_detach(isc_timer_t **timerp) { static void dispatch(isc_timermgr_t *manager, isc_time_t *now) { isc_boolean_t done = ISC_FALSE, post_event, need_schedule; - isc_event_t *event; + isc_timerevent_t *event; isc_eventtype_t type = 0; isc_timer_t *timer; isc_result_t result; @@ -650,16 +650,18 @@ dispatch(isc_timermgr_t *manager, isc_ti /* * XXX We could preallocate this event. */ - event = isc_event_allocate(manager->mctx, + event = (isc_timerevent_t *)isc_event_allocate(manager->mctx, timer, type, timer->action, timer->arg, sizeof(*event)); - if (event != NULL) - isc_task_send(timer->task, &event); - else + if (event != NULL) { + event->due = timer->due; + isc_task_send(timer->task, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Fri Nov 14 18:09:20 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 388C7106567E; Fri, 14 Nov 2008 18:09:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E5058FC08; Fri, 14 Nov 2008 18:09:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAEI9KDH098553; Fri, 14 Nov 2008 18:09:20 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAEI9KJ8098552; Fri, 14 Nov 2008 18:09:20 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811141809.mAEI9KJ8098552@svn.freebsd.org> From: Warner Losh Date: Fri, 14 Nov 2008 18:09:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184973 - in stable/7/sys: . dev/pccbb modules/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Nov 2008 18:09:20 -0000 Author: imp Date: Fri Nov 14 18:09:19 2008 New Revision: 184973 URL: http://svn.freebsd.org/changeset/base/184973 Log: Merge r183539 and r183558: Do match on class to avoid false positives, return BUS_GENERIC_PROBE for a generic match. Approved by: re@ Modified: stable/7/sys/ (props changed) stable/7/sys/dev/pccbb/pccbb_pci.c stable/7/sys/modules/cxgb/ (props changed) Modified: stable/7/sys/dev/pccbb/pccbb_pci.c ============================================================================== --- stable/7/sys/dev/pccbb/pccbb_pci.c Fri Nov 14 12:31:05 2008 (r184972) +++ stable/7/sys/dev/pccbb/pccbb_pci.c Fri Nov 14 18:09:19 2008 (r184973) @@ -229,6 +229,7 @@ cbb_pci_probe(device_t brdev) { const char *name; uint32_t progif; + uint32_t baseclass; uint32_t subclass; /* @@ -245,11 +246,13 @@ cbb_pci_probe(device_t brdev) * to date have progif 0 (the Yenta spec, and successors mandate * this). */ + baseclass = pci_get_class(brdev); subclass = pci_get_subclass(brdev); progif = pci_get_progif(brdev); - if (subclass == PCIS_BRIDGE_CARDBUS && progif == 0) { + if (baseclass == PCIC_BRIDGE && + subclass == PCIS_BRIDGE_CARDBUS && progif == 0) { device_set_desc(brdev, "PCI-CardBus Bridge"); - return (BUS_PROBE_DEFAULT); + return (BUS_PROBE_GENERIC); } return (ENXIO); }