From owner-svn-src-all@FreeBSD.ORG Sun May 29 00:17:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DB441065673; Sun, 29 May 2011 00:17:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8E7E8FC23; Sun, 29 May 2011 00:17:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T0HDYL006350; Sun, 29 May 2011 00:17:13 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T0HDke006347; Sun, 29 May 2011 00:17:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105290017.p4T0HDke006347@svn.freebsd.org> From: Adrian Chadd Date: Sun, 29 May 2011 00:17:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222432 - in head/sys/dev/ath: . ath_hal/ar9002 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 00:17:14 -0000 Author: adrian Date: Sun May 29 00:17:13 2011 New Revision: 222432 URL: http://svn.freebsd.org/changeset/base/222432 Log: Teach if_ath about devices which have short-GI in 20MHz channel modes. This has been disabled until now because there hasn't been any supported device which has this feature. Since the AR9287 is the first device to support it, and since now the HAL has functional AR9287+11n support, flip this on. Modified: head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c Sat May 28 22:11:22 2011 (r222431) +++ head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c Sun May 29 00:17:13 2011 (r222432) @@ -439,9 +439,14 @@ ar9287FillCapabilityInfo(struct ath_hal /* Disable this so Block-ACK works correctly */ pCap->halHasRxSelfLinkedTail = AH_FALSE; pCap->halPSPollBroken = AH_FALSE; + + /* Hardware supports (at least) single-stream STBC TX/RX */ pCap->halRxStbcSupport = 1; pCap->halTxStbcSupport = 1; + /* Hardware supports short-GI w/ 20MHz */ + pCap->halHTSGI20Support = 1; + return AH_TRUE; } Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat May 28 22:11:22 2011 (r222431) +++ head/sys/dev/ath/if_ath.c Sun May 29 00:17:13 2011 (r222432) @@ -627,13 +627,22 @@ ath_attach(u_int16_t devid, struct ath_s | IEEE80211_HTC_AMPDU /* A-MPDU tx/rx */ | IEEE80211_HTC_AMSDU /* A-MSDU tx/rx */ | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */ - /* At the present time, the hardware doesn't support short-GI in 20mhz mode */ -#if 0 - | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */ -#endif | IEEE80211_HTCAP_SMPS_OFF; /* SM power save off */ ; + /* + * Enable short-GI for HT20 only if the hardware + * advertises support. + * Notably, anything earlier than the AR9287 doesn't. + */ + if ((ath_hal_getcapability(ah, + HAL_CAP_HT20_SGI, 0, NULL) == HAL_OK) && + (wmodes & HAL_MODE_HT20)) { + device_printf(sc->sc_dev, + "[HT] enabling short-GI in 20MHz mode\n"); + ic->ic_htcaps |= IEEE80211_HTCAP_SHORTGI20; + } + if (wmodes & HAL_MODE_HT40) ic->ic_htcaps |= IEEE80211_HTCAP_CHWIDTH40 | IEEE80211_HTCAP_SHORTGI40; From owner-svn-src-all@FreeBSD.ORG Sun May 29 00:27:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57CE1106564A; Sun, 29 May 2011 00:27:43 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EE8A8FC12; Sun, 29 May 2011 00:27:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T0RhYU006689; Sun, 29 May 2011 00:27:43 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T0Rh1Y006686; Sun, 29 May 2011 00:27:43 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201105290027.p4T0Rh1Y006686@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 29 May 2011 00:27:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222433 - in head/sys/powerpc: booke include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 00:27:43 -0000 Author: marcel Date: Sun May 29 00:27:42 2011 New Revision: 222433 URL: http://svn.freebsd.org/changeset/base/222433 Log: o Add system versions for the P4040(E) and P4080(E). o In bare_probe(), change the logic that determines the maximum number of processors/cores into a switch statement and take advantage of the fact that bit 3 of the SVR value indicates whether we're running on a security enabled version. Since we don't care about that here, mask the bit. All -E versions are taken care of automatically. Modified: head/sys/powerpc/booke/platform_bare.c head/sys/powerpc/include/spr.h Modified: head/sys/powerpc/booke/platform_bare.c ============================================================================== --- head/sys/powerpc/booke/platform_bare.c Sun May 29 00:17:13 2011 (r222432) +++ head/sys/powerpc/booke/platform_bare.c Sun May 29 00:27:42 2011 (r222433) @@ -104,13 +104,22 @@ bare_probe(platform_t plat) int i, law_max, tgt; ver = SVR_VER(mfspr(SPR_SVR)); - - if (ver == SVR_MPC8572E || ver == SVR_MPC8572 || - ver == SVR_P1020E || ver == SVR_P1020 || - ver == SVR_P2020E || ver == SVR_P2020) + switch (ver & ~0x0008) { /* Mask Security Enabled bit */ + case SVR_P4080: + maxcpu = 8; + break; + case SVR_P4040: + maxcpu = 4; + break; + case SVR_MPC8572: + case SVR_P1020: + case SVR_P2020: maxcpu = 2; - else + break; + default: maxcpu = 1; + break; + } /* * Clear local access windows. Skip DRAM entries, so we don't shoot Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Sun May 29 00:17:13 2011 (r222432) +++ head/sys/powerpc/include/spr.h Sun May 29 00:27:42 2011 (r222433) @@ -662,6 +662,10 @@ #define SVR_P2010E 0x80eb #define SVR_P2020 0x80e2 #define SVR_P2020E 0x80ea +#define SVR_P4040 0x8200 +#define SVR_P4040E 0x8208 +#define SVR_P4080 0x8201 +#define SVR_P4080E 0x8209 #define SVR_VER(svr) (((svr) >> 16) & 0xffff) #define SPR_PID0 0x030 /* ..8 Process ID Register 0 */ From owner-svn-src-all@FreeBSD.ORG Sun May 29 00:40:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC747106566B; Sun, 29 May 2011 00:40:59 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D7418FC08; Sun, 29 May 2011 00:40:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T0exGT007187; Sun, 29 May 2011 00:40:59 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T0exUt007185; Sun, 29 May 2011 00:40:59 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201105290040.p4T0exUt007185@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 29 May 2011 00:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222434 - head/sys/powerpc/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 00:40:59 -0000 Author: marcel Date: Sun May 29 00:40:59 2011 New Revision: 222434 URL: http://svn.freebsd.org/changeset/base/222434 Log: The P4080 has 8 cores. Bump MAXCPU to 8 to match. Modified: head/sys/powerpc/include/param.h Modified: head/sys/powerpc/include/param.h ============================================================================== --- head/sys/powerpc/include/param.h Sun May 29 00:27:42 2011 (r222433) +++ head/sys/powerpc/include/param.h Sun May 29 00:40:59 2011 (r222434) @@ -68,7 +68,7 @@ #endif #if defined(SMP) || defined(KLD_MODULE) -#define MAXCPU 4 +#define MAXCPU 8 #else #define MAXCPU 1 #endif /* SMP || KLD_MODULE */ From owner-svn-src-all@FreeBSD.ORG Sun May 29 00:42:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB8C4106564A; Sun, 29 May 2011 00:42:34 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 809448FC12; Sun, 29 May 2011 00:42:34 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id CD00A58135; Sat, 28 May 2011 19:42:33 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id enqPxuP4WmmZ; Sat, 28 May 2011 19:42:33 -0500 (CDT) Received: from elpis.tachypleus.net (unknown [76.210.63.135]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 5C37D5811B; Sat, 28 May 2011 19:42:33 -0500 (CDT) Message-ID: <4DE19678.3050701@freebsd.org> Date: Sat, 28 May 2011 19:42:32 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD powerpc; en-US; rv:1.9.2.13) Gecko/20110202 Thunderbird/3.1.7 MIME-Version: 1.0 To: Marcel Moolenaar References: <201105290040.p4T0exUt007185@svn.freebsd.org> In-Reply-To: <201105290040.p4T0exUt007185@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222434 - head/sys/powerpc/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 00:42:34 -0000 On 05/28/11 19:40, Marcel Moolenaar wrote: > Author: marcel > Date: Sun May 29 00:40:59 2011 > New Revision: 222434 > URL: http://svn.freebsd.org/changeset/base/222434 > > Log: > The P4080 has 8 cores. Bump MAXCPU to 8 to match. Can we just bump this straight to 32, like on other archs? We're very near to supporting many-way POWER6 and POWER7 systems anyway, and a single-socket POWER7 can already have 32 CPUs. -Nathan From owner-svn-src-all@FreeBSD.ORG Sun May 29 01:04:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBE231065670; Sun, 29 May 2011 01:04:05 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id AB08E8FC08; Sun, 29 May 2011 01:04:05 +0000 (UTC) Received: from sa-nc-common-178.static.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.4/8.14.4) with ESMTP id p4T13xWv083491 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 28 May 2011 18:04:04 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Marcel Moolenaar In-Reply-To: <4DE19678.3050701@freebsd.org> Date: Sat, 28 May 2011 18:03:54 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201105290040.p4T0exUt007185@svn.freebsd.org> <4DE19678.3050701@freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222434 - head/sys/powerpc/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 01:04:06 -0000 On May 28, 2011, at 5:42 PM, Nathan Whitehorn wrote: > On 05/28/11 19:40, Marcel Moolenaar wrote: >> Author: marcel >> Date: Sun May 29 00:40:59 2011 >> New Revision: 222434 >> URL: http://svn.freebsd.org/changeset/base/222434 >>=20 >> Log: >> The P4080 has 8 cores. Bump MAXCPU to 8 to match. >=20 > Can we just bump this straight to 32, like on other archs? We're very = near to supporting many-way POWER6 and POWER7 systems anyway, and a = single-socket POWER7 can already have 32 CPUs. We could, but I'm not sure I should be concerned about the "scaling" of the various arrays in the kernel due to MAXCPU. This with an eye on small embedded devices that do 2-way SMP. I've never liked this constant anyway to be honest. It's either too big or too small. I don't think it'll ever be right :-) --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-all@FreeBSD.ORG Sun May 29 02:09:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B012C106566B; Sun, 29 May 2011 02:09:09 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A03E18FC0A; Sun, 29 May 2011 02:09:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T299Z9009968; Sun, 29 May 2011 02:09:09 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T299nS009966; Sun, 29 May 2011 02:09:09 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105290209.p4T299nS009966@svn.freebsd.org> From: Attilio Rao Date: Sun, 29 May 2011 02:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222436 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 02:09:09 -0000 Author: attilio Date: Sun May 29 02:09:09 2011 New Revision: 222436 URL: http://svn.freebsd.org/changeset/base/222436 Log: MFC r222002: Do not use memory barrier when is not necessary. Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_mod.c Sun May 29 00:59:38 2011 (r222435) +++ stable/8/sys/dev/hwpmc/hwpmc_mod.c Sun May 29 02:09:09 2011 (r222436) @@ -4083,7 +4083,7 @@ pmc_process_interrupt(int cpu, struct pm done: /* mark CPU as needing processing */ - atomic_set_rel_int(&pmc_cpumask, (1 << cpu)); + atomic_set_int(&pmc_cpumask, (1 << cpu)); return (error); } @@ -4193,7 +4193,7 @@ pmc_process_samples(int cpu) break; if (ps->ps_nsamples == PMC_SAMPLE_INUSE) { /* Need a rescan at a later time. */ - atomic_set_rel_int(&pmc_cpumask, (1 << cpu)); + atomic_set_int(&pmc_cpumask, (1 << cpu)); break; } @@ -4782,7 +4782,7 @@ pmc_cleanup(void) PMCDBG(MOD,INI,0, "%s", "cleanup"); /* switch off sampling */ - atomic_store_rel_int(&pmc_cpumask, 0); + pmc_cpumask = 0; pmc_intr = NULL; sx_xlock(&pmc_sx); From owner-svn-src-all@FreeBSD.ORG Sun May 29 02:10:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3F47106566B; Sun, 29 May 2011 02:10:57 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C46408FC0A; Sun, 29 May 2011 02:10:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T2Avoo010081; Sun, 29 May 2011 02:10:57 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T2AvFN010079; Sun, 29 May 2011 02:10:57 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105290210.p4T2AvFN010079@svn.freebsd.org> From: Attilio Rao Date: Sun, 29 May 2011 02:10:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222437 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 02:10:57 -0000 Author: attilio Date: Sun May 29 02:10:57 2011 New Revision: 222437 URL: http://svn.freebsd.org/changeset/base/222437 Log: MFC r222201: Fill the whole cpuset_t, not only the first object. Modified: stable/8/sys/kern/kern_cpuset.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_cpuset.c ============================================================================== --- stable/8/sys/kern/kern_cpuset.c Sun May 29 02:09:09 2011 (r222436) +++ stable/8/sys/kern/kern_cpuset.c Sun May 29 02:10:57 2011 (r222437) @@ -681,7 +681,7 @@ cpuset_thread0(void) * cpuset_create() due to NULL parent. */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - set->cs_mask.__bits[0] = -1; + CPU_FILL(&set->cs_mask); LIST_INIT(&set->cs_children); LIST_INSERT_HEAD(&cpuset_ids, set, cs_link); set->cs_ref = 1; From owner-svn-src-all@FreeBSD.ORG Sun May 29 02:21:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F8B6106566C; Sun, 29 May 2011 02:21:36 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1702E8FC0A; Sun, 29 May 2011 02:21:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T2LZNI010424; Sun, 29 May 2011 02:21:35 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T2LZtf010422; Sun, 29 May 2011 02:21:35 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <201105290221.p4T2LZtf010422@svn.freebsd.org> From: Qing Li Date: Sun, 29 May 2011 02:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222438 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 02:21:36 -0000 Author: qingli Date: Sun May 29 02:21:35 2011 New Revision: 222438 URL: http://svn.freebsd.org/changeset/base/222438 Log: Supply the LLE_STATIC flag bit to in_ifscurb() when scrubbing interface address so that proper clean up will take place in the routing code. This patch fixes the bootp panic on startup problem. Also, added more error handling and logging code in function in_scrubprefix(). MFC after: 5 days Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun May 29 02:10:57 2011 (r222437) +++ head/sys/netinet/in.c Sun May 29 02:21:35 2011 (r222438) @@ -548,7 +548,7 @@ in_control(struct socket *so, u_long cmd * is the same as before, then the call is * un-necessarily executed here. */ - in_ifscrub(ifp, ia, 0); + in_ifscrub(ifp, ia, LLE_STATIC); ia->ia_sockmask = ifra->ifra_mask; ia->ia_sockmask.sin_family = AF_INET; ia->ia_subnetmask = @@ -557,7 +557,7 @@ in_control(struct socket *so, u_long cmd } if ((ifp->if_flags & IFF_POINTOPOINT) && (ifra->ifra_dstaddr.sin_family == AF_INET)) { - in_ifscrub(ifp, ia, 0); + in_ifscrub(ifp, ia, LLE_STATIC); ia->ia_dstaddr = ifra->ifra_dstaddr; maskIsNew = 1; /* We lie; but the effect's the same */ } @@ -1179,14 +1179,20 @@ in_scrubprefix(struct in_ifaddr *target, && (ia->ia_ifp->if_type != IFT_CARP)) { ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(); - rtinit(&(target->ia_ifa), (int)RTM_DELETE, + error = rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target)); - target->ia_flags &= ~IFA_ROUTE; - + if (error == 0) + target->ia_flags &= ~IFA_ROUTE; + else + log(LOG_INFO, "in_scrubprefix: err=%d, old prefix delete failed\n", + error); error = rtinit(&ia->ia_ifa, (int)RTM_ADD, rtinitflags(ia) | RTF_UP); if (error == 0) ia->ia_flags |= IFA_ROUTE; + else + log(LOG_INFO, "in_scrubprefix: err=%d, new prefix add failed\n", + error); ifa_free(&ia->ia_ifa); return (error); } @@ -1210,9 +1216,12 @@ in_scrubprefix(struct in_ifaddr *target, /* * As no-one seem to have this prefix, we can remove the route. */ - rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target)); - target->ia_flags &= ~IFA_ROUTE; - return (0); + error = rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target)); + if (error == 0) + target->ia_flags &= ~IFA_ROUTE; + else + log(LOG_INFO, "in_scrubprefix: err=%d, prefix delete failed\n", error); + return (error); } #undef rtinitflags From owner-svn-src-all@FreeBSD.ORG Sun May 29 03:01:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77C621065673; Sun, 29 May 2011 03:01:59 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id A1A648FC0C; Sun, 29 May 2011 03:01:58 +0000 (UTC) Received: by wyf23 with SMTP id 23so2699499wyf.13 for ; Sat, 28 May 2011 20:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gCYenPiS1o28RGSLqSKIv123C7twMd7xy81Tv6vY1qY=; b=U5m0u5nwq13Saj/d/KYH5mqldsEZ6gQ1kdKEwtKZnZIcUS5LDiBTf1y67Yhc0Sr0aj A18mtK3fOgLApFGoSabmyNAaj0lAXDKcf5S/VpAdA5sZCU1gOGQZbLD09dfj1eixRMRe 6nAPKYhS2VkXXSGCkvVc/d5FhLwwgAA9B/VCg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=sB2w2bH22b6atJuhAsm4wSHnsbn6iYBIXgchmazg42U+bJ8QZ7/RSN7lp3AQV683If 4zX9Zya8O5EioTgDxZkQILYV45rFJWhJ5ZOJ8VoN2dhtx7p6VprJKP5DiYZirUHyWeGF L247BfP97GFfVtCdKboy95uekXegjYUd92WeQ= MIME-Version: 1.0 Received: by 10.216.59.85 with SMTP id r63mr1177724wec.35.1306638117239; Sat, 28 May 2011 20:01:57 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.93.193 with HTTP; Sat, 28 May 2011 20:01:57 -0700 (PDT) In-Reply-To: <201105282103.43370.pieter@degoeje.nl> References: <201105131848.p4DIm1j7079495@svn.freebsd.org> <201105282103.43370.pieter@degoeje.nl> Date: Sat, 28 May 2011 20:01:57 -0700 X-Google-Sender-Auth: 6UeKLgbjHrdgXGGOwyCqPuHAHZA Message-ID: From: mdf@FreeBSD.org To: Pieter de Goeje Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221853 - in head/sys: dev/md dev/null sys vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 03:01:59 -0000 On Sat, May 28, 2011 at 12:03 PM, Pieter de Goeje wrote= : > On Friday 13 May 2011 20:48:01 Matthew D Fleming wrote: >> Author: mdf >> Date: Fri May 13 18:48:00 2011 >> New Revision: 221853 >> URL: http://svn.freebsd.org/changeset/base/221853 >> >> Log: >> =A0 Usa a globally visible region of zeros for both /dev/zero and the md >> =A0 device. =A0There are likely other kernel uses of "blob of zeros" tha= n can >> =A0 be converted. >> >> =A0 Reviewed by: =A0 =A0 =A0 =A0alc >> =A0 MFC after: =A01 week >> > > This change seems to reduce /dev/zero performance by 68% as measured by t= his > command: dd if=3D/dev/zero of=3D/dev/null bs=3D64k count=3D100000. > > x dd-8-stable > + dd-9-current > +------------------------------------------------------------------------= -+ > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= | > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= | > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= | > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0x =A0x| > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0x x =A0x| > |A =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |MA_|| > +------------------------------------------------------------------------= -+ > =A0 =A0N =A0 =A0 =A0 =A0 =A0 Min =A0 =A0 =A0 =A0 =A0 Max =A0 =A0 =A0 =A0M= edian =A0 =A0 =A0 =A0 =A0 Avg =A0 =A0 =A0 =A0Stddev > x =A0 5 1.2573578e+10 1.3156063e+10 1.2827355e+10 =A01.290079e+10 2.49512= 07e+08 > + =A0 5 4.1271391e+09 4.1453925e+09 4.1295157e+09 4.1328097e+09 =A0 =A0 7= 487363.6 > Difference at 95.0% confidence > =A0 =A0 =A0 =A0-8.76798e+09 +/- 2.57431e+08 > =A0 =A0 =A0 =A0-67.9647% +/- 1.99547% > =A0 =A0 =A0 =A0(Student's t, pooled s =3D 1.76511e+08) > > This particular measurement was against 8-stable but the results are the = same > for -current just before this commit. Basically througput drops from > ~13GB/sec to 4GB/sec. > > Hardware is a Phenom II X4 945 with 8GB of 800Mhz DDR2 memory. FreeBSD/am= d64 > is installed. This processor has 6MB of L3 cache. > > To me it looks like it's not able to cache the zeroes anymore. Is this > intentional? I tried to change ZERO_REGION_SIZE back to 64K but that didn= 't > help. Hmm. I don't have access to my FreeBSD box over the weekend, but I'll run this on my box when I get back to work. Meanwhile you could try setting ZERO_REGION_SIZE to PAGE_SIZE and I think that will restore things to the original performance. Cheers, matthew From owner-svn-src-all@FreeBSD.ORG Sun May 29 07:40:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E7261065670; Sun, 29 May 2011 07:40:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 351998FC1E; Sun, 29 May 2011 07:40:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T7enjm020082; Sun, 29 May 2011 07:40:49 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T7engw020080; Sun, 29 May 2011 07:40:49 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105290740.p4T7engw020080@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 May 2011 07:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222444 - head/contrib/ntp/ntpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 07:40:49 -0000 Author: bz Date: Sun May 29 07:40:48 2011 New Revision: 222444 URL: http://svn.freebsd.org/changeset/base/222444 Log: The argument to setsockopt for IP_MULTICAST_LOOP depends on operating system and is decided upon by configure and could be an u_int or a u_char. For FreeBSD it is a u_char. For IPv6 however RFC 3493, 5.2 defines the argument to IPV6_MULTICAST_LOOP to be an unsigned integer so make sure we always use that using a second variable for the IPV6 case. This is to get rid of these error messages every 5 minutes on some systems: ntpd[1530]: setsockopt IPV6_MULTICAST_LOOP failure: Invalid argument on socket 22, addr fe80::... for multicast address ff02::101 While here also fix the copy&paste error in the log message for IPV6_MULTICAST_LOOP. Reviewed by: roberto Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 10 days Filed as: Bug 1936 on ntp.org Modified: head/contrib/ntp/ntpd/ntp_io.c Modified: head/contrib/ntp/ntpd/ntp_io.c ============================================================================== --- head/contrib/ntp/ntpd/ntp_io.c Sun May 29 05:45:56 2011 (r222443) +++ head/contrib/ntp/ntpd/ntp_io.c Sun May 29 07:40:48 2011 (r222444) @@ -1753,7 +1753,12 @@ void enable_multicast_if(struct interface *iface, struct sockaddr_storage *maddr) { #ifdef MCAST +#ifdef IP_MULTICAST_LOOP /*u_char*/ TYPEOF_IP_MULTICAST_LOOP off = 0; +#endif +#ifdef IPV6_MULTICAST_LOOP + u_int off6 = 0; /* RFC 3493, 5.2. defines type unsigned int */ +#endif switch (maddr->ss_family) { @@ -1797,9 +1802,9 @@ enable_multicast_if(struct interface *if * Don't send back to itself, but allow it to fail to set it */ if (setsockopt(iface->fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, - (char *) &off, sizeof(off)) == -1) { + (char *) &off6, sizeof(off6)) == -1) { netsyslog(LOG_ERR, - "setsockopt IP_MULTICAST_LOOP failure: %m on socket %d, addr %s for multicast address %s", + "setsockopt IPV6_MULTICAST_LOOP failure: %m on socket %d, addr %s for multicast address %s", iface->fd, stoa(&iface->sin), stoa(maddr)); } #endif From owner-svn-src-all@FreeBSD.ORG Sun May 29 07:44:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA5311065670; Sun, 29 May 2011 07:44:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA82E8FC08; Sun, 29 May 2011 07:44:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T7iO0D020241; Sun, 29 May 2011 07:44:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T7iO30020239; Sun, 29 May 2011 07:44:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105290744.p4T7iO30020239@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 May 2011 07:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222445 - vendor/ntp/dist X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 07:44:24 -0000 Author: bz Date: Sun May 29 07:44:24 2011 New Revision: 222445 URL: http://svn.freebsd.org/changeset/base/222445 Log: Mention r222444, NTP bug 1936 we locally fixed already to be considered on next update(s). Requested by: roberto Modified: vendor/ntp/dist/FREEBSD-upgrade Modified: vendor/ntp/dist/FREEBSD-upgrade ============================================================================== --- vendor/ntp/dist/FREEBSD-upgrade Sun May 29 07:40:48 2011 (r222444) +++ vendor/ntp/dist/FREEBSD-upgrade Sun May 29 07:44:24 2011 (r222445) @@ -51,3 +51,7 @@ lynx (without the GIF files of course). One patch needs to be applied after that to close two buffer overflows. See bin/92839 for details. + +A patch to fix IPV6_MULTICAST_LOOP was committed to head as r222444 and +filed as http://bugs.ntp.org/show_bug.cgi?id=1936. Check if still needed +or re-apply on update. From owner-svn-src-all@FreeBSD.ORG Sun May 29 11:10:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF6B61065673; Sun, 29 May 2011 11:10:56 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5D048FC0C; Sun, 29 May 2011 11:10:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TBAugk027412; Sun, 29 May 2011 11:10:56 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TBAuqS027410; Sun, 29 May 2011 11:10:56 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105291110.p4TBAuqS027410@svn.freebsd.org> From: Benedict Reuschling Date: Sun, 29 May 2011 11:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222447 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 11:10:56 -0000 Author: bcr (doc committer) Date: Sun May 29 11:10:56 2011 New Revision: 222447 URL: http://svn.freebsd.org/changeset/base/222447 Log: Mention that jumbo frame support is disabled on PCIe VT6130/VT6132 controllers because of TX MAC hangs when trying to send a frame that is larger than 4K (see r200759). PR: docs/156742 Submitted by: Michael Moll (kvedulv at kvedulv dot de) Reviewed by: yongari@ MFC after: 6 days Modified: head/share/man/man4/vge.4 Modified: head/share/man/man4/vge.4 ============================================================================== --- head/share/man/man4/vge.4 Sun May 29 10:49:33 2011 (r222446) +++ head/share/man/man4/vge.4 Sun May 29 11:10:56 2011 (r222447) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 23, 2010 +.Dd May 29, 2011 .Dt VGE 4 .Os .Sh NAME @@ -66,13 +66,14 @@ The MAC supports TCP/IP hardware checksums (IPv4 only), TCP large send, VLAN tag insertion and stripping, as well as VLAN filtering, a 64-entry CAM filter and a 64-entry VLAN filter, 64-bit multicast hash filter, 4 separate transmit DMA queues, flow control -and jumbo frames up to 16K in size. +and jumbo frames (not on VT6130/VT6132) up to 16K in size. The Velocity family controllers have a 16K receive FIFO and 48K transmit FIFO. .Pp The .Nm driver takes advantage of the controller's checksum offload and VLAN -tagging features, as well as the jumbo frame and CAM filter support. +tagging features, as well as the jumbo frame (except VT6130/VT6132) and CAM +filter support. The CAM filter is used for multicast address filtering to provide 64 perfect multicast address filter support. If it is necessary for the interface to join more than 64 multicast @@ -81,6 +82,8 @@ groups, the driver will switch over to u The jumbo frame support can be enabled by setting the interface MTU to any value larger than the default of 1500 bytes, up to a maximum of 9000 bytes. +Jumbo frames are disabled on the VT6130/VT6132 controllers because the TX +MAC will hang when trying to send a frame that is larger than 4K. The receive and transmit checksum offload support can be toggled on and off using the .Xr ifconfig 8 From owner-svn-src-all@FreeBSD.ORG Sun May 29 13:08:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72EF61065673; Sun, 29 May 2011 13:08:06 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 2A7768FC16; Sun, 29 May 2011 13:08:06 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 9FF2358135; Sun, 29 May 2011 08:08:05 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id oAWiawMHrgjH; Sun, 29 May 2011 08:08:05 -0500 (CDT) Received: from elpis.tachypleus.net (unknown [76.210.63.135]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 2E4975811B; Sun, 29 May 2011 08:08:04 -0500 (CDT) Message-ID: <4DE24534.4080209@freebsd.org> Date: Sun, 29 May 2011 08:08:04 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD powerpc; en-US; rv:1.9.2.13) Gecko/20110202 Thunderbird/3.1.7 MIME-Version: 1.0 To: Julian Elischer References: <201105280850.p4S8odjf076440@svn.freebsd.org> In-Reply-To: <201105280850.p4S8odjf076440@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222417 - in head/sys/boot: common forth i386/loader ia64/common pc98/loader powerpc/ofw powerpc/ps3 sparc64/loader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 13:08:06 -0000 On 05/28/11 03:50, Julian Elischer wrote: > Author: julian > Date: Sat May 28 08:50:38 2011 > New Revision: 222417 > URL: http://svn.freebsd.org/changeset/base/222417 > > Log: > New boot loader menus from Devin Teske. > Discussed on hackers and recommended for inclusion into 9.0 at the devsummit. > All support email to devin dteske at vicor dot ignoreme dot com . > > Submitted by: dteske at vicor dot ignoreme dot com > Reviewed by: me and many others > > Added: > head/sys/boot/forth/beastie.4th.8 (contents, props changed) > head/sys/boot/forth/brand.4th (contents, props changed) > head/sys/boot/forth/brand.4th.8 (contents, props changed) > head/sys/boot/forth/check-password.4th (contents, props changed) > head/sys/boot/forth/check-password.4th.8 (contents, props changed) > head/sys/boot/forth/color.4th (contents, props changed) > head/sys/boot/forth/color.4th.8 (contents, props changed) > head/sys/boot/forth/delay.4th (contents, props changed) > head/sys/boot/forth/delay.4th.8 (contents, props changed) > head/sys/boot/forth/menu-commands.4th (contents, props changed) > head/sys/boot/forth/menu.4th (contents, props changed) > head/sys/boot/forth/menu.4th.8 (contents, props changed) > head/sys/boot/forth/menu.rc (contents, props changed) > head/sys/boot/forth/shortcuts.4th (contents, props changed) > head/sys/boot/forth/version.4th (contents, props changed) > head/sys/boot/forth/version.4th.8 (contents, props changed) > Modified: > head/sys/boot/common/Makefile.inc > head/sys/boot/forth/beastie.4th > head/sys/boot/forth/loader.4th > head/sys/boot/forth/loader.conf.5 > head/sys/boot/forth/loader.rc > head/sys/boot/forth/support.4th > head/sys/boot/i386/loader/Makefile > head/sys/boot/ia64/common/Makefile > head/sys/boot/pc98/loader/Makefile > head/sys/boot/powerpc/ofw/Makefile > head/sys/boot/powerpc/ps3/Makefile > head/sys/boot/sparc64/loader/Makefile > This patch is bogus for non-x86 architectures, which don't use a boot menu, never have, and don't support full-screen mode. Please revert it for everything but i386 (and maybe pc98). -Nathan From owner-svn-src-all@FreeBSD.ORG Sun May 29 14:25:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9452106564A; Sun, 29 May 2011 14:25:42 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EE2A8FC12; Sun, 29 May 2011 14:25:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TEPghB033868; Sun, 29 May 2011 14:25:42 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TEPggZ033861; Sun, 29 May 2011 14:25:42 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201105291425.p4TEPggZ033861@svn.freebsd.org> From: Andreas Tobler Date: Sun, 29 May 2011 14:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222449 - in head/sys: conf dev/iicbus powerpc/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 14:25:42 -0000 Author: andreast Date: Sun May 29 14:25:42 2011 New Revision: 222449 URL: http://svn.freebsd.org/changeset/base/222449 Log: Add a new driver, the ad7417, to read temperatures and voltages on some PowerMac's. Approved by: nwhitehorn (mentor) Added: head/sys/dev/iicbus/ad7417.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/powerpc/conf/NOTES Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sun May 29 12:15:49 2011 (r222448) +++ head/sys/conf/files.powerpc Sun May 29 14:25:42 2011 (r222449) @@ -27,6 +27,7 @@ dev/cfi/cfi_bus_fdt.c optional cfi fdt dev/fb/fb.c optional sc dev/fdt/fdt_powerpc.c optional fdt dev/hwpmc/hwpmc_powerpc.c optional hwpmc +dev/iicbus/ad7417.c optional ad7417 powermac dev/iicbus/ds1775.c optional ds1775 powermac dev/iicbus/max6690.c optional max6690 powermac dev/kbd/kbd.c optional sc Added: head/sys/dev/iicbus/ad7417.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/ad7417.c Sun May 29 14:25:42 2011 (r222449) @@ -0,0 +1,457 @@ +/*- + * Copyright (c) 2010 Andreas Tobler + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#define FCU_ZERO_C_TO_K 2732 + +/* CPU A/B sensors, temp and adc: AD7417. */ + +#define AD7417_TEMP 0x00 +#define AD7417_CONFIG 0x01 +#define AD7417_ADC 0x04 +#define AD7417_CONFIG2 0x05 +#define AD7417_CONFMASK 0xe0 + +uint8_t adc741x_config; + +struct ad7417_sensor { + int id; + char location[32]; + enum { + ADC7417_TEMP_SENSOR, + ADC7417_ADC_SENSOR + } type; +}; + +/* Regular bus attachment functions */ +static int ad7417_probe(device_t); +static int ad7417_attach(device_t); + +/* Utility functions */ +static int ad7417_sensor_sysctl(SYSCTL_HANDLER_ARGS); +static int ad7417_write(device_t dev, uint32_t addr, uint8_t reg, + uint8_t *buf, int len); +static int ad7417_read_1(device_t dev, uint32_t addr, uint8_t reg, + uint8_t *data); +static int ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg, + uint16_t *data); + +struct ad7417_softc { + device_t sc_dev; + uint32_t sc_addr; + struct ad7417_sensor *sc_sensors; + int sc_nsensors; +}; +static device_method_t ad7417_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ad7417_probe), + DEVMETHOD(device_attach, ad7417_attach), + { 0, 0 }, +}; + +static driver_t ad7417_driver = { + "ad7417", + ad7417_methods, + sizeof(struct ad7417_softc) +}; + +static devclass_t ad7417_devclass; + +DRIVER_MODULE(ad7417, iicbus, ad7417_driver, ad7417_devclass, 0, 0); +MALLOC_DEFINE(M_AD7417, "ad7417", "Supply-Monitor AD7417"); + + +static int +ad7417_write(device_t dev, uint32_t addr, uint8_t reg, uint8_t *buff, int len) +{ + unsigned char buf[4]; + struct iic_msg msg[] = { + { addr, IIC_M_WR, 0, buf } + }; + + msg[0].len = len + 1; + buf[0] = reg; + memcpy(buf + 1, buff, len); + + if (iicbus_transfer(dev, msg, 1) != 0) { + device_printf(dev, "iicbus write failed\n"); + return (EIO); + } + + return (0); + +} + +static int +ad7417_read_1(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data) +{ + uint8_t buf[4]; + + struct iic_msg msg[2] = { + { addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, + { addr, IIC_M_RD, 1, buf }, + }; + + if (iicbus_transfer(dev, msg, 2) != 0) { + device_printf(dev, "iicbus read failed\n"); + return (EIO); + } + + *data = *((uint8_t*)buf); + + return (0); +} + +static int +ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data) +{ + uint8_t buf[4]; + + struct iic_msg msg[2] = { + { addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, + { addr, IIC_M_RD, 2, buf }, + }; + + if (iicbus_transfer(dev, msg, 2) != 0) { + device_printf(dev, "iicbus read failed\n"); + return (EIO); + } + + *data = *((uint16_t*)buf); + + return (0); +} + +static int +ad7417_init_adc(device_t dev, uint32_t addr) +{ + uint8_t buf; + + adc741x_config = 0; + /* Clear Config2 */ + buf = 0; + ad7417_write(dev, addr, AD7417_CONFIG2, &buf, 1); + + /* Read & cache Config1 */ + buf = 0; + ad7417_write(dev, addr, AD7417_CONFIG, &buf, 1); + + ad7417_read_1(dev, addr, AD7417_CONFIG, &buf); + adc741x_config = (uint8_t)buf; + + /* Disable shutdown mode */ + adc741x_config &= 0xfe; + buf = adc741x_config; + ad7417_write(dev, addr, AD7417_CONFIG, &buf, 1); + + return (0); + +} +static int +ad7417_probe(device_t dev) +{ + const char *name, *compatible; + struct ad7417_softc *sc; + + name = ofw_bus_get_name(dev); + compatible = ofw_bus_get_compat(dev); + + if (!name) + return (ENXIO); + + if (strcmp(name, "supply-monitor") != 0 || + strcmp(compatible, "ad7417") != 0) + return (ENXIO); + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + device_set_desc(dev, "Supply-Monitor AD7417"); + + return (0); +} + +/* + * This function returns the number of sensors. If we call it the second time + * and we have allocated memory for sc->sc_sensors, we fill in the properties. + */ +static int +ad7417_fill_sensor_prop(device_t dev) +{ + phandle_t child; + struct ad7417_softc *sc; + u_int id[10]; + char location[96]; + char type[32]; + int i = 0, j, len = 0, prop_len, prev_len = 0; + + sc = device_get_softc(dev); + + child = ofw_bus_get_node(dev); + + /* Fill the sensor location property. */ + prop_len = OF_getprop(child, "hwsensor-location", location, + sizeof(location)); + while (len < prop_len) { + if (sc->sc_sensors != NULL) + strcpy(sc->sc_sensors[i].location, location + len); + prev_len = strlen(location + len) + 1; + len += prev_len; + i++; + } + if (sc->sc_sensors == NULL) + return (i); + + /* Fill the fan type property. */ + len = 0; + i = 0; + prev_len = 0; + prop_len = OF_getprop(child, "hwsensor-type", type, sizeof(type)); + while (len < prop_len) { + if (strcmp(type + len, "temperature") == 0) + sc->sc_sensors[i].type = ADC7417_TEMP_SENSOR; + else + sc->sc_sensors[i].type = ADC7417_ADC_SENSOR; + prev_len = strlen(type + len) + 1; + len += prev_len; + i++; + } + + /* Fill the sensor id property. Taken from OF. */ + prop_len = OF_getprop(child, "hwsensor-id", id, sizeof(id)); + for (j = 0; j < i; j++) + sc->sc_sensors[j].id = id[j]; + + return (i); +} + +static int +ad7417_attach(device_t dev) +{ + struct ad7417_softc *sc; + struct sysctl_oid *oid, *sensroot_oid; + struct sysctl_ctx_list *ctx; + char sysctl_name[32]; + int i, j; + const char *unit; + const char *desc; + + sc = device_get_softc(dev); + + sc->sc_nsensors = 0; + + /* Count the actual number of sensors. */ + sc->sc_nsensors = ad7417_fill_sensor_prop(dev); + + device_printf(dev, "%d sensors detected.\n", sc->sc_nsensors); + + if (sc->sc_nsensors == 0) + device_printf(dev, "WARNING: No AD7417 sensors detected!\n"); + + sc->sc_sensors = malloc (sc->sc_nsensors * sizeof(struct ad7417_sensor), + M_AD7417, M_WAITOK | M_ZERO); + + ctx = device_get_sysctl_ctx(dev); + sensroot_oid = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensor", + CTLFLAG_RD, 0, "AD7417 Sensor Information"); + + /* Now we can fill the properties into the allocated struct. */ + sc->sc_nsensors = ad7417_fill_sensor_prop(dev); + + /* Add sysctls for the sensors. */ + for (i = 0; i < sc->sc_nsensors; i++) { + for (j = 0; j < strlen(sc->sc_sensors[i].location); j++) { + sysctl_name[j] = tolower(sc->sc_sensors[i].location[j]); + if (isspace(sysctl_name[j])) + sysctl_name[j] = '_'; + } + sysctl_name[j] = 0; + + oid = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(sensroot_oid), + OID_AUTO, + sysctl_name, CTLFLAG_RD, 0, + "Sensor Information"); + + if (sc->sc_sensors[i].type == ADC7417_TEMP_SENSOR) { + unit = "temp"; + desc = "Sensor temp in C"; + } else { + unit = "volt"; + desc = "Sensor Volt in V"; + } + /* I use i to pass the sensor id. */ + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + unit, CTLTYPE_INT | CTLFLAG_RD, dev, + i, ad7417_sensor_sysctl, + sc->sc_sensors[i].type == ADC7417_TEMP_SENSOR ? + "IK" : "I", desc); + } + /* Dump sensor location, ID & type. */ + if (bootverbose) { + device_printf(dev, "Sensors\n"); + for (i = 0; i < sc->sc_nsensors; i++) { + device_printf(dev, "Location: %s ID: %d type: %d\n", + sc->sc_sensors[i].location, + sc->sc_sensors[i].id, + sc->sc_sensors[i].type); + } + } + + return (0); +} + +static int +ad7417_get_temp(device_t dev, uint32_t addr, int *temp) +{ + uint16_t buf[2]; + uint16_t read; + + ad7417_read_2(dev, addr, AD7417_TEMP, buf); + read = *((int16_t*)buf); + + /* The ADC is 10 bit, the resolution is 0.25 C. + The temperature is in tenth kelvin. + */ + *temp = (((int16_t)(read & 0xffc0)) >> 6) * 25 / 10; + return (0); +} + +static int +ad7417_get_adc(device_t dev, uint32_t addr, unsigned int *value, + uint8_t chan) +{ + uint8_t cfg1, tmp; + uint16_t read, buf[2]; + + ad7417_read_1(dev, addr, AD7417_CONFIG, &cfg1); + + tmp = chan << 5; + + cfg1 = (cfg1 & ~AD7417_CONFMASK) | (tmp & AD7417_CONFMASK); + + ad7417_write(dev, addr, AD7417_CONFIG, &cfg1, 1); + + ad7417_read_2(dev, addr, AD7417_ADC, buf); + + read = *((uint16_t*)buf); + + *value = ((uint32_t)read) >> 6; + + return (0); +} + +static int +ad7417_sensor_read(device_t dev, struct ad7417_sensor *sens, int *temp) +{ + struct ad7417_softc *sc; + + sc = device_get_softc(dev); + + /* Init the ADC. */ + ad7417_init_adc(sc->sc_dev, sc->sc_addr); + + if (sens->type == ADC7417_TEMP_SENSOR) { + ad7417_get_temp(sc->sc_dev, sc->sc_addr, temp); + *temp += FCU_ZERO_C_TO_K; + } else { + uint8_t chan; + switch (sens->id) { + case 11: + case 16: + chan = 1; + break; + case 12: + case 17: + chan = 2; + break; + case 13: + case 18: + chan = 3; + break; + case 14: + case 19: + chan = 4; + break; + default: + chan = 1; + } + + ad7417_get_adc(sc->sc_dev, sc->sc_addr, temp, chan); + } + return (0); +} + +static int +ad7417_sensor_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t dev; + struct ad7417_softc *sc; + struct ad7417_sensor *sens; + int value = 0; + int error; + int temp; + + dev = arg1; + sc = device_get_softc(dev); + sens = &sc->sc_sensors[arg2]; + + error = ad7417_sensor_read(dev, sens, &value); + if (error != 0) + return (error); + + temp = value; + + error = sysctl_handle_int(oidp, &temp, 0, req); + + return (error); +} Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Sun May 29 12:15:49 2011 (r222448) +++ head/sys/powerpc/conf/GENERIC Sun May 29 14:25:42 2011 (r222449) @@ -174,6 +174,7 @@ device sbp # SCSI over FireWire (Requi device fwe # Ethernet over FireWire (non-standard!) # Misc +device ad7417 # PowerMac7,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Sun May 29 12:15:49 2011 (r222448) +++ head/sys/powerpc/conf/GENERIC64 Sun May 29 14:25:42 2011 (r222449) @@ -175,6 +175,7 @@ device sbp # SCSI over FireWire (Requi device fwe # Ethernet over FireWire (non-standard!) # Misc +device ad7417 # PowerMac7,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor Modified: head/sys/powerpc/conf/NOTES ============================================================================== --- head/sys/powerpc/conf/NOTES Sun May 29 12:15:49 2011 (r222448) +++ head/sys/powerpc/conf/NOTES Sun May 29 14:25:42 2011 (r222449) @@ -39,6 +39,7 @@ device kiic # Apple Keywest I2C Contro device ofwd # Open Firmware disks device adb # Apple Desktop Bus device cuda # VIA-CUDA ADB interface +device ad7417 # PowerMac7,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor From owner-svn-src-all@FreeBSD.ORG Sun May 29 14:27:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7914B106566B; Sun, 29 May 2011 14:27:11 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6976B8FC0A; Sun, 29 May 2011 14:27:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TERBdw033951; Sun, 29 May 2011 14:27:11 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TERBN1033949; Sun, 29 May 2011 14:27:11 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201105291427.p4TERBN1033949@svn.freebsd.org> From: Andreas Tobler Date: Sun, 29 May 2011 14:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222450 - head/sys/boot/powerpc/ofw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 14:27:11 -0000 Author: andreast Date: Sun May 29 14:27:11 2011 New Revision: 222450 URL: http://svn.freebsd.org/changeset/base/222450 Log: Add some missing files. Without we hang in the OF prompt asking for screen.4th. Approved by: nwhitehorn (mentor) Modified: head/sys/boot/powerpc/ofw/Makefile Modified: head/sys/boot/powerpc/ofw/Makefile ============================================================================== --- head/sys/boot/powerpc/ofw/Makefile Sun May 29 14:25:42 2011 (r222449) +++ head/sys/boot/powerpc/ofw/Makefile Sun May 29 14:27:11 2011 (r222450) @@ -103,6 +103,7 @@ loader.help: help.common help.ofw .PATH: ${.CURDIR}/../../forth FILES= loader.help loader.4th support.4th loader.conf +FILES+= screen.4th frames.4th FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th FILESDIR_loader.conf= /boot/defaults From owner-svn-src-all@FreeBSD.ORG Sun May 29 15:02:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 992E9106566C; Sun, 29 May 2011 15:02:10 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51C798FC14; Sun, 29 May 2011 15:02:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TF2AKY035050; Sun, 29 May 2011 15:02:10 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TF2AWx035049; Sun, 29 May 2011 15:02:10 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201105291502.p4TF2AWx035049@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 May 2011 15:02:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222451 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 15:02:10 -0000 Author: jilles Date: Sun May 29 15:02:10 2011 New Revision: 222451 URL: http://svn.freebsd.org/changeset/base/222451 Log: sh: Add test for 'set +o'. Added: head/tools/regression/bin/sh/builtins/set1.0 (contents, props changed) Added: head/tools/regression/bin/sh/builtins/set1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/set1.0 Sun May 29 15:02:10 2011 (r222451) @@ -0,0 +1,32 @@ +# $FreeBSD$ + +set +C +set +f +set -e + +settings=$(set +o) +set -C +set -f +set +e +case $- in +*C*) ;; +*) echo missing C ;; +esac +case $- in +*f*) ;; +*) echo missing C ;; +esac +case $- in +*e*) echo bad e ;; +esac +eval "$settings" +case $- in +*C*) echo bad C ;; +esac +case $- in +*f*) echo bad f ;; +esac +case $- in +*e*) ;; +*) echo missing e ;; +esac From owner-svn-src-all@FreeBSD.ORG Sun May 29 15:07:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDE6E1065672; Sun, 29 May 2011 15:07:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDC538FC0A; Sun, 29 May 2011 15:07:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TF7rjs035262; Sun, 29 May 2011 15:07:53 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TF7rC7035260; Sun, 29 May 2011 15:07:53 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201105291507.p4TF7rC7035260@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 May 2011 15:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222452 - stable/8/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 15:07:53 -0000 Author: jilles Date: Sun May 29 15:07:53 2011 New Revision: 222452 URL: http://svn.freebsd.org/changeset/base/222452 Log: MFC r222173: sh: Fix bss-based buffer overflow in . builtin. If the length of a directory in PATH together with the given filename exceeded FILENAME_MAX (which may happen even for pathnames that work), a static buffer was overflown. The static buffer is unnecessary, we can use the stalloc() stack. Obtained from: NetBSD Modified: stable/8/bin/sh/main.c Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/main.c ============================================================================== --- stable/8/bin/sh/main.c Sun May 29 15:02:10 2011 (r222451) +++ stable/8/bin/sh/main.c Sun May 29 15:07:53 2011 (r222452) @@ -296,7 +296,6 @@ readcmdfile(const char *name) static char * find_dot_file(char *basename) { - static char localname[FILENAME_MAX+1]; char *fullname; const char *path = pathval(); struct stat statb; @@ -306,10 +305,14 @@ find_dot_file(char *basename) return basename; while ((fullname = padvance(&path, basename)) != NULL) { - strcpy(localname, fullname); + if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode)) { + /* + * Don't bother freeing here, since it will + * be freed by the caller. + */ + return fullname; + } stunalloc(fullname); - if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode)) - return localname; } return basename; } From owner-svn-src-all@FreeBSD.ORG Sun May 29 15:10:13 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AC2C106566C; Sun, 29 May 2011 15:10:13 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AB448FC13; Sun, 29 May 2011 15:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TFADt9035368; Sun, 29 May 2011 15:10:13 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TFADQ7035367; Sun, 29 May 2011 15:10:13 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201105291510.p4TFADQ7035367@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 May 2011 15:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222453 - stable/8/tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 15:10:13 -0000 Author: jilles Date: Sun May 29 15:10:12 2011 New Revision: 222453 URL: http://svn.freebsd.org/changeset/base/222453 Log: MFC r222174: sh: Add test for r222173 (MFCed as r222452). Added: stable/8/tools/regression/bin/sh/builtins/dot4.0 - copied unchanged from r222174, head/tools/regression/bin/sh/builtins/dot4.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/dot4.0 (from r222174, head/tools/regression/bin/sh/builtins/dot4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/dot4.0 Sun May 29 15:10:12 2011 (r222453, copy of r222174, head/tools/regression/bin/sh/builtins/dot4.0) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +v=abcd +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +r=$( ( + trap 'exit 0' 0 + . "$v" +) 2>&1 >/dev/null) && [ -n "$r" ] From owner-svn-src-all@FreeBSD.ORG Sun May 29 15:10:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C942106566C; Sun, 29 May 2011 15:10:52 +0000 (UTC) (envelope-from brix@FreeBSD.org) Received: from solow.pil.dk (relay.pil.dk [195.41.47.164]) by mx1.freebsd.org (Postfix) with ESMTP id 385908FC1F; Sun, 29 May 2011 15:10:51 +0000 (UTC) Received: from druadan.brixandersen.dk (0x55534f5f.adsl.cybercity.dk [85.83.79.95]) by solow.pil.dk (Postfix) with ESMTPA id 3CF081CC00D; Sun, 29 May 2011 17:10:50 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-3--190352940" From: Henrik Brix Andersen In-Reply-To: <201105291425.p4TEPggZ033861@svn.freebsd.org> Date: Sun, 29 May 2011 17:10:45 +0200 Content-Transfer-Encoding: 7bit Message-Id: <9F1CE0EF-CCA6-4A8A-8FE1-2E593626025A@FreeBSD.org> References: <201105291425.p4TEPggZ033861@svn.freebsd.org> To: Andreas Tobler X-Pgp-Agent: GPGMail 1.3.3 X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222449 - in head/sys: conf dev/iicbus powerpc/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 15:10:52 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-3--190352940 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, On May 29, 2011, at 16:25, Andreas Tobler wrote: > Author: andreast > Date: Sun May 29 14:25:42 2011 > New Revision: 222449 > URL: http://svn.freebsd.org/changeset/base/222449 >=20 > Log: > Add a new driver, the ad7417, to read temperatures and voltages on = some > PowerMac's. >=20 > Approved by: nwhitehorn (mentor) >=20 > Added: > head/sys/dev/iicbus/ad7417.c (contents, props changed) > Modified: > head/sys/conf/files.powerpc > head/sys/powerpc/conf/GENERIC > head/sys/powerpc/conf/GENERIC64 > head/sys/powerpc/conf/NOTES Since this driver is powerpc-only (the chip is not powerpc-specific - = but this driver depends on OFW?) shouldn't it live somewhere under = sys/powerpc/ instead of the generic sys/dev/iicbus/? Or perhaps be rewritten to a more generic form? Brix --=20 Henrik Brix Andersen --Apple-Mail-3--190352940 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iEYEARECAAYFAk3iYfUACgkQv+Q4flTiePj4ogCeNY9Gk5hOaaXSUo40edmHW5x0 bcgAn1CP8/rw/5a1ZlkJpt0+QN6h2Zid =9tLJ -----END PGP SIGNATURE----- --Apple-Mail-3--190352940-- From owner-svn-src-all@FreeBSD.ORG Sun May 29 18:00:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC90C106564A; Sun, 29 May 2011 18:00:50 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD3DB8FC14; Sun, 29 May 2011 18:00:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TI0oP1040432; Sun, 29 May 2011 18:00:50 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TI0o01040430; Sun, 29 May 2011 18:00:50 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201105291800.p4TI0o01040430@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 29 May 2011 18:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222454 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 18:00:51 -0000 Author: trociny Date: Sun May 29 18:00:50 2011 New Revision: 222454 URL: http://svn.freebsd.org/changeset/base/222454 Log: In soreceive_generic(), if MSG_WAITALL is set but the request is larger than the receive buffer, we have to receive in sections. When notifying the protocol that some data has been drained the lock is released for a moment. Returning we block waiting for the rest of data. There is a race, when data could arrive while the lock was released and then the connection stalls in sbwait. Fix this by checking for data before blocking and skip blocking if there are some. PR: kern/154504 Reported by: Andrey Simonenko Tested by: Andrey Simonenko Reviewed by: rwatson Approved by: kib (co-mentor) MFC after: 2 weeks Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sun May 29 15:10:12 2011 (r222453) +++ head/sys/kern/uipc_socket.c Sun May 29 18:00:50 2011 (r222454) @@ -1845,10 +1845,16 @@ dontblock: } SBLASTRECORDCHK(&so->so_rcv); SBLASTMBUFCHK(&so->so_rcv); - error = sbwait(&so->so_rcv); - if (error) { - SOCKBUF_UNLOCK(&so->so_rcv); - goto release; + /* + * We could receive some data while was notifying + * the protocol. Skip blocking in this case. + */ + if (so->so_rcv.sb_mb == NULL) { + error = sbwait(&so->so_rcv); + if (error) { + SOCKBUF_UNLOCK(&so->so_rcv); + goto release; + } } m = so->so_rcv.sb_mb; if (m != NULL) From owner-svn-src-all@FreeBSD.ORG Sun May 29 18:09:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 058B6106564A; Sun, 29 May 2011 18:09:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9ABD8FC18; Sun, 29 May 2011 18:09:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TI9ED9040719; Sun, 29 May 2011 18:09:14 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TI9ESQ040717; Sun, 29 May 2011 18:09:14 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201105291809.p4TI9ESQ040717@svn.freebsd.org> From: Kirk McKusick Date: Sun, 29 May 2011 18:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222455 - stable/8/sys/ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 18:09:15 -0000 Author: mckusick Date: Sun May 29 18:09:14 2011 New Revision: 222455 URL: http://svn.freebsd.org/changeset/base/222455 Log: MFC r222334: The check for whether a block is going to be claimed by a snapshot needs to happen before we notify the underlying layer that it is being freed. Modified: stable/8/sys/ufs/ffs/ffs_alloc.c Modified: stable/8/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/8/sys/ufs/ffs/ffs_alloc.c Sun May 29 18:00:50 2011 (r222454) +++ stable/8/sys/ufs/ffs/ffs_alloc.c Sun May 29 18:09:14 2011 (r222455) @@ -1874,10 +1874,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size /* devvp is a normal disk device */ dev = devvp->v_rdev; cgblkno = fsbtodb(fs, cgtod(fs, cg)); - ASSERT_VOP_LOCKED(devvp, "ffs_blkfree"); - if ((devvp->v_vflag & VV_COPYONWRITE) && - ffs_snapblkfree(fs, devvp, bno, size, inum)) - return; + ASSERT_VOP_LOCKED(devvp, "ffs_blkfree_cg"); } #ifdef INVARIANTS if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0 || @@ -2024,6 +2021,17 @@ ffs_blkfree(ump, fs, devvp, bno, size, i struct bio *bip; struct ffs_blkfree_trim_params *tp; + /* + * Check to see if a snapshot wants to claim the block. + * Check that devvp is a normal disk device, not a snapshot, + * it has a snapshot(s) associated with it, and one of the + * snapshots wants to claim the block. + */ + if (devvp->v_type != VREG && + (devvp->v_vflag & VV_COPYONWRITE) && + ffs_snapblkfree(fs, devvp, bno, size, inum)) { + return; + } if (!ump->um_candelete) { ffs_blkfree_cg(ump, fs, devvp, bno, size, inum); return; From owner-svn-src-all@FreeBSD.ORG Sun May 29 18:35:58 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29B2F106564A; Sun, 29 May 2011 18:35:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 187328FC15; Sun, 29 May 2011 18:35:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TIZwmA041678; Sun, 29 May 2011 18:35:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TIZw50041673; Sun, 29 May 2011 18:35:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105291835.p4TIZw50041673@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 18:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222458 - in head/sys: dev/iicbus powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 18:35:58 -0000 Author: nwhitehorn Date: Sun May 29 18:35:57 2011 New Revision: 222458 URL: http://svn.freebsd.org/changeset/base/222458 Log: Update the I2C-based temperature/fan drivers to connect to the Powermac thermal control module. This provides automatic fan management on all G5 PowerMacs and Xserves. Modified: head/sys/dev/iicbus/ad7417.c head/sys/dev/iicbus/ds1775.c head/sys/dev/iicbus/max6690.c head/sys/powerpc/powermac/fcu.c Modified: head/sys/dev/iicbus/ad7417.c ============================================================================== --- head/sys/dev/iicbus/ad7417.c Sun May 29 18:33:13 2011 (r222457) +++ head/sys/dev/iicbus/ad7417.c Sun May 29 18:35:57 2011 (r222458) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #define FCU_ZERO_C_TO_K 2732 @@ -63,8 +64,9 @@ __FBSDID("$FreeBSD$"); uint8_t adc741x_config; struct ad7417_sensor { + struct pmac_therm therm; + device_t dev; int id; - char location[32]; enum { ADC7417_TEMP_SENSOR, ADC7417_ADC_SENSOR @@ -83,6 +85,9 @@ static int ad7417_read_1(device_t dev, u uint8_t *data); static int ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data); +static int ad7417_diode_read(struct ad7417_sensor *sens); +static int ad7417_adc_read(struct ad7417_sensor *sens); +static int ad7417_sensor_read(struct ad7417_sensor *sens); struct ad7417_softc { device_t sc_dev; @@ -243,7 +248,7 @@ ad7417_fill_sensor_prop(device_t dev) sizeof(location)); while (len < prop_len) { if (sc->sc_sensors != NULL) - strcpy(sc->sc_sensors[i].location, location + len); + strcpy(sc->sc_sensors[i].therm.name, location + len); prev_len = strlen(location + len) + 1; len += prev_len; i++; @@ -251,7 +256,7 @@ ad7417_fill_sensor_prop(device_t dev) if (sc->sc_sensors == NULL) return (i); - /* Fill the fan type property. */ + /* Fill the sensor type property. */ len = 0; i = 0; prev_len = 0; @@ -271,6 +276,36 @@ ad7417_fill_sensor_prop(device_t dev) for (j = 0; j < i; j++) sc->sc_sensors[j].id = id[j]; + /* Fill the sensor zone property. Taken from OF. */ + prop_len = OF_getprop(child, "hwsensor-zone", id, sizeof(id)); + for (j = 0; j < i; j++) + sc->sc_sensors[j].therm.zone = id[j]; + + /* Finish setting up sensor properties */ + for (j = 0; j < i; j++) { + sc->sc_sensors[j].dev = dev; + + /* HACK: Apple wired a random diode to the ADC line */ + if (strstr(sc->sc_sensors[j].therm.name, "DIODE TEMP") + != NULL) { + sc->sc_sensors[j].type = ADC7417_TEMP_SENSOR; + sc->sc_sensors[j].therm.read = + (int (*)(struct pmac_therm *))(ad7417_diode_read); + } else { + sc->sc_sensors[j].therm.read = + (int (*)(struct pmac_therm *))(ad7417_sensor_read); + } + + if (sc->sc_sensors[j].type != ADC7417_TEMP_SENSOR) + continue; + + /* Make up some ranges */ + sc->sc_sensors[j].therm.target_temp = 500 + 2732; + sc->sc_sensors[j].therm.max_temp = 900 + 2732; + + pmac_thermal_sensor_register(&sc->sc_sensors[j].therm); + } + return (i); } @@ -310,8 +345,9 @@ ad7417_attach(device_t dev) /* Add sysctls for the sensors. */ for (i = 0; i < sc->sc_nsensors; i++) { - for (j = 0; j < strlen(sc->sc_sensors[i].location); j++) { - sysctl_name[j] = tolower(sc->sc_sensors[i].location[j]); + for (j = 0; j < strlen(sc->sc_sensors[i].therm.name); j++) { + sysctl_name[j] = + tolower(sc->sc_sensors[i].therm.name[j]); if (isspace(sysctl_name[j])) sysctl_name[j] = '_'; } @@ -341,7 +377,7 @@ ad7417_attach(device_t dev) device_printf(dev, "Sensors\n"); for (i = 0; i < sc->sc_nsensors; i++) { device_printf(dev, "Location: %s ID: %d type: %d\n", - sc->sc_sensors[i].location, + sc->sc_sensors[i].therm.name, sc->sc_sensors[i].id, sc->sc_sensors[i].type); } @@ -391,44 +427,91 @@ ad7417_get_adc(device_t dev, uint32_t ad } static int -ad7417_sensor_read(device_t dev, struct ad7417_sensor *sens, int *temp) +ad7417_diode_read(struct ad7417_sensor *sens) +{ + static int eeprom_read = 0; + static cell_t eeprom[2][40]; + phandle_t eeprom_node; + int rawval, diode_slope, diode_offset; + int temp; + + if (!eeprom_read) { + eeprom_node = OF_finddevice("/u3/i2c/cpuid@a0"); + OF_getprop(eeprom_node, "cpuid", eeprom[0], sizeof(eeprom[0])); + eeprom_node = OF_finddevice("/u3/i2c/cpuid@a2"); + OF_getprop(eeprom_node, "cpuid", eeprom[1], sizeof(eeprom[1])); + eeprom_read = 1; + } + + rawval = ad7417_adc_read(sens); + if (strstr(sens->therm.name, "CPU B") != NULL) { + diode_slope = eeprom[1][0x11] >> 16; + diode_offset = (int16_t)(eeprom[1][0x11] & 0xffff) << 12; + } else { + diode_slope = eeprom[0][0x11] >> 16; + diode_offset = (int16_t)(eeprom[0][0x11] & 0xffff) << 12; + } + + temp = (rawval*diode_slope + diode_offset) >> 2; + temp = (10*(temp >> 16)) + ((10*(temp & 0xffff)) >> 16); + + return (temp + FCU_ZERO_C_TO_K); +} + +static int +ad7417_adc_read(struct ad7417_sensor *sens) +{ + struct ad7417_softc *sc; + uint8_t chan; + int temp; + + sc = device_get_softc(sens->dev); + + switch (sens->id) { + case 11: + case 16: + chan = 1; + break; + case 12: + case 17: + chan = 2; + break; + case 13: + case 18: + chan = 3; + break; + case 14: + case 19: + chan = 4; + break; + default: + chan = 1; + } + + ad7417_get_adc(sc->sc_dev, sc->sc_addr, &temp, chan); + + return (temp); +} + + +static int +ad7417_sensor_read(struct ad7417_sensor *sens) { struct ad7417_softc *sc; + int temp; - sc = device_get_softc(dev); + sc = device_get_softc(sens->dev); /* Init the ADC. */ ad7417_init_adc(sc->sc_dev, sc->sc_addr); if (sens->type == ADC7417_TEMP_SENSOR) { - ad7417_get_temp(sc->sc_dev, sc->sc_addr, temp); - *temp += FCU_ZERO_C_TO_K; + ad7417_get_temp(sc->sc_dev, sc->sc_addr, &temp); + temp += FCU_ZERO_C_TO_K; } else { - uint8_t chan; - switch (sens->id) { - case 11: - case 16: - chan = 1; - break; - case 12: - case 17: - chan = 2; - break; - case 13: - case 18: - chan = 3; - break; - case 14: - case 19: - chan = 4; - break; - default: - chan = 1; - } - - ad7417_get_adc(sc->sc_dev, sc->sc_addr, temp, chan); + temp = ad7417_adc_read(sens); } - return (0); + return (temp); } static int @@ -439,19 +522,16 @@ ad7417_sensor_sysctl(SYSCTL_HANDLER_ARGS struct ad7417_sensor *sens; int value = 0; int error; - int temp; dev = arg1; sc = device_get_softc(dev); sens = &sc->sc_sensors[arg2]; - error = ad7417_sensor_read(dev, sens, &value); - if (error != 0) - return (error); - - temp = value; + value = sens->therm.read(&sens->therm); + if (value < 0) + return (ENXIO); - error = sysctl_handle_int(oidp, &temp, 0, req); + error = sysctl_handle_int(oidp, &value, 0, req); return (error); } Modified: head/sys/dev/iicbus/ds1775.c ============================================================================== --- head/sys/dev/iicbus/ds1775.c Sun May 29 18:33:13 2011 (r222457) +++ head/sys/dev/iicbus/ds1775.c Sun May 29 18:35:57 2011 (r222458) @@ -49,33 +49,31 @@ __FBSDID("$FreeBSD$"); #include #include +#include #define FCU_ZERO_C_TO_K 2732 /* Drivebay sensor: LM75/DS1775. */ #define DS1775_TEMP 0x0 -struct ds1775_sensor { - char location[32]; -}; - /* Regular bus attachment functions */ static int ds1775_probe(device_t); static int ds1775_attach(device_t); +struct ds1775_softc { + struct pmac_therm sc_sensor; + device_t sc_dev; + struct intr_config_hook enum_hook; + uint32_t sc_addr; +}; + /* Utility functions */ +static int ds1775_sensor_read(struct ds1775_softc *sc); static int ds1775_sensor_sysctl(SYSCTL_HANDLER_ARGS); static void ds1775_start(void *xdev); static int ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data); -struct ds1775_softc { - device_t sc_dev; - struct intr_config_hook enum_hook; - uint32_t sc_addr; - struct ds1775_sensor *sc_sensors; - -}; static device_method_t ds1775_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ds1775_probe), @@ -92,7 +90,6 @@ static driver_t ds1775_driver = { static devclass_t ds1775_devclass; DRIVER_MODULE(ds1755, iicbus, ds1775_driver, ds1775_devclass, 0, 0); -MALLOC_DEFINE(M_DS1775, "ds1775", "Temp-Monitor DS1775"); static int ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data) @@ -169,7 +166,6 @@ ds1775_start(void *xdev) { phandle_t child; struct ds1775_softc *sc; - struct ds1775_sensor *sens; struct sysctl_oid *sensroot_oid; struct sysctl_ctx_list *ctx; ssize_t plen; @@ -183,30 +179,34 @@ ds1775_start(void *xdev) child = ofw_bus_get_node(dev); - sc->sc_sensors = malloc (sizeof(struct ds1775_sensor), - M_DS1775, M_WAITOK | M_ZERO); - - sens = sc->sc_sensors; - ctx = device_get_sysctl_ctx(dev); sensroot_oid = device_get_sysctl_tree(dev); - plen = OF_getprop(child, "hwsensor-location", sens->location, - sizeof(sens->location)); + OF_getprop(child, "hwsensor-zone", &sc->sc_sensor.zone, sizeof(int)); + plen = OF_getprop(child, "hwsensor-location", sc->sc_sensor.name, + sizeof(sc->sc_sensor.name)); units = "C"; if (plen == -1) { strcpy(sysctl_name, "sensor"); } else { - for (i = 0; i < strlen(sens->location); i++) { - sysctl_name[i] = tolower(sens->location[i]); + for (i = 0; i < strlen(sc->sc_sensor.name); i++) { + sysctl_name[i] = tolower(sc->sc_sensor.name[i]); if (isspace(sysctl_name[i])) sysctl_name[i] = '_'; } sysctl_name[i] = 0; } - sprintf(sysctl_desc,"%s (%s)", sens->location, units); + /* Make up target temperatures. These are low, for the drive bay. */ + sc->sc_sensor.target_temp = 300 + FCU_ZERO_C_TO_K; + sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K; + + sc->sc_sensor.read = + (int (*)(struct pmac_therm *sc))(ds1775_sensor_read); + pmac_thermal_sensor_register(&sc->sc_sensor); + + sprintf(sysctl_desc,"%s (%s)", sc->sc_sensor.name, units); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO, sysctl_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, @@ -216,14 +216,11 @@ ds1775_start(void *xdev) } static int -ds1775_sensor_read(device_t dev, struct ds1775_sensor *sens, int *temp) +ds1775_sensor_read(struct ds1775_softc *sc) { - struct ds1775_softc *sc; uint16_t buf[2]; uint16_t read; - sc = device_get_softc(dev); - ds1775_read_2(sc->sc_dev, sc->sc_addr, DS1775_TEMP, buf); read = *((int16_t *)buf); @@ -231,29 +228,21 @@ ds1775_sensor_read(device_t dev, struct /* The default mode of the ADC is 9 bit, the resolution is 0.5 C per bit. The temperature is in tenth kelvin. */ - *temp = ((int16_t)(read) >> 7) * 5; - - return (0); + return (((int16_t)(read) >> 7) * 5 + FCU_ZERO_C_TO_K); } + static int ds1775_sensor_sysctl(SYSCTL_HANDLER_ARGS) { device_t dev; struct ds1775_softc *sc; - struct ds1775_sensor *sens; - int value; int error; unsigned int temp; dev = arg1; sc = device_get_softc(dev); - sens = &sc->sc_sensors[arg2]; - - error = ds1775_sensor_read(dev, sens, &value); - if (error != 0) - return (error); - temp = value + FCU_ZERO_C_TO_K; + temp = ds1775_sensor_read(sc); error = sysctl_handle_int(oidp, &temp, 0, req); Modified: head/sys/dev/iicbus/max6690.c ============================================================================== --- head/sys/dev/iicbus/max6690.c Sun May 29 18:33:13 2011 (r222457) +++ head/sys/dev/iicbus/max6690.c Sun May 29 18:35:57 2011 (r222458) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #define FCU_ZERO_C_TO_K 2732 @@ -61,8 +62,10 @@ __FBSDID("$FreeBSD$"); #define MAX6690_TEMP_MASK 0xe0 struct max6690_sensor { + struct pmac_therm therm; + device_t dev; + int id; - char location[32]; }; /* Regular bus attachment functions */ @@ -70,6 +73,7 @@ static int max6690_probe(device_t); static int max6690_attach(device_t); /* Utility functions */ +static int max6690_sensor_read(struct max6690_sensor *sens); static int max6690_sensor_sysctl(SYSCTL_HANDLER_ARGS); static void max6690_start(void *xdev); static int max6690_read_1(device_t dev, uint32_t addr, uint8_t reg, @@ -167,7 +171,7 @@ max6690_fill_sensor_prop(device_t dev) sizeof(location)); while (len < prop_len) { if (sc->sc_sensors != NULL) - strcpy(sc->sc_sensors[i].location, location + len); + strcpy(sc->sc_sensors[i].therm.name, location + len); prev_len = strlen(location + len) + 1; len += prev_len; i++; @@ -180,6 +184,22 @@ max6690_fill_sensor_prop(device_t dev) for (j = 0; j < i; j++) sc->sc_sensors[j].id = (id[j] & 0xf); + /* Fill the sensor zone property. */ + prop_len = OF_getprop(child, "hwsensor-zone", id, sizeof(id)); + for (j = 0; j < i; j++) + sc->sc_sensors[j].therm.zone = id[j]; + + /* Set up remaining sensor properties */ + for (j = 0; j < i; j++) { + sc->sc_sensors[j].dev = dev; + + sc->sc_sensors[j].therm.target_temp = 400 + 2732; + sc->sc_sensors[j].therm.max_temp = 800 + 2732; + + sc->sc_sensors[j].therm.read = + (int (*)(struct pmac_therm *))(max6690_sensor_read); + } + return (i); } static int @@ -240,10 +260,15 @@ max6690_start(void *xdev) /* Now we can fill the properties into the allocated struct. */ sc->sc_nsensors = max6690_fill_sensor_prop(dev); + /* Register with powermac_thermal */ + for (i = 0; i < sc->sc_nsensors; i++) + pmac_thermal_sensor_register(&sc->sc_sensors[i].therm); + /* Add sysctls for the sensors. */ for (i = 0; i < sc->sc_nsensors; i++) { - for (j = 0; j < strlen(sc->sc_sensors[i].location); j++) { - sysctl_name[j] = tolower(sc->sc_sensors[i].location[j]); + for (j = 0; j < strlen(sc->sc_sensors[i].therm.name); j++) { + sysctl_name[j] = + tolower(sc->sc_sensors[i].therm.name[j]); if (isspace(sysctl_name[j])) sysctl_name[j] = '_'; } @@ -265,7 +290,7 @@ max6690_start(void *xdev) device_printf(dev, "Sensors\n"); for (i = 0; i < sc->sc_nsensors; i++) { device_printf(dev, "Location : %s ID: %d\n", - sc->sc_sensors[i].location, + sc->sc_sensors[i].therm.name, sc->sc_sensors[i].id); } } @@ -274,14 +299,15 @@ max6690_start(void *xdev) } static int -max6690_sensor_read(device_t dev, struct max6690_sensor *sens, int *temp) +max6690_sensor_read(struct max6690_sensor *sens) { uint8_t reg_int = 0, reg_ext = 0; uint8_t integer; uint8_t fraction; + int temp; struct max6690_softc *sc; - sc = device_get_softc(dev); + sc = device_get_softc(sens->dev); /* The internal sensor id's are even, the external ar odd. */ if ((sens->id % 2) == 0) { @@ -301,9 +327,9 @@ max6690_sensor_read(device_t dev, struct /* The temperature is in tenth kelvin, the fractional part resolution is 0.125. */ - *temp = (integer * 10) + (fraction >> 5) * 10 / 8; + temp = (integer * 10) + (fraction >> 5) * 10 / 8; - return (0); + return (temp); } static int @@ -320,9 +346,9 @@ max6690_sensor_sysctl(SYSCTL_HANDLER_ARG sc = device_get_softc(dev); sens = &sc->sc_sensors[arg2]; - error = max6690_sensor_read(dev, sens, &value); - if (error != 0) - return (error); + value = max6690_sensor_read(sens); + if (value < 0) + return (EIO); temp = value + FCU_ZERO_C_TO_K; Modified: head/sys/powerpc/powermac/fcu.c ============================================================================== --- head/sys/powerpc/powermac/fcu.c Sun May 29 18:33:13 2011 (r222457) +++ head/sys/powerpc/powermac/fcu.c Sun May 29 18:35:57 2011 (r222458) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include /* FCU registers * /u3@0,f8000000/i2c@f8001000/fan@15e @@ -66,10 +67,10 @@ __FBSDID("$FreeBSD$"); #define FCU_PWM_SGET(x) 0x30 + (x) * 2 /* Set or get PWM. */ struct fcu_fan { + struct pmac_fan fan; + device_t dev; + int id; - cell_t min; - cell_t max; - char location[32]; enum { FCU_FAN_RPM, FCU_FAN_PWM @@ -103,9 +104,9 @@ static int fcu_attach(device_t); /* Utility functions */ static void fcu_attach_fans(device_t dev); static int fcu_fill_fan_prop(device_t dev); -static int fcu_fan_set_rpm(device_t dev, struct fcu_fan *fan, int rpm); -static int fcu_fan_get_rpm(device_t dev, struct fcu_fan *fan, int *rpm); -static int fcu_fan_set_pwm(device_t dev, struct fcu_fan *fan, int pwm); +static int fcu_fan_set_rpm(struct fcu_fan *fan, int rpm); +static int fcu_fan_get_rpm(struct fcu_fan *fan); +static int fcu_fan_set_pwm(struct fcu_fan *fan, int pwm); static int fcu_fan_get_pwm(device_t dev, struct fcu_fan *fan, int *pwm, int *rpm); static int fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS); @@ -249,23 +250,23 @@ fcu_start(void *xdev) } static int -fcu_fan_set_rpm(device_t dev, struct fcu_fan *fan, int rpm) +fcu_fan_set_rpm(struct fcu_fan *fan, int rpm) { uint8_t reg; struct fcu_softc *sc; unsigned char buf[2]; - sc = device_get_softc(dev); + sc = device_get_softc(fan->dev); /* Clamp to allowed range */ - rpm = max(fan->min, rpm); - rpm = min(fan->max, rpm); + rpm = max(fan->fan.min_rpm, rpm); + rpm = min(fan->fan.max_rpm, rpm); if (fan->type == FCU_FAN_RPM) { reg = FCU_RPM_SET(fan->id); fan->setpoint = rpm; } else { - device_printf(dev, "Unknown fan type: %d\n", fan->type); + device_printf(fan->dev, "Unknown fan type: %d\n", fan->type); return (EIO); } @@ -278,66 +279,68 @@ fcu_fan_set_rpm(device_t dev, struct fcu } static int -fcu_fan_get_rpm(device_t dev, struct fcu_fan *fan, int *rpm) +fcu_fan_get_rpm(struct fcu_fan *fan) { uint8_t reg; struct fcu_softc *sc; uint8_t buff[2] = { 0, 0 }; uint8_t active = 0, avail = 0, fail = 0; + int rpm; - sc = device_get_softc(dev); + sc = device_get_softc(fan->dev); if (fan->type == FCU_FAN_RPM) { /* Check if the fan is available. */ reg = FCU_RPM_AVAILABLE; fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &avail); if ((avail & (1 << fan->id)) == 0) { - device_printf(dev, "RPM Fan not available ID: %d\n", - fan->id); - return (EIO); + device_printf(fan->dev, + "RPM Fan not available ID: %d\n", fan->id); + return (-1); } /* Check if we have a failed fan. */ reg = FCU_RPM_FAIL; fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &fail); if ((fail & (1 << fan->id)) != 0) { - device_printf(dev, "RPM Fan failed ID: %d\n", fan->id); - return (EIO); + device_printf(fan->dev, + "RPM Fan failed ID: %d\n", fan->id); + return (-1); } /* Check if fan is active. */ reg = FCU_RPM_ACTIVE; fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &active); if ((active & (1 << fan->id)) == 0) { - device_printf(dev, "RPM Fan not active ID: %d\n", + device_printf(fan->dev, "RPM Fan not active ID: %d\n", fan->id); - return (ENXIO); + return (-1); } reg = FCU_RPM_READ(fan->id); } else { - device_printf(dev, "Unknown fan type: %d\n", fan->type); - return (EIO); + device_printf(fan->dev, "Unknown fan type: %d\n", fan->type); + return (-1); } /* It seems that we can read the fans rpm. */ fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buff); - *rpm = (buff[0] << (8 - fcu_rpm_shift)) | buff[1] >> fcu_rpm_shift; + rpm = (buff[0] << (8 - fcu_rpm_shift)) | buff[1] >> fcu_rpm_shift; - return (0); + return (rpm); } static int -fcu_fan_set_pwm(device_t dev, struct fcu_fan *fan, int pwm) +fcu_fan_set_pwm(struct fcu_fan *fan, int pwm) { uint8_t reg; struct fcu_softc *sc; uint8_t buf[2]; - sc = device_get_softc(dev); + sc = device_get_softc(fan->dev); /* Clamp to allowed range */ - pwm = max(fan->min, pwm); - pwm = min(fan->max, pwm); + pwm = max(fan->fan.min_rpm, pwm); + pwm = min(fan->fan.max_rpm, pwm); if (fan->type == FCU_FAN_PWM) { reg = FCU_PWM_SGET(fan->id); @@ -347,7 +350,7 @@ fcu_fan_set_pwm(device_t dev, struct fcu pwm = 30; fan->setpoint = pwm; } else { - device_printf(dev, "Unknown fan type: %d\n", fan->type); + device_printf(fan->dev, "Unknown fan type: %d\n", fan->type); return (EIO); } @@ -434,7 +437,7 @@ fcu_fill_fan_prop(device_t dev) sizeof(location)); while (len < prop_len) { if (sc->sc_fans != NULL) { - strcpy(sc->sc_fans[i].location, location + len); + strcpy(sc->sc_fans[i].fan.name, location + len); } prev_len = strlen(location + len) + 1; len += prev_len; @@ -463,6 +466,33 @@ fcu_fill_fan_prop(device_t dev) for (j = 0; j < i; j++) sc->sc_fans[j].id = ((id[j] >> 8) & 0x0f) % 8; + /* Fill the fan zone property. */ + prop_len = OF_getprop(child, "hwctrl-zone", id, sizeof(id)); + for (j = 0; j < i; j++) + sc->sc_fans[j].fan.zone = id[j]; + + /* Finish setting up fan properties */ + for (j = 0; j < i; j++) { + sc->sc_fans[j].dev = sc->sc_dev; + if (sc->sc_fans[j].type == FCU_FAN_RPM) { + sc->sc_fans[j].fan.min_rpm = 4800 >> fcu_rpm_shift; + sc->sc_fans[j].fan.max_rpm = 56000 >> fcu_rpm_shift; + sc->sc_fans[j].setpoint = + fcu_fan_get_rpm(&sc->sc_fans[j]); + sc->sc_fans[j].fan.read = + (int (*)(struct pmac_fan *))(fcu_fan_get_rpm); + sc->sc_fans[j].fan.set = + (int (*)(struct pmac_fan *, int))(fcu_fan_set_rpm); + } else { + sc->sc_fans[j].fan.min_rpm = 40; /* Percent */ + sc->sc_fans[j].fan.max_rpm = 100; + sc->sc_fans[j].fan.read = NULL; + sc->sc_fans[j].fan.set = + (int (*)(struct pmac_fan *, int))(fcu_fan_set_pwm); + } + sc->sc_fans[j].fan.default_rpm = sc->sc_fans[j].fan.max_rpm; + } + return (i); } @@ -478,7 +508,7 @@ fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) sc = device_get_softc(fcu); fan = &sc->sc_fans[arg2 & 0x00ff]; if (fan->type == FCU_FAN_RPM) { - fcu_fan_get_rpm(fcu, fan, &rpm); + rpm = fcu_fan_get_rpm(fan); error = sysctl_handle_int(oidp, &rpm, 0, req); } else { fcu_fan_get_pwm(fcu, fan, &pwm, &rpm); @@ -504,9 +534,9 @@ fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) return (error); if (fan->type == FCU_FAN_RPM) - return (fcu_fan_set_rpm(fcu, fan, rpm)); + return (fcu_fan_set_rpm(fan, rpm)); else - return (fcu_fan_set_pwm(fcu, fan, pwm)); + return (fcu_fan_set_pwm(fan, pwm)); } static void @@ -543,39 +573,36 @@ fcu_attach_fans(device_t dev) /* Now we can fill the properties into the allocated struct. */ sc->sc_nfans = fcu_fill_fan_prop(dev); + /* Register fans with pmac_thermal */ + for (i = 0; i < sc->sc_nfans; i++) + pmac_thermal_fan_register(&sc->sc_fans[i].fan); + /* Add sysctls for the fans. */ for (i = 0; i < sc->sc_nfans; i++) { - for (j = 0; j < strlen(sc->sc_fans[i].location); j++) { - sysctl_name[j] = tolower(sc->sc_fans[i].location[j]); + for (j = 0; j < strlen(sc->sc_fans[i].fan.name); j++) { + sysctl_name[j] = tolower(sc->sc_fans[i].fan.name[j]); if (isspace(sysctl_name[j])) sysctl_name[j] = '_'; } sysctl_name[j] = 0; if (sc->sc_fans[i].type == FCU_FAN_RPM) { - sc->sc_fans[i].min = 2400 >> fcu_rpm_shift; - sc->sc_fans[i].max = 56000 >> fcu_rpm_shift; - fcu_fan_get_rpm(dev, &sc->sc_fans[i], - &sc->sc_fans[i].setpoint); - oid = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(fanroot_oid), OID_AUTO, sysctl_name, CTLFLAG_RD, 0, "Fan Information"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "minrpm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].min), sizeof(cell_t), - "Minimum allowed RPM"); + &(sc->sc_fans[i].fan.min_rpm), + sizeof(int), "Minimum allowed RPM"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "maxrpm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].max), sizeof(cell_t), - "Maximum allowed RPM"); + &(sc->sc_fans[i].fan.max_rpm), + sizeof(int), "Maximum allowed RPM"); /* I use i to pass the fan id. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "rpm", CTLTYPE_INT | CTLFLAG_RW, dev, i, fcu_fanrpm_sysctl, "I", "Fan RPM"); } else { - sc->sc_fans[i].min = 30; - sc->sc_fans[i].max = 100; fcu_fan_get_pwm(dev, &sc->sc_fans[i], &sc->sc_fans[i].setpoint, &sc->sc_fans[i].rpm); @@ -585,12 +612,12 @@ fcu_attach_fans(device_t dev) CTLFLAG_RD, 0, "Fan Information"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "minpwm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].min), sizeof(cell_t), - "Minimum allowed PWM in %"); + &(sc->sc_fans[i].fan.min_rpm), + sizeof(int), "Minimum allowed PWM in %"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "maxpwm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].max), sizeof(cell_t), - "Maximum allowed PWM in %"); + &(sc->sc_fans[i].fan.max_rpm), + sizeof(int), "Maximum allowed PWM in %"); /* I use i to pass the fan id or'ed with the type * of info I want to display/modify. */ @@ -610,7 +637,7 @@ fcu_attach_fans(device_t dev) device_printf(dev, "Fans\n"); for (i = 0; i < sc->sc_nfans; i++) { device_printf(dev, "Location: %s type: %d ID: %d " - "RPM: %d\n", sc->sc_fans[i].location, + "RPM: %d\n", sc->sc_fans[i].fan.name, sc->sc_fans[i].type, sc->sc_fans[i].id, (sc->sc_fans[i].type == FCU_FAN_RPM) ? sc->sc_fans[i].setpoint : From owner-svn-src-all@FreeBSD.ORG Sun May 29 18:41:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AD90106564A; Sun, 29 May 2011 18:41:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B51A8FC18; Sun, 29 May 2011 18:41:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TIf6cu041864; Sun, 29 May 2011 18:41:06 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TIf6uN041859; Sun, 29 May 2011 18:41:06 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201105291841.p4TIf6uN041859@svn.freebsd.org> From: Michael Tuexen Date: Sun, 29 May 2011 18:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222459 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 18:41:07 -0000 Author: tuexen Date: Sun May 29 18:41:06 2011 New Revision: 222459 URL: http://svn.freebsd.org/changeset/base/222459 Log: Get rid of unused functions. MFC after: 1 week. Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sun May 29 18:35:57 2011 (r222458) +++ head/sys/netinet/sctp_indata.c Sun May 29 18:41:06 2011 (r222459) @@ -247,49 +247,6 @@ sctp_build_ctl_nchunk(struct sctp_inpcb } -char * -sctp_build_ctl_cchunk(struct sctp_inpcb *inp, - int *control_len, - struct sctp_sndrcvinfo *sinfo) -{ - struct sctp_sndrcvinfo *outinfo; - struct cmsghdr *cmh; - char *buf; - int len; - int use_extended = 0; - - if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_RECVDATAIOEVNT)) { - /* user does not want the sndrcv ctl */ - return (NULL); - } - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXT_RCVINFO)) { - use_extended = 1; - len = CMSG_LEN(sizeof(struct sctp_extrcvinfo)); - } else { - len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); - } - SCTP_MALLOC(buf, char *, len, SCTP_M_CMSG); - if (buf == NULL) { - /* No space */ - return (buf); - } - /* We need a CMSG header followed by the struct */ - cmh = (struct cmsghdr *)buf; - outinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmh); - cmh->cmsg_level = IPPROTO_SCTP; - if (use_extended) { - cmh->cmsg_type = SCTP_EXTRCV; - cmh->cmsg_len = len; - memcpy(outinfo, sinfo, len); - } else { - cmh->cmsg_type = SCTP_SNDRCV; - cmh->cmsg_len = len; - *outinfo = *sinfo; - } - *control_len = len; - return (buf); -} - static void sctp_mark_non_revokable(struct sctp_association *asoc, uint32_t tsn) { Modified: head/sys/netinet/sctp_indata.h ============================================================================== --- head/sys/netinet/sctp_indata.h Sun May 29 18:35:57 2011 (r222458) +++ head/sys/netinet/sctp_indata.h Sun May 29 18:41:06 2011 (r222459) @@ -83,11 +83,6 @@ struct mbuf * sctp_build_ctl_nchunk(struct sctp_inpcb *inp, struct sctp_sndrcvinfo *sinfo); -char * -sctp_build_ctl_cchunk(struct sctp_inpcb *inp, - int *control_len, - struct sctp_sndrcvinfo *sinfo); - void sctp_set_rwnd(struct sctp_tcb *, struct sctp_association *); uint32_t Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun May 29 18:35:57 2011 (r222458) +++ head/sys/netinet/sctputil.c Sun May 29 18:41:06 2011 (r222459) @@ -6184,71 +6184,6 @@ sctp_soreceive(struct socket *so, } -int -sctp_l_soreceive(struct socket *so, - struct sockaddr **name, - struct uio *uio, - char **controlp, - int *controllen, - int *flag) -{ - int error, fromlen; - uint8_t sockbuf[256]; - struct sockaddr *from; - struct sctp_extrcvinfo sinfo; - int filling_sinfo = 1; - struct sctp_inpcb *inp; - - inp = (struct sctp_inpcb *)so->so_pcb; - /* pickup the assoc we are reading from */ - if (inp == NULL) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); - return (EINVAL); - } - if ((sctp_is_feature_off(inp, - SCTP_PCB_FLAGS_RECVDATAIOEVNT)) || - (controlp == NULL)) { - /* user does not want the sndrcv ctl */ - filling_sinfo = 0; - } - if (name) { - from = (struct sockaddr *)sockbuf; - fromlen = sizeof(sockbuf); - from->sa_len = 0; - } else { - from = NULL; - fromlen = 0; - } - - error = sctp_sorecvmsg(so, uio, - (struct mbuf **)NULL, - from, fromlen, flag, - (struct sctp_sndrcvinfo *)&sinfo, - filling_sinfo); - if ((controlp) && (filling_sinfo)) { - /* - * copy back the sinfo in a CMSG format note that the caller - * has reponsibility for freeing the memory. - */ - if (filling_sinfo) - *controlp = sctp_build_ctl_cchunk(inp, - controllen, - (struct sctp_sndrcvinfo *)&sinfo); - } - if (name) { - /* copy back the address info */ - if (from && from->sa_len) { - *name = sodupsockaddr(from, M_WAIT); - } else { - *name = NULL; - } - } - return (error); -} - - - - Modified: head/sys/netinet/sctputil.h ============================================================================== --- head/sys/netinet/sctputil.h Sun May 29 18:35:57 2011 (r222458) +++ head/sys/netinet/sctputil.h Sun May 29 18:41:06 2011 (r222459) @@ -328,20 +328,6 @@ sctp_soreceive(struct socket *so, struct struct mbuf **controlp, int *flagsp); - -/* For those not passing mbufs, this does the - * translations for you. Caller owns memory - * of size controllen returned in controlp. - */ -int -sctp_l_soreceive(struct socket *so, - struct sockaddr **name, - struct uio *uio, - char **controlp, - int *controllen, - int *flag); - - void sctp_misc_ints(uint8_t from, uint32_t a, uint32_t b, uint32_t c, uint32_t d); From owner-svn-src-all@FreeBSD.ORG Sun May 29 19:53:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC6DE1065674; Sun, 29 May 2011 19:53:11 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCDA68FC13; Sun, 29 May 2011 19:53:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TJrBQo044073; Sun, 29 May 2011 19:53:11 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TJrBMq044071; Sun, 29 May 2011 19:53:11 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105291953.p4TJrBMq044071@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 19:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222460 - head/sys/powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 19:53:11 -0000 Author: nwhitehorn Date: Sun May 29 19:53:11 2011 New Revision: 222460 URL: http://svn.freebsd.org/changeset/base/222460 Log: Don't put negative values into the averages. Modified: head/sys/powerpc/powermac/powermac_thermal.c Modified: head/sys/powerpc/powermac/powermac_thermal.c ============================================================================== --- head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 18:41:06 2011 (r222459) +++ head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 19:53:11 2011 (r222460) @@ -121,6 +121,8 @@ pmac_therm_manage_fans(void) sensor->sensor->target_temp)*100 / (sensor->sensor->max_temp - sensor->sensor->target_temp); + if (frac_excess < 0) + frac_excess = 0; if (sensor->sensor->zone == fan->fan->zone) { max_excess_zone = imax(max_excess_zone, frac_excess); From owner-svn-src-all@FreeBSD.ORG Sun May 29 19:53:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 961271065782; Sun, 29 May 2011 19:53:46 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 86C4A8FC1D; Sun, 29 May 2011 19:53:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TJrk8W044122; Sun, 29 May 2011 19:53:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TJrkAt044120; Sun, 29 May 2011 19:53:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105291953.p4TJrkAt044120@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 19:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222461 - head/sys/dev/iicbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 19:53:46 -0000 Author: nwhitehorn Date: Sun May 29 19:53:46 2011 New Revision: 222461 URL: http://svn.freebsd.org/changeset/base/222461 Log: Move the celsius-to-kelvin conversion to a place that powermac_thermal can see it as well. Modified: head/sys/dev/iicbus/max6690.c Modified: head/sys/dev/iicbus/max6690.c ============================================================================== --- head/sys/dev/iicbus/max6690.c Sun May 29 19:53:11 2011 (r222460) +++ head/sys/dev/iicbus/max6690.c Sun May 29 19:53:46 2011 (r222461) @@ -329,7 +329,7 @@ max6690_sensor_read(struct max6690_senso */ temp = (integer * 10) + (fraction >> 5) * 10 / 8; - return (temp); + return (temp + FCU_ZERO_C_TO_K); } static int @@ -338,7 +338,6 @@ max6690_sensor_sysctl(SYSCTL_HANDLER_ARG device_t dev; struct max6690_softc *sc; struct max6690_sensor *sens; - int value = 0; int error; unsigned int temp; @@ -346,12 +345,10 @@ max6690_sensor_sysctl(SYSCTL_HANDLER_ARG sc = device_get_softc(dev); sens = &sc->sc_sensors[arg2]; - value = max6690_sensor_read(sens); - if (value < 0) + temp = max6690_sensor_read(sens); + if (temp < 0) return (EIO); - temp = value + FCU_ZERO_C_TO_K; - error = sysctl_handle_int(oidp, &temp, 0, req); return (error); From owner-svn-src-all@FreeBSD.ORG Sun May 29 20:04:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F98F106566B; Sun, 29 May 2011 20:04:03 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 501B08FC14; Sun, 29 May 2011 20:04:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TK43tQ044512; Sun, 29 May 2011 20:04:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TK43LR044509; Sun, 29 May 2011 20:04:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105292004.p4TK43LR044509@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 20:04:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222462 - head/sys/powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 20:04:03 -0000 Author: nwhitehorn Date: Sun May 29 20:04:02 2011 New Revision: 222462 URL: http://svn.freebsd.org/changeset/base/222462 Log: Add the next digit of precision to temperatures, which I missed when converting the reporting format from degrees C to 0.1 degree K. Modified: head/sys/powerpc/powermac/smu.c head/sys/powerpc/powermac/smusat.c Modified: head/sys/powerpc/powermac/smu.c ============================================================================== --- head/sys/powerpc/powermac/smu.c Sun May 29 19:53:46 2011 (r222461) +++ head/sys/powerpc/powermac/smu.c Sun May 29 20:04:02 2011 (r222462) @@ -854,7 +854,7 @@ smu_sensor_read(struct smu_sensor *sens) value <<= 1; /* Convert from 16.16 fixed point degC into integer 0.1 K. */ - value = 10*(value >> 16) + 2732; + value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732; break; case SMU_VOLTAGE_SENSOR: value *= sc->sc_cpu_volt_scale; Modified: head/sys/powerpc/powermac/smusat.c ============================================================================== --- head/sys/powerpc/powermac/smusat.c Sun May 29 19:53:46 2011 (r222461) +++ head/sys/powerpc/powermac/smusat.c Sun May 29 20:04:02 2011 (r222462) @@ -235,7 +235,7 @@ smusat_sensor_read(struct smu_sensor *se /* 16.16 */ value <<= 10; /* From 16.16 to 0.1 C */ - value = 10*(value >> 16) + 2732; + value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732; break; case SMU_VOLTAGE_SENSOR: /* 16.16 */ From owner-svn-src-all@FreeBSD.ORG Sun May 29 20:46:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32A60106564A; Sun, 29 May 2011 20:46:54 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22FDD8FC0C; Sun, 29 May 2011 20:46:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TKksi6045884; Sun, 29 May 2011 20:46:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TKksdv045882; Sun, 29 May 2011 20:46:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105292046.p4TKksdv045882@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 20:46:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222463 - head/sys/powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 20:46:54 -0000 Author: nwhitehorn Date: Sun May 29 20:46:53 2011 New Revision: 222463 URL: http://svn.freebsd.org/changeset/base/222463 Log: Add some error handling here: if a sensor returns an error code (a negative Kelvin temperature, which is impossible except for some contrived magnetic spin systems), use the previous measurement from that sensor instead of corrupting everything and randomly changing the fans or shutting off the machine. Modified: head/sys/powerpc/powermac/powermac_thermal.c Modified: head/sys/powerpc/powermac/powermac_thermal.c ============================================================================== --- head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 20:04:02 2011 (r222462) +++ head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 20:46:53 2011 (r222463) @@ -94,13 +94,17 @@ pmac_therm_manage_fans(void) struct pmac_fan_le *fan; int average_excess, max_excess_zone, frac_excess; int nsens, nsens_zone; + int temp; if (!enable_pmac_thermal) return; /* Read all the sensors */ SLIST_FOREACH(sensor, &sensors, entries) { - sensor->last_val = sensor->sensor->read(sensor->sensor); + temp = sensor->sensor->read(sensor->sensor); + if (temp > 0) /* Use the previous temp in case of error */ + sensor->last_val = temp; + if (sensor->last_val > sensor->sensor->max_temp) { printf("WARNING: Current temperature (%s: %d.%d C) " "exceeds critical temperature (%d.%d C)! " From owner-svn-src-all@FreeBSD.ORG Sun May 29 20:55:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B2D6106564A; Sun, 29 May 2011 20:55:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BC258FC0A; Sun, 29 May 2011 20:55:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TKtNhf046237; Sun, 29 May 2011 20:55:23 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TKtNgD046235; Sun, 29 May 2011 20:55:23 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105292055.p4TKtNgD046235@svn.freebsd.org> From: Rick Macklem Date: Sun, 29 May 2011 20:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222464 - head/sys/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 20:55:24 -0000 Author: rmacklem Date: Sun May 29 20:55:23 2011 New Revision: 222464 URL: http://svn.freebsd.org/changeset/base/222464 Log: Add a check for MNTK_UNMOUNTF at the beginning of nfs_sync() in the old NFS client so that a forced dismount doesn't get stuck in the VFS_SYNC() call that happens before VFS_UNMOUNT() in dounmount(). Analagous to r222329 for the new NFS client. An additional change is needed before forced dismounts will work. PR: kern/157365 MFC after: 2 weeks Modified: head/sys/nfsclient/nfs_vfsops.c Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Sun May 29 20:46:53 2011 (r222463) +++ head/sys/nfsclient/nfs_vfsops.c Sun May 29 20:55:23 2011 (r222464) @@ -1408,10 +1408,20 @@ nfs_sync(struct mount *mp, int waitfor) td = curthread; + MNT_ILOCK(mp); + /* + * If a forced dismount is in progress, return from here so that + * the umount(2) syscall doesn't get stuck in VFS_SYNC() before + * calling VFS_UNMOUNT(). + */ + if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + MNT_IUNLOCK(mp); + return (EBADF); + } + /* * Force stale buffer cache information to be flushed. */ - MNT_ILOCK(mp); loop: MNT_VNODE_FOREACH(vp, mp, mvp) { VI_LOCK(vp); From owner-svn-src-all@FreeBSD.ORG Sun May 29 21:03:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A400106566C; Sun, 29 May 2011 21:03:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 794CC8FC13; Sun, 29 May 2011 21:03:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TL3ekG046541; Sun, 29 May 2011 21:03:40 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TL3egv046536; Sun, 29 May 2011 21:03:40 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105292103.p4TL3egv046536@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 May 2011 21:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222465 - in head/usr.sbin: jail jls X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 21:03:40 -0000 Author: bz Date: Sun May 29 21:03:40 2011 New Revision: 222465 URL: http://svn.freebsd.org/changeset/base/222465 Log: Check for IPv4 or IPv6 to be available by the kernel to not provoke errors trying to query options not available. Make it possible to compile out INET or INET6 only parts. Reviewed by: jamie Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 10 days Modified: head/usr.sbin/jail/Makefile head/usr.sbin/jail/jail.c head/usr.sbin/jls/Makefile head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jail/Makefile ============================================================================== --- head/usr.sbin/jail/Makefile Sun May 29 20:55:23 2011 (r222464) +++ head/usr.sbin/jail/Makefile Sun May 29 21:03:40 2011 (r222465) @@ -10,5 +10,8 @@ LDADD= -ljail -lutil .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DINET +.endif .include Modified: head/usr.sbin/jail/jail.c ============================================================================== --- head/usr.sbin/jail/jail.c Sun May 29 20:55:23 2011 (r222464) +++ head/usr.sbin/jail/jail.c Sun May 29 21:03:40 2011 (r222465) @@ -54,12 +54,18 @@ static struct jailparam *params; static char **param_values; static int nparams; -static char *ip4_addr; #ifdef INET6 +static int ip6_ok; static char *ip6_addr; #endif +#ifdef INET +static int ip4_ok; +static char *ip4_addr; +#endif +#if defined(INET6) || defined(INET) static void add_ip_addr(char **addrp, char *newaddr); +#endif #ifdef INET6 static void add_ip_addr46(char *newaddr); #endif @@ -194,6 +200,13 @@ main(int argc, char **argv) if (uflag) GET_USER_INFO; +#ifdef INET6 + ip6_ok = feature_present("inet6"); +#endif +#ifdef INET + ip4_ok = feature_present("inet"); +#endif + if (jailname) set_param("name", jailname); if (securelevel) @@ -207,10 +220,12 @@ main(int argc, char **argv) break; } if (hflag) { +#ifdef INET if (!strncmp(argv[i], "ip4.addr=", 9)) { add_ip_addr(&ip4_addr, argv[i] + 9); break; } +#endif #ifdef INET6 if (!strncmp(argv[i], "ip6.addr=", 9)) { add_ip_addr(&ip6_addr, argv[i] + 9); @@ -231,12 +246,14 @@ main(int argc, char **argv) set_param("host.hostname", argv[1]); if (hflag) add_ip_addrinfo(0, argv[1]); +#if defined(INET6) || defined(INET) if (argv[2][0] != '\0') #ifdef INET6 add_ip_addr46(argv[2]); #else add_ip_addr(&ip4_addr, argv[2]); #endif +#endif cmdarg = 3; /* Emulate the defaults from security.jail.* sysctls */ sysvallen = sizeof(sysval); @@ -259,8 +276,10 @@ main(int argc, char **argv) } } } +#ifdef INET if (ip4_addr != NULL) set_param("ip4.addr", ip4_addr); +#endif #ifdef INET6 if (ip6_addr != NULL) set_param("ip6.addr", ip6_addr); @@ -297,14 +316,19 @@ main(int argc, char **argv) for (i = 0; i < nparams; i++) if (!strcmp(params[i].jp_name, "path")) break; -#ifdef INET6 +#if defined(INET6) && defined(INET) fprintf(fp, "%d\t%s\t%s\t%s%s%s\t%s\n", jid, i < nparams ? (char *)params[i].jp_value : argv[0], argv[1], ip4_addr ? ip4_addr : "", ip4_addr && ip4_addr[0] && ip6_addr && ip6_addr[0] ? "," : "", ip6_addr ? ip6_addr : "", argv[3]); -#else +#elif defined(INET6) + fprintf(fp, "%d\t%s\t%s\t%s\t%s\n", + jid, i < nparams + ? (char *)params[i].jp_value : argv[0], + argv[1], ip6_addr ? ip6_addr : "", argv[3]); +#elif defined(INET) fprintf(fp, "%d\t%s\t%s\t%s\t%s\n", jid, i < nparams ? (char *)params[i].jp_value : argv[0], @@ -348,6 +372,7 @@ main(int argc, char **argv) err(1, "execvp: %s", argv[cmdarg]); } +#if defined(INET6) || defined(INET) static void add_ip_addr(char **addrp, char *value) { @@ -368,6 +393,7 @@ add_ip_addr(char **addrp, char *value) *addrp = addr; } } +#endif #ifdef INET6 static void @@ -391,23 +417,24 @@ static void add_ip_addrinfo(int ai_flags, char *value) { struct addrinfo hints, *ai0, *ai; - struct in_addr addr4; - size_t size; - int error, ip4ok; - int mib[4]; + int error; +#ifdef INET char avalue4[INET_ADDRSTRLEN]; + struct in_addr addr4; +#endif #ifdef INET6 - struct in6_addr addr6; - int ip6ok; char avalue6[INET6_ADDRSTRLEN]; + struct in6_addr addr6; #endif /* Look up the hostname (or get the address) */ memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; -#ifdef INET6 +#if defined(INET6) && defined(INET) hints.ai_family = PF_UNSPEC; -#else +#elif defined(INET6) + hints.ai_family = PF_INET6; +#elif defined(INET) hints.ai_family = PF_INET; #endif hints.ai_flags = ai_flags; @@ -415,32 +442,12 @@ add_ip_addrinfo(int ai_flags, char *valu if (error != 0) errx(1, "hostname %s: %s", value, gai_strerror(error)); - /* - * Silently ignore unsupported address families from DNS lookups. - * But if this is a numeric address, let the kernel give the error. - */ - if (ai_flags & AI_NUMERICHOST) - ip4ok = -#ifdef INET6 - ip6ok = -#endif - 1; - else { - size = 4; - ip4ok = (sysctlnametomib("security.jail.param.ip4", mib, - &size) == 0); -#ifdef INET6 - size = 4; - ip6ok = (sysctlnametomib("security.jail.param.ip6", mib, - &size) == 0); -#endif - } - /* Convert the addresses to ASCII so set_param can convert them back. */ for (ai = ai0; ai; ai = ai->ai_next) switch (ai->ai_family) { +#ifdef INET case AF_INET: - if (!ip4ok) + if (!ip4_ok && (ai_flags & AI_NUMERICHOST) == 0) break; memcpy(&addr4, &((struct sockaddr_in *) (void *)ai->ai_addr)->sin_addr, sizeof(addr4)); @@ -449,9 +456,10 @@ add_ip_addrinfo(int ai_flags, char *valu err(1, "inet_ntop"); add_ip_addr(&ip4_addr, avalue4); break; +#endif #ifdef INET6 case AF_INET6: - if (!ip6ok) + if (!ip6_ok && (ai_flags & AI_NUMERICHOST) == 0) break; memcpy(&addr6, &((struct sockaddr_in6 *) (void *)ai->ai_addr)->sin6_addr, sizeof(addr6)); Modified: head/usr.sbin/jls/Makefile ============================================================================== --- head/usr.sbin/jls/Makefile Sun May 29 20:55:23 2011 (r222464) +++ head/usr.sbin/jls/Makefile Sun May 29 21:03:40 2011 (r222465) @@ -1,8 +1,17 @@ # $FreeBSD$ +.include + PROG= jls MAN= jls.8 DPADD= ${LIBJAIL} LDADD= -ljail +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+= -DINET6 +.endif +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DINET +.endif + .include Modified: head/usr.sbin/jls/jls.c ============================================================================== --- head/usr.sbin/jls/jls.c Sun May 29 20:55:23 2011 (r222464) +++ head/usr.sbin/jls/jls.c Sun May 29 21:03:40 2011 (r222465) @@ -59,6 +59,12 @@ __FBSDID("$FreeBSD$"); static struct jailparam *params; static int *param_parent; static int nparams; +#ifdef INET6 +static int ip6_ok; +#endif +#ifdef INET +static int ip4_ok; +#endif static int add_param(const char *name, void *value, size_t valuelen, struct jailparam *source, unsigned flags); @@ -112,6 +118,13 @@ main(int argc, char **argv) errx(1, "usage: jls [-dhnqv] [-j jail] [param ...]"); } +#ifdef INET6 + ip6_ok = feature_present("inet6"); +#endif +#ifdef INET + ip4_ok = feature_present("inet"); +#endif + /* Add the parameters to print. */ if (optind == argc) { if (pflags & (PRINT_HEADER | PRINT_NAMEVAL)) @@ -124,13 +137,24 @@ main(int argc, char **argv) add_param("name", NULL, (size_t)0, NULL, JP_USER); add_param("dying", NULL, (size_t)0, NULL, JP_USER); add_param("cpuset.id", NULL, (size_t)0, NULL, JP_USER); - add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER); - add_param("ip6.addr", NULL, (size_t)0, NULL, - JP_USER | JP_OPT); +#ifdef INET + if (ip4_ok) + add_param("ip4.addr", NULL, (size_t)0, NULL, + JP_USER); +#endif +#ifdef INET6 + if (ip6_ok) + add_param("ip6.addr", NULL, (size_t)0, NULL, + JP_USER | JP_OPT); +#endif } else { pflags |= PRINT_DEFAULT; add_param("jid", NULL, (size_t)0, NULL, JP_USER); - add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER); +#ifdef INET + if (ip4_ok) + add_param("ip4.addr", NULL, (size_t)0, NULL, + JP_USER); +#endif add_param("host.hostname", NULL, (size_t)0, NULL, JP_USER); add_param("path", NULL, (size_t)0, NULL, JP_USER); @@ -327,7 +351,7 @@ print_jail(int pflags, int jflags) { char *nname; char **param_values; - int i, ai, jid, count, spc; + int i, ai, jid, count, n, spc; char ipbuf[INET6_ADDRSTRLEN]; jid = jailparam_get(params, nparams, jflags); @@ -345,31 +369,45 @@ print_jail(int pflags, int jflags) *(int *)params[4].jp_value ? "DYING" : "ACTIVE", "", *(int *)params[5].jp_value); - count = params[6].jp_valuelen / sizeof(struct in_addr); - for (ai = 0; ai < count; ai++) - if (inet_ntop(AF_INET, - &((struct in_addr *)params[6].jp_value)[ai], - ipbuf, sizeof(ipbuf)) == NULL) - err(1, "inet_ntop"); - else - printf("%6s %-15.15s\n", "", ipbuf); - if (!strcmp(params[7].jp_name, "ip6.addr")) { - count = params[7].jp_valuelen / sizeof(struct in6_addr); + n = 6; +#ifdef INET + if (ip4_ok && !strcmp(params[n].jp_name, "ip.addr")) { + count = params[n].jp_valuelen / sizeof(struct in_addr); + for (ai = 0; ai < count; ai++) + if (inet_ntop(AF_INET, + &((struct in_addr *)params[n].jp_value)[ai], + ipbuf, sizeof(ipbuf)) == NULL) + err(1, "inet_ntop"); + else + printf("%6s %-15.15s\n", "", ipbuf); + n++; + } +#endif +#ifdef INET6 + if (ip6_ok && !strcmp(params[n].jp_name, "ip6.addr")) { + count = params[n].jp_valuelen / sizeof(struct in6_addr); for (ai = 0; ai < count; ai++) if (inet_ntop(AF_INET6, - &((struct in6_addr *)params[7].jp_value)[ai], + &((struct in6_addr *) + params[n].jp_value)[ai], ipbuf, sizeof(ipbuf)) == NULL) err(1, "inet_ntop"); else printf("%6s %s\n", "", ipbuf); + n++; } +#endif } else if (pflags & PRINT_DEFAULT) printf("%6d %-15.15s %-29.29s %.74s\n", *(int *)params[0].jp_value, - params[1].jp_valuelen == 0 ? "-" +#ifdef INET + (!ip4_ok || params[1].jp_valuelen == 0) ? "-" : inet_ntoa(*(struct in_addr *)params[1].jp_value), - (char *)params[2].jp_value, - (char *)params[3].jp_value); +#else + "-" +#endif + (char *)params[2-!ip4_ok].jp_value, + (char *)params[3-!ip4_ok].jp_value); else { param_values = alloca(nparams * sizeof(*param_values)); for (i = 0; i < nparams; i++) { From owner-svn-src-all@FreeBSD.ORG Sun May 29 21:13:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4F86106566B; Sun, 29 May 2011 21:13:53 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B58B78FC16; Sun, 29 May 2011 21:13:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TLDrrH046888; Sun, 29 May 2011 21:13:53 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TLDrA3046886; Sun, 29 May 2011 21:13:53 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105292113.p4TLDrA3046886@svn.freebsd.org> From: Rick Macklem Date: Sun, 29 May 2011 21:13:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 21:13:53 -0000 Author: rmacklem Date: Sun May 29 21:13:53 2011 New Revision: 222466 URL: http://svn.freebsd.org/changeset/base/222466 Log: Modify the umount(8) command so that it doesn't do a sync(2) syscall before unmount(2) for the "-f" case. This avoids a forced dismount from getting stuck for an NFS mountpoint in sync() when the server is not responsive. With this commit, forced dismounts should normally work for the NFS clients, but can take up to about 1minute to complete. PR: kern/157365 Reviewed by: kib MFC after: 2 weeks Modified: head/sbin/umount/umount.c Modified: head/sbin/umount/umount.c ============================================================================== --- head/sbin/umount/umount.c Sun May 29 21:03:40 2011 (r222465) +++ head/sbin/umount/umount.c Sun May 29 21:13:53 2011 (r222466) @@ -90,9 +90,6 @@ main(int argc, char *argv[]) struct statfs *mntbuf, *sfs; struct addrinfo hints; - /* Start disks transferring immediately. */ - sync(); - all = errs = 0; while ((ch = getopt(argc, argv, "AaF:fh:t:v")) != -1) switch (ch) { @@ -127,6 +124,10 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + /* Start disks transferring immediately. */ + if ((fflag & MNT_FORCE) == 0) + sync(); + if ((argc == 0 && !all) || (argc != 0 && all)) usage(); From owner-svn-src-all@FreeBSD.ORG Sun May 29 21:20:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EFA61065675; Sun, 29 May 2011 21:20:48 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FCC08FC14; Sun, 29 May 2011 21:20:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TLKl9W047126; Sun, 29 May 2011 21:20:47 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TLKlTx047124; Sun, 29 May 2011 21:20:47 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201105292120.p4TLKlTx047124@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 29 May 2011 21:20:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222467 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 21:20:48 -0000 Author: trociny Date: Sun May 29 21:20:47 2011 New Revision: 222467 URL: http://svn.freebsd.org/changeset/base/222467 Log: If READ from the local node failed we send the request to the remote node. There is no use in doing this for synchronization requests. Approved by: pjd (mentor) MFC after: 1 week Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Sun May 29 21:13:53 2011 (r222466) +++ head/sbin/hastd/primary.c Sun May 29 21:20:47 2011 (r222467) @@ -1243,7 +1243,7 @@ local_send_thread(void *arg) ggio->gctl_offset + res->hr_localoff); if (ret == ggio->gctl_length) hio->hio_errors[ncomp] = 0; - else { + else if (!ISSYNCREQ(hio)) { /* * If READ failed, try to read from remote node. */ From owner-svn-src-all@FreeBSD.ORG Sun May 29 21:24:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC21C106564A; Sun, 29 May 2011 21:24:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBCAF8FC13; Sun, 29 May 2011 21:24:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TLOKR2047296; Sun, 29 May 2011 21:24:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TLOKiM047291; Sun, 29 May 2011 21:24:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105292124.p4TLOKiM047291@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 May 2011 21:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222468 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 21:24:21 -0000 Author: bz Date: Sun May 29 21:24:20 2011 New Revision: 222468 URL: http://svn.freebsd.org/changeset/base/222468 Log: Split netconfig into three parts: - netconfig - what auto will call which in turn will check for IPv4 and IPv6 to be available and ask the user to configure it by calling - netconfig_ipv4 doing DHCP and static IPv4 addresses, and - netconfig_ipv6 doing rtsol and static IPv6 addresses, and then checking, querying and updating resolv.conf upon return. Both DHCP and rtsol (in the future) might update resolv.conf already so we seed ourselves from that file if available. Reviewed by: nwhitehorn Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Added: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 (contents, props changed) head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 (contents, props changed) Modified: head/usr.sbin/bsdinstall/scripts/Makefile head/usr.sbin/bsdinstall/scripts/netconfig Modified: head/usr.sbin/bsdinstall/scripts/Makefile ============================================================================== --- head/usr.sbin/bsdinstall/scripts/Makefile Sun May 29 21:20:47 2011 (r222467) +++ head/usr.sbin/bsdinstall/scripts/Makefile Sun May 29 21:24:20 2011 (r222468) @@ -1,7 +1,8 @@ # $FreeBSD$ SCRIPTS= auto adduser checksum config hostname jail keymap mirrorselect \ - mount netconfig rootpass services time umount wlanconfig + mount netconfig netconfig_ipv4 netconfig_ipv6 rootpass services \ + time umount wlanconfig BINDIR= /usr/libexec/bsdinstall NO_MAN= true Modified: head/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig Sun May 29 21:20:47 2011 (r222467) +++ head/usr.sbin/bsdinstall/scripts/netconfig Sun May 29 21:24:20 2011 (r222468) @@ -2,6 +2,11 @@ #- # Copyright (c) 2011 Nathan Whitehorn # All rights reserved. +# Copyright (c) 2011 The FreeBSD Foundation +# All rights reserved. +# +# Portions of this software were developed by Bjoern Zeeb +# under sponsorship from the FreeBSD Foundation. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -66,56 +71,124 @@ if ifconfig $INTERFACE | grep -q 'media: INTERFACE="$NEXT_WLAN_IFACE" fi -dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0 -if [ $? -eq $DIALOG_OK ]; then - echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/rc.conf.net - - if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then - dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0 - dhclient $INTERFACE 2>> $BSDINSTALL_LOG - if [ $? -ne 0 ]; then - dialog --backtitle 'FreeBSD Installer' --msgbox "DHCP lease acquisition failed." 0 0 - exec $0 - fi +IPV6_AVAIL=0 +IPV4_AVAIL=0 +sysctl -N kern.features.inet6 > /dev/null 2>&1 +case $? in +0) IPV6_AVAIL=1 ;; +esac +sysctl -N kern.features.inet > /dev/null 2>&1 +case $? in +0) IPV4_AVAIL=1 ;; +esac + +if [ ${IPV4_AVAIL} -eq 1 ]; then + dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --yesno 'Would you like to configure IPv4 for this interface?' 0 0 + if [ $? -eq $DIALOG_OK ]; then + bsdinstall netconfig_ipv4 ${INTERFACE} "${IFCONFIG_PREFIX}" || \ + exec $0 + else + IPV4_AVAIL=0 + fi +fi +# In case wlanconfig left an option and we do not support IPv4 we need to write +# it out on its own. We cannot write it out with IPv6 as that suffix. +if [ ${IPV4_AVAIL} -eq 0 -a -n ${IFCONFIG_PREFIX} ]; then + echo ifconfig_${INTERFACE}=\"${IFCONFIG_PREFIX}\" >> $BSDINSTALL_TMPETC/rc.conf.net +fi +if [ ${IPV6_AVAIL} -eq 1 ]; then + dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --yesno 'Would you like to configure IPv6 for this interface?' 0 0 + if [ $? -eq $DIALOG_OK ]; then + bsdinstall netconfig_ipv6 ${INTERFACE} || exec $0 + else + IPV6_AVAIL=0 fi - exit 0 fi -IP_ADDRESS=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $2); }'` -NETMASK=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $4); }'` -ROUTER=`netstat -rn -f inet | awk '/default/ {printf("%s\n", $2);}'` +SEARCH="" +IP4_1="" +IP4_2="" +IP6_1="" +IP6_2="" +while read key value; do + case "${key}" in + search) SEARCH="${value}" ;; + nameserver) # is more trick as we have to distinguish v4 and v6 + case "${value}" in + [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) + if [ -z "${IP4_1}" ] ; then + IP4_1="${value}" + elif [ -z "${IP4_2}" ]; then + IP4_2="${value}" + fi + ;; + [0-9A-Fa-f:]*:*) + if [ -z "${IP6_1}" ] ; then + IP6_1="${value}" + elif [ -z "${IP6_2}" ]; then + IP6_2="${value}" + fi + ;; + esac + ;; + # ignore others + esac +done < ${BSDINSTALL_TMPETC}/resolv.conf + +RESOLV="" +if [ ${IPV6_AVAIL} -eq 1 -a ${IPV4_AVAIL} -eq 1 ]; then + RESOLV=" + 'Search' 1 0 \"${SEARCH}\" 1 16 50 0 0 + 'Nameserver' 2 0 \"Nameserver\" 2 16 50 0 2 + 'IPv6 DNS #1' 2 0 \"${IP6_1}\" 2 16 50 0 0 + 'IPv6 DNS #2' 3 0 \"${IP6_2}\" 3 16 50 0 0 + 'IPv4 DNS #1' 4 0 \"${IP4_1}\" 4 16 16 0 0 + 'IPv4 DNS #2' 5 0 \"${IP4_2}\" 5 16 16 0 0" +elif [ ${IPV6_AVAIL} -eq 1 ]; then + RESOLV=" + 'Search' 1 0 \"${SEARCH}\" 1 16 50 0 0 + 'Nameserver' 2 0 \"Nameserver\" 2 16 50 0 2 + 'IPv6 DNS #1' 2 0 \"${IP6_1}\" 2 16 50 0 0 + 'IPv6 DNS #2' 3 0 \"${IP6_2}\" 3 16 50 0 0" +elif [ ${IPV4_AVAIL} -eq 1 ]; then + RESOLV=" + 'Search' 1 0 \"${SEARCH}\" 1 16 50 0 0 + 'Nameserver' 2 0 \"Nameserver\" 2 16 50 0 2 + 'IPv4 DNS #1' 2 0 \"${IP4_1}\" 2 16 16 0 0 + 'IPv4 DNS #2' 3 0 \"${IP4_2}\" 3 16 16 0 0" +else + exit 0 +fi exec 3>&1 -IF_CONFIG=$(dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --form 'Static Network Interface Configuration' 0 0 0 \ - 'IP Address' 1 0 "$IP_ADDRESS" 1 20 16 0 \ - 'Subnet Mask' 2 0 "$NETMASK" 2 20 16 0 \ - 'Default Router' 3 0 "$ROUTER" 3 20 16 0 \ - \ - 'Nameserver' 5 0 "" 5 20 16 0 \ - 'Search Domain' 6 0 "" 6 20 20 0 \ +RESOLV=$(echo "${RESOLV}" | xargs dialog --backtitle 'FreeBSD Installer' \ + --title 'Network Configuration' \ + --mixedform 'Resovler Configuration' 0 0 0 \ 2>&1 1>&3) if [ $? -eq $DIALOG_CANCEL ]; then exec $0; fi exec 3>&- -echo $INTERFACE $IF_CONFIG | - awk -v prefix="$IFCONFIG_PREFIX" '{ - printf("ifconfig_%s=\"%s%s netmask %s\"\n", $1, prefix, $2, $3); - printf("defaultrouter=\"%s\"\n", $4); - }' >> $BSDINSTALL_TMPETC/rc.conf.net - -if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then - . $BSDINSTALL_TMPETC/rc.conf.net - ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` - route delete default - route add default $defaultrouter -fi - - -echo $IF_CONFIG | - awk '{ - if ($4 != "") - printf("nameserver %s\n", $4); - if ($5 != "") - printf("search %s\n", $5); - }' > $BSDINSTALL_TMPETC/resolv.conf +echo ${RESOLV} | tr ' ' '\n' | \ +awk ' +BEGIN { + search=1 + printf "search "; +} +{ + if (/^[[:space:]]+$/) { + next; + } + if (/^Nameserver$/) { + printf "\n"; + search=0; + next; + } + if (search > 0) { + printf "%s%s", (search > 1) ? "," : "", $1; + next; + } + printf "nameserver %s\n", $1; +}' > ${BSDINSTALL_TMPETC}/resolv.conf Added: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Sun May 29 21:24:20 2011 (r222468) @@ -0,0 +1,85 @@ +#!/bin/sh +#- +# Copyright (c) 2011 Nathan Whitehorn +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +: ${DIALOG_OK=0} +: ${DIALOG_CANCEL=1} +: ${DIALOG_HELP=2} +: ${DIALOG_EXTRA=3} +: ${DIALOG_ITEM_HELP=4} +: ${DIALOG_ESC=255} + +INTERFACE=$1 +IFCONFIG_PREFIX="$2" +case "${INTERFACE}" in +"") dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --msgbox 'No interface specified for IPv4 configuration.' 0 0 + exit 1 + ;; +esac + +dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0 +if [ $? -eq $DIALOG_OK ]; then + echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/rc.conf.net + + if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then + dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0 + dhclient $INTERFACE 2>> $BSDINSTALL_LOG + if [ $? -ne 0 ]; then + dialog --backtitle 'FreeBSD Installer' --msgbox "DHCP lease acquisition failed." 0 0 + exec $0 ${INTERFACE} "${IFCONFIG_PREFIX}" + fi + fi + exit 0 +fi + +IP_ADDRESS=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $2); }'` +NETMASK=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $4); }'` +ROUTER=`netstat -rn -f inet | awk '/default/ {printf("%s\n", $2);}'` + +exec 3>&1 +IF_CONFIG=$(dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --form 'Static Network Interface Configuration' 0 0 0 \ + 'IP Address' 1 0 "$IP_ADDRESS" 1 20 16 0 \ + 'Subnet Mask' 2 0 "$NETMASK" 2 20 16 0 \ + 'Default Router' 3 0 "$ROUTER" 3 20 16 0 \ +2>&1 1>&3) +if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi +exec 3>&- + +echo $INTERFACE $IF_CONFIG | + awk -v prefix="$IFCONFIG_PREFIX" '{ + printf("ifconfig_%s=\"%s inet %s netmask %s\"\n", $1, prefix, $2, $3); + printf("defaultrouter=\"%s\"\n", $4); + }' >> $BSDINSTALL_TMPETC/rc.conf.net + +if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then + . $BSDINSTALL_TMPETC/rc.conf.net + ifconfig $INTERFACE inet `eval echo \\\$ifconfig_$INTERFACE` + route delete -inet default + route add -inet default $defaultrouter +fi + Added: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Sun May 29 21:24:20 2011 (r222468) @@ -0,0 +1,149 @@ +#!/bin/sh +#- +# Copyright (c) 2011 Nathan Whitehorn +# All rights reserved. +# Copyright (c) 2011 The FreeBSD Foundation +# All rights reserved. +# +# Portions of this software were developed by Bjoern Zeeb +# under sponsorship from the FreeBSD Foundation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +# +# TODO: +# - Add -R /sbin/resolvconf to rtsol once support is in tree. +# - Add DHCPv6 support once FreeBSD ships with it. +# + +: ${DIALOG_OK=0} +: ${DIALOG_CANCEL=1} +: ${DIALOG_HELP=2} +: ${DIALOG_EXTRA=3} +: ${DIALOG_ITEM_HELP=4} +: ${DIALOG_ESC=255} + +INTERFACE=$1 +case "${INTERFACE}" in +"") dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --msgbox 'No interface specified for IPv6 configuration.' 0 0 + exit 1 + ;; +esac + +AGAIN="" +while : ; do + MSG="Would you like to try stateless address autoconfiguration (SLAAC)${AGAIN}?" + dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --yesno "${MSG}" 0 0 + if [ $? -eq $DIALOG_OK ]; then + if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then + dialog --backtitle 'FreeBSD Installer' \ + --infobox "Sending Router Solicitation ..." 0 0 + ifconfig ${INTERFACE} inet6 accept_rtadv up + rtsol -F $INTERFACE 2>> $BSDINSTALL_LOG + if [ $? -ne 0 ]; then + dialog --backtitle 'FreeBSD Installer' --msgbox "SLAAC failed." 0 0 + AGAIN=" again" + continue + fi + fi + echo ifconfig_${INTERFACE}_ipv6=\"accept_rtadv\" >> $BSDINSTALL_TMPETC/rc.conf.net + exit 0 + else + break + fi +done + +ROUTER6=`netstat -Wrn -f inet6 | awk '/default/ {printf("%s\n", $2);}'` +ADDRS=`ifconfig ${INTERFACE} inet6 | \ +awk -v dfr="${ROUTER6}" ' +BEGIN { + n=0; +} +{ + if (/inet6/) { + if (match($2, "^fe80:")) { next; }; + # For the moment ignore all but the first address; it might confuse the user. + if (n > 0) { next; }; + n++; + printf "\"IPv6 Address\" %d 0 \"%s/%s\" %d 16 50 0 0 ", n, $2, $4, n; + } +} +END { + if (n == 0) { + n++; + printf "\"IPv6 Address\" %d 0 \"\" %d 16 50 0 0 ", n, n; + } + n++; + # Nasty trick adding a (hidden, same y) read-only field as a marker + # to separate interface address(es) from the default router. + printf "\"Default Router\" %d 0 \"%s\" %d 16 50 0 2 ", n, "DefaultRouter", n; + printf "\"Default Router\" %d 0 \"%s\" %d 16 50 0 0 ", n, dfr, n; +}'` + +exec 3>&1 +IF_CONFIG=$(echo ${ADDRS} | xargs dialog --backtitle 'FreeBSD Installer' \ + --title 'Network Configuration' \ + --mixedform 'Static IPv6 Network Interface Configuration' 0 0 0 \ +2>&1 1>&3) +if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi +exec 3>&- + +echo ${IF_CONFIG} | tr ' ' '\n' | \ +awk -v iface="${INTERFACE}" ' +BEGIN { + dfr=0; + count=0; +} +{ + if (/^[[:space:]]+$/) { + next; + } + if (/DefaultRouter/) { + dfr=1; + next; + } + if (dfr == 1) { + printf("ipv6_defaultrouter=\"%s\"\n", $1); + next; + } + if (count > 0) { + # Ignore all but the first IP address for now. + next; + } + count++; + if (!match($1, "/")) { + sub("$", "/64", $1); + } + printf("ifconfig_%s_ipv6=\"inet6 %s\"\n", iface, $1); +}' >> $BSDINSTALL_TMPETC/rc.conf.net + +if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then + . $BSDINSTALL_TMPETC/rc.conf.net + ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6` + route delete default + route add default ${ipv6_defaultrouter} +fi + From owner-svn-src-all@FreeBSD.ORG Sun May 29 22:37:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23749106566C; Sun, 29 May 2011 22:37:24 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13AEF8FC14; Sun, 29 May 2011 22:37:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TMbNGX049482; Sun, 29 May 2011 22:37:23 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TMbNRT049480; Sun, 29 May 2011 22:37:23 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105292237.p4TMbNRT049480@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 22:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222469 - head/sys/powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 22:37:24 -0000 Author: nwhitehorn Date: Sun May 29 22:37:23 2011 New Revision: 222469 URL: http://svn.freebsd.org/changeset/base/222469 Log: Use kproc_exit() instead of returning from the management function on systems with no manageable thermal control devices. Modified: head/sys/powerpc/powermac/powermac_thermal.c Modified: head/sys/powerpc/powermac/powermac_thermal.c ============================================================================== --- head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 21:24:20 2011 (r222468) +++ head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 22:37:23 2011 (r222469) @@ -79,7 +79,7 @@ fan_management_proc(void) { /* Nothing to manage? */ if (SLIST_EMPTY(&fans)) - return; + kproc_exit(0); while (1) { pmac_therm_manage_fans(); From owner-svn-src-all@FreeBSD.ORG Sun May 29 23:24:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D36AD1065672; Sun, 29 May 2011 23:24:57 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (pancho.soaustin.net [76.74.250.40]) by mx1.freebsd.org (Postfix) with ESMTP id B4F2D8FC14; Sun, 29 May 2011 23:24:57 +0000 (UTC) Received: by mail.soaustin.net (Postfix, from userid 502) id 071DB56205; Sun, 29 May 2011 18:24:57 -0500 (CDT) Date: Sun, 29 May 2011 18:24:56 -0500 From: Mark Linimon To: Nathan Whitehorn Message-ID: <20110529232456.GA7446@lonesome.com> References: <201105292046.p4TKksdv045882@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201105292046.p4TKksdv045882@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222463 - head/sys/powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 23:24:57 -0000 On Sun, May 29, 2011 at 08:46:54PM +0000, Nathan Whitehorn wrote: > Add some error handling here: if a sensor returns an error code (a negative > Kelvin temperature, which is impossible except for some contrived magnetic > spin systems), use the previous measurement from that sensor instead of > corrupting everything and randomly changing the fans or shutting off the > machine. I believe this wins "commit message of the month". mcl From owner-svn-src-all@FreeBSD.ORG Mon May 30 04:23:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 876F91065670; Mon, 30 May 2011 04:23:34 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DD1D8FC14; Mon, 30 May 2011 04:23:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U4NYM3059892; Mon, 30 May 2011 04:23:34 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U4NYYq059888; Mon, 30 May 2011 04:23:34 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201105300423.p4U4NYYq059888@svn.freebsd.org> From: Julian Elischer Date: Mon, 30 May 2011 04:23:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222472 - in head/sys/boot: ia64/common powerpc/ps3 sparc64/loader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 04:23:34 -0000 Author: julian Date: Mon May 30 04:23:33 2011 New Revision: 222472 URL: http://svn.freebsd.org/changeset/base/222472 Log: Include forgotten framework changes to get some of the new menu files installed correctly on non x86/amd systems. pointy-hut to devin Modified: head/sys/boot/ia64/common/Makefile head/sys/boot/powerpc/ps3/Makefile head/sys/boot/sparc64/loader/Makefile Modified: head/sys/boot/ia64/common/Makefile ============================================================================== --- head/sys/boot/ia64/common/Makefile Mon May 30 02:41:04 2011 (r222471) +++ head/sys/boot/ia64/common/Makefile Mon May 30 04:23:33 2011 (r222472) @@ -33,6 +33,7 @@ loader.help: help.common .PATH: ${.CURDIR}/../../forth FILES+= loader.4th support.4th loader.conf +FILES+= screen.4th frames.4th FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th .if !exists(${DESTDIR}/boot/loader.rc) Modified: head/sys/boot/powerpc/ps3/Makefile ============================================================================== --- head/sys/boot/powerpc/ps3/Makefile Mon May 30 02:41:04 2011 (r222471) +++ head/sys/boot/powerpc/ps3/Makefile Mon May 30 04:23:33 2011 (r222472) @@ -113,8 +113,9 @@ loader.help: help.common help.ps3 .PATH: ${.CURDIR}/../../forth FILES= loader.help loader.4th support.4th loader.conf +FILES+= screen.4th frames.4th FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th -FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th +FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th FILESDIR_loader.conf= /boot/defaults .if !exists(${DESTDIR}/boot/loader.rc) Modified: head/sys/boot/sparc64/loader/Makefile ============================================================================== --- head/sys/boot/sparc64/loader/Makefile Mon May 30 02:41:04 2011 (r222471) +++ head/sys/boot/sparc64/loader/Makefile Mon May 30 04:23:33 2011 (r222472) @@ -84,8 +84,9 @@ loader.help: help.common help.sparc64 .PATH: ${.CURDIR}/../../forth FILES= loader.help loader.4th support.4th loader.conf +FILES+= screen.4th frames.4th FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th -FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th +FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th FILESDIR_loader.conf= /boot/defaults .if !exists(${DESTDIR}/boot/loader.rc) From owner-svn-src-all@FreeBSD.ORG Mon May 30 05:37:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C47CB106564A; Mon, 30 May 2011 05:37:26 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAE578FC12; Mon, 30 May 2011 05:37:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U5bQ00062108; Mon, 30 May 2011 05:37:26 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U5bQJA062103; Mon, 30 May 2011 05:37:26 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105300537.p4U5bQJA062103@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 30 May 2011 05:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222473 - in head: sbin/ipfw sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 05:37:27 -0000 Author: ae Date: Mon May 30 05:37:26 2011 New Revision: 222473 URL: http://svn.freebsd.org/changeset/base/222473 Log: Add tablearg support for ipfw setfib. PR: kern/156410 MFC after: 2 weeks Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_sockopt.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon May 30 04:23:33 2011 (r222472) +++ head/sbin/ipfw/ipfw.8 Mon May 30 05:37:26 2011 (r222473) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 27, 2010 +.Dd May 30, 2011 .Dt IPFW 8 .Os .Sh NAME @@ -871,13 +871,16 @@ for more information on and .Cm ngtee actions. -.It Cm setfib Ar fibnum +.It Cm setfib Ar fibnum | tablearg The packet is tagged so as to use the FIB (routing table) .Ar fibnum in any subsequent forwarding decisions. Initially this is limited to the values 0 through 15, see .Xr setfib 1 . Processing continues at the next rule. +It is possible to use the +.Cm tablearg +keyword with a setfib. If tablearg value is not within compiled FIB range packet fib is set to 0. .It Cm reass Queue and reassemble ip fragments. If the packet is not fragmented, counters are updated and processing continues with the next rule. @@ -1711,7 +1714,7 @@ is used. The .Cm tablearg argument can be used with the following actions: -.Cm nat, pipe , queue, divert, tee, netgraph, ngtee, fwd, skipto +.Cm nat, pipe , queue, divert, tee, netgraph, ngtee, fwd, skipto, setfib, action parameters: .Cm tag, untag, rule options: Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon May 30 04:23:33 2011 (r222472) +++ head/sbin/ipfw/ipfw2.c Mon May 30 05:37:26 2011 (r222473) @@ -2835,14 +2835,19 @@ chkarg: size_t intsize = sizeof(int); action->opcode = O_SETFIB; - NEED1("missing fib number"); - action->arg1 = strtoul(*av, NULL, 10); - if (sysctlbyname("net.fibs", &numfibs, &intsize, NULL, 0) == -1) - errx(EX_DATAERR, "fibs not suported.\n"); - if (action->arg1 >= numfibs) /* Temporary */ - errx(EX_DATAERR, "fib too large.\n"); - av++; - break; + NEED1("missing fib number"); + if (_substrcmp(*av, "tablearg") == 0) { + action->arg1 = IP_FW_TABLEARG; + } else { + action->arg1 = strtoul(*av, NULL, 10); + if (sysctlbyname("net.fibs", &numfibs, &intsize, + NULL, 0) == -1) + errx(EX_DATAERR, "fibs not suported.\n"); + if (action->arg1 >= numfibs) /* Temporary */ + errx(EX_DATAERR, "fib too large.\n"); + } + av++; + break; } case TOK_REASS: Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Mon May 30 04:23:33 2011 (r222472) +++ head/sys/netinet/ipfw/ip_fw2.c Mon May 30 05:37:26 2011 (r222473) @@ -2137,14 +2137,21 @@ do { \ done = 1; /* exit outer loop */ break; - case O_SETFIB: + case O_SETFIB: { + uint32_t fib; + f->pcnt++; /* update stats */ f->bcnt += pktlen; f->timestamp = time_uptime; - M_SETFIB(m, cmd->arg1); - args->f_id.fib = cmd->arg1; + fib = (cmd->arg1 == IP_FW_TABLEARG) ? tablearg: + cmd->arg1; + if (fib >= rt_numfibs) + fib = 0; + M_SETFIB(m, fib); + args->f_id.fib = fib; l = 0; /* exit inner loop */ break; + } case O_NAT: if (!IPFW_NAT_LOADED) { Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_sockopt.c Mon May 30 04:23:33 2011 (r222472) +++ head/sys/netinet/ipfw/ip_fw_sockopt.c Mon May 30 05:37:26 2011 (r222473) @@ -606,7 +606,7 @@ check_ipfw_struct(struct ip_fw *rule, in case O_SETFIB: if (cmdlen != F_INSN_SIZE(ipfw_insn)) goto bad_size; - if (cmd->arg1 >= rt_numfibs) { + if ((cmd->arg1 != IP_FW_TABLEARG) && (cmd->arg1 >= rt_numfibs)) { printf("ipfw: invalid fib number %d\n", cmd->arg1); return EINVAL; From owner-svn-src-all@FreeBSD.ORG Mon May 30 05:53:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C68E1065672; Mon, 30 May 2011 05:53:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D47438FC14; Mon, 30 May 2011 05:53:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U5r0Tj062595; Mon, 30 May 2011 05:53:00 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U5r0SE062593; Mon, 30 May 2011 05:53:00 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105300553.p4U5r0SE062593@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 30 May 2011 05:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222474 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 05:53:01 -0000 Author: ae Date: Mon May 30 05:53:00 2011 New Revision: 222474 URL: http://svn.freebsd.org/changeset/base/222474 Log: Wrap long line. MFC after: 2 weeks Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_sockopt.c Mon May 30 05:37:26 2011 (r222473) +++ head/sys/netinet/ipfw/ip_fw_sockopt.c Mon May 30 05:53:00 2011 (r222474) @@ -606,7 +606,8 @@ check_ipfw_struct(struct ip_fw *rule, in case O_SETFIB: if (cmdlen != F_INSN_SIZE(ipfw_insn)) goto bad_size; - if ((cmd->arg1 != IP_FW_TABLEARG) && (cmd->arg1 >= rt_numfibs)) { + if ((cmd->arg1 != IP_FW_TABLEARG) && + (cmd->arg1 >= rt_numfibs)) { printf("ipfw: invalid fib number %d\n", cmd->arg1); return EINVAL; From owner-svn-src-all@FreeBSD.ORG Mon May 30 06:23:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D02E11065672; Mon, 30 May 2011 06:23:51 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B61818FC19; Mon, 30 May 2011 06:23:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U6Npmq063537; Mon, 30 May 2011 06:23:51 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U6NpAp063533; Mon, 30 May 2011 06:23:51 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201105300623.p4U6NpAp063533@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 30 May 2011 06:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222475 - in head/sys/dev: mmc sdhci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 06:23:51 -0000 Author: jchandra Date: Mon May 30 06:23:51 2011 New Revision: 222475 URL: http://svn.freebsd.org/changeset/base/222475 Log: Fix read_ivar implementation for MMC and SD. 1. Both mmc_read_ivar() and sdhci_read_ivar() use the expression '*(int *)result = val' to assign to result which is uintptr_t *. This does not work on big-endian 64 bit systems. 2. The media_size ivar is declared as 'off_t' which does not fit into uintptr_t in 32bit systems, change this to long. Submitted by: kanthms at netlogicmicro com (initial version) Modified: head/sys/dev/mmc/mmc.c head/sys/dev/mmc/mmcvar.h head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Mon May 30 05:53:00 2011 (r222474) +++ head/sys/dev/mmc/mmc.c Mon May 30 06:23:51 2011 (r222475) @@ -1445,37 +1445,37 @@ mmc_read_ivar(device_t bus, device_t chi default: return (EINVAL); case MMC_IVAR_DSR_IMP: - *(int *)result = ivar->csd.dsr_imp; + *result = ivar->csd.dsr_imp; break; case MMC_IVAR_MEDIA_SIZE: - *(off_t *)result = ivar->sec_count; + *result = ivar->sec_count; break; case MMC_IVAR_RCA: - *(int *)result = ivar->rca; + *result = ivar->rca; break; case MMC_IVAR_SECTOR_SIZE: - *(int *)result = MMC_SECTOR_SIZE; + *result = MMC_SECTOR_SIZE; break; case MMC_IVAR_TRAN_SPEED: - *(int *)result = mmcbr_get_clock(bus); + *result = mmcbr_get_clock(bus); break; case MMC_IVAR_READ_ONLY: - *(int *)result = ivar->read_only; + *result = ivar->read_only; break; case MMC_IVAR_HIGH_CAP: - *(int *)result = ivar->high_cap; + *result = ivar->high_cap; break; case MMC_IVAR_CARD_TYPE: - *(int *)result = ivar->mode; + *result = ivar->mode; break; case MMC_IVAR_BUS_WIDTH: - *(int *)result = ivar->bus_width; + *result = ivar->bus_width; break; case MMC_IVAR_ERASE_SECTOR: - *(int *)result = ivar->erase_sector; + *result = ivar->erase_sector; break; case MMC_IVAR_MAX_DATA: - *(int *)result = mmcbr_get_max_data(bus); + *result = mmcbr_get_max_data(bus); break; } return (0); Modified: head/sys/dev/mmc/mmcvar.h ============================================================================== --- head/sys/dev/mmc/mmcvar.h Mon May 30 05:53:00 2011 (r222474) +++ head/sys/dev/mmc/mmcvar.h Mon May 30 06:23:51 2011 (r222475) @@ -79,7 +79,7 @@ enum mmc_device_ivars { __BUS_ACCESSOR(mmc, var, MMC, ivar, type) MMC_ACCESSOR(dsr_imp, DSR_IMP, int) -MMC_ACCESSOR(media_size, MEDIA_SIZE, off_t) +MMC_ACCESSOR(media_size, MEDIA_SIZE, long) MMC_ACCESSOR(rca, RCA, int) MMC_ACCESSOR(sector_size, SECTOR_SIZE, int) MMC_ACCESSOR(tran_speed, TRAN_SPEED, int) Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Mon May 30 05:53:00 2011 (r222474) +++ head/sys/dev/sdhci/sdhci.c Mon May 30 06:23:51 2011 (r222475) @@ -1443,46 +1443,46 @@ sdhci_read_ivar(device_t bus, device_t c default: return (EINVAL); case MMCBR_IVAR_BUS_MODE: - *(int *)result = slot->host.ios.bus_mode; + *result = slot->host.ios.bus_mode; break; case MMCBR_IVAR_BUS_WIDTH: - *(int *)result = slot->host.ios.bus_width; + *result = slot->host.ios.bus_width; break; case MMCBR_IVAR_CHIP_SELECT: - *(int *)result = slot->host.ios.chip_select; + *result = slot->host.ios.chip_select; break; case MMCBR_IVAR_CLOCK: - *(int *)result = slot->host.ios.clock; + *result = slot->host.ios.clock; break; case MMCBR_IVAR_F_MIN: - *(int *)result = slot->host.f_min; + *result = slot->host.f_min; break; case MMCBR_IVAR_F_MAX: - *(int *)result = slot->host.f_max; + *result = slot->host.f_max; break; case MMCBR_IVAR_HOST_OCR: - *(int *)result = slot->host.host_ocr; + *result = slot->host.host_ocr; break; case MMCBR_IVAR_MODE: - *(int *)result = slot->host.mode; + *result = slot->host.mode; break; case MMCBR_IVAR_OCR: - *(int *)result = slot->host.ocr; + *result = slot->host.ocr; break; case MMCBR_IVAR_POWER_MODE: - *(int *)result = slot->host.ios.power_mode; + *result = slot->host.ios.power_mode; break; case MMCBR_IVAR_VDD: - *(int *)result = slot->host.ios.vdd; + *result = slot->host.ios.vdd; break; case MMCBR_IVAR_CAPS: - *(int *)result = slot->host.caps; + *result = slot->host.caps; break; case MMCBR_IVAR_TIMING: - *(int *)result = slot->host.ios.timing; + *result = slot->host.ios.timing; break; case MMCBR_IVAR_MAX_DATA: - *(int *)result = 65535; + *result = 65535; break; } return (0); From owner-svn-src-all@FreeBSD.ORG Mon May 30 07:21:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86C31106566B; Mon, 30 May 2011 07:21:35 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 30F218FC0A; Mon, 30 May 2011 07:21:34 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 4C02E45EB2; Mon, 30 May 2011 09:21:33 +0200 (CEST) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 9EB7545684; Mon, 30 May 2011 09:21:27 +0200 (CEST) Date: Mon, 30 May 2011 09:20:56 +0200 From: Pawel Jakub Dawidek To: "Bjoern A. Zeeb" Message-ID: <20110530072056.GK2114@garage.freebsd.pl> References: <201105292103.p4TL3egv046536@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2fjX3cMESU3XgGmZ" Content-Disposition: inline In-Reply-To: <201105292103.p4TL3egv046536@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222465 - in head/usr.sbin: jail jls X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 07:21:35 -0000 --2fjX3cMESU3XgGmZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, May 29, 2011 at 09:03:40PM +0000, Bjoern A. Zeeb wrote: > Author: bz > Date: Sun May 29 21:03:40 2011 > New Revision: 222465 > URL: http://svn.freebsd.org/changeset/base/222465 >=20 > Log: > Check for IPv4 or IPv6 to be available by the kernel to not > provoke errors trying to query options not available. > Make it possible to compile out INET or INET6 only parts. That's interesting. When adding IPv6 support to HAST I was thinking about making IPv4/IPv6 support compile options. But after discussing this with various folks I decided to always compile IPv4 and IPv6 support in for userland tools and detect what is supported by the kernel at runtime. This way it is easy to just recompile the kernel to add/remove IPv4/IPv6 support and userland tools may stay unmodified. Do we have some general recommendation within FreeBSD how to handle this in userland? (ie. at compile-time or at run-time) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --2fjX3cMESU3XgGmZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk3jRVcACgkQForvXbEpPzS4jwCg7gkLPvTXNAyLqk/RtRUIUDyh CkAAn26pAw7SxO3nxPDNFTN4YrjU8kcd =+jfq -----END PGP SIGNATURE----- --2fjX3cMESU3XgGmZ-- From owner-svn-src-all@FreeBSD.ORG Mon May 30 07:52:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 704C6106564A; Mon, 30 May 2011 07:52:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 1F0A58FC0A; Mon, 30 May 2011 07:52:29 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 0A26725D385D; Mon, 30 May 2011 07:52:27 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 3793315A097A; Mon, 30 May 2011 07:52:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id uc4MUdHnCBfR; Mon, 30 May 2011 07:52:26 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id DEC9715A095A; Mon, 30 May 2011 07:52:25 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <20110530072056.GK2114@garage.freebsd.pl> Date: Mon, 30 May 2011 07:52:24 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <1E64D441-B1DD-4535-BA36-BE89DBEF06F2@FreeBSD.org> References: <201105292103.p4TL3egv046536@svn.freebsd.org> <20110530072056.GK2114@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222465 - in head/usr.sbin: jail jls X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 07:52:29 -0000 On May 30, 2011, at 7:20 AM, Pawel Jakub Dawidek wrote: > On Sun, May 29, 2011 at 09:03:40PM +0000, Bjoern A. Zeeb wrote: >> Author: bz >> Date: Sun May 29 21:03:40 2011 >> New Revision: 222465 >> URL: http://svn.freebsd.org/changeset/base/222465 >>=20 >> Log: >> Check for IPv4 or IPv6 to be available by the kernel to not >> provoke errors trying to query options not available. >> Make it possible to compile out INET or INET6 only parts. >=20 > That's interesting. When adding IPv6 support to HAST I was thinking > about making IPv4/IPv6 support compile options. But after discussing > this with various folks I decided to always compile IPv4 and IPv6 > support in for userland tools and detect what is supported by the = kernel > at runtime. This way it is easy to just recompile the kernel to > add/remove IPv4/IPv6 support and userland tools may stay unmodified. >=20 > Do we have some general recommendation within FreeBSD how to handle = this > in userland? (ie. at compile-time or at run-time) The code by default still compiles for dual-stack usage and dynamically detects available address families now avoiding errors. The problem before was that on an IPv6-only kernel you get an error, = which prevents the classic jls command from working: # jls=20 jls: unknown parameter: ip4.addr Now that works, skipping the unavailable option without erroring. The = problem here is historical as jails in the early days had the single one = mandatory IPv4 address, which now no longer is mandatory or might not even be possible = to use.=20 In addition to dynamic detection it allows people to reduce the size of = the binary using src.conf like we have supported for compiling out INET6 for = ages for various user space binaries, just that we can compile out one or the = other now. While possibly less interesting for jail/jls there are still = people building images for very tiny RAM and disk - say very cheap IPv6 only sensor = networks with tens of thousands of nodes and for them every byte might still = matter, Compiling out will also force an address family even on a dual stack = kernel. So having a mix of src.conf options and feature_present(3) gives the = full flexibility for everyone. Bjoern --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-all@FreeBSD.ORG Mon May 30 07:58:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A4911065670; Mon, 30 May 2011 07:58:49 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A0D68FC18; Mon, 30 May 2011 07:58:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U7wnW3066494; Mon, 30 May 2011 07:58:49 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U7wnoV066492; Mon, 30 May 2011 07:58:49 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105300758.p4U7wnoV066492@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 07:58:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222478 - stable/8/share/man/man7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 07:58:49 -0000 Author: bcr (doc committer) Date: Mon May 30 07:58:49 2011 New Revision: 222478 URL: http://svn.freebsd.org/changeset/base/222478 Log: MFC r218699: Document TRYBROKEN in ports(7). PR: docs/153542 Submitted by: Eitan Adler Modified: stable/8/share/man/man7/ports.7 Directory Properties: stable/8/share/man/man7/ (props changed) Modified: stable/8/share/man/man7/ports.7 ============================================================================== --- stable/8/share/man/man7/ports.7 Mon May 30 07:15:33 2011 (r222477) +++ stable/8/share/man/man7/ports.7 Mon May 30 07:58:49 2011 (r222478) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2009 +.Dd February 14, 2009 .Dt PORTS 7 .Os .Sh NAME @@ -477,6 +477,9 @@ Of course, these ports may not work as e what you are doing and are sure about installing a forbidden port, then .Va NO_IGNORE lets you do it. +.It Va TRYBROKEN +If defined, attempt to build a port even if it is marked as +.Aq Va BROKEN . .It Va PORT_DBDIR Directory where the results of configuring .Va OPTIONS From owner-svn-src-all@FreeBSD.ORG Mon May 30 08:00:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D35921065675; Mon, 30 May 2011 08:00:28 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C345F8FC18; Mon, 30 May 2011 08:00:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U80S8a066610; Mon, 30 May 2011 08:00:28 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U80Si7066608; Mon, 30 May 2011 08:00:28 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105300800.p4U80Si7066608@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 08:00:28 +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: r222479 - stable/7/share/man/man7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:00:28 -0000 Author: bcr (doc committer) Date: Mon May 30 08:00:28 2011 New Revision: 222479 URL: http://svn.freebsd.org/changeset/base/222479 Log: MFC r218699: Document TRYBROKEN in ports(7). PR: docs/153542 Submitted by: Eitan Adler Modified: stable/7/share/man/man7/ports.7 Directory Properties: stable/7/share/man/man7/ (props changed) Modified: stable/7/share/man/man7/ports.7 ============================================================================== --- stable/7/share/man/man7/ports.7 Mon May 30 07:58:49 2011 (r222478) +++ stable/7/share/man/man7/ports.7 Mon May 30 08:00:28 2011 (r222479) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2009 +.Dd February 14, 2009 .Dt PORTS 7 .Os .Sh NAME @@ -477,6 +477,9 @@ Of course, these ports may not work as e what you are doing and are sure about installing a forbidden port, then .Va NO_IGNORE lets you do it. +.It Va TRYBROKEN +If defined, attempt to build a port even if it is marked as +.Aq Va BROKEN . .It Va PORT_DBDIR Directory where the results of configuring .Va OPTIONS From owner-svn-src-all@FreeBSD.ORG Mon May 30 08:04:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D15D9106566B; Mon, 30 May 2011 08:04:47 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C16578FC08; Mon, 30 May 2011 08:04:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U84lgv066791; Mon, 30 May 2011 08:04:47 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U84lJY066789; Mon, 30 May 2011 08:04:47 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105300804.p4U84lJY066789@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 08:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222480 - stable/8/share/man/man7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:04:47 -0000 Author: bcr (doc committer) Date: Mon May 30 08:04:47 2011 New Revision: 222480 URL: http://svn.freebsd.org/changeset/base/222480 Log: MFC r222278: Add a description to the checksum target about not only being able to verify, but also having the ability to fetch distfiles that are missing or failed the checksum calculation PR: docs/138887 Submitted by: Radim Kolar (hsn at sendmail dot cz) Modified: stable/8/share/man/man7/ports.7 Directory Properties: stable/8/share/man/man7/ (props changed) Modified: stable/8/share/man/man7/ports.7 ============================================================================== --- stable/8/share/man/man7/ports.7 Mon May 30 08:00:28 2011 (r222479) +++ stable/8/share/man/man7/ports.7 Mon May 30 08:04:47 2011 (r222480) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 14, 2009 +.Dd May 25, 2011 .Dt PORTS 7 .Os .Sh NAME @@ -124,6 +124,8 @@ and .It Cm checksum Verify that the fetched distfile's checksum matches the one the port was tested against. +If the distfile's checksum does not match, it also fetches the distfiles +which are missing or failed the checksum calculation. Defining .Va NO_CHECKSUM will skip this step. From owner-svn-src-all@FreeBSD.ORG Mon May 30 08:05:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55268106567A; Mon, 30 May 2011 08:05:28 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44FC98FC08; Mon, 30 May 2011 08:05:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U85SHv066851; Mon, 30 May 2011 08:05:28 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U85SSg066849; Mon, 30 May 2011 08:05:28 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105300805.p4U85SSg066849@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 08:05:28 +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: r222481 - stable/7/share/man/man7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:05:28 -0000 Author: bcr (doc committer) Date: Mon May 30 08:05:27 2011 New Revision: 222481 URL: http://svn.freebsd.org/changeset/base/222481 Log: MFC r222278: Add a description to the checksum target about not only being able to verify, but also having the ability to fetch distfiles that are missing or failed the checksum calculation PR: docs/138887 Submitted by: Radim Kolar (hsn at sendmail dot cz) Modified: stable/7/share/man/man7/ports.7 Directory Properties: stable/7/share/man/man7/ (props changed) Modified: stable/7/share/man/man7/ports.7 ============================================================================== --- stable/7/share/man/man7/ports.7 Mon May 30 08:04:47 2011 (r222480) +++ stable/7/share/man/man7/ports.7 Mon May 30 08:05:27 2011 (r222481) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 14, 2009 +.Dd May 25, 2011 .Dt PORTS 7 .Os .Sh NAME @@ -124,6 +124,8 @@ and .It Cm checksum Verify that the fetched distfile's checksum matches the one the port was tested against. +If the distfile's checksum does not match, it also fetches the distfiles +which are missing or failed the checksum calculation. Defining .Va NO_CHECKSUM will skip this step. From owner-svn-src-all@FreeBSD.ORG Mon May 30 08:40:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97C02106566B; Mon, 30 May 2011 08:40:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 884E88FC21; Mon, 30 May 2011 08:40:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U8ex3k067952; Mon, 30 May 2011 08:40:59 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U8exFB067950; Mon, 30 May 2011 08:40:59 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105300840.p4U8exFB067950@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 30 May 2011 08:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222482 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:40:59 -0000 Author: bz Date: Mon May 30 08:40:59 2011 New Revision: 222482 URL: http://svn.freebsd.org/changeset/base/222482 Log: While doing it right for current configuration, fix the entry for rc.conf adding the missing mandatory "inet6" keyword. Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon May 30 08:05:27 2011 (r222481) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon May 30 08:40:59 2011 (r222482) @@ -69,7 +69,7 @@ while : ; do continue fi fi - echo ifconfig_${INTERFACE}_ipv6=\"accept_rtadv\" >> $BSDINSTALL_TMPETC/rc.conf.net + echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/rc.conf.net exit 0 else break From owner-svn-src-all@FreeBSD.ORG Mon May 30 08:54:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AD30106566B; Mon, 30 May 2011 08:54:33 +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 1AF3F8FC0A; Mon, 30 May 2011 08:54:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U8sW7w068375; Mon, 30 May 2011 08:54:32 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U8sWPW068373; Mon, 30 May 2011 08:54:32 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300854.p4U8sWPW068373@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 08:54:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222483 - head/tools/regression/netinet/tcpconnect X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:54:33 -0000 Author: rwatson Date: Mon May 30 08:54:32 2011 New Revision: 222483 URL: http://svn.freebsd.org/changeset/base/222483 Log: Add missing #include of err.h. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Modified: head/tools/regression/netinet/tcpconnect/tcpconnect.c Modified: head/tools/regression/netinet/tcpconnect/tcpconnect.c ============================================================================== --- head/tools/regression/netinet/tcpconnect/tcpconnect.c Mon May 30 08:40:59 2011 (r222482) +++ head/tools/regression/netinet/tcpconnect/tcpconnect.c Mon May 30 08:54:32 2011 (r222483) @@ -34,6 +34,7 @@ #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Mon May 30 08:54:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 538031065670; Mon, 30 May 2011 08:54:33 +0000 (UTC) Date: Mon, 30 May 2011 08:54:33 +0000 From: Alexey Dokuchaev To: Julian Elischer Message-ID: <20110530085433.GA13988@FreeBSD.org> References: <201105280850.p4S8odjf076440@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201105280850.p4S8odjf076440@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222417 - in head/sys/boot: common forth i386/loader ia64/common pc98/loader powerpc/ofw powerpc/ps3 sparc64/loader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:54:33 -0000 On Sat, May 28, 2011 at 08:50:39AM +0000, Julian Elischer wrote: > Author: julian > Date: Sat May 28 08:50:38 2011 > New Revision: 222417 > URL: http://svn.freebsd.org/changeset/base/222417 > > Log: > New boot loader menus from Devin Teske. > Discussed on hackers and recommended for inclusion into 9.0 at the > devsummit. What about that sexy loader by olli@ [1]? I thought it was also destined for 9.x? Or these two works do not interfere? I've been using it for quite a while, seems pretty stable to me. ./danfe [1] http://wiki.freebsd.org/OliverFromme/BootLoader From owner-svn-src-all@FreeBSD.ORG Mon May 30 09:04:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90907106564A; Mon, 30 May 2011 09:04:36 +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 482C88FC12; Mon, 30 May 2011 09:04:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U94aV6068732; Mon, 30 May 2011 09:04:36 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U94aOF068730; Mon, 30 May 2011 09:04:36 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300904.p4U94aOF068730@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 09:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222484 - head/tools/regression/netinet/tcpdrop X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:04:36 -0000 Author: rwatson Date: Mon May 30 09:04:35 2011 New Revision: 222484 URL: http://svn.freebsd.org/changeset/base/222484 Log: In the tcpdrop regression test, allow the kernel to allocate us a port rather than using a fixed port number. This means that the regression test can be run many times in a row without waiting on TIMEWAIT to release a hard-coded port number. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Modified: head/tools/regression/netinet/tcpdrop/tcpdrop.c Modified: head/tools/regression/netinet/tcpdrop/tcpdrop.c ============================================================================== --- head/tools/regression/netinet/tcpdrop/tcpdrop.c Mon May 30 08:54:32 2011 (r222483) +++ head/tools/regression/netinet/tcpdrop/tcpdrop.c Mon May 30 09:04:35 2011 (r222484) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2006 Robert N. M. Watson + * Copyright (c) 2011 Juniper Networks, Inc. * All rights reserved. * + * Portions of this software were developed by Robert N. M. Watson under + * contract to Juniper Networks, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -46,8 +50,6 @@ #include #include -#define TCP_PORT 9001 - static int tcp_drop(struct sockaddr_in *sin_local, struct sockaddr_in *sin_remote) { @@ -66,41 +68,12 @@ tcp_drop(struct sockaddr_in *sin_local, } static void -tcp_server(pid_t partner) +tcp_server(pid_t partner, int listen_fd) { - int error, listen_fd, accept_fd; - struct sockaddr_in sin; + int error, accept_fd; ssize_t len; char ch; - listen_fd = socket(PF_INET, SOCK_STREAM, 0); - if (listen_fd < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: socket"); - } - - bzero(&sin, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_len = sizeof(sin); - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - sin.sin_port = htons(TCP_PORT); - - if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: bind"); - } - - if (listen(listen_fd, -1) < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: listen"); - } - accept_fd = accept(listen_fd, NULL, NULL); if (accept_fd < 0) { error = errno; @@ -146,7 +119,7 @@ tcp_server(pid_t partner) } static void -tcp_client(pid_t partner) +tcp_client(pid_t partner, u_short port) { struct sockaddr_in sin, sin_local; int error, sock; @@ -168,7 +141,7 @@ tcp_client(pid_t partner) sin.sin_family = AF_INET; sin.sin_len = sizeof(sin); sin.sin_addr.s_addr = ntohl(INADDR_LOOPBACK); - sin.sin_port = htons(TCP_PORT); + sin.sin_port = port; if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) < 0) { error = errno; @@ -230,6 +203,40 @@ int main(int argc, char *argv[]) { pid_t child_pid, parent_pid; + struct sockaddr_in sin; + int listen_fd; + u_short port; + socklen_t len; + + listen_fd = socket(PF_INET, SOCK_STREAM, 0); + if (listen_fd < 0) + err(-1, "socket"); + + /* + * We use the loopback, but let the kernel select a port for the + * server socket. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) + err(-1, "bind"); + + if (listen(listen_fd, -1) < 0) + err(-1, "listen"); + + /* + * Query the port so that the client can use it. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + if (getsockname(listen_fd, (struct sockaddr *)&sin, &len) < 0) + err(-1, "getsockname"); + port = sin.sin_port; + printf("Using port %d\n", ntohs(port)); if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) err(-1, "signal"); @@ -240,9 +247,9 @@ main(int argc, char *argv[]) err(-1, "fork"); if (child_pid == 0) { child_pid = getpid(); - tcp_server(parent_pid); + tcp_server(parent_pid, listen_fd); } else - tcp_client(child_pid); + tcp_client(child_pid, port); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon May 30 09:06:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D64FF1065673; Mon, 30 May 2011 09:06:24 +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 C68098FC19; Mon, 30 May 2011 09:06:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U96ONt068823; Mon, 30 May 2011 09:06:24 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U96OZZ068821; Mon, 30 May 2011 09:06:24 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300906.p4U96OZZ068821@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 09:06:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222485 - head/tools/regression/netinet/tcpfullwindowrst X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:06:24 -0000 Author: rwatson Date: Mon May 30 09:06:24 2011 New Revision: 222485 URL: http://svn.freebsd.org/changeset/base/222485 Log: Add missing include of stdio.h. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Modified: head/tools/regression/netinet/tcpfullwindowrst/tcpfullwindowrsttest.c Modified: head/tools/regression/netinet/tcpfullwindowrst/tcpfullwindowrsttest.c ============================================================================== --- head/tools/regression/netinet/tcpfullwindowrst/tcpfullwindowrsttest.c Mon May 30 09:04:35 2011 (r222484) +++ head/tools/regression/netinet/tcpfullwindowrst/tcpfullwindowrsttest.c Mon May 30 09:06:24 2011 (r222485) @@ -35,6 +35,7 @@ $FreeBSD$ #include #include #include +#include #include #include From owner-svn-src-all@FreeBSD.ORG Mon May 30 09:34:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A46BB106566C; Mon, 30 May 2011 09:34:15 +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 93CBA8FC14; Mon, 30 May 2011 09:34:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U9YF0R069735; Mon, 30 May 2011 09:34:15 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U9YFbh069733; Mon, 30 May 2011 09:34:15 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300934.p4U9YFbh069733@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 09:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222486 - head/tools/regression/netinet/tcpsocktimewait X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:34:15 -0000 Author: rwatson Date: Mon May 30 09:34:15 2011 New Revision: 222486 URL: http://svn.freebsd.org/changeset/base/222486 Log: Rework TIMEWAIT regression test so that kernel-allocated port numbers are used rather than a fixed userspace one, avoiding conflicts between the two test runs. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Modified: head/tools/regression/netinet/tcpsocktimewait/tcpsocktimewait.c Modified: head/tools/regression/netinet/tcpsocktimewait/tcpsocktimewait.c ============================================================================== --- head/tools/regression/netinet/tcpsocktimewait/tcpsocktimewait.c Mon May 30 09:06:24 2011 (r222485) +++ head/tools/regression/netinet/tcpsocktimewait/tcpsocktimewait.c Mon May 30 09:34:15 2011 (r222486) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2006 Robert N. M. Watson + * Copyright (c) 2011 Juniper Networks, Inc. * All rights reserved. * + * Portions of this software were developed by Robert N. M. Watson under + * contract to Juniper Networks, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -41,45 +45,15 @@ #include #include #include +#include #include #include #include -#define TCP_PORT 9001 - static void -tcp_server(pid_t partner) +tcp_server(pid_t partner, int listen_fd) { - int error, listen_fd, accept_fd; - struct sockaddr_in sin; - - listen_fd = socket(PF_INET, SOCK_STREAM, 0); - if (listen_fd < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: socket"); - } - - bzero(&sin, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_len = sizeof(sin); - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - sin.sin_port = htons(TCP_PORT); - - if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: bind"); - } - - if (listen(listen_fd, -1) < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: listen"); - } + int error, accept_fd; accept_fd = accept(listen_fd, NULL, NULL); if (accept_fd < 0) { @@ -93,7 +67,7 @@ tcp_server(pid_t partner) } static void -tcp_client(pid_t partner, int secs) +tcp_client(pid_t partner, u_short port, int secs) { struct sockaddr_in sin; int error, sock; @@ -112,7 +86,7 @@ tcp_client(pid_t partner, int secs) sin.sin_family = AF_INET; sin.sin_len = sizeof(sin); sin.sin_addr.s_addr = ntohl(INADDR_LOOPBACK); - sin.sin_port = htons(TCP_PORT); + sin.sin_port = port; if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) < 0) { error = errno; @@ -135,7 +109,11 @@ tcp_client(pid_t partner, int secs) int main(int argc, char *argv[]) { + struct sockaddr_in sin; pid_t child_pid, parent_pid; + int listen_fd; + socklen_t len; + u_short port; if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) err(-1, "signal"); @@ -144,29 +122,96 @@ main(int argc, char *argv[]) * Run the whole thing twice: once, with a short sleep in the client, * so that we close before time wait runs out, and once with a long * sleep so that the time wait terminates while the socket is open. + * We don't reuse listen sockets between runs. + */ + listen_fd = socket(PF_INET, SOCK_STREAM, 0); + if (listen_fd < 0) + err(-1, "socket"); + + /* + * We use the loopback, but let the kernel select a port for the + * server socket. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) + err(-1, "bind"); + + if (listen(listen_fd, -1) < 0) + err(-1, "listen"); + + /* + * Query the port so that the client can use it. */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + len = sizeof(sin); + if (getsockname(listen_fd, (struct sockaddr *)&sin, &len) < 0) + err(-1, "getsockname"); + port = sin.sin_port; + printf("Using port %d\n", ntohs(port)); + parent_pid = getpid(); child_pid = fork(); if (child_pid < 0) err(-1, "fork"); if (child_pid == 0) { child_pid = getpid(); - tcp_server(child_pid); + tcp_server(child_pid, listen_fd); exit(0); } else - tcp_client(parent_pid, 1); + tcp_client(parent_pid, port, 1); (void)kill(child_pid, SIGTERM); + close(listen_fd); sleep(5); + /* + * Start again, this time long sleep. + */ + listen_fd = socket(PF_INET, SOCK_STREAM, 0); + if (listen_fd < 0) + err(-1, "socket"); + + /* + * We use the loopback, but let the kernel select a port for the + * server socket. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) + err(-1, "bind"); + + if (listen(listen_fd, -1) < 0) + err(-1, "listen"); + + /* + * Query the port so that the client can use it. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + len = sizeof(sin); + if (getsockname(listen_fd, (struct sockaddr *)&sin, &len) < 0) + err(-1, "getsockname"); + port = sin.sin_port; + printf("Using port %d\n", ntohs(port)); + parent_pid = getpid(); child_pid = fork(); if (child_pid < 0) err(-1, "fork"); if (child_pid == 0) { child_pid = getpid(); - tcp_server(parent_pid); + tcp_server(parent_pid, listen_fd); } else - tcp_client(child_pid, 800); + tcp_client(child_pid, port, 800); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon May 30 09:41:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F282106566B; Mon, 30 May 2011 09:41:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FADA8FC13; Mon, 30 May 2011 09:41:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U9fd58069988; Mon, 30 May 2011 09:41:39 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U9fdbL069986; Mon, 30 May 2011 09:41:39 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105300941.p4U9fdbL069986@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 30 May 2011 09:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222487 - head/tools/regression/netinet/udpconnectjail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:41:39 -0000 Author: bz Date: Mon May 30 09:41:38 2011 New Revision: 222487 URL: http://svn.freebsd.org/changeset/base/222487 Log: Upgrade jail(2) to latest jail(2) API to make the regression test work again. Eventually should switch to jail_set(2). Reported by: rwatson MFC after: 10 days Modified: head/tools/regression/netinet/udpconnectjail/udpconnectjail.c Modified: head/tools/regression/netinet/udpconnectjail/udpconnectjail.c ============================================================================== --- head/tools/regression/netinet/udpconnectjail/udpconnectjail.c Mon May 30 09:34:15 2011 (r222486) +++ head/tools/regression/netinet/udpconnectjail/udpconnectjail.c Mon May 30 09:41:38 2011 (r222487) @@ -77,6 +77,7 @@ main(int argc, __unused char *argv[]) { struct sockaddr_in sin; struct jail thejail; + struct in_addr ia4; if (argc != 1) usage(); @@ -94,12 +95,18 @@ main(int argc, __unused char *argv[]) /* * Now re-run in a jail. + * XXX-BZ should switch to jail_set(2). */ + ia4.s_addr = htonl(INADDR_LOOPBACK); + bzero(&thejail, sizeof(thejail)); - thejail.version = 0; + thejail.version = JAIL_API_VERSION; thejail.path = "/"; thejail.hostname = "jail"; - thejail.ip_number = INADDR_LOOPBACK; + thejail.jailname = "udpconnectjail"; + thejail.ip4s = 1; + thejail.ip4 = &ia4; + if (jail(&thejail) < 0) errx(-1, "jail: %s", strerror(errno)); test("in jail", &sin); From owner-svn-src-all@FreeBSD.ORG Mon May 30 09:43:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CD51106566B; Mon, 30 May 2011 09:43:56 +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 0B2BC8FC08; Mon, 30 May 2011 09:43:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U9hu2q070106; Mon, 30 May 2011 09:43:56 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U9htjI070096; Mon, 30 May 2011 09:43:55 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300943.p4U9htjI070096@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 09:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222488 - in head/sys: contrib/pf/net netinet netinet/ipfw netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:43:56 -0000 Author: rwatson Date: Mon May 30 09:43:55 2011 New Revision: 222488 URL: http://svn.freebsd.org/changeset/base/222488 Log: Decompose the current single inpcbinfo lock into two locks: - The existing ipi_lock continues to protect the global inpcb list and inpcb counter. This lock is now relegated to a small number of allocation and free operations, and occasional operations that walk all connections (including, awkwardly, certain UDP multicast receive operations -- something to revisit). - A new ipi_hash_lock protects the two inpcbinfo hash tables for looking up connections and bound sockets, manipulated using new INP_HASH_*() macros. This lock, combined with inpcb locks, protects the 4-tuple address space. Unlike the current ipi_lock, ipi_hash_lock follows the individual inpcb connection locks, so may be acquired while manipulating a connection on which a lock is already held, avoiding the need to acquire the inpcbinfo lock preemptively when a binding change might later be required. As a result, however, lookup operations necessarily go through a reference acquire while holding the lookup lock, later acquiring an inpcb lock -- if required. A new function in_pcblookup() looks up connections, and accepts flags indicating how to return the inpcb. Due to lock order changes, callers no longer need acquire locks before performing a lookup: the lookup routine will acquire the ipi_hash_lock as needed. In the future, it will also be able to use alternative lookup and locking strategies transparently to callers, such as pcbgroup lookup. New lookup flags are, supplementing the existing INPLOOKUP_WILDCARD flag: INPLOOKUP_RLOCKPCB - Acquire a read lock on the returned inpcb INPLOOKUP_WLOCKPCB - Acquire a write lock on the returned inpcb Callers must pass exactly one of these flags (for the time being). Some notes: - All protocols are updated to work within the new regime; especially, TCP, UDPv4, and UDPv6. pcbinfo ipi_lock acquisitions are largely eliminated, and global hash lock hold times are dramatically reduced compared to previous locking. - The TCP syncache still relies on the pcbinfo lock, something that we may want to revisit. - Support for reverting to the FreeBSD 7.x locking strategy in TCP input is no longer available -- hash lookup locks are now held only very briefly during inpcb lookup, rather than for potentially extended periods. However, the pcbinfo ipi_lock will still be acquired if a connection state might change such that a connection is added or removed. - Raw IP sockets continue to use the pcbinfo ipi_lock for protection, due to maintaining their own hash tables. - The interface in6_pcblookup_hash_locked() is maintained, which allows callers to acquire hash locks and perform one or more lookups atomically with 4-tuple allocation: this is required only for TCPv6, as there is no in6_pcbconnect_setup(), which there should be. - UDPv6 locking remains significantly more conservative than UDPv4 locking, which relates to source address selection. This needs attention, as it likely significantly reduces parallelism in this code for multithreaded socket use (such as in BIND). - In the UDPv4 and UDPv6 multicast cases, we need to revisit locking somewhat, as they relied on ipi_lock to stablise 4-tuple matches, which is no longer sufficient. A second check once the inpcb lock is held should do the trick, keeping the general case from requiring the inpcb lock for every inpcb visited. - This work reminds us that we need to revisit locking of the v4/v6 flags, which may be accessed lock-free both before and after this change. - Right now, a single lock name is used for the pcbhash lock -- this is undesirable, and probably another argument is required to take care of this (or a char array name field in the pcbinfo?). This is not an MFC candidate for 8.x due to its impact on lookup and locking semantics. It's possible some of these issues could be worked around with compatibility wrappers, if necessary. Reviewed by: bz Sponsored by: Juniper Networks, Inc. Modified: head/sys/contrib/pf/net/pf.c head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet/ip_divert.c head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/raw_ip.c head/sys/netinet/siftr.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_pcb.h head/sys/netinet6/in6_src.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/contrib/pf/net/pf.c Mon May 30 09:43:55 2011 (r222488) @@ -3034,16 +3034,14 @@ pf_socket_lookup(int direction, struct p #ifdef INET case AF_INET: #ifdef __FreeBSD__ - INP_INFO_RLOCK(pi); /* XXX LOR */ - inp = in_pcblookup_hash(pi, saddr->v4, sport, daddr->v4, - dport, 0, NULL); + inp = in_pcblookup(pi, saddr->v4, sport, daddr->v4, + dport, INPLOOKUP_RLOCKPCB, NULL); if (inp == NULL) { - inp = in_pcblookup_hash(pi, saddr->v4, sport, - daddr->v4, dport, INPLOOKUP_WILDCARD, NULL); - if(inp == NULL) { - INP_INFO_RUNLOCK(pi); + inp = in_pcblookup(pi, saddr->v4, sport, + daddr->v4, dport, INPLOOKUP_WILDCARD | + INPLOOKUP_RLOCKPCB, NULL); + if (inp == NULL) return (-1); - } } #else inp = in_pcbhashlookup(tb, saddr->v4, sport, daddr->v4, dport); @@ -3058,16 +3056,14 @@ pf_socket_lookup(int direction, struct p #ifdef INET6 case AF_INET6: #ifdef __FreeBSD__ - INP_INFO_RLOCK(pi); - inp = in6_pcblookup_hash(pi, &saddr->v6, sport, - &daddr->v6, dport, 0, NULL); + inp = in6_pcblookup(pi, &saddr->v6, sport, + &daddr->v6, dport, INPLOOKUP_RLOCKPCB, NULL); if (inp == NULL) { - inp = in6_pcblookup_hash(pi, &saddr->v6, sport, - &daddr->v6, dport, INPLOOKUP_WILDCARD, NULL); - if (inp == NULL) { - INP_INFO_RUNLOCK(pi); + inp = in6_pcblookup(pi, &saddr->v6, sport, + &daddr->v6, dport, INPLOOKUP_WILDCARD | + INPLOOKUP_RLOCKPCB, NULL); + if (inp == NULL) return (-1); - } } #else inp = in6_pcbhashlookup(tb, &saddr->v6, sport, &daddr->v6, @@ -3085,9 +3081,10 @@ pf_socket_lookup(int direction, struct p return (-1); } #ifdef __FreeBSD__ + INP_RLOCK_ASSERT(inp); pd->lookup.uid = inp->inp_cred->cr_uid; pd->lookup.gid = inp->inp_cred->cr_groups[0]; - INP_INFO_RUNLOCK(pi); + INP_RUNLOCK(inp); #else pd->lookup.uid = inp->inp_socket->so_euid; pd->lookup.gid = inp->inp_socket->so_egid; Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/in_pcb.c Mon May 30 09:43:55 2011 (r222488) @@ -127,6 +127,10 @@ static VNET_DEFINE(int, ipport_tcplastco #define V_ipport_tcplastcount VNET(ipport_tcplastcount) +static struct inpcb *in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, + struct in_addr faddr, u_int fport_arg, + struct in_addr laddr, u_int lport_arg, + int lookupflags, struct ifnet *ifp); static void in_pcbremlists(struct inpcb *inp); #ifdef INET @@ -212,11 +216,13 @@ in_pcbinfo_init(struct inpcbinfo *pcbinf { INP_INFO_LOCK_INIT(pcbinfo, name); + INP_HASH_LOCK_INIT(pcbinfo, "pcbinfohash"); /* XXXRW: argument? */ #ifdef VIMAGE pcbinfo->ipi_vnet = curvnet; #endif pcbinfo->ipi_listhead = listhead; LIST_INIT(pcbinfo->ipi_listhead); + pcbinfo->ipi_count = 0; pcbinfo->ipi_hashbase = hashinit(hash_nelements, M_PCB, &pcbinfo->ipi_hashmask); pcbinfo->ipi_porthashbase = hashinit(porthash_nelements, M_PCB, @@ -234,10 +240,14 @@ void in_pcbinfo_destroy(struct inpcbinfo *pcbinfo) { + KASSERT(pcbinfo->ipi_count == 0, + ("%s: ipi_count = %u", __func__, pcbinfo->ipi_count)); + hashdestroy(pcbinfo->ipi_hashbase, M_PCB, pcbinfo->ipi_hashmask); hashdestroy(pcbinfo->ipi_porthashbase, M_PCB, pcbinfo->ipi_porthashmask); uma_zdestroy(pcbinfo->ipi_zone); + INP_HASH_LOCK_DESTROY(pcbinfo); INP_INFO_LOCK_DESTROY(pcbinfo); } @@ -309,8 +319,8 @@ in_pcbbind(struct inpcb *inp, struct soc { int anonport, error; - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); if (inp->inp_lport != 0 || inp->inp_laddr.s_addr != INADDR_ANY) return (EINVAL); @@ -351,8 +361,8 @@ in_pcb_lport(struct inpcb *inp, struct i * Because no actual state changes occur here, a global write lock on * the pcbinfo isn't required. */ - INP_INFO_LOCK_ASSERT(pcbinfo); INP_LOCK_ASSERT(inp); + INP_HASH_LOCK_ASSERT(pcbinfo); if (inp->inp_flags & INP_HIGHPORT) { first = V_ipport_hifirstauto; /* sysctl */ @@ -473,11 +483,10 @@ in_pcbbind_setup(struct inpcb *inp, stru int error; /* - * Because no actual state changes occur here, a global write lock on - * the pcbinfo isn't required. + * No state changes, so read locks are sufficient here. */ - INP_INFO_LOCK_ASSERT(pcbinfo); INP_LOCK_ASSERT(inp); + INP_HASH_LOCK_ASSERT(pcbinfo); if (TAILQ_EMPTY(&V_in_ifaddrhead)) /* XXX broken! */ return (EADDRNOTAVAIL); @@ -618,8 +627,8 @@ in_pcbconnect(struct inpcb *inp, struct in_addr_t laddr, faddr; int anonport, error; - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); lport = inp->inp_lport; laddr = inp->inp_laddr.s_addr; @@ -907,8 +916,8 @@ in_pcbconnect_setup(struct inpcb *inp, s * Because a global state change doesn't actually occur here, a read * lock is sufficient. */ - INP_INFO_LOCK_ASSERT(inp->inp_pcbinfo); INP_LOCK_ASSERT(inp); + INP_HASH_LOCK_ASSERT(inp->inp_pcbinfo); if (oinpp != NULL) *oinpp = NULL; @@ -983,8 +992,8 @@ in_pcbconnect_setup(struct inpcb *inp, s if (error) return (error); } - oinp = in_pcblookup_hash(inp->inp_pcbinfo, faddr, fport, laddr, lport, - 0, NULL); + oinp = in_pcblookup_hash_locked(inp->inp_pcbinfo, faddr, fport, + laddr, lport, 0, NULL); if (oinp != NULL) { if (oinpp != NULL) *oinpp = oinp; @@ -1007,8 +1016,8 @@ void in_pcbdisconnect(struct inpcb *inp) { - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); inp->inp_faddr.s_addr = INADDR_ANY; inp->inp_fport = 0; @@ -1187,19 +1196,24 @@ void in_pcbdrop(struct inpcb *inp) { - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); + /* + * XXXRW: Possibly we should protect the setting of INP_DROPPED with + * the hash lock...? + */ inp->inp_flags |= INP_DROPPED; if (inp->inp_flags & INP_INHASHLIST) { struct inpcbport *phd = inp->inp_phd; + INP_HASH_WLOCK(inp->inp_pcbinfo); LIST_REMOVE(inp, inp_hash); LIST_REMOVE(inp, inp_portlist); if (LIST_FIRST(&phd->phd_pcblist) == NULL) { LIST_REMOVE(phd, phd_hash); free(phd, M_PCB); } + INP_HASH_WUNLOCK(inp->inp_pcbinfo); inp->inp_flags &= ~INP_INHASHLIST; } } @@ -1328,7 +1342,8 @@ in_pcbpurgeif0(struct inpcbinfo *pcbinfo } /* - * Lookup a PCB based on the local address and port. + * Lookup a PCB based on the local address and port. Caller must hold the + * hash lock. No inpcb locks or references are acquired. */ #define INP_LOOKUP_MAPPED_PCB_COST 3 struct inpcb * @@ -1346,7 +1361,7 @@ in_pcblookup_local(struct inpcbinfo *pcb KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - INP_INFO_LOCK_ASSERT(pcbinfo); + INP_HASH_LOCK_ASSERT(pcbinfo); if ((lookupflags & INPLOOKUP_WILDCARD) == 0) { struct inpcbhead *head; @@ -1450,10 +1465,12 @@ in_pcblookup_local(struct inpcbinfo *pcb #undef INP_LOOKUP_MAPPED_PCB_COST /* - * Lookup PCB in hash list. + * Lookup PCB in hash list, using pcbinfo tables. This variation assumes + * that the caller has locked the hash list, and will not perform any further + * locking or reference operations on either the hash list or the connection. */ -struct inpcb * -in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, +static struct inpcb * +in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport_arg, struct in_addr laddr, u_int lport_arg, int lookupflags, struct ifnet *ifp) { @@ -1464,7 +1481,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbi KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - INP_INFO_LOCK_ASSERT(pcbinfo); + INP_HASH_LOCK_ASSERT(pcbinfo); /* * First look for an exact match. @@ -1574,6 +1591,56 @@ in_pcblookup_hash(struct inpcbinfo *pcbi return (NULL); } + +/* + * Lookup PCB in hash list, using pcbinfo tables. This variation locks the + * hash list lock, and will return the inpcb locked (i.e., requires + * INPLOOKUP_LOCKPCB). + */ +static struct inpcb * +in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, + u_int fport, struct in_addr laddr, u_int lport, int lookupflags, + struct ifnet *ifp) +{ + struct inpcb *inp; + + INP_HASH_RLOCK(pcbinfo); + inp = in_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, + (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); + if (inp != NULL) { + in_pcbref(inp); + INP_HASH_RUNLOCK(pcbinfo); + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else if (lookupflags & INPLOOKUP_RLOCKPCB) { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } else + panic("%s: locking bug", __func__); + } else + INP_HASH_RUNLOCK(pcbinfo); + return (inp); +} + +/* + * Public inpcb lookup routines, accepting a 4-tuple. + */ +struct inpcb * +in_pcblookup(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport, + struct in_addr laddr, u_int lport, int lookupflags, struct ifnet *ifp) +{ + + KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, + ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, + ("%s: LOCKPCB not set", __func__)); + + return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, + lookupflags, ifp)); +} #endif /* INET */ /* @@ -1588,8 +1655,9 @@ in_pcbinshash(struct inpcb *inp) struct inpcbport *phd; u_int32_t hashkey_faddr; - INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(pcbinfo); + KASSERT((inp->inp_flags & INP_INHASHLIST) == 0, ("in_pcbinshash: INP_INHASHLIST")); @@ -1645,8 +1713,9 @@ in_pcbrehash(struct inpcb *inp) struct inpcbhead *head; u_int32_t hashkey_faddr; - INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(pcbinfo); + KASSERT(inp->inp_flags & INP_INHASHLIST, ("in_pcbrehash: !INP_INHASHLIST")); @@ -1679,12 +1748,14 @@ in_pcbremlists(struct inpcb *inp) if (inp->inp_flags & INP_INHASHLIST) { struct inpcbport *phd = inp->inp_phd; + INP_HASH_WLOCK(pcbinfo); LIST_REMOVE(inp, inp_hash); LIST_REMOVE(inp, inp_portlist); if (LIST_FIRST(&phd->phd_pcblist) == NULL) { LIST_REMOVE(phd, phd_hash); free(phd, M_PCB); } + INP_HASH_WUNLOCK(pcbinfo); inp->inp_flags &= ~INP_INHASHLIST; } LIST_REMOVE(inp, inp_list); Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/in_pcb.h Mon May 30 09:43:55 2011 (r222488) @@ -268,22 +268,22 @@ struct inpcbport { * Global data structure for each high-level protocol (UDP, TCP, ...) in both * IPv4 and IPv6. Holds inpcb lists and information for managing them. * - * Each pcbinfo is protected by ipi_lock, covering mutable global fields (such - * as the global pcb list) and hashed lookup tables. The lock order is: + * Each pcbinfo is protected by two locks: ipi_lock and ipi_hash_lock, + * the former covering mutable global fields (such as the global pcb list), + * and the latter covering the hashed lookup tables. The lock order is: * - * ipi_lock (before) inpcb locks + * ipi_lock (before) inpcb locks (before) ipi_hash_lock * * Locking key: * * (c) Constant or nearly constant after initialisation * (g) Locked by ipi_lock - * (h) Read using either ipi_lock or inpcb lock; write requires both. + * (h) Read using either ipi_hash_lock or inpcb lock; write requires both. * (x) Synchronisation properties poorly defined */ struct inpcbinfo { /* - * Global lock protecting global inpcb list, inpcb count, hash tables, - * etc. + * Global lock protecting global inpcb list, inpcb count, etc. */ struct rwlock ipi_lock; @@ -312,17 +312,22 @@ struct inpcbinfo { struct uma_zone *ipi_zone; /* (c) */ /* + * Global lock protecting hash lookup tables. + */ + struct rwlock ipi_hash_lock; + + /* * Global hash of inpcbs, hashed by local and foreign addresses and * port numbers. */ - struct inpcbhead *ipi_hashbase; /* (g) */ - u_long ipi_hashmask; /* (g) */ + struct inpcbhead *ipi_hashbase; /* (h) */ + u_long ipi_hashmask; /* (h) */ /* * Global hash of inpcbs, hashed by only local port number. */ - struct inpcbporthead *ipi_porthashbase; /* (g) */ - u_long ipi_porthashmask; /* (g) */ + struct inpcbporthead *ipi_porthashbase; /* (h) */ + u_long ipi_porthashmask; /* (h) */ /* * Pointer to network stack instance @@ -406,6 +411,18 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_INFO_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_lock, RA_WLOCKED) #define INP_INFO_UNLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_lock, RA_UNLOCKED) +#define INP_HASH_LOCK_INIT(ipi, d) \ + rw_init_flags(&(ipi)->ipi_hash_lock, (d), 0) +#define INP_HASH_LOCK_DESTROY(ipi) rw_destroy(&(ipi)->ipi_hash_lock) +#define INP_HASH_RLOCK(ipi) rw_rlock(&(ipi)->ipi_hash_lock) +#define INP_HASH_WLOCK(ipi) rw_wlock(&(ipi)->ipi_hash_lock) +#define INP_HASH_RUNLOCK(ipi) rw_runlock(&(ipi)->ipi_hash_lock) +#define INP_HASH_WUNLOCK(ipi) rw_wunlock(&(ipi)->ipi_hash_lock) +#define INP_HASH_LOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \ + RA_LOCKED) +#define INP_HASH_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \ + RA_WLOCKED) + #define INP_PCBHASH(faddr, lport, fport, mask) \ (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) #define INP_PCBPORTHASH(lport, mask) \ @@ -466,7 +483,16 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_LLE_VALID 0x00000001 /* cached lle is valid */ #define INP_RT_VALID 0x00000002 /* cached rtentry is valid */ -#define INPLOOKUP_WILDCARD 1 +/* + * Flags passed to in_pcblookup*() functions. + */ +#define INPLOOKUP_WILDCARD 0x00000001 /* Allow wildcard sockets. */ +#define INPLOOKUP_RLOCKPCB 0x00000002 /* Return inpcb read-locked. */ +#define INPLOOKUP_WLOCKPCB 0x00000004 /* Return inpcb write-locked. */ + +#define INPLOOKUP_MASK (INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB | \ + INPLOOKUP_WLOCKPCB) + #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) #define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ @@ -527,7 +553,7 @@ struct inpcb * in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_short, int, struct ucred *); struct inpcb * - in_pcblookup_hash(struct inpcbinfo *, struct in_addr, u_int, + in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, struct in_addr, u_int, int, struct ifnet *); void in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr, int, struct inpcb *(*)(struct inpcb *, int)); Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/ip_divert.c Mon May 30 09:43:55 2011 (r222488) @@ -659,9 +659,9 @@ div_pcblist(SYSCTL_HANDLER_ARGS) INP_INFO_WLOCK(&V_divcbinfo); for (i = 0; i < n; i++) { inp = inp_list[i]; - INP_WLOCK(inp); - if (!in_pcbrele(inp)) - INP_WUNLOCK(inp); + INP_RLOCK(inp); + if (!in_pcbrele_rlocked(inp)) + INP_RUNLOCK(inp); } INP_INFO_WUNLOCK(&V_divcbinfo); Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/ipfw/ip_fw2.c Mon May 30 09:43:55 2011 (r222488) @@ -657,7 +657,7 @@ check_uidgid(ipfw_insn_u32 *insn, int pr (struct bsd_ucred *)uc, ugid_lookupp, ((struct mbuf *)inp)->m_skb); #else /* FreeBSD */ struct inpcbinfo *pi; - int wildcard; + int lookupflags; struct inpcb *pcb; int match; @@ -682,30 +682,31 @@ check_uidgid(ipfw_insn_u32 *insn, int pr if (*ugid_lookupp == -1) return (0); if (proto == IPPROTO_TCP) { - wildcard = 0; + lookupflags = 0; pi = &V_tcbinfo; } else if (proto == IPPROTO_UDP) { - wildcard = INPLOOKUP_WILDCARD; + lookupflags = INPLOOKUP_WILDCARD; pi = &V_udbinfo; } else return 0; + lookupflags |= INPLOOKUP_RLOCKPCB; match = 0; if (*ugid_lookupp == 0) { - INP_INFO_RLOCK(pi); pcb = (oif) ? - in_pcblookup_hash(pi, + in_pcblookup(pi, dst_ip, htons(dst_port), src_ip, htons(src_port), - wildcard, oif) : - in_pcblookup_hash(pi, + lookupflags, oif) : + in_pcblookup(pi, src_ip, htons(src_port), dst_ip, htons(dst_port), - wildcard, NULL); + lookupflags, NULL); if (pcb != NULL) { + INP_RLOCK_ASSERT(pcb); *uc = crhold(pcb->inp_cred); *ugid_lookupp = 1; + INP_RUNLOCK(pcb); } - INP_INFO_RUNLOCK(pi); if (*ugid_lookupp == 0) { /* * We tried and failed, set the variable to -1 @@ -1827,21 +1828,32 @@ do { \ else break; + /* + * XXXRW: so_user_cookie should almost + * certainly be inp_user_cookie? + */ + /* For incomming packet, lookup up the inpcb using the src/dest ip/port tuple */ if (inp == NULL) { - INP_INFO_RLOCK(pi); - inp = in_pcblookup_hash(pi, + inp = in_pcblookup(pi, src_ip, htons(src_port), dst_ip, htons(dst_port), - 0, NULL); - INP_INFO_RUNLOCK(pi); - } - - if (inp && inp->inp_socket) { - tablearg = inp->inp_socket->so_user_cookie; - if (tablearg) - match = 1; + INPLOOKUP_RLOCKPCB, NULL); + if (inp != NULL) { + tablearg = + inp->inp_socket->so_user_cookie; + if (tablearg) + match = 1; + INP_RUNLOCK(inp); + } + } else { + if (inp->inp_socket) { + tablearg = + inp->inp_socket->so_user_cookie; + if (tablearg) + match = 1; + } } break; } Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/raw_ip.c Mon May 30 09:43:55 2011 (r222488) @@ -226,7 +226,7 @@ rip_append(struct inpcb *last, struct ip { int policyfail = 0; - INP_RLOCK_ASSERT(last); + INP_LOCK_ASSERT(last); #ifdef IPSEC /* check AH/ESP integrity. */ @@ -834,16 +834,19 @@ rip_detach(struct socket *so) static void rip_dodisconnect(struct socket *so, struct inpcb *inp) { + struct inpcbinfo *pcbinfo; - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); - INP_WLOCK_ASSERT(inp); - + pcbinfo = inp->inp_pcbinfo; + INP_INFO_WLOCK(pcbinfo); + INP_WLOCK(inp); rip_delhash(inp); inp->inp_faddr.s_addr = INADDR_ANY; rip_inshash(inp); SOCK_LOCK(so); so->so_state &= ~SS_ISCONNECTED; SOCK_UNLOCK(so); + INP_WUNLOCK(inp); + INP_INFO_WUNLOCK(pcbinfo); } static void @@ -854,11 +857,7 @@ rip_abort(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip_abort: inp == NULL")); - INP_INFO_WLOCK(&V_ripcbinfo); - INP_WLOCK(inp); rip_dodisconnect(so, inp); - INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&V_ripcbinfo); } static void @@ -869,11 +868,7 @@ rip_close(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip_close: inp == NULL")); - INP_INFO_WLOCK(&V_ripcbinfo); - INP_WLOCK(inp); rip_dodisconnect(so, inp); - INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&V_ripcbinfo); } static int @@ -887,11 +882,7 @@ rip_disconnect(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip_disconnect: inp == NULL")); - INP_INFO_WLOCK(&V_ripcbinfo); - INP_WLOCK(inp); rip_dodisconnect(so, inp); - INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&V_ripcbinfo); return (0); } @@ -1077,9 +1068,9 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) INP_INFO_WLOCK(&V_ripcbinfo); for (i = 0; i < n; i++) { inp = inp_list[i]; - INP_WLOCK(inp); - if (!in_pcbrele(inp)) - INP_WUNLOCK(inp); + INP_RLOCK(inp); + if (!in_pcbrele_rlocked(inp)) + INP_RUNLOCK(inp); } INP_INFO_WUNLOCK(&V_ripcbinfo); Modified: head/sys/netinet/siftr.c ============================================================================== --- head/sys/netinet/siftr.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/siftr.c Mon May 30 09:43:55 2011 (r222488) @@ -696,17 +696,16 @@ siftr_findinpcb(int ipver, struct ip *ip /* We need the tcbinfo lock. */ INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); - INP_INFO_RLOCK(&V_tcbinfo); if (dir == PFIL_IN) inp = (ipver == INP_IPV4 ? - in_pcblookup_hash(&V_tcbinfo, ip->ip_src, sport, ip->ip_dst, - dport, 0, m->m_pkthdr.rcvif) + in_pcblookup(&V_tcbinfo, ip->ip_src, sport, ip->ip_dst, + dport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) : #ifdef SIFTR_IPV6 - in6_pcblookup_hash(&V_tcbinfo, + in6_pcblookup(&V_tcbinfo, &((struct ip6_hdr *)ip)->ip6_src, sport, - &((struct ip6_hdr *)ip)->ip6_dst, dport, 0, + &((struct ip6_hdr *)ip)->ip6_dst, dport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) #else NULL @@ -715,13 +714,13 @@ siftr_findinpcb(int ipver, struct ip *ip else inp = (ipver == INP_IPV4 ? - in_pcblookup_hash(&V_tcbinfo, ip->ip_dst, dport, ip->ip_src, - sport, 0, m->m_pkthdr.rcvif) + in_pcblookup(&V_tcbinfo, ip->ip_dst, dport, ip->ip_src, + sport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) : #ifdef SIFTR_IPV6 - in6_pcblookup_hash(&V_tcbinfo, + in6_pcblookup(&V_tcbinfo, &((struct ip6_hdr *)ip)->ip6_dst, dport, - &((struct ip6_hdr *)ip)->ip6_src, sport, 0, + &((struct ip6_hdr *)ip)->ip6_src, sport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) #else NULL @@ -734,12 +733,7 @@ siftr_findinpcb(int ipver, struct ip *ip ss->nskip_in_inpcb++; else ss->nskip_out_inpcb++; - } else { - /* Acquire the inpcb lock. */ - INP_UNLOCK_ASSERT(inp); - INP_RLOCK(inp); } - INP_INFO_RUNLOCK(&V_tcbinfo); return (inp); } Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/tcp_input.c Mon May 30 09:43:55 2011 (r222488) @@ -5,6 +5,7 @@ * Swinburne University of Technology, Melbourne, Australia. * Copyright (c) 2009-2010 Lawrence Stewart * Copyright (c) 2010 The FreeBSD Foundation + * Copyright (c) 2010-2011 Juniper Networks, Inc. * All rights reserved. * * Portions of this software were developed at the Centre for Advanced Internet @@ -16,6 +17,9 @@ * Internet Architectures, Swinburne University of Technology, Melbourne, * Australia by David Hayes under sponsorship from the FreeBSD Foundation. * + * Portions of this software were developed by Robert N. M. Watson under + * contract to Juniper Networks, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -197,10 +201,6 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, &VNET_NAME(tcp_autorcvbuf_max), 0, "Max size of automatic receive buffer"); -int tcp_read_locking = 1; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, read_locking, CTLFLAG_RW, - &tcp_read_locking, 0, "Enable read locking strategy"); - VNET_DEFINE(struct inpcbhead, tcb); #define tcb6 tcb /* for KAME src sync over BSD*'s */ VNET_DEFINE(struct inpcbinfo, tcbinfo); @@ -591,8 +591,7 @@ tcp_input(struct mbuf *m, int off0) char *s = NULL; /* address and port logging */ int ti_locked; #define TI_UNLOCKED 1 -#define TI_RLOCKED 2 -#define TI_WLOCKED 3 +#define TI_WLOCKED 2 #ifdef TCPDEBUG /* @@ -756,30 +755,25 @@ tcp_input(struct mbuf *m, int off0) drop_hdrlen = off0 + off; /* - * Locate pcb for segment, which requires a lock on tcbinfo. - * Optimisticaly acquire a global read lock rather than a write lock - * unless header flags necessarily imply a state change. There are - * two cases where we might discover later we need a write lock - * despite the flags: ACKs moving a connection out of the syncache, - * and ACKs for a connection in TIMEWAIT. + * Locate pcb for segment; if we're likely to add or remove a + * connection then first acquire pcbinfo lock. There are two cases + * where we might discover later we need a write lock despite the + * flags: ACKs moving a connection out of the syncache, and ACKs for + * a connection in TIMEWAIT. */ - if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || - tcp_read_locking == 0) { + if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0) { INP_INFO_WLOCK(&V_tcbinfo); ti_locked = TI_WLOCKED; - } else { - INP_INFO_RLOCK(&V_tcbinfo); - ti_locked = TI_RLOCKED; - } + } else + ti_locked = TI_UNLOCKED; findpcb: #ifdef INVARIANTS - if (ti_locked == TI_RLOCKED) - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - else if (ti_locked == TI_WLOCKED) + if (ti_locked == TI_WLOCKED) { INP_INFO_WLOCK_ASSERT(&V_tcbinfo); - else - panic("%s: findpcb ti_locked %d\n", __func__, ti_locked); + } else { + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); + } #endif #ifdef INET @@ -797,20 +791,18 @@ findpcb: * Transparently forwarded. Pretend to be the destination. * already got one like this? */ - inp = in_pcblookup_hash(&V_tcbinfo, - ip->ip_src, th->th_sport, - ip->ip_dst, th->th_dport, - 0, m->m_pkthdr.rcvif); + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, th->th_sport, + ip->ip_dst, th->th_dport, INPLOOKUP_WLOCKPCB, + m->m_pkthdr.rcvif); if (!inp) { - /* It's new. Try to find the ambushing socket. */ - inp = in_pcblookup_hash(&V_tcbinfo, - ip->ip_src, th->th_sport, - next_hop->sin_addr, - next_hop->sin_port ? - ntohs(next_hop->sin_port) : - th->th_dport, - INPLOOKUP_WILDCARD, - m->m_pkthdr.rcvif); + /* + * It's new. Try to find the ambushing socket. + */ + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, + th->th_sport, next_hop->sin_addr, + next_hop->sin_port ? ntohs(next_hop->sin_port) : + th->th_dport, INPLOOKUP_WILDCARD | + INPLOOKUP_WLOCKPCB, m->m_pkthdr.rcvif); } /* Remove the tag from the packet. We don't need it anymore. */ m_tag_delete(m, fwd_tag); @@ -820,21 +812,19 @@ findpcb: { #ifdef INET6 if (isipv6) - inp = in6_pcblookup_hash(&V_tcbinfo, - &ip6->ip6_src, th->th_sport, - &ip6->ip6_dst, th->th_dport, - INPLOOKUP_WILDCARD, - m->m_pkthdr.rcvif); + inp = in6_pcblookup(&V_tcbinfo, &ip6->ip6_src, + th->th_sport, &ip6->ip6_dst, th->th_dport, + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, + m->m_pkthdr.rcvif); #endif #if defined(INET) && defined(INET6) else #endif #ifdef INET - inp = in_pcblookup_hash(&V_tcbinfo, - ip->ip_src, th->th_sport, - ip->ip_dst, th->th_dport, - INPLOOKUP_WILDCARD, - m->m_pkthdr.rcvif); + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, + th->th_sport, ip->ip_dst, th->th_dport, + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, + m->m_pkthdr.rcvif); #endif } @@ -865,7 +855,7 @@ findpcb: rstreason = BANDLIM_RST_CLOSEDPORT; goto dropwithreset; } - INP_WLOCK(inp); + INP_WLOCK_ASSERT(inp); if (!(inp->inp_flags & INP_HW_FLOWID) && (m->m_flags & M_FLOWID) && ((inp->inp_socket == NULL) @@ -906,28 +896,26 @@ findpcb: * legitimate new connection attempt the old INPCB gets removed and * we can try again to find a listening socket. * - * At this point, due to earlier optimism, we may hold a read lock on - * the inpcbinfo, rather than a write lock. If so, we need to - * upgrade, or if that fails, acquire a reference on the inpcb, drop - * all locks, acquire a global write lock, and then re-acquire the - * inpcb lock. We may at that point discover that another thread has - * tried to free the inpcb, in which case we need to loop back and - * try to find a new inpcb to deliver to. + * At this point, due to earlier optimism, we may hold only an inpcb + * lock, and not the inpcbinfo write lock. If so, we need to try to + * acquire it, or if that fails, acquire a reference on the inpcb, + * drop all locks, acquire a global write lock, and then re-acquire + * the inpcb lock. We may at that point discover that another thread + * has tried to free the inpcb, in which case we need to loop back + * and try to find a new inpcb to deliver to. + * + * XXXRW: It may be time to rethink timewait locking. */ relocked: if (inp->inp_flags & INP_TIMEWAIT) { - KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, - ("%s: INP_TIMEWAIT ti_locked %d", __func__, ti_locked)); - - if (ti_locked == TI_RLOCKED) { - if (INP_INFO_TRY_UPGRADE(&V_tcbinfo) == 0) { + if (ti_locked == TI_UNLOCKED) { + if (INP_INFO_TRY_WLOCK(&V_tcbinfo) == 0) { in_pcbref(inp); INP_WUNLOCK(inp); - INP_INFO_RUNLOCK(&V_tcbinfo); INP_INFO_WLOCK(&V_tcbinfo); ti_locked = TI_WLOCKED; INP_WLOCK(inp); - if (in_pcbrele(inp)) { + if (in_pcbrele_wlocked(inp)) { inp = NULL; goto findpcb; } @@ -975,26 +963,24 @@ relocked: /* * We've identified a valid inpcb, but it could be that we need an - * inpcbinfo write lock and have only a read lock. In this case, - * attempt to upgrade/relock using the same strategy as the TIMEWAIT - * case above. If we relock, we have to jump back to 'relocked' as - * the connection might now be in TIMEWAIT. - */ - if (tp->t_state != TCPS_ESTABLISHED || - (thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || - tcp_read_locking == 0) { - KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, - ("%s: upgrade check ti_locked %d", __func__, ti_locked)); - - if (ti_locked == TI_RLOCKED) { - if (INP_INFO_TRY_UPGRADE(&V_tcbinfo) == 0) { + * inpcbinfo write lock but don't hold it. In this case, attempt to + * acquire using the same strategy as the TIMEWAIT case above. If we + * relock, we have to jump back to 'relocked' as the connection might + * now be in TIMEWAIT. + */ +#ifdef INVARIANTS + if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0) + INP_INFO_WLOCK_ASSERT(&V_tcbinfo); +#endif + if (tp->t_state != TCPS_ESTABLISHED) { + if (ti_locked == TI_UNLOCKED) { + if (INP_INFO_TRY_WLOCK(&V_tcbinfo) == 0) { in_pcbref(inp); INP_WUNLOCK(inp); - INP_INFO_RUNLOCK(&V_tcbinfo); INP_INFO_WLOCK(&V_tcbinfo); ti_locked = TI_WLOCKED; INP_WLOCK(inp); - if (in_pcbrele(inp)) { + if (in_pcbrele_wlocked(inp)) { inp = NULL; goto findpcb; } @@ -1027,13 +1013,16 @@ relocked: /* * When the socket is accepting connections (the INPCB is in LISTEN * state) we look into the SYN cache if this is a new connection - * attempt or the completion of a previous one. + * attempt or the completion of a previous one. Because listen + * sockets are never in TCPS_ESTABLISHED, the V_tcbinfo lock will be + * held in this case. */ if (so->so_options & SO_ACCEPTCONN) { struct in_conninfo inc; KASSERT(tp->t_state == TCPS_LISTEN, ("%s: so accepting but " "tp not listening", __func__)); + INP_INFO_WLOCK_ASSERT(&V_tcbinfo); bzero(&inc, sizeof(inc)); #ifdef INET6 @@ -1371,13 +1360,17 @@ relocked: return; dropwithreset: - if (ti_locked == TI_RLOCKED) - INP_INFO_RUNLOCK(&V_tcbinfo); - else if (ti_locked == TI_WLOCKED) + if (ti_locked == TI_WLOCKED) { INP_INFO_WUNLOCK(&V_tcbinfo); - else - panic("%s: dropwithreset ti_locked %d", __func__, ti_locked); - ti_locked = TI_UNLOCKED; + ti_locked = TI_UNLOCKED; + } +#ifdef INVARIANTS + else { + KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropwithreset " + "ti_locked: %d", __func__, ti_locked)); + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); + } +#endif if (inp != NULL) { tcp_dropwithreset(m, th, tp, tlen, rstreason); @@ -1388,13 +1381,17 @@ dropwithreset: goto drop; dropunlock: - if (ti_locked == TI_RLOCKED) - INP_INFO_RUNLOCK(&V_tcbinfo); - else if (ti_locked == TI_WLOCKED) + if (ti_locked == TI_WLOCKED) { INP_INFO_WUNLOCK(&V_tcbinfo); - else - panic("%s: dropunlock ti_locked %d", __func__, ti_locked); - ti_locked = TI_UNLOCKED; + ti_locked = TI_UNLOCKED; + } +#ifdef INVARIANTS + else { + KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropunlock " + "ti_locked: %d", __func__, ti_locked)); + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); + } +#endif if (inp != NULL) INP_WUNLOCK(inp); @@ -1449,13 +1446,13 @@ tcp_do_segment(struct mbuf *m, struct tc INP_INFO_WLOCK_ASSERT(&V_tcbinfo); } else { #ifdef INVARIANTS - if (ti_locked == TI_RLOCKED) - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon May 30 10:02:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 359491065672; Mon, 30 May 2011 10:02:52 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 261D98FC18; Mon, 30 May 2011 10:02:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UA2qRH070762; Mon, 30 May 2011 10:02:52 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UA2qu7070760; Mon, 30 May 2011 10:02:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105301002.p4UA2qu7070760@svn.freebsd.org> From: Adrian Chadd Date: Mon, 30 May 2011 10:02:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222489 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 10:02:52 -0000 Author: adrian Date: Mon May 30 10:02:51 2011 New Revision: 222489 URL: http://svn.freebsd.org/changeset/base/222489 Log: Update chipset support list for ath_hal. Modified: head/share/man/man4/ath_hal.4 Modified: head/share/man/man4/ath_hal.4 ============================================================================== --- he