From rpaulo at FreeBSD.org Thu Oct 1 02:08:44 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Thu Oct 1 02:08:55 2009 Subject: svn commit: r197653 - in head/sys: amd64/conf i386/conf Message-ID: <200910010208.n9128hbK033492@svn.freebsd.org> Author: rpaulo Date: Thu Oct 1 02:08:42 2009 New Revision: 197653 URL: http://svn.freebsd.org/changeset/base/197653 Log: Improve 802.11s comment. Spotted by: dougb MFC after: 1 day Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Wed Sep 30 19:40:51 2009 (r197652) +++ head/sys/amd64/conf/GENERIC Thu Oct 1 02:08:42 2009 (r197653) @@ -257,7 +257,7 @@ device xe # Xircom pccard Ethernet device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support +options IEEE80211_SUPPORT_MESH # enable 802.11s draft support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Wed Sep 30 19:40:51 2009 (r197652) +++ head/sys/i386/conf/GENERIC Thu Oct 1 02:08:42 2009 (r197653) @@ -269,7 +269,7 @@ device xe # Xircom pccard Ethernet device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support +options IEEE80211_SUPPORT_MESH # enable 802.11s draft support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support From cokane at FreeBSD.org Thu Oct 1 02:43:51 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 02:44:03 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis Message-ID: <200910010243.n912hpSM034846@svn.freebsd.org> Author: cokane Date: Thu Oct 1 02:43:51 2009 New Revision: 197654 URL: http://svn.freebsd.org/changeset/base/197654 Log: style(9) fixes (always compare pointers to NULL) Also, the previous commit to sys/dev/if_ndis/if_ndis.c also included the removal of a call to ndis_setstate_80211 that is no longer needed. Submitted by: sam MFC after: 3 days Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 02:08:42 2009 (r197653) +++ head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 02:43:51 2009 (r197654) @@ -1534,7 +1534,7 @@ ndis_inputtask(dobj, arg) if (m == NULL) break; KeReleaseSpinLock(&sc->ndis_rxlock, irql); - if (sc->ndis_80211 && vap) + if ((sc->ndis_80211 != NULL) && (vap != NULL)) vap->iv_deliver_data(vap, vap->iv_bss, m); else (*ifp->if_input)(ifp, m); @@ -1746,7 +1746,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_CONNECT) { sc->ndis_link = 1; NDIS_UNLOCK(sc); - if (sc->ndis_80211 && vap) { + if ((sc->ndis_80211 != NULL) && (vap != NULL)) { ndis_getstate_80211(sc); ieee80211_new_state(vap, IEEE80211_S_RUN, -1); } @@ -1758,7 +1758,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_DISCONNECT) { sc->ndis_link = 0; NDIS_UNLOCK(sc); - if (sc->ndis_80211 && vap) + if ((sc->ndis_80211 != NULL) && (vap != NULL)) ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); NDIS_LOCK(sc); if_link_state_change(sc->ifp, LINK_STATE_DOWN); From bz at FreeBSD.org Thu Oct 1 10:30:08 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Oct 1 10:30:19 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <200910010243.n912hpSM034846@svn.freebsd.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> Message-ID: <20091001102557.E26486@maildrop.int.zabbadoz.net> On Thu, 1 Oct 2009, Coleman Kane wrote: > Author: cokane > Date: Thu Oct 1 02:43:51 2009 > New Revision: 197654 > URL: http://svn.freebsd.org/changeset/base/197654 > > Log: > style(9) fixes (always compare pointers to NULL) > > Also, the previous commit to sys/dev/if_ndis/if_ndis.c also included the > removal of a call to ndis_setstate_80211 that is no longer needed. The problem just is that sc->ndis_80211 is an integer and this broke the build. > Submitted by: sam > MFC after: 3 days > > Modified: > head/sys/dev/if_ndis/if_ndis.c > > Modified: head/sys/dev/if_ndis/if_ndis.c > ============================================================================== > --- head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 02:08:42 2009 (r197653) > +++ head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 02:43:51 2009 (r197654) > @@ -1534,7 +1534,7 @@ ndis_inputtask(dobj, arg) > if (m == NULL) > break; > KeReleaseSpinLock(&sc->ndis_rxlock, irql); > - if (sc->ndis_80211 && vap) > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > vap->iv_deliver_data(vap, vap->iv_bss, m); > else > (*ifp->if_input)(ifp, m); > @@ -1746,7 +1746,7 @@ ndis_ticktask(d, xsc) > sc->ndis_sts == NDIS_STATUS_MEDIA_CONNECT) { > sc->ndis_link = 1; > NDIS_UNLOCK(sc); > - if (sc->ndis_80211 && vap) { > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) { > ndis_getstate_80211(sc); > ieee80211_new_state(vap, IEEE80211_S_RUN, -1); > } > @@ -1758,7 +1758,7 @@ ndis_ticktask(d, xsc) > sc->ndis_sts == NDIS_STATUS_MEDIA_DISCONNECT) { > sc->ndis_link = 0; > NDIS_UNLOCK(sc); > - if (sc->ndis_80211 && vap) > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); > NDIS_LOCK(sc); > if_link_state_change(sc->ifp, LINK_STATE_DOWN); > -- Bjoern A. Zeeb It will not break if you know what you are doing. From des at des.no Thu Oct 1 10:33:52 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Oct 1 10:33:58 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <200910010243.n912hpSM034846@svn.freebsd.org> (Coleman Kane's message of "Thu, 1 Oct 2009 02:43:51 +0000 (UTC)") References: <200910010243.n912hpSM034846@svn.freebsd.org> Message-ID: <86eipno12p.fsf@ds4.des.no> Coleman Kane writes: > - if (sc->ndis_80211 && vap) > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) sc->ndis_80211 is an int. NULL is a pointer. DES -- Dag-Erling Sm?rgrav - des@des.no From nyan at FreeBSD.org Thu Oct 1 10:46:23 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Thu Oct 1 10:46:28 2009 Subject: svn commit: r197657 - head/sys/pc98/conf Message-ID: <200910011046.n91AkMqI048438@svn.freebsd.org> Author: nyan Date: Thu Oct 1 10:46:22 2009 New Revision: 197657 URL: http://svn.freebsd.org/changeset/base/197657 Log: MFi386: revision 197653 Improve 802.11s comment. MFC after: 1 day Modified: head/sys/pc98/conf/GENERIC Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Thu Oct 1 10:06:09 2009 (r197656) +++ head/sys/pc98/conf/GENERIC Thu Oct 1 10:46:22 2009 (r197657) @@ -223,7 +223,7 @@ device xe # Xircom pccard Ethernet #device wlan # 802.11 support #options IEEE80211_DEBUG # enable debug msgs #options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -#options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support +#options IEEE80211_SUPPORT_MESH # enable 802.11s draft support #device wlan_wep # 802.11 WEP support #device wlan_ccmp # 802.11 CCMP support #device wlan_tkip # 802.11 TKIP support From avg at FreeBSD.org Thu Oct 1 10:53:13 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Thu Oct 1 10:53:24 2009 Subject: svn commit: r197658 - head/sys/kern Message-ID: <200910011053.n91ArCLW048615@svn.freebsd.org> Author: avg Date: Thu Oct 1 10:53:12 2009 New Revision: 197658 URL: http://svn.freebsd.org/changeset/base/197658 Log: print machine in kernel boot version string Discussed with: gavin, kib, jhb PR: kern/126926 MFC after: 2 weeks Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Thu Oct 1 10:46:22 2009 (r197657) +++ head/sys/kern/init_main.c Thu Oct 1 10:53:12 2009 (r197658) @@ -288,11 +288,24 @@ print_caddr_t(void *data) { printf("%s", (char *)data); } + +static void +print_version(void *data __unused) +{ + int len; + + /* Strip a trailing newline from version. */ + len = strlen(version); + while (len > 0 && version[len - 1] == '\n') + len--; + printf("%.*s %s\n", len, version, machine); +} + SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, copyright); SYSINIT(trademark, SI_SUB_COPYRIGHT, SI_ORDER_SECOND, print_caddr_t, trademark); -SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_caddr_t, version); +SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_version, NULL); #ifdef WITNESS static char wit_warn[] = From cokane at FreeBSD.org Thu Oct 1 11:52:07 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 11:52:13 2009 Subject: svn commit: r197659 - head/sys/dev/if_ndis Message-ID: <200910011152.n91Bq7lt050048@svn.freebsd.org> Author: cokane Date: Thu Oct 1 11:52:06 2009 New Revision: 197659 URL: http://svn.freebsd.org/changeset/base/197659 Log: Fix a bad use of NULL instead of zero for int comparison. Sorry for the breakage. Submitted by: bz, des, onemda MFC after: 3 days Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 10:53:12 2009 (r197658) +++ head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 11:52:06 2009 (r197659) @@ -1534,7 +1534,7 @@ ndis_inputtask(dobj, arg) if (m == NULL) break; KeReleaseSpinLock(&sc->ndis_rxlock, irql); - if ((sc->ndis_80211 != NULL) && (vap != NULL)) + if ((sc->ndis_80211 != 0) && (vap != NULL)) vap->iv_deliver_data(vap, vap->iv_bss, m); else (*ifp->if_input)(ifp, m); @@ -1746,7 +1746,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_CONNECT) { sc->ndis_link = 1; NDIS_UNLOCK(sc); - if ((sc->ndis_80211 != NULL) && (vap != NULL)) { + if ((sc->ndis_80211 != 0) && (vap != NULL)) { ndis_getstate_80211(sc); ieee80211_new_state(vap, IEEE80211_S_RUN, -1); } @@ -1758,7 +1758,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_DISCONNECT) { sc->ndis_link = 0; NDIS_UNLOCK(sc); - if ((sc->ndis_80211 != NULL) && (vap != NULL)) + if ((sc->ndis_80211 != 0) && (vap != NULL)) ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); NDIS_LOCK(sc); if_link_state_change(sc->ifp, LINK_STATE_DOWN); From amdmi3 at amdmi3.ru Thu Oct 1 12:06:56 2009 From: amdmi3 at amdmi3.ru (Dmitry Marakasov) Date: Thu Oct 1 12:07:08 2009 Subject: svn commit: r197608 - head/sys/geom/part In-Reply-To: References: <200909282352.n8SNql1n069970@svn.freebsd.org> <200909290749.08764.jhb@freebsd.org> <20090929145447.GA82539@hades.panopticon> <20090929235146.GA64567@hades.panopticon> Message-ID: <20091001120652.GI50565@hades.panopticon> * Marcel Moolenaar (xcllnt@mac.com) wrote: > >> Seconded. I've seen a report of geom_part_ebr unable to detect > >> partitions which were actually there. Will inquiry the reporter if > >> this change solved the problem. > > > > Seems like it hasn't. Here's the first sector from that partition: > > I'll see about checking the partition table more rigorously > so that we can eliminate the check for the unused space. > > With what tool was this created? Dunno. I've pointed the person who had that problem to this thread. -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru From kib at FreeBSD.org Thu Oct 1 12:46:58 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 1 12:47:09 2009 Subject: svn commit: r197660 - head/sys/kern Message-ID: <200910011246.n91Ckw96051354@svn.freebsd.org> Author: kib Date: Thu Oct 1 12:46:58 2009 New Revision: 197660 URL: http://svn.freebsd.org/changeset/base/197660 Log: Fix typo. MFC after: 3 days Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Thu Oct 1 11:52:06 2009 (r197659) +++ head/sys/kern/kern_sig.c Thu Oct 1 12:46:58 2009 (r197660) @@ -1892,7 +1892,7 @@ sigtd(struct proc *p, int sig, int prop) /* * Check if current thread can handle the signal without - * switching conetxt to another thread. + * switching context to another thread. */ if (curproc == p && !SIGISMEMBER(curthread->td_sigmask, sig)) return (curthread); From kib at FreeBSD.org Thu Oct 1 12:48:36 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 1 12:48:41 2009 Subject: svn commit: r197661 - head/sys/vm Message-ID: <200910011248.n91CmZBH051431@svn.freebsd.org> Author: kib Date: Thu Oct 1 12:48:35 2009 New Revision: 197661 URL: http://svn.freebsd.org/changeset/base/197661 Log: Move the annotation for vm_map_startup() immediately before the function. MFC after: 3 days Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Thu Oct 1 12:46:58 2009 (r197660) +++ head/sys/vm/vm_map.c Thu Oct 1 12:48:35 2009 (r197661) @@ -116,22 +116,6 @@ __FBSDID("$FreeBSD$"); * another, and then marking both regions as copy-on-write. */ -/* - * vm_map_startup: - * - * Initialize the vm_map module. Must be called before - * any other vm_map routines. - * - * Map and entry structures are allocated from the general - * purpose memory pool with some exceptions: - * - * - The kernel map and kmem submap are allocated statically. - * - Kernel map entries are allocated out of a static pool. - * - * These restrictions are necessary since malloc() uses the - * maps and requires map entries. - */ - static struct mtx map_sleep_mtx; static uma_zone_t mapentzone; static uma_zone_t kmapentzone; @@ -176,6 +160,22 @@ static void vmspace_zdtor(void *mem, int start = end; \ } +/* + * vm_map_startup: + * + * Initialize the vm_map module. Must be called before + * any other vm_map routines. + * + * Map and entry structures are allocated from the general + * purpose memory pool with some exceptions: + * + * - The kernel map and kmem submap are allocated statically. + * - Kernel map entries are allocated out of a static pool. + * + * These restrictions are necessary since malloc() uses the + * maps and requires map entries. + */ + void vm_map_startup(void) { From kib at FreeBSD.org Thu Oct 1 12:50:27 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 1 12:50:39 2009 Subject: svn commit: r197662 - head/sys/kern Message-ID: <200910011250.n91CoQ5G051511@svn.freebsd.org> Author: kib Date: Thu Oct 1 12:50:26 2009 New Revision: 197662 URL: http://svn.freebsd.org/changeset/base/197662 Log: Do not dereference vp->v_mount without holding vnode lock and checking that the vnode is not reclaimed. Noted by: Igor Sysoev MFC after: 1 week Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu Oct 1 12:48:35 2009 (r197661) +++ head/sys/kern/uipc_syscalls.c Thu Oct 1 12:50:26 2009 (r197662) @@ -2086,9 +2086,11 @@ retry_space: /* * Get the page from backing store. */ - bsize = vp->v_mount->mnt_stat.f_iosize; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_SHARED | LK_RETRY); + error = vn_lock(vp, LK_SHARED); + if (error != 0) + goto after_read; + bsize = vp->v_mount->mnt_stat.f_iosize; /* * XXXMAC: Because we don't have fp->f_cred @@ -2101,6 +2103,7 @@ retry_space: IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), td->td_ucred, NOCRED, &resid, td); VOP_UNLOCK(vp, 0); + after_read: VFS_UNLOCK_GIANT(vfslocked); VM_OBJECT_LOCK(obj); vm_page_io_finish(pg); From kib at FreeBSD.org Thu Oct 1 12:52:49 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 1 12:52:55 2009 Subject: svn commit: r197663 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200910011252.n91Cqmlb051599@svn.freebsd.org> Author: kib Date: Thu Oct 1 12:52:48 2009 New Revision: 197663 URL: http://svn.freebsd.org/changeset/base/197663 Log: As a workaround, for Intel CPUs, do not use CLFLUSH in pmap_invalidate_cache_range() when self-snoop is apparently not reported in cpu features. We get a reserved trap when clflushing APIC registers window. XEN in full system virtualization mode removes self-snoop from CPU features, making this a problem. Tested by: csjp Reviewed by: alc MFC after: 3 days Modified: head/sys/amd64/amd64/initcpu.c head/sys/i386/i386/initcpu.c Modified: head/sys/amd64/amd64/initcpu.c ============================================================================== --- head/sys/amd64/amd64/initcpu.c Thu Oct 1 12:50:26 2009 (r197662) +++ head/sys/amd64/amd64/initcpu.c Thu Oct 1 12:52:48 2009 (r197663) @@ -165,4 +165,10 @@ initializecpu(void) */ if ((cpu_feature & CPUID_CLFSH) != 0) cpu_clflush_line_size = ((cpu_procinfo >> 8) & 0xff) * 8; + /* + * XXXKIB: (temporary) hack to work around traps generated when + * CLFLUSHing APIC registers window. + */ + if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS)) + cpu_feature &= ~CPUID_CLFSH; } Modified: head/sys/i386/i386/initcpu.c ============================================================================== --- head/sys/i386/i386/initcpu.c Thu Oct 1 12:50:26 2009 (r197662) +++ head/sys/i386/i386/initcpu.c Thu Oct 1 12:52:48 2009 (r197663) @@ -717,6 +717,12 @@ initializecpu(void) */ if ((cpu_feature & CPUID_CLFSH) != 0) cpu_clflush_line_size = ((cpu_procinfo >> 8) & 0xff) * 8; + /* + * XXXKIB: (temporary) hack to work around traps generated when + * CLFLUSHing APIC registers window. + */ + if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS)) + cpu_feature &= ~CPUID_CLFSH; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) /* From cokane at FreeBSD.org Thu Oct 1 13:13:09 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 13:13:20 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <86eipno12p.fsf@ds4.des.no> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> Message-ID: <1254401817.4255.14.camel@localhost> On Thu, 2009-10-01 at 12:33 +0200, Dag-Erling Sm?rgrav wrote: > Coleman Kane writes: > > - if (sc->ndis_80211 && vap) > > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > > sc->ndis_80211 is an int. NULL is a pointer. > > DES Thanks, fix committed... I know style(9) says I should have not bothered with the commit, but the assume-that-zero-is-false logic seemed egregious enough at the time to warrant correcting it. I just corrected it improperly in my haste. Enjoy being able to buildkernel again. I'll be sitting in the corner. -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091001/948de7d1/attachment.pgp From attilio at freebsd.org Thu Oct 1 13:21:36 2009 From: attilio at freebsd.org (Attilio Rao) Date: Thu Oct 1 13:21:43 2009 Subject: svn commit: r197643 - in head/sys: kern sys In-Reply-To: References: <200909301326.n8UDQVB1016396@svn.freebsd.org> Message-ID: <3bbf2fe10910010621u72d0f692h8f9c4a783667253d@mail.gmail.com> 2009/9/30 Robert Watson : > On Wed, 30 Sep 2009, Attilio Rao wrote: > >> When releasing a read/shared lock we need to use a write memory barrier >> in order to avoid, on architectures which doesn't have strong ordered >> writes, CPU instructions reordering. > > Hi Attilio (Fabio, et al), > > Nice catch! Are we aware of specific reported problems that can be laid at > the feet of this bug, or was this more of a "wait a moment, shouldn't there > be a barrier there?". Could you comment on the scope of this problem across > architectures we support? A possible problem related to that would be MD specific and not on ia32/amd64 because there the barriers and simple atomics are the same. Given that sun4v suffers of serveral other problems, that MIPS has no SMP support, you would find it only for arm, ia64 and sparc eventually. Thus I'm not aware of any problem which can be reconducted to that. Attilio -- Peace can only be achieved by understanding - A. Einstein From stas at FreeBSD.org Thu Oct 1 13:41:39 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Thu Oct 1 13:42:00 2009 Subject: svn commit: r197643 - in head/sys: kern sys In-Reply-To: <3bbf2fe10910010621u72d0f692h8f9c4a783667253d@mail.gmail.com> References: <200909301326.n8UDQVB1016396@svn.freebsd.org> <3bbf2fe10910010621u72d0f692h8f9c4a783667253d@mail.gmail.com> Message-ID: <20091001174130.0d3bec21.stas@FreeBSD.org> On Thu, 1 Oct 2009 15:21:34 +0200 Attilio Rao mentioned: > 2009/9/30 Robert Watson : > > On Wed, 30 Sep 2009, Attilio Rao wrote: > > > >> When releasing a read/shared lock we need to use a write memory barrier > >> in order to avoid, on architectures which doesn't have strong ordered > >> writes, CPU instructions reordering. > > > > Hi Attilio (Fabio, et al), > > > > Nice catch! Are we aware of specific reported problems that can be laid at > > the feet of this bug, or was this more of a "wait a moment, shouldn't there > > be a barrier there?". Could you comment on the scope of this problem across > > architectures we support? > > A possible problem related to that would be MD specific and not on > ia32/amd64 because there the barriers and simple atomics are the same. > Given that sun4v suffers of serveral other problems, that MIPS has no > SMP support, you would find it only for arm, ia64 and sparc > eventually. Thus I'm not aware of any problem which can be reconducted > to that. > Actually, MIPS is going to grow SMP support really soon, and ARM cpus do not do reordering until ARMv7 afaik. So this should not result in any real problems on ARM too. OTOH, I suspect powerpc may be affected. I'm not sure if any of the models we support perform OOO, though. -- Stanislav Sedov ST4096-RIPE -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 801 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091001/411577bc/attachment.pgp From raj at semihalf.com Thu Oct 1 13:56:09 2009 From: raj at semihalf.com (Rafal Jaworowski) Date: Thu Oct 1 13:56:15 2009 Subject: svn commit: r197643 - in head/sys: kern sys In-Reply-To: <20091001174130.0d3bec21.stas@FreeBSD.org> References: <200909301326.n8UDQVB1016396@svn.freebsd.org> <3bbf2fe10910010621u72d0f692h8f9c4a783667253d@mail.gmail.com> <20091001174130.0d3bec21.stas@FreeBSD.org> Message-ID: <2B51434B-9A1D-4711-9648-1A49B125C785@semihalf.com> On 2009-10-01, at 15:41, Stanislav Sedov wrote: > On Thu, 1 Oct 2009 15:21:34 +0200 > Attilio Rao mentioned: > >> 2009/9/30 Robert Watson : >>> On Wed, 30 Sep 2009, Attilio Rao wrote: >>> >>>> When releasing a read/shared lock we need to use a write memory >>>> barrier >>>> in order to avoid, on architectures which doesn't have strong >>>> ordered >>>> writes, CPU instructions reordering. >>> >>> Hi Attilio (Fabio, et al), >>> >>> Nice catch! Are we aware of specific reported problems that can >>> be laid at >>> the feet of this bug, or was this more of a "wait a moment, >>> shouldn't there >>> be a barrier there?". Could you comment on the scope of this >>> problem across >>> architectures we support? >> >> A possible problem related to that would be MD specific and not on >> ia32/amd64 because there the barriers and simple atomics are the >> same. >> Given that sun4v suffers of serveral other problems, that MIPS has no >> SMP support, you would find it only for arm, ia64 and sparc >> eventually. Thus I'm not aware of any problem which can be >> reconducted >> to that. >> > > Actually, MIPS is going to grow SMP support really soon, and ARM cpus > do not do reordering until ARMv7 afaik. So this should not result in > any real problems on ARM too. Even past generation ARM can do out-of-order execution: see Marvell Feroceon cores which are v5 ISA compatible, although their internal microarchitecture has extended features like this. > OTOH, I suspect powerpc may be affected. I'm not sure if any of the > models > we support perform OOO, though. PowerPC is inherently OOOE. Rafal From des at des.no Thu Oct 1 14:03:22 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Oct 1 14:03:28 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <1254401817.4255.14.camel@localhost> (Coleman Kane's message of "Thu, 01 Oct 2009 08:56:57 -0400") References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <1254401817.4255.14.camel@localhost> Message-ID: <86ab0bnrdj.fsf@ds4.des.no> Coleman Kane writes: > Thanks, fix committed... I know style(9) says I should have not bothered > with the commit, but the assume-that-zero-is-false logic seemed > egregious enough at the time to warrant correcting it. Depends. Is ndis_80211 purely a boolean value? If yes, it should probably be a bit field; if no, style(9) clearly says that you should use an explicit comparison. (a quick perusal of the source says it isn't, so an explicit comparison is required) > I just corrected it improperly in my haste. Enjoy being able to > buildkernel again. I'll be sitting in the corner. Don't worry, you'll be in good company there :) DES -- Dag-Erling Sm?rgrav - des@des.no From brde at optusnet.com.au Thu Oct 1 14:36:15 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Thu Oct 1 14:36:21 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <86eipno12p.fsf@ds4.des.no> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> Message-ID: <20091002002534.D21507@delplex.bde.org> On Thu, 1 Oct 2009, [utf-8] Dag-Erling Smørgrav wrote: > Coleman Kane writes: >> - if (sc->ndis_80211 && vap) >> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > > sc->ndis_80211 is an int. NULL is a pointer. Also, the number of style bugs was doubled on (almost?) every changed line by adding 2 sets of unnecessary parentheses. Bruce From vanhu at FreeBSD.org Thu Oct 1 15:33:53 2009 From: vanhu at FreeBSD.org (VANHULLEBUS Yvan) Date: Thu Oct 1 15:34:00 2009 Subject: svn commit: r197674 - head/sys/netipsec Message-ID: <200910011533.n91FXron055903@svn.freebsd.org> Author: vanhu Date: Thu Oct 1 15:33:53 2009 New Revision: 197674 URL: http://svn.freebsd.org/changeset/base/197674 Log: Changed an IPSEC_ASSERT to a simple test, as such invalid packets may come from outside without being discarded before. Submitted by: aurelien.ansel@netasq.com Reviewed by: bz (secteam) Obtained from: NETASQ MFC after: 1m Modified: head/sys/netipsec/xform_esp.c Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Thu Oct 1 15:28:40 2009 (r197673) +++ head/sys/netipsec/xform_esp.c Thu Oct 1 15:33:53 2009 (r197674) @@ -282,9 +282,15 @@ esp_input(struct mbuf *m, struct secasva IPSEC_ASSERT(sav != NULL, ("null SA")); IPSEC_ASSERT(sav->tdb_encalgxform != NULL, ("null encoding xform")); - IPSEC_ASSERT((skip&3) == 0 && (m->m_pkthdr.len&3) == 0, - ("misaligned packet, skip %u pkt len %u", - skip, m->m_pkthdr.len)); + + /* Valid IP Packet length ? */ + if ( (skip&3) || (m->m_pkthdr.len&3) ){ + DPRINTF(("%s: misaligned packet, skip %u pkt len %u", + __func__, skip, m->m_pkthdr.len)); + V_espstat.esps_badilen++; + m_freem(m); + return EINVAL; + } /* XXX don't pullup, just copy header */ IP6_EXTHDR_GET(esp, struct newesp *, m, skip, sizeof (struct newesp)); From xcllnt at mac.com Thu Oct 1 15:41:15 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Thu Oct 1 15:41:22 2009 Subject: svn commit: r197608 - head/sys/geom/part In-Reply-To: <20091001120652.GI50565@hades.panopticon> References: <200909282352.n8SNql1n069970@svn.freebsd.org> <200909290749.08764.jhb@freebsd.org> <20090929145447.GA82539@hades.panopticon> <20090929235146.GA64567@hades.panopticon> <20091001120652.GI50565@hades.panopticon> Message-ID: On Oct 1, 2009, at 5:06 AM, Dmitry Marakasov wrote: > * Marcel Moolenaar (xcllnt@mac.com) wrote: > >>>> Seconded. I've seen a report of geom_part_ebr unable to detect >>>> partitions which were actually there. Will inquiry the reporter if >>>> this change solved the problem. >>> >>> Seems like it hasn't. Here's the first sector from that partition: >> >> I'll see about checking the partition table more rigorously >> so that we can eliminate the check for the unused space. >> >> With what tool was this created? > > Dunno. I've pointed the person who had that problem to this thread. It should not matter; I was just curious... -- Marcel Moolenaar xcllnt@mac.com From des at FreeBSD.org Thu Oct 1 17:12:53 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Thu Oct 1 17:13:07 2009 Subject: svn commit: r197679 - in head: crypto/openssh crypto/openssh/openbsd-compat secure/libexec/sftp-server secure/libexec/ssh-keysign secure/usr.bin/scp secure/usr.bin/sftp secure/usr.bin/ssh secure/us... Message-ID: <200910011712.n91HCqaT058548@svn.freebsd.org> Author: des Date: Thu Oct 1 17:12:52 2009 New Revision: 197679 URL: http://svn.freebsd.org/changeset/base/197679 Log: Upgrade to OpenSSH 5.3p1. Added: head/crypto/openssh/roaming.h - copied unchanged from r197675, vendor-crypto/openssh/dist/roaming.h head/crypto/openssh/roaming_common.c - copied unchanged from r197675, vendor-crypto/openssh/dist/roaming_common.c head/crypto/openssh/roaming_dummy.c - copied unchanged from r197675, vendor-crypto/openssh/dist/roaming_dummy.c head/crypto/openssh/schnorr.h - copied unchanged from r197675, vendor-crypto/openssh/dist/schnorr.h Modified: head/crypto/openssh/ (props changed) head/crypto/openssh/ChangeLog head/crypto/openssh/README head/crypto/openssh/README.platform head/crypto/openssh/auth-pam.c head/crypto/openssh/auth-passwd.c head/crypto/openssh/auth-sia.c head/crypto/openssh/auth1.c head/crypto/openssh/auth2-jpake.c head/crypto/openssh/auth2-kbdint.c head/crypto/openssh/auth2-none.c head/crypto/openssh/auth2-passwd.c head/crypto/openssh/auth2-pubkey.c head/crypto/openssh/auth2.c head/crypto/openssh/canohost.c head/crypto/openssh/canohost.h head/crypto/openssh/channels.c head/crypto/openssh/clientloop.c head/crypto/openssh/config.h head/crypto/openssh/config.h.in head/crypto/openssh/defines.h head/crypto/openssh/gss-genr.c head/crypto/openssh/includes.h head/crypto/openssh/jpake.c head/crypto/openssh/jpake.h head/crypto/openssh/kex.c head/crypto/openssh/kex.h head/crypto/openssh/kexdhs.c head/crypto/openssh/kexgexs.c head/crypto/openssh/monitor.c head/crypto/openssh/monitor_mm.c head/crypto/openssh/monitor_wrap.c head/crypto/openssh/monitor_wrap.h head/crypto/openssh/openbsd-compat/bsd-cygwin_util.c head/crypto/openssh/openbsd-compat/bsd-cygwin_util.h head/crypto/openssh/openbsd-compat/daemon.c head/crypto/openssh/openbsd-compat/getrrsetbyname.c head/crypto/openssh/openbsd-compat/openssl-compat.c head/crypto/openssh/openbsd-compat/openssl-compat.h head/crypto/openssh/openbsd-compat/port-aix.c head/crypto/openssh/openbsd-compat/port-aix.h head/crypto/openssh/packet.c head/crypto/openssh/packet.h head/crypto/openssh/readconf.c head/crypto/openssh/readconf.h head/crypto/openssh/schnorr.c head/crypto/openssh/servconf.c head/crypto/openssh/serverloop.c head/crypto/openssh/session.c head/crypto/openssh/sftp-client.c head/crypto/openssh/sftp-server.8 head/crypto/openssh/sftp-server.c head/crypto/openssh/ssh-agent.1 head/crypto/openssh/ssh-agent.c head/crypto/openssh/ssh-keygen.c head/crypto/openssh/ssh.1 head/crypto/openssh/ssh.c head/crypto/openssh/ssh_config head/crypto/openssh/ssh_config.5 head/crypto/openssh/ssh_namespace.h head/crypto/openssh/sshconnect.c head/crypto/openssh/sshconnect.h head/crypto/openssh/sshconnect2.c head/crypto/openssh/sshd.8 head/crypto/openssh/sshd.c head/crypto/openssh/sshd_config head/crypto/openssh/sshd_config.5 head/crypto/openssh/sshlogin.c head/crypto/openssh/uuencode.c head/crypto/openssh/version.h head/secure/libexec/sftp-server/Makefile head/secure/libexec/ssh-keysign/Makefile head/secure/usr.bin/scp/Makefile head/secure/usr.bin/sftp/Makefile head/secure/usr.bin/ssh-add/Makefile head/secure/usr.bin/ssh-agent/Makefile head/secure/usr.bin/ssh-keygen/Makefile head/secure/usr.bin/ssh-keyscan/Makefile head/secure/usr.bin/ssh/Makefile head/secure/usr.sbin/sshd/Makefile Modified: head/crypto/openssh/ChangeLog ============================================================================== --- head/crypto/openssh/ChangeLog Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/ChangeLog Thu Oct 1 17:12:52 2009 (r197679) @@ -1,3 +1,282 @@ +20090926 + - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec] + [contrib/suse/openssh.spec] Update for release + - (djm) [README] update relnotes URL + - (djm) [packet.c] Restore EWOULDBLOCK handling that got lost somewhere + - (djm) Release 5.3p1 + +20090911 + - (dtucker) [configure.ac] Change the -lresolv check so it works on Mac OS X + 10.6 (which doesn't have BIND8_COMPAT and thus uses res_9_query). Patch + from jbasney at ncsa uiuc edu. + +20090908 + - (djm) [serverloop.c] Fix test for server-assigned remote forwarding port + (-R 0:...); bz#1578, spotted and fix by gavin AT emf.net; ok dtucker@ + +20090901 + - (dtucker) [configure.ac] Bug #1639: use AC_PATH_PROG to search the path for + krb5-config if it's not in the location specified by --with-kerberos5. + Patch from jchadima at redhat. + +20090829 + - (dtucker) [README.platform] Add text about development packages, based on + text from Chris Pepper in bug #1631. + +20090828 + - dtucker [auth-sia.c] Roll back the change for bug #1241 as it apparently + causes problems in some Tru64 configurations. + - (djm) [sshd_config.5] downgrade mention of login.conf to be an example + and mention PAM as another provider for ChallengeResponseAuthentication; + bz#1408; ok dtucker@ + - (djm) [sftp-server.c] bz#1535: accept ENOSYS as a fallback error when + attempting atomic rename(); ok dtucker@ + - (djm) [Makefile.in] bz#1505: Solaris make(1) doesn't accept make variables + in argv, so pass them in the environment; ok dtucker@ + - (dtucker) [channels.c configure.ac] Bug #1528: skip the tcgetattr call on + the pty master on Solaris, since it never succeeds and can hang if large + amounts of data is sent to the slave (eg a copy-paste). Based on a patch + originally from Doke Scott, ok djm@ + - (dtucker) [clientloop.c configure.ac defines.h] Make the client's IO buffer + size a compile-time option and set it to 64k on Cygwin, since Corinna + reports that it makes a significant difference to performance. ok djm@ + - (dtucker) [configure.ac] Fix the syntax of the Solaris tcgetattr entry. + +20090820 + - (dtucker) [includes.h] Bug #1634: do not include system glob.h if we're not + using it since the type conflicts can cause problems on FreeBSD. Patch + from Jonathan Chen. + - (dtucker) [session.c openbsd-compat/port-aix.h] Bugs #1249 and #1567: move + the setpcred call on AIX to immediately before the permanently_set_uid(). + Ensures that we still have privileges when we call chroot and + pam_open_sesson. Based on a patch from David Leonard. + +20090817 + - (dtucker) [configure.ac] Check for headers before libraries for openssl an + zlib, which should make the errors slightly more meaningful on platforms + where there's separate "-devel" packages for those. + - (dtucker) [sshlogin.c openbsd-compat/port-aix.{c,h}] Bug #1595: make + PrintLastLog work on AIX. Based in part on a patch from Miguel Sanders. + +20090729 + - (tim) [contrib/cygwin/ssh-user-config] Change script to call correct error + function. Patch from Corinna Vinschen. + +20090713 + - (dtucker) [openbsd-compat/getrrsetbyname.c] Reduce answer buffer size so it + fits into 16 bits to work around a bug in glibc's resolver where it masks + off the buffer size at 16 bits. Patch from Hauke Lampe, ok djm jakob. + +20090712 + - (dtucker) [configure.ac] Include sys/param.h for the sys/mount.h test, + prevents configure complaining on older BSDs. + - (dtucker [contrib/cygwin/ssh-{host,user}-config] Add license text. Patch + from Corinna Vinschen. + - (dtucker) [auth-pam.c] Bug #1534: move the deletion of PAM credentials on + logout to after the session close. Patch from Anicka Bernathova, + originally from Andreas Schwab via Novelll ok djm. + +20090707 + - (dtucker) [contrib/cygwin/ssh-host-config] better support for automated + scripts and fix usage of eval. Patch from Corinna Vinschen. + +20090705 + - (dtucker) OpenBSD CVS Sync + - andreas@cvs.openbsd.org 2009/06/27 09:29:06 + [packet.h packet.c] + packet_bacup_state() and packet_restore_state() will be used to + temporarily save the current state ren resuming a suspended connection. + ok markus@ + - andreas@cvs.openbsd.org 2009/06/27 09:32:43 + [roaming_common.c roaming.h] + It may be necessary to retransmit some data when resuming, so add it + to a buffer when roaming is enabled. + Most of this code was written by Martin Forssen, maf at appgate dot com. + ok markus@ + - andreas@cvs.openbsd.org 2009/06/27 09:35:06 + [readconf.h readconf.c] + Add client option UseRoaming. It doesn't do anything yet but will + control whether the client tries to use roaming if enabled on the + server. From Martin Forssen. + ok markus@ + - markus@cvs.openbsd.org 2009/06/30 14:54:40 + [version.h] + crank version; ok deraadt + - dtucker@cvs.openbsd.org 2009/07/02 02:11:47 + [ssh.c] + allow for long home dir paths (bz #1615). ok deraadt + (based in part on a patch from jchadima at redhat) + - stevesk@cvs.openbsd.org 2009/07/05 19:28:33 + [clientloop.c] + only send SSH2_MSG_DISCONNECT if we're in compat20; from dtucker@ + ok deraadt@ markus@ + +20090622 + - (dtucker) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2009/06/22 05:39:28 + [monitor_wrap.c monitor_mm.c ssh-keygen.c auth2.c gss-genr.c sftp-client.c] + alphabetize includes; reduces diff vs portable and style(9). + ok stevesk djm + (Id sync only; these were already in order in -portable) + +20090621 + - (dtucker) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2009/03/17 21:37:00 + [ssh.c] + pass correct argv[0] to openlog(); ok djm@ + - jmc@cvs.openbsd.org 2009/03/19 15:15:09 + [ssh.1] + for "Ciphers", just point the reader to the keyword in ssh_config(5), just + as we do for "MACs": this stops us getting out of sync when the lists + change; + fixes documentation/6102, submitted by Peter J. Philipp + alternative fix proposed by djm + ok markus + - tobias@cvs.openbsd.org 2009/03/23 08:31:19 + [ssh-agent.c] + Fixed a possible out-of-bounds memory access if the environment variable + SHELL is shorter than 3 characters. + with input by and ok dtucker + - tobias@cvs.openbsd.org 2009/03/23 19:38:04 + [ssh-agent.c] + My previous commit didn't fix the problem at all, so stick at my first + version of the fix presented to dtucker. + Issue notified by Matthias Barkhoff (matthias dot barkhoff at gmx dot de). + ok dtucker + - sobrado@cvs.openbsd.org 2009/03/26 08:38:39 + [sftp-server.8 sshd.8 ssh-agent.1] + fix a few typographical errors found by spell(1). + ok dtucker@, jmc@ + - stevesk@cvs.openbsd.org 2009/04/13 19:07:44 + [sshd_config.5] + fix possessive; ok djm@ + - stevesk@cvs.openbsd.org 2009/04/14 16:33:42 + [sftp-server.c] + remove unused option character from getopt() optstring; ok markus@ + - jj@cvs.openbsd.org 2009/04/14 21:10:54 + [servconf.c] + Fixed a few the-the misspellings in comments. Skipped a bunch in + binutils,gcc and so on. ok jmc@ + - stevesk@cvs.openbsd.org 2009/04/17 19:23:06 + [session.c] + use INTERNAL_SFTP_NAME for setproctitle() of in-process sftp-server; + ok djm@ markus@ + - stevesk@cvs.openbsd.org 2009/04/17 19:40:17 + [sshd_config.5] + clarify that even internal-sftp needs /dev/log for logging to work; ok + markus@ + - jmc@cvs.openbsd.org 2009/04/18 18:39:10 + [sshd_config.5] + tweak previous; ok stevesk + - stevesk@cvs.openbsd.org 2009/04/21 15:13:17 + [sshd_config.5] + clarify we cd to user's home after chroot; ok markus@ on + earlier version; tweaks and ok jmc@ + - andreas@cvs.openbsd.org 2009/05/25 06:48:01 + [channels.c packet.c clientloop.c packet.h serverloop.c monitor_wrap.c + monitor.c] + Put the globals in packet.c into a struct and don't access it directly + from other files. No functional changes. + ok markus@ djm@ + - andreas@cvs.openbsd.org 2009/05/27 06:31:25 + [canohost.h canohost.c] + Add clear_cached_addr(), needed for upcoming changes allowing the peer + address to change. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:33:39 + [clientloop.c] + Send SSH2_MSG_DISCONNECT when the client disconnects. From a larger + change from Martin Forssen, maf at appgate dot com. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:34:36 + [kex.c kex.h] + Move the KEX_COOKIE_LEN define to kex.h + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:36:07 + [packet.h packet.c] + Add packet_put_int64() and packet_get_int64(), part of a larger change + from Martin Forssen. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:38:16 + [sshconnect.h sshconnect.c] + Un-static ssh_exchange_identification(), part of a larger change from + Martin Forssen and needed for upcoming changes. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/28 16:50:16 + [sshd.c packet.c serverloop.c monitor_wrap.c clientloop.c sshconnect.c + monitor.c Added roaming.h roaming_common.c roaming_dummy.c] + Keep track of number of bytes read and written. Needed for upcoming + changes. Most code from Martin Forssen, maf at appgate dot com. + ok markus@ + Also, applied appropriate changes to Makefile.in + - andreas@cvs.openbsd.org 2009/06/12 20:43:22 + [monitor.c packet.c] + Fix warnings found by chl@ and djm@ and change roaming_atomicio's + return type to match atomicio's + Diff from djm@, ok markus@ + - andreas@cvs.openbsd.org 2009/06/12 20:58:32 + [packet.c] + Move some more statics into session_state + ok markus@ djm@ + - dtucker@cvs.openbsd.org 2009/06/21 07:37:15 + [kexdhs.c kexgexs.c] + abort if key_sign fails, preventing possible null deref. Based on report + from Paolo Ganci, ok markus@ djm@ + - dtucker@cvs.openbsd.org 2009/06/21 09:04:03 + [roaming.h roaming_common.c roaming_dummy.c] + Add tags for the benefit of the sync scripts + Also: pull in the changes for 1.1->1.2 missed in the previous sync. + - (dtucker) [auth2-jpake.c auth2.c canohost.h session.c] Whitespace and + header-order changes to reduce diff vs OpenBSD. + - (dtucker) [servconf.c sshd.c] More whitespace sync. + - (dtucker) [roaming_common.c roaming_dummy.c] Wrap #include in + ifdef. + +20090616 + - (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t + is a struct with a __val member. Fixes build on, eg, Redhat 6.2. + +20090504 + - (dtucker) [sshlogin.c] Move the NO_SSH_LASTLOG #ifndef line to include + variable declarations. Should prevent unused warnings anywhere it's set + (only Crays as far as I can tell) and be a no-op everywhere else. + +20090318 + - (tim) [configure.ac] Remove setting IP_TOS_IS_BROKEN for Cygwin. The problem + that setsockopt(IP_TOS) doesn't work on Cygwin has been fixed since 2005. + Based on patch from vinschen at redhat com. + +20090308 + - (dtucker) [auth-passwd.c auth1.c auth2-kbdint.c auth2-none.c auth2-passwd.c + auth2-pubkey.c session.c openbsd-compat/bsd-cygwin_util.{c,h} + openbsd-compat/daemon.c] Remove support for Windows 95/98/ME and very old + version of Cygwin. Patch from vinschen at redhat com. + +20090307 + - (dtucker) [contrib/aix/buildbff.sh] Only try to rename ssh_prng_cmds if it + exists (it's not created if OpenSSL's PRNG is self-seeded, eg if the OS + has a /dev/random). + - (dtucker) [schnorr.c openbsd-compat/openssl-compat.{c,h}] Add + EVP_DigestUpdate to the OLD_EVP compatibility functions and tell schnorr.c + to use them. Allows building with older OpenSSL versions. + - (dtucker) [configure.ac defines.h] Check for in_port_t and typedef if needed. + - (dtucker) [configure.ac] Missing comma in type list. + - (dtucker) [configure.ac openbsd-compat/openssl-compat.{c,h}] + EVP_DigestUpdate does not exactly match the other OLD_EVP functions (eg + in openssl 0.9.6) so add an explicit test for it. + +20090306 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2009/03/05 07:18:19 + [auth2-jpake.c jpake.c jpake.h monitor_wrap.c monitor_wrap.h schnorr.c] + [sshconnect2.c] + refactor the (disabled) Schnorr proof code to make it a little more + generally useful + - djm@cvs.openbsd.org 2009/03/05 11:30:50 + [uuencode.c] + document what these functions do so I don't ever have to recuse into + b64_pton/ntop to remember their return values + 20090223 - (djm) OpenBSD CVS Sync - djm@cvs.openbsd.org 2009/02/22 23:50:57 Modified: head/crypto/openssh/README ============================================================================== --- head/crypto/openssh/README Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/README Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -See http://www.openssh.com/txt/release-5.2 for the release notes. +See http://www.openssh.com/txt/release-5.3 for the release notes. - A Japanese translation of this document and of the OpenSSH FAQ is - available at http://www.unixuser.org/~haruyama/security/openssh/index.html @@ -62,4 +62,4 @@ References - [6] http://www.openbsd.org/cgi-bin/man.cgi?query=style&sektion=9 [7] http://www.openssh.com/faq.html -$Id: README,v 1.70 2009/02/23 00:11:57 djm Exp $ +$Id: README,v 1.70.4.1 2009/09/26 04:11:47 djm Exp $ Modified: head/crypto/openssh/README.platform ============================================================================== --- head/crypto/openssh/README.platform Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/README.platform Thu Oct 1 17:12:52 2009 (r197679) @@ -56,6 +56,18 @@ using a third party driver. More informa http://www-user.rhrk.uni-kl.de/~nissler/tuntap/ +Linux +----- + +Some Linux distributions (including Red Hat/Fedora/CentOS) include +headers and library links in the -devel RPMs rather than the main +binary RPMs. If you get an error about headers, or complaining about a +missing prerequisite then you may need to install the equivalent +development packages. On Redhat based distros these may be openssl-devel, +zlib-devel and pam-devel, on Debian based distros these may be +libssl-dev, libz-dev and libpam-dev. + + Solaris ------- If you enable BSM auditing on Solaris, you need to update audit_event(4) @@ -81,4 +93,4 @@ account stacks which will prevent authen return the output from pam_nologin to the client. -$Id: README.platform,v 1.9 2007/08/09 04:31:53 dtucker Exp $ +$Id: README.platform,v 1.10 2009/08/28 23:14:48 dtucker Exp $ Modified: head/crypto/openssh/auth-pam.c ============================================================================== --- head/crypto/openssh/auth-pam.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth-pam.c Thu Oct 1 17:12:52 2009 (r197679) @@ -602,16 +602,16 @@ sshpam_cleanup(void) return; debug("PAM: cleanup"); pam_set_item(sshpam_handle, PAM_CONV, (const void *)&null_conv); - if (sshpam_cred_established) { - debug("PAM: deleting credentials"); - pam_setcred(sshpam_handle, PAM_DELETE_CRED); - sshpam_cred_established = 0; - } if (sshpam_session_open) { debug("PAM: closing session"); pam_close_session(sshpam_handle, PAM_SILENT); sshpam_session_open = 0; } + if (sshpam_cred_established) { + debug("PAM: deleting credentials"); + pam_setcred(sshpam_handle, PAM_DELETE_CRED); + sshpam_cred_established = 0; + } sshpam_authenticated = 0; pam_end(sshpam_handle, sshpam_err); sshpam_handle = NULL; Modified: head/crypto/openssh/auth-passwd.c ============================================================================== --- head/crypto/openssh/auth-passwd.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth-passwd.c Thu Oct 1 17:12:52 2009 (r197679) @@ -102,7 +102,7 @@ auth_password(Authctxt *authctxt, const } #endif #ifdef HAVE_CYGWIN - if (is_winnt) { + { HANDLE hToken = cygwin_logon_user(pw, password); if (hToken == INVALID_HANDLE_VALUE) Modified: head/crypto/openssh/auth-sia.c ============================================================================== --- head/crypto/openssh/auth-sia.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth-sia.c Thu Oct 1 17:12:52 2009 (r197679) @@ -34,10 +34,6 @@ #include #include #include -#include -#include -#include -#include #include "ssh.h" #include "key.h" @@ -53,52 +49,6 @@ extern ServerOptions options; extern int saved_argc; extern char **saved_argv; -static int -sia_password_change_required(const char *user) -{ - struct es_passwd *acct; - time_t pw_life; - time_t pw_date; - - set_auth_parameters(saved_argc, saved_argv); - - if ((acct = getespwnam(user)) == NULL) { - error("Couldn't access protected database entry for %s", user); - endprpwent(); - return (0); - } - - /* If forced password change flag is set, honor it */ - if (acct->uflg->fg_psw_chg_reqd && acct->ufld->fd_psw_chg_reqd) { - endprpwent(); - return (1); - } - - /* Obtain password lifetime; if none, it can't have expired */ - if (acct->uflg->fg_expire) - pw_life = acct->ufld->fd_expire; - else if (acct->sflg->fg_expire) - pw_life = acct->sfld->fd_expire; - else { - endprpwent(); - return (0); - } - - /* Offset from last change; if none, it must be expired */ - if (acct->uflg->fg_schange) - pw_date = acct->ufld->fd_schange + pw_life; - else { - endprpwent(); - return (1); - } - - endprpwent(); - - /* If expiration date is prior to now, change password */ - - return (pw_date <= time((time_t *) NULL)); -} - int sys_auth_passwd(Authctxt *authctxt, const char *pass) { @@ -126,9 +76,6 @@ sys_auth_passwd(Authctxt *authctxt, cons sia_ses_release(&ent); - authctxt->force_pwchange = sia_password_change_required( - authctxt->user); - return (1); } Modified: head/crypto/openssh/auth1.c ============================================================================== --- head/crypto/openssh/auth1.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth1.c Thu Oct 1 17:12:52 2009 (r197679) @@ -318,15 +318,7 @@ do_authloop(Authctxt *authctxt) } #endif /* _UNICOS */ -#ifdef HAVE_CYGWIN - if (authenticated && - !check_nt_auth(type == SSH_CMSG_AUTH_PASSWORD, - authctxt->pw)) { - packet_disconnect("Authentication rejected for uid %d.", - authctxt->pw == NULL ? -1 : authctxt->pw->pw_uid); - authenticated = 0; - } -#else +#ifndef HAVE_CYGWIN /* Special handling for root */ if (authenticated && authctxt->pw->pw_uid == 0 && !auth_root_allowed(meth->name)) { Modified: head/crypto/openssh/auth2-jpake.c ============================================================================== --- head/crypto/openssh/auth2-jpake.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-jpake.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth2-jpake.c,v 1.2 2008/11/07 23:34:48 dtucker Exp $ */ +/* $OpenBSD: auth2-jpake.c,v 1.3 2009/03/05 07:18:19 djm Exp $ */ /* * Copyright (c) 2008 Damien Miller. All rights reserved. * @@ -42,8 +42,8 @@ #include "ssh2.h" #include "key.h" #include "hostfile.h" -#include "buffer.h" #include "auth.h" +#include "buffer.h" #include "packet.h" #include "dispatch.h" #include "log.h" @@ -55,6 +55,7 @@ #endif #include "monitor_wrap.h" +#include "schnorr.h" #include "jpake.h" /* @@ -359,7 +360,7 @@ auth2_jpake_get_pwdata(Authctxt *authctx } /* - * Being authentication attempt. + * Begin authentication attempt. * Note, sets authctxt->postponed while in subprotocol */ static int Modified: head/crypto/openssh/auth2-kbdint.c ============================================================================== --- head/crypto/openssh/auth2-kbdint.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-kbdint.c Thu Oct 1 17:12:52 2009 (r197679) @@ -58,10 +58,6 @@ userauth_kbdint(Authctxt *authctxt) xfree(devs); xfree(lang); -#ifdef HAVE_CYGWIN - if (check_nt_auth(0, authctxt->pw) == 0) - authenticated = 0; -#endif return authenticated; } Modified: head/crypto/openssh/auth2-none.c ============================================================================== --- head/crypto/openssh/auth2-none.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-none.c Thu Oct 1 17:12:52 2009 (r197679) @@ -61,10 +61,6 @@ userauth_none(Authctxt *authctxt) { none_enabled = 0; packet_check_eom(); -#ifdef HAVE_CYGWIN - if (check_nt_auth(1, authctxt->pw) == 0) - return (0); -#endif if (options.password_authentication) return (PRIVSEP(auth_password(authctxt, ""))); return (0); Modified: head/crypto/openssh/auth2-passwd.c ============================================================================== --- head/crypto/openssh/auth2-passwd.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-passwd.c Thu Oct 1 17:12:52 2009 (r197679) @@ -68,10 +68,6 @@ userauth_passwd(Authctxt *authctxt) logit("password change not supported"); else if (PRIVSEP(auth_password(authctxt, password)) == 1) authenticated = 1; -#ifdef HAVE_CYGWIN - if (check_nt_auth(1, authctxt->pw) == 0) - authenticated = 0; -#endif memset(password, 0, len); xfree(password); return authenticated; Modified: head/crypto/openssh/auth2-pubkey.c ============================================================================== --- head/crypto/openssh/auth2-pubkey.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-pubkey.c Thu Oct 1 17:12:52 2009 (r197679) @@ -170,10 +170,6 @@ done: key_free(key); xfree(pkalg); xfree(pkblob); -#ifdef HAVE_CYGWIN - if (check_nt_auth(0, authctxt->pw) == 0) - authenticated = 0; -#endif return authenticated; } Modified: head/crypto/openssh/auth2.c ============================================================================== --- head/crypto/openssh/auth2.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth2.c,v 1.120 2008/11/04 08:22:12 djm Exp $ */ +/* $OpenBSD: auth2.c,v 1.121 2009/06/22 05:39:28 dtucker Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -36,8 +36,8 @@ __RCSID("$FreeBSD$"); #include #include -#include "xmalloc.h" #include "atomicio.h" +#include "xmalloc.h" #include "ssh2.h" #include "packet.h" #include "log.h" Modified: head/crypto/openssh/canohost.c ============================================================================== --- head/crypto/openssh/canohost.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/canohost.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: canohost.c,v 1.64 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: canohost.c,v 1.65 2009/05/27 06:31:25 andreas Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -35,6 +35,8 @@ #include "misc.h" static void check_ip_options(int, char *); +static char *canonical_host_ip = NULL; +static int cached_port = -1; /* * Return the canonical name of the host at the other end of the socket. The @@ -304,6 +306,16 @@ get_local_name(int sock) return get_socket_address(sock, 0, NI_NAMEREQD); } +void +clear_cached_addr(void) +{ + if (canonical_host_ip != NULL) { + xfree(canonical_host_ip); + canonical_host_ip = NULL; + } + cached_port = -1; +} + /* * Returns the IP-address of the remote host as a string. The returned * string must not be freed. @@ -312,8 +324,6 @@ get_local_name(int sock) const char * get_remote_ipaddr(void) { - static char *canonical_host_ip = NULL; - /* Check whether we have cached the ipaddr. */ if (canonical_host_ip == NULL) { if (packet_connection_is_on_socket()) { @@ -402,13 +412,11 @@ get_peer_port(int sock) int get_remote_port(void) { - static int port = -1; - /* Cache to avoid getpeername() on a dead connection */ - if (port == -1) - port = get_port(0); + if (cached_port == -1) + cached_port = get_port(0); - return port; + return cached_port; } int Modified: head/crypto/openssh/canohost.h ============================================================================== --- head/crypto/openssh/canohost.h Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/canohost.h Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: canohost.h,v 1.10 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: canohost.h,v 1.11 2009/05/27 06:31:25 andreas Exp $ */ /* * Author: Tatu Ylonen @@ -24,6 +24,6 @@ char *get_local_name(int); int get_remote_port(void); int get_local_port(void); int get_sock_port(int, int); - +void clear_cached_addr(void); void ipv64_normalise_mapped(struct sockaddr_storage *, socklen_t *); Modified: head/crypto/openssh/channels.c ============================================================================== --- head/crypto/openssh/channels.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/channels.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.295 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.296 2009/05/25 06:48:00 andreas Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1653,6 +1653,7 @@ channel_handle_wfd(Channel *c, fd_set *r } return -1; } +#ifndef BROKEN_TCGETATTR_ICANON if (compat20 && c->isatty && dlen >= 1 && buf[0] != '\r') { if (tcgetattr(c->wfd, &tio) == 0 && !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { @@ -1666,6 +1667,7 @@ channel_handle_wfd(Channel *c, fd_set *r packet_send(); } } +#endif buffer_consume(&c->output, len); if (compat20 && len > 0) { c->local_consumed += len; @@ -2431,7 +2433,7 @@ channel_input_status_confirm(int type, u int id; /* Reset keepalive timeout */ - keep_alive_timeouts = 0; + packet_set_alive_timeouts(0); id = packet_get_int(); packet_check_eom(); Modified: head/crypto/openssh/clientloop.c ============================================================================== --- head/crypto/openssh/clientloop.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/clientloop.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.209 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.213 2009/07/05 19:28:33 stevesk Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -109,6 +109,7 @@ #include "misc.h" #include "match.h" #include "msg.h" +#include "roaming.h" /* import options */ extern Options options; @@ -491,13 +492,13 @@ client_global_request_reply(int type, u_ xfree(gc); } - keep_alive_timeouts = 0; + packet_set_alive_timeouts(0); } static void server_alive_check(void) { - if (++keep_alive_timeouts > options.server_alive_count_max) { + if (packet_inc_alive_timeouts() > options.server_alive_count_max) { logit("Timeout, server not responding."); cleanup_exit(255); } @@ -634,8 +635,8 @@ client_suspend_self(Buffer *bin, Buffer static void client_process_net_input(fd_set *readset) { - int len; - char buf[8192]; + int len, cont = 0; + char buf[SSH_IOBUFSZ]; /* * Read input from the server, and add any such data to the buffer of @@ -643,8 +644,8 @@ client_process_net_input(fd_set *readset */ if (FD_ISSET(connection_in, readset)) { /* Read as much as possible. */ - len = read(connection_in, buf, sizeof(buf)); - if (len == 0) { + len = roaming_read(connection_in, buf, sizeof(buf), &cont); + if (len == 0 && cont == 0) { /* * Received EOF. The remote host has closed the * connection. @@ -1128,7 +1129,7 @@ static void client_process_input(fd_set *readset) { int len; - char buf[8192]; + char buf[SSH_IOBUFSZ]; /* Read input from stdin. */ if (FD_ISSET(fileno(stdin), readset)) { @@ -1476,6 +1477,14 @@ client_loop(int have_pty, int escape_cha /* Stop watching for window change. */ signal(SIGWINCH, SIG_DFL); + if (compat20) { + packet_start(SSH2_MSG_DISCONNECT); + packet_put_int(SSH2_DISCONNECT_BY_APPLICATION); + packet_put_cstring("disconnected by user"); + packet_send(); + packet_write_wait(); + } + channel_free_all(); if (have_pty) Modified: head/crypto/openssh/config.h ============================================================================== --- head/crypto/openssh/config.h Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/config.h Thu Oct 1 17:12:52 2009 (r197679) @@ -69,6 +69,9 @@ /* Define if your snprintf is busted */ /* #undef BROKEN_SNPRINTF */ +/* tcgetattr with ICANON may hang */ +/* #undef BROKEN_TCGETATTR_ICANON */ + /* updwtmpx is broken (if present) */ /* #undef BROKEN_UPDWTMPX */ @@ -123,9 +126,12 @@ /* Builtin PRNG command timeout */ #define ENTROPY_TIMEOUT_MSEC 200 -/* f_fsid has members */ +/* fsid_t has member val */ /* #undef FSID_HAS_VAL */ +/* fsid_t has member __val */ +/* #undef FSID_HAS___VAL */ + /* Define to 1 if the `getpgrp' function requires zero arguments. */ #define GETPGRP_VOID 1 @@ -519,6 +525,9 @@ /* Define to 1 if the system has the type `in_addr_t'. */ #define HAVE_IN_ADDR_T 1 +/* Define to 1 if the system has the type `in_port_t'. */ +#define HAVE_IN_PORT_T 1 + /* Define to 1 if you have the header file. */ /* #undef HAVE_LASTLOG_H */ @@ -1227,6 +1236,9 @@ /* Define if X11 doesn't support AF_UNIX sockets on that system */ /* #undef NO_X11_UNIX_SOCKETS */ +/* Define if EVP_DigestUpdate returns void */ +/* #undef OPENSSL_EVP_DIGESTUPDATE_VOID */ + /* libcrypto is missing AES 192 and 256 bit functions */ /* #undef OPENSSL_LOBOTOMISED_AES */ @@ -1310,6 +1322,9 @@ /* Use audit debugging module */ /* #undef SSH_AUDIT_EVENTS */ +/* Windows is sensitive to read buffer size */ +/* #undef SSH_IOBUFSZ */ + /* non-privileged user for privilege separation */ #define SSH_PRIVSEP_USER "sshd" @@ -1398,9 +1413,13 @@ /* Define if you want SELinux support. */ /* #undef WITH_SELINUX */ -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +#elif ! defined __LITTLE_ENDIAN__ +/* # undef WORDS_BIGENDIAN */ +#endif /* Define if xauth is found in your path */ /* #undef XAUTH_PATH */ Modified: head/crypto/openssh/config.h.in ============================================================================== --- head/crypto/openssh/config.h.in Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/config.h.in Thu Oct 1 17:12:52 2009 (r197679) @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + /* Define if you have a getaddrinfo that fails for the all-zeros IPv6 address */ #undef AIX_GETNAMEINFO_HACK @@ -68,6 +71,9 @@ /* Define if your snprintf is busted */ #undef BROKEN_SNPRINTF +/* tcgetattr with ICANON may hang */ +#undef BROKEN_TCGETATTR_ICANON + /* updwtmpx is broken (if present) */ #undef BROKEN_UPDWTMPX @@ -122,9 +128,12 @@ /* Builtin PRNG command timeout */ #undef ENTROPY_TIMEOUT_MSEC -/* f_fsid has members */ +/* fsid_t has member val */ #undef FSID_HAS_VAL +/* fsid_t has member __val */ +#undef FSID_HAS___VAL + /* Define to 1 if the `getpgrp' function requires zero arguments. */ #undef GETPGRP_VOID @@ -518,6 +527,9 @@ /* Define to 1 if the system has the type `in_addr_t'. */ #undef HAVE_IN_ADDR_T +/* Define to 1 if the system has the type `in_port_t'. */ +#undef HAVE_IN_PORT_T + /* Define to 1 if you have the header file. */ #undef HAVE_LASTLOG_H @@ -1226,6 +1238,9 @@ /* Define if X11 doesn't support AF_UNIX sockets on that system */ #undef NO_X11_UNIX_SOCKETS +/* Define if EVP_DigestUpdate returns void */ +#undef OPENSSL_EVP_DIGESTUPDATE_VOID + /* libcrypto is missing AES 192 and 256 bit functions */ #undef OPENSSL_LOBOTOMISED_AES @@ -1309,6 +1324,9 @@ /* Use audit debugging module */ #undef SSH_AUDIT_EVENTS +/* Windows is sensitive to read buffer size */ +#undef SSH_IOBUFSZ + /* non-privileged user for privilege separation */ #undef SSH_PRIVSEP_USER @@ -1397,9 +1415,17 @@ /* Define if you want SELinux support. */ #undef WITH_SELINUX -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif /* Define if xauth is found in your path */ #undef XAUTH_PATH Modified: head/crypto/openssh/defines.h ============================================================================== --- head/crypto/openssh/defines.h Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/defines.h Thu Oct 1 17:12:52 2009 (r197679) @@ -25,7 +25,7 @@ #ifndef _DEFINES_H #define _DEFINES_H -/* $Id: defines.h,v 1.153 2009/02/01 11:19:54 dtucker Exp $ */ +/* $Id: defines.h,v 1.156 2009/08/28 01:21:07 dtucker Exp $ */ /* Constants */ @@ -300,6 +300,9 @@ struct sockaddr_un { #ifndef HAVE_IN_ADDR_T typedef u_int32_t in_addr_t; #endif +#ifndef HAVE_IN_PORT_T +typedef u_int16_t in_port_t; +#endif #if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE) #define _STRUCT_WINSIZE @@ -591,6 +594,10 @@ struct winsize { #define FSID_TO_ULONG(f) \ ((((u_int64_t)(f).val[0] & 0xffffffffUL) << 32) | \ ((f).val[1] & 0xffffffffUL)) +#elif defined(FSID_HAS___VAL) +#define FSID_TO_ULONG(f) \ + ((((u_int64_t)(f).__val[0] & 0xffffffffUL) << 32) | \ + ((f).__val[1] & 0xffffffffUL)) #else # define FSID_TO_ULONG(f) ((f)) #endif @@ -742,4 +749,8 @@ struct winsize { #define INET6_ADDRSTRLEN 46 #endif +#ifndef SSH_IOBUFSZ +# define SSH_IOBUFSZ 8192 +#endif + #endif /* _DEFINES_H */ Modified: head/crypto/openssh/gss-genr.c ============================================================================== --- head/crypto/openssh/gss-genr.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/gss-genr.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: gss-genr.c,v 1.19 2007/06/12 11:56:15 dtucker Exp $ */ +/* $OpenBSD: gss-genr.c,v 1.20 2009/06/22 05:39:28 dtucker Exp $ */ /* * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. Modified: head/crypto/openssh/includes.h ============================================================================== --- head/crypto/openssh/includes.h Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/includes.h Thu Oct 1 17:12:52 2009 (r197679) @@ -31,7 +31,8 @@ #endif #if defined(HAVE_GLOB_H) && defined(GLOB_HAS_ALTDIRFUNC) && \ defined(GLOB_HAS_GL_MATCHC) && \ - defined(HAVE_DECL_GLOB_NOMATCH) && HAVE_DECL_GLOB_NOMATCH != 0 + defined(HAVE_DECL_GLOB_NOMATCH) && HAVE_DECL_GLOB_NOMATCH != 0 && \ + !defined(BROKEN_GLOB) # include #endif #ifdef HAVE_ENDIAN_H Modified: head/crypto/openssh/jpake.c ============================================================================== --- head/crypto/openssh/jpake.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/jpake.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: jpake.c,v 1.1 2008/11/04 08:22:12 djm Exp $ */ +/* $OpenBSD: jpake.c,v 1.2 2009/03/05 07:18:19 djm Exp $ */ /* * Copyright (c) 2008 Damien Miller. All rights reserved. * @@ -47,6 +47,7 @@ #include "log.h" #include "jpake.h" +#include "schnorr.h" #ifdef JPAKE @@ -60,165 +61,10 @@ "98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB" \ "9ED529077096966D670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF" -struct jpake_group * +struct modp_group * jpake_default_group(void) { - struct jpake_group *ret; - - ret = xmalloc(sizeof(*ret)); - ret->p = ret->q = ret->g = NULL; - if (BN_hex2bn(&ret->p, JPAKE_GROUP_P) == 0 || - BN_hex2bn(&ret->g, JPAKE_GROUP_G) == 0) - fatal("%s: BN_hex2bn", __func__); - /* Subgroup order is p/2 (p is a safe prime) */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From trasz at FreeBSD.org Thu Oct 1 17:22:04 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Thu Oct 1 17:22:16 2009 Subject: svn commit: r197680 - in head/sys: fs/fifofs kern sys Message-ID: <200910011722.n91HM4Kg058819@svn.freebsd.org> Author: trasz Date: Thu Oct 1 17:22:03 2009 New Revision: 197680 URL: http://svn.freebsd.org/changeset/base/197680 Log: Provide default implementation for VOP_ACCESS(9), so that filesystems which want to provide VOP_ACCESSX(9) don't have to implement both. Note that this commit makes implementation of either of these two mandatory. Reviewed by: kib Modified: head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/subr_acl_posix1e.c head/sys/kern/vfs_default.c head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/fs/fifofs/fifo_vnops.c Thu Oct 1 17:22:03 2009 (r197680) @@ -119,7 +119,6 @@ static struct filterops fifo_notsup_filt struct vop_vector fifo_specops = { .vop_default = &default_vnodeops, - .vop_access = VOP_EBADF, .vop_advlock = fifo_advlock, .vop_close = fifo_close, .vop_create = VOP_PANIC, Modified: head/sys/kern/subr_acl_posix1e.c ============================================================================== --- head/sys/kern/subr_acl_posix1e.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/kern/subr_acl_posix1e.c Thu Oct 1 17:22:03 2009 (r197680) @@ -61,6 +61,9 @@ vaccess_acl_posix1e(enum vtype type, uid accmode_t acl_mask_granted; int group_matched, i; + KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0, + ("invalid bit in accmode")); + /* * Look for a normal, non-privileged way to access the file/directory * as requested. If it exists, go with that. Otherwise, attempt to Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/kern/vfs_default.c Thu Oct 1 17:22:03 2009 (r197680) @@ -83,12 +83,17 @@ static int dirent_exists(struct vnode *v * * If there is no specific entry here, we will return EOPNOTSUPP. * + * Note that every filesystem has to implement either vop_access + * or vop_accessx; failing to do so will result in immediate crash + * due to stack overflow, as vop_stdaccess() calls vop_stdaccessx(), + * which calls vop_stdaccess() etc. */ struct vop_vector default_vnodeops = { .vop_default = NULL, .vop_bypass = VOP_EOPNOTSUPP, + .vop_access = vop_stdaccess, .vop_accessx = vop_stdaccessx, .vop_advlock = vop_stdadvlock, .vop_advlockasync = vop_stdadvlockasync, @@ -326,6 +331,16 @@ out: } int +vop_stdaccess(struct vop_access_args *ap) +{ + + KASSERT((ap->a_accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | + VAPPEND)) == 0, ("invalid bit in accmode")); + + return (VOP_ACCESSX(ap->a_vp, ap->a_accmode, ap->a_cred, ap->a_td)); +} + +int vop_stdaccessx(struct vop_accessx_args *ap) { int error; Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/kern/vfs_subr.c Thu Oct 1 17:22:03 2009 (r197680) @@ -3520,6 +3520,9 @@ vaccess(enum vtype type, mode_t file_mod accmode_t dac_granted; accmode_t priv_granted; + KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0, + ("invalid bit in accmode")); + /* * Look for a normal, non-privileged way to access the file/directory * as requested. If it exists, go with that. Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/sys/vnode.h Thu Oct 1 17:22:03 2009 (r197680) @@ -685,6 +685,7 @@ int vop_stdlock(struct vop_lock1_args *) int vop_stdputpages(struct vop_putpages_args *); int vop_stdunlock(struct vop_unlock_args *); int vop_nopoll(struct vop_poll_args *); +int vop_stdaccess(struct vop_access_args *ap); int vop_stdaccessx(struct vop_accessx_args *ap); int vop_stdadvlock(struct vop_advlock_args *ap); int vop_stdadvlockasync(struct vop_advlockasync_args *ap); From cokane at FreeBSD.org Thu Oct 1 17:33:07 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 17:33:17 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <20091002002534.D21507@delplex.bde.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> Message-ID: <1254418346.4255.31.camel@localhost> On Fri, 2009-10-02 at 00:36 +1000, Bruce Evans wrote: > On Thu, 1 Oct 2009, [utf-8] Dag-Erling Sm?rgrav wrote: > > > Coleman Kane writes: > >> - if (sc->ndis_80211 && vap) > >> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > > > > sc->ndis_80211 is an int. NULL is a pointer. > > Also, the number of style bugs was doubled on (almost?) every changed line > by adding 2 sets of unnecessary parentheses. > > Bruce Re-read style(9) more closely. Yes... the extra parentheses are superfluous, and should therefore be removed. However, the current rev, which looks like this: if ((sc->ndis_80211 != 0) && (vap != NULL)) doesn't help the author shoot themselves in the foot as violating the "explicitly compare values to zero" rule did in the earlier revision. I'll heed the request of the second-to-last paragraph of style(9) on this particular change, not churning the SVN repo further, and make a mental note for later. -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091001/5b7166cd/attachment.pgp From brde at optusnet.com.au Thu Oct 1 18:20:31 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Thu Oct 1 18:20:37 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <1254418346.4255.31.camel@localhost> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> <1254418346.4255.31.camel@localhost> Message-ID: <20091002040903.U21917@delplex.bde.org> On Thu, 1 Oct 2009, Coleman Kane wrote: > On Fri, 2009-10-02 at 00:36 +1000, Bruce Evans wrote: >> On Thu, 1 Oct 2009, [utf-8] Dag-Erling Smørgrav wrote: >> >>> Coleman Kane writes: >>>> - if (sc->ndis_80211 && vap) >>>> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) >>> >>> sc->ndis_80211 is an int. NULL is a pointer. >> >> Also, the number of style bugs was doubled on (almost?) every changed line >> by adding 2 sets of unnecessary parentheses. >> >> Bruce > > Re-read style(9) more closely. Do I need to read it at all :-). > Yes... the extra parentheses are superfluous, and should therefore be > removed. However, the current rev, which looks like this: > > if ((sc->ndis_80211 != 0) && (vap != NULL)) > > doesn't help the author shoot themselves in the foot as violating the > "explicitly compare values to zero" rule did in the earlier revision. Actually I needed to count the style bugs more carefully -- 2 implicit comparisons with 0 or NULL (unless the first one is really boolean), but I only counted 1, while I counted 2 for the extra parentheses. > I'll heed the request of the second-to-last paragraph of style(9) on > this particular change, not churning the SVN repo further, and make a > mental note for later. Thanks. I forgot about that paragraph being there. I think churning repos doesn't matter much now if it ever did, but churning sources makes their history hard to understand. Bruce From marcus at FreeBSD.org Thu Oct 1 18:23:51 2009 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Thu Oct 1 18:23:57 2009 Subject: svn commit: r197681 - head/lib/libc/gen Message-ID: <200910011823.n91INoDU060562@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Thu Oct 1 18:23:50 2009 New Revision: 197681 URL: http://svn.freebsd.org/changeset/base/197681 Log: Correct the pthread stub prototype for pthread_mutexattr_settype to allow for the type argument. This is known to fix some pthread_mutexattr_settype() invocations, especially when it comes to pulseaudio. Approved by: kib deischen (threads) MFC after: 3 days Modified: head/lib/libc/gen/_pthread_stubs.c Modified: head/lib/libc/gen/_pthread_stubs.c ============================================================================== --- head/lib/libc/gen/_pthread_stubs.c Thu Oct 1 17:22:03 2009 (r197680) +++ head/lib/libc/gen/_pthread_stubs.c Thu Oct 1 18:23:50 2009 (r197681) @@ -222,7 +222,7 @@ STUB_FUNC1(pthread_mutex_trylock, PJT_MU STUB_FUNC1(pthread_mutex_unlock, PJT_MUTEX_UNLOCK, int, void *) STUB_FUNC1(pthread_mutexattr_destroy, PJT_MUTEXATTR_DESTROY, int, void *) STUB_FUNC1(pthread_mutexattr_init, PJT_MUTEXATTR_INIT, int, void *) -STUB_FUNC1(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *) +STUB_FUNC2(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *, int) STUB_FUNC2(pthread_once, PJT_ONCE, int, void *, void *) STUB_FUNC1(pthread_rwlock_destroy, PJT_RWLOCK_DESTROY, int, void *) STUB_FUNC2(pthread_rwlock_init, PJT_RWLOCK_INIT, int, void *, void *) From thompsa at FreeBSD.org Thu Oct 1 18:37:17 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Thu Oct 1 18:37:28 2009 Subject: svn commit: r197682 - head/sys/dev/usb/controller Message-ID: <200910011837.n91IbGL4061002@svn.freebsd.org> Author: thompsa Date: Thu Oct 1 18:37:16 2009 New Revision: 197682 URL: http://svn.freebsd.org/changeset/base/197682 Log: EHCI Hardware BUG workaround The EHCI HW can use the qtd_next field instead of qtd_altnext when a short packet is received. This contradicts what is stated in the EHCI datasheet. Also the total-bytes field in the status field of the following TD gets corrupted upon reception of a short packet! We work this around in software by not queueing more than one job/TD at a time of up to 16Kbytes! The bug has been seen on multiple INTEL based EHCI chips. Other vendors have not been tested yet. - Applications using /dev/usb/X.Y.Z, where Z is non-zero are affected, but not applications using LibUSB v0.1, v1.2 and v2.0. - Mass Storage (umass) is affected. Submitted by: Hans Petter Selasky MFC after: 3 days Modified: head/sys/dev/usb/controller/ehci.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Thu Oct 1 18:23:50 2009 (r197681) +++ head/sys/dev/usb/controller/ehci.c Thu Oct 1 18:37:16 2009 (r197682) @@ -131,6 +131,7 @@ struct ehci_std_temp { uint8_t auto_data_toggle; uint8_t setup_alt_next; uint8_t last_frame; + uint8_t can_use_next; }; void @@ -1207,11 +1208,6 @@ ehci_non_isoc_done_sub(struct usb_xfer * xfer->td_transfer_cache = td; - /* update data toggle */ - - xfer->endpoint->toggle_next = - (status & EHCI_QTD_TOGGLE_MASK) ? 1 : 0; - #if USB_DEBUG if (status & EHCI_QTD_STATERRS) { DPRINTFN(11, "error, addr=%d, endpt=0x%02x, frame=0x%02x" @@ -1235,6 +1231,9 @@ ehci_non_isoc_done_sub(struct usb_xfer * static void ehci_non_isoc_done(struct usb_xfer *xfer) { + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); + ehci_qh_t *qh; + uint32_t status; usb_error_t err = 0; DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n", @@ -1248,6 +1247,17 @@ ehci_non_isoc_done(struct usb_xfer *xfer } #endif + /* extract data toggle directly from the QH's overlay area */ + + qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; + + usb_pc_cpu_invalidate(qh->page_cache); + + status = hc32toh(sc, qh->qh_qtd.qtd_status); + + xfer->endpoint->toggle_next = + (status & EHCI_QTD_TOGGLE_MASK) ? 1 : 0; + /* reset scanner */ xfer->td_transfer_cache = xfer->td_transfer_first; @@ -1348,6 +1358,7 @@ ehci_check_transfer(struct usb_xfer *xfe } } else { ehci_qtd_t *td; + ehci_qh_t *qh; /* non-isochronous transfer */ @@ -1357,16 +1368,35 @@ ehci_check_transfer(struct usb_xfer *xfe */ td = xfer->td_transfer_cache; + qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; + + usb_pc_cpu_invalidate(qh->page_cache); + + status = hc32toh(sc, qh->qh_qtd.qtd_status); + if (status & EHCI_QTD_ACTIVE) { + /* transfer is pending */ + goto done; + } + while (1) { usb_pc_cpu_invalidate(td->page_cache); status = hc32toh(sc, td->qtd_status); /* - * if there is an active TD the transfer isn't done + * Check if there is an active TD which + * indicates that the transfer isn't done. */ if (status & EHCI_QTD_ACTIVE) { /* update cache */ - xfer->td_transfer_cache = td; + if (xfer->td_transfer_cache != td) { + xfer->td_transfer_cache = td; + if (qh->qh_qtd.qtd_next & + htohc32(sc, EHCI_LINK_TERMINATE)) { + /* XXX - manually advance to next frame */ + qh->qh_qtd.qtd_next = td->qtd_self; + usb_pc_cpu_flush(td->page_cache); + } + } goto done; } /* @@ -1545,7 +1575,6 @@ ehci_setup_standard_chain_sub(struct ehc ehci_qtd_t *td; ehci_qtd_t *td_next; ehci_qtd_t *td_alt_next; - uint32_t qtd_altnext; uint32_t buf_offset; uint32_t average; uint32_t len_old; @@ -1554,7 +1583,6 @@ ehci_setup_standard_chain_sub(struct ehc uint8_t precompute; terminate = htohc32(temp->sc, EHCI_LINK_TERMINATE); - qtd_altnext = terminate; td_alt_next = NULL; buf_offset = 0; shortpkt_old = temp->shortpkt; @@ -1612,7 +1640,8 @@ restart: td->qtd_status = temp->qtd_status | - htohc32(temp->sc, EHCI_QTD_SET_BYTES(average)); + htohc32(temp->sc, EHCI_QTD_IOC | + EHCI_QTD_SET_BYTES(average)); if (average == 0) { @@ -1687,11 +1716,23 @@ restart: td->qtd_buffer_hi[x] = 0; } - if (td_next) { - /* link the current TD with the next one */ - td->qtd_next = td_next->qtd_self; + if (temp->can_use_next) { + if (td_next) { + /* link the current TD with the next one */ + td->qtd_next = td_next->qtd_self; + } + } else { + /* + * BUG WARNING: The EHCI HW can use the + * qtd_next field instead of qtd_altnext when + * a short packet is received! We work this + * around in software by not queueing more + * than one job/TD at a time! + */ + td->qtd_next = terminate; } - td->qtd_altnext = qtd_altnext; + + td->qtd_altnext = terminate; td->alt_next = td_alt_next; usb_pc_cpu_flush(td->page_cache); @@ -1703,15 +1744,9 @@ restart: /* setup alt next pointer, if any */ if (temp->last_frame) { td_alt_next = NULL; - qtd_altnext = terminate; } else { /* we use this field internally */ td_alt_next = td_next; - if (temp->setup_alt_next) { - qtd_altnext = td_next->qtd_self; - } else { - qtd_altnext = terminate; - } } /* restore */ @@ -1756,6 +1791,8 @@ ehci_setup_standard_chain(struct usb_xfe temp.qtd_status = 0; temp.last_frame = 0; temp.setup_alt_next = xfer->flags_int.short_frames_ok; + temp.can_use_next = (xfer->flags_int.control_xfr || + (UE_GET_DIR(xfer->endpointno) == UE_DIR_OUT)); if (xfer->flags_int.control_xfr) { if (xfer->endpoint->toggle_next) { @@ -1889,7 +1926,6 @@ ehci_setup_standard_chain(struct usb_xfe /* the last TD terminates the transfer: */ td->qtd_next = htohc32(temp.sc, EHCI_LINK_TERMINATE); td->qtd_altnext = htohc32(temp.sc, EHCI_LINK_TERMINATE); - td->qtd_status |= htohc32(temp.sc, EHCI_QTD_IOC); usb_pc_cpu_flush(td->page_cache); From cokane at FreeBSD.org Thu Oct 1 18:44:29 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 18:44:40 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <20091002040903.U21917@delplex.bde.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> <1254418346.4255.31.camel@localhost> <20091002040903.U21917@delplex.bde.org> Message-ID: <1254422625.4255.46.camel@localhost> On Fri, 2009-10-02 at 04:20 +1000, Bruce Evans wrote: > On Thu, 1 Oct 2009, Coleman Kane wrote: > > > On Fri, 2009-10-02 at 00:36 +1000, Bruce Evans wrote: > >> On Thu, 1 Oct 2009, [utf-8] Dag-Erling Sm?rgrav wrote: > >> > >>> Coleman Kane writes: > >>>> - if (sc->ndis_80211 && vap) > >>>> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > >>> > >>> sc->ndis_80211 is an int. NULL is a pointer. > >> > >> Also, the number of style bugs was doubled on (almost?) every changed line > >> by adding 2 sets of unnecessary parentheses. > >> > >> Bruce > > > > Re-read style(9) more closely. > > Do I need to read it at all :-). I meant that in the past-tense first-person manner, sorry, not trying to tell anyone what to do. ;) Should have written "I re-read style(9)...". > > > Yes... the extra parentheses are superfluous, and should therefore be > > removed. However, the current rev, which looks like this: > > > > if ((sc->ndis_80211 != 0) && (vap != NULL)) > > > > doesn't help the author shoot themselves in the foot as violating the > > "explicitly compare values to zero" rule did in the earlier revision. > > Actually I needed to count the style bugs more carefully -- 2 implicit > comparisons with 0 or NULL (unless the first one is really boolean), > but I only counted 1, while I counted 2 for the extra parentheses. I think you're right about the ndis_80211. I got thrown off by the first usage of it in the file which reads: sc->ndis_80211++; But it looks like 1) It is tested elsewhere as a boolean, and 2) That statement really means sc->ndis_80211 = 1 (or = TRUE). > > > I'll heed the request of the second-to-last paragraph of style(9) on > > this particular change, not churning the SVN repo further, and make a > > mental note for later. > > Thanks. I forgot about that paragraph being there. I think churning > repos doesn't matter much now if it ever did, but churning sources makes > their history hard to understand. > > Bruce -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091001/22e9421d/attachment.pgp From cokane at FreeBSD.org Thu Oct 1 18:46:38 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 18:46:49 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <20091002040903.U21917@delplex.bde.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> <1254418346.4255.31.camel@localhost> <20091002040903.U21917@delplex.bde.org> Message-ID: <1254422625.4255.46.camel@localhost> On Fri, 2009-10-02 at 04:20 +1000, Bruce Evans wrote: > On Thu, 1 Oct 2009, Coleman Kane wrote: > > > On Fri, 2009-10-02 at 00:36 +1000, Bruce Evans wrote: > >> On Thu, 1 Oct 2009, [utf-8] Dag-Erling Sm?rgrav wrote: > >> > >>> Coleman Kane writes: > >>>> - if (sc->ndis_80211 && vap) > >>>> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > >>> > >>> sc->ndis_80211 is an int. NULL is a pointer. > >> > >> Also, the number of style bugs was doubled on (almost?) every changed line > >> by adding 2 sets of unnecessary parentheses. > >> > >> Bruce > > > > Re-read style(9) more closely. > > Do I need to read it at all :-). I meant that in the past-tense first-person manner, sorry, not trying to tell anyone what to do. ;) Should have written "I re-read style(9)...". > > > Yes... the extra parentheses are superfluous, and should therefore be > > removed. However, the current rev, which looks like this: > > > > if ((sc->ndis_80211 != 0) && (vap != NULL)) > > > > doesn't help the author shoot themselves in the foot as violating the > > "explicitly compare values to zero" rule did in the earlier revision. > > Actually I needed to count the style bugs more carefully -- 2 implicit > comparisons with 0 or NULL (unless the first one is really boolean), > but I only counted 1, while I counted 2 for the extra parentheses. I think you're right about the ndis_80211. I got thrown off by the first usage of it in the file which reads: sc->ndis_80211++; But it looks like 1) It is tested elsewhere as a boolean, and 2) That statement really means sc->ndis_80211 = 1 (or = TRUE). > > > I'll heed the request of the second-to-last paragraph of style(9) on > > this particular change, not churning the SVN repo further, and make a > > mental note for later. > > Thanks. I forgot about that paragraph being there. I think churning > repos doesn't matter much now if it ever did, but churning sources makes > their history hard to understand. > > Bruce -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091001/22e9421d/attachment-0003.pgp From delphij at FreeBSD.org Thu Oct 1 18:58:27 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Oct 1 18:58:33 2009 Subject: svn commit: r197683 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910011858.n91IwQhM061711@svn.freebsd.org> Author: delphij Date: Thu Oct 1 18:58:26 2009 New Revision: 197683 URL: http://svn.freebsd.org/changeset/base/197683 Log: Return EOPNOTSUPP instead of EINVAL when doing chflags(2) over an old format ZFS, as defined in the manual page. Submitted by: pjd (response of my original patch but bugs are mine) MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 1 18:37:16 2009 (r197682) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 1 18:58:26 2009 (r197683) @@ -4180,8 +4180,12 @@ zfs_freebsd_setattr(ap) zflags = VTOZ(vp)->z_phys->zp_flags; if (vap->va_flags != VNOVAL) { + zfsvfs_t *zfsvfs = VTOZ(vp)->z_zfsvfs; int error; + if (zfsvfs->z_use_fuids == B_FALSE) + return (EOPNOTSUPP); + fflags = vap->va_flags; if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_NODUMP)) != 0) return (EOPNOTSUPP); From jhb at FreeBSD.org Thu Oct 1 19:12:14 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Oct 1 19:12:25 2009 Subject: svn commit: r197684 - head/sys/ddb Message-ID: <200910011912.n91JCEoG062039@svn.freebsd.org> Author: jhb Date: Thu Oct 1 19:12:14 2009 New Revision: 197684 URL: http://svn.freebsd.org/changeset/base/197684 Log: Put square backets ([]) around process names for system processes to patch the behavior of ps(1). Modified: head/sys/ddb/db_ps.c Modified: head/sys/ddb/db_ps.c ============================================================================== --- head/sys/ddb/db_ps.c Thu Oct 1 18:58:26 2009 (r197683) +++ head/sys/ddb/db_ps.c Thu Oct 1 19:12:14 2009 (r197684) @@ -189,13 +189,19 @@ db_ps(db_expr_t addr, boolean_t hasaddr, if (cred != NULL && jailed(cred)) strlcat(state, "J", sizeof(state)); db_printf(" %-6.6s ", state); - if (p->p_flag & P_HADTHREADS) + if (p->p_flag & P_HADTHREADS) { #ifdef __LP64__ - db_printf(" (threaded) %s\n", - p->p_comm); + db_printf(" (threaded) "); #else - db_printf(" (threaded) %s\n", p->p_comm); + db_printf(" (threaded) "); #endif + if (p->p_flag & P_SYSTEM) + db_printf("["); + db_printf("%s", p->p_comm); + if (p->p_flag & P_SYSTEM) + db_printf("]"); + db_printf("\n"); + } FOREACH_THREAD_IN_PROC(p, td) { dumpthread(p, td, p->p_flag & P_HADTHREADS); if (db_pager_quit) From qingli at FreeBSD.org Thu Oct 1 20:32:30 2009 From: qingli at FreeBSD.org (Qing Li) Date: Thu Oct 1 20:32:36 2009 Subject: svn commit: r197687 - head/sys/net Message-ID: <200910012032.n91KWTOa064111@svn.freebsd.org> Author: qingli Date: Thu Oct 1 20:32:29 2009 New Revision: 197687 URL: http://svn.freebsd.org/changeset/base/197687 Log: The flow-table associates TCP/UDP flows and IP destinations with specific routes. When the routing table changes, for example, when a new route with a more specific prefix is inserted into the routing table, the flow-table is not updated to reflect that change. As such existing connections cannot take advantage of the new path. In some cases the path is broken. This patch will update the affected flow-table entries when a more specific route is added. The route entry is properly marked when a route is deleted from the table. In this case, when the flow-table performs a search, the stale entry is updated automatically. Therefore this patch is not necessary for route deletion. Submitted by: simon, phk Reviewed by: bz, kmacy MFC after: 3 days Modified: head/sys/net/flowtable.c head/sys/net/flowtable.h head/sys/net/route.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Thu Oct 1 20:11:42 2009 (r197686) +++ head/sys/net/flowtable.c Thu Oct 1 20:32:29 2009 (r197687) @@ -830,7 +830,7 @@ fle_free(struct flentry *fle) } static void -flowtable_free_stale(struct flowtable *ft) +flowtable_free_stale(struct flowtable *ft, struct rtentry *rt) { int curbit = 0, count; struct flentry *fle, **flehead, *fleprev; @@ -866,8 +866,14 @@ flowtable_free_stale(struct flowtable *f curbit); } #endif - while (fle != NULL) { - if (!flow_stale(ft, fle)) { + while (fle != NULL) { + if (rt != NULL) { + if (__DEVOLATILE(struct rtentry *, fle->f_rt) != rt) { + fleprev = fle; + fle = fle->f_next; + continue; + } + } else if (!flow_stale(ft, fle)) { fleprev = fle; fle = fle->f_next; continue; @@ -916,6 +922,30 @@ flowtable_free_stale(struct flowtable *f log(LOG_DEBUG, "freed %d flow entries\n", count); } +void +flowtable_route_flush(struct flowtable *ft, struct rtentry *rt) +{ + int i; + if (ft->ft_flags & FL_PCPU) { + for (i = 0; i <= mp_maxid; i++) { + if (CPU_ABSENT(i)) + continue; + + thread_lock(curthread); + sched_bind(curthread, i); + thread_unlock(curthread); + + flowtable_free_stale(ft, rt); + + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); + } + } else { + flowtable_free_stale(ft, rt); + } +} + static void flowtable_clean_vnet(void) { @@ -933,14 +963,14 @@ flowtable_clean_vnet(void) sched_bind(curthread, i); thread_unlock(curthread); - flowtable_free_stale(ft); + flowtable_free_stale(ft, NULL); thread_lock(curthread); sched_unbind(curthread); thread_unlock(curthread); } } else { - flowtable_free_stale(ft); + flowtable_free_stale(ft, NULL); } ft = ft->ft_next; } Modified: head/sys/net/flowtable.h ============================================================================== --- head/sys/net/flowtable.h Thu Oct 1 20:11:42 2009 (r197686) +++ head/sys/net/flowtable.h Thu Oct 1 20:32:29 2009 (r197687) @@ -51,5 +51,7 @@ struct flowtable *flowtable_alloc(int ne int flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro, uint32_t fibnum); +void flowtable_route_flush(struct flowtable *ft, struct rtentry *rt); + #endif /* _KERNEL */ #endif Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Thu Oct 1 20:11:42 2009 (r197686) +++ head/sys/net/route.c Thu Oct 1 20:32:29 2009 (r197687) @@ -56,6 +56,7 @@ #include #include #include +#include #ifdef RADIX_MPATH #include @@ -996,6 +997,9 @@ rtrequest1_fib(int req, struct rt_addrin { int error = 0, needlock = 0; register struct rtentry *rt; +#ifdef FLOWTABLE + register struct rtentry *rt0; +#endif register struct radix_node *rn; register struct radix_node_head *rnh; struct ifaddr *ifa; @@ -1153,6 +1157,53 @@ rtrequest1_fib(int req, struct rt_addrin } #endif +#ifdef FLOWTABLE + rt0 = NULL; + /* XXX + * "flow-table" only support IPv4 at the moment. + */ + if (dst->sa_family == AF_INET) { + rn = rnh->rnh_matchaddr(dst, rnh); + if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { + struct sockaddr *mask; + u_char *m, *n; + int len; + + /* + * compare mask to see if the new route is + * more specific than the existing one + */ + rt0 = RNTORT(rn); + RT_LOCK(rt0); + RT_ADDREF(rt0); + RT_UNLOCK(rt0); + /* + * A host route is already present, so + * leave the flow-table entries as is. + */ + if (rt0->rt_flags & RTF_HOST) { + RTFREE(rt0); + rt0 = NULL; + } else if (!(flags & RTF_HOST) && netmask) { + mask = rt_mask(rt0); + len = mask->sa_len; + m = (u_char *)mask; + n = (u_char *)netmask; + while (len-- > 0) { + if (*n != *m) + break; + n++; + m++; + } + if (len == 0 || (*n < *m)) { + RTFREE(rt0); + rt0 = NULL; + } + } + } + } +#endif + /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); /* @@ -1165,8 +1216,18 @@ rtrequest1_fib(int req, struct rt_addrin Free(rt_key(rt)); RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); +#ifdef FLOWTABLE + if (rt0 != NULL) + RTFREE(rt0); +#endif senderr(EEXIST); + } +#ifdef FLOWTABLE + else if (rt0 != NULL) { + flowtable_route_flush(V_ip_ft, rt0); + RTFREE(rt0); } +#endif /* * If this protocol has something to add to this then From jkim at FreeBSD.org Thu Oct 1 20:56:15 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Oct 1 20:56:21 2009 Subject: svn commit: r197688 - head/sys/modules/acpi/acpi Message-ID: <200910012056.n91KuFK4064968@svn.freebsd.org> Author: jkim Date: Thu Oct 1 20:56:15 2009 New Revision: 197688 URL: http://svn.freebsd.org/changeset/base/197688 Log: Compile ACPI debugger and disassembler for kernel modules unconditionally. These files will generate almost empty object files without ACPI_DEBUG/DDB options. As a result, size of acpi.ko will increase slightly. Modified: head/sys/modules/acpi/acpi/Makefile Modified: head/sys/modules/acpi/acpi/Makefile ============================================================================== --- head/sys/modules/acpi/acpi/Makefile Thu Oct 1 20:32:29 2009 (r197687) +++ head/sys/modules/acpi/acpi/Makefile Thu Oct 1 20:56:15 2009 (r197688) @@ -27,6 +27,10 @@ KMOD= acpi # ACPI CA sources +SRCS+= dbcmds.c dbdisply.c dbexec.c dbfileio.c dbhistry.c dbinput.c dbstats.c +SRCS+= dbutils.c dbxface.c +SRCS+= dmbuffer.c dmnames.c dmopcode.c dmobject.c dmresrc.c dmresrcl.c +SRCS+= dmresrcs.c dmutils.c dmwalk.c SRCS+= dsfield.c dsinit.c dsmethod.c dsmthdat.c dsobject.c dsopcode.c SRCS+= dsutils.c dswexec.c dswload.c dswscope.c dswstate.c SRCS+= evevent.c evgpe.c evgpeblk.c evmisc.c evregion.c evrgnini.c evsci.c @@ -69,12 +73,6 @@ SRCS+= cpufreq_if.h device_if.h isa_if.h # This obviously needs a better and more structural fix. SRCS+= opt_kstack_pages.h opt_nfs.h opt_apic.h opt_compat.h opt_hwpmc_hooks.h -# Debugging support -DBSRC= dbcmds.c dbdisply.c dbexec.c dbfileio.c dbhistry.c dbinput.c dbstats.c -DBSRC+= dbutils.c dbxface.c -DBSRC+= dmbuffer.c dmnames.c dmopcode.c dmobject.c dmresrc.c dmresrcl.c -DBSRC+= dmresrcs.c dmutils.c dmwalk.c - .if !defined(KERNBUILDDIR) .if KTR CFLAGS+=-DKTR @@ -87,7 +85,6 @@ CFLAGS+=-DACPI_MAX_THREADS=${ACPI_MAX_TH .endif .if ACPI_DEBUG CFLAGS+=-DACPI_DEBUG -SRCS+= ${DBSRC} opt_ddb.h: Makefile echo "#define DDB 1" > ${.TARGET} .else @@ -98,10 +95,12 @@ opt_ddb.h: Makefile # Machine-specific code such as sleep/wakeup SRCS+= acpi_machdep.c acpi_wakecode.h acpi_wakeup.c -.if ${MACHINE} == "i386" -SRCS+= madt.c assym.s +SRCS+= assym.s madt.c +CLEANFILES+= acpi_wakecode.bin acpi_wakecode.h acpi_wakecode.o +.if ${MACHINE_ARCH} == "amd64" +SRCS+= opt_global.h +CLEANFILES+= acpi_wakedata.h .endif -CLEANFILES+= acpi_wakecode.h acpi_wakecode.o acpi_wakecode.bin ${DBSRC:.c=.o} acpi_wakecode.h: acpi_wakecode.S assym.s ${MAKE} -f ${.CURDIR}/../../../${MACHINE_ARCH}/acpica/Makefile \ From jilles at FreeBSD.org Thu Oct 1 21:40:08 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Thu Oct 1 21:40:32 2009 Subject: svn commit: r197691 - in head: bin/sh tools/regression/bin/sh/errors Message-ID: <200910012140.n91Le8Kx071672@svn.freebsd.org> Author: jilles Date: Thu Oct 1 21:40:08 2009 New Revision: 197691 URL: http://svn.freebsd.org/changeset/base/197691 Log: sh: Disallow mismatched quotes in backticks (`...`). Due to the amount of code removed by this, it seems that allowing unmatched quotes was a deliberate imitation of System V sh and real ksh. Most other shells do not allow unmatched quotes (e.g. bash, zsh, pdksh, NetBSD /bin/sh, dash). PR: bin/137657 Added: head/tools/regression/bin/sh/errors/backquote-error2.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Thu Oct 1 21:14:40 2009 (r197690) +++ head/bin/sh/parser.c Thu Oct 1 21:40:08 2009 (r197691) @@ -82,7 +82,6 @@ struct heredoc { STATIC struct heredoc *heredoclist; /* list of here documents to read */ -STATIC int parsebackquote; /* nonzero if we are inside backquotes */ STATIC int doprompt; /* if set, prompt the user */ STATIC int needprompt; /* true if interactive and at start of line */ STATIC int lasttoken; /* last token read */ @@ -1043,7 +1042,7 @@ readtoken1(int firstc, char const *synta endword: if (syntax == ARISYNTAX) synerror("Missing '))'"); - if (syntax != BASESYNTAX && ! parsebackquote && eofmark == NULL) + if (syntax != BASESYNTAX && eofmark == NULL) synerror("Unterminated quoted string"); if (varnest != 0) { startlinno = plinno; @@ -1303,7 +1302,6 @@ parsesub: { parsebackq: { struct nodelist **nlpp; - int savepbq; union node *n; char *volatile str; struct jmploc jmploc; @@ -1311,11 +1309,9 @@ parsebackq: { int savelen; int saveprompt; - savepbq = parsebackquote; if (setjmp(jmploc.loc)) { if (str) ckfree(str); - parsebackquote = 0; handler = savehandler; longjmp(handler->loc, 1); } @@ -1397,7 +1393,6 @@ done: nlpp = &(*nlpp)->next; *nlpp = (struct nodelist *)stalloc(sizeof (struct nodelist)); (*nlpp)->next = NULL; - parsebackquote = oldstyle; if (oldstyle) { saveprompt = doprompt; @@ -1433,7 +1428,6 @@ done: str = NULL; INTON; } - parsebackquote = savepbq; handler = savehandler; if (arinest || dblquote) USTPUTC(CTLBACKQ | CTLQUOTE, out); Added: head/tools/regression/bin/sh/errors/backquote-error2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/errors/backquote-error2.0 Thu Oct 1 21:40:08 2009 (r197691) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +sh -c 'echo `echo .BA"DCODE.` +echo ".BAD"CODE.' 2>&1 | grep -q BADCODE && exit 1 +echo '`"`' | sh -n 2>/dev/null && exit 1 +echo '`'"'"'`' | sh -n 2>/dev/null && exit 1 +exit 0 From emaste at FreeBSD.org Thu Oct 1 21:44:31 2009 From: emaste at FreeBSD.org (Ed Maste) Date: Thu Oct 1 21:44:41 2009 Subject: svn commit: r197692 - head/sys/kern Message-ID: <200910012144.n91LiU4X072601@svn.freebsd.org> Author: emaste Date: Thu Oct 1 21:44:30 2009 New Revision: 197692 URL: http://svn.freebsd.org/changeset/base/197692 Log: In fill_kinfo_thread, copy the thread's name into struct kinfo_proc even if it is empty. Otherwise the previous thread's name would remain in the struct and then be reported for this thread. Submitted by: Ryan Stone MFC after: 1 week Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Thu Oct 1 21:40:08 2009 (r197691) +++ head/sys/kern/kern_proc.c Thu Oct 1 21:44:30 2009 (r197692) @@ -847,8 +847,7 @@ fill_kinfo_thread(struct thread *td, str strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg)); else bzero(kp->ki_wmesg, sizeof(kp->ki_wmesg)); - if (td->td_name[0] != '\0') - strlcpy(kp->ki_ocomm, td->td_name, sizeof(kp->ki_ocomm)); + strlcpy(kp->ki_ocomm, td->td_name, sizeof(kp->ki_ocomm)); if (TD_ON_LOCK(td)) { kp->ki_kiflag |= KI_LOCKBLOCK; strlcpy(kp->ki_lockname, td->td_lockname, From jhb at freebsd.org Thu Oct 1 21:51:51 2009 From: jhb at freebsd.org (John Baldwin) Date: Thu Oct 1 21:51:57 2009 Subject: svn commit: r197684 - head/sys/ddb In-Reply-To: <200910011912.n91JCEoG062039@svn.freebsd.org> References: <200910011912.n91JCEoG062039@svn.freebsd.org> Message-ID: <200910011517.50276.jhb@freebsd.org> On Thursday 01 October 2009 3:12:14 pm John Baldwin wrote: > Author: jhb > Date: Thu Oct 1 19:12:14 2009 > New Revision: 197684 > URL: http://svn.freebsd.org/changeset/base/197684 > > Log: > Put square backets ([]) around process names for system processes to patch > the behavior of ps(1). Bah I should clarify that this just fixes the process name for multithreaded kernel processes. Single-threaded processes were already handled. -- John Baldwin From kmacy at FreeBSD.org Thu Oct 1 22:05:39 2009 From: kmacy at FreeBSD.org (Kip Macy) Date: Thu Oct 1 22:05:45 2009 Subject: svn commit: r197693 - in head/sys/i386: i386 include xen Message-ID: <200910012205.n91M5cTJ076251@svn.freebsd.org> Author: kmacy Date: Thu Oct 1 22:05:38 2009 New Revision: 197693 URL: http://svn.freebsd.org/changeset/base/197693 Log: make read_eflags and write_eflags accomplish the same effect on PVM as native, simplifying interrupt handling Modified: head/sys/i386/i386/vm_machdep.c head/sys/i386/include/cpufunc.h head/sys/i386/xen/xen_machdep.c Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Thu Oct 1 21:44:30 2009 (r197692) +++ head/sys/i386/i386/vm_machdep.c Thu Oct 1 22:05:38 2009 (r197693) @@ -270,11 +270,7 @@ cpu_fork(td1, p2, td2, flags) /* * XXX XEN need to check on PSL_USER is handled */ -#ifdef XEN - td2->td_md.md_saved_flags = 0; -#else td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; -#endif /* * Now, cpu_switch() can schedule the new process. * pcb_esp is loaded pointing to the cpu_switch() stack frame @@ -446,11 +442,7 @@ cpu_set_upcall(struct thread *td, struct /* Setup to release spin count in fork_exit(). */ td->td_md.md_spinlock_count = 1; -#ifdef XEN - td->td_md.md_saved_flags = 0; -#else td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; -#endif } /* Modified: head/sys/i386/include/cpufunc.h ============================================================================== --- head/sys/i386/include/cpufunc.h Thu Oct 1 21:44:30 2009 (r197692) +++ head/sys/i386/include/cpufunc.h Thu Oct 1 22:05:38 2009 (r197693) @@ -49,8 +49,8 @@ extern u_int xen_rcr2(void); extern void xen_load_cr3(u_int data); extern void xen_tlb_flush(void); extern void xen_invlpg(u_int addr); -extern int xen_save_and_cli(void); -extern void xen_restore_flags(u_int eflags); +extern void write_eflags(u_int eflags); +extern u_int read_eflags(void); #endif struct region_descriptor; @@ -293,7 +293,11 @@ ia32_pause(void) } static __inline u_int +#ifdef XEN +_read_eflags(void) +#else read_eflags(void) +#endif { u_int ef; @@ -335,7 +339,11 @@ wbinvd(void) } static __inline void +#ifdef XEN +_write_eflags(u_int ef) +#else write_eflags(u_int ef) +#endif { __asm __volatile("pushl %0; popfl" : : "r" (ef)); } @@ -653,23 +661,15 @@ intr_disable(void) { register_t eflags; -#ifdef XEN - eflags = xen_save_and_cli(); -#else eflags = read_eflags(); disable_intr(); -#endif return (eflags); } static __inline void intr_restore(register_t eflags) { -#ifdef XEN - xen_restore_flags(eflags); -#else write_eflags(eflags); -#endif } #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ Modified: head/sys/i386/xen/xen_machdep.c ============================================================================== --- head/sys/i386/xen/xen_machdep.c Thu Oct 1 21:44:30 2009 (r197692) +++ head/sys/i386/xen/xen_machdep.c Thu Oct 1 22:05:38 2009 (r197693) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -101,6 +102,7 @@ void ni_sti(void); void ni_cli(void) { + CTR0(KTR_SPARE2, "ni_cli disabling interrupts"); __asm__("pushl %edx;" "pushl %eax;" ); @@ -345,33 +347,53 @@ xen_load_cr3(u_int val) PANIC_IF(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); } -void -xen_restore_flags(u_int eflags) +#ifdef KTR +static __inline u_int +rebp(void) { - if (eflags > 1) - eflags = ((eflags & PSL_I) == 0); + u_int data; - __restore_flags(eflags); + __asm __volatile("movl 4(%%ebp),%0" : "=r" (data)); + return (data); } +#endif -int -xen_save_and_cli(void) +u_int +read_eflags(void) { - int eflags; - - __save_and_cli(eflags); + vcpu_info_t *_vcpu; + u_int eflags; + + eflags = _read_eflags(); + _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; + if (_vcpu->evtchn_upcall_mask) + eflags &= ~PSL_I; + return (eflags); } void +write_eflags(u_int eflags) +{ + u_int intr; + + CTR2(KTR_SPARE2, "%x xen_restore_flags eflags %x", rebp(), eflags); + intr = ((eflags & PSL_I) == 0); + __restore_flags(intr); + _write_eflags(eflags); +} + +void xen_cli(void) { + CTR1(KTR_SPARE2, "%x xen_cli disabling interrupts", rebp()); __cli(); } void xen_sti(void) { + CTR1(KTR_SPARE2, "%x xen_sti enabling interrupts", rebp()); __sti(); } From delphij at delphij.net Fri Oct 2 00:42:53 2009 From: delphij at delphij.net (Xin LI) Date: Fri Oct 2 00:42:59 2009 Subject: svn commit: r197662 - head/sys/kern In-Reply-To: <200910011250.n91CoQ5G051511@svn.freebsd.org> References: <200910011250.n91CoQ5G051511@svn.freebsd.org> Message-ID: <4AC54C81.7030201@delphij.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Konstantin Belousov wrote: > Author: kib > Date: Thu Oct 1 12:50:26 2009 > New Revision: 197662 > URL: http://svn.freebsd.org/changeset/base/197662 > > Log: > Do not dereference vp->v_mount without holding vnode lock and checking > that the vnode is not reclaimed. > > Noted by: Igor Sysoev > MFC after: 1 week Thanks! > Modified: > head/sys/kern/uipc_syscalls.c > > Modified: head/sys/kern/uipc_syscalls.c > ============================================================================== > --- head/sys/kern/uipc_syscalls.c Thu Oct 1 12:48:35 2009 (r197661) > +++ head/sys/kern/uipc_syscalls.c Thu Oct 1 12:50:26 2009 (r197662) > @@ -2086,9 +2086,11 @@ retry_space: > /* > * Get the page from backing store. > */ > - bsize = vp->v_mount->mnt_stat.f_iosize; > vfslocked = VFS_LOCK_GIANT(vp->v_mount); > - vn_lock(vp, LK_SHARED | LK_RETRY); > + error = vn_lock(vp, LK_SHARED); > + if (error != 0) > + goto after_read; > + bsize = vp->v_mount->mnt_stat.f_iosize; > > /* > * XXXMAC: Because we don't have fp->f_cred > @@ -2101,6 +2103,7 @@ retry_space: > IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), > td->td_ucred, NOCRED, &resid, td); > VOP_UNLOCK(vp, 0); > + after_read: > VFS_UNLOCK_GIANT(vfslocked); > VM_OBJECT_LOCK(obj); > vm_page_io_finish(pg); > - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) iEYEARECAAYFAkrFTIAACgkQi+vbBBjt66DwFgCgn1DSEwLvKdf05bwSWqe3cKwl qZEAn28OF2G63pmKDzTB5mm2O9SaGuQB =7Ae1 -----END PGP SIGNATURE----- From qingli at freebsd.org Fri Oct 2 01:32:41 2009 From: qingli at freebsd.org (Qing Li) Date: Fri Oct 2 01:32:52 2009 Subject: svn commit: r197687 - head/sys/net In-Reply-To: <200910012032.n91KWTOa064111@svn.freebsd.org> References: <200910012032.n91KWTOa064111@svn.freebsd.org> Message-ID: <9ace436c0910011832q3fe6d273nbfd3c9a5d8d348ed@mail.gmail.com> I misinterpreted the "Submitted by:" field. I thought I put in the names of persons who reported the bug. Disregard the "Submitted by" field for this checkin. It's my code. Something breaks, my fault, email me ... -- Qing On Thu, Oct 1, 2009 at 1:32 PM, Qing Li wrote: > Author: qingli > Date: Thu Oct ?1 20:32:29 2009 > New Revision: 197687 > URL: http://svn.freebsd.org/changeset/base/197687 > > Log: > ?The flow-table associates TCP/UDP flows and IP destinations with > ?specific routes. When the routing table changes, for example, > ?when a new route with a more specific prefix is inserted into the > ?routing table, the flow-table is not updated to reflect that change. > ?As such existing connections cannot take advantage of the new path. > ?In some cases the path is broken. This patch will update the affected > ?flow-table entries when a more specific route is added. The route > ?entry is properly marked when a route is deleted from the table. > ?In this case, when the flow-table performs a search, the stale > ?entry is updated automatically. Therefore this patch is not > ?necessary for route deletion. > > ?Submitted by: simon, phk > ?Reviewed by: ?bz, kmacy > ?MFC after: ? ?3 days > > Modified: > ?head/sys/net/flowtable.c > ?head/sys/net/flowtable.h > ?head/sys/net/route.c > > Modified: head/sys/net/flowtable.c > ============================================================================== > --- head/sys/net/flowtable.c ? ?Thu Oct ?1 20:11:42 2009 ? ? ? ?(r197686) > +++ head/sys/net/flowtable.c ? ?Thu Oct ?1 20:32:29 2009 ? ? ? ?(r197687) > @@ -830,7 +830,7 @@ fle_free(struct flentry *fle) > ?} > > ?static void > -flowtable_free_stale(struct flowtable *ft) > +flowtable_free_stale(struct flowtable *ft, struct rtentry *rt) > ?{ > ? ? ? ?int curbit = 0, count; > ? ? ? ?struct flentry *fle, ?**flehead, *fleprev; > @@ -866,8 +866,14 @@ flowtable_free_stale(struct flowtable *f > ? ? ? ? ? ? ? ? ? ? ? ? ? ?curbit); > ? ? ? ? ? ? ? ?} > ?#endif > - ? ? ? ? ? ? ? while (fle != NULL) { > - ? ? ? ? ? ? ? ? ? ? ? if (!flow_stale(ft, fle)) { > + ? ? ? ? ? ? ? while (fle != NULL) { > + ? ? ? ? ? ? ? ? ? ? ? if (rt != NULL) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (__DEVOLATILE(struct rtentry *, fle->f_rt) != rt) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fleprev = fle; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fle = fle->f_next; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? } else if (!flow_stale(ft, fle)) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?fleprev = fle; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?fle = fle->f_next; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?continue; > @@ -916,6 +922,30 @@ flowtable_free_stale(struct flowtable *f > ? ? ? ? ? ? ? ?log(LOG_DEBUG, "freed %d flow entries\n", count); > ?} > > +void > +flowtable_route_flush(struct flowtable *ft, struct rtentry *rt) > +{ > + ? ? ? int i; > + ? ? ? if (ft->ft_flags & FL_PCPU) { > + ? ? ? ? ? ? ? for (i = 0; i <= mp_maxid; i++) { > + ? ? ? ? ? ? ? ? ? ? ? if (CPU_ABSENT(i)) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue; > + > + ? ? ? ? ? ? ? ? ? ? ? thread_lock(curthread); > + ? ? ? ? ? ? ? ? ? ? ? sched_bind(curthread, i); > + ? ? ? ? ? ? ? ? ? ? ? thread_unlock(curthread); > + > + ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft, rt); > + > + ? ? ? ? ? ? ? ? ? ? ? thread_lock(curthread); > + ? ? ? ? ? ? ? ? ? ? ? sched_unbind(curthread); > + ? ? ? ? ? ? ? ? ? ? ? thread_unlock(curthread); > + ? ? ? ? ? ? ? } > + ? ? ? } else { > + ? ? ? ? ? ? ? flowtable_free_stale(ft, rt); > + ? ? ? } > +} > + > ?static void > ?flowtable_clean_vnet(void) > ?{ > @@ -933,14 +963,14 @@ flowtable_clean_vnet(void) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sched_bind(curthread, i); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?thread_unlock(curthread); > > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft, NULL); > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?thread_lock(curthread); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sched_unbind(curthread); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?thread_unlock(curthread); > ? ? ? ? ? ? ? ? ? ? ? ?} > ? ? ? ? ? ? ? ?} else { > - ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft); > + ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft, NULL); > ? ? ? ? ? ? ? ?} > ? ? ? ? ? ? ? ?ft = ft->ft_next; > ? ? ? ?} > > Modified: head/sys/net/flowtable.h > ============================================================================== > --- head/sys/net/flowtable.h ? ?Thu Oct ?1 20:11:42 2009 ? ? ? ?(r197686) > +++ head/sys/net/flowtable.h ? ?Thu Oct ?1 20:32:29 2009 ? ? ? ?(r197687) > @@ -51,5 +51,7 @@ struct flowtable *flowtable_alloc(int ne > ?int flowtable_lookup(struct flowtable *ft, struct mbuf *m, > ? ? struct route *ro, uint32_t fibnum); > > +void flowtable_route_flush(struct flowtable *ft, struct rtentry *rt); > + > ?#endif /* _KERNEL */ > ?#endif > > Modified: head/sys/net/route.c > ============================================================================== > --- head/sys/net/route.c ? ? ? ?Thu Oct ?1 20:11:42 2009 ? ? ? ?(r197686) > +++ head/sys/net/route.c ? ? ? ?Thu Oct ?1 20:32:29 2009 ? ? ? ?(r197687) > @@ -56,6 +56,7 @@ > ?#include > ?#include > ?#include > +#include > > ?#ifdef RADIX_MPATH > ?#include > @@ -996,6 +997,9 @@ rtrequest1_fib(int req, struct rt_addrin > ?{ > ? ? ? ?int error = 0, needlock = 0; > ? ? ? ?register struct rtentry *rt; > +#ifdef FLOWTABLE > + ? ? ? register struct rtentry *rt0; > +#endif > ? ? ? ?register struct radix_node *rn; > ? ? ? ?register struct radix_node_head *rnh; > ? ? ? ?struct ifaddr *ifa; > @@ -1153,6 +1157,53 @@ rtrequest1_fib(int req, struct rt_addrin > ? ? ? ? ? ? ? ?} > ?#endif > > +#ifdef FLOWTABLE > + ? ? ? ? ? ? ? rt0 = NULL; > + ? ? ? ? ? ? ? /* XXX > + ? ? ? ? ? ? ? ?* "flow-table" only support IPv4 at the moment. > + ? ? ? ? ? ? ? ?*/ > + ? ? ? ? ? ? ? if (dst->sa_family == AF_INET) { > + ? ? ? ? ? ? ? ? ? ? ? rn = rnh->rnh_matchaddr(dst, rnh); > + ? ? ? ? ? ? ? ? ? ? ? if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct sockaddr *mask; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u_char *m, *n; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int len; > + > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?* compare mask to see if the new route is > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?* more specific than the existing one > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rt0 = RNTORT(rn); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RT_LOCK(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RT_ADDREF(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RT_UNLOCK(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?* A host route is already present, so > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?* leave the flow-table entries as is. > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (rt0->rt_flags & RTF_HOST) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RTFREE(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rt0 = NULL; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } else if (!(flags & RTF_HOST) && netmask) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mask = rt_mask(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? len = mask->sa_len; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m = (u_char *)mask; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? n = (u_char *)netmask; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? while (len-- > 0) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (*n != *m) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? n++; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m++; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (len == 0 || (*n < *m)) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RTFREE(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rt0 = NULL; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? } > +#endif > + > ? ? ? ? ? ? ? ?/* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ > ? ? ? ? ? ? ? ?rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); > ? ? ? ? ? ? ? ?/* > @@ -1165,8 +1216,18 @@ rtrequest1_fib(int req, struct rt_addrin > ? ? ? ? ? ? ? ? ? ? ? ?Free(rt_key(rt)); > ? ? ? ? ? ? ? ? ? ? ? ?RT_LOCK_DESTROY(rt); > ? ? ? ? ? ? ? ? ? ? ? ?uma_zfree(V_rtzone, rt); > +#ifdef FLOWTABLE > + ? ? ? ? ? ? ? ? ? ? ? if (rt0 != NULL) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RTFREE(rt0); > +#endif > ? ? ? ? ? ? ? ? ? ? ? ?senderr(EEXIST); > + ? ? ? ? ? ? ? } > +#ifdef FLOWTABLE > + ? ? ? ? ? ? ? else if (rt0 != NULL) { > + ? ? ? ? ? ? ? ? ? ? ? flowtable_route_flush(V_ip_ft, rt0); > + ? ? ? ? ? ? ? ? ? ? ? RTFREE(rt0); > ? ? ? ? ? ? ? ?} > +#endif > > ? ? ? ? ? ? ? ?/* > ? ? ? ? ? ? ? ? * If this protocol has something to add to this then > From qingli at FreeBSD.org Fri Oct 2 01:34:55 2009 From: qingli at FreeBSD.org (Qing Li) Date: Fri Oct 2 01:35:07 2009 Subject: svn commit: r197695 - head/sys/netinet Message-ID: <200910020134.n921YtW8084991@svn.freebsd.org> Author: qingli Date: Fri Oct 2 01:34:55 2009 New Revision: 197695 URL: http://svn.freebsd.org/changeset/base/197695 Log: Previously, if an address alias is configured on an interface, and this address alias has a prefix matching that of another address configured on the same interface, then the ARP entry for the alias is not deleted from the ARP table when that address alias is removed. This patch fixes the aforementioned issue. PR: kern/139113 MFC after: 3 days Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Oct 2 01:07:28 2009 (r197694) +++ head/sys/netinet/in.c Fri Oct 2 01:34:55 2009 (r197695) @@ -1060,6 +1060,8 @@ in_scrubprefix(struct in_ifaddr *target) !(target->ia_ifp->if_flags & IFF_LOOPBACK)) { error = ifa_del_loopback_route((struct ifaddr *)target, (struct sockaddr *)&target->ia_addr); + /* remove arp cache */ + arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr); } if ((target->ia_flags & IFA_ROUTE) == 0) { @@ -1082,8 +1084,6 @@ in_scrubprefix(struct in_ifaddr *target) prefix = target->ia_addr.sin_addr; mask = target->ia_sockmask.sin_addr; prefix.s_addr &= mask.s_addr; - /* remove arp cache */ - arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr); } IN_IFADDR_RLOCK(); From qingli at FreeBSD.org Fri Oct 2 01:45:11 2009 From: qingli at FreeBSD.org (Qing Li) Date: Fri Oct 2 01:45:17 2009 Subject: svn commit: r197696 - head/sys/netinet Message-ID: <200910020145.n921jBwI085264@svn.freebsd.org> Author: qingli Date: Fri Oct 2 01:45:11 2009 New Revision: 197696 URL: http://svn.freebsd.org/changeset/base/197696 Log: Remove a log message from production code. This log message can be triggered by a misconfigured host that is sending out gratuious ARPs. This log message can also be triggered during a network renumbering event when multiple prefixes co-exist on a single network segment. MFC after: immediately Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Oct 2 01:34:55 2009 (r197695) +++ head/sys/netinet/in.c Fri Oct 2 01:45:11 2009 (r197696) @@ -1327,8 +1327,10 @@ in_lltable_rtcheck(struct ifnet *ifp, co /* XXX rtalloc1 should take a const param */ rt = rtalloc1(__DECONST(struct sockaddr *, l3addr), 0, 0); if (rt == NULL || (rt->rt_flags & RTF_GATEWAY) || rt->rt_ifp != ifp) { +#ifdef DIAGNOSTICS log(LOG_INFO, "IPv4 address: \"%s\" is not on the network\n", inet_ntoa(((const struct sockaddr_in *)l3addr)->sin_addr)); +#endif if (rt != NULL) RTFREE_LOCKED(rt); return (EINVAL); From hrs at FreeBSD.org Fri Oct 2 02:24:26 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 02:24:38 2009 Subject: svn commit: r197697 - in head/etc: . rc.d Message-ID: <200910020224.n922OPcG086114@svn.freebsd.org> Author: hrs Date: Fri Oct 2 02:24:25 2009 New Revision: 197697 URL: http://svn.freebsd.org/changeset/base/197697 Log: - Add AF_IPX and AF_NATM to afexists(). - Add afexists() check to address family specific rc.d scripts. A script for an AF will be silently ignored if the kernel has no support for the AF. Modified: head/etc/network.subr head/etc/rc.d/defaultroute head/etc/rc.d/faith head/etc/rc.d/ip6addrctl head/etc/rc.d/static_arp head/etc/rc.d/stf Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/network.subr Fri Oct 2 02:24:25 2009 (r197697) @@ -356,6 +356,16 @@ afexists() inet6) ${SYSCTL_N} net.inet6 > /dev/null 2>&1 ;; + ipx) + ${SYSCTL_N} net.ipx > /dev/null 2>&1 + ;; + atm) + if [ -x /sbin/atmconfig ]; then + /sbin/atmconfig diag list > /dev/null 2>&1 + else + return 1 + fi + ;; *) err 1 "afexists(): Unsupported address family: $_af" ;; Modified: head/etc/rc.d/defaultroute ============================================================================== --- head/etc/rc.d/defaultroute Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/defaultroute Fri Oct 2 02:24:25 2009 (r197697) @@ -20,6 +20,8 @@ defaultroute_start() { local output carrier nocarrier nl + afexists inet || return 0 + # Return without waiting if we don't have dhcp interfaces or # if none of the dhcp interfaces is plugged in. dhcp_interfaces=`list_net_interfaces dhcp` Modified: head/etc/rc.d/faith ============================================================================== --- head/etc/rc.d/faith Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/faith Fri Oct 2 02:24:25 2009 (r197697) @@ -15,6 +15,8 @@ stop_cmd="faith_down" faith_up() { + afexists inet6 || return 0 + case ${ipv6_faith_prefix} in [Nn][Oo] | '') ;; @@ -48,6 +50,8 @@ faith_up() faith_down() { + afexists inet6 || return 0 + echo "Removing IPv6-to-IPv4 TCP relay capturing interface: faith0." ifconfig faith0 destroy ${SYSCTL_W} net.inet6.ip6.keepfaith=0 Modified: head/etc/rc.d/ip6addrctl ============================================================================== --- head/etc/rc.d/ip6addrctl Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/ip6addrctl Fri Oct 2 02:24:25 2009 (r197697) @@ -9,6 +9,7 @@ # KEYWORD: nojail . /etc/rc.subr +. /etc/network.subr name="ip6addrctl" rcvar=`set_rcvar` @@ -23,6 +24,8 @@ set_rcvar_obsolete ipv6_enable ipv6_pref ip6addrctl_prefer_ipv6() { + afexists inet6 || return 0 + ip6addrctl flush >/dev/null 2>&1 ip6addrctl add ::1/128 50 0 ip6addrctl add ::/0 40 1 @@ -34,6 +37,8 @@ ip6addrctl_prefer_ipv6() ip6addrctl_prefer_ipv4() { + afexists inet6 || return 0 + ip6addrctl flush >/dev/null 2>&1 ip6addrctl add ::ffff:0:0/96 50 0 ip6addrctl add ::1/128 40 1 @@ -45,30 +50,27 @@ ip6addrctl_prefer_ipv4() ip6addrctl_start() { - if ifconfig lo0 inet6 >/dev/null 2>&1; then - # We have IPv6 support in kernel. + afexists inet6 || return 0 - # install the policy of the address selection algorithm. - if [ -f /etc/ip6addrctl.conf ]; then - ip6addrctl flush >/dev/null 2>&1 - ip6addrctl install /etc/ip6addrctl.conf - checkyesno ip6addrctl_verbose && ip6addrctl + # install the policy of the address selection algorithm. + if [ -f /etc/ip6addrctl.conf ]; then + ip6addrctl flush >/dev/null 2>&1 + ip6addrctl install /etc/ip6addrctl.conf + checkyesno ip6addrctl_verbose && ip6addrctl + else + if checkyesno ipv6_prefer; then + ip6addrctl_prefer_ipv6 else - if checkyesno ipv6_prefer; then - ip6addrctl_prefer_ipv6 - else - ip6addrctl_prefer_ipv4 - fi + ip6addrctl_prefer_ipv4 fi fi } ip6addrctl_stop() { - if ifconfig lo0 inet6 >/dev/null 2>&1; then - # We have IPv6 support in kernel. - ip6addrctl flush >/dev/null 2>&1 - fi + afexists inet6 || return 0 + + ip6addrctl flush >/dev/null 2>&1 } load_rc_config $name Modified: head/etc/rc.d/static_arp ============================================================================== --- head/etc/rc.d/static_arp Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/static_arp Fri Oct 2 02:24:25 2009 (r197697) @@ -34,6 +34,7 @@ # KEYWORD: nojail . /etc/rc.subr +. /etc/network.subr name="static_arp" start_cmd="static_arp_start" @@ -43,6 +44,8 @@ static_arp_start() { local e arp_args + afexists inet || return 0 + if [ -n "${static_arp_pairs}" ]; then echo -n 'Binding static ARP pair(s):' for e in ${static_arp_pairs}; do @@ -58,6 +61,8 @@ static_arp_stop() { local e arp_args + afexists inet || return 0 + if [ -n "${static_arp_pairs}" ]; then echo -n 'Unbinding static ARP pair(s):' for e in ${static_arp_pairs}; do Modified: head/etc/rc.d/stf ============================================================================== --- head/etc/rc.d/stf Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/stf Fri Oct 2 02:24:25 2009 (r197697) @@ -15,6 +15,8 @@ stop_cmd="stf_down" stf_up() { + afexists inet6 || return 0 + case ${stf_interface_ipv4addr} in [Nn][Oo] | '') ;; @@ -67,6 +69,8 @@ stf_up() stf_down() { + afexists inet6 || return 0 + echo "Removing 6to4 tunnel interface: stf0." ifconfig stf0 destroy route delete -inet6 2002:e000:: -prefixlen 20 ::1 From hrs at FreeBSD.org Fri Oct 2 02:27:50 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 02:27:56 2009 Subject: svn commit: r197698 - head/etc/rc.d Message-ID: <200910020227.n922RnBd086217@svn.freebsd.org> Author: hrs Date: Fri Oct 2 02:27:49 2009 New Revision: 197698 URL: http://svn.freebsd.org/changeset/base/197698 Log: - Fix logic inversion bug of net.inet.tcp.rfc1323[*]. - Split netoptions_start() to netoptions_AF() and add afexists() check for each address family. - Display a message only if the user sets a non-default value, and set a sysctl explicitly even if it is the default value. Spotted by: Pegasus Mc Cleaft[*] Modified: head/etc/rc.d/netoptions Modified: head/etc/rc.d/netoptions ============================================================================== --- head/etc/rc.d/netoptions Fri Oct 2 02:24:25 2009 (r197697) +++ head/etc/rc.d/netoptions Fri Oct 2 02:27:49 2009 (r197698) @@ -26,29 +26,48 @@ netoptions_init() netoptions_start() { + local _af + + for _af in inet inet6; do + afexists ${_af} && eval netoptions_${_af} + done + [ -n "${_netoptions_initdone}" ] && echo '.' +} + +netoptions_inet() +{ if checkyesno log_in_vain; then netoptions_init echo -n " log_in_vain=${log_in_vain}" - ${SYSCTL_W} net.inet.tcp.log_in_vain="${log_in_vain}" >/dev/null - ${SYSCTL_W} net.inet.udp.log_in_vain="${log_in_vain}" >/dev/null + ${SYSCTL_W} net.inet.tcp.log_in_vain=1 >/dev/null + ${SYSCTL_W} net.inet.udp.log_in_vain=1 >/dev/null + else + ${SYSCTL_W} net.inet.tcp.log_in_vain=0 >/dev/null + ${SYSCTL_W} net.inet.udp.log_in_vain=0 >/dev/null fi if checkyesno tcp_extensions; then + ${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null + else netoptions_init - echo -n ' rfc1323 extensions=NO' + echo -n ' rfc1323 extensions=${tcp_extensions}' ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null fi - if ! checkyesno tcp_keepalive; then + if checkyesno tcp_keepalive; then + ${SYSCTL_W} net.inet.tcp.always_keepalive=1 >/dev/null + else netoptions_init - echo -n ' TCP keepalive=NO' + echo -n ' TCP keepalive=${tcp_keepalive}' ${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null fi if checkyesno tcp_drop_synfin; then netoptions_init - echo -n ' drop SYN+FIN packets=YES' + echo -n ' drop SYN+FIN packets=${tcp_drop_synfin}' ${SYSCTL_W} net.inet.tcp.drop_synfin=1 >/dev/null + else + ${SYSCTL_W} net.inet.tcp.drop_synfin=0 >/dev/null fi case ${ip_portrange_first} in @@ -66,17 +85,17 @@ netoptions_start() ${SYSCTL_W} net.inet.ip.portrange.last=$ip_portrange_last >/dev/null ;; esac +} - if afexists inet6; then - if checkyesno ipv6_ipv4mapping; then - ${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null - else - echo -n " no-ipv4-mapped-ipv6" - ${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null - fi +netoptions_inet6() +{ + if checkyesno ipv6_ipv4mapping; then + netoptions_init + echo -n " ipv4-mapped-ipv6=${ipv6_ipv4mapping}" + ${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null + else + ${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null fi - - [ -n "${_netoptions_initdone}" ] && echo '.' } load_rc_config $name From hrs at FreeBSD.org Fri Oct 2 02:28:59 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 02:29:10 2009 Subject: svn commit: r197699 - head/etc/rc.d Message-ID: <200910020228.n922SxFT086277@svn.freebsd.org> Author: hrs Date: Fri Oct 2 02:28:59 2009 New Revision: 197699 URL: http://svn.freebsd.org/changeset/base/197699 Log: - Split routing_*() and option_*() to *_AF() and add afexists() check for each address family. Replace AF_static() with static_AF() for consistency. - Display a message only if the user sets a non-default value, and set a sysctl explicitly even if it is the default value. Modified: head/etc/rc.d/routing Modified: head/etc/rc.d/routing ============================================================================== --- head/etc/rc.d/routing Fri Oct 2 02:27:49 2009 (r197698) +++ head/etc/rc.d/routing Fri Oct 2 02:28:59 2009 (r197699) @@ -27,8 +27,24 @@ routing_start() routing_stop() { + local _af + static_stop "$@" - route -n flush + for _af in inet inet6; do + afexists ${_af} && eval routing_stop_${_af} + done +} + +routing_stop_inet() +{ + route -n flush -inet +} + +routing_stop_inet6() +{ + local i + + route -n flush -inet6 for i in ${ipv6_network_interfaces}; do ifconfig $i inet6 -defaultif done @@ -40,21 +56,11 @@ static_start() _af=$1 case ${_af} in - inet) - do_static inet add + inet|inet6|atm) + do_static add ${_af} ;; - inet6) - do_static inet6 add - ;; - atm) - do_static atm add - ;; - *) - do_static inet add - if afexists inet6; then - do_static inet6 add - fi - do_static atm add + "") + do_static add inet inet6 atm ;; esac } @@ -65,21 +71,11 @@ static_stop() _af=$1 case ${_af} in - inet) - do_static inet delete - ;; - inet6) - do_static inet6 delete + inet|inet6|atm) + do_static delete ${_af} ;; - atm) - do_static atm delete - ;; - *) - do_static inet delete - if afexists inet6; then - do_static inet6 delete - fi - do_static atm delete + "") + do_static delete inet inet6 atm ;; esac } @@ -87,13 +83,15 @@ static_stop() do_static() { local _af _action - _af=$1 - _action=$2 + _action=$1 - eval $1_static $2 + shift + for _af in "$@"; do + afexists ${_af} && eval static_${_af} ${_action} + done } -inet_static() +static_inet() { local _action _action=$1 @@ -115,7 +113,7 @@ inet_static() fi } -inet6_static() +static_inet6() { local _action i _action=$1 @@ -222,9 +220,9 @@ inet6_static() esac } -atm_static() +static_atm() { - local _action i + local _action i route_args _action=$1 if [ -n "${natm_static_routes}" ]; then @@ -246,61 +244,93 @@ ropts_init() options_start() { + local _af + + for _af in inet inet6 ipx; do + afexists ${_af} && eval options_${_af} + done + [ -n "${_ropts_initdone}" ] && echo '.' +} + +options_inet() +{ if checkyesno icmp_bmcastecho; then ropts_init echo -n ' broadcast ping responses=YES' - sysctl net.inet.icmp.bmcastecho=1 >/dev/null + ${SYSCTL_W} net.inet.icmp.bmcastecho=1 > /dev/null + else + ${SYSCTL_W} net.inet.icmp.bmcastecho=0 > /dev/null fi if checkyesno icmp_drop_redirect; then ropts_init echo -n ' ignore ICMP redirect=YES' - sysctl net.inet.icmp.drop_redirect=1 >/dev/null + ${SYSCTL_W} net.inet.icmp.drop_redirect=1 > /dev/null + else + ${SYSCTL_W} net.inet.icmp.drop_redirect=0 > /dev/null fi if checkyesno icmp_log_redirect; then ropts_init echo -n ' log ICMP redirect=YES' - sysctl net.inet.icmp.log_redirect=1 >/dev/null + ${SYSCTL_W} net.inet.icmp.log_redirect=1 > /dev/null + else + ${SYSCTL_W} net.inet.icmp.log_redirect=0 > /dev/null fi if checkyesno gateway_enable; then ropts_init echo -n ' IPv4 gateway=YES' - sysctl net.inet.ip.forwarding=1 >/dev/null - fi - - if checkyesno ipv6_gateway_enable; then - ropts_init - echo -n ' IPv6 gateway=YES' - sysctl net.inet6.ip6.forwarding=1 >/dev/null + ${SYSCTL_W} net.inet.ip.forwarding=1 > /dev/null + else + ${SYSCTL_W} net.inet.ip.forwarding=0 > /dev/null fi if checkyesno forward_sourceroute; then ropts_init echo -n ' do source routing=YES' - sysctl net.inet.ip.sourceroute=1 >/dev/null + ${SYSCTL_W} net.inet.ip.sourceroute=1 > /dev/null + else + ${SYSCTL_W} net.inet.ip.sourceroute=0 > /dev/null fi if checkyesno accept_sourceroute; then ropts_init echo -n ' accept source routing=YES' - sysctl net.inet.ip.accept_sourceroute=1 >/dev/null + ${SYSCTL_W} net.inet.ip.accept_sourceroute=1 > /dev/null + else + ${SYSCTL_W} net.inet.ip.accept_sourceroute=0 > /dev/null fi - if checkyesno ipxgateway_enable; then + if checkyesno arpproxy_all; then ropts_init - echo -n ' IPX gateway=YES' - sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null + echo -n ' ARP proxyall=YES' + ${SYSCTL_W} net.link.ether.inet.proxyall=1 > /dev/null + else + ${SYSCTL_W} net.link.ether.inet.proxyall=0 > /dev/null fi +} - if checkyesno arpproxy_all; then +options_inet6() +{ + if checkyesno ipv6_gateway_enable; then ropts_init - echo -n ' ARP proxyall=YES' - sysctl net.link.ether.inet.proxyall=1 >/dev/null + echo -n ' IPv6 gateway=YES' + ${SYSCTL_W} net.inet6.ip6.forwarding=1 > /dev/null + else + ${SYSCTL_W} net.inet6.ip6.forwarding=0 > /dev/null fi +} - [ -n "${_ropts_initdone}" ] && echo '.' +options_ipx() +{ + if checkyesno ipxgateway_enable; then + ropts_init + echo -n ' IPX gateway=YES' + ${SYSCTL_W} net.ipx.ipx.ipxforwarding=1 > /dev/null + else + ${SYSCTL_W} net.ipx.ipx.ipxforwarding=0 > /dev/null + fi } load_rc_config $name From sam at freebsd.org Fri Oct 2 03:02:02 2009 From: sam at freebsd.org (Sam Leffler) Date: Fri Oct 2 03:02:09 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <20091002002534.D21507@delplex.bde.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> Message-ID: <4AC56D26.4030500@freebsd.org> Bruce Evans wrote: > On Thu, 1 Oct 2009, [utf-8] Dag-Erling Sm??rgrav wrote: > >> Coleman Kane writes: >>> - if (sc->ndis_80211 && vap) >>> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) >> >> sc->ndis_80211 is an int. NULL is a pointer. > > Also, the number of style bugs was doubled on (almost?) every changed line > by adding 2 sets of unnecessary parentheses. FWIW I simply asked he compare ptr's against NULL. The excessive paren's hurt my eyes too :-) Sam From hrs at FreeBSD.org Fri Oct 2 06:19:34 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 06:19:46 2009 Subject: svn commit: r197701 - head/etc/rc.d Message-ID: <200910020619.n926JYGK091501@svn.freebsd.org> Author: hrs Date: Fri Oct 2 06:19:34 2009 New Revision: 197701 URL: http://svn.freebsd.org/changeset/base/197701 Log: Revert the previous afexists() change. Knobs configured explicitly by the user should not be ignored if possible even if the kernel does not support the prerequisite feature. Discussed with: ume Modified: head/etc/rc.d/faith head/etc/rc.d/static_arp head/etc/rc.d/stf Modified: head/etc/rc.d/faith ============================================================================== --- head/etc/rc.d/faith Fri Oct 2 05:11:46 2009 (r197700) +++ head/etc/rc.d/faith Fri Oct 2 06:19:34 2009 (r197701) @@ -15,8 +15,6 @@ stop_cmd="faith_down" faith_up() { - afexists inet6 || return 0 - case ${ipv6_faith_prefix} in [Nn][Oo] | '') ;; @@ -50,8 +48,6 @@ faith_up() faith_down() { - afexists inet6 || return 0 - echo "Removing IPv6-to-IPv4 TCP relay capturing interface: faith0." ifconfig faith0 destroy ${SYSCTL_W} net.inet6.ip6.keepfaith=0 Modified: head/etc/rc.d/static_arp ============================================================================== --- head/etc/rc.d/static_arp Fri Oct 2 05:11:46 2009 (r197700) +++ head/etc/rc.d/static_arp Fri Oct 2 06:19:34 2009 (r197701) @@ -44,8 +44,6 @@ static_arp_start() { local e arp_args - afexists inet || return 0 - if [ -n "${static_arp_pairs}" ]; then echo -n 'Binding static ARP pair(s):' for e in ${static_arp_pairs}; do @@ -61,8 +59,6 @@ static_arp_stop() { local e arp_args - afexists inet || return 0 - if [ -n "${static_arp_pairs}" ]; then echo -n 'Unbinding static ARP pair(s):' for e in ${static_arp_pairs}; do Modified: head/etc/rc.d/stf ============================================================================== --- head/etc/rc.d/stf Fri Oct 2 05:11:46 2009 (r197700) +++ head/etc/rc.d/stf Fri Oct 2 06:19:34 2009 (r197701) @@ -15,8 +15,6 @@ stop_cmd="stf_down" stf_up() { - afexists inet6 || return 0 - case ${stf_interface_ipv4addr} in [Nn][Oo] | '') ;; @@ -69,8 +67,6 @@ stf_up() stf_down() { - afexists inet6 || return 0 - echo "Removing 6to4 tunnel interface: stf0." ifconfig stf0 destroy route delete -inet6 2002:e000:: -prefixlen 20 ::1 From tom at tomjudge.com Fri Oct 2 06:42:46 2009 From: tom at tomjudge.com (Tom Judge) Date: Fri Oct 2 06:42:57 2009 Subject: svn commit: r197687 - head/sys/net In-Reply-To: <200910012032.n91KWTOa064111@svn.freebsd.org> References: <200910012032.n91KWTOa064111@svn.freebsd.org> Message-ID: <4AC59C42.1030903@tomjudge.com> Qing Li wrote: > Author: qingli > Date: Thu Oct 1 20:32:29 2009 > New Revision: 197687 > URL: http://svn.freebsd.org/changeset/base/197687 > > Log: > The flow-table associates TCP/UDP flows and IP destinations with > specific routes. When the routing table changes, for example, > when a new route with a more specific prefix is inserted into the > routing table, the flow-table is not updated to reflect that change. > As such existing connections cannot take advantage of the new path. > In some cases the path is broken. This patch will update the affected > flow-table entries when a more specific route is added. The route > entry is properly marked when a route is deleted from the table. > In this case, when the flow-table performs a search, the stale > entry is updated automatically. Therefore this patch is not > necessary for route deletion. > Hi, Will this fix the issue that I see visualising its self as packet loss over a VPN tunnel? The tunnel is an openvpn (tun mode) tunnel providing a route to 192.168.201.0/24 however when I ping an address in this network with flowtable enabled I see 2-3 out of every 5-6 packets end up being sent out of bge0 (IP 172.17.XX.XX/23 GW 172.17.XX.1) to the default gateway (which responds with destination host unreachable) rather than down tun0. Thanks Tom From hrs at FreeBSD.org Fri Oct 2 06:51:39 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 06:51:50 2009 Subject: svn commit: r197702 - head/etc/rc.d Message-ID: <200910020651.n926pdFA092242@svn.freebsd.org> Author: hrs Date: Fri Oct 2 06:51:39 2009 New Revision: 197702 URL: http://svn.freebsd.org/changeset/base/197702 Log: The net.inet.tcp.log_in_vain accepts 0, 1 or 2, not Y/N. Modified: head/etc/rc.d/netoptions Modified: head/etc/rc.d/netoptions ============================================================================== --- head/etc/rc.d/netoptions Fri Oct 2 06:19:34 2009 (r197701) +++ head/etc/rc.d/netoptions Fri Oct 2 06:51:39 2009 (r197702) @@ -36,15 +36,18 @@ netoptions_start() netoptions_inet() { - if checkyesno log_in_vain; then + case ${log_in_vain} in + [12]) netoptions_init echo -n " log_in_vain=${log_in_vain}" - ${SYSCTL_W} net.inet.tcp.log_in_vain=1 >/dev/null - ${SYSCTL_W} net.inet.udp.log_in_vain=1 >/dev/null - else + ${SYSCTL_W} net.inet.tcp.log_in_vain=${log_in_vain} >/dev/null + ${SYSCTL_W} net.inet.udp.log_in_vain=${log_in_vain} >/dev/null + ;; + *) ${SYSCTL_W} net.inet.tcp.log_in_vain=0 >/dev/null ${SYSCTL_W} net.inet.udp.log_in_vain=0 >/dev/null - fi + ;; + esac if checkyesno tcp_extensions; then ${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null From hrs at FreeBSD.org Fri Oct 2 07:00:20 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 07:00:31 2009 Subject: svn commit: r197703 - head/sys/netinet6 Message-ID: <200910020700.n9270KiU092488@svn.freebsd.org> Author: hrs Date: Fri Oct 2 07:00:20 2009 New Revision: 197703 URL: http://svn.freebsd.org/changeset/base/197703 Log: Enable adding a link-local address even if ND6_IFF_IFDISABLED. Note that when the interface has ND6_IFF_IFDISABLED, a newly-added address is always marked as IN6_IFF_TENTATIVE so that the interface can perform DAD after the ND6_IFF_IFDISABLED is cleared. Modified: head/sys/netinet6/in6_ifattach.c Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Fri Oct 2 06:51:39 2009 (r197702) +++ head/sys/netinet6/in6_ifattach.c Fri Oct 2 07:00:20 2009 (r197703) @@ -751,7 +751,6 @@ in6_ifattach(struct ifnet *ifp, struct i * assign a link-local address, if there's none. */ if (ifp->if_type != IFT_BRIDGE && - !(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { int error; From qingli at freebsd.org Fri Oct 2 07:22:34 2009 From: qingli at freebsd.org (Qing Li) Date: Fri Oct 2 07:22:40 2009 Subject: svn commit: r197687 - head/sys/net In-Reply-To: <4AC59C42.1030903@tomjudge.com> References: <200910012032.n91KWTOa064111@svn.freebsd.org> <4AC59C42.1030903@tomjudge.com> Message-ID: <9ace436c0910020022mfcc1e9y3dd81796537c2a06@mail.gmail.com> I believe this patch will fix your issue. In fact two other users of openvpn reports the exact same problem symptom. Please give it a try and let me know how it works out for you. -- Qing On Thu, Oct 1, 2009 at 11:22 PM, Tom Judge wrote: > Qing Li wrote: >> >> Author: qingli >> Date: Thu Oct ?1 20:32:29 2009 >> New Revision: 197687 >> URL: http://svn.freebsd.org/changeset/base/197687 >> >> Log: >> ?The flow-table associates TCP/UDP flows and IP destinations with >> ?specific routes. When the routing table changes, for example, >> ?when a new route with a more specific prefix is inserted into the >> ?routing table, the flow-table is not updated to reflect that change. >> ?As such existing connections cannot take advantage of the new path. >> ?In some cases the path is broken. This patch will update the affected >> ?flow-table entries when a more specific route is added. The route >> ?entry is properly marked when a route is deleted from the table. >> ?In this case, when the flow-table performs a search, the stale >> ?entry is updated automatically. Therefore this patch is not >> ?necessary for route deletion. >> > > Hi, > > Will this fix the issue that I see visualising ?its self as packet loss over > a VPN tunnel? > > The tunnel is an openvpn (tun mode) tunnel providing a route to > 192.168.201.0/24 however when I ping an address in this network with > flowtable enabled I see 2-3 out of every 5-6 packets end up being sent out > of bge0 (IP 172.17.XX.XX/23 GW 172.17.XX.1) to the default gateway (which > responds with destination host unreachable) rather than down tun0. > > Thanks > > Tom > > From simon at FreeBSD.org Fri Oct 2 10:38:27 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Fri Oct 2 10:38:32 2009 Subject: svn commit: r197687 - head/sys/net In-Reply-To: <4AC59C42.1030903@tomjudge.com> References: <200910012032.n91KWTOa064111@svn.freebsd.org> <4AC59C42.1030903@tomjudge.com> Message-ID: <20091002103824.GA1653@zaphod.nitro.dk> On 2009.10.02 06:22:58 +0000, Tom Judge wrote: > Qing Li wrote: > > Author: qingli > > Date: Thu Oct 1 20:32:29 2009 > > New Revision: 197687 > > URL: http://svn.freebsd.org/changeset/base/197687 > > > > Log: > > The flow-table associates TCP/UDP flows and IP destinations with > > specific routes. When the routing table changes, for example, > > when a new route with a more specific prefix is inserted into the > > routing table, the flow-table is not updated to reflect that change. > > As such existing connections cannot take advantage of the new path. > > In some cases the path is broken. This patch will update the affected > > flow-table entries when a more specific route is added. The route > > entry is properly marked when a route is deleted from the table. > > In this case, when the flow-table performs a search, the stale > > entry is updated automatically. Therefore this patch is not > > necessary for route deletion. > > Hi, > > Will this fix the issue that I see visualising its self as packet loss > over a VPN tunnel? > > The tunnel is an openvpn (tun mode) tunnel providing a route to > 192.168.201.0/24 however when I ping an address in this network with > flowtable enabled I see 2-3 out of every 5-6 packets end up being sent > out of bge0 (IP 172.17.XX.XX/23 GW 172.17.XX.1) to the default gateway > (which responds with destination host unreachable) rather than down tun0. This sounds very similar to the problem I was seeing (also with OpenVPN), which was fixed by qingli's patch. The packet is most likely actually not lost, but routed to your default gateway instead (or whatever it would be sent before the VPN was created). -- Simon L. Nielsen From rpaulo at FreeBSD.org Fri Oct 2 11:10:06 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Fri Oct 2 11:10:18 2009 Subject: svn commit: r197704 - in head/sys/arm: arm xscale Message-ID: <200910021110.n92BA5fu099181@svn.freebsd.org> Author: rpaulo Date: Fri Oct 2 11:10:05 2009 New Revision: 197704 URL: http://svn.freebsd.org/changeset/base/197704 Log: Remove performance counter headers. This code came from NetBSD, but our hardware perf. counter support is different, so we don't need these files. Reviewed by: freebsd-arm (no comments) Deleted: head/sys/arm/xscale/xscalereg.h head/sys/arm/xscale/xscalevar.h Modified: head/sys/arm/arm/cpufunc.c Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Fri Oct 2 07:00:20 2009 (r197703) +++ head/sys/arm/arm/cpufunc.c Fri Oct 2 11:10:05 2009 (r197704) @@ -83,15 +83,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#if defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ - defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) -#include -#endif - -#if defined(PERFCTRS) -struct arm_pmc_funcs *arm_pmc; -#endif - /* PRIMARY CACHE VARIABLES */ int arm_picache_size; int arm_picache_line_size; @@ -1128,10 +1119,6 @@ set_cpufuncs() : "r" (BCUCTL_E0|BCUCTL_E1|BCUCTL_EV)); cpufuncs = xscale_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - /* * i80200 errata: Step-A0 and A1 have a bug where * D$ dirty bits are not cleared on "invalidate by @@ -1165,10 +1152,6 @@ set_cpufuncs() PMNC_CC_IF)); cpufuncs = xscale_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); pmap_pte_init_xscale(); @@ -1179,10 +1162,6 @@ set_cpufuncs() #if defined(CPU_XSCALE_81342) if (cputype == CPU_ID_81342) { cpufuncs = xscalec3_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); pmap_pte_init_xscale(); @@ -1196,10 +1175,6 @@ set_cpufuncs() (cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA210) { cpufuncs = xscale_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); pmap_pte_init_xscale(); @@ -1215,10 +1190,6 @@ set_cpufuncs() cputype == CPU_ID_IXP425_266 || cputype == CPU_ID_IXP435) { cpufuncs = xscale_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); pmap_pte_init_xscale(); From rpaulo at FreeBSD.org Fri Oct 2 11:14:12 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Fri Oct 2 11:14:23 2009 Subject: svn commit: r197706 - head/sys/sys Message-ID: <200910021114.n92BECKI099344@svn.freebsd.org> Author: rpaulo Date: Fri Oct 2 11:14:12 2009 New Revision: 197706 URL: http://svn.freebsd.org/changeset/base/197706 Log: Reserve numbers for XScale. Reviewed by: jkoshy Modified: head/sys/sys/pmc.h Modified: head/sys/sys/pmc.h ============================================================================== --- head/sys/sys/pmc.h Fri Oct 2 11:10:51 2009 (r197705) +++ head/sys/sys/pmc.h Fri Oct 2 11:14:12 2009 (r197706) @@ -84,7 +84,8 @@ __PMC_CPU(INTEL_CORE2, 0x88, "Intel Core2") \ __PMC_CPU(INTEL_CORE2EXTREME, 0x89, "Intel Core2 Extreme") \ __PMC_CPU(INTEL_ATOM, 0x8A, "Intel Atom") \ - __PMC_CPU(INTEL_COREI7, 0x8B, "Intel Core i7") + __PMC_CPU(INTEL_COREI7, 0x8B, "Intel Core i7") \ + __PMC_CPU(INTEL_XSCALE, 0x100, "Intel XScale") enum pmc_cputype { #undef __PMC_CPU @@ -93,7 +94,7 @@ enum pmc_cputype { }; #define PMC_CPU_FIRST PMC_CPU_AMD_K7 -#define PMC_CPU_LAST PMC_CPU_INTEL_COREI7 +#define PMC_CPU_LAST PMC_CPU_INTEL_XSCALE /* * Classes of PMCs @@ -107,7 +108,8 @@ enum pmc_cputype { __PMC_CLASS(P6) /* Intel Pentium Pro counters */ \ __PMC_CLASS(P4) /* Intel Pentium-IV counters */ \ __PMC_CLASS(IAF) /* Intel Core2/Atom, fixed function */ \ - __PMC_CLASS(IAP) /* Intel Core...Atom, programmable */ + __PMC_CLASS(IAP) /* Intel Core...Atom, programmable */ \ + __PMC_CLASS(XSCALE) /* Intel XScale counters */ enum pmc_class { #undef __PMC_CLASS @@ -116,7 +118,7 @@ enum pmc_class { }; #define PMC_CLASS_FIRST PMC_CLASS_TSC -#define PMC_CLASS_LAST PMC_CLASS_IAP +#define PMC_CLASS_LAST PMC_CLASS_XSCALE /* * A PMC can be in the following states: From nyan at FreeBSD.org Fri Oct 2 12:47:01 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Fri Oct 2 12:47:13 2009 Subject: svn commit: r197709 - head/sys/conf Message-ID: <200910021247.n92Cl1tb001993@svn.freebsd.org> Author: nyan Date: Fri Oct 2 12:47:01 2009 New Revision: 197709 URL: http://svn.freebsd.org/changeset/base/197709 Log: Fix build nfscl and/or nfsd. MFC after: 3 days Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Oct 2 11:46:01 2009 (r197708) +++ head/sys/conf/files Fri Oct 2 12:47:01 2009 (r197709) @@ -2668,12 +2668,12 @@ vm/vm_reserv.c standard vm/vm_unix.c standard vm/vm_zeroidle.c standard vm/vnode_pager.c standard -xdr/xdr.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_array.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_mbuf.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_mem.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_reference.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_sizeof.c optional krpc | nfslockd | nfsclient | nfsserver +xdr/xdr.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_array.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_mbuf.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_mem.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_reference.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_sizeof.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd # gnu/fs/xfs/xfs_alloc.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" \ From bz at FreeBSD.org Fri Oct 2 17:48:52 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Oct 2 17:48:58 2009 Subject: svn commit: r197711 - head/sys/kern Message-ID: <200910021748.n92Hmprd008488@svn.freebsd.org> Author: bz Date: Fri Oct 2 17:48:51 2009 New Revision: 197711 URL: http://svn.freebsd.org/changeset/base/197711 Log: Add a mitigation feature that will prevent user mappings at virtual address 0, limiting the ability to convert a kernel NULL pointer dereference into a privilege escalation attack. If the sysctl is set to 0 a newly started process will not be able to map anything in the address range of the first page (0 to PAGE_SIZE). This is the default. Already running processes are not affected by this. You can either change the sysctl or the tunable from loader in case you need to map at a virtual address of 0, for example when running any of the extinct species of a set of a.out binaries, vm86 emulation, .. In that case set security.bsd.map_at_zero="1". Superseeds: r197537 In collaboration with: jhb, kib, alc Modified: head/sys/kern/init_main.c head/sys/kern/kern_exec.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Fri Oct 2 17:39:23 2009 (r197710) +++ head/sys/kern/init_main.c Fri Oct 2 17:48:51 2009 (r197711) @@ -505,6 +505,11 @@ proc0_init(void *dummy __unused) pmap_pinit0(vmspace_pmap(&vmspace0)); p->p_vmspace = &vmspace0; vmspace0.vm_refcnt = 1; + + /* + * proc0 is not expected to enter usermode, so there is no special + * handling for sv_minuser here, like is done for exec_new_vmspace(). + */ vm_map_init(&vmspace0.vm_map, p->p_sysent->sv_minuser, p->p_sysent->sv_maxuser); vmspace0.vm_map.pmap = vmspace_pmap(&vmspace0); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Oct 2 17:39:23 2009 (r197710) +++ head/sys/kern/kern_exec.c Fri Oct 2 17:48:51 2009 (r197711) @@ -122,6 +122,11 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +static int map_at_zero = 0; +TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); +SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, + "Permit processes to map an object at virtual address 0."); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { @@ -999,7 +1004,7 @@ exec_new_vmspace(imgp, sv) int error; struct proc *p = imgp->proc; struct vmspace *vmspace = p->p_vmspace; - vm_offset_t stack_addr; + vm_offset_t sv_minuser, stack_addr; vm_map_t map; u_long ssiz; @@ -1015,13 +1020,17 @@ exec_new_vmspace(imgp, sv) * not disrupted */ map = &vmspace->vm_map; - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv->sv_minuser && + if (map_at_zero) + sv_minuser = sv->sv_minuser; + else + sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); + if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser) { shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); } else { - error = vmspace_exec(p, sv->sv_minuser, sv->sv_maxuser); + error = vmspace_exec(p, sv_minuser, sv->sv_maxuser); if (error) return (error); vmspace = p->p_vmspace; From bz at FreeBSD.org Fri Oct 2 17:51:47 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Oct 2 17:51:59 2009 Subject: svn commit: r197712 - head/sys/vm Message-ID: <200910021751.n92Hpkrk008597@svn.freebsd.org> Author: bz Date: Fri Oct 2 17:51:46 2009 New Revision: 197712 URL: http://svn.freebsd.org/changeset/base/197712 Log: Back out the functional parts from r197537. After r197711, affecting all user mappings, mmap no longer needs special treatment. Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Fri Oct 2 17:48:51 2009 (r197711) +++ head/sys/vm/vm_mmap.c Fri Oct 2 17:51:46 2009 (r197712) @@ -97,14 +97,6 @@ SYSCTL_INT(_vm, OID_AUTO, max_proc_mmap, "Maximum number of memory-mapped files per process"); /* - * 'mmap_zero' determines whether or not MAP_FIXED mmap() requests for - * virtual address zero are permitted. - */ -static int mmap_zero; -SYSCTL_INT(_security_bsd, OID_AUTO, mmap_zero, CTLFLAG_RW, &mmap_zero, 0, - "Processes may map an object at virtual address zero"); - -/* * Set the maximum number of vm_map_entry structures per process. Roughly * speaking vm_map_entry structures are tiny, so allowing them to eat 1/100 * of our KVM malloc space still results in generous limits. We want a @@ -277,13 +269,6 @@ mmap(td, uap) if (addr & PAGE_MASK) return (EINVAL); - /* - * Mapping to address zero is only permitted if - * mmap_zero is enabled. - */ - if (addr == 0 && !mmap_zero) - return (EINVAL); - /* Address range must be all in user VM space. */ if (addr < vm_map_min(&vms->vm_map) || addr + size > vm_map_max(&vms->vm_map)) From bz at FreeBSD.org Fri Oct 2 17:53:49 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Oct 2 17:53:56 2009 Subject: svn commit: r197713 - head/tools/regression/mmap Message-ID: <200910021753.n92HrmUK008678@svn.freebsd.org> Author: bz Date: Fri Oct 2 17:53:48 2009 New Revision: 197713 URL: http://svn.freebsd.org/changeset/base/197713 Log: Replace the name of the sysctl to security.bsd.map_at_zero and to be consistent updated the name of the variable as well, after the change in r197711. Modified: head/tools/regression/mmap/mmap.c Modified: head/tools/regression/mmap/mmap.c ============================================================================== --- head/tools/regression/mmap/mmap.c Fri Oct 2 17:51:46 2009 (r197712) +++ head/tools/regression/mmap/mmap.c Fri Oct 2 17:53:48 2009 (r197713) @@ -36,7 +36,7 @@ const struct tests { void *addr; - int ok[2]; /* Depending on security.bsd.mmap_zero {0, !=0}. */ + int ok[2]; /* Depending on security.bsd.map_at_zero {0, !=0}. */ } tests[] = { { (void *)0, { 0, 1 } }, /* Test sysctl. */ { (void *)1, { 0, 0 } }, @@ -54,37 +54,37 @@ main(void) { void *p; size_t len; - int i, error, mib[3], mmap_zero; + int i, error, mib[3], map_at_zero; error = 0; - /* Get the current sysctl value of security.bsd.mmap_zero. */ + /* Get the current sysctl value of security.bsd.map_at_zero. */ len = sizeof(mib) / sizeof(*mib); - if (sysctlnametomib("security.bsd.mmap_zero", mib, &len) == -1) - err(1, "sysctlnametomib(security.bsd.mmap_zero)"); + if (sysctlnametomib("security.bsd.map_at_zero", mib, &len) == -1) + err(1, "sysctlnametomib(security.bsd.map_at_zero)"); - len = sizeof(mmap_zero); - if (sysctl(mib, 3, &mmap_zero, &len, NULL, 0) == -1) - err(1, "sysctl(security.bsd.mmap_zero)"); + len = sizeof(map_at_zero); + if (sysctl(mib, 3, &map_at_zero, &len, NULL, 0) == -1) + err(1, "sysctl(security.bsd.map_at_zero)"); /* Normalize to 0 or 1 for array access. */ - mmap_zero = !!mmap_zero; + map_at_zero = !!map_at_zero; for (i=0; i < (sizeof(tests) / sizeof(*tests)); i++) { p = mmap((void *)tests[i].addr, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_FIXED, -1, 0); if (p == MAP_FAILED) { - if (tests[i].ok[mmap_zero] != 0) + if (tests[i].ok[map_at_zero] != 0) error++; warnx("%s: mmap(%p, ...) failed.", - (tests[i].ok[mmap_zero] == 0) ? "OK " : "ERR", + (tests[i].ok[map_at_zero] == 0) ? "OK " : "ERR", tests[i].addr); } else { - if (tests[i].ok[mmap_zero] != 1) + if (tests[i].ok[map_at_zero] != 1) error++; warnx("%s: mmap(%p, ...) succeeded: p=%p", - (tests[i].ok[mmap_zero] == 1) ? "OK " : "ERR", + (tests[i].ok[map_at_zero] == 1) ? "OK " : "ERR", tests[i].addr, p); } } From hrs at FreeBSD.org Fri Oct 2 20:19:53 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 20:20:05 2009 Subject: svn commit: r197719 - head/etc/rc.d Message-ID: <200910022019.n92KJrRo012165@svn.freebsd.org> Author: hrs Date: Fri Oct 2 20:19:53 2009 New Revision: 197719 URL: http://svn.freebsd.org/changeset/base/197719 Log: - Enable an afexists() check only when no AF argument is specified. - Simplify helper functions. Discussed with: ume Modified: head/etc/rc.d/routing Modified: head/etc/rc.d/routing ============================================================================== --- head/etc/rc.d/routing Fri Oct 2 20:15:47 2009 (r197718) +++ head/etc/rc.d/routing Fri Oct 2 20:19:53 2009 (r197719) @@ -13,26 +13,80 @@ . /etc/network.subr name="routing" -start_cmd="routing_start" +start_cmd="routing_start doall" stop_cmd="routing_stop" extra_commands="options static" -static_cmd="static_start" -options_cmd="options_start" +static_cmd="routing_start static" +options_cmd="routing_start options" + +afcheck() +{ + case $_af in + ""|inet|inet6|ipx|atm) + ;; + *) + err 1 "Unsupported address family: $_af." + ;; + esac +} routing_start() { - static_start "$@" - options_start "$@" + local _cmd _af _a + _cmd=$1 + _af=$2 + + afcheck + + case $_af in + inet|inet6|ipx|atm) + setroutes $_cmd $_af + ;; + "") + for _a in inet inet6 ipx atm; do + afexists $_a && setroutes $_cmd $_a + done + ;; + esac + [ -n "${_ropts_initdone}" ] && echo '.' } routing_stop() { - local _af + local _af _a + _af=$1 - static_stop "$@" - for _af in inet inet6; do - afexists ${_af} && eval routing_stop_${_af} - done + afcheck + + case $_af in + inet|inet6|ipx|atm) + eval static_${_af} delete + eval routing_stop_${_af} + ;; + "") + for _a in inet inet6 ipx atm; do + afexists $_a || continue + eval static_${_a} delete + eval routing_stop_${_a} + done + ;; + esac +} + +setroutes() +{ + case $1 in + static) + static_$2 add + ;; + options) + options_$2 + ;; + doall) + static_$2 add + options_$2 + ;; + esac } routing_stop_inet() @@ -50,45 +104,14 @@ routing_stop_inet6() done } -static_start() -{ - local _af - _af=$1 - - case ${_af} in - inet|inet6|atm) - do_static add ${_af} - ;; - "") - do_static add inet inet6 atm - ;; - esac -} - -static_stop() +routing_stop_atm() { - local _af - _af=$1 - - case ${_af} in - inet|inet6|atm) - do_static delete ${_af} - ;; - "") - do_static delete inet inet6 atm - ;; - esac + return 0 } -do_static() +routing_stop_ipx() { - local _af _action - _action=$1 - - shift - for _af in "$@"; do - afexists ${_af} && eval static_${_af} ${_action} - done + return 0 } static_inet() @@ -233,6 +256,10 @@ static_atm() fi } +static_ipx() +{ +} + _ropts_initdone= ropts_init() { @@ -242,16 +269,6 @@ ropts_init() fi } -options_start() -{ - local _af - - for _af in inet inet6 ipx; do - afexists ${_af} && eval options_${_af} - done - [ -n "${_ropts_initdone}" ] && echo '.' -} - options_inet() { if checkyesno icmp_bmcastecho; then @@ -322,6 +339,10 @@ options_inet6() fi } +options_atm() +{ +} + options_ipx() { if checkyesno ipxgateway_enable; then From swell.k at gmail.com Fri Oct 2 21:11:35 2009 From: swell.k at gmail.com (Anonymous) Date: Fri Oct 2 21:11:41 2009 Subject: svn commit: r197698 - head/etc/rc.d In-Reply-To: <200910020227.n922RnBd086217__26713.9191426852$1254450512$gmane$org@svn.freebsd.org> (Hiroki Sato's message of "Fri, 2 Oct 2009 02:27:49 +0000 (UTC)") References: <200910020227.n922RnBd086217__26713.9191426852$1254450512$gmane$org@svn.freebsd.org> Message-ID: <86tyyh4i4o.fsf@gmail.com> Hiroki Sato writes: > Modified: head/etc/rc.d/netoptions [...] > > if checkyesno tcp_extensions; then > + ${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null > + else > netoptions_init > - echo -n ' rfc1323 extensions=NO' > + echo -n ' rfc1323 extensions=${tcp_extensions}' ^^^^^^^^^^^^^^^^^ Here. > ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null > fi > > - if ! checkyesno tcp_keepalive; then > + if checkyesno tcp_keepalive; then > + ${SYSCTL_W} net.inet.tcp.always_keepalive=1 >/dev/null > + else > netoptions_init > - echo -n ' TCP keepalive=NO' > + echo -n ' TCP keepalive=${tcp_keepalive}' ^^^^^^^^^^^^^^^^ Here. > ${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null > fi > > if checkyesno tcp_drop_synfin; then > netoptions_init > - echo -n ' drop SYN+FIN packets=YES' > + echo -n ' drop SYN+FIN packets=${tcp_drop_synfin}' ^^^^^^^^^^^^^^^^^^ And here. These are *single* quotes, no parameter expansion can occur. I keep getting following in `dmesg -a' Additional TCP/IP options: drop SYN+FIN packets=${tcp_drop_synfin} . From rwatson at FreeBSD.org Fri Oct 2 21:31:16 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Fri Oct 2 21:31:28 2009 Subject: svn commit: r197720 - head/sys/kern Message-ID: <200910022131.n92LVFXO014114@svn.freebsd.org> Author: rwatson Date: Fri Oct 2 21:31:15 2009 New Revision: 197720 URL: http://svn.freebsd.org/changeset/base/197720 Log: Don't comment on stream socket handling in sosend_dgram, since that's not handled. MFC after: 3 weeks Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Fri Oct 2 20:19:53 2009 (r197719) +++ head/sys/kern/uipc_socket.c Fri Oct 2 21:31:15 2009 (r197720) @@ -970,9 +970,6 @@ sosend_dgram(struct socket *so, struct s * must use a signed comparison of space and resid. On the other * hand, a negative resid causes us to loop sending 0-length * segments to the protocol. - * - * Also check to make sure that MSG_EOR isn't used on SOCK_STREAM - * type sockets since that's an error. */ if (resid < 0) { error = EINVAL; From marcel at FreeBSD.org Fri Oct 2 22:30:45 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Fri Oct 2 22:30:57 2009 Subject: svn commit: r197721 - head/sys/dev/uart Message-ID: <200910022230.n92MUjZR015619@svn.freebsd.org> Author: marcel Date: Fri Oct 2 22:30:44 2009 New Revision: 197721 URL: http://svn.freebsd.org/changeset/base/197721 Log: Fix RTS/CTS flow control, broken by the TTY overhaul. The new TTY interface is fairly simple WRT dealing with flow control, but needed 2 new RX buffer functions with "get-char-from-buf" separated from "advance-buf-pointer" so that the pointer could be advanced only when ttydisc_rint() succeeded. MFC after: 1 week Modified: head/sys/dev/uart/uart_bus.h head/sys/dev/uart/uart_core.c head/sys/dev/uart/uart_tty.c Modified: head/sys/dev/uart/uart_bus.h ============================================================================== --- head/sys/dev/uart/uart_bus.h Fri Oct 2 21:31:15 2009 (r197720) +++ head/sys/dev/uart/uart_bus.h Fri Oct 2 22:30:44 2009 (r197721) @@ -96,6 +96,7 @@ struct uart_softc { int sc_opened:1; /* This UART is open for business. */ int sc_polled:1; /* This UART has no interrupts. */ int sc_txbusy:1; /* This UART is transmitting. */ + int sc_isquelch:1; /* This UART has input squelched. */ struct uart_devinfo *sc_sysdev; /* System device (or NULL). */ @@ -141,6 +142,8 @@ int uart_bus_ipend(device_t dev); int uart_bus_probe(device_t dev, int regshft, int rclk, int rid, int chan); int uart_bus_sysdev(device_t dev); +void uart_sched_softih(struct uart_softc *, uint32_t); + int uart_tty_attach(struct uart_softc *); int uart_tty_detach(struct uart_softc *); void uart_tty_intr(void *arg); @@ -175,6 +178,28 @@ uart_rx_get(struct uart_softc *sc) } static __inline int +uart_rx_next(struct uart_softc *sc) +{ + int ptr; + + ptr = sc->sc_rxget; + if (ptr == sc->sc_rxput) + return (-1); + ptr += 1; + sc->sc_rxget = (ptr < sc->sc_rxbufsz) ? ptr : 0; + return (0); +} + +static __inline int +uart_rx_peek(struct uart_softc *sc) +{ + int ptr; + + ptr = sc->sc_rxget; + return ((ptr == sc->sc_rxput) ? -1 : sc->sc_rxbuf[ptr]); +} + +static __inline int uart_rx_put(struct uart_softc *sc, int xc) { int ptr; Modified: head/sys/dev/uart/uart_core.c ============================================================================== --- head/sys/dev/uart/uart_core.c Fri Oct 2 21:31:15 2009 (r197720) +++ head/sys/dev/uart/uart_core.c Fri Oct 2 22:30:44 2009 (r197721) @@ -91,7 +91,7 @@ uart_getrange(struct uart_class *uc) * Schedule a soft interrupt. We do this on the 0 to !0 transition * of the TTY pending interrupt status. */ -static void +void uart_sched_softih(struct uart_softc *sc, uint32_t ipend) { uint32_t new, old; Modified: head/sys/dev/uart/uart_tty.c ============================================================================== --- head/sys/dev/uart/uart_tty.c Fri Oct 2 21:31:15 2009 (r197720) +++ head/sys/dev/uart/uart_tty.c Fri Oct 2 22:30:44 2009 (r197721) @@ -166,27 +166,6 @@ uart_tty_outwakeup(struct tty *tp) if (sc == NULL || sc->sc_leaving) return; - /* - * Handle input flow control. Note that if we have hardware support, - * we don't do anything here. We continue to receive until our buffer - * is full. At that time we cannot empty the UART itself and it will - * de-assert RTS for us. In that situation we're completely stuffed. - * Without hardware support, we need to toggle RTS ourselves. - */ - if ((tp->t_termios.c_cflag & CRTS_IFLOW) && !sc->sc_hwiflow) { -#if 0 - /*if ((tp->t_state & TS_TBLOCK) && - (sc->sc_hwsig & SER_RTS)) - UART_SETSIG(sc, SER_DRTS); - else */ if (/*!(tp->t_state & TS_TBLOCK) &&*/ - !(sc->sc_hwsig & SER_RTS)) - UART_SETSIG(sc, SER_DRTS|SER_RTS); -#endif - /* XXX: we should use inwakeup to implement this! */ - if (!(sc->sc_hwsig & SER_RTS)) - UART_SETSIG(sc, SER_DRTS|SER_RTS); - } - if (sc->sc_txbusy) return; @@ -195,6 +174,23 @@ uart_tty_outwakeup(struct tty *tp) UART_TRANSMIT(sc); } +static void +uart_tty_inwakeup(struct tty *tp) +{ + struct uart_softc *sc; + + sc = tty_softc(tp); + if (sc == NULL || sc->sc_leaving) + return; + + if (sc->sc_isquelch) { + if ((tp->t_termios.c_cflag & CRTS_IFLOW) && !sc->sc_hwiflow) + UART_SETSIG(sc, SER_DRTS|SER_RTS); + sc->sc_isquelch = 0; + uart_sched_softih(sc, SER_INT_RXREADY); + } +} + static int uart_tty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) { @@ -252,9 +248,9 @@ uart_tty_param(struct tty *tp, struct te UART_SETSIG(sc, SER_DDTR | SER_DTR); /* Set input flow control state. */ if (!sc->sc_hwiflow) { - /* if ((t->c_cflag & CRTS_IFLOW) && (tp->t_state & TS_TBLOCK)) + if ((t->c_cflag & CRTS_IFLOW) && sc->sc_isquelch) UART_SETSIG(sc, SER_DRTS); - else */ + else UART_SETSIG(sc, SER_DRTS | SER_RTS); } else UART_IOCTL(sc, UART_IOCTL_IFLOW, (t->c_cflag & CRTS_IFLOW)); @@ -294,8 +290,8 @@ uart_tty_intr(void *arg) tty_lock(tp); if (pend & SER_INT_RXREADY) { - while (!uart_rx_empty(sc) /* && !(tp->t_state & TS_TBLOCK)*/) { - xc = uart_rx_get(sc); + while (!uart_rx_empty(sc) && !sc->sc_isquelch) { + xc = uart_rx_peek(sc); c = xc & 0xff; if (xc & UART_STAT_FRAMERR) err |= TRE_FRAMING; @@ -303,7 +299,13 @@ uart_tty_intr(void *arg) err |= TRE_OVERRUN; if (xc & UART_STAT_PARERR) err |= TRE_PARITY; - ttydisc_rint(tp, c, err); + if (ttydisc_rint(tp, c, err) != 0) { + sc->sc_isquelch = 1; + if ((tp->t_termios.c_cflag & CRTS_IFLOW) && + !sc->sc_hwiflow) + UART_SETSIG(sc, SER_DRTS); + } else + uart_rx_next(sc); } } @@ -344,6 +346,7 @@ static struct ttydevsw uart_tty_class = .tsw_open = uart_tty_open, .tsw_close = uart_tty_close, .tsw_outwakeup = uart_tty_outwakeup, + .tsw_inwakeup = uart_tty_inwakeup, .tsw_ioctl = uart_tty_ioctl, .tsw_param = uart_tty_param, .tsw_modem = uart_tty_modem, From weongyo at FreeBSD.org Sat Oct 3 02:28:29 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Sat Oct 3 02:28:36 2009 Subject: svn commit: r197724 - head/share/man/man4 Message-ID: <200910030228.n932SSBs026599@svn.freebsd.org> Author: weongyo Date: Sat Oct 3 02:28:28 2009 New Revision: 197724 URL: http://svn.freebsd.org/changeset/base/197724 Log: TRENDnet TEW-424UB has multiple revisions so clarify zyd(4) man page and adds a device to urtw(4). The revision informations are as follows: rev A ZD1211 V2 SiS163U V2.1R SiS163U V3.xR RTL8187B and bump date. Obtained from: OpenBSD Reported by: Albert Shih Modified: head/share/man/man4/urtw.4 head/share/man/man4/zyd.4 Modified: head/share/man/man4/urtw.4 ============================================================================== --- head/share/man/man4/urtw.4 Fri Oct 2 23:48:42 2009 (r197723) +++ head/share/man/man4/urtw.4 Sat Oct 3 02:28:28 2009 (r197724) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 25, 2009 +.Dd October 2, 2009 .Dt URTW 4 .Os .Sh NAME @@ -73,6 +73,7 @@ driver supports Realtek RTL8187B/L based .It "Netgear WG111v2 RTL8225 USB" .It "Safehome WLG-1500SMA5 RTL8225 USB" .It "Shuttle XPC Accessory PN20 RTL8225 USB" +.It "TRENDnet TEW-424UB V3.xR RTL8225 USB" .El .Sh EXAMPLES Join an existing BSS network (i.e., connect to an access point): Modified: head/share/man/man4/zyd.4 ============================================================================== --- head/share/man/man4/zyd.4 Fri Oct 2 23:48:42 2009 (r197723) +++ head/share/man/man4/zyd.4 Sat Oct 3 02:28:28 2009 (r197724) @@ -32,7 +32,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 1, 2008 +.Dd October 2, 2009 .Dt ZYD 4 .Os .Sh NAME @@ -113,7 +113,7 @@ driver: .It Sweex wireless USB 54 Mbps .It Tekram/Siemens USB adapter .It Telegent TG54USB -.It Trendnet TEW-424UB +.It Trendnet TEW-424UB rev A .It Trendnet TEW-429UB .It TwinMOS G240 .It Unicorn WL-54G From dougb at FreeBSD.org Sat Oct 3 02:37:22 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sat Oct 3 02:37:35 2009 Subject: svn commit: r197725 - head/usr.bin/whois Message-ID: <200910030237.n932bMnY026802@svn.freebsd.org> Author: dougb Date: Sat Oct 3 02:37:21 2009 New Revision: 197725 URL: http://svn.freebsd.org/changeset/base/197725 Log: The 6bone was decommissioned on 6/6/06, so remove references to it. Modified: head/usr.bin/whois/whois.1 head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.1 ============================================================================== --- head/usr.bin/whois/whois.1 Sat Oct 3 02:28:28 2009 (r197724) +++ head/usr.bin/whois/whois.1 Sat Oct 3 02:37:21 2009 (r197725) @@ -32,7 +32,7 @@ .\" From: @(#)whois.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd January 23, 2006 +.Dd October 2, 2009 .Dt WHOIS 1 .Os .Sh NAME @@ -40,7 +40,7 @@ .Nd "Internet domain name and network number directory service" .Sh SYNOPSIS .Nm -.Op Fl aAbdfgiIklmQrR6 +.Op Fl aAbdfgiIklmQrR .Op Fl c Ar country-code | Fl h Ar host .Op Fl p Ar port .Ar name ... @@ -212,17 +212,14 @@ This option is deprecated; use the option with an argument of .Qq Li RU instead. -.It Fl 6 -Use the IPv6 Resource Center -.Pq Tn 6bone -database. -It contains network names and addresses for the IPv6 network. -.El .Pp The operands specified to .Nm are treated independently and may be used as queries on different whois servers. +.El +.Sh EXIT STATUS +.Ex -std .Sh EXAMPLES Most types of data, such as domain names and .Tn IP @@ -255,15 +252,6 @@ but other .Tn TLDs can be queried by using a similar syntax.) .Pp -The following example demonstrates how to obtain information about an -.Tn IPv6 -address or hostname using the -.Fl 6 -option, which directs the query to -.Tn 6bone . -.Pp -.Dl "whois -6 IPv6-IP-Address" -.Pp The following example demonstrates how to query a whois server using a non-standard port, where .Dq Li query-data Modified: head/usr.bin/whois/whois.c ============================================================================== --- head/usr.bin/whois/whois.c Sat Oct 3 02:28:28 2009 (r197724) +++ head/usr.bin/whois/whois.c Sat Oct 3 02:37:21 2009 (r197725) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #define PNICHOST "whois.apnic.net" #define MNICHOST "whois.ra.net" #define QNICHOST_TAIL ".whois-servers.net" -#define SNICHOST "whois.6bone.net" #define BNICHOST "whois.registro.br" #define NORIDHOST "whois.norid.no" #define IANAHOST "whois.iana.org" @@ -164,8 +163,10 @@ main(int argc, char *argv[]) warnx("-R is deprecated; use '-c ru' instead"); country = "ru"; break; + /* Remove in FreeBSD 10 */ case '6': - host = SNICHOST; + errx(EX_USAGE, + "-6 is deprecated; use -[aAflr] instead"); break; case '?': default: From tom at tomjudge.com Sat Oct 3 04:27:25 2009 From: tom at tomjudge.com (Tom Judge) Date: Sat Oct 3 04:27:31 2009 Subject: svn commit: r197704 - in head/sys/arm: arm xscale In-Reply-To: <200910021110.n92BA5fu099181@svn.freebsd.org> References: <200910021110.n92BA5fu099181@svn.freebsd.org> Message-ID: <4AC6D283.2080706@tomjudge.com> Hi Rui, This broke the arm i80219 build. I hav attached a patch which fixes the build. Tom Rui Paulo wrote: > Author: rpaulo > Date: Fri Oct 2 11:10:05 2009 > New Revision: 197704 > URL: http://svn.freebsd.org/changeset/base/197704 > > Log: > Remove performance counter headers. This code came from NetBSD, but our > hardware perf. counter support is different, so we don't need these > files. > > Reviewed by: freebsd-arm (no comments) > > Deleted: > head/sys/arm/xscale/xscalereg.h > head/sys/arm/xscale/xscalevar.h > Modified: > head/sys/arm/arm/cpufunc.c > > -------------- next part -------------- Index: arm/cpufunc.c =================================================================== --- arm/cpufunc.c (revision 197725) +++ arm/cpufunc.c (working copy) @@ -1139,17 +1139,6 @@ if (cputype == CPU_ID_80321_400 || cputype == CPU_ID_80321_600 || cputype == CPU_ID_80321_400_B0 || cputype == CPU_ID_80321_600_B0 || cputype == CPU_ID_80219_400 || cputype == CPU_ID_80219_600) { - /* - * Reset the Performance Monitoring Unit to a - * pristine state: - * - CCNT, PMN0, PMN1 reset to 0 - * - overflow indications cleared - * - all counters disabled - */ - __asm __volatile("mcr p14, 0, %0, c0, c0, 0" - : - : "r" (PMNC_P|PMNC_C|PMNC_PMN0_IF|PMNC_PMN1_IF| - PMNC_CC_IF)); cpufuncs = xscale_cpufuncs; cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ Index: xscale/i80321/i80321_timer.c =================================================================== --- xscale/i80321/i80321_timer.c (revision 197725) +++ xscale/i80321/i80321_timer.c (working copy) @@ -66,7 +66,7 @@ definitions overrides the ones from i80321reg.h */ #endif -#include +//#include #include "opt_timer.h" From bz at FreeBSD.org Sat Oct 3 10:50:01 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Oct 3 10:50:53 2009 Subject: svn commit: r197726 - head/sys/kern Message-ID: <200910031050.n93Ao0th038513@svn.freebsd.org> Author: bz Date: Sat Oct 3 10:50:00 2009 New Revision: 197726 URL: http://svn.freebsd.org/changeset/base/197726 Log: Print a warning in case we cannot add more brandinfo because we would overflow the MAX_BRANDS sized array. Reviewed by: kib MFC After: 1 month Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sat Oct 3 02:37:21 2009 (r197725) +++ head/sys/kern/imgact_elf.c Sat Oct 3 10:50:00 2009 (r197726) @@ -180,8 +180,11 @@ __elfN(insert_brand_entry)(Elf_Brandinfo break; } } - if (i == MAX_BRANDS) + if (i == MAX_BRANDS) { + printf("WARNING: %s: could not insert brandinfo entry: %p\n", + __func__, entry); return (-1); + } return (0); } From bz at FreeBSD.org Sat Oct 3 10:56:04 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Oct 3 10:56:14 2009 Subject: svn commit: r197727 - head/sys/net Message-ID: <200910031056.n93Au3Zs038682@svn.freebsd.org> Author: bz Date: Sat Oct 3 10:56:03 2009 New Revision: 197727 URL: http://svn.freebsd.org/changeset/base/197727 Log: Put #ifdef INET around parts of the FLOWTABLE code, to unbreak nooptions INET kernel builds. MFC after: 3 days X-MFC: with r197687 Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sat Oct 3 10:50:00 2009 (r197726) +++ head/sys/net/route.c Sat Oct 3 10:56:03 2009 (r197727) @@ -1162,6 +1162,7 @@ rtrequest1_fib(int req, struct rt_addrin /* XXX * "flow-table" only support IPv4 at the moment. */ +#ifdef INET if (dst->sa_family == AF_INET) { rn = rnh->rnh_matchaddr(dst, rnh); if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { @@ -1203,6 +1204,7 @@ rtrequest1_fib(int req, struct rt_addrin } } #endif +#endif /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); @@ -1224,7 +1226,9 @@ rtrequest1_fib(int req, struct rt_addrin } #ifdef FLOWTABLE else if (rt0 != NULL) { +#ifdef INET flowtable_route_flush(V_ip_ft, rt0); +#endif RTFREE(rt0); } #endif From rpaulo at FreeBSD.org Sat Oct 3 11:02:37 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sat Oct 3 11:02:43 2009 Subject: svn commit: r197728 - head/etc Message-ID: <200910031102.n93B2arF038856@svn.freebsd.org> Author: rpaulo Date: Sat Oct 3 11:02:36 2009 New Revision: 197728 URL: http://svn.freebsd.org/changeset/base/197728 Log: Add OpenVPN IANA assigned port number. Modified: head/etc/services Modified: head/etc/services ============================================================================== --- head/etc/services Sat Oct 3 10:56:03 2009 (r197727) +++ head/etc/services Sat Oct 3 11:02:36 2009 (r197728) @@ -1521,6 +1521,8 @@ nfa 1155/tcp #Network File Access nfa 1155/udp #Network File Access phone 1167/udp #conference calling skkserv 1178/tcp #SKK (kanji input) +openvpn 1194/tcp #OpenVPN +openvpn 1194/udp #OpenVPN lupa 1212/tcp lupa 1212/udp nerv 1222/tcp #SNI R&D network From bz at FreeBSD.org Sat Oct 3 11:57:22 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Oct 3 11:57:29 2009 Subject: svn commit: r197729 - in head/sys: amd64/amd64 arm/arm compat/ia32 i386/i386 ia64/ia64 mips/mips powerpc/powerpc sparc64/sparc64 Message-ID: <200910031157.n93BvLhS039965@svn.freebsd.org> Author: bz Date: Sat Oct 3 11:57:21 2009 New Revision: 197729 URL: http://svn.freebsd.org/changeset/base/197729 Log: Make sure that the primary native brandinfo always gets added first and the native ia32 compat as middle (before other things). o(ld)brandinfo as well as third party like linux, kfreebsd, etc. stays on SI_ORDER_ANY coming last. The reason for this is only to make sure that even in case we would overflow the MAX_BRANDS sized array, the native FreeBSD brandinfo would still be there and the system would be operational. Reviewed by: kib MFC after: 1 month Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/arm/arm/elf_machdep.c head/sys/compat/ia32/ia32_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/ia64/ia64/elf_machdep.c head/sys/mips/mips/elf64_machdep.c head/sys/mips/mips/elf_machdep.c head/sys/powerpc/powerpc/elf_machdep.c head/sys/sparc64/sparc64/elf_machdep.c Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/amd64/amd64/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -89,7 +89,7 @@ static Elf64_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf64_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/arm/arm/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -88,7 +88,7 @@ static Elf32_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf32_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- head/sys/compat/ia32/ia32_sysvec.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/compat/ia32/ia32_sysvec.c Sat Oct 3 11:57:21 2009 (r197729) @@ -152,7 +152,7 @@ static Elf32_Brandinfo ia32_brand_info = .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_MIDDLE, (sysinit_cfunc_t) elf32_insert_brand_entry, &ia32_brand_info); Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/i386/i386/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -88,7 +88,7 @@ static Elf32_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf32_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/ia64/ia64/elf_machdep.c ============================================================================== --- head/sys/ia64/ia64/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/ia64/ia64/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -95,7 +95,7 @@ static Elf64_Brandinfo freebsd_brand_inf .brand_note = &elf64_freebsd_brandnote, .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info); static Elf64_Brandinfo freebsd_brand_oinfo = { Modified: head/sys/mips/mips/elf64_machdep.c ============================================================================== --- head/sys/mips/mips/elf64_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/mips/mips/elf64_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -108,7 +108,7 @@ static Elf64_Brandinfo freebsd_brand_inf .flags = BI_BRAND_NOTE }; -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf64_insert_brand_entry, &freebsd_brand_info64); Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/mips/mips/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -90,7 +90,7 @@ static Elf32_Brandinfo freebsd_brand_inf .flags = BI_BRAND_NOTE }; -SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf32_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/powerpc/powerpc/elf_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/powerpc/powerpc/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -91,7 +91,7 @@ static Elf32_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf32_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/sparc64/sparc64/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -103,7 +103,7 @@ static Elf64_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf64_insert_brand_entry, &freebsd_brand_info); From nyan at FreeBSD.org Sat Oct 3 12:22:13 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Sat Oct 3 12:22:24 2009 Subject: svn commit: r197730 - in head/sys: modules/nfslockd nlm Message-ID: <200910031222.n93CMDnp040558@svn.freebsd.org> Author: nyan Date: Sat Oct 3 12:22:12 2009 New Revision: 197730 URL: http://svn.freebsd.org/changeset/base/197730 Log: unifdef NFSCLIENT because the nlm depends on the nfsclient even if NFSCLIENT is not defined. Now the nfslockd module works with the nfsclient module. Reviewed by: kib MFC after: 3 days Modified: head/sys/modules/nfslockd/Makefile head/sys/nlm/nlm_prot_impl.c Modified: head/sys/modules/nfslockd/Makefile ============================================================================== --- head/sys/modules/nfslockd/Makefile Sat Oct 3 11:57:21 2009 (r197729) +++ head/sys/modules/nfslockd/Makefile Sat Oct 3 12:22:12 2009 (r197730) @@ -14,18 +14,12 @@ SRCS+= opt_inet6.h opt_nfs.h .if !defined(KERNBUILDDIR) NFS_INET6?= 1 # 0/1 - requires INET6 to be configured in kernel -NFSCLIENT?= 1 # 0/1 - requires NFSCLIENT to be configured in kernel .if ${NFS_INET6} > 0 opt_inet6.h: echo "#define INET6 1" > ${.TARGET} .endif -.if ${NFSCLIENT} > 0 -opt_nfs.h: - echo "#define NFSCLIENT 1" > ${.TARGET} -.endif - .endif .include Modified: head/sys/nlm/nlm_prot_impl.c ============================================================================== --- head/sys/nlm/nlm_prot_impl.c Sat Oct 3 11:57:21 2009 (r197729) +++ head/sys/nlm/nlm_prot_impl.c Sat Oct 3 12:22:12 2009 (r197730) @@ -26,7 +26,6 @@ */ #include "opt_inet6.h" -#include "opt_nfs.h" #include __FBSDID("$FreeBSD$"); @@ -671,8 +670,6 @@ nlm_host_destroy(struct nlm_host *host) free(host, M_NLM); } -#ifdef NFSCLIENT - /* * Thread start callback for client lock recovery */ @@ -695,8 +692,6 @@ nlm_client_recovery_start(void *arg) kthread_exit(); } -#endif - /* * This is called when we receive a host state change notification. We * unlock any active locks owned by the host. When rpc.lockd is @@ -735,7 +730,6 @@ nlm_host_notify(struct nlm_host *host, i lf_clearremotesys(host->nh_sysid); host->nh_state = newstate; -#ifdef NFSCLIENT /* * If we have any remote locks for this host (i.e. it * represents a remote NFS server that our local NFS client @@ -750,7 +744,6 @@ nlm_host_notify(struct nlm_host *host, i kthread_add(nlm_client_recovery_start, host, curproc, &td, 0, 0, "NFS lock recovery for %s", host->nh_caller_name); } -#endif } /* @@ -1479,10 +1472,8 @@ nlm_server_main(int addr_count, char **a enum clnt_stat stat; struct nlm_host *host, *nhost; struct nlm_waiting_lock *nw; -#ifdef NFSCLIENT vop_advlock_t *old_nfs_advlock; vop_reclaim_t *old_nfs_reclaim; -#endif int v4_used; #ifdef INET6 int v6_used; @@ -1583,20 +1574,16 @@ nlm_server_main(int addr_count, char **a NLM_DEBUG(1, "NLM: local NSM state is %d\n", smstat.state); nlm_nsm_state = smstat.state; -#ifdef NFSCLIENT old_nfs_advlock = nfs_advlock_p; nfs_advlock_p = nlm_advlock; old_nfs_reclaim = nfs_reclaim_p; nfs_reclaim_p = nlm_reclaim; -#endif svc_run(pool); error = 0; -#ifdef NFSCLIENT nfs_advlock_p = old_nfs_advlock; nfs_reclaim_p = old_nfs_reclaim; -#endif out: if (pool) From rpaulo at FreeBSD.org Sat Oct 3 13:59:15 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sat Oct 3 13:59:22 2009 Subject: svn commit: r197733 - in head/sys/arm: arm xscale/i80321 Message-ID: <200910031359.n93DxFtm042595@svn.freebsd.org> Author: rpaulo Date: Sat Oct 3 13:59:15 2009 New Revision: 197733 URL: http://svn.freebsd.org/changeset/base/197733 Log: Remove remaining bits of performance counter support. Submitted by: Tom Judge Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/xscale/i80321/i80321_timer.c Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Sat Oct 3 13:17:21 2009 (r197732) +++ head/sys/arm/arm/cpufunc.c Sat Oct 3 13:59:15 2009 (r197733) @@ -1088,18 +1088,6 @@ set_cpufuncs() i80200_icu_init(); - /* - * Reset the Performance Monitoring Unit to a - * pristine state: - * - CCNT, PMN0, PMN1 reset to 0 - * - overflow indications cleared - * - all counters disabled - */ - __asm __volatile("mcr p14, 0, %0, c0, c0, 0" - : - : "r" (PMNC_P|PMNC_C|PMNC_PMN0_IF|PMNC_PMN1_IF| - PMNC_CC_IF)); - #if defined(XSCALE_CCLKCFG) /* * Crank CCLKCFG to maximum legal value. @@ -1139,18 +1127,6 @@ set_cpufuncs() if (cputype == CPU_ID_80321_400 || cputype == CPU_ID_80321_600 || cputype == CPU_ID_80321_400_B0 || cputype == CPU_ID_80321_600_B0 || cputype == CPU_ID_80219_400 || cputype == CPU_ID_80219_600) { - /* - * Reset the Performance Monitoring Unit to a - * pristine state: - * - CCNT, PMN0, PMN1 reset to 0 - * - overflow indications cleared - * - all counters disabled - */ - __asm __volatile("mcr p14, 0, %0, c0, c0, 0" - : - : "r" (PMNC_P|PMNC_C|PMNC_PMN0_IF|PMNC_PMN1_IF| - PMNC_CC_IF)); - cpufuncs = xscale_cpufuncs; cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); Modified: head/sys/arm/xscale/i80321/i80321_timer.c ============================================================================== --- head/sys/arm/xscale/i80321/i80321_timer.c Sat Oct 3 13:17:21 2009 (r197732) +++ head/sys/arm/xscale/i80321/i80321_timer.c Sat Oct 3 13:59:15 2009 (r197733) @@ -66,8 +66,6 @@ __FBSDID("$FreeBSD$"); definitions overrides the ones from i80321reg.h */ #endif -#include - #include "opt_timer.h" void (*i80321_hardclock_hook)(void) = NULL; From rpaulo at gmail.com Sat Oct 3 13:59:25 2009 From: rpaulo at gmail.com (Rui Paulo) Date: Sat Oct 3 13:59:32 2009 Subject: svn commit: r197704 - in head/sys/arm: arm xscale In-Reply-To: <4AC6D283.2080706@tomjudge.com> References: <200910021110.n92BA5fu099181@svn.freebsd.org> <4AC6D283.2080706@tomjudge.com> Message-ID: Fixed, thanks. On 3 Oct 2009, at 05:26, Tom Judge wrote: > Hi Rui, > > This broke the arm i80219 build. > > I hav attached a patch which fixes the build. > > Tom > > Rui Paulo wrote: >> Author: rpaulo >> Date: Fri Oct 2 11:10:05 2009 >> New Revision: 197704 >> URL: http://svn.freebsd.org/changeset/base/197704 >> >> Log: >> Remove performance counter headers. This code came from NetBSD, >> but our >> hardware perf. counter support is different, so we don't need these >> files. >> Reviewed by: freebsd-arm (no comments) >> >> Deleted: >> head/sys/arm/xscale/xscalereg.h >> head/sys/arm/xscale/xscalevar.h >> Modified: >> head/sys/arm/arm/cpufunc.c >> >> > > Index: arm/cpufunc.c > =================================================================== > --- arm/cpufunc.c (revision 197725) > +++ arm/cpufunc.c (working copy) > @@ -1139,17 +1139,6 @@ > if (cputype == CPU_ID_80321_400 || cputype == CPU_ID_80321_600 || > cputype == CPU_ID_80321_400_B0 || cputype == > CPU_ID_80321_600_B0 || > cputype == CPU_ID_80219_400 || cputype == CPU_ID_80219_600) { > - /* > - * Reset the Performance Monitoring Unit to a > - * pristine state: > - * - CCNT, PMN0, PMN1 reset to 0 > - * - overflow indications cleared > - * - all counters disabled > - */ > - __asm __volatile("mcr p14, 0, %0, c0, c0, 0" > - : > - : "r" (PMNC_P|PMNC_C|PMNC_PMN0_IF|PMNC_PMN1_IF| > - PMNC_CC_IF)); > > cpufuncs = xscale_cpufuncs; > cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ > Index: xscale/i80321/i80321_timer.c > =================================================================== > --- xscale/i80321/i80321_timer.c (revision 197725) > +++ xscale/i80321/i80321_timer.c (working copy) > @@ -66,7 +66,7 @@ > definitions overrides the ones from i80321reg.h > */ > #endif > -#include > +//#include > > #include "opt_timer.h" > -- Rui Paulo From attilio at FreeBSD.org Sat Oct 3 15:02:55 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Sat Oct 3 15:03:06 2009 Subject: svn commit: r197735 - head/sys/kern Message-ID: <200910031502.n93F2tOp043967@svn.freebsd.org> Author: attilio Date: Sat Oct 3 15:02:55 2009 New Revision: 197735 URL: http://svn.freebsd.org/changeset/base/197735 Log: When releasing a lockmgr held in shared way we need to use a write memory barrier in order to avoid, on architectures which doesn't have strong ordered writes, CPU instructions reordering. Diagnosed by: fabio Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Sat Oct 3 14:38:22 2009 (r197734) +++ head/sys/kern/kern_lock.c Sat Oct 3 15:02:55 2009 (r197735) @@ -241,7 +241,7 @@ wakeupshlk(struct lock *lk, const char * * and return. */ if (LK_SHARERS(x) > 1) { - if (atomic_cmpset_ptr(&lk->lk_lock, x, + if (atomic_cmpset_rel_ptr(&lk->lk_lock, x, x - LK_ONE_SHARER)) break; continue; @@ -254,7 +254,7 @@ wakeupshlk(struct lock *lk, const char * if ((x & LK_ALL_WAITERS) == 0) { MPASS((x & ~LK_EXCLUSIVE_SPINNERS) == LK_SHARERS_LOCK(1)); - if (atomic_cmpset_ptr(&lk->lk_lock, x, LK_UNLOCKED)) + if (atomic_cmpset_rel_ptr(&lk->lk_lock, x, LK_UNLOCKED)) break; continue; } @@ -280,7 +280,7 @@ wakeupshlk(struct lock *lk, const char * queue = SQ_SHARED_QUEUE; } - if (!atomic_cmpset_ptr(&lk->lk_lock, LK_SHARERS_LOCK(1) | x, + if (!atomic_cmpset_rel_ptr(&lk->lk_lock, LK_SHARERS_LOCK(1) | x, v)) { sleepq_release(&lk->lock_object); continue; From delphij at FreeBSD.org Sun Oct 4 10:38:05 2009 From: delphij at FreeBSD.org (Xin LI) Date: Sun Oct 4 10:38:11 2009 Subject: svn commit: r197740 - head/sys/fs/tmpfs Message-ID: <200910041038.n94Ac5U7070347@svn.freebsd.org> Author: delphij Date: Sun Oct 4 10:38:04 2009 New Revision: 197740 URL: http://svn.freebsd.org/changeset/base/197740 Log: Fix a bug that causes the fsx test case of mmap'ed page being out of sync of read/write, inspired by ZFS's counterpart. PR: kern/139312 Submitted by: gk@ MFC after: 1 week Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Oct 4 09:57:39 2009 (r197739) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Oct 4 10:38:04 2009 (r197740) @@ -444,7 +444,8 @@ tmpfs_mappedread(vm_object_t vobj, vm_ob offset = addr & PAGE_MASK; tlen = MIN(PAGE_SIZE - offset, len); - if ((vobj == NULL) || (vobj->resident_page_count == 0)) + if ((vobj == NULL) || + (vobj->resident_page_count == 0 && vobj->cache == NULL)) goto nocache; VM_OBJECT_LOCK(vobj); @@ -555,7 +556,8 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_o offset = addr & PAGE_MASK; tlen = MIN(PAGE_SIZE - offset, len); - if ((vobj == NULL) || (vobj->resident_page_count == 0)) { + if ((vobj == NULL) || + (vobj->resident_page_count == 0 && vobj->cache == NULL)) { vpg = NULL; goto nocache; } @@ -573,6 +575,8 @@ lookupvpg: VM_OBJECT_UNLOCK(vobj); error = uiomove_fromphys(&vpg, offset, tlen, uio); } else { + if (__predict_false(vobj->cache != NULL)) + vm_page_cache_free(vobj, idx, idx + 1); VM_OBJECT_UNLOCK(vobj); vpg = NULL; } From rpaulo at FreeBSD.org Sun Oct 4 10:54:20 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sun Oct 4 10:54:28 2009 Subject: svn commit: r197741 - head/lib/libpmc Message-ID: <200910041054.n94AsKTI071707@svn.freebsd.org> Author: rpaulo Date: Sun Oct 4 10:54:20 2009 New Revision: 197741 URL: http://svn.freebsd.org/changeset/base/197741 Log: Install x86 related man pages on x86 systems only. Reviewed by: jkoshy Modified: head/lib/libpmc/Makefile Modified: head/lib/libpmc/Makefile ============================================================================== --- head/lib/libpmc/Makefile Sun Oct 4 10:38:04 2009 (r197740) +++ head/lib/libpmc/Makefile Sun Oct 4 10:54:20 2009 (r197741) @@ -24,6 +24,7 @@ MAN+= pmc_start.3 MAN+= pmclog.3 # PMC-dependent manual pages +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" MAN+= pmc.atom.3 MAN+= pmc.core.3 MAN+= pmc.core2.3 @@ -34,6 +35,7 @@ MAN+= pmc.p4.3 MAN+= pmc.p5.3 MAN+= pmc.p6.3 MAN+= pmc.tsc.3 +.endif MLINKS+= \ pmc_allocate.3 pmc_release.3 \ From michio.jinbo at gmail.com Sun Oct 4 16:20:42 2009 From: michio.jinbo at gmail.com (Michio "Karl" Jinbo) Date: Sun Oct 4 16:20:49 2009 Subject: svn commit: r197744 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci i386/i386 In-Reply-To: <200910041220.n94CKxTH073639@svn.freebsd.org> References: <200910041220.n94CKxTH073639@svn.freebsd.org> Message-ID: <20091005004923.4086.22FF24F1@gmail.com> On Sun, 4 Oct 2009 12:20:59 +0000 (UTC) Konstantin Belousov wrote: > Log: > MFC r197663: > As a workaround, for Intel CPUs, do not use CLFLUSH in > pmap_invalidate_cache_range() when self-snoop is apparently not reported > in cpu features. > > Approved by: re (bz, kensmith) I was tested r197663/r197744, but kernel panic again on Citrix Xen Server. using 8.0-RC1 install cd, results are 1. INTEL SU9400+HYPER-V(Windows2008 R2) -> boot OK. 2. AMD Athlon X2 TK-55+HYPER-V(Windows2008 R2) -> boot NG. 3. AMD PhenomII 940BK+Citrix Xen Server -> boot NG. I think INTEL CPUs are no problem, but AMD CPUs appear the problem. So I tested the following patch, kernel boot was successed on recent 9-CURRENT and environment 3. sorry, poor English. --- sys/i386/i386/initcpu.c.original 2009-10-01 21:52:48.000000000 +0900 +++ sys/i386/i386/initcpu.c 2009-10-05 08:29:45.000000000 +0900 @@ -721,7 +721,7 @@ * XXXKIB: (temporary) hack to work around traps generated when * CLFLUSHing APIC registers window. */ - if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS)) + if (cpu_vendor_id == CPU_VENDOR_AMD && !(cpu_feature & CPUID_SS)) cpu_feature &= ~CPUID_CLFSH; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) -- Michio Jinbo From simon at FreeBSD.org Sun Oct 4 16:30:34 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Sun Oct 4 16:30:40 2009 Subject: svn commit: r197747 - head/release/doc/share/misc Message-ID: <200910041630.n94GUXIn079213@svn.freebsd.org> Author: simon Date: Sun Oct 4 16:30:33 2009 New Revision: 197747 URL: http://svn.freebsd.org/changeset/base/197747 Log: In lists, if there is a Li command remove it. This fixes markup for uath(4). MFC after: 3 days Reported by: Warren Block Modified: head/release/doc/share/misc/man2hwnotes.pl Modified: head/release/doc/share/misc/man2hwnotes.pl ============================================================================== --- head/release/doc/share/misc/man2hwnotes.pl Sun Oct 4 13:03:07 2009 (r197746) +++ head/release/doc/share/misc/man2hwnotes.pl Sun Oct 4 16:30:33 2009 (r197747) @@ -252,6 +252,10 @@ sub parse { $txt =~ s/ Ta /\t/g; $txt =~ s/([^\t]+)\t.*/$1/; } + + # Remove Li commands + $txt =~ s/^Li //g; + parabuf_addline(\%mdocvars, normalize($txt)); } elsif (/^Bl/) { $mdocvars{isin_list} = 1; From alc at FreeBSD.org Sun Oct 4 18:53:10 2009 From: alc at FreeBSD.org (Alan Cox) Date: Sun Oct 4 18:53:23 2009 Subject: svn commit: r197750 - head/sys/vm Message-ID: <200910041853.n94IrAf7082338@svn.freebsd.org> Author: alc Date: Sun Oct 4 18:53:10 2009 New Revision: 197750 URL: http://svn.freebsd.org/changeset/base/197750 Log: Align and pad the page queue and free page queue locks so that the linker can't possibly place them together within the same cache line. MFC after: 3 weeks Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Oct 4 17:22:51 2009 (r197749) +++ head/sys/vm/vm_page.c Sun Oct 4 18:53:10 2009 (r197750) @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); */ struct vpgqueues vm_page_queues[PQ_COUNT]; -struct mtx vm_page_queue_mtx; -struct mtx vm_page_queue_free_mtx; +struct vpglocks vm_page_queue_lock; +struct vpglocks vm_page_queue_free_lock; vm_page_t vm_page_array = 0; int vm_page_array_size = 0; Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sun Oct 4 17:22:51 2009 (r197749) +++ head/sys/vm/vm_page.h Sun Oct 4 18:53:10 2009 (r197750) @@ -170,7 +170,15 @@ struct vpgqueues { }; extern struct vpgqueues vm_page_queues[PQ_COUNT]; -extern struct mtx vm_page_queue_free_mtx; + +struct vpglocks { + struct mtx data; + char pad[CACHE_LINE_SIZE - sizeof(struct mtx)]; +} __aligned(CACHE_LINE_SIZE); + +extern struct vpglocks vm_page_queue_free_lock; + +#define vm_page_queue_free_mtx vm_page_queue_free_lock.data /* * These are the flags defined for vm_page. @@ -258,7 +266,9 @@ PHYS_TO_VM_PAGE(vm_paddr_t pa) #endif } -extern struct mtx vm_page_queue_mtx; +extern struct vpglocks vm_page_queue_lock; + +#define vm_page_queue_mtx vm_page_queue_lock.data #define vm_page_lock_queues() mtx_lock(&vm_page_queue_mtx) #define vm_page_unlock_queues() mtx_unlock(&vm_page_queue_mtx) From das at FreeBSD.org Sun Oct 4 19:43:38 2009 From: das at FreeBSD.org (David Schultz) Date: Sun Oct 4 19:43:44 2009 Subject: svn commit: r197752 - head/lib/libc/stdio Message-ID: <200910041943.n94JhaDg083487@svn.freebsd.org> Author: das Date: Sun Oct 4 19:43:36 2009 New Revision: 197752 URL: http://svn.freebsd.org/changeset/base/197752 Log: Better glibc compatibility for getline/getdelim: - Tolerate applications that pass a NULL pointer for the buffer and claim that the capacity of the buffer is nonzero. - If an application passes in a non-NULL buffer pointer and claims the buffer has zero capacity, we should free (well, realloc) it anyway. It could have been obtained from malloc(0), so failing to free it would be a small memory leak. MFC After: 2 weeks Reported by: naddy PR: ports/138320 Modified: head/lib/libc/stdio/getdelim.c Modified: head/lib/libc/stdio/getdelim.c ============================================================================== --- head/lib/libc/stdio/getdelim.c Sun Oct 4 19:03:32 2009 (r197751) +++ head/lib/libc/stdio/getdelim.c Sun Oct 4 19:43:36 2009 (r197752) @@ -120,8 +120,8 @@ getdelim(char ** __restrict linep, size_ goto error; } - if (*linecapp == 0) - *linep = NULL; + if (*linep == NULL) + *linecapp = 0; if (fp->_r <= 0 && __srefill(fp)) { /* If fp is at EOF already, we just need space for the NUL. */ From das at FreeBSD.org Sun Oct 4 19:44:42 2009 From: das at FreeBSD.org (David Schultz) Date: Sun Oct 4 19:44:53 2009 Subject: svn commit: r197753 - head/tools/regression/lib/libc/stdio Message-ID: <200910041944.n94JifN8083557@svn.freebsd.org> Author: das Date: Sun Oct 4 19:44:41 2009 New Revision: 197753 URL: http://svn.freebsd.org/changeset/base/197753 Log: Regression tests for r197752 (handling of empty/NULL buffers). Modified: head/tools/regression/lib/libc/stdio/test-getdelim.c Modified: head/tools/regression/lib/libc/stdio/test-getdelim.c ============================================================================== --- head/tools/regression/lib/libc/stdio/test-getdelim.c Sun Oct 4 19:43:36 2009 (r197752) +++ head/tools/regression/lib/libc/stdio/test-getdelim.c Sun Oct 4 19:44:41 2009 (r197753) @@ -80,7 +80,7 @@ main(int argc, char *argv[]) srandom(0); - printf("1..5\n"); + printf("1..6\n"); /* * Test multiple times with different buffer sizes @@ -103,6 +103,7 @@ main(int argc, char *argv[]) assert(getline(&line, &linecap, fp) == -1); assert(line[0] == '\0'); free(line); + line = NULL; assert(feof(fp)); assert(!ferror(fp)); fclose(fp); @@ -164,5 +165,23 @@ main(int argc, char *argv[]) fclose(fp); printf("ok 5 - nul\n"); + /* Make sure NULL *linep and zero *linecapp are handled. */ + fp = mkfilebuf(); + free(line); + line = NULL; + linecap = 42; + assert(getline(&line, &linecap, fp) == sizeof(apothegm) - 1); + assert(memcmp(line, apothegm, sizeof(apothegm)) == 0); + fp = mkfilebuf(); + free(line); + line = malloc(100); + linecap = 0; + assert(getline(&line, &linecap, fp) == sizeof(apothegm) - 1); + assert(memcmp(line, apothegm, sizeof(apothegm)) == 0); + free(line); + assert(!ferror(fp)); + fclose(fp); + printf("ok 6 - empty/NULL initial buffer\n"); + exit(0); } From weongyo at FreeBSD.org Sun Oct 4 23:30:08 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Sun Oct 4 23:30:21 2009 Subject: svn commit: r197761 - in head/sys/dev/usb: . wlan Message-ID: <200910042330.n94NU8sr088627@svn.freebsd.org> Author: weongyo Date: Sun Oct 4 23:30:08 2009 New Revision: 197761 URL: http://svn.freebsd.org/changeset/base/197761 Log: updates device entries supported with the product name not magic numbers and sorts entries. WUSB54GCV2 is added. Obtained from: OpenBSD Modified: head/sys/dev/usb/usbdevs head/sys/dev/usb/wlan/if_urtw.c Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sun Oct 4 21:50:29 2009 (r197760) +++ head/sys/dev/usb/usbdevs Sun Oct 4 23:30:08 2009 (r197761) @@ -908,6 +908,7 @@ product ASIX AX88772 0x7720 AX88772 product ASUS WL167G 0x1707 WL-167g Wireless Adapter product ASUS WL159G 0x170c WL-159g product ASUS A9T_WIFI 0x171b A9T wireless +product ASUS P5B_WIFI 0x171d P5B wireless product ASUS RT2573_1 0x1723 RT2573 product ASUS RT2573_2 0x1724 RT2573 product ASUS LCM 0x1726 LCM display @@ -975,6 +976,7 @@ product BELKIN F5D7051 0x7051 F5D7051 5 product BELKIN F5D7050A 0x705a F5D7050A Wireless Adapter /* Also sold as 'Ativa 802.11g wireless card' */ product BELKIN F5D7050_V4000 0x705c F5D7050 v4000 Wireless Adapter +product BELKIN F5D7050E 0x705e F5D7050E Wireless Adapter product BELKIN F5D9050V3 0x905b F5D9050 ver 3 Wireless Adapter product BELKIN2 F5U002 0x0002 F5U002 Parallel printer @@ -1656,6 +1658,7 @@ product LINKSYS2 WUSB11 0x2219 WUSB11 W product LINKSYS2 USB200M 0x2226 USB 2.0 10/100 Ethernet product LINKSYS3 WUSB11v28 0x2233 WUSB11 v2.8 Wireless Adapter product LINKSYS4 USB1000 0x0039 USB1000 +product LINKSYS4 WUSB54GCV2 0x0073 WUSB54GC v2 /* Logitech products */ product LOGITECH M2452 0x0203 M2452 keyboard @@ -1876,6 +1879,7 @@ product NETGEAR EA101X 0x1002 Ethernet product NETGEAR FA101 0x1020 Ethernet 10/100, USB1.1 product NETGEAR FA120 0x1040 USB 2.0 Ethernet product NETGEAR WG111V2_2 0x4240 PrismGT USB 2.0 WLAN +product NETGEAR WG111V3 0x4260 WG111v3 product NETGEAR WG111U 0x4300 WG111U product NETGEAR WG111U_NF 0x4301 WG111U (no firmware) product NETGEAR WG111V2 0x6a00 WG111V2 @@ -2101,6 +2105,9 @@ product RALINK RT2573_2 0x9021 RT2501US /* Green House and CompUSA OEM this part */ product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet product REALTEK RTL8187 0x8187 RTL8187 Wireless Adapter +product REALTEK RTL8187B_0 0x8189 RTL8187B Wireless Adapter +product REALTEK RTL8187B_1 0x8197 RTL8187B Wireless Adapter +product REALTEK RTL8187B_2 0x8198 RTL8187B Wireless Adapter /* Ricoh products */ product RICOH VGPVCC2 0x1830 VGP-VCC2 Camera @@ -2270,6 +2277,8 @@ product SITECOM SERIAL 0x2068 USB to se product SITECOM2 WL022 0x182d WL-022 /* Sitecom Europe products */ +product SITECOMEU WL168V1 0x000d WL-168 v1 +product SITECOMEU WL168V4 0x0028 WL-168 v4 product SITECOMEU LN028 0x061c LN-028 product SITECOMEU WL113 0x9071 WL-113 product SITECOMEU ZD1211B 0x9075 ZD1211B @@ -2375,6 +2384,7 @@ product DIAMOND2 RIO600USB 0x5001 Rio 60 product DIAMOND2 RIO800USB 0x5002 Rio 800 USB /* Surecom Technology products */ +product SURECOM EP9001G2A 0x11f2 EP-9001-G rev 2A product SURECOM RT2570 0x11f3 RT2570 product SURECOM RT2573 0x31f3 RT2573 Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Sun Oct 4 21:50:29 2009 (r197760) +++ head/sys/dev/usb/wlan/if_urtw.c Sun Oct 4 23:30:08 2009 (r197761) @@ -102,23 +102,24 @@ TUNABLE_INT("hw.usb.urtw.preamble_mode", #define URTW_REV_RTL8187B 0 #define URTW_REV_RTL8187L 1 static const struct usb_device_id urtw_devs[] = { - { USB_VPI(USB_VENDOR_BELKIN, 0x705e, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_REALTEK, 0x8189, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_REALTEK, 0x8197, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_REALTEK, 0x8198, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_NETGEAR, 0x4260, URTW_REV_RTL8187B) }, + URTW_DEV_B(NETGEAR, WG111V3), + URTW_DEV_B(REALTEK, RTL8187B_0), + URTW_DEV_B(REALTEK, RTL8187B_1), + URTW_DEV_B(REALTEK, RTL8187B_2), + URTW_DEV_B(SITECOMEU, WL168V4), + URTW_DEV_L(ASUS, P5B_WIFI), + URTW_DEV_L(BELKIN, F5D7050E), + URTW_DEV_L(LINKSYS4, WUSB54GCV2), + URTW_DEV_L(NETGEAR, WG111V2), + URTW_DEV_L(REALTEK, RTL8187), + URTW_DEV_L(SITECOMEU, WL168V1), + URTW_DEV_L(SURECOM, EP9001G2A), { USB_VPI(0x1b75, 0x8187, URTW_REV_RTL8187L) }, - { USB_VPI(USB_VENDOR_ASUS, 0x171d, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_DICKSMITH, 0x9401, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_HP, 0xca02, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_LOGITEC, 0x010c, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_NETGEAR, 0x6100, URTW_REV_RTL8187L) }, - URTW_DEV_L(NETGEAR, WG111V2), - URTW_DEV_L(REALTEK, RTL8187), - { USB_VPI(USB_VENDOR_SITECOMEU, 0x000d, URTW_REV_RTL8187L) }, - { USB_VPI(USB_VENDOR_SITECOMEU, 0x0028, URTW_REV_RTL8187B) }, { USB_VPI(USB_VENDOR_SPHAIRON, 0x0150, URTW_REV_RTL8187L) }, - { USB_VPI(USB_VENDOR_SURECOM, 0x11f2, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_QCOM, 0x6232, URTW_REV_RTL8187L) }, #undef URTW_DEV_L #undef URTW_DEV_B From mjacob at FreeBSD.org Mon Oct 5 01:31:16 2009 From: mjacob at FreeBSD.org (Matt Jacob) Date: Mon Oct 5 01:31:28 2009 Subject: svn commit: r197763 - head/sbin/growfs Message-ID: <200910050131.n951VGW9091208@svn.freebsd.org> Author: mjacob Date: Mon Oct 5 01:31:16 2009 New Revision: 197763 URL: http://svn.freebsd.org/changeset/base/197763 Log: The cylinder group tag cg_initediblk needs to match the number of inodes actually initialized. In the growfs case for UFS2, no inodes were actually being initialized and the number of inodes noted as initialized was the number of inodes per group. This created a filesystem that was deemed corrupted because the inodes thus added were full of garbage. MFC after: 1 month Modified: head/sbin/growfs/growfs.c Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Mon Oct 5 00:28:47 2009 (r197762) +++ head/sbin/growfs/growfs.c Mon Oct 5 01:31:16 2009 (r197763) @@ -397,11 +397,17 @@ initcg(int cylno, time_t utime, int fso, dupper += howmany(sblock.fs_cssize, sblock.fs_fsize); cs = &fscs[cylno]; memset(&acg, 0, sblock.fs_cgsize); + /* + * Note that we do not set cg_initediblk at all. + * In this extension of a previous filesystem + * we have no inodes initialized for the cylinder + * group at all. The first access to that cylinder + * group will do the correct initialization. + */ acg.cg_time = utime; acg.cg_magic = CG_MAGIC; acg.cg_cgx = cylno; acg.cg_niblk = sblock.fs_ipg; - acg.cg_initediblk = sblock.fs_ipg; acg.cg_ndblk = dmax - cbase; if (sblock.fs_contigsumsize > 0) acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag; @@ -414,7 +420,6 @@ initcg(int cylno, time_t utime, int fso, acg.cg_time = 0; acg.cg_old_niblk = acg.cg_niblk; acg.cg_niblk = 0; - acg.cg_initediblk = 0; acg.cg_old_btotoff = start; acg.cg_old_boff = acg.cg_old_btotoff + sblock.fs_old_cpg * sizeof(int32_t); @@ -2217,6 +2222,7 @@ main(int argc, char **argv) printf("Warning: %jd sector(s) cannot be allocated.\n", (intmax_t)fsbtodb(&sblock, sblock.fs_size % sblock.fs_fpg)); sblock.fs_size = sblock.fs_ncg * sblock.fs_fpg; + maxino -= sblock.fs_ipg; } /* From edwin at FreeBSD.org Mon Oct 5 07:11:20 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Mon Oct 5 07:11:31 2009 Subject: svn commit: r197764 - in head: include usr.bin/locale Message-ID: <200910050711.n957BJnS003574@svn.freebsd.org> Author: edwin Date: Mon Oct 5 07:11:19 2009 New Revision: 197764 URL: http://svn.freebsd.org/changeset/base/197764 Log: Modified locale(1) to be able to show the altmon_X fields and the [cxX]_fmt's. Also modify the "-k list" option to display only fields with a certain prefix. MFC after: 1 week Modified: head/include/langinfo.h head/usr.bin/locale/locale.1 head/usr.bin/locale/locale.c Modified: head/include/langinfo.h ============================================================================== --- head/include/langinfo.h Mon Oct 5 01:31:16 2009 (r197763) +++ head/include/langinfo.h Mon Oct 5 07:11:19 2009 (r197764) @@ -114,6 +114,20 @@ typedef __nl_item nl_item; #define D_MD_ORDER 57 /* month/day order (local extension) */ #endif +/* standalone months forms for %OB */ +#define ALTMON_1 58 +#define ALTMON_2 59 +#define ALTMON_3 60 +#define ALTMON_4 61 +#define ALTMON_5 62 +#define ALTMON_6 63 +#define ALTMON_7 64 +#define ALTMON_8 65 +#define ALTMON_9 66 +#define ALTMON_10 67 +#define ALTMON_11 68 +#define ALTMON_12 69 + __BEGIN_DECLS char *nl_langinfo(nl_item); __END_DECLS Modified: head/usr.bin/locale/locale.1 ============================================================================== --- head/usr.bin/locale/locale.1 Mon Oct 5 01:31:16 2009 (r197763) +++ head/usr.bin/locale/locale.1 Mon Oct 5 07:11:19 2009 (r197764) @@ -35,8 +35,12 @@ .Nm .Op Fl a | m .Nm -.Op Fl ck -.Op Ar keyword ... +.Fl k +.Ic list +.Op Ar prefix +.Nm +.Op Fl ck +.Ar keyword ... .Sh DESCRIPTION The .Nm @@ -79,6 +83,8 @@ The special specific) keyword .Cm list can be used to retrieve the human readable list of all available keywords. +If so, +a prefix string can be defined to limit the amount of keywords returned. .Sh EXIT STATUS .Ex -std .Sh SEE ALSO Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Mon Oct 5 01:31:16 2009 (r197763) +++ head/usr.bin/locale/locale.c Mon Oct 5 07:11:19 2009 (r197764) @@ -55,7 +55,7 @@ const char *lookup_localecat(int); char *kwval_lconv(int); int kwval_lookup(char *, char **, int *, int *); void showdetails(char *); -void showkeywordslist(void); +void showkeywordslist(char *substring); void showlocale(void); void usage(void); @@ -149,6 +149,9 @@ struct _kwinfo { { "d_t_fmt", 1, LC_TIME, D_T_FMT, "" }, { "d_fmt", 1, LC_TIME, D_FMT, "" }, { "t_fmt", 1, LC_TIME, T_FMT, "" }, + { "c_fmt", 1, LC_TIME, C_FMT, "" }, + { "x_fmt", 1, LC_TIME, X_FMT, "" }, + { "X_fmt", 1, LC_TIME, CAPITALX_FMT, "" }, { "am_str", 1, LC_TIME, AM_STR, "" }, { "pm_str", 1, LC_TIME, PM_STR, "" }, { "t_fmt_ampm", 1, LC_TIME, T_FMT_AMPM, "" }, @@ -190,6 +193,18 @@ struct _kwinfo { { "abmon_10", 1, LC_TIME, ABMON_10, "" }, { "abmon_11", 1, LC_TIME, ABMON_11, "" }, { "abmon_12", 1, LC_TIME, ABMON_12, "" }, + { "altmon_1", 1, LC_TIME, ALTMON_1, "" }, + { "altmon_2", 1, LC_TIME, ALTMON_2, "" }, + { "altmon_3", 1, LC_TIME, ALTMON_3, "" }, + { "altmon_4", 1, LC_TIME, ALTMON_4, "" }, + { "altmon_5", 1, LC_TIME, ALTMON_5, "" }, + { "altmon_6", 1, LC_TIME, ALTMON_6, "" }, + { "altmon_7", 1, LC_TIME, ALTMON_7, "" }, + { "altmon_8", 1, LC_TIME, ALTMON_8, "" }, + { "altmon_9", 1, LC_TIME, ALTMON_9, "" }, + { "altmon_10", 1, LC_TIME, ALTMON_10, "" }, + { "altmon_11", 1, LC_TIME, ALTMON_11, "" }, + { "altmon_12", 1, LC_TIME, ALTMON_12, "" }, { "era", 1, LC_TIME, ERA, "(unavailable)" }, { "era_d_fmt", 1, LC_TIME, ERA_D_FMT, "(unavailable)" }, { "era_d_t_fmt", 1, LC_TIME, ERA_D_T_FMT, "(unavailable)" }, @@ -217,7 +232,7 @@ main(int argc, char *argv[]) int ch; int tmp; - while ((ch = getopt(argc, argv, "ackm")) != -1) { + while ((ch = getopt(argc, argv, "ackms:")) != -1) { switch (ch) { case 'a': all_locales = 1; @@ -265,7 +280,7 @@ main(int argc, char *argv[]) if (prt_keywords && argc > 0) while (tmp < argc) if (strcasecmp(argv[tmp++], "list") == 0) { - showkeywordslist(); + showkeywordslist(argv[tmp]); exit(0); } @@ -290,7 +305,8 @@ void usage(void) { printf("Usage: locale [ -a | -m ]\n" - " locale [ -ck ] name ...\n"); + " locale -k list [prefix]\n" + " locale [ -ck ] keyword ...\n"); exit(1); } @@ -594,6 +610,7 @@ showdetails(char *kw) * invalid keyword specified. * XXX: any actions? */ + fprintf(stderr, "Unknown keyword: `%s'\n", kw); return; } @@ -639,16 +656,25 @@ lookup_localecat(int cat) * Show list of keywords */ void -showkeywordslist(void) +showkeywordslist(char *substring) { size_t i; #define FMT "%-20s %-12s %-7s %-20s\n" - printf("List of available keywords\n\n"); + if (substring == NULL) + printf("List of available keywords\n\n"); + else + printf("List of available keywords starting with '%s'\n\n", + substring); printf(FMT, "Keyword", "Category", "Type", "Comment"); printf("-------------------- ------------ ------- --------------------\n"); for (i = 0; i < NKWINFO; i++) { + if (substring != NULL) { + if (strncmp(kwinfo[i].name, substring, + strlen(substring)) != 0) + continue; + } printf(FMT, kwinfo[i].name, lookup_localecat(kwinfo[i].catid), From edwin at FreeBSD.org Mon Oct 5 07:13:16 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Mon Oct 5 07:13:22 2009 Subject: svn commit: r197765 - head/lib/libc/locale Message-ID: <200910050713.n957DGvV003647@svn.freebsd.org> Author: edwin Date: Mon Oct 5 07:13:15 2009 New Revision: 197765 URL: http://svn.freebsd.org/changeset/base/197765 Log: Modified locale(1) to be able to show the altmon_X fields and the [cxX]_fmt's. Also modify the "-k list" option to display only fields with a certain prefix. MFC after: 1 week Modified: head/lib/libc/locale/nl_langinfo.c Modified: head/lib/libc/locale/nl_langinfo.c ============================================================================== --- head/lib/libc/locale/nl_langinfo.c Mon Oct 5 07:11:19 2009 (r197764) +++ head/lib/libc/locale/nl_langinfo.c Mon Oct 5 07:13:15 2009 (r197765) @@ -93,6 +93,12 @@ nl_langinfo(nl_item item) case ABMON_9: case ABMON_10: case ABMON_11: case ABMON_12: ret = (char*) __get_current_time_locale()->mon[_REL(ABMON_1)]; break; + case ALTMON_1: case ALTMON_2: case ALTMON_3: case ALTMON_4: + case ALTMON_5: case ALTMON_6: case ALTMON_7: case ALTMON_8: + case ALTMON_9: case ALTMON_10: case ALTMON_11: case ALTMON_12: + ret = (char*) + __get_current_time_locale()->alt_month[_REL(ALTMON_1)]; + break; case ERA: /* XXX: need to be implemented */ ret = ""; From edwin at FreeBSD.org Mon Oct 5 07:21:22 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Mon Oct 5 07:21:33 2009 Subject: svn commit: r197766 - head/usr.bin/locale Message-ID: <200910050721.n957LMcB003847@svn.freebsd.org> Author: edwin Date: Mon Oct 5 07:21:21 2009 New Revision: 197766 URL: http://svn.freebsd.org/changeset/base/197766 Log: Backout changes for c_fmt, x_fmt and X_fmt, they were coming from the wrong patches. Apologies. Modified: head/usr.bin/locale/locale.c Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Mon Oct 5 07:13:15 2009 (r197765) +++ head/usr.bin/locale/locale.c Mon Oct 5 07:21:21 2009 (r197766) @@ -149,9 +149,6 @@ struct _kwinfo { { "d_t_fmt", 1, LC_TIME, D_T_FMT, "" }, { "d_fmt", 1, LC_TIME, D_FMT, "" }, { "t_fmt", 1, LC_TIME, T_FMT, "" }, - { "c_fmt", 1, LC_TIME, C_FMT, "" }, - { "x_fmt", 1, LC_TIME, X_FMT, "" }, - { "X_fmt", 1, LC_TIME, CAPITALX_FMT, "" }, { "am_str", 1, LC_TIME, AM_STR, "" }, { "pm_str", 1, LC_TIME, PM_STR, "" }, { "t_fmt_ampm", 1, LC_TIME, T_FMT_AMPM, "" }, From lulf at FreeBSD.org Mon Oct 5 08:44:32 2009 From: lulf at FreeBSD.org (Ulf Lilleengen) Date: Mon Oct 5 08:44:45 2009 Subject: svn commit: r197767 - head/sys/geom/vinum Message-ID: <200910050844.n958iVWv005562@svn.freebsd.org> Author: lulf Date: Mon Oct 5 08:44:31 2009 New Revision: 197767 URL: http://svn.freebsd.org/changeset/base/197767 Log: - Improve error message consistency and wording. Modified: head/sys/geom/vinum/geom_vinum_create.c head/sys/geom/vinum/geom_vinum_events.c head/sys/geom/vinum/geom_vinum_init.c head/sys/geom/vinum/geom_vinum_move.c head/sys/geom/vinum/geom_vinum_rm.c head/sys/geom/vinum/geom_vinum_subr.c Modified: head/sys/geom/vinum/geom_vinum_create.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_create.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_create.c Mon Oct 5 08:44:31 2009 (r197767) @@ -94,7 +94,7 @@ gv_create_drive(struct gv_softc *sc, str if (g_attach(cp, pp) != 0) { g_destroy_consumer(cp); g_topology_unlock(); - G_VINUM_DEBUG(0, "create drive '%s': couldn't attach", + G_VINUM_DEBUG(0, "create drive '%s': unable to attach", d->name); g_free(d); return (GV_ERR_CREATE); @@ -135,7 +135,7 @@ gv_create_drive(struct gv_softc *sc, str g_detach(cp); g_destroy_consumer(cp); g_topology_unlock(); - G_VINUM_DEBUG(0, "create drive '%s': couldn't update " + G_VINUM_DEBUG(0, "create drive '%s': unable to update " "access counts", d->name); if (d->hdr != NULL) g_free(d->hdr); @@ -320,7 +320,7 @@ gv_concat(struct g_geom *gp, struct gctl dcount = 0; vol = gctl_get_param(req, "name", NULL); if (vol == NULL) { - gctl_error(req, "volume names not given"); + gctl_error(req, "volume name not given"); return; } @@ -388,7 +388,7 @@ gv_mirror(struct g_geom *gp, struct gctl pcount = 0; vol = gctl_get_param(req, "name", NULL); if (vol == NULL) { - gctl_error(req, "volume's not given"); + gctl_error(req, "volume name not given"); return; } @@ -396,7 +396,7 @@ gv_mirror(struct g_geom *gp, struct gctl drives = gctl_get_paraml(req, "drives", sizeof(*drives)); if (drives == NULL) { - gctl_error(req, "drives not given"); + gctl_error(req, "drive names not given"); return; } @@ -480,7 +480,7 @@ gv_raid5(struct g_geom *gp, struct gctl_ vol = gctl_get_param(req, "name", NULL); if (vol == NULL) { - gctl_error(req, "volume's not given"); + gctl_error(req, "volume name not given"); return; } flags = gctl_get_paraml(req, "flags", sizeof(*flags)); @@ -493,7 +493,7 @@ gv_raid5(struct g_geom *gp, struct gctl_ } if (drives == NULL) { - gctl_error(req, "drives not given"); + gctl_error(req, "drive names not given"); return; } @@ -558,14 +558,14 @@ gv_stripe(struct g_geom *gp, struct gctl pcount = 0; vol = gctl_get_param(req, "name", NULL); if (vol == NULL) { - gctl_error(req, "volume's not given"); + gctl_error(req, "volume name not given"); return; } flags = gctl_get_paraml(req, "flags", sizeof(*flags)); drives = gctl_get_paraml(req, "drives", sizeof(*drives)); if (drives == NULL) { - gctl_error(req, "drives not given"); + gctl_error(req, "drive names not given"); return; } Modified: head/sys/geom/vinum/geom_vinum_events.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_events.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_events.c Mon Oct 5 08:44:31 2009 (r197767) @@ -193,7 +193,7 @@ gv_drive_lost(struct gv_softc *sc, struc if (cp != NULL) { if (cp->nstart != cp->nend) { G_VINUM_DEBUG(0, "dead drive '%s' has still active " - "requests, can't detach consumer", d->name); + "requests, unable to detach consumer", d->name); gv_post_event(sc, GV_EVENT_DRIVE_LOST, d, NULL, 0, 0); return; } Modified: head/sys/geom/vinum/geom_vinum_init.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_init.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_init.c Mon Oct 5 08:44:31 2009 (r197767) @@ -87,7 +87,7 @@ gv_start_obj(struct g_geom *gp, struct g case GV_TYPE_SD: case GV_TYPE_DRIVE: /* XXX Not implemented, but what is the use? */ - gctl_error(req, "cannot start '%s' - not yet supported", + gctl_error(req, "unable to start '%s' - not yet supported", argv); return; default: @@ -279,8 +279,8 @@ gv_rebuild_plex(struct gv_plex *p) LIST_FOREACH(s, &p->subdisks, in_plex) { d = s->drive_sc; if (d == NULL || (d->flags & GV_DRIVE_REFERENCED)) { - G_VINUM_DEBUG(0, "can't rebuild %s, subdisk(s) have no " - "drives", p->name); + G_VINUM_DEBUG(0, "unable to rebuild %s, subdisk(s) have" + " no drives", p->name); return (ENXIO); } } Modified: head/sys/geom/vinum/geom_vinum_move.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_move.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_move.c Mon Oct 5 08:44:31 2009 (r197767) @@ -84,7 +84,7 @@ gv_move(struct g_geom *gp, struct gctl_r type = gv_object_type(sc, object); if (type != GV_TYPE_SD) { gctl_error(req, "you can only move subdisks; " - "'%s' isn't one", object); + "'%s' is not a subdisk", object); return; } @@ -145,7 +145,7 @@ gv_move_sd(struct gv_softc *sc, struct g err = gv_set_sd_state(cursd, GV_SD_STALE, GV_SETSTATE_FORCE | GV_SETSTATE_CONFIG); if (err) { - G_VINUM_DEBUG(0, "could not set the subdisk '%s' to state " + G_VINUM_DEBUG(0, "unable to set the subdisk '%s' to state " "'stale'", cursd->name); return (err); } Modified: head/sys/geom/vinum/geom_vinum_rm.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_rm.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_rm.c Mon Oct 5 08:44:31 2009 (r197767) @@ -207,7 +207,7 @@ gv_rm_vol(struct gv_softc *sc, struct gv /* Check if any of our consumers is open. */ if (gv_provider_is_open(pp)) { - G_VINUM_DEBUG(0, "Unable to remove %s: volume still in use", + G_VINUM_DEBUG(0, "unable to remove %s: volume still in use", v->name); return; } @@ -241,7 +241,7 @@ gv_rm_plex(struct gv_softc *sc, struct g /* Check if any of our consumers is open. */ if (v != NULL && gv_provider_is_open(v->provider) && v->plexcount < 2) { - G_VINUM_DEBUG(0, "Unable to remove %s: volume still in use", + G_VINUM_DEBUG(0, "unable to remove %s: volume still in use", p->name); return; } @@ -318,7 +318,7 @@ gv_rm_drive(struct gv_softc *sc, struct g_topology_unlock(); if (err) { - G_VINUM_DEBUG(0, "%s: couldn't access '%s', " + G_VINUM_DEBUG(0, "%s: unable to access '%s', " "errno: %d", __func__, cp->provider->name, err); return; } @@ -327,7 +327,7 @@ gv_rm_drive(struct gv_softc *sc, struct d->hdr->magic = GV_NOMAGIC; err = gv_write_header(cp, d->hdr); if (err) - G_VINUM_DEBUG(0, "gv_rm_drive: couldn't write header to" + G_VINUM_DEBUG(0, "gv_rm_drive: error writing header to" " '%s', errno: %d", cp->provider->name, err); g_topology_lock(); Modified: head/sys/geom/vinum/geom_vinum_subr.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_subr.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_subr.c Mon Oct 5 08:44:31 2009 (r197767) @@ -585,7 +585,7 @@ gv_sd_to_drive(struct gv_sd *s, struct g return (0); } } else { - G_VINUM_DEBUG(0, "can't give sd '%s' to '%s' " + G_VINUM_DEBUG(0, "error giving subdisk '%s' to '%s' " "(already on '%s')", s->name, d->name, s->drive_sc->name); return (GV_ERR_ISATTACHED); @@ -612,7 +612,7 @@ gv_sd_to_drive(struct gv_sd *s, struct g /* No good slot found? */ if (s->size == -1) { - G_VINUM_DEBUG(0, "couldn't autosize '%s' on '%s'", + G_VINUM_DEBUG(0, "unable to autosize '%s' on '%s'", s->name, d->name); return (GV_ERR_BADSIZE); } From des at FreeBSD.org Mon Oct 5 09:26:23 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 5 09:26:30 2009 Subject: svn commit: r197768 - head/etc/pam.d Message-ID: <200910050926.n959QMSG006510@svn.freebsd.org> Author: des Date: Mon Oct 5 09:26:22 2009 New Revision: 197768 URL: http://svn.freebsd.org/changeset/base/197768 Log: Change the pam_ssh examples: if you use it, you probably want want_agent. MFC after: 3 weeks Modified: head/etc/pam.d/kde head/etc/pam.d/other head/etc/pam.d/sshd head/etc/pam.d/system head/etc/pam.d/telnetd Modified: head/etc/pam.d/kde ============================================================================== --- head/etc/pam.d/kde Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/kde Mon Oct 5 09:26:22 2009 (r197768) @@ -15,5 +15,5 @@ account required pam_nologin.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_permit.so Modified: head/etc/pam.d/other ============================================================================== --- head/etc/pam.d/other Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/other Mon Oct 5 09:26:22 2009 (r197768) @@ -18,7 +18,7 @@ account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_permit.so # password Modified: head/etc/pam.d/sshd ============================================================================== --- head/etc/pam.d/sshd Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/sshd Mon Oct 5 09:26:22 2009 (r197768) @@ -18,7 +18,7 @@ account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_permit.so # password Modified: head/etc/pam.d/system ============================================================================== --- head/etc/pam.d/system Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/system Mon Oct 5 09:26:22 2009 (r197768) @@ -17,7 +17,7 @@ account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_lastlog.so no_fail # password Modified: head/etc/pam.d/telnetd ============================================================================== --- head/etc/pam.d/telnetd Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/telnetd Mon Oct 5 09:26:22 2009 (r197768) @@ -18,7 +18,7 @@ account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_lastlog.so no_fail # password From des at FreeBSD.org Mon Oct 5 09:28:55 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 5 09:29:01 2009 Subject: svn commit: r197769 - head/etc/pam.d Message-ID: <200910050928.n959StEr006603@svn.freebsd.org> Author: des Date: Mon Oct 5 09:28:54 2009 New Revision: 197769 URL: http://svn.freebsd.org/changeset/base/197769 Log: tabify MFC after: 3 weeks Modified: head/etc/pam.d/ftpd head/etc/pam.d/kde head/etc/pam.d/other head/etc/pam.d/sshd head/etc/pam.d/system head/etc/pam.d/telnetd head/etc/pam.d/xdm Modified: head/etc/pam.d/ftpd ============================================================================== --- head/etc/pam.d/ftpd Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/ftpd Mon Oct 5 09:28:54 2009 (r197769) @@ -8,12 +8,12 @@ auth sufficient pam_opie.so no_warn no_fake_prompts auth requisite pam_opieaccess.so no_warn allow_local #auth sufficient pam_krb5.so no_warn -#auth sufficient pam_ssh.so no_warn try_first_pass +#auth sufficient pam_ssh.so no_warn try_first_pass auth required pam_unix.so no_warn try_first_pass # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_unix.so # session Modified: head/etc/pam.d/kde ============================================================================== --- head/etc/pam.d/kde Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/kde Mon Oct 5 09:28:54 2009 (r197769) @@ -11,9 +11,9 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_permit.so Modified: head/etc/pam.d/other ============================================================================== --- head/etc/pam.d/other Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/other Mon Oct 5 09:28:54 2009 (r197769) @@ -13,12 +13,12 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_permit.so # password Modified: head/etc/pam.d/sshd ============================================================================== --- head/etc/pam.d/sshd Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/sshd Mon Oct 5 09:28:54 2009 (r197769) @@ -13,12 +13,12 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_permit.so # password Modified: head/etc/pam.d/system ============================================================================== --- head/etc/pam.d/system Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/system Mon Oct 5 09:28:54 2009 (r197769) @@ -12,12 +12,12 @@ auth requisite pam_opieaccess.so no_war auth required pam_unix.so no_warn try_first_pass nullok # account -#account required pam_krb5.so +#account required pam_krb5.so account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_lastlog.so no_fail # password Modified: head/etc/pam.d/telnetd ============================================================================== --- head/etc/pam.d/telnetd Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/telnetd Mon Oct 5 09:28:54 2009 (r197769) @@ -13,12 +13,12 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_lastlog.so no_fail # password Modified: head/etc/pam.d/xdm ============================================================================== --- head/etc/pam.d/xdm Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/xdm Mon Oct 5 09:28:54 2009 (r197769) @@ -11,11 +11,11 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_unix.so # session -#session required pam_ssh.so want_agent +#session required pam_ssh.so want_agent session required pam_lastlog.so no_fail # password From stas at FreeBSD.org Mon Oct 5 10:08:59 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Mon Oct 5 10:09:05 2009 Subject: svn commit: r197770 - head/sys/arm/arm Message-ID: <200910051008.n95A8wII007645@svn.freebsd.org> Author: stas Date: Mon Oct 5 10:08:58 2009 New Revision: 197770 URL: http://svn.freebsd.org/changeset/base/197770 Log: - Drop unused pmap_use_l1 function and comment out currently unused pmap_dcache_wbinv_all/pmap_copy_page functions which we might want to take advatage of later. This fixes the build with PMAP_DEBUG defined. Discussed with: cognet Modified: head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Mon Oct 5 09:28:54 2009 (r197769) +++ head/sys/arm/arm/pmap.c Mon Oct 5 10:08:58 2009 (r197770) @@ -203,7 +203,6 @@ static void pmap_enter_locked(pmap_t, v static void pmap_fix_cache(struct vm_page *, pmap_t, vm_offset_t); static void pmap_alloc_l1(pmap_t); static void pmap_free_l1(pmap_t); -static void pmap_use_l1(pmap_t); static int pmap_clearbit(struct vm_page *, u_int); @@ -829,47 +828,6 @@ pmap_free_l1(pmap_t pm) mtx_unlock(&l1_lru_lock); } -static PMAP_INLINE void -pmap_use_l1(pmap_t pm) -{ - struct l1_ttable *l1; - - /* - * Do nothing if we're in interrupt context. - * Access to an L1 by the kernel pmap must not affect - * the LRU list. - */ - if (pm == pmap_kernel()) - return; - - l1 = pm->pm_l1; - - /* - * If the L1 is not currently on the LRU list, just return - */ - if (l1->l1_domain_use_count == PMAP_DOMAINS) - return; - - mtx_lock(&l1_lru_lock); - - /* - * Check the use count again, now that we've acquired the lock - */ - if (l1->l1_domain_use_count == PMAP_DOMAINS) { - mtx_unlock(&l1_lru_lock); - return; - } - - /* - * Move the L1 to the back of the LRU list - */ - TAILQ_REMOVE(&l1_lru_list, l1, l1_lru); - TAILQ_INSERT_TAIL(&l1_lru_list, l1, l1_lru); - - mtx_unlock(&l1_lru_lock); -} - - /* * Returns a pointer to the L2 bucket associated with the specified pmap * and VA, or NULL if no L2 bucket exists for the address. @@ -1311,6 +1269,7 @@ pmap_idcache_wbinv_all(pmap_t pm) } } +#ifdef notyet static PMAP_INLINE void pmap_dcache_wbinv_all(pmap_t pm) { @@ -1320,6 +1279,7 @@ pmap_dcache_wbinv_all(pmap_t pm) cpu_l2cache_wbinv_all(); } } +#endif /* * PTE_SYNC_CURRENT: @@ -1914,7 +1874,7 @@ pmap_init(void) { int shpgperproc = PMAP_SHPGPERPROC; - PDEBUG(1, printf("pmap_init: phys_start = %08x\n")); + PDEBUG(1, printf("pmap_init: phys_start = %08x\n", PHYSADDR)); /* * init the pv free list @@ -2373,8 +2333,8 @@ pmap_bootstrap(vm_offset_t firstaddr, vm vm_size_t size; int l1idx, l2idx, l2next = 0; - PDEBUG(1, printf("firstaddr = %08x, loadaddr = %08x\n", - firstaddr, loadaddr)); + PDEBUG(1, printf("firstaddr = %08x, lastaddr = %08x\n", + firstaddr, lastaddr)); virtual_avail = firstaddr; kernel_pmap->pm_l1 = l1; @@ -4251,7 +4211,7 @@ pmap_zero_page_idle(vm_page_t m) * pmap_clean_page() * * This is a local function used to work out the best strategy to clean - * a single page referenced by its entry in the PV table. It's used by + * a single page referenced by its entry in the PV table. It should be used by * pmap_copy_page, pmap_zero page and maybe some others later on. * * Its policy is effectively: @@ -4266,6 +4226,8 @@ pmap_zero_page_idle(vm_page_t m) * mapped at 0x00000000 a whole cache clean will be performed rather than * just the 1 page. Since this should not occur in everyday use and if it does * it will just result in not the most efficient clean for the page. + * + * We don't yet use this function but may want to. */ static int pmap_clean_page(struct pv_entry *pv, boolean_t is_src) From jhb at FreeBSD.org Mon Oct 5 13:30:31 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Oct 5 13:30:38 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <200910041853.n94IrAf7082338@svn.freebsd.org> References: <200910041853.n94IrAf7082338@svn.freebsd.org> Message-ID: <4AC9F4F4.4030008@FreeBSD.org> Alan Cox wrote: > Author: alc > Date: Sun Oct 4 18:53:10 2009 > New Revision: 197750 > URL: http://svn.freebsd.org/changeset/base/197750 > > Log: > Align and pad the page queue and free page queue locks so that the linker > can't possibly place them together within the same cache line. > > MFC after: 3 weeks > > Modified: > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Sun Oct 4 17:22:51 2009 (r197749) > +++ head/sys/vm/vm_page.c Sun Oct 4 18:53:10 2009 (r197750) > @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); > */ > > struct vpgqueues vm_page_queues[PQ_COUNT]; > -struct mtx vm_page_queue_mtx; > -struct mtx vm_page_queue_free_mtx; > +struct vpglocks vm_page_queue_lock; > +struct vpglocks vm_page_queue_free_lock; I think you can do this by just: struct mtx vm_page_queue_mtx __aligned(CACHE_LINE_SIZE); without the need for a wrapper structure. -- John Baldwin From jhb at FreeBSD.org Mon Oct 5 14:13:17 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Oct 5 14:13:28 2009 Subject: svn commit: r197772 - head/sys/dev/ppbus Message-ID: <200910051413.n95EDGXN014646@svn.freebsd.org> Author: jhb Date: Mon Oct 5 14:13:16 2009 New Revision: 197772 URL: http://svn.freebsd.org/changeset/base/197772 Log: When the timeout backoff hits the maximum value, leave it capped at the maximum value rather than setting it to the result of a boolean expression that is always true. Submitted by: Joseph Kong MFC after: 1 month Modified: head/sys/dev/ppbus/lpt.c Modified: head/sys/dev/ppbus/lpt.c ============================================================================== --- head/sys/dev/ppbus/lpt.c Mon Oct 5 14:03:26 2009 (r197771) +++ head/sys/dev/ppbus/lpt.c Mon Oct 5 14:13:16 2009 (r197772) @@ -456,7 +456,7 @@ lptout(void *arg) if (sc->sc_state & OPEN) { sc->sc_backoff++; if (sc->sc_backoff > hz/LPTOUTMAX) - sc->sc_backoff = sc->sc_backoff > hz/LPTOUTMAX; + sc->sc_backoff = hz/LPTOUTMAX; callout_reset(&sc->sc_timer, sc->sc_backoff, lptout, sc); } else sc->sc_state &= ~TOUT; From alc at cs.rice.edu Mon Oct 5 14:17:46 2009 From: alc at cs.rice.edu (Alan Cox) Date: Mon Oct 5 14:18:03 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <4AC9F4F4.4030008@FreeBSD.org> References: <200910041853.n94IrAf7082338@svn.freebsd.org> <4AC9F4F4.4030008@FreeBSD.org> Message-ID: <4ACA0000.2080005@cs.rice.edu> John Baldwin wrote: > Alan Cox wrote: >> Author: alc >> Date: Sun Oct 4 18:53:10 2009 >> New Revision: 197750 >> URL: http://svn.freebsd.org/changeset/base/197750 >> >> Log: >> Align and pad the page queue and free page queue locks so that the >> linker >> can't possibly place them together within the same cache line. >> MFC after: 3 weeks >> >> Modified: >> head/sys/vm/vm_page.c >> head/sys/vm/vm_page.h >> >> Modified: head/sys/vm/vm_page.c >> ============================================================================== >> >> --- head/sys/vm/vm_page.c Sun Oct 4 17:22:51 2009 (r197749) >> +++ head/sys/vm/vm_page.c Sun Oct 4 18:53:10 2009 (r197750) >> @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); >> */ >> >> struct vpgqueues vm_page_queues[PQ_COUNT]; >> -struct mtx vm_page_queue_mtx; >> -struct mtx vm_page_queue_free_mtx; >> +struct vpglocks vm_page_queue_lock; >> +struct vpglocks vm_page_queue_free_lock; > > I think you can do this by just: > > struct mtx vm_page_queue_mtx __aligned(CACHE_LINE_SIZE); > > without the need for a wrapper structure. > Unfortunately, no. When I compile the following example: int a; int b __attribute__((aligned(16))); int x; int y; int z; int main(void) { return (0); } I get the following: 080495b4 A __bss_start 080495b4 A _edata 080495c0 b completed.4860 080495c4 B environ 080495d0 B b 080495d4 B x 080495d8 B z 080495dc B y 080495e0 B a 080495e4 A _end Thus, "b" is aligned as specified, but not padded to 16 bytes. Alan From rwatson at FreeBSD.org Mon Oct 5 14:49:17 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 14:49:29 2009 Subject: svn commit: r197775 - head/sys/kern Message-ID: <200910051449.n95EnGof015525@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 14:49:16 2009 New Revision: 197775 URL: http://svn.freebsd.org/changeset/base/197775 Log: First cut at implementing SOCK_SEQPACKET support for UNIX (local) domain sockets. This allows for reliable bi-directional datagram communication over UNIX domain sockets, in contrast to SOCK_DGRAM (M:N, unreliable) or SOCK_STERAM (bi-directional bytestream). Largely, this reuses existing UNIX domain socket code. This allows applications requiring record- oriented semantics to do so reliably via local IPC. Some implementation notes (also present in XXX comments): - Currently we lack an sbappend variant able to do datagrams and control data without doing addresses, so we mark SOCK_SEQPACKET as PR_ADDR. Adding a new variant will solve this problem. - UNIX domain sockets on FreeBSD provide back-pressure/flow control notification for stream sockets by manipulating the send socket buffer's size during pru_send and pru_rcvd. This trick works less well for SOCK_SEQPACKET as sosend_generic() uses sb_hiwat not just to manage blocking, but also to determine maximum datagram size. Fixing this requires rethinking how back-pressure is done for SOCK_SEQPACKET; in the mean time, it's possible to get EMSGSIZE when buffers fill, instead of blocking. Discussed with: benl Reviewed by: bz, rpaulo MFC after: 3 months Sponsored by: Google Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Mon Oct 5 14:46:56 2009 (r197774) +++ head/sys/kern/uipc_usrreq.c Mon Oct 5 14:49:16 2009 (r197775) @@ -50,7 +50,8 @@ * garbage collector to find and tear down cycles of disconnected sockets. * * TODO: - * SEQPACKET, RDM + * RDM + * distinguish datagram size limits from flow control limits in SEQPACKET * rethink name space problems * need a proper out-of-band */ @@ -112,6 +113,7 @@ static ino_t unp_ino; /* Prototype for static int unp_rights; /* (g) File descriptors in flight. */ static struct unp_head unp_shead; /* (l) List of stream sockets. */ static struct unp_head unp_dhead; /* (l) List of datagram sockets. */ +static struct unp_head unp_sphead; /* (l) List of seqpacket sockets. */ static const struct sockaddr sun_noname = { sizeof(sun_noname), AF_LOCAL }; @@ -139,10 +141,14 @@ static u_long unpst_sendspace = PIPSIZ; static u_long unpst_recvspace = PIPSIZ; static u_long unpdg_sendspace = 2*1024; /* really max datagram size */ static u_long unpdg_recvspace = 4*1024; +static u_long unpsp_sendspace = PIPSIZ; /* really max datagram size */ +static u_long unpsp_recvspace = PIPSIZ; SYSCTL_NODE(_net, PF_LOCAL, local, CTLFLAG_RW, 0, "Local domain"); SYSCTL_NODE(_net_local, SOCK_STREAM, stream, CTLFLAG_RW, 0, "SOCK_STREAM"); SYSCTL_NODE(_net_local, SOCK_DGRAM, dgram, CTLFLAG_RW, 0, "SOCK_DGRAM"); +SYSCTL_NODE(_net_local, SOCK_SEQPACKET, seqpacket, CTLFLAG_RW, 0, + "SOCK_SEQPACKET"); SYSCTL_ULONG(_net_local_stream, OID_AUTO, sendspace, CTLFLAG_RW, &unpst_sendspace, 0, "Default stream send space."); @@ -152,6 +158,10 @@ SYSCTL_ULONG(_net_local_dgram, OID_AUTO, &unpdg_sendspace, 0, "Default datagram send space."); SYSCTL_ULONG(_net_local_dgram, OID_AUTO, recvspace, CTLFLAG_RW, &unpdg_recvspace, 0, "Default datagram receive space."); +SYSCTL_ULONG(_net_local_seqpacket, OID_AUTO, maxseqpacket, CTLFLAG_RW, + &unpsp_sendspace, 0, "Default seqpacket send space."); +SYSCTL_ULONG(_net_local_seqpacket, OID_AUTO, recvspace, CTLFLAG_RW, + &unpsp_recvspace, 0, "Default seqpacket receive space."); SYSCTL_INT(_net_local, OID_AUTO, inflight, CTLFLAG_RD, &unp_rights, 0, "File descriptors in flight."); @@ -257,6 +267,7 @@ static struct mbuf *unp_addsockcred(stru */ static struct domain localdomain; static struct pr_usrreqs uipc_usrreqs_dgram, uipc_usrreqs_stream; +static struct pr_usrreqs uipc_usrreqs_seqpacket; static struct protosw localsw[] = { { .pr_type = SOCK_STREAM, @@ -271,6 +282,19 @@ static struct protosw localsw[] = { .pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS, .pr_usrreqs = &uipc_usrreqs_dgram }, +{ + .pr_type = SOCK_SEQPACKET, + .pr_domain = &localdomain, + + /* + * XXXRW: For now, PR_ADDR because soreceive will bump into them + * due to our use of sbappendaddr. A new sbappend variants is needed + * that supports both atomic record writes and control data. + */ + .pr_flags = PR_ADDR|PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD| + PR_RIGHTS, + .pr_usrreqs = &uipc_usrreqs_seqpacket, +}, }; static struct domain localdomain = { @@ -353,6 +377,11 @@ uipc_attach(struct socket *so, int proto recvspace = unpdg_recvspace; break; + case SOCK_SEQPACKET: + sendspace = unpsp_sendspace; + recvspace = unpsp_recvspace; + break; + default: panic("uipc_attach"); } @@ -372,8 +401,22 @@ uipc_attach(struct socket *so, int proto UNP_LIST_LOCK(); unp->unp_gencnt = ++unp_gencnt; unp_count++; - LIST_INSERT_HEAD(so->so_type == SOCK_DGRAM ? &unp_dhead : &unp_shead, - unp, unp_link); + switch (so->so_type) { + case SOCK_STREAM: + LIST_INSERT_HEAD(&unp_shead, unp, unp_link); + break; + + case SOCK_DGRAM: + LIST_INSERT_HEAD(&unp_dhead, unp, unp_link); + break; + + case SOCK_SEQPACKET: + LIST_INSERT_HEAD(&unp_sphead, unp, unp_link); + break; + + default: + panic("uipc_attach"); + } UNP_LIST_UNLOCK(); return (0); @@ -705,11 +748,8 @@ uipc_rcvd(struct socket *so, int flags) unp = sotounpcb(so); KASSERT(unp != NULL, ("uipc_rcvd: unp == NULL")); - if (so->so_type == SOCK_DGRAM) - panic("uipc_rcvd DGRAM?"); - - if (so->so_type != SOCK_STREAM) - panic("uipc_rcvd unknown socktype"); + if (so->so_type != SOCK_STREAM && so->so_type != SOCK_SEQPACKET) + panic("uipc_rcvd socktype %d", so->so_type); /* * Adjust backpressure on sender and wakeup any waiting to write. @@ -824,6 +864,7 @@ uipc_send(struct socket *so, int flags, break; } + case SOCK_SEQPACKET: case SOCK_STREAM: if ((so->so_state & SS_ISCONNECTED) == 0) { if (nam != NULL) { @@ -875,11 +916,33 @@ uipc_send(struct socket *so, int flags, * Send to paired receive port, and then reduce send buffer * hiwater marks to maintain backpressure. Wake up readers. */ - if (control != NULL) { - if (sbappendcontrol_locked(&so2->so_rcv, m, control)) + switch (so->so_type) { + case SOCK_STREAM: + if (control != NULL) { + if (sbappendcontrol_locked(&so2->so_rcv, m, + control)) + control = NULL; + } else + sbappend_locked(&so2->so_rcv, m); + break; + + case SOCK_SEQPACKET: { + const struct sockaddr *from; + + from = &sun_noname; + if (sbappendaddr_locked(&so2->so_rcv, from, m, + control)) control = NULL; - } else - sbappend_locked(&so2->so_rcv, m); + break; + } + } + + /* + * XXXRW: While fine for SOCK_STREAM, this conflates maximum + * datagram size and back-pressure for SOCK_SEQPACKET, which + * can lead to undesired return of EMSGSIZE on send instead + * of more desirable blocking. + */ mbcnt_delta = so2->so_rcv.sb_mbcnt - unp2->unp_mbcnt; unp2->unp_mbcnt = so2->so_rcv.sb_mbcnt; sbcc = so2->so_rcv.sb_cc; @@ -939,7 +1002,8 @@ uipc_sense(struct socket *so, struct sta UNP_LINK_RLOCK(); UNP_PCB_LOCK(unp); unp2 = unp->unp_conn; - if (so->so_type == SOCK_STREAM && unp2 != NULL) { + if ((so->so_type == SOCK_STREAM || so->so_type == SOCK_SEQPACKET) && + unp2 != NULL) { so2 = unp2->unp_socket; sb->st_blksize += so2->so_rcv.sb_cc; } @@ -1009,6 +1073,26 @@ static struct pr_usrreqs uipc_usrreqs_dg .pru_close = uipc_close, }; +static struct pr_usrreqs uipc_usrreqs_seqpacket = { + .pru_abort = uipc_abort, + .pru_accept = uipc_accept, + .pru_attach = uipc_attach, + .pru_bind = uipc_bind, + .pru_connect = uipc_connect, + .pru_connect2 = uipc_connect2, + .pru_detach = uipc_detach, + .pru_disconnect = uipc_disconnect, + .pru_listen = uipc_listen, + .pru_peeraddr = uipc_peeraddr, + .pru_rcvd = uipc_rcvd, + .pru_send = uipc_send, + .pru_sense = uipc_sense, + .pru_shutdown = uipc_shutdown, + .pru_sockaddr = uipc_sockaddr, + .pru_soreceive = soreceive_generic, /* XXX: or...? */ + .pru_close = uipc_close, +}; + static struct pr_usrreqs uipc_usrreqs_stream = { .pru_abort = uipc_abort, .pru_accept = uipc_accept, @@ -1306,6 +1390,7 @@ unp_connect2(struct socket *so, struct s break; case SOCK_STREAM: + case SOCK_SEQPACKET: unp2->unp_conn = unp; if (req == PRU_CONNECT && ((unp->unp_flags | unp2->unp_flags) & UNP_CONNWAIT)) @@ -1343,6 +1428,7 @@ unp_disconnect(struct unpcb *unp, struct break; case SOCK_STREAM: + case SOCK_SEQPACKET: soisdisconnected(unp->unp_socket); unp2->unp_conn = NULL; soisdisconnected(unp2->unp_socket); @@ -1368,7 +1454,22 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) struct unp_head *head; struct xunpcb *xu; - head = ((intptr_t)arg1 == SOCK_DGRAM ? &unp_dhead : &unp_shead); + switch ((intptr_t)arg1) { + case SOCK_STREAM: + head = &unp_shead; + break; + + case SOCK_DGRAM: + head = &unp_dhead; + break; + + case SOCK_SEQPACKET: + head = &unp_sphead; + break; + + default: + panic("unp_pcblist: arg1 %d", (intptr_t)arg1); + } /* * The process of preparing the PCB list is too time-consuming and @@ -1481,6 +1582,9 @@ SYSCTL_PROC(_net_local_dgram, OID_AUTO, SYSCTL_PROC(_net_local_stream, OID_AUTO, pcblist, CTLFLAG_RD, (caddr_t)(long)SOCK_STREAM, 0, unp_pcblist, "S,xunpcb", "List of active local stream sockets"); +SYSCTL_PROC(_net_local_seqpacket, OID_AUTO, pcblist, CTLFLAG_RD, + (caddr_t)(long)SOCK_SEQPACKET, 0, unp_pcblist, "S,xunpcb", + "List of active local seqpacket sockets"); static void unp_shutdown(struct unpcb *unp) @@ -1492,7 +1596,8 @@ unp_shutdown(struct unpcb *unp) UNP_PCB_LOCK_ASSERT(unp); unp2 = unp->unp_conn; - if (unp->unp_socket->so_type == SOCK_STREAM && unp2 != NULL) { + if ((unp->unp_socket->so_type == SOCK_STREAM || + (unp->unp_socket->so_type == SOCK_SEQPACKET)) && unp2 != NULL) { so = unp2->unp_socket; if (so != NULL) socantrcvmore(so); @@ -1658,6 +1763,7 @@ unp_init(void) NULL, EVENTHANDLER_PRI_ANY); LIST_INIT(&unp_dhead); LIST_INIT(&unp_shead); + LIST_INIT(&unp_sphead); TASK_INIT(&unp_gc_task, 0, unp_gc, NULL); UNP_LINK_LOCK_INIT(); UNP_LIST_LOCK_INIT(); @@ -1974,7 +2080,8 @@ SYSCTL_INT(_net_local, OID_AUTO, taskcou static void unp_gc(__unused void *arg, int pending) { - struct unp_head *heads[] = { &unp_dhead, &unp_shead, NULL }; + struct unp_head *heads[] = { &unp_dhead, &unp_shead, &unp_sphead, + NULL }; struct unp_head **head; struct file **unref; struct unpcb *unp; From stas at FreeBSD.org Mon Oct 5 15:05:10 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Mon Oct 5 15:05:22 2009 Subject: svn commit: r197741 - head/lib/libpmc In-Reply-To: <200910041054.n94AsKTI071707@svn.freebsd.org> References: <200910041054.n94AsKTI071707@svn.freebsd.org> Message-ID: <20091005190502.7976ef3e.stas@FreeBSD.org> On Sun, 4 Oct 2009 10:54:20 +0000 (UTC) Rui Paulo mentioned: > Author: rpaulo > Date: Sun Oct 4 10:54:20 2009 > New Revision: 197741 > URL: http://svn.freebsd.org/changeset/base/197741 > > Log: > Install x86 related man pages on x86 systems only. > > Reviewed by: jkoshy > > Modified: > head/lib/libpmc/Makefile > > Modified: head/lib/libpmc/Makefile > ============================================================================== > --- head/lib/libpmc/Makefile Sun Oct 4 10:38:04 2009 (r197740) > +++ head/lib/libpmc/Makefile Sun Oct 4 10:54:20 2009 (r197741) > @@ -24,6 +24,7 @@ MAN+= pmc_start.3 > MAN+= pmclog.3 > > # PMC-dependent manual pages > +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" > MAN+= pmc.atom.3 > MAN+= pmc.core.3 > MAN+= pmc.core2.3 > @@ -34,6 +35,7 @@ MAN+= pmc.p4.3 > MAN+= pmc.p5.3 > MAN+= pmc.p6.3 > MAN+= pmc.tsc.3 > +.endif > You probably don't want to install i386-only man pages on amd64 as well (pmc.atom, pmc.k7, pmc.p5). -- Stanislav Sedov ST4096-RIPE -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 801 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091005/5413b0da/attachment.pgp From jh at FreeBSD.org Mon Oct 5 15:05:44 2009 From: jh at FreeBSD.org (Jaakko Heinonen) Date: Mon Oct 5 15:05:51 2009 Subject: svn commit: r197776 - head/share/misc Message-ID: <200910051505.n95F5iQH015898@svn.freebsd.org> Author: jh Date: Mon Oct 5 15:05:43 2009 New Revision: 197776 URL: http://svn.freebsd.org/changeset/base/197776 Log: Add myself. Approved by: trasz (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Mon Oct 5 14:49:16 2009 (r197775) +++ head/share/misc/committers-src.dot Mon Oct 5 15:05:43 2009 (r197776) @@ -106,6 +106,7 @@ ivoras [label="Ivan Voras\nivoras@FreeBS jake [label="Jake Burkholder\njake@FreeBSD.org\n2000/05/16"] jamie [label="Jamie Gritton\njamie@FreeBSD.org\n2009/01/28"] jayanth [label="Jayanth Vijayaraghavan\njayanth@FreeBSD.org\n2000/05/08"] +jh [label="Jaakko Heinonen\njh@FreeBSD.org\n2009/10/02"] jilles [label="Jilles Tjoelker\njilles@FreeBSD.org\n2009/05/22"] jinmei [label="JINMEI Tatuya\njinmei@FreeBSD.org\n2007/03/17"] jdp [label="John Polstra\njdp@FreeBSD.org\n????/??/??"] @@ -406,6 +407,7 @@ rwatson -> bz rwatson -> cperciva rwatson -> emaste rwatson -> gnn +rwatson -> jh rwatson -> kensmith rwatson -> kmacy rwatson -> linimon @@ -435,6 +437,8 @@ sos -> marcel thompsa -> weongyo thompsa -> eri +trasz -> jh + ume -> jinmei ume -> suz ume -> tshiozak From rwatson at FreeBSD.org Mon Oct 5 15:06:15 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 15:06:21 2009 Subject: svn commit: r197777 - head/usr.bin/netstat Message-ID: <200910051506.n95F6FWb015948@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 15:06:14 2009 New Revision: 197777 URL: http://svn.freebsd.org/changeset/base/197777 Log: netstat(1) support for UNIX SOCK_SEQPACKET sockets -- changes were required only for the kvm case, as we supported SOCK_SEQPACKET via sysctl already. Sponsored by: Google MFC after: 3 months Modified: head/usr.bin/netstat/main.c head/usr.bin/netstat/netstat.h head/usr.bin/netstat/unix.c Modified: head/usr.bin/netstat/main.c ============================================================================== --- head/usr.bin/netstat/main.c Mon Oct 5 15:05:43 2009 (r197776) +++ head/usr.bin/netstat/main.c Mon Oct 5 15:06:14 2009 (r197777) @@ -186,6 +186,8 @@ static struct nlist nl[] = { { .n_name = "_mfctablesize" }, #define N_ARPSTAT 55 { .n_name = "_arpstat" }, +#define N_UNP_SPHEAD 56 + { .n_name = "unp_sphead" }, { .n_name = NULL }, }; @@ -601,7 +603,8 @@ main(int argc, char *argv[]) #endif /* NETGRAPH */ if ((af == AF_UNIX || af == AF_UNSPEC) && !sflag) unixpr(nl[N_UNP_COUNT].n_value, nl[N_UNP_GENCNT].n_value, - nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value); + nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value, + nl[N_UNP_SPHEAD].n_value); exit(0); } Modified: head/usr.bin/netstat/netstat.h ============================================================================== --- head/usr.bin/netstat/netstat.h Mon Oct 5 15:05:43 2009 (r197776) +++ head/usr.bin/netstat/netstat.h Mon Oct 5 15:06:14 2009 (r197777) @@ -150,7 +150,7 @@ void ddp_stats(u_long, const char *, int void netgraphprotopr(u_long, const char *, int, int); #endif -void unixpr(u_long, u_long, u_long, u_long); +void unixpr(u_long, u_long, u_long, u_long, u_long); void esis_stats(u_long, const char *, int, int); void clnp_stats(u_long, const char *, int, int); Modified: head/usr.bin/netstat/unix.c ============================================================================== --- head/usr.bin/netstat/unix.c Mon Oct 5 15:05:43 2009 (r197776) +++ head/usr.bin/netstat/unix.c Mon Oct 5 15:06:14 2009 (r197777) @@ -193,21 +193,37 @@ fail: } void -unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off) +unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off, + u_long sphead_off) { char *buf; int ret, type; struct xsocket *so; struct xunpgen *xug, *oxug; struct xunpcb *xunp; + u_long head_off; for (type = SOCK_STREAM; type <= SOCK_SEQPACKET; type++) { if (live) ret = pcblist_sysctl(type, &buf); - else - ret = pcblist_kvm(count_off, gencnt_off, - type == SOCK_STREAM ? shead_off : - (type == SOCK_DGRAM ? dhead_off : 0), &buf); + else { + head_off = 0; + switch (type) { + case SOCK_STREAM: + head_off = shead_off; + break; + + case SOCK_DGRAM: + head_off = dhead_off; + break; + + case SOCK_SEQPACKET: + head_off = sphead_off; + break; + } + ret = pcblist_kvm(count_off, gencnt_off, head_off, + &buf); + } if (ret == -1) continue; if (ret < 0) From rwatson at FreeBSD.org Mon Oct 5 15:07:44 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 15:07:56 2009 Subject: svn commit: r197778 - head/share/man/man4 Message-ID: <200910051507.n95F7isb016016@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 15:07:44 2009 New Revision: 197778 URL: http://svn.freebsd.org/changeset/base/197778 Log: SOCK_SEQPACKET is now supported on UNIX domain sockets. Sponsored by: Google MFC after: 3 months Modified: head/share/man/man4/unix.4 Modified: head/share/man/man4/unix.4 ============================================================================== --- head/share/man/man4/unix.4 Mon Oct 5 15:06:14 2009 (r197777) +++ head/share/man/man4/unix.4 Mon Oct 5 15:07:44 2009 (r197778) @@ -52,7 +52,8 @@ mechanisms. The .Ux Ns -domain family supports the -.Dv SOCK_STREAM +.Dv SOCK_STREAM , +.Dv SOCK_SEQPACKET , and .Dv SOCK_DGRAM socket types and uses @@ -127,11 +128,14 @@ The .Ux Ns -domain protocol family is comprised of simple transport protocols that support the -.Dv SOCK_STREAM +.Dv SOCK_STREAM , +.Dv SOCK_SEQPACKET , and .Dv SOCK_DGRAM abstractions. .Dv SOCK_STREAM +and +.Dv SOCK_SEQPACKET sockets also support the communication of .Ux file descriptors through the use of the @@ -206,8 +210,9 @@ and tested with .Xr getsockopt 2 : .Bl -tag -width ".Dv LOCAL_CONNWAIT" .It Dv LOCAL_CREDS -This option may be enabled on a -.Dv SOCK_DGRAM +This option may be enabled on +.Dv SOCK_DGRAM , +.Dv SOCK_SEQPACKET , or a .Dv SOCK_STREAM socket. From rwatson at FreeBSD.org Mon Oct 5 15:15:14 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 15:16:01 2009 Subject: svn commit: r197779 - head/share/man/man4 Message-ID: <200910051515.n95FFDub016209@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 15:15:13 2009 New Revision: 197779 URL: http://svn.freebsd.org/changeset/base/197779 Log: Bump unix(4) man page date for SOCK_SEQPACKET. Suggested by: bz MFC after: 3 months Modified: head/share/man/man4/unix.4 Modified: head/share/man/man4/unix.4 ============================================================================== --- head/share/man/man4/unix.4 Mon Oct 5 15:07:44 2009 (r197778) +++ head/share/man/man4/unix.4 Mon Oct 5 15:15:13 2009 (r197779) @@ -32,7 +32,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd July 15, 2001 +.Dd October 5, 2009 .Dt UNIX 4 .Os .Sh NAME From trasz at FreeBSD.org Mon Oct 5 15:16:28 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Oct 5 15:17:33 2009 Subject: svn commit: r197780 - head/share/man/man9 Message-ID: <200910051516.n95FGS6p016270@svn.freebsd.org> Author: trasz Date: Mon Oct 5 15:16:28 2009 New Revision: 197780 URL: http://svn.freebsd.org/changeset/base/197780 Log: Make fetch(9) and store(9) manual pages closer to reality. Modified: head/share/man/man9/Makefile head/share/man/man9/fetch.9 head/share/man/man9/store.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Oct 5 15:15:13 2009 (r197779) +++ head/share/man/man9/Makefile Mon Oct 5 15:16:28 2009 (r197780) @@ -606,8 +606,10 @@ MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECL EVENTHANDLER.9 eventhandler_register.9 MLINKS+=fetch.9 fubyte.9 \ fetch.9 fuswintr.9 \ - fetch.9 fusword.9 \ - fetch.9 fuword.9 + fetch.9 fuword.9 \ + fetch.9 fuword16.9 \ + fetch.9 fuword32.9 \ + fetch.9 fuword64.9 MLINKS+=g_attach.9 g_detach.9 MLINKS+=g_bio.9 g_clone_bio.9 \ g_bio.9 g_destroy_bio.9 \ @@ -1142,8 +1144,10 @@ MLINKS+=stack.9 stack_copy.9 \ stack.9 stack_zero.9 MLINKS+=store.9 subyte.9 \ store.9 suswintr.9 \ - store.9 susword.9 \ - store.9 suword.9 + store.9 suword.9 \ + store.9 suword16.9 \ + store.9 suword32.9 \ + store.9 suword64.9 MLINKS+=swi.9 swi_add.9 \ swi.9 swi_sched.9 MLINKS+=sx.9 sx_assert.9 \ Modified: head/share/man/man9/fetch.9 ============================================================================== --- head/share/man/man9/fetch.9 Mon Oct 5 15:15:13 2009 (r197779) +++ head/share/man/man9/fetch.9 Mon Oct 5 15:16:28 2009 (r197780) @@ -34,29 +34,35 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 1996 +.Dd October 5, 2009 .Dt FETCH 9 .Os .Sh NAME .Nm fetch , .Nm fubyte , -.Nm fusword , .Nm fuswintr , -.Nm fuword +.Nm fuword , +.Nm fuword16 , +.Nm fuword32 , +.Nm fuword64 .Nd fetch data from user-space .Sh SYNOPSIS .In sys/types.h .In sys/time.h .In sys/systm.h -.In sys/resourcevar.h .Ft int .Fn fubyte "const void *base" +.Ft long +.Fn fuword "const void *base" .Ft int -.Fn fusword "void *base" +.Fn fuword16 "void *base" +.Ft int32_t +.Fn fuword32 "const void *base" +.Ft int64_t +.Fn fuword64 "const void *base" +.In sys/resourcevar.h .Ft int .Fn fuswintr "void *base" -.Ft long -.Fn fuword "const void *base" .Sh DESCRIPTION The .Nm @@ -69,16 +75,22 @@ routines provide the following functiona .It Fn fubyte Fetches a byte of data from the user-space address .Pa base . -.It Fn fusword -Fetches a short word of data from the user-space address +.It Fn fuword +Fetches a word of data from the user-space address +.Pa base . +.It Fn fuword16 +Fetches 16 bits of data from the user-space address +.Pa base . +.It Fn fuword32 +Fetches 32 bits of data from the user-space address +.Pa base . +.It Fn fuword64 +Fetches 64 bits of data from the user-space address .Pa base . .It Fn fuswintr Fetches a short word of data from the user-space address .Pa base . This function is safe to call during an interrupt context. -.It Fn fuword -Fetches a word of data from the user-space address -.Pa base . .El .Sh RETURN VALUES The Modified: head/share/man/man9/store.9 ============================================================================== --- head/share/man/man9/store.9 Mon Oct 5 15:15:13 2009 (r197779) +++ head/share/man/man9/store.9 Mon Oct 5 15:16:28 2009 (r197780) @@ -34,13 +34,12 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 1996 +.Dd October 5, 2009 .Dt STORE 9 .Os .Sh NAME .Nm store , .Nm subyte , -.Nm susword , .Nm suswintr , .Nm suword .Nd store data to user-space @@ -48,15 +47,19 @@ .In sys/types.h .In sys/time.h .In sys/systm.h -.In sys/resourcevar.h .Ft int .Fn subyte "void *base" "int byte" .Ft int -.Fn susword "void *base" "int word" +.Fn suword "void *base" "long word" .Ft int -.Fn suswintr "void *base" "int word" +.Fn suword16 "void *base" "int word" .Ft int -.Fn suword "void *base" "long word" +.Fn suword32 "void *base" "int32_t word" +.Ft int +.Fn suword64 "void *base" "int64_t word" +.In sys/resourcevar.h +.Ft int +.Fn suswintr "void *base" "int word" .Sh DESCRIPTION The .Nm @@ -69,16 +72,22 @@ routines provide the following functiona .It Fn subyte Stores a byte of data to the user-space address .Pa base . -.It Fn susword -Stores a short word of data to the user-space address +.It Fn suword +Stores a word of data to the user-space address +.Pa base . +.It Fn suword16 +Stores 16 bits of of data to the user-space address +.Pa base . +.It Fn suword32 +Stores 32 bits of of data to the user-space address +.Pa base . +.It Fn suword64 +Stores 64 bits of of data to the user-space address .Pa base . .It Fn suswintr Stores a short word of data to the user-space address .Pa base . This function is safe to call during an interrupt context. -.It Fn suword -Stores a word of data to the user-space address -.Pa base . .El .Sh RETURN VALUES The From jhb at FreeBSD.org Mon Oct 5 15:21:48 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Oct 5 15:21:55 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <4ACA0000.2080005@cs.rice.edu> References: <200910041853.n94IrAf7082338@svn.freebsd.org> <4AC9F4F4.4030008@FreeBSD.org> <4ACA0000.2080005@cs.rice.edu> Message-ID: <4ACA0F09.2010808@FreeBSD.org> Alan Cox wrote: > John Baldwin wrote: >> Alan Cox wrote: >>> Author: alc >>> Date: Sun Oct 4 18:53:10 2009 >>> New Revision: 197750 >>> URL: http://svn.freebsd.org/changeset/base/197750 >>> >>> Log: >>> Align and pad the page queue and free page queue locks so that the >>> linker >>> can't possibly place them together within the same cache line. >>> MFC after: 3 weeks >>> >>> Modified: >>> head/sys/vm/vm_page.c >>> head/sys/vm/vm_page.h >>> >>> Modified: head/sys/vm/vm_page.c >>> ============================================================================== >>> >>> --- head/sys/vm/vm_page.c Sun Oct 4 17:22:51 2009 (r197749) >>> +++ head/sys/vm/vm_page.c Sun Oct 4 18:53:10 2009 (r197750) >>> @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); >>> */ >>> >>> struct vpgqueues vm_page_queues[PQ_COUNT]; >>> -struct mtx vm_page_queue_mtx; >>> -struct mtx vm_page_queue_free_mtx; >>> +struct vpglocks vm_page_queue_lock; >>> +struct vpglocks vm_page_queue_free_lock; >> >> I think you can do this by just: >> >> struct mtx vm_page_queue_mtx __aligned(CACHE_LINE_SIZE); >> >> without the need for a wrapper structure. >> > > Unfortunately, no. When I compile the following example: > > int a; > int b __attribute__((aligned(16))); > int x; > int y; > int z; > > int > main(void) > { > > return (0); > } > > I get the following: > > 080495b4 A __bss_start > 080495b4 A _edata > 080495c0 b completed.4860 > 080495c4 B environ > 080495d0 B b > 080495d4 B x > 080495d8 B z > 080495dc B y > 080495e0 B a > 080495e4 A _end > > Thus, "b" is aligned as specified, but not padded to 16 bytes. Do you care what is in the padding in this case or more about just having each mutex on a separate cache line? __aligned() is fine if you don't mind the padding getting reused for something else. -- John Baldwin From rwatson at FreeBSD.org Mon Oct 5 15:27:01 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 15:27:13 2009 Subject: svn commit: r197781 - in head/tools/regression/sockets: unix_seqpacket unix_seqpacket_exercise Message-ID: <200910051527.n95FR1Je016540@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 15:27:01 2009 New Revision: 197781 URL: http://svn.freebsd.org/changeset/base/197781 Log: A few regression tests for SOCK_SEQPACKET UNIX domain sockets. Sponsored by: Google Added: head/tools/regression/sockets/unix_seqpacket/ head/tools/regression/sockets/unix_seqpacket/Makefile (contents, props changed) head/tools/regression/sockets/unix_seqpacket/unix_seqpacket.c (contents, props changed) head/tools/regression/sockets/unix_seqpacket_exercise/ head/tools/regression/sockets/unix_seqpacket_exercise/Makefile (contents, props changed) head/tools/regression/sockets/unix_seqpacket_exercise/unix_seqpacket_exercise.c (contents, props changed) Added: head/tools/regression/sockets/unix_seqpacket/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sockets/unix_seqpacket/Makefile Mon Oct 5 15:27:01 2009 (r197781) @@ -0,0 +1,9 @@ +# +# $FreeBSD$ +# + +PROG= unix_seqpacket +CFLAGS+= -Wall -Werror +NO_MAN= + +.include Added: head/tools/regression/sockets/unix_seqpacket/unix_seqpacket.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sockets/unix_seqpacket/unix_seqpacket.c Mon Oct 5 15:27:01 2009 (r197781) @@ -0,0 +1,140 @@ +/*- + * Copyright (c) 2009 Robert N. M. Watson + * All rights reserved. + * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include + +#define FAILERR(str) err(-1, "%s: %s", __func__, str) +#define FAILERRX(str) errx(-1, "%s: %s", __func__, str) + +static void +test_socket(void) +{ + int s; + + s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s < 0) + FAILERR("socket"); + (void)close(s); +} + +static void +test_socketpair(void) +{ + int sv[2]; + + if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sv) < 0) + FAILERR("socketpair"); + (void)close(sv[0]); + (void)close(sv[1]); +} + +static void +test_listen_unbound(void) +{ + int s; + + s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s < 0) + FAILERR("socket"); + if (listen(s, -1) == 0) + FAILERRX("listen"); + (void)close(s); +} + +static void +test_bind(void) +{ + struct sockaddr_un sun; + char path[PATH_MAX]; + int s; + + snprintf(path, sizeof(path), "/tmp/lds.XXXXXXXXX"); + if (mktemp(path) == NULL) + FAILERR("mktemp"); + s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s < 0) + FAILERR("socket"); + bzero(&sun, sizeof(sun)); + sun.sun_family = AF_LOCAL; + sun.sun_len = sizeof(sun); + strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + if (bind(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) + FAILERR("bind"); + close(s); + (void)unlink(path); +} + +static void +test_listen_bound(void) +{ + struct sockaddr_un sun; + char path[PATH_MAX]; + int s; + + snprintf(path, sizeof(path), "/tmp/lds.XXXXXXXXX"); + if (mktemp(path) == NULL) + FAILERR("mktemp"); + s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s < 0) + FAILERR("socket"); + bzero(&sun, sizeof(sun)); + sun.sun_family = AF_LOCAL; + sun.sun_len = sizeof(sun); + strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + if (bind(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) + FAILERR("bind"); + if (listen(s, -1)) { + (void)unlink(path); + FAILERR("bind"); + } + close(s); + (void)unlink(path); +} + +int +main(int argc, char *argv[]) +{ + + test_socket(); + test_socketpair(); + test_listen_unbound(); + test_bind(); + test_listen_bound(); +} Added: head/tools/regression/sockets/unix_seqpacket_exercise/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sockets/unix_seqpacket_exercise/Makefile Mon Oct 5 15:27:01 2009 (r197781) @@ -0,0 +1,9 @@ +# +# $FreeBSD$ +# + +PROG=unix_seqpacket_exercise +CFLAGS+=-Wall -Werror +NO_MAN= + +.include Added: head/tools/regression/sockets/unix_seqpacket_exercise/unix_seqpacket_exercise.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sockets/unix_seqpacket_exercise/unix_seqpacket_exercise.c Mon Oct 5 15:27:01 2009 (r197781) @@ -0,0 +1,435 @@ +/*- + * Copyright (c) 2009 Robert N. M. Watson + * All rights reserved. + * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define min(x, y) (x < y ? x : y) + +#define BUFLEN 32768 + +#define SEQPACKET_RCVBUF (131072-16) +#define SEQPACKET_SNDBUF (131072-16) + +#define FAILERR(str) err(-1, "%s: %s", __func__, str) +#define FAILNERR(str, n) err(-1, "%s %d: %s", __func__, n, str) +#define FAILNMERR(str, n, m) err(-1, "%s %d %d: %s", __func__, n, m, str) +#define FAILERRX(str) errx(-1, "%s: %s", __func__, str) +#define FAILNERRX(str, n) errx(-1, "%s %d: %s", __func__, n, str) +#define FAILNMERRX(str, n, m) errx(-1, "%s %d %d: %s", __func__, n, m, str) + +static int ann = 0; + +#define ANN() (ann ? warnx("%s: start", __func__) : 0) +#define ANNN(n) (ann ? warnx("%s %d: start", __func__, (n)) : 0) +#define ANNNM(n, m) (ann ? warnx("%s %d %d: start", __func__, (n), (m)) : 0) + +#define OK() warnx("%s: ok", __func__) +#define OKN(n) warnx("%s %d: ok", __func__, (n)) +#define OKNM(n, m) warnx("%s %d %d: ok", __func__, (n), (m)) + +#ifdef SO_NOSIGPIPE +#define NEW_SOCKET(s) do { \ + int i; \ + \ + (s) = socket(PF_LOCAL, SOCK_SEQPACKET, 0); \ + if ((s) < 0) \ + FAILERR("socket"); \ + \ + i = 1; \ + if (setsockopt((s), SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_NOSIGPIPE"); \ + \ + i = SEQPACKET_RCVBUF; \ + if (setsockopt((s), SOL_SOCKET, SO_RCVBUF, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_RCVBUF"); \ + \ + i = SEQPACKET_SNDBUF; \ + if (setsockopt((s), SOL_SOCKET, SO_SNDBUF, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_SNDBUF"); \ +} while (0) +#else +#define NEW_SOCKET(s) do { \ + int i; \ + \ + (s) = socket(PF_LOCAL, SOCK_SEQPACKET, 0); \ + if ((s) < 0) \ + FAILERR("socket"); \ + \ + i = SEQPACKET_RCVBUF; \ + if (setsockopt((s), SOL_SOCKET, SO_RCVBUF, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_RCVBUF"); \ + \ + i = SEQPACKET_SNDBUF; \ + if (setsockopt((s), SOL_SOCKET, SO_SNDBUF, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_SNDBUF"); \ +} while (0) +#endif + +static void +server(int s_listen) +{ + char buffer[BUFLEN]; + ssize_t ssize_recv, ssize_send; + socklen_t socklen; + int i, s_accept; + + while (1) { + s_accept = accept(s_listen, NULL, 0); + if (s_accept >= 0) { + i = SEQPACKET_RCVBUF; + if (setsockopt(s_accept, SOL_SOCKET, SO_RCVBUF, &i, + sizeof(i)) < 0) { + warn("server: setsockopt SO_RCVBUF"); + close(s_accept); + continue; + } + + if (getsockopt(s_accept, SOL_SOCKET, SO_RCVBUF, &i, + &socklen) < 0) { + warn("server: getsockopt SO_RCVBUF"); + close(s_accept); + continue; + } + if (i != SEQPACKET_RCVBUF) { + warnx("server: getsockopt SO_RCVBUF wrong %d", + i); + close(s_accept); + continue; + } + + socklen = sizeof(i); + if (getsockopt(s_accept, SOL_SOCKET, SO_SNDBUF, &i, + &socklen) < 0) { + warn("server: getsockopt SO_SNDBUF"); + close(s_accept); + continue; + } + if (i != SEQPACKET_SNDBUF) { + warnx("server: getsockopt SO_SNDBUF wrong %d", + i); + close(s_accept); + continue; + } + + do { + ssize_recv = recv(s_accept, buffer, + sizeof(buffer), 0); + if (ssize_recv == 0) + break; + if (ssize_recv < 0) { + warn("server: recv"); + break; + } + ssize_send = send(s_accept, buffer, + ssize_recv, 0); + if (ssize_send == 0) + break; + if (ssize_send < 0) { + warn("server: send"); + break; + } + if (ssize_send != ssize_recv) + warnx("server: recv %d sent %d", + ssize_recv, ssize_send); + } while (1); + close(s_accept); + } else + warn("server: accept"); + } +} + +static void +test_connect(struct sockaddr_un *sun) +{ + int s; + + ANN(); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILERR("connect"); + (void)close(s); + OK(); +} + +static void +test_connect_send(struct sockaddr_un *sun) +{ + ssize_t ssize; + char ch; + int s; + + ANN(); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILERR("connect"); + ssize = send(s, &ch, sizeof(ch), 0); + if (ssize < 0) + FAILERR("send"); + if (ssize != sizeof(ch)) + FAILERRX("send wrong size"); + (void)close(s); + OK(); +} + +static void +test_connect_shutdown_send(struct sockaddr_un *sun) +{ + ssize_t ssize; + char ch; + int s; + + ANN(); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILERR("connect"); + if (shutdown(s, SHUT_RDWR) < 0) + FAILERR("shutdown SHUT_RDWR"); + ssize = send(s, &ch, sizeof(ch), 0); + if (ssize >= 0) + FAILERRX("send"); + if (errno != EPIPE) + FAILERR("send unexpected error"); + (void)close(s); + OK(); +} + +static void +test_connect_send_recv(struct sockaddr_un *sun, size_t size) +{ + char buf[size + 4]; /* Detect extra bytes. */ + size_t truncsize; + ssize_t ssize; + int s; + + ANNN(size); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILNERR("connect", size); + ssize = send(s, buf, size, 0); + if (ssize < 0 && size >= SEQPACKET_RCVBUF) + goto out; + if (ssize < 0) + FAILNERR("send", size); + if (ssize == 0) + FAILNERR("send eof", size); + if (ssize != size) + FAILNERRX("send size", size); + + truncsize = min(size, BUFLEN); + ssize = recv(s, buf, sizeof(buf), 0); + if (ssize < 0) + FAILNERR("recv", size); + if (ssize == 0) + FAILNERRX("recv eof", size); + if (ssize < truncsize) + FAILNERRX("recv too few bytes", size); + if (ssize > truncsize) + FAILNERRX("recv too many bytes", size); +out: + (void)close(s); + OKN(size); +} + +static void +test_connect_send_recv_count(struct sockaddr_un *sun, int count, size_t size) +{ + char buf[size + 4]; /* Detect extra bytes and coalescing. */ + size_t truncsize; + ssize_t ssize; + int i, s; + + ANNNM(size, count); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILNMERR("connect", size, count); + for (i = 0; i < count; i++) { + usleep(5000); + ssize = send(s, buf, size, 0); + if (ssize < 0 && size >= SEQPACKET_RCVBUF) + goto out; + if (ssize < 0) + FAILNMERR("send", size, count); + if (ssize == 0) + FAILNMERRX("send eof", size, count); + if (ssize != size) + FAILNMERRX("send size", size, count); + } + + truncsize = min(size, BUFLEN); + for (i = 0; i < count; i++) { + ssize = recv(s, buf, sizeof(buf), 0); + if (ssize < 0) + FAILNMERR("recv", size, count); + if (ssize == 0) + FAILNMERRX("recv eof", size, count); + if (ssize < truncsize) + FAILNMERRX("recv too few bytes", size, count); + if (ssize > truncsize) + FAILNMERRX("recv too many bytes", size, count); + } +out: + (void)close(s); + OKNM(size, count); +} + +static void +test_sendto(struct sockaddr_un *sun) +{ + ssize_t ssize; + char ch; + int s; + + ANN(); + NEW_SOCKET(s); + ssize = sendto(s, &ch, sizeof(ch), 0, (struct sockaddr *)sun, + sizeof(*sun)); + if (ssize < 0) + FAILERR("sendto"); + (void)close(s); + OK(); +} + +static void +client(struct sockaddr_un *sun) +{ + size_t sizes[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, + 4096, 8192, 16384, 32768, 65536 /*, 131072 */}; + int c, i; + + test_connect(sun); + test_connect_send(sun); + test_connect_shutdown_send(sun); + + /* + * Try a range of sizes and packet counts. + */ + for (i = 0; i < sizeof(sizes) / sizeof(sizes[0]); i++) + test_connect_send_recv(sun, sizes[i]); + for (c = 1; c <= 8; c++) { + for (i = 0; i < sizeof(sizes) / sizeof(sizes[0]); i++) + test_connect_send_recv_count(sun, c, sizes[i]); + } + test_sendto(sun); + printf("client done\n"); +} + +int +main(int argc, char *argv[]) +{ + struct sockaddr_un sun; + char path[PATH_MAX]; + pid_t pid_client, pid_server; + int i, s_listen; + + snprintf(path, sizeof(path), "/tmp/lds_exercise.XXXXXXXXX"); + if (mktemp(path) == NULL) + FAILERR("mktemp"); + + s_listen = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s_listen < 0) { + (void)unlink(path); + FAILERR("socket"); + } + + i = SEQPACKET_RCVBUF; + if (setsockopt(s_listen, SOL_SOCKET, SO_RCVBUF, &i, sizeof(i)) < 0) { + (void)unlink(path); + FAILERR("setsockopt SO_RCVBUF"); + } + + i = SEQPACKET_SNDBUF; + if (setsockopt(s_listen, SOL_SOCKET, SO_SNDBUF, &i, sizeof(i)) < 0) { + (void)unlink(path); + FAILERR("setsockopt SO_SNDBUF"); + } + + i = 1; + if (setsockopt(s_listen, SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof(i)) + < 0) { + (void)unlink(path); + FAILERR("setsockopt SO_NOSIGPIPE"); + } + + bzero(&sun, sizeof(sun)); + sun.sun_len = sizeof(sun); + sun.sun_family = AF_LOCAL; + strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + + if (bind(s_listen, (struct sockaddr *)&sun, sizeof(sun)) < 0) { + (void)unlink(path); + FAILERR("bind"); + } + + if (listen(s_listen, -1) < 0) { + (void)unlink(path); + FAILERR("listen"); + } + + pid_server = fork(); + if (pid_server < 0) { + (void)unlink(path); + FAILERR("fork"); + } + if (pid_server == 0) { + server(s_listen); + return (0); + } + + pid_client = fork(); + if (pid_client < 0) { + (void)kill(pid_server, SIGKILL); + (void)unlink(path); + FAILERR("fork"); + } + if (pid_client == 0) { + client(&sun); + return (0); + } + + /* + * When the client is done, kill the server and clean up. + */ + (void)waitpid(pid_client, NULL, 0); + (void)kill(pid_server, SIGKILL); + (void)unlink(path); + return (0); +} From jkim at FreeBSD.org Mon Oct 5 16:26:55 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Mon Oct 5 16:27:06 2009 Subject: svn commit: r197783 - head/sys/dev/ata/chipsets Message-ID: <200910051626.n95GQs3T018031@svn.freebsd.org> Author: jkim Date: Mon Oct 5 16:26:54 2009 New Revision: 197783 URL: http://svn.freebsd.org/changeset/base/197783 Log: - Revert r191568 partially. Forcing AHCI mode by changing device subclass and progif is evil. It doesn't work reliably[1] and we should honor BIOS configuration by the user. - If the SATA controller is enbled but combined mode is disabled, mask off the emulated IDE channel on the legacy IDE controller. Pointed out by: mav[1] Modified: head/sys/dev/ata/chipsets/ata-ati.c Modified: head/sys/dev/ata/chipsets/ata-ati.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ati.c Mon Oct 5 15:45:25 2009 (r197782) +++ head/sys/dev/ata/chipsets/ata-ati.c Mon Oct 5 16:26:54 2009 (r197783) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -55,9 +54,6 @@ __FBSDID("$FreeBSD$"); /* local prototypes */ static int ata_ati_chipinit(device_t dev); static void ata_ati_setmode(device_t dev, int mode); -static void ata_ati_ahci_enable(device_t dev); -static int ata_ati_ahci_chipinit(device_t dev); -static int ata_ati_ahci_resume(device_t dev); /* misc defines */ #define ATI_PATA 0x01 @@ -66,13 +62,6 @@ static int ata_ati_ahci_resume(device_t #define SII_MEMIO 1 #define SII_BUG 0x04 -/* Misc Control Register */ -#define ATI_PCI_MISC_CTRL 0x40 -#define ATI_PCI_MISCCTRL_ENABLE_WR 0x00000001 - -/* Watchdog Control/Status Register */ -#define ATI_PCI_WD_CTRL 0x44 -#define ATI_PCI_WDCTRL_ENABLE 0x0001 /* * ATI chipset support functions @@ -121,19 +110,7 @@ ata_ati_probe(device_t dev) ctlr->chipinit = ata_sii_chipinit; break; case ATI_AHCI: - /* - * Force AHCI mode if IDE mode is set from BIOS. - */ - if ((ctlr->chip->chipid == ATA_ATI_IXP600_S1 || - ctlr->chip->chipid == ATA_ATI_IXP700_S1) && - pci_get_subclass(dev) == PCIS_STORAGE_IDE) { - struct pci_devinfo *dinfo = device_get_ivars(dev); - pcicfgregs *cfg = &dinfo->cfg; - cfg->subclass = PCIS_STORAGE_SATA; - cfg->progif = PCIP_STORAGE_SATA_AHCI_1_0; - ata_ati_ahci_enable(dev); - } - ctlr->chipinit = ata_ati_ahci_chipinit; + ctlr->chipinit = ata_ahci_chipinit; break; } return (BUS_PROBE_DEFAULT); @@ -143,13 +120,41 @@ static int ata_ati_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); + device_t smbdev; + int satacfg; if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; - /* IXP600 only has 1 PATA channel */ - if (ctlr->chip->chipid == ATA_ATI_IXP600) + switch (ctlr->chip->chipid) { + case ATA_ATI_IXP600: + /* IXP600 only has 1 PATA channel */ ctlr->channels = 1; + break; + case ATA_ATI_IXP700: + /* + * When "combined mode" is enabled, an additional PATA channel is + * emulated with two SATA ports and appears on this device. + * This mode can only be detected via SMB controller. + */ + smbdev = pci_find_device(ATA_ATI_ID, 0x4385); + if (smbdev != NULL) { + satacfg = pci_read_config(smbdev, 0xad, 1); + if (bootverbose) + device_printf(dev, "SATA controller %s (%s%s channel)\n", + (satacfg & 0x01) == 0 ? "disabled" : "enabled", + (satacfg & 0x08) == 0 ? "" : "combined mode, ", + (satacfg & 0x10) == 0 ? "primary" : "secondary"); + + /* + * If SATA controller is enabled but combined mode is disabled, + * we have only one PATA channel. Ignore a non-existent channel. + */ + if ((satacfg & 0x09) == 0x01) + ctlr->ichannels &= ~(1 << ((satacfg & 0x10) >> 4)); + } + break; + } ctlr->setmode = ata_ati_setmode; return 0; @@ -219,43 +224,6 @@ ata_ati_setmode(device_t dev, int mode) } } -static void -ata_ati_ahci_enable(device_t dev) -{ - struct pci_devinfo *dinfo = device_get_ivars(dev); - pcicfgregs *cfg = &dinfo->cfg; - uint32_t ctrl; - - ctrl = pci_read_config(dev, ATI_PCI_MISC_CTRL, 4); - pci_write_config(dev, ATI_PCI_MISC_CTRL, - ctrl | ATI_PCI_MISCCTRL_ENABLE_WR, 4); - pci_write_config(dev, PCIR_SUBCLASS, cfg->subclass, 1); - pci_write_config(dev, PCIR_PROGIF, cfg->progif, 1); - pci_write_config(dev, ATI_PCI_WD_CTRL, - pci_read_config(dev, ATI_PCI_WD_CTRL, 2) | ATI_PCI_WDCTRL_ENABLE, 2); - pci_write_config(dev, ATI_PCI_MISC_CTRL, - ctrl & ~ATI_PCI_MISCCTRL_ENABLE_WR, 4); -} - -static int -ata_ati_ahci_chipinit(device_t dev) -{ - struct ata_pci_controller *ctlr = device_get_softc(dev); - int error; - - error = ata_ahci_chipinit(dev); - ctlr->resume = ata_ati_ahci_resume; - return (error); -} - -static int -ata_ati_ahci_resume(device_t dev) -{ - - ata_ati_ahci_enable(dev); - return (ata_ahci_ctlr_reset(dev)); -} - ATA_DECLARE_DRIVER(ata_ati); MODULE_DEPEND(ata_ati, ata_ahci, 1, 1, 1); MODULE_DEPEND(ata_ati, ata_sii, 1, 1, 1); From des at FreeBSD.org Mon Oct 5 18:55:14 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 5 18:55:21 2009 Subject: svn commit: r197785 - head/crypto/openssh Message-ID: <200910051855.n95ItDOj021922@svn.freebsd.org> Author: des Date: Mon Oct 5 18:55:13 2009 New Revision: 197785 URL: http://svn.freebsd.org/changeset/base/197785 Log: Add more symbols that need to be masked: - initialized and uninitialized data - symbols from roaming_dummy.c which end up in pam_ssh Update the command line used to generate the #defines. Modified: head/crypto/openssh/ssh_namespace.h Modified: head/crypto/openssh/ssh_namespace.h ============================================================================== --- head/crypto/openssh/ssh_namespace.h Mon Oct 5 18:20:36 2009 (r197784) +++ head/crypto/openssh/ssh_namespace.h Mon Oct 5 18:55:13 2009 (r197785) @@ -7,7 +7,7 @@ * * A list of symbols which need munging is obtained as follows: * - * nm libssh.a | awk '$2 == "T" && $3 !~ /^ssh_/ { print "#define", $3, "ssh_" $3 }' + * nm libssh.a | awk '/[0-9a-z] [A-Z] / && $3 !~ /^ssh_/ { print "#define", $3, "ssh_" $3 }' * * $FreeBSD$ */ @@ -18,6 +18,7 @@ #define acss_setkey ssh_acss_setkey #define acss_setsubkey ssh_acss_setsubkey #define add_host_to_hostfile ssh_add_host_to_hostfile +#define add_recv_bytes ssh_add_recv_bytes #define addargs ssh_addargs #define addr_match_list ssh_addr_match_list #define ask_permission ssh_ask_permission @@ -111,6 +112,8 @@ #define channel_open_message ssh_channel_open_message #define channel_output_poll ssh_channel_output_poll #define channel_permit_all_opens ssh_channel_permit_all_opens +#define channel_post ssh_channel_post +#define channel_pre ssh_channel_pre #define channel_prepare_select ssh_channel_prepare_select #define channel_print_adm_permitted_opens ssh_channel_print_adm_permitted_opens #define channel_register_cleanup ssh_channel_register_cleanup @@ -150,14 +153,19 @@ #define cipher_set_key_string ssh_cipher_set_key_string #define cipher_set_keycontext ssh_cipher_set_keycontext #define cipher_set_keyiv ssh_cipher_set_keyiv +#define ciphers ssh_ciphers #define ciphers_valid ssh_ciphers_valid #define cleanhostname ssh_cleanhostname #define cleanup_exit ssh_cleanup_exit #define clear_cached_addr ssh_clear_cached_addr #define colon ssh_colon +#define compat13 ssh_compat13 +#define compat20 ssh_compat20 #define compat_cipher_proposal ssh_compat_cipher_proposal #define compat_datafellows ssh_compat_datafellows #define convtime ssh_convtime +#define current_keys ssh_current_keys +#define datafellows ssh_datafellows #define debug ssh_debug #define debug ssh_debug #define debug2 ssh_debug2 @@ -175,6 +183,7 @@ #define dh_new_group14 ssh_dh_new_group14 #define dh_new_group_asc ssh_dh_new_group_asc #define dh_pub_is_valid ssh_dh_pub_is_valid +#define dispatch ssh_dispatch #define dispatch_init ssh_dispatch_init #define dispatch_protocol_error ssh_dispatch_protocol_error #define dispatch_protocol_ignore ssh_dispatch_protocol_ignore @@ -205,6 +214,7 @@ #define get_local_port ssh_get_local_port #define get_peer_ipaddr ssh_get_peer_ipaddr #define get_peer_port ssh_get_peer_port +#define get_recv_bytes ssh_get_recv_bytes #define get_remote_ipaddr ssh_get_remote_ipaddr #define get_remote_name_or_ip ssh_get_remote_name_or_ip #define get_remote_port ssh_get_remote_port @@ -216,6 +226,7 @@ #define host_hash ssh_host_hash #define hostfile_read_key ssh_hostfile_read_key #define hpdelim ssh_hpdelim +#define incoming_stream ssh_incoming_stream #define init_rng ssh_init_rng #define ipv64_normalise_mapped ssh_ipv64_normalise_mapped #define kex_derive_keys ssh_kex_derive_keys @@ -268,6 +279,7 @@ #define mac_init ssh_mac_init #define mac_setup ssh_mac_setup #define mac_valid ssh_mac_valid +#define macs ssh_macs #define match_host_and_ip ssh_match_host_and_ip #define match_hostname ssh_match_hostname #define match_list ssh_match_list @@ -279,6 +291,7 @@ #define ms_subtract_diff ssh_ms_subtract_diff #define ms_to_timeval ssh_ms_to_timeval #define mysignal ssh_mysignal +#define outgoing_stream ssh_outgoing_stream #define packet_add_padding ssh_packet_add_padding #define packet_backup_state ssh_packet_backup_state #define packet_close ssh_packet_close @@ -363,9 +376,13 @@ #define refresh_progress_meter ssh_refresh_progress_meter #define replacearg ssh_replacearg #define restore_uid ssh_restore_uid +#define resume_in_progress ssh_resume_in_progress +#define resume_kex ssh_resume_kex #define rijndael_decrypt ssh_rijndael_decrypt #define rijndael_encrypt ssh_rijndael_encrypt #define rijndael_set_key ssh_rijndael_set_key +#define roaming_read ssh_roaming_read +#define roaming_write ssh_roaming_write #define rsa_generate_additional_parameters ssh_rsa_generate_additional_parameters #define rsa_private_decrypt ssh_rsa_private_decrypt #define rsa_public_encrypt ssh_rsa_public_encrypt @@ -393,6 +410,7 @@ #define tty_make_modes ssh_tty_make_modes #define tty_parse_modes ssh_tty_parse_modes #define tun_open ssh_tun_open +#define umac_ctx ssh_umac_ctx #define umac_delete ssh_umac_delete #define umac_final ssh_umac_final #define umac_new ssh_umac_new From des at FreeBSD.org Mon Oct 5 18:56:18 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 5 18:56:24 2009 Subject: svn commit: r197786 - head/lib/libpam/modules/pam_ssh Message-ID: <200910051856.n95IuIow021985@svn.freebsd.org> Author: des Date: Mon Oct 5 18:56:18 2009 New Revision: 197786 URL: http://svn.freebsd.org/changeset/base/197786 Log: pam_ssh needs roaming_dummy to link correctly against libssh. Modified: head/lib/libpam/modules/pam_ssh/Makefile Modified: head/lib/libpam/modules/pam_ssh/Makefile ============================================================================== --- head/lib/libpam/modules/pam_ssh/Makefile Mon Oct 5 18:55:13 2009 (r197785) +++ head/lib/libpam/modules/pam_ssh/Makefile Mon Oct 5 18:56:18 2009 (r197786) @@ -7,6 +7,9 @@ LIB= pam_ssh MAN= pam_ssh.8 SRCS= pam_ssh.c +# required when linking with a dynamic libssh +SRCS+= roaming_dummy.c + WARNS?= 0 CFLAGS+= -I${SSHDIR} -include ssh_namespace.h From bcr at FreeBSD.org Mon Oct 5 19:29:49 2009 From: bcr at FreeBSD.org (Benedict Reuschling) Date: Mon Oct 5 19:30:03 2009 Subject: svn commit: r197788 - head/usr.bin/calendar/calendars Message-ID: <200910051929.n95JTnbD022940@svn.freebsd.org> Author: bcr (doc committer) Date: Mon Oct 5 19:29:49 2009 New Revision: 197788 URL: http://svn.freebsd.org/changeset/base/197788 Log: Belatedly add my calendar entry. Discussed with: remko Approved by: remko, jkois (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Mon Oct 5 19:29:25 2009 (r197787) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Oct 5 19:29:49 2009 (r197788) @@ -244,6 +244,7 @@ 09/10 Wesley R. Peters born in Hartford, Alabama, United States, 1961 09/12 Weongyo Jeong born in Haman, Korea, 1980 09/12 William C. Fumerola II born in Detroit, Michigan, United States, 1981 +09/12 Benedict Christopher Reuschling born in Darmstadt, Germany, 1981 09/15 Dima Panov born in Khabarovsk, Russian Federation, 1978 09/17 Maxim Bolotin born in Rostov-on-Don, Russian Federation, 1976 09/20 Kevin Lo born in Taipei, Taiwan, Republic of China, 1972 From trasz at FreeBSD.org Mon Oct 5 19:56:57 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Oct 5 19:57:08 2009 Subject: svn commit: r197789 - head/sys/kern Message-ID: <200910051956.n95Juu6T023638@svn.freebsd.org> Author: trasz Date: Mon Oct 5 19:56:56 2009 New Revision: 197789 URL: http://svn.freebsd.org/changeset/base/197789 Log: Fix NFSv4 ACLs on sparc64. Turns out that fuword(9) fetches 64 bits instead of sizeof(int), and on sparc64 that resulted in fetching wrong value for acl_maxcnt, which in turn caused __acl_get_link(2) to fail with EINVAL. PR: sparc64/139304 Submitted by: Dmitry Afanasiev Modified: head/sys/kern/vfs_acl.c Modified: head/sys/kern/vfs_acl.c ============================================================================== --- head/sys/kern/vfs_acl.c Mon Oct 5 19:29:49 2009 (r197788) +++ head/sys/kern/vfs_acl.c Mon Oct 5 19:56:56 2009 (r197789) @@ -161,7 +161,7 @@ acl_copyout(struct acl *kernel_acl, void break; default: - if (fuword((char *)user_acl + + if (fuword32((char *)user_acl + offsetof(struct acl, acl_maxcnt)) != ACL_MAX_ENTRIES) return (EINVAL); From hrs at FreeBSD.org Mon Oct 5 20:11:33 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Mon Oct 5 20:11:44 2009 Subject: svn commit: r197790 - head/etc Message-ID: <200910052011.n95KBXdS024044@svn.freebsd.org> Author: hrs Date: Mon Oct 5 20:11:33 2009 New Revision: 197790 URL: http://svn.freebsd.org/changeset/base/197790 Log: Fix a case when both ${name}_program and ${command} are defined. Spotted by: Michio "Karl" Jinbo Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Mon Oct 5 19:56:56 2009 (r197789) +++ head/etc/rc.subr Mon Oct 5 20:11:33 2009 (r197790) @@ -602,7 +602,7 @@ run_rc_command() esac eval _override_command=\$${name}_program - command=${command:-${_override_command}} + command=${command:+${_override_command:-$command}} _keywords="start stop restart rcvar $extra_commands" rc_pid= From np at FreeBSD.org Mon Oct 5 20:21:41 2009 From: np at FreeBSD.org (Navdeep Parhar) Date: Mon Oct 5 20:21:48 2009 Subject: svn commit: r197791 - in head/sys: conf dev/cxgb dev/cxgb/common modules/cxgb/cxgb Message-ID: <200910052021.n95KLfDJ024351@svn.freebsd.org> Author: np Date: Mon Oct 5 20:21:41 2009 New Revision: 197791 URL: http://svn.freebsd.org/changeset/base/197791 Log: cxgb(4) updates, including: - support for the new Gen-2, BT, and LP-CR cards. - T3 firmware 7.7.0 - shared "common code" updates. Approved by: gnn (mentor) Obtained from: Chelsio MFC after: 1 month Added: head/sys/dev/cxgb/common/cxgb_aq100x.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cxgb/common/cxgb_ael1002.c head/sys/dev/cxgb/common/cxgb_common.h head/sys/dev/cxgb/common/cxgb_mv88e1xxx.c head/sys/dev/cxgb/common/cxgb_regs.h head/sys/dev/cxgb/common/cxgb_t3_hw.c head/sys/dev/cxgb/common/cxgb_tn1010.c head/sys/dev/cxgb/common/cxgb_vsc8211.c head/sys/dev/cxgb/common/cxgb_xgmac.c head/sys/dev/cxgb/cxgb_adapter.h head/sys/dev/cxgb/cxgb_main.c head/sys/dev/cxgb/cxgb_osdep.h head/sys/dev/cxgb/cxgb_t3fw.h head/sys/modules/cxgb/cxgb/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Oct 5 20:11:33 2009 (r197790) +++ head/sys/conf/files Mon Oct 5 20:21:41 2009 (r197791) @@ -774,6 +774,8 @@ dev/cxgb/common/cxgb_vsc8211.c optional compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_ael1002.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" +dev/cxgb/common/cxgb_aq100x.c optional cxgb pci \ + compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_mv88e1xxx.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_xgmac.c optional cxgb pci \ Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_ael1002.c Mon Oct 5 20:11:33 2009 (r197790) +++ head/sys/dev/cxgb/common/cxgb_ael1002.c Mon Oct 5 20:21:41 2009 (r197791) @@ -45,16 +45,30 @@ enum { enum { AEL100X_TX_DISABLE = 9, AEL100X_TX_CONFIG1 = 0xc002, + AEL1002_PWR_DOWN_HI = 0xc011, AEL1002_PWR_DOWN_LO = 0xc012, AEL1002_XFI_EQL = 0xc015, AEL1002_LB_EN = 0xc017, + AEL_OPT_SETTINGS = 0xc017, AEL_I2C_CTRL = 0xc30a, AEL_I2C_DATA = 0xc30b, AEL_I2C_STAT = 0xc30c, + AEL2005_GPIO_CTRL = 0xc214, AEL2005_GPIO_STAT = 0xc215, + + AEL2020_GPIO_INTR = 0xc103, + AEL2020_GPIO_CTRL = 0xc108, + AEL2020_GPIO_STAT = 0xc10c, + AEL2020_GPIO_CFG = 0xc110, + + AEL2020_GPIO_SDA = 0, + AEL2020_GPIO_MODDET = 1, + AEL2020_GPIO_0 = 3, + AEL2020_GPIO_1 = 2, + AEL2020_GPIO_LSTAT = AEL2020_GPIO_1, }; enum { edc_none, edc_sr, edc_twinax }; @@ -81,7 +95,7 @@ struct reg_val { unsigned short set_bits; }; -static int get_module_type(struct cphy *phy); +static int ael2xxx_get_module_type(struct cphy *phy, int delay_ms); static int set_phy_regs(struct cphy *phy, const struct reg_val *rv) { @@ -108,6 +122,9 @@ static void ael100x_txon(struct cphy *ph msleep(30); } +/* + * Read an 8-bit word from a device attached to the PHY's i2c bus. + */ static int ael_i2c_rd(struct cphy *phy, int dev_addr, int word_addr) { int i, err; @@ -131,11 +148,14 @@ static int ael_i2c_rd(struct cphy *phy, return data >> 8; } } - CH_WARN(phy->adapter, "PHY %u I2C read of addr %u timed out\n", - phy->addr, word_addr); + CH_WARN(phy->adapter, "PHY %u i2c read of dev.addr %x.%x timed out\n", + phy->addr, dev_addr, word_addr); return -ETIMEDOUT; } +/* + * Write an 8-bit word to a device attached to the PHY's i2c bus. + */ static int ael_i2c_wr(struct cphy *phy, int dev_addr, int word_addr, int data) { int i, err; @@ -158,8 +178,8 @@ static int ael_i2c_wr(struct cphy *phy, if ((stat & 3) == 1) return 0; } - CH_WARN(phy->adapter, "PHY %u I2C Write of addr %u timed out\n", - phy->addr, word_addr); + CH_WARN(phy->adapter, "PHY %u i2c Write of dev.addr %x.%x = %#x timed out\n", + phy->addr, dev_addr, word_addr, data); return -ETIMEDOUT; } @@ -230,9 +250,9 @@ static int ael1002_get_module_type(struc if (delay_ms) msleep(delay_ms); - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0); + v = ael2xxx_get_module_type(phy, delay_ms); - return v == -ETIMEDOUT ? phy_modtype_none : get_module_type(phy); + return (v == -ETIMEDOUT ? phy_modtype_none : v); } static int ael1002_reset(struct cphy *phy, int wait) @@ -312,12 +332,13 @@ static struct cphy_ops ael1002_ops = { }; #endif -int t3_ael1002_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr, +int t3_ael1002_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops) { int err; + struct cphy *phy = &pinfo->phy; - cphy_init(phy, adapter, phy_addr, &ael1002_ops, mdio_ops, + cphy_init(phy, pinfo->adapter, pinfo, phy_addr, &ael1002_ops, mdio_ops, SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE, "10GBASE-R"); ael100x_txon(phy); @@ -366,12 +387,6 @@ static int ael1006_reset(struct cphy *ph } -static int ael1006_power_down(struct cphy *phy, int enable) -{ - return t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, - BMCR_PDOWN, enable ? BMCR_PDOWN : 0); -} - #ifdef C99_NOT_SUPPORTED static struct cphy_ops ael1006_ops = { ael1006_reset, @@ -385,7 +400,7 @@ static struct cphy_ops ael1006_ops = { NULL, NULL, get_link_status_r, - ael1006_power_down, + ael1002_power_down, }; #else static struct cphy_ops ael1006_ops = { @@ -395,20 +410,97 @@ static struct cphy_ops ael1006_ops = { .intr_clear = t3_phy_lasi_intr_clear, .intr_handler = t3_phy_lasi_intr_handler, .get_link_status = get_link_status_r, - .power_down = ael1006_power_down, + .power_down = ael1002_power_down, }; #endif -int t3_ael1006_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr, +int t3_ael1006_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops) { - cphy_init(phy, adapter, phy_addr, &ael1006_ops, mdio_ops, + struct cphy *phy = &pinfo->phy; + + cphy_init(phy, pinfo->adapter, pinfo, phy_addr, &ael1006_ops, mdio_ops, SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE, "10GBASE-SR"); + phy->modtype = phy_modtype_sr; ael100x_txon(phy); return 0; } +/* + * Decode our module type. + */ +static int ael2xxx_get_module_type(struct cphy *phy, int delay_ms) +{ + int v; + + if (delay_ms) + msleep(delay_ms); + + v = get_phytrans_type(phy); + if (v == phy_transtype_sfp) { + /* SFP: see SFF-8472 for below */ + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 3); + if (v < 0) + return v; + + if (v == 0x1) + return phy_modtype_twinax; + if (v == 0x10) + return phy_modtype_sr; + if (v == 0x20) + return phy_modtype_lr; + if (v == 0x40) + return phy_modtype_lrm; + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 6); + if (v < 0) + return v; + if (v != 4) + return phy_modtype_unknown; + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 10); + if (v < 0) + return v; + + if (v & 0x80) { + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0x12); + if (v < 0) + return v; + return v > 10 ? phy_modtype_twinax_long : + phy_modtype_twinax; + } + } else if (v == phy_transtype_xfp) { + /* XFP: See INF-8077i for details. */ + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 127); + if (v < 0) + return v; + + if (v != 1) { + /* XXX: set page select to table 1 yourself */ + return phy_modtype_unknown; + } + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 131); + if (v < 0) + return v; + v &= 0xf0; + if (v == 0x10) + return phy_modtype_lrm; + if (v == 0x40) + return phy_modtype_lr; + if (v == 0x80) + return phy_modtype_sr; + } + + return phy_modtype_unknown; +} + +/* + * Code to support the Aeluros/NetLogic 2005 10Gb PHY. + */ static int ael2005_setup_sr_edc(struct cphy *phy) { static struct reg_val regs[] = { @@ -1103,72 +1195,21 @@ static int ael2005_setup_twinax_edc(stru return err; } -static int get_module_type(struct cphy *phy) +static int ael2005_get_module_type(struct cphy *phy, int delay_ms) { int v; + unsigned int stat; - v = get_phytrans_type(phy); - if (v == phy_transtype_sfp) { - /* SFP: see SFF-8472 for below */ - - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 3); - if (v < 0) - return v; - - if (v == 0x1) - return phy_modtype_twinax; - if (v == 0x10) - return phy_modtype_sr; - if (v == 0x20) - return phy_modtype_lr; - if (v == 0x40) - return phy_modtype_lrm; - - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 6); - if (v < 0) - return v; - if (v != 4) - return phy_modtype_unknown; - - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 10); - if (v < 0) - return v; - - if (v & 0x80) { - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0x12); - if (v < 0) - return v; - return v > 10 ? phy_modtype_twinax_long : - phy_modtype_twinax; - } - } else if (v == phy_transtype_xfp) { - /* XFP: See INF-8077i for details. */ - - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 127); - if (v < 0) - return v; - - if (v != 1) { - /* XXX: set page select to table 1 yourself */ - return phy_modtype_unknown; - } + v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, &stat); + if (v) + return v; - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 131); - if (v < 0) - return v; - v &= 0xf0; - if (v == 0x10) - return phy_modtype_lrm; - if (v == 0x40) - return phy_modtype_lr; - if (v == 0x80) - return phy_modtype_sr; - } + if (stat & (1 << 8)) /* module absent */ + return phy_modtype_none; - return phy_modtype_unknown; + return ael2xxx_get_module_type(phy, delay_ms); } - static int ael2005_intr_enable(struct cphy *phy) { int err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, 0x200); @@ -1187,24 +1228,6 @@ static int ael2005_intr_clear(struct cph return err ? err : t3_phy_lasi_intr_clear(phy); } -static int ael2005_get_module_type(struct cphy *phy, int delay_ms) -{ - int v; - unsigned int stat; - - v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, &stat); - if (v) - return v; - - if (stat & (1 << 8)) /* module absent */ - return phy_modtype_none; - - if (delay_ms) - msleep(delay_ms); - - return get_module_type(phy); -} - static int ael2005_reset(struct cphy *phy, int wait) { static struct reg_val regs0[] = { @@ -1223,7 +1246,8 @@ static int ael2005_reset(struct cphy *ph { 0, 0, 0, 0 } }; - int err, lasi_ctrl; + int err; + unsigned int lasi_ctrl; err = mdio_read(phy, MDIO_DEV_PMA_PMD, LASI_CTRL, &lasi_ctrl); if (err) @@ -1311,8 +1335,8 @@ static int ael2005_intr_handler(struct c return ret; } -#ifdef C99_NOT_SUPPORTED static struct cphy_ops ael2005_ops = { +#ifdef C99_NOT_SUPPORTED ael2005_reset, ael2005_intr_enable, ael2005_intr_disable, @@ -1325,9 +1349,7 @@ static struct cphy_ops ael2005_ops = { NULL, get_link_status_r, ael1002_power_down, -}; #else -static struct cphy_ops ael2005_ops = { .reset = ael2005_reset, .intr_enable = ael2005_intr_enable, .intr_disable = ael2005_intr_disable, @@ -1335,14 +1357,16 @@ static struct cphy_ops ael2005_ops = { .intr_handler = ael2005_intr_handler, .get_link_status = get_link_status_r, .power_down = ael1002_power_down, -}; #endif +}; -int t3_ael2005_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr, +int t3_ael2005_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops) { int err; - cphy_init(phy, adapter, phy_addr, &ael2005_ops, mdio_ops, + struct cphy *phy = &pinfo->phy; + + cphy_init(phy, pinfo->adapter, pinfo, phy_addr, &ael2005_ops, mdio_ops, SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE | SUPPORTED_IRQ, "10GBASE-R"); msleep(125); @@ -1357,6 +1381,713 @@ int t3_ael2005_phy_prep(struct cphy *phy } /* + * Setup EDC and other parameters for operation with an optical module. + */ +static int ael2020_setup_sr_edc(struct cphy *phy) +{ + static struct reg_val regs[] = { + { MDIO_DEV_PMA_PMD, 0xcc01, 0xffff, 0x488a }, + + { MDIO_DEV_PMA_PMD, 0xcb1b, 0xffff, 0x0200 }, + { MDIO_DEV_PMA_PMD, 0xcb1c, 0xffff, 0x00f0 }, + { MDIO_DEV_PMA_PMD, 0xcc06, 0xffff, 0x00e0 }, + + /* end */ + { 0, 0, 0, 0 } + }; + int err; + + err = set_phy_regs(phy, regs); + msleep(50); + if (err) + return err; + + phy->priv = edc_sr; + return 0; +} + +/* + * Setup EDC and other parameters for operation with an TWINAX module. + */ +static int ael2020_setup_twinax_edc(struct cphy *phy, int modtype) +{ + static struct reg_val uCclock40MHz[] = { + { MDIO_DEV_PMA_PMD, 0xff28, 0xffff, 0x4001 }, + { MDIO_DEV_PMA_PMD, 0xff2a, 0xffff, 0x0002 }, + { 0, 0, 0, 0 } + }; + + static struct reg_val uCclockActivate[] = { + { MDIO_DEV_PMA_PMD, 0xd000, 0xffff, 0x5200 }, + { 0, 0, 0, 0 } + }; + + static struct reg_val uCactivate[] = { + { MDIO_DEV_PMA_PMD, 0xd080, 0xffff, 0x0100 }, + { MDIO_DEV_PMA_PMD, 0xd092, 0xffff, 0x0000 }, + { 0, 0, 0, 0 } + }; + + static u16 twinax_edc[] = { + 0xd800, 0x4009, + 0xd801, 0x2fff, + 0xd802, 0x300f, + 0xd803, 0x40aa, + 0xd804, 0x401c, + 0xd805, 0x401e, + 0xd806, 0x2ff4, + 0xd807, 0x3dc4, + 0xd808, 0x2035, + 0xd809, 0x3035, + 0xd80a, 0x6524, + 0xd80b, 0x2cb2, + 0xd80c, 0x3012, + 0xd80d, 0x1002, + 0xd80e, 0x26e2, + 0xd80f, 0x3022, + 0xd810, 0x1002, + 0xd811, 0x27d2, + 0xd812, 0x3022, + 0xd813, 0x1002, + 0xd814, 0x2822, + 0xd815, 0x3012, + 0xd816, 0x1002, + 0xd817, 0x2492, + 0xd818, 0x3022, + 0xd819, 0x1002, + 0xd81a, 0x2772, + 0xd81b, 0x3012, + 0xd81c, 0x1002, + 0xd81d, 0x23d2, + 0xd81e, 0x3022, + 0xd81f, 0x1002, + 0xd820, 0x22cd, + 0xd821, 0x301d, + 0xd822, 0x27f2, + 0xd823, 0x3022, + 0xd824, 0x1002, + 0xd825, 0x5553, + 0xd826, 0x0307, + 0xd827, 0x2522, + 0xd828, 0x3022, + 0xd829, 0x1002, + 0xd82a, 0x2142, + 0xd82b, 0x3012, + 0xd82c, 0x1002, + 0xd82d, 0x4016, + 0xd82e, 0x5e63, + 0xd82f, 0x0344, + 0xd830, 0x2142, + 0xd831, 0x3012, + 0xd832, 0x1002, + 0xd833, 0x400e, + 0xd834, 0x2522, + 0xd835, 0x3022, + 0xd836, 0x1002, + 0xd837, 0x2b52, + 0xd838, 0x3012, + 0xd839, 0x1002, + 0xd83a, 0x2742, + 0xd83b, 0x3022, + 0xd83c, 0x1002, + 0xd83d, 0x25e2, + 0xd83e, 0x3022, + 0xd83f, 0x1002, + 0xd840, 0x2fa4, + 0xd841, 0x3dc4, + 0xd842, 0x6624, + 0xd843, 0x414b, + 0xd844, 0x56b3, + 0xd845, 0x03c6, + 0xd846, 0x866b, + 0xd847, 0x400c, + 0xd848, 0x2712, + 0xd849, 0x3012, + 0xd84a, 0x1002, + 0xd84b, 0x2c4b, + 0xd84c, 0x309b, + 0xd84d, 0x56b3, + 0xd84e, 0x03c3, + 0xd84f, 0x866b, + 0xd850, 0x400c, + 0xd851, 0x2272, + 0xd852, 0x3022, + 0xd853, 0x1002, + 0xd854, 0x2742, + 0xd855, 0x3022, + 0xd856, 0x1002, + 0xd857, 0x25e2, + 0xd858, 0x3022, + 0xd859, 0x1002, + 0xd85a, 0x2fb4, + 0xd85b, 0x3dc4, + 0xd85c, 0x6624, + 0xd85d, 0x56b3, + 0xd85e, 0x03c3, + 0xd85f, 0x866b, + 0xd860, 0x401c, + 0xd861, 0x2c45, + 0xd862, 0x3095, + 0xd863, 0x5b53, + 0xd864, 0x2372, + 0xd865, 0x3012, + 0xd866, 0x13c2, + 0xd867, 0x5cc3, + 0xd868, 0x2712, + 0xd869, 0x3012, + 0xd86a, 0x1312, + 0xd86b, 0x2b52, + 0xd86c, 0x3012, + 0xd86d, 0x1002, + 0xd86e, 0x2742, + 0xd86f, 0x3022, + 0xd870, 0x1002, + 0xd871, 0x2582, + 0xd872, 0x3022, + 0xd873, 0x1002, + 0xd874, 0x2142, + 0xd875, 0x3012, + 0xd876, 0x1002, + 0xd877, 0x628f, + 0xd878, 0x2985, + 0xd879, 0x33a5, + 0xd87a, 0x25e2, + 0xd87b, 0x3022, + 0xd87c, 0x1002, + 0xd87d, 0x5653, + 0xd87e, 0x03d2, + 0xd87f, 0x401e, + 0xd880, 0x6f72, + 0xd881, 0x1002, + 0xd882, 0x628f, + 0xd883, 0x2304, + 0xd884, 0x3c84, + 0xd885, 0x6436, + 0xd886, 0xdff4, + 0xd887, 0x6436, + 0xd888, 0x2ff5, + 0xd889, 0x3005, + 0xd88a, 0x8656, + 0xd88b, 0xdfba, + 0xd88c, 0x56a3, + 0xd88d, 0xd05a, + 0xd88e, 0x2972, + 0xd88f, 0x3012, + 0xd890, 0x1392, + 0xd891, 0xd05a, + 0xd892, 0x56a3, + 0xd893, 0xdfba, + 0xd894, 0x0383, + 0xd895, 0x6f72, + 0xd896, 0x1002, + 0xd897, 0x2b45, + 0xd898, 0x3005, + 0xd899, 0x4178, + 0xd89a, 0x5653, + 0xd89b, 0x0384, + 0xd89c, 0x2a62, + 0xd89d, 0x3012, + 0xd89e, 0x1002, + 0xd89f, 0x2f05, + 0xd8a0, 0x3005, + 0xd8a1, 0x41c8, + 0xd8a2, 0x5653, + 0xd8a3, 0x0382, + 0xd8a4, 0x0002, + 0xd8a5, 0x4218, + 0xd8a6, 0x2474, + 0xd8a7, 0x3c84, + 0xd8a8, 0x6437, + 0xd8a9, 0xdff4, + 0xd8aa, 0x6437, + 0xd8ab, 0x2ff5, + 0xd8ac, 0x3c05, + 0xd8ad, 0x8757, + 0xd8ae, 0xb888, + 0xd8af, 0x9787, + 0xd8b0, 0xdff4, + 0xd8b1, 0x6724, + 0xd8b2, 0x866a, + 0xd8b3, 0x6f72, + 0xd8b4, 0x1002, + 0xd8b5, 0x2641, + 0xd8b6, 0x3021, + 0xd8b7, 0x1001, + 0xd8b8, 0xc620, + 0xd8b9, 0x0000, + 0xd8ba, 0xc621, + 0xd8bb, 0x0000, + 0xd8bc, 0xc622, + 0xd8bd, 0x00ce, + 0xd8be, 0xc623, + 0xd8bf, 0x007f, + 0xd8c0, 0xc624, + 0xd8c1, 0x0032, + 0xd8c2, 0xc625, + 0xd8c3, 0x0000, + 0xd8c4, 0xc627, + 0xd8c5, 0x0000, + 0xd8c6, 0xc628, + 0xd8c7, 0x0000, + 0xd8c8, 0xc62c, + 0xd8c9, 0x0000, + 0xd8ca, 0x0000, + 0xd8cb, 0x2641, + 0xd8cc, 0x3021, + 0xd8cd, 0x1001, + 0xd8ce, 0xc502, + 0xd8cf, 0x53ac, + 0xd8d0, 0xc503, + 0xd8d1, 0x2cd3, + 0xd8d2, 0xc600, + 0xd8d3, 0x2a6e, + 0xd8d4, 0xc601, + 0xd8d5, 0x2a2c, + 0xd8d6, 0xc605, + 0xd8d7, 0x5557, + 0xd8d8, 0xc60c, + 0xd8d9, 0x5400, + 0xd8da, 0xc710, + 0xd8db, 0x0700, + 0xd8dc, 0xc711, + 0xd8dd, 0x0f06, + 0xd8de, 0xc718, + 0xd8df, 0x0700, + 0xd8e0, 0xc719, + 0xd8e1, 0x0f06, + 0xd8e2, 0xc720, + 0xd8e3, 0x4700, + 0xd8e4, 0xc721, + 0xd8e5, 0x0f06, + 0xd8e6, 0xc728, + 0xd8e7, 0x0700, + 0xd8e8, 0xc729, + 0xd8e9, 0x1207, + 0xd8ea, 0xc801, + 0xd8eb, 0x7f50, + 0xd8ec, 0xc802, + 0xd8ed, 0x7760, + 0xd8ee, 0xc803, + 0xd8ef, 0x7fce, + 0xd8f0, 0xc804, + 0xd8f1, 0x520e, + 0xd8f2, 0xc805, + 0xd8f3, 0x5c11, + 0xd8f4, 0xc806, + 0xd8f5, 0x3c51, + 0xd8f6, 0xc807, + 0xd8f7, 0x4061, + 0xd8f8, 0xc808, + 0xd8f9, 0x49c1, + 0xd8fa, 0xc809, + 0xd8fb, 0x3840, + 0xd8fc, 0xc80a, + 0xd8fd, 0x0000, + 0xd8fe, 0xc821, + 0xd8ff, 0x0002, + 0xd900, 0xc822, + 0xd901, 0x0046, + 0xd902, 0xc844, + 0xd903, 0x182f, + 0xd904, 0xc013, + 0xd905, 0xf341, + 0xd906, 0xc084, + 0xd907, 0x0030, + 0xd908, 0xc904, + 0xd909, 0x1401, + 0xd90a, 0xcb0c, + 0xd90b, 0x0004, + 0xd90c, 0xcb0e, + 0xd90d, 0xa00a, + 0xd90e, 0xcb0f, + 0xd90f, 0xc0c0, + 0xd910, 0xcb10, + 0xd911, 0xc0c0, + 0xd912, 0xcb11, + 0xd913, 0x00a0, + 0xd914, 0xcb12, + 0xd915, 0x0007, + 0xd916, 0xc241, + 0xd917, 0xa000, + 0xd918, 0xc243, + 0xd919, 0x7fe0, + 0xd91a, 0xc604, + 0xd91b, 0x000e, + 0xd91c, 0xc609, + 0xd91d, 0x00f5, + 0xd91e, 0xc611, + 0xd91f, 0x000e, + 0xd920, 0xc660, + 0xd921, 0x9600, + 0xd922, 0xc687, + 0xd923, 0x0004, + 0xd924, 0xc60a, + 0xd925, 0x04f5, + 0xd926, 0x0000, + 0xd927, 0x2641, + 0xd928, 0x3021, + 0xd929, 0x1001, + 0xd92a, 0xc620, + 0xd92b, 0x14e5, + 0xd92c, 0xc621, + 0xd92d, 0xc53d, + 0xd92e, 0xc622, + 0xd92f, 0x3cbe, + 0xd930, 0xc623, + 0xd931, 0x4452, + 0xd932, 0xc624, + 0xd933, 0xc5c5, + 0xd934, 0xc625, + 0xd935, 0xe01e, + 0xd936, 0xc627, + 0xd937, 0x0000, + 0xd938, 0xc628, + 0xd939, 0x0000, + 0xd93a, 0xc62c, + 0xd93b, 0x0000, + 0xd93c, 0x0000, + 0xd93d, 0x2b84, + 0xd93e, 0x3c74, + 0xd93f, 0x6435, + 0xd940, 0xdff4, + 0xd941, 0x6435, + 0xd942, 0x2806, + 0xd943, 0x3006, + 0xd944, 0x8565, + 0xd945, 0x2b24, + 0xd946, 0x3c24, + 0xd947, 0x6436, + 0xd948, 0x1002, + 0xd949, 0x2b24, + 0xd94a, 0x3c24, + 0xd94b, 0x6436, + 0xd94c, 0x4045, + 0xd94d, 0x8656, + 0xd94e, 0x5663, + 0xd94f, 0x0302, + 0xd950, 0x401e, + 0xd951, 0x1002, + 0xd952, 0x2807, + 0xd953, 0x31a7, + 0xd954, 0x20c4, + 0xd955, 0x3c24, + 0xd956, 0x6724, + 0xd957, 0x1002, + 0xd958, 0x2807, + 0xd959, 0x3187, + 0xd95a, 0x20c4, + 0xd95b, 0x3c24, + 0xd95c, 0x6724, + 0xd95d, 0x1002, + 0xd95e, 0x24f4, + 0xd95f, 0x3c64, + 0xd960, 0x6436, + 0xd961, 0xdff4, + 0xd962, 0x6436, + 0xd963, 0x1002, + 0xd964, 0x2006, + 0xd965, 0x3d76, + 0xd966, 0xc161, + 0xd967, 0x6134, + 0xd968, 0x6135, + 0xd969, 0x5443, + 0xd96a, 0x0303, + 0xd96b, 0x6524, + 0xd96c, 0x00fb, + 0xd96d, 0x1002, + 0xd96e, 0x20d4, + 0xd96f, 0x3c24, + 0xd970, 0x2025, + 0xd971, 0x3005, + 0xd972, 0x6524, + 0xd973, 0x1002, + 0xd974, 0xd019, + 0xd975, 0x2104, + 0xd976, 0x3c24, + 0xd977, 0x2105, + 0xd978, 0x3805, + 0xd979, 0x6524, + 0xd97a, 0xdff4, + 0xd97b, 0x4005, + 0xd97c, 0x6524, + 0xd97d, 0x2e8d, + 0xd97e, 0x303d, + 0xd97f, 0x2408, + 0xd980, 0x35d8, + 0xd981, 0x5dd3, + 0xd982, 0x0307, + 0xd983, 0x8887, + 0xd984, 0x63a7, + 0xd985, 0x8887, + 0xd986, 0x63a7, + 0xd987, 0xdffd, + 0xd988, 0x00f9, + 0xd989, 0x1002, + 0xd98a, 0x0000, + }; + int i, err; + + /* set uC clock and activate it */ + err = set_phy_regs(phy, uCclock40MHz); + msleep(500); + if (err) + return err; + err = set_phy_regs(phy, uCclockActivate); + msleep(500); + if (err) + return err; + + for (i = 0; i < ARRAY_SIZE(twinax_edc) && !err; i += 2) + err = mdio_write(phy, MDIO_DEV_PMA_PMD, twinax_edc[i], + twinax_edc[i + 1]); + /* activate uC */ + err = set_phy_regs(phy, uCactivate); + if (!err) + phy->priv = edc_twinax; + return err; +} + +/* + * Return Module Type. + */ +static int ael2020_get_module_type(struct cphy *phy, int delay_ms) +{ + int v; + unsigned int stat; + + v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2020_GPIO_STAT, &stat); + if (v) + return v; + + if (stat & (0x1 << (AEL2020_GPIO_MODDET*4))) { + /* module absent */ + return phy_modtype_none; + } + + return ael2xxx_get_module_type(phy, delay_ms); +} + +/* + * Enable PHY interrupts. We enable "Module Detection" interrupts (on any + * state transition) and then generic Link Alarm Status Interrupt (LASI). + */ +static int ael2020_intr_enable(struct cphy *phy) +{ + struct reg_val regs[] = { + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CFG+AEL2020_GPIO_LSTAT, + 0xffff, 0x4 }, + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CTRL, + 0xffff, 0x8 << (AEL2020_GPIO_LSTAT*4) }, + + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CTRL, + 0xffff, 0x2 << (AEL2020_GPIO_MODDET*4) }, + + /* end */ + { 0, 0, 0, 0 } + }; + int err; + + err = set_phy_regs(phy, regs); + if (err) + return err; + + phy->caps |= POLL_LINK_1ST_TIME; + + /* enable standard Link Alarm Status Interrupts */ + err = t3_phy_lasi_intr_enable(phy); + if (err) + return err; + + return 0; +} + +/* + * Disable PHY interrupts. The mirror of the above ... + */ +static int ael2020_intr_disable(struct cphy *phy) +{ + struct reg_val regs[] = { + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CTRL, + 0xffff, 0xb << (AEL2020_GPIO_LSTAT*4) }, + + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CTRL, + 0xffff, 0x1 << (AEL2020_GPIO_MODDET*4) }, + + /* end */ + { 0, 0, 0, 0 } + }; + int err; + + err = set_phy_regs(phy, regs); + if (err) + return err; + + /* disable standard Link Alarm Status Interrupts */ + return t3_phy_lasi_intr_disable(phy); +} + +/* + * Clear PHY interrupt state. + */ +static int ael2020_intr_clear(struct cphy *phy) +{ + unsigned int stat; + int err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2020_GPIO_INTR, &stat); + return err ? err : t3_phy_lasi_intr_clear(phy); +} + +/* + * Common register settings for the AEL2020 when it comes out of reset. + */ +static struct reg_val ael2020_reset_regs[] = { + { MDIO_DEV_PMA_PMD, 0xc003, 0xffff, 0x3101 }, + + { MDIO_DEV_PMA_PMD, 0xcd40, 0xffff, 0x0001 }, + + { MDIO_DEV_PMA_PMD, 0xff02, 0xffff, 0x0023 }, + { MDIO_DEV_PMA_PMD, 0xff03, 0xffff, 0x0000 }, + { MDIO_DEV_PMA_PMD, 0xff04, 0xffff, 0x0000 }, + + /* end */ + { 0, 0, 0, 0 } +}; + +/* + * Reset the PHY and put it into a canonical operating state. + */ +static int ael2020_reset(struct cphy *phy, int wait) +{ + int err; + unsigned int lasi_ctrl; + + /* grab current interrupt state */ + err = mdio_read(phy, MDIO_DEV_PMA_PMD, LASI_CTRL, &lasi_ctrl); + if (err) + return err; + + err = t3_phy_reset(phy, MDIO_DEV_PMA_PMD, 125); + if (err) + return err; + msleep(100); + + /* basic initialization for all module types */ + phy->priv = edc_none; + err = set_phy_regs(phy, ael2020_reset_regs); + if (err) + return err; + + /* determine module type and perform appropriate initialization */ + err = ael2020_get_module_type(phy, 0); + if (err < 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From delphij at FreeBSD.org Mon Oct 5 21:11:05 2009 From: delphij at FreeBSD.org (Xin LI) Date: Mon Oct 5 21:11:11 2009 Subject: svn commit: r197793 - head/lib/libc/gen Message-ID: <200910052111.n95LB5mH025841@svn.freebsd.org> Author: delphij Date: Mon Oct 5 21:11:04 2009 New Revision: 197793 URL: http://svn.freebsd.org/changeset/base/197793 Log: fts_open() requires that the list passed as argument to contain at least one path. When the list is empty (contain only a NULL pointer), return EINVAL instead of pretending to succeed, which will cause a NULL pointer deference in a later fts_read() call. Noticed by: Christoph Mallon (via rdivacky@) MFC after: 2 weeks Modified: head/lib/libc/gen/fts.3 head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts.3 ============================================================================== --- head/lib/libc/gen/fts.3 Mon Oct 5 20:38:36 2009 (r197792) +++ head/lib/libc/gen/fts.3 Mon Oct 5 21:11:04 2009 (r197793) @@ -28,7 +28,7 @@ .\" @(#)fts.3 8.5 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd January 26, 2008 +.Dd October 5, 2009 .Dt FTS 3 .Os .Sh NAME @@ -776,7 +776,7 @@ may fail and set as follows: .Bl -tag -width Er .It Bq Er EINVAL -The options were invalid. +The options were invalid, or the list were empty. .El .Sh SEE ALSO .Xr find 1 , Modified: head/lib/libc/gen/fts.c ============================================================================== --- head/lib/libc/gen/fts.c Mon Oct 5 20:38:36 2009 (r197792) +++ head/lib/libc/gen/fts.c Mon Oct 5 21:11:04 2009 (r197793) @@ -124,6 +124,12 @@ fts_open(argv, options, compar) return (NULL); } + /* fts_open() requires at least one path */ + if (*argv == NULL) { + errno = EINVAL; + return (NULL); + } + /* Allocate/initialize the stream. */ if ((priv = malloc(sizeof(*priv))) == NULL) return (NULL); From rwatson at FreeBSD.org Mon Oct 5 22:23:13 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 22:23:19 2009 Subject: svn commit: r197794 - head/sys/kern Message-ID: <200910052223.n95MNDc9027482@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 22:23:12 2009 New Revision: 197794 URL: http://svn.freebsd.org/changeset/base/197794 Log: Fix build on amd64, where sysctl arg1 is a pointer. Reported by: Mr Tinderbox MFC after: 3 months Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Mon Oct 5 21:11:04 2009 (r197793) +++ head/sys/kern/uipc_usrreq.c Mon Oct 5 22:23:12 2009 (r197794) @@ -1468,7 +1468,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) break; default: - panic("unp_pcblist: arg1 %d", (intptr_t)arg1); + panic("unp_pcblist: arg1 %d", (int)(intptr_t)arg1); } /* From rwatson at FreeBSD.org Mon Oct 5 22:24:14 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 22:24:20 2009 Subject: svn commit: r197795 - head/sys/netinet Message-ID: <200910052224.n95MOEXH027549@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 22:24:13 2009 New Revision: 197795 URL: http://svn.freebsd.org/changeset/base/197795 Log: In tcp_input(), we acquire a global write lock at first only if a segment is likely to trigger a TCP state change (i.e., FIN/RST/SYN). If we later have to upgrade the lock, we acquire an inpcb reference and drop both global/inpcb locks before reacquiring in-order. In that gap, the connection may transition into TIMEWAIT, so we need to loop back and reevaluate the inpcb after relocking. MFC after: 3 days Reported by: Kamigishi Rei Reviewed by: bz Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Mon Oct 5 22:23:12 2009 (r197794) +++ head/sys/netinet/tcp_input.c Mon Oct 5 22:24:13 2009 (r197795) @@ -648,6 +648,7 @@ findpcb: * tried to free the inpcb, in which case we need to loop back and * try to find a new inpcb to deliver to. */ +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)); @@ -698,7 +699,8 @@ findpcb: * 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. + * 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 || @@ -720,6 +722,7 @@ findpcb: goto findpcb; } tcp_wlock_relocked++; + goto relocked; } else { ti_locked = TI_WLOCKED; tcp_wlock_upgraded++; From dougb at FreeBSD.org Tue Oct 6 02:13:35 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Oct 6 02:13:51 2009 Subject: svn commit: r197797 - head/games/fortune/datfiles Message-ID: <200910060213.n962DWVr032502@svn.freebsd.org> Author: dougb Date: Tue Oct 6 02:13:32 2009 New Revision: 197797 URL: http://svn.freebsd.org/changeset/base/197797 Log: "Potluck Pogo" was a collection of Walt Kelly's "Pogo" cartoons first published in 1955. "Putluck Pogo" seems to be a typo. Modified: head/games/fortune/datfiles/fortunes head/games/fortune/datfiles/fortunes.sp.ok Modified: head/games/fortune/datfiles/fortunes ============================================================================== --- head/games/fortune/datfiles/fortunes Mon Oct 5 23:19:51 2009 (r197796) +++ head/games/fortune/datfiles/fortunes Tue Oct 6 02:13:32 2009 (r197797) @@ -18126,7 +18126,7 @@ tail on me, go ahead. They'd be very bo commenting on rumors of womanizing. % Food for thought is no substitute for the real thing. - -- Walt Kelly, "Putluck Pogo" + -- Walt Kelly, "Potluck Pogo" % Foolproof Operation: No provision for adjustment. Modified: head/games/fortune/datfiles/fortunes.sp.ok ============================================================================== --- head/games/fortune/datfiles/fortunes.sp.ok Mon Oct 5 23:19:51 2009 (r197796) +++ head/games/fortune/datfiles/fortunes.sp.ok Tue Oct 6 02:13:32 2009 (r197797) @@ -3300,6 +3300,7 @@ postjudice Postnews Postpetroleum potholes +Potluck potty Poul Pournelle @@ -3376,7 +3377,6 @@ Purshottam PUSHes pushy pussycats -Putluck Putt's PVLC PxP From maxim at FreeBSD.org Tue Oct 6 04:57:19 2009 From: maxim at FreeBSD.org (Maxim Konovalov) Date: Tue Oct 6 04:57:30 2009 Subject: svn commit: r197799 - head/share/man/man4 Message-ID: <200910060457.n964vJPT036055@svn.freebsd.org> Author: maxim Date: Tue Oct 6 04:57:18 2009 New Revision: 197799 URL: http://svn.freebsd.org/changeset/base/197799 Log: o Fix typo: "an in particular" -> "and in particular". PR: docs/139370 Submitted by: Kenyon Ralph MFC after: 1 week Modified: head/share/man/man4/de.4 Modified: head/share/man/man4/de.4 ============================================================================== --- head/share/man/man4/de.4 Tue Oct 6 03:53:29 2009 (r197798) +++ head/share/man/man4/de.4 Tue Oct 6 04:57:18 2009 (r197799) @@ -88,7 +88,7 @@ setup utility and are not changeable. .Pp Use the .Xr ifconfig 8 -command an in particular the +command and in particular the .Fl m flag to list the supported media types for your particular card. .Pp From alc at cs.rice.edu Tue Oct 6 08:01:58 2009 From: alc at cs.rice.edu (Alan Cox) Date: Tue Oct 6 08:02:09 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <4ACA0F09.2010808@FreeBSD.org> References: <200910041853.n94IrAf7082338@svn.freebsd.org> <4AC9F4F4.4030008@FreeBSD.org> <4ACA0000.2080005@cs.rice.edu> <4ACA0F09.2010808@FreeBSD.org> Message-ID: <4ACAF96C.6070204@cs.rice.edu> John Baldwin wrote: > > Do you care what is in the padding in this case or more about just > having each mutex on a separate cache line? __aligned() is fine if > you don't mind the padding getting reused for something else. > Yes, I care. I would also like to prevent the placement of the heads of the active, inactive, and hold queues (vm_page_queues[]) in the same cache line as the free page queue mutex. Alan From des at FreeBSD.org Tue Oct 6 10:19:21 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Tue Oct 6 10:20:31 2009 Subject: svn commit: r197802 - head/crypto/openssh Message-ID: <200910061019.n96AJKjW043720@svn.freebsd.org> Author: des Date: Tue Oct 6 10:19:20 2009 New Revision: 197802 URL: http://svn.freebsd.org/changeset/base/197802 Log: Expand $FreeBSD$ Modified: head/crypto/openssh/sftp-server.8 (props changed) head/crypto/openssh/ssh-agent.1 (props changed) From attilio at FreeBSD.org Tue Oct 6 13:45:50 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Tue Oct 6 13:46:03 2009 Subject: svn commit: r197803 - in head/sys: amd64/include i386/include Message-ID: <200910061345.n96DjnS1048710@svn.freebsd.org> Author: attilio Date: Tue Oct 6 13:45:49 2009 New Revision: 197803 URL: http://svn.freebsd.org/changeset/base/197803 Log: Per their definition, atomic instructions used in conjuction with memory barriers should also ensure that the compiler doesn't reorder paths where they are used. GCC, however, does that aggressively, even in presence of volatile operands. The most reliable way GCC offers for avoid instructions reordering is clobbering "memory" even if that is theoretically an heavy-weight operation, flushing the content of all the registers and forcing reload of them (We could rely, however, on gcc DTRT by just understanding the purpose as this is a well-known pattern for many modern operating-systems). Not all our memory barriers, right now, clobber memory for GCC-like compilers. The most notable cases are IA32 and amd64 where the memory barrier are treacted the same as normal atomic instructions. Fix this by offering the possibility to implement atomic instructions with memory barriers separately from the normal version and implement the GCC-like specific one using memory clobbering. Thanks to Chris Lattner (@apple) for his discussion on llvm specifics. Reported by: jhb Reviewed by: jhb Tested by: rdivacky, Giovanni Trematerra Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Tue Oct 6 10:19:20 2009 (r197802) +++ head/sys/amd64/include/atomic.h Tue Oct 6 13:45:49 2009 (r197803) @@ -73,10 +73,13 @@ */ #if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM) #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ +void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); int atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src); +int atomic_cmpset_barr_int(volatile u_int *dst, u_int exp, u_int src); +int atomic_cmpset_barr_long(volatile u_long *dst, u_long exp, u_long src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); u_long atomic_fetchadd_long(volatile u_long *p, u_long v); @@ -97,8 +100,9 @@ void atomic_store_rel_##TYPE(volatile u #endif /* - * The assembly is volatilized to demark potential before-and-after side - * effects if an interrupt or SMP collision were to occur. + * The assembly is volatilized to avoid code chunk removal by the compiler. + * GCC aggressively reorders operations and memory clobbering is necessary + * in order to avoid that for memory barriers. */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ @@ -108,6 +112,15 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE : "=m" (*p) \ : CONS (V), "m" (*p)); \ } \ + \ +static __inline void \ +atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile(MPLOCKED OP \ + : "=m" (*p) \ + : CONS (V), "m" (*p) \ + : "memory"); \ +} \ struct __hack /* @@ -160,6 +173,9 @@ atomic_cmpset_long(volatile u_long *dst, return (res); } +#define atomic_cmpset_barr_int atomic_cmpset_int +#define atomic_cmpset_barr_long atomic_cmpset_long + /* * Atomically add the value of v to the integer pointed to by p and return * the previous value of *p. @@ -205,18 +221,23 @@ atomic_fetchadd_long(volatile u_long *p, * PentiumPro or higher, reads may pass writes, so for that case we have * to use a serializing instruction (i.e. with LOCK) to do the load in * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we don't need any memory barriers. + * is always consistent, so we only need to take care of compiler. */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ - return (*p); \ + u_##TYPE tmp; \ + \ + tmp = *p; \ + __asm __volatile ("" : : : "memory"); \ + return (tmp); \ } \ \ static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ + __asm __volatile ("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -247,7 +268,8 @@ atomic_store_rel_##TYPE(volatile u_##TYP __asm __volatile(SOP \ : "=m" (*p), /* 0 */ \ "+r" (v) /* 1 */ \ - : "m" (*p)); /* 2 */ \ + : "m" (*p) /* 2 */ \ + : "memory"); \ } \ struct __hack @@ -327,46 +349,45 @@ u_long atomic_readandclear_long(volatile #endif /* __GNUCLIKE_ASM */ -/* Acquire and release variants are identical to the normal ones. */ -#define atomic_set_acq_char atomic_set_char -#define atomic_set_rel_char atomic_set_char -#define atomic_clear_acq_char atomic_clear_char -#define atomic_clear_rel_char atomic_clear_char -#define atomic_add_acq_char atomic_add_char -#define atomic_add_rel_char atomic_add_char -#define atomic_subtract_acq_char atomic_subtract_char -#define atomic_subtract_rel_char atomic_subtract_char - -#define atomic_set_acq_short atomic_set_short -#define atomic_set_rel_short atomic_set_short -#define atomic_clear_acq_short atomic_clear_short -#define atomic_clear_rel_short atomic_clear_short -#define atomic_add_acq_short atomic_add_short -#define atomic_add_rel_short atomic_add_short -#define atomic_subtract_acq_short atomic_subtract_short -#define atomic_subtract_rel_short atomic_subtract_short - -#define atomic_set_acq_int atomic_set_int -#define atomic_set_rel_int atomic_set_int -#define atomic_clear_acq_int atomic_clear_int -#define atomic_clear_rel_int atomic_clear_int -#define atomic_add_acq_int atomic_add_int -#define atomic_add_rel_int atomic_add_int -#define atomic_subtract_acq_int atomic_subtract_int -#define atomic_subtract_rel_int atomic_subtract_int -#define atomic_cmpset_acq_int atomic_cmpset_int -#define atomic_cmpset_rel_int atomic_cmpset_int - -#define atomic_set_acq_long atomic_set_long -#define atomic_set_rel_long atomic_set_long -#define atomic_clear_acq_long atomic_clear_long -#define atomic_clear_rel_long atomic_clear_long -#define atomic_add_acq_long atomic_add_long -#define atomic_add_rel_long atomic_add_long -#define atomic_subtract_acq_long atomic_subtract_long -#define atomic_subtract_rel_long atomic_subtract_long -#define atomic_cmpset_acq_long atomic_cmpset_long -#define atomic_cmpset_rel_long atomic_cmpset_long +#define atomic_set_acq_char atomic_set_barr_char +#define atomic_set_rel_char atomic_set_barr_char +#define atomic_clear_acq_char atomic_clear_barr_char +#define atomic_clear_rel_char atomic_clear_barr_char +#define atomic_add_acq_char atomic_add_barr_char +#define atomic_add_rel_char atomic_add_barr_char +#define atomic_subtract_acq_char atomic_subtract_barr_char +#define atomic_subtract_rel_char atomic_subtract_barr_char + +#define atomic_set_acq_short atomic_set_barr_short +#define atomic_set_rel_short atomic_set_barr_short +#define atomic_clear_acq_short atomic_clear_barr_short +#define atomic_clear_rel_short atomic_clear_barr_short +#define atomic_add_acq_short atomic_add_barr_short +#define atomic_add_rel_short atomic_add_barr_short +#define atomic_subtract_acq_short atomic_subtract_barr_short +#define atomic_subtract_rel_short atomic_subtract_barr_short + +#define atomic_set_acq_int atomic_set_barr_int +#define atomic_set_rel_int atomic_set_barr_int +#define atomic_clear_acq_int atomic_clear_barr_int +#define atomic_clear_rel_int atomic_clear_barr_int +#define atomic_add_acq_int atomic_add_barr_int +#define atomic_add_rel_int atomic_add_barr_int +#define atomic_subtract_acq_int atomic_subtract_barr_int +#define atomic_subtract_rel_int atomic_subtract_barr_int +#define atomic_cmpset_acq_int atomic_cmpset_barr_int +#define atomic_cmpset_rel_int atomic_cmpset_barr_int + +#define atomic_set_acq_long atomic_set_barr_long +#define atomic_set_rel_long atomic_set_barr_long +#define atomic_clear_acq_long atomic_clear_barr_long +#define atomic_clear_rel_long atomic_clear_barr_long +#define atomic_add_acq_long atomic_add_barr_long +#define atomic_add_rel_long atomic_add_barr_long +#define atomic_subtract_acq_long atomic_subtract_barr_long +#define atomic_subtract_rel_long atomic_subtract_barr_long +#define atomic_cmpset_acq_long atomic_cmpset_barr_long +#define atomic_cmpset_rel_long atomic_cmpset_barr_long /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Tue Oct 6 10:19:20 2009 (r197802) +++ head/sys/i386/include/atomic.h Tue Oct 6 13:45:49 2009 (r197803) @@ -73,9 +73,11 @@ */ #if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM) #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ +void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); +int atomic_cmpset_barr_int(volatile u_int *dst, u_int exp, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ @@ -95,8 +97,9 @@ void atomic_store_rel_##TYPE(volatile u #endif /* - * The assembly is volatilized to demark potential before-and-after side - * effects if an interrupt or SMP collision were to occur. + * The assembly is volatilized to avoid code chunk removal by the compiler. + * GCC aggressively reorders operations and memory clobbering is necessary + * in order to avoid that for memory barriers. */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ @@ -106,6 +109,15 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE : "=m" (*p) \ : CONS (V), "m" (*p)); \ } \ + \ +static __inline void \ +atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile(MPLOCKED OP \ + : "=m" (*p) \ + : CONS (V), "m" (*p) \ + : "memory"); \ +} \ struct __hack /* @@ -168,6 +180,8 @@ atomic_cmpset_int(volatile u_int *dst, u #endif /* CPU_DISABLE_CMPXCHG */ +#define atomic_cmpset_barr_int atomic_cmpset_int + /* * Atomically add the value of v to the integer pointed to by p and return * the previous value of *p. @@ -194,18 +208,23 @@ atomic_fetchadd_int(volatile u_int *p, u * PentiumPro or higher, reads may pass writes, so for that case we have * to use a serializing instruction (i.e. with LOCK) to do the load in * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we don't need any memory barriers. + * is always consistent, so we only need to take care of compiler. */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ - return (*p); \ + u_##TYPE tmp; \ + \ + tmp = *p; \ + __asm __volatile("" : : : "memory"); \ + return (tmp); \ } \ \ static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ + __asm __volatile("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -236,7 +255,8 @@ atomic_store_rel_##TYPE(volatile u_##TYP __asm __volatile(SOP \ : "=m" (*p), /* 0 */ \ "+r" (v) /* 1 */ \ - : "m" (*p)); /* 2 */ \ + : "m" (*p) /* 2 */ \ + : "memory"); \ } \ struct __hack @@ -282,6 +302,14 @@ atomic_cmpset_long(volatile u_long *dst, (u_int)src)); } +static __inline int +atomic_cmpset_barr_long(volatile u_long *dst, u_long exp, u_long src) +{ + + return (atomic_cmpset_barr_int((volatile u_int *)dst, (u_int)exp, + (u_int)src)); +} + static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long v) { @@ -331,46 +359,45 @@ u_long atomic_readandclear_long(volatile #endif /* __GNUCLIKE_ASM */ -/* Acquire and release variants are identical to the normal ones. */ -#define atomic_set_acq_char atomic_set_char -#define atomic_set_rel_char atomic_set_char -#define atomic_clear_acq_char atomic_clear_char -#define atomic_clear_rel_char atomic_clear_char -#define atomic_add_acq_char atomic_add_char -#define atomic_add_rel_char atomic_add_char -#define atomic_subtract_acq_char atomic_subtract_char -#define atomic_subtract_rel_char atomic_subtract_char - -#define atomic_set_acq_short atomic_set_short -#define atomic_set_rel_short atomic_set_short -#define atomic_clear_acq_short atomic_clear_short -#define atomic_clear_rel_short atomic_clear_short -#define atomic_add_acq_short atomic_add_short -#define atomic_add_rel_short atomic_add_short -#define atomic_subtract_acq_short atomic_subtract_short -#define atomic_subtract_rel_short atomic_subtract_short - -#define atomic_set_acq_int atomic_set_int -#define atomic_set_rel_int atomic_set_int -#define atomic_clear_acq_int atomic_clear_int -#define atomic_clear_rel_int atomic_clear_int -#define atomic_add_acq_int atomic_add_int -#define atomic_add_rel_int atomic_add_int -#define atomic_subtract_acq_int atomic_subtract_int -#define atomic_subtract_rel_int atomic_subtract_int -#define atomic_cmpset_acq_int atomic_cmpset_int -#define atomic_cmpset_rel_int atomic_cmpset_int - -#define atomic_set_acq_long atomic_set_long -#define atomic_set_rel_long atomic_set_long -#define atomic_clear_acq_long atomic_clear_long -#define atomic_clear_rel_long atomic_clear_long -#define atomic_add_acq_long atomic_add_long -#define atomic_add_rel_long atomic_add_long -#define atomic_subtract_acq_long atomic_subtract_long -#define atomic_subtract_rel_long atomic_subtract_long -#define atomic_cmpset_acq_long atomic_cmpset_long -#define atomic_cmpset_rel_long atomic_cmpset_long +#define atomic_set_acq_char atomic_set_barr_char +#define atomic_set_rel_char atomic_set_barr_char +#define atomic_clear_acq_char atomic_clear_barr_char +#define atomic_clear_rel_char atomic_clear_barr_char +#define atomic_add_acq_char atomic_add_barr_char +#define atomic_add_rel_char atomic_add_barr_char +#define atomic_subtract_acq_char atomic_subtract_barr_char +#define atomic_subtract_rel_char atomic_subtract_barr_char + +#define atomic_set_acq_short atomic_set_barr_short +#define atomic_set_rel_short atomic_set_barr_short +#define atomic_clear_acq_short atomic_clear_barr_short +#define atomic_clear_rel_short atomic_clear_barr_short +#define atomic_add_acq_short atomic_add_barr_short +#define atomic_add_rel_short atomic_add_barr_short +#define atomic_subtract_acq_short atomic_subtract_barr_short +#define atomic_subtract_rel_short atomic_subtract_barr_short + +#define atomic_set_acq_int atomic_set_barr_int +#define atomic_set_rel_int atomic_set_barr_int +#define atomic_clear_acq_int atomic_clear_barr_int +#define atomic_clear_rel_int atomic_clear_barr_int +#define atomic_add_acq_int atomic_add_barr_int +#define atomic_add_rel_int atomic_add_barr_int +#define atomic_subtract_acq_int atomic_subtract_barr_int +#define atomic_subtract_rel_int atomic_subtract_barr_int +#define atomic_cmpset_acq_int atomic_cmpset_barr_int +#define atomic_cmpset_rel_int atomic_cmpset_barr_int + +#define atomic_set_acq_long atomic_set_barr_long +#define atomic_set_rel_long atomic_set_barr_long +#define atomic_clear_acq_long atomic_clear_barr_long +#define atomic_clear_rel_long atomic_clear_barr_long +#define atomic_add_acq_long atomic_add_barr_long +#define atomic_add_rel_long atomic_add_barr_long +#define atomic_subtract_acq_long atomic_subtract_barr_long +#define atomic_subtract_rel_long atomic_subtract_barr_long +#define atomic_cmpset_acq_long atomic_cmpset_barr_long +#define atomic_cmpset_rel_long atomic_cmpset_barr_long /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char From rwatson at FreeBSD.org Tue Oct 6 14:05:58 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 6 14:06:04 2009 Subject: svn commit: r197804 - in head: include lib/libc/gen Message-ID: <200910061405.n96E5vsq049153@svn.freebsd.org> Author: rwatson Date: Tue Oct 6 14:05:57 2009 New Revision: 197804 URL: http://svn.freebsd.org/changeset/base/197804 Log: Add basename_r(3) to complement basename(3). basename_r(3) which accepts a caller-allocated buffer of at least MAXPATHLEN, rather than using a global buffer. MFC after: 1 month Sponsored by: Google Modified: head/include/libgen.h head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/gen/basename.3 head/lib/libc/gen/basename.c Modified: head/include/libgen.h ============================================================================== --- head/include/libgen.h Tue Oct 6 13:45:49 2009 (r197803) +++ head/include/libgen.h Tue Oct 6 14:05:57 2009 (r197804) @@ -36,6 +36,7 @@ __BEGIN_DECLS char *basename(const char *); +char *basename_r(const char *, char *); char *dirname(const char *); #if 0 char *regcmp(const char *, ...); Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Tue Oct 6 13:45:49 2009 (r197803) +++ head/lib/libc/gen/Makefile.inc Tue Oct 6 14:05:57 2009 (r197804) @@ -76,6 +76,7 @@ MAN+= alarm.3 arc4random.3 \ MLINKS+=arc4random.3 arc4random_addrandom.3 arc4random.3 arc4random_stir.3 \ arc4random.3 arc4random_buf.3 arc4random.3 arc4random_uniform.3 +MLINKS+=basename.3 basename_r.3 MLINKS+=ctermid.3 ctermid_r.3 MLINKS+=devname.3 devname_r.3 MLINKS+=devname.3 fdevname.3 Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Tue Oct 6 13:45:49 2009 (r197803) +++ head/lib/libc/gen/Symbol.map Tue Oct 6 14:05:57 2009 (r197804) @@ -367,6 +367,7 @@ FBSD_1.1 { }; FBSD_1.2 { + basename_r; getpagesizes; }; Modified: head/lib/libc/gen/basename.3 ============================================================================== --- head/lib/libc/gen/basename.3 Tue Oct 6 13:45:49 2009 (r197803) +++ head/lib/libc/gen/basename.3 Tue Oct 6 14:05:57 2009 (r197804) @@ -27,7 +27,7 @@ .\" $OpenBSD: basename.3,v 1.12 2000/04/18 03:01:25 aaron Exp $ .\" $FreeBSD$ .\" -.Dd October 12, 2006 +.Dd October 6, 2009 .Dt BASENAME 3 .Os .Sh NAME @@ -37,6 +37,8 @@ .In libgen.h .Ft char * .Fn basename "const char *path" +.Ft char * +.Fn basename_r "const char *path" "char *bname" .Sh DESCRIPTION The .Fn basename @@ -58,6 +60,12 @@ If is a null pointer or the empty string, a pointer to the string .Qq \&. is returned. +.Pp +The +.Fn basename_r +variation accepts a buffer of at least +.Dv MAXPATHLEN +bytes in which to store the resulting component. .Sh IMPLEMENTATION NOTES The .Fn basename @@ -65,15 +73,17 @@ function returns a pointer to internal storage space allocated on the first call that will be overwritten by subsequent calls. +.Fn basename_r +is therefore preferred for threaded applications. .Sh RETURN VALUES On successful completion, .Fn basename -returns a pointer to the last component of +and +.Fn basename_r +return pointers to the last component of .Fa path . .Pp -If -.Fn basename -fails, a null pointer is returned and the global variable +If they fail, a null pointer is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS Modified: head/lib/libc/gen/basename.c ============================================================================== --- head/lib/libc/gen/basename.c Tue Oct 6 13:45:49 2009 (r197803) +++ head/lib/libc/gen/basename.c Tue Oct 6 14:05:57 2009 (r197804) @@ -40,18 +40,12 @@ __FBSDID("$FreeBSD$"); #include char * -basename(path) +basename_r(path, bname) const char *path; + char *bname; { - static char *bname = NULL; const char *endp, *startp; - if (bname == NULL) { - bname = (char *)malloc(MAXPATHLEN); - if (bname == NULL) - return(NULL); - } - /* Empty or NULL string gets treated as "." */ if (path == NULL || *path == '\0') { (void)strcpy(bname, "."); @@ -82,3 +76,17 @@ basename(path) bname[endp - startp + 1] = '\0'; return(bname); } + +char * +basename(path) + const char *path; +{ + static char *bname = NULL; + + if (bname == NULL) { + bname = (char *)malloc(MAXPATHLEN); + if (bname == NULL) + return (NULL); + } + return (basename_r(path, bname)); +} From rwatson at FreeBSD.org Tue Oct 6 17:14:39 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 6 17:14:46 2009 Subject: svn commit: r197808 - head/libexec/rtld-elf Message-ID: <200910061714.n96HEd4U053183@svn.freebsd.org> Author: rwatson Date: Tue Oct 6 17:14:39 2009 New Revision: 197808 URL: http://svn.freebsd.org/changeset/base/197808 Log: In rtld's map_object(), use pread(..., 0) rather than read() to read the ELF header from the front of the file. As all other I/O on the binary is done using mmap(), this avoids the need for seek privileges on the file descriptor during run-time linking. MFC after: 1 month Sponsored by: Google Modified: head/libexec/rtld-elf/map_object.c Modified: head/libexec/rtld-elf/map_object.c ============================================================================== --- head/libexec/rtld-elf/map_object.c Tue Oct 6 17:10:38 2009 (r197807) +++ head/libexec/rtld-elf/map_object.c Tue Oct 6 17:14:39 2009 (r197808) @@ -273,7 +273,7 @@ get_elf_header (int fd, const char *path } u; ssize_t nbytes; - if ((nbytes = read(fd, u.buf, PAGE_SIZE)) == -1) { + if ((nbytes = pread(fd, u.buf, PAGE_SIZE, 0)) == -1) { _rtld_error("%s: read error: %s", path, strerror(errno)); return NULL; } From gabor at FreeBSD.org Tue Oct 6 19:47:03 2009 From: gabor at FreeBSD.org (Gabor Kovesdan) Date: Tue Oct 6 19:47:15 2009 Subject: svn commit: r197804 - in head: include lib/libc/gen In-Reply-To: <200910061405.n96E5vsq049153@svn.freebsd.org> References: <200910061405.n96E5vsq049153@svn.freebsd.org> Message-ID: <4ACB9A21.10502@FreeBSD.org> Robert Watson escribi?: > + > +char * > +basename(path) > + const char *path; > +{ > + static char *bname = NULL; > + > Sorry if it's a trivial question but isn't ANSI prototype preferred over K&R function definition? -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From rdivacky at FreeBSD.org Tue Oct 6 20:19:17 2009 From: rdivacky at FreeBSD.org (Roman Divacky) Date: Tue Oct 6 20:19:28 2009 Subject: svn commit: r197812 - head/contrib/tcsh Message-ID: <200910062019.n96KJG5Q062846@svn.freebsd.org> Author: rdivacky Date: Tue Oct 6 20:19:16 2009 New Revision: 197812 URL: http://svn.freebsd.org/changeset/base/197812 Log: Fix tcsh losing history when tcsh terminates because the pty beneath it is closed. Diagnosed by Ted Anderson: New signal queuing logic was introduced in 6.15 and allows the signal handlers to be run explicitly by calling handle_pending_signals, instead of immediately when the signal is delivered. This function is called at various places, typically when receiving a EINTR from a slow system call such as read or write. In the pty exit case, it was called from xwrite, called from flush, while printing the "exit" message after receiving EOF when reading from the pty (note that the read did not return EINTR but zero bytes, indicating EOF). The SIGHUP handler, phup(), called rechist, which opened the history file and began writing the merged history to it. This process invoked flush recursively to actually write the data. In this case, however, the flush noticed it was being called recursively and decided fail by calling stderror. My conclusion was that the signal was being handled at a bad time. But whether to fix flush not to care about the recursive call, or to handle the signal some other time and when to handle it, was unclear to me. However, by adding an extra call to handle_pending_signals, just after process() returns to main(), I was able to avoid the truncated history after network outages and similar failures. I verified this fix in version 6.17. Approved by: ed (mentor) MFC after: 1 week Modified: head/contrib/tcsh/sh.c Modified: head/contrib/tcsh/sh.c ============================================================================== --- head/contrib/tcsh/sh.c Tue Oct 6 19:44:44 2009 (r197811) +++ head/contrib/tcsh/sh.c Tue Oct 6 20:19:16 2009 (r197812) @@ -1291,6 +1291,8 @@ main(int argc, char **argv) /* * Mop-up. */ + /* Take care of these (especially HUP) here instead of inside flush. */ + handle_pending_signals(); if (intty) { if (loginsh) { xprintf("logout\n"); From rwatson at FreeBSD.org Tue Oct 6 20:21:58 2009 From: rwatson at FreeBSD.org (Robert N. M. Watson) Date: Tue Oct 6 20:22:05 2009 Subject: svn commit: r197804 - in head: include lib/libc/gen In-Reply-To: <4ACB9A21.10502@FreeBSD.org> References: <200910061405.n96E5vsq049153@svn.freebsd.org> <4ACB9A21.10502@FreeBSD.org> Message-ID: <1A174135-001D-4550-B3E7-84EAA69A2169@FreeBSD.org> On 6 Oct 2009, at 20:27, Gabor Kovesdan wrote: > Robert Watson escribi?: >> + >> +char * >> +basename(path) >> + const char *path; >> +{ >> + static char *bname = NULL; >> + >> > Sorry if it's a trivial question but isn't ANSI prototype preferred > over K&R function definition? For the purposes of this purely functional change, I maintained the existing style in the file, which was K&R. Robert From rwatson at FreeBSD.org Tue Oct 6 20:35:41 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 6 20:35:53 2009 Subject: svn commit: r197814 - head/sys/netinet Message-ID: <200910062035.n96KZfM3063262@svn.freebsd.org> Author: rwatson Date: Tue Oct 6 20:35:41 2009 New Revision: 197814 URL: http://svn.freebsd.org/changeset/base/197814 Log: Remove tcp_input lock statistics; these are intended for debugging only and are not intended to ship in 8.0 as they dirty additional cache lines in a performance-critical per-packet path. MFC after: 3 days Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Oct 6 20:33:02 2009 (r197813) +++ head/sys/netinet/tcp_input.c Tue Oct 6 20:35:41 2009 (r197814) @@ -180,26 +180,6 @@ int tcp_read_locking = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, read_locking, CTLFLAG_RW, &tcp_read_locking, 0, "Enable read locking strategy"); -int tcp_rlock_atfirst; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, rlock_atfirst, CTLFLAG_RD, - &tcp_rlock_atfirst, 0, ""); - -int tcp_wlock_atfirst; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcp_wlock_atfirst, CTLFLAG_RD, - &tcp_wlock_atfirst, 0, ""); - -int tcp_wlock_upgraded; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, wlock_upgraded, CTLFLAG_RD, - &tcp_wlock_upgraded, 0, ""); - -int tcp_wlock_relocked; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, wlock_relocked, CTLFLAG_RD, - &tcp_wlock_relocked, 0, ""); - -int tcp_wlock_looped; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, wlock_looped, CTLFLAG_RD, - &tcp_wlock_looped, 0, ""); - VNET_DEFINE(struct inpcbhead, tcb); VNET_DEFINE(struct inpcbinfo, tcbinfo); #define tcb6 tcb /* for KAME src sync over BSD*'s */ @@ -505,11 +485,9 @@ tcp_input(struct mbuf *m, int off0) tcp_read_locking == 0) { INP_INFO_WLOCK(&V_tcbinfo); ti_locked = TI_WLOCKED; - tcp_wlock_atfirst++; } else { INP_INFO_RLOCK(&V_tcbinfo); ti_locked = TI_RLOCKED; - tcp_rlock_atfirst++; } findpcb: @@ -662,15 +640,11 @@ relocked: ti_locked = TI_WLOCKED; INP_WLOCK(inp); if (in_pcbrele(inp)) { - tcp_wlock_looped++; inp = NULL; goto findpcb; } - tcp_wlock_relocked++; - } else { + } else ti_locked = TI_WLOCKED; - tcp_wlock_upgraded++; - } } INP_INFO_WLOCK_ASSERT(&V_tcbinfo); @@ -717,16 +691,12 @@ relocked: ti_locked = TI_WLOCKED; INP_WLOCK(inp); if (in_pcbrele(inp)) { - tcp_wlock_looped++; inp = NULL; goto findpcb; } - tcp_wlock_relocked++; goto relocked; - } else { + } else ti_locked = TI_WLOCKED; - tcp_wlock_upgraded++; - } } INP_INFO_WLOCK_ASSERT(&V_tcbinfo); } From kmacy at FreeBSD.org Tue Oct 6 21:40:50 2009 From: kmacy at FreeBSD.org (Kip Macy) Date: Tue Oct 6 21:40:57 2009 Subject: svn commit: r197816 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910062140.n96LeoDG064737@svn.freebsd.org> Author: kmacy Date: Tue Oct 6 21:40:50 2009 New Revision: 197816 URL: http://svn.freebsd.org/changeset/base/197816 Log: Prevent paging pressure from draining arc too much - always drain arc if above arc_c_max - never drain arc if arc is below arc_c_max MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 6 21:23:49 2009 (r197815) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 6 21:40:50 2009 (r197816) @@ -1821,6 +1821,12 @@ arc_reclaim_needed(void) #endif #ifdef _KERNEL + if (needfree) + return (1); + if (arc_size > arc_c_max) + return (1); + if (arc_size <= arc_c_min) + return (0); /* * If pages are needed or we're within 2048 pages @@ -1829,9 +1835,6 @@ arc_reclaim_needed(void) if (vm_pages_needed || (vm_paging_target() > -2048)) return (1); - if (needfree) - return (1); - #if 0 /* * take 'desfree' extra pages, so we reclaim sooner, rather than later From jilles at FreeBSD.org Tue Oct 6 22:00:15 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Tue Oct 6 22:00:22 2009 Subject: svn commit: r197820 - in head: bin/sh tools/regression/bin/sh/execution Message-ID: <200910062200.n96M0FMX065301@svn.freebsd.org> Author: jilles Date: Tue Oct 6 22:00:14 2009 New Revision: 197820 URL: http://svn.freebsd.org/changeset/base/197820 Log: sh: Send the "xyz: not found" message to redirected fd 2. This also fixes that trying to execute a non-regular file with a command name without '/' returns 127 instead of 126. The fix is rather simplistic: treat CMDUNKNOWN as if the command were found as an external program. The resulting fork is a bit wasteful but executing unknown commands should not be very frequent. PR: bin/137659 Added: head/tools/regression/bin/sh/execution/unknown1.0 (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/exec.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Tue Oct 6 21:49:13 2009 (r197819) +++ head/bin/sh/eval.c Tue Oct 6 22:00:14 2009 (r197820) @@ -713,12 +713,7 @@ evalcommand(union node *cmd, int flags, do_clearcmdentry = 1; } - find_command(argv[0], &cmdentry, 1, path); - if (cmdentry.cmdtype == CMDUNKNOWN) { /* command not found */ - exitstatus = 127; - flushout(&errout); - return; - } + find_command(argv[0], &cmdentry, 0, path); /* implement the bltin builtin here */ if (cmdentry.cmdtype == CMDBUILTIN && cmdentry.u.index == BLTINCMD) { for (;;) { @@ -740,7 +735,7 @@ evalcommand(union node *cmd, int flags, /* Fork off a child process if necessary. */ if (cmd->ncmd.backgnd - || (cmdentry.cmdtype == CMDNORMAL + || ((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN) && ((flags & EV_EXIT) == 0 || have_traps())) || ((flags & EV_BACKCMD) != 0 && (cmdentry.cmdtype != CMDBUILTIN Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Tue Oct 6 21:49:13 2009 (r197819) +++ head/bin/sh/exec.c Tue Oct 6 22:00:14 2009 (r197820) @@ -429,6 +429,7 @@ loop: outfmt(out2, "%s: %s\n", name, strerror(e)); } entry->cmdtype = CMDUNKNOWN; + entry->u.index = 0; return; success: Added: head/tools/regression/bin/sh/execution/unknown1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/unknown1.0 Tue Oct 6 22:00:14 2009 (r197820) @@ -0,0 +1,29 @@ +# $FreeBSD$ + +nosuchtool 2>/dev/null +[ $? -ne 127 ] && exit 1 +/var/empty/nosuchtool 2>/dev/null +[ $? -ne 127 ] && exit 1 +(nosuchtool) 2>/dev/null +[ $? -ne 127 ] && exit 1 +(/var/empty/nosuchtool) 2>/dev/null +[ $? -ne 127 ] && exit 1 +/ 2>/dev/null +[ $? -ne 126 ] && exit 1 +PATH=/usr bin 2>/dev/null +[ $? -ne 126 ] && exit 1 + +dummy=$(nosuchtool 2>/dev/null) +[ $? -ne 127 ] && exit 1 +dummy=$(/var/empty/nosuchtool 2>/dev/null) +[ $? -ne 127 ] && exit 1 +dummy=$( (nosuchtool) 2>/dev/null) +[ $? -ne 127 ] && exit 1 +dummy=$( (/var/empty/nosuchtool) 2>/dev/null) +[ $? -ne 127 ] && exit 1 +dummy=$(/ 2>/dev/null) +[ $? -ne 126 ] && exit 1 +dummy=$(PATH=/usr bin 2>/dev/null) +[ $? -ne 126 ] && exit 1 + +exit 0 From attilio at FreeBSD.org Tue Oct 6 23:48:29 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Tue Oct 6 23:48:40 2009 Subject: svn commit: r197824 - in head/sys: amd64/include i386/include Message-ID: <200910062348.n96NmSIj067721@svn.freebsd.org> Author: attilio Date: Tue Oct 6 23:48:28 2009 New Revision: 197824 URL: http://svn.freebsd.org/changeset/base/197824 Log: - All the functions in atomic.h needs to be in "physical" form (like not defined through macros or similar) in order to be later compiled in the kernel and offer this way the support for modules (and compatibility among the UP case and SMP case). Fix this for the newly introduced atomic_cmpset_barr_* cases by defining and specifying a template. Note that the new DEFINE_CMPSET_GEN() template save more typing on amd64 than the current code. [1] - Fix the style for memory barriers on amd64. [1] Reported by: Paul B. Mahol Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Tue Oct 6 22:21:51 2009 (r197823) +++ head/sys/amd64/include/atomic.h Tue Oct 6 23:48:28 2009 (r197824) @@ -32,9 +32,9 @@ #error this file needs sys/cdefs.h as a prerequisite #endif -#define mb() __asm__ __volatile__ ("mfence;": : :"memory") -#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") -#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") +#define mb() __asm __volatile("mfence;" : : : "memory") +#define wmb() __asm __volatile("sfence;" : : : "memory") +#define rmb() __asm __volatile("lfence;" : : : "memory") /* * Various simple operations on memory, each of which is atomic in the @@ -131,50 +131,33 @@ struct __hack * Returns 0 on failure, non-zero on success */ -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %2,%1 ; " - " sete %0 ; " - "1: " - "# atomic_cmpset_int" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} - -static __inline int -atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgq %2,%1 ; " - " sete %0 ; " - "1: " - "# atomic_cmpset_long" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} +#define DEFINE_CMPSET_GEN(NAME, TYPE, OP) \ +static __inline int \ +atomic_cmpset_##NAME(volatile u_##TYPE *dst, u_##TYPE exp, u_##TYPE src)\ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " " OP " %2,%1 ; " \ + " sete %0 ; " \ + "1: " \ + "# atomic_cmpset_##NAME" \ + : "=a" (res), /* 0 */ \ + "=m" (*dst) /* 1 */ \ + : "r" (src), /* 2 */ \ + "a" (exp), /* 3 */ \ + "m" (*dst) /* 4 */ \ + : "memory"); \ + \ + return (res); \ +} \ +struct __hack -#define atomic_cmpset_barr_int atomic_cmpset_int -#define atomic_cmpset_barr_long atomic_cmpset_long +DEFINE_CMPSET_GEN(int, int, "cmpxchgl"); +DEFINE_CMPSET_GEN(long, long, "cmpxchgq"); +DEFINE_CMPSET_GEN(barr_int, int, "cmpxchgl"); +DEFINE_CMPSET_GEN(barr_long, long, "cmpxchgq"); /* * Atomically add the value of v to the integer pointed to by p and return Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Tue Oct 6 22:21:51 2009 (r197823) +++ head/sys/i386/include/atomic.h Tue Oct 6 23:48:28 2009 (r197824) @@ -130,57 +130,62 @@ struct __hack #ifdef CPU_DISABLE_CMPXCHG -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) -{ - u_char res; - - __asm __volatile( - " pushfl ; " - " cli ; " - " cmpl %3,%4 ; " - " jne 1f ; " - " movl %2,%1 ; " - "1: " - " sete %0 ; " - " popfl ; " - "# atomic_cmpset_int" - : "=q" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "r" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} +#define DEFINE_CMPSET_GEN(NAME) \ +static __inline int \ +atomic_cmpset_##NAME(volatile u_int *dst, u_int exp, u_int src)\ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " pushfl ; " \ + " cli ; " \ + " cmpl %3,%4 ; " \ + " jne 1f ; " \ + " movl %2,%1 ; " \ + "1: " \ + " sete %0 ; " \ + " popfl ; " \ + "# atomic_cmpset_##NAME" \ + : "=q" (res), /* 0 */ \ + "=m" (*dst) /* 1 */ \ + : "r" (src), /* 2 */ \ + "r" (exp), /* 3 */ \ + "m" (*dst) /* 4 */ \ + : "memory"); \ + \ + return (res); \ +} \ +struct __hack #else /* !CPU_DISABLE_CMPXCHG */ -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %2,%1 ; " - " sete %0 ; " - "1: " - "# atomic_cmpset_int" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} +#define DEFINE_CMPSET_GEN(NAME) \ +static __inline int \ +atomic_cmpset_##NAME(volatile u_int *dst, u_int exp, u_int src)\ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchgl %2,%1 ; " \ + " sete %0 ; " \ + "1: " \ + "# atomic_cmpset_##NAME" \ + : "=a" (res), /* 0 */ \ + "=m" (*dst) /* 1 */ \ + : "r" (src), /* 2 */ \ + "a" (exp), /* 3 */ \ + "m" (*dst) /* 4 */ \ + : "memory"); \ + \ + return (res); \ +} \ +struct __hack #endif /* CPU_DISABLE_CMPXCHG */ -#define atomic_cmpset_barr_int atomic_cmpset_int +DEFINE_CMPSET_GEN(int); +DEFINE_CMPSET_GEN(barr_int); /* * Atomically add the value of v to the integer pointed to by p and return From rpaulo at FreeBSD.org Wed Oct 7 09:07:08 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Wed Oct 7 09:07:20 2009 Subject: svn commit: r197829 - head/contrib/tcpdump Message-ID: <200910070907.n97977Dt079392@svn.freebsd.org> Author: rpaulo Date: Wed Oct 7 09:07:06 2009 New Revision: 197829 URL: http://svn.freebsd.org/changeset/base/197829 Log: Add parsing code for TCP UTO (User Timeout Option). Submitted by: fangwang@ Obtained from: //depot/projects/soc2009/tcputo/ Modified: head/contrib/tcpdump/print-tcp.c head/contrib/tcpdump/tcp.h Modified: head/contrib/tcpdump/print-tcp.c ============================================================================== --- head/contrib/tcpdump/print-tcp.c Wed Oct 7 08:43:06 2009 (r197828) +++ head/contrib/tcpdump/print-tcp.c Wed Oct 7 09:07:06 2009 (r197829) @@ -124,6 +124,7 @@ struct tok tcp_option_values[] = { { TCPOPT_CCECHO, "" }, { TCPOPT_SIGNATURE, "md5" }, { TCPOPT_AUTH, "enhanced auth" }, + { TCPOPT_UTO, "uto" }, { 0, NULL } }; @@ -613,6 +614,17 @@ tcp_print(register const u_char *bp, reg */ break; + case TCPOPT_UTO: + datalen = 2; + LENCHECK(datalen); + uint utoval = EXTRACT_16BITS(cp); + if (utoval & 0x0001) + utoval = (utoval >> 1) * 60; + else + utoval >>= 1; + (void)printf(" %u", utoval); + break; + default: datalen = len - 2; for (i = 0; i < datalen; ++i) { Modified: head/contrib/tcpdump/tcp.h ============================================================================== --- head/contrib/tcpdump/tcp.h Wed Oct 7 08:43:06 2009 (r197828) +++ head/contrib/tcpdump/tcp.h Wed Oct 7 09:07:06 2009 (r197829) @@ -83,6 +83,8 @@ struct tcphdr { #define TCPOLEN_SIGNATURE 18 #define TCP_SIGLEN 16 /* length of an option 19 digest */ #define TCPOPT_AUTH 20 /* Enhanced AUTH option */ +#define TCPOPT_UTO 28 /* tcp user timeout (rfc5482) */ +#define TCPOLEN_UTO 4 #define TCPOPT_TSTAMP_HDR \ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) From pjd at FreeBSD.org Wed Oct 7 12:38:19 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Wed Oct 7 12:38:26 2009 Subject: svn commit: r197831 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910071238.n97CcJxh084465@svn.freebsd.org> Author: pjd Date: Wed Oct 7 12:38:19 2009 New Revision: 197831 URL: http://svn.freebsd.org/changeset/base/197831 Log: Fix situation where Mac OS X NFS client creates a file and when it tries to set ownership and mode in the same setattr operation, the mode was overwritten by secpolicy_vnode_setattr(). PR: kern/118320 Submitted by: Mark Thompson MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Oct 7 09:22:27 2009 (r197830) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Oct 7 12:38:19 2009 (r197831) @@ -2538,6 +2538,7 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, i vattr_t oldva; uint_t mask = vap->va_mask; uint_t saved_mask; + uint64_t saved_mode; int trim_mask = 0; uint64_t new_mode; znode_t *attrzp; @@ -2766,6 +2767,13 @@ top: if (trim_mask) { saved_mask = vap->va_mask; vap->va_mask &= ~trim_mask; + if (trim_mask & AT_MODE) { + /* + * Save the mode, as secpolicy_vnode_setattr() + * will overwrite it with ova.va_mode. + */ + saved_mode = vap->va_mode; + } } err = secpolicy_vnode_setattr(cr, vp, vap, &oldva, flags, (int (*)(void *, int, cred_t *))zfs_zaccess_unix, zp); @@ -2774,8 +2782,16 @@ top: return (err); } - if (trim_mask) + if (trim_mask) { vap->va_mask |= saved_mask; + if (trim_mask & AT_MODE) { + /* + * Recover the mode after + * secpolicy_vnode_setattr(). + */ + vap->va_mode = saved_mode; + } + } } /* From stas at FreeBSD.org Wed Oct 7 13:12:44 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Wed Oct 7 13:12:51 2009 Subject: svn commit: r197832 - head/sys/dev/bge Message-ID: <200910071312.n97DCigb085206@svn.freebsd.org> Author: stas Date: Wed Oct 7 13:12:43 2009 New Revision: 197832 URL: http://svn.freebsd.org/changeset/base/197832 Log: - Add support for new BGE chips (5761, 5784 and 57780). These chips uses new BGE_PCI_PRODID_ASICREV register to store the chip identifier and its revision. - Add new grouping macro for 7575+ chips (BGE_IS_5755_PLUS). - Add IDs for Fujitsu-branded Broadcom adapters. PR: kern/127587 Tested by: Thomas Quinot (BCM7561 A0) MFC after: 2 weeks Obtained from: OpenBSD Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 7 12:38:19 2009 (r197831) +++ head/sys/dev/bge/if_bge.c Wed Oct 7 13:12:43 2009 (r197832) @@ -170,6 +170,7 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5720 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5721 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5722 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5723 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5750 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5750M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5751 }, @@ -184,12 +185,21 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5754M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5755 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5755M }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5761 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5761E }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5761S }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5761SE }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5764 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5780 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5780S }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5781 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5782 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5784 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5785F }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5785G }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5786 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5787 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5787F }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5787M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5788 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5789 }, @@ -198,11 +208,19 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5903M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5906 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5906M }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57760 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57780 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57788 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57790 }, { SK_VENDORID, SK_DEVICEID_ALTIMA }, { TC_VENDORID, TC_DEVICEID_3C996 }, + { FJTSU_VENDORID, FJTSU_DEVICEID_PW008GE4 }, + { FJTSU_VENDORID, FJTSU_DEVICEID_PW008GE5 }, + { FJTSU_VENDORID, FJTSU_DEVICEID_PP250450 }, + { 0, 0 } }; @@ -216,6 +234,7 @@ static const struct bge_vendor { { BCOM_VENDORID, "Broadcom" }, { SK_VENDORID, "SysKonnect" }, { TC_VENDORID, "3Com" }, + { FJTSU_VENDORID, "Fujitsu" }, { 0, NULL } }; @@ -271,12 +290,18 @@ static const struct bge_revision { { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, { BGE_CHIPID_BCM5722_A0, "BCM5722 A0" }, + { BGE_CHIPID_BCM5761_A0, "BCM5761 A0" }, + { BGE_CHIPID_BCM5761_A1, "BCM5761 A1" }, + { BGE_CHIPID_BCM5784_A0, "BCM5784 A0" }, + { BGE_CHIPID_BCM5784_A1, "BCM5784 A1" }, /* 5754 and 5787 share the same ASIC ID */ { BGE_CHIPID_BCM5787_A0, "BCM5754/5787 A0" }, { BGE_CHIPID_BCM5787_A1, "BCM5754/5787 A1" }, { BGE_CHIPID_BCM5787_A2, "BCM5754/5787 A2" }, { BGE_CHIPID_BCM5906_A1, "BCM5906 A1" }, { BGE_CHIPID_BCM5906_A2, "BCM5906 A2" }, + { BGE_CHIPID_BCM57780_A0, "BCM57780 A0" }, + { BGE_CHIPID_BCM57780_A1, "BCM57780 A1" }, { 0, NULL } }; @@ -297,9 +322,13 @@ static const struct bge_revision bge_maj { BGE_ASICREV_BCM5780, "unknown BCM5780" }, { BGE_ASICREV_BCM5714, "unknown BCM5714" }, { BGE_ASICREV_BCM5755, "unknown BCM5755" }, + { BGE_ASICREV_BCM5761, "unknown BCM5761" }, + { BGE_ASICREV_BCM5784, "unknown BCM5784" }, + { BGE_ASICREV_BCM5785, "unknown BCM5785" }, /* 5754 and 5787 share the same ASIC ID */ { BGE_ASICREV_BCM5787, "unknown BCM5754/5787" }, { BGE_ASICREV_BCM5906, "unknown BCM5906" }, + { BGE_ASICREV_BCM57780, "unknown BCM57780" }, { 0, NULL } }; @@ -309,6 +338,7 @@ static const struct bge_revision bge_maj #define BGE_IS_5705_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5705_PLUS) #define BGE_IS_5714_FAMILY(sc) ((sc)->bge_flags & BGE_FLAG_5714_FAMILY) #define BGE_IS_575X_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_575X_PLUS) +#define BGE_IS_5755_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5755_PLUS) const struct bge_revision * bge_lookup_rev(uint32_t); const struct bge_vendor * bge_lookup_vendor(uint16_t); @@ -1758,8 +1788,7 @@ bge_blockinit(struct bge_softc *sc) val = BGE_WDMAMODE_ENABLE | BGE_WDMAMODE_ALL_ATTNS; /* Enable host coalescing bug fix. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || - sc->bge_asicrev == BGE_ASICREV_BCM5787) + if (BGE_IS_5755_PLUS(sc)) val |= 1 << 29; /* Turn on write DMA state machine */ @@ -1768,6 +1797,12 @@ bge_blockinit(struct bge_softc *sc) /* Turn on read DMA state machine */ val = BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || + sc->bge_asicrev == BGE_ASICREV_BCM57780) + val |= BGE_RDMAMODE_BD_SBD_CRPT_ATTN | + BGE_RDMAMODE_MBUF_RBD_CRPT_ATTN | + BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN; if (sc->bge_flags & BGE_FLAG_PCIE) val |= BGE_RDMAMODE_FIFO_LONG_BURST; CSR_WRITE_4(sc, BGE_RDMA_MODE, val); @@ -1790,7 +1825,10 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_SBDC_MODE, BGE_SBDCMODE_ENABLE); /* Turn on send data completion state machine */ - CSR_WRITE_4(sc, BGE_SDC_MODE, BGE_SDCMODE_ENABLE); + val = BGE_SDCMODE_ENABLE; + if (sc->bge_asicrev == BGE_ASICREV_BCM5761) + val |= BGE_SDCMODE_CDELAY; + CSR_WRITE_4(sc, BGE_SDC_MODE, val); /* Turn on send data initiator state machine */ CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE); @@ -1897,8 +1935,11 @@ bge_probe(device_t dev) const struct bge_vendor *v; uint32_t id; - id = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) & - BGE_PCIMISCCTL_ASICREV; + id = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> + BGE_PCIMISCCTL_ASICREV_SHIFT; + if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) + id = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); br = bge_lookup_rev(id); v = bge_lookup_vendor(vid); { @@ -1915,8 +1956,8 @@ bge_probe(device_t dev) br != NULL ? br->br_name : "NetXtreme Ethernet Controller"); } - snprintf(buf, 96, "%s, %sASIC rev. %#04x", model, - br != NULL ? "" : "unknown ", id >> 16); + snprintf(buf, 96, "%s, %sASIC rev. %#08x", model, + br != NULL ? "" : "unknown ", id); device_set_desc_copy(dev, buf); if (pci_get_subvendor(dev) == DELL_VENDORID) sc->bge_flags |= BGE_FLAG_NO_3LED; @@ -2411,8 +2452,11 @@ bge_attach(device_t dev) /* Save various chip information. */ sc->bge_chipid = - pci_read_config(dev, BGE_PCI_MISC_CTL, 4) & - BGE_PCIMISCCTL_ASICREV; + pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> + BGE_PCIMISCCTL_ASICREV_SHIFT; + if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) + sc->bge_chipid = pci_read_config(dev, BGE_PCI_PRODID_ASICREV, + 4); sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); @@ -2431,6 +2475,15 @@ bge_attach(device_t dev) /* Save chipset family. */ switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM5755: + case BGE_ASICREV_BCM5761: + case BGE_ASICREV_BCM5784: + case BGE_ASICREV_BCM5785: + case BGE_ASICREV_BCM5787: + case BGE_ASICREV_BCM57780: + sc->bge_flags |= BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | + BGE_FLAG_5705_PLUS; + break; case BGE_ASICREV_BCM5700: case BGE_ASICREV_BCM5701: case BGE_ASICREV_BCM5703: @@ -2444,8 +2497,6 @@ bge_attach(device_t dev) /* FALLTHROUGH */ case BGE_ASICREV_BCM5750: case BGE_ASICREV_BCM5752: - case BGE_ASICREV_BCM5755: - case BGE_ASICREV_BCM5787: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; /* FALLTHROUGH */ @@ -2466,6 +2517,8 @@ bge_attach(device_t dev) if (BGE_IS_5705_PLUS(sc) && !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || + sc->bge_asicrev == BGE_ASICREV_BCM5761 || + sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5787) { if (sc->bge_chipid != BGE_CHIPID_BCM5722_A0) sc->bge_flags |= BGE_FLAG_JITTER_BUG; @@ -2873,8 +2926,7 @@ bge_reset(struct bge_softc *sc) /* Disable fastboot on controllers that support it. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5752 || - sc->bge_asicrev == BGE_ASICREV_BCM5755 || - sc->bge_asicrev == BGE_ASICREV_BCM5787) { + BGE_IS_5755_PLUS(sc)) { if (bootverbose) device_printf(sc->bge_dev, "Disabling fastboot\n"); CSR_WRITE_4(sc, BGE_FASTBOOT_PC, 0x0); @@ -4689,6 +4741,8 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG } printf("Hardware Flags:\n"); + if (BGE_IS_5755_PLUS(sc)) + printf(" - 5755 Plus\n"); if (BGE_IS_575X_PLUS(sc)) printf(" - 575X Plus\n"); if (BGE_IS_5705_PLUS(sc)) Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Wed Oct 7 12:38:19 2009 (r197831) +++ head/sys/dev/bge/if_bgereg.h Wed Oct 7 13:12:43 2009 (r197832) @@ -218,6 +218,7 @@ #define BGE_PCI_UNDI_TX_BD_PRODIDX_LO 0xAC #define BGE_PCI_ISR_MBX_HI 0xB0 #define BGE_PCI_ISR_MBX_LO 0xB4 +#define BGE_PCI_PRODID_ASICREV 0xBC /* PCI Misc. Host control register */ #define BGE_PCIMISCCTL_CLEAR_INTA 0x00000001 @@ -229,6 +230,7 @@ #define BGE_PCIMISCCTL_REG_WORDSWAP 0x00000040 #define BGE_PCIMISCCTL_INDIRECT_ACCESS 0x00000080 #define BGE_PCIMISCCTL_ASICREV 0xFFFF0000 +#define BGE_PCIMISCCTL_ASICREV_SHIFT 16 #define BGE_HIF_SWAP_OPTIONS (BGE_PCIMISCCTL_ENDIAN_WORDSWAP) #if BYTE_ORDER == LITTLE_ENDIAN @@ -245,66 +247,72 @@ (BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_CLEAR_INTA| \ BGE_PCIMISCCTL_MASK_PCI_INTR|BGE_PCIMISCCTL_INDIRECT_ACCESS) -#define BGE_CHIPID_TIGON_I 0x40000000 -#define BGE_CHIPID_TIGON_II 0x60000000 -#define BGE_CHIPID_BCM5700_A0 0x70000000 -#define BGE_CHIPID_BCM5700_A1 0x70010000 -#define BGE_CHIPID_BCM5700_B0 0x71000000 -#define BGE_CHIPID_BCM5700_B1 0x71010000 -#define BGE_CHIPID_BCM5700_B2 0x71020000 -#define BGE_CHIPID_BCM5700_B3 0x71030000 -#define BGE_CHIPID_BCM5700_ALTIMA 0x71040000 -#define BGE_CHIPID_BCM5700_C0 0x72000000 -#define BGE_CHIPID_BCM5701_A0 0x00000000 /* grrrr */ -#define BGE_CHIPID_BCM5701_B0 0x01000000 -#define BGE_CHIPID_BCM5701_B2 0x01020000 -#define BGE_CHIPID_BCM5701_B5 0x01050000 -#define BGE_CHIPID_BCM5703_A0 0x10000000 -#define BGE_CHIPID_BCM5703_A1 0x10010000 -#define BGE_CHIPID_BCM5703_A2 0x10020000 -#define BGE_CHIPID_BCM5703_A3 0x10030000 -#define BGE_CHIPID_BCM5703_B0 0x11000000 -#define BGE_CHIPID_BCM5704_A0 0x20000000 -#define BGE_CHIPID_BCM5704_A1 0x20010000 -#define BGE_CHIPID_BCM5704_A2 0x20020000 -#define BGE_CHIPID_BCM5704_A3 0x20030000 -#define BGE_CHIPID_BCM5704_B0 0x21000000 -#define BGE_CHIPID_BCM5705_A0 0x30000000 -#define BGE_CHIPID_BCM5705_A1 0x30010000 -#define BGE_CHIPID_BCM5705_A2 0x30020000 -#define BGE_CHIPID_BCM5705_A3 0x30030000 -#define BGE_CHIPID_BCM5750_A0 0x40000000 -#define BGE_CHIPID_BCM5750_A1 0x40010000 -#define BGE_CHIPID_BCM5750_A3 0x40030000 -#define BGE_CHIPID_BCM5750_B0 0x41000000 -#define BGE_CHIPID_BCM5750_B1 0x41010000 -#define BGE_CHIPID_BCM5750_C0 0x42000000 -#define BGE_CHIPID_BCM5750_C1 0x42010000 -#define BGE_CHIPID_BCM5750_C2 0x42020000 -#define BGE_CHIPID_BCM5714_A0 0x50000000 -#define BGE_CHIPID_BCM5752_A0 0x60000000 -#define BGE_CHIPID_BCM5752_A1 0x60010000 -#define BGE_CHIPID_BCM5752_A2 0x60020000 -#define BGE_CHIPID_BCM5714_B0 0x80000000 -#define BGE_CHIPID_BCM5714_B3 0x80030000 -#define BGE_CHIPID_BCM5715_A0 0x90000000 -#define BGE_CHIPID_BCM5715_A1 0x90010000 -#define BGE_CHIPID_BCM5715_A3 0x90030000 -#define BGE_CHIPID_BCM5755_A0 0xa0000000 -#define BGE_CHIPID_BCM5755_A1 0xa0010000 -#define BGE_CHIPID_BCM5755_A2 0xa0020000 -#define BGE_CHIPID_BCM5722_A0 0xa2000000 -#define BGE_CHIPID_BCM5754_A0 0xb0000000 -#define BGE_CHIPID_BCM5754_A1 0xb0010000 -#define BGE_CHIPID_BCM5754_A2 0xb0020000 -#define BGE_CHIPID_BCM5787_A0 0xb0000000 -#define BGE_CHIPID_BCM5787_A1 0xb0010000 -#define BGE_CHIPID_BCM5787_A2 0xb0020000 -#define BGE_CHIPID_BCM5906_A1 0xc0010000 -#define BGE_CHIPID_BCM5906_A2 0xc0020000 +#define BGE_CHIPID_TIGON_I 0x4000 +#define BGE_CHIPID_TIGON_II 0x6000 +#define BGE_CHIPID_BCM5700_A0 0x7000 +#define BGE_CHIPID_BCM5700_A1 0x7001 +#define BGE_CHIPID_BCM5700_B0 0x7100 +#define BGE_CHIPID_BCM5700_B1 0x7101 +#define BGE_CHIPID_BCM5700_B2 0x7102 +#define BGE_CHIPID_BCM5700_B3 0x7103 +#define BGE_CHIPID_BCM5700_ALTIMA 0x7104 +#define BGE_CHIPID_BCM5700_C0 0x7200 +#define BGE_CHIPID_BCM5701_A0 0x0000 /* grrrr */ +#define BGE_CHIPID_BCM5701_B0 0x0100 +#define BGE_CHIPID_BCM5701_B2 0x0102 +#define BGE_CHIPID_BCM5701_B5 0x0105 +#define BGE_CHIPID_BCM5703_A0 0x1000 +#define BGE_CHIPID_BCM5703_A1 0x1001 +#define BGE_CHIPID_BCM5703_A2 0x1002 +#define BGE_CHIPID_BCM5703_A3 0x1003 +#define BGE_CHIPID_BCM5703_B0 0x1100 +#define BGE_CHIPID_BCM5704_A0 0x2000 +#define BGE_CHIPID_BCM5704_A1 0x2001 +#define BGE_CHIPID_BCM5704_A2 0x2002 +#define BGE_CHIPID_BCM5704_A3 0x2003 +#define BGE_CHIPID_BCM5704_B0 0x2100 +#define BGE_CHIPID_BCM5705_A0 0x3000 +#define BGE_CHIPID_BCM5705_A1 0x3001 +#define BGE_CHIPID_BCM5705_A2 0x3002 +#define BGE_CHIPID_BCM5705_A3 0x3003 +#define BGE_CHIPID_BCM5750_A0 0x4000 +#define BGE_CHIPID_BCM5750_A1 0x4001 +#define BGE_CHIPID_BCM5750_A3 0x4000 +#define BGE_CHIPID_BCM5750_B0 0x4100 +#define BGE_CHIPID_BCM5750_B1 0x4101 +#define BGE_CHIPID_BCM5750_C0 0x4200 +#define BGE_CHIPID_BCM5750_C1 0x4201 +#define BGE_CHIPID_BCM5750_C2 0x4202 +#define BGE_CHIPID_BCM5714_A0 0x5000 +#define BGE_CHIPID_BCM5752_A0 0x6000 +#define BGE_CHIPID_BCM5752_A1 0x6001 +#define BGE_CHIPID_BCM5752_A2 0x6002 +#define BGE_CHIPID_BCM5714_B0 0x8000 +#define BGE_CHIPID_BCM5714_B3 0x8003 +#define BGE_CHIPID_BCM5715_A0 0x9000 +#define BGE_CHIPID_BCM5715_A1 0x9001 +#define BGE_CHIPID_BCM5715_A3 0x9003 +#define BGE_CHIPID_BCM5755_A0 0xa000 +#define BGE_CHIPID_BCM5755_A1 0xa001 +#define BGE_CHIPID_BCM5755_A2 0xa002 +#define BGE_CHIPID_BCM5722_A0 0xa200 +#define BGE_CHIPID_BCM5754_A0 0xb000 +#define BGE_CHIPID_BCM5754_A1 0xb001 +#define BGE_CHIPID_BCM5754_A2 0xb002 +#define BGE_CHIPID_BCM5761_A0 0x5761000 +#define BGE_CHIPID_BCM5761_A1 0x5761100 +#define BGE_CHIPID_BCM5784_A0 0x5784000 +#define BGE_CHIPID_BCM5784_A1 0x5784100 +#define BGE_CHIPID_BCM5787_A0 0xb000 +#define BGE_CHIPID_BCM5787_A1 0xb001 +#define BGE_CHIPID_BCM5787_A2 0xb002 +#define BGE_CHIPID_BCM5906_A1 0xc001 +#define BGE_CHIPID_BCM5906_A2 0xc002 +#define BGE_CHIPID_BCM57780_A0 0x57780000 +#define BGE_CHIPID_BCM57780_A1 0x57780001 /* shorthand one */ -#define BGE_ASICREV(x) ((x) >> 28) +#define BGE_ASICREV(x) ((x) >> 12) #define BGE_ASICREV_BCM5701 0x00 #define BGE_ASICREV_BCM5703 0x01 #define BGE_ASICREV_BCM5704 0x02 @@ -319,9 +327,16 @@ #define BGE_ASICREV_BCM5754 0x0b #define BGE_ASICREV_BCM5787 0x0b #define BGE_ASICREV_BCM5906 0x0c +/* Should consult BGE_PCI_PRODID_ASICREV for ChipID */ +#define BGE_ASICREV_USE_PRODID_REG 0x0f +/* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ +#define BGE_ASICREV_BCM5761 0x5761 +#define BGE_ASICREV_BCM5784 0x5784 +#define BGE_ASICREV_BCM5785 0x5785 +#define BGE_ASICREV_BCM57780 0x57780 /* chip revisions */ -#define BGE_CHIPREV(x) ((x) >> 24) +#define BGE_CHIPREV(x) ((x) >> 8) #define BGE_CHIPREV_5700_AX 0x70 #define BGE_CHIPREV_5700_BX 0x71 #define BGE_CHIPREV_5700_CX 0x72 @@ -331,6 +346,9 @@ #define BGE_CHIPREV_5704_BX 0x21 #define BGE_CHIPREV_5750_AX 0x40 #define BGE_CHIPREV_5750_BX 0x41 +/* BGE_PCI_PRODID_ASICREV chip rev. identifiers. */ +#define BGE_CHIPREV_5761_AX 0x57611 +#define BGE_CHIPREV_5784_AX 0x57841 /* PCI DMA Read/Write Control register */ #define BGE_PCIDMARWCTL_MINDMA 0x000000FF @@ -861,6 +879,7 @@ #define BGE_SDCMODE_RESET 0x00000001 #define BGE_SDCMODE_ENABLE 0x00000002 #define BGE_SDCMODE_ATTN 0x00000004 +#define BGE_SDCMODE_CDELAY 0x00000010 /* Send Data completion status register */ #define BGE_SDCSTAT_ATTN 0x00000004 @@ -1378,6 +1397,9 @@ #define BGE_RDMAMODE_PCI_FIFOOREAD_ATTN 0x00000100 #define BGE_RDMAMODE_LOCWRITE_TOOBIG 0x00000200 #define BGE_RDMAMODE_ALL_ATTNS 0x000003FC +#define BGE_RDMAMODE_BD_SBD_CRPT_ATTN 0x00000800 +#define BGE_RDMAMODE_MBUF_RBD_CRPT_ATTN 0x00001000 +#define BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN 0x00002000 #define BGE_RDMAMODE_FIFO_SIZE_128 0x00020000 #define BGE_RDMAMODE_FIFO_LONG_BURST 0x00030000 @@ -2101,6 +2123,7 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5720 0x1658 #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A +#define BCOM_DEVICEID_BCM5723 0x165B #define BCOM_DEVICEID_BCM5750 0x1676 #define BCOM_DEVICEID_BCM5750M 0x167C #define BCOM_DEVICEID_BCM5751 0x1677 @@ -2115,13 +2138,22 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5754M 0x1672 #define BCOM_DEVICEID_BCM5755 0x167B #define BCOM_DEVICEID_BCM5755M 0x1673 +#define BCOM_DEVICEID_BCM5761 0x1681 +#define BCOM_DEVICEID_BCM5761E 0x1680 +#define BCOM_DEVICEID_BCM5761S 0x1688 +#define BCOM_DEVICEID_BCM5761SE 0x1689 +#define BCOM_DEVICEID_BCM5764 0x1684 #define BCOM_DEVICEID_BCM5780 0x166A #define BCOM_DEVICEID_BCM5780S 0x166B #define BCOM_DEVICEID_BCM5781 0x16DD #define BCOM_DEVICEID_BCM5782 0x1696 +#define BCOM_DEVICEID_BCM5784 0x1698 +#define BCOM_DEVICEID_BCM5785F 0x16a0 +#define BCOM_DEVICEID_BCM5785G 0x1699 #define BCOM_DEVICEID_BCM5786 0x169A #define BCOM_DEVICEID_BCM5787 0x169B #define BCOM_DEVICEID_BCM5787M 0x1693 +#define BCOM_DEVICEID_BCM5787F 0x167f #define BCOM_DEVICEID_BCM5788 0x169C #define BCOM_DEVICEID_BCM5789 0x169D #define BCOM_DEVICEID_BCM5901 0x170D @@ -2129,6 +2161,10 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5903M 0x16FF #define BCOM_DEVICEID_BCM5906 0x1712 #define BCOM_DEVICEID_BCM5906M 0x1713 +#define BCOM_DEVICEID_BCM57760 0x1690 +#define BCOM_DEVICEID_BCM57780 0x1692 +#define BCOM_DEVICEID_BCM57788 0x1691 +#define BCOM_DEVICEID_BCM57790 0x1694 /* * Alteon AceNIC PCI vendor/device ID. @@ -2179,6 +2215,14 @@ struct bge_status_block { #define SUN_VENDORID 0x108e /* + * Fujitsu vendor/device IDs + */ +#define FJTSU_VENDORID 0x10cf +#define FJTSU_DEVICEID_PW008GE5 0x11a1 +#define FJTSU_DEVICEID_PW008GE4 0x11a2 +#define FJTSU_DEVICEID_PP250450 0x11cc /* PRIMEPOWER250/450 LAN */ + +/* * Offset of MAC address inside EEPROM. */ #define BGE_EE_MAC_OFFSET 0x7C @@ -2558,6 +2602,7 @@ struct bge_softc { #define BGE_FLAG_5705_PLUS 0x00002000 #define BGE_FLAG_5714_FAMILY 0x00004000 #define BGE_FLAG_575X_PLUS 0x00008000 +#define BGE_FLAG_5755_PLUS 0x00010000 #define BGE_FLAG_RX_ALIGNBUG 0x00100000 #define BGE_FLAG_NO_3LED 0x00200000 #define BGE_FLAG_ADC_BUG 0x00400000 @@ -2568,8 +2613,8 @@ struct bge_softc { #define BGE_FLAG_CRC_BUG 0x08000000 #define BGE_FLAG_5788 0x20000000 uint32_t bge_chipid; - uint8_t bge_asicrev; - uint8_t bge_chiprev; + uint32_t bge_asicrev; + uint32_t bge_chiprev; uint8_t bge_asf_mode; uint8_t bge_asf_count; struct bge_ring_data bge_ldata; /* rings */ From jh at FreeBSD.org Wed Oct 7 13:25:23 2009 From: jh at FreeBSD.org (Jaakko Heinonen) Date: Wed Oct 7 13:25:32 2009 Subject: svn commit: r197833 - head/usr.sbin/cdcontrol Message-ID: <200910071325.n97DPNJN085484@svn.freebsd.org> Author: jh Date: Wed Oct 7 13:25:22 2009 New Revision: 197833 URL: http://svn.freebsd.org/changeset/base/197833 Log: When run() returns an error, print the error message also in non-interactive mode. Previously error messages were printed only in interactive mode. PR: bin/124517 Approved by: trasz (mentor) MFC after: 1 month Modified: head/usr.sbin/cdcontrol/cdcontrol.c Modified: head/usr.sbin/cdcontrol/cdcontrol.c ============================================================================== --- head/usr.sbin/cdcontrol/cdcontrol.c Wed Oct 7 13:12:43 2009 (r197832) +++ head/usr.sbin/cdcontrol/cdcontrol.c Wed Oct 7 13:25:22 2009 (r197833) @@ -241,7 +241,7 @@ int main (int argc, char **argv) if (argc > 0) { char buf[80], *p; - int len; + int len, rc; for (p=buf; argc-->0; ++argv) { len = strlen (*argv); @@ -257,7 +257,11 @@ int main (int argc, char **argv) } *p = 0; arg = parse (buf, &cmd); - return (run (cmd, arg)); + rc = run (cmd, arg); + if (rc < 0 && verbose) + warn(NULL); + + return (rc); } if (verbose == 1) From stas at FreeBSD.org Wed Oct 7 13:25:24 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Wed Oct 7 13:25:43 2009 Subject: svn commit: r197834 - head/share/man/man4 Message-ID: <200910071325.n97DPODb085517@svn.freebsd.org> Author: stas Date: Wed Oct 7 13:25:24 2009 New Revision: 197834 URL: http://svn.freebsd.org/changeset/base/197834 Log: - Document new revisions of chips supported. Modified: head/share/man/man4/bge.4 Modified: head/share/man/man4/bge.4 ============================================================================== --- head/share/man/man4/bge.4 Wed Oct 7 13:25:22 2009 (r197833) +++ head/share/man/man4/bge.4 Wed Oct 7 13:25:24 2009 (r197834) @@ -31,12 +31,12 @@ .\" .\" $FreeBSD$ .\" -.Dd May 19, 2009 +.Dd Oct 7, 2009 .Dt BGE 4 .Os .Sh NAME .Nm bge -.Nd "Broadcom BCM570x/5714/5721/5722/5750/5751/5752/5789 PCI Gigabit Ethernet adapter driver" +.Nd "Broadcom BCM570x/5714/5721/5722/5750/5751/5752/5761/5784/5789/57780 PCI Gigabit Ethernet adapter driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -56,8 +56,8 @@ if_bge_load="YES" The .Nm driver provides support for various NICs based on the Broadcom BCM570x, -5714, 5721, 5722, 5750, 5751, 5752 and 5789 families of Gigabit Ethernet -controller chips. +5714, 5721, 5722, 5750, 5751, 5752, 5761, 5784, 5789 and 57780 families +of Gigabit Ethernet controller chips. .Pp All of these NICs are capable of 10, 100 and 1000Mbps speeds over CAT5 copper cable, except for the SysKonnect SK-9D41 which supports only From simon at FreeBSD.org Wed Oct 7 13:45:12 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Wed Oct 7 13:45:24 2009 Subject: svn commit: r197835 - head/share/man/man4 Message-ID: <200910071345.n97DjC88085937@svn.freebsd.org> Author: simon Date: Wed Oct 7 13:45:12 2009 New Revision: 197835 URL: http://svn.freebsd.org/changeset/base/197835 Log: - Document that 'Dell PowerEdge R710' has bce(4) supported NIC. - Bump document date. MFC after: 3 days Modified: head/share/man/man4/bce.4 Modified: head/share/man/man4/bce.4 ============================================================================== --- head/share/man/man4/bce.4 Wed Oct 7 13:25:24 2009 (r197834) +++ head/share/man/man4/bce.4 Wed Oct 7 13:45:12 2009 (r197835) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 7, 2009 +.Dd October 7, 2009 .Dt BCE 4 .Os .Sh NAME @@ -165,6 +165,8 @@ Dell PowerEdge 1950 integrated BCM5708 N .It Dell PowerEdge 2950 integrated BCM5708 NIC .It +Dell PowerEdge R710 integrated BCM5709 NIC +.It HP NC370F Multifunction Gigabit Server Adapter .It HP NC370T Multifunction Gigabit Server Adapter From stas at FreeBSD.org Wed Oct 7 14:29:50 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Wed Oct 7 14:30:02 2009 Subject: svn commit: r197837 - head/sys/dev/bge Message-ID: <200910071429.n97ETmS3086922@svn.freebsd.org> Author: stas Date: Wed Oct 7 14:29:48 2009 New Revision: 197837 URL: http://svn.freebsd.org/changeset/base/197837 Log: - Give a name to the host coalescing bug fix WDMA mode register bit instead of using hardcoded value in the code. Obtained from: OpenBSD Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 7 14:14:05 2009 (r197836) +++ head/sys/dev/bge/if_bge.c Wed Oct 7 14:29:48 2009 (r197837) @@ -1789,7 +1789,7 @@ bge_blockinit(struct bge_softc *sc) /* Enable host coalescing bug fix. */ if (BGE_IS_5755_PLUS(sc)) - val |= 1 << 29; + val |= BGE_WDMAMODE_STATUS_TAG_FIX; /* Turn on write DMA state machine */ CSR_WRITE_4(sc, BGE_WDMA_MODE, val); Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Wed Oct 7 14:14:05 2009 (r197836) +++ head/sys/dev/bge/if_bgereg.h Wed Oct 7 14:29:48 2009 (r197837) @@ -1431,6 +1431,7 @@ #define BGE_WDMAMODE_PCI_FIFOOREAD_ATTN 0x00000100 #define BGE_WDMAMODE_LOCREAD_TOOBIG 0x00000200 #define BGE_WDMAMODE_ALL_ATTNS 0x000003FC +#define BGE_WDMAMODE_STATUS_TAG_FIX 0x20000000 /* Write DMA status register */ #define BGE_WDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 From mav at FreeBSD.org Wed Oct 7 15:40:05 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Wed Oct 7 15:40:30 2009 Subject: svn commit: r197838 - in head/sys/dev: ahci siis Message-ID: <200910071540.n97Fe4xN088962@svn.freebsd.org> Author: mav Date: Wed Oct 7 15:40:04 2009 New Revision: 197838 URL: http://svn.freebsd.org/changeset/base/197838 Log: On command timeout handle frozen command first, to not run it inside XXX_end_transaction(). Submitted by: avg Modified: head/sys/dev/ahci/ahci.c head/sys/dev/siis/siis.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Oct 7 14:29:48 2009 (r197837) +++ head/sys/dev/ahci/ahci.c Wed Oct 7 15:40:04 2009 (r197838) @@ -1259,15 +1259,16 @@ ahci_timeout(struct ahci_slot *slot) if (!ch->readlog) xpt_freeze_simq(ch->sim, ch->numrslots); - /* Handle command with timeout. */ - ahci_end_transaction(&ch->slot[slot->slot], AHCI_ERR_TIMEOUT); - /* Handle the rest of commands. */ + /* Handle frozen command. */ if (ch->frozen) { union ccb *fccb = ch->frozen; ch->frozen = NULL; fccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; xpt_done(fccb); } + /* Handle command with timeout. */ + ahci_end_transaction(&ch->slot[slot->slot], AHCI_ERR_TIMEOUT); + /* Handle the rest of commands. */ for (i = 0; i < ch->numslots; i++) { /* Do we have a running request on slot? */ if (ch->slot[i].state < AHCI_SLOT_RUNNING) Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Wed Oct 7 14:29:48 2009 (r197837) +++ head/sys/dev/siis/siis.c Wed Oct 7 15:40:04 2009 (r197838) @@ -982,15 +982,16 @@ device_printf(dev, "%s is %08x ss %08x r if (!ch->readlog) xpt_freeze_simq(ch->sim, ch->numrslots); - /* Handle command with timeout. */ - siis_end_transaction(&ch->slot[slot->slot], SIIS_ERR_TIMEOUT); - /* Handle the rest of commands. */ + /* Handle frozen command. */ if (ch->frozen) { union ccb *fccb = ch->frozen; ch->frozen = NULL; fccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; xpt_done(fccb); } + /* Handle command with timeout. */ + siis_end_transaction(&ch->slot[slot->slot], SIIS_ERR_TIMEOUT); + /* Handle the rest of commands. */ for (i = 0; i < SIIS_MAX_SLOTS; i++) { /* Do we have a running request on slot? */ if (ch->slot[i].state < SIIS_SLOT_RUNNING) From zml at FreeBSD.org Wed Oct 7 19:50:14 2009 From: zml at FreeBSD.org (Zachary Loafman) Date: Wed Oct 7 19:50:27 2009 Subject: svn commit: r197840 - head/sys/nlm Message-ID: <200910071950.n97JoECb097724@svn.freebsd.org> Author: zml Date: Wed Oct 7 19:50:14 2009 New Revision: 197840 URL: http://svn.freebsd.org/changeset/base/197840 Log: Handle GRANTED_RES messages more gracefully: Send along a grant cookie to reference the lock, look up the grant cookie when the GRANTED_RES comes back. Properly handle the case of an error on the grant. Add a short expiration window so that granted locks are not freed immediately. Approved by: dfr (mentor) MFC after: 2 weeks Modified: head/sys/nlm/nlm.h head/sys/nlm/nlm_prot_impl.c head/sys/nlm/nlm_prot_server.c Modified: head/sys/nlm/nlm.h ============================================================================== --- head/sys/nlm/nlm.h Wed Oct 7 15:41:30 2009 (r197839) +++ head/sys/nlm/nlm.h Wed Oct 7 19:50:14 2009 (r197840) @@ -49,6 +49,12 @@ extern struct timeval nlm_zero_tv; extern int nlm_nsm_state; /* + * Make a struct netobj. + */ +extern void nlm_make_netobj(struct netobj *dst, caddr_t srt, + size_t srcsize, struct malloc_type *type); + +/* * Copy a struct netobj. */ extern void nlm_copy_netobj(struct netobj *dst, struct netobj *src, @@ -193,6 +199,12 @@ extern int nlm_do_granted(nlm4_testargs struct svc_req *rqstp, CLIENT **rpcp); /* + * Implementation for the granted result RPC. The client may reject the granted + * message, in which case we need to handle it appropriately. + */ +extern void nlm_do_granted_res(nlm4_res *argp, struct svc_req *rqstp); + +/* * Free all locks associated with the hostname argp->name. */ extern void nlm_do_free_all(nlm4_notify *argp); Modified: head/sys/nlm/nlm_prot_impl.c ============================================================================== --- head/sys/nlm/nlm_prot_impl.c Wed Oct 7 15:41:30 2009 (r197839) +++ head/sys/nlm/nlm_prot_impl.c Wed Oct 7 19:50:14 2009 (r197840) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -77,6 +78,11 @@ MALLOC_DEFINE(M_NLM, "NLM", "Network Loc #define NLM_IDLE_PERIOD 5 /* + * We only look for GRANTED_RES messages for a little while. + */ +#define NLM_EXPIRE_TIMEOUT 10 + +/* * Support for sysctl vfs.nlm.sysid */ SYSCTL_NODE(_vfs, OID_AUTO, nlm, CTLFLAG_RW, NULL, "Network Lock Manager"); @@ -204,6 +210,7 @@ struct nlm_async_lock { struct nlm_host *af_host; /* (c) host which is locking */ CLIENT *af_rpc; /* (c) rpc client to send message */ nlm4_testargs af_granted; /* (c) notification details */ + time_t af_expiretime; /* (c) notification time */ }; TAILQ_HEAD(nlm_async_lock_list, nlm_async_lock); @@ -237,7 +244,9 @@ struct nlm_host { enum nlm_host_state nh_monstate; /* (l) local NSM monitoring state */ time_t nh_idle_timeout; /* (s) Time at which host is idle */ struct sysctl_ctx_list nh_sysctl; /* (c) vfs.nlm.sysid nodes */ + uint32_t nh_grantcookie; /* (l) grant cookie counter */ struct nlm_async_lock_list nh_pending; /* (l) pending async locks */ + struct nlm_async_lock_list nh_granted; /* (l) granted locks */ struct nlm_async_lock_list nh_finished; /* (l) finished async locks */ }; TAILQ_HEAD(nlm_host_list, nlm_host); @@ -247,6 +256,25 @@ static uint32_t nlm_next_sysid = 1; / static void nlm_host_unmonitor(struct nlm_host *); +struct nlm_grantcookie { + uint32_t ng_sysid; + uint32_t ng_cookie; +}; + +static inline uint32_t +ng_sysid(struct netobj *src) +{ + + return ((struct nlm_grantcookie *)src->n_bytes)->ng_sysid; +} + +static inline uint32_t +ng_cookie(struct netobj *src) +{ + + return ((struct nlm_grantcookie *)src->n_bytes)->ng_cookie; +} + /**********************************************************************/ /* @@ -281,6 +309,19 @@ nlm_uninit(void *dummy) SYSUNINIT(nlm_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, nlm_uninit, NULL); /* + * Create a netobj from an arbitrary source. + */ +void +nlm_make_netobj(struct netobj *dst, caddr_t src, size_t srcsize, + struct malloc_type *type) +{ + + dst->n_len = srcsize; + dst->n_bytes = malloc(srcsize, type, M_WAITOK); + memcpy(dst->n_bytes, src, srcsize); +} + +/* * Copy a struct netobj. */ void @@ -288,11 +329,10 @@ nlm_copy_netobj(struct netobj *dst, stru struct malloc_type *type) { - dst->n_len = src->n_len; - dst->n_bytes = malloc(src->n_len, type, M_WAITOK); - memcpy(dst->n_bytes, src->n_bytes, src->n_len); + nlm_make_netobj(dst, src->n_bytes, src->n_len, type); } + /* * Create an RPC client handle for the given (address,prog,vers) * triple using UDP. @@ -518,8 +558,10 @@ nlm_lock_callback(void *arg, int pending struct nlm_async_lock *af = (struct nlm_async_lock *) arg; struct rpc_callextra ext; - NLM_DEBUG(2, "NLM: async lock %p for %s (sysid %d) granted\n", - af, af->af_host->nh_caller_name, af->af_host->nh_sysid); + NLM_DEBUG(2, "NLM: async lock %p for %s (sysid %d) granted," + " cookie %d:%d\n", af, af->af_host->nh_caller_name, + af->af_host->nh_sysid, ng_sysid(&af->af_granted.cookie), + ng_cookie(&af->af_granted.cookie)); /* * Send the results back to the host. @@ -556,16 +598,12 @@ nlm_lock_callback(void *arg, int pending } /* - * Move this entry to the nh_finished list. Someone else will - * free it later - its too hard to do it here safely without - * racing with cancel. - * - * XXX possibly we should have a third "granted sent but not - * ack'ed" list so that we can re-send the granted message. + * Move this entry to the nh_granted list. */ + af->af_expiretime = time_uptime + NLM_EXPIRE_TIMEOUT; mtx_lock(&af->af_host->nh_lock); TAILQ_REMOVE(&af->af_host->nh_pending, af, af_link); - TAILQ_INSERT_TAIL(&af->af_host->nh_finished, af, af_link); + TAILQ_INSERT_TAIL(&af->af_host->nh_granted, af, af_link); mtx_unlock(&af->af_host->nh_lock); } @@ -635,11 +673,23 @@ nlm_cancel_async_lock(struct nlm_async_l } static void -nlm_free_finished_locks(struct nlm_host *host) +nlm_check_expired_locks(struct nlm_host *host) { struct nlm_async_lock *af; + time_t uptime = time_uptime; mtx_lock(&host->nh_lock); + while ((af = TAILQ_FIRST(&host->nh_granted)) != NULL + && uptime >= af->af_expiretime) { + NLM_DEBUG(2, "NLM: async lock %p for %s (sysid %d) expired," + " cookie %d:%d\n", af, af->af_host->nh_caller_name, + af->af_host->nh_sysid, ng_sysid(&af->af_granted.cookie), + ng_cookie(&af->af_granted.cookie)); + TAILQ_REMOVE(&host->nh_granted, af, af_link); + mtx_unlock(&host->nh_lock); + nlm_free_async_lock(af); + mtx_lock(&host->nh_lock); + } while ((af = TAILQ_FIRST(&host->nh_finished)) != NULL) { TAILQ_REMOVE(&host->nh_finished, af, af_link); mtx_unlock(&host->nh_lock); @@ -722,7 +772,7 @@ nlm_host_notify(struct nlm_host *host, i nlm_cancel_async_lock(af); } mtx_unlock(&host->nh_lock); - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); /* * The host just rebooted - trash its locks. @@ -799,7 +849,9 @@ nlm_create_host(const char* caller_name) host->nh_vers = 0; host->nh_state = 0; host->nh_monstate = NLM_UNMONITORED; + host->nh_grantcookie = 1; TAILQ_INIT(&host->nh_pending); + TAILQ_INIT(&host->nh_granted); TAILQ_INIT(&host->nh_finished); TAILQ_INSERT_TAIL(&nlm_hosts, host, nh_link); @@ -1834,7 +1886,7 @@ nlm_do_test(nlm4_testargs *argp, nlm4_te NLM_DEBUG(3, "nlm_do_test(): caller_name = %s (sysid = %d)\n", host->nh_caller_name, host->nh_sysid); - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); sysid = host->nh_sysid; nlm_convert_to_fhandle_t(&fh, &argp->alock.fh); @@ -1939,7 +1991,7 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re nlm_host_notify(host, argp->state); } - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); sysid = host->nh_sysid; nlm_convert_to_fhandle_t(&fh, &argp->alock.fh); @@ -1968,6 +2020,7 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re if (argp->block) { struct nlm_async_lock *af; CLIENT *client; + struct nlm_grantcookie cookie; /* * First, make sure we can contact the host's NLM. @@ -1993,6 +2046,10 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re break; } } + if (!af) { + cookie.ng_sysid = host->nh_sysid; + cookie.ng_cookie = host->nh_grantcookie++; + } mtx_unlock(&host->nh_lock); if (af) { CLNT_RELEASE(client); @@ -2011,6 +2068,8 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re * We use M_RPC here so that we can xdr_free the thing * later. */ + nlm_make_netobj(&af->af_granted.cookie, + (caddr_t)&cookie, sizeof(cookie), M_RPC); af->af_granted.exclusive = argp->exclusive; af->af_granted.alock.caller_name = strdup(argp->alock.caller_name, M_RPC); @@ -2111,7 +2170,7 @@ nlm_do_cancel(nlm4_cancargs *argp, nlm4_ NLM_DEBUG(3, "nlm_do_cancel(): caller_name = %s (sysid = %d)\n", host->nh_caller_name, host->nh_sysid); - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); sysid = host->nh_sysid; nlm_convert_to_fhandle_t(&fh, &argp->alock.fh); @@ -2200,7 +2259,7 @@ nlm_do_unlock(nlm4_unlockargs *argp, nlm NLM_DEBUG(3, "nlm_do_unlock(): caller_name = %s (sysid = %d)\n", host->nh_caller_name, host->nh_sysid); - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); sysid = host->nh_sysid; nlm_convert_to_fhandle_t(&fh, &argp->alock.fh); @@ -2257,6 +2316,7 @@ nlm_do_granted(nlm4_testargs *argp, nlm4 nlm_copy_netobj(&result->cookie, &argp->cookie, M_RPC); result->stat.stat = nlm4_denied; + KFAIL_POINT_CODE(DEBUG_FP, nlm_deny_grant, goto out); mtx_lock(&nlm_global_lock); TAILQ_FOREACH(nw, &nlm_waiting_locks, nw_link) { @@ -2275,6 +2335,8 @@ nlm_do_granted(nlm4_testargs *argp, nlm4 } } mtx_unlock(&nlm_global_lock); + +out: if (rpcp) *rpcp = nlm_host_get_rpc(host, TRUE); nlm_host_release(host); @@ -2282,6 +2344,65 @@ nlm_do_granted(nlm4_testargs *argp, nlm4 } void +nlm_do_granted_res(nlm4_res *argp, struct svc_req *rqstp) +{ + struct nlm_host *host = NULL; + struct nlm_async_lock *af = NULL; + int error; + + if (argp->cookie.n_len != sizeof(struct nlm_grantcookie)) { + NLM_DEBUG(1, "NLM: bogus grant cookie"); + goto out; + } + + host = nlm_find_host_by_sysid(ng_sysid(&argp->cookie)); + if (!host) { + NLM_DEBUG(1, "NLM: Unknown host rejected our grant"); + goto out; + } + + mtx_lock(&host->nh_lock); + TAILQ_FOREACH(af, &host->nh_granted, af_link) + if (ng_cookie(&argp->cookie) == + ng_cookie(&af->af_granted.cookie)) + break; + if (af) + TAILQ_REMOVE(&host->nh_granted, af, af_link); + mtx_unlock(&host->nh_lock); + + if (!af) { + NLM_DEBUG(1, "NLM: host %s (sysid %d) replied to our grant " + "with unrecognized cookie %d:%d", host->nh_caller_name, + host->nh_sysid, ng_sysid(&argp->cookie), + ng_cookie(&argp->cookie)); + goto out; + } + + if (argp->stat.stat != nlm4_granted) { + af->af_fl.l_type = F_UNLCK; + error = VOP_ADVLOCK(af->af_vp, NULL, F_UNLCK, &af->af_fl, F_REMOTE); + if (error) { + NLM_DEBUG(1, "NLM: host %s (sysid %d) rejected our grant " + "and we failed to unlock (%d)", host->nh_caller_name, + host->nh_sysid, error); + goto out; + } + + NLM_DEBUG(5, "NLM: async lock %p rejected by host %s (sysid %d)", + af, host->nh_caller_name, host->nh_sysid); + } else { + NLM_DEBUG(5, "NLM: async lock %p accepted by host %s (sysid %d)", + af, host->nh_caller_name, host->nh_sysid); + } + + out: + if (af) + nlm_free_async_lock(af); + if (host) + nlm_host_release(host); +} + +void nlm_do_free_all(nlm4_notify *argp) { struct nlm_host *host, *thost; Modified: head/sys/nlm/nlm_prot_server.c ============================================================================== --- head/sys/nlm/nlm_prot_server.c Wed Oct 7 15:41:30 2009 (r197839) +++ head/sys/nlm/nlm_prot_server.c Wed Oct 7 19:50:14 2009 (r197840) @@ -671,6 +671,7 @@ bool_t nlm4_granted_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp) { + nlm_do_granted_res(argp, rqstp); return (FALSE); } From pjd at FreeBSD.org Wed Oct 7 20:09:27 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Wed Oct 7 20:09:37 2009 Subject: svn commit: r197816 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs In-Reply-To: <200910062140.n96LeoDG064737@svn.freebsd.org> References: <200910062140.n96LeoDG064737@svn.freebsd.org> Message-ID: <20091007200918.GC2049@garage.freebsd.pl> On Tue, Oct 06, 2009 at 09:40:50PM +0000, Kip Macy wrote: > Author: kmacy > Date: Tue Oct 6 21:40:50 2009 > New Revision: 197816 > URL: http://svn.freebsd.org/changeset/base/197816 > > Log: > Prevent paging pressure from draining arc too much > - always drain arc if above arc_c_max - never drain arc if arc is below arc_c_max Below arc_c_min, right? Thanks for working on this. > + if (arc_size <= arc_c_min) > + return (0); -- Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091007/6806142f/attachment.pgp From rwatson at FreeBSD.org Wed Oct 7 20:20:52 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Wed Oct 7 20:21:04 2009 Subject: svn commit: r197841 - in head: lib/libc/gen lib/libc/sys sys/sys Message-ID: <200910072020.n97KKqPx098336@svn.freebsd.org> Author: rwatson Date: Wed Oct 7 20:20:51 2009 New Revision: 197841 URL: http://svn.freebsd.org/changeset/base/197841 Log: Add a new errno, ENOTCAPABLE, to be returned when a process requests an operation on a file descriptor that is not authorized by the descriptor's capability flags. MFC after: 1 month Sponsored by: Google Modified: head/lib/libc/gen/errlst.c head/lib/libc/sys/intro.2 head/sys/sys/errno.h Modified: head/lib/libc/gen/errlst.c ============================================================================== --- head/lib/libc/gen/errlst.c Wed Oct 7 19:50:14 2009 (r197840) +++ head/lib/libc/gen/errlst.c Wed Oct 7 20:20:51 2009 (r197841) @@ -150,5 +150,6 @@ const char *const sys_errlist[] = { "Multihop attempted", /* 90 - EMULTIHOP */ "Link has been severed", /* 91 - ENOLINK */ "Protocol error", /* 92 - EPROTO */ + "Capabilities insufficient", /* 93 - ENOTCAPABLE */ }; const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]); Modified: head/lib/libc/sys/intro.2 ============================================================================== --- head/lib/libc/sys/intro.2 Wed Oct 7 19:50:14 2009 (r197840) +++ head/lib/libc/sys/intro.2 Wed Oct 7 20:20:51 2009 (r197841) @@ -456,6 +456,9 @@ The specified extended attribute does no .It Er 88 EDOOFUS Em "Programming error" . A function or API is being abused in a way which could only be detected at run-time. +.It Er 93 ENOTCAPABLE Em "Capabilities insufficient" . +An operation on a capability file descriptor requires greater privilege than +the capability allows. .El .Sh DEFINITIONS .Bl -tag -width Ds Modified: head/sys/sys/errno.h ============================================================================== --- head/sys/sys/errno.h Wed Oct 7 19:50:14 2009 (r197840) +++ head/sys/sys/errno.h Wed Oct 7 20:20:51 2009 (r197841) @@ -174,7 +174,11 @@ __END_DECLS #define EPROTO 92 /* Protocol error */ #ifndef _POSIX_SOURCE -#define ELAST 92 /* Must be equal largest errno */ +#define ENOTCAPABLE 93 /* Capabilities insufficient */ +#endif /* _POSIX_SOURCE */ + +#ifndef _POSIX_SOURCE +#define ELAST 93 /* Must be equal largest errno */ #endif /* _POSIX_SOURCE */ #ifdef _KERNEL From pjd at FreeBSD.org Wed Oct 7 20:54:07 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Wed Oct 7 20:54:19 2009 Subject: svn commit: r197842 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910072054.n97Ks7EB099062@svn.freebsd.org> Author: pjd Date: Wed Oct 7 20:54:07 2009 New Revision: 197842 URL: http://svn.freebsd.org/changeset/base/197842 Log: Fix white-spaces. MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 7 20:20:51 2009 (r197841) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 7 20:54:07 2009 (r197842) @@ -433,7 +433,7 @@ vdev_geom_open_by_guid(vdev_t *vd) if (cp != NULL) { len = strlen(cp->provider->name) + strlen("/dev/") + 1; buf = kmem_alloc(len, KM_SLEEP); - + snprintf(buf, len, "/dev/%s", cp->provider->name); spa_strfree(vd->vdev_path); vd->vdev_path = buf; @@ -663,11 +663,11 @@ static void vdev_geom_io_done(zio_t *zio) { - /* - * If the device returned ENXIO, then attempt we should verify if GEOM - * provider has been removed. If this is the case, then we trigger an - * asynchronous removal of the device. - */ + /* + * If the device returned ENXIO, then attempt we should verify if GEOM + * provider has been removed. If this is the case, then we trigger an + * asynchronous removal of the device. + */ if (zio->io_error == ENXIO) { vdev_t *vd = zio->io_vd; vdev_geom_ctx_t *ctx; From pjd at FreeBSD.org Wed Oct 7 20:56:16 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Wed Oct 7 20:56:22 2009 Subject: svn commit: r197843 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910072056.n97KuGfc099150@svn.freebsd.org> Author: pjd Date: Wed Oct 7 20:56:15 2009 New Revision: 197843 URL: http://svn.freebsd.org/changeset/base/197843 Log: On FreeBSD it is enough to report provider removal when orphan event is received, we don't have to do it on every ENXIO error in I/O path. Solaris has no GEOM so they have to handle it in a less clean way. MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 7 20:54:07 2009 (r197842) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 7 20:56:15 2009 (r197843) @@ -662,26 +662,6 @@ sendreq: static void vdev_geom_io_done(zio_t *zio) { - - /* - * If the device returned ENXIO, then attempt we should verify if GEOM - * provider has been removed. If this is the case, then we trigger an - * asynchronous removal of the device. - */ - if (zio->io_error == ENXIO) { - vdev_t *vd = zio->io_vd; - vdev_geom_ctx_t *ctx; - struct g_provider *pp = NULL; - - ctx = vd->vdev_tsd; - if (ctx != NULL && ctx->gc_consumer != NULL) - pp = ctx->gc_consumer->provider; - - if (pp == NULL || (pp->flags & G_PF_ORPHAN)) { - vd->vdev_remove_wanted = B_TRUE; - spa_async_request(zio->io_spa, SPA_ASYNC_REMOVE); - } - } } vdev_ops_t vdev_geom_ops = { From edwin at FreeBSD.org Wed Oct 7 21:14:46 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Wed Oct 7 21:14:52 2009 Subject: svn commit: r197847 - head/usr.bin/locale Message-ID: <200910072114.n97LEjH3099863@svn.freebsd.org> Author: edwin Date: Wed Oct 7 21:14:45 2009 New Revision: 197847 URL: http://svn.freebsd.org/changeset/base/197847 Log: Add the comment "(FreeBSD only)" to the altmonth_x keywords MFC after: 1 week Modified: head/usr.bin/locale/locale.c Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Wed Oct 7 21:05:40 2009 (r197846) +++ head/usr.bin/locale/locale.c Wed Oct 7 21:14:45 2009 (r197847) @@ -190,18 +190,18 @@ struct _kwinfo { { "abmon_10", 1, LC_TIME, ABMON_10, "" }, { "abmon_11", 1, LC_TIME, ABMON_11, "" }, { "abmon_12", 1, LC_TIME, ABMON_12, "" }, - { "altmon_1", 1, LC_TIME, ALTMON_1, "" }, - { "altmon_2", 1, LC_TIME, ALTMON_2, "" }, - { "altmon_3", 1, LC_TIME, ALTMON_3, "" }, - { "altmon_4", 1, LC_TIME, ALTMON_4, "" }, - { "altmon_5", 1, LC_TIME, ALTMON_5, "" }, - { "altmon_6", 1, LC_TIME, ALTMON_6, "" }, - { "altmon_7", 1, LC_TIME, ALTMON_7, "" }, - { "altmon_8", 1, LC_TIME, ALTMON_8, "" }, - { "altmon_9", 1, LC_TIME, ALTMON_9, "" }, - { "altmon_10", 1, LC_TIME, ALTMON_10, "" }, - { "altmon_11", 1, LC_TIME, ALTMON_11, "" }, - { "altmon_12", 1, LC_TIME, ALTMON_12, "" }, + { "altmon_1", 1, LC_TIME, ALTMON_1, "(FreeBSD only)" }, + { "altmon_2", 1, LC_TIME, ALTMON_2, "(FreeBSD only)" }, + { "altmon_3", 1, LC_TIME, ALTMON_3, "(FreeBSD only)" }, + { "altmon_4", 1, LC_TIME, ALTMON_4, "(FreeBSD only)" }, + { "altmon_5", 1, LC_TIME, ALTMON_5, "(FreeBSD only)" }, + { "altmon_6", 1, LC_TIME, ALTMON_6, "(FreeBSD only)" }, + { "altmon_7", 1, LC_TIME, ALTMON_7, "(FreeBSD only)" }, + { "altmon_8", 1, LC_TIME, ALTMON_8, "(FreeBSD only)" }, + { "altmon_9", 1, LC_TIME, ALTMON_9, "(FreeBSD only)" }, + { "altmon_10", 1, LC_TIME, ALTMON_10, "(FreeBSD only)" }, + { "altmon_11", 1, LC_TIME, ALTMON_11, "(FreeBSD only)" }, + { "altmon_12", 1, LC_TIME, ALTMON_12, "(FreeBSD only)" }, { "era", 1, LC_TIME, ERA, "(unavailable)" }, { "era_d_fmt", 1, LC_TIME, ERA_D_FMT, "(unavailable)" }, { "era_d_t_fmt", 1, LC_TIME, ERA_D_T_FMT, "(unavailable)" }, From jilles at FreeBSD.org Wed Oct 7 22:21:54 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Wed Oct 7 22:22:09 2009 Subject: svn commit: r197848 - head/bin/sh Message-ID: <200910072221.n97MLsfX001294@svn.freebsd.org> Author: jilles Date: Wed Oct 7 22:21:53 2009 New Revision: 197848 URL: http://svn.freebsd.org/changeset/base/197848 Log: Clarify quoting of word in ${v=word} in sh(1). Modified: head/bin/sh/sh.1 Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Wed Oct 7 21:14:45 2009 (r197847) +++ head/bin/sh/sh.1 Wed Oct 7 22:21:53 2009 (r197848) @@ -1227,6 +1227,9 @@ In all cases, the final value of .Ar parameter is substituted. +Quoting inside +.Ar word +does not prevent field splitting or pathname expansion. Only variables, not positional parameters or special parameters, can be assigned in this way. From delphij at FreeBSD.org Wed Oct 7 23:01:32 2009 From: delphij at FreeBSD.org (Xin LI) Date: Wed Oct 7 23:01:45 2009 Subject: svn commit: r197849 - head/tools/regression/tmpfs Message-ID: <200910072301.n97N1VI6002073@svn.freebsd.org> Author: delphij Date: Wed Oct 7 23:01:31 2009 New Revision: 197849 URL: http://svn.freebsd.org/changeset/base/197849 Log: Fix build on amd64. PR: misc/139409 Submitted by: gk Modified: head/tools/regression/tmpfs/h_tools.c Modified: head/tools/regression/tmpfs/h_tools.c ============================================================================== --- head/tools/regression/tmpfs/h_tools.c Wed Oct 7 22:21:53 2009 (r197848) +++ head/tools/regression/tmpfs/h_tools.c Wed Oct 7 23:01:31 2009 (r197849) @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -250,10 +251,10 @@ statvfs_main(int argc, char **argv) return EXIT_FAILURE; } - (void)printf("f_bsize=%llu\n", buf.f_bsize); - (void)printf("f_blocks=%llu\n", buf.f_blocks); - (void)printf("f_bfree=%llu\n", buf.f_bfree); - (void)printf("f_files=%llu\n", buf.f_files); + (void)printf("f_bsize=%ju\n", (uintmax_t)buf.f_bsize); + (void)printf("f_blocks=%ju\n", (uintmax_t)buf.f_blocks); + (void)printf("f_bfree=%ju\n", (uintmax_t)buf.f_bfree); + (void)printf("f_files=%ju\n", (uintmax_t)buf.f_files); return EXIT_SUCCESS; } From delphij at FreeBSD.org Wed Oct 7 23:17:16 2009 From: delphij at FreeBSD.org (Xin LI) Date: Wed Oct 7 23:17:28 2009 Subject: svn commit: r197850 - head/sys/fs/tmpfs Message-ID: <200910072317.n97NHFKL002393@svn.freebsd.org> Author: delphij Date: Wed Oct 7 23:17:15 2009 New Revision: 197850 URL: http://svn.freebsd.org/changeset/base/197850 Log: Add a special workaround to handle UIO_NOCOPY case. This fixes data corruption observed when sendfile() is being used. PR: kern/127213 Submitted by: gk MFC after: 2 weeks Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:01:31 2009 (r197849) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:17:15 2009 (r197850) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -428,15 +430,72 @@ tmpfs_setattr(struct vop_setattr_args *v } /* --------------------------------------------------------------------- */ +static int +tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, + vm_offset_t offset, size_t tlen, struct uio *uio) +{ + vm_page_t m; + int error; + + VM_OBJECT_LOCK(tobj); + vm_object_pip_add(tobj, 1); + m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | + VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + if (m->valid != VM_PAGE_BITS_ALL) { + if (vm_pager_has_page(tobj, idx, NULL, NULL)) { + error = vm_pager_get_pages(tobj, &m, 1, 0); + if (error != 0) { + printf("tmpfs get pages from pager error [read]\n"); + goto out; + } + } else + vm_page_zero_invalid(m, TRUE); + } + VM_OBJECT_UNLOCK(tobj); + error = uiomove_fromphys(&m, offset, tlen, uio); + VM_OBJECT_LOCK(tobj); +out: + vm_page_lock_queues(); + vm_page_unwire(m, TRUE); + vm_page_unlock_queues(); + vm_page_wakeup(m); + vm_object_pip_subtract(tobj, 1); + VM_OBJECT_UNLOCK(tobj); + + return (error); +} + +static __inline int +tmpfs_nocacheread_buf(vm_object_t tobj, vm_pindex_t idx, + vm_offset_t offset, size_t tlen, void *buf) +{ + struct uio uio; + struct iovec iov; + + uio.uio_iovcnt = 1; + uio.uio_iov = &iov; + iov.iov_base = buf; + iov.iov_len = tlen; + + uio.uio_offset = 0; + uio.uio_resid = tlen; + uio.uio_rw = UIO_READ; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_td = curthread; + + return (tmpfs_nocacheread(tobj, idx, offset, tlen, &uio)); +} static int tmpfs_mappedread(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio) { + struct sf_buf *sf; vm_pindex_t idx; vm_page_t m; vm_offset_t offset; off_t addr; size_t tlen; + char *ma; int error; addr = uio->uio_offset; @@ -461,33 +520,30 @@ lookupvpg: vm_page_wakeup(m); VM_OBJECT_UNLOCK(vobj); return (error); + } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { + if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) + goto lookupvpg; + vm_page_busy(m); + VM_OBJECT_UNLOCK(vobj); + sched_pin(); + sf = sf_buf_alloc(m, SFB_CPUPRIVATE); + ma = (char *)sf_buf_kva(sf); + error = tmpfs_nocacheread_buf(tobj, idx, offset, tlen, + ma + offset); + if (error == 0) { + uio->uio_offset += tlen; + uio->uio_resid -= tlen; + } + sf_buf_free(sf); + sched_unpin(); + VM_OBJECT_LOCK(vobj); + vm_page_wakeup(m); + VM_OBJECT_UNLOCK(vobj); + return (error); } VM_OBJECT_UNLOCK(vobj); nocache: - VM_OBJECT_LOCK(tobj); - vm_object_pip_add(tobj, 1); - m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - if (m->valid != VM_PAGE_BITS_ALL) { - if (vm_pager_has_page(tobj, idx, NULL, NULL)) { - error = vm_pager_get_pages(tobj, &m, 1, 0); - if (error != 0) { - printf("tmpfs get pages from pager error [read]\n"); - goto out; - } - } else - vm_page_zero_invalid(m, TRUE); - } - VM_OBJECT_UNLOCK(tobj); - error = uiomove_fromphys(&m, offset, tlen, uio); - VM_OBJECT_LOCK(tobj); -out: - vm_page_lock_queues(); - vm_page_unwire(m, TRUE); - vm_page_unlock_queues(); - vm_page_wakeup(m); - vm_object_pip_subtract(tobj, 1); - VM_OBJECT_UNLOCK(tobj); + error = tmpfs_nocacheread(tobj, idx, offset, tlen, uio); return (error); } From ed at FreeBSD.org Thu Oct 8 10:26:50 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Thu Oct 8 10:27:01 2009 Subject: svn commit: r197853 - head/sys/teken Message-ID: <200910081026.n98AQoEM019144@svn.freebsd.org> Author: ed Date: Thu Oct 8 10:26:49 2009 New Revision: 197853 URL: http://svn.freebsd.org/changeset/base/197853 Log: Discard Device Control Strings and Operating System Commands. These strings often contain things like: - Window titles. - Extended key map functionality. - Color palette switching. We could look at these features in the future (if people consider them to be important enough), but we'd better discard them now. This fixes some artifacts people reported when using TERM=xterm. Reported by: des@, Paul B. Mahol Modified: head/sys/teken/sequences head/sys/teken/teken.c head/sys/teken/teken_subr.h Modified: head/sys/teken/sequences ============================================================================== --- head/sys/teken/sequences Thu Oct 8 09:03:04 2009 (r197852) +++ head/sys/teken/sequences Thu Oct 8 10:26:49 2009 (r197853) @@ -88,6 +88,7 @@ ICH Insert character ^[ [ @ n IL Insert line ^[ [ L n IND Index ^[ D NEL Next line ^[ E +OSC Operating System Command ^[ ] RI Reverse index ^[ M RIS Reset to Initial State ^[ c RM Reset Mode ^[ [ l r Modified: head/sys/teken/teken.c ============================================================================== --- head/sys/teken/teken.c Thu Oct 8 09:03:04 2009 (r197852) +++ head/sys/teken/teken.c Thu Oct 8 10:26:49 2009 (r197853) @@ -56,6 +56,7 @@ static FILE *df; #define TS_WRAPPED 0x10 /* Next character should be printed on col 0. */ #define TS_8BIT 0x20 /* UTF-8 disabled. */ #define TS_CONS25 0x40 /* cons25 emulation. */ +#define TS_INSTRING 0x80 /* Inside string. */ /* Character that blanks a cell. */ #define BLANK ' ' @@ -176,6 +177,24 @@ static void teken_input_char(teken_t *t, teken_char_t c) { + /* + * There is no support for DCS and OSC. Just discard strings + * until we receive characters that may indicate string + * termination. + */ + if (t->t_stateflags & TS_INSTRING) { + switch (c) { + case '\x1B': + t->t_stateflags &= ~TS_INSTRING; + break; + case '\a': + t->t_stateflags &= ~TS_INSTRING; + return; + default: + return; + } + } + switch (c) { case '\0': break; Modified: head/sys/teken/teken_subr.h ============================================================================== --- head/sys/teken/teken_subr.h Thu Oct 8 09:03:04 2009 (r197852) +++ head/sys/teken/teken_subr.h Thu Oct 8 10:26:49 2009 (r197853) @@ -425,10 +425,11 @@ teken_subr_delete_line(teken_t *t, unsig } static void -teken_subr_device_control_string(teken_t *t __unused) +teken_subr_device_control_string(teken_t *t) { - teken_printf("device control string???\n"); + teken_printf("Unsupported device control string\n"); + t->t_stateflags |= TS_INSTRING; } static void @@ -744,6 +745,14 @@ teken_subr_next_line(teken_t *t) } static void +teken_subr_operating_system_command(teken_t *t) +{ + + teken_printf("Unsupported operating system command\n"); + t->t_stateflags |= TS_INSTRING; +} + +static void teken_subr_pan_down(teken_t *t, unsigned int nrows) { @@ -1258,7 +1267,10 @@ static void teken_subr_string_terminator(teken_t *t __unused) { - teken_printf("string terminator???\n"); + /* + * Strings are already terminated in teken_input_char() when ^[ + * is inserted. + */ } static void From rrs at FreeBSD.org Thu Oct 8 11:36:06 2009 From: rrs at FreeBSD.org (Randall Stewart) Date: Thu Oct 8 11:36:18 2009 Subject: svn commit: r197856 - head/sys/netinet Message-ID: <200910081136.n98Ba63d021725@svn.freebsd.org> Author: rrs Date: Thu Oct 8 11:36:06 2009 New Revision: 197856 URL: http://svn.freebsd.org/changeset/base/197856 Log: Fix so that round robing stream scheduling works as advertised MFC after: 0 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Thu Oct 8 11:28:32 2009 (r197855) +++ head/sys/netinet/sctp_output.c Thu Oct 8 11:36:06 2009 (r197856) @@ -5602,8 +5602,6 @@ sctp_insert_on_wheel(struct sctp_tcb *st struct sctp_association *asoc, struct sctp_stream_out *strq, int holds_lock) { - struct sctp_stream_out *stre, *strn; - if (holds_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } @@ -5612,26 +5610,7 @@ sctp_insert_on_wheel(struct sctp_tcb *st /* already on wheel */ goto outof_here; } - stre = TAILQ_FIRST(&asoc->out_wheel); - if (stre == NULL) { - /* only one on wheel */ - TAILQ_INSERT_HEAD(&asoc->out_wheel, strq, next_spoke); - goto outof_here; - } - for (; stre; stre = strn) { - strn = TAILQ_NEXT(stre, next_spoke); - if (stre->stream_no > strq->stream_no) { - TAILQ_INSERT_BEFORE(stre, strq, next_spoke); - goto outof_here; - } else if (stre->stream_no == strq->stream_no) { - /* huh, should not happen */ - goto outof_here; - } else if (strn == NULL) { - /* next one is null */ - TAILQ_INSERT_AFTER(&asoc->out_wheel, stre, strq, - next_spoke); - } - } + TAILQ_INSERT_TAIL(&asoc->out_wheel, strq, next_spoke); outof_here: if (holds_lock == 0) { SCTP_TCB_SEND_UNLOCK(stcb); @@ -7202,8 +7181,6 @@ done_it: if (strq == NULL) { strq = asoc->last_out_stream = TAILQ_FIRST(&asoc->out_wheel); } - /* Save off the last stream */ - asoc->last_out_stream = strq; return (strq); } @@ -7280,7 +7257,9 @@ sctp_fill_outqueue(struct sctp_tcb *stcb bail = 0; moved_how_much = sctp_move_to_outqueue(stcb, net, strq, goal_mtu, frag_point, &locked, &giveup, eeor_mode, &bail); - asoc->last_out_stream = strq; + if (moved_how_much) + asoc->last_out_stream = strq; + if (locked) { asoc->locked_on_sending = strq; if ((moved_how_much == 0) || (giveup) || bail) From trasz at FreeBSD.org Thu Oct 8 15:34:01 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Thu Oct 8 15:34:08 2009 Subject: svn commit: r197859 - head/cddl/contrib/opensolaris/lib/libzfs/common Message-ID: <200910081534.n98FY185026334@svn.freebsd.org> Author: trasz Date: Thu Oct 8 15:34:01 2009 New Revision: 197859 URL: http://svn.freebsd.org/changeset/base/197859 Log: 'aclmode' and 'aclinherit' properties should work as advertised; don't refuse to set them. Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Oct 8 13:57:51 2009 (r197858) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Oct 8 15:34:01 2009 (r197859) @@ -1792,8 +1792,6 @@ zfs_prop_set(zfs_handle_t *zhp, const ch switch (prop) { case ZFS_PROP_SHAREISCSI: case ZFS_PROP_DEVICES: - case ZFS_PROP_ACLMODE: - case ZFS_PROP_ACLINHERIT: case ZFS_PROP_ISCSIOPTIONS: (void) snprintf(errbuf, sizeof (errbuf), "property '%s' not supported on FreeBSD", propname); From pjd at FreeBSD.org Thu Oct 8 16:03:20 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Thu Oct 8 16:03:31 2009 Subject: svn commit: r197860 - head/sys/cddl/compat/opensolaris/kern Message-ID: <200910081603.n98G3KxV026926@svn.freebsd.org> Author: pjd Date: Thu Oct 8 16:03:19 2009 New Revision: 197860 URL: http://svn.freebsd.org/changeset/base/197860 Log: File system owner is when uid matches and jail matches. MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Thu Oct 8 15:34:01 2009 (r197859) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Thu Oct 8 16:03:19 2009 (r197860) @@ -78,12 +78,11 @@ secpolicy_fs_owner(struct mount *mp, str if (zfs_super_owner) { if (cred->cr_uid == mp->mnt_cred->cr_uid && - (!jailed(cred) || - cred->cr_prison == mp->mnt_cred->cr_prison)) { + cred->cr_prison == mp->mnt_cred->cr_prison) { return (0); } } - return (priv_check_cred(cred, PRIV_VFS_MOUNT_OWNER, 0)); + return (EPERM); } /* From pjd at FreeBSD.org Thu Oct 8 16:05:17 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Thu Oct 8 16:05:28 2009 Subject: svn commit: r197861 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910081605.n98G5HJY027001@svn.freebsd.org> Author: pjd Date: Thu Oct 8 16:05:17 2009 New Revision: 197861 URL: http://svn.freebsd.org/changeset/base/197861 Log: Allow file system owner to modify system flags if securelevel permits. MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c head/sys/cddl/compat/opensolaris/sys/policy.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Thu Oct 8 16:03:19 2009 (r197860) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Thu Oct 8 16:05:17 2009 (r197861) @@ -358,8 +358,11 @@ secpolicy_fs_mount_clearopts(cred_t *cr, * Check privileges for setting xvattr attributes */ int -secpolicy_xvattr(xvattr_t *xvap, uid_t owner, cred_t *cr, vtype_t vtype) +secpolicy_xvattr(struct vnode *vp, xvattr_t *xvap, uid_t owner, cred_t *cr, + vtype_t vtype) { + if (secpolicy_fs_owner(vp->v_mount, cr) == 0) + return (0); return (priv_check_cred(cr, PRIV_VFS_SYSFLAGS, 0)); } Modified: head/sys/cddl/compat/opensolaris/sys/policy.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/policy.h Thu Oct 8 16:03:19 2009 (r197860) +++ head/sys/cddl/compat/opensolaris/sys/policy.h Thu Oct 8 16:05:17 2009 (r197861) @@ -70,7 +70,8 @@ int secpolicy_setid_setsticky_clear(stru int secpolicy_fs_owner(struct mount *vfsp, struct ucred *cred); int secpolicy_fs_mount(cred_t *cr, vnode_t *mvp, struct mount *vfsp); void secpolicy_fs_mount_clearopts(cred_t *cr, struct mount *vfsp); -int secpolicy_xvattr(xvattr_t *xvap, uid_t owner, cred_t *cr, vtype_t vtype); +int secpolicy_xvattr(struct vnode *vp, xvattr_t *xvap, uid_t owner, + cred_t *cr, vtype_t vtype); #endif /* _KERNEL */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 8 16:03:19 2009 (r197860) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 8 16:05:17 2009 (r197861) @@ -1306,7 +1306,7 @@ zfs_create(vnode_t *dvp, char *name, vat } if (vap->va_mask & AT_XVATTR) { - if ((error = secpolicy_xvattr((xvattr_t *)vap, + if ((error = secpolicy_xvattr(dvp, (xvattr_t *)vap, crgetuid(cr), cr, vap->va_type)) != 0) { ZFS_EXIT(zfsvfs); return (error); @@ -1758,7 +1758,7 @@ zfs_mkdir(vnode_t *dvp, char *dirname, v zf |= ZCILOOK; if (vap->va_mask & AT_XVATTR) - if ((error = secpolicy_xvattr((xvattr_t *)vap, + if ((error = secpolicy_xvattr(dvp, (xvattr_t *)vap, crgetuid(cr), cr, vap->va_type)) != 0) { ZFS_EXIT(zfsvfs); return (error); @@ -4206,12 +4206,6 @@ zfs_freebsd_setattr(ap) if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_NODUMP)) != 0) return (EOPNOTSUPP); /* - * Callers may only modify the file flags on objects they - * have VADMIN rights for. - */ - if ((error = VOP_ACCESS(vp, VADMIN, cred, curthread)) != 0) - return (error); - /* * Unprivileged processes are not permitted to unset system * flags, or modify flags if any system flags are set. * Privileged non-jail processes may not modify system flags @@ -4221,14 +4215,21 @@ zfs_freebsd_setattr(ap) * is non-zero; otherwise, they behave like unprivileged * processes. */ - if (priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0) == 0) { + if (secpolicy_fs_owner(vp->v_mount, cred) == 0 || + priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0) == 0) { if (zflags & (ZFS_IMMUTABLE | ZFS_APPENDONLY | ZFS_NOUNLINK)) { error = securelevel_gt(cred, 0); - if (error) + if (error != 0) return (error); } } else { + /* + * Callers may only modify the file flags on objects they + * have VADMIN rights for. + */ + if ((error = VOP_ACCESS(vp, VADMIN, cred, curthread)) != 0) + return (error); if (zflags & (ZFS_IMMUTABLE | ZFS_APPENDONLY | ZFS_NOUNLINK)) { return (EPERM); From jkim at FreeBSD.org Thu Oct 8 17:41:54 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Oct 8 17:42:00 2009 Subject: svn commit: r197863 - head/sys/amd64/acpica Message-ID: <200910081741.n98HfrI3028811@svn.freebsd.org> Author: jkim Date: Thu Oct 8 17:41:53 2009 New Revision: 197863 URL: http://svn.freebsd.org/changeset/base/197863 Log: Clean up amd64 suspend/resume code. - Allocate memory for wakeup code after ACPI bus is attached. The early memory allocation hack was inherited from i386 but amd64 does not need it. - Exclude real mode IVT and BDA explicitly. Improve comments about memory allocation and reason for the exclusions. It is a no-op in reality, though. - Remove an unnecessary CLD from wakeup code and re-align. Modified: head/sys/amd64/acpica/acpi_machdep.c head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/acpica/acpi_wakeup.c Modified: head/sys/amd64/acpica/acpi_machdep.c ============================================================================== --- head/sys/amd64/acpica/acpi_machdep.c Thu Oct 8 17:11:01 2009 (r197862) +++ head/sys/amd64/acpica/acpi_machdep.c Thu Oct 8 17:41:53 2009 (r197863) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include #include @@ -511,7 +512,6 @@ acpi_machdep_init(device_t dev) sc->acpi_clone = apm_create_clone(sc->acpi_dev_t, sc); clone_setup(&apm_clones); EVENTHANDLER_REGISTER(dev_clone, apm_clone, 0, 1000); - acpi_install_wakeup_handler(sc); if (intr_model != ACPI_INTR_PIC) acpi_SetIntrModel(intr_model); @@ -801,13 +801,20 @@ nexus_acpi_probe(device_t dev) static int nexus_acpi_attach(device_t dev) { + device_t acpi_dev; + int error; nexus_init_resources(); bus_generic_probe(dev); - if (BUS_ADD_CHILD(dev, 10, "acpi", 0) == NULL) + acpi_dev = BUS_ADD_CHILD(dev, 10, "acpi", 0); + if (acpi_dev == NULL) panic("failed to add acpi0 device"); - return (bus_generic_attach(dev)); + error = bus_generic_attach(dev); + if (error == 0) + acpi_install_wakeup_handler(device_get_softc(acpi_dev)); + + return (error); } static device_method_t nexus_acpi_methods[] = { Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Thu Oct 8 17:11:01 2009 (r197862) +++ head/sys/amd64/acpica/acpi_wakecode.S Thu Oct 8 17:41:53 2009 (r197863) @@ -54,18 +54,17 @@ .data /* So we can modify it */ ALIGN_TEXT -wakeup_start: .code16 +wakeup_start: /* * Set up segment registers for real mode, a small stack for * any calls we make, and clear any flags. */ cli /* make sure no interrupts */ - cld mov %cs, %ax /* copy %cs to %ds. Remember these */ mov %ax, %ds /* are offsets rather than selectors */ mov %ax, %ss - movw $PAGE_SIZE - 8, %sp + movw $PAGE_SIZE, %sp xorw %ax, %ax pushw %ax popfw @@ -129,6 +128,7 @@ wakeup_sw32: /* * At this point, we are running in 32 bit legacy protected mode. */ + ALIGN_TEXT .code32 wakeup_32: Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Thu Oct 8 17:11:01 2009 (r197862) +++ head/sys/amd64/acpica/acpi_wakeup.c Thu Oct 8 17:41:53 2009 (r197863) @@ -31,13 +31,11 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include #include #include -#include #include #include @@ -46,11 +44,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef SMP #include #include +#include #endif #include @@ -63,10 +61,6 @@ __FBSDID("$FreeBSD$"); /* Make sure the code is less than a page and leave room for the stack. */ CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024); -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - extern int acpi_resume_beep; extern int acpi_reset_video; @@ -79,7 +73,7 @@ static struct xpcb *stopxpcbs; int acpi_restorecpu(struct xpcb *, vm_offset_t); int acpi_savecpu(struct xpcb *); -static void acpi_alloc_wakeup_handler(void); +static void *acpi_alloc_wakeup_handler(void); static void acpi_stop_beep(void *); #ifdef SMP @@ -322,49 +316,50 @@ out: return (ret); } -static vm_offset_t acpi_wakeaddr; - -static void +static void * acpi_alloc_wakeup_handler(void) { void *wakeaddr; - if (!cold) - return; - /* * Specify the region for our wakeup code. We want it in the low 1 MB - * region, excluding video memory and above (0xa0000). We ask for - * it to be page-aligned, just to be safe. + * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA + * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT), + * and ROM area (0xa0000 and above). The temporary page tables must be + * page-aligned. */ - wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0, 0x9ffff, - PAGE_SIZE, 0ul); + wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0x500, + 0xa0000, PAGE_SIZE, 0ul); if (wakeaddr == NULL) { printf("%s: can't alloc wake memory\n", __func__); - return; + return (NULL); } stopxpcbs = malloc(mp_ncpus * sizeof(*stopxpcbs), M_DEVBUF, M_NOWAIT); if (stopxpcbs == NULL) { contigfree(wakeaddr, 4 * PAGE_SIZE, M_DEVBUF); printf("%s: can't alloc CPU state memory\n", __func__); - return; + return (NULL); } - acpi_wakeaddr = (vm_offset_t)wakeaddr; -} -SYSINIT(acpiwakeup, SI_SUB_KMEM, SI_ORDER_ANY, acpi_alloc_wakeup_handler, 0); + return (wakeaddr); +} void acpi_install_wakeup_handler(struct acpi_softc *sc) { + static void *wakeaddr = NULL; uint64_t *pt4, *pt3, *pt2; int i; - if (acpi_wakeaddr == 0ul) + if (wakeaddr != NULL) + return; + + wakeaddr = acpi_alloc_wakeup_handler(); + if (wakeaddr == NULL) return; - sc->acpi_wakeaddr = acpi_wakeaddr; - sc->acpi_wakephys = vtophys(acpi_wakeaddr); + sc->acpi_wakeaddr = (vm_offset_t)wakeaddr; + sc->acpi_wakephys = vtophys(wakeaddr); bcopy(wakecode, (void *)WAKECODE_VADDR(sc), sizeof(wakecode)); @@ -390,7 +385,7 @@ acpi_install_wakeup_handler(struct acpi_ WAKECODE_FIXUP(wakeup_sfmask, uint64_t, rdmsr(MSR_SF_MASK)); /* Build temporary page tables below realmode code. */ - pt4 = (uint64_t *)acpi_wakeaddr; + pt4 = wakeaddr; pt3 = pt4 + (PAGE_SIZE) / sizeof(uint64_t); pt2 = pt3 + (PAGE_SIZE) / sizeof(uint64_t); From attilio at freebsd.org Thu Oct 8 18:22:57 2009 From: attilio at freebsd.org (Attilio Rao) Date: Thu Oct 8 18:23:09 2009 Subject: svn commit: r197863 - head/sys/amd64/acpica In-Reply-To: <200910081741.n98HfrI3028811@svn.freebsd.org> References: <200910081741.n98HfrI3028811@svn.freebsd.org> Message-ID: <3bbf2fe10910081122t2e23d1cep44846da4a7035227@mail.gmail.com> 2009/10/8 Jung-uk Kim : > Author: jkim > Date: Thu Oct 8 17:41:53 2009 > New Revision: 197863 > URL: http://svn.freebsd.org/changeset/base/197863 > > Log: > Clean up amd64 suspend/resume code. > @@ -322,49 +316,50 @@ out: > return (ret); > } > > -static vm_offset_t acpi_wakeaddr; > - > -static void > +static void * > acpi_alloc_wakeup_handler(void) > { > void *wakeaddr; > > - if (!cold) > - return; > - > /* > * Specify the region for our wakeup code. We want it in the low 1 MB > - * region, excluding video memory and above (0xa0000). We ask for > - * it to be page-aligned, just to be safe. > + * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA > + * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT), > + * and ROM area (0xa0000 and above). The temporary page tables must be > + * page-aligned. > */ > - wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0, 0x9ffff, > - PAGE_SIZE, 0ul); > + wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0x500, > + 0xa0000, PAGE_SIZE, 0ul); > if (wakeaddr == NULL) { > printf("%s: can't alloc wake memory\n", __func__); > - return; > + return (NULL); > } > stopxpcbs = malloc(mp_ncpus * sizeof(*stopxpcbs), M_DEVBUF, M_NOWAIT); > if (stopxpcbs == NULL) { > contigfree(wakeaddr, 4 * PAGE_SIZE, M_DEVBUF); > printf("%s: can't alloc CPU state memory\n", __func__); > - return; > + return (NULL); > } > - acpi_wakeaddr = (vm_offset_t)wakeaddr; > -} > > -SYSINIT(acpiwakeup, SI_SUB_KMEM, SI_ORDER_ANY, acpi_alloc_wakeup_handler, 0); > + return (wakeaddr); > +} > > void > acpi_install_wakeup_handler(struct acpi_softc *sc) > { > + static void *wakeaddr = NULL; > uint64_t *pt4, *pt3, *pt2; > int i; Maybe it was better to have a non-reentrat function here? Attilio -- Peace can only be achieved by understanding - A. Einstein From jkim at FreeBSD.org Thu Oct 8 18:59:31 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Oct 8 18:59:38 2009 Subject: svn commit: r197863 - head/sys/amd64/acpica In-Reply-To: <3bbf2fe10910081122t2e23d1cep44846da4a7035227@mail.gmail.com> References: <200910081741.n98HfrI3028811@svn.freebsd.org> <3bbf2fe10910081122t2e23d1cep44846da4a7035227@mail.gmail.com> Message-ID: <200910081459.22441.jkim@FreeBSD.org> 2009/10/8 Jung-uk Kim : On Thursday 08 October 2009 02:22 pm, Attilio Rao wrote: > > void > > acpi_install_wakeup_handler(struct acpi_softc *sc) > > { > > + static void *wakeaddr = NULL; > > uint64_t *pt4, *pt3, *pt2; > > int i; > > Maybe it was better to have a non-reentrat function here? It won't re-enter here because we cannot detach ACPI bus ATM. It is just a safety belt for the distant(?) future. ;-) Jung-uk Kim From trasz at FreeBSD.org Thu Oct 8 19:45:37 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Thu Oct 8 19:45:49 2009 Subject: svn commit: r197867 - head/cddl/contrib/opensolaris/lib/libzfs/common Message-ID: <200910081945.n98Jjbrd031264@svn.freebsd.org> Author: trasz Date: Thu Oct 8 19:45:37 2009 New Revision: 197867 URL: http://svn.freebsd.org/changeset/base/197867 Log: Properly mark ZFS properties which are not changeable under FreeBSD. Reviewed by: pjd Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Oct 8 18:55:12 2009 (r197866) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Oct 8 19:45:37 2009 (r197867) @@ -1790,9 +1790,14 @@ zfs_prop_set(zfs_handle_t *zhp, const ch /* We don't support those properties on FreeBSD. */ switch (prop) { - case ZFS_PROP_SHAREISCSI: case ZFS_PROP_DEVICES: + case ZFS_PROP_ZONED: + case ZFS_PROP_SHAREISCSI: case ZFS_PROP_ISCSIOPTIONS: + case ZFS_PROP_XATTR: + case ZFS_PROP_VSCAN: + case ZFS_PROP_NBMAND: + case ZFS_PROP_SHARESMB: (void) snprintf(errbuf, sizeof (errbuf), "property '%s' not supported on FreeBSD", propname); ret = zfs_error(hdl, EZFS_PERM, errbuf); From tuexen at FreeBSD.org Thu Oct 8 20:33:13 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Thu Oct 8 20:33:26 2009 Subject: svn commit: r197868 - head/sys/netinet Message-ID: <200910082033.n98KXC8O032354@svn.freebsd.org> Author: tuexen Date: Thu Oct 8 20:33:12 2009 New Revision: 197868 URL: http://svn.freebsd.org/changeset/base/197868 Log: Use correct arguments when calling SCTP_RTALLOC(). Approved by: rrs (mentor) MFC after: 0 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Thu Oct 8 19:45:37 2009 (r197867) +++ head/sys/netinet/sctp_output.c Thu Oct 8 20:33:12 2009 (r197868) @@ -3570,7 +3570,7 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_free_ifa(_lsrc); } else { ip->ip_src = over_addr->sin.sin_addr; - SCTP_RTALLOC((&ro->ro_rt), vrf_id); + SCTP_RTALLOC(ro, vrf_id); } } if (port) { @@ -3924,7 +3924,7 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_free_ifa(_lsrc); } else { lsa6->sin6_addr = over_addr->sin6.sin6_addr; - SCTP_RTALLOC((&ro->ro_rt), vrf_id); + SCTP_RTALLOC(ro, vrf_id); } (void)sa6_recoverscope(sin6); } From pjd at FreeBSD.org Fri Oct 9 09:30:00 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Fri Oct 9 09:30:11 2009 Subject: svn commit: r197896 - head/sys/cam/ata Message-ID: <200910090929.n999Txp5048391@svn.freebsd.org> Author: pjd Date: Fri Oct 9 09:29:59 2009 New Revision: 197896 URL: http://svn.freebsd.org/changeset/base/197896 Log: Export disk serial numbers for adaX disks. Reviewed by: mav MFC after: 3 days Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Fri Oct 9 09:18:22 2009 (r197895) +++ head/sys/cam/ata/ata_da.c Fri Oct 9 09:29:59 2009 (r197896) @@ -721,6 +721,8 @@ adaregister(struct cam_periph *periph, v softc->disk->d_flags = 0; if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; + strlcpy(softc->disk->d_ident, cgd->serial_num, + MIN(sizeof(softc->disk->d_ident), cgd->serial_num_len + 1)); adasetgeom(periph, cgd); softc->disk->d_sectorsize = softc->params.secsize; From pjd at FreeBSD.org Fri Oct 9 09:42:23 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Fri Oct 9 09:42:29 2009 Subject: svn commit: r197898 - in head/sys/geom: concat label part shsec stripe uzip Message-ID: <200910090942.n999gMb5048731@svn.freebsd.org> Author: pjd Date: Fri Oct 9 09:42:22 2009 New Revision: 197898 URL: http://svn.freebsd.org/changeset/base/197898 Log: If provider is open for writing when we taste it, skip it for classes that depend on on-disk metadata. This was we won't attach to providers that are used by other classes. For example we don't want to configure partitions on da0 if it is part of gmirror, what we really want is partitions on mirror/foo. During regular work it works like this: if provider is open for writing a class receives the spoiled event from GEOM and detaches, once provider is closed the taste event is send again and class can rediscover its metadata if it is still there. This doesn't work that way when new class arrives, because GEOM gives all existing providers for it to taste, also those open for writing. Classes have to decided on their own if they want to deal with such providers (eg. geom_dev) or not (classes modified by this commit). Reported by: des, Oliver Lehmann Tested by: des, Oliver Lehmann Discussed with: phk, marcel Reviewed by: marcel MFC after: 3 days Modified: head/sys/geom/concat/g_concat.c head/sys/geom/label/g_label.c head/sys/geom/part/g_part.c head/sys/geom/shsec/g_shsec.c head/sys/geom/stripe/g_stripe.c head/sys/geom/uzip/g_uzip.c Modified: head/sys/geom/concat/g_concat.c ============================================================================== --- head/sys/geom/concat/g_concat.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/concat/g_concat.c Fri Oct 9 09:42:22 2009 (r197898) @@ -599,6 +599,10 @@ g_concat_taste(struct g_class *mp, struc g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); g_topology_assert(); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + G_CONCAT_DEBUG(3, "Tasting %s.", pp->name); gp = g_new_geomf(mp, "concat:taste"); Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/label/g_label.c Fri Oct 9 09:42:22 2009 (r197898) @@ -271,6 +271,10 @@ g_label_taste(struct g_class *mp, struct G_LABEL_DEBUG(2, "Tasting %s.", pp->name); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + if (strcmp(pp->geom->class->name, mp->name) == 0) return (NULL); Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/part/g_part.c Fri Oct 9 09:42:22 2009 (r197898) @@ -1459,6 +1459,10 @@ g_part_taste(struct g_class *mp, struct G_PART_TRACE((G_T_TOPOLOGY, "%s(%s,%s)", __func__, mp->name, pp->name)); g_topology_assert(); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + /* * Create a GEOM with consumer and hook it up to the provider. * With that we become part of the topology. Optain read access Modified: head/sys/geom/shsec/g_shsec.c ============================================================================== --- head/sys/geom/shsec/g_shsec.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/shsec/g_shsec.c Fri Oct 9 09:42:22 2009 (r197898) @@ -638,6 +638,10 @@ g_shsec_taste(struct g_class *mp, struct g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); g_topology_assert(); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + G_SHSEC_DEBUG(3, "Tasting %s.", pp->name); gp = g_new_geomf(mp, "shsec:taste"); Modified: head/sys/geom/stripe/g_stripe.c ============================================================================== --- head/sys/geom/stripe/g_stripe.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/stripe/g_stripe.c Fri Oct 9 09:42:22 2009 (r197898) @@ -912,6 +912,10 @@ g_stripe_taste(struct g_class *mp, struc g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); g_topology_assert(); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + G_STRIPE_DEBUG(3, "Tasting %s.", pp->name); gp = g_new_geomf(mp, "stripe:taste"); Modified: head/sys/geom/uzip/g_uzip.c ============================================================================== --- head/sys/geom/uzip/g_uzip.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/uzip/g_uzip.c Fri Oct 9 09:42:22 2009 (r197898) @@ -363,6 +363,11 @@ g_uzip_taste(struct g_class *mp, struct g_trace(G_T_TOPOLOGY, "g_uzip_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); + + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + buf = NULL; /* From des at FreeBSD.org Fri Oct 9 09:42:58 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Fri Oct 9 09:43:04 2009 Subject: svn commit: r197899 - in head/contrib/openpam: . doc/man Message-ID: <200910090942.n999gwAG048800@svn.freebsd.org> Author: des Date: Fri Oct 9 09:42:58 2009 New Revision: 197899 URL: http://svn.freebsd.org/changeset/base/197899 Log: Merge upstream r421: grammar nit in pam.conf(5). Modified: head/contrib/openpam/ (props changed) head/contrib/openpam/doc/man/pam.conf.5 Modified: head/contrib/openpam/doc/man/pam.conf.5 ============================================================================== --- head/contrib/openpam/doc/man/pam.conf.5 Fri Oct 9 09:42:22 2009 (r197898) +++ head/contrib/openpam/doc/man/pam.conf.5 Fri Oct 9 09:42:58 2009 (r197899) @@ -109,7 +109,7 @@ will be failure regardless of the succes .It Cm requisite If this module succeeds, the result of the chain will be success unless a later module fails. -If it module fails, the chain is broken and the result is failure. +If the module fails, the chain is broken and the result is failure. .It Cm sufficient If this module succeeds, the chain is broken and the result is success. From brueffer at FreeBSD.org Fri Oct 9 10:03:42 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Fri Oct 9 10:03:48 2009 Subject: svn commit: r197900 - head/share/man/man4 Message-ID: <200910091003.n99A3gmU050168@svn.freebsd.org> Author: brueffer Date: Fri Oct 9 10:03:41 2009 New Revision: 197900 URL: http://svn.freebsd.org/changeset/base/197900 Log: Improved one-line description of this module (taken from NOTES). Modified: head/share/man/man4/lindev.4 Modified: head/share/man/man4/lindev.4 ============================================================================== --- head/share/man/man4/lindev.4 Fri Oct 9 09:42:58 2009 (r197899) +++ head/share/man/man4/lindev.4 Fri Oct 9 10:03:41 2009 (r197900) @@ -30,7 +30,7 @@ .Os .Sh NAME .Nm lindev -.Nd the lindev module +.Nd Linux-specific pseudo devices support .Sh SYNOPSIS To compile this collection of linux-specific pseudo devices into the kernel, place the following line in your kernel configuration file: From attilio at FreeBSD.org Fri Oct 9 15:51:40 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Fri Oct 9 15:51:52 2009 Subject: svn commit: r197910 - in head/sys: amd64/include i386/include Message-ID: <200910091551.n99Fpe3Z057493@svn.freebsd.org> Author: attilio Date: Fri Oct 9 15:51:40 2009 New Revision: 197910 URL: http://svn.freebsd.org/changeset/base/197910 Log: atomic_cmpset_barr_* was added in order to cope with compilers willing to specify their own version of atomic_cmpset_* which could have been different than the membar version. Right now, however, FreeBSD is bound mostly to GCC-like compilers and it is desired to add new support and compat shim mostly when there is a real necessity, in order to avoid too much compatibility bloats. In this optic, bring back atomic_cmpset_{acq, rel}_* to be the same as atomic_cmpset_* and unwind the atomic_cmpset_barr_* introduction. Requested by: jhb Reviewed by: jhb Tested by: Giovanni Trematerra Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Fri Oct 9 14:31:29 2009 (r197909) +++ head/sys/amd64/include/atomic.h Fri Oct 9 15:51:40 2009 (r197910) @@ -78,8 +78,6 @@ void atomic_##NAME##_barr_##TYPE(volatil int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); int atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src); -int atomic_cmpset_barr_int(volatile u_int *dst, u_int exp, u_int src); -int atomic_cmpset_barr_long(volatile u_long *dst, u_long exp, u_long src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); u_long atomic_fetchadd_long(volatile u_long *p, u_long v); @@ -131,33 +129,47 @@ struct __hack * Returns 0 on failure, non-zero on success */ -#define DEFINE_CMPSET_GEN(NAME, TYPE, OP) \ -static __inline int \ -atomic_cmpset_##NAME(volatile u_##TYPE *dst, u_##TYPE exp, u_##TYPE src)\ -{ \ - u_char res; \ - \ - __asm __volatile( \ - " " MPLOCKED " " \ - " " OP " %2,%1 ; " \ - " sete %0 ; " \ - "1: " \ - "# atomic_cmpset_##NAME" \ - : "=a" (res), /* 0 */ \ - "=m" (*dst) /* 1 */ \ - : "r" (src), /* 2 */ \ - "a" (exp), /* 3 */ \ - "m" (*dst) /* 4 */ \ - : "memory"); \ - \ - return (res); \ -} \ -struct __hack +static __inline int +atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " cmpxchgl %2,%1 ; " + " sete %0 ; " + "1: " + "# atomic_cmpset_int" + : "=a" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "a" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} + +static __inline int +atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src) +{ + u_char res; -DEFINE_CMPSET_GEN(int, int, "cmpxchgl"); -DEFINE_CMPSET_GEN(long, long, "cmpxchgq"); -DEFINE_CMPSET_GEN(barr_int, int, "cmpxchgl"); -DEFINE_CMPSET_GEN(barr_long, long, "cmpxchgq"); + __asm __volatile( + " " MPLOCKED " " + " cmpxchgq %2,%1 ; " + " sete %0 ; " + "1: " + "# atomic_cmpset_long" + : "=a" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "a" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} /* * Atomically add the value of v to the integer pointed to by p and return @@ -358,8 +370,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_int atomic_add_barr_int #define atomic_subtract_acq_int atomic_subtract_barr_int #define atomic_subtract_rel_int atomic_subtract_barr_int -#define atomic_cmpset_acq_int atomic_cmpset_barr_int -#define atomic_cmpset_rel_int atomic_cmpset_barr_int +#define atomic_cmpset_acq_int atomic_cmpset_int +#define atomic_cmpset_rel_int atomic_cmpset_int #define atomic_set_acq_long atomic_set_barr_long #define atomic_set_rel_long atomic_set_barr_long @@ -369,8 +381,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_long atomic_add_barr_long #define atomic_subtract_acq_long atomic_subtract_barr_long #define atomic_subtract_rel_long atomic_subtract_barr_long -#define atomic_cmpset_acq_long atomic_cmpset_barr_long -#define atomic_cmpset_rel_long atomic_cmpset_barr_long +#define atomic_cmpset_acq_long atomic_cmpset_long +#define atomic_cmpset_rel_long atomic_cmpset_long /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Fri Oct 9 14:31:29 2009 (r197909) +++ head/sys/i386/include/atomic.h Fri Oct 9 15:51:40 2009 (r197910) @@ -77,7 +77,6 @@ void atomic_##NAME##_##TYPE(volatile u_# void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); -int atomic_cmpset_barr_int(volatile u_int *dst, u_int exp, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ @@ -130,62 +129,55 @@ struct __hack #ifdef CPU_DISABLE_CMPXCHG -#define DEFINE_CMPSET_GEN(NAME) \ -static __inline int \ -atomic_cmpset_##NAME(volatile u_int *dst, u_int exp, u_int src)\ -{ \ - u_char res; \ - \ - __asm __volatile( \ - " pushfl ; " \ - " cli ; " \ - " cmpl %3,%4 ; " \ - " jne 1f ; " \ - " movl %2,%1 ; " \ - "1: " \ - " sete %0 ; " \ - " popfl ; " \ - "# atomic_cmpset_##NAME" \ - : "=q" (res), /* 0 */ \ - "=m" (*dst) /* 1 */ \ - : "r" (src), /* 2 */ \ - "r" (exp), /* 3 */ \ - "m" (*dst) /* 4 */ \ - : "memory"); \ - \ - return (res); \ -} \ -struct __hack +static __inline int +atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) +{ + u_char res; + + __asm __volatile( + " pushfl ; " + " cli ; " + " cmpl %3,%4 ; " + " jne 1f ; " + " movl %2,%1 ; " + "1: " + " sete %0 ; " + " popfl ; " + "# atomic_cmpset_int" + : "=q" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "r" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} #else /* !CPU_DISABLE_CMPXCHG */ -#define DEFINE_CMPSET_GEN(NAME) \ -static __inline int \ -atomic_cmpset_##NAME(volatile u_int *dst, u_int exp, u_int src)\ -{ \ - u_char res; \ - \ - __asm __volatile( \ - " " MPLOCKED " " \ - " cmpxchgl %2,%1 ; " \ - " sete %0 ; " \ - "1: " \ - "# atomic_cmpset_##NAME" \ - : "=a" (res), /* 0 */ \ - "=m" (*dst) /* 1 */ \ - : "r" (src), /* 2 */ \ - "a" (exp), /* 3 */ \ - "m" (*dst) /* 4 */ \ - : "memory"); \ - \ - return (res); \ -} \ -struct __hack +static __inline int +atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) +{ + u_char res; -#endif /* CPU_DISABLE_CMPXCHG */ + __asm __volatile( + " " MPLOCKED " " + " cmpxchgl %2,%1 ; " + " sete %0 ; " + "1: " + "# atomic_cmpset_int" + : "=a" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "a" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} -DEFINE_CMPSET_GEN(int); -DEFINE_CMPSET_GEN(barr_int); +#endif /* CPU_DISABLE_CMPXCHG */ /* * Atomically add the value of v to the integer pointed to by p and return @@ -307,14 +299,6 @@ atomic_cmpset_long(volatile u_long *dst, (u_int)src)); } -static __inline int -atomic_cmpset_barr_long(volatile u_long *dst, u_long exp, u_long src) -{ - - return (atomic_cmpset_barr_int((volatile u_int *)dst, (u_int)exp, - (u_int)src)); -} - static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long v) { @@ -390,8 +374,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_int atomic_add_barr_int #define atomic_subtract_acq_int atomic_subtract_barr_int #define atomic_subtract_rel_int atomic_subtract_barr_int -#define atomic_cmpset_acq_int atomic_cmpset_barr_int -#define atomic_cmpset_rel_int atomic_cmpset_barr_int +#define atomic_cmpset_acq_int atomic_cmpset_int +#define atomic_cmpset_rel_int atomic_cmpset_int #define atomic_set_acq_long atomic_set_barr_long #define atomic_set_rel_long atomic_set_barr_long @@ -401,8 +385,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_long atomic_add_barr_long #define atomic_subtract_acq_long atomic_subtract_barr_long #define atomic_subtract_rel_long atomic_subtract_barr_long -#define atomic_cmpset_acq_long atomic_cmpset_barr_long -#define atomic_cmpset_rel_long atomic_cmpset_barr_long +#define atomic_cmpset_acq_long atomic_cmpset_long +#define atomic_cmpset_rel_long atomic_cmpset_long /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char From jhb at freebsd.org Fri Oct 9 16:08:13 2009 From: jhb at freebsd.org (John Baldwin) Date: Fri Oct 9 16:08:51 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <4ACAF96C.6070204@cs.rice.edu> References: <200910041853.n94IrAf7082338@svn.freebsd.org> <4ACA0F09.2010808@FreeBSD.org> <4ACAF96C.6070204@cs.rice.edu> Message-ID: <200910091029.04442.jhb@freebsd.org> On Tuesday 06 October 2009 4:01:48 am Alan Cox wrote: > John Baldwin wrote: > > > > Do you care what is in the padding in this case or more about just > > having each mutex on a separate cache line? __aligned() is fine if > > you don't mind the padding getting reused for something else. > > > > Yes, I care. I would also like to prevent the placement of the heads of > the active, inactive, and hold queues (vm_page_queues[]) in the same > cache line as the free page queue mutex. Hmm, ok. -- John Baldwin From tuexen at FreeBSD.org Fri Oct 9 19:30:23 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Fri Oct 9 19:30:35 2009 Subject: svn commit: r197914 - head/sys/netinet Message-ID: <200910091930.n99JUNbc061867@svn.freebsd.org> Author: tuexen Date: Fri Oct 9 19:30:23 2009 New Revision: 197914 URL: http://svn.freebsd.org/changeset/base/197914 Log: Do not include vnet.h twice. Approved by: rrs (mentor) MFC after: 3 days Modified: head/sys/netinet/sctp_os_bsd.h Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Fri Oct 9 19:23:12 2009 (r197913) +++ head/sys/netinet/sctp_os_bsd.h Fri Oct 9 19:30:23 2009 (r197914) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From ota at j.email.ne.jp Fri Oct 9 20:10:25 2009 From: ota at j.email.ne.jp (Yoshihiro Ota) Date: Fri Oct 9 20:11:04 2009 Subject: svn commit: r197850 - head/sys/fs/tmpfs In-Reply-To: <200910072317.n97NHFKL002393@svn.freebsd.org> References: <200910072317.n97NHFKL002393@svn.freebsd.org> Message-ID: <20091009154924.689f21e1.ota@j.email.ne.jp> Could someone explain what was the cause and why this fixes the issue? When I read it, it looked like that a vm object could be in 2 locations and one of them looked the cause of the problem. But I couldn't figure out thereafter. Thanks, Hiro On Wed, 7 Oct 2009 23:17:15 +0000 (UTC) Xin LI wrote: > Author: delphij > Date: Wed Oct 7 23:17:15 2009 > New Revision: 197850 > URL: http://svn.freebsd.org/changeset/base/197850 > > Log: > Add a special workaround to handle UIO_NOCOPY case. This fixes data > corruption observed when sendfile() is being used. > > PR: kern/127213 > Submitted by: gk > MFC after: 2 weeks > > Modified: > head/sys/fs/tmpfs/tmpfs_vnops.c > > Modified: head/sys/fs/tmpfs/tmpfs_vnops.c > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:01:31 2009 (r197849) > +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:17:15 2009 (r197850) > @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -428,15 +430,72 @@ tmpfs_setattr(struct vop_setattr_args *v > } > > /* --------------------------------------------------------------------- */ > +static int > +tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, > + vm_offset_t offset, size_t tlen, struct uio *uio) > +{ > + vm_page_t m; > + int error; > + > + VM_OBJECT_LOCK(tobj); > + vm_object_pip_add(tobj, 1); > + m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | > + VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); > + if (m->valid != VM_PAGE_BITS_ALL) { > + if (vm_pager_has_page(tobj, idx, NULL, NULL)) { > + error = vm_pager_get_pages(tobj, &m, 1, 0); > + if (error != 0) { > + printf("tmpfs get pages from pager error [read]\n"); > + goto out; > + } > + } else > + vm_page_zero_invalid(m, TRUE); > + } > + VM_OBJECT_UNLOCK(tobj); > + error = uiomove_fromphys(&m, offset, tlen, uio); > + VM_OBJECT_LOCK(tobj); > +out: > + vm_page_lock_queues(); > + vm_page_unwire(m, TRUE); > + vm_page_unlock_queues(); > + vm_page_wakeup(m); > + vm_object_pip_subtract(tobj, 1); > + VM_OBJECT_UNLOCK(tobj); > + > + return (error); > +} > + > +static __inline int > +tmpfs_nocacheread_buf(vm_object_t tobj, vm_pindex_t idx, > + vm_offset_t offset, size_t tlen, void *buf) > +{ > + struct uio uio; > + struct iovec iov; > + > + uio.uio_iovcnt = 1; > + uio.uio_iov = &iov; > + iov.iov_base = buf; > + iov.iov_len = tlen; > + > + uio.uio_offset = 0; > + uio.uio_resid = tlen; > + uio.uio_rw = UIO_READ; > + uio.uio_segflg = UIO_SYSSPACE; > + uio.uio_td = curthread; > + > + return (tmpfs_nocacheread(tobj, idx, offset, tlen, &uio)); > +} > > static int > tmpfs_mappedread(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio) > { > + struct sf_buf *sf; > vm_pindex_t idx; > vm_page_t m; > vm_offset_t offset; > off_t addr; > size_t tlen; > + char *ma; > int error; > > addr = uio->uio_offset; > @@ -461,33 +520,30 @@ lookupvpg: > vm_page_wakeup(m); > VM_OBJECT_UNLOCK(vobj); > return (error); > + } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { > + if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) > + goto lookupvpg; > + vm_page_busy(m); > + VM_OBJECT_UNLOCK(vobj); > + sched_pin(); > + sf = sf_buf_alloc(m, SFB_CPUPRIVATE); > + ma = (char *)sf_buf_kva(sf); > + error = tmpfs_nocacheread_buf(tobj, idx, offset, tlen, > + ma + offset); > + if (error == 0) { > + uio->uio_offset += tlen; > + uio->uio_resid -= tlen; > + } > + sf_buf_free(sf); > + sched_unpin(); > + VM_OBJECT_LOCK(vobj); > + vm_page_wakeup(m); > + VM_OBJECT_UNLOCK(vobj); > + return (error); > } > VM_OBJECT_UNLOCK(vobj); > nocache: > - VM_OBJECT_LOCK(tobj); > - vm_object_pip_add(tobj, 1); > - m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | > - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); > - if (m->valid != VM_PAGE_BITS_ALL) { > - if (vm_pager_has_page(tobj, idx, NULL, NULL)) { > - error = vm_pager_get_pages(tobj, &m, 1, 0); > - if (error != 0) { > - printf("tmpfs get pages from pager error [read]\n"); > - goto out; > - } > - } else > - vm_page_zero_invalid(m, TRUE); > - } > - VM_OBJECT_UNLOCK(tobj); > - error = uiomove_fromphys(&m, offset, tlen, uio); > - VM_OBJECT_LOCK(tobj); > -out: > - vm_page_lock_queues(); > - vm_page_unwire(m, TRUE); > - vm_page_unlock_queues(); > - vm_page_wakeup(m); > - vm_object_pip_subtract(tobj, 1); > - VM_OBJECT_UNLOCK(tobj); > + error = tmpfs_nocacheread(tobj, idx, offset, tlen, uio); > > return (error); > } > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From gleb.kurtsou at gmail.com Fri Oct 9 20:59:07 2009 From: gleb.kurtsou at gmail.com (Gleb Kurtsou) Date: Fri Oct 9 20:59:19 2009 Subject: svn commit: r197850 - head/sys/fs/tmpfs In-Reply-To: <20091009154924.689f21e1.ota@j.email.ne.jp> References: <200910072317.n97NHFKL002393@svn.freebsd.org> <20091009154924.689f21e1.ota@j.email.ne.jp> Message-ID: <20091009205842.GA3808@tops> On (09/10/2009 15:49), Yoshihiro Ota wrote: > Could someone explain what was the cause and why this fixes the issue? > > When I read it, it looked like that a vm object could be in 2 locations > and one of them looked the cause of the problem. > But I couldn't figure out thereafter. kern_sendfile performs vm_page_grab which allocates a new page if not found. Then it calls VOP_READ with UIO_NOCOPY. The page itself is getting filled by bio routines, because it has no valid bits set (looks like allocbuf handles this case during buffer allocation). Both zfs and tmpfs do not use buffer management routines for io, that's why sendfile should be handled separately. There's also comment about this case in zfs: http://fxr.watson.org/fxr/source/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c?im=excerpts#L451 The patch does "real read" from swap backed storage (tobj) into that page. > > Thanks, > Hiro > > On Wed, 7 Oct 2009 23:17:15 +0000 (UTC) > Xin LI wrote: > > > Author: delphij > > Date: Wed Oct 7 23:17:15 2009 > > New Revision: 197850 > > URL: http://svn.freebsd.org/changeset/base/197850 > > > > Log: > > Add a special workaround to handle UIO_NOCOPY case. This fixes data > > corruption observed when sendfile() is being used. > > > > PR: kern/127213 > > Submitted by: gk > > MFC after: 2 weeks > > > > Modified: > > head/sys/fs/tmpfs/tmpfs_vnops.c > > > > Modified: head/sys/fs/tmpfs/tmpfs_vnops.c > > ============================================================================== > > --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:01:31 2009 (r197849) > > +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:17:15 2009 (r197850) > > @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > #include > > @@ -428,15 +430,72 @@ tmpfs_setattr(struct vop_setattr_args *v > > } > > > > /* --------------------------------------------------------------------- */ > > +static int > > +tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, > > + vm_offset_t offset, size_t tlen, struct uio *uio) > > +{ > > + vm_page_t m; > > + int error; > > + > > + VM_OBJECT_LOCK(tobj); > > + vm_object_pip_add(tobj, 1); > > + m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | > > + VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); > > + if (m->valid != VM_PAGE_BITS_ALL) { > > + if (vm_pager_has_page(tobj, idx, NULL, NULL)) { > > + error = vm_pager_get_pages(tobj, &m, 1, 0); > > + if (error != 0) { > > + printf("tmpfs get pages from pager error [read]\n"); > > + goto out; > > + } > > + } else > > + vm_page_zero_invalid(m, TRUE); > > + } > > + VM_OBJECT_UNLOCK(tobj); > > + error = uiomove_fromphys(&m, offset, tlen, uio); > > + VM_OBJECT_LOCK(tobj); > > +out: > > + vm_page_lock_queues(); > > + vm_page_unwire(m, TRUE); > > + vm_page_unlock_queues(); > > + vm_page_wakeup(m); > > + vm_object_pip_subtract(tobj, 1); > > + VM_OBJECT_UNLOCK(tobj); > > + > > + return (error); > > +} > > + > > +static __inline int > > +tmpfs_nocacheread_buf(vm_object_t tobj, vm_pindex_t idx, > > + vm_offset_t offset, size_t tlen, void *buf) > > +{ > > + struct uio uio; > > + struct iovec iov; > > + > > + uio.uio_iovcnt = 1; > > + uio.uio_iov = &iov; > > + iov.iov_base = buf; > > + iov.iov_len = tlen; > > + > > + uio.uio_offset = 0; > > + uio.uio_resid = tlen; > > + uio.uio_rw = UIO_READ; > > + uio.uio_segflg = UIO_SYSSPACE; > > + uio.uio_td = curthread; > > + > > + return (tmpfs_nocacheread(tobj, idx, offset, tlen, &uio)); > > +} > > > > static int > > tmpfs_mappedread(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio) > > { > > + struct sf_buf *sf; > > vm_pindex_t idx; > > vm_page_t m; > > vm_offset_t offset; > > off_t addr; > > size_t tlen; > > + char *ma; > > int error; > > > > addr = uio->uio_offset; > > @@ -461,33 +520,30 @@ lookupvpg: > > vm_page_wakeup(m); > > VM_OBJECT_UNLOCK(vobj); > > return (error); > > + } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { > > + if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) > > + goto lookupvpg; > > + vm_page_busy(m); > > + VM_OBJECT_UNLOCK(vobj); > > + sched_pin(); > > + sf = sf_buf_alloc(m, SFB_CPUPRIVATE); > > + ma = (char *)sf_buf_kva(sf); > > + error = tmpfs_nocacheread_buf(tobj, idx, offset, tlen, > > + ma + offset); > > + if (error == 0) { > > + uio->uio_offset += tlen; > > + uio->uio_resid -= tlen; > > + } > > + sf_buf_free(sf); > > + sched_unpin(); > > + VM_OBJECT_LOCK(vobj); > > + vm_page_wakeup(m); > > + VM_OBJECT_UNLOCK(vobj); > > + return (error); > > } > > VM_OBJECT_UNLOCK(vobj); > > nocache: > > - VM_OBJECT_LOCK(tobj); > > - vm_object_pip_add(tobj, 1); > > - m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | > > - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); > > - if (m->valid != VM_PAGE_BITS_ALL) { > > - if (vm_pager_has_page(tobj, idx, NULL, NULL)) { > > - error = vm_pager_get_pages(tobj, &m, 1, 0); > > - if (error != 0) { > > - printf("tmpfs get pages from pager error [read]\n"); > > - goto out; > > - } > > - } else > > - vm_page_zero_invalid(m, TRUE); > > - } > > - VM_OBJECT_UNLOCK(tobj); > > - error = uiomove_fromphys(&m, offset, tlen, uio); > > - VM_OBJECT_LOCK(tobj); > > -out: > > - vm_page_lock_queues(); > > - vm_page_unwire(m, TRUE); > > - vm_page_unlock_queues(); > > - vm_page_wakeup(m); > > - vm_object_pip_subtract(tobj, 1); > > - VM_OBJECT_UNLOCK(tobj); > > + error = tmpfs_nocacheread(tobj, idx, offset, tlen, uio); > > > > return (error); > > } > > _______________________________________________ > > svn-src-all@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/svn-src-all > > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From eri at FreeBSD.org Sat Oct 10 03:32:47 2009 From: eri at FreeBSD.org (Ermal Luçi) Date: Sat Oct 10 03:32:53 2009 Subject: svn commit: r197928 - head/sys/modules/pf Message-ID: <200910100332.n9A3Wkkm071801@svn.freebsd.org> Author: eri Date: Sat Oct 10 03:32:46 2009 New Revision: 197928 URL: http://svn.freebsd.org/changeset/base/197928 Log: Fix typo which has survived amazingly long! Approved by: mlaier(mentor) MFC after: 3 days Modified: head/sys/modules/pf/Makefile Modified: head/sys/modules/pf/Makefile ============================================================================== --- head/sys/modules/pf/Makefile Sat Oct 10 01:47:27 2009 (r197927) +++ head/sys/modules/pf/Makefile Sat Oct 10 03:32:46 2009 (r197928) @@ -28,7 +28,7 @@ opt_bpf.h: # pflog can be loaded as a module, have the additional checks turned on opt_pf.h: echo "#define DEV_PF 1" > ${.TARGET} - echo "#define DEF_PFLOG 1" >> ${.TARGET} + echo "#define DEV_PFLOG 1" >> ${.TARGET} .endif .include From tuexen at FreeBSD.org Sat Oct 10 13:59:19 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Sat Oct 10 13:59:25 2009 Subject: svn commit: r197929 - head/sys/netinet Message-ID: <200910101359.n9ADxJBl083948@svn.freebsd.org> Author: tuexen Date: Sat Oct 10 13:59:18 2009 New Revision: 197929 URL: http://svn.freebsd.org/changeset/base/197929 Log: Correct include order as indicated by bz. Approved by: re (mentor) MFC after: 3 days Modified: head/sys/netinet/sctp_os_bsd.h Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Sat Oct 10 03:32:46 2009 (r197928) +++ head/sys/netinet/sctp_os_bsd.h Sat Oct 10 13:59:18 2009 (r197929) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -77,8 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #ifdef IPSEC #include #include From bz at FreeBSD.org Sat Oct 10 14:10:08 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Oct 10 14:10:15 2009 Subject: svn commit: r197929 - head/sys/netinet In-Reply-To: <200910101359.n9ADxJBl083948@svn.freebsd.org> References: <200910101359.n9ADxJBl083948@svn.freebsd.org> Message-ID: <20091010140858.T5956@maildrop.int.zabbadoz.net> On Sat, 10 Oct 2009, Michael Tuexen wrote: > Author: tuexen > Date: Sat Oct 10 13:59:18 2009 > New Revision: 197929 > URL: http://svn.freebsd.org/changeset/base/197929 > > Log: > Correct include order as indicated by bz. > > Approved by: re (mentor) s,re,rrs, ? > MFC after: 3 days > > Modified: > head/sys/netinet/sctp_os_bsd.h > > Modified: head/sys/netinet/sctp_os_bsd.h > ============================================================================== > --- head/sys/netinet/sctp_os_bsd.h Sat Oct 10 03:32:46 2009 (r197928) > +++ head/sys/netinet/sctp_os_bsd.h Sat Oct 10 13:59:18 2009 (r197929) > @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > > #include > #include > @@ -77,8 +78,6 @@ __FBSDID("$FreeBSD$"); > #include > #include > > -#include > - > #ifdef IPSEC > #include > #include > -- Bjoern A. Zeeb It will not break if you know what you are doing. From kib at FreeBSD.org Sat Oct 10 14:56:35 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 14:56:54 2009 Subject: svn commit: r197930 - head/sys/kern Message-ID: <200910101456.n9AEuYIC085111@svn.freebsd.org> Author: kib Date: Sat Oct 10 14:56:34 2009 New Revision: 197930 URL: http://svn.freebsd.org/changeset/base/197930 Log: Postpone dropping fp till both kq_global and kqueue mutexes are unlocked. fdrop() closes file descriptor when reference count goes to zero. Close method for vnodes locks the vnode, resulting in "sleepable after non-sleepable". For pipes, pipe mutex is before kqueue lock, causing LOR. Reported and tested by: pho MFC after: 2 weeks Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Sat Oct 10 13:59:18 2009 (r197929) +++ head/sys/kern/kern_event.c Sat Oct 10 14:56:34 2009 (r197930) @@ -1025,13 +1025,13 @@ findkn: /* knote is in the process of changing, wait for it to stablize. */ if (kn != NULL && (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); + kq->kq_state |= KQ_FLUXWAIT; + msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqflxwt", 0); if (fp != NULL) { fdrop(fp, td); fp = NULL; } - KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); - kq->kq_state |= KQ_FLUXWAIT; - msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqflxwt", 0); goto findkn; } From tuexen at FreeBSD.org Sat Oct 10 15:27:10 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Sat Oct 10 15:27:43 2009 Subject: svn commit: r197929 - head/sys/netinet In-Reply-To: <20091010140858.T5956@maildrop.int.zabbadoz.net> References: <200910101359.n9ADxJBl083948@svn.freebsd.org> <20091010140858.T5956@maildrop.int.zabbadoz.net> Message-ID: On Oct 10, 2009, at 4:09 PM, Bjoern A. Zeeb wrote: > On Sat, 10 Oct 2009, Michael Tuexen wrote: > >> Author: tuexen >> Date: Sat Oct 10 13:59:18 2009 >> New Revision: 197929 >> URL: http://svn.freebsd.org/changeset/base/197929 >> >> Log: >> Correct include order as indicated by bz. >> >> Approved by: re (mentor) > > s,re,rrs, ? Sorry, rrs... Best regards Michael > > >> MFC after: 3 days >> >> Modified: >> head/sys/netinet/sctp_os_bsd.h >> >> Modified: head/sys/netinet/sctp_os_bsd.h >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- head/sys/netinet/sctp_os_bsd.h Sat Oct 10 03:32:46 2009 (r197928) >> +++ head/sys/netinet/sctp_os_bsd.h Sat Oct 10 13:59:18 2009 (r197929) >> @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -77,8 +78,6 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> >> -#include >> - >> #ifdef IPSEC >> #include >> #include >> > > -- > Bjoern A. Zeeb It will not break if you know what you are > doing. > From kib at FreeBSD.org Sat Oct 10 15:27:11 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 15:27:53 2009 Subject: svn commit: r197931 - head/libexec/rtld-elf Message-ID: <200910101527.n9AFRAwQ085645@svn.freebsd.org> Author: kib Date: Sat Oct 10 15:27:10 2009 New Revision: 197931 URL: http://svn.freebsd.org/changeset/base/197931 Log: Calculate relocation base for the main object, and apply the relocation adjustment for all virtual addresses encoded into the ELF structures of it. PIE binary could and should be loaded at non-zero mapbase. For sym_zero pseudosymbol used as a return value from find_symdef() for undefined weak symbols, st_value also should be adjusted, since _rtld_bind corrects symbol values by relocbase. Discussed with: bz Reviewed by: kan Tested by: bz (i386, amd64), bsam (linux) MFC after: some time Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Sat Oct 10 14:56:34 2009 (r197930) +++ head/libexec/rtld-elf/rtld.c Sat Oct 10 15:27:10 2009 (r197931) @@ -474,6 +474,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ /* Initialize a fake symbol for resolving undefined weak references. */ sym_zero.st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE); sym_zero.st_shndx = SHN_UNDEF; + sym_zero.st_value = -(uintptr_t)obj_main->relocbase; if (!libmap_disable) libmap_disable = (bool)lm_init(libmap_override); @@ -991,26 +992,26 @@ digest_phdr(const Elf_Phdr *phdr, int ph obj = obj_new(); for (ph = phdr; ph < phlimit; ph++) { - switch (ph->p_type) { + if (ph->p_type != PT_PHDR) + continue; - case PT_PHDR: - if ((const Elf_Phdr *)ph->p_vaddr != phdr) { - _rtld_error("%s: invalid PT_PHDR", path); - return NULL; - } - obj->phdr = (const Elf_Phdr *) ph->p_vaddr; - obj->phsize = ph->p_memsz; - break; + obj->phdr = phdr; + obj->phsize = ph->p_memsz; + obj->relocbase = (caddr_t)phdr - ph->p_vaddr; + break; + } + + for (ph = phdr; ph < phlimit; ph++) { + switch (ph->p_type) { case PT_INTERP: - obj->interp = (const char *) ph->p_vaddr; + obj->interp = (const char *)(ph->p_vaddr + obj->relocbase); break; case PT_LOAD: if (nsegs == 0) { /* First load segment */ obj->vaddrbase = trunc_page(ph->p_vaddr); - obj->mapbase = (caddr_t) obj->vaddrbase; - obj->relocbase = obj->mapbase - obj->vaddrbase; + obj->mapbase = obj->vaddrbase + obj->relocbase; obj->textsize = round_page(ph->p_vaddr + ph->p_memsz) - obj->vaddrbase; } else { /* Last load segment */ @@ -1021,7 +1022,7 @@ digest_phdr(const Elf_Phdr *phdr, int ph break; case PT_DYNAMIC: - obj->dynamic = (const Elf_Dyn *) ph->p_vaddr; + obj->dynamic = (const Elf_Dyn *)(ph->p_vaddr + obj->relocbase); break; case PT_TLS: @@ -1029,7 +1030,7 @@ digest_phdr(const Elf_Phdr *phdr, int ph obj->tlssize = ph->p_memsz; obj->tlsalign = ph->p_align; obj->tlsinitsize = ph->p_filesz; - obj->tlsinit = (void*) ph->p_vaddr; + obj->tlsinit = (void*)(ph->p_vaddr + obj->relocbase); break; } } From kib at FreeBSD.org Sat Oct 10 15:28:52 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 15:29:04 2009 Subject: svn commit: r197932 - head/sys/kern Message-ID: <200910101528.n9AFSqDs085710@svn.freebsd.org> Author: kib Date: Sat Oct 10 15:28:52 2009 New Revision: 197932 URL: http://svn.freebsd.org/changeset/base/197932 Log: Do not map segments of zero length. Discussed with: bz Reviewed by: kan Tested by: bz (i386, amd64), bsam (linux) MFC after: some time Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sat Oct 10 15:27:10 2009 (r197931) +++ head/sys/kern/imgact_elf.c Sat Oct 10 15:28:52 2009 (r197932) @@ -635,7 +635,8 @@ __elfN(load_file)(struct proc *p, const } for (i = 0, numsegs = 0; i < hdr->e_phnum; i++) { - if (phdr[i].p_type == PT_LOAD) { /* Loadable segment */ + if (phdr[i].p_type == PT_LOAD && phdr[i].p_memsz != 0) { + /* Loadable segment */ prot = 0; if (phdr[i].p_flags & PF_X) prot |= VM_PROT_EXECUTE; @@ -764,6 +765,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i for (i = 0; i < hdr->e_phnum; i++) { switch (phdr[i].p_type) { case PT_LOAD: /* Loadable segment */ + if (phdr[i].p_memsz == 0) + break; prot = 0; if (phdr[i].p_flags & PF_X) prot |= VM_PROT_EXECUTE; From kib at FreeBSD.org Sat Oct 10 15:31:25 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 15:31:37 2009 Subject: svn commit: r197933 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include Message-ID: <200910101531.n9AFVOLI085794@svn.freebsd.org> Author: kib Date: Sat Oct 10 15:31:24 2009 New Revision: 197933 URL: http://svn.freebsd.org/changeset/base/197933 Log: Define architectural load bases for PIE binaries. Addresses were selected by looking at the bases used for non-relocatable executables by gnu ld(1), and adjusting it slightly. Discussed with: bz Reviewed by: kan Tested by: bz (i386, amd64), bsam (linux) MFC after: some time Modified: head/sys/amd64/include/elf.h head/sys/arm/include/elf.h head/sys/i386/include/elf.h head/sys/ia64/include/elf.h head/sys/mips/include/elf.h head/sys/powerpc/include/elf.h head/sys/sparc64/include/elf.h head/sys/sun4v/include/elf.h Modified: head/sys/amd64/include/elf.h ============================================================================== --- head/sys/amd64/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/amd64/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -106,4 +106,10 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH EM_X86_64 #define ELF_TARG_VER 1 +#if __ELF_WORD_SIZE == 32 +#define ET_DYN_LOAD_ADDR 0x01001000 +#else +#define ET_DYN_LOAD_ADDR 0x01021000 +#endif + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/arm/include/elf.h ============================================================================== --- head/sys/arm/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/arm/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -97,4 +97,7 @@ __ElfType(Auxinfo); * value. */ #define MAGIC_TRAMP_NUMBER 0x5c000003 + +#define ET_DYN_LOAD_ADDR 0x12000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/i386/include/elf.h ============================================================================== --- head/sys/i386/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/i386/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -105,4 +105,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH EM_386 #define ELF_TARG_VER 1 +#define ET_DYN_LOAD_ADDR 0x01001000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/ia64/include/elf.h ============================================================================== --- head/sys/ia64/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/ia64/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -141,4 +141,6 @@ __ElfType(Auxinfo); #define DT_IA_64_PLT_RESERVE 0x70000000 +#define ET_DYN_LOAD_ADDR 0x2500000000000000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/mips/include/elf.h ============================================================================== --- head/sys/mips/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/mips/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -250,4 +250,6 @@ __ElfType(Auxinfo); #define AT_COUNT 16 /* Count of defined aux entry types. */ +#define ET_DYN_LOAD_ADDR 0x0120000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/powerpc/include/elf.h ============================================================================== --- head/sys/powerpc/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/powerpc/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -96,4 +96,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH EM_PPC #define ELF_TARG_VER 1 +#define ET_DYN_LOAD_ADDR 0x01010000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/sparc64/include/elf.h ============================================================================== --- head/sys/sparc64/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/sparc64/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -97,4 +97,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH ELF_ARCH #define ELF_TARG_VER 1 +#define ET_DYN_LOAD_ADDR 0x150000000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/sun4v/include/elf.h ============================================================================== --- head/sys/sun4v/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/sun4v/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -97,4 +97,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH ELF_ARCH #define ELF_TARG_VER 1 +#define ET_DYN_LOAD_ADDR 0x150000000 + #endif /* !_MACHINE_ELF_H_ */ From kib at FreeBSD.org Sat Oct 10 15:33:01 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 15:33:18 2009 Subject: svn commit: r197934 - head/sys/kern Message-ID: <200910101533.n9AFX1Gq085870@svn.freebsd.org> Author: kib Date: Sat Oct 10 15:33:01 2009 New Revision: 197934 URL: http://svn.freebsd.org/changeset/base/197934 Log: Map PIE binaries at non-zero base address. Discussed with: bz Reviewed by: kan Tested by: bz (i386, amd64), bsam (linux) MFC after: some time Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sat Oct 10 15:31:24 2009 (r197933) +++ head/sys/kern/imgact_elf.c Sat Oct 10 15:33:01 2009 (r197934) @@ -688,7 +688,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i u_long text_size = 0, data_size = 0, total_size = 0; u_long text_addr = 0, data_addr = 0; u_long seg_size, seg_addr; - u_long addr, entry = 0, proghdr = 0; + u_long addr, et_dyn_addr, entry = 0, proghdr = 0; int32_t osrel = 0; int error = 0, i; const char *interp = NULL, *newinterp = NULL; @@ -736,9 +736,12 @@ __CONCAT(exec_, __elfN(imgact))(struct i hdr->e_ident[EI_OSABI]); return (ENOEXEC); } - if (hdr->e_type == ET_DYN && - (brand_info->flags & BI_CAN_EXEC_DYN) == 0) - return (ENOEXEC); + if (hdr->e_type == ET_DYN) { + if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) + return (ENOEXEC); + et_dyn_addr = ET_DYN_LOAD_ADDR; + } else + et_dyn_addr = 0; sv = brand_info->sysvec; if (interp != NULL && brand_info->interp_newpath != NULL) newinterp = brand_info->interp_newpath; @@ -786,7 +789,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i if ((error = __elfN(load_section)(vmspace, imgp->object, phdr[i].p_offset, - (caddr_t)(uintptr_t)phdr[i].p_vaddr, + (caddr_t)(uintptr_t)phdr[i].p_vaddr + et_dyn_addr, phdr[i].p_memsz, phdr[i].p_filesz, prot, sv->sv_pagesize)) != 0) return (error); @@ -800,11 +803,12 @@ __CONCAT(exec_, __elfN(imgact))(struct i if (phdr[i].p_offset == 0 && hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize <= phdr[i].p_filesz) - proghdr = phdr[i].p_vaddr + hdr->e_phoff; + proghdr = phdr[i].p_vaddr + hdr->e_phoff + + et_dyn_addr; - seg_addr = trunc_page(phdr[i].p_vaddr); + seg_addr = trunc_page(phdr[i].p_vaddr + et_dyn_addr); seg_size = round_page(phdr[i].p_memsz + - phdr[i].p_vaddr - seg_addr); + phdr[i].p_vaddr + et_dyn_addr - seg_addr); /* * Is this .text or .data? We can't use @@ -826,7 +830,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i phdr[i].p_memsz)) { text_size = seg_size; text_addr = seg_addr; - entry = (u_long)hdr->e_entry; + entry = (u_long)hdr->e_entry + et_dyn_addr; } else { data_size = seg_size; data_addr = seg_addr; @@ -834,7 +838,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i total_size += seg_size; break; case PT_PHDR: /* Program header table info */ - proghdr = phdr[i].p_vaddr; + proghdr = phdr[i].p_vaddr + et_dyn_addr; break; default: break; From kib at FreeBSD.org Sat Oct 10 21:17:30 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 21:17:36 2009 Subject: svn commit: r197942 - head/sys/kern Message-ID: <200910102117.n9ALHUKW092617@svn.freebsd.org> Author: kib Date: Sat Oct 10 21:17:30 2009 New Revision: 197942 URL: http://svn.freebsd.org/changeset/base/197942 Log: Refine r195509, instead of checking that vnode type is VBAD, that is set quite late in the revocation path, properly verify that vnode is not doomed before calling VOP. Reported and tested by: Harald Schmalzbauer MFC after: 3 days Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Sat Oct 10 21:10:49 2009 (r197941) +++ head/sys/kern/kern_exit.c Sat Oct 10 21:17:30 2009 (r197942) @@ -340,10 +340,10 @@ exit1(struct thread *td, int rv) if (ttyvp != NULL) { sx_xunlock(&proctree_lock); - vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY); - if (ttyvp->v_type != VBAD) + if (vn_lock(ttyvp, LK_EXCLUSIVE) == 0) { VOP_REVOKE(ttyvp, REVOKEALL); - VOP_UNLOCK(ttyvp, 0); + VOP_UNLOCK(ttyvp, 0); + } sx_xlock(&proctree_lock); } } From trasz at FreeBSD.org Sat Oct 10 21:49:04 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sat Oct 10 21:49:17 2009 Subject: svn commit: r197945 - head/sys/dev/fdc Message-ID: <200910102149.n9ALn4Br093280@svn.freebsd.org> Author: trasz Date: Sat Oct 10 21:49:04 2009 New Revision: 197945 URL: http://svn.freebsd.org/changeset/base/197945 Log: Orphaning provider with EXDEV seems weird; perhaps the author meant ENXIO here? Modified: head/sys/dev/fdc/fdc.c Modified: head/sys/dev/fdc/fdc.c ============================================================================== --- head/sys/dev/fdc/fdc.c Sat Oct 10 21:43:04 2009 (r197944) +++ head/sys/dev/fdc/fdc.c Sat Oct 10 21:49:04 2009 (r197945) @@ -864,7 +864,7 @@ fdc_worker(struct fdc_data *fdc) fd->flags |= FD_NEWDISK; mtx_unlock(&fdc->fdc_mtx); g_topology_lock(); - g_orphan_provider(fd->fd_provider, EXDEV); + g_orphan_provider(fd->fd_provider, ENXIO); fd->fd_provider->flags |= G_PF_WITHER; fd->fd_provider = g_new_providerf(fd->fd_geom, fd->fd_geom->name); From dougb at FreeBSD.org Sat Oct 10 22:17:04 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sat Oct 10 22:17:10 2009 Subject: svn commit: r197947 - in head/etc: . rc.d Message-ID: <200910102217.n9AMH3hU093866@svn.freebsd.org> Author: dougb Date: Sat Oct 10 22:17:03 2009 New Revision: 197947 URL: http://svn.freebsd.org/changeset/base/197947 Log: In regards to the "Starting foo:" type messages at boot time, create and employ a more generic solution, and use it in the individual rc.d scripts that also have an $rc_quiet test: 1. Add check_startmsgs() to rc.subr. 2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute variations of [ -z "$rc_quiet" ] with check_startmsgs 3. In savecore add a trailing '.' to the end of the message to make it more consistent with other scripts. 4. In newsyslog remove a : before the terminal '.' since we do not expect there to be anything printed out in between to make it more consistent. 5. In the following scripts change "quotes" to 'quotes' where no variables exist in the message: savecore pf newsyslog 6. In the following scripts substitute if/then/fi for the simpler (and more consistent) check_startmsgs &&: faith stf 7. In the following scripts separate the "Starting foo:" from the terminal '.' to make them more consistent: moused hostname pf 8. In nfsclient move the message to its own line to avoid a style bug 9. In pf rc_quiet does not apply to the _stop method, so remove the test there. 10. In motd add 'quotes' around the terminal '.' for consistency Modified: head/etc/rc.d/bgfsck head/etc/rc.d/cleartmp head/etc/rc.d/faith head/etc/rc.d/fsck head/etc/rc.d/hostid head/etc/rc.d/hostname head/etc/rc.d/ldconfig head/etc/rc.d/motd head/etc/rc.d/mountcritlocal head/etc/rc.d/moused head/etc/rc.d/netif head/etc/rc.d/newsyslog head/etc/rc.d/nfsclient head/etc/rc.d/pf head/etc/rc.d/savecore head/etc/rc.d/stf head/etc/rc.subr Modified: head/etc/rc.d/bgfsck ============================================================================== --- head/etc/rc.d/bgfsck Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/bgfsck Sat Oct 10 22:17:03 2009 (r197947) @@ -31,7 +31,7 @@ bgfsck_start () bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds" fi if [ -z "${rc_force}" ]; then - [ -z "${rc_quiet}" ] && echo "${bgfsck_msg}." + check_startmsgs && echo "${bgfsck_msg}." fi (sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \ Modified: head/etc/rc.d/cleartmp ============================================================================== --- head/etc/rc.d/cleartmp Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/cleartmp Sat Oct 10 22:17:03 2009 (r197947) @@ -25,7 +25,7 @@ cleartmp_start() ${tmp}/.ICE-unix ${tmp}/.font-unix" if checkyesno ${rcvar1}; then - [ -z "${rc_quiet}" ] && echo "Clearing ${tmp}." + check_startmsgs && echo "Clearing ${tmp}." # This is not needed for mfs, but doesn't hurt anything. # Things to note: @@ -44,7 +44,7 @@ cleartmp_start() elif checkyesno clear_tmp_X; then # Remove X lock files, since they will prevent you from # restarting X. Remove other X related directories. - [ -z "${rc_quiet}" ] && echo "Clearing ${tmp} (X related)." + check_startmsgs && echo "Clearing ${tmp} (X related)." rm -rf ${tmp}/.X[0-9]-lock ${x11_socket_dirs} fi if checkyesno clear_tmp_X; then Modified: head/etc/rc.d/faith ============================================================================== --- head/etc/rc.d/faith Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/faith Sat Oct 10 22:17:03 2009 (r197947) @@ -39,9 +39,7 @@ faith_up() route change -inet6 ${prefix} -prefixlen ${prefixlen} \ -ifp faith0 done - if [ -z "${rc_quiet}" ]; then - ifconfig faith0 - fi + check_startmsgs && ifconfig faith0 ;; esac } Modified: head/etc/rc.d/fsck ============================================================================== --- head/etc/rc.d/fsck Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/fsck Sat Oct 10 22:17:03 2009 (r197947) @@ -23,7 +23,7 @@ fsck_start() # During fsck ignore SIGQUIT trap : 3 - [ -z "${rc_quiet}" ] && echo "Starting file system checks:" + check_startmsgs && echo "Starting file system checks:" if checkyesno background_fsck; then fsck -F -p else Modified: head/etc/rc.d/hostid ============================================================================== --- head/etc/rc.d/hostid Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/hostid Sat Oct 10 22:17:03 2009 (r197947) @@ -49,9 +49,9 @@ hostid_set() # Set both kern.hostuuid and kern.hostid. # - [ -z "${rc_quiet}" ] && echo "Setting hostuuid: ${uuid}." + check_startmsgs && echo "Setting hostuuid: ${uuid}." ${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null - [ -z "${rc_quiet}" ] && echo "Setting hostid: ${id}." + check_startmsgs && echo "Setting hostid: ${id}." ${SYSCTL_W} kern.hostid=${id} >/dev/null } Modified: head/etc/rc.d/hostname ============================================================================== --- head/etc/rc.d/hostname Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/hostname Sat Oct 10 22:17:03 2009 (r197947) @@ -72,8 +72,9 @@ hostname_start() # All right, it is safe to invoke hostname(1) now. # - [ -z "${rc_quiet}" ] && echo "Setting hostname: ${hostname}." + check_startmsgs && echo -n "Setting hostname: ${hostname}" /bin/hostname "${hostname}" + check_startmsgs && echo '.' } load_rc_config $name Modified: head/etc/rc.d/ldconfig ============================================================================== --- head/etc/rc.d/ldconfig Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/ldconfig Sat Oct 10 22:17:03 2009 (r197947) @@ -36,7 +36,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - [ -z "${rc_quiet}" ] && echo 'ELF ldconfig path:' ${_LDC} + check_startmsgs && echo 'ELF ldconfig path:' ${_LDC} ${ldconfig} -elf ${_ins} ${_LDC} case `sysctl -n hw.machine_arch` in @@ -55,7 +55,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - [ -z "${rc_quiet}" ] && + check_startmsgs && echo '32-bit compatibility ldconfig path:' ${_LDC} ${ldconfig} -32 -m ${_ins} ${_LDC} ;; @@ -72,8 +72,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - [ -z "${rc_quiet}" ] && - echo 'a.out ldconfig path:' ${_LDC} + check_startmsgs && echo 'a.out ldconfig path:' ${_LDC} ${ldconfig} -aout ${_ins} ${_LDC} ;; esac Modified: head/etc/rc.d/motd ============================================================================== --- head/etc/rc.d/motd Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/motd Sat Oct 10 22:17:03 2009 (r197947) @@ -22,7 +22,7 @@ motd_start() # Must be done *before* interactive logins are possible # to prevent possible race conditions. # - [ -z "${rc_quiet}" ] && echo -n 'Updating motd:' + check_startmsgs && echo -n 'Updating motd:' if [ ! -f /etc/motd ]; then install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd fi @@ -42,7 +42,7 @@ motd_start() } rm -f $T - [ -z "${rc_quiet}" ] && echo . + check_startmsgs && echo '.' } load_rc_config $name Modified: head/etc/rc.d/mountcritlocal ============================================================================== --- head/etc/rc.d/mountcritlocal Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/mountcritlocal Sat Oct 10 22:17:03 2009 (r197947) @@ -28,7 +28,7 @@ mountcritlocal_start() esac # Mount everything except nfs filesystems. - [ -z "${rc_quiet}" ] && echo -n 'Mounting local file systems:' + check_startmsgs && echo -n 'Mounting local file systems:' mount_excludes='no' for i in ${netfs_types}; do fstype=${i%:*} @@ -37,7 +37,7 @@ mountcritlocal_start() mount_excludes=${mount_excludes%,} mount -a -t ${mount_excludes} err=$? - [ -z "${rc_quiet}" ] && echo '.' + check_startmsgs && echo '.' case ${err} in 0) Modified: head/etc/rc.d/moused ============================================================================== --- head/etc/rc.d/moused Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/moused Sat Oct 10 22:17:03 2009 (r197947) @@ -51,8 +51,9 @@ moused_start() mytype="$moused_type" fi - [ -z "${rc_quiet}" ] && echo -n "Starting ${ms} moused." + check_startmsgs && echo -n "Starting ${ms} moused" /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg} + check_startmsgs && echo '.' mousechar_arg= case ${mousechar_start} in Modified: head/etc/rc.d/netif ============================================================================== --- head/etc/rc.d/netif Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/netif Sat Oct 10 22:17:03 2009 (r197947) @@ -143,7 +143,7 @@ network_common() ;; esac echo "${_str} Network:${_ok}." - if [ -z "${rc_quiet}" ]; then + if check_startmsgs; then for ifn in ${_ok}; do /sbin/ifconfig ${ifn} done Modified: head/etc/rc.d/newsyslog ============================================================================== --- head/etc/rc.d/newsyslog Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/newsyslog Sat Oct 10 22:17:03 2009 (r197947) @@ -17,9 +17,9 @@ stop_cmd=":" newsyslog_start() { - [ -z "${rc_quiet}" ] && echo -n "Creating and/or trimming log files:" + check_startmsgs && echo -n 'Creating and/or trimming log files' ${command} ${rc_flags} - [ -z "${rc_quiet}" ] && echo "." + check_startmsgs && echo '.' } load_rc_config $name Modified: head/etc/rc.d/nfsclient ============================================================================== --- head/etc/rc.d/nfsclient Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/nfsclient Sat Oct 10 22:17:03 2009 (r197947) @@ -22,7 +22,8 @@ nfsclient_start() # if [ -n "${nfs_access_cache}" ]; then - [ -z "${rc_quiet}" ] && echo "NFS access cache time=${nfs_access_cache}" + check_startmsgs && + echo "NFS access cache time=${nfs_access_cache}" if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then warn "failed to set access cache timeout" fi Modified: head/etc/rc.d/pf ============================================================================== --- head/etc/rc.d/pf Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/pf Sat Oct 10 22:17:03 2009 (r197947) @@ -25,19 +25,21 @@ required_modules="pf" pf_start() { - [ -z "${rc_quiet}" ] && echo "Enabling pf." + check_startmsgs && echo -n 'Enabling pf' $pf_program -F all > /dev/null 2>&1 $pf_program -f "$pf_rules" $pf_flags if ! $pf_program -s info | grep -q "Enabled" ; then $pf_program -e fi + check_startmsgs && echo '.' } pf_stop() { if $pf_program -s info | grep -q "Enabled" ; then - [ -z "${rc_quiet}" ] && echo "Disabling pf." + echo -n 'Disabling pf' $pf_program -d + echo '.' fi } Modified: head/etc/rc.d/savecore ============================================================================== --- head/etc/rc.d/savecore Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/savecore Sat Oct 10 22:17:03 2009 (r197947) @@ -69,7 +69,7 @@ savecore_start() ${crashinfo_program} -d ${dumpdir} fi else - [ -z "${rc_quiet}" ] && echo "No core dumps found" + check_startmsgs && echo 'No core dumps found.' fi } Modified: head/etc/rc.d/stf ============================================================================== --- head/etc/rc.d/stf Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/stf Sat Oct 10 22:17:03 2009 (r197947) @@ -53,9 +53,8 @@ stf_up() ifconfig stf0 create >/dev/null 2>&1 ifconfig stf0 inet6 2002:${ipv4_in_hexformat}:${stf_interface_ipv6_slaid:-0}:${stf_interface_ipv6_ifid} \ prefixlen ${stf_prefixlen} - if [ -z "${rc_quiet}" ]; then - /sbin/ifconfig stf0 - fi + check_startmsgs && /sbin/ifconfig stf0 + # disallow packets to malicious 6to4 prefix route add -inet6 2002:e000:: -prefixlen 20 ::1 -reject route add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.subr Sat Oct 10 22:17:03 2009 (r197947) @@ -398,6 +398,20 @@ wait_for_pids() } # +# check_startmsgs +# If rc_quiet is set (usually as a result of using faststart at +# boot time) check if rc_startmsgs is enabled. +# +check_startmsgs() +{ + if [ -n "$rc_quiet" ]; then + checkyesno rc_startmsgs + else + return 0 + fi +} + +# # run_rc_command argument # Search for argument in the list of supported commands, which is: # "start stop restart rcvar status poll ${extra_commands}" @@ -708,13 +722,7 @@ run_rc_command() # setup the full command to run # - _show_startmsgs=1 - if [ -n "${rc_quiet}" ]; then - if ! checkyesno rc_startmsgs; then - unset _show_startmsgs - fi - fi - [ -n "$_show_startmsgs" ] && echo "Starting ${name}." + check_startmsgs && echo "Starting ${name}." if [ -n "$_chroot" ]; then _doit="\ ${_nice:+nice -n $_nice }\ From rpaulo at FreeBSD.org Sat Oct 10 22:29:34 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sat Oct 10 22:29:47 2009 Subject: svn commit: r197948 - head/sys/dev/ath/ath_hal Message-ID: <200910102229.n9AMTYoQ094207@svn.freebsd.org> Author: rpaulo Date: Sat Oct 10 22:29:34 2009 New Revision: 197948 URL: http://svn.freebsd.org/changeset/base/197948 Log: Atheros EEPROM version 4K. This version is mostly based on version 1.4. This is needed by the upcoming AR9285 support. Information on the layout gathered from Linux ath9k. Not yet connected to the build. Tested by: Eugeny Dzhurinsky Added: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c (contents, props changed) head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h (contents, props changed) Added: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Sat Oct 10 22:29:34 2009 (r197948) @@ -0,0 +1,404 @@ +/* + * Copyright (c) 2009 Rui Paulo + * Copyright (c) 2008 Sam Leffler, Errno Consulting + * Copyright (c) 2008 Atheros Communications, Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ +#include "opt_ah.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ah_eeprom_v14.h" +#include "ah_eeprom_v4k.h" + +static HAL_STATUS +v4kEepromGet(struct ath_hal *ah, int param, void *val) +{ +#define CHAN_A_IDX 0 +#define CHAN_B_IDX 1 +#define IS_VERS(op, v) ((pBase->version & AR5416_EEP_VER_MINOR_MASK) op (v)) + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader; + const BASE_EEP4K_HEADER *pBase = &ee->ee_base.baseEepHeader; + uint32_t sum; + uint8_t *macaddr; + int i; + + switch (param) { + case AR_EEP_NFTHRESH_5: + *(int16_t *)val = pModal[0].noiseFloorThreshCh[0]; + return HAL_OK; + case AR_EEP_NFTHRESH_2: + *(int16_t *)val = pModal[1].noiseFloorThreshCh[0]; + return HAL_OK; + case AR_EEP_MACADDR: /* Get MAC Address */ + sum = 0; + macaddr = val; + for (i = 0; i < 6; i++) { + macaddr[i] = pBase->macAddr[i]; + sum += pBase->macAddr[i]; + } + if (sum == 0 || sum == 0xffff*3) { + HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad mac address %s\n", + __func__, ath_hal_ether_sprintf(macaddr)); + return HAL_EEBADMAC; + } + return HAL_OK; + case AR_EEP_REGDMN_0: + return pBase->regDmn[0]; + case AR_EEP_REGDMN_1: + return pBase->regDmn[1]; + case AR_EEP_OPCAP: + return pBase->deviceCap; + case AR_EEP_OPMODE: + return pBase->opCapFlags; + case AR_EEP_RFSILENT: + return pBase->rfSilent; + case AR_EEP_OB_5: + return pModal[CHAN_A_IDX].ob; + case AR_EEP_DB_5: + return pModal[CHAN_A_IDX].db; + case AR_EEP_OB_2: + return pModal[CHAN_B_IDX].ob; + case AR_EEP_DB_2: + return pModal[CHAN_B_IDX].db; + case AR_EEP_TXMASK: + return pBase->txMask; + case AR_EEP_RXMASK: + return pBase->rxMask; + case AR_EEP_RXGAIN_TYPE: + return AR5416_EEP_RXGAIN_ORIG; + case AR_EEP_TXGAIN_TYPE: + return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ? + pBase->txGainType : AR5416_EEP_TXGAIN_ORIG; +#if 0 + case AR_EEP_OL_PWRCTRL: + HALASSERT(val == AH_NULL); + return pBase->openLoopPwrCntl ? HAL_OK : HAL_EIO; +#endif + case AR_EEP_AMODE: + HALASSERT(val == AH_NULL); + return pBase->opCapFlags & AR5416_OPFLAGS_11A ? + HAL_OK : HAL_EIO; + case AR_EEP_BMODE: + case AR_EEP_GMODE: + HALASSERT(val == AH_NULL); + return pBase->opCapFlags & AR5416_OPFLAGS_11G ? + HAL_OK : HAL_EIO; + case AR_EEP_32KHZCRYSTAL: + case AR_EEP_COMPRESS: + case AR_EEP_FASTFRAME: /* XXX policy decision, h/w can do it */ + case AR_EEP_WRITEPROTECT: /* NB: no write protect bit */ + HALASSERT(val == AH_NULL); + /* fall thru... */ + case AR_EEP_MAXQCU: /* NB: not in opCapFlags */ + case AR_EEP_KCENTRIES: /* NB: not in opCapFlags */ + return HAL_EIO; + case AR_EEP_AES: + case AR_EEP_BURST: + case AR_EEP_RFKILL: + case AR_EEP_TURBO5DISABLE: + case AR_EEP_TURBO2DISABLE: + HALASSERT(val == AH_NULL); + return HAL_OK; + case AR_EEP_ANTGAINMAX_2: + *(int8_t *) val = ee->ee_antennaGainMax[1]; + return HAL_OK; + case AR_EEP_ANTGAINMAX_5: + *(int8_t *) val = ee->ee_antennaGainMax[0]; + return HAL_OK; + default: + HALASSERT(0); + return HAL_EINVAL; + } +#undef IS_VERS +#undef CHAN_A_IDX +#undef CHAN_B_IDX +} + +static HAL_BOOL +v4kEepromSet(struct ath_hal *ah, int param, int v) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (param) { + case AR_EEP_ANTGAINMAX_2: + ee->ee_antennaGainMax[1] = (int8_t) v; + return HAL_OK; + case AR_EEP_ANTGAINMAX_5: + ee->ee_antennaGainMax[0] = (int8_t) v; + return HAL_OK; + } + return HAL_EINVAL; +} + +static HAL_BOOL +v4kEepromDiag(struct ath_hal *ah, int request, + const void *args, uint32_t argsize, void **result, uint32_t *resultsize) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (request) { + case HAL_DIAG_EEPROM: + *result = &ee->ee_base; + *resultsize = sizeof(ee->ee_base); + return AH_TRUE; + } + return AH_FALSE; +} + +/* Do structure specific swaps if Eeprom format is non native to host */ +static void +eepromSwap(struct ar5416eeprom_4k *ee) +{ + uint32_t integer, i; + uint16_t word; + MODAL_EEP4K_HEADER *pModal; + + /* convert Base Eep header */ + word = __bswap16(ee->baseEepHeader.length); + ee->baseEepHeader.length = word; + + word = __bswap16(ee->baseEepHeader.checksum); + ee->baseEepHeader.checksum = word; + + word = __bswap16(ee->baseEepHeader.version); + ee->baseEepHeader.version = word; + + word = __bswap16(ee->baseEepHeader.regDmn[0]); + ee->baseEepHeader.regDmn[0] = word; + + word = __bswap16(ee->baseEepHeader.regDmn[1]); + ee->baseEepHeader.regDmn[1] = word; + + word = __bswap16(ee->baseEepHeader.rfSilent); + ee->baseEepHeader.rfSilent = word; + + word = __bswap16(ee->baseEepHeader.blueToothOptions); + ee->baseEepHeader.blueToothOptions = word; + + word = __bswap16(ee->baseEepHeader.deviceCap); + ee->baseEepHeader.deviceCap = word; + + /* convert Modal Eep header */ + pModal = &ee->modalHeader; + + /* XXX linux/ah_osdep.h only defines __bswap32 for BE */ + integer = __bswap32(pModal->antCtrlCommon); + pModal->antCtrlCommon = integer; + + for (i = 0; i < AR5416_4K_MAX_CHAINS; i++) { + integer = __bswap32(pModal->antCtrlChain[i]); + pModal->antCtrlChain[i] = integer; + } + + for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) { + word = __bswap16(pModal->spurChans[i].spurChan); + pModal->spurChans[i].spurChan = word; + } +} + +static uint16_t +v4kEepromGetSpurChan(struct ath_hal *ah, int ix, HAL_BOOL is2GHz) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + HALASSERT(0 <= ix && ix < AR5416_EEPROM_MODAL_SPURS); + HALASSERT(is2GHz); + return ee->ee_base.modalHeader.spurChans[ix].spurChan; +} + +/************************************************************************** + * fbin2freq + * + * Get channel value from binary representation held in eeprom + * RETURNS: the frequency in MHz + */ +static uint16_t +fbin2freq(uint8_t fbin, HAL_BOOL is2GHz) +{ + /* + * Reserved value 0xFF provides an empty definition both as + * an fbin and as a frequency - do not convert + */ + if (fbin == AR5416_BCHAN_UNUSED) + return fbin; + return (uint16_t)((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin)); +} + +/* + * Copy EEPROM Conformance Testing Limits contents + * into the allocated space + */ +/* USE CTLS from chain zero */ +#define CTL_CHAIN 0 + +static void +v4kEepromReadCTLInfo(struct ath_hal *ah, HAL_EEPROM_v4k *ee) +{ + RD_EDGES_POWER *rep = ee->ee_rdEdgesPower; + int i, j; + + HALASSERT(AR5416_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES); + + for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR5416_4K_NUM_CTLS; i++) { + for (j = 0; j < NUM_EDGES; j ++) { + /* XXX Confirm this is the right thing to do when an invalid channel is stored */ + if (ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel == AR5416_BCHAN_UNUSED) { + rep[j].rdEdge = 0; + rep[j].twice_rdEdgePower = 0; + rep[j].flag = 0; + } else { + rep[j].rdEdge = fbin2freq( + ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel, + (ee->ee_base.ctlIndex[i] & CTL_MODE_M) != CTL_11A); + rep[j].twice_rdEdgePower = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_POWER); + rep[j].flag = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_FLAG) != 0; + } + } + rep += NUM_EDGES; + } + ee->ee_numCtls = i; + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "%s Numctls = %u\n",__func__,i); +} + +/* + * Reclaim any EEPROM-related storage. + */ +static void +v4kEepromDetach(struct ath_hal *ah) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + ath_hal_free(ee); + AH_PRIVATE(ah)->ah_eeprom = AH_NULL; +} + +#define owl_get_eep_ver(_ee) \ + (((_ee)->ee_base.baseEepHeader.version >> 12) & 0xF) +#define owl_get_eep_rev(_ee) \ + (((_ee)->ee_base.baseEepHeader.version) & 0xFFF) + +HAL_STATUS +ath_hal_v4kEepromAttach(struct ath_hal *ah) +{ +#define NW(a) (sizeof(a) / sizeof(uint16_t)) + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + uint16_t *eep_data, magic; + HAL_BOOL need_swap; + u_int w, off, len; + uint32_t sum; + + HALASSERT(ee == AH_NULL); + + if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s Error reading Eeprom MAGIC\n", __func__); + return HAL_EEREAD; + } + HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n", + __func__, magic); + if (magic != AR5416_EEPROM_MAGIC) { + HALDEBUG(ah, HAL_DEBUG_ANY, "Bad magic number\n"); + return HAL_EEMAGIC; + } + + ee = ath_hal_malloc(sizeof(HAL_EEPROM_v4k)); + if (ee == AH_NULL) { + /* XXX message */ + return HAL_ENOMEM; + } + + eep_data = (uint16_t *)&ee->ee_base; + for (w = 0; w < NW(struct ar5416eeprom_4k); w++) { + off = owl_eep_start_loc + w; /* NB: AP71 starts at 0 */ + if (!ath_hal_eepromRead(ah, off, &eep_data[w])) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s eeprom read error at offset 0x%x\n", + __func__, off); + return HAL_EEREAD; + } + } + /* Convert to eeprom native eeprom endian format */ + if (isBigEndian()) { + for (w = 0; w < NW(struct ar5416eeprom_4k); w++) + eep_data[w] = __bswap16(eep_data[w]); + } + + /* + * At this point, we're in the native eeprom endian format + * Now, determine the eeprom endian by looking at byte 26?? + */ + need_swap = ((ee->ee_base.baseEepHeader.eepMisc & AR5416_EEPMISC_BIG_ENDIAN) != 0) ^ isBigEndian(); + if (need_swap) { + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "Byte swap EEPROM contents.\n"); + len = __bswap16(ee->ee_base.baseEepHeader.length); + } else { + len = ee->ee_base.baseEepHeader.length; + } + len = AH_MIN(len, sizeof(struct ar5416eeprom_4k)) / sizeof(uint16_t); + + /* Apply the checksum, done in native eeprom format */ + /* XXX - Need to check to make sure checksum calculation is done + * in the correct endian format. Right now, it seems it would + * cast the raw data to host format and do the calculation, which may + * not be correct as the calculation may need to be done in the native + * eeprom format + */ + sum = 0; + for (w = 0; w < len; w++) { + sum ^= eep_data[w]; + } + /* Check CRC - Attach should fail on a bad checksum */ + if (sum != 0xffff) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "Bad EEPROM checksum 0x%x (Len=%u)\n", sum, len); + return HAL_EEBADSUM; + } + + if (need_swap) + eepromSwap(&ee->ee_base); /* byte swap multi-byte data */ + + /* swap words 0+2 so version is at the front */ + magic = eep_data[0]; + eep_data[0] = eep_data[2]; + eep_data[2] = magic; + + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "%s Eeprom Version %u.%u\n", __func__, + owl_get_eep_ver(ee), owl_get_eep_rev(ee)); + + /* NB: must be after all byte swapping */ + if (owl_get_eep_ver(ee) != AR5416_EEP_VER) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "Bad EEPROM version 0x%x\n", owl_get_eep_ver(ee)); + return HAL_EEBADSUM; + } + + v4kEepromReadCTLInfo(ah, ee); /* Get CTLs */ + + AH_PRIVATE(ah)->ah_eeprom = ee; + AH_PRIVATE(ah)->ah_eeversion = ee->ee_base.baseEepHeader.version; + AH_PRIVATE(ah)->ah_eepromDetach = v4kEepromDetach; + AH_PRIVATE(ah)->ah_eepromGet = v4kEepromGet; + AH_PRIVATE(ah)->ah_eepromSet = v4kEepromSet; + AH_PRIVATE(ah)->ah_getSpurChan = v4kEepromGetSpurChan; + AH_PRIVATE(ah)->ah_eepromDiag = v4kEepromDiag; + return HAL_OK; +#undef NW +} Added: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h Sat Oct 10 22:29:34 2009 (r197948) @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2009 Rui Paulo + * Copyright (c) 2008 Sam Leffler, Errno Consulting + * Copyright (c) 2008 Atheros Communications, Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ +#ifndef _AH_EEPROM_V4K_H_ +#define _AH_EEPROM_V4K_H_ + +#include "ah_eeprom.h" +#include "ah_eeprom_v14.h" + +#undef owl_eep_start_loc +#ifdef __LINUX_ARM_ARCH__ /* AP71 */ +#define owl_eep_start_loc 0 +#else +#define owl_eep_start_loc 64 +#endif + +// 16-bit offset location start of calibration struct +#define AR5416_4K_EEP_START_LOC 64 +#define AR5416_4K_NUM_2G_CAL_PIERS 3 +#define AR5416_4K_NUM_2G_CCK_TARGET_POWERS 3 +#define AR5416_4K_NUM_2G_20_TARGET_POWERS 3 +#define AR5416_4K_NUM_2G_40_TARGET_POWERS 3 +#define AR5416_4K_NUM_CTLS 12 +#define AR5416_4K_NUM_BAND_EDGES 4 +#define AR5416_4K_NUM_PD_GAINS 2 +#define AR5416_4K_PD_GAINS_IN_MASK 4 +#define AR5416_4K_PD_GAIN_ICEPTS 5 +#define AR5416_4K_MAX_CHAINS 1 + +/* + * NB: The format in EEPROM has words 0 and 2 swapped (i.e. version + * and length are swapped). We reverse their position after reading + * the data into host memory so the version field is at the same + * offset as in previous EEPROM layouts. This makes utilities that + * inspect the EEPROM contents work without looking at the PCI device + * id which may or may not be reliable. + */ +typedef struct BaseEepHeader4k { + uint16_t version; /* NB: length in EEPROM */ + uint16_t checksum; + uint16_t length; /* NB: version in EEPROM */ + uint8_t opCapFlags; + uint8_t eepMisc; + uint16_t regDmn[2]; + uint8_t macAddr[6]; + uint8_t rxMask; + uint8_t txMask; + uint16_t rfSilent; + uint16_t blueToothOptions; + uint16_t deviceCap; + uint32_t binBuildNumber; + uint8_t deviceType; + uint8_t txGainType; /* high power tx gain table support */ +} __packed BASE_EEP4K_HEADER; // 32 B + +typedef struct ModalEepHeader4k { + uint32_t antCtrlChain[AR5416_4K_MAX_CHAINS]; // 12 + uint32_t antCtrlCommon; // 4 + int8_t antennaGainCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t switchSettling; // 1 + uint8_t txRxAttenCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t rxTxMarginCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t adcDesiredSize; // 1 + int8_t pgaDesiredSize; // 1 + uint8_t xlnaGainCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t txEndToXpaOff; // 1 + uint8_t txEndToRxOn; // 1 + uint8_t txFrameToXpaOn; // 1 + uint8_t thresh62; // 1 + uint8_t noiseFloorThreshCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t xpdGain; // 1 + uint8_t xpd; // 1 + int8_t iqCalICh[AR5416_4K_MAX_CHAINS]; // 1 + int8_t iqCalQCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t pdGainOverlap; // 1 + uint8_t ob; // 1 + uint8_t db; // 1 + uint8_t xpaBiasLvl; // 1 +#if 0 + uint8_t pwrDecreaseFor2Chain; // 1 + uint8_t pwrDecreaseFor3Chain; // 1 -> 48 B +#endif + uint8_t txFrameToDataStart; // 1 + uint8_t txFrameToPaOn; // 1 + uint8_t ht40PowerIncForPdadc; // 1 + uint8_t bswAtten[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t bswMargin[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t swSettleHt40; // 1 + uint8_t xatten2Db[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t xatten2Margin[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t ob_ch1; // 1 -> ob and db become chain specific from AR9280 + uint8_t db_ch1; // 1 + uint8_t flagBits; // 1 +#define AR5416_EEP_FLAG_USEANT1 0x01 /* +1 configured antenna */ +#define AR5416_EEP_FLAG_FORCEXPAON 0x02 /* force XPA bit for 5G */ +#define AR5416_EEP_FLAG_LOCALBIAS 0x04 /* enable local bias */ +#define AR5416_EEP_FLAG_FEMBANDSELECT 0x08 /* FEM band select used */ +#define AR5416_EEP_FLAG_XLNABUFIN 0x10 +#define AR5416_EEP_FLAG_XLNAISEL 0x60 +#define AR5416_EEP_FLAG_XLNAISEL_S 5 +#define AR5416_EEP_FLAG_XLNABUFMODE 0x80 + uint8_t miscBits; // [0..1]: bb_tx_dac_scale_cck + uint16_t xpaBiasLvlFreq[3]; // 6 + uint8_t futureModal[2]; // 2 + + SPUR_CHAN spurChans[AR5416_EEPROM_MODAL_SPURS]; // 20 B +} __packed MODAL_EEP4K_HEADER; // == 68 B + +typedef struct CalCtlData4k { + CAL_CTL_EDGES ctlEdges[AR5416_4K_MAX_CHAINS][AR5416_4K_NUM_BAND_EDGES]; +} __packed CAL_CTL_DATA_4K; + +typedef struct calDataPerFreq4k { + uint8_t pwrPdg[AR5416_4K_NUM_PD_GAINS][AR5416_4K_PD_GAIN_ICEPTS]; + uint8_t vpdPdg[AR5416_4K_NUM_PD_GAINS][AR5416_4K_PD_GAIN_ICEPTS]; +} __packed CAL_DATA_PER_FREQ_4K; + +struct ar5416eeprom_4k { + BASE_EEP4K_HEADER baseEepHeader; // 32 B + uint8_t custData[20]; // 20 B + MODAL_EEP4K_HEADER modalHeader; // 68 B + uint8_t calFreqPier2G[AR5416_4K_NUM_2G_CAL_PIERS]; + CAL_DATA_PER_FREQ_4K calPierData2G[AR5416_4K_MAX_CHAINS][AR5416_4K_NUM_2G_CAL_PIERS]; + CAL_TARGET_POWER_LEG calTargetPowerCck[AR5416_4K_NUM_2G_CCK_TARGET_POWERS]; + CAL_TARGET_POWER_LEG calTargetPower2G[AR5416_4K_NUM_2G_20_TARGET_POWERS]; + CAL_TARGET_POWER_HT calTargetPower2GHT20[AR5416_4K_NUM_2G_20_TARGET_POWERS]; + CAL_TARGET_POWER_HT calTargetPower2GHT40[AR5416_4K_NUM_2G_40_TARGET_POWERS]; + uint8_t ctlIndex[AR5416_4K_NUM_CTLS]; + CAL_CTL_DATA_4K ctlData[AR5416_4K_NUM_CTLS]; + uint8_t padding; +} __packed; + +typedef struct { + struct ar5416eeprom_4k ee_base; +#define NUM_EDGES 8 + uint16_t ee_numCtls; + RD_EDGES_POWER ee_rdEdgesPower[NUM_EDGES*AR5416_4K_NUM_CTLS]; + /* XXX these are dynamically calculated for use by shared code */ + int8_t ee_antennaGainMax[2]; +} HAL_EEPROM_v4k; +#endif /* _AH_EEPROM_V4K_H_ */ From das at FreeBSD.org Sun Oct 11 00:08:55 2009 From: das at FreeBSD.org (David Schultz) Date: Sun Oct 11 00:09:02 2009 Subject: svn commit: r197949 - head/lib/libc/sys Message-ID: <200910110008.n9B08tQc095922@svn.freebsd.org> Author: das Date: Sun Oct 11 00:08:55 2009 New Revision: 197949 URL: http://svn.freebsd.org/changeset/base/197949 Log: Document errno codes added in r144530. Modified: head/lib/libc/sys/intro.2 Modified: head/lib/libc/sys/intro.2 ============================================================================== --- head/lib/libc/sys/intro.2 Sat Oct 10 22:29:34 2009 (r197948) +++ head/lib/libc/sys/intro.2 Sun Oct 11 00:08:55 2009 (r197949) @@ -456,6 +456,14 @@ The specified extended attribute does no .It Er 88 EDOOFUS Em "Programming error" . A function or API is being abused in a way which could only be detected at run-time. +.It Er 89 EBADMSG Em "Bad message" . +A corrupted message was detected. +.It Er 90 EMULTIHOP Em "Multihop attempted" . +This error code is unused, but present for compatibility with other systems. +.It Er 91 ENOLINK Em "Link has been severed" . +This error code is unused, but present for compatibility with other systems. +.It Er 92 EPROTO Em "Protocol error" . +A device or socket encountered an unrecoverable protocol error. .It Er 93 ENOTCAPABLE Em "Capabilities insufficient" . An operation on a capability file descriptor requires greater privilege than the capability allows. From rnoland at FreeBSD.org Sun Oct 11 01:51:36 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Oct 11 01:51:42 2009 Subject: svn commit: r197950 - head/sys/dev/agp Message-ID: <200910110151.n9B1panj097787@svn.freebsd.org> Author: rnoland Date: Sun Oct 11 01:51:35 2009 New Revision: 197950 URL: http://svn.freebsd.org/changeset/base/197950 Log: Add pci id's for Intel G41 chipset Submitted by: Artyom Mirgorodsky MFC after: 3 days Modified: head/sys/dev/agp/agp_i810.c Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Sun Oct 11 00:08:55 2009 (r197949) +++ head/sys/dev/agp/agp_i810.c Sun Oct 11 01:51:35 2009 (r197950) @@ -175,6 +175,8 @@ static const struct agp_i810_match { "Intel Q45 SVGA controller"}, {0x2E228086, CHIP_G4X, 0x00020000, "Intel G45 SVGA controller"}, + {0x2E328086, CHIP_G4X, 0x00020000, + "Intel G41 SVGA controller"}, {0, 0, 0, NULL} }; From rnoland at FreeBSD.org Sun Oct 11 01:54:01 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Oct 11 01:54:23 2009 Subject: svn commit: r197951 - head/sys/dev/drm Message-ID: <200910110154.n9B1s1lw097867@svn.freebsd.org> Author: rnoland Date: Sun Oct 11 01:54:00 2009 New Revision: 197951 URL: http://svn.freebsd.org/changeset/base/197951 Log: Add support for Intel G41 chipset Submitted by: Artyom Mirgorodsky MFC after: 3 days Modified: head/sys/dev/drm/drm_pciids.h head/sys/dev/drm/i915_drv.h Modified: head/sys/dev/drm/drm_pciids.h ============================================================================== --- head/sys/dev/drm/drm_pciids.h Sun Oct 11 01:51:35 2009 (r197950) +++ head/sys/dev/drm/drm_pciids.h Sun Oct 11 01:54:00 2009 (r197951) @@ -552,6 +552,7 @@ {0x8086, 0x2E02, CHIP_I9XX|CHIP_I965, "Intel Integrated Graphics Device"}, \ {0x8086, 0x2E12, CHIP_I9XX|CHIP_I965, "Intel Q45/Q43"}, \ {0x8086, 0x2E22, CHIP_I9XX|CHIP_I965, "Intel G45/G43"}, \ + {0x8086, 0x2E32, CHIP_I9XX|CHIP_I965, "Intel G41"}, \ {0, 0, 0, NULL} #define imagine_PCI_IDS \ Modified: head/sys/dev/drm/i915_drv.h ============================================================================== --- head/sys/dev/drm/i915_drv.h Sun Oct 11 01:51:35 2009 (r197950) +++ head/sys/dev/drm/i915_drv.h Sun Oct 11 01:54:00 2009 (r197951) @@ -644,7 +644,8 @@ extern int i915_wait_ring(struct drm_dev (dev)->pci_device == 0x2A42 || \ (dev)->pci_device == 0x2E02 || \ (dev)->pci_device == 0x2E12 || \ - (dev)->pci_device == 0x2E22) + (dev)->pci_device == 0x2E22 || \ + (dev)->pci_device == 0x2E32) #define IS_I965GM(dev) ((dev)->pci_device == 0x2A02) @@ -653,6 +654,7 @@ extern int i915_wait_ring(struct drm_dev #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \ (dev)->pci_device == 0x2E12 || \ (dev)->pci_device == 0x2E22 || \ + (dev)->pci_device == 0x2E32 || \ IS_GM45(dev)) #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \ From julian at FreeBSD.org Sun Oct 11 05:59:43 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Sun Oct 11 05:59:50 2009 Subject: svn commit: r197952 - in head/sys: net netgraph netinet netinet/ipfw netinet6 Message-ID: <200910110559.n9B5xhNg002528@svn.freebsd.org> Author: julian Date: Sun Oct 11 05:59:43 2009 New Revision: 197952 URL: http://svn.freebsd.org/changeset/base/197952 Log: Virtualize the pfil hooks so that different jails may chose different packet filters. ALso allows ipfw to be enabled on on ejail and disabled on another. In 8.0 it's a global setting. Sitting aroung in tree waiting to commit for: 2 months MFC after: 2 months Modified: head/sys/net/if_bridge.c head/sys/net/if_ethersubr.c head/sys/net/pfil.c head/sys/netgraph/ng_bridge.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c head/sys/netinet/ip_var.h head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_pfil.c head/sys/netinet/raw_ip.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_output.c head/sys/netinet6/ip6_var.h Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/net/if_bridge.c Sun Oct 11 05:59:43 2009 (r197952) @@ -109,6 +109,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* for struct arpcom */ #include @@ -1800,9 +1801,9 @@ bridge_dummynet(struct mbuf *m, struct i return; } - if (PFIL_HOOKED(&inet_pfil_hook) + if (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif ) { if (bridge_pfil(&m, sc->sc_ifp, ifp, PFIL_OUT) != 0) @@ -2062,9 +2063,9 @@ bridge_forward(struct bridge_softc *sc, ETHER_BPF_MTAP(ifp, m); /* run the packet filter */ - if (PFIL_HOOKED(&inet_pfil_hook) + if (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif ) { BRIDGE_UNLOCK(sc); @@ -2102,9 +2103,9 @@ bridge_forward(struct bridge_softc *sc, BRIDGE_UNLOCK(sc); - if (PFIL_HOOKED(&inet_pfil_hook) + if (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif ) { if (bridge_pfil(&m, ifp, dst_if, PFIL_OUT) != 0) @@ -2243,7 +2244,7 @@ bridge_input(struct ifnet *ifp, struct m #ifdef INET6 # define OR_PFIL_HOOKED_INET6 \ - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #else # define OR_PFIL_HOOKED_INET6 #endif @@ -2260,7 +2261,7 @@ bridge_input(struct ifnet *ifp, struct m iface->if_ipackets++; \ /* Filter on the physical interface. */ \ if (pfil_local_phys && \ - (PFIL_HOOKED(&inet_pfil_hook) \ + (PFIL_HOOKED(&V_inet_pfil_hook) \ OR_PFIL_HOOKED_INET6)) { \ if (bridge_pfil(&m, NULL, ifp, \ PFIL_IN) != 0 || m == NULL) { \ @@ -2349,9 +2350,9 @@ bridge_broadcast(struct bridge_softc *sc } /* Filter on the bridge interface before broadcasting */ - if (runfilt && (PFIL_HOOKED(&inet_pfil_hook) + if (runfilt && (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif )) { if (bridge_pfil(&m, sc->sc_ifp, NULL, PFIL_OUT) != 0) @@ -2396,9 +2397,9 @@ bridge_broadcast(struct bridge_softc *sc * pointer so we do not redundantly filter on the bridge for * each interface we broadcast on. */ - if (runfilt && (PFIL_HOOKED(&inet_pfil_hook) + if (runfilt && (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif )) { if (used == 0) { @@ -3037,7 +3038,7 @@ bridge_pfil(struct mbuf **mp, struct ifn goto bad; } - if (ip_fw_chk_ptr && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { + if (V_ip_fw_chk_ptr && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { struct dn_pkt_tag *dn_tag; error = -1; @@ -3057,7 +3058,7 @@ bridge_pfil(struct mbuf **mp, struct ifn args.next_hop = NULL; args.eh = &eh2; args.inp = NULL; /* used by ipfw uid/gid/jail rules */ - i = ip_fw_chk_ptr(&args); + i = V_ip_fw_chk_ptr(&args); *mp = args.m; if (*mp == NULL) @@ -3109,21 +3110,21 @@ ipfwpass: * in_if -> bridge_if -> out_if */ if (pfil_bridge && dir == PFIL_OUT && bifp != NULL) - error = pfil_run_hooks(&inet_pfil_hook, mp, bifp, + error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (pfil_member && ifp != NULL) - error = pfil_run_hooks(&inet_pfil_hook, mp, ifp, + error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (pfil_bridge && dir == PFIL_IN && bifp != NULL) - error = pfil_run_hooks(&inet_pfil_hook, mp, bifp, + error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ @@ -3163,21 +3164,21 @@ ipfwpass: #ifdef INET6 case ETHERTYPE_IPV6: if (pfil_bridge && dir == PFIL_OUT && bifp != NULL) - error = pfil_run_hooks(&inet6_pfil_hook, mp, bifp, + error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (pfil_member && ifp != NULL) - error = pfil_run_hooks(&inet6_pfil_hook, mp, ifp, + error = pfil_run_hooks(&V_inet6_pfil_hook, mp, ifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (pfil_bridge && dir == PFIL_IN && bifp != NULL) - error = pfil_run_hooks(&inet6_pfil_hook, mp, bifp, + error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, dir, NULL); break; #endif Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/net/if_ethersubr.c Sun Oct 11 05:59:43 2009 (r197952) @@ -434,7 +434,7 @@ ether_output_frame(struct ifnet *ifp, st { #if defined(INET) || defined(INET6) - if (ip_fw_chk_ptr && V_ether_ipfw != 0) { + if (V_ip_fw_chk_ptr && V_ether_ipfw != 0) { if (ether_ipfw_chk(&m, ifp, 0) == 0) { if (m) { m_freem(m); @@ -502,7 +502,7 @@ ether_ipfw_chk(struct mbuf **m0, struct args.next_hop = NULL; /* we do not support forward yet */ args.eh = &save_eh; /* MAC header for bridged/MAC packets */ args.inp = NULL; /* used by ipfw uid/gid/jail rules */ - i = ip_fw_chk_ptr(&args); + i = V_ip_fw_chk_ptr(&args); m = args.m; if (m != NULL) { /* @@ -775,7 +775,7 @@ ether_demux(struct ifnet *ifp, struct mb * Allow dummynet and/or ipfw to claim the frame. * Do not do this for PROMISC frames in case we are re-entered. */ - if (ip_fw_chk_ptr && V_ether_ipfw != 0 && !(m->m_flags & M_PROMISC)) { + if (V_ip_fw_chk_ptr && V_ether_ipfw != 0 && !(m->m_flags & M_PROMISC)) { if (ether_ipfw_chk(&m, NULL, 0) == 0) { if (m) m_freem(m); /* dropped; free mbuf chain */ Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/net/pfil.c Sun Oct 11 05:59:43 2009 (r197952) @@ -56,8 +56,9 @@ static int pfil_list_add(pfil_list_t *, static int pfil_list_remove(pfil_list_t *, int (*)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), void *); -LIST_HEAD(, pfil_head) pfil_head_list = - LIST_HEAD_INITIALIZER(&pfil_head_list); +LIST_HEAD(pfilheadhead, pfil_head); +VNET_DEFINE(struct pfilheadhead, pfil_head_list); +#define V_pfil_head_list VNET(pfil_head_list) /* * pfil_run_hooks() runs the specified packet filter hooks. @@ -97,7 +98,7 @@ pfil_head_register(struct pfil_head *ph) struct pfil_head *lph; PFIL_LIST_LOCK(); - LIST_FOREACH(lph, &pfil_head_list, ph_list) { + LIST_FOREACH(lph, &V_pfil_head_list, ph_list) { if (ph->ph_type == lph->ph_type && ph->ph_un.phu_val == lph->ph_un.phu_val) { PFIL_LIST_UNLOCK(); @@ -108,7 +109,7 @@ pfil_head_register(struct pfil_head *ph) ph->ph_nhooks = 0; TAILQ_INIT(&ph->ph_in); TAILQ_INIT(&ph->ph_out); - LIST_INSERT_HEAD(&pfil_head_list, ph, ph_list); + LIST_INSERT_HEAD(&V_pfil_head_list, ph, ph_list); PFIL_LIST_UNLOCK(); return (0); } @@ -143,7 +144,7 @@ pfil_head_get(int type, u_long val) struct pfil_head *ph; PFIL_LIST_LOCK(); - LIST_FOREACH(ph, &pfil_head_list, ph_list) + LIST_FOREACH(ph, &V_pfil_head_list, ph_list) if (ph->ph_type == type && ph->ph_un.phu_val == val) break; PFIL_LIST_UNLOCK(); @@ -284,3 +285,45 @@ pfil_list_remove(pfil_list_t *list, } return ENOENT; } + +/**************** + * Stuff that must be initialized for every instance + * (including the first of course). + */ +static int +vnet_pfil_init(const void *unused) +{ + LIST_INIT(&V_pfil_head_list); + return (0); +} + +/*********************** + * Called for the removal of each instance. + */ +static int +vnet_pfil_uninit(const void *unused) +{ + /* XXX should panic if list is not empty */ + return 0; +} + +/* Define startup order. */ +#define PFIL_SYSINIT_ORDER SI_SUB_PROTO_BEGIN +#define PFIL_MODEVENT_ORDER (SI_ORDER_FIRST) /* On boot slot in here. */ +#define PFIL_VNET_ORDER (PFIL_MODEVENT_ORDER + 2) /* Later still. */ + +/* + * Starting up. + * VNET_SYSINIT is called for each existing vnet and each new vnet. + */ +VNET_SYSINIT(vnet_pfil_init, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, + vnet_pfil_init, NULL); + +/* + * Closing up shop. These are done in REVERSE ORDER, + * Not called on reboot. + * VNET_SYSUNINIT is called for each exiting vnet as it exits. + */ +VNET_SYSUNINIT(vnet_pfil_uninit, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, + vnet_pfil_uninit, NULL); + Modified: head/sys/netgraph/ng_bridge.c ============================================================================== --- head/sys/netgraph/ng_bridge.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netgraph/ng_bridge.c Sun Oct 11 05:59:43 2009 (r197952) @@ -634,7 +634,7 @@ ng_bridge_rcvdata(hook_p hook, item_p it /* Run packet through ipfw processing, if enabled */ #if 0 - if (priv->conf.ipfw[linkNum] && V_fw_enable && ip_fw_chk_ptr != NULL) { + if (priv->conf.ipfw[linkNum] && V_fw_enable && V_ip_fw_chk_ptr != NULL) { /* XXX not implemented yet */ } #endif Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ip_fastfwd.c Sun Oct 11 05:59:43 2009 (r197952) @@ -351,10 +351,11 @@ ip_fastforward(struct mbuf *m) /* * Run through list of ipfilter hooks for input packets */ - if (!PFIL_HOOKED(&inet_pfil_hook)) + if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passin; - if (pfil_run_hooks(&inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL) || + if (pfil_run_hooks( + &V_inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL) || m == NULL) goto drop; @@ -438,10 +439,10 @@ passin: /* * Run through list of hooks for output packets. */ - if (!PFIL_HOOKED(&inet_pfil_hook)) + if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; - if (pfil_run_hooks(&inet_pfil_hook, &m, ifp, PFIL_OUT, NULL) || m == NULL) { + if (pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_OUT, NULL) || m == NULL) { goto drop; } Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ip_input.c Sun Oct 11 05:59:43 2009 (r197952) @@ -170,7 +170,7 @@ SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, &VNET_NAME(ip_checkinterface), 0, "Verify packet arrives on correct interface"); -struct pfil_head inet_pfil_hook; /* Packet filter hooks */ +VNET_DEFINE(struct pfil_head, inet_pfil_hook); /* Packet filter hooks */ static struct netisr_handler ip_nh = { .nh_name = "ip", @@ -318,6 +318,13 @@ ip_init(void) NULL, UMA_ALIGN_PTR, 0); maxnipq_update(); + /* Initialize packet filter hooks. */ + V_inet_pfil_hook.ph_type = PFIL_TYPE_AF; + V_inet_pfil_hook.ph_af = AF_INET; + if ((i = pfil_head_register(&V_inet_pfil_hook)) != 0) + printf("%s: WARNING: unable to register pfil hook, " + "error %d\n", __func__, i); + #ifdef FLOWTABLE TUNABLE_INT_FETCH("net.inet.ip.output_flowtable_size", &V_ip_output_flowtable_size); @@ -348,13 +355,6 @@ ip_init(void) ip_protox[pr->pr_protocol] = pr - inetsw; } - /* Initialize packet filter hooks. */ - inet_pfil_hook.ph_type = PFIL_TYPE_AF; - inet_pfil_hook.ph_af = AF_INET; - if ((i = pfil_head_register(&inet_pfil_hook)) != 0) - printf("%s: WARNING: unable to register pfil hook, " - "error %d\n", __func__, i); - /* Start ipport_tick. */ callout_init(&ipport_tick_callout, CALLOUT_MPSAFE); callout_reset(&ipport_tick_callout, 1, ipport_tick, NULL); @@ -510,11 +510,11 @@ tooshort: */ /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet_pfil_hook)) + if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passin; odst = ip->ip_dst; - if (pfil_run_hooks(&inet_pfil_hook, &m, ifp, PFIL_IN, NULL) != 0) + if (pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_IN, NULL) != 0) return; if (m == NULL) /* consumed by filter */ return; Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ip_output.c Sun Oct 11 05:59:43 2009 (r197952) @@ -489,12 +489,12 @@ sendit: #endif /* IPSEC */ /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet_pfil_hook)) + if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; /* Run through list of hooks for output packets. */ odst.s_addr = ip->ip_dst.s_addr; - error = pfil_run_hooks(&inet_pfil_hook, &m, ifp, PFIL_OUT, inp); + error = pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_OUT, inp); if (error != 0 || m == NULL) goto done; Modified: head/sys/netinet/ip_var.h ============================================================================== --- head/sys/netinet/ip_var.h Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ip_var.h Sun Oct 11 05:59:43 2009 (r197952) @@ -244,14 +244,20 @@ extern int (*ip_rsvp_vif)(struct socket extern void (*ip_rsvp_force_done)(struct socket *); extern void (*rsvp_input_p)(struct mbuf *m, int off); -extern struct pfil_head inet_pfil_hook; /* packet filter hooks */ +VNET_DECLARE(struct pfil_head, inet_pfil_hook); /* packet filter hooks */ +#define V_inet_pfil_hook VNET(inet_pfil_hook) void in_delayed_cksum(struct mbuf *m); /* ipfw and dummynet hooks. Most are declared in raw_ip.c */ struct ip_fw_args; -extern int (*ip_fw_chk_ptr)(struct ip_fw_args *args); -extern int (*ip_fw_ctl_ptr)(struct sockopt *); +typedef int (*ip_fw_chk_ptr_t)(struct ip_fw_args *args); +typedef int (*ip_fw_ctl_ptr_t)(struct sockopt *); +VNET_DECLARE(ip_fw_chk_ptr_t, ip_fw_chk_ptr); +VNET_DECLARE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr); +#define V_ip_fw_chk_ptr VNET(ip_fw_chk_ptr) +#define V_ip_fw_ctl_ptr VNET(ip_fw_ctl_ptr) + extern int (*ip_dn_ctl_ptr)(struct sockopt *); extern int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa); extern void (*ip_dn_ruledel_ptr)(void *); /* in ip_fw2.c */ Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ipfw/ip_fw2.c Sun Oct 11 05:59:43 2009 (r197952) @@ -2495,6 +2495,10 @@ do { \ } IPFW_RLOCK(chain); + if (! V_ipfw_vnet_ready) { /* shutting down, leave NOW. */ + IPFW_RUNLOCK(chain); + return (IP_FW_PASS); /* accept */ + } mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL); if (args->rule) { /* @@ -4637,29 +4641,21 @@ ipfw_init(void) printf("limited to %d packets/entry by default\n", V_verbose_limit); - /* - * Hook us up to pfil. - * Eventually pfil will be per vnet. - */ - if ((error = ipfw_hook()) != 0) { - printf("ipfw_hook() error\n"); - return (error); - } -#ifdef INET6 - if ((error = ipfw6_hook()) != 0) { - printf("ipfw6_hook() error\n"); - return (error); - } -#endif - /* - * Other things that are only done the first time. - * (now that we are guaranteed of success). - */ - ip_fw_ctl_ptr = ipfw_ctl; - ip_fw_chk_ptr = ipfw_chk; return (error); } +/********************** + * Called for the removal of the last instance only on module unload. + */ +static void +ipfw_destroy(void) +{ + + uma_zdestroy(ipfw_dyn_rule_zone); + IPFW_DYN_LOCK_DESTROY(); + printf("IP firewall unloaded\n"); +} + /**************** * Stuff that must be initialized for every instance * (including the first of course). @@ -4743,19 +4739,30 @@ vnet_ipfw_init(const void *unused) /* First set up some values that are compile time options */ V_ipfw_vnet_ready = 1; /* Open for business */ - return (0); -} -/********************** - * Called for the removal of the last instance only on module unload. - */ -static void -ipfw_destroy(void) -{ + /* Hook up the raw inputs */ + V_ip_fw_ctl_ptr = ipfw_ctl; + V_ip_fw_chk_ptr = ipfw_chk; - uma_zdestroy(ipfw_dyn_rule_zone); - IPFW_DYN_LOCK_DESTROY(); - printf("IP firewall unloaded\n"); + /* + * Hook us up to pfil. + */ + if (V_fw_enable) { + if ((error = ipfw_hook()) != 0) { + printf("ipfw_hook() error\n"); + return (error); + } + } +#ifdef INET6 + if (V_fw6_enable) { + if ((error = ipfw6_hook()) != 0) { + printf("ipfw6_hook() error\n"); + /* XXX should we unhook everything else? */ + return (error); + } + } +#endif + return (0); } /*********************** @@ -4767,9 +4774,18 @@ vnet_ipfw_uninit(const void *unused) struct ip_fw *reap; V_ipfw_vnet_ready = 0; /* tell new callers to go away */ - callout_drain(&V_ipfw_timeout); + ipfw_unhook(); +#ifdef INET6 + ipfw6_unhook(); +#endif + /* layer2 and other entrypoints still come in this way. */ + V_ip_fw_chk_ptr = NULL; + V_ip_fw_ctl_ptr = NULL; + IPFW_WLOCK(&V_layer3_chain); /* We wait on the wlock here until the last user leaves */ + IPFW_WUNLOCK(&V_layer3_chain); IPFW_WLOCK(&V_layer3_chain); + callout_drain(&V_ipfw_timeout); flush_tables(&V_layer3_chain); V_layer3_chain.reap = NULL; free_chain(&V_layer3_chain, 1 /* kill default rule */); @@ -4803,21 +4819,10 @@ ipfw_modevent(module_t mod, int type, vo /* Called once at module load or * system boot if compiled in. */ break; - case MOD_UNLOAD: - break; case MOD_QUIESCE: - /* Yes, the unhooks can return errors, we can safely ignore - * them. Eventually these will be done per jail as they - * shut down. We will wait on each vnet's l3 lock as existing - * callers go away. - */ - ipfw_unhook(); -#ifdef INET6 - ipfw6_unhook(); -#endif - /* layer2 and other entrypoints still come in this way. */ - ip_fw_chk_ptr = NULL; - ip_fw_ctl_ptr = NULL; + /* Called before unload. May veto unloading. */ + break; + case MOD_UNLOAD: /* Called during unload. */ break; case MOD_SHUTDOWN: @@ -4866,4 +4871,3 @@ SYSUNINIT(ipfw_destroy, IPFW_SI_SUB_FIRE VNET_SYSUNINIT(vnet_ipfw_uninit, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER, vnet_ipfw_uninit, NULL); - Modified: head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_pfil.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ipfw/ip_fw_pfil.c Sun Oct 11 05:59:43 2009 (r197952) @@ -515,42 +515,54 @@ ipfw6_unhook(void) int ipfw_chg_hook(SYSCTL_HANDLER_ARGS) { - int enable = *(int *)arg1; + int enable; + int oldenable; int error; -#ifdef VIMAGE /* Since enabling is global, only let base do it. */ - if (! IS_DEFAULT_VNET(curvnet)) - return (EPERM); + if (arg1 == &VNET_NAME(fw_enable)) { + enable = V_fw_enable; + } +#ifdef INET6 + else if (arg1 == &VNET_NAME(fw6_enable)) { + enable = V_fw6_enable; + } #endif + else + return (EINVAL); + + oldenable = enable; + error = sysctl_handle_int(oidp, &enable, 0, req); + if (error) return (error); enable = (enable) ? 1 : 0; - if (enable == *(int *)arg1) + if (enable == oldenable) return (0); - if (arg1 == &V_fw_enable) { + if (arg1 == &VNET_NAME(fw_enable)) { if (enable) error = ipfw_hook(); else error = ipfw_unhook(); + if (error) + return (error); + V_fw_enable = enable; } #ifdef INET6 - if (arg1 == &V_fw6_enable) { + else if (arg1 == &VNET_NAME(fw6_enable)) { if (enable) error = ipfw6_hook(); else error = ipfw6_unhook(); + if (error) + return (error); + V_fw6_enable = enable; } #endif - if (error) - return (error); - - *(int *)arg1 = enable; - return (0); } Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/raw_ip.c Sun Oct 11 05:59:43 2009 (r197952) @@ -84,9 +84,9 @@ VNET_DEFINE(struct inpcbinfo, ripcbinfo) * The data hooks are not used here but it is convenient * to keep them all in one place. */ -int (*ip_fw_ctl_ptr)(struct sockopt *) = NULL; +VNET_DEFINE(ip_fw_chk_ptr_t, ip_fw_chk_ptr) = NULL; +VNET_DEFINE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr) = NULL; int (*ip_dn_ctl_ptr)(struct sockopt *) = NULL; -int (*ip_fw_chk_ptr)(struct ip_fw_args *args) = NULL; int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa) = NULL; /* @@ -523,8 +523,8 @@ rip_ctloutput(struct socket *so, struct case IP_FW_TABLE_LIST: case IP_FW_NAT_GET_CONFIG: case IP_FW_NAT_GET_LOG: - if (ip_fw_ctl_ptr != NULL) - error = ip_fw_ctl_ptr(sopt); + if (V_ip_fw_ctl_ptr != NULL) + error = V_ip_fw_ctl_ptr(sopt); else error = ENOPROTOOPT; break; @@ -584,8 +584,8 @@ rip_ctloutput(struct socket *so, struct case IP_FW_TABLE_FLUSH: case IP_FW_NAT_CFG: case IP_FW_NAT_DEL: - if (ip_fw_ctl_ptr != NULL) - error = ip_fw_ctl_ptr(sopt); + if (V_ip_fw_ctl_ptr != NULL) + error = V_ip_fw_ctl_ptr(sopt); else error = ENOPROTOOPT; break; Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet6/ip6_forward.c Sun Oct 11 05:59:43 2009 (r197952) @@ -551,11 +551,11 @@ skip_routing: in6_clearscope(&ip6->ip6_dst); /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet6_pfil_hook)) + if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto pass; /* Run through list of hooks for output packets. */ - error = pfil_run_hooks(&inet6_pfil_hook, &m, rt->rt_ifp, PFIL_OUT, NULL); + error = pfil_run_hooks(&V_inet6_pfil_hook, &m, rt->rt_ifp, PFIL_OUT, NULL); if (error != 0) goto senderr; if (m == NULL) Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet6/ip6_input.c Sun Oct 11 05:59:43 2009 (r197952) @@ -152,7 +152,7 @@ VNET_DECLARE(int, udp6_recvspace); struct rwlock in6_ifaddr_lock; RW_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock"); -struct pfil_head inet6_pfil_hook; +VNET_DEFINE (struct pfil_head, inet6_pfil_hook); static void ip6_init2(void *); static struct ip6aux *ip6_setdstifaddr(struct mbuf *, struct in6_ifaddr *); @@ -247,6 +247,13 @@ ip6_init(void) V_ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; + /* Initialize packet filter hooks. */ + V_inet6_pfil_hook.ph_type = PFIL_TYPE_AF; + V_inet6_pfil_hook.ph_af = AF_INET6; + if ((i = pfil_head_register(&V_inet6_pfil_hook)) != 0) + printf("%s: WARNING: unable to register pfil hook, " + "error %d\n", __func__, i); + /* Skip global initialization stuff for non-default instances. */ if (!IS_DEFAULT_VNET(curvnet)) return; @@ -275,13 +282,6 @@ ip6_init(void) ip6_protox[pr->pr_protocol] = pr - inet6sw; } - /* Initialize packet filter hooks. */ - inet6_pfil_hook.ph_type = PFIL_TYPE_AF; - inet6_pfil_hook.ph_af = AF_INET6; - if ((i = pfil_head_register(&inet6_pfil_hook)) != 0) - printf("%s: WARNING: unable to register pfil hook, " - "error %d\n", __func__, i); - netisr_register(&ip6_nh); } @@ -515,10 +515,11 @@ ip6_input(struct mbuf *m) odst = ip6->ip6_dst; /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet6_pfil_hook)) + if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passin; - if (pfil_run_hooks(&inet6_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL)) + if (pfil_run_hooks(&V_inet6_pfil_hook, &m, + m->m_pkthdr.rcvif, PFIL_IN, NULL)) return; if (m == NULL) /* consumed by filter */ return; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet6/ip6_output.c Sun Oct 11 05:59:43 2009 (r197952) @@ -805,12 +805,12 @@ again: } /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet6_pfil_hook)) + if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passout; odst = ip6->ip6_dst; /* Run through list of hooks for output packets. */ - error = pfil_run_hooks(&inet6_pfil_hook, &m, ifp, PFIL_OUT, inp); + error = pfil_run_hooks(&V_inet6_pfil_hook, &m, ifp, PFIL_OUT, inp); if (error != 0 || m == NULL) goto done; ip6 = mtod(m, struct ip6_hdr *); Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet6/ip6_var.h Sun Oct 11 05:59:43 2009 (r197952) @@ -358,7 +358,8 @@ VNET_DECLARE(int, ip6_use_defzone); /* W #endif #define V_ip6_use_defzone VNET(ip6_use_defzone) -extern struct pfil_head inet6_pfil_hook; /* packet filter hooks */ +VNET_DECLARE (struct pfil_head, inet6_pfil_hook); /* packet filter hooks */ +#define V_inet6_pfil_hook VNET(inet6_pfil_hook) extern struct pr_usrreqs rip6_usrreqs; struct sockopt; From delphij at FreeBSD.org Sun Oct 11 07:03:57 2009 From: delphij at FreeBSD.org (Xin LI) Date: Sun Oct 11 07:04:09 2009 Subject: svn commit: r197953 - head/sys/fs/tmpfs Message-ID: <200910110703.n9B73uSs003722@svn.freebsd.org> Author: delphij Date: Sun Oct 11 07:03:56 2009 New Revision: 197953 URL: http://svn.freebsd.org/changeset/base/197953 Log: Add locking around access to parent node, and bail out when the parent node is already freed rather than panicking the system. PR: kern/122038 Submitted by: gk Tested by: pho MFC after: 1 week Modified: head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs.h ============================================================================== --- head/sys/fs/tmpfs/tmpfs.h Sun Oct 11 05:59:43 2009 (r197952) +++ head/sys/fs/tmpfs/tmpfs.h Sun Oct 11 07:03:56 2009 (r197953) @@ -303,10 +303,30 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #define TMPFS_NODE_LOCK(node) mtx_lock(&(node)->tn_interlock) #define TMPFS_NODE_UNLOCK(node) mtx_unlock(&(node)->tn_interlock) -#define TMPFS_NODE_MTX(node) (&(node)->tn_interlock) +#define TMPFS_NODE_MTX(node) (&(node)->tn_interlock) + +#ifdef INVARIANTS +#define TMPFS_ASSERT_LOCKED(node) do { \ + MPASS(node != NULL); \ + MPASS(node->tn_vnode != NULL); \ + if (!VOP_ISLOCKED(node->tn_vnode) && \ + !mtx_owned(TMPFS_NODE_MTX(node))) \ + panic("tmpfs: node is not locked: %p", node); \ + } while (0) +#define TMPFS_ASSERT_ELOCKED(node) do { \ + MPASS((node) != NULL); \ + MPASS((node)->tn_vnode != NULL); \ + mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); \ + ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs"); \ + } while (0) +#else +#define TMPFS_ASSERT_LOCKED(node) (void)0 +#define TMPFS_ASSERT_ELOCKED(node) (void)0 +#endif #define TMPFS_VNODE_ALLOCATING 1 #define TMPFS_VNODE_WANT 2 +#define TMPFS_VNODE_DOOMED 4 /* --------------------------------------------------------------------- */ /* Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Sun Oct 11 05:59:43 2009 (r197952) +++ head/sys/fs/tmpfs/tmpfs_subr.c Sun Oct 11 07:03:56 2009 (r197953) @@ -124,7 +124,9 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp nnode->tn_dir.tn_readdir_lastn = 0; nnode->tn_dir.tn_readdir_lastp = NULL; nnode->tn_links++; + TMPFS_NODE_LOCK(nnode->tn_dir.tn_parent); nnode->tn_dir.tn_parent->tn_links++; + TMPFS_NODE_UNLOCK(nnode->tn_dir.tn_parent); break; case VFIFO: @@ -187,6 +189,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp, #ifdef INVARIANTS TMPFS_NODE_LOCK(node); MPASS(node->tn_vnode == NULL); + MPASS((node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0); TMPFS_NODE_UNLOCK(node); #endif @@ -312,6 +315,7 @@ tmpfs_alloc_vp(struct mount *mp, struct loop: TMPFS_NODE_LOCK(node); if ((vp = node->tn_vnode) != NULL) { + MPASS((node->tn_vpstate & TMPFS_VNODE_DOOMED) == 0); VI_LOCK(vp); TMPFS_NODE_UNLOCK(node); vholdl(vp); @@ -330,6 +334,14 @@ loop: goto out; } + if ((node->tn_vpstate & TMPFS_VNODE_DOOMED) || + (node->tn_type == VDIR && node->tn_dir.tn_parent == NULL)) { + TMPFS_NODE_UNLOCK(node); + error = ENOENT; + vp = NULL; + goto out; + } + /* * otherwise lock the vp list while we call getnewvnode * since that can block. @@ -375,6 +387,7 @@ loop: vp->v_op = &tmpfs_fifoop_entries; break; case VDIR: + MPASS(node->tn_dir.tn_parent != NULL); if (node->tn_dir.tn_parent == node) vp->v_vflag |= VV_ROOT; break; @@ -428,10 +441,9 @@ tmpfs_free_vp(struct vnode *vp) node = VP_TO_TMPFS_NODE(vp); - TMPFS_NODE_LOCK(node); + mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); node->tn_vnode = NULL; vp->v_data = NULL; - TMPFS_NODE_UNLOCK(node); } /* --------------------------------------------------------------------- */ @@ -653,7 +665,18 @@ tmpfs_dir_getdotdotdent(struct tmpfs_nod TMPFS_VALIDATE_DIR(node); MPASS(uio->uio_offset == TMPFS_DIRCOOKIE_DOTDOT); + /* + * Return ENOENT if the current node is already removed. + */ + TMPFS_ASSERT_LOCKED(node); + if (node->tn_dir.tn_parent == NULL) { + return (ENOENT); + } + + TMPFS_NODE_LOCK(node->tn_dir.tn_parent); dent.d_fileno = node->tn_dir.tn_parent->tn_id; + TMPFS_NODE_UNLOCK(node->tn_dir.tn_parent); + dent.d_type = DT_DIR; dent.d_namlen = 2; dent.d_name[0] = '.'; Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Oct 11 05:59:43 2009 (r197952) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Oct 11 07:03:56 2009 (r197953) @@ -87,6 +87,11 @@ tmpfs_lookup(struct vop_cachedlookup_arg dnode->tn_dir.tn_parent == dnode, !(cnp->cn_flags & ISDOTDOT))); + TMPFS_ASSERT_LOCKED(dnode); + if (dnode->tn_dir.tn_parent == NULL) { + error = ENOENT; + goto out; + } if (cnp->cn_flags & ISDOTDOT) { int ltype = 0; @@ -914,6 +919,7 @@ tmpfs_rename(struct vop_rename_args *v) char *newname; int error; struct tmpfs_dirent *de; + struct tmpfs_mount *tmp; struct tmpfs_node *fdnode; struct tmpfs_node *fnode; struct tmpfs_node *tnode; @@ -934,6 +940,7 @@ tmpfs_rename(struct vop_rename_args *v) goto out; } + tmp = VFS_TO_TMPFS(tdvp->v_mount); tdnode = VP_TO_TMPFS_DIR(tdvp); /* If source and target are the same file, there is nothing to do. */ @@ -1018,25 +1025,63 @@ tmpfs_rename(struct vop_rename_args *v) * directory being moved. Otherwise, we'd end up * with stale nodes. */ n = tdnode; + /* TMPFS_LOCK garanties that no nodes are freed while + * traversing the list. Nodes can only be marked as + * removed: tn_parent == NULL. */ + TMPFS_LOCK(tmp); + TMPFS_NODE_LOCK(n); while (n != n->tn_dir.tn_parent) { + struct tmpfs_node *parent; + if (n == fnode) { + TMPFS_NODE_UNLOCK(n); + TMPFS_UNLOCK(tmp); error = EINVAL; if (newname != NULL) free(newname, M_TMPFSNAME); goto out_locked; } - n = n->tn_dir.tn_parent; + parent = n->tn_dir.tn_parent; + TMPFS_NODE_UNLOCK(n); + if (parent == NULL) { + n = NULL; + break; + } + TMPFS_NODE_LOCK(parent); + if (parent->tn_dir.tn_parent == NULL) { + TMPFS_NODE_UNLOCK(parent); + n = NULL; + break; + } + n = parent; + } + TMPFS_UNLOCK(tmp); + if (n == NULL) { + error = EINVAL; + if (newname != NULL) + free(newname, M_TMPFSNAME); + goto out_locked; } + TMPFS_NODE_UNLOCK(n); /* Adjust the parent pointer. */ TMPFS_VALIDATE_DIR(fnode); + TMPFS_NODE_LOCK(de->td_node); de->td_node->tn_dir.tn_parent = tdnode; + TMPFS_NODE_UNLOCK(de->td_node); /* As a result of changing the target of the '..' * entry, the link count of the source and target * directories has to be adjusted. */ - fdnode->tn_links--; + TMPFS_NODE_LOCK(tdnode); + TMPFS_ASSERT_LOCKED(tdnode); tdnode->tn_links++; + TMPFS_NODE_UNLOCK(tdnode); + + TMPFS_NODE_LOCK(fdnode); + TMPFS_ASSERT_LOCKED(fdnode); + fdnode->tn_links--; + TMPFS_NODE_UNLOCK(fdnode); } /* Do the move: just remove the entry from the source directory @@ -1163,15 +1208,26 @@ tmpfs_rmdir(struct vop_rmdir_args *v) goto out; } + /* Detach the directory entry from the directory (dnode). */ tmpfs_dir_detach(dvp, de); + /* No vnode should be allocated for this entry from this point */ + TMPFS_NODE_LOCK(node); + TMPFS_ASSERT_ELOCKED(node); node->tn_links--; + node->tn_dir.tn_parent = NULL; node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \ TMPFS_NODE_MODIFIED; - node->tn_dir.tn_parent->tn_links--; - node->tn_dir.tn_parent->tn_status |= TMPFS_NODE_ACCESSED | \ + + TMPFS_NODE_UNLOCK(node); + + TMPFS_NODE_LOCK(dnode); + TMPFS_ASSERT_ELOCKED(dnode); + dnode->tn_links--; + dnode->tn_status |= TMPFS_NODE_ACCESSED | \ TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED; + TMPFS_NODE_UNLOCK(dnode); cache_purge(dvp); cache_purge(vp); @@ -1359,13 +1415,21 @@ tmpfs_reclaim(struct vop_reclaim_args *v vnode_destroy_vobject(vp); cache_purge(vp); + + TMPFS_NODE_LOCK(node); + TMPFS_ASSERT_ELOCKED(node); tmpfs_free_vp(vp); /* If the node referenced by this vnode was deleted by the user, * we must free its associated data structures (now that the vnode * is being reclaimed). */ - if (node->tn_links == 0) + if (node->tn_links == 0 && + (node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0) { + node->tn_vpstate = TMPFS_VNODE_DOOMED; + TMPFS_NODE_UNLOCK(node); tmpfs_free_node(tmp, node); + } else + TMPFS_NODE_UNLOCK(node); MPASS(vp->v_data == NULL); return 0; From tuexen at FreeBSD.org Sun Oct 11 12:23:56 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Sun Oct 11 12:24:08 2009 Subject: svn commit: r197955 - head/sys/netinet Message-ID: <200910111223.n9BCNuTp011104@svn.freebsd.org> Author: tuexen Date: Sun Oct 11 12:23:56 2009 New Revision: 197955 URL: http://svn.freebsd.org/changeset/base/197955 Log: Fix a race condition where a mutex was destroyed while sleeping on it. Found while analyzing a report from julian. It might fix his bug. Approved by: rrs (mentor) MFC after: 3 days Modified: head/sys/netinet/sctp_bsd_addr.c head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_bsd_addr.c ============================================================================== --- head/sys/netinet/sctp_bsd_addr.c Sun Oct 11 11:00:14 2009 (r197954) +++ head/sys/netinet/sctp_bsd_addr.c Sun Oct 11 12:23:56 2009 (r197955) @@ -97,6 +97,7 @@ sctp_iterator_thread(void *v) &SCTP_BASE_INFO(ipi_iterator_wq_mtx), 0, "waiting_for_work", 0); if (SCTP_BASE_INFO(threads_must_exit)) { + SCTP_IPI_ITERATOR_WQ_DESTROY(); kthread_exit(); } sctp_iterator_worker(); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Oct 11 11:00:14 2009 (r197954) +++ head/sys/netinet/sctp_pcb.c Sun Oct 11 12:23:56 2009 (r197955) @@ -5616,7 +5616,6 @@ sctp_pcb_finish(void) SCTP_IP_PKTLOG_DESTROY(); #endif - SCTP_IPI_ITERATOR_WQ_DESTROY(); SCTP_IPI_ADDR_DESTROY(); SCTP_ITERATOR_LOCK_DESTROY(); SCTP_STATLOG_DESTROY(); From jh at FreeBSD.org Sun Oct 11 12:32:26 2009 From: jh at FreeBSD.org (Jaakko Heinonen) Date: Sun Oct 11 12:32:32 2009 Subject: svn commit: r197956 - head/usr.bin/systat Message-ID: <200910111232.n9BCWQfE011299@svn.freebsd.org> Author: jh Date: Sun Oct 11 12:32:25 2009 New Revision: 197956 URL: http://svn.freebsd.org/changeset/base/197956 Log: - Catch SIGHUP to perform cleanup before exiting. - Exit if getch() returns with an error other than EINTR. Otherwise systat(1) may get stuck in an infinite loop if it doesn't receive SIGHUP when terminal closes. [1] - Remove attempt to clear stdio error indicators. getch() doesn't use stdio, making it useless. [2] - Remove unneeded masking of getch() return value. [2] PR: bin/107171 Reviewed by: bde Approved by: trasz (mentor) Obtained from: OpenBSD [1] Suggested by: bde [2] MFC after: 1 month Modified: head/usr.bin/systat/keyboard.c head/usr.bin/systat/main.c Modified: head/usr.bin/systat/keyboard.c ============================================================================== --- head/usr.bin/systat/keyboard.c Sun Oct 11 12:23:56 2009 (r197955) +++ head/usr.bin/systat/keyboard.c Sun Oct 11 12:32:25 2009 (r197956) @@ -39,8 +39,10 @@ __FBSDID("$FreeBSD$"); static const char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif +#include #include #include +#include #include #include "systat.h" @@ -57,10 +59,11 @@ keyboard(void) move(CMDLINE, 0); do { refresh(); - ch = getch() & 0177; - if (ch == 0177 && ferror(stdin)) { - clearerr(stdin); - continue; + ch = getch(); + if (ch == ERR) { + if (errno == EINTR) + continue; + exit(1); } if (ch >= 'A' && ch <= 'Z') ch += 'a' - 'A'; Modified: head/usr.bin/systat/main.c ============================================================================== --- head/usr.bin/systat/main.c Sun Oct 11 12:23:56 2009 (r197955) +++ head/usr.bin/systat/main.c Sun Oct 11 12:32:25 2009 (r197956) @@ -133,6 +133,7 @@ main(int argc, char **argv) exit(1); } } + signal(SIGHUP, die); signal(SIGINT, die); signal(SIGQUIT, die); signal(SIGTERM, die); From des at FreeBSD.org Sun Oct 11 14:27:33 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Sun Oct 11 14:27:45 2009 Subject: svn commit: r197957 - head/crypto/openssh Message-ID: <200910111427.n9BERXkE013479@svn.freebsd.org> Author: des Date: Sun Oct 11 14:27:33 2009 New Revision: 197957 URL: http://svn.freebsd.org/changeset/base/197957 Log: Remove dupe. Modified: head/crypto/openssh/sshd_config Modified: head/crypto/openssh/sshd_config ============================================================================== --- head/crypto/openssh/sshd_config Sun Oct 11 12:32:25 2009 (r197956) +++ head/crypto/openssh/sshd_config Sun Oct 11 14:27:33 2009 (r197957) @@ -17,7 +17,6 @@ #VersionAddendum FreeBSD-20091001 #Port 22 -#Protocol 2 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: From kib at FreeBSD.org Sun Oct 11 16:23:11 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 11 16:23:23 2009 Subject: svn commit: r197958 - head/lib/libc/sys Message-ID: <200910111623.n9BGNBlG015888@svn.freebsd.org> Author: kib Date: Sun Oct 11 16:23:11 2009 New Revision: 197958 URL: http://svn.freebsd.org/changeset/base/197958 Log: In nanosleep(2), note that the calling thread is put to sleep, not the whole process. Also explicitely name the parameter that specifies sleep interval. Modified: head/lib/libc/sys/nanosleep.2 Modified: head/lib/libc/sys/nanosleep.2 ============================================================================== --- head/lib/libc/sys/nanosleep.2 Sun Oct 11 14:27:33 2009 (r197957) +++ head/lib/libc/sys/nanosleep.2 Sun Oct 11 16:23:11 2009 (r197958) @@ -47,7 +47,9 @@ The .Fn nanosleep system call -causes the process to sleep for the specified time. +causes the calling thread to sleep until the time interval specified by +.Fa rqtp +has elapsed. An unmasked signal will cause it to terminate the sleep early, regardless of the .Dv SA_RESTART From nwhitehorn at FreeBSD.org Sun Oct 11 16:41:39 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sun Oct 11 16:41:50 2009 Subject: svn commit: r197961 - head/sys/powerpc/aim Message-ID: <200910111641.n9BGfd3d016422@svn.freebsd.org> Author: nwhitehorn Date: Sun Oct 11 16:41:39 2009 New Revision: 197961 URL: http://svn.freebsd.org/changeset/base/197961 Log: Correct a typo here and actually save DSISR instead of overwriting it. Modified: head/sys/powerpc/aim/trap_subr.S Modified: head/sys/powerpc/aim/trap_subr.S ============================================================================== --- head/sys/powerpc/aim/trap_subr.S Sun Oct 11 16:39:16 2009 (r197960) +++ head/sys/powerpc/aim/trap_subr.S Sun Oct 11 16:41:39 2009 (r197961) @@ -451,7 +451,7 @@ disitrap: lwz %r30,(PC_TEMPSAVE+CPUSAVE_AIM_DAR)(%r1) /* get DAR */ stw %r30,(PC_DBSAVE +CPUSAVE_AIM_DAR)(%r1) /* save DAR */ lwz %r30,(PC_TEMPSAVE+CPUSAVE_AIM_DSISR)(%r1) /* get DSISR */ - lwz %r30,(PC_DBSAVE +CPUSAVE_AIM_DSISR)(%r1) /* save DSISR */ + stw %r30,(PC_DBSAVE +CPUSAVE_AIM_DSISR)(%r1) /* save DSISR */ lwz %r30,(PC_DISISAVE+CPUSAVE_R28)(%r1) /* get r28 */ stw %r30,(PC_DBSAVE +CPUSAVE_R28)(%r1) /* save r28 */ lwz %r31,(PC_DISISAVE+CPUSAVE_R29)(%r1) /* get r29 */ From nwhitehorn at FreeBSD.org Sun Oct 11 16:44:59 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sun Oct 11 16:45:10 2009 Subject: svn commit: r197962 - head/sys/powerpc/aim Message-ID: <200910111644.n9BGiwgj016518@svn.freebsd.org> Author: nwhitehorn Date: Sun Oct 11 16:44:58 2009 New Revision: 197962 URL: http://svn.freebsd.org/changeset/base/197962 Log: Correct another typo. Actually save the condition register instead of overwriting r12 by mistake. Modified: head/sys/powerpc/aim/swtch.S Modified: head/sys/powerpc/aim/swtch.S ============================================================================== --- head/sys/powerpc/aim/swtch.S Sun Oct 11 16:41:39 2009 (r197961) +++ head/sys/powerpc/aim/swtch.S Sun Oct 11 16:44:58 2009 (r197962) @@ -171,7 +171,7 @@ ENTRY(savectx) mr %r12,%r2 stmw %r12,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs */ mfcr %r4 /* Save the condition register */ - stw %r4,PCB_CONTEXT(%r3) + stw %r4,PCB_CR(%r3) blr /* From kib at FreeBSD.org Sun Oct 11 16:49:31 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 11 16:49:38 2009 Subject: svn commit: r197963 - in head/sys: kern sys Message-ID: <200910111649.n9BGnUmJ016709@svn.freebsd.org> Author: kib Date: Sun Oct 11 16:49:30 2009 New Revision: 197963 URL: http://svn.freebsd.org/changeset/base/197963 Log: Currently, when signal is delivered to the process and there is a thread not blocking the signal, signal is placed on the thread sigqueue. If the selected thread is in kernel executing thr_exit() or sigprocmask() syscalls, then signal might be not delivered to usermode for arbitrary amount of time, and for exiting thread it is lost. Put process-directed signals to the process queue unconditionally, selecting the thread to deliver the signal only by the thread returning to usermode, since only then the thread can handle delivery of signal reliably. For exiting thread or thread that has blocked some signals, check whether the newly blocked signal is queued for the process, and try to find a thread to wakeup for delivery, in reschedule_signal(). For exiting thread, assume that all signals are blocked. Change cursig() and postsig() to look both into the thread and process signal queues. When there is a signal that thread returning to usermode could consume, TDF_NEEDSIGCHK flag is not neccessary set now. Do unlocked read of p_siglist and p_pendingcnt to check for queued signals. Note that thread that has a signal unblocked might get spurious wakeup and EINTR from the interruptible system call now, due to the possibility of being selected by reschedule_signals(), while other thread returned to usermode earlier and removed the signal from process queue. This should not cause compliance issues, since the thread has not blocked a signal and thus should be ready to receive it anyway. Reported by: Justin Teller Reviewed by: davidxu, jilles MFC after: 1 month Modified: head/sys/kern/kern_sig.c head/sys/kern/kern_thr.c head/sys/kern/subr_trap.c head/sys/sys/signalvar.h Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sun Oct 11 16:44:58 2009 (r197962) +++ head/sys/kern/kern_sig.c Sun Oct 11 16:49:30 2009 (r197963) @@ -220,6 +220,8 @@ static int sigproptbl[NSIG] = { SA_KILL|SA_PROC, /* SIGUSR2 */ }; +static void reschedule_signals(struct proc *p, sigset_t block); + static void sigqueue_start(void) { @@ -581,20 +583,11 @@ void signotify(struct thread *td) { struct proc *p; - sigset_t set; p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); - /* - * If our mask changed we may have to move signal that were - * previously masked by all threads to our sigqueue. - */ - set = p->p_sigqueue.sq_signals; - SIGSETNAND(set, td->td_sigmask); - if (! SIGISEMPTY(set)) - sigqueue_move_set(&p->p_sigqueue, &td->td_sigqueue, &set); if (SIGPENDING(td)) { thread_lock(td); td->td_flags |= TDF_NEEDSIGCHK | TDF_ASTPENDING; @@ -976,24 +969,28 @@ execsigs(struct proc *p) * Manipulate signal mask. */ int -kern_sigprocmask(td, how, set, oset, old) - struct thread *td; - int how; - sigset_t *set, *oset; - int old; +kern_sigprocmask(struct thread *td, int how, sigset_t *set, sigset_t *oset, + int old) { + sigset_t new_block, oset1; + struct proc *p; int error; - PROC_LOCK(td->td_proc); + p = td->td_proc; + PROC_LOCK(p); if (oset != NULL) *oset = td->td_sigmask; error = 0; + SIGEMPTYSET(new_block); if (set != NULL) { switch (how) { case SIG_BLOCK: SIG_CANTMASK(*set); + oset1 = td->td_sigmask; SIGSETOR(td->td_sigmask, *set); + new_block = td->td_sigmask; + SIGSETNAND(new_block, oset1); break; case SIG_UNBLOCK: SIGSETNAND(td->td_sigmask, *set); @@ -1001,10 +998,13 @@ kern_sigprocmask(td, how, set, oset, old break; case SIG_SETMASK: SIG_CANTMASK(*set); + oset1 = td->td_sigmask; if (old) SIGSETLO(td->td_sigmask, *set); else td->td_sigmask = *set; + new_block = td->td_sigmask; + SIGSETNAND(new_block, oset1); signotify(td); break; default: @@ -1012,7 +1012,20 @@ kern_sigprocmask(td, how, set, oset, old break; } } - PROC_UNLOCK(td->td_proc); + + /* + * The new_block set contains signals that were not previosly + * blocked, but are blocked now. + * + * In case we block any signal that was not previously blocked + * for td, and process has the signal pending, try to schedule + * signal delivery to some thread that does not block the signal, + * possibly waking it up. + */ + if (p->p_numthreads != 1) + reschedule_signals(p, new_block); + + PROC_UNLOCK(p); return (error); } @@ -1985,17 +1998,9 @@ tdsignal(struct proc *p, struct thread * KNOTE_LOCKED(&p->p_klist, NOTE_SIGNAL | sig); prop = sigprop(sig); - /* - * If the signal is blocked and not destined for this thread, then - * assign it to the process so that we can find it later in the first - * thread that unblocks it. Otherwise, assign it to this thread now. - */ if (td == NULL) { td = sigtd(p, sig, prop); - if (SIGISMEMBER(td->td_sigmask, sig)) - sigqueue = &p->p_sigqueue; - else - sigqueue = &td->td_sigqueue; + sigqueue = &p->p_sigqueue; } else { KASSERT(td->td_proc == p, ("invalid thread")); sigqueue = &td->td_sigqueue; @@ -2392,6 +2397,62 @@ stopme: return (td->td_xsig); } +static void +reschedule_signals(struct proc *p, sigset_t block) +{ + struct sigacts *ps; + struct thread *td; + int i; + + PROC_LOCK_ASSERT(p, MA_OWNED); + + ps = p->p_sigacts; + for (i = 1; !SIGISEMPTY(block); i++) { + if (!SIGISMEMBER(block, i)) + continue; + SIGDELSET(block, i); + if (!SIGISMEMBER(p->p_siglist, i)) + continue; + + td = sigtd(p, i, 0); + signotify(td); + mtx_lock(&ps->ps_mtx); + if (p->p_flag & P_TRACED || SIGISMEMBER(ps->ps_sigcatch, i)) + tdsigwakeup(td, i, SIG_CATCH, + (SIGISMEMBER(ps->ps_sigintr, i) ? EINTR : + ERESTART)); + mtx_unlock(&ps->ps_mtx); + } +} + +void +tdsigcleanup(struct thread *td) +{ + struct proc *p; + sigset_t unblocked; + + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + + sigqueue_flush(&td->td_sigqueue); + if (p->p_numthreads == 1) + return; + + /* + * Since we cannot handle signals, notify signal post code + * about this by filling the sigmask. + * + * Also, if needed, wake up thread(s) that do not block the + * same signals as the exiting thread, since the thread might + * have been selected for delivery and woken up. + */ + SIGFILLSET(unblocked); + SIGSETNAND(unblocked, td->td_sigmask); + SIGFILLSET(td->td_sigmask); + reschedule_signals(p, unblocked); + +} + /* * If the current process has received a signal (should be caught or cause * termination, should interrupt current syscall), return the signal number. @@ -2409,8 +2470,9 @@ issignal(struct thread *td, int stop_all { struct proc *p; struct sigacts *ps; + struct sigqueue *queue; sigset_t sigpending; - int sig, prop, newsig; + int sig, prop, newsig, signo; p = td->td_proc; ps = p->p_sigacts; @@ -2420,6 +2482,7 @@ issignal(struct thread *td, int stop_all int traced = (p->p_flag & P_TRACED) || (p->p_stops & S_SIG); sigpending = td->td_sigqueue.sq_signals; + SIGSETOR(sigpending, p->p_sigqueue.sq_signals); SIGSETNAND(sigpending, td->td_sigmask); if (p->p_flag & P_PPWAIT) @@ -2440,6 +2503,7 @@ issignal(struct thread *td, int stop_all */ if (SIGISMEMBER(ps->ps_sigignore, sig) && (traced == 0)) { sigqueue_delete(&td->td_sigqueue, sig); + sigqueue_delete(&p->p_sigqueue, sig); continue; } if (p->p_flag & P_TRACED && (p->p_flag & P_PPWAIT) == 0) { @@ -2452,12 +2516,18 @@ issignal(struct thread *td, int stop_all if (sig != newsig) { ksiginfo_t ksi; + + queue = &td->td_sigqueue; /* * clear old signal. * XXX shrug off debugger, it causes siginfo to * be thrown away. */ - sigqueue_get(&td->td_sigqueue, sig, &ksi); + if (sigqueue_get(queue, sig, &ksi) == 0) { + queue = &p->p_sigqueue; + signo = sigqueue_get(queue, sig, &ksi); + KASSERT(signo == sig, ("signo != sig")); + } /* * If parent wants us to take the signal, @@ -2472,7 +2542,7 @@ issignal(struct thread *td, int stop_all * Put the new signal into td_sigqueue. If the * signal is being masked, look for other signals. */ - SIGADDSET(td->td_sigqueue.sq_signals, sig); + SIGADDSET(queue->sq_signals, sig); if (SIGISMEMBER(td->td_sigmask, sig)) continue; signotify(td); @@ -2567,6 +2637,7 @@ issignal(struct thread *td, int stop_all return (sig); } sigqueue_delete(&td->td_sigqueue, sig); /* take the signal! */ + sigqueue_delete(&p->p_sigqueue, sig); } /* NOTREACHED */ } @@ -2613,7 +2684,9 @@ postsig(sig) ps = p->p_sigacts; mtx_assert(&ps->ps_mtx, MA_OWNED); ksiginfo_init(&ksi); - sigqueue_get(&td->td_sigqueue, sig, &ksi); + if (sigqueue_get(&td->td_sigqueue, sig, &ksi) == 0 && + sigqueue_get(&p->p_sigqueue, sig, &ksi) == 0) + return; ksi.ksi_signo = sig; if (ksi.ksi_code == SI_TIMER) itimer_accept(p, ksi.ksi_timerid, &ksi); Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Sun Oct 11 16:44:58 2009 (r197962) +++ head/sys/kern/kern_thr.c Sun Oct 11 16:49:30 2009 (r197963) @@ -282,7 +282,7 @@ thr_exit(struct thread *td, struct thr_e } PROC_LOCK(p); - sigqueue_flush(&td->td_sigqueue); + tdsigcleanup(td); PROC_SLOCK(p); /* Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Sun Oct 11 16:44:58 2009 (r197962) +++ head/sys/kern/subr_trap.c Sun Oct 11 16:49:30 2009 (r197963) @@ -90,6 +90,7 @@ userret(struct thread *td, struct trapfr CTR3(KTR_SYSC, "userret: thread %p (pid %d, %s)", td, p->p_pid, td->td_name); +#if 0 #ifdef DIAGNOSTIC /* Check that we called signotify() enough. */ PROC_LOCK(p); @@ -100,6 +101,7 @@ userret(struct thread *td, struct trapfr thread_unlock(td); PROC_UNLOCK(p); #endif +#endif #ifdef KTRACE KTRUSERRET(td); #endif @@ -218,7 +220,14 @@ ast(struct trapframe *framep) ktrcsw(0, 1); #endif } - if (flags & TDF_NEEDSIGCHK) { + + /* + * Check for signals. Unlocked reads of p_pendingcnt or + * p_siglist might cause process-directed signal to be handled + * later. + */ + if (flags & TDF_NEEDSIGCHK || p->p_pendingcnt > 0 || + !SIGISEMPTY(p->p_siglist)) { PROC_LOCK(p); mtx_lock(&p->p_sigacts->ps_mtx); while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0) Modified: head/sys/sys/signalvar.h ============================================================================== --- head/sys/sys/signalvar.h Sun Oct 11 16:44:58 2009 (r197962) +++ head/sys/sys/signalvar.h Sun Oct 11 16:49:30 2009 (r197963) @@ -252,9 +252,10 @@ typedef struct sigqueue { /* Return nonzero if process p has an unmasked pending signal. */ #define SIGPENDING(td) \ - (!SIGISEMPTY((td)->td_siglist) && \ - !sigsetmasked(&(td)->td_siglist, &(td)->td_sigmask)) - + ((!SIGISEMPTY((td)->td_siglist) && \ + !sigsetmasked(&(td)->td_siglist, &(td)->td_sigmask)) || \ + (!SIGISEMPTY((td)->td_proc->p_siglist) && \ + !sigsetmasked(&(td)->td_proc->p_siglist, &(td)->td_sigmask))) /* * Return the value of the pseudo-expression ((*set & ~*mask) != 0). This * is an optimized version of SIGISEMPTY() on a temporary variable @@ -336,6 +337,7 @@ void sigexit(struct thread *td, int sign int sig_ffs(sigset_t *set); void siginit(struct proc *p); void signotify(struct thread *td); +void tdsigcleanup(struct thread *td); int tdsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi); void trapsignal(struct thread *td, ksiginfo_t *); From kib at FreeBSD.org Sun Oct 11 17:04:14 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 11 17:04:21 2009 Subject: svn commit: r197965 - in head/tools/regression/sigqueue: sigqtest1 sigqtest2 Message-ID: <200910111704.n9BH4DMu017945@svn.freebsd.org> Author: kib Date: Sun Oct 11 17:04:13 2009 New Revision: 197965 URL: http://svn.freebsd.org/changeset/base/197965 Log: Tweaks for sigqueue tests: - slightly adjust code for style, sort headers. - in sigqtest2, print received signals, to make it easy to see why test failed. - in sigqtest2, job_control_test(), cover a race by adding sleep after child stopped itself to allow for SIGCHLD due to stop and exit to not be coalesced. MFC after: 2 weeks Modified: head/tools/regression/sigqueue/sigqtest1/sigqtest1.c head/tools/regression/sigqueue/sigqtest2/sigqtest2.c Modified: head/tools/regression/sigqueue/sigqtest1/sigqtest1.c ============================================================================== --- head/tools/regression/sigqueue/sigqtest1/sigqtest1.c Sun Oct 11 16:52:24 2009 (r197964) +++ head/tools/regression/sigqueue/sigqtest1/sigqtest1.c Sun Oct 11 17:04:13 2009 (r197965) @@ -1,12 +1,14 @@ /* $FreeBSD$ */ -#include -#include #include #include +#include +#include +#include int received; -void handler(int sig, siginfo_t *si, void *ctx) +void +handler(int sig, siginfo_t *si, void *ctx) { if (si->si_code != SI_QUEUE) errx(1, "si_code != SI_QUEUE"); @@ -15,7 +17,8 @@ void handler(int sig, siginfo_t *si, voi received++; } -int main() +int +main() { struct sigaction sa; union sigval val; Modified: head/tools/regression/sigqueue/sigqtest2/sigqtest2.c ============================================================================== --- head/tools/regression/sigqueue/sigqtest2/sigqtest2.c Sun Oct 11 16:52:24 2009 (r197964) +++ head/tools/regression/sigqueue/sigqtest2/sigqtest2.c Sun Oct 11 17:04:13 2009 (r197965) @@ -1,24 +1,29 @@ /* $FreeBSD$ */ -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include int stop_received; int exit_received; int cont_received; -void job_handler(int sig, siginfo_t *si, void *ctx) +void +job_handler(int sig, siginfo_t *si, void *ctx) { int status; int ret; if (si->si_code == CLD_STOPPED) { + printf("%d: stop received\n", si->si_pid); stop_received = 1; kill(si->si_pid, SIGCONT); } else if (si->si_code == CLD_EXITED) { + printf("%d: exit received\n", si->si_pid); ret = waitpid(si->si_pid, &status, 0); if (ret == -1) errx(1, "waitpid"); @@ -26,11 +31,13 @@ void job_handler(int sig, siginfo_t *si, errx(1, "!WIFEXITED(status)"); exit_received = 1; } else if (si->si_code == CLD_CONTINUED) { + printf("%d: cont received\n", si->si_pid); cont_received = 1; } } -void job_control_test() +void +job_control_test(void) { struct sigaction sa; pid_t pid; @@ -43,9 +50,12 @@ void job_control_test() stop_received = 0; cont_received = 0; exit_received = 0; + fflush(stdout); pid = fork(); if (pid == 0) { + printf("child %d\n", getpid()); kill(getpid(), SIGSTOP); + sleep(2); exit(1); } @@ -60,11 +70,13 @@ void job_control_test() printf("job control test OK.\n"); } -void rtsig_handler(int sig, siginfo_t *si, void *ctx) +void +rtsig_handler(int sig, siginfo_t *si, void *ctx) { } -int main() +int +main() { struct sigaction sa; sigset_t set; From jilles at FreeBSD.org Sun Oct 11 20:19:46 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Sun Oct 11 20:19:52 2009 Subject: svn commit: r197968 - in head/lib: libc/include libc/sys libthr libthr/thread Message-ID: <200910112019.n9BKJjM1028235@svn.freebsd.org> Author: jilles Date: Sun Oct 11 20:19:45 2009 New Revision: 197968 URL: http://svn.freebsd.org/changeset/base/197968 Log: Make openat(2) a cancellation point. This is required by POSIX and matches open(2). Reviewed by: kib, jhb MFC after: 1 month Modified: head/lib/libc/include/namespace.h head/lib/libc/include/un-namespace.h head/lib/libc/sys/Symbol.map head/lib/libthr/pthread.map head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_syscalls.c Modified: head/lib/libc/include/namespace.h ============================================================================== --- head/lib/libc/include/namespace.h Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libc/include/namespace.h Sun Oct 11 20:19:45 2009 (r197968) @@ -80,6 +80,7 @@ #define listen _listen #define nanosleep _nanosleep #define open _open +#define openat _openat #define poll _poll #define pthread_atfork _pthread_atfork #define pthread_attr_destroy _pthread_attr_destroy Modified: head/lib/libc/include/un-namespace.h ============================================================================== --- head/lib/libc/include/un-namespace.h Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libc/include/un-namespace.h Sun Oct 11 20:19:45 2009 (r197968) @@ -61,6 +61,7 @@ #undef listen #undef nanosleep #undef open +#undef openat #undef poll #undef pthread_atfork #undef pthread_attr_destroy Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libc/sys/Symbol.map Sun Oct 11 20:19:45 2009 (r197968) @@ -769,6 +769,8 @@ FBSDprivate_1.0 { __sys_olio_listio; _open; __sys_open; + _openat; + __sys_openat; _pathconf; __sys_pathconf; _pipe; Modified: head/lib/libthr/pthread.map ============================================================================== --- head/lib/libthr/pthread.map Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libthr/pthread.map Sun Oct 11 20:19:45 2009 (r197968) @@ -195,6 +195,7 @@ FBSDprivate_1.0 { __msync; __nanosleep; __open; + __openat; __poll; __pthread_cond_timedwait; __pthread_cond_wait; @@ -406,3 +407,7 @@ FBSD_1.1 { pthread_mutex_setspinloops_np; pthread_mutex_setyieldloops_np; }; + +FBSD_1.2 { + openat; +}; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libthr/thread/thr_private.h Sun Oct 11 20:19:45 2009 (r197968) @@ -668,6 +668,7 @@ void _pthread_cleanup_pop(int); #ifdef _SYS_FCNTL_H_ int __sys_fcntl(int, int, ...); int __sys_open(const char *, int, ...); +int __sys_openat(int, const char *, int, ...); #endif /* #include */ Modified: head/lib/libthr/thread/thr_syscalls.c ============================================================================== --- head/lib/libthr/thread/thr_syscalls.c Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libthr/thread/thr_syscalls.c Sun Oct 11 20:19:45 2009 (r197968) @@ -139,6 +139,7 @@ int __fsync(int); int __msync(void *, size_t, int); int __nanosleep(const struct timespec *, struct timespec *); int __open(const char *, int,...); +int __openat(int, const char *, int,...); int __poll(struct pollfd *, unsigned int, int); ssize_t __read(int, void *buf, size_t); ssize_t __readv(int, const struct iovec *, int); @@ -341,6 +342,33 @@ __open(const char *path, int flags,...) return ret; } +__weak_reference(__openat, openat); + +int +__openat(int fd, const char *path, int flags, ...) +{ + struct pthread *curthread = _get_curthread(); + int ret; + int mode = 0; + va_list ap; + + _thr_cancel_enter(curthread); + + /* Check if the file is being created: */ + if (flags & O_CREAT) { + /* Get the creation mode: */ + va_start(ap, flags); + mode = va_arg(ap, int); + va_end(ap); + } + + ret = __sys_openat(fd, path, flags, mode); + + _thr_cancel_leave(curthread); + + return ret; +} + __weak_reference(__poll, poll); int From marcel at FreeBSD.org Sun Oct 11 20:42:27 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sun Oct 11 20:42:38 2009 Subject: svn commit: r197969 - head/sys/conf Message-ID: <200910112042.n9BKgRCQ029985@svn.freebsd.org> Author: marcel Date: Sun Oct 11 20:42:26 2009 New Revision: 197969 URL: http://svn.freebsd.org/changeset/base/197969 Log: Scan for option ROMs on i386 and amd64 only. Modified: head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.i386 Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Oct 11 20:19:45 2009 (r197968) +++ head/sys/conf/files Sun Oct 11 20:42:26 2009 (r197969) @@ -1919,7 +1919,6 @@ gnu/fs/reiserfs/reiserfs_vnops.c optiona isa/isa_if.m standard isa/isa_common.c optional isa isa/isahint.c optional isa -isa/orm.c optional isa isa/pnp.c optional isa isapnp isa/pnpparse.c optional isa isapnp fs/cd9660/cd9660_bmap.c optional cd9660 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sun Oct 11 20:19:45 2009 (r197968) +++ head/sys/conf/files.amd64 Sun Oct 11 20:42:26 2009 (r197969) @@ -228,6 +228,7 @@ dev/syscons/scvtb.c optional sc dev/uart/uart_cpu_amd64.c optional uart dev/wpi/if_wpi.c optional wpi isa/atrtc.c standard +isa/orm.c optional isa isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/link_elf_obj.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Sun Oct 11 20:19:45 2009 (r197968) +++ head/sys/conf/files.i386 Sun Oct 11 20:42:26 2009 (r197969) @@ -362,6 +362,7 @@ i386/svr4/svr4_locore.s optional compat i386/svr4/svr4_machdep.c optional compat_svr4 # isa/atrtc.c optional atpic +isa/orm.c optional isa isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_aout.c optional compat_aout From rwatson at FreeBSD.org Sun Oct 11 20:55:09 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Oct 11 20:55:15 2009 Subject: svn commit: r197949 - head/lib/libc/sys In-Reply-To: <200910110008.n9B08tQc095922@svn.freebsd.org> References: <200910110008.n9B08tQc095922@svn.freebsd.org> Message-ID: On Sun, 11 Oct 2009, David Schultz wrote: > Log: > Document errno codes added in r144530. Thanks! Seeing this MFC'd for 8.0 wouldn't be such a bad thing either. Robert > Modified: > head/lib/libc/sys/intro.2 > > Modified: head/lib/libc/sys/intro.2 > ============================================================================== > --- head/lib/libc/sys/intro.2 Sat Oct 10 22:29:34 2009 (r197948) > +++ head/lib/libc/sys/intro.2 Sun Oct 11 00:08:55 2009 (r197949) > @@ -456,6 +456,14 @@ The specified extended attribute does no > .It Er 88 EDOOFUS Em "Programming error" . > A function or API is being abused in a way which could only be detected > at run-time. > +.It Er 89 EBADMSG Em "Bad message" . > +A corrupted message was detected. > +.It Er 90 EMULTIHOP Em "Multihop attempted" . > +This error code is unused, but present for compatibility with other systems. > +.It Er 91 ENOLINK Em "Link has been severed" . > +This error code is unused, but present for compatibility with other systems. > +.It Er 92 EPROTO Em "Protocol error" . > +A device or socket encountered an unrecoverable protocol error. > .It Er 93 ENOTCAPABLE Em "Capabilities insufficient" . > An operation on a capability file descriptor requires greater privilege than > the capability allows. > From rpaulo at FreeBSD.org Mon Oct 12 10:08:59 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Oct 12 10:09:06 2009 Subject: svn commit: r197975 - head/sys/net80211 Message-ID: <200910121008.n9CA8wId052976@svn.freebsd.org> Author: rpaulo Date: Mon Oct 12 10:08:58 2009 New Revision: 197975 URL: http://svn.freebsd.org/changeset/base/197975 Log: Another 3.03 draft bit that I missed in the previous 802.11s stack update. The Mesh Configuration IE has changed quite a bit. Refactor the code to handle this change. MFC after: 3 days Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Mon Oct 12 07:29:50 2009 (r197974) +++ head/sys/net80211/ieee80211_hwmp.c Mon Oct 12 10:08:58 2009 (r197975) @@ -192,7 +192,7 @@ static ieee80211_recv_action_func hwmp_r static struct ieee80211_mesh_proto_path mesh_proto_hwmp = { .mpp_descr = "HWMP", - .mpp_ie = IEEE80211_MESHCONF_HWMP, + .mpp_ie = IEEE80211_MESHCONF_PATH_HWMP, .mpp_discover = hwmp_discover, .mpp_peerdown = hwmp_peerdown, .mpp_vattach = hwmp_vattach, Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Mon Oct 12 07:29:50 2009 (r197974) +++ head/sys/net80211/ieee80211_mesh.c Mon Oct 12 10:08:58 2009 (r197975) @@ -132,7 +132,7 @@ static ieee80211_send_action_func mesh_s static const struct ieee80211_mesh_proto_metric mesh_metric_airtime = { .mpm_descr = "AIRTIME", - .mpm_ie = IEEE80211_MESHCONF_AIRTIME, + .mpm_ie = IEEE80211_MESHCONF_METRIC_AIRTIME, .mpm_metric = mesh_airtime_calc, }; @@ -344,18 +344,18 @@ int ieee80211_mesh_register_proto_path(const struct ieee80211_mesh_proto_path *mpp) { int i, firstempty = -1; - static const uint8_t emptyie[4] = { 0, 0, 0, 0 }; for (i = 0; i < N(mesh_proto_paths); i++) { - if (memcmp(mpp->mpp_ie, mesh_proto_paths[i].mpp_ie, 4) == 0) + if (strncmp(mpp->mpp_descr, mesh_proto_paths[i].mpp_descr, + IEEE80211_MESH_PROTO_DSZ) == 0) return EEXIST; - if (memcmp(mesh_proto_paths[i].mpp_ie, emptyie, 4) == 0 && - firstempty == -1) + if (!mesh_proto_paths[i].mpp_active && firstempty == -1) firstempty = i; } if (firstempty < 0) return ENOSPC; memcpy(&mesh_proto_paths[firstempty], mpp, sizeof(*mpp)); + mesh_proto_paths[firstempty].mpp_active = 1; return 0; } @@ -364,18 +364,18 @@ ieee80211_mesh_register_proto_metric(con ieee80211_mesh_proto_metric *mpm) { int i, firstempty = -1; - static const uint8_t emptyie[4] = { 0, 0, 0, 0 }; for (i = 0; i < N(mesh_proto_metrics); i++) { - if (memcmp(mpm->mpm_ie, mesh_proto_metrics[i].mpm_ie, 4) == 0) + if (strncmp(mpm->mpm_descr, mesh_proto_metrics[i].mpm_descr, + IEEE80211_MESH_PROTO_DSZ) == 0) return EEXIST; - if (memcmp(mesh_proto_metrics[i].mpm_ie, emptyie, 4) == 0 && - firstempty == -1) + if (!mesh_proto_metrics[i].mpm_active && firstempty == -1) firstempty = i; } if (firstempty < 0) return ENOSPC; memcpy(&mesh_proto_metrics[firstempty], mpm, sizeof(*mpm)); + mesh_proto_metrics[firstempty].mpm_active = 1; return 0; } @@ -2282,51 +2282,40 @@ mesh_verify_meshid(struct ieee80211vap * static int mesh_verify_meshconf(struct ieee80211vap *vap, const uint8_t *ie) { - static const uint8_t null[4] = IEEE80211_MESHCONF_NULL; const struct ieee80211_meshconf_ie *meshconf = (const struct ieee80211_meshconf_ie *) ie; const struct ieee80211_mesh_state *ms = vap->iv_mesh; if (meshconf == NULL) return 1; - if (meshconf->conf_ver != IEEE80211_MESHCONF_VERSION) { + if (meshconf->conf_pselid != ms->ms_ppath->mpp_ie) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "wrong mesh conf version: %d\n", meshconf->conf_ver); + "unknown path selection algorithm: 0x%x\n", + meshconf->conf_pselid); return 1; } - if (memcmp(meshconf->conf_pselid, ms->ms_ppath->mpp_ie, 4) != 0) { + if (meshconf->conf_pmetid != ms->ms_pmetric->mpm_ie) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown path selection algorithm: 0x%x%x%x%x\n", - meshconf->conf_pselid[0], meshconf->conf_pselid[1], - meshconf->conf_pselid[2], meshconf->conf_pselid[3]); + "unknown path metric algorithm: 0x%x\n", + meshconf->conf_pmetid); return 1; } - if (memcmp(meshconf->conf_pmetid, ms->ms_pmetric->mpm_ie, 4) != 0) { + if (meshconf->conf_ccid != 0) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown path metric algorithm: 0x%x%x%x%x\n", - meshconf->conf_pmetid[0], meshconf->conf_pmetid[1], - meshconf->conf_pmetid[2], meshconf->conf_pmetid[3]); + "unknown congestion control algorithm: 0x%x\n", + meshconf->conf_ccid); return 1; } - if (memcmp(meshconf->conf_ccid, null, 4) != 0) { + if (meshconf->conf_syncid != IEEE80211_MESHCONF_SYNC_NEIGHOFF) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown congestion sig algorithm: 0x%x%x%x%x\n", - meshconf->conf_ccid[0], meshconf->conf_ccid[1], - meshconf->conf_ccid[2], meshconf->conf_ccid[3]); + "unknown sync algorithm: 0x%x\n", + meshconf->conf_syncid); return 1; } - if (memcmp(meshconf->conf_syncid, null, 4) != 0) { + if (meshconf->conf_authid != 0) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown sync algorithm: 0x%x%x%x%x\n", - meshconf->conf_syncid[0], meshconf->conf_syncid[1], - meshconf->conf_syncid[2], meshconf->conf_syncid[3]); - return 1; - } - if (memcmp(meshconf->conf_authid, null, 4) != 0) { - IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown auth auth algorithm: 0x%x%x%x%x\n", - meshconf->conf_pselid[0], meshconf->conf_pselid[1], - meshconf->conf_pselid[2], meshconf->conf_pselid[3]); + "unknown auth auth algorithm: 0x%x\n", + meshconf->conf_pselid); return 1; } /* Not accepting peers */ @@ -2394,24 +2383,16 @@ uint8_t * ieee80211_add_meshconf(uint8_t *frm, struct ieee80211vap *vap) { const struct ieee80211_mesh_state *ms = vap->iv_mesh; - static const uint8_t null[4] = IEEE80211_MESHCONF_NULL; KASSERT(vap->iv_opmode == IEEE80211_M_MBSS, ("not a MBSS vap")); *frm++ = IEEE80211_ELEMID_MESHCONF; *frm++ = sizeof(struct ieee80211_meshconf_ie) - 2; - *frm++ = IEEE80211_MESHCONF_VERSION; - memcpy(frm, ms->ms_ppath->mpp_ie, 4); /* path selection */ - frm += 4; - memcpy(frm, ms->ms_pmetric->mpm_ie, 4); /* link metric */ - frm += 4; - /* XXX null for now */ - memcpy(frm, null, 4); /* congestion control */ - frm += 4; - memcpy(frm, null, 4); /* sync */ - frm += 4; - memcpy(frm, null, 4); /* auth */ - frm += 4; + *frm++ = ms->ms_ppath->mpp_ie; /* path selection */ + *frm++ = ms->ms_pmetric->mpm_ie; /* link metric */ + *frm++ = IEEE80211_MESHCONF_CC_DISABLED; + *frm++ = IEEE80211_MESHCONF_SYNC_NEIGHOFF; + *frm++ = IEEE80211_MESHCONF_AUTH_DISABLED; /* NB: set the number of neighbors before the rest */ *frm = (ms->ms_neighbors > 15 ? 15 : ms->ms_neighbors) << 1; if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) @@ -2440,7 +2421,7 @@ ieee80211_add_meshpeer(uint8_t *frm, uin *frm++ = IEEE80211_ELEMID_MESHPEER; switch (subtype) { case IEEE80211_MESH_PEER_LINK_OPEN: - *frm++ = 6; /* length */ + frm++ = 6; /* length */ memcpy(frm, meshpeerproto, 4); frm += 4; ADDSHORT(frm, localid); /* local ID */ Modified: head/sys/net80211/ieee80211_mesh.h ============================================================================== --- head/sys/net80211/ieee80211_mesh.h Mon Oct 12 07:29:50 2009 (r197974) +++ head/sys/net80211/ieee80211_mesh.h Mon Oct 12 10:08:58 2009 (r197975) @@ -43,47 +43,27 @@ struct ieee80211_meshconf_ie { uint8_t conf_ie; /* IEEE80211_ELEMID_MESHCONF */ uint8_t conf_len; - uint8_t conf_ver; - uint8_t conf_pselid[4]; /* Active Path Sel. Proto. ID */ - uint8_t conf_pmetid[4]; /* APS Metric Identifier */ - uint8_t conf_ccid[4]; /* Congestion Control Mode ID */ - uint8_t conf_syncid[4]; /* Sync. Protocol ID */ - uint8_t conf_authid[4]; /* Auth. Protocol ID */ + uint8_t conf_pselid; /* Active Path Sel. Proto. ID */ + uint8_t conf_pmetid; /* Active Metric Identifier */ + uint8_t conf_ccid; /* Congestion Control Mode ID */ + uint8_t conf_syncid; /* Sync. Protocol ID */ + uint8_t conf_authid; /* Auth. Protocol ID */ uint8_t conf_form; /* Formation Information */ uint8_t conf_cap; } __packed; -#define IEEE80211_MESHCONF_VERSION 1 -/* Null Protocol */ -#define IEEE80211_MESHCONF_NULL_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_NULL_VALUE 0xff -#define IEEE80211_MESHCONF_NULL { IEEE80211_MESHCONF_NULL_OUI, \ - IEEE80211_MESHCONF_NULL_VALUE } /* Hybrid Wireless Mesh Protocol */ -#define IEEE80211_MESHCONF_HWMP_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_HWMP_VALUE 0x00 -#define IEEE80211_MESHCONF_HWMP { IEEE80211_MESHCONF_HWMP_OUI, \ - IEEE80211_MESHCONF_HWMP_VALUE } +#define IEEE80211_MESHCONF_PATH_HWMP 0x00 /* Airtime Link Metric */ -#define IEEE80211_MESHCONF_AIRTIME_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_AIRTIME_VALUE 0x00 -#define IEEE80211_MESHCONF_AIRTIME { IEEE80211_MESHCONF_AIRTIME_OUI, \ - IEEE80211_MESHCONF_AIRTIME_VALUE } -/* Congestion Control Signaling */ -#define IEEE80211_MESHCONF_CCSIG_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_CCSIG_VALUE 0x00 -#define IEEE80211_MESHCONF_CCSIG { IEEE80211_MESHCONF_CCSIG_OUI,\ - IEEE80211_MESHCONF_CCSIG_VALUE } +#define IEEE80211_MESHCONF_METRIC_AIRTIME 0x00 +/* Congestion Control */ +#define IEEE80211_MESHCONF_CC_DISABLED 0x00 +#define IEEE80211_MESHCONF_CC_SIG 0x01 /* Neighbour Offset */ -#define IEEE80211_MESHCONF_NEIGHOFF_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_NEIGHOFF_VALUE 0x00 -#define IEEE80211_MESHCONF_NEIGHOFF { IEEE80211_MESHCONF_NEIGHOFF_OUI, \ - IEEE80211_MESHCONF_NEIGHOFF_VALUE } +#define IEEE80211_MESHCONF_SYNC_NEIGHOFF 0x00 +#define IEEE80211_MESHCONF_AUTH_DISABLED 0x00 /* Simultaneous Authenticaction of Equals */ -#define IEEE80211_MESHCONF_SAE_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_SAE_VALUE 0x01 -#define IEEE80211_MESHCONF_SAE { IEEE80211_MESHCONF_SAE_OUI, \ - IEEE80211_MESHCONF_SAE_VALUE } +#define IEEE80211_MESHCONF_AUTH_SAE 0x01 #define IEEE80211_MESHCONF_FORM_MP 0x01 /* Connected to Portal */ #define IEEE80211_MESHCONF_FORM_NNEIGH_MASK 0x04 /* Number of Neighbours */ #define IEEE80211_MESHCONF_CAP_AP 0x01 /* Accepting Peers */ @@ -390,8 +370,9 @@ struct ieee80211_mesh_route { */ enum ieee80211_state; struct ieee80211_mesh_proto_path { + uint8_t mpp_active; char mpp_descr[IEEE80211_MESH_PROTO_DSZ]; - uint8_t mpp_ie[4]; + uint8_t mpp_ie; struct ieee80211_node * (*mpp_discover)(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], @@ -411,8 +392,9 @@ struct ieee80211_mesh_proto_path { * Mesh Link Metric Report Protocol. */ struct ieee80211_mesh_proto_metric { + uint8_t mpm_active; char mpm_descr[IEEE80211_MESH_PROTO_DSZ]; - uint8_t mpm_ie[4]; + uint8_t mpm_ie; uint32_t (*mpm_metric)(struct ieee80211_node *); }; From kib at FreeBSD.org Mon Oct 12 10:09:48 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Oct 12 10:10:00 2009 Subject: svn commit: r197976 - head/sys/kern Message-ID: <200910121009.n9CA9mMm053031@svn.freebsd.org> Author: kib Date: Mon Oct 12 10:09:48 2009 New Revision: 197976 URL: http://svn.freebsd.org/changeset/base/197976 Log: Fix typo. Submitted by: rdivacky MFC after: 1 month Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Oct 12 10:08:58 2009 (r197975) +++ head/sys/kern/kern_sig.c Mon Oct 12 10:09:48 2009 (r197976) @@ -1014,7 +1014,7 @@ kern_sigprocmask(struct thread *td, int } /* - * The new_block set contains signals that were not previosly + * The new_block set contains signals that were not previously * blocked, but are blocked now. * * In case we block any signal that was not previously blocked From rpaulo at FreeBSD.org Mon Oct 12 10:30:15 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Oct 12 10:30:26 2009 Subject: svn commit: r197977 - head/sys/net80211 Message-ID: <200910121030.n9CAUFUK053419@svn.freebsd.org> Author: rpaulo Date: Mon Oct 12 10:30:15 2009 New Revision: 197977 URL: http://svn.freebsd.org/changeset/base/197977 Log: Fix a wrong initialization that snuck in the latest commit. MFC after: 3 days Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Mon Oct 12 10:09:48 2009 (r197976) +++ head/sys/net80211/ieee80211_mesh.c Mon Oct 12 10:30:15 2009 (r197977) @@ -2421,7 +2421,7 @@ ieee80211_add_meshpeer(uint8_t *frm, uin *frm++ = IEEE80211_ELEMID_MESHPEER; switch (subtype) { case IEEE80211_MESH_PEER_LINK_OPEN: - frm++ = 6; /* length */ + *frm++ = 6; /* length */ memcpy(frm, meshpeerproto, 4); frm += 4; ADDSHORT(frm, localid); /* local ID */ From alan.bsd at gmail.com Mon Oct 12 10:54:03 2009 From: alan.bsd at gmail.com (Alan R. S. Bueno) Date: Mon Oct 12 10:54:40 2009 Subject: svn commit: r197949 - head/lib/libc/sys In-Reply-To: References: <200910110008.n9B08tQc095922@svn.freebsd.org> Message-ID: On Sun, Oct 11, 2009 at 5:55 PM, Robert Watson wrote: > > On Sun, 11 Oct 2009, David Schultz wrote: > >> Log: >> ?Document errno codes added in r144530. > > Thanks! ?Seeing this MFC'd for 8.0 wouldn't be such a bad thing either. > > Robert > > > >> Modified: >> ?head/lib/libc/sys/intro.2 >> >> Modified: head/lib/libc/sys/intro.2 >> >> ============================================================================== >> --- head/lib/libc/sys/intro.2 ? Sat Oct 10 22:29:34 2009 ? ? ? ?(r197948) >> +++ head/lib/libc/sys/intro.2 ? Sun Oct 11 00:08:55 2009 ? ? ? ?(r197949) >> @@ -456,6 +456,14 @@ The specified extended attribute does no >> .It Er 88 EDOOFUS Em "Programming error" . >> A function or API is being abused in a way which could only be detected >> at run-time. >> +.It Er 89 EBADMSG Em "Bad message" . >> +A corrupted message was detected. >> +.It Er 90 EMULTIHOP Em "Multihop attempted" . >> +This error code is unused, but present for compatibility with other >> systems. >> +.It Er 91 ENOLINK Em "Link has been severed" . >> +This error code is unused, but present for compatibility with other >> systems. >> +.It Er 92 EPROTO Em "Protocol error" . >> +A device or socket encountered an unrecoverable protocol error. >> .It Er 93 ENOTCAPABLE Em "Capabilities insufficient" . >> An operation on a capability file descriptor requires greater privilege >> than >> the capability allows. >> Hi, That modification also imply modifying the template NLS catalog and the translations (or maybe translators should be advised to update their files (I don't know if they are aware of the change)). The patch to C.msg: Index: C.msg =================================================================== RCS file: /home/ncvs/src/lib/libc/nls/C.msg,v retrieving revision 1.1 diff -u -r1.1 C.msg --- C.msg 27 Feb 2005 17:59:39 -0000 1.1 +++ C.msg 12 Oct 2009 10:14:33 -0000 @@ -181,6 +181,16 @@ 87 Attribute not found $ EDOOFUS 88 Programming error +$ EBADMSG +89 Bad message +$ EMULTIHOP +90 Multihop attempted +$ ENOLINK +91 Link has been severed +$ EPROTO +92 Protocol error +$ ENOTCAPABLE +93 Capabilities insufficient $ $ strsignal() support catalog $ Thanks! From rpaulo at FreeBSD.org Mon Oct 12 14:51:20 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Oct 12 14:51:26 2009 Subject: svn commit: r197980 - head/sbin/ifconfig Message-ID: <200910121451.n9CEpJb4070288@svn.freebsd.org> Author: rpaulo Date: Mon Oct 12 14:51:19 2009 New Revision: 197980 URL: http://svn.freebsd.org/changeset/base/197980 Log: Update for latest 802.11s changes in meshconf format. MFC after: 3 days Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Mon Oct 12 12:54:34 2009 (r197979) +++ head/sbin/ifconfig/ifieee80211.c Mon Oct 12 14:51:19 2009 (r197980) @@ -2624,25 +2624,31 @@ do { \ if (verbose) { const struct ieee80211_meshconf_ie *mconf = (const struct ieee80211_meshconf_ie *)ie; - const uint8_t null[4] = IEEE80211_MESHCONF_NULL; - const uint8_t hwmp[4] = IEEE80211_MESHCONF_HWMP; - const uint8_t airtime[4] = IEEE80211_MESHCONF_AIRTIME; - const uint8_t ccsig[4] = IEEE80211_MESHCONF_CCSIG; - const uint8_t sae[4] = IEEE80211_MESHCONF_SAE; - const uint8_t neighoff[4] = IEEE80211_MESHCONF_SAE; - printf("conf_ver); - MATCHOUI(mconf->conf_pselid, hwmp, "HWMP"); + printf("conf_pselid == IEEE80211_MESHCONF_PATH_HWMP) + printf("HWMP"); + else + printf("UNKNOWN"); printf(" LINK:"); - MATCHOUI(mconf->conf_pmetid, airtime, "AIRTIME"); + if (mconf->conf_pmetid == IEEE80211_MESHCONF_METRIC_AIRTIME) + printf("AIRTIME"); + else + printf("UNKNOWN"); printf(" CONGESTION:"); - MATCHOUI(mconf->conf_ccid, ccsig, "SIG"); - MATCHOUI(mconf->conf_ccid, null, "NULL"); + if (mconf->conf_ccid == IEEE80211_MESHCONF_CC_DISABLED) + printf("DISABLED"); + else + printf("UNKNOWN"); printf(" SYNC:"); - MATCHOUI(mconf->conf_syncid, neighoff, "NEIGHOFF"); - MATCHOUI(mconf->conf_syncid, null, "NULL"); + if (mconf->conf_syncid == IEEE80211_MESHCONF_SYNC_NEIGHOFF) + printf("NEIGHOFF"); + else + printf("UNKNOWN"); printf(" AUTH:"); - MATCHOUI(mconf->conf_authid, sae, "SAE"); - MATCHOUI(mconf->conf_authid, null, "NULL"); + if (mconf->conf_authid == IEEE80211_MESHCONF_AUTH_DISABLED) + printf("DISABLED"); + else + printf("UNKNOWN"); printf(" FORM:0x%x CAPS:0x%x>", mconf->conf_form, mconf->conf_cap); } From jkoshy at FreeBSD.org Mon Oct 12 15:49:49 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Mon Oct 12 15:49:56 2009 Subject: svn commit: r197983 - head/sys/kern Message-ID: <200910121549.n9CFnm9Q073871@svn.freebsd.org> Author: jkoshy Date: Mon Oct 12 15:49:48 2009 New Revision: 197983 URL: http://svn.freebsd.org/changeset/base/197983 Log: Improve the description of sysctl "kern.sugid_coredump". Submitted by: Mel Flynn on -hackers Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Oct 12 15:46:17 2009 (r197982) +++ head/sys/kern/kern_sig.c Mon Oct 12 15:49:48 2009 (r197983) @@ -162,7 +162,7 @@ SYSINIT(signal, SI_SUB_P1003_1B, SI_ORDE int sugid_coredump; SYSCTL_INT(_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW, - &sugid_coredump, 0, "Enable coredumping set user/group ID processes"); + &sugid_coredump, 0, "Allow setuid and setgid processes to dump core"); static int do_coredump = 1; SYSCTL_INT(_kern, OID_AUTO, coredump, CTLFLAG_RW, From bland at FreeBSD.org Mon Oct 12 17:10:51 2009 From: bland at FreeBSD.org (Alexander Nedotsukov) Date: Mon Oct 12 17:11:03 2009 Subject: svn commit: r197995 - in head/kerberos5/lib: libgssapi_krb5 libgssapi_spnego Message-ID: <200910121710.n9CHApOl078521@svn.freebsd.org> Author: bland (ports committer) Date: Mon Oct 12 17:10:51 2009 New Revision: 197995 URL: http://svn.freebsd.org/changeset/base/197995 Log: Link GSS mechanics modules against libgssapi so they will not fail due unresolved symbol errors when in turn libgssapi was loaded with RTLD_LOCAL flag set (which is the default). Reviewed by: dfr, jhb MFC after: 3 days Modified: head/kerberos5/lib/libgssapi_krb5/Makefile head/kerberos5/lib/libgssapi_spnego/Makefile Modified: head/kerberos5/lib/libgssapi_krb5/Makefile ============================================================================== --- head/kerberos5/lib/libgssapi_krb5/Makefile Mon Oct 12 17:09:35 2009 (r197994) +++ head/kerberos5/lib/libgssapi_krb5/Makefile Mon Oct 12 17:10:51 2009 (r197995) @@ -2,8 +2,8 @@ LIB= gssapi_krb5 LDFLAGS= -Wl,-Bsymbolic -LDADD= -lkrb5 -lhx509 -lcrypto -lroken -lasn1 -lcom_err -lcrypt -DPADD= ${LIBKRB5} ${LIBHX509} ${LIBCRYPTO} ${LIBROKEN} ${LIBASN1} \ +LDADD= -lgssapi -lkrb5 -lhx509 -lcrypto -lroken -lasn1 -lcom_err -lcrypt +DPADD= ${LIBGSSAPI} ${LIBKRB5} ${LIBHX509} ${LIBCRYPTO} ${LIBROKEN} ${LIBASN1} \ ${LIBCOM_ERR} ${LIBCRYPT} INCS= ${KRB5DIR}/lib/gssapi/gssapi/gssapi_krb5.h Modified: head/kerberos5/lib/libgssapi_spnego/Makefile ============================================================================== --- head/kerberos5/lib/libgssapi_spnego/Makefile Mon Oct 12 17:09:35 2009 (r197994) +++ head/kerberos5/lib/libgssapi_spnego/Makefile Mon Oct 12 17:10:51 2009 (r197995) @@ -2,8 +2,8 @@ LIB= gssapi_spnego LDFLAGS= -Wl,-Bsymbolic -LDADD= -lasn1 -DPADD= ${LIBASN1} +LDADD= -lgssapi -lasn1 +DPADD= ${LIBGSSAPI} ${LIBASN1} SRCS= accept_sec_context.c \ compat.c \ From rmacklem at uoguelph.ca Mon Oct 12 17:45:28 2009 From: rmacklem at uoguelph.ca (Rick Macklem) Date: Mon Oct 12 17:45:39 2009 Subject: svn commit: r197995 - in head/kerberos5/lib: libgssapi_krb5 libgssapi_spnego In-Reply-To: <200910121710.n9CHApOl078521@svn.freebsd.org> References: <200910121710.n9CHApOl078521@svn.freebsd.org> Message-ID: On Mon, 12 Oct 2009, Alexander Nedotsukov wrote: > Author: bland (ports committer) > Date: Mon Oct 12 17:10:51 2009 > New Revision: 197995 > URL: http://svn.freebsd.org/changeset/base/197995 > > Log: > Link GSS mechanics modules against libgssapi so they will not fail due > unresolved symbol errors when in turn libgssapi was loaded with RTLD_LOCAL > flag set (which is the default). > Thanks a lot for dealing with this, rick From hrs at FreeBSD.org Mon Oct 12 18:54:03 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Mon Oct 12 18:54:14 2009 Subject: svn commit: r197996 - head/sys/netinet6 Message-ID: <200910121854.n9CIs2hg080743@svn.freebsd.org> Author: hrs Date: Mon Oct 12 18:54:02 2009 New Revision: 197996 URL: http://svn.freebsd.org/changeset/base/197996 Log: - Do not assign a link-local address when ND6_IFF_IFDISABLED. Adding a tentative address is useless. - Comment out a confused warning message when in6_ifattach_linklocal() fails. This can occur when the interface does not support ioctl(SIOCAIFADDR) (interfaces associated with 802.11 wireless network device drivers, for example). Modified: head/sys/netinet6/in6_ifattach.c Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Mon Oct 12 17:10:51 2009 (r197995) +++ head/sys/netinet6/in6_ifattach.c Mon Oct 12 18:54:02 2009 (r197996) @@ -751,16 +751,19 @@ in6_ifattach(struct ifnet *ifp, struct i * assign a link-local address, if there's none. */ if (ifp->if_type != IFT_BRIDGE && + !(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { int error; ia = in6ifa_ifpforlinklocal(ifp, 0); if (ia == NULL) { error = in6_ifattach_linklocal(ifp, altifp); +#if 0 if (error) log(LOG_NOTICE, "in6_ifattach_linklocal: " "failed to add a link-local addr to %s\n", if_name(ifp)); +#endif } else ifa_free(&ia->ia_ifa); } From rwatson at FreeBSD.org Mon Oct 12 18:58:43 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 12 18:58:55 2009 Subject: svn commit: r197997 - head/sys/nfsclient Message-ID: <200910121858.n9CIwhCx080881@svn.freebsd.org> Author: rwatson Date: Mon Oct 12 18:58:42 2009 New Revision: 197997 URL: http://svn.freebsd.org/changeset/base/197997 Log: Add a MODULE_DEPEND() on the NFS client from dtnfsclient so that dtnfsclient can access NFS client symbols. MFC after: 3 days Discussed with: kib Reported by: markm Modified: head/sys/nfsclient/nfs_kdtrace.c Modified: head/sys/nfsclient/nfs_kdtrace.c ============================================================================== --- head/sys/nfsclient/nfs_kdtrace.c Mon Oct 12 18:54:02 2009 (r197996) +++ head/sys/nfsclient/nfs_kdtrace.c Mon Oct 12 18:58:42 2009 (r197997) @@ -543,3 +543,4 @@ DEV_MODULE(dtnfsclient, dtnfsclient_mode MODULE_VERSION(dtnfsclient, 1); MODULE_DEPEND(dtnfsclient, dtrace, 1, 1, 1); MODULE_DEPEND(dtnfsclient, opensolaris, 1, 1, 1); +MODULE_DEPEND(dtnfsclient, nfs, 1, 1, 1); From rwatson at FreeBSD.org Mon Oct 12 18:59:32 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 12 18:59:38 2009 Subject: svn commit: r197998 - head/sys/modules/nfsclient Message-ID: <200910121859.n9CIxVfa080932@svn.freebsd.org> Author: rwatson Date: Mon Oct 12 18:59:31 2009 New Revision: 197998 URL: http://svn.freebsd.org/changeset/base/197998 Log: Export DTrace symbols from nfsclient so that dtnfsclient can get to them. This fixes DTrace with nfsclient built as a module. MFC after: 3 days Reported by: markm Modified: head/sys/modules/nfsclient/Makefile Modified: head/sys/modules/nfsclient/Makefile ============================================================================== --- head/sys/modules/nfsclient/Makefile Mon Oct 12 18:58:42 2009 (r197997) +++ head/sys/modules/nfsclient/Makefile Mon Oct 12 18:59:31 2009 (r197998) @@ -41,4 +41,14 @@ NFS_ROOT= 1 SRCS+= nfs_diskless.c .endif +EXPORT_SYMS= \ + dtrace_nfsclient_accesscache_flush_done_probe \ + dtrace_nfsclient_accesscache_get_hit_probe \ + dtrace_nfsclient_accesscache_get_miss_probe \ + dtrace_nfsclient_accesscache_load_done_probe \ + nfsclient_accesscache_flush_done_id \ + nfsclient_accesscache_get_hit_id \ + nfsclient_accesscache_get_miss_id \ + nfsclient_accesscache_load_done_id + .include From hrs at FreeBSD.org Mon Oct 12 19:19:09 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Mon Oct 12 19:19:15 2009 Subject: svn commit: r197999 - head/sys/dev/usb/input Message-ID: <200910121919.n9CJJ9LW083155@svn.freebsd.org> Author: hrs Date: Mon Oct 12 19:19:08 2009 New Revision: 197999 URL: http://svn.freebsd.org/changeset/base/197999 Log: Fix the 106/109 USB Japanese keyboard "underscore" issue. Sun Type 6 USB keyboard support added in rev 1.46 conflicted with some scan codes used in Japanese keyboards because the scan code conversion routine was ambiguous for the overlapped codes. PR: ports/134005 Submitted by: YAMASHIRO Jun Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Mon Oct 12 18:59:31 2009 (r197998) +++ head/sys/dev/usb/input/ukbd.c Mon Oct 12 19:19:08 2009 (r197999) @@ -247,8 +247,8 @@ static const uint8_t ukbd_trtab[256] = { NN, NN, NN, NN, NN, NN, NN, NN, /* 68 - 6F */ NN, NN, NN, NN, 115, 108, 111, 113, /* 70 - 77 */ 109, 110, 112, 118, 114, 116, 117, 119, /* 78 - 7F */ - 121, 120, NN, NN, NN, NN, NN, 115, /* 80 - 87 */ - 112, 125, 121, 123, NN, NN, NN, NN, /* 88 - 8F */ + 121, 120, NN, NN, NN, NN, NN, 123, /* 80 - 87 */ + 124, 125, 126, 127, 128, NN, NN, NN, /* 88 - 8F */ NN, NN, NN, NN, NN, NN, NN, NN, /* 90 - 97 */ NN, NN, NN, NN, NN, NN, NN, NN, /* 98 - 9F */ NN, NN, NN, NN, NN, NN, NN, NN, /* A0 - A7 */ @@ -1636,20 +1636,59 @@ static int ukbd_key2scan(struct ukbd_softc *sc, int code, int shift, int up) { static const int scan[] = { - 0x1c, 0x1d, 0x35, - 0x37 | SCAN_PREFIX_SHIFT, /* PrintScreen */ - 0x38, 0x47, 0x48, 0x49, 0x4b, 0x4d, 0x4f, - 0x50, 0x51, 0x52, 0x53, - 0x46, /* XXX Pause/Break */ - 0x5b, 0x5c, 0x5d, + /* 89 */ + 0x11c, /* Enter */ + /* 90-99 */ + 0x11d, /* Ctrl-R */ + 0x135, /* Divide */ + 0x137 | SCAN_PREFIX_SHIFT, /* PrintScreen */ + 0x138, /* Alt-R */ + 0x147, /* Home */ + 0x148, /* Up */ + 0x149, /* PageUp */ + 0x14b, /* Left */ + 0x14d, /* Right */ + 0x14f, /* End */ + /* 100-109 */ + 0x150, /* Down */ + 0x151, /* PageDown */ + 0x152, /* Insert */ + 0x153, /* Delete */ + 0x146, /* XXX Pause/Break */ + 0x15b, /* Win_L(Super_L) */ + 0x15c, /* Win_R(Super_R) */ + 0x15d, /* Application(Menu) */ + /* SUN TYPE 6 USB KEYBOARD */ - 0x68, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, - 0x64, 0x65, 0x66, 0x67, 0x25, 0x1f, 0x1e, - 0x20, + 0x168, /* Sun Type 6 Help */ + 0x15e, /* Sun Type 6 Stop */ + /* 110 - 119 */ + 0x15f, /* Sun Type 6 Again */ + 0x160, /* Sun Type 6 Props */ + 0x161, /* Sun Type 6 Undo */ + 0x162, /* Sun Type 6 Front */ + 0x163, /* Sun Type 6 Copy */ + 0x164, /* Sun Type 6 Open */ + 0x165, /* Sun Type 6 Paste */ + 0x166, /* Sun Type 6 Find */ + 0x167, /* Sun Type 6 Cut */ + 0x125, /* Sun Type 6 Mute */ + /* 120 - 128 */ + 0x11f, /* Sun Type 6 VolumeDown */ + 0x11e, /* Sun Type 6 VolumeUp */ + 0x120, /* Sun Type 6 PowerDown */ + + /* Japanese 106/109 keyboard */ + 0x73, /* Keyboard Intl' 1 (backslash / underscore) */ + 0x70, /* Keyboard Intl' 2 (Katakana / Hiragana) */ + 0x7d, /* Keyboard Intl' 3 (Yen sign) (Not using in jp106/109) */ + 0x79, /* Keyboard Intl' 4 (Henkan) */ + 0x7b, /* Keyboard Intl' 5 (Muhenkan) */ + 0x5c, /* Keyboard Intl' 6 (Keypad ,) (For PC-9821 layout) */ }; if ((code >= 89) && (code < (89 + (sizeof(scan) / sizeof(scan[0]))))) { - code = scan[code - 89] | SCAN_PREFIX_E0; + code = scan[code - 89]; } /* Pause/Break */ if ((code == 104) && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R)))) { From markm at FreeBSD.org Mon Oct 12 21:10:29 2009 From: markm at FreeBSD.org (Mark Murray) Date: Mon Oct 12 21:11:19 2009 Subject: svn commit: r198005 - head Message-ID: <200910122110.n9CLASd4085940@svn.freebsd.org> Author: markm Date: Mon Oct 12 21:10:28 2009 New Revision: 198005 URL: http://svn.freebsd.org/changeset/base/198005 Log: We haven't installed usbdevs for many moons now, and it doesn't work any more anyway. Add it to the "obsolete" list. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Oct 12 21:08:38 2009 (r198004) +++ head/ObsoleteFiles.inc Mon Oct 12 21:10:28 2009 (r198005) @@ -503,6 +503,8 @@ OLD_FILES+=usr/include/dev/usb/usb_quirk OLD_FILES+=usr/include/dev/usb/usbcdc.h OLD_FILES+=usr/include/dev/usb/usbdivar.h OLD_FILES+=usr/include/dev/usb/uxb360gp_rdesc.h +OLD_FILES+=usr/sbin/usbdevs +OLD_FILES+=usr/share/man/man8/usbdevs.8.gz # 20090203: removal of pccard header files OLD_FILES+=usr/include/pccard/cardinfo.h OLD_FILES+=usr/include/pccard/cis.h From hrs at FreeBSD.org Mon Oct 12 21:11:50 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Mon Oct 12 21:12:02 2009 Subject: svn commit: r198006 - head/sbin/ifconfig Message-ID: <200910122111.n9CLBoDn086011@svn.freebsd.org> Author: hrs Date: Mon Oct 12 21:11:50 2009 New Revision: 198006 URL: http://svn.freebsd.org/changeset/base/198006 Log: Use printb() to display the "nd6 options=" line. Modified: head/sbin/ifconfig/af_nd6.c Modified: head/sbin/ifconfig/af_nd6.c ============================================================================== --- head/sbin/ifconfig/af_nd6.c Mon Oct 12 21:10:28 2009 (r198005) +++ head/sbin/ifconfig/af_nd6.c Mon Oct 12 21:11:50 2009 (r198006) @@ -56,17 +56,9 @@ static const char rcsid[] = #include "ifconfig.h" #define MAX_SYSCTL_TRY 5 - -static struct nd6_opt_list { - const char *label; - u_int mask; -} nd6_opts[] = { - { "IFDISABLED", ND6_IFF_IFDISABLED, }, - { "PERFORMNUD", ND6_IFF_PERFORMNUD, }, - { "ACCEPT_RTADV", ND6_IFF_ACCEPT_RTADV, }, - { "PREFER_SOURCE", ND6_IFF_PREFER_SOURCE, }, - { "AUTO_LINKLOCAL", ND6_IFF_AUTO_LINKLOCAL, }, -}; +#define ND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \ + "\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \ + "\020DEFAULTIF" static int isnd6defif(int); void setnd6flags(const char *, int, int, const struct afswtch *); @@ -153,9 +145,8 @@ nd6_status(int s) char *buf, *next; int mib[6], ntry; int s6; - int i, error; + int error; int isinet6, isdefif; - int nopts; /* Check if the interface has at least one IPv6 address. */ mib[0] = CTL_NET; @@ -220,22 +211,9 @@ nd6_status(int s) close(s6); if (nd.ndi.flags == 0 && !isdefif) return; - - nopts = 0; - printf("\tnd6 options=%d<", nd.ndi.flags); - for (i=0; i < sizeof(nd6_opts)/sizeof(nd6_opts[0]); i++) { - if (nd.ndi.flags & nd6_opts[i].mask) { - if (nopts++) - printf(","); - printf("%s", nd6_opts[i].label); - } - } - if (isdefif) { - if (nopts) - printf(","); - printf("DEFAULTIF"); - } - printf(">\n"); + printb("\tnd6 options", + (unsigned int)(nd.ndi.flags | (isdefif << 15)), ND6BITS); + putchar('\n'); } static struct afswtch af_nd6 = { From bland at FreeBSD.org Tue Oct 13 05:38:08 2009 From: bland at FreeBSD.org (Alexander Nedotsukov) Date: Tue Oct 13 05:38:15 2009 Subject: svn commit: r198020 - head Message-ID: <200910130538.n9D5c8vb096085@svn.freebsd.org> Author: bland (ports committer) Date: Tue Oct 13 05:38:08 2009 New Revision: 198020 URL: http://svn.freebsd.org/changeset/base/198020 Log: Chase dependency changes in libgssapi_krb5 module introruced by revision r197995. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Oct 13 05:05:54 2009 (r198019) +++ head/Makefile.inc1 Tue Oct 13 05:38:08 2009 (r198020) @@ -1122,7 +1122,7 @@ lib/libradius__L secure/lib/libssl__L: s _secure_lib_libssh= secure/lib/libssh secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L .if ${MK_KERBEROS} != "no" -kerberos5/lib/libgssapi_krb5__L: kerberos5/lib/libkrb5__L \ +kerberos5/lib/libgssapi_krb5__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ lib/libmd__L kerberos5/lib/libroken__L secure/lib/libcrypto__L \ lib/libcrypt__L From ed at FreeBSD.org Tue Oct 13 06:25:53 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Tue Oct 13 06:26:00 2009 Subject: svn commit: r198021 - head/games/number Message-ID: <200910130625.n9D6Prka097018@svn.freebsd.org> Author: ed Date: Tue Oct 13 06:25:53 2009 New Revision: 198021 URL: http://svn.freebsd.org/changeset/base/198021 Log: Make number(6) build with WARNS=6. Modified: head/games/number/Makefile head/games/number/number.c Modified: head/games/number/Makefile ============================================================================== --- head/games/number/Makefile Tue Oct 13 05:38:08 2009 (r198020) +++ head/games/number/Makefile Tue Oct 13 06:25:53 2009 (r198021) @@ -4,4 +4,6 @@ PROG= number MAN= number.6 +WARNS?= 6 + .include Modified: head/games/number/number.c ============================================================================== --- head/games/number/number.c Tue Oct 13 05:38:08 2009 (r198020) +++ head/games/number/number.c Tue Oct 13 06:25:53 2009 (r198021) @@ -88,9 +88,7 @@ void usage(void); int lflag; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch, first; char line[256]; @@ -275,7 +273,7 @@ void pfract(len) int len; { - static char *pref[] = { "", "ten-", "hundred-" }; + static char const * const pref[] = { "", "ten-", "hundred-" }; switch(len) { case 1: From imp at bsdimp.com Tue Oct 13 08:08:17 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Tue Oct 13 08:08:24 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <200910112042.n9BKgRCQ029985@svn.freebsd.org> References: <200910112042.n9BKgRCQ029985@svn.freebsd.org> Message-ID: <20091012.232251.420437707.imp@bsdimp.com> In message: <200910112042.n9BKgRCQ029985@svn.freebsd.org> Marcel Moolenaar writes: : Author: marcel : Date: Sun Oct 11 20:42:26 2009 : New Revision: 197969 : URL: http://svn.freebsd.org/changeset/base/197969 : : Log: : Scan for option ROMs on i386 and amd64 only. Why? They should be scanned for on any system with a real isa bus... Warner : Modified: : head/sys/conf/files : head/sys/conf/files.amd64 : head/sys/conf/files.i386 : : Modified: head/sys/conf/files : ============================================================================== : --- head/sys/conf/files Sun Oct 11 20:19:45 2009 (r197968) : +++ head/sys/conf/files Sun Oct 11 20:42:26 2009 (r197969) : @@ -1919,7 +1919,6 @@ gnu/fs/reiserfs/reiserfs_vnops.c optiona : isa/isa_if.m standard : isa/isa_common.c optional isa : isa/isahint.c optional isa : -isa/orm.c optional isa : isa/pnp.c optional isa isapnp : isa/pnpparse.c optional isa isapnp : fs/cd9660/cd9660_bmap.c optional cd9660 : : Modified: head/sys/conf/files.amd64 : ============================================================================== : --- head/sys/conf/files.amd64 Sun Oct 11 20:19:45 2009 (r197968) : +++ head/sys/conf/files.amd64 Sun Oct 11 20:42:26 2009 (r197969) : @@ -228,6 +228,7 @@ dev/syscons/scvtb.c optional sc : dev/uart/uart_cpu_amd64.c optional uart : dev/wpi/if_wpi.c optional wpi : isa/atrtc.c standard : +isa/orm.c optional isa : isa/syscons_isa.c optional sc : isa/vga_isa.c optional vga : kern/link_elf_obj.c standard : : Modified: head/sys/conf/files.i386 : ============================================================================== : --- head/sys/conf/files.i386 Sun Oct 11 20:19:45 2009 (r197968) : +++ head/sys/conf/files.i386 Sun Oct 11 20:42:26 2009 (r197969) : @@ -362,6 +362,7 @@ i386/svr4/svr4_locore.s optional compat : i386/svr4/svr4_machdep.c optional compat_svr4 : # : isa/atrtc.c optional atpic : +isa/orm.c optional isa : isa/syscons_isa.c optional sc : isa/vga_isa.c optional vga : kern/imgact_aout.c optional compat_aout : From rwatson at FreeBSD.org Tue Oct 13 09:21:20 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 13 09:21:33 2009 Subject: svn commit: r198024 - head/sys/modules/nfsclient Message-ID: <200910130921.n9D9LKPJ000323@svn.freebsd.org> Author: rwatson Date: Tue Oct 13 09:21:20 2009 New Revision: 198024 URL: http://svn.freebsd.org/changeset/base/198024 Log: EXPORT_SYMS is not, in fact, required, for a dependent module to access non-static symbols in a module they depend on, so remove dtrace symbols from nfsclient's EXPORT_SYMS again. Suggested by: jhb Modified: head/sys/modules/nfsclient/Makefile Modified: head/sys/modules/nfsclient/Makefile ============================================================================== --- head/sys/modules/nfsclient/Makefile Tue Oct 13 09:21:15 2009 (r198023) +++ head/sys/modules/nfsclient/Makefile Tue Oct 13 09:21:20 2009 (r198024) @@ -41,14 +41,4 @@ NFS_ROOT= 1 SRCS+= nfs_diskless.c .endif -EXPORT_SYMS= \ - dtrace_nfsclient_accesscache_flush_done_probe \ - dtrace_nfsclient_accesscache_get_hit_probe \ - dtrace_nfsclient_accesscache_get_miss_probe \ - dtrace_nfsclient_accesscache_load_done_probe \ - nfsclient_accesscache_flush_done_id \ - nfsclient_accesscache_get_hit_id \ - nfsclient_accesscache_get_miss_id \ - nfsclient_accesscache_load_done_id - .include From rpaulo at FreeBSD.org Tue Oct 13 10:43:17 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Tue Oct 13 10:43:29 2009 Subject: svn commit: r198027 - head/sys/net80211 Message-ID: <200910131043.n9DAhH2a003651@svn.freebsd.org> Author: rpaulo Date: Tue Oct 13 10:43:17 2009 New Revision: 198027 URL: http://svn.freebsd.org/changeset/base/198027 Log: Properly initialize the mesh conf capabilities byte. MFC after: 2 days Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Tue Oct 13 10:14:38 2009 (r198026) +++ head/sys/net80211/ieee80211_mesh.c Tue Oct 13 10:43:17 2009 (r198027) @@ -2398,6 +2398,7 @@ ieee80211_add_meshconf(uint8_t *frm, str if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) *frm |= IEEE80211_MESHCONF_FORM_MP; frm += 1; + *frm = 0; if (ms->ms_flags & IEEE80211_MESHFLAGS_AP) *frm |= IEEE80211_MESHCONF_CAP_AP; if (ms->ms_flags & IEEE80211_MESHFLAGS_FWD) From jhb at FreeBSD.org Tue Oct 13 12:23:29 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Oct 13 12:23:41 2009 Subject: svn commit: r198028 - head/sys/dev/ppbus Message-ID: <200910131223.n9DCNTM6005585@svn.freebsd.org> Author: jhb Date: Tue Oct 13 12:23:28 2009 New Revision: 198028 URL: http://svn.freebsd.org/changeset/base/198028 Log: Correct a copy/paste bug in a comment. lptclose() checks once a second to see if the ppc hardware has gone idle rather than four times a second. Modified: head/sys/dev/ppbus/lpt.c Modified: head/sys/dev/ppbus/lpt.c ============================================================================== --- head/sys/dev/ppbus/lpt.c Tue Oct 13 10:43:17 2009 (r198027) +++ head/sys/dev/ppbus/lpt.c Tue Oct 13 12:23:28 2009 (r198028) @@ -624,7 +624,7 @@ lptclose(struct cdev *dev, int flags, in while ((ppb_rstr(ppbus) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) - /* wait 1/4 second, give up if we get a signal */ + /* wait 1 second, give up if we get a signal */ if (ppb_sleep(ppbus, lptdev, LPPRI | PCATCH, "lpclose", hz) != EWOULDBLOCK) break; From emaste at FreeBSD.org Tue Oct 13 12:56:24 2009 From: emaste at FreeBSD.org (Ed Maste) Date: Tue Oct 13 12:56:35 2009 Subject: svn commit: r198029 - head/usr.sbin/ntp/doc Message-ID: <200910131256.n9DCuN5x006191@svn.freebsd.org> Author: emaste Date: Tue Oct 13 12:56:23 2009 New Revision: 198029 URL: http://svn.freebsd.org/changeset/base/198029 Log: Correct typo: thetime -> the time PR: docs/139447 Submitted by: Guido Falsi mad at madpilot dot net Modified: head/usr.sbin/ntp/doc/ntpd.8 Modified: head/usr.sbin/ntp/doc/ntpd.8 ============================================================================== --- head/usr.sbin/ntp/doc/ntpd.8 Tue Oct 13 12:23:28 2009 (r198028) +++ head/usr.sbin/ntp/doc/ntpd.8 Tue Oct 13 12:56:23 2009 (r198029) @@ -121,7 +121,7 @@ Normally, .Nm exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. -This option allows thetime to be set to any value without restriction; +This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, .Nm From jhb at freebsd.org Tue Oct 13 14:42:13 2009 From: jhb at freebsd.org (John Baldwin) Date: Tue Oct 13 14:42:23 2009 Subject: svn commit: r198024 - head/sys/modules/nfsclient In-Reply-To: <200910130921.n9D9LKPJ000323@svn.freebsd.org> References: <200910130921.n9D9LKPJ000323@svn.freebsd.org> Message-ID: <200910130906.02860.jhb@freebsd.org> On Tuesday 13 October 2009 5:21:20 am Robert Watson wrote: > Author: rwatson > Date: Tue Oct 13 09:21:20 2009 > New Revision: 198024 > URL: http://svn.freebsd.org/changeset/base/198024 > > Log: > EXPORT_SYMS is not, in fact, required, for a dependent module to access > non-static symbols in a module they depend on, so remove dtrace symbols > from nfsclient's EXPORT_SYMS again. > > Suggested by: jhb Arguably, though, this is due to bugs that we should try to fix in 9.0. -- John Baldwin From rwatson at FreeBSD.org Tue Oct 13 15:01:11 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 13 15:01:22 2009 Subject: svn commit: r198024 - head/sys/modules/nfsclient In-Reply-To: <200910130906.02860.jhb@freebsd.org> References: <200910130921.n9D9LKPJ000323@svn.freebsd.org> <200910130906.02860.jhb@freebsd.org> Message-ID: On Tue, 13 Oct 2009, John Baldwin wrote: > On Tuesday 13 October 2009 5:21:20 am Robert Watson wrote: >> Author: rwatson >> Date: Tue Oct 13 09:21:20 2009 >> New Revision: 198024 >> URL: http://svn.freebsd.org/changeset/base/198024 >> >> Log: >> EXPORT_SYMS is not, in fact, required, for a dependent module to access >> non-static symbols in a module they depend on, so remove dtrace symbols >> from nfsclient's EXPORT_SYMS again. >> >> Suggested by: jhb > > Arguably, though, this is due to bugs that we should try to fix in 9.0. Heh. OK. :-) Robert From xcllnt at mac.com Tue Oct 13 16:00:13 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Tue Oct 13 16:00:26 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091012.232251.420437707.imp@bsdimp.com> References: <200910112042.n9BKgRCQ029985@svn.freebsd.org> <20091012.232251.420437707.imp@bsdimp.com> Message-ID: On Oct 12, 2009, at 10:22 PM, M. Warner Losh wrote: > In message: <200910112042.n9BKgRCQ029985@svn.freebsd.org> > Marcel Moolenaar writes: > : Author: marcel > : Date: Sun Oct 11 20:42:26 2009 > : New Revision: 197969 > : URL: http://svn.freebsd.org/changeset/base/197969 > : > : Log: > : Scan for option ROMs on i386 and amd64 only. > > Why? They should be scanned for on any system with a real isa bus... Other than i386, those are? -- Marcel Moolenaar xcllnt@mac.com From rwatson at FreeBSD.org Tue Oct 13 17:57:06 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 13 17:57:33 2009 Subject: svn commit: r198040 - head/lib/libc/nls Message-ID: <200910131757.n9DHv6Cp012330@svn.freebsd.org> Author: rwatson Date: Tue Oct 13 17:57:06 2009 New Revision: 198040 URL: http://svn.freebsd.org/changeset/base/198040 Log: Add C message catalogue entries for newer errnos: EBADMSG, EMULTIHOP, ENOLINK, EPROTO, ENOTCAPABLE. Submitted by: Alan R. S. Bueno MFC after: 3 days (most) Modified: head/lib/libc/nls/C.msg Modified: head/lib/libc/nls/C.msg ============================================================================== --- head/lib/libc/nls/C.msg Tue Oct 13 17:56:48 2009 (r198039) +++ head/lib/libc/nls/C.msg Tue Oct 13 17:57:06 2009 (r198040) @@ -181,6 +181,16 @@ $ ENOATTR 87 Attribute not found $ EDOOFUS 88 Programming error +$ EBADMSG +89 Bad message +$ EMULTIHOP +90 Multihop attempted +$ ENOLINK +91 Link has been severed +$ EPROTO +92 Protocol error +$ ENOTCAPABLE +93 Capabilities insufficient $ $ strsignal() support catalog $ From rwatson at FreeBSD.org Tue Oct 13 18:07:32 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 13 18:07:44 2009 Subject: svn commit: r197949 - head/lib/libc/sys In-Reply-To: References: <200910110008.n9B08tQc095922@svn.freebsd.org> Message-ID: On Mon, 12 Oct 2009, Alan R. S. Bueno wrote: > That modification also imply modifying the template NLS catalog and the > translations (or maybe translators should be advised to update their files > (I don't know if they are aware of the change)). I wasn't aware I needed to do this, and have now merged your patch, thanks! (David: I also commited the descriptions of the errnos you added). Robert > > The patch to C.msg: > > Index: C.msg > =================================================================== > RCS file: /home/ncvs/src/lib/libc/nls/C.msg,v > retrieving revision 1.1 > diff -u -r1.1 C.msg > --- C.msg 27 Feb 2005 17:59:39 -0000 1.1 > +++ C.msg 12 Oct 2009 10:14:33 -0000 > @@ -181,6 +181,16 @@ > 87 Attribute not found > $ EDOOFUS > 88 Programming error > +$ EBADMSG > +89 Bad message > +$ EMULTIHOP > +90 Multihop attempted > +$ ENOLINK > +91 Link has been severed > +$ EPROTO > +92 Protocol error > +$ ENOTCAPABLE > +93 Capabilities insufficient > $ > $ strsignal() support catalog > $ > > > Thanks! > From jhb at FreeBSD.org Tue Oct 13 18:07:56 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Oct 13 18:08:03 2009 Subject: svn commit: r198041 - head/sys/modules/ubser Message-ID: <200910131807.n9DI7upT012586@svn.freebsd.org> Author: jhb Date: Tue Oct 13 18:07:56 2009 New Revision: 198041 URL: http://svn.freebsd.org/changeset/base/198041 Log: Fix this module so it at least builds. Note that it isn't hooked up to the build however, and ubser(4) is also not present in any kernel configs (including NOTES). Modified: head/sys/modules/ubser/Makefile Modified: head/sys/modules/ubser/Makefile ============================================================================== --- head/sys/modules/ubser/Makefile Tue Oct 13 17:57:06 2009 (r198040) +++ head/sys/modules/ubser/Makefile Tue Oct 13 18:07:56 2009 (r198041) @@ -1,9 +1,9 @@ # $FreeBSD$ S= ${.CURDIR}/../.. -.PATH: $S/dev/usb +.PATH: $S/dev/usb/serial KMOD= ubser -SRCS= ubser.c ubser.h opt_usb.h device_if.h bus_if.h usbdevs.h +SRCS= ubser.c opt_usb.h device_if.h bus_if.h usbdevs.h .include From jhb at FreeBSD.org Tue Oct 13 19:02:04 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Oct 13 19:02:10 2009 Subject: svn commit: r198043 - in head/sys: amd64/conf i386/conf pc98/conf sparc64/conf Message-ID: <200910131902.n9DJ23tg013751@svn.freebsd.org> Author: jhb Date: Tue Oct 13 19:02:03 2009 New Revision: 198043 URL: http://svn.freebsd.org/changeset/base/198043 Log: Move the USB wireless drivers down into their own section next to the USB ethernet drivers. Submitted by: Glen Barber glen.j.barber @ gmail MFC after: 1 month Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC head/sys/pc98/conf/GENERIC head/sys/sparc64/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Tue Oct 13 18:09:15 2009 (r198042) +++ head/sys/amd64/conf/GENERIC Tue Oct 13 19:02:03 2009 (r198043) @@ -297,10 +297,6 @@ device ukbd # Keyboard device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse -device rum # Ralink Technology RT2501USB wireless NICs -device uath # Atheros AR5523 wireless NICs -device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs device urio # Diamond Rio 500 MP3 player # USB Serial devices device uark # Technologies ARK3116 based serial adapters @@ -319,6 +315,11 @@ device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # FireWire support device firewire # FireWire bus code Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Tue Oct 13 18:09:15 2009 (r198042) +++ head/sys/i386/conf/GENERIC Tue Oct 13 19:02:03 2009 (r198043) @@ -310,10 +310,6 @@ device ukbd # Keyboard device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse -device rum # Ralink Technology RT2501USB wireless NICs -device ural # Ralink Technology RT2500USB wireless NICs -device uath # Atheros AR5523 wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs device urio # Diamond Rio 500 MP3 player # USB Serial devices device u3g # USB-based 3G modems (Option, Huawei, Sierra) @@ -333,6 +329,11 @@ device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # FireWire support device firewire # FireWire bus code Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Tue Oct 13 18:09:15 2009 (r198042) +++ head/sys/pc98/conf/GENERIC Tue Oct 13 19:02:03 2009 (r198043) @@ -264,10 +264,6 @@ device bpf # Berkeley packet filter #device ulpt # Printer #device umass # Disks/Mass storage - Requires scbus and da #device ums # Mouse -#device rum # Ralink Technology RT2501USB wireless NICs -#device uath # Atheros AR5523 wireless NICs -#device ural # Ralink Technology RT2500USB wireless NICs -#device zyd # ZyDAS zb1211/zb1211b wireless NICs #device urio # Diamond Rio 500 MP3 player # USB Serial devices #device uark # Technologies ARK3116 based serial adapters @@ -287,6 +283,11 @@ device bpf # Berkeley packet filter #device kue # Kawasaki LSI USB Ethernet #device rue # RealTek RTL8150 USB Ethernet #device udav # Davicom DM9601E USB +# USB Wireless +#device rum # Ralink Technology RT2501USB wireless NICs +#device uath # Atheros AR5523 wireless NICs +#device ural # Ralink Technology RT2500USB wireless NICs +#device zyd # ZyDAS zb1211/zb1211b wireless NICs # FireWire support #device firewire # FireWire bus code Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Tue Oct 13 18:09:15 2009 (r198042) +++ head/sys/sparc64/conf/GENERIC Tue Oct 13 19:02:03 2009 (r198043) @@ -239,10 +239,6 @@ device ukbd # Keyboard device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse -device rum # Ralink Technology RT2501USB wireless NICs -device uath # Atheros AR5523 wireless NICs -device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs device urio # Diamond Rio 500 MP3 player # USB Serial devices device uark # Technologies ARK3116 based serial adapters @@ -261,6 +257,11 @@ device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # FireWire support device firewire # FireWire bus code From jhb at FreeBSD.org Tue Oct 13 19:04:01 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Oct 13 19:04:13 2009 Subject: svn commit: r198044 - head/sys/arm/conf Message-ID: <200910131904.n9DJ41QC013817@svn.freebsd.org> Author: jhb Date: Tue Oct 13 19:04:01 2009 New Revision: 198044 URL: http://svn.freebsd.org/changeset/base/198044 Log: Sync with other GENERIC kernel configs: - Move USB serial drivers earlier to match their placement in other kernel configs. - Add descriptions to various USB drivers. - Move the USB wireless drivers into a new section. - Add ulscom to the list of USB serial drivers. Modified: head/sys/arm/conf/HL200 head/sys/arm/conf/KB920X Modified: head/sys/arm/conf/HL200 ============================================================================== --- head/sys/arm/conf/HL200 Tue Oct 13 19:02:03 2009 (r198043) +++ head/sys/arm/conf/HL200 Tue Oct 13 19:04:01 2009 (r198044) @@ -100,9 +100,17 @@ device usb # USB Bus (required) device uhid # "Human Interface Devices" device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da -device ural # Ralink Technology RT2500USB wireless NICs -device rum # Ralink Technology RT2501USB wireless NICs device urio # Diamond Rio 500 MP3 player +# USB Serial devices +device uark # Technologies ARK3116 based serial adapters +device ubsa # Belkin F5U103 and compatible serial adapters +#device ubser # not yet converted. +device uftdi # For FTDI usb serial adapters +device uipaq # Some WinCE based devices +device uplcom # Prolific PL-2303 serial adapters +device uslcom # SI Labs CP2101/CP2102 serial adapters +device uvisor # Visor and Palm devices +device uvscom # USB serial support for DDI pocket's PHS # USB Ethernet, requires miibus device miibus device aue # ADMtek USB Ethernet @@ -111,16 +119,12 @@ device cdce # Generic USB over Etherne device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet -device udav -# usb serial -device uark -device ubsa -#device ubser # not yet converted. -device uftdi -device uipaq -device uplcom -device uvisor -device uvscom +device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # SCSI peripherals device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) Modified: head/sys/arm/conf/KB920X ============================================================================== --- head/sys/arm/conf/KB920X Tue Oct 13 19:02:03 2009 (r198043) +++ head/sys/arm/conf/KB920X Tue Oct 13 19:04:01 2009 (r198044) @@ -101,9 +101,16 @@ device usb # USB Bus (required) device uhid # "Human Interface Devices" device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da -device ural # Ralink Technology RT2500USB wireless NICs -device rum # Ralink Technology RT2501USB wireless NICs device urio # Diamond Rio 500 MP3 player +# USB Serial devices +device uark # Technologies ARK3116 based serial adapters +device ubsa # Belkin F5U103 and compatible serial adapters +device uftdi # For FTDI usb serial adapters +device uipaq # Some WinCE based devices +device uplcom # Prolific PL-2303 serial adapters +device uslcom # SI Labs CP2101/CP2102 serial adapters +device uvisor # Visor and Palm devices +device uvscom # USB serial support for DDI pocket's PHS # USB Ethernet, requires miibus device miibus device aue # ADMtek USB Ethernet @@ -112,15 +119,12 @@ device cdce # Generic USB over Etherne device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet -device udav -# usb serial -device uark -device ubsa -device uftdi -device uipaq -device uplcom -device uvisor -device uvscom +device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # SCSI peripherals device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) From das at freebsd.org Tue Oct 13 19:24:02 2009 From: das at freebsd.org (David Schultz) Date: Tue Oct 13 19:24:08 2009 Subject: svn commit: r197949 - head/lib/libc/sys In-Reply-To: References: <200910110008.n9B08tQc095922@svn.freebsd.org> Message-ID: <20091013190302.GA64666@zim.MIT.EDU> On Tue, Oct 13, 2009, Robert Watson wrote: > > On Mon, 12 Oct 2009, Alan R. S. Bueno wrote: > > >That modification also imply modifying the template NLS catalog and the > >translations (or maybe translators should be advised to update their files > >(I don't know if they are aware of the change)). > > I wasn't aware I needed to do this, and have now merged your patch, thanks! > (David: I also commited the descriptions of the errnos you added). Thanks! I believe the NLS catalogs actually being built and used is a relatively recent development. From ertr1013 at student.uu.se Tue Oct 13 20:09:03 2009 From: ertr1013 at student.uu.se (Erik Trulsson) Date: Tue Oct 13 20:09:13 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: References: <200910112042.n9BKgRCQ029985@svn.freebsd.org> <20091012.232251.420437707.imp@bsdimp.com> Message-ID: <20091013200820.GA84594@owl.midgard.homeip.net> On Tue, Oct 13, 2009 at 08:59:42AM -0700, Marcel Moolenaar wrote: > > On Oct 12, 2009, at 10:22 PM, M. Warner Losh wrote: > > > In message: <200910112042.n9BKgRCQ029985@svn.freebsd.org> > > Marcel Moolenaar writes: > > : Author: marcel > > : Date: Sun Oct 11 20:42:26 2009 > > : New Revision: 197969 > > : URL: http://svn.freebsd.org/changeset/base/197969 > > : > > : Log: > > : Scan for option ROMs on i386 and amd64 only. > > > > Why? They should be scanned for on any system with a real isa bus... > > Other than i386, those are? Well, I know that there were machines using Alpha and PowerPC processors (and MIPS, and PA-RISC, and ...) that provided real (E)ISA-slots. Those might not count though since recent releases of FreeBSD have dropped support for Alpha, and the relevant PowerPC (etc.) machines have probably never been supported by FreeBSD. For machines that are currently supported by FreeBSD and which provides ISA-slots it is probably only the i386 architecture that qualifies. (There might also be some motherboard out there that has ISA-slots and supports amd64-capable CPUs but one will have to look fairly hard to find one.) -- Erik Trulsson ertr1013@student.uu.se From bz at FreeBSD.org Tue Oct 13 20:22:13 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Tue Oct 13 20:22:19 2009 Subject: svn commit: r198049 - head/sys/dev/bge Message-ID: <200910132022.n9DKMCsE015462@svn.freebsd.org> Author: bz Date: Tue Oct 13 20:22:12 2009 New Revision: 198049 URL: http://svn.freebsd.org/changeset/base/198049 Log: Immediately after clearing a pending callout that didn't make it due to the lock we hold, disable interrupts, and announce to the firmware that we are shutting down. Especially do this before disabling blocks. This makes some types of machines with asf enabled no longer hang upon boot, when we start configuring the interface. PR: i386/96382, kern/100410, kern/122252, kern/116328 Reported by: erwin Hardware provided by: TDC A/S Reviewed by: stas Tested by: stas Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Oct 13 20:21:17 2009 (r198048) +++ head/sys/dev/bge/if_bge.c Tue Oct 13 20:22:12 2009 (r198049) @@ -4270,6 +4270,16 @@ bge_stop(struct bge_softc *sc) callout_stop(&sc->bge_stat_ch); + /* Disable host interrupts. */ + BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); + + /* + * Tell firmware we're shutting down. + */ + bge_stop_fw(sc); + bge_sig_pre_reset(sc, BGE_RESET_STOP); + /* * Disable all of the receiver blocks. */ @@ -4309,16 +4319,6 @@ bge_stop(struct bge_softc *sc) BGE_CLRBIT(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); } - /* Disable host interrupts. */ - BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); - - /* - * Tell firmware we're shutting down. - */ - - bge_stop_fw(sc); - bge_sig_pre_reset(sc, BGE_RESET_STOP); bge_reset(sc); bge_sig_legacy(sc, BGE_RESET_STOP); bge_sig_post_reset(sc, BGE_RESET_STOP); From bz at FreeBSD.org Tue Oct 13 20:29:15 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Tue Oct 13 20:29:25 2009 Subject: svn commit: r198050 - head/sys/netinet Message-ID: <200910132029.n9DKTEJE015700@svn.freebsd.org> Author: bz Date: Tue Oct 13 20:29:14 2009 New Revision: 198050 URL: http://svn.freebsd.org/changeset/base/198050 Log: Compare pointer to NULL rather than 0. MFC after: 1 month Modified: head/sys/netinet/ip_icmp.c Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Tue Oct 13 20:22:12 2009 (r198049) +++ head/sys/netinet/ip_icmp.c Tue Oct 13 20:29:14 2009 (r198050) @@ -367,7 +367,7 @@ icmp_input(struct mbuf *m, int off) goto freeit; } i = hlen + min(icmplen, ICMP_ADVLENMIN); - if (m->m_len < i && (m = m_pullup(m, i)) == 0) { + if (m->m_len < i && (m = m_pullup(m, i)) == NULL) { ICMPSTAT_INC(icps_tooshort); return; } From marck at rinet.ru Tue Oct 13 20:42:22 2009 From: marck at rinet.ru (Dmitry Morozovsky) Date: Tue Oct 13 20:42:29 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091013200820.GA84594@owl.midgard.homeip.net> References: <200910112042.n9BKgRCQ029985@svn.freebsd.org> <20091012.232251.420437707.imp@bsdimp.com> <20091013200820.GA84594@owl.midgard.homeip.net> Message-ID: On Tue, 13 Oct 2009, Erik Trulsson wrote: ET> (There might also be some motherboard out there that has ISA-slots and ET> supports amd64-capable CPUs but one will have to look fairly hard to find ET> one.) Oh, I would love to see at least a photo of such a beast ;-) (As for my experience, the highest CPU on a mobo with [E]ISA slots were Intel Pentium, or similar AMD K6) ;-P -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From jilles at FreeBSD.org Tue Oct 13 20:58:23 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Tue Oct 13 20:58:29 2009 Subject: svn commit: r198053 - head/lib/libc/gen Message-ID: <200910132058.n9DKwMoW016461@svn.freebsd.org> Author: jilles Date: Tue Oct 13 20:58:22 2009 New Revision: 198053 URL: http://svn.freebsd.org/changeset/base/198053 Log: Make getcwd(3) faster, simpler and more compliant using *at syscalls. It is no longer necessary to construct long paths consisting of repeated "../" which may be slow to process and may exceed PATH_MAX. Modified: head/lib/libc/gen/getcwd.c Modified: head/lib/libc/gen/getcwd.c ============================================================================== --- head/lib/libc/gen/getcwd.c Tue Oct 13 20:48:05 2009 (r198052) +++ head/lib/libc/gen/getcwd.c Tue Oct 13 20:58:22 2009 (r198053) @@ -62,13 +62,14 @@ getcwd(pt, size) dev_t dev; ino_t ino; int first; - char *bpt, *bup; + char *bpt; struct stat s; dev_t root_dev; ino_t root_ino; - size_t ptsize, upsize; + size_t ptsize; int save_errno; - char *ept, *eup, *up, c; + char *ept, c; + int fd; /* * If no buffer specified by the user, allocate one as necessary. @@ -106,18 +107,6 @@ getcwd(pt, size) bpt = ept - 1; *bpt = '\0'; - /* - * Allocate 1024 bytes for the string of "../"'s. - * Should always be enough. If it's not, allocate - * as necessary. Special case the first stat, it's ".", not "..". - */ - if ((up = malloc(upsize = 1024)) == NULL) - goto err; - eup = up + upsize; - bup = up; - up[0] = '.'; - up[1] = '\0'; - /* Save root values, so know when to stop. */ if (stat("/", &s)) goto err; @@ -128,7 +117,7 @@ getcwd(pt, size) for (first = 1;; first = 0) { /* Stat the current level. */ - if (lstat(up, &s)) + if (dir != NULL ? _fstat(dirfd(dir), &s) : lstat(".", &s)) goto err; /* Save current node values. */ @@ -144,32 +133,22 @@ getcwd(pt, size) * been that way and stuff would probably break. */ bcopy(bpt, pt, ept - bpt); - free(up); + if (dir) + (void) closedir(dir); return (pt); } - /* - * Build pointer to the parent directory, allocating memory - * as necessary. Max length is 3 for "../", the largest - * possible component name, plus a trailing NUL. - */ - while (bup + 3 + MAXNAMLEN + 1 >= eup) { - if ((up = reallocf(up, upsize *= 2)) == NULL) - goto err; - bup = up; - eup = up + upsize; - } - *bup++ = '.'; - *bup++ = '.'; - *bup = '\0'; - /* Open and stat parent directory. */ - if (!(dir = opendir(up)) || _fstat(dirfd(dir), &s)) + fd = _openat(dir != NULL ? dirfd(dir) : AT_FDCWD, + "..", O_RDONLY); + if (fd == -1) goto err; - - /* Add trailing slash for next directory. */ - *bup++ = '/'; - *bup = '\0'; + if (dir) + (void) closedir(dir); + if (!(dir = fdopendir(fd)) || _fstat(dirfd(dir), &s)) { + _close(fd); + goto err; + } /* * If it's a mount point, have to stat each element because @@ -190,10 +169,10 @@ getcwd(pt, size) goto notfound; if (ISDOT(dp)) continue; - bcopy(dp->d_name, bup, dp->d_namlen + 1); /* Save the first error for later. */ - if (lstat(up, &s)) { + if (fstatat(dirfd(dir), dp->d_name, &s, + AT_SYMLINK_NOFOLLOW)) { if (!save_errno) save_errno = errno; errno = 0; @@ -227,11 +206,6 @@ getcwd(pt, size) *--bpt = '/'; bpt -= dp->d_namlen; bcopy(dp->d_name, bpt, dp->d_namlen); - (void) closedir(dir); - dir = NULL; - - /* Truncate any file name. */ - *bup = '\0'; } notfound: @@ -250,7 +224,6 @@ err: free(pt); if (dir) (void) closedir(dir); - free(up); errno = save_errno; return (NULL); From jkim at FreeBSD.org Tue Oct 13 21:04:07 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Tue Oct 13 21:04:13 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: References: <200910112042.n9BKgRCQ029985@svn.freebsd.org> <20091013200820.GA84594@owl.midgard.homeip.net> Message-ID: <200910131703.50700.jkim@FreeBSD.org> On Tuesday 13 October 2009 04:42 pm, Dmitry Morozovsky wrote: > On Tue, 13 Oct 2009, Erik Trulsson wrote: > > ET> (There might also be some motherboard out there that has > ISA-slots and ET> supports amd64-capable CPUs but one will have to > look fairly hard to find ET> one.) > > Oh, I would love to see at least a photo of such a beast ;-) > > (As for my experience, the highest CPU on a mobo with [E]ISA slots > were Intel Pentium, or similar AMD K6) Physical ISA slots on motherboard may be hard to find item these days but PCI-to-ISA bridge boards exist and should work on any architecture, at least theoretically. :-) Jung-uk Kim From jhb at freebsd.org Tue Oct 13 21:18:34 2009 From: jhb at freebsd.org (John Baldwin) Date: Tue Oct 13 21:18:41 2009 Subject: svn commit: r198044 - head/sys/arm/conf In-Reply-To: <200910131904.n9DJ41QC013817@svn.freebsd.org> References: <200910131904.n9DJ41QC013817@svn.freebsd.org> Message-ID: <200910131510.48144.jhb@freebsd.org> On Tuesday 13 October 2009 3:04:01 pm John Baldwin wrote: > Author: jhb > Date: Tue Oct 13 19:04:01 2009 > New Revision: 198044 > URL: http://svn.freebsd.org/changeset/base/198044 > > Log: > Sync with other GENERIC kernel configs: > - Move USB serial drivers earlier to match their placement in other kernel > configs. > - Add descriptions to various USB drivers. > - Move the USB wireless drivers into a new section. > - Add ulscom to the list of USB serial drivers. I do wonder if it is time to have some files like 'sys/conf/std.usb.serial' that list all the USB serial drivers so that we only have one list of instead of N to ease future maintenance. Similiar arguments could be made for 'std.usb.wireless' and 'std.usb.ethernet' perhaps. -- John Baldwin From imp at bsdimp.com Tue Oct 13 21:28:02 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Tue Oct 13 21:28:08 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: References: <200910112042.n9BKgRCQ029985@svn.freebsd.org> <20091012.232251.420437707.imp@bsdimp.com> Message-ID: <20091013.113213.1449397633.imp@bsdimp.com> In message: Marcel Moolenaar writes: : : On Oct 12, 2009, at 10:22 PM, M. Warner Losh wrote: : : > In message: <200910112042.n9BKgRCQ029985@svn.freebsd.org> : > Marcel Moolenaar writes: : > : Author: marcel : > : Date: Sun Oct 11 20:42:26 2009 : > : New Revision: 197969 : > : URL: http://svn.freebsd.org/changeset/base/197969 : > : : > : Log: : > : Scan for option ROMs on i386 and amd64 only. : > : > Why? They should be scanned for on any system with a real isa bus... : : Other than i386, those are? So other than i386 and amd64, what systems use the isa device? Warner From jilles at FreeBSD.org Tue Oct 13 21:51:51 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Tue Oct 13 21:51:57 2009 Subject: svn commit: r198056 - head/bin/ls Message-ID: <200910132151.n9DLpo1A017647@svn.freebsd.org> Author: jilles Date: Tue Oct 13 21:51:50 2009 New Revision: 198056 URL: http://svn.freebsd.org/changeset/base/198056 Log: ls: Make -p not inhibit following symlinks. According to the man page, when neither -H/-L nor -F/-d/-l are given, -H is implied. This agrees with POSIX, GNU ls and Solaris ls. This means that -p, although it is very similar to -F, does not prevent the implicit following of symlinks. PR: standards/128546 Modified: head/bin/ls/ls.c Modified: head/bin/ls/ls.c ============================================================================== --- head/bin/ls/ls.c Tue Oct 13 21:28:51 2009 (r198055) +++ head/bin/ls/ls.c Tue Oct 13 21:51:50 2009 (r198056) @@ -399,7 +399,7 @@ main(int argc, char *argv[]) * If not -F, -d or -l options, follow any symbolic links listed on * the command line. */ - if (!f_longform && !f_listdir && !f_type) + if (!f_longform && !f_listdir && (!f_type || f_slash)) fts_options |= FTS_COMFOLLOW; /* From xcllnt at mac.com Tue Oct 13 22:02:23 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Tue Oct 13 22:02:35 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091013.113213.1449397633.imp@bsdimp.com> References: <200910112042.n9BKgRCQ029985@svn.freebsd.org> <20091012.232251.420437707.imp@bsdimp.com> <20091013.113213.1449397633.imp@bsdimp.com> Message-ID: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> On Oct 13, 2009, at 10:32 AM, M. Warner Losh wrote: > : > Why? They should be scanned for on any system with a real isa > bus... > : > : Other than i386, those are? > > So other than i386 and amd64, what systems use the isa device? I interpret the lack of answer as: none. isa(4) is usable on various architectures where the southbridge contains a LPC or similar. The MPC8555 CDS, for example, has a VIA southbridge that we need to talk to in order to get to the ATPIC for dealing with the nested interrupt. isa(4) is the device for this, but isaorm is causing kernel panics simply because the memory between 0xC0000 and 0x100000 is not reserved for ISA option ROMs. Likewise for Itanium, sparc64, etc... In short: scanning for option ROMs is not possible in all cases where ISA compatibility is provided. -- Marcel Moolenaar xcllnt@mac.com From ertr1013 at student.uu.se Tue Oct 13 22:12:21 2009 From: ertr1013 at student.uu.se (Erik Trulsson) Date: Tue Oct 13 22:12:34 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: References: <200910112042.n9BKgRCQ029985@svn.freebsd.org> <20091012.232251.420437707.imp@bsdimp.com> <20091013200820.GA84594@owl.midgard.homeip.net> Message-ID: <20091013220407.GA85173@owl.midgard.homeip.net> On Wed, Oct 14, 2009 at 12:42:19AM +0400, Dmitry Morozovsky wrote: > On Tue, 13 Oct 2009, Erik Trulsson wrote: > > ET> (There might also be some motherboard out there that has ISA-slots and > ET> supports amd64-capable CPUs but one will have to look fairly hard to find > ET> one.) > > Oh, I would love to see at least a photo of such a beast ;-) Turned out to Actually be surprisingly easy to find with Google. Take a good look: http://www.ibase.com.tw/2009/mb945.htmL That motherboard supports modern Core2{Quad,Duo} CPUs and has an ISA-slot. > > (As for my experience, the highest CPU on a mobo with [E]ISA slots were Intel > Pentium, or similar AMD K6) The most modern mainboard with an ISA-slot that I have actually held in my own hands supports dual Pentium-III (Socket 370) CPUs. I know that there also exist mainboards for Pentium-4 (Socket 478) and Athlon (Socket A) CPUs that have ISA-slots. -- Erik Trulsson ertr1013@student.uu.se From marck at rinet.ru Tue Oct 13 22:37:53 2009 From: marck at rinet.ru (Dmitry Morozovsky) Date: Tue Oct 13 22:38:01 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091013220407.GA85173@owl.midgard.homeip.net> References: <200910112042.n9BKgRCQ029985@svn.freebsd.org> <20091012.232251.420437707.imp@bsdimp.com> <20091013200820.GA84594@owl.midgard.homeip.net> <20091013220407.GA85173@owl.midgard.homeip.net> Message-ID: On Wed, 14 Oct 2009, Erik Trulsson wrote: ET> > ET> (There might also be some motherboard out there that has ISA-slots and ET> > ET> supports amd64-capable CPUs but one will have to look fairly hard to find ET> > ET> one.) ET> > ET> > Oh, I would love to see at least a photo of such a beast ;-) ET> ET> Turned out to Actually be surprisingly easy to find with Google. Take a good look: ET> ET> http://www.ibase.com.tw/2009/mb945.htmL ET> ET> That motherboard supports modern Core2{Quad,Duo} CPUs and has an ISA-slot. Yes, embedded/industrial needs are quite different from usual/casual; I totally forgot about these areas. ET> > (As for my experience, the highest CPU on a mobo with [E]ISA slots were Intel ET> > Pentium, or similar AMD K6) ET> ET> The most modern mainboard with an ISA-slot that I have actually held in my own ET> hands supports dual Pentium-III (Socket 370) CPUs. ET> ET> I know that there also exist mainboards for Pentium-4 (Socket 478) and ET> Athlon (Socket A) CPUs that have ISA-slots. Well, there avoid me; however, I vaguely remember i686 (aka PentiumPro[tm]) servers with EISA in our colleagues' office back in late 90's... -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From imp at bsdimp.com Wed Oct 14 02:49:41 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Oct 14 02:49:47 2009 Subject: svn commit: r198044 - head/sys/arm/conf In-Reply-To: <200910131510.48144.jhb@freebsd.org> References: <200910131904.n9DJ41QC013817@svn.freebsd.org> <200910131510.48144.jhb@freebsd.org> Message-ID: <20091013.200741.1973690373.imp@bsdimp.com> In message: <200910131510.48144.jhb@freebsd.org> John Baldwin writes: : On Tuesday 13 October 2009 3:04:01 pm John Baldwin wrote: : > Author: jhb : > Date: Tue Oct 13 19:04:01 2009 : > New Revision: 198044 : > URL: http://svn.freebsd.org/changeset/base/198044 : > : > Log: : > Sync with other GENERIC kernel configs: : > - Move USB serial drivers earlier to match their placement in other kernel : > configs. : > - Add descriptions to various USB drivers. : > - Move the USB wireless drivers into a new section. : > - Add ulscom to the list of USB serial drivers. : : I do wonder if it is time to have some files like 'sys/conf/std.usb.serial' : that list all the USB serial drivers so that we only have one list of instead : of N to ease future maintenance. Similiar arguments could be made : for 'std.usb.wireless' and 'std.usb.ethernet' perhaps. I've tried this in the past... Having multiple attributes in the filename helps. but std.ethernet likely is a bad idea since that means it needs to include usb.ethernet and you can't easily exclude usb. I've often thought that it would be cool to tag each device with one or more attributes so we could easily include all devices with the attribute, and also be able to report attribute based things... Warner From imp at bsdimp.com Wed Oct 14 02:49:42 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Oct 14 02:49:58 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> References: <20091013.113213.1449397633.imp@bsdimp.com> <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> Message-ID: <20091013.180620.-1542634329.imp@bsdimp.com> In message: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> Marcel Moolenaar writes: : : On Oct 13, 2009, at 10:32 AM, M. Warner Losh wrote: : > : > Why? They should be scanned for on any system with a real isa : > bus... : > : : > : Other than i386, those are? : > : > So other than i386 and amd64, what systems use the isa device? : : I interpret the lack of answer as: none. : : isa(4) is usable on various architectures where the southbridge : contains a LPC or similar. The MPC8555 CDS, for example, has a : VIA southbridge that we need to talk to in order to get to the : ATPIC for dealing with the nested interrupt. isa(4) is the device : for this, but isaorm is causing kernel panics simply because : the memory between 0xC0000 and 0x100000 is not reserved for ISA : option ROMs. Likewise for Itanium, sparc64, etc... Does this mean that the memory cycles on the I/O bus isn't supported for these architectures? Or that it is and we just don't implement it in the platform specific interfaces for it? The memory space is reserved for any system that has a ISA bus, but it might not be at physical address 0xc0000, etc. : In short: scanning for option ROMs is not possible in all cases : where ISA compatibility is provided. Why is that? The platform specific code needs to implement the necessary hooks to support this. Warner From imp at bsdimp.com Wed Oct 14 02:49:44 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Oct 14 02:50:13 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: References: <20091013200820.GA84594@owl.midgard.homeip.net> Message-ID: <20091013.180723.126931106.imp@bsdimp.com> In message: Dmitry Morozovsky writes: : On Tue, 13 Oct 2009, Erik Trulsson wrote: : : ET> (There might also be some motherboard out there that has ISA-slots and : ET> supports amd64-capable CPUs but one will have to look fairly hard to find : ET> one.) : : Oh, I would love to see at least a photo of such a beast ;-) : : (As for my experience, the highest CPU on a mobo with [E]ISA slots were Intel : Pentium, or similar AMD K6) I have a MIPS-base PC that has EISA slots on it... Deskstation rPC44 with a R4400PC CPU... There's a number of ARM boards that have PC-104 expansion bus as well. The Cirrus logic boards from embeddedarm.com are but one example. Warner From imp at bsdimp.com Wed Oct 14 02:49:56 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Oct 14 02:50:24 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <200910131703.50700.jkim@FreeBSD.org> References: <20091013200820.GA84594@owl.midgard.homeip.net> <200910131703.50700.jkim@FreeBSD.org> Message-ID: <20091013.180342.-905862086.imp@bsdimp.com> In message: <200910131703.50700.jkim@FreeBSD.org> Jung-uk Kim writes: : On Tuesday 13 October 2009 04:42 pm, Dmitry Morozovsky wrote: : > On Tue, 13 Oct 2009, Erik Trulsson wrote: : > : > ET> (There might also be some motherboard out there that has : > ISA-slots and ET> supports amd64-capable CPUs but one will have to : > look fairly hard to find ET> one.) : > : > Oh, I would love to see at least a photo of such a beast ;-) : > : > (As for my experience, the highest CPU on a mobo with [E]ISA slots : > were Intel Pentium, or similar AMD K6) : : Physical ISA slots on motherboard may be hard to find item these days : but PCI-to-ISA bridge boards exist and should work on any : architecture, at least theoretically. :-) The code in question is scannign for expansion ROMs on a ISA connected card. These ROMs are x86 code, but that's not relevant to the scanning of the bus for them since the card will decode those memory ranges even if the host CPU can't execute the code. Warner From xcllnt at mac.com Wed Oct 14 03:35:25 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Wed Oct 14 03:35:37 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091013.180620.-1542634329.imp@bsdimp.com> References: <20091013.113213.1449397633.imp@bsdimp.com> <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> <20091013.180620.-1542634329.imp@bsdimp.com> Message-ID: On Oct 13, 2009, at 5:06 PM, M. Warner Losh wrote: > In message: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> > Marcel Moolenaar writes: > : > : On Oct 13, 2009, at 10:32 AM, M. Warner Losh wrote: > : > : > Why? They should be scanned for on any system with a real isa > : > bus... > : > : > : > : Other than i386, those are? > : > > : > So other than i386 and amd64, what systems use the isa device? > : > : I interpret the lack of answer as: none. > : > : isa(4) is usable on various architectures where the southbridge > : contains a LPC or similar. The MPC8555 CDS, for example, has a > : VIA southbridge that we need to talk to in order to get to the > : ATPIC for dealing with the nested interrupt. isa(4) is the device > : for this, but isaorm is causing kernel panics simply because > : the memory between 0xC0000 and 0x100000 is not reserved for ISA > : option ROMs. Likewise for Itanium, sparc64, etc... > > Does this mean that the memory cycles on the I/O bus isn't supported > for these architectures? Correct. > Or that it is and we just don't implement it > in the platform specific interfaces for it? No. > The memory space is > reserved for any system that has a ISA bus, but it might not be at > physical address 0xc0000, etc. It's uncommon to have an actual ISA bus and even more uncommon that the option ROM is actually being used. > : In short: scanning for option ROMs is not possible in all cases > : where ISA compatibility is provided. > > Why is that? The platform specific code needs to implement the > necessary hooks to support this. There are no hooks to implement. If there is any FreeBSD supported board that actually needs to have the option ROMs scanned by orm(4), then we can always make it conditional upon ``device isa_orm''. Making it dependent on isa(4) is causing real problems and my change limits the use of orm(4) to platforms where it can possibly have any chance of being useful -- provided orm(4) is changed to do something useful. -- Marcel Moolenaar xcllnt@mac.com From imp at bsdimp.com Wed Oct 14 04:05:10 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Oct 14 04:05:16 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: References: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> <20091013.180620.-1542634329.imp@bsdimp.com> Message-ID: <20091013.220411.-432748090.imp@bsdimp.com> In message: Marcel Moolenaar writes: : : On Oct 13, 2009, at 5:06 PM, M. Warner Losh wrote: : : > In message: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> : > Marcel Moolenaar writes: : > : : > : On Oct 13, 2009, at 10:32 AM, M. Warner Losh wrote: : > : > : > Why? They should be scanned for on any system with a real isa : > : > bus... : > : > : : > : > : Other than i386, those are? : > : > : > : > So other than i386 and amd64, what systems use the isa device? : > : : > : I interpret the lack of answer as: none. : > : : > : isa(4) is usable on various architectures where the southbridge : > : contains a LPC or similar. The MPC8555 CDS, for example, has a : > : VIA southbridge that we need to talk to in order to get to the : > : ATPIC for dealing with the nested interrupt. isa(4) is the device : > : for this, but isaorm is causing kernel panics simply because : > : the memory between 0xC0000 and 0x100000 is not reserved for ISA : > : option ROMs. Likewise for Itanium, sparc64, etc... : > : > Does this mean that the memory cycles on the I/O bus isn't supported : > for these architectures? : : Correct. Then it isn't an ISA bus. : > Or that it is and we just don't implement it : > in the platform specific interfaces for it? : : No. Then they aren't real ISA buses. : > The memory space is : > reserved for any system that has a ISA bus, but it might not be at : > physical address 0xc0000, etc. : : It's uncommon to have an actual ISA bus and even more uncommon : that the option ROM is actually being used. ISA memory ranges are quite common on actual cards. : > : In short: scanning for option ROMs is not possible in all cases : > : where ISA compatibility is provided. : > : > Why is that? The platform specific code needs to implement the : > necessary hooks to support this. : : There are no hooks to implement. If there is any FreeBSD supported : board that actually needs to have the option ROMs scanned by orm(4), FreeBSD does support boards that need to have option ROMs scanned. Every PC made today even has them. Today they are primarily video BIOS that's being scanned. They are also on SCSI controllers and can be on network cards. FreeBSD still has support for all these devices. All PC Cards, even those in CardBus slots, need to have this functionality to avoid mapping their CIS on top of a ROM that may be there. : then we can always make it conditional upon ``device isa_orm''. Making : it dependent on isa(4) is causing real problems and my change limits : the use of orm(4) to platforms where it can possibly have any chance : of being useful -- provided orm(4) is changed to do something useful. Every system that has an ISA bus needs to have it scanned for the ROMs. It is part of the ISA specification. If there are variants that don't have any way to create memory bus cycles on the ISA bus, then we need some systemic way to cope. Remove orm is a half-assed kludge since it breaks ISA PNP boards that have memory ranges, for example. So let's fix this right, and avoid yet another kludge like the one you've committed. And this time, let's talk about the fix rather than doing a drive-by? Warner From imp at bsdimp.com Wed Oct 14 04:39:11 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Oct 14 04:39:23 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: References: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> <20091013.180620.-1542634329.imp@bsdimp.com> Message-ID: <20091013.223459.-957891176.imp@bsdimp.com> In message: Marcel Moolenaar writes: : : On Oct 13, 2009, at 5:06 PM, M. Warner Losh wrote: : : > In message: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> : > Marcel Moolenaar writes: : > : : > : On Oct 13, 2009, at 10:32 AM, M. Warner Losh wrote: : > : > : > Why? They should be scanned for on any system with a real isa : > : > bus... : > : > : : > : > : Other than i386, those are? : > : > : > : > So other than i386 and amd64, what systems use the isa device? : > : : > : I interpret the lack of answer as: none. : > : : > : isa(4) is usable on various architectures where the southbridge : > : contains a LPC or similar. The MPC8555 CDS, for example, has a : > : VIA southbridge that we need to talk to in order to get to the : > : ATPIC for dealing with the nested interrupt. isa(4) is the device : > : for this, but isaorm is causing kernel panics simply because : > : the memory between 0xC0000 and 0x100000 is not reserved for ISA : > : option ROMs. Likewise for Itanium, sparc64, etc... : > : > Does this mean that the memory cycles on the I/O bus isn't supported : > for these architectures? : : Correct. Sparc64 doesn't have an ISA bus at all. Hmmm, NetBSD doesn't implement it, but it looks like we have ofw_isa that does implement it. It looks like NetBSD implements all the ISA bus devices we have as ebus devices. Not sure which is more correct, but it is clear from reading the sparc64 isa.c that it does unnatural acts to convince the rest of the system there's really an ISA bus there. It looks to have memory ranges decoded form the ofw description. It isn't clear to me if these are additional devices that NetBSD doesn't support that hang off a PCI-ISA bridge (in which case I'd imagine the memory cycles are passed down), or if they are on what NetBSD calls the ebus. However, given the limited activity in the sparc64 port, I'm not sure a lot of work here is warranted. We've been scanning orm on this architecture for a long time, and haven't had reports of crashes. sys/powerpc/mpc85xx/isa.c could easily reflect that there's no memory available by failing all SYS_RES_MEMORY requests. This would properly fix the bus to reflect reality, and would break things with a proper message (can't allocate the memory resource on the bus). This would move the orm problem from a crash to minor code bloat. That's a much easier problem to solve, and won't break ARM systems that have a PC-104 expansion bus that do support memory address cycles on the pc-104 bus. This code isn't yet in the tree. The itanium stuff I can't comment on, but if it is the same, then a similar trick could be used as for powerpc. I've included something that should be sufficient for powerpc to behave properly. Warner -------------- next part -------------- Index: isa.c =================================================================== --- isa.c (revision 197533) +++ isa.c (working copy) @@ -51,6 +51,14 @@ struct resource_list *rl = &idev->id_resources; int isdefault, passthrough, rids; + /* + * MPC85xx reference boards have most of a pseudo ISA bus, but + * don't pass memory cycles to the cards. Fail all allocation + * attempts to reflect this. + */ + if (type == SYS_RES_MEMORY) + return NULL; + isdefault = (start == 0UL && end == ~0UL) ? 1 : 0; passthrough = (device_get_parent(child) != bus) ? 1 : 0; @@ -59,7 +67,6 @@ switch (type) { case SYS_RES_IOPORT: rids = ISA_PNP_NPORT; break; case SYS_RES_IRQ: rids = ISA_PNP_NIRQ; break; - case SYS_RES_MEMORY: rids = ISA_PNP_NMEM; break; default: rids = 0; break; } if (*rid < 0 || *rid >= rids) From bz at FreeBSD.org Wed Oct 14 11:55:56 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Oct 14 11:56:02 2009 Subject: svn commit: r198075 - head/sys/net Message-ID: <200910141155.n9EBtuUB035620@svn.freebsd.org> Author: bz Date: Wed Oct 14 11:55:55 2009 New Revision: 198075 URL: http://svn.freebsd.org/changeset/base/198075 Log: Unbreak the VIMAGE build with IPSEC, broken with r197952 by virtualizing the pfil hooks. For consistency add the V_ to virtualize the pfil hooks in here as well. MFC after: 55 days X-MFC after: julian MFCed r197952. Modified: head/sys/net/if_enc.c Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Wed Oct 14 11:50:22 2009 (r198074) +++ head/sys/net/if_enc.c Wed Oct 14 11:55:55 2009 (r198075) @@ -243,9 +243,9 @@ ipsec_filter(struct mbuf **mp, int dir, } /* Skip pfil(9) if no filters are loaded */ - if (!(PFIL_HOOKED(&inet_pfil_hook) + if (!(PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif )) { return (0); @@ -271,7 +271,7 @@ ipsec_filter(struct mbuf **mp, int dir, ip->ip_len = ntohs(ip->ip_len); ip->ip_off = ntohs(ip->ip_off); - error = pfil_run_hooks(&inet_pfil_hook, mp, + error = pfil_run_hooks(&V_inet_pfil_hook, mp, encif, dir, NULL); if (*mp == NULL || error != 0) @@ -285,7 +285,7 @@ ipsec_filter(struct mbuf **mp, int dir, #ifdef INET6 case 6: - error = pfil_run_hooks(&inet6_pfil_hook, mp, + error = pfil_run_hooks(&V_inet6_pfil_hook, mp, encif, dir, NULL); break; #endif From bz at FreeBSD.org Wed Oct 14 12:01:11 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Oct 14 12:01:19 2009 Subject: svn commit: r198076 - head/sys/netinet6 Message-ID: <200910141201.n9EC1BTx035783@svn.freebsd.org> Author: bz Date: Wed Oct 14 12:01:11 2009 New Revision: 198076 URL: http://svn.freebsd.org/changeset/base/198076 Log: Explicitly compare to a return code. Discussed with: philip (after we both misread the logic there the 1st time) MFC after: 6 weeks Modified: head/sys/netinet6/icmp6.c Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Wed Oct 14 11:55:55 2009 (r198075) +++ head/sys/netinet6/icmp6.c Wed Oct 14 12:01:11 2009 (r198076) @@ -870,7 +870,7 @@ icmp6_input(struct mbuf **mp, int *offp, break; } deliver: - if (icmp6_notify_error(&m, off, icmp6len, code)) { + if (icmp6_notify_error(&m, off, icmp6len, code) != 0) { /* In this case, m should've been freed. */ return (IPPROTO_DONE); } From bz at FreeBSD.org Wed Oct 14 12:25:07 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Oct 14 12:25:14 2009 Subject: svn commit: r197952 - in head/sys: net netgraph netinet netinet/ipfw netinet6 In-Reply-To: <200910110559.n9B5xhNg002528@svn.freebsd.org> References: <200910110559.n9B5xhNg002528@svn.freebsd.org> Message-ID: <20091014115713.N5956@maildrop.int.zabbadoz.net> On Sun, 11 Oct 2009, Julian Elischer wrote: > Author: julian > Date: Sun Oct 11 05:59:43 2009 > New Revision: 197952 > URL: http://svn.freebsd.org/changeset/base/197952 > > Log: > Virtualize the pfil hooks so that different jails may chose different > packet filters. ALso allows ipfw to be enabled on on ejail and disabled > on another. In 8.0 it's a global setting. > > Sitting aroung in tree waiting to commit for: 2 months Unfortunately this broke VIMAGE with IPSEC builds, which I just fixed. I am not yet convinced this was the right approach but probably the most straight forward one. /bz > MFC after: 2 months > > Modified: > head/sys/net/if_bridge.c > head/sys/net/if_ethersubr.c > head/sys/net/pfil.c > head/sys/netgraph/ng_bridge.c > head/sys/netinet/ip_fastfwd.c > head/sys/netinet/ip_input.c > head/sys/netinet/ip_output.c > head/sys/netinet/ip_var.h > head/sys/netinet/ipfw/ip_fw2.c > head/sys/netinet/ipfw/ip_fw_pfil.c > head/sys/netinet/raw_ip.c > head/sys/netinet6/ip6_forward.c > head/sys/netinet6/ip6_input.c > head/sys/netinet6/ip6_output.c > head/sys/netinet6/ip6_var.h -- Bjoern A. Zeeb It will not break if you know what you are doing. From jhb at FreeBSD.org Wed Oct 14 14:13:42 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Wed Oct 14 14:13:49 2009 Subject: svn commit: r198079 - head/sys/boot/i386/zfsboot Message-ID: <200910141413.n9EEDgQo039064@svn.freebsd.org> Author: jhb Date: Wed Oct 14 14:13:42 2009 New Revision: 198079 URL: http://svn.freebsd.org/changeset/base/198079 Log: Use zfs_read() instead of xfsread() to read /boot.config. xfsread() fails short read requests, so the result was that a /boot.config smaller than 512 bytes was ignored. boot2 uses fsread() instead of xfsread() to read /boot.config already, so this makes zfsboot more like boot2. Submitted by: Johny Mattsson johny-freebsd of earthmagic org Reviewed by: dfr MFC after: 3 days Modified: head/sys/boot/i386/zfsboot/zfsboot.c Modified: head/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- head/sys/boot/i386/zfsboot/zfsboot.c Wed Oct 14 13:58:24 2009 (r198078) +++ head/sys/boot/i386/zfsboot/zfsboot.c Wed Oct 14 14:13:42 2009 (r198079) @@ -609,7 +609,7 @@ main(void) if (zfs_lookup(spa, PATH_CONFIG, &dn) == 0) { off = 0; - xfsread(&dn, &off, cmd, sizeof(cmd)); + zfs_read(spa, &dn, &off, cmd, sizeof(cmd)); } if (*cmd) { From jhb at freebsd.org Wed Oct 14 15:00:45 2009 From: jhb at freebsd.org (John Baldwin) Date: Wed Oct 14 15:00:52 2009 Subject: svn commit: r198044 - head/sys/arm/conf In-Reply-To: <20091013.200741.1973690373.imp@bsdimp.com> References: <200910131904.n9DJ41QC013817@svn.freebsd.org> <200910131510.48144.jhb@freebsd.org> <20091013.200741.1973690373.imp@bsdimp.com> Message-ID: <200910140753.57264.jhb@freebsd.org> On Tuesday 13 October 2009 10:07:41 pm M. Warner Losh wrote: > In message: <200910131510.48144.jhb@freebsd.org> > John Baldwin writes: > : On Tuesday 13 October 2009 3:04:01 pm John Baldwin wrote: > : > Author: jhb > : > Date: Tue Oct 13 19:04:01 2009 > : > New Revision: 198044 > : > URL: http://svn.freebsd.org/changeset/base/198044 > : > > : > Log: > : > Sync with other GENERIC kernel configs: > : > - Move USB serial drivers earlier to match their placement in other kernel > : > configs. > : > - Add descriptions to various USB drivers. > : > - Move the USB wireless drivers into a new section. > : > - Add ulscom to the list of USB serial drivers. > : > : I do wonder if it is time to have some files like 'sys/conf/std.usb.serial' > : that list all the USB serial drivers so that we only have one list of instead > : of N to ease future maintenance. Similiar arguments could be made > : for 'std.usb.wireless' and 'std.usb.ethernet' perhaps. > > I've tried this in the past... Having multiple attributes in the > filename helps. but std.ethernet likely is a bad idea since that > means it needs to include usb.ethernet and you can't easily exclude > usb. USB seems to be a bus where if the bus works, then all the peripherals generally work unlike PCI where invidiual drivers need to handle DMA addresses properly, endian issues, etc. So, I'm only wondering out loud about the USB case for now since it seems more plausible than some other cases. What I would like to do is avoid having to touch N kernel configs each time a USB driver is added. > I've often thought that it would be cool to tag each device with one > or more attributes so we could easily include all devices with the > attribute, and also be able to report attribute based things... That sounds interesting. I think it means we need to move to more of a module-centric approach though where a module has a name, attributes, a list of files, etc. Possibly a list of variants as well (e.g. so drivers with multiple attachments can only include the attachments for the busses in the base kernel still when the driver is compiled into the kernel). -- John Baldwin From jhb at FreeBSD.org Wed Oct 14 15:58:59 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Wed Oct 14 15:59:05 2009 Subject: svn commit: r198085 - head/share/man/man9 Message-ID: <200910141558.n9EFwx0N041742@svn.freebsd.org> Author: jhb Date: Wed Oct 14 15:58:59 2009 New Revision: 198085 URL: http://svn.freebsd.org/changeset/base/198085 Log: Add a manual page for BUS_BIND_INTR() and bus_bind_intr(). MFC after: 1 week Added: head/share/man/man9/BUS_BIND_INTR.9 (contents, props changed) Modified: head/share/man/man9/Makefile Added: head/share/man/man9/BUS_BIND_INTR.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/BUS_BIND_INTR.9 Wed Oct 14 15:58:59 2009 (r198085) @@ -0,0 +1,96 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 2009 Advanced Computing Technologies LLC +.\" Written by: John H. Baldwin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 14, 2009 +.Dt BUS_BIND_INTR 9 +.Os +.Sh NAME +.Nm BUS_BIND_INTR , +.Nm bus_bind_intr +.Nd "bind an interrupt resource to a specific CPU" +.Sh SYNOPSIS +.In sys/param.h +.In sys/bus.h +.Ft int +.Fo BUS_BIND_INTR +.Fa "device_t dev" "device_t child" "struct resource *irq" "int cpu" +.Fc +.Ft int +.Fn bus_bind_intr "device_t dev" "struct resource *irq" "int cpu" +.Sh DESCRIPTION +The +.Fn BUS_BIND_INTR +method allows an interrupt resource to be pinned to a specific CPU. +The interrupt resource must have an interrupt handler attached via +.Xr BUS_SETUP_INTR 9 . +The +.Fa cpu +parameter corresponds to the ID of a valid CPU in the system. +Binding an interrupt restricts the +.Xr cpuset 2 +of any associated interrupt threads to only include the specified CPU. +It may also direct the low-level interrupt handling of the interrupt to the +specified CPU as well, +but this behavior is platform-dependent. +If the value +.Dv NOCPU +is used for +.Fa cpu , +then the interrupt will be +.Dq unbound +which restores any associated interrupt threads back to the default cpuset. +.Pp +Non-sleepable locks such as mutexes should not be held across calls to these +functions. +.Pp +The +.Fn bus_bind_intr +function is a simple wrapper around +.Fn BUS_BIND_INTR . +.Pp +Note that currently there is no attempt made to arbitrate between +multiple bind requests for the same interrupt from either the same +device or multiple devices. +There is also no arbitration between interrupt binding requests submitted +by userland via +.Xr cpuset 2 +and +.Fn BUS_BIND_INTR . +The most recent binding request is the one that will be in effect. +.Sh SEE ALSO +.Xr BUS_SETUP_INTR 9 , +.Xr cpuset 2 , +.Xr device 9 +.Sh HISTORY +The +.Fn BUS_BIND_INTR +method and +.Fn bus_bind_intr +functions first appeared in +.Fx 7.2 . Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Oct 14 15:37:03 2009 (r198084) +++ head/share/man/man9/Makefile Wed Oct 14 15:58:59 2009 (r198085) @@ -23,6 +23,7 @@ MAN= accept_filter.9 \ bus_activate_resource.9 \ BUS_ADD_CHILD.9 \ bus_alloc_resource.9 \ + BUS_BIND_INTR.9 \ bus_child_present.9 \ BUS_CONFIG_INTR.9 \ bus_dma.9 \ @@ -403,6 +404,7 @@ MLINKS+=bpf.9 bpf_filter.9 \ MLINKS+=buf.9 bp.9 MLINKS+=bus_activate_resource.9 bus_deactivate_resource.9 MLINKS+=bus_alloc_resource.9 bus_alloc_resource_any.9 +MLINKS+=BUS_BIND_INTR.9 bus_bind_intr.9 MLINKS+=bus_dma.9 busdma.9 \ bus_dma.9 bus_dmamap_create.9 \ bus_dma.9 bus_dmamap_destroy.9 \ From jhb at FreeBSD.org Wed Oct 14 16:00:21 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Wed Oct 14 16:00:33 2009 Subject: svn commit: r198086 - head/share/man/man9 Message-ID: <200910141600.n9EG0Kjo041831@svn.freebsd.org> Author: jhb Date: Wed Oct 14 16:00:20 2009 New Revision: 198086 URL: http://svn.freebsd.org/changeset/base/198086 Log: Oops, add a return values section to note that these routines return an error on failure or zero on success. Modified: head/share/man/man9/BUS_BIND_INTR.9 Modified: head/share/man/man9/BUS_BIND_INTR.9 ============================================================================== --- head/share/man/man9/BUS_BIND_INTR.9 Wed Oct 14 15:58:59 2009 (r198085) +++ head/share/man/man9/BUS_BIND_INTR.9 Wed Oct 14 16:00:20 2009 (r198086) @@ -83,6 +83,8 @@ by userland via and .Fn BUS_BIND_INTR . The most recent binding request is the one that will be in effect. +.Sh RETURN VALUES +Zero is returned on success, otherwise an appropriate error is returned. .Sh SEE ALSO .Xr BUS_SETUP_INTR 9 , .Xr cpuset 2 , From julian at elischer.org Wed Oct 14 16:21:59 2009 From: julian at elischer.org (Julian Elischer) Date: Wed Oct 14 16:22:05 2009 Subject: svn commit: r198075 - head/sys/net In-Reply-To: <200910141155.n9EBtuUB035620@svn.freebsd.org> References: <200910141155.n9EBtuUB035620@svn.freebsd.org> Message-ID: <4AD5FAA9.2090202@elischer.org> Bjoern A. Zeeb wrote: > Author: bz > Date: Wed Oct 14 11:55:55 2009 > New Revision: 198075 > URL: http://svn.freebsd.org/changeset/base/198075 > > Log: > Unbreak the VIMAGE build with IPSEC, broken with r197952 by > virtualizing the pfil hooks. > For consistency add the V_ to virtualize the pfil hooks in here as well. > > MFC after: 55 days > X-MFC after: julian MFCed r197952. did these get added recently or something? > > Modified: > head/sys/net/if_enc.c > > Modified: head/sys/net/if_enc.c > ============================================================================== > --- head/sys/net/if_enc.c Wed Oct 14 11:50:22 2009 (r198074) > +++ head/sys/net/if_enc.c Wed Oct 14 11:55:55 2009 (r198075) > @@ -243,9 +243,9 @@ ipsec_filter(struct mbuf **mp, int dir, > } > > /* Skip pfil(9) if no filters are loaded */ > - if (!(PFIL_HOOKED(&inet_pfil_hook) > + if (!(PFIL_HOOKED(&V_inet_pfil_hook) > #ifdef INET6 > - || PFIL_HOOKED(&inet6_pfil_hook) > + || PFIL_HOOKED(&V_inet6_pfil_hook) > #endif > )) { > return (0); > @@ -271,7 +271,7 @@ ipsec_filter(struct mbuf **mp, int dir, > ip->ip_len = ntohs(ip->ip_len); > ip->ip_off = ntohs(ip->ip_off); > > - error = pfil_run_hooks(&inet_pfil_hook, mp, > + error = pfil_run_hooks(&V_inet_pfil_hook, mp, > encif, dir, NULL); > > if (*mp == NULL || error != 0) > @@ -285,7 +285,7 @@ ipsec_filter(struct mbuf **mp, int dir, > > #ifdef INET6 > case 6: > - error = pfil_run_hooks(&inet6_pfil_hook, mp, > + error = pfil_run_hooks(&V_inet6_pfil_hook, mp, > encif, dir, NULL); > break; > #endif From julian at elischer.org Wed Oct 14 16:25:54 2009 From: julian at elischer.org (Julian Elischer) Date: Wed Oct 14 16:25:59 2009 Subject: svn commit: r197952 - in head/sys: net netgraph netinet netinet/ipfw netinet6 In-Reply-To: <20091014115713.N5956@maildrop.int.zabbadoz.net> References: <200910110559.n9B5xhNg002528@svn.freebsd.org> <20091014115713.N5956@maildrop.int.zabbadoz.net> Message-ID: <4AD5FB93.7000006@elischer.org> Bjoern A. Zeeb wrote: > On Sun, 11 Oct 2009, Julian Elischer wrote: > >> Author: julian >> Date: Sun Oct 11 05:59:43 2009 >> New Revision: 197952 >> URL: http://svn.freebsd.org/changeset/base/197952 >> >> Log: >> Virtualize the pfil hooks so that different jails may chose different >> packet filters. ALso allows ipfw to be enabled on on ejail and disabled >> on another. In 8.0 it's a global setting. >> >> Sitting aroung in tree waiting to commit for: 2 months > > Unfortunately this broke VIMAGE with IPSEC builds, which I just fixed. > > I am not yet convinced this was the right approach but probably the > most straight forward one. yes I saw. however i'm puzzled as to why I didn't see the breakage. I tested many different builds when I did this and grepped for the pfil hooks throughout the code. maybe I missed VIMAGE_LINT? (is ipsec in LINT?) > > > /bz > >> MFC after: 2 months >> >> Modified: >> head/sys/net/if_bridge.c >> head/sys/net/if_ethersubr.c >> head/sys/net/pfil.c >> head/sys/netgraph/ng_bridge.c >> head/sys/netinet/ip_fastfwd.c >> head/sys/netinet/ip_input.c >> head/sys/netinet/ip_output.c >> head/sys/netinet/ip_var.h >> head/sys/netinet/ipfw/ip_fw2.c >> head/sys/netinet/ipfw/ip_fw_pfil.c >> head/sys/netinet/raw_ip.c >> head/sys/netinet6/ip6_forward.c >> head/sys/netinet6/ip6_input.c >> head/sys/netinet6/ip6_output.c >> head/sys/netinet6/ip6_var.h > From xcllnt at mac.com Wed Oct 14 16:59:28 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Wed Oct 14 16:59:40 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091013.220411.-432748090.imp@bsdimp.com> References: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> <20091013.180620.-1542634329.imp@bsdimp.com> <20091013.220411.-432748090.imp@bsdimp.com> Message-ID: On Oct 13, 2009, at 9:04 PM, M. Warner Losh wrote: > : > Does this mean that the memory cycles on the I/O bus isn't > supported > : > for these architectures? > : > : Correct. > > Then it isn't an ISA bus. Of course it isn't an ISA bus. It's all LPC. Leaving the specialized embedded market aside, there's no point discussing real ISA busses in the FreeBSD context. Noone cares and as long as it doesn't break anything noone is going to put in effort to fix the code. > : There are no hooks to implement. If there is any FreeBSD supported > : board that actually needs to have the option ROMs scanned by orm(4), > > FreeBSD does support boards that need to have option ROMs scanned. orm(4) doesn't do anything with it. Other than claim the memory region and indirectly enforce policy, there's nothing orm(4) does. Policy should be implemented in the platform code where the knowledge exists and it should not be done as a side-effect of a driver that encodes the knowledge of a single platform by way of hardcoding numbers that don't hold on other platforms. orm(4) causes machine checks and kernel panics on PowerPC and Itanium and none of the non-i386 hardware has any real history with ISA, so the sensible thing is to have orm(4) be specific to PC hardware where it has relevance. If orm(4) is actually *required* on non-PC hardware then one only has to add the appropriate line to file.${ARCH} and it's there. -- Marcel Moolenaar xcllnt@mac.com From imp at bsdimp.com Wed Oct 14 17:44:46 2009 From: imp at bsdimp.com (Warner Losh) Date: Wed Oct 14 17:44:52 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: References: <20091013.220411.-432748090.imp@bsdimp.com> Message-ID: <20091014.113945.74724941.imp@bsdimp.com> > On Oct 13, 2009, at 9:04 PM, M. Warner Losh wrote: > > : > Does this mean that the memory cycles on the I/O bus isn't > > supported > > : > for these architectures? > > : > > : Correct. > > > > Then it isn't an ISA bus. > > Of course it isn't an ISA bus. It's all LPC. Leaving the specialized > embedded market aside, there's no point discussing real ISA busses > in the FreeBSD context. Noone cares and as long as it doesn't break > anything noone is going to put in effort to fix the code. LPC is a real ISA bus in this context, since it passes the memory range decodes. Your changes to break things. It is a kludge. I can't be more clear than this. You keep ignoring me, and it is very frustrating. > > : There are no hooks to implement. If there is any FreeBSD supported > > : board that actually needs to have the option ROMs scanned by orm(4), > > > > FreeBSD does support boards that need to have option ROMs scanned. > > orm(4) doesn't do anything with it. Other than claim the memory > region and indirectly enforce policy, there's nothing orm(4) does. > Policy should be implemented in the platform code where the knowledge > exists and it should not be done as a side-effect of a driver that > encodes the knowledge of a single platform by way of hardcoding numbers > that don't hold on other platforms. Please listen. orm(4) isn't the problem. The problem is that the powerpc and itanium isa modules allow memory ranges that shouldn't be allowed. That's the platform specific code that needs to be fixed. > orm(4) causes machine checks and kernel panics on PowerPC and Itanium > and none of the non-i386 hardware has any real history with ISA, so > the sensible thing is to have orm(4) be specific to PC hardware where > it has relevance. If orm(4) is actually *required* on non-PC hardware > then one only has to add the appropriate line to file.${ARCH} and it's > there. To be pedantic: powerpc's buggy isa MD code is causing these problems. orm(4) is just a symptom, not the disease. Warner From xcllnt at mac.com Wed Oct 14 18:35:18 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Wed Oct 14 18:35:25 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091014.113945.74724941.imp@bsdimp.com> References: <20091013.220411.-432748090.imp@bsdimp.com> <20091014.113945.74724941.imp@bsdimp.com> Message-ID: <2D55EFED-675A-4CC7-AF39-DE83961552F0@mac.com> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: > > I can't be more clear than this. You keep ignoring me, and it is very > frustrating. I'm not ignoring you. I'm still talking. You simply haven't convinced me. While it's possible (likely?) that I don't understand the issues, all you've achieved so far is that I'm more convinced that limiting orm(4) to i386 and amd64 is the right thing, because the alternative is not at all appealing. > The problem is that the > powerpc and itanium isa modules allow memory ranges that shouldn't be > allowed. That's the platform specific code that needs to be fixed. isa_set_resource() is MI code and it happily adds whatever resources a driver wants. The only chance MD code has is to fail the allocation, but since the whole ISA code bypasses the newbus hierarchy, there's no way we know in the isa MD code what is valid and what isn't unless we add kluges to platform code. If you want to fix it for real, does that mean fix it for real or does that mean add kluges to platform code? Shouldn't we have ISA bridges obtain the set of valid resources from their parent in the newbus hierarchy? > To be pedantic: powerpc's buggy isa MD code is causing these > problems. orm(4) is just a symptom, not the disease. Fine, be pedantic. I eliminated the symptom. Good, now at least I'm not blocked and we can really discuss the disease and fix it. See above. -- Marcel Moolenaar xcllnt@mac.com From marius at alchemy.franken.de Wed Oct 14 18:53:44 2009 From: marius at alchemy.franken.de (Marius Strobl) Date: Wed Oct 14 18:53:55 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091013.223459.-957891176.imp@bsdimp.com> References: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> <20091013.180620.-1542634329.imp@bsdimp.com> <20091013.223459.-957891176.imp@bsdimp.com> Message-ID: <20091014185338.GA26673@alchemy.franken.de> On Tue, Oct 13, 2009 at 10:34:59PM -0600, M. Warner Losh wrote: > In message: > Marcel Moolenaar writes: > : > : On Oct 13, 2009, at 5:06 PM, M. Warner Losh wrote: > : > : > In message: <2E290D8D-BAF0-4E4E-A352-B00FAFD9DF83@mac.com> > : > Marcel Moolenaar writes: > : > : > : > : On Oct 13, 2009, at 10:32 AM, M. Warner Losh wrote: > : > : > : > Why? They should be scanned for on any system with a real isa > : > : > bus... > : > : > : > : > : > : Other than i386, those are? > : > : > > : > : > So other than i386 and amd64, what systems use the isa device? > : > : > : > : I interpret the lack of answer as: none. > : > : > : > : isa(4) is usable on various architectures where the southbridge > : > : contains a LPC or similar. The MPC8555 CDS, for example, has a > : > : VIA southbridge that we need to talk to in order to get to the > : > : ATPIC for dealing with the nested interrupt. isa(4) is the device > : > : for this, but isaorm is causing kernel panics simply because > : > : the memory between 0xC0000 and 0x100000 is not reserved for ISA > : > : option ROMs. Likewise for Itanium, sparc64, etc... > : > > : > Does this mean that the memory cycles on the I/O bus isn't supported > : > for these architectures? > : > : Correct. > > Sparc64 doesn't have an ISA bus at all. Hmmm, NetBSD doesn't > implement it, but it looks like we have ofw_isa that does implement > it. It looks like NetBSD implements all the ISA bus devices we have > as ebus devices. Not sure which is more correct, but it is clear from > reading the sparc64 isa.c that it does unnatural acts to convince the > rest of the system there's really an ISA bus there. It looks to have > memory ranges decoded form the ofw description. It isn't clear to me > if these are additional devices that NetBSD doesn't support that hang > off a PCI-ISA bridge (in which case I'd imagine the memory cycles are > passed down), or if they are on what NetBSD calls the ebus. The EBus is a bus designed to be electrically compatible with ISA devices so ISA Super I/O, sound chips etc can be used for on-board I/O purposes, but otherwise is a different beast with proper DMA engines etc. It's a rather old bus already found as SBus-EBus bridges in pre-sun4u and machines, PCI-EBus bridges in old sun4u machines and JBus(i.e. host)-EBus brides in current sun4u and sun4v machines. The ISA busses found in sun4u and sun4v machines actually are LPC beneath a PCI-ISA bridge as these machines use ordinary PC-southbridges. NetBSD treating ISA devices as EBus ones probably is just a quick hack (which also involves turning I/O resources into memory ones). Why they chose to leave it implemented like that is beyond me, especially since thesy also have proper MI OFW ISA code. Lack thereof and lack of easy expandibilty of isa(4) at least is the reason why in FreeBSD ofw_isa.c does unnatural things to fake PNP information. > However, > given the limited activity in the sparc64 port, I'm not sure a lot of > work here is warranted. We've been scanning orm on this architecture > for a long time, and haven't had reports of crashes. It would be really great if FreeBSD would distinguish between LPC and real ISA so things like the ISAPNP code and ISA bus front-ends of ATA, network and SCSI drivers etc wouldn't be compliled into kernels for architectures that just have no use for these as they have LPC but no ISA slots, but the lack of activity in ISA driver development probably doesn't warrant fixing this. Marius From rnoland at FreeBSD.org Wed Oct 14 19:24:01 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Wed Oct 14 19:24:07 2009 Subject: svn commit: r198097 - head/sys/geom/part Message-ID: <200910141924.n9EJO1YM046579@svn.freebsd.org> Author: rnoland Date: Wed Oct 14 19:24:01 2009 New Revision: 198097 URL: http://svn.freebsd.org/changeset/base/198097 Log: Set the active flag in the PMBR when we install bootcode on a GPT partitioned disk. Some BIOS require this to be set before they will boot the device. Approved by: marcel MFC after: 2 weeks Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Wed Oct 14 18:50:43 2009 (r198096) +++ head/sys/geom/part/g_part_gpt.c Wed Oct 14 19:24:01 2009 (r198097) @@ -382,6 +382,9 @@ g_part_gpt_bootcode(struct g_part_table codesz = MIN(codesz, gpp->gpp_codesize); if (codesz > 0) bcopy(gpp->gpp_codeptr, table->mbr, codesz); + + /* Mark the PMBR active since some BIOS require it */ + table->mbr[DOSPARTOFF] = 0x80; /* status */ return (0); } From weongyo at FreeBSD.org Wed Oct 14 20:09:10 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Wed Oct 14 20:09:17 2009 Subject: svn commit: r198098 - head/sys/dev/usb/wlan Message-ID: <200910142009.n9EK9Ai8047500@svn.freebsd.org> Author: weongyo Date: Wed Oct 14 20:09:09 2009 New Revision: 198098 URL: http://svn.freebsd.org/changeset/base/198098 Log: fixes a TX hang bug that it could happen when if_start callback didn't be restarted by full of the output queue. MFC after: 3 days Tested by: bsduser Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Wed Oct 14 19:24:01 2009 (r198097) +++ head/sys/dev/usb/wlan/if_rum.c Wed Oct 14 20:09:09 2009 (r198098) @@ -826,6 +826,9 @@ tr_setup: usbd_transfer_submit(xfer); } + RUM_UNLOCK(sc); + rum_start(ifp); + RUM_LOCK(sc); break; default: /* Error */ @@ -930,8 +933,8 @@ tr_setup: * the private mutex of a device! That is why we do the * "ieee80211_input" here, and not some lines up! */ + RUM_UNLOCK(sc); if (m) { - RUM_UNLOCK(sc); ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *)); if (ni != NULL) { @@ -941,8 +944,11 @@ tr_setup: } else (void) ieee80211_input_all(ic, m, rssi, RT2573_NOISE_FLOOR); - RUM_LOCK(sc); } + if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0 && + !IFQ_IS_EMPTY(&ifp->if_snd)) + rum_start(ifp); + RUM_LOCK(sc); return; default: /* Error */ From weongyo at FreeBSD.org Wed Oct 14 20:30:27 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Wed Oct 14 20:30:39 2009 Subject: svn commit: r198099 - head/sys/dev/usb/wlan Message-ID: <200910142030.n9EKUR4f048044@svn.freebsd.org> Author: weongyo Date: Wed Oct 14 20:30:27 2009 New Revision: 198099 URL: http://svn.freebsd.org/changeset/base/198099 Log: fixes a TX hang that could be possible to happen when the trasfers are in the high speed that some drivers don't call if_start callback after marking ~IFF_DRV_OACTIVE. MFC after: 3 days Modified: head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Wed Oct 14 20:09:09 2009 (r198098) +++ head/sys/dev/usb/wlan/if_uath.c Wed Oct 14 20:30:27 2009 (r198099) @@ -2762,6 +2762,9 @@ setup: m = NULL; desc = NULL; } + if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0 && + !IFQ_IS_EMPTY(&ifp->if_snd)) + uath_start(ifp); UATH_LOCK(sc); break; default: Modified: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- head/sys/dev/usb/wlan/if_upgt.c Wed Oct 14 20:09:09 2009 (r198098) +++ head/sys/dev/usb/wlan/if_upgt.c Wed Oct 14 20:30:27 2009 (r198099) @@ -2291,6 +2291,9 @@ setup: (void) ieee80211_input_all(ic, m, rssi, nf); m = NULL; } + if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0 && + !IFQ_IS_EMPTY(&ifp->if_snd)) + upgt_start(ifp); UPGT_LOCK(sc); break; default: Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Wed Oct 14 20:09:09 2009 (r198098) +++ head/sys/dev/usb/wlan/if_ural.c Wed Oct 14 20:30:27 2009 (r198099) @@ -837,6 +837,9 @@ tr_setup: usbd_transfer_submit(xfer); } + RAL_UNLOCK(sc); + ural_start(ifp); + RAL_LOCK(sc); break; default: /* Error */ @@ -945,8 +948,8 @@ tr_setup: * the private mutex of a device! That is why we do the * "ieee80211_input" here, and not some lines up! */ + RAL_UNLOCK(sc); if (m) { - RAL_UNLOCK(sc); ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *)); if (ni != NULL) { @@ -954,8 +957,11 @@ tr_setup: ieee80211_free_node(ni); } else (void) ieee80211_input_all(ic, m, rssi, nf); - RAL_LOCK(sc); } + if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0 && + !IFQ_IS_EMPTY(&ifp->if_snd)) + ural_start(ifp); + RAL_LOCK(sc); return; default: /* Error */ Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Wed Oct 14 20:09:09 2009 (r198098) +++ head/sys/dev/usb/wlan/if_urtw.c Wed Oct 14 20:30:27 2009 (r198099) @@ -4072,6 +4072,9 @@ setup: (void) ieee80211_input_all(ic, m, rssi, nf); m = NULL; } + if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0 && + !IFQ_IS_EMPTY(&ifp->if_snd)) + urtw_start(ifp); URTW_LOCK(sc); break; default: Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Wed Oct 14 20:09:09 2009 (r198098) +++ head/sys/dev/usb/wlan/if_zyd.c Wed Oct 14 20:30:27 2009 (r198099) @@ -2322,6 +2322,9 @@ tr_setup: } else (void)ieee80211_input_all(ic, m, rssi, nf); } + if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0 && + !IFQ_IS_EMPTY(&ifp->if_snd)) + zyd_start(ifp); ZYD_LOCK(sc); break; @@ -2431,6 +2434,9 @@ tr_setup: usbd_xfer_set_priv(xfer, data); usbd_transfer_submit(xfer); } + ZYD_UNLOCK(sc); + zyd_start(ifp); + ZYD_LOCK(sc); break; default: /* Error */ From jhb at freebsd.org Wed Oct 14 20:59:40 2009 From: jhb at freebsd.org (John Baldwin) Date: Wed Oct 14 20:59:46 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <2D55EFED-675A-4CC7-AF39-DE83961552F0@mac.com> References: <20091014.113945.74724941.imp@bsdimp.com> <2D55EFED-675A-4CC7-AF39-DE83961552F0@mac.com> Message-ID: <200910141645.26010.jhb@freebsd.org> On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: > On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: > > > > I can't be more clear than this. You keep ignoring me, and it is very > > frustrating. > > I'm not ignoring you. I'm still talking. You simply haven't convinced > me. While it's possible (likely?) that I don't understand the issues, > all you've achieved so far is that I'm more convinced that limiting > orm(4) to i386 and amd64 is the right thing, because the alternative > is not at all appealing. > > > The problem is that the > > powerpc and itanium isa modules allow memory ranges that shouldn't be > > allowed. That's the platform specific code that needs to be fixed. > > isa_set_resource() is MI code and it happily adds whatever resources > a driver wants. The only chance MD code has is to fail the allocation, > but since the whole ISA code bypasses the newbus hierarchy, there's > no way we know in the isa MD code what is valid and what isn't unless > we add kluges to platform code. > > If you want to fix it for real, does that mean fix it for real or > does that mean add kluges to platform code? > > Shouldn't we have ISA bridges obtain the set of valid resources > from their parent in the newbus hierarchy? Hmm, can we even know that? PCI-ISA bridges in x86 at least don't have any I/O limit registers like PCI-PCI bridges, instead they are subtractively decoded, i.e. they "eat" any memory request that no one else claims. I'm not sure if other platforms have a way of knowing this however. Are you aware of something in OFW to communicate this? ACPI does this for Host-PCI bridges via ResourceProvider() resource entries, but I've never seen ACPI do it for a PCI-ISA bridge. -- John Baldwin From xcllnt at mac.com Wed Oct 14 21:21:14 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Wed Oct 14 21:21:20 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <200910141645.26010.jhb@freebsd.org> References: <20091014.113945.74724941.imp@bsdimp.com> <2D55EFED-675A-4CC7-AF39-DE83961552F0@mac.com> <200910141645.26010.jhb@freebsd.org> Message-ID: <6B860A3C-C1F0-42A0-8ECB-3D41DA698EE2@mac.com> On Oct 14, 2009, at 1:45 PM, John Baldwin wrote: > On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: >> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: >>> >>> I can't be more clear than this. You keep ignoring me, and it is >>> very >>> frustrating. >> >> I'm not ignoring you. I'm still talking. You simply haven't convinced >> me. While it's possible (likely?) that I don't understand the issues, >> all you've achieved so far is that I'm more convinced that limiting >> orm(4) to i386 and amd64 is the right thing, because the alternative >> is not at all appealing. >> >>> The problem is that the >>> powerpc and itanium isa modules allow memory ranges that shouldn't >>> be >>> allowed. That's the platform specific code that needs to be fixed. >> >> isa_set_resource() is MI code and it happily adds whatever resources >> a driver wants. The only chance MD code has is to fail the >> allocation, >> but since the whole ISA code bypasses the newbus hierarchy, there's >> no way we know in the isa MD code what is valid and what isn't unless >> we add kluges to platform code. >> >> If you want to fix it for real, does that mean fix it for real or >> does that mean add kluges to platform code? >> >> Shouldn't we have ISA bridges obtain the set of valid resources >> from their parent in the newbus hierarchy? > > Hmm, can we even know that? PCI-ISA bridges in x86 at least don't > have any > I/O limit registers like PCI-PCI bridges, instead they are > subtractively > decoded, i.e. they "eat" any memory request that no one else claims. The key here being requests that reach the PCI-ISA bridge. It's entirely platform specific which I/O memory addresses generated by the CPU gets decoded and forwarded in such a way that it's visible to the PCI-ISA bridge. This is what needs to be obtained from the parent in the newbus hierarchy. Rather than hardcoding [0xC0000 .. 0x100000> as the ISA option ROM memory range, it should be something like [isa_mem_base+0xC0000 .. isa_mem_base + 0x100000> or even [isa_rom_base .. isa_rom_base + 0x40000>. -- Marcel Moolenaar xcllnt@mac.com From jhb at freebsd.org Wed Oct 14 21:38:50 2009 From: jhb at freebsd.org (John Baldwin) Date: Wed Oct 14 21:38:55 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <6B860A3C-C1F0-42A0-8ECB-3D41DA698EE2@mac.com> References: <200910141645.26010.jhb@freebsd.org> <6B860A3C-C1F0-42A0-8ECB-3D41DA698EE2@mac.com> Message-ID: <200910141738.43910.jhb@freebsd.org> On Wednesday 14 October 2009 5:20:38 pm Marcel Moolenaar wrote: > > On Oct 14, 2009, at 1:45 PM, John Baldwin wrote: > > > On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: > >> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: > >>> > >>> I can't be more clear than this. You keep ignoring me, and it is > >>> very > >>> frustrating. > >> > >> I'm not ignoring you. I'm still talking. You simply haven't convinced > >> me. While it's possible (likely?) that I don't understand the issues, > >> all you've achieved so far is that I'm more convinced that limiting > >> orm(4) to i386 and amd64 is the right thing, because the alternative > >> is not at all appealing. > >> > >>> The problem is that the > >>> powerpc and itanium isa modules allow memory ranges that shouldn't > >>> be > >>> allowed. That's the platform specific code that needs to be fixed. > >> > >> isa_set_resource() is MI code and it happily adds whatever resources > >> a driver wants. The only chance MD code has is to fail the > >> allocation, > >> but since the whole ISA code bypasses the newbus hierarchy, there's > >> no way we know in the isa MD code what is valid and what isn't unless > >> we add kluges to platform code. > >> > >> If you want to fix it for real, does that mean fix it for real or > >> does that mean add kluges to platform code? > >> > >> Shouldn't we have ISA bridges obtain the set of valid resources > >> from their parent in the newbus hierarchy? > > > > Hmm, can we even know that? PCI-ISA bridges in x86 at least don't > > have any > > I/O limit registers like PCI-PCI bridges, instead they are > > subtractively > > decoded, i.e. they "eat" any memory request that no one else claims. > > The key here being requests that reach the PCI-ISA bridge. It's entirely > platform specific which I/O memory addresses generated by the CPU gets > decoded and forwarded in such a way that it's visible to the PCI-ISA > bridge. This is what needs to be obtained from the parent in the newbus > hierarchy. Rather than hardcoding [0xC0000 .. 0x100000> as the ISA > option > ROM memory range, it should be something like [isa_mem_base+0xC0000 .. > isa_mem_base + 0x100000> or even [isa_rom_base .. isa_rom_base + > 0x40000>. That might certainly be a reasonable IVAR for isab(4) to provide to isa(4): a ROM base. However, orm(4) should be enabled for all ISA bridges assuming that is fixed. OTOH, the way many bus drivers I've seen handle this so far is to change the base address of SYS_RES_MEMORY objects as they pass through the relevant bridge so that the actual memory address is properly adjusted when it gets to the equivalent of the nexus. This is how many of the Foo->PCI bridges in arm that I've looked at work, and I think this is more inline with Warner's original patch which is to allow the various platform-specific ISA bridge drivers reject memory ranges they do not decode and provide any needed adjustments to ranges they do decode to transform them into suitable resources for their parent. Then orm(4) would just see it's attempts to do bus_alloc_resource() fail and end up DTRT. Given that, I do think this logic belongs in the ISA bridge drivers rather than in individual ISA drivers. We don't make ISA peripheral drivers add an 'isa_mem_base' or equivalent to their I/O resources, and in terms of I/O resources, orm(4) is just a special blackhole device (much like the ACPI or PnPBIOS system resource devices, or the ram0 or apic0 devices on x86). -- John Baldwin From imp at bsdimp.com Wed Oct 14 22:15:18 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Oct 14 22:15:30 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <6B860A3C-C1F0-42A0-8ECB-3D41DA698EE2@mac.com> References: <2D55EFED-675A-4CC7-AF39-DE83961552F0@mac.com> <200910141645.26010.jhb@freebsd.org> <6B860A3C-C1F0-42A0-8ECB-3D41DA698EE2@mac.com> Message-ID: <20091014.160701.-736097942.imp@bsdimp.com> In message: <6B860A3C-C1F0-42A0-8ECB-3D41DA698EE2@mac.com> Marcel Moolenaar writes: : : On Oct 14, 2009, at 1:45 PM, John Baldwin wrote: : : > On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: : >> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: : >>> : >>> I can't be more clear than this. You keep ignoring me, and it is : >>> very : >>> frustrating. : >> : >> I'm not ignoring you. I'm still talking. You simply haven't convinced : >> me. While it's possible (likely?) that I don't understand the issues, : >> all you've achieved so far is that I'm more convinced that limiting : >> orm(4) to i386 and amd64 is the right thing, because the alternative : >> is not at all appealing. : >> : >>> The problem is that the : >>> powerpc and itanium isa modules allow memory ranges that shouldn't : >>> be : >>> allowed. That's the platform specific code that needs to be fixed. : >> : >> isa_set_resource() is MI code and it happily adds whatever resources : >> a driver wants. The only chance MD code has is to fail the : >> allocation, : >> but since the whole ISA code bypasses the newbus hierarchy, there's : >> no way we know in the isa MD code what is valid and what isn't unless : >> we add kluges to platform code. : >> : >> If you want to fix it for real, does that mean fix it for real or : >> does that mean add kluges to platform code? : >> : >> Shouldn't we have ISA bridges obtain the set of valid resources : >> from their parent in the newbus hierarchy? : > : > Hmm, can we even know that? PCI-ISA bridges in x86 at least don't : > have any : > I/O limit registers like PCI-PCI bridges, instead they are : > subtractively : > decoded, i.e. they "eat" any memory request that no one else claims. : : The key here being requests that reach the PCI-ISA bridge. It's entirely : platform specific which I/O memory addresses generated by the CPU gets : decoded and forwarded in such a way that it's visible to the PCI-ISA : bridge. This is what needs to be obtained from the parent in the newbus : hierarchy. Rather than hardcoding [0xC0000 .. 0x100000> as the ISA : option : ROM memory range, it should be something like [isa_mem_base+0xC0000 .. : isa_mem_base + 0x100000> or even [isa_rom_base .. isa_rom_base + : 0x40000>. 0xc0000..0x100000 is the right range of addresses to use. It is the responsibility of the bus space to translate that to whatever physical address to use. These are bus addresses, and are by definition platform independent. If other platforms map these bus addresses to other physical addresses, then it is their responsibility to map them in the bus_space layer. I think that's the primary disconnect here. The powerpc bus_space doesn't do this at all, but should for those platforms that actually implement it. Warner From imp at bsdimp.com Wed Oct 14 22:15:20 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Wed Oct 14 22:15:41 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <200910141738.43910.jhb@freebsd.org> References: <200910141645.26010.jhb@freebsd.org> <6B860A3C-C1F0-42A0-8ECB-3D41DA698EE2@mac.com> <200910141738.43910.jhb@freebsd.org> Message-ID: <20091014.161115.-1796258170.imp@bsdimp.com> In message: <200910141738.43910.jhb@freebsd.org> John Baldwin writes: : On Wednesday 14 October 2009 5:20:38 pm Marcel Moolenaar wrote: : > : > On Oct 14, 2009, at 1:45 PM, John Baldwin wrote: : > : > > On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: : > >> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: : > >>> : > >>> I can't be more clear than this. You keep ignoring me, and it is : > >>> very : > >>> frustrating. : > >> : > >> I'm not ignoring you. I'm still talking. You simply haven't convinced : > >> me. While it's possible (likely?) that I don't understand the issues, : > >> all you've achieved so far is that I'm more convinced that limiting : > >> orm(4) to i386 and amd64 is the right thing, because the alternative : > >> is not at all appealing. : > >> : > >>> The problem is that the : > >>> powerpc and itanium isa modules allow memory ranges that shouldn't : > >>> be : > >>> allowed. That's the platform specific code that needs to be fixed. : > >> : > >> isa_set_resource() is MI code and it happily adds whatever resources : > >> a driver wants. The only chance MD code has is to fail the : > >> allocation, : > >> but since the whole ISA code bypasses the newbus hierarchy, there's : > >> no way we know in the isa MD code what is valid and what isn't unless : > >> we add kluges to platform code. : > >> : > >> If you want to fix it for real, does that mean fix it for real or : > >> does that mean add kluges to platform code? : > >> : > >> Shouldn't we have ISA bridges obtain the set of valid resources : > >> from their parent in the newbus hierarchy? : > > : > > Hmm, can we even know that? PCI-ISA bridges in x86 at least don't : > > have any : > > I/O limit registers like PCI-PCI bridges, instead they are : > > subtractively : > > decoded, i.e. they "eat" any memory request that no one else claims. : > : > The key here being requests that reach the PCI-ISA bridge. It's entirely : > platform specific which I/O memory addresses generated by the CPU gets : > decoded and forwarded in such a way that it's visible to the PCI-ISA : > bridge. This is what needs to be obtained from the parent in the newbus : > hierarchy. Rather than hardcoding [0xC0000 .. 0x100000> as the ISA : > option : > ROM memory range, it should be something like [isa_mem_base+0xC0000 .. : > isa_mem_base + 0x100000> or even [isa_rom_base .. isa_rom_base + : > 0x40000>. : : That might certainly be a reasonable IVAR for isab(4) to provide to isa(4): a : ROM base. However, orm(4) should be enabled for all ISA bridges assuming : that is fixed. OTOH, the way many bus drivers I've seen handle this so far : is to change the base address of SYS_RES_MEMORY objects as they pass through : the relevant bridge so that the actual memory address is properly adjusted : when it gets to the equivalent of the nexus. This is how many of the : Foo->PCI bridges in arm that I've looked at work, and I think this is more : inline with Warner's original patch which is to allow the various : platform-specific ISA bridge drivers reject memory ranges they do not decode : and provide any needed adjustments to ranges they do decode to transform them : into suitable resources for their parent. Then orm(4) would just see it's : attempts to do bus_alloc_resource() fail and end up DTRT. Given that, I do : think this logic belongs in the ISA bridge drivers rather than in individual : ISA drivers. We don't make ISA peripheral drivers add an 'isa_mem_base' or : equivalent to their I/O resources, and in terms of I/O resources, orm(4) is : just a special blackhole device (much like the ACPI or PnPBIOS system : resource devices, or the ram0 or apic0 devices on x86). This is exactly what I've been trying to say: the memory addresses that orm is using are ISA BUS addresses. These just happen to map 1:1 on x86, but will map to something else on other platforms. But our kernel API is that the driver requests the bus address, and that any necessary translation happen in the bus_space layer. I disagree that it belongs entirely in the isa bridge drivers. They may communicate information to the bus_space implementation, but it is bus_space that ultimately does this translation. Warner From imp at bsdimp.com Thu Oct 15 04:51:51 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Thu Oct 15 04:52:04 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <200910141738.43910.jhb@freebsd.org> References: <200910141645.26010.jhb@freebsd.org> <6B860A3C-C1F0-42A0-8ECB-3D41DA698EE2@mac.com> <200910141738.43910.jhb@freebsd.org> Message-ID: <20091014.224434.-345402487.imp@bsdimp.com> In message: <200910141738.43910.jhb@freebsd.org> John Baldwin writes: : On Wednesday 14 October 2009 5:20:38 pm Marcel Moolenaar wrote: : > : > On Oct 14, 2009, at 1:45 PM, John Baldwin wrote: : > : > > On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: : > >> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: : > >>> : > >>> I can't be more clear than this. You keep ignoring me, and it is : > >>> very : > >>> frustrating. : > >> : > >> I'm not ignoring you. I'm still talking. You simply haven't convinced : > >> me. While it's possible (likely?) that I don't understand the issues, : > >> all you've achieved so far is that I'm more convinced that limiting : > >> orm(4) to i386 and amd64 is the right thing, because the alternative : > >> is not at all appealing. : > >> : > >>> The problem is that the : > >>> powerpc and itanium isa modules allow memory ranges that shouldn't : > >>> be : > >>> allowed. That's the platform specific code that needs to be fixed. : > >> : > >> isa_set_resource() is MI code and it happily adds whatever resources : > >> a driver wants. The only chance MD code has is to fail the : > >> allocation, : > >> but since the whole ISA code bypasses the newbus hierarchy, there's : > >> no way we know in the isa MD code what is valid and what isn't unless : > >> we add kluges to platform code. They aren't kludges. They are codifying the restrictions the platform has for that bus. : > >> If you want to fix it for real, does that mean fix it for real or : > >> does that mean add kluges to platform code? We add proper code to the platform code. The problem exists if you accidentally configure aha. It will probe memory. : > >> Shouldn't we have ISA bridges obtain the set of valid resources : > >> from their parent in the newbus hierarchy? We likely should have the ISA bridge create and give out a bus_space that maps the ISA bus addresses to wherever they are mapped on the host. : > > Hmm, can we even know that? PCI-ISA bridges in x86 at least don't : > > have any : > > I/O limit registers like PCI-PCI bridges, instead they are : > > subtractively : > > decoded, i.e. they "eat" any memory request that no one else claims. Correct. They always assume the default x86 mapping of the ISA bus space to physical memory. : > The key here being requests that reach the PCI-ISA bridge. It's entirely : > platform specific which I/O memory addresses generated by the CPU gets : > decoded and forwarded in such a way that it's visible to the PCI-ISA : > bridge. This is what needs to be obtained from the parent in the newbus : > hierarchy. Rather than hardcoding [0xC0000 .. 0x100000> as the ISA : > option : > ROM memory range, it should be something like [isa_mem_base+0xC0000 .. : > isa_mem_base + 0x100000> or even [isa_rom_base .. isa_rom_base + : > 0x40000>. Hard coding 0xc0000, etc is proper here because that's not a physical address. It is an ISA bus address. This address needs to be mapped to the host memory segment at the bus_space level so that the drivers we have in the tree will work on those architectures where the mapping isn't the identity like on x86. The drivers should have no knowledge this is happening if they are using bus_space routines. That's what they exist for. : That might certainly be a reasonable IVAR for isab(4) to provide to isa(4): a : ROM base. However, orm(4) should be enabled for all ISA bridges assuming : that is fixed. OTOH, the way many bus drivers I've seen handle this so far : is to change the base address of SYS_RES_MEMORY objects as they pass through : the relevant bridge so that the actual memory address is properly adjusted : when it gets to the equivalent of the nexus. This is how many of the : Foo->PCI bridges in arm that I've looked at work, and I think this is more : inline with Warner's original patch which is to allow the various : platform-specific ISA bridge drivers reject memory ranges they do not decode : and provide any needed adjustments to ranges they do decode to transform them : into suitable resources for their parent. I think that they are done at the wrong level if they are done there. They should be done in the bus_space layer so that the driver can get the bus addresses to maybe program into pci hardware. : Then orm(4) would just see it's : attempts to do bus_alloc_resource() fail and end up DTRT. Yes and no. bus_alloc_resource would do the right thing. If the bridge driver knew that it had a private mapping, it would create an rman that had the memory ranges (in ISA memory space) that it decoded. It would then carve out allocates from this rman for any child devices that asked for it. It would return a bus_space handle that could be used by the driver and bus_space_read* to get the right thing from the memory. For x86, you couldn't implement this because the bus_space assumes one global space. On arm and mips, for example, their bus_space implementations are such that at any level you can do things like byte ordering hacks or address translations like this. On those platforms, the bus_space functions become calls into a function pointer table that allows for this kind of mapping. : Given that, I do : think this logic belongs in the ISA bridge drivers rather than in individual : ISA drivers. We don't make ISA peripheral drivers add an 'isa_mem_base' or : equivalent to their I/O resources, and in terms of I/O resources, orm(4) is : just a special blackhole device (much like the ACPI or PnPBIOS system : resource devices, or the ram0 or apic0 devices on x86). Keep in mind that 0xc0000 is a bus space address on the ISA bus, not a physical memory address. On x86 it just happens to be mapped 1:1 to physical memory. On other systems this isn't the case. On those systems, the bus_space that is returned for this resource should do the translation. that's what it was invented for. For example, the TS-7200 board maps the 8-bit memory reads to one address range, 16-bit memory reads to another, 8-bit port access to a third and 16-bit port access to a forth. Let's call these M8, M16, I8 and I16. So a bus_space_read_1 of a memory rid will return *(uint8_t *)(M8 + offset). A bus_space_read_2 of the same offset will return *(uint16_t *)(M16 + offset), etc. So when orm runs on this board, its bus_space stuff will read M8 + 0xc0000, etc. No changs to the driver are necessary to accomplish this. All the fixes are done in the bus_space that's used to access the isa bus on this board. This is the basis of my saying that the MD code for the machine in question must either filter out the requests for the memory range on the ISA bus that isn't decoded. Or it must provide the translation from the ISA BUS address passed to bus_space_read_1 to the actual physical/virtual address that the bus is mapped in on that machine. If you think about it, this needs to be the case. Many ISA cards need to have the address on the bus programmed into them for various things. If you had to have every platform and subbus codified for them in the driver, we'd quickly have a big mess in every driver since they would all have to know how to map the physical addresses. This is also the source of my frustration with the thread, I think. I don't think that Marcel understood this world view and assumed that no mapping was needed and therefore orm was this horribly x86 specific code. Since I didn't understand this until today, I reacted badly and lost my temper, for which I'd like to apologize. I should have stopped and explained this view better. Warner P.S. The code to implement this board is only in perforce right now (and may be broken). You can see how NetBSD accomplishes this in their tree. From xcllnt at mac.com Thu Oct 15 05:36:03 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Thu Oct 15 05:36:09 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091014.224434.-345402487.imp@bsdimp.com> References: <200910141645.26010.jhb@freebsd.org> <6B860A3C-C1F0-42A0-8ECB-3D41DA698EE2@mac.com> <200910141738.43910.jhb@freebsd.org> <20091014.224434.-345402487.imp@bsdimp.com> Message-ID: On Oct 14, 2009, at 9:44 PM, M. Warner Losh wrote: > This is also the source of my frustration with the thread, I think. I > don't think that Marcel understood this world view and assumed that no > mapping was needed and therefore orm was this horribly x86 specific > code. Since I didn't understand this until today, I reacted badly and > lost my temper, for which I'd like to apologize. I should have > stopped and explained this view better. Apology accepted. Sorry, if I appeared frustrated as well. I can respect the PoV that the hardcoding in drivers are bus addresses. I have no problem with that. It isn't my PoV, because it doesn't match with the existence of functions like inb(), outb(), inw(), outw(), etc. The I/O port numbers passed to those functions are typically absolute due to the total lack of newbus involvement. I merely extrapolated the memory addresses as behaving in the same way. They do actually, because VGA frame buffer memory is at 0xA0000 and part of the PCI specification and you don't want to translate that, so how does MD code know when to map and when not to? It doesn't, so the only logical interpretation is that the addresses are absolute and no mapping can be done. I don't mind changing the interpretation of I/O ports and memory addresses as being ISA bus addresses, but that means that we need to get rid off inb(), outb(), et al and use newbus through out. Until that's done (and people figure out how to deal with VGA resources) or there's a real need for orm(4), it's safest for non-PC platforms to not have orm(4) wreck havoc. -- Marcel Moolenaar xcllnt@mac.com From imp at bsdimp.com Thu Oct 15 06:00:01 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Thu Oct 15 06:00:13 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: References: <200910141738.43910.jhb@freebsd.org> <20091014.224434.-345402487.imp@bsdimp.com> Message-ID: <20091014.235315.62961324.imp@bsdimp.com> In message: Marcel Moolenaar writes: : : On Oct 14, 2009, at 9:44 PM, M. Warner Losh wrote: : > This is also the source of my frustration with the thread, I think. I : > don't think that Marcel understood this world view and assumed that no : > mapping was needed and therefore orm was this horribly x86 specific : > code. Since I didn't understand this until today, I reacted badly and : > lost my temper, for which I'd like to apologize. I should have : > stopped and explained this view better. : : Apology accepted. Sorry, if I appeared frustrated as well. : : I can respect the PoV that the hardcoding in drivers are bus addresses. : I have no problem with that. It isn't my PoV, because it doesn't match : with the existence of functions like inb(), outb(), inw(), outw(), etc. inb, etc, aren't part of bus_space and exist outside of it. These functions typically don't exist on !x86 platforms, and when they do they are very platform specific.. : The I/O port numbers passed to those functions are typically absolute : due to the total lack of newbus involvement. I merely extrapolated the : memory addresses as behaving in the same way. They do actually, because : VGA frame buffer memory is at 0xA0000 and part of the PCI specification : and you don't want to translate that, so how does MD code know when to : map and when not to? It doesn't, so the only logical interpretation is : that the addresses are absolute and no mapping can be done. The PCI specification says that the frame buffer is at 0xa0000 in the pci bus space. It doesn't say anything about how that bus space is mapped into the processor's address space (although it comments on x86's traditional mapping in many places). : I don't mind changing the interpretation of I/O ports and memory : addresses as being ISA bus addresses, but that means that we need to : get rid off inb(), outb(), et al and use newbus through out. Until : that's done (and people figure out how to deal with VGA resources) or : there's a real need for orm(4), it's safest for non-PC platforms to not : have orm(4) wreck havoc. There is a real need for orm. I'm open to ways to improve the situation without requiring the complete implementation of the ISA stuff. The reason that it does wreck havoc is because there's problems in the ISA implementation on the platforms it wrecks havoc on. You can mask these problems by removing orm. However, any other isa device that reads memory will have issues on these platforms. The VGA resource issue should be a simple one to deal with via bus_spae. This is the first time I've heard of it, frankly, so would be interested in learning more about it. We've also, as a project, have strongly encouraged drivers to move away from inb, et al, and direct memory access to using bus_space interfaces since around FreeBSD 4.0. Many drivers have been converted. I think the few stragglers were killed as part of the network modernization efforts, although some pre-ISA PNP support still uses inb/outb directly. I think I'd quibble that it is !x86. It is specific to powerpc and itanium platforms. Sparc64 handles it correctly, as does arm (at east in the projects/arm tree). I don't think that mips has any ISA support, even in the projects/mips tree. Warner From qingli at FreeBSD.org Thu Oct 15 06:12:05 2009 From: qingli at FreeBSD.org (Qing Li) Date: Thu Oct 15 06:12:16 2009 Subject: svn commit: r198111 - head/sys/netinet Message-ID: <200910150612.n9F6C4vH061396@svn.freebsd.org> Author: qingli Date: Thu Oct 15 06:12:04 2009 New Revision: 198111 URL: http://svn.freebsd.org/changeset/base/198111 Log: This patch fixes the following issues in the ARP operation: 1. There is a regression issue in the ARP code. The incomplete ARP entry was timing out too quickly (1 second timeout), as such, a new entry is created each time arpresolve() is called. Therefore the maximum attempts made is always 1. Consequently the error code returned to the application is always 0. 2. Set the expiration of each incomplete entry to a 20-second lifetime. 3. Return "incomplete" entries to the application. Reviewed by: kmacy MFC after: 3 days Modified: head/sys/netinet/if_ether.c head/sys/netinet/in.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Thu Oct 15 06:02:37 2009 (r198110) +++ head/sys/netinet/if_ether.c Thu Oct 15 06:12:04 2009 (r198111) @@ -88,11 +88,14 @@ VNET_DEFINE(int, useloopback) = 1; /* us /* timer values */ static VNET_DEFINE(int, arpt_keep) = (20*60); /* once resolved, good for 20 * minutes */ +static VNET_DEFINE(int, arpt_down) = 20; /* keep incomplete entries for + * 20 seconds */ static VNET_DEFINE(int, arp_maxtries) = 5; static VNET_DEFINE(int, arp_proxyall); static VNET_DEFINE(struct arpstat, arpstat); /* ARP statistics, see if_arp.h */ #define V_arpt_keep VNET(arpt_keep) +#define V_arpt_down VNET(arpt_down) #define V_arp_maxtries VNET(arp_maxtries) #define V_arp_proxyall VNET(arp_proxyall) #define V_arpstat VNET(arpstat) @@ -309,7 +312,7 @@ retry: } if ((la->la_flags & LLE_VALID) && - ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) { + ((la->la_flags & LLE_STATIC) || la->la_expire > time_second)) { bcopy(&la->ll_addr, desten, ifp->if_addrlen); /* * If entry has an expiry time and it is approaching, @@ -317,7 +320,7 @@ retry: * arpt_down interval. */ if (!(la->la_flags & LLE_STATIC) && - time_uptime + la->la_preempt > la->la_expire) { + time_second + la->la_preempt > la->la_expire) { arprequest(ifp, NULL, &SIN(dst)->sin_addr, IF_LLADDR(ifp)); @@ -337,7 +340,7 @@ retry: goto done; } - renew = (la->la_asked == 0 || la->la_expire != time_uptime); + renew = (la->la_asked == 0 || la->la_expire != time_second); if ((renew || m != NULL) && (flags & LLE_EXCLUSIVE) == 0) { flags |= LLE_EXCLUSIVE; LLE_RUNLOCK(la); @@ -370,12 +373,12 @@ retry: error = EWOULDBLOCK; /* First request. */ else error = - (rt0->rt_flags & RTF_GATEWAY) ? EHOSTDOWN : EHOSTUNREACH; + (rt0->rt_flags & RTF_GATEWAY) ? EHOSTUNREACH : EHOSTDOWN; if (renew) { LLE_ADDREF(la); - la->la_expire = time_uptime; - callout_reset(&la->la_timer, hz, arptimer, la); + la->la_expire = time_second; + callout_reset(&la->la_timer, hz * V_arpt_down, arptimer, la); la->la_asked++; LLE_WUNLOCK(la); arprequest(ifp, NULL, &SIN(dst)->sin_addr, @@ -687,7 +690,7 @@ match: EVENTHANDLER_INVOKE(arp_update_event, la); if (!(la->la_flags & LLE_STATIC)) { - la->la_expire = time_uptime + V_arpt_keep; + la->la_expire = time_second + V_arpt_keep; callout_reset(&la->la_timer, hz * V_arpt_keep, arptimer, la); } Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu Oct 15 06:02:37 2009 (r198110) +++ head/sys/netinet/in.c Thu Oct 15 06:12:04 2009 (r198111) @@ -1440,7 +1440,7 @@ in_lltable_dump(struct lltable *llt, str struct sockaddr_dl *sdl; /* skip deleted entries */ - if ((lle->la_flags & (LLE_DELETED|LLE_VALID)) != LLE_VALID) + if ((lle->la_flags & LLE_DELETED) == LLE_DELETED) continue; /* Skip if jailed and not a valid IP of the prison. */ if (prison_if(wr->td->td_ucred, L3_ADDR(lle)) != 0) @@ -1472,10 +1472,15 @@ in_lltable_dump(struct lltable *llt, str sdl = &arpc.sdl; sdl->sdl_family = AF_LINK; sdl->sdl_len = sizeof(*sdl); - sdl->sdl_alen = ifp->if_addrlen; sdl->sdl_index = ifp->if_index; sdl->sdl_type = ifp->if_type; - bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); + if ((lle->la_flags & LLE_VALID) == LLE_VALID) { + sdl->sdl_alen = ifp->if_addrlen; + bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); + } else { + sdl->sdl_alen = 0; + bzero(LLADDR(sdl), ifp->if_addrlen); + } arpc.rtm.rtm_rmx.rmx_expire = lle->la_flags & LLE_STATIC ? 0 : lle->la_expire; From qingli at freebsd.org Thu Oct 15 06:26:22 2009 From: qingli at freebsd.org (Qing Li) Date: Thu Oct 15 06:26:34 2009 Subject: svn commit: r198111 - head/sys/netinet In-Reply-To: <200910150612.n9F6C4vH061396@svn.freebsd.org> References: <200910150612.n9F6C4vH061396@svn.freebsd.org> Message-ID: <9ace436c0910142326t69ddfe9ex26fa2c99849483aa@mail.gmail.com> Forgot to mention the return code was incorrect. The function was returning EHOSTUNEACH when it should be returning EHOSTDOWN. This is also fixed by this patch. -- Qing On Wed, Oct 14, 2009 at 11:12 PM, Qing Li wrote: > Author: qingli > Date: Thu Oct 15 06:12:04 2009 > New Revision: 198111 > URL: http://svn.freebsd.org/changeset/base/198111 > > Log: > ?This patch fixes the following issues in the ARP operation: > > ?1. There is a regression issue in the ARP code. The incomplete > ? ? ARP entry was timing out too quickly (1 second timeout), as > ? ? such, a new entry is created each time arpresolve() is called. > ? ? Therefore the maximum attempts made is always 1. Consequently > ? ? the error code returned to the application is always 0. > ?2. Set the expiration of each incomplete entry to a 20-second > ? ? lifetime. > ?3. Return "incomplete" entries to the application. > > ?Reviewed by: ?kmacy > ?MFC after: ? ?3 days > > Modified: > ?head/sys/netinet/if_ether.c > ?head/sys/netinet/in.c > > Modified: head/sys/netinet/if_ether.c > ============================================================================== > --- head/sys/netinet/if_ether.c Thu Oct 15 06:02:37 2009 ? ? ? ?(r198110) > +++ head/sys/netinet/if_ether.c Thu Oct 15 06:12:04 2009 ? ? ? ?(r198111) > @@ -88,11 +88,14 @@ VNET_DEFINE(int, useloopback) = 1; ?/* us > ?/* timer values */ > ?static VNET_DEFINE(int, arpt_keep) = (20*60); ?/* once resolved, good for 20 > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? * minutes */ > +static VNET_DEFINE(int, arpt_down) = 20; ? ? ?/* keep incomplete entries for > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?* 20 seconds */ > ?static VNET_DEFINE(int, arp_maxtries) = 5; > ?static VNET_DEFINE(int, arp_proxyall); > ?static VNET_DEFINE(struct arpstat, arpstat); ?/* ARP statistics, see if_arp.h */ > > ?#define ? ? ? ?V_arpt_keep ? ? ? ? ? ? VNET(arpt_keep) > +#define ? ? ? ?V_arpt_down ? ? ? ? ? ? VNET(arpt_down) > ?#define ? ? ? ?V_arp_maxtries ? ? ? ? ?VNET(arp_maxtries) > ?#define ? ? ? ?V_arp_proxyall ? ? ? ? ?VNET(arp_proxyall) > ?#define ? ? ? ?V_arpstat ? ? ? ? ? ? ? VNET(arpstat) > @@ -309,7 +312,7 @@ retry: > ? ? ? ?} > > ? ? ? ?if ((la->la_flags & LLE_VALID) && > - ? ? ? ? ? ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) { > + ? ? ? ? ? ((la->la_flags & LLE_STATIC) || la->la_expire > time_second)) { > ? ? ? ? ? ? ? ?bcopy(&la->ll_addr, desten, ifp->if_addrlen); > ? ? ? ? ? ? ? ?/* > ? ? ? ? ? ? ? ? * If entry has an expiry time and it is approaching, > @@ -317,7 +320,7 @@ retry: > ? ? ? ? ? ? ? ? * arpt_down interval. > ? ? ? ? ? ? ? ? */ > ? ? ? ? ? ? ? ?if (!(la->la_flags & LLE_STATIC) && > - ? ? ? ? ? ? ? ? ? time_uptime + la->la_preempt > la->la_expire) { > + ? ? ? ? ? ? ? ? ? time_second + la->la_preempt > la->la_expire) { > ? ? ? ? ? ? ? ? ? ? ? ?arprequest(ifp, NULL, > ? ? ? ? ? ? ? ? ? ? ? ? ? ?&SIN(dst)->sin_addr, IF_LLADDR(ifp)); > > @@ -337,7 +340,7 @@ retry: > ? ? ? ? ? ? ? ?goto done; > ? ? ? ?} > > - ? ? ? renew = (la->la_asked == 0 || la->la_expire != time_uptime); > + ? ? ? renew = (la->la_asked == 0 || la->la_expire != time_second); > ? ? ? ?if ((renew || m != NULL) && (flags & LLE_EXCLUSIVE) == 0) { > ? ? ? ? ? ? ? ?flags |= LLE_EXCLUSIVE; > ? ? ? ? ? ? ? ?LLE_RUNLOCK(la); > @@ -370,12 +373,12 @@ retry: > ? ? ? ? ? ? ? ?error = EWOULDBLOCK; ? ?/* First request. */ > ? ? ? ?else > ? ? ? ? ? ? ? ?error = > - ? ? ? ? ? ? ? ? ? (rt0->rt_flags & RTF_GATEWAY) ? EHOSTDOWN : EHOSTUNREACH; > + ? ? ? ? ? ? ? ? ? ? ? (rt0->rt_flags & RTF_GATEWAY) ? EHOSTUNREACH : EHOSTDOWN; > > ? ? ? ?if (renew) { > ? ? ? ? ? ? ? ?LLE_ADDREF(la); > - ? ? ? ? ? ? ? la->la_expire = time_uptime; > - ? ? ? ? ? ? ? callout_reset(&la->la_timer, hz, arptimer, la); > + ? ? ? ? ? ? ? la->la_expire = time_second; > + ? ? ? ? ? ? ? callout_reset(&la->la_timer, hz * V_arpt_down, arptimer, la); > ? ? ? ? ? ? ? ?la->la_asked++; > ? ? ? ? ? ? ? ?LLE_WUNLOCK(la); > ? ? ? ? ? ? ? ?arprequest(ifp, NULL, &SIN(dst)->sin_addr, > @@ -687,7 +690,7 @@ match: > ? ? ? ? ? ? ? ?EVENTHANDLER_INVOKE(arp_update_event, la); > > ? ? ? ? ? ? ? ?if (!(la->la_flags & LLE_STATIC)) { > - ? ? ? ? ? ? ? ? ? ? ? la->la_expire = time_uptime + V_arpt_keep; > + ? ? ? ? ? ? ? ? ? ? ? la->la_expire = time_second + V_arpt_keep; > ? ? ? ? ? ? ? ? ? ? ? ?callout_reset(&la->la_timer, hz * V_arpt_keep, > ? ? ? ? ? ? ? ? ? ? ? ? ? ?arptimer, la); > ? ? ? ? ? ? ? ?} > > Modified: head/sys/netinet/in.c > ============================================================================== > --- head/sys/netinet/in.c ? ? ? Thu Oct 15 06:02:37 2009 ? ? ? ?(r198110) > +++ head/sys/netinet/in.c ? ? ? Thu Oct 15 06:12:04 2009 ? ? ? ?(r198111) > @@ -1440,7 +1440,7 @@ in_lltable_dump(struct lltable *llt, str > ? ? ? ? ? ? ? ? ? ? ? ?struct sockaddr_dl *sdl; > > ? ? ? ? ? ? ? ? ? ? ? ?/* skip deleted entries */ > - ? ? ? ? ? ? ? ? ? ? ? if ((lle->la_flags & (LLE_DELETED|LLE_VALID)) != LLE_VALID) > + ? ? ? ? ? ? ? ? ? ? ? if ((lle->la_flags & LLE_DELETED) == LLE_DELETED) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?continue; > ? ? ? ? ? ? ? ? ? ? ? ?/* Skip if jailed and not a valid IP of the prison. */ > ? ? ? ? ? ? ? ? ? ? ? ?if (prison_if(wr->td->td_ucred, L3_ADDR(lle)) != 0) > @@ -1472,10 +1472,15 @@ in_lltable_dump(struct lltable *llt, str > ? ? ? ? ? ? ? ? ? ? ? ?sdl = &arpc.sdl; > ? ? ? ? ? ? ? ? ? ? ? ?sdl->sdl_family = AF_LINK; > ? ? ? ? ? ? ? ? ? ? ? ?sdl->sdl_len = sizeof(*sdl); > - ? ? ? ? ? ? ? ? ? ? ? sdl->sdl_alen = ifp->if_addrlen; > ? ? ? ? ? ? ? ? ? ? ? ?sdl->sdl_index = ifp->if_index; > ? ? ? ? ? ? ? ? ? ? ? ?sdl->sdl_type = ifp->if_type; > - ? ? ? ? ? ? ? ? ? ? ? bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); > + ? ? ? ? ? ? ? ? ? ? ? if ((lle->la_flags & LLE_VALID) == LLE_VALID) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sdl->sdl_alen = ifp->if_addrlen; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); > + ? ? ? ? ? ? ? ? ? ? ? } else { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sdl->sdl_alen = 0; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bzero(LLADDR(sdl), ifp->if_addrlen); > + ? ? ? ? ? ? ? ? ? ? ? } > > ? ? ? ? ? ? ? ? ? ? ? ?arpc.rtm.rtm_rmx.rmx_expire = > ? ? ? ? ? ? ? ? ? ? ? ? ? ?lle->la_flags & LLE_STATIC ? 0 : lle->la_expire; > From hrs at FreeBSD.org Thu Oct 15 07:58:02 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Thu Oct 15 07:58:14 2009 Subject: svn commit: r198114 - in head/release/doc: . en_US.ISO8859-1/errata share/mk share/sgml Message-ID: <200910150758.n9F7w1as064193@svn.freebsd.org> Author: hrs Date: Thu Oct 15 07:58:01 2009 New Revision: 198114 URL: http://svn.freebsd.org/changeset/base/198114 Log: Bump version numbers and update descriptions for the 9-CURRENT world. The %[no]include.historic knobs are removed because they are not used for a long time. Modified: head/release/doc/README head/release/doc/en_US.ISO8859-1/errata/article.sgml head/release/doc/share/mk/doc.relnotes.mk head/release/doc/share/sgml/release.dsl head/release/doc/share/sgml/release.ent Modified: head/release/doc/README ============================================================================== --- head/release/doc/README Thu Oct 15 07:47:49 2009 (r198113) +++ head/release/doc/README Thu Oct 15 07:58:01 2009 (r198114) @@ -99,9 +99,10 @@ element will be included. For example: SPARC64-specific text -The currently-supported architectures are i386, sparc64, and -ia64. An element may appear for multiple architectures by specifying -a comma-separated list of architectures (i.e. arch="sparc64,ia64"). +The currently-supported architectures are amd64, arm, i386, ia64, +pc98, powerpc, and sparc64. An element may appear for multiple +architectures by specifying a comma-separated list of architectures +(i.e. arch="sparc64,ia64"). When creating a translation, make a new directory under this directory with a language code (paralleling the DocProj directory Modified: head/release/doc/en_US.ISO8859-1/errata/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/errata/article.sgml Thu Oct 15 07:47:49 2009 (r198113) +++ head/release/doc/en_US.ISO8859-1/errata/article.sgml Thu Oct 15 07:58:01 2009 (r198114) @@ -16,7 +16,6 @@ %release; - ]>
Modified: head/release/doc/share/mk/doc.relnotes.mk ============================================================================== --- head/release/doc/share/mk/doc.relnotes.mk Thu Oct 15 07:47:49 2009 (r198113) +++ head/release/doc/share/mk/doc.relnotes.mk Thu Oct 15 07:58:01 2009 (r198114) @@ -11,23 +11,6 @@ DSLHTML?= ${RELN_ROOT}/share/sgml/defaul DSLPRINT?= ${RELN_ROOT}/share/sgml/default.dsl # -# Tweakable Makefile variables -# -# INCLUDE_HISTORIC Used by relnotes document only. When set, -# causes all release notes entries to be printed, -# even those marked as "historic". If not set -# (the default), only print "non-historic" -# release note entries. To designate a release -# note entry as "historic", add a role="historic" -# attribute to the applicable element(s). -# -.if defined(INCLUDE_HISTORIC) -JADEFLAGS+= -iinclude.historic -.else -JADEFLAGS+= -ino.include.historic -.endif - -# # Automatic device list generation: # .if exists(${RELN_ROOT}/../man4) Modified: head/release/doc/share/sgml/release.dsl ============================================================================== --- head/release/doc/share/sgml/release.dsl Thu Oct 15 07:47:49 2009 (r198113) +++ head/release/doc/share/sgml/release.dsl Thu Oct 15 07:58:01 2009 (r198114) @@ -3,8 +3,6 @@ - - %release.ent; @@ -14,14 +12,6 @@ -; Configure behavior of this stylesheet - - - ; String manipulation functions (define (split-string-to-list STR) ;; return list of STR separated with char #\ or #\, @@ -54,36 +44,6 @@ ((equal? STR (car s)) #t) (else (loop (cdr s)))))) -; Deal with conditional inclusion of text via entities. -(default - (let* ((role (attribute-string (normalize "role"))) - (for-arch (entity-text "arch"))) - (cond - - ;; If role=historic, and we're not printing historic things, then - ;; don't output this element. - ((and (equal? role "historic") - (not %include-historic%)) - (empty-sosofo)) - - ;; None of the above - (else (next-match))))) - -(mode qandatoc - (default - (let* ((role (attribute-string (normalize "role"))) - (for-arch (entity-text "arch"))) - (cond - - ;; If role=historic, and we're not printing historic things, then - ;; don't output this element. - ((and (equal? role "historic") - (not %include-historic%)) - (empty-sosofo)) - - ;; None of the above - (else (next-match)))))) - ; We might have some sect1 level elements where the modification times ; are significant. An example of this is the "What's New" section in ; the release notes. We enable the printing of pubdate entry in @@ -198,7 +158,6 @@ (u (string-append "&release.man.url;?query=" (data r) "&" "sektion=" (data m)))) (case v - (("xfree86") (string-append u "&" "manpath=XFree86+&release.manpath.xfree86;" )) (("xorg") (string-append u "&" "manpath=Xorg+&release.manpath.xorg;" )) (("netbsd") (string-append u "&" "manpath=NetBSD+&release.manpath.netbsd;")) (("ports") (string-append u "&" "manpath=FreeBSD+&release.manpath.freebsd-ports;")) Modified: head/release/doc/share/sgml/release.ent ============================================================================== --- head/release/doc/share/sgml/release.ent Thu Oct 15 07:47:49 2009 (r198113) +++ head/release/doc/share/sgml/release.ent Thu Oct 15 07:58:01 2009 (r198114) @@ -6,23 +6,23 @@ - + - + - + - + - + @@ -36,11 +36,10 @@ - - - + + - + From rwatson at FreeBSD.org Thu Oct 15 10:31:24 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Thu Oct 15 10:31:31 2009 Subject: svn commit: r198118 - head/usr.bin/netstat Message-ID: <200910151031.n9FAVOvU070664@svn.freebsd.org> Author: rwatson Date: Thu Oct 15 10:31:24 2009 New Revision: 198118 URL: http://svn.freebsd.org/changeset/base/198118 Log: Print routing statistics as unsigned short rather than unsigned int, otherwise sign extension leads to unlikely values when in the negative range of the signed short structure fields that hold the statistics. The type used to hold routing statistics is arguably also incorrect. MFC after: 3 days Modified: head/usr.bin/netstat/route.c Modified: head/usr.bin/netstat/route.c ============================================================================== --- head/usr.bin/netstat/route.c Thu Oct 15 08:55:43 2009 (r198117) +++ head/usr.bin/netstat/route.c Thu Oct 15 10:31:24 2009 (r198118) @@ -1008,11 +1008,11 @@ rt_stats(u_long rtsaddr, u_long rttaddr) #define p(f, m) if (rtstat.f || sflag <= 1) \ printf(m, rtstat.f, plural(rtstat.f)) - p(rts_badredirect, "\t%u bad routing redirect%s\n"); - p(rts_dynamic, "\t%u dynamically created route%s\n"); - p(rts_newgateway, "\t%u new gateway%s due to redirects\n"); - p(rts_unreach, "\t%u destination%s found unreachable\n"); - p(rts_wildcard, "\t%u use%s of a wildcard route\n"); + p(rts_badredirect, "\t%hu bad routing redirect%s\n"); + p(rts_dynamic, "\t%hu dynamically created route%s\n"); + p(rts_newgateway, "\t%hu new gateway%s due to redirects\n"); + p(rts_unreach, "\t%hu destination%s found unreachable\n"); + p(rts_wildcard, "\t%hu use%s of a wildcard route\n"); #undef p if (rttrash || sflag <= 1) From brueffer at FreeBSD.org Thu Oct 15 11:32:06 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Thu Oct 15 11:32:12 2009 Subject: svn commit: r198125 - head/share/man/man4 Message-ID: <200910151132.n9FBW6NH072200@svn.freebsd.org> Author: brueffer Date: Thu Oct 15 11:32:05 2009 New Revision: 198125 URL: http://svn.freebsd.org/changeset/base/198125 Log: Use our standard section 4 SYNOPSIS. MFC after: 3 days Modified: head/share/man/man4/sbp_targ.4 head/share/man/man4/targ.4 Modified: head/share/man/man4/sbp_targ.4 ============================================================================== --- head/share/man/man4/sbp_targ.4 Thu Oct 15 11:12:53 2009 (r198124) +++ head/share/man/man4/sbp_targ.4 Thu Oct 15 11:32:05 2009 (r198125) @@ -38,16 +38,24 @@ .Nm sbp_targ .Nd Serial Bus Protocol 2 (SBP-2) Target Mode devices driver .Sh SYNOPSIS -.Cd "kldload firewire" -.Cd "kldload cam" -.Cd "kldload sbp_targ" -.Pp -or -.Pp +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent .Cd "device sbp_targ" .Cd "device firewire" .Cd "device scbus" .Cd "device targ" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following lines in +.Xr loader.conf 5 : +.Bd -literal -offset indent +firewire_load="YES" +cam_load="YES" +sbp_targ_load"YES" +.Ed .Sh DESCRIPTION The .Nm Modified: head/share/man/man4/targ.4 ============================================================================== --- head/share/man/man4/targ.4 Thu Oct 15 11:12:53 2009 (r198124) +++ head/share/man/man4/targ.4 Thu Oct 15 11:32:05 2009 (r198125) @@ -31,7 +31,12 @@ .Nm targ .Nd SCSI target emulator driver .Sh SYNOPSIS -.Cd device targ +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device targ" +.Ed .Sh DESCRIPTION The .Nm From jhb at FreeBSD.org Thu Oct 15 11:41:13 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Oct 15 11:41:24 2009 Subject: svn commit: r198126 - head/sys/kern Message-ID: <200910151141.n9FBfCew072438@svn.freebsd.org> Author: jhb Date: Thu Oct 15 11:41:12 2009 New Revision: 198126 URL: http://svn.freebsd.org/changeset/base/198126 Log: Fix a sign bug in the handling of nice priorities when computing the interactive score for a thread. Submitted by: Taku YAMAMOTO taku of tackymt.homeip.net Reviewed by: jeff MFC after: 3 days Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Thu Oct 15 11:32:05 2009 (r198125) +++ head/sys/kern/sched_ule.c Thu Oct 15 11:41:12 2009 (r198126) @@ -1406,7 +1406,7 @@ sched_priority(struct thread *td) * score. Negative nice values make it easier for a thread to be * considered interactive. */ - score = imax(0, sched_interact_score(td) - td->td_proc->p_nice); + score = imax(0, sched_interact_score(td) + td->td_proc->p_nice); if (score < sched_interact) { pri = PRI_MIN_REALTIME; pri += ((PRI_MAX_REALTIME - PRI_MIN_REALTIME) / sched_interact) From jhb at freebsd.org Thu Oct 15 12:45:00 2009 From: jhb at freebsd.org (John Baldwin) Date: Thu Oct 15 12:45:13 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091014.161115.-1796258170.imp@bsdimp.com> References: <200910141645.26010.jhb@freebsd.org> <200910141738.43910.jhb@freebsd.org> <20091014.161115.-1796258170.imp@bsdimp.com> Message-ID: <200910150833.54252.jhb@freebsd.org> On Wednesday 14 October 2009 6:11:15 pm M. Warner Losh wrote: > In message: <200910141738.43910.jhb@freebsd.org> > John Baldwin writes: > : On Wednesday 14 October 2009 5:20:38 pm Marcel Moolenaar wrote: > : > > : > On Oct 14, 2009, at 1:45 PM, John Baldwin wrote: > : > > : > > On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: > : > >> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: > : > >>> > : > >>> I can't be more clear than this. You keep ignoring me, and it is > : > >>> very > : > >>> frustrating. > : > >> > : > >> I'm not ignoring you. I'm still talking. You simply haven't convinced > : > >> me. While it's possible (likely?) that I don't understand the issues, > : > >> all you've achieved so far is that I'm more convinced that limiting > : > >> orm(4) to i386 and amd64 is the right thing, because the alternative > : > >> is not at all appealing. > : > >> > : > >>> The problem is that the > : > >>> powerpc and itanium isa modules allow memory ranges that shouldn't > : > >>> be > : > >>> allowed. That's the platform specific code that needs to be fixed. > : > >> > : > >> isa_set_resource() is MI code and it happily adds whatever resources > : > >> a driver wants. The only chance MD code has is to fail the > : > >> allocation, > : > >> but since the whole ISA code bypasses the newbus hierarchy, there's > : > >> no way we know in the isa MD code what is valid and what isn't unless > : > >> we add kluges to platform code. > : > >> > : > >> If you want to fix it for real, does that mean fix it for real or > : > >> does that mean add kluges to platform code? > : > >> > : > >> Shouldn't we have ISA bridges obtain the set of valid resources > : > >> from their parent in the newbus hierarchy? > : > > > : > > Hmm, can we even know that? PCI-ISA bridges in x86 at least don't > : > > have any > : > > I/O limit registers like PCI-PCI bridges, instead they are > : > > subtractively > : > > decoded, i.e. they "eat" any memory request that no one else claims. > : > > : > The key here being requests that reach the PCI-ISA bridge. It's entirely > : > platform specific which I/O memory addresses generated by the CPU gets > : > decoded and forwarded in such a way that it's visible to the PCI-ISA > : > bridge. This is what needs to be obtained from the parent in the newbus > : > hierarchy. Rather than hardcoding [0xC0000 .. 0x100000> as the ISA > : > option > : > ROM memory range, it should be something like [isa_mem_base+0xC0000 .. > : > isa_mem_base + 0x100000> or even [isa_rom_base .. isa_rom_base + > : > 0x40000>. > : > : That might certainly be a reasonable IVAR for isab(4) to provide to isa(4): a > : ROM base. However, orm(4) should be enabled for all ISA bridges assuming > : that is fixed. OTOH, the way many bus drivers I've seen handle this so far > : is to change the base address of SYS_RES_MEMORY objects as they pass through > : the relevant bridge so that the actual memory address is properly adjusted > : when it gets to the equivalent of the nexus. This is how many of the > : Foo->PCI bridges in arm that I've looked at work, and I think this is more > : inline with Warner's original patch which is to allow the various > : platform-specific ISA bridge drivers reject memory ranges they do not decode > : and provide any needed adjustments to ranges they do decode to transform them > : into suitable resources for their parent. Then orm(4) would just see it's > : attempts to do bus_alloc_resource() fail and end up DTRT. Given that, I do > : think this logic belongs in the ISA bridge drivers rather than in individual > : ISA drivers. We don't make ISA peripheral drivers add an 'isa_mem_base' or > : equivalent to their I/O resources, and in terms of I/O resources, orm(4) is > : just a special blackhole device (much like the ACPI or PnPBIOS system > : resource devices, or the ram0 or apic0 devices on x86). > > This is exactly what I've been trying to say: the memory addresses > that orm is using are ISA BUS addresses. These just happen to map 1:1 > on x86, but will map to something else on other platforms. But our > kernel API is that the driver requests the bus address, and that any > necessary translation happen in the bus_space layer. > > I disagree that it belongs entirely in the isa bridge drivers. They > may communicate information to the bus_space implementation, but it is > bus_space that ultimately does this translation. I think it actually depends on the platform as to where it belongs. If you have some Foo->ISA bridge that uses a window on the Foo bus to map ISA space, then I think it makes sense to handle that in the Foo->ISA bridge, especially if it is a relocatable window. If the ISA bus is instead assigned a fixed range in the system address space then that probably belongs in the bus_space support. -- John Baldwin From luigi at FreeBSD.org Thu Oct 15 14:18:35 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Thu Oct 15 14:18:47 2009 Subject: svn commit: r198132 - head/tools/tools/netrate/netsend Message-ID: <200910151418.n9FEIZdo075760@svn.freebsd.org> Author: luigi Date: Thu Oct 15 14:18:35 2009 New Revision: 198132 URL: http://svn.freebsd.org/changeset/base/198132 Log: A small change to avoid calling gettimeofday() too often (hardwired to once every 20us at most). I found out that on many machines round here, i could only get 300-400kpps with netsend even on loopback and a 'deny' rule in the firewall, while reducing the number of calls to gettimeofday() brings the value to 900kpps and more. This code is just a quick fix for the problem. Of course it could be done better, with proper getopt() parsing and the like, but since this applies to the entire program i'll postpone that to when i have more time. Reviewed by: rwatson MFC after: 1 month Modified: head/tools/tools/netrate/netsend/netsend.c Modified: head/tools/tools/netrate/netsend/netsend.c ============================================================================== --- head/tools/tools/netrate/netsend/netsend.c Thu Oct 15 13:34:45 2009 (r198131) +++ head/tools/tools/netrate/netsend/netsend.c Thu Oct 15 14:18:35 2009 (r198132) @@ -124,6 +124,9 @@ timing_loop(int s, struct timespec inter u_int32_t counter; long finishtime; long send_errors, send_calls; + /* do not call gettimeofday more than every 20us */ + long minres_ns = 20000; + int ic, gettimeofday_cycles; if (clock_getres(CLOCK_REALTIME, &tmptime) == -1) { perror("clock_getres"); @@ -132,8 +135,15 @@ timing_loop(int s, struct timespec inter if (timespec_ge(&tmptime, &interval)) fprintf(stderr, - "warning: interval less than resolution (%jd.%09ld)\n", + "warning: interval (%jd.%09ld) less than resolution (%jd.%09ld)\n", + (intmax_t)interval.tv_sec, interval.tv_nsec, (intmax_t)tmptime.tv_sec, tmptime.tv_nsec); + if (tmptime.tv_nsec < minres_ns) { + gettimeofday_cycles = minres_ns/(tmptime.tv_nsec + 1); + fprintf(stderr, + "calling time every %d cycles\n", gettimeofday_cycles); + } else + gettimeofday_cycles = 0; if (clock_gettime(CLOCK_REALTIME, &starttime) == -1) { perror("clock_gettime"); @@ -151,10 +161,14 @@ timing_loop(int s, struct timespec inter send_errors = send_calls = 0; counter = 0; waited = 0; + ic = gettimeofday_cycles; while (1) { timespec_add(&nexttime, &interval); - if (wait_time(nexttime, &tmptime, &waited) == -1) - return (-1); + if (--ic <= 0) { + ic = gettimeofday_cycles; + if (wait_time(nexttime, &tmptime, &waited) == -1) + return (-1); + } /* * We maintain and, if there's room, send a counter. Note * that even if the error is purely local, we still increment @@ -236,8 +250,9 @@ main(int argc, char *argv[]) /* * Specify an arbitrary limit. It's exactly that, not selected by - .* any particular strategy. '0' is a special value meaning "blast", + * any particular strategy. '0' is a special value meaning "blast", * and avoids the cost of a timing loop. + * XXX 0 is not actually implemented. */ rate = strtoul(argv[4], &dummy, 10); if (rate < 1 || *dummy != '\0') From jhb at FreeBSD.org Thu Oct 15 14:54:36 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Oct 15 14:54:43 2009 Subject: svn commit: r198134 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/i386/include sys/kern sys/sys Message-ID: <200910151454.n9FEsZCr076621@svn.freebsd.org> Author: jhb Date: Thu Oct 15 14:54:35 2009 New Revision: 198134 URL: http://svn.freebsd.org/changeset/base/198134 Log: Add a facility for associating optional descriptions with active interrupt handlers. This is primarily intended as a way to allow devices that use multiple interrupts (e.g. MSI) to meaningfully distinguish the various interrupt handlers. - Add a new BUS_DESCRIBE_INTR() method to the bus interface to associate a description with an active interrupt handler setup by BUS_SETUP_INTR. It has a default method (bus_generic_describe_intr()) which simply passes the request up to the parent device. - Add a bus_describe_intr() wrapper around BUS_DESCRIBE_INTR() that supports printf(9) style formatting using var args. - Reserve MAXCOMLEN bytes in the intr_handler structure to hold the name of an interrupt handler and copy the name passed to intr_event_add_handler() into that buffer instead of just saving the pointer to the name. - Add a new intr_event_describe_handler() which appends a description string to an interrupt handler's name. - Implement support for interrupt descriptions on amd64 and i386 by having the nexus(4) driver supply a custom bus_describe_intr method that invokes a new intr_describe() MD routine which in turn looks up the associated interrupt event and invokes intr_event_describe_handler(). Requested by: many Reviewed by: scottl MFC after: 2 weeks Added: head/share/man/man9/BUS_DESCRIBE_INTR.9 (contents, props changed) Modified: head/share/man/man9/Makefile head/sys/amd64/amd64/intr_machdep.c head/sys/amd64/amd64/nexus.c head/sys/amd64/include/intr_machdep.h head/sys/i386/i386/intr_machdep.c head/sys/i386/i386/nexus.c head/sys/i386/include/intr_machdep.h head/sys/kern/bus_if.m head/sys/kern/kern_intr.c head/sys/kern/subr_bus.c head/sys/sys/bus.h head/sys/sys/interrupt.h Added: head/share/man/man9/BUS_DESCRIBE_INTR.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/BUS_DESCRIBE_INTR.9 Thu Oct 15 14:54:35 2009 (r198134) @@ -0,0 +1,104 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 2009 Advanced Computing Technologies LLC +.\" Written by: John H. Baldwin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 14, 2009 +.Dt BUS_DESCRIBE_INTR 9 +.Os +.Sh NAME +.Nm BUS_DESCRIBE_INTR , +.Nm bus_describe_intr +.Nd "associate a description with an active interrupt handler" +.Sh SYNOPSIS +.In sys/param.h +.In sys/bus.h +.Ft int +.Fo BUS_BIND_INTR +.Fa "device_t dev" "device_t child" "struct resource *irq" "void *cookie" +.Fa "const char *descr" +.Fc +.Ft int +.Fo bus_describe_intr +.Fa "device_t dev" "struct resource *irq" "void *cookie" "const char *fmt" +.Fa ... +.Fc +.Sh DESCRIPTION +The +.Fn BUS_DESCRIBE_INTR +method associates a description with an active interrupt handler. +The +.Fa cookie +parameter must be the value returned by a successful call to +.Xr BUS_SETUP_INTR 9 +for the interrupt +.Fa irq . +.Pp +The +.Fn bus_describe_intr +function is a simple wrapper around +.Fn BUS_DESCRIBE_INTR . +As a convenience, +.Fn bus_describe_intr +allows the caller to use +.Xr printf 9 +style formatting to build the description string using +.Fa fmt . +.Pp +When an interrupt handler is established by +.Xr BUS_SETUP_INTR 9 , +the handler is named after the device the handler is established for. +This name is then used in various places such as interrupt statistics +displayed by +.Xr systat 1 +and +.Xr vmstat 8 . +For devices that use a single interrupt, +the device name is sufficiently unique to identify the interrupt handler. +However, for devices that use multiple interrupts it can be useful to +distinguish the interrupt handlers. +When a description is set for an active interrupt handler, +a colon followed by the description is appended to the device name to form +the interrupt handler name. +.Sh RETURN VALUES +Zero is returned on success, otherwise an appropriate error is returned. +.Sh SEE ALSO +.Xr BUS_SETUP_INTR 9 , +.Xr device 9 , +.Xr printf 9 , +.Xr systat 1 , +.Xr vmstat 8 +.Sh HISTORY +The +.Fn BUS_DESCRIBE_INTR +method and +.Fn bus_describe_intr +functions first appeared in +.Fx 9.0 . +.Sh BUGS +It is not currently possible to remove a description from an active interrupt +handler. Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Thu Oct 15 14:39:59 2009 (r198133) +++ head/share/man/man9/Makefile Thu Oct 15 14:54:35 2009 (r198134) @@ -26,6 +26,7 @@ MAN= accept_filter.9 \ BUS_BIND_INTR.9 \ bus_child_present.9 \ BUS_CONFIG_INTR.9 \ + BUS_DESCRIBE_INTR.9 \ bus_dma.9 \ bus_generic_attach.9 \ bus_generic_detach.9 \ @@ -405,6 +406,7 @@ MLINKS+=buf.9 bp.9 MLINKS+=bus_activate_resource.9 bus_deactivate_resource.9 MLINKS+=bus_alloc_resource.9 bus_alloc_resource_any.9 MLINKS+=BUS_BIND_INTR.9 bus_bind_intr.9 +MLINKS+=BUS_DESCRIBE_INTR.9 bus_describe_intr.9 MLINKS+=bus_dma.9 busdma.9 \ bus_dma.9 bus_dmamap_create.9 \ bus_dma.9 bus_dmamap_destroy.9 \ Modified: head/sys/amd64/amd64/intr_machdep.c ============================================================================== --- head/sys/amd64/amd64/intr_machdep.c Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/amd64/amd64/intr_machdep.c Thu Oct 15 14:54:35 2009 (r198134) @@ -466,6 +466,23 @@ intr_bind(u_int vector, u_char cpu) return (intr_event_bind(isrc->is_event, cpu)); } +/* Add a description to an active interrupt handler. */ +int +intr_describe(u_int vector, void *ih, const char *descr) +{ + struct intsrc *isrc; + int error; + + isrc = intr_lookup_source(vector); + if (isrc == NULL) + return (EINVAL); + error = intr_event_describe_handler(isrc->is_event, ih, descr); + if (error) + return (error); + intrcnt_updatename(isrc); + return (0); +} + /* * Add a CPU to our mask of valid CPUs that can be destinations of * interrupts. Modified: head/sys/amd64/amd64/nexus.c ============================================================================== --- head/sys/amd64/amd64/nexus.c Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/amd64/amd64/nexus.c Thu Oct 15 14:54:35 2009 (r198134) @@ -92,6 +92,9 @@ static int nexus_bind_intr(device_t, dev #endif static int nexus_config_intr(device_t, int, enum intr_trigger, enum intr_polarity); +static int nexus_describe_intr(device_t dev, device_t child, + struct resource *irq, void *cookie, + const char *descr); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); static int nexus_deactivate_resource(device_t, device_t, int, int, @@ -135,6 +138,7 @@ static device_method_t nexus_methods[] = DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_describe_intr, nexus_describe_intr), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), DEVMETHOD(bus_set_resource, nexus_set_resource), DEVMETHOD(bus_get_resource, nexus_get_resource), @@ -479,6 +483,14 @@ nexus_config_intr(device_t dev, int irq, return (intr_config_intr(irq, trig, pol)); } +static int +nexus_describe_intr(device_t dev, device_t child, struct resource *irq, + void *cookie, const char *descr) +{ + + return (intr_describe(rman_get_start(irq), cookie, descr)); +} + static struct resource_list * nexus_get_reslist(device_t dev, device_t child) { Modified: head/sys/amd64/include/intr_machdep.h ============================================================================== --- head/sys/amd64/include/intr_machdep.h Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/amd64/include/intr_machdep.h Thu Oct 15 14:54:35 2009 (r198134) @@ -151,6 +151,7 @@ int intr_bind(u_int vector, u_char cpu); #endif int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); +int intr_describe(u_int vector, void *ih, const char *descr); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); u_int intr_next_cpu(void); struct intsrc *intr_lookup_source(int vector); Modified: head/sys/i386/i386/intr_machdep.c ============================================================================== --- head/sys/i386/i386/intr_machdep.c Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/i386/i386/intr_machdep.c Thu Oct 15 14:54:35 2009 (r198134) @@ -432,6 +432,23 @@ intr_bind(u_int vector, u_char cpu) return (intr_event_bind(isrc->is_event, cpu)); } +/* Add a description to an active interrupt handler. */ +int +intr_describe(u_int vector, void *ih, const char *descr) +{ + struct intsrc *isrc; + int error; + + isrc = intr_lookup_source(vector); + if (isrc == NULL) + return (EINVAL); + error = intr_event_describe_handler(isrc->is_event, ih, descr); + if (error) + return (error); + intrcnt_updatename(isrc); + return (0); +} + /* * Add a CPU to our mask of valid CPUs that can be destinations of * interrupts. Modified: head/sys/i386/i386/nexus.c ============================================================================== --- head/sys/i386/i386/nexus.c Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/i386/i386/nexus.c Thu Oct 15 14:54:35 2009 (r198134) @@ -96,6 +96,9 @@ static int nexus_bind_intr(device_t, dev #endif static int nexus_config_intr(device_t, int, enum intr_trigger, enum intr_polarity); +static int nexus_describe_intr(device_t dev, device_t child, + struct resource *irq, void *cookie, + const char *descr); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); static int nexus_deactivate_resource(device_t, device_t, int, int, @@ -141,6 +144,7 @@ static device_method_t nexus_methods[] = DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_describe_intr, nexus_describe_intr), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), DEVMETHOD(bus_set_resource, nexus_set_resource), DEVMETHOD(bus_get_resource, nexus_get_resource), @@ -526,6 +530,14 @@ nexus_config_intr(device_t dev, int irq, return (intr_config_intr(irq, trig, pol)); } +static int +nexus_describe_intr(device_t dev, device_t child, struct resource *irq, + void *cookie, const char *descr) +{ + + return (intr_describe(rman_get_start(irq), cookie, descr)); +} + static struct resource_list * nexus_get_reslist(device_t dev, device_t child) { Modified: head/sys/i386/include/intr_machdep.h ============================================================================== --- head/sys/i386/include/intr_machdep.h Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/i386/include/intr_machdep.h Thu Oct 15 14:54:35 2009 (r198134) @@ -138,6 +138,7 @@ int intr_bind(u_int vector, u_char cpu); #endif int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); +int intr_describe(u_int vector, void *ih, const char *descr); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); u_int intr_next_cpu(void); struct intsrc *intr_lookup_source(int vector); Modified: head/sys/kern/bus_if.m ============================================================================== --- head/sys/kern/bus_if.m Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/kern/bus_if.m Thu Oct 15 14:54:35 2009 (r198134) @@ -509,7 +509,6 @@ METHOD int bind_intr { int _cpu; } DEFAULT bus_generic_bind_intr; - /** * @brief Allow (bus) drivers to specify the trigger mode and polarity * of the specified interrupt. @@ -527,6 +526,25 @@ METHOD int config_intr { } DEFAULT bus_generic_config_intr; /** + * @brief Allow drivers to associate a description with an active + * interrupt handler. + * + * @param _dev the parent device of @p _child + * @param _child the device which allocated the resource + * @param _irq the resource representing the interrupt + * @param _cookie the cookie value returned when the interrupt + * was originally registered + * @param _descr the description to associate with the interrupt + */ +METHOD int describe_intr { + device_t _dev; + device_t _child; + struct resource *_irq; + void *_cookie; + const char *_descr; +} DEFAULT bus_generic_describe_intr; + +/** * @brief Notify a (bus) driver about a child that the hints mechanism * believes it has discovered. * Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/kern/kern_intr.c Thu Oct 15 14:54:35 2009 (r198134) @@ -524,7 +524,7 @@ intr_event_add_handler(struct intr_event ih->ih_filter = filter; ih->ih_handler = handler; ih->ih_argument = arg; - ih->ih_name = name; + strlcpy(ih->ih_name, name, sizeof(ih->ih_name)); ih->ih_event = ie; ih->ih_pri = pri; if (flags & INTR_EXCL) @@ -597,7 +597,7 @@ intr_event_add_handler(struct intr_event ih->ih_filter = filter; ih->ih_handler = handler; ih->ih_argument = arg; - ih->ih_name = name; + strlcpy(ih->ih_name, name, sizeof(ih->ih_name)); ih->ih_event = ie; ih->ih_pri = pri; if (flags & INTR_EXCL) @@ -665,6 +665,61 @@ intr_event_add_handler(struct intr_event #endif /* + * Append a description preceded by a ':' to the name of the specified + * interrupt handler. + */ +int +intr_event_describe_handler(struct intr_event *ie, void *cookie, + const char *descr) +{ + struct intr_handler *ih; + size_t space; + char *start; + + mtx_lock(&ie->ie_lock); +#ifdef INVARIANTS + TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) { + if (ih == cookie) + break; + } + if (ih == NULL) { + mtx_unlock(&ie->ie_lock); + panic("handler %p not find in interrupt event %p", cookie, ie); + } +#endif + ih = cookie; + + /* + * Look for an existing description by checking for an + * existing ":". This assumes device names do not include + * colons. If one is found, prepare to insert the new + * description at that point. If one is not found, find the + * end of the name to use as the insertion point. + */ + start = index(ih->ih_name, ':'); + if (start == NULL) + start = index(ih->ih_name, 0); + + /* + * See if there is enough remaining room in the string for the + * description + ":". The "- 1" leaves room for the trailing + * '\0'. The "+ 1" accounts for the colon. + */ + space = sizeof(ih->ih_name) - (start - ih->ih_name) - 1; + if (strlen(descr) + 1 > space) { + mtx_unlock(&ie->ie_lock); + return (ENOSPC); + } + + /* Append a colon followed by the description. */ + *start = ':'; + strcpy(start + 1, descr); + intr_event_update(ie); + mtx_unlock(&ie->ie_lock); + return (0); +} + +/* * Return the ie_source field from the intr_event an intr_handler is * associated with. */ Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/kern/subr_bus.c Thu Oct 15 14:54:35 2009 (r198134) @@ -3520,6 +3520,24 @@ bus_generic_config_intr(device_t dev, in } /** + * @brief Helper function for implementing BUS_DESCRIBE_INTR(). + * + * This simple implementation of BUS_DESCRIBE_INTR() simply calls the + * BUS_DESCRIBE_INTR() method of the parent of @p dev. + */ +int +bus_generic_describe_intr(device_t dev, device_t child, struct resource *irq, + void *cookie, const char *descr) +{ + + /* Propagate up the bus hierarchy until someone handles it. */ + if (dev->parent) + return (BUS_DESCRIBE_INTR(dev->parent, child, irq, cookie, + descr)); + return (EINVAL); +} + +/** * @brief Helper function for implementing BUS_GET_DMA_TAG(). * * This simple implementation of BUS_GET_DMA_TAG() simply calls the @@ -3824,6 +3842,28 @@ bus_bind_intr(device_t dev, struct resou } /** + * @brief Wrapper function for BUS_DESCRIBE_INTR(). + * + * This function first formats the requested description into a + * temporary buffer and then calls the BUS_DESCRIBE_INTR() method of + * the parent of @p dev. + */ +int +bus_describe_intr(device_t dev, struct resource *irq, void *cookie, + const char *fmt, ...) +{ + char descr[MAXCOMLEN]; + va_list ap; + + if (dev->parent == NULL) + return (EINVAL); + va_start(ap, fmt); + vsnprintf(descr, sizeof(descr), fmt, ap); + va_end(ap); + return (BUS_DESCRIBE_INTR(dev->parent, dev, irq, cookie, descr)); +} + +/** * @brief Wrapper function for BUS_SET_RESOURCE(). * * This function simply calls the BUS_SET_RESOURCE() method of the Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/sys/bus.h Thu Oct 15 14:54:35 2009 (r198134) @@ -292,6 +292,9 @@ int bus_generic_bind_intr(device_t dev, int bus_generic_child_present(device_t dev, device_t child); int bus_generic_config_intr(device_t, int, enum intr_trigger, enum intr_polarity); +int bus_generic_describe_intr(device_t dev, device_t child, + struct resource *irq, void *cookie, + const char *descr); int bus_generic_deactivate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int bus_generic_detach(device_t dev); @@ -363,6 +366,8 @@ int bus_setup_intr(device_t dev, struct void *arg, void **cookiep); int bus_teardown_intr(device_t dev, struct resource *r, void *cookie); int bus_bind_intr(device_t dev, struct resource *r, int cpu); +int bus_describe_intr(device_t dev, struct resource *irq, void *cookie, + const char *fmt, ...); int bus_set_resource(device_t dev, int type, int rid, u_long start, u_long count); int bus_get_resource(device_t dev, int type, int rid, Modified: head/sys/sys/interrupt.h ============================================================================== --- head/sys/sys/interrupt.h Thu Oct 15 14:39:59 2009 (r198133) +++ head/sys/sys/interrupt.h Thu Oct 15 14:54:35 2009 (r198134) @@ -47,7 +47,7 @@ struct intr_handler { driver_intr_t *ih_handler; /* Threaded handler function. */ void *ih_argument; /* Argument to pass to handlers. */ int ih_flags; - const char *ih_name; /* Name of handler. */ + char ih_name[MAXCOMLEN]; /* Name of handler. */ struct intr_event *ih_event; /* Event we are connected to. */ int ih_need; /* Needs service. */ TAILQ_ENTRY(intr_handler) ih_next; /* Next handler for this event. */ @@ -172,6 +172,8 @@ int intr_event_destroy(struct intr_event void intr_event_execute_handlers(struct proc *p, struct intr_event *ie); int intr_event_handle(struct intr_event *ie, struct trapframe *frame); int intr_event_remove_handler(void *cookie); +int intr_event_describe_handler(struct intr_event *ie, void *cookie, + const char *descr); int intr_getaffinity(int irq, void *mask); void *intr_handler_source(void *cookie); int intr_setaffinity(int irq, void *mask); From jhb at FreeBSD.org Thu Oct 15 14:55:12 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Oct 15 14:55:18 2009 Subject: svn commit: r198135 - head/sys/sys Message-ID: <200910151455.n9FEtBbD076697@svn.freebsd.org> Author: jhb Date: Thu Oct 15 14:55:11 2009 New Revision: 198135 URL: http://svn.freebsd.org/changeset/base/198135 Log: Style fixes to the function prototypes for bus_alloc_resources() and bus_release_resources(). Modified: head/sys/sys/bus.h Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Oct 15 14:54:35 2009 (r198134) +++ head/sys/sys/bus.h Thu Oct 15 14:55:11 2009 (r198135) @@ -347,8 +347,10 @@ struct resource_spec { int flags; }; -int bus_alloc_resources(device_t dev, struct resource_spec *rs, struct resource **res); -void bus_release_resources(device_t dev, const struct resource_spec *rs, struct resource **res); +int bus_alloc_resources(device_t dev, struct resource_spec *rs, + struct resource **res); +void bus_release_resources(device_t dev, const struct resource_spec *rs, + struct resource **res); struct resource *bus_alloc_resource(device_t dev, int type, int *rid, u_long start, u_long end, u_long count, From imp at bsdimp.com Thu Oct 15 15:01:20 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Thu Oct 15 15:01:25 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <200910150833.54252.jhb@freebsd.org> References: <200910141738.43910.jhb@freebsd.org> <20091014.161115.-1796258170.imp@bsdimp.com> <200910150833.54252.jhb@freebsd.org> Message-ID: <20091015.085910.-520412456.imp@bsdimp.com> In message: <200910150833.54252.jhb@freebsd.org> John Baldwin writes: : On Wednesday 14 October 2009 6:11:15 pm M. Warner Losh wrote: : > In message: <200910141738.43910.jhb@freebsd.org> : > John Baldwin writes: : > : On Wednesday 14 October 2009 5:20:38 pm Marcel Moolenaar wrote: : > : > : > : > On Oct 14, 2009, at 1:45 PM, John Baldwin wrote: : > : > : > : > > On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: : > : > >> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: : > : > >>> : > : > >>> I can't be more clear than this. You keep ignoring me, and it is : > : > >>> very : > : > >>> frustrating. : > : > >> : > : > >> I'm not ignoring you. I'm still talking. You simply haven't convinced : > : > >> me. While it's possible (likely?) that I don't understand the issues, : > : > >> all you've achieved so far is that I'm more convinced that limiting : > : > >> orm(4) to i386 and amd64 is the right thing, because the alternative : > : > >> is not at all appealing. : > : > >> : > : > >>> The problem is that the : > : > >>> powerpc and itanium isa modules allow memory ranges that shouldn't : > : > >>> be : > : > >>> allowed. That's the platform specific code that needs to be fixed. : > : > >> : > : > >> isa_set_resource() is MI code and it happily adds whatever resources : > : > >> a driver wants. The only chance MD code has is to fail the : > : > >> allocation, : > : > >> but since the whole ISA code bypasses the newbus hierarchy, there's : > : > >> no way we know in the isa MD code what is valid and what isn't unless : > : > >> we add kluges to platform code. : > : > >> : > : > >> If you want to fix it for real, does that mean fix it for real or : > : > >> does that mean add kluges to platform code? : > : > >> : > : > >> Shouldn't we have ISA bridges obtain the set of valid resources : > : > >> from their parent in the newbus hierarchy? : > : > > : > : > > Hmm, can we even know that? PCI-ISA bridges in x86 at least don't : > : > > have any : > : > > I/O limit registers like PCI-PCI bridges, instead they are : > : > > subtractively : > : > > decoded, i.e. they "eat" any memory request that no one else claims. : > : > : > : > The key here being requests that reach the PCI-ISA bridge. It's entirely : > : > platform specific which I/O memory addresses generated by the CPU gets : > : > decoded and forwarded in such a way that it's visible to the PCI-ISA : > : > bridge. This is what needs to be obtained from the parent in the newbus : > : > hierarchy. Rather than hardcoding [0xC0000 .. 0x100000> as the ISA : > : > option : > : > ROM memory range, it should be something like [isa_mem_base+0xC0000 .. : > : > isa_mem_base + 0x100000> or even [isa_rom_base .. isa_rom_base + : > : > 0x40000>. : > : : > : That might certainly be a reasonable IVAR for isab(4) to provide to isa(4): a : > : ROM base. However, orm(4) should be enabled for all ISA bridges assuming : > : that is fixed. OTOH, the way many bus drivers I've seen handle this so far : > : is to change the base address of SYS_RES_MEMORY objects as they pass through : > : the relevant bridge so that the actual memory address is properly adjusted : > : when it gets to the equivalent of the nexus. This is how many of the : > : Foo->PCI bridges in arm that I've looked at work, and I think this is more : > : inline with Warner's original patch which is to allow the various : > : platform-specific ISA bridge drivers reject memory ranges they do not decode : > : and provide any needed adjustments to ranges they do decode to transform them : > : into suitable resources for their parent. Then orm(4) would just see it's : > : attempts to do bus_alloc_resource() fail and end up DTRT. Given that, I do : > : think this logic belongs in the ISA bridge drivers rather than in individual : > : ISA drivers. We don't make ISA peripheral drivers add an 'isa_mem_base' or : > : equivalent to their I/O resources, and in terms of I/O resources, orm(4) is : > : just a special blackhole device (much like the ACPI or PnPBIOS system : > : resource devices, or the ram0 or apic0 devices on x86). : > : > This is exactly what I've been trying to say: the memory addresses : > that orm is using are ISA BUS addresses. These just happen to map 1:1 : > on x86, but will map to something else on other platforms. But our : > kernel API is that the driver requests the bus address, and that any : > necessary translation happen in the bus_space layer. : > : > I disagree that it belongs entirely in the isa bridge drivers. They : > may communicate information to the bus_space implementation, but it is : > bus_space that ultimately does this translation. : : I think it actually depends on the platform as to where it belongs. If you : have some Foo->ISA bridge that uses a window on the Foo bus to map ISA space, : then I think it makes sense to handle that in the Foo->ISA bridge, especially : if it is a relocatable window. If the ISA bus is instead assigned a fixed : range in the system address space then that probably belongs in the bus_space : support. I'd think it would be the opposite. bus_space needs to know how to map the request, since it is the last one involved. If this is mappable or movable, then it needs to know that too. However, adjusting the resources that you give to a child on the way through the bridge is just assisting bus_space doing the right thing if the bus_space on that architecture just implements one or two global spaces. Warner From jhb at freebsd.org Thu Oct 15 15:18:58 2009 From: jhb at freebsd.org (John Baldwin) Date: Thu Oct 15 15:19:04 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091015.085910.-520412456.imp@bsdimp.com> References: <200910141738.43910.jhb@freebsd.org> <200910150833.54252.jhb@freebsd.org> <20091015.085910.-520412456.imp@bsdimp.com> Message-ID: <200910151118.50619.jhb@freebsd.org> On Thursday 15 October 2009 10:59:10 am M. Warner Losh wrote: > In message: <200910150833.54252.jhb@freebsd.org> > John Baldwin writes: > : On Wednesday 14 October 2009 6:11:15 pm M. Warner Losh wrote: > : > In message: <200910141738.43910.jhb@freebsd.org> > : > John Baldwin writes: > : > : On Wednesday 14 October 2009 5:20:38 pm Marcel Moolenaar wrote: > : > : > > : > : > On Oct 14, 2009, at 1:45 PM, John Baldwin wrote: > : > : > > : > : > > On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: > : > : > >> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: > : > : > >>> > : > : > >>> I can't be more clear than this. You keep ignoring me, and it is > : > : > >>> very > : > : > >>> frustrating. > : > : > >> > : > : > >> I'm not ignoring you. I'm still talking. You simply haven't convinced > : > : > >> me. While it's possible (likely?) that I don't understand the issues, > : > : > >> all you've achieved so far is that I'm more convinced that limiting > : > : > >> orm(4) to i386 and amd64 is the right thing, because the alternative > : > : > >> is not at all appealing. > : > : > >> > : > : > >>> The problem is that the > : > : > >>> powerpc and itanium isa modules allow memory ranges that shouldn't > : > : > >>> be > : > : > >>> allowed. That's the platform specific code that needs to be fixed. > : > : > >> > : > : > >> isa_set_resource() is MI code and it happily adds whatever resources > : > : > >> a driver wants. The only chance MD code has is to fail the > : > : > >> allocation, > : > : > >> but since the whole ISA code bypasses the newbus hierarchy, there's > : > : > >> no way we know in the isa MD code what is valid and what isn't unless > : > : > >> we add kluges to platform code. > : > : > >> > : > : > >> If you want to fix it for real, does that mean fix it for real or > : > : > >> does that mean add kluges to platform code? > : > : > >> > : > : > >> Shouldn't we have ISA bridges obtain the set of valid resources > : > : > >> from their parent in the newbus hierarchy? > : > : > > > : > : > > Hmm, can we even know that? PCI-ISA bridges in x86 at least don't > : > : > > have any > : > : > > I/O limit registers like PCI-PCI bridges, instead they are > : > : > > subtractively > : > : > > decoded, i.e. they "eat" any memory request that no one else claims. > : > : > > : > : > The key here being requests that reach the PCI-ISA bridge. It's entirely > : > : > platform specific which I/O memory addresses generated by the CPU gets > : > : > decoded and forwarded in such a way that it's visible to the PCI-ISA > : > : > bridge. This is what needs to be obtained from the parent in the newbus > : > : > hierarchy. Rather than hardcoding [0xC0000 .. 0x100000> as the ISA > : > : > option > : > : > ROM memory range, it should be something like [isa_mem_base+0xC0000 .. > : > : > isa_mem_base + 0x100000> or even [isa_rom_base .. isa_rom_base + > : > : > 0x40000>. > : > : > : > : That might certainly be a reasonable IVAR for isab(4) to provide to isa(4): a > : > : ROM base. However, orm(4) should be enabled for all ISA bridges assuming > : > : that is fixed. OTOH, the way many bus drivers I've seen handle this so far > : > : is to change the base address of SYS_RES_MEMORY objects as they pass through > : > : the relevant bridge so that the actual memory address is properly adjusted > : > : when it gets to the equivalent of the nexus. This is how many of the > : > : Foo->PCI bridges in arm that I've looked at work, and I think this is more > : > : inline with Warner's original patch which is to allow the various > : > : platform-specific ISA bridge drivers reject memory ranges they do not decode > : > : and provide any needed adjustments to ranges they do decode to transform them > : > : into suitable resources for their parent. Then orm(4) would just see it's > : > : attempts to do bus_alloc_resource() fail and end up DTRT. Given that, I do > : > : think this logic belongs in the ISA bridge drivers rather than in individual > : > : ISA drivers. We don't make ISA peripheral drivers add an 'isa_mem_base' or > : > : equivalent to their I/O resources, and in terms of I/O resources, orm(4) is > : > : just a special blackhole device (much like the ACPI or PnPBIOS system > : > : resource devices, or the ram0 or apic0 devices on x86). > : > > : > This is exactly what I've been trying to say: the memory addresses > : > that orm is using are ISA BUS addresses. These just happen to map 1:1 > : > on x86, but will map to something else on other platforms. But our > : > kernel API is that the driver requests the bus address, and that any > : > necessary translation happen in the bus_space layer. > : > > : > I disagree that it belongs entirely in the isa bridge drivers. They > : > may communicate information to the bus_space implementation, but it is > : > bus_space that ultimately does this translation. > : > : I think it actually depends on the platform as to where it belongs. If you > : have some Foo->ISA bridge that uses a window on the Foo bus to map ISA space, > : then I think it makes sense to handle that in the Foo->ISA bridge, especially > : if it is a relocatable window. If the ISA bus is instead assigned a fixed > : range in the system address space then that probably belongs in the bus_space > : support. > > I'd think it would be the opposite. bus_space needs to know how to > map the request, since it is the last one involved. If this is > mappable or movable, then it needs to know that too. It depends I think. If the Foo bus just maps a Foo memory resource and then sub-allocates that to satisfy ISA ranges then from bus_space's perspective it is just working with Foo resources. It would never know about ISA nor would it need to know. > However, adjusting the resources that you give to a child on the way > through the bridge is just assisting bus_space doing the right thing > if the bus_space on that architecture just implements one or two > global spaces. I think we are mostly agreeing actually. My main statement is that how ISA memory resources are actually mapped, etc. is platform-dependent but that different platforms may implement that support using different means. -- John Baldwin From luigi at FreeBSD.org Thu Oct 15 15:30:41 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Thu Oct 15 15:30:48 2009 Subject: svn commit: r198136 - head/tools/tools/netrate/netsend Message-ID: <200910151530.n9FFUfxI077369@svn.freebsd.org> Author: luigi Date: Thu Oct 15 15:30:41 2009 New Revision: 198136 URL: http://svn.freebsd.org/changeset/base/198136 Log: Support the specification of a range of destination ports e.g. netsend 127.0.0.1 6666-7777 [payloadsize] [packet_rate] [duration] This is useful to test the behaviour of systems that do some kind of flow classifications and so exhibit different behaviour depending on the number of flows that hit them. I plan to add a similar extension to sweep on a range of IP addresses, so we can issue a single command to flood (obviously, for testing purposes!) a number of different destinations. When there is only one destination, we do a preliminary connect() of the socket so we can use send() instead of sendto(). When we have multiple ports, the socket is not connect()'ed and we do a sendto() instead. There is a performance hit in this case, as the throughput on the loopback interface (with a firewall rule that blocks the transmission) goes down from 900kpps to 490kpps on my test machine. If the number of different destinations is limited, one option to explore is to have multiple connect()ed sockets. MFC after: 1 month Modified: head/tools/tools/netrate/netsend/netsend.c Modified: head/tools/tools/netrate/netsend/netsend.c ============================================================================== --- head/tools/tools/netrate/netsend/netsend.c Thu Oct 15 14:55:11 2009 (r198135) +++ head/tools/tools/netrate/netsend/netsend.c Thu Oct 15 15:30:41 2009 (r198136) @@ -39,12 +39,23 @@ #include #include +/* program arguments */ +struct _a { + int s; + struct timespec interval; + int port, port_max; + long duration; + struct sockaddr_in sin; + int packet_len; + void *packet; +}; + static void usage(void) { fprintf(stderr, - "netsend [ip] [port] [payloadsize] [rate] [duration]\n"); + "netsend [ip] [port[-port_max]] [payloadsize] [packet_rate] [duration]\n"); exit(-1); } @@ -114,10 +125,12 @@ wait_time(struct timespec ts, struct tim * Calculate a second-aligned starting time for the packet stream. Busy * wait between our calculated interval and dropping the provided packet * into the socket. If we hit our duration limit, bail. + * We sweep the ports from a->port to a->port_max included. + * If the two ports are the same we connect() the socket upfront, which + * almost halves the cost of the sendto() call. */ static int -timing_loop(int s, struct timespec interval, long duration, u_char *packet, - u_int packet_len) +timing_loop(struct _a *a) { struct timespec nexttime, starttime, tmptime; long long waited; @@ -127,18 +140,19 @@ timing_loop(int s, struct timespec inter /* do not call gettimeofday more than every 20us */ long minres_ns = 20000; int ic, gettimeofday_cycles; + int cur_port; if (clock_getres(CLOCK_REALTIME, &tmptime) == -1) { perror("clock_getres"); return (-1); } - if (timespec_ge(&tmptime, &interval)) + if (timespec_ge(&tmptime, &a->interval)) fprintf(stderr, "warning: interval (%jd.%09ld) less than resolution (%jd.%09ld)\n", - (intmax_t)interval.tv_sec, interval.tv_nsec, + (intmax_t)a->interval.tv_sec, a->interval.tv_nsec, (intmax_t)tmptime.tv_sec, tmptime.tv_nsec); - if (tmptime.tv_nsec < minres_ns) { + if (a->interval.tv_nsec < minres_ns) { gettimeofday_cycles = minres_ns/(tmptime.tv_nsec + 1); fprintf(stderr, "calling time every %d cycles\n", gettimeofday_cycles); @@ -156,14 +170,23 @@ timing_loop(int s, struct timespec inter if (wait_time(starttime, NULL, NULL) == -1) return (-1); nexttime = starttime; - finishtime = starttime.tv_sec + duration; + finishtime = starttime.tv_sec + a->duration; send_errors = send_calls = 0; counter = 0; waited = 0; ic = gettimeofday_cycles; + cur_port = a->port; + if (a->port == a->port_max) { + if (connect(a->s, (struct sockaddr *)&a->sin, sizeof(a->sin))) { + perror("connect"); + return (-1); + } + } while (1) { - timespec_add(&nexttime, &interval); + int ret; + + timespec_add(&nexttime, &a->interval); if (--ic <= 0) { ic = gettimeofday_cycles; if (wait_time(nexttime, &tmptime, &waited) == -1) @@ -178,17 +201,28 @@ timing_loop(int s, struct timespec inter * previous send, the error will turn up the current send * operation, causing the current sequence number also to be * skipped. + * The counter is incremented only on the initial port number, + * so all destinations will see the same set of packets. * * XXXRW: Note alignment assumption. */ - if (packet_len >= 4) { - *((u_int32_t *)packet) = htonl(counter); + if (cur_port == a->port && a->packet_len >= 4) { + *((u_int32_t *)a->packet) = htonl(counter); counter++; } - if (send(s, packet, packet_len, 0) < 0) + if (a->port == a->port_max) { /* socket already bound */ + ret = send(a->s, a->packet, a->packet_len, 0); + } else { + a->sin.sin_port = htons(cur_port++); + if (cur_port > a->port_max) + cur_port = a->port; + ret = sendto(a->s, a->packet, a->packet_len, 0, + (struct sockaddr *)&a->sin, sizeof(a->sin)); + } + if (ret < 0) send_errors++; send_calls++; - if (duration != 0 && tmptime.tv_sec >= finishtime) + if (a->duration != 0 && tmptime.tv_sec >= finishtime) goto done; } @@ -205,11 +239,11 @@ done: tmptime.tv_nsec); printf("send calls: %ld\n", send_calls); printf("send errors: %ld\n", send_errors); - printf("approx send rate: %ld\n", (send_calls - send_errors) / - duration); + printf("approx send rate: %ld pps\n", (send_calls - send_errors) / + a->duration); printf("approx error rate: %ld\n", (send_errors / send_calls)); printf("waited: %lld\n", waited); - printf("approx waits/sec: %lld\n", (long long)(waited / duration)); + printf("approx waits/sec: %lld\n", (long long)(waited / a->duration)); printf("approx wait rate: %lld\n", (long long)(waited / send_calls)); return (0); @@ -218,27 +252,35 @@ done: int main(int argc, char *argv[]) { - long rate, payloadsize, port, duration; - struct timespec interval; - struct sockaddr_in sin; - char *dummy, *packet; - int s; + long rate, payloadsize, port; + char *dummy; + struct _a a; /* arguments */ + + bzero(&a, sizeof(a)); if (argc != 6) usage(); - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - if (inet_aton(argv[1], &sin.sin_addr) == 0) { + a.sin.sin_len = sizeof(a.sin); + a.sin.sin_family = AF_INET; + if (inet_aton(argv[1], &a.sin.sin_addr) == 0) { perror(argv[1]); return (-1); } port = strtoul(argv[2], &dummy, 10); - if (port < 1 || port > 65535 || *dummy != '\0') + if (port < 1 || port > 65535) usage(); - sin.sin_port = htons(port); + if (*dummy != '\0' && *dummy != '-') + usage(); + a.sin.sin_port = htons(port); + a.port = a.port_max = port; + if (*dummy == '-') { /* set high port */ + port = strtoul(dummy + 1, &dummy, 10); + if (port < a.port || port > 65535) + usage(); + a.port_max = port; + } payloadsize = strtoul(argv[3], &dummy, 10); if (payloadsize < 0 || *dummy != '\0') @@ -247,56 +289,51 @@ main(int argc, char *argv[]) fprintf(stderr, "payloadsize > 32768\n"); return (-1); } + a.packet_len = payloadsize; /* * Specify an arbitrary limit. It's exactly that, not selected by * any particular strategy. '0' is a special value meaning "blast", * and avoids the cost of a timing loop. - * XXX 0 is not actually implemented. */ rate = strtoul(argv[4], &dummy, 10); - if (rate < 1 || *dummy != '\0') + if (rate < 0 || *dummy != '\0') usage(); if (rate > MAX_RATE) { - fprintf(stderr, "rate > %d\n", MAX_RATE); + fprintf(stderr, "packet rate at most %d\n", MAX_RATE); return (-1); } - duration = strtoul(argv[5], &dummy, 10); - if (duration < 0 || *dummy != '\0') + a.duration = strtoul(argv[5], &dummy, 10); + if (a.duration < 0 || *dummy != '\0') usage(); - packet = malloc(payloadsize); - if (packet == NULL) { + a.packet = malloc(payloadsize); + if (a.packet == NULL) { perror("malloc"); return (-1); } - bzero(packet, payloadsize); - + bzero(a.packet, payloadsize); if (rate == 0) { - interval.tv_sec = 0; - interval.tv_nsec = 0; + a.interval.tv_sec = 0; + a.interval.tv_nsec = 0; } else if (rate == 1) { - interval.tv_sec = 1; - interval.tv_nsec = 0; + a.interval.tv_sec = 1; + a.interval.tv_nsec = 0; } else { - interval.tv_sec = 0; - interval.tv_nsec = ((1 * 1000000000) / rate); + a.interval.tv_sec = 0; + a.interval.tv_nsec = ((1 * 1000000000) / rate); } + printf("Sending packet of payload size %ld every %jd.%09lds for %ld " - "seconds\n", payloadsize, (intmax_t)interval.tv_sec, - interval.tv_nsec, duration); + "seconds\n", payloadsize, (intmax_t)a.interval.tv_sec, + a.interval.tv_nsec, a.duration); - s = socket(PF_INET, SOCK_DGRAM, 0); - if (s == -1) { + a.s = socket(PF_INET, SOCK_DGRAM, 0); + if (a.s == -1) { perror("socket"); return (-1); } - if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - perror("connect"); - return (-1); - } - - return (timing_loop(s, interval, duration, packet, payloadsize)); + return (timing_loop(&a)); } From rwatson at FreeBSD.org Thu Oct 15 15:50:51 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Thu Oct 15 15:51:02 2009 Subject: svn commit: r198136 - head/tools/tools/netrate/netsend In-Reply-To: <200910151530.n9FFUfxI077369@svn.freebsd.org> References: <200910151530.n9FFUfxI077369@svn.freebsd.org> Message-ID: On Thu, 15 Oct 2009, Luigi Rizzo wrote: > Support the specification of a range of destination ports e.g. > > netsend 127.0.0.1 6666-7777 [payloadsize] [packet_rate] [duration] All sounds very useful -- consider making some of these changes (where appropriate) to netblast as well? Also, I can't remember if netsend / netblast know about calling bind() before commencing, but if not they should be taught. That should (a) eliminate significant overhead and (b) use weaker locking so that greater concurrency can be exploited by multiple instances. The connect(2) case should force binding, but in absence of connect(2), a per-packet "source address selection" decision needs to be made. Robert > > This is useful to test the behaviour of systems that do some kind > of flow classifications and so exhibit different behaviour depending > on the number of flows that hit them. > I plan to add a similar extension to sweep on a range of IP addresses, > so we can issue a single command to flood (obviously, for testing > purposes!) a number of different destinations. > > When there is only one destination, we do a preliminary connect() > of the socket so we can use send() instead of sendto(). > When we have multiple ports, the socket is not connect()'ed and we > do a sendto() instead. There is a performance hit in this case, > as the throughput on the loopback interface (with a firewall rule > that blocks the transmission) goes down from 900kpps to 490kpps on > my test machine. > > If the number of different destinations is limited, one option to > explore is to have multiple connect()ed sockets. > > MFC after: 1 month > > Modified: > head/tools/tools/netrate/netsend/netsend.c > > Modified: head/tools/tools/netrate/netsend/netsend.c > ============================================================================== > --- head/tools/tools/netrate/netsend/netsend.c Thu Oct 15 14:55:11 2009 (r198135) > +++ head/tools/tools/netrate/netsend/netsend.c Thu Oct 15 15:30:41 2009 (r198136) > @@ -39,12 +39,23 @@ > #include > #include > > +/* program arguments */ > +struct _a { > + int s; > + struct timespec interval; > + int port, port_max; > + long duration; > + struct sockaddr_in sin; > + int packet_len; > + void *packet; > +}; > + > static void > usage(void) > { > > fprintf(stderr, > - "netsend [ip] [port] [payloadsize] [rate] [duration]\n"); > + "netsend [ip] [port[-port_max]] [payloadsize] [packet_rate] [duration]\n"); > exit(-1); > } > > @@ -114,10 +125,12 @@ wait_time(struct timespec ts, struct tim > * Calculate a second-aligned starting time for the packet stream. Busy > * wait between our calculated interval and dropping the provided packet > * into the socket. If we hit our duration limit, bail. > + * We sweep the ports from a->port to a->port_max included. > + * If the two ports are the same we connect() the socket upfront, which > + * almost halves the cost of the sendto() call. > */ > static int > -timing_loop(int s, struct timespec interval, long duration, u_char *packet, > - u_int packet_len) > +timing_loop(struct _a *a) > { > struct timespec nexttime, starttime, tmptime; > long long waited; > @@ -127,18 +140,19 @@ timing_loop(int s, struct timespec inter > /* do not call gettimeofday more than every 20us */ > long minres_ns = 20000; > int ic, gettimeofday_cycles; > + int cur_port; > > if (clock_getres(CLOCK_REALTIME, &tmptime) == -1) { > perror("clock_getres"); > return (-1); > } > > - if (timespec_ge(&tmptime, &interval)) > + if (timespec_ge(&tmptime, &a->interval)) > fprintf(stderr, > "warning: interval (%jd.%09ld) less than resolution (%jd.%09ld)\n", > - (intmax_t)interval.tv_sec, interval.tv_nsec, > + (intmax_t)a->interval.tv_sec, a->interval.tv_nsec, > (intmax_t)tmptime.tv_sec, tmptime.tv_nsec); > - if (tmptime.tv_nsec < minres_ns) { > + if (a->interval.tv_nsec < minres_ns) { > gettimeofday_cycles = minres_ns/(tmptime.tv_nsec + 1); > fprintf(stderr, > "calling time every %d cycles\n", gettimeofday_cycles); > @@ -156,14 +170,23 @@ timing_loop(int s, struct timespec inter > if (wait_time(starttime, NULL, NULL) == -1) > return (-1); > nexttime = starttime; > - finishtime = starttime.tv_sec + duration; > + finishtime = starttime.tv_sec + a->duration; > > send_errors = send_calls = 0; > counter = 0; > waited = 0; > ic = gettimeofday_cycles; > + cur_port = a->port; > + if (a->port == a->port_max) { > + if (connect(a->s, (struct sockaddr *)&a->sin, sizeof(a->sin))) { > + perror("connect"); > + return (-1); > + } > + } > while (1) { > - timespec_add(&nexttime, &interval); > + int ret; > + > + timespec_add(&nexttime, &a->interval); > if (--ic <= 0) { > ic = gettimeofday_cycles; > if (wait_time(nexttime, &tmptime, &waited) == -1) > @@ -178,17 +201,28 @@ timing_loop(int s, struct timespec inter > * previous send, the error will turn up the current send > * operation, causing the current sequence number also to be > * skipped. > + * The counter is incremented only on the initial port number, > + * so all destinations will see the same set of packets. > * > * XXXRW: Note alignment assumption. > */ > - if (packet_len >= 4) { > - *((u_int32_t *)packet) = htonl(counter); > + if (cur_port == a->port && a->packet_len >= 4) { > + *((u_int32_t *)a->packet) = htonl(counter); > counter++; > } > - if (send(s, packet, packet_len, 0) < 0) > + if (a->port == a->port_max) { /* socket already bound */ > + ret = send(a->s, a->packet, a->packet_len, 0); > + } else { > + a->sin.sin_port = htons(cur_port++); > + if (cur_port > a->port_max) > + cur_port = a->port; > + ret = sendto(a->s, a->packet, a->packet_len, 0, > + (struct sockaddr *)&a->sin, sizeof(a->sin)); > + } > + if (ret < 0) > send_errors++; > send_calls++; > - if (duration != 0 && tmptime.tv_sec >= finishtime) > + if (a->duration != 0 && tmptime.tv_sec >= finishtime) > goto done; > } > > @@ -205,11 +239,11 @@ done: > tmptime.tv_nsec); > printf("send calls: %ld\n", send_calls); > printf("send errors: %ld\n", send_errors); > - printf("approx send rate: %ld\n", (send_calls - send_errors) / > - duration); > + printf("approx send rate: %ld pps\n", (send_calls - send_errors) / > + a->duration); > printf("approx error rate: %ld\n", (send_errors / send_calls)); > printf("waited: %lld\n", waited); > - printf("approx waits/sec: %lld\n", (long long)(waited / duration)); > + printf("approx waits/sec: %lld\n", (long long)(waited / a->duration)); > printf("approx wait rate: %lld\n", (long long)(waited / send_calls)); > > return (0); > @@ -218,27 +252,35 @@ done: > int > main(int argc, char *argv[]) > { > - long rate, payloadsize, port, duration; > - struct timespec interval; > - struct sockaddr_in sin; > - char *dummy, *packet; > - int s; > + long rate, payloadsize, port; > + char *dummy; > + struct _a a; /* arguments */ > + > + bzero(&a, sizeof(a)); > > if (argc != 6) > usage(); > > - bzero(&sin, sizeof(sin)); > - sin.sin_len = sizeof(sin); > - sin.sin_family = AF_INET; > - if (inet_aton(argv[1], &sin.sin_addr) == 0) { > + a.sin.sin_len = sizeof(a.sin); > + a.sin.sin_family = AF_INET; > + if (inet_aton(argv[1], &a.sin.sin_addr) == 0) { > perror(argv[1]); > return (-1); > } > > port = strtoul(argv[2], &dummy, 10); > - if (port < 1 || port > 65535 || *dummy != '\0') > + if (port < 1 || port > 65535) > usage(); > - sin.sin_port = htons(port); > + if (*dummy != '\0' && *dummy != '-') > + usage(); > + a.sin.sin_port = htons(port); > + a.port = a.port_max = port; > + if (*dummy == '-') { /* set high port */ > + port = strtoul(dummy + 1, &dummy, 10); > + if (port < a.port || port > 65535) > + usage(); > + a.port_max = port; > + } > > payloadsize = strtoul(argv[3], &dummy, 10); > if (payloadsize < 0 || *dummy != '\0') > @@ -247,56 +289,51 @@ main(int argc, char *argv[]) > fprintf(stderr, "payloadsize > 32768\n"); > return (-1); > } > + a.packet_len = payloadsize; > > /* > * Specify an arbitrary limit. It's exactly that, not selected by > * any particular strategy. '0' is a special value meaning "blast", > * and avoids the cost of a timing loop. > - * XXX 0 is not actually implemented. > */ > rate = strtoul(argv[4], &dummy, 10); > - if (rate < 1 || *dummy != '\0') > + if (rate < 0 || *dummy != '\0') > usage(); > if (rate > MAX_RATE) { > - fprintf(stderr, "rate > %d\n", MAX_RATE); > + fprintf(stderr, "packet rate at most %d\n", MAX_RATE); > return (-1); > } > > - duration = strtoul(argv[5], &dummy, 10); > - if (duration < 0 || *dummy != '\0') > + a.duration = strtoul(argv[5], &dummy, 10); > + if (a.duration < 0 || *dummy != '\0') > usage(); > > - packet = malloc(payloadsize); > - if (packet == NULL) { > + a.packet = malloc(payloadsize); > + if (a.packet == NULL) { > perror("malloc"); > return (-1); > } > - bzero(packet, payloadsize); > - > + bzero(a.packet, payloadsize); > if (rate == 0) { > - interval.tv_sec = 0; > - interval.tv_nsec = 0; > + a.interval.tv_sec = 0; > + a.interval.tv_nsec = 0; > } else if (rate == 1) { > - interval.tv_sec = 1; > - interval.tv_nsec = 0; > + a.interval.tv_sec = 1; > + a.interval.tv_nsec = 0; > } else { > - interval.tv_sec = 0; > - interval.tv_nsec = ((1 * 1000000000) / rate); > + a.interval.tv_sec = 0; > + a.interval.tv_nsec = ((1 * 1000000000) / rate); > } > + > printf("Sending packet of payload size %ld every %jd.%09lds for %ld " > - "seconds\n", payloadsize, (intmax_t)interval.tv_sec, > - interval.tv_nsec, duration); > + "seconds\n", payloadsize, (intmax_t)a.interval.tv_sec, > + a.interval.tv_nsec, a.duration); > > - s = socket(PF_INET, SOCK_DGRAM, 0); > - if (s == -1) { > + a.s = socket(PF_INET, SOCK_DGRAM, 0); > + if (a.s == -1) { > perror("socket"); > return (-1); > } > > - if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { > - perror("connect"); > - return (-1); > - } > - > - return (timing_loop(s, interval, duration, packet, payloadsize)); > + return (timing_loop(&a)); > } > From ru at FreeBSD.org Thu Oct 15 18:17:29 2009 From: ru at FreeBSD.org (Ruslan Ermilov) Date: Thu Oct 15 18:17:36 2009 Subject: svn commit: r198148 - in head/bin: cat uuidgen Message-ID: <200910151817.n9FIHT7r081105@svn.freebsd.org> Author: ru Date: Thu Oct 15 18:17:29 2009 New Revision: 198148 URL: http://svn.freebsd.org/changeset/base/198148 Log: Removed redundant WARNS setting. Submitted by: Ulrich Sp?rlein Modified: head/bin/cat/Makefile head/bin/uuidgen/Makefile Modified: head/bin/cat/Makefile ============================================================================== --- head/bin/cat/Makefile Thu Oct 15 17:40:45 2009 (r198147) +++ head/bin/cat/Makefile Thu Oct 15 18:17:29 2009 (r198148) @@ -2,6 +2,5 @@ # $FreeBSD$ PROG= cat -WARNS?= 6 .include Modified: head/bin/uuidgen/Makefile ============================================================================== --- head/bin/uuidgen/Makefile Thu Oct 15 17:40:45 2009 (r198147) +++ head/bin/uuidgen/Makefile Thu Oct 15 18:17:29 2009 (r198148) @@ -1,6 +1,5 @@ # $FreeBSD$ PROG= uuidgen -WARNS?= 6 .include From jkim at FreeBSD.org Thu Oct 15 18:32:09 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Oct 15 18:32:16 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <200910151118.50619.jhb@freebsd.org> References: <200910141738.43910.jhb@freebsd.org> <20091015.085910.-520412456.imp@bsdimp.com> <200910151118.50619.jhb@freebsd.org> Message-ID: <200910151431.53236.jkim@FreeBSD.org> On Thursday 15 October 2009 11:18 am, John Baldwin wrote: > On Thursday 15 October 2009 10:59:10 am M. Warner Losh wrote: > > In message: <200910150833.54252.jhb@freebsd.org> > > > > John Baldwin writes: > > : On Wednesday 14 October 2009 6:11:15 pm M. Warner Losh wrote: > > : > In message: <200910141738.43910.jhb@freebsd.org> > > : > > > : > John Baldwin writes: > > : > : On Wednesday 14 October 2009 5:20:38 pm Marcel Moolenaar wrote: > > : > : > On Oct 14, 2009, at 1:45 PM, John Baldwin wrote: > > : > : > > On Wednesday 14 October 2009 2:35:16 pm Marcel Moolenaar wrote: > > : > : > >> On Oct 14, 2009, at 10:39 AM, Warner Losh wrote: > > : > : > >>> I can't be more clear than this. You keep ignoring > > : > : > >>> me, and it > > is > > > : > : > >>> very > > : > : > >>> frustrating. > > : > : > >> > > : > : > >> I'm not ignoring you. I'm still talking. You simply > > : > : > >> haven't > > convinced > > > : > : > >> me. While it's possible (likely?) that I don't > > : > : > >> understand the > > issues, > > > : > : > >> all you've achieved so far is that I'm more convinced > > : > : > >> that > > limiting > > > : > : > >> orm(4) to i386 and amd64 is the right thing, because > > : > : > >> the > > alternative > > > : > : > >> is not at all appealing. > > : > : > >> > > : > : > >>> The problem is that the > > : > : > >>> powerpc and itanium isa modules allow memory ranges > > : > : > >>> that > > shouldn't > > > : > : > >>> be > > : > : > >>> allowed. That's the platform specific code that > > : > : > >>> needs to be > > fixed. > > > : > : > >> isa_set_resource() is MI code and it happily adds > > : > : > >> whatever > > resources > > > : > : > >> a driver wants. The only chance MD code has is to fail > > : > : > >> the allocation, > > : > : > >> but since the whole ISA code bypasses the newbus > > : > : > >> hierarchy, > > there's > > > : > : > >> no way we know in the isa MD code what is valid and > > : > : > >> what isn't > > unless > > > : > : > >> we add kluges to platform code. > > : > : > >> > > : > : > >> If you want to fix it for real, does that mean fix it > > : > : > >> for real or does that mean add kluges to platform > > : > : > >> code? > > : > : > >> > > : > : > >> Shouldn't we have ISA bridges obtain the set of valid > > : > : > >> resources from their parent in the newbus hierarchy? > > : > : > > > > : > : > > Hmm, can we even know that? PCI-ISA bridges in x86 at > > : > : > > least don't have any > > : > : > > I/O limit registers like PCI-PCI bridges, instead they > > : > : > > are subtractively > > : > : > > decoded, i.e. they "eat" any memory request that no one > > : > : > > else > > claims. > > > : > : > The key here being requests that reach the PCI-ISA > > : > : > bridge. It's > > entirely > > > : > : > platform specific which I/O memory addresses generated by > > : > : > the CPU > > gets > > > : > : > decoded and forwarded in such a way that it's visible to > > : > : > the PCI-ISA bridge. This is what needs to be obtained > > : > : > from the parent in the > > newbus > > > : > : > hierarchy. Rather than hardcoding [0xC0000 .. 0x100000> > > : > : > as the ISA option > > : > : > ROM memory range, it should be something like > > [isa_mem_base+0xC0000 .. > > > : > : > isa_mem_base + 0x100000> or even [isa_rom_base .. > > : > : > isa_rom_base + 0x40000>. > > : > : > > : > : That might certainly be a reasonable IVAR for isab(4) to > > : > : provide to > > isa(4): a > > > : > : ROM base. However, orm(4) should be enabled for all ISA > > : > : bridges > > assuming > > > : > : that is fixed. OTOH, the way many bus drivers I've seen > > : > : handle this > > so far > > > : > : is to change the base address of SYS_RES_MEMORY objects as > > : > : they pass > > through > > > : > : the relevant bridge so that the actual memory address is > > : > : properly > > adjusted > > > : > : when it gets to the equivalent of the nexus. This is how > > : > : many of the Foo->PCI bridges in arm that I've looked at > > : > : work, and I think this is > > more > > > : > : inline with Warner's original patch which is to allow the > > : > : various platform-specific ISA bridge drivers reject memory > > : > : ranges they do not > > decode > > > : > : and provide any needed adjustments to ranges they do decode > > : > : to > > transform them > > > : > : into suitable resources for their parent. Then orm(4) > > : > : would just see > > it's > > > : > : attempts to do bus_alloc_resource() fail and end up DTRT. > > : > : Given that, > > I do > > > : > : think this logic belongs in the ISA bridge drivers rather > > : > : than in > > individual > > > : > : ISA drivers. We don't make ISA peripheral drivers add > > an 'isa_mem_base' or > > > : > : equivalent to their I/O resources, and in terms of I/O > > : > : resources, > > orm(4) is > > > : > : just a special blackhole device (much like the ACPI or > > : > : PnPBIOS system resource devices, or the ram0 or apic0 > > : > : devices on x86). > > : > > > : > This is exactly what I've been trying to say: the memory > > : > addresses that orm is using are ISA BUS addresses. These > > : > just happen to map 1:1 on x86, but will map to something else > > : > on other platforms. But our kernel API is that the driver > > : > requests the bus address, and that any necessary translation > > : > happen in the bus_space layer. > > : > > > : > I disagree that it belongs entirely in the isa bridge > > : > drivers. They may communicate information to the bus_space > > : > implementation, but it is bus_space that ultimately does this > > : > translation. > > : > > : I think it actually depends on the platform as to where it > > : belongs. If > > you > > > : have some Foo->ISA bridge that uses a window on the Foo bus to > > : map ISA > > space, > > > : then I think it makes sense to handle that in the Foo->ISA > > : bridge, > > especially > > > : if it is a relocatable window. If the ISA bus is instead > > : assigned a fixed range in the system address space then that > > : probably belongs in the > > bus_space > > > : support. > > > > I'd think it would be the opposite. bus_space needs to know how > > to map the request, since it is the last one involved. If this > > is mappable or movable, then it needs to know that too. > > It depends I think. If the Foo bus just maps a Foo memory resource > and then sub-allocates that to satisfy ISA ranges then from > bus_space's perspective it is just working with Foo resources. It > would never know about ISA nor would it need to know. > > > However, adjusting the resources that you give to a child on the > > way through the bridge is just assisting bus_space doing the > > right thing if the bus_space on that architecture just implements > > one or two global spaces. > > I think we are mostly agreeing actually. My main statement is that > how ISA memory resources are actually mapped, etc. is > platform-dependent but that different platforms may implement that > support using different means. This is actually very interesting discussion for me because one of my pet projects is extending x86bios to support non-PC architectures. If anyone is interested, the current source tarball is here: http://people.freebsd.org/~jkim/x86bios-20091015.tar.bz2 Especially, please see the code around #ifdef X86BIOS_COMPAT_ARCH. Basically, mapping I/O ports and orm(4) is missing. We don't have to implement I/O ports but orm(4) vs. bus_space(9) is critical to make it a reality. Please consider it as a real practical example for orm, not just a blackhole driver. :-) Jung-uk Kim From jhb at FreeBSD.org Thu Oct 15 18:51:20 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Oct 15 18:51:31 2009 Subject: svn commit: r198149 - head/sys/kern Message-ID: <200910151851.n9FIpJBD081808@svn.freebsd.org> Author: jhb Date: Thu Oct 15 18:51:19 2009 New Revision: 198149 URL: http://svn.freebsd.org/changeset/base/198149 Log: Use language more closely resembling English in a panic message. Pointy hat to: jhb Submitted by: pluknet Modified: head/sys/kern/kern_intr.c Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Thu Oct 15 18:17:29 2009 (r198148) +++ head/sys/kern/kern_intr.c Thu Oct 15 18:51:19 2009 (r198149) @@ -684,7 +684,7 @@ intr_event_describe_handler(struct intr_ } if (ih == NULL) { mtx_unlock(&ie->ie_lock); - panic("handler %p not find in interrupt event %p", cookie, ie); + panic("handler %p not found in interrupt event %p", cookie, ie); } #endif ih = cookie; From thompsa at FreeBSD.org Thu Oct 15 20:07:09 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Thu Oct 15 20:07:22 2009 Subject: svn commit: r198151 - in head/sys/dev: pci usb/controller Message-ID: <200910152007.n9FK78cG083259@svn.freebsd.org> Author: thompsa Date: Thu Oct 15 20:07:08 2009 New Revision: 198151 URL: http://svn.freebsd.org/changeset/base/198151 Log: Workaround buggy BIOS code in USB regard. By doing the BIOS to OS handover for all host controllers at the same time, we avoid problems where the BIOS will actually write to the USB registers of all the USB host controllers every time we handover one of them, and consequently reset the OS programmed values. Submitted by: avg Reviewed by: jhb Added: head/sys/dev/usb/controller/ehcireg.h (contents, props changed) head/sys/dev/usb/controller/ohcireg.h (contents, props changed) head/sys/dev/usb/controller/uhcireg.h (contents, props changed) Modified: head/sys/dev/pci/pci.c head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ehci.h head/sys/dev/usb/controller/ehci_ixp4xx.c head/sys/dev/usb/controller/ehci_mbus.c head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/ohci.h head/sys/dev/usb/controller/ohci_atmelarm.c head/sys/dev/usb/controller/ohci_pci.c head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uhci.h head/sys/dev/usb/controller/uhci_pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/pci/pci.c Thu Oct 15 20:07:08 2009 (r198151) @@ -62,6 +62,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include "pcib_if.h" #include "pci_if.h" @@ -270,6 +274,13 @@ TUNABLE_INT("hw.pci.honor_msi_blacklist" SYSCTL_INT(_hw_pci, OID_AUTO, honor_msi_blacklist, CTLFLAG_RD, &pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI"); +static int pci_usb_takeover = 1; +TUNABLE_INT("hw.pci.usb_early_takeover", &pci_usb_takeover); +SYSCTL_INT(_hw_pci, OID_AUTO, usb_early_takeover, CTLFLAG_RD | CTLFLAG_TUN, + &pci_usb_takeover, 1, "Enable early takeover of USB controllers.\n\ +Disable this if you depend on BIOS emulation of USB devices, that is\n\ +you use USB devices (like keyboard or mouse) but do not load USB drivers"); + /* Find a device_t by bus/slot/function in domain 0 */ device_t @@ -2569,6 +2580,106 @@ pci_assign_interrupt(device_t bus, devic resource_list_add(&dinfo->resources, SYS_RES_IRQ, 0, irq, irq, 1); } +/* Perform early OHCI takeover from SMM. */ +static void +ohci_early_takeover(device_t self) +{ + struct resource *res; + uint32_t ctl; + int rid; + int i; + + rid = PCIR_BAR(0); + res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (res == NULL) + return; + + ctl = bus_read_4(res, OHCI_CONTROL); + if (ctl & OHCI_IR) { + if (bootverbose) + printf("ohci early: " + "SMM active, request owner change\n"); + bus_write_4(res, OHCI_COMMAND_STATUS, OHCI_OCR); + for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) { + DELAY(1000); + ctl = bus_read_4(res, OHCI_CONTROL); + } + if (ctl & OHCI_IR) { + if (bootverbose) + printf("ohci early: " + "SMM does not respond, resetting\n"); + bus_write_4(res, OHCI_CONTROL, OHCI_HCFS_RESET); + } + } + + bus_release_resource(self, SYS_RES_MEMORY, rid, res); +} + +/* Perform early UHCI takeover from SMM. */ +static void +uhci_early_takeover(device_t self) +{ + /* + * Set the PIRQD enable bit and switch off all the others. We don't + * want legacy support to interfere with us XXX Does this also mean + * that the BIOS won't touch the keyboard anymore if it is connected + * to the ports of the root hub? + */ + pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2); +} + +/* Perform early EHCI takeover from SMM. */ +static void +ehci_early_takeover(device_t self) +{ + struct resource *res; + uint32_t cparams; + uint32_t eec; + uint8_t eecp; + uint8_t bios_sem; + int rid; + int i; + + rid = PCIR_BAR(0); + res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (res == NULL) + return; + + cparams = bus_read_4(res, EHCI_HCCPARAMS); + + /* Synchronise with the BIOS if it owns the controller. */ + for (eecp = EHCI_HCC_EECP(cparams); eecp != 0; + eecp = EHCI_EECP_NEXT(eec)) { + eec = pci_read_config(self, eecp, 4); + if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP) { + continue; + } + bios_sem = pci_read_config(self, eecp + + EHCI_LEGSUP_BIOS_SEM, 1); + if (bios_sem == 0) { + continue; + } + if (bootverbose) + printf("ehci early: " + "SMM active, request owner change\n"); + + pci_write_config(self, eecp + EHCI_LEGSUP_OS_SEM, 1, 1); + + for (i = 0; (i < 100) && (bios_sem != 0); i++) { + DELAY(1000); + bios_sem = pci_read_config(self, eecp + + EHCI_LEGSUP_BIOS_SEM, 1); + } + + if (bios_sem != 0) { + if (bootverbose) + printf("ehci early: " + "SMM does not respond\n"); + } + } + bus_release_resource(self, SYS_RES_MEMORY, rid, res); +} + void pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask) { @@ -2612,6 +2723,16 @@ pci_add_resources(device_t bus, device_t pci_assign_interrupt(bus, dev, 0); #endif } + + if (pci_usb_takeover && pci_get_class(dev) == PCIC_SERIALBUS && + pci_get_subclass(dev) == PCIS_SERIALBUS_USB) { + if (pci_get_progif(dev) == PCIP_SERIALBUS_USB_EHCI) + ehci_early_takeover(dev); + else if (pci_get_progif(dev) == PCIP_SERIALBUS_USB_OHCI) + ohci_early_takeover(dev); + else if (pci_get_progif(dev) == PCIP_SERIALBUS_USB_UHCI) + uhci_early_takeover(dev); + } } void Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/ehci.c Thu Oct 15 20:07:08 2009 (r198151) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define EHCI_BUS2SC(bus) \ ((ehci_softc_t *)(((uint8_t *)(bus)) - \ Modified: head/sys/dev/usb/controller/ehci.h ============================================================================== --- head/sys/dev/usb/controller/ehci.h Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/ehci.h Thu Oct 15 20:07:08 2009 (r198151) @@ -40,139 +40,6 @@ #define EHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) -/* PCI config registers */ -#define PCI_CBMEM 0x10 /* configuration base MEM */ -#define PCI_INTERFACE_EHCI 0x20 -#define PCI_USBREV 0x60 /* RO USB protocol revision */ -#define PCI_USB_REV_MASK 0xff -#define PCI_USB_REV_PRE_1_0 0x00 -#define PCI_USB_REV_1_0 0x10 -#define PCI_USB_REV_1_1 0x11 -#define PCI_USB_REV_2_0 0x20 -#define PCI_EHCI_FLADJ 0x61 /* RW Frame len adj, SOF=59488+6*fladj */ -#define PCI_EHCI_PORTWAKECAP 0x62 /* RW Port wake caps (opt) */ - -/* EHCI Extended Capabilities */ -#define EHCI_EC_LEGSUP 0x01 -#define EHCI_EECP_NEXT(x) (((x) >> 8) & 0xff) -#define EHCI_EECP_ID(x) ((x) & 0xff) - -/* Legacy support extended capability */ -#define EHCI_LEGSUP_BIOS_SEM 0x02 -#define EHCI_LEGSUP_OS_SEM 0x03 -#define EHCI_LEGSUP_USBLEGCTLSTS 0x04 - -/* EHCI capability registers */ -#define EHCI_CAPLENGTH 0x00 /* RO Capability register length field */ -/* reserved 0x01 */ -#define EHCI_HCIVERSION 0x02 /* RO Interface version number */ -#define EHCI_HCSPARAMS 0x04 /* RO Structural parameters */ -#define EHCI_HCS_DEBUGPORT(x) (((x) >> 20) & 0xf) -#define EHCI_HCS_P_INDICATOR(x) ((x) & 0x10000) -#define EHCI_HCS_N_CC(x) (((x) >> 12) & 0xf) /* # of companion ctlrs */ -#define EHCI_HCS_N_PCC(x) (((x) >> 8) & 0xf) /* # of ports per comp. */ -#define EHCI_HCS_PPC(x) ((x) & 0x10) /* port power control */ -#define EHCI_HCS_N_PORTS(x) ((x) & 0xf) /* # of ports */ -#define EHCI_HCCPARAMS 0x08 /* RO Capability parameters */ -#define EHCI_HCC_EECP(x) (((x) >> 8) & 0xff) /* extended ports caps */ -#define EHCI_HCC_IST(x) (((x) >> 4) & 0xf) /* isoc sched threshold */ -#define EHCI_HCC_ASPC(x) ((x) & 0x4) /* async sched park cap */ -#define EHCI_HCC_PFLF(x) ((x) & 0x2) /* prog frame list flag */ -#define EHCI_HCC_64BIT(x) ((x) & 0x1) /* 64 bit address cap */ -#define EHCI_HCSP_PORTROUTE 0x0c /* RO Companion port route description */ - -/* EHCI operational registers. Offset given by EHCI_CAPLENGTH register */ -#define EHCI_USBCMD 0x00 /* RO, RW, WO Command register */ -#define EHCI_CMD_ITC_M 0x00ff0000 /* RW interrupt threshold ctrl */ -#define EHCI_CMD_ITC_1 0x00010000 -#define EHCI_CMD_ITC_2 0x00020000 -#define EHCI_CMD_ITC_4 0x00040000 -#define EHCI_CMD_ITC_8 0x00080000 -#define EHCI_CMD_ITC_16 0x00100000 -#define EHCI_CMD_ITC_32 0x00200000 -#define EHCI_CMD_ITC_64 0x00400000 -#define EHCI_CMD_ASPME 0x00000800 /* RW/RO async park enable */ -#define EHCI_CMD_ASPMC 0x00000300 /* RW/RO async park count */ -#define EHCI_CMD_LHCR 0x00000080 /* RW light host ctrl reset */ -#define EHCI_CMD_IAAD 0x00000040 /* RW intr on async adv door - * bell */ -#define EHCI_CMD_ASE 0x00000020 /* RW async sched enable */ -#define EHCI_CMD_PSE 0x00000010 /* RW periodic sched enable */ -#define EHCI_CMD_FLS_M 0x0000000c /* RW/RO frame list size */ -#define EHCI_CMD_FLS(x) (((x) >> 2) & 3) /* RW/RO frame list size */ -#define EHCI_CMD_HCRESET 0x00000002 /* RW reset */ -#define EHCI_CMD_RS 0x00000001 /* RW run/stop */ -#define EHCI_USBSTS 0x04 /* RO, RW, RWC Status register */ -#define EHCI_STS_ASS 0x00008000 /* RO async sched status */ -#define EHCI_STS_PSS 0x00004000 /* RO periodic sched status */ -#define EHCI_STS_REC 0x00002000 /* RO reclamation */ -#define EHCI_STS_HCH 0x00001000 /* RO host controller halted */ -#define EHCI_STS_IAA 0x00000020 /* RWC interrupt on async adv */ -#define EHCI_STS_HSE 0x00000010 /* RWC host system error */ -#define EHCI_STS_FLR 0x00000008 /* RWC frame list rollover */ -#define EHCI_STS_PCD 0x00000004 /* RWC port change detect */ -#define EHCI_STS_ERRINT 0x00000002 /* RWC error interrupt */ -#define EHCI_STS_INT 0x00000001 /* RWC interrupt */ -#define EHCI_STS_INTRS(x) ((x) & 0x3f) - -/* - * NOTE: the doorbell interrupt is enabled, but the doorbell is never - * used! SiS chipsets require this. - */ -#define EHCI_NORMAL_INTRS (EHCI_STS_IAA | EHCI_STS_HSE | \ - EHCI_STS_PCD | EHCI_STS_ERRINT | EHCI_STS_INT) - -#define EHCI_USBINTR 0x08 /* RW Interrupt register */ -#define EHCI_INTR_IAAE 0x00000020 /* interrupt on async advance - * ena */ -#define EHCI_INTR_HSEE 0x00000010 /* host system error ena */ -#define EHCI_INTR_FLRE 0x00000008 /* frame list rollover ena */ -#define EHCI_INTR_PCIE 0x00000004 /* port change ena */ -#define EHCI_INTR_UEIE 0x00000002 /* USB error intr ena */ -#define EHCI_INTR_UIE 0x00000001 /* USB intr ena */ - -#define EHCI_FRINDEX 0x0c /* RW Frame Index register */ - -#define EHCI_CTRLDSSEGMENT 0x10 /* RW Control Data Structure Segment */ - -#define EHCI_PERIODICLISTBASE 0x14 /* RW Periodic List Base */ -#define EHCI_ASYNCLISTADDR 0x18 /* RW Async List Base */ - -#define EHCI_CONFIGFLAG 0x40 /* RW Configure Flag register */ -#define EHCI_CONF_CF 0x00000001 /* RW configure flag */ - -#define EHCI_PORTSC(n) (0x40+(4*(n))) /* RO, RW, RWC Port Status reg */ -#define EHCI_PS_WKOC_E 0x00400000 /* RW wake on over current ena */ -#define EHCI_PS_WKDSCNNT_E 0x00200000 /* RW wake on disconnect ena */ -#define EHCI_PS_WKCNNT_E 0x00100000 /* RW wake on connect ena */ -#define EHCI_PS_PTC 0x000f0000 /* RW port test control */ -#define EHCI_PS_PIC 0x0000c000 /* RW port indicator control */ -#define EHCI_PS_PO 0x00002000 /* RW port owner */ -#define EHCI_PS_PP 0x00001000 /* RW,RO port power */ -#define EHCI_PS_LS 0x00000c00 /* RO line status */ -#define EHCI_PS_IS_LOWSPEED(x) (((x) & EHCI_PS_LS) == 0x00000400) -#define EHCI_PS_PR 0x00000100 /* RW port reset */ -#define EHCI_PS_SUSP 0x00000080 /* RW suspend */ -#define EHCI_PS_FPR 0x00000040 /* RW force port resume */ -#define EHCI_PS_OCC 0x00000020 /* RWC over current change */ -#define EHCI_PS_OCA 0x00000010 /* RO over current active */ -#define EHCI_PS_PEC 0x00000008 /* RWC port enable change */ -#define EHCI_PS_PE 0x00000004 /* RW port enable */ -#define EHCI_PS_CSC 0x00000002 /* RWC connect status change */ -#define EHCI_PS_CS 0x00000001 /* RO connect status */ -#define EHCI_PS_CLEAR (EHCI_PS_OCC | EHCI_PS_PEC | EHCI_PS_CSC) - -#define EHCI_USBMODE 0x68 /* RW USB Device mode register */ -#define EHCI_UM_CM 0x00000003 /* R/WO Controller Mode */ -#define EHCI_UM_CM_IDLE 0x0 /* Idle */ -#define EHCI_UM_CM_HOST 0x3 /* Host Controller */ -#define EHCI_UM_ES 0x00000004 /* R/WO Endian Select */ -#define EHCI_UM_ES_LE 0x0 /* Little-endian byte alignment */ -#define EHCI_UM_ES_BE 0x4 /* Big-endian byte alignment */ -#define EHCI_UM_SDIS 0x00000010 /* R/WO Stream Disable Mode */ - -#define EHCI_PORT_RESET_COMPLETE 2 /* ms */ - /* * Alignment NOTE: structures must be aligned so that the hardware can index * without performing addition. Modified: head/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_ixp4xx.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/ehci_ixp4xx.c Thu Oct 15 20:07:08 2009 (r198151) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/dev/usb/controller/ehci_mbus.c ============================================================================== --- head/sys/dev/usb/controller/ehci_mbus.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/ehci_mbus.c Thu Oct 15 20:07:08 2009 (r198151) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/ehci_pci.c Thu Oct 15 20:07:08 2009 (r198151) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define PCI_EHCI_VENDORID_ACERLABS 0x10b9 #define PCI_EHCI_VENDORID_AMD 0x1022 Added: head/sys/dev/usb/controller/ehcireg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/controller/ehcireg.h Thu Oct 15 20:07:08 2009 (r198151) @@ -0,0 +1,174 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _EHCIREG_H_ +#define _EHCIREG_H_ + +/* PCI config registers */ +#define PCI_CBMEM 0x10 /* configuration base MEM */ +#define PCI_INTERFACE_EHCI 0x20 +#define PCI_USBREV 0x60 /* RO USB protocol revision */ +#define PCI_USB_REV_MASK 0xff +#define PCI_USB_REV_PRE_1_0 0x00 +#define PCI_USB_REV_1_0 0x10 +#define PCI_USB_REV_1_1 0x11 +#define PCI_USB_REV_2_0 0x20 +#define PCI_EHCI_FLADJ 0x61 /* RW Frame len adj, SOF=59488+6*fladj */ +#define PCI_EHCI_PORTWAKECAP 0x62 /* RW Port wake caps (opt) */ + +/* EHCI Extended Capabilities */ +#define EHCI_EC_LEGSUP 0x01 +#define EHCI_EECP_NEXT(x) (((x) >> 8) & 0xff) +#define EHCI_EECP_ID(x) ((x) & 0xff) + +/* Legacy support extended capability */ +#define EHCI_LEGSUP_BIOS_SEM 0x02 +#define EHCI_LEGSUP_OS_SEM 0x03 +#define EHCI_LEGSUP_USBLEGCTLSTS 0x04 + +/* EHCI capability registers */ +#define EHCI_CAPLENGTH 0x00 /* RO Capability register length field */ +/* reserved 0x01 */ +#define EHCI_HCIVERSION 0x02 /* RO Interface version number */ +#define EHCI_HCSPARAMS 0x04 /* RO Structural parameters */ +#define EHCI_HCS_DEBUGPORT(x) (((x) >> 20) & 0xf) +#define EHCI_HCS_P_INDICATOR(x) ((x) & 0x10000) +#define EHCI_HCS_N_CC(x) (((x) >> 12) & 0xf) /* # of companion ctlrs */ +#define EHCI_HCS_N_PCC(x) (((x) >> 8) & 0xf) /* # of ports per comp. */ +#define EHCI_HCS_PPC(x) ((x) & 0x10) /* port power control */ +#define EHCI_HCS_N_PORTS(x) ((x) & 0xf) /* # of ports */ +#define EHCI_HCCPARAMS 0x08 /* RO Capability parameters */ +#define EHCI_HCC_EECP(x) (((x) >> 8) & 0xff) /* extended ports caps */ +#define EHCI_HCC_IST(x) (((x) >> 4) & 0xf) /* isoc sched threshold */ +#define EHCI_HCC_ASPC(x) ((x) & 0x4) /* async sched park cap */ +#define EHCI_HCC_PFLF(x) ((x) & 0x2) /* prog frame list flag */ +#define EHCI_HCC_64BIT(x) ((x) & 0x1) /* 64 bit address cap */ +#define EHCI_HCSP_PORTROUTE 0x0c /* RO Companion port route description */ + +/* EHCI operational registers. Offset given by EHCI_CAPLENGTH register */ +#define EHCI_USBCMD 0x00 /* RO, RW, WO Command register */ +#define EHCI_CMD_ITC_M 0x00ff0000 /* RW interrupt threshold ctrl */ +#define EHCI_CMD_ITC_1 0x00010000 +#define EHCI_CMD_ITC_2 0x00020000 +#define EHCI_CMD_ITC_4 0x00040000 +#define EHCI_CMD_ITC_8 0x00080000 +#define EHCI_CMD_ITC_16 0x00100000 +#define EHCI_CMD_ITC_32 0x00200000 +#define EHCI_CMD_ITC_64 0x00400000 +#define EHCI_CMD_ASPME 0x00000800 /* RW/RO async park enable */ +#define EHCI_CMD_ASPMC 0x00000300 /* RW/RO async park count */ +#define EHCI_CMD_LHCR 0x00000080 /* RW light host ctrl reset */ +#define EHCI_CMD_IAAD 0x00000040 /* RW intr on async adv door + * bell */ +#define EHCI_CMD_ASE 0x00000020 /* RW async sched enable */ +#define EHCI_CMD_PSE 0x00000010 /* RW periodic sched enable */ +#define EHCI_CMD_FLS_M 0x0000000c /* RW/RO frame list size */ +#define EHCI_CMD_FLS(x) (((x) >> 2) & 3) /* RW/RO frame list size */ +#define EHCI_CMD_HCRESET 0x00000002 /* RW reset */ +#define EHCI_CMD_RS 0x00000001 /* RW run/stop */ +#define EHCI_USBSTS 0x04 /* RO, RW, RWC Status register */ +#define EHCI_STS_ASS 0x00008000 /* RO async sched status */ +#define EHCI_STS_PSS 0x00004000 /* RO periodic sched status */ +#define EHCI_STS_REC 0x00002000 /* RO reclamation */ +#define EHCI_STS_HCH 0x00001000 /* RO host controller halted */ +#define EHCI_STS_IAA 0x00000020 /* RWC interrupt on async adv */ +#define EHCI_STS_HSE 0x00000010 /* RWC host system error */ +#define EHCI_STS_FLR 0x00000008 /* RWC frame list rollover */ +#define EHCI_STS_PCD 0x00000004 /* RWC port change detect */ +#define EHCI_STS_ERRINT 0x00000002 /* RWC error interrupt */ +#define EHCI_STS_INT 0x00000001 /* RWC interrupt */ +#define EHCI_STS_INTRS(x) ((x) & 0x3f) + +/* + * NOTE: the doorbell interrupt is enabled, but the doorbell is never + * used! SiS chipsets require this. + */ +#define EHCI_NORMAL_INTRS (EHCI_STS_IAA | EHCI_STS_HSE | \ + EHCI_STS_PCD | EHCI_STS_ERRINT | EHCI_STS_INT) + +#define EHCI_USBINTR 0x08 /* RW Interrupt register */ +#define EHCI_INTR_IAAE 0x00000020 /* interrupt on async advance + * ena */ +#define EHCI_INTR_HSEE 0x00000010 /* host system error ena */ +#define EHCI_INTR_FLRE 0x00000008 /* frame list rollover ena */ +#define EHCI_INTR_PCIE 0x00000004 /* port change ena */ +#define EHCI_INTR_UEIE 0x00000002 /* USB error intr ena */ +#define EHCI_INTR_UIE 0x00000001 /* USB intr ena */ + +#define EHCI_FRINDEX 0x0c /* RW Frame Index register */ + +#define EHCI_CTRLDSSEGMENT 0x10 /* RW Control Data Structure Segment */ + +#define EHCI_PERIODICLISTBASE 0x14 /* RW Periodic List Base */ +#define EHCI_ASYNCLISTADDR 0x18 /* RW Async List Base */ + +#define EHCI_CONFIGFLAG 0x40 /* RW Configure Flag register */ +#define EHCI_CONF_CF 0x00000001 /* RW configure flag */ + +#define EHCI_PORTSC(n) (0x40+(4*(n))) /* RO, RW, RWC Port Status reg */ +#define EHCI_PS_WKOC_E 0x00400000 /* RW wake on over current ena */ +#define EHCI_PS_WKDSCNNT_E 0x00200000 /* RW wake on disconnect ena */ +#define EHCI_PS_WKCNNT_E 0x00100000 /* RW wake on connect ena */ +#define EHCI_PS_PTC 0x000f0000 /* RW port test control */ +#define EHCI_PS_PIC 0x0000c000 /* RW port indicator control */ +#define EHCI_PS_PO 0x00002000 /* RW port owner */ +#define EHCI_PS_PP 0x00001000 /* RW,RO port power */ +#define EHCI_PS_LS 0x00000c00 /* RO line status */ +#define EHCI_PS_IS_LOWSPEED(x) (((x) & EHCI_PS_LS) == 0x00000400) +#define EHCI_PS_PR 0x00000100 /* RW port reset */ +#define EHCI_PS_SUSP 0x00000080 /* RW suspend */ +#define EHCI_PS_FPR 0x00000040 /* RW force port resume */ +#define EHCI_PS_OCC 0x00000020 /* RWC over current change */ +#define EHCI_PS_OCA 0x00000010 /* RO over current active */ +#define EHCI_PS_PEC 0x00000008 /* RWC port enable change */ +#define EHCI_PS_PE 0x00000004 /* RW port enable */ +#define EHCI_PS_CSC 0x00000002 /* RWC connect status change */ +#define EHCI_PS_CS 0x00000001 /* RO connect status */ +#define EHCI_PS_CLEAR (EHCI_PS_OCC | EHCI_PS_PEC | EHCI_PS_CSC) + +#define EHCI_USBMODE 0x68 /* RW USB Device mode register */ +#define EHCI_UM_CM 0x00000003 /* R/WO Controller Mode */ +#define EHCI_UM_CM_IDLE 0x0 /* Idle */ +#define EHCI_UM_CM_HOST 0x3 /* Host Controller */ +#define EHCI_UM_ES 0x00000004 /* R/WO Endian Select */ +#define EHCI_UM_ES_LE 0x0 /* Little-endian byte alignment */ +#define EHCI_UM_ES_BE 0x4 /* Big-endian byte alignment */ +#define EHCI_UM_SDIS 0x00000010 /* R/WO Stream Disable Mode */ + +#define EHCI_PORT_RESET_COMPLETE 2 /* ms */ + +#endif /* _EHCIREG_H_ */ Modified: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/ohci.c Thu Oct 15 20:07:08 2009 (r198151) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define OHCI_BUS2SC(bus) \ ((ohci_softc_t *)(((uint8_t *)(bus)) - \ Modified: head/sys/dev/usb/controller/ohci.h ============================================================================== --- head/sys/dev/usb/controller/ohci.h Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/ohci.h Thu Oct 15 20:07:08 2009 (r198151) @@ -41,95 +41,6 @@ #define OHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) -/* PCI config registers */ -#define PCI_CBMEM 0x10 /* configuration base memory */ -#define PCI_INTERFACE_OHCI 0x10 - -/* OHCI registers */ -#define OHCI_REVISION 0x00 /* OHCI revision */ -#define OHCI_REV_LO(rev) ((rev) & 0xf) -#define OHCI_REV_HI(rev) (((rev)>>4) & 0xf) -#define OHCI_REV_LEGACY(rev) ((rev) & 0x100) -#define OHCI_CONTROL 0x04 -#define OHCI_CBSR_MASK 0x00000003 /* Control/Bulk Service Ratio */ -#define OHCI_RATIO_1_1 0x00000000 -#define OHCI_RATIO_1_2 0x00000001 -#define OHCI_RATIO_1_3 0x00000002 -#define OHCI_RATIO_1_4 0x00000003 -#define OHCI_PLE 0x00000004 /* Periodic List Enable */ -#define OHCI_IE 0x00000008 /* Isochronous Enable */ -#define OHCI_CLE 0x00000010 /* Control List Enable */ -#define OHCI_BLE 0x00000020 /* Bulk List Enable */ -#define OHCI_HCFS_MASK 0x000000c0 /* HostControllerFunctionalStat - * e */ -#define OHCI_HCFS_RESET 0x00000000 -#define OHCI_HCFS_RESUME 0x00000040 -#define OHCI_HCFS_OPERATIONAL 0x00000080 -#define OHCI_HCFS_SUSPEND 0x000000c0 -#define OHCI_IR 0x00000100 /* Interrupt Routing */ -#define OHCI_RWC 0x00000200 /* Remote Wakeup Connected */ -#define OHCI_RWE 0x00000400 /* Remote Wakeup Enabled */ -#define OHCI_COMMAND_STATUS 0x08 -#define OHCI_HCR 0x00000001 /* Host Controller Reset */ -#define OHCI_CLF 0x00000002 /* Control List Filled */ -#define OHCI_BLF 0x00000004 /* Bulk List Filled */ -#define OHCI_OCR 0x00000008 /* Ownership Change Request */ -#define OHCI_SOC_MASK 0x00030000 /* Scheduling Overrun Count */ -#define OHCI_INTERRUPT_STATUS 0x0c -#define OHCI_SO 0x00000001 /* Scheduling Overrun */ -#define OHCI_WDH 0x00000002 /* Writeback Done Head */ -#define OHCI_SF 0x00000004 /* Start of Frame */ -#define OHCI_RD 0x00000008 /* Resume Detected */ -#define OHCI_UE 0x00000010 /* Unrecoverable Error */ -#define OHCI_FNO 0x00000020 /* Frame Number Overflow */ -#define OHCI_RHSC 0x00000040 /* Root Hub Status Change */ -#define OHCI_OC 0x40000000 /* Ownership Change */ -#define OHCI_MIE 0x80000000 /* Master Interrupt Enable */ -#define OHCI_INTERRUPT_ENABLE 0x10 -#define OHCI_INTERRUPT_DISABLE 0x14 -#define OHCI_HCCA 0x18 -#define OHCI_PERIOD_CURRENT_ED 0x1c -#define OHCI_CONTROL_HEAD_ED 0x20 -#define OHCI_CONTROL_CURRENT_ED 0x24 -#define OHCI_BULK_HEAD_ED 0x28 -#define OHCI_BULK_CURRENT_ED 0x2c -#define OHCI_DONE_HEAD 0x30 -#define OHCI_FM_INTERVAL 0x34 -#define OHCI_GET_IVAL(s) ((s) & 0x3fff) -#define OHCI_GET_FSMPS(s) (((s) >> 16) & 0x7fff) -#define OHCI_FIT 0x80000000 -#define OHCI_FM_REMAINING 0x38 -#define OHCI_FM_NUMBER 0x3c -#define OHCI_PERIODIC_START 0x40 -#define OHCI_LS_THRESHOLD 0x44 -#define OHCI_RH_DESCRIPTOR_A 0x48 -#define OHCI_GET_NDP(s) ((s) & 0xff) -#define OHCI_PSM 0x0100 /* Power Switching Mode */ -#define OHCI_NPS 0x0200 /* No Power Switching */ -#define OHCI_DT 0x0400 /* Device Type */ -#define OHCI_OCPM 0x0800 /* Overcurrent Protection Mode */ -#define OHCI_NOCP 0x1000 /* No Overcurrent Protection */ -#define OHCI_GET_POTPGT(s) ((s) >> 24) -#define OHCI_RH_DESCRIPTOR_B 0x4c -#define OHCI_RH_STATUS 0x50 -#define OHCI_LPS 0x00000001 /* Local Power Status */ -#define OHCI_OCI 0x00000002 /* OverCurrent Indicator */ -#define OHCI_DRWE 0x00008000 /* Device Remote Wakeup Enable */ -#define OHCI_LPSC 0x00010000 /* Local Power Status Change */ -#define OHCI_CCIC 0x00020000 /* OverCurrent Indicator - * Change */ -#define OHCI_CRWE 0x80000000 /* Clear Remote Wakeup Enable */ -#define OHCI_RH_PORT_STATUS(n) (0x50 + ((n)*4)) /* 1 based indexing */ - -#define OHCI_LES (OHCI_PLE | OHCI_IE | OHCI_CLE | OHCI_BLE) -#define OHCI_ALL_INTRS (OHCI_SO | OHCI_WDH | OHCI_SF | \ - OHCI_RD | OHCI_UE | OHCI_FNO | \ - OHCI_RHSC | OHCI_OC) -#define OHCI_NORMAL_INTRS (OHCI_WDH | OHCI_RD | OHCI_UE | OHCI_RHSC) - -#define OHCI_FSMPS(i) (((i-210)*6/7) << 16) -#define OHCI_PERIODIC(i) ((i)*9/10) - #define OHCI_NO_INTRS 32 #define OHCI_HCCA_SIZE 256 Modified: head/sys/dev/usb/controller/ohci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/ohci_atmelarm.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/ohci_atmelarm.c Thu Oct 15 20:07:08 2009 (r198151) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ohci_pci.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/ohci_pci.c Thu Oct 15 20:07:08 2009 (r198151) @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define PCI_OHCI_VENDORID_ACERLABS 0x10b9 #define PCI_OHCI_VENDORID_AMD 0x1022 Added: head/sys/dev/usb/controller/ohcireg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/controller/ohcireg.h Thu Oct 15 20:07:08 2009 (r198151) @@ -0,0 +1,131 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net) at + * Carlstedt Research & Technology. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _OHCIREG_H_ +#define _OHCIREG_H_ + +/* PCI config registers */ +#define PCI_CBMEM 0x10 /* configuration base memory */ +#define PCI_INTERFACE_OHCI 0x10 + +/* OHCI registers */ +#define OHCI_REVISION 0x00 /* OHCI revision */ +#define OHCI_REV_LO(rev) ((rev) & 0xf) +#define OHCI_REV_HI(rev) (((rev)>>4) & 0xf) +#define OHCI_REV_LEGACY(rev) ((rev) & 0x100) +#define OHCI_CONTROL 0x04 +#define OHCI_CBSR_MASK 0x00000003 /* Control/Bulk Service Ratio */ +#define OHCI_RATIO_1_1 0x00000000 +#define OHCI_RATIO_1_2 0x00000001 +#define OHCI_RATIO_1_3 0x00000002 +#define OHCI_RATIO_1_4 0x00000003 +#define OHCI_PLE 0x00000004 /* Periodic List Enable */ +#define OHCI_IE 0x00000008 /* Isochronous Enable */ +#define OHCI_CLE 0x00000010 /* Control List Enable */ +#define OHCI_BLE 0x00000020 /* Bulk List Enable */ +#define OHCI_HCFS_MASK 0x000000c0 /* HostControllerFunctionalStat + * e */ +#define OHCI_HCFS_RESET 0x00000000 +#define OHCI_HCFS_RESUME 0x00000040 +#define OHCI_HCFS_OPERATIONAL 0x00000080 +#define OHCI_HCFS_SUSPEND 0x000000c0 +#define OHCI_IR 0x00000100 /* Interrupt Routing */ +#define OHCI_RWC 0x00000200 /* Remote Wakeup Connected */ +#define OHCI_RWE 0x00000400 /* Remote Wakeup Enabled */ +#define OHCI_COMMAND_STATUS 0x08 +#define OHCI_HCR 0x00000001 /* Host Controller Reset */ +#define OHCI_CLF 0x00000002 /* Control List Filled */ +#define OHCI_BLF 0x00000004 /* Bulk List Filled */ +#define OHCI_OCR 0x00000008 /* Ownership Change Request */ +#define OHCI_SOC_MASK 0x00030000 /* Scheduling Overrun Count */ +#define OHCI_INTERRUPT_STATUS 0x0c +#define OHCI_SO 0x00000001 /* Scheduling Overrun */ +#define OHCI_WDH 0x00000002 /* Writeback Done Head */ +#define OHCI_SF 0x00000004 /* Start of Frame */ +#define OHCI_RD 0x00000008 /* Resume Detected */ +#define OHCI_UE 0x00000010 /* Unrecoverable Error */ +#define OHCI_FNO 0x00000020 /* Frame Number Overflow */ +#define OHCI_RHSC 0x00000040 /* Root Hub Status Change */ +#define OHCI_OC 0x40000000 /* Ownership Change */ +#define OHCI_MIE 0x80000000 /* Master Interrupt Enable */ +#define OHCI_INTERRUPT_ENABLE 0x10 +#define OHCI_INTERRUPT_DISABLE 0x14 +#define OHCI_HCCA 0x18 +#define OHCI_PERIOD_CURRENT_ED 0x1c +#define OHCI_CONTROL_HEAD_ED 0x20 +#define OHCI_CONTROL_CURRENT_ED 0x24 +#define OHCI_BULK_HEAD_ED 0x28 +#define OHCI_BULK_CURRENT_ED 0x2c +#define OHCI_DONE_HEAD 0x30 +#define OHCI_FM_INTERVAL 0x34 +#define OHCI_GET_IVAL(s) ((s) & 0x3fff) +#define OHCI_GET_FSMPS(s) (((s) >> 16) & 0x7fff) +#define OHCI_FIT 0x80000000 +#define OHCI_FM_REMAINING 0x38 +#define OHCI_FM_NUMBER 0x3c +#define OHCI_PERIODIC_START 0x40 +#define OHCI_LS_THRESHOLD 0x44 +#define OHCI_RH_DESCRIPTOR_A 0x48 +#define OHCI_GET_NDP(s) ((s) & 0xff) +#define OHCI_PSM 0x0100 /* Power Switching Mode */ +#define OHCI_NPS 0x0200 /* No Power Switching */ +#define OHCI_DT 0x0400 /* Device Type */ +#define OHCI_OCPM 0x0800 /* Overcurrent Protection Mode */ +#define OHCI_NOCP 0x1000 /* No Overcurrent Protection */ +#define OHCI_GET_POTPGT(s) ((s) >> 24) +#define OHCI_RH_DESCRIPTOR_B 0x4c +#define OHCI_RH_STATUS 0x50 +#define OHCI_LPS 0x00000001 /* Local Power Status */ +#define OHCI_OCI 0x00000002 /* OverCurrent Indicator */ +#define OHCI_DRWE 0x00008000 /* Device Remote Wakeup Enable */ +#define OHCI_LPSC 0x00010000 /* Local Power Status Change */ +#define OHCI_CCIC 0x00020000 /* OverCurrent Indicator + * Change */ +#define OHCI_CRWE 0x80000000 /* Clear Remote Wakeup Enable */ +#define OHCI_RH_PORT_STATUS(n) (0x50 + ((n)*4)) /* 1 based indexing */ + +#define OHCI_LES (OHCI_PLE | OHCI_IE | OHCI_CLE | OHCI_BLE) +#define OHCI_ALL_INTRS (OHCI_SO | OHCI_WDH | OHCI_SF | \ + OHCI_RD | OHCI_UE | OHCI_FNO | \ + OHCI_RHSC | OHCI_OC) +#define OHCI_NORMAL_INTRS (OHCI_WDH | OHCI_RD | OHCI_UE | OHCI_RHSC) + +#define OHCI_FSMPS(i) (((i-210)*6/7) << 16) +#define OHCI_PERIODIC(i) ((i)*9/10) + +#endif /* _OHCIREG_H_ */ Modified: head/sys/dev/usb/controller/uhci.c ============================================================================== --- head/sys/dev/usb/controller/uhci.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/uhci.c Thu Oct 15 20:07:08 2009 (r198151) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define alt_next next #define UHCI_BUS2SC(bus) \ Modified: head/sys/dev/usb/controller/uhci.h ============================================================================== --- head/sys/dev/usb/controller/uhci.h Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/uhci.h Thu Oct 15 20:07:08 2009 (r198151) @@ -41,64 +41,6 @@ #define UHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) -/* PCI config registers */ -#define PCI_USBREV 0x60 /* USB protocol revision */ -#define PCI_USB_REV_MASK 0xff -#define PCI_USB_REV_PRE_1_0 0x00 -#define PCI_USB_REV_1_0 0x10 -#define PCI_USB_REV_1_1 0x11 -#define PCI_LEGSUP 0xc0 /* Legacy Support register */ -#define PCI_LEGSUP_USBPIRQDEN 0x2000 /* USB PIRQ D Enable */ -#define PCI_CBIO 0x20 /* configuration base IO */ -#define PCI_INTERFACE_UHCI 0x00 - -/* UHCI registers */ -#define UHCI_CMD 0x00 -#define UHCI_CMD_RS 0x0001 -#define UHCI_CMD_HCRESET 0x0002 -#define UHCI_CMD_GRESET 0x0004 -#define UHCI_CMD_EGSM 0x0008 -#define UHCI_CMD_FGR 0x0010 -#define UHCI_CMD_SWDBG 0x0020 -#define UHCI_CMD_CF 0x0040 -#define UHCI_CMD_MAXP 0x0080 -#define UHCI_STS 0x02 -#define UHCI_STS_USBINT 0x0001 -#define UHCI_STS_USBEI 0x0002 -#define UHCI_STS_RD 0x0004 -#define UHCI_STS_HSE 0x0008 -#define UHCI_STS_HCPE 0x0010 -#define UHCI_STS_HCH 0x0020 -#define UHCI_STS_ALLINTRS 0x003f -#define UHCI_INTR 0x04 -#define UHCI_INTR_TOCRCIE 0x0001 -#define UHCI_INTR_RIE 0x0002 -#define UHCI_INTR_IOCE 0x0004 -#define UHCI_INTR_SPIE 0x0008 -#define UHCI_FRNUM 0x06 -#define UHCI_FRNUM_MASK 0x03ff -#define UHCI_FLBASEADDR 0x08 -#define UHCI_SOF 0x0c -#define UHCI_SOF_MASK 0x7f -#define UHCI_PORTSC1 0x010 -#define UHCI_PORTSC2 0x012 -#define UHCI_PORTSC_CCS 0x0001 -#define UHCI_PORTSC_CSC 0x0002 -#define UHCI_PORTSC_PE 0x0004 -#define UHCI_PORTSC_POEDC 0x0008 -#define UHCI_PORTSC_LS 0x0030 -#define UHCI_PORTSC_LS_SHIFT 4 -#define UHCI_PORTSC_RD 0x0040 -#define UHCI_PORTSC_LSDA 0x0100 -#define UHCI_PORTSC_PR 0x0200 -#define UHCI_PORTSC_OCI 0x0400 -#define UHCI_PORTSC_OCIC 0x0800 -#define UHCI_PORTSC_SUSP 0x1000 - -#define URWMASK(x) ((x) & (UHCI_PORTSC_SUSP | \ - UHCI_PORTSC_PR | UHCI_PORTSC_RD | \ - UHCI_PORTSC_PE)) - #define UHCI_FRAMELIST_COUNT 1024 /* units */ #define UHCI_FRAMELIST_ALIGN 4096 /* bytes */ @@ -118,8 +60,6 @@ typedef uint32_t uhci_physaddr_t; #define UHCI_PTR_QH 0x00000002 #define UHCI_PTR_VF 0x00000004 -#define UHCI_QH_REMOVE_DELAY 5 /* us - QH remove delay */ - /* * The Queue Heads (QH) and Transfer Descriptors (TD) are accessed by * both the CPU and the USB-controller which run concurrently. Great Modified: head/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/uhci_pci.c Thu Oct 15 19:50:00 2009 (r198150) +++ head/sys/dev/usb/controller/uhci_pci.c Thu Oct 15 20:07:08 2009 (r198151) @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define PCI_UHCI_VENDORID_INTEL 0x8086 #define PCI_UHCI_VENDORID_VIA 0x1106 Added: head/sys/dev/usb/controller/uhcireg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/controller/uhcireg.h Thu Oct 15 20:07:08 2009 (r198151) @@ -0,0 +1,100 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net) at + * Carlstedt Research & Technology. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UHCIREG_H_ +#define _UHCIREG_H_ + +/* PCI config registers */ +#define PCI_USBREV 0x60 /* USB protocol revision */ +#define PCI_USB_REV_MASK 0xff +#define PCI_USB_REV_PRE_1_0 0x00 +#define PCI_USB_REV_1_0 0x10 +#define PCI_USB_REV_1_1 0x11 +#define PCI_LEGSUP 0xc0 /* Legacy Support register */ +#define PCI_LEGSUP_USBPIRQDEN 0x2000 /* USB PIRQ D Enable */ +#define PCI_CBIO 0x20 /* configuration base IO */ +#define PCI_INTERFACE_UHCI 0x00 + +/* UHCI registers */ +#define UHCI_CMD 0x00 +#define UHCI_CMD_RS 0x0001 +#define UHCI_CMD_HCRESET 0x0002 +#define UHCI_CMD_GRESET 0x0004 +#define UHCI_CMD_EGSM 0x0008 +#define UHCI_CMD_FGR 0x0010 +#define UHCI_CMD_SWDBG 0x0020 +#define UHCI_CMD_CF 0x0040 +#define UHCI_CMD_MAXP 0x0080 +#define UHCI_STS 0x02 +#define UHCI_STS_USBINT 0x0001 +#define UHCI_STS_USBEI 0x0002 +#define UHCI_STS_RD 0x0004 +#define UHCI_STS_HSE 0x0008 +#define UHCI_STS_HCPE 0x0010 +#define UHCI_STS_HCH 0x0020 +#define UHCI_STS_ALLINTRS 0x003f +#define UHCI_INTR 0x04 +#define UHCI_INTR_TOCRCIE 0x0001 +#define UHCI_INTR_RIE 0x0002 +#define UHCI_INTR_IOCE 0x0004 +#define UHCI_INTR_SPIE 0x0008 +#define UHCI_FRNUM 0x06 +#define UHCI_FRNUM_MASK 0x03ff +#define UHCI_FLBASEADDR 0x08 +#define UHCI_SOF 0x0c +#define UHCI_SOF_MASK 0x7f +#define UHCI_PORTSC1 0x010 +#define UHCI_PORTSC2 0x012 +#define UHCI_PORTSC_CCS 0x0001 +#define UHCI_PORTSC_CSC 0x0002 +#define UHCI_PORTSC_PE 0x0004 +#define UHCI_PORTSC_POEDC 0x0008 +#define UHCI_PORTSC_LS 0x0030 +#define UHCI_PORTSC_LS_SHIFT 4 +#define UHCI_PORTSC_RD 0x0040 +#define UHCI_PORTSC_LSDA 0x0100 +#define UHCI_PORTSC_PR 0x0200 +#define UHCI_PORTSC_OCI 0x0400 +#define UHCI_PORTSC_OCIC 0x0800 +#define UHCI_PORTSC_SUSP 0x1000 + +#define URWMASK(x) ((x) & (UHCI_PORTSC_SUSP | \ + UHCI_PORTSC_PR | UHCI_PORTSC_RD | \ + UHCI_PORTSC_PE)) + +#endif /* _UHCIREG_H_ */ From thompsa at FreeBSD.org Thu Oct 15 20:09:28 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Thu Oct 15 20:09:34 2009 Subject: svn commit: r198152 - head/sys/dev/usb/input Message-ID: <200910152009.n9FK9SLp083361@svn.freebsd.org> Author: thompsa Date: Thu Oct 15 20:09:27 2009 New Revision: 198152 URL: http://svn.freebsd.org/changeset/base/198152 Log: Only poll ukbd if KDB is active. Submitted by: HPS Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Thu Oct 15 20:07:08 2009 (r198151) +++ head/sys/dev/usb/input/ukbd.c Thu Oct 15 20:09:27 2009 (r198152) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -328,6 +329,9 @@ ukbd_do_poll(struct ukbd_softc *sc, uint { DPRINTFN(2, "polling\n"); + if (kdb_active == 0) + return; /* Only poll if KDB is active */ + while (sc->sc_inputs == 0) { usbd_transfer_poll(sc->sc_xfer, UKBD_N_TRANSFER); From thompsa at FreeBSD.org Thu Oct 15 20:15:29 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Thu Oct 15 20:15:36 2009 Subject: svn commit: r198153 - head/sys/dev/usb/net Message-ID: <200910152015.n9FKFTEQ083518@svn.freebsd.org> Author: thompsa Date: Thu Oct 15 20:15:29 2009 New Revision: 198153 URL: http://svn.freebsd.org/changeset/base/198153 Log: Correct offset calcluation for the NCM implementation. Submitted by: HPS Modified: head/sys/dev/usb/net/if_cdce.c Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Thu Oct 15 20:09:27 2009 (r198152) +++ head/sys/dev/usb/net/if_cdce.c Thu Oct 15 20:15:29 2009 (r198153) @@ -1088,7 +1088,7 @@ cdce_ncm_fill_tx_frames(struct usb_xfer sc->sc_ncm.hdr.dwSignature[2] = 'M'; sc->sc_ncm.hdr.dwSignature[3] = 'H'; USETW(sc->sc_ncm.hdr.wHeaderLength, sizeof(sc->sc_ncm.hdr)); - USETW(sc->sc_ncm.hdr.wBlockLength, offset); + USETW(sc->sc_ncm.hdr.wBlockLength, last_offset); USETW(sc->sc_ncm.hdr.wSequence, sc->sc_ncm.tx_seq); USETW(sc->sc_ncm.hdr.wDptIndex, sizeof(sc->sc_ncm.hdr)); @@ -1243,25 +1243,24 @@ cdce_ncm_bulk_read_callback(struct usb_x offset = UGETW(sc->sc_ncm.dp[x].wFrameIndex); temp = UGETW(sc->sc_ncm.dp[x].wFrameLength); - if ((offset + temp) > actlen) { - DPRINTFN(1, "invalid frame detected (ignored)\n"); - m = NULL; - } else if (temp >= sizeof(struct ether_header)) { - /* - * allocate a suitable memory buffer, if - * possible - */ - if (temp > (MCLBYTES - ETHER_ALIGN)) { - m = NULL; - continue; - } if (temp > (MHLEN - ETHER_ALIGN)) { - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - } else { - m = m_gethdr(M_DONTWAIT, MT_DATA); - } + if ((offset == 0) || + (temp < sizeof(struct ether_header)) || + (temp > (MCLBYTES - ETHER_ALIGN))) { + DPRINTFN(1, "NULL frame detected at %d\n", x); + m = NULL; + /* silently ignore this frame */ + continue; + } else if ((offset + temp) > actlen) { + DPRINTFN(1, "invalid frame " + "detected at %d\n", x); + m = NULL; + /* silently ignore this frame */ + continue; + } else if (temp > (MHLEN - ETHER_ALIGN)) { + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); } else { - m = NULL; /* dump it */ + m = m_gethdr(M_DONTWAIT, MT_DATA); } DPRINTFN(16, "frame %u, offset = %u, length = %u \n", From dougb at FreeBSD.org Thu Oct 15 23:20:24 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Thu Oct 15 23:20:35 2009 Subject: svn commit: r198162 - head/etc Message-ID: <200910152320.n9FNKNCc087417@svn.freebsd.org> Author: dougb Date: Thu Oct 15 23:20:23 2009 New Revision: 198162 URL: http://svn.freebsd.org/changeset/base/198162 Log: Allow $name_program to override $command in a more robust way that will not cause the value to be null if $command is not set. Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Thu Oct 15 21:20:12 2009 (r198161) +++ head/etc/rc.subr Thu Oct 15 23:20:23 2009 (r198162) @@ -616,7 +616,7 @@ run_rc_command() esac eval _override_command=\$${name}_program - command=${command:+${_override_command:-$command}} + command=${_override_command:-$command} _keywords="start stop restart rcvar $extra_commands" rc_pid= From brde at optusnet.com.au Fri Oct 16 04:58:10 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Fri Oct 16 04:58:21 2009 Subject: svn commit: r198118 - head/usr.bin/netstat In-Reply-To: <200910151031.n9FAVOvU070664@svn.freebsd.org> References: <200910151031.n9FAVOvU070664@svn.freebsd.org> Message-ID: <20091016154905.E8438@delplex.bde.org> On Thu, 15 Oct 2009, Robert Watson wrote: > Log: > Print routing statistics as unsigned short rather than unsigned int, > otherwise sign extension leads to unlikely values when in the negative > range of the signed short structure fields that hold the statistics. > The type used to hold routing statistics is arguably also incorrect. This enlarges the bug. With signed types you get advance warning of overflow (you actually get overflow earlier but it usually just results in obviously wrong values being printed), and repeated warnings on overflow (every time the overflowing values wrap back to negative). With unsigned types or this change, you get unobviously wrong values after the first overflow, and no repeated warnings (unless you watch the values carefully enough to see them go backwards). Using unsigned bytes only delays the overflow for a whole factor of 2. Bruce From avg at freebsd.org Fri Oct 16 05:09:42 2009 From: avg at freebsd.org (Andriy Gapon) Date: Fri Oct 16 05:09:55 2009 Subject: svn commit: r198151 - in head/sys/dev: pci usb/controller In-Reply-To: <200910152007.n9FK78cG083259@svn.freebsd.org> References: <200910152007.n9FK78cG083259@svn.freebsd.org> Message-ID: <4AD80002.6000704@freebsd.org> on 15/10/2009 23:07 Andrew Thompson said the following: > Author: thompsa > Date: Thu Oct 15 20:07:08 2009 > New Revision: 198151 > URL: http://svn.freebsd.org/changeset/base/198151 > > Log: > Workaround buggy BIOS code in USB regard. By doing the BIOS to OS handover for > all host controllers at the same time, we avoid problems where the BIOS will > actually write to the USB registers of all the USB host controllers every time > we handover one of them, and consequently reset the OS programmed values. This should fix the boot-time problems with AMD SB600/SB7xx controllers. Many thanks to Hans for a lot of help. -- Andriy Gapon From kib at FreeBSD.org Fri Oct 16 12:01:00 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Oct 16 12:01:42 2009 Subject: svn commit: r198170 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200910161201.n9GC103B003290@svn.freebsd.org> Author: kib Date: Fri Oct 16 12:00:59 2009 New Revision: 198170 URL: http://svn.freebsd.org/changeset/base/198170 Log: Move intr_describe() out of #ifdef SMP; the function is always required. Reviewed by: jhb Modified: head/sys/amd64/amd64/intr_machdep.c head/sys/i386/i386/intr_machdep.c Modified: head/sys/amd64/amd64/intr_machdep.c ============================================================================== --- head/sys/amd64/amd64/intr_machdep.c Fri Oct 16 11:00:26 2009 (r198169) +++ head/sys/amd64/amd64/intr_machdep.c Fri Oct 16 12:00:59 2009 (r198170) @@ -400,6 +400,23 @@ atpic_reset(void) } #endif +/* Add a description to an active interrupt handler. */ +int +intr_describe(u_int vector, void *ih, const char *descr) +{ + struct intsrc *isrc; + int error; + + isrc = intr_lookup_source(vector); + if (isrc == NULL) + return (EINVAL); + error = intr_event_describe_handler(isrc->is_event, ih, descr); + if (error) + return (error); + intrcnt_updatename(isrc); + return (0); +} + #ifdef DDB /* * Dump data about interrupt handlers @@ -466,23 +483,6 @@ intr_bind(u_int vector, u_char cpu) return (intr_event_bind(isrc->is_event, cpu)); } -/* Add a description to an active interrupt handler. */ -int -intr_describe(u_int vector, void *ih, const char *descr) -{ - struct intsrc *isrc; - int error; - - isrc = intr_lookup_source(vector); - if (isrc == NULL) - return (EINVAL); - error = intr_event_describe_handler(isrc->is_event, ih, descr); - if (error) - return (error); - intrcnt_updatename(isrc); - return (0); -} - /* * Add a CPU to our mask of valid CPUs that can be destinations of * interrupts. Modified: head/sys/i386/i386/intr_machdep.c ============================================================================== --- head/sys/i386/i386/intr_machdep.c Fri Oct 16 11:00:26 2009 (r198169) +++ head/sys/i386/i386/intr_machdep.c Fri Oct 16 12:00:59 2009 (r198170) @@ -366,6 +366,23 @@ intr_init(void *dummy __unused) } SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL); +/* Add a description to an active interrupt handler. */ +int +intr_describe(u_int vector, void *ih, const char *descr) +{ + struct intsrc *isrc; + int error; + + isrc = intr_lookup_source(vector); + if (isrc == NULL) + return (EINVAL); + error = intr_event_describe_handler(isrc->is_event, ih, descr); + if (error) + return (error); + intrcnt_updatename(isrc); + return (0); +} + #ifdef DDB /* * Dump data about interrupt handlers @@ -432,23 +449,6 @@ intr_bind(u_int vector, u_char cpu) return (intr_event_bind(isrc->is_event, cpu)); } -/* Add a description to an active interrupt handler. */ -int -intr_describe(u_int vector, void *ih, const char *descr) -{ - struct intsrc *isrc; - int error; - - isrc = intr_lookup_source(vector); - if (isrc == NULL) - return (EINVAL); - error = intr_event_describe_handler(isrc->is_event, ih, descr); - if (error) - return (error); - intrcnt_updatename(isrc); - return (0); -} - /* * Add a CPU to our mask of valid CPUs that can be destinations of * interrupts. From brueffer at FreeBSD.org Fri Oct 16 12:32:07 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Fri Oct 16 12:32:14 2009 Subject: svn commit: r198171 - head/share/man/man9 Message-ID: <200910161232.n9GCW77a003886@svn.freebsd.org> Author: brueffer Date: Fri Oct 16 12:32:07 2009 New Revision: 198171 URL: http://svn.freebsd.org/changeset/base/198171 Log: Sort SEE ALSO. Modified: head/share/man/man9/BUS_DESCRIBE_INTR.9 Modified: head/share/man/man9/BUS_DESCRIBE_INTR.9 ============================================================================== --- head/share/man/man9/BUS_DESCRIBE_INTR.9 Fri Oct 16 12:00:59 2009 (r198170) +++ head/share/man/man9/BUS_DESCRIBE_INTR.9 Fri Oct 16 12:32:07 2009 (r198171) @@ -88,10 +88,10 @@ the interrupt handler name. Zero is returned on success, otherwise an appropriate error is returned. .Sh SEE ALSO .Xr BUS_SETUP_INTR 9 , -.Xr device 9 , -.Xr printf 9 , .Xr systat 1 , -.Xr vmstat 8 +.Xr vmstat 8 , +.Xr device 9 , +.Xr printf 9 .Sh HISTORY The .Fn BUS_DESCRIBE_INTR From jilles at FreeBSD.org Fri Oct 16 16:17:58 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Fri Oct 16 16:18:03 2009 Subject: svn commit: r198173 - head/bin/sh Message-ID: <200910161617.n9GGHvpt008234@svn.freebsd.org> Author: jilles Date: Fri Oct 16 16:17:57 2009 New Revision: 198173 URL: http://svn.freebsd.org/changeset/base/198173 Log: sh: Show more information about syntax errors in command substitution: the line number where the command substitution started. This applies to both the $() and `` forms but is most useful for `` because the other line number is relative to the enclosed text there. (For older versions, -v can be used as a workaround.) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Fri Oct 16 12:42:02 2009 (r198172) +++ head/bin/sh/parser.c Fri Oct 16 16:17:57 2009 (r198173) @@ -1308,11 +1308,16 @@ parsebackq: { struct jmploc *const savehandler = handler; int savelen; int saveprompt; + const int bq_startlinno = plinno; if (setjmp(jmploc.loc)) { if (str) ckfree(str); handler = savehandler; + if (exception == EXERROR) { + startlinno = bq_startlinno; + synerror("Error in command substitution"); + } longjmp(handler->loc, 1); } INTOFF; From jhb at freebsd.org Fri Oct 16 16:28:05 2009 From: jhb at freebsd.org (John Baldwin) Date: Fri Oct 16 16:28:21 2009 Subject: svn commit: r198151 - in head/sys/dev: pci usb/controller In-Reply-To: <4AD80002.6000704@freebsd.org> References: <200910152007.n9FK78cG083259@svn.freebsd.org> <4AD80002.6000704@freebsd.org> Message-ID: <200910160737.28222.jhb@freebsd.org> On Friday 16 October 2009 1:09:22 am Andriy Gapon wrote: > on 15/10/2009 23:07 Andrew Thompson said the following: > > Author: thompsa > > Date: Thu Oct 15 20:07:08 2009 > > New Revision: 198151 > > URL: http://svn.freebsd.org/changeset/base/198151 > > > > Log: > > Workaround buggy BIOS code in USB regard. By doing the BIOS to OS handover for > > all host controllers at the same time, we avoid problems where the BIOS will > > actually write to the USB registers of all the USB host controllers every time > > we handover one of them, and consequently reset the OS programmed values. > > This should fix the boot-time problems with AMD SB600/SB7xx controllers. > Many thanks to Hans for a lot of help. At least one other system also exhibits this: Intel D850 motherboards (P4 system with RDRAM). I think there is an amd64 PR about this as well that may be for yet another system. -- John Baldwin From jhb at freebsd.org Fri Oct 16 16:28:09 2009 From: jhb at freebsd.org (John Baldwin) Date: Fri Oct 16 16:28:22 2009 Subject: svn commit: r198171 - head/share/man/man9 In-Reply-To: <200910161232.n9GCW77a003886@svn.freebsd.org> References: <200910161232.n9GCW77a003886@svn.freebsd.org> Message-ID: <200910160950.39342.jhb@freebsd.org> On Friday 16 October 2009 8:32:07 am Christian Brueffer wrote: > Author: brueffer > Date: Fri Oct 16 12:32:07 2009 > New Revision: 198171 > URL: http://svn.freebsd.org/changeset/base/198171 > > Log: > Sort SEE ALSO. Ah, I couldn't recall if the section number was a primary key or not. -- John Baldwin From jhb at FreeBSD.org Fri Oct 16 19:30:49 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Oct 16 19:32:11 2009 Subject: svn commit: r198174 - head/sys/nfsclient Message-ID: <200910161930.n9GJUnHD011723@svn.freebsd.org> Author: jhb Date: Fri Oct 16 19:30:48 2009 New Revision: 198174 URL: http://svn.freebsd.org/changeset/base/198174 Log: Close a race with caching of -ve name lookups in the NFS client. Specifically, clients only trust -ve cache entries while the directory remains unchanged and discard any -ve cache entries for a directory when they notice that the modification time of a directory entry changes. The race involves two concurrent lookups as follows: - Thread A does a lookup for file 'foo' which sends a lookup RPC to the server. The lookup fails and the server replies. - The 'foo' file is created (either by the same client or a different client) updating the modification time on the parent directory of 'foo'. - Thread B does a lookup for a different file 'bar' which updates the cached attributes of the parent directory of 'foo' to reflect the new modification time after 'foo' was created. - Thread A finally resumes execution to parse the reply from the NFS server. It adds a -ve cache entry and sets the cached value of the directory's modification time that is used for invalidating -ve cached lookups to the new modification time set by thread B. At this point, future lookups of 'foo' will honor the -ve cached entry until the cached entry is pushed out of the name cache's LRU or the modification time of the parent directory is changed again by some other change. The fix is to read the directory's modification time before sending the lookup RPC and use that cached modification time when setting the directory's cached modification time. Also, we do not add a -ve cache entry if another thread has added -ve cache entry that set the directory's cached modification time to a newer value than the value we read before sending the lookup RPC. Reviewed by: rmacklem MFC after: 1 week Modified: head/sys/nfsclient/nfs_vnops.c Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Fri Oct 16 16:17:57 2009 (r198173) +++ head/sys/nfsclient/nfs_vnops.c Fri Oct 16 19:30:48 2009 (r198174) @@ -924,6 +924,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode **vpp = ap->a_vpp; struct mount *mp = dvp->v_mount; struct vattr vattr; + time_t dmtime; int flags = cnp->cn_flags; struct vnode *newvp; struct nfsmount *nmp; @@ -935,7 +936,7 @@ nfs_lookup(struct vop_lookup_args *ap) int error = 0, attrflag, fhsize, ltype; int v3 = NFS_ISV3(dvp); struct thread *td = cnp->cn_thread; - + *vpp = NULLVP; if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) @@ -992,6 +993,19 @@ nfs_lookup(struct vop_lookup_args *ap) np->n_dmtime = 0; mtx_unlock(&np->n_mtx); } + + /* + * Cache the modification time of the parent directory in case + * the lookup fails and results in adding the first negative + * name cache entry for the directory. Since this is reading + * a single time_t, don't bother with locking. The + * modification time may be a bit stale, but it must be read + * before performing the lookup RPC to prevent a race where + * another lookup updates the timestamp on the directory after + * the lookup RPC has been performed on the server but before + * n_dmtime is set at the end of this function. + */ + dmtime = np->n_vattr.va_mtime.tv_sec; error = 0; newvp = NULLVP; nfsstats.lookupcache_misses++; @@ -1130,13 +1144,25 @@ nfsmout: * Maintain n_dmtime as the modification time * of the parent directory when the oldest -ve * name cache entry for this directory was - * added. + * added. If a -ve cache entry has already + * been added with a newer modification time + * by a concurrent lookup, then don't bother + * adding a cache entry. The modification + * time of the directory might have changed + * due to the file this lookup failed to find + * being created. In that case a subsequent + * lookup would incorrectly use the entry + * added here instead of doing an extra + * lookup. */ mtx_lock(&np->n_mtx); - if (np->n_dmtime == 0) - np->n_dmtime = np->n_vattr.va_mtime.tv_sec; - mtx_unlock(&np->n_mtx); - cache_enter(dvp, NULL, cnp); + if (np->n_dmtime <= dmtime) { + if (np->n_dmtime == 0) + np->n_dmtime = dmtime; + mtx_unlock(&np->n_mtx); + cache_enter(dvp, NULL, cnp); + } else + mtx_unlock(&np->n_mtx); } return (ENOENT); } From jhb at freebsd.org Fri Oct 16 19:51:52 2009 From: jhb at freebsd.org (John Baldwin) Date: Fri Oct 16 19:51:58 2009 Subject: svn commit: r198174 - head/sys/nfsclient In-Reply-To: <200910161930.n9GJUnHD011723@svn.freebsd.org> References: <200910161930.n9GJUnHD011723@svn.freebsd.org> Message-ID: <200910161551.35583.jhb@freebsd.org> On Friday 16 October 2009 3:30:49 pm John Baldwin wrote: > Author: jhb > Date: Fri Oct 16 19:30:48 2009 > New Revision: 198174 > URL: http://svn.freebsd.org/changeset/base/198174 > > Log: > Close a race with caching of -ve name lookups in the NFS client. > Specifically, clients only trust -ve cache entries while the directory > remains unchanged and discard any -ve cache entries for a directory when > they notice that the modification time of a directory entry changes. The > race involves two concurrent lookups as follows: > - Thread A does a lookup for file 'foo' which sends a lookup RPC to the > server. The lookup fails and the server replies. > - The 'foo' file is created (either by the same client or a different > client) updating the modification time on the parent directory of 'foo'. > - Thread B does a lookup for a different file 'bar' which updates the > cached attributes of the parent directory of 'foo' to reflect the new > modification time after 'foo' was created. > - Thread A finally resumes execution to parse the reply from the NFS > server. It adds a -ve cache entry and sets the cached value of the > directory's modification time that is used for invalidating -ve cached > lookups to the new modification time set by thread B. Slight correction, the file has to be created on a different client since the local client would exclusively lock the directory vnode while it created the file avoiding this race. I created the file on a separate client when I reproduced this during testing (I used a hack to force a 5 second sleep when adding -ve cache entries to let thread B do its lookup and update the mtime before thread A tried to add its -ve cache entry to "force" the race). I have seen this in practice in a couple of cases at work where an ls of a directory would show a file that was added, but attempting to open the file itself or even ls the individual file would fail with ENOENT. -- John Baldwin From jh at FreeBSD.org Fri Oct 16 20:52:45 2009 From: jh at FreeBSD.org (Jaakko Heinonen) Date: Fri Oct 16 20:52:51 2009 Subject: svn commit: r198175 - head/usr.bin/touch Message-ID: <200910162052.n9GKqjOd013242@svn.freebsd.org> Author: jh Date: Fri Oct 16 20:52:45 2009 New Revision: 198175 URL: http://svn.freebsd.org/changeset/base/198175 Log: - If lstat()/stat() fails with an error other than ENOENT, don't ignore the error and assume that the file doesn't exist. Touch could return success with -c option even if the file existed and time was not set. - If the first utimes_f() call fails with -A option, give up and don't continue trying to set times to current time. [1] - Set exit status to 1 when setting of timestamps fails for a directory or symbolic link even though lstat()/stat() would succeed. - Don't print bogus error message when rw() succeeds. PR: bin/112213 Submitted by: jilles [1] Reviewed by: jilles Approved by: trasz (mentor) Modified: head/usr.bin/touch/touch.c Modified: head/usr.bin/touch/touch.c ============================================================================== --- head/usr.bin/touch/touch.c Fri Oct 16 19:30:48 2009 (r198174) +++ head/usr.bin/touch/touch.c Fri Oct 16 20:52:45 2009 (r198175) @@ -164,6 +164,11 @@ main(int argc, char *argv[]) for (rval = 0; *argv; ++argv) { /* See if the file exists. */ if (stat_f(*argv, &sb) != 0) { + if (errno != ENOENT) { + rval = 1; + warn("%s", *argv); + continue; + } if (!cflag) { /* Create the file. */ fd = open(*argv, @@ -206,7 +211,7 @@ main(int argc, char *argv[]) continue; /* If the user specified a time, nothing else we can do. */ - if (timeset) { + if (timeset || Aflag) { rval = 1; warn("%s", *argv); continue; @@ -222,11 +227,13 @@ main(int argc, char *argv[]) continue; /* Try reading/writing. */ - if (!S_ISLNK(sb.st_mode) && !S_ISDIR(sb.st_mode) && - rw(*argv, &sb, fflag)) + if (!S_ISLNK(sb.st_mode) && !S_ISDIR(sb.st_mode)) { + if (rw(*argv, &sb, fflag)) + rval = 1; + } else { rval = 1; - else warn("%s", *argv); + } } exit(rval); } From peterjeremy at acm.org Fri Oct 16 23:32:38 2009 From: peterjeremy at acm.org (Peter Jeremy) Date: Fri Oct 16 23:32:44 2009 Subject: svn commit: r198134 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/i386/include sys/kern sys/sys In-Reply-To: <200910151454.n9FEsZCr076621@svn.freebsd.org> References: <200910151454.n9FEsZCr076621@svn.freebsd.org> Message-ID: <20091016213858.GA38569@server.vk2pj.dyndns.org> On 2009-Oct-15 14:54:35 +0000, John Baldwin wrote: > Add a facility for associating optional descriptions with active interrupt > handlers. This is primarily intended as a way to allow devices that use > multiple interrupts (e.g. MSI) to meaningfully distinguish the various > interrupt handlers. This appears to be the cause of my latest non-SMP i386 build breaking. (And by code inspection, amd64 is similarly broken). The problem is that the intr_describe() definitions are inside (large) #ifdef SMP blocks, whilst the reference is not similarly protected. code inspection) -- Peter Jeremy -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091016/9e08da93/attachment.pgp From neel at FreeBSD.org Sat Oct 17 00:33:56 2009 From: neel at FreeBSD.org (Neel Natu) Date: Sat Oct 17 00:34:08 2009 Subject: svn commit: r198183 - head/share/misc Message-ID: <200910170033.n9H0Xtl4018713@svn.freebsd.org> Author: neel Date: Sat Oct 17 00:33:55 2009 New Revision: 198183 URL: http://svn.freebsd.org/changeset/base/198183 Log: Add myself. Approved by: imp (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Sat Oct 17 00:22:07 2009 (r198182) +++ head/share/misc/committers-src.dot Sat Oct 17 00:33:55 2009 (r198183) @@ -138,6 +138,7 @@ mjacob [label="Matt Jacob\nmjacob@FreeBS mlaier [label="Max Laier\nmlaier@FreeBSD.org\n2004/02/10"] mr [label="Michael Reifenberger\nmr@FreeBSD.org\n2001/09/30"] murray [label="Murray Stokely\nmurray@FreeBSD.org\n2000/04/05"] +neel [label="Neel Natu\nneel@FreeBSD.org\n2009/09/20"] netchild [label="Alexander Leidinger\nnetchild@FreeBSD.org\n2005/03/31"] njl [label="Nate Lawson\nnjl@FreeBSD.org\n2002/08/07"] nork [label="Norikatsu Shigemura\nnork@FreeBSD.org\n2009/06/09"] @@ -289,6 +290,7 @@ imp -> jon imp -> keichii imp -> mb imp -> mr +imp -> neel imp -> non imp -> nork imp -> onoe From ed at FreeBSD.org Sat Oct 17 08:59:42 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sat Oct 17 08:59:54 2009 Subject: svn commit: r198185 - head/sys/kern Message-ID: <200910170859.n9H8xf7X028023@svn.freebsd.org> Author: ed Date: Sat Oct 17 08:59:41 2009 New Revision: 198185 URL: http://svn.freebsd.org/changeset/base/198185 Log: Print backspaces after echoing an EOF. Applications like shells expect EOF to give no graphical output, while our implementation prints ^D by default (tunable with stty echoctl). Make the new implementation behave like the old TTY code. Print two backspaces afterwards. Reported by: koitsu MFC after: 1 month Modified: head/sys/kern/tty_ttydisc.c Modified: head/sys/kern/tty_ttydisc.c ============================================================================== --- head/sys/kern/tty_ttydisc.c Sat Oct 17 08:58:01 2009 (r198184) +++ head/sys/kern/tty_ttydisc.c Sat Oct 17 08:59:41 2009 (r198185) @@ -624,15 +624,21 @@ ttydisc_echo_force(struct tty *tp, char /* * Only use ^X notation when ECHOCTL is turned on and * we've got an quoted control character. + * + * Print backspaces when echoing an end-of-file. */ - char ob[2] = { '^', '?' }; + char ob[4] = "^?\b\b"; /* Print ^X notation. */ if (c != 0x7f) ob[1] = c + 'A' - 1; - tp->t_column += 2; - return ttyoutq_write_nofrag(&tp->t_outq, ob, 2); + if (!quote && CMP_CC(VEOF, c)) { + return ttyoutq_write_nofrag(&tp->t_outq, ob, 4); + } else { + tp->t_column += 2; + return ttyoutq_write_nofrag(&tp->t_outq, ob, 2); + } } else { /* Can just be printed. */ tp->t_column++; From jhb at freebsd.org Sat Oct 17 15:05:46 2009 From: jhb at freebsd.org (John Baldwin) Date: Sat Oct 17 15:06:25 2009 Subject: svn commit: r198134 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/i386/include sys/kern sys/sys In-Reply-To: <20091016213858.GA38569@server.vk2pj.dyndns.org> References: <200910151454.n9FEsZCr076621@svn.freebsd.org> <20091016213858.GA38569@server.vk2pj.dyndns.org> Message-ID: <200910171100.59915.jhb@freebsd.org> On Friday 16 October 2009 05:38:58 pm Peter Jeremy wrote: > On 2009-Oct-15 14:54:35 +0000, John Baldwin wrote: > > Add a facility for associating optional descriptions with active > > interrupt handlers. This is primarily intended as a way to allow devices > > that use multiple interrupts (e.g. MSI) to meaningfully distinguish the > > various interrupt handlers. > > This appears to be the cause of my latest non-SMP i386 build breaking. > (And by code inspection, amd64 is similarly broken). > > The problem is that the intr_describe() definitions are inside (large) > #ifdef SMP blocks, whilst the reference is not similarly protected. > code inspection) I believe kib@ fixed this yesterday already? -- John Baldwin From ume at FreeBSD.org Sat Oct 17 15:53:16 2009 From: ume at FreeBSD.org (Hajimu UMEMOTO) Date: Sat Oct 17 15:53:22 2009 Subject: svn commit: r198189 - head/bin/csh Message-ID: <200910171553.n9HFrFCf045488@svn.freebsd.org> Author: ume Date: Sat Oct 17 15:53:15 2009 New Revision: 198189 URL: http://svn.freebsd.org/changeset/base/198189 Log: Check error of dlfunc(3). MFC after: 3 days Modified: head/bin/csh/iconv_stub.c Modified: head/bin/csh/iconv_stub.c ============================================================================== --- head/bin/csh/iconv_stub.c Sat Oct 17 13:42:23 2009 (r198188) +++ head/bin/csh/iconv_stub.c Sat Oct 17 15:53:15 2009 (r198189) @@ -61,9 +61,20 @@ dl_iconv_open(const char *tocode, const if (iconvlib == NULL) return (iconv_t)-1; iconv_open = (iconv_open_t *)dlfunc(iconvlib, ICONV_OPEN); + if (iconv_open == NULL) + goto dlfunc_err; dl_iconv = (dl_iconv_t *)dlfunc(iconvlib, ICONV_ENGINE); + if (dl_iconv == NULL) + goto dlfunc_err; dl_iconv_close = (dl_iconv_close_t *)dlfunc(iconvlib, ICONV_CLOSE); + if (dl_iconv_close == NULL) + goto dlfunc_err; } return iconv_open(tocode, fromcode); + +dlfunc_err: + dlclose(iconvlib); + iconvlib = NULL; + return (iconv_t)-1; } From dougb at FreeBSD.org Sat Oct 17 21:09:15 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sat Oct 17 21:09:27 2009 Subject: svn commit: r198190 - head/etc/rc.d Message-ID: <200910172109.n9HL9FEE051034@svn.freebsd.org> Author: dougb Date: Sat Oct 17 21:09:15 2009 New Revision: 198190 URL: http://svn.freebsd.org/changeset/base/198190 Log: Remove a circular dependency on routing Submitted by: Mykola Dzham Approved by: hrs Modified: head/etc/rc.d/faith head/etc/rc.d/stf Modified: head/etc/rc.d/faith ============================================================================== --- head/etc/rc.d/faith Sat Oct 17 15:53:15 2009 (r198189) +++ head/etc/rc.d/faith Sat Oct 17 21:09:15 2009 (r198190) @@ -3,7 +3,7 @@ # # PROVIDE: faith -# REQUIRE: netif routing +# REQUIRE: netif # KEYWORD: nojail . /etc/rc.subr Modified: head/etc/rc.d/stf ============================================================================== --- head/etc/rc.d/stf Sat Oct 17 15:53:15 2009 (r198189) +++ head/etc/rc.d/stf Sat Oct 17 21:09:15 2009 (r198190) @@ -3,7 +3,7 @@ # # PROVIDE: stf -# REQUIRE: netif routing +# REQUIRE: netif # KEYWORD: nojail . /etc/rc.subr From peterjeremy at acm.org Sat Oct 17 22:11:22 2009 From: peterjeremy at acm.org (Peter Jeremy) Date: Sat Oct 17 22:11:28 2009 Subject: svn commit: r198134 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/i386/include sys/kern sys/sys In-Reply-To: <200910171100.59915.jhb@freebsd.org> References: <200910151454.n9FEsZCr076621@svn.freebsd.org> <20091016213858.GA38569@server.vk2pj.dyndns.org> <200910171100.59915.jhb@freebsd.org> Message-ID: <20091017221118.GH38569@server.vk2pj.dyndns.org> On 2009-Oct-17 11:00:59 -0400, John Baldwin wrote: >> The problem is that the intr_describe() definitions are inside (large) >> #ifdef SMP blocks, whilst the reference is not similarly protected. >> code inspection) > >I believe kib@ fixed this yesterday already? Yes, this problem is fixed. The fix was after my source update so I missed it. Sorry for the noise. -- Peter Jeremy -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091017/7f1ee973/attachment.pgp From weongyo at FreeBSD.org Sun Oct 18 00:11:49 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Sun Oct 18 00:12:02 2009 Subject: svn commit: r198194 - head/sys/dev/usb/wlan Message-ID: <200910180011.n9I0Bn0u054468@svn.freebsd.org> Author: weongyo Date: Sun Oct 18 00:11:49 2009 New Revision: 198194 URL: http://svn.freebsd.org/changeset/base/198194 Log: overhauls urtw(4) for supporting RTL8187B devices properly that there was major changes to initialize RF chipset and set H/W registers and removed a lot of magic numbers on code. Details are as follows: - uses the endpoint 0x89 to get TX status information which used to get TX complete or retry numbers or get a beacon interrupt. It's only valuable for RTL8187B. - removes urtw_write[8|16|32]_i functions that it's useless now. - uses ic->ic_updateslot to set SLOT, SIFS, DIES, EIFS, CW_VAL registers that doesn't set these whenever the channel is changed. - code for initializing RF chipset for RTL8187B changed a lot that there was many problems on TX transfers so it doesn't work properly even if just for a ping/pong. Now it becomes more stable than before that TX throughputs using netperf(1) were about 15 ~ 17Mbps/s though sometimes it encounters packet losses. - removes a lot of magic numbers that in the previous all of representing RX and TX descriptors were consisted of magic numbers and structures. It'd be more readable rather than before. - calculates TX duration more accurately for urtw(4) devices. - style(9) Modified: head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_urtwreg.h head/sys/dev/usb/wlan/if_urtwvar.h Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Sat Oct 17 23:04:04 2009 (r198193) +++ head/sys/dev/usb/wlan/if_urtw.c Sun Oct 18 00:11:49 2009 (r198194) @@ -76,6 +76,7 @@ enum { URTW_DEBUG_STATE = 0x00000020, /* 802.11 state transitions */ URTW_DEBUG_STAT = 0x00000040, /* statistic */ URTW_DEBUG_INIT = 0x00000080, /* initialization of dev */ + URTW_DEBUG_TXSTATUS = 0x00000100, /* tx status */ URTW_DEBUG_ANY = 0xffffffff }; #define DPRINTF(sc, m, fmt, ...) do { \ @@ -326,13 +327,47 @@ static struct urtw_pair urtw_8225v2_rf_p { 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 } }; -static struct urtw_pair urtw_8225v2b_rf_part1[] = { +static struct urtw_pair urtw_8225v2b_rf_part0[] = { { 0x00, 0x00b7 }, { 0x01, 0x0ee0 }, { 0x02, 0x044d }, { 0x03, 0x0441 }, { 0x04, 0x08c3 }, { 0x05, 0x0c72 }, { 0x06, 0x00e6 }, { 0x07, 0x082a }, { 0x08, 0x003f }, { 0x09, 0x0335 }, { 0x0a, 0x09d4 }, { 0x0b, 0x07bb }, { 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 } }; +static struct urtw_pair urtw_8225v2b_rf_part1[] = { + {0x0f0, 0x32}, {0x0f1, 0x32}, {0x0f2, 0x00}, + {0x0f3, 0x00}, {0x0f4, 0x32}, {0x0f5, 0x43}, + {0x0f6, 0x00}, {0x0f7, 0x00}, {0x0f8, 0x46}, + {0x0f9, 0xa4}, {0x0fa, 0x00}, {0x0fb, 0x00}, + {0x0fc, 0x96}, {0x0fd, 0xa4}, {0x0fe, 0x00}, + {0x0ff, 0x00}, {0x158, 0x4b}, {0x159, 0x00}, + {0x15a, 0x4b}, {0x15b, 0x00}, {0x160, 0x4b}, + {0x161, 0x09}, {0x162, 0x4b}, {0x163, 0x09}, + {0x1ce, 0x0f}, {0x1cf, 0x00}, {0x1e0, 0xff}, + {0x1e1, 0x0f}, {0x1e2, 0x00}, {0x1f0, 0x4e}, + {0x1f1, 0x01}, {0x1f2, 0x02}, {0x1f3, 0x03}, + {0x1f4, 0x04}, {0x1f5, 0x05}, {0x1f6, 0x06}, + {0x1f7, 0x07}, {0x1f8, 0x08}, {0x24e, 0x00}, + {0x20c, 0x04}, {0x221, 0x61}, {0x222, 0x68}, + {0x223, 0x6f}, {0x224, 0x76}, {0x225, 0x7d}, + {0x226, 0x84}, {0x227, 0x8d}, {0x24d, 0x08}, + {0x250, 0x05}, {0x251, 0xf5}, {0x252, 0x04}, + {0x253, 0xa0}, {0x254, 0x1f}, {0x255, 0x23}, + {0x256, 0x45}, {0x257, 0x67}, {0x258, 0x08}, + {0x259, 0x08}, {0x25a, 0x08}, {0x25b, 0x08}, + {0x260, 0x08}, {0x261, 0x08}, {0x262, 0x08}, + {0x263, 0x08}, {0x264, 0xcf}, {0x272, 0x56}, + {0x273, 0x9a}, {0x034, 0xf0}, {0x035, 0x0f}, + {0x05b, 0x40}, {0x084, 0x88}, {0x085, 0x24}, + {0x088, 0x54}, {0x08b, 0xb8}, {0x08c, 0x07}, + {0x08d, 0x00}, {0x094, 0x1b}, {0x095, 0x12}, + {0x096, 0x00}, {0x097, 0x06}, {0x09d, 0x1a}, + {0x09f, 0x10}, {0x0b4, 0x22}, {0x0be, 0x80}, + {0x0db, 0x00}, {0x0ee, 0x00}, {0x091, 0x03}, + {0x24c, 0x00}, {0x39f, 0x00}, {0x08c, 0x01}, + {0x08d, 0x10}, {0x08e, 0x08}, {0x08f, 0x00} +}; + static struct urtw_pair urtw_8225v2_rf_part2[] = { { 0x00, 0x01 }, { 0x01, 0x02 }, { 0x02, 0x42 }, { 0x03, 0x00 }, { 0x04, 0x00 }, { 0x05, 0x00 }, { 0x06, 0x40 }, { 0x07, 0x00 }, @@ -478,6 +513,7 @@ static const uint8_t urtw_8187b_reg_tabl static usb_callback_t urtw_bulk_rx_callback; static usb_callback_t urtw_bulk_tx_callback; +static usb_callback_t urtw_bulk_tx_status_callback; static const struct usb_config urtw_8187b_usbconfig[URTW_8187B_N_XFERS] = { [URTW_8187B_BULK_RX] = { @@ -492,6 +528,18 @@ static const struct usb_config urtw_8187 }, .callback = urtw_bulk_rx_callback }, + [URTW_8187B_BULK_TX_STATUS] = { + .type = UE_BULK, + .endpoint = 0x89, + .direction = UE_DIR_IN, + .bufsize = MCLBYTES, + .flags = { + .ext_buffer = 1, + .pipe_bof = 1, + .short_xfer_ok = 1 + }, + .callback = urtw_bulk_tx_status_callback + }, [URTW_8187B_BULK_TX_BE] = { .type = UE_BULK, .endpoint = URTW_8187B_TXPIPE_BE, @@ -703,9 +751,6 @@ static usb_error_t urtw_adapter_start(st static usb_error_t urtw_adapter_start_b(struct urtw_softc *); static usb_error_t urtw_set_mode(struct urtw_softc *, uint32_t); static usb_error_t urtw_8187b_cmd_reset(struct urtw_softc *); -static usb_error_t urtw_write16_i(struct urtw_softc *, int, uint16_t, int); -static usb_error_t urtw_write8_i(struct urtw_softc *, int, uint8_t, int); -static usb_error_t urtw_write32_i(struct urtw_softc *, int, uint32_t, int); static usb_error_t urtw_do_request(struct urtw_softc *, struct usb_device_request *, void *); static usb_error_t urtw_8225v2b_set_txpwrlvl(struct urtw_softc *, int); @@ -713,6 +758,10 @@ static usb_error_t urtw_led_off(struct u static void urtw_abort_xfers(struct urtw_softc *); static struct urtw_data * urtw_getbuf(struct urtw_softc *sc); +static int urtw_compute_txtime(uint16_t, uint16_t, uint8_t, + uint8_t); +static void urtw_updateslot(struct ifnet *); +static void urtw_updateslottask(void *, int); static int urtw_match(device_t dev) @@ -757,6 +806,7 @@ urtw_attach(device_t dev) MTX_DEF); usb_callout_init_mtx(&sc->sc_led_ch, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_led_task, 0, urtw_ledtask, sc); + TASK_INIT(&sc->sc_updateslot_task, 0, urtw_updateslottask, sc); callout_init(&sc->sc_watchdog_ch, 0); if (sc->sc_flags & URTW_RTL8187B) { @@ -845,7 +895,7 @@ urtw_attach(device_t dev) ic->ic_scan_start = urtw_scan_start; ic->ic_scan_end = urtw_scan_end; ic->ic_set_channel = urtw_set_channel; - + ic->ic_updateslot = urtw_updateslot; ic->ic_vap_create = urtw_vap_create; ic->ic_vap_delete = urtw_vap_delete; ic->ic_update_mcast = urtw_update_mcast; @@ -878,6 +928,7 @@ urtw_detach(device_t dev) return (0); urtw_stop(ifp, 1); + ieee80211_draintask(ic, &sc->sc_updateslot_task); ieee80211_draintask(ic, &sc->sc_led_task); usb_callout_drain(&sc->sc_led_ch); @@ -1014,6 +1065,9 @@ urtw_init_locked(void *arg) if (error != 0) goto fail; + if (sc->sc_flags & URTW_RTL8187B) + usbd_transfer_start(sc->sc_xfer[URTW_8187B_BULK_TX_STATUS]); + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -1036,7 +1090,6 @@ static usb_error_t urtw_adapter_start_b(struct urtw_softc *sc) { #define N(a) (sizeof(a) / sizeof((a)[0])) - int i; uint8_t data8; usb_error_t error; @@ -1068,81 +1121,12 @@ urtw_adapter_start_b(struct urtw_softc * if (error) goto fail; - urtw_write16_m(sc, 0x2d, 0xfff); - urtw_read8_m(sc, URTW_CW_CONF, &data8); - urtw_write8_m(sc, URTW_CW_CONF, data8 | URTW_CW_CONF_PERPACKET_RETRY); - urtw_read8_m(sc, URTW_TX_AGC_CTL, &data8); - data8 |= URTW_TX_AGC_CTL_PERPACKET_GAIN | - URTW_TX_AGC_CTL_PERPACKET_ANTSEL; - urtw_write8_m(sc, URTW_TX_AGC_CTL, data8); - - error = urtw_write16_i(sc, 0xe0, 0xfff, 1); - if (error) - goto fail; - - urtw_read8_m(sc, URTW_RATE_FALLBACK, &data8); - urtw_write8_m(sc, URTW_RATE_FALLBACK, data8 | URTW_RATE_FALLBACK_ENABLE); - - urtw_write16_m(sc, URTW_ATIM_WND, 2); - urtw_write16_m(sc, URTW_BEACON_INTERVAL, 100); - error = urtw_write16_i(sc, 0xd4, 0xffff, 1); - if (error) - goto fail; - - error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); - if (error) - goto fail; - urtw_read8_m(sc, URTW_CONFIG1, &data8); - urtw_write8_m(sc, URTW_CONFIG1, (data8 & 0x3f) | 0x80); - error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); - if (error) - goto fail; - - urtw_write8_m(sc, URTW_WPA_CONFIG, 0); - for (i = 0; i < N(urtw_8187b_reg_table); i++) { - error = urtw_write8_i(sc, urtw_8187b_reg_table[i][0], - urtw_8187b_reg_table[i][1], urtw_8187b_reg_table[i][2]); - if (error) - goto fail; - } - - urtw_write16_m(sc, URTW_TID_AC_MAP, 0xfa50); - urtw_write16_m(sc, URTW_INT_MIG, 0); - - error = urtw_write32_i(sc, 0xf0, 0, 1); - if (error) - goto fail; - error = urtw_write32_i(sc, 0xf4, 0, 1); - if (error) - goto fail; - error = urtw_write8_i(sc, 0xf8, 0, 1); - if (error) - goto fail; - - urtw_write32_m(sc, URTW_RF_TIMING, 0x00004001); - - error = urtw_write16_i(sc, 0x72, 0x569a, 2); - if (error) - goto fail; - - error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); - if (error) - goto fail; - urtw_read8_m(sc, URTW_CONFIG3, &data8); - urtw_write8_m(sc, URTW_CONFIG3, data8 | URTW_CONFIG3_ANAPARAM_WRITE); - error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); - if (error) - goto fail; - - urtw_write16_m(sc, URTW_RF_PINS_OUTPUT, 0x0480); - urtw_write16_m(sc, URTW_RF_PINS_SELECT, 0x2488); - urtw_write16_m(sc, URTW_RF_PINS_ENABLE, 0x1fff); - usb_pause_mtx(&sc->sc_mtx, 100); - error = sc->sc_rf_init(sc); if (error != 0) goto fail; + urtw_write8_m(sc, URTW_CMD, URTW_CMD_RX_ENABLE | URTW_CMD_TX_ENABLE); + /* fix RTL8187B RX stall */ error = urtw_intr_enable(sc); if (error) goto fail; @@ -1171,42 +1155,21 @@ urtw_adapter_start_b(struct urtw_softc * urtw_read8_m(sc, 0xdb, &data8); urtw_write8_m(sc, 0xdb, data8 | (1 << 2)); - error = urtw_write16_i(sc, 0x72, 0x59fa, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x74, 0x59d2, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x76, 0x59d2, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x78, 0x19fa, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x7a, 0x19fa, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x7c, 0x00d0, 3); - if (error) - goto fail; + urtw_write16_m(sc, 0x372, 0x59fa); + urtw_write16_m(sc, 0x374, 0x59d2); + urtw_write16_m(sc, 0x376, 0x59d2); + urtw_write16_m(sc, 0x378, 0x19fa); + urtw_write16_m(sc, 0x37a, 0x19fa); + urtw_write16_m(sc, 0x37c, 0x00d0); urtw_write8_m(sc, 0x61, 0); - error = urtw_write8_i(sc, 0x80, 0x0f, 1); - if (error) - goto fail; - error = urtw_write8_i(sc, 0x83, 0x03, 1); - if (error) - goto fail; - urtw_write8_m(sc, 0xda, 0x10); - error = urtw_write8_i(sc, 0x4d, 0x08, 2); - if (error) - goto fail; - - urtw_write32_m(sc, URTW_HSSI_PARA, 0x0600321B); - error = urtw_write16_i(sc, 0xec, 0x800, 1); - if (error) - goto fail; + urtw_write8_m(sc, 0x180, 0x0f); + urtw_write8_m(sc, 0x183, 0x03); + urtw_write8_m(sc, 0xda, 0x10); + urtw_write8_m(sc, 0x24d, 0x08); + urtw_write32_m(sc, URTW_HSSI_PARA, 0x0600321b); + urtw_write16_m(sc, 0x1ec, 0x800); /* RX MAX SIZE */ fail: return (error); #undef N @@ -1310,41 +1273,11 @@ urtw_8187b_cmd_reset(struct urtw_softc * device_printf(sc->sc_dev, "reset timeout\n"); goto fail; } - - error = urtw_set_mode(sc, URTW_EPROM_CMD_LOAD); - if (error) - goto fail; - - for (i = 0; i < 20; i++) { - usb_pause_mtx(&sc->sc_mtx, 4); - urtw_read8_m(sc, URTW_EPROM_CMD, &data8); - if (!(data8 & URTW_EPROM_CMD_CONFIG)) - break; - } - if (i >= 20) { - device_printf(sc->sc_dev, "eeprom reset timeout\n"); - goto fail; - } - fail: return (error); } static usb_error_t -urtw_write16_i(struct urtw_softc *sc, int val, uint16_t data, int idx) -{ - struct usb_device_request req; - - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, idx & 0x3); - USETW(req.wLength, sizeof(uint16_t)); - - return (urtw_do_request(sc, &req, &data)); -} - -static usb_error_t urtw_do_request(struct urtw_softc *sc, struct usb_device_request *req, void *data) { @@ -1367,34 +1300,6 @@ urtw_do_request(struct urtw_softc *sc, return (err); } -static usb_error_t -urtw_write8_i(struct urtw_softc *sc, int val, uint8_t data, int idx) -{ - struct usb_device_request req; - - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, idx & 0x3); - USETW(req.wLength, sizeof(uint8_t)); - - return (urtw_do_request(sc, &req, &data)); -} - -static usb_error_t -urtw_write32_i(struct urtw_softc *sc, int val, uint32_t data, int idx) -{ - struct usb_device_request req; - - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, idx & 0x3); - USETW(req.wLength, sizeof(uint32_t)); - - return (urtw_do_request(sc, &req, &data)); -} - static void urtw_stop_locked(struct ifnet *ifp, int disable) { @@ -1534,6 +1439,7 @@ urtw_start(struct ifnet *ifp) } sc->sc_txtimer = 5; + callout_reset(&sc->sc_watchdog_ch, hz, urtw_watchdog, sc); } URTW_UNLOCK(sc); } @@ -1733,14 +1639,12 @@ static int urtw_tx_start(struct urtw_softc *sc, struct ieee80211_node *ni, struct mbuf *m0, struct urtw_data *data, int prior) { - int xferlen; struct ifnet *ifp = sc->sc_ifp; struct ieee80211_frame *wh = mtod(m0, struct ieee80211_frame *); struct ieee80211_key *k; const struct ieee80211_txparam *tp; struct ieee80211com *ic = ifp->if_l2com; struct ieee80211vap *vap = ni->ni_vap; - struct urtw_8187b_txhdr *hdr; struct usb_xfer *rtl8187b_pipes[URTW_8187B_TXPIPE_MAX] = { sc->sc_xfer[URTW_8187B_BULK_TX_BE], sc->sc_xfer[URTW_8187B_BULK_TX_BK], @@ -1748,6 +1652,10 @@ urtw_tx_start(struct urtw_softc *sc, str sc->sc_xfer[URTW_8187B_BULK_TX_VO] }; struct usb_xfer *xfer; + int dur = 0, rtsdur = 0, rtsenable = 0, ctsenable = 0, rate, + pkttime = 0, txdur = 0, isshort = 0, xferlen; + uint16_t acktime, rtstime, ctstime; + uint32_t flags; usb_error_t error; URTW_ASSERT_LOCKED(sc); @@ -1780,60 +1688,107 @@ urtw_tx_start(struct urtw_softc *sc, str ieee80211_radiotap_tx(vap, m0); } + if ((wh->i_fc[10] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT || + (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) { + tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; + rate = tp->mgmtrate; + } else { + tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; + /* for data frames */ + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) + rate = tp->mcastrate; + else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) + rate = tp->ucastrate; + else + rate = urtw_rtl2rate(sc->sc_currate); + } + + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) + txdur = pkttime = urtw_compute_txtime(m0->m_pkthdr.len + + IEEE80211_CRC_LEN, rate, 0, 0); + else { + acktime = urtw_compute_txtime(14, 2,0, 0); + if ((m0->m_pkthdr.len + 4) > vap->iv_rtsthreshold) { + rtsenable = 1; + ctsenable = 0; + rtstime = urtw_compute_txtime(URTW_ACKCTS_LEN, 2, 0, 0); + ctstime = urtw_compute_txtime(14, 2, 0, 0); + pkttime = urtw_compute_txtime(m0->m_pkthdr.len + + IEEE80211_CRC_LEN, rate, 0, isshort); + rtsdur = ctstime + pkttime + acktime + + 3 * URTW_ASIFS_TIME; + txdur = rtstime + rtsdur; + } else { + rtsenable = ctsenable = rtsdur = 0; + pkttime = urtw_compute_txtime(m0->m_pkthdr.len + + IEEE80211_CRC_LEN, rate, 0, isshort); + txdur = pkttime + URTW_ASIFS_TIME + acktime; + } + + if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG) + dur = urtw_compute_txtime(m0->m_pkthdr.len + + IEEE80211_CRC_LEN, rate, 0, isshort) + + 3 * URTW_ASIFS_TIME + + 2 * acktime; + else + dur = URTW_ASIFS_TIME + acktime; + } + *(uint16_t *)wh->i_dur = htole16(dur); + xferlen = m0->m_pkthdr.len; xferlen += (sc->sc_flags & URTW_RTL8187B) ? (4 * 8) : (4 * 3); if ((0 == xferlen % 64) || (0 == xferlen % 512)) xferlen += 1; bzero(data->buf, URTW_TX_MAXSIZE); - data->buf[0] = m0->m_pkthdr.len & 0xff; - data->buf[1] = (m0->m_pkthdr.len & 0x0f00) >> 8; - data->buf[1] |= (1 << 7); - + flags = m0->m_pkthdr.len & 0xfff; + flags |= URTW_TX_FLAG_NO_ENC; if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) && (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE) && (sc->sc_preamble_mode == URTW_PREAMBLE_MODE_SHORT) && (sc->sc_currate != 0)) - data->buf[2] |= 1; - if ((m0->m_pkthdr.len > vap->iv_rtsthreshold) && - prior == URTW_PRIORITY_LOW) { - device_printf(sc->sc_dev, "TODO tx.\n"); - return (EIO); - } + flags |= URTW_TX_FLAG_SPLCP; if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG) - data->buf[2] |= (1 << 1); - /* RTS rate - 10 means we use a basic rate. */ - data->buf[2] |= (urtw_rate2rtl(2) << 3); - /* - * XXX currently TX rate control depends on the rate value of - * RX descriptor because I don't know how to we can control TX rate - * in more smart way. Please fix me you find a thing. - */ - data->buf[3] = sc->sc_currate; - if (prior == URTW_PRIORITY_NORMAL) { - tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; - if (IEEE80211_IS_MULTICAST(wh->i_addr1)) - data->buf[3] = urtw_rate2rtl(tp->mcastrate); - else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) - data->buf[3] = urtw_rate2rtl(tp->ucastrate); - } + flags |= URTW_TX_FLAG_MOREFRAG; + + flags |= (sc->sc_currate & 0xf) << URTW_TX_FLAG_TXRATE_SHIFT; if (sc->sc_flags & URTW_RTL8187B) { - hdr = (struct urtw_8187b_txhdr *)data->buf; - hdr->rts_duration = 0; - hdr->len = 0; - hdr->retry = 3 | (7 << 4) | 11; - hdr->tx_duration = ieee80211_compute_duration(ic->ic_rt, - m0->m_pkthdr.len + IEEE80211_CRC_LEN, - urtw_rtl2rate(data->buf[3]), - (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0); - /* XXX MUST fill another variables like rts_duration, tx_.. */ - m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)&data->buf[32]); + struct urtw_8187b_txhdr *tx; + + tx = (struct urtw_8187b_txhdr *)data->buf; + if (ctsenable) + flags |= URTW_TX_FLAG_CTS; + if (rtsenable) { + flags |= URTW_TX_FLAG_RTS; + flags |= (urtw_rate2rtl(11) & 0xf) << + URTW_TX_FLAG_RTSRATE_SHIFT; + tx->rtsdur = rtsdur; + } + tx->flag = htole32(flags); + tx->txdur = txdur; + if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == + IEEE80211_FC0_TYPE_MGT && + (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == + IEEE80211_FC0_SUBTYPE_PROBE_RESP) + tx->retry = 1; + else + tx->retry = URTW_TX_MAXRETRY; + m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(tx + 1)); } else { - data->buf[8] = 3; /* CW minimum */ - data->buf[8] |= (7 << 4); /* CW maximum */ - data->buf[9] |= 11; /* retry limitation */ - m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)&data->buf[12]); + struct urtw_8187l_txhdr *tx; + + tx = (struct urtw_8187l_txhdr *)data->buf; + if (rtsenable) { + flags |= URTW_TX_FLAG_RTS; + tx->rtsdur = rtsdur; + } + flags |= (urtw_rate2rtl(11) & 0xf) << URTW_TX_FLAG_RTSRATE_SHIFT; + tx->flag = htole32(flags); + tx->retry = 3; /* CW minimum */ + tx->retry = 7 << 4; /* CW maximum */ + tx->retry = URTW_TX_MAXRETRY << 8; /* retry limitation */ + m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(tx + 1)); } data->buflen = xferlen; @@ -2054,8 +2009,8 @@ urtw_read8_c(struct urtw_softc *sc, int req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = URTW_8187_GETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint8_t)); error = urtw_do_request(sc, &req, data); @@ -2072,8 +2027,8 @@ urtw_read16_c(struct urtw_softc *sc, int req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = URTW_8187_GETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint16_t)); error = urtw_do_request(sc, &req, data); @@ -2090,8 +2045,8 @@ urtw_read32_c(struct urtw_softc *sc, int req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = URTW_8187_GETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint32_t)); error = urtw_do_request(sc, &req, data); @@ -2107,8 +2062,8 @@ urtw_write8_c(struct urtw_softc *sc, int req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint8_t)); return (urtw_do_request(sc, &req, &data)); @@ -2123,8 +2078,8 @@ urtw_write16_c(struct urtw_softc *sc, in req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint16_t)); return (urtw_do_request(sc, &req, &data)); @@ -2139,8 +2094,8 @@ urtw_write32_c(struct urtw_softc *sc, in req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint32_t)); return (urtw_do_request(sc, &req, &data)); @@ -2404,6 +2359,38 @@ urtw_get_rfchip(struct urtw_softc *sc) uint32_t data; usb_error_t error; + if (sc->sc_flags & URTW_RTL8187B) { + urtw_read8_m(sc, 0xe1, &data8); + switch (data8) { + case 0: + sc->sc_flags |= URTW_RTL8187B_REV_B; + break; + case 1: + sc->sc_flags |= URTW_RTL8187B_REV_D; + break; + case 2: + sc->sc_flags |= URTW_RTL8187B_REV_E; + break; + default: + device_printf(sc->sc_dev, "unknown type: %#x\n", data8); + sc->sc_flags |= URTW_RTL8187B_REV_B; + break; + } + } else { + urtw_read32_m(sc, URTW_TX_CONF, &data); + switch (data & URTW_TX_HWMASK) { + case URTW_TX_R8187vD_B: + sc->sc_flags |= URTW_RTL8187B; + break; + case URTW_TX_R8187vD: + break; + default: + device_printf(sc->sc_dev, "unknown RTL8187L type: %#x\n", + data & URTW_TX_HWMASK); + break; + } + } + error = urtw_eprom_read32(sc, URTW_EPROM_RFCHIPID, &data); if (error != 0) goto fail; @@ -2437,12 +2424,6 @@ urtw_get_rfchip(struct urtw_softc *sc) /* never reach */ } - if (sc->sc_flags & URTW_RTL8187B) { - urtw_read8_m(sc, 0xe1, &data8); - sc->sc_flags |= (data8 == 0) ? URTW_RTL8187B_REV_B : - (data8 == 1) ? URTW_RTL8187B_REV_D : URTW_RTL8187B_REV_E; - } - device_printf(sc->sc_dev, "%s rf %s hwrev %s\n", (sc->sc_flags & URTW_RTL8187B) ? "rtl8187b" : "rtl8187l", ((data & 0xff) == URTW_EPROM_RFCHIPID_RTL8225U) ? "rtl8225u" : @@ -2762,8 +2743,6 @@ fail0: return (error); static usb_error_t urtw_8225_rf_set_chan(struct urtw_softc *sc, int chan) { - struct ieee80211com *ic = sc->sc_ifp->if_l2com; - struct ieee80211_channel *c = ic->ic_curchan; usb_error_t error; error = urtw_8225_set_txpwrlvl(sc, chan); @@ -2771,27 +2750,6 @@ urtw_8225_rf_set_chan(struct urtw_softc goto fail; urtw_8225_write(sc, URTW_8225_ADDR_7_MAGIC, urtw_8225_channel[chan]); usb_pause_mtx(&sc->sc_mtx, 10); - - urtw_write8_m(sc, URTW_SIFS, 0x22); - - if (sc->sc_state == IEEE80211_S_ASSOC && - ic->ic_flags & IEEE80211_F_SHSLOT) - urtw_write8_m(sc, URTW_SLOT, 0x9); - else - urtw_write8_m(sc, URTW_SLOT, 0x14); - - if (IEEE80211_IS_CHAN_G(c)) { - /* for G */ - urtw_write8_m(sc, URTW_DIFS, 0x14); - urtw_write8_m(sc, URTW_EIFS, 0x5b - 0x14); - urtw_write8_m(sc, URTW_CW_VAL, 0x73); - } else { - /* for B */ - urtw_write8_m(sc, URTW_DIFS, 0x24); - urtw_write8_m(sc, URTW_EIFS, 0x5b - 0x24); - urtw_write8_m(sc, URTW_CW_VAL, 0xa5); - } - fail: return (error); } @@ -3039,8 +2997,6 @@ fail: static usb_error_t urtw_8225v2_rf_set_chan(struct urtw_softc *sc, int chan) { - struct ieee80211com *ic = sc->sc_ifp->if_l2com; - struct ieee80211_channel *c = ic->ic_curchan; usb_error_t error; error = urtw_8225v2_set_txpwrlvl(sc, chan); @@ -3049,27 +3005,6 @@ urtw_8225v2_rf_set_chan(struct urtw_soft urtw_8225_write(sc, URTW_8225_ADDR_7_MAGIC, urtw_8225_channel[chan]); usb_pause_mtx(&sc->sc_mtx, 10); - - urtw_write8_m(sc, URTW_SIFS, 0x22); - - if(sc->sc_state == IEEE80211_S_ASSOC && - ic->ic_flags & IEEE80211_F_SHSLOT) - urtw_write8_m(sc, URTW_SLOT, 0x9); - else - urtw_write8_m(sc, URTW_SLOT, 0x14); - - if (IEEE80211_IS_CHAN_G(c)) { - /* for G */ - urtw_write8_m(sc, URTW_DIFS, 0x14); - urtw_write8_m(sc, URTW_EIFS, 0x5b - 0x14); - urtw_write8_m(sc, URTW_CW_VAL, 0x73); - } else { - /* for B */ - urtw_write8_m(sc, URTW_DIFS, 0x24); - urtw_write8_m(sc, URTW_EIFS, 0x5b - 0x24); - urtw_write8_m(sc, URTW_CW_VAL, 0xa5); - } - fail: return (error); } @@ -3272,53 +3207,156 @@ urtw_8225v2b_rf_init(struct urtw_softc * { #define N(a) (sizeof(a) / sizeof((a)[0])) int i; + uint8_t data8; usb_error_t error; + error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); + if (error) + goto fail; + + /* + * initialize extra registers on 8187 + */ + urtw_write16_m(sc, URTW_BRSR_8187B, 0xfff); + + /* retry limit */ + urtw_read8_m(sc, URTW_CW_CONF, &data8); + data8 |= URTW_CW_CONF_PERPACKET_RETRY; + urtw_write8_m(sc, URTW_CW_CONF, data8); + + /* TX AGC */ + urtw_read8_m(sc, URTW_TX_AGC_CTL, &data8); + data8 |= URTW_TX_AGC_CTL_PERPACKET_GAIN; + urtw_write8_m(sc, URTW_TX_AGC_CTL, data8); + + /* Auto Rate Fallback Control */ +#define URTW_ARFR 0x1e0 + urtw_write16_m(sc, URTW_ARFR, 0xfff); + urtw_read8_m(sc, URTW_RATE_FALLBACK, &data8); + urtw_write8_m(sc, URTW_RATE_FALLBACK, + data8 | URTW_RATE_FALLBACK_ENABLE); + + urtw_read8_m(sc, URTW_MSR, &data8); + urtw_write8_m(sc, URTW_MSR, data8 & 0xf3); + urtw_read8_m(sc, URTW_MSR, &data8); + urtw_write8_m(sc, URTW_MSR, data8 | URTW_MSR_LINK_ENEDCA); + urtw_write8_m(sc, URTW_ACM_CONTROL, sc->sc_acmctl); + + urtw_write16_m(sc, URTW_ATIM_WND, 2); + urtw_write16_m(sc, URTW_BEACON_INTERVAL, 100); +#define URTW_FEMR_FOR_8187B 0x1d4 + urtw_write16_m(sc, URTW_FEMR_FOR_8187B, 0xffff); + + /* led type */ + urtw_read8_m(sc, URTW_CONFIG1, &data8); + data8 = (data8 & 0x3f) | 0x80; + urtw_write8_m(sc, URTW_CONFIG1, data8); + + /* applying MAC address again. */ + urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)sc->sc_bssid)[0]); + urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)sc->sc_bssid)[1] & 0xffff); + + error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); + if (error) + goto fail; + + urtw_write8_m(sc, URTW_WPA_CONFIG, 0); + + /* + * MAC configuration + */ for (i = 0; i < N(urtw_8225v2b_rf_part1); i++) - urtw_8225_write(sc, urtw_8225v2b_rf_part1[i].reg, + urtw_write8_m(sc, urtw_8225v2b_rf_part1[i].reg, urtw_8225v2b_rf_part1[i].val); + urtw_write16_m(sc, URTW_TID_AC_MAP, 0xfa50); + urtw_write16_m(sc, URTW_INT_MIG, 0x0000); + urtw_write32_m(sc, 0x1f0, 0); + urtw_write32_m(sc, 0x1f4, 0); + urtw_write8_m(sc, 0x1f8, 0); + urtw_write32_m(sc, URTW_RF_TIMING, 0x4001); - urtw_8225_write(sc, - URTW_8225_ADDR_0_MAGIC, URTW_8225_ADDR_0_DATA_MAGIC1); +#define URTW_RFSW_CTRL 0x272 + urtw_write16_m(sc, URTW_RFSW_CTRL, 0x569a); - for (i = 0; i < N(urtw_8225v2b_rxgain); i++) { + /* + * initialize PHY + */ + error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); + if (error) + goto fail; + urtw_read8_m(sc, URTW_CONFIG3, &data8); + urtw_write8_m(sc, URTW_CONFIG3, + data8 | URTW_CONFIG3_ANAPARAM_WRITE); + + error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); + if (error) + goto fail; + + /* setup RFE initial timing */ + urtw_write16_m(sc, URTW_RF_PINS_OUTPUT, 0x0480); + urtw_write16_m(sc, URTW_RF_PINS_SELECT, 0x2488); + urtw_write16_m(sc, URTW_RF_PINS_ENABLE, 0x1fff); + usb_pause_mtx(&sc->sc_mtx, 1100); + + for (i = 0; i < N(urtw_8225v2b_rf_part0); i++) { + urtw_8225_write(sc, urtw_8225v2b_rf_part0[i].reg, + urtw_8225v2b_rf_part0[i].val); + usb_pause_mtx(&sc->sc_mtx, 1); + } + urtw_8225_write(sc, 0x00, 0x01b7); + + for (i = 0; i < 95; i++) { urtw_8225_write(sc, URTW_8225_ADDR_1_MAGIC, (uint8_t)(i + 1)); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_8225_write(sc, URTW_8225_ADDR_2_MAGIC, urtw_8225v2b_rxgain[i]); + usb_pause_mtx(&sc->sc_mtx, 1); } urtw_8225_write(sc, URTW_8225_ADDR_3_MAGIC, 0x080); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_8225_write(sc, URTW_8225_ADDR_5_MAGIC, 0x004); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_8225_write(sc, URTW_8225_ADDR_0_MAGIC, 0x0b7); + usb_pause_mtx(&sc->sc_mtx, 1); + usb_pause_mtx(&sc->sc_mtx, 3000); urtw_8225_write(sc, URTW_8225_ADDR_2_MAGIC, 0xc4d); + usb_pause_mtx(&sc->sc_mtx, 2000); urtw_8225_write(sc, URTW_8225_ADDR_2_MAGIC, 0x44d); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_8225_write(sc, URTW_8225_ADDR_0_MAGIC, 0x2bf); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_write8_m(sc, URTW_TX_GAIN_CCK, 0x03); urtw_write8_m(sc, URTW_TX_GAIN_OFDM, 0x07); urtw_write8_m(sc, URTW_TX_ANTENNA, 0x03); urtw_8187_write_phy_ofdm(sc, 0x80, 0x12); - for (i = 0; i < N(urtw_8225z2_agc); i++) { - urtw_8187_write_phy_ofdm(sc, 0xf, urtw_8225z2_agc[i]); - urtw_8187_write_phy_ofdm(sc, 0xe, 0x80 + i); - urtw_8187_write_phy_ofdm(sc, 0xe, 0); + for (i = 0; i < 128; i++) { + uint32_t addr, data; + + data = (urtw_8225z2_agc[i] << 8) | 0x0000008f; + addr = ((i + 0x80) << 8) | 0x0000008e; + + urtw_8187_write_phy_ofdm(sc, data & 0x7f, (data >> 8) & 0xff); + urtw_8187_write_phy_ofdm(sc, addr & 0x7f, (addr >> 8) & 0xff); + urtw_8187_write_phy_ofdm(sc, 0x0e, 0x00); } urtw_8187_write_phy_ofdm(sc, 0x80, 0x10); for (i = 0; i < N(urtw_8225v2b_rf_part2); i++) urtw_8187_write_phy_ofdm(sc, i, urtw_8225v2b_rf_part2[i].val); - urtw_write32_m(sc, 0xf0, (7 << 12) | (3 << 8) | 0x1c); - urtw_write32_m(sc, 0xf4, (7 << 12) | (3 << 8) | 0x1c); - urtw_write32_m(sc, 0xf8, (7 << 12) | (3 << 8) | 0x1c); - urtw_write32_m(sc, 0xfc, (7 << 12) | (3 << 8) | 0x1c); - urtw_write8_m(sc, URTW_ACM_CONTROL, 0); + urtw_write32_m(sc, URTW_8187B_AC_VO, (7 << 12) | (3 << 8) | 0x1c); + urtw_write32_m(sc, URTW_8187B_AC_VI, (7 << 12) | (3 << 8) | 0x1c); + urtw_write32_m(sc, URTW_8187B_AC_BE, (7 << 12) | (3 << 8) | 0x1c); + urtw_write32_m(sc, URTW_8187B_AC_BK, (7 << 12) | (3 << 8) | 0x1c); urtw_8187_write_phy_ofdm(sc, 0x97, 0x46); urtw_8187_write_phy_ofdm(sc, 0xa4, 0xb6); urtw_8187_write_phy_ofdm(sc, 0x85, 0xfc); urtw_8187_write_phy_cck(sc, 0xc1, 0x88); + fail: return (error); #undef N @@ -3327,8 +3365,6 @@ fail: static usb_error_t urtw_8225v2b_rf_set_chan(struct urtw_softc *sc, int chan) { - int ack; - struct ieee80211com *ic = sc->sc_ifp->if_l2com; usb_error_t error; error = urtw_8225v2b_set_txpwrlvl(sc, chan); @@ -3337,33 +3373,6 @@ urtw_8225v2b_rf_set_chan(struct urtw_sof urtw_8225_write(sc, URTW_8225_ADDR_7_MAGIC, urtw_8225_channel[chan]); usb_pause_mtx(&sc->sc_mtx, 10); - - urtw_write8_m(sc, URTW_SIFS, 0xa); - if (ic->ic_flags & IEEE80211_F_SHSLOT) { - urtw_write8_m(sc, URTW_SLOT, 0x9); - urtw_write8_m(sc, URTW_DIFS, 0x1c); - /* In 8187B, BRSR + 1 ==> EIFS register */ - urtw_write8_m(sc, URTW_BRSR + 1, 0x53); - - ack = 112 + 48 + 0x1c; - ack += (ic->ic_flags & IEEE80211_F_SHPREAMBLE) ? - 72 : 144; - urtw_write8_m(sc, URTW_CARRIER_SCOUNT, - roundup2(ack, 4)); - } else { - urtw_write8_m(sc, URTW_SLOT, 0x14); - urtw_write8_m(sc, URTW_DIFS, 0x32); - /* In 8187B, BRSR + 1 ==> EIFS register */ - urtw_write8_m(sc, URTW_BRSR + 1, 0x5b); - - ack = 112 + 48 + 0x32; - ack += (ic->ic_flags & IEEE80211_F_SHPREAMBLE) ? - 72 : 144; - urtw_write8_m(sc, URTW_CARRIER_SCOUNT, - roundup2(ack, 4)); - - } - fail: return (error); } @@ -3819,8 +3828,10 @@ urtw_rx_enable(struct urtw_softc *sc) if (error != 0) goto fail; - urtw_read8_m(sc, URTW_CMD, &data); - urtw_write8_m(sc, URTW_CMD, data | URTW_CMD_RX_ENABLE); + if ((sc->sc_flags & URTW_RTL8187B) == 0) { + urtw_read8_m(sc, URTW_CMD, &data); + urtw_write8_m(sc, URTW_CMD, data | URTW_CMD_RX_ENABLE); + } fail: return (error); } @@ -3844,8 +3855,9 @@ urtw_tx_enable(struct urtw_softc *sc) (7 << 21); /* MAX TX DMA */ urtw_write32_m(sc, URTW_TX_CONF, data); - urtw_read8_m(sc, URTW_CMD, &data8); - urtw_write8_m(sc, URTW_CMD, data8 | URTW_CMD_TX_ENABLE); + urtw_read8_m(sc, URTW_MSR, &data8); + data8 |= URTW_MSR_LINK_ENEDCA; + urtw_write8_m(sc, URTW_MSR, data8); return (error); } @@ -3929,14 +3941,13 @@ static struct mbuf * urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *data, int *rssi_p, int8_t *nf_p) { - int actlen, flen, len, nf = -95, rssi; + int actlen, flen, rssi; struct ieee80211_frame *wh; struct mbuf *m, *mnew; - struct urtw_8187b_rxhdr *bhdr; struct urtw_softc *sc = data->sc; struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; - uint8_t *desc, quality = 0, rate; + uint8_t noise = 0, rate; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); @@ -3946,39 +3957,34 @@ urtw_rxeof(struct usb_xfer *xfer, struct } if (sc->sc_flags & URTW_RTL8187B) { - len = actlen - (sizeof(struct urtw_8187b_rxhdr)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From weongyo at FreeBSD.org Sun Oct 18 00:46:59 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Sun Oct 18 00:47:05 2009 Subject: svn commit: r198195 - head/share/man/man4 Message-ID: <200910180046.n9I0kxmb055069@svn.freebsd.org> Author: weongyo Date: Sun Oct 18 00:46:59 2009 New Revision: 198195 URL: http://svn.freebsd.org/changeset/base/198195 Log: adds devices supportted by urtw(4) and bumps date. Modified: head/share/man/man4/urtw.4 Modified: head/share/man/man4/urtw.4 ============================================================================== --- head/share/man/man4/urtw.4 Sun Oct 18 00:11:49 2009 (r198194) +++ head/share/man/man4/urtw.4 Sun Oct 18 00:46:59 2009 (r198195) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 2, 2009 +.Dd October 17, 2009 .Dt URTW 4 .Os .Sh NAME @@ -70,9 +70,15 @@ driver supports Realtek RTL8187B/L based .Pp .Bl -column "Shuttle XPC Accessory PN20" "RTL8225" "USB" -compact -offset 6n .It Em "Card Radio Bus" +.It "Belkin F5D7050E RTL8225 USB" +.It "Linksys WUSB54GCv2 RTL8225 USB" .It "Netgear WG111v2 RTL8225 USB" +.It "Netgear WG111v3 RTL8225 USB" .It "Safehome WLG-1500SMA5 RTL8225 USB" .It "Shuttle XPC Accessory PN20 RTL8225 USB" +.It "Sitecom WL168v1 RTL8225 USB" +.It "Sitecom WL168v4 RTL8225 USB" +.It "SureCom EP-9001-g(2A) RTL8225 USB" .It "TRENDnet TEW-424UB V3.xR RTL8225 USB" .El .Sh EXAMPLES From rwatson at FreeBSD.org Sun Oct 18 11:23:57 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Oct 18 11:24:08 2009 Subject: svn commit: r198196 - head/sys/netinet Message-ID: <200910181123.n9IBNuWE067492@svn.freebsd.org> Author: rwatson Date: Sun Oct 18 11:23:56 2009 New Revision: 198196 URL: http://svn.freebsd.org/changeset/base/198196 Log: Rewrap ip_input() comment so that it prints more nicely. MFC after: 3 days Modified: head/sys/netinet/ip_input.c Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Sun Oct 18 00:46:59 2009 (r198195) +++ head/sys/netinet/ip_input.c Sun Oct 18 11:23:56 2009 (r198196) @@ -530,9 +530,9 @@ tooshort: } if ((dchg = (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL)) != 0) { /* - * Directly ship on the packet. This allows to forward packets - * that were destined for us to some other directly connected - * host. + * Directly ship on the packet. This allows to forward + * packets that were destined for us to some other directly + * connected host. */ ip_forward(m, dchg); return; From fjoe at FreeBSD.org Sun Oct 18 11:26:09 2009 From: fjoe at FreeBSD.org (Max Khon) Date: Sun Oct 18 11:26:21 2009 Subject: svn commit: r198197 - head/usr.bin/make Message-ID: <200910181126.n9IBQ9kJ067571@svn.freebsd.org> Author: fjoe Date: Sun Oct 18 11:26:09 2009 New Revision: 198197 URL: http://svn.freebsd.org/changeset/base/198197 Log: Exit with non-zero error code in case of errors when make is run with -k and not parallel (compat) make is run. Modified: head/usr.bin/make/job.c Modified: head/usr.bin/make/job.c ============================================================================== --- head/usr.bin/make/job.c Sun Oct 18 11:23:56 2009 (r198196) +++ head/usr.bin/make/job.c Sun Oct 18 11:26:09 2009 (r198197) @@ -3380,6 +3380,8 @@ Compat_Run(Lst *targs) printf("`%s' not remade because of errors.\n", gn->name); makeErrors++; + } else if (gn->made == ERROR) { + makeErrors++; } } From rwatson at FreeBSD.org Sun Oct 18 11:27:35 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Oct 18 11:27:41 2009 Subject: svn commit: r198198 - head/sys/net Message-ID: <200910181127.n9IBRYwf067631@svn.freebsd.org> Author: rwatson Date: Sun Oct 18 11:27:34 2009 New Revision: 198198 URL: http://svn.freebsd.org/changeset/base/198198 Log: Line-wrap pfil.c so that it prints more nicely. MFC after: 3 days Modified: head/sys/net/pfil.c Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Sun Oct 18 11:26:09 2009 (r198197) +++ head/sys/net/pfil.c Sun Oct 18 11:27:34 2009 (r198198) @@ -49,12 +49,14 @@ static struct mtx pfil_global_lock; -MTX_SYSINIT(pfil_heads_lock, &pfil_global_lock, "pfil_head_list lock", MTX_DEF); +MTX_SYSINIT(pfil_heads_lock, &pfil_global_lock, "pfil_head_list lock", + MTX_DEF); static int pfil_list_add(pfil_list_t *, struct packet_filter_hook *, int); static int pfil_list_remove(pfil_list_t *, - int (*)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), void *); + int (*)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), + void *); LIST_HEAD(pfilheadhead, pfil_head); VNET_DEFINE(struct pfilheadhead, pfil_head_list); @@ -77,7 +79,8 @@ pfil_run_hooks(struct pfil_head *ph, str for (pfh = pfil_hook_get(dir, ph); pfh != NULL; pfh = TAILQ_NEXT(pfh, pfil_link)) { if (pfh->pfil_func != NULL) { - rv = (*pfh->pfil_func)(pfh->pfil_arg, &m, ifp, dir, inp); + rv = (*pfh->pfil_func)(pfh->pfil_arg, &m, ifp, dir, + inp); if (rv != 0 || m == NULL) break; } @@ -221,8 +224,8 @@ error: * hook list. */ int -pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), - void *arg, int flags, struct pfil_head *ph) +pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, + struct inpcb *), void *arg, int flags, struct pfil_head *ph) { int err = 0; @@ -273,7 +276,8 @@ pfil_list_add(pfil_list_t *list, struct */ static int pfil_list_remove(pfil_list_t *list, - int (*func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), void *arg) + int (*func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), + void *arg) { struct packet_filter_hook *pfh; From fjoe at FreeBSD.org Sun Oct 18 11:28:32 2009 From: fjoe at FreeBSD.org (Max Khon) Date: Sun Oct 18 11:28:44 2009 Subject: svn commit: r198199 - head/usr.bin/make Message-ID: <200910181128.n9IBSWfI067684@svn.freebsd.org> Author: fjoe Date: Sun Oct 18 11:28:31 2009 New Revision: 198199 URL: http://svn.freebsd.org/changeset/base/198199 Log: Reset UPTODATE gnodes after remaking makefiles when make is not going to be restarted: such nodes could be marked UPTODATE without doing rebuild due to remakingMakefiles being TRUE. Modified: head/usr.bin/make/main.c Modified: head/usr.bin/make/main.c ============================================================================== --- head/usr.bin/make/main.c Sun Oct 18 11:27:34 2009 (r198198) +++ head/usr.bin/make/main.c Sun Oct 18 11:28:31 2009 (r198199) @@ -706,6 +706,7 @@ Main_AddSourceMakefile(const char *name) static void Remake_Makefiles(void) { + Lst cleanup; LstNode *ln; int error_cnt = 0; int remade_cnt = 0; @@ -716,6 +717,7 @@ Remake_Makefiles(void) Fatal("Failed to change directory to %s.", curdir); } + Lst_Init(&cleanup); LST_FOREACH(ln, &source_makefiles) { LstNode *ln2; struct GNode *gn; @@ -791,21 +793,7 @@ Remake_Makefiles(void) gn->name); error_cnt++; } else if (gn->made == UPTODATE) { - Lst examine; - - Lst_Init(&examine); - Lst_EnQueue(&examine, gn); - while (!Lst_IsEmpty(&examine)) { - LstNode *eln; - GNode *egn = Lst_DeQueue(&examine); - - egn->make = FALSE; - LST_FOREACH(eln, &egn->children) { - GNode *cgn = Lst_Datum(eln); - - Lst_EnQueue(&examine, cgn); - } - } + Lst_EnQueue(&cleanup, gn); } } @@ -827,6 +815,24 @@ Remake_Makefiles(void) } } + while (!Lst_IsEmpty(&cleanup)) { + GNode *gn = Lst_DeQueue(&cleanup); + + gn->unmade = 0; + gn->make = FALSE; + gn->made = UNMADE; + gn->childMade = FALSE; + gn->mtime = gn->cmtime = 0; + gn->cmtime_gn = NULL; + + LST_FOREACH(ln, &gn->children) { + GNode *cgn = Lst_Datum(ln); + + gn->unmade++; + Lst_EnQueue(&cleanup, cgn); + } + } + if (curdir != objdir) { if (chdir(objdir) < 0) Fatal("Failed to change directory to %s.", objdir); From kib at FreeBSD.org Sun Oct 18 12:55:40 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 18 12:55:47 2009 Subject: svn commit: r198201 - head/sys/vm Message-ID: <200910181255.n9ICtelB069286@svn.freebsd.org> Author: kib Date: Sun Oct 18 12:55:39 2009 New Revision: 198201 URL: http://svn.freebsd.org/changeset/base/198201 Log: Remove spurious call to priv_check(PRIV_VM_SWAP_NOQUOTA). Call priv_check(PRIV_VM_SWAP_NORLIMIT) only when per-uid limit is actually exceed. Both changes aim at calling priv_check(9) only for the cases when privilege is actually exercised by the process. Reported and tested by: rwatson Reviewed by: alc MFC after: 3 days Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun Oct 18 12:48:23 2009 (r198200) +++ head/sys/vm/swap_pager.c Sun Oct 18 12:55:39 2009 (r198201) @@ -176,7 +176,7 @@ swap_reserve(vm_ooffset_t incr) int swap_reserve_by_uid(vm_ooffset_t incr, struct uidinfo *uip) { - vm_ooffset_t r, s, max; + vm_ooffset_t r, s; int res, error; static int curfail; static struct timeval lastfail; @@ -185,7 +185,6 @@ swap_reserve_by_uid(vm_ooffset_t incr, s panic("swap_reserve: & PAGE_MASK"); res = 0; - error = priv_check(curthread, PRIV_VM_SWAP_NOQUOTA); mtx_lock(&sw_dev_mtx); r = swap_reserved + incr; if (overcommit & SWAP_RESERVE_ALLOW_NONWIRED) { @@ -204,10 +203,9 @@ swap_reserve_by_uid(vm_ooffset_t incr, s if (res) { PROC_LOCK(curproc); UIDINFO_VMSIZE_LOCK(uip); - error = priv_check(curthread, PRIV_VM_SWAP_NORLIMIT); - max = (error != 0) ? lim_cur(curproc, RLIMIT_SWAP) : 0; - if (max != 0 && uip->ui_vmsize + incr > max && - (overcommit & SWAP_RESERVE_RLIMIT_ON) != 0) + if ((overcommit & SWAP_RESERVE_RLIMIT_ON) != 0 && + uip->ui_vmsize + incr > lim_cur(curproc, RLIMIT_SWAP) && + priv_check(curthread, PRIV_VM_SWAP_NORLIMIT)) res = 0; else uip->ui_vmsize += incr; From kib at FreeBSD.org Sun Oct 18 12:57:49 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 18 12:57:56 2009 Subject: svn commit: r198202 - head/sys/kern Message-ID: <200910181257.n9ICvn3R069352@svn.freebsd.org> Author: kib Date: Sun Oct 18 12:57:48 2009 New Revision: 198202 URL: http://svn.freebsd.org/changeset/base/198202 Log: If ET_DYN binary has non-zero base address for some reason, honour it and do not relocate the binary to ET_DYN_LOAD_ADDR. This allows for the binary author to influence address map of the process. In particular, when the binary is actually an interpeter, this allows to have almost usual process address map. Communicate the relocation bias of the mapping for interpeter-less ET_DYN binary, that is interperter itself, in AT_BASE aux entry. This way, rtld is able to find its dynamic structure and relocate itself. Note that mapbase in the rtld is still wrong and requires further fixing. Reported and tested by: rwatson Discussed with: kan MFC after: 3 days Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sun Oct 18 12:55:39 2009 (r198201) +++ head/sys/kern/imgact_elf.c Sun Oct 18 12:57:48 2009 (r198202) @@ -688,9 +688,9 @@ __CONCAT(exec_, __elfN(imgact))(struct i u_long text_size = 0, data_size = 0, total_size = 0; u_long text_addr = 0, data_addr = 0; u_long seg_size, seg_addr; - u_long addr, et_dyn_addr, entry = 0, proghdr = 0; + u_long addr, baddr, et_dyn_addr, entry = 0, proghdr = 0; int32_t osrel = 0; - int error = 0, i; + int error = 0, i, n; const char *interp = NULL, *newinterp = NULL; Elf_Brandinfo *brand_info; char *path; @@ -719,14 +719,22 @@ __CONCAT(exec_, __elfN(imgact))(struct i phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); if (!aligned(phdr, Elf_Addr)) return (ENOEXEC); + n = 0; + baddr = 0; for (i = 0; i < hdr->e_phnum; i++) { + if (phdr[i].p_type == PT_LOAD) { + if (n == 0) + baddr = phdr[i].p_vaddr; + n++; + continue; + } if (phdr[i].p_type == PT_INTERP) { /* Path to interpreter */ if (phdr[i].p_filesz > MAXPATHLEN || phdr[i].p_offset + phdr[i].p_filesz > PAGE_SIZE) return (ENOEXEC); interp = imgp->image_header + phdr[i].p_offset; - break; + continue; } } @@ -739,7 +747,14 @@ __CONCAT(exec_, __elfN(imgact))(struct i if (hdr->e_type == ET_DYN) { if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) return (ENOEXEC); - et_dyn_addr = ET_DYN_LOAD_ADDR; + /* + * Honour the base load address from the dso if it is + * non-zero for some reason. + */ + if (baddr == 0) + et_dyn_addr = ET_DYN_LOAD_ADDR; + else + et_dyn_addr = 0; } else et_dyn_addr = 0; sv = brand_info->sysvec; @@ -910,7 +925,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i return (error); } } else - addr = 0; + addr = et_dyn_addr; /* * Construct auxargs table (used by the fixup routine) From marius at FreeBSD.org Sun Oct 18 13:08:17 2009 From: marius at FreeBSD.org (Marius Strobl) Date: Sun Oct 18 13:08:23 2009 Subject: svn commit: r198203 - in head/sys: sparc64/include sun4v/include Message-ID: <200910181308.n9ID8FCP069572@svn.freebsd.org> Author: marius Date: Sun Oct 18 13:08:15 2009 New Revision: 198203 URL: http://svn.freebsd.org/changeset/base/198203 Log: Change the load base to below 2GB so PIE binaries work including when compiled to use the Medium/Low code model, which we currently default to for the userland. GNU/Linux has moved their default to Medium/Middle some time ago, which probably explains why the current GNU ld(1) uses a base in the range between 32 and 44 bits instead. Submitted by: kib Modified: head/sys/sparc64/include/elf.h head/sys/sun4v/include/elf.h Modified: head/sys/sparc64/include/elf.h ============================================================================== --- head/sys/sparc64/include/elf.h Sun Oct 18 12:57:48 2009 (r198202) +++ head/sys/sparc64/include/elf.h Sun Oct 18 13:08:15 2009 (r198203) @@ -97,6 +97,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH ELF_ARCH #define ELF_TARG_VER 1 -#define ET_DYN_LOAD_ADDR 0x150000000 +#define ET_DYN_LOAD_ADDR 0x100000 #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/sun4v/include/elf.h ============================================================================== --- head/sys/sun4v/include/elf.h Sun Oct 18 12:57:48 2009 (r198202) +++ head/sys/sun4v/include/elf.h Sun Oct 18 13:08:15 2009 (r198203) @@ -97,6 +97,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH ELF_ARCH #define ELF_TARG_VER 1 -#define ET_DYN_LOAD_ADDR 0x150000000 +#define ET_DYN_LOAD_ADDR 0x100000 #endif /* !_MACHINE_ELF_H_ */ From rpaulo at FreeBSD.org Sun Oct 18 13:51:50 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sun Oct 18 13:51:55 2009 Subject: svn commit: r198204 - head/sys/dev/hwpmc Message-ID: <200910181351.n9IDpns6070668@svn.freebsd.org> Author: rpaulo Date: Sun Oct 18 13:51:49 2009 New Revision: 198204 URL: http://svn.freebsd.org/changeset/base/198204 Log: Fix KASSERT string to include the real module name. Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Sun Oct 18 13:08:15 2009 (r198203) +++ head/sys/dev/hwpmc/hwpmc_mod.c Sun Oct 18 13:51:49 2009 (r198204) @@ -504,7 +504,7 @@ pmc_ri_to_classdep(struct pmc_mdep *md, pcd = pmc_rowindex_to_classdep[ri]; KASSERT(pcd != NULL, - ("[amd,%d] ri %d null pcd", __LINE__, ri)); + ("[pmc,%d] ri %d null pcd", __LINE__, ri)); *adjri = ri - pcd->pcd_ri; From rwatson at FreeBSD.org Sun Oct 18 13:55:38 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Oct 18 13:55:50 2009 Subject: svn commit: r198118 - head/usr.bin/netstat In-Reply-To: <20091016154905.E8438@delplex.bde.org> References: <200910151031.n9FAVOvU070664@svn.freebsd.org> <20091016154905.E8438@delplex.bde.org> Message-ID: On Fri, 16 Oct 2009, Bruce Evans wrote: > On Thu, 15 Oct 2009, Robert Watson wrote: > >> Log: >> Print routing statistics as unsigned short rather than unsigned int, >> otherwise sign extension leads to unlikely values when in the negative >> range of the signed short structure fields that hold the statistics. >> The type used to hold routing statistics is arguably also incorrect. > > This enlarges the bug. With signed types you get advance warning of > overflow (you actually get overflow earlier but it usually just results in > obviously wrong values being printed), and repeated warnings on overflow > (every time the overflowing values wrap back to negative). With unsigned > types or this change, you get unobviously wrong values after the first > overflow, and no repeated warnings (unless you watch the values carefully > enough to see them go backwards). Using unsigned bytes only delays the > overflow for a whole factor of 2. Yes, a preferable fix would be to move to a u_long (or the like) for the statistics, but unfortunately it's too late in the game to fix that for 8.0. I'll change the statistics types in 9.0 at some point. Robert N M Watson Computer Laboratory University of Cambridge From maxim at FreeBSD.org Sun Oct 18 17:10:40 2009 From: maxim at FreeBSD.org (Maxim Konovalov) Date: Sun Oct 18 17:10:46 2009 Subject: svn commit: r198210 - head/share/misc Message-ID: <200910181710.n9IHAdvY074408@svn.freebsd.org> Author: maxim Date: Sun Oct 18 17:10:39 2009 New Revision: 198210 URL: http://svn.freebsd.org/changeset/base/198210 Log: o OpenBSD 4.6 added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Sun Oct 18 15:58:57 2009 (r198209) +++ head/share/misc/bsd-family-tree Sun Oct 18 17:10:39 2009 (r198210) @@ -230,7 +230,7 @@ FreeBSD 5.2 | | | FreeBSD 7.2 | NetBSD 5.0 OpenBSD 4.5 | | | | | | | | | | | | DragonFly 2.4.0 - | V | | | | + | V | | OpenBSD 4.6 | | | | | | FreeBSD 8 -current | NetBSD -current OpenBSD -current | | | | | | @@ -504,6 +504,7 @@ NetBSD 5.0 2009-04-29 [NBD] OpenBSD 4.5 2009-05-01 [OBD] FreeBSD 7.2 2009-05-04 [FBD] DragonFly 2.4.0 2009-09-16 [DFB] +OpenBSD 4.6 2009-10-18 [OBD] Bibliography ------------------------ From nwhitehorn at FreeBSD.org Sun Oct 18 17:11:16 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sun Oct 18 17:11:28 2009 Subject: svn commit: r198211 - head/sys/dev/gem Message-ID: <200910181711.n9IHBG6W074471@svn.freebsd.org> Author: nwhitehorn Date: Sun Oct 18 17:11:16 2009 New Revision: 198211 URL: http://svn.freebsd.org/changeset/base/198211 Log: Work around a quirk with the G5 Xserve, which has a fake GMAC controller with an all-zero MAC address. In this case, don't attach. Discussed with: marius Modified: head/sys/dev/gem/if_gem_pci.c Modified: head/sys/dev/gem/if_gem_pci.c ============================================================================== --- head/sys/dev/gem/if_gem_pci.c Sun Oct 18 17:10:39 2009 (r198210) +++ head/sys/dev/gem/if_gem_pci.c Sun Oct 18 17:11:16 2009 (r198211) @@ -295,6 +295,16 @@ gem_pci_attach(device_t dev) GEM_PCI_ROM_OFFSET + j + PCI_VPDRES_LARGE_SIZE + PCI_VPD_SIZE, sc->sc_enaddr, ETHER_ADDR_LEN); #endif + /* + * The Xserve G5 has a fake GMAC with an all-zero MAC address. + * Check for this, and don't attach in this case. + */ + + for (i = 0; i < ETHER_ADDR_LEN && sc->sc_enaddr[i] == 0; i++) {} + if (i == ETHER_ADDR_LEN) { + device_printf(dev, "invalid MAC address\n"); + goto fail; + } if (gem_attach(sc) != 0) { device_printf(dev, "could not be attached\n"); From nwhitehorn at FreeBSD.org Sun Oct 18 17:22:09 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sun Oct 18 17:22:15 2009 Subject: svn commit: r198212 - head/sys/powerpc/aim Message-ID: <200910181722.n9IHM9Ll074706@svn.freebsd.org> Author: nwhitehorn Date: Sun Oct 18 17:22:08 2009 New Revision: 198212 URL: http://svn.freebsd.org/changeset/base/198212 Log: Don't assume that physical addresses are identity mapped. This allows the second processor on G5 systems to start. Note that SMP is still non-functional on these systems because of IPI delivery problems. Modified: head/sys/powerpc/aim/platform_chrp.c Modified: head/sys/powerpc/aim/platform_chrp.c ============================================================================== --- head/sys/powerpc/aim/platform_chrp.c Sun Oct 18 17:11:16 2009 (r198211) +++ head/sys/powerpc/aim/platform_chrp.c Sun Oct 18 17:22:08 2009 (r198212) @@ -35,11 +35,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include #include +#include #include #include @@ -220,6 +223,7 @@ chrp_smp_start_cpu(platform_t plat, stru #ifdef SMP phandle_t cpu; volatile uint8_t *rstvec; + static volatile uint8_t *rstvec_virtbase = NULL; int res, reset, timeout; cpu = pc->pc_hwref; @@ -229,7 +233,10 @@ chrp_smp_start_cpu(platform_t plat, stru ap_pcpu = pc; - rstvec = (uint8_t *)(0x80000000 + reset); + if (rstvec_virtbase == NULL) + rstvec_virtbase = pmap_mapdev(0x80000000, PAGE_SIZE); + + rstvec = rstvec_virtbase + reset; *rstvec = 4; powerpc_sync(); From ed at FreeBSD.org Sun Oct 18 19:45:45 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Oct 18 19:45:51 2009 Subject: svn commit: r198213 - head/sys/kern Message-ID: <200910181945.n9IJjijt077186@svn.freebsd.org> Author: ed Date: Sun Oct 18 19:45:44 2009 New Revision: 198213 URL: http://svn.freebsd.org/changeset/base/198213 Log: Make lock devices work properly. It turned out I did add the code to use the init state devices to set the termios structure when opening the device, but it seems I totally forgot to add the bits required to force the actual locking of flags through the lock state devices. Reported by: ru MFC after: 1 week (to be discussed) Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Oct 18 17:22:08 2009 (r198212) +++ head/sys/kern/tty.c Sun Oct 18 19:45:44 2009 (r198213) @@ -523,6 +523,34 @@ ttydev_ioctl(struct cdev *dev, u_long cm goto done; } + if (cmd == TIOCSETA || cmd == TIOCSETAW || cmd == TIOCSETAF) { + struct termios *old = &tp->t_termios; + struct termios *new = (struct termios *)data; + struct termios *lock = TTY_CALLOUT(tp, dev) ? + &tp->t_termios_lock_out : &tp->t_termios_lock_in; + int cc; + + /* + * Lock state devices. Just overwrite the values of the + * commands that are currently in use. + */ + new->c_iflag = (old->c_iflag & lock->c_iflag) | + (new->c_iflag & ~lock->c_iflag); + new->c_oflag = (old->c_oflag & lock->c_oflag) | + (new->c_oflag & ~lock->c_oflag); + new->c_cflag = (old->c_cflag & lock->c_cflag) | + (new->c_cflag & ~lock->c_cflag); + new->c_lflag = (old->c_lflag & lock->c_lflag) | + (new->c_lflag & ~lock->c_lflag); + for (cc = 0; cc < NCCS; ++cc) + if (lock->c_cc[cc]) + new->c_cc[cc] = old->c_cc[cc]; + if (lock->c_ispeed) + new->c_ispeed = old->c_ispeed; + if (lock->c_ospeed) + new->c_ospeed = old->c_ospeed; + } + error = tty_ioctl(tp, cmd, data, td); done: tty_unlock(tp); From ed at FreeBSD.org Sun Oct 18 19:48:54 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Oct 18 19:49:01 2009 Subject: svn commit: r198214 - in head: etc sys/kern Message-ID: <200910181948.n9IJmsUd077273@svn.freebsd.org> Author: ed Date: Sun Oct 18 19:48:53 2009 New Revision: 198214 URL: http://svn.freebsd.org/changeset/base/198214 Log: Allow the buffer size to be configured for pseudo-like TTY devices. Devices that don't implement param() (which means they don't support hardware parameters such as flow control, baud rate) hardcode the baud rate to TTYDEF_SPEED. This means the buffer size cannot be configured, which is a little inconvenient when using canonical mode with big lines of input, etc. Make it adjustable, but do clamp it between B50 and B115200 to prevent awkward buffer sizes. Remove the baud rate assignment from /etc/gettytab. Trust the kernel to fill in a proper value. Reported by: Mikolaj Golub MFC after: 1 month Modified: head/etc/gettytab head/sys/kern/tty.c Modified: head/etc/gettytab ============================================================================== --- head/etc/gettytab Sun Oct 18 19:45:44 2009 (r198213) +++ head/etc/gettytab Sun Oct 18 19:48:53 2009 (r198214) @@ -162,7 +162,7 @@ X|Xwindow|X window system:\ :fd@:nd@:cd@:rw:sp#9600: P|Pc|Pc console:\ - :ht:np:sp#115200: + :ht:np: # # Wierdo special case for fast crt's with hardcopy devices Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Oct 18 19:45:44 2009 (r198213) +++ head/sys/kern/tty.c Sun Oct 18 19:48:53 2009 (r198214) @@ -870,8 +870,19 @@ static int ttydevsw_defparam(struct tty *tp, struct termios *t) { - /* Use a fake baud rate, we're not a real device. */ - t->c_ispeed = t->c_ospeed = TTYDEF_SPEED; + /* + * Allow the baud rate to be adjusted for pseudo-devices, but at + * least restrict it to 115200 to prevent excessive buffer + * usage. Also disallow 0, to prevent foot shooting. + */ + if (t->c_ispeed < B50) + t->c_ispeed = B50; + else if (t->c_ispeed > B115200) + t->c_ispeed = B115200; + if (t->c_ospeed < B50) + t->c_ospeed = B50; + else if (t->c_ospeed > B115200) + t->c_ospeed = B115200; return (0); } From ed at FreeBSD.org Sun Oct 18 19:50:15 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Oct 18 19:50:22 2009 Subject: svn commit: r198215 - head/usr.sbin/jail Message-ID: <200910181950.n9IJoFJ1077342@svn.freebsd.org> Author: ed Date: Sun Oct 18 19:50:15 2009 New Revision: 198215 URL: http://svn.freebsd.org/changeset/base/198215 Log: Fix a typo in the jail(8) manpage. Submitted by: Jille Timmermans MFC after: 1 week Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Sun Oct 18 19:48:53 2009 (r198214) +++ head/usr.sbin/jail/jail.8 Sun Oct 18 19:50:15 2009 (r198215) @@ -377,7 +377,7 @@ Since raw sockets can be used to configu network subsystems, extra caution should be used where privileged access to jails is given out to untrusted parties. .It Va allow.chflags -Normally, priveleged users inside a jail are treated as unprivileged by +Normally, privileged users inside a jail are treated as unprivileged by .Xr chflags 2 . When this parameter is set, such users are treated as privileged, and may manipulate system file flags subject to the usual constraints on From ed at FreeBSD.org Sun Oct 18 19:51:07 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Oct 18 19:51:18 2009 Subject: svn commit: r198216 - head/etc Message-ID: <200910181951.n9IJp645077401@svn.freebsd.org> Author: ed Date: Sun Oct 18 19:51:06 2009 New Revision: 198216 URL: http://svn.freebsd.org/changeset/base/198216 Log: Fix qouting in a comment, to make it look more consistent Submitted by: Jille Timmermans MFC after: 1 week Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sun Oct 18 19:50:15 2009 (r198215) +++ head/etc/rc.subr Sun Oct 18 19:51:06 2009 (r198216) @@ -593,7 +593,7 @@ run_rc_command() rc_fast=yes rc_quiet=yes ;; - force*) # "force prefix; always run + force*) # "force" prefix; always run rc_force=yes _rc_prefix=force rc_arg=${rc_arg#${_rc_prefix}} From ed at FreeBSD.org Sun Oct 18 20:33:24 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Oct 18 20:33:31 2009 Subject: svn commit: r198217 - head/usr.sbin/jail Message-ID: <200910182033.n9IKXOeZ078493@svn.freebsd.org> Author: ed Date: Sun Oct 18 20:33:24 2009 New Revision: 198217 URL: http://svn.freebsd.org/changeset/base/198217 Log: Don't forget to increment the man page date. Reported by: bz Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Sun Oct 18 19:51:06 2009 (r198216) +++ head/usr.sbin/jail/jail.8 Sun Oct 18 20:33:24 2009 (r198217) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 25, 2009 +.Dd October 18, 2009 .Dt JAIL 8 .Os .Sh NAME From rwatson at FreeBSD.org Sun Oct 18 22:43:29 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Oct 18 22:44:09 2009 Subject: svn commit: r198218 - head/sys/net Message-ID: <200910182243.n9IMhSTc080720@svn.freebsd.org> Author: rwatson Date: Sun Oct 18 22:43:28 2009 New Revision: 198218 URL: http://svn.freebsd.org/changeset/base/198218 Log: Sort function prototypes in pfil.h, clean up white space, and better align fields for printing. MFC after: 3 days Modified: head/sys/net/pfil.h Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Sun Oct 18 20:33:24 2009 (r198217) +++ head/sys/net/pfil.h Sun Oct 18 22:43:28 2009 (r198218) @@ -50,7 +50,7 @@ struct inpcb; struct packet_filter_hook { TAILQ_ENTRY(packet_filter_hook) pfil_link; int (*pfil_func)(void *, struct mbuf **, struct ifnet *, int, - struct inpcb *); + struct inpcb *); void *pfil_arg; int pfil_flags; }; @@ -80,14 +80,13 @@ struct pfil_head { LIST_ENTRY(pfil_head) ph_list; }; +int pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, + int, struct inpcb *), void *, int, struct pfil_head *); +int pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, + int, struct inpcb *), void *, int, struct pfil_head *); int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, int, struct inpcb *inp); -int pfil_add_hook(int (*func)(void *, struct mbuf **, - struct ifnet *, int, struct inpcb *), void *, int, struct pfil_head *); -int pfil_remove_hook(int (*func)(void *, struct mbuf **, - struct ifnet *, int, struct inpcb *), void *, int, struct pfil_head *); - int pfil_head_register(struct pfil_head *); int pfil_head_unregister(struct pfil_head *); @@ -107,6 +106,7 @@ struct pfil_head *pfil_head_get(int, u_l static __inline struct packet_filter_hook * pfil_hook_get(int dir, struct pfil_head *ph) { + if (dir == PFIL_IN) return (TAILQ_FIRST(&ph->ph_in)); else if (dir == PFIL_OUT) From rwatson at FreeBSD.org Sun Oct 18 22:54:10 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Oct 18 22:54:20 2009 Subject: svn commit: r198219 - head/sys/net Message-ID: <200910182254.n9IMsAIW080988@svn.freebsd.org> Author: rwatson Date: Sun Oct 18 22:54:09 2009 New Revision: 198219 URL: http://svn.freebsd.org/changeset/base/198219 Log: Remove unused pfil_flags field in packet_filter_hook. MFC after: 3 days Modified: head/sys/net/pfil.h Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Sun Oct 18 22:43:28 2009 (r198218) +++ head/sys/net/pfil.h Sun Oct 18 22:54:09 2009 (r198219) @@ -52,7 +52,6 @@ struct packet_filter_hook { int (*pfil_func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *); void *pfil_arg; - int pfil_flags; }; #define PFIL_IN 0x00000001 From imp at bsdimp.com Mon Oct 19 04:15:31 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Mon Oct 19 04:15:42 2009 Subject: svn commit: r197969 - head/sys/conf In-Reply-To: <20091014185338.GA26673@alchemy.franken.de> References: <20091013.223459.-957891176.imp@bsdimp.com> <20091014185338.GA26673@alchemy.franken.de> Message-ID: <20091018.220841.387099187.imp@bsdimp.com> In message: <20091014185338.GA26673@alchemy.franken.de> Marius Strobl writes: : It would be really great if FreeBSD would distinguish between : LPC and real ISA so things like the ISAPNP code and ISA bus : front-ends of ATA, network and SCSI drivers etc wouldn't be : compliled into kernels for architectures that just have no : use for these as they have LPC but no ISA slots, but the lack : of activity in ISA driver development probably doesn't : warrant fixing this. driver ata nodriver ata.isa would be nice.. Warner From ed at FreeBSD.org Mon Oct 19 07:17:38 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Mon Oct 19 07:17:57 2009 Subject: svn commit: r198223 - in head/sys: kern sys Message-ID: <200910190717.n9J7HbpP094533@svn.freebsd.org> Author: ed Date: Mon Oct 19 07:17:37 2009 New Revision: 198223 URL: http://svn.freebsd.org/changeset/base/198223 Log: Properly set the low watermarks when reducing the baud rate. Now that buffers are deallocated lazily, we should not use tty*q_getsize() to obtain the buffer size to calculate the low watermarks. Doing this may cause the watermark to be placed outside the typical buffer size. This caused some regressions after my previous commit to the TTY code, which allows pseudo-devices to resize the buffers as well. Reported by: yongari, dougb MFC after: 1 week Modified: head/sys/kern/tty.c head/sys/sys/ttyqueue.h Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Oct 18 23:38:59 2009 (r198222) +++ head/sys/kern/tty.c Mon Oct 19 07:17:37 2009 (r198223) @@ -109,14 +109,14 @@ tty_watermarks(struct tty *tp) ttyinq_setsize(&tp->t_inq, tp, bs); /* Set low watermark at 10% (when 90% is available). */ - tp->t_inlow = (ttyinq_getsize(&tp->t_inq) * 9) / 10; + tp->t_inlow = (ttyinq_getallocatedsize(&tp->t_inq) * 9) / 10; /* Provide an ouput buffer for 0.2 seconds of data. */ bs = MIN(tp->t_termios.c_ospeed / 5, TTYBUF_MAX); ttyoutq_setsize(&tp->t_outq, tp, bs); /* Set low watermark at 10% (when 90% is available). */ - tp->t_outlow = (ttyoutq_getsize(&tp->t_outq) * 9) / 10; + tp->t_outlow = (ttyoutq_getallocatedsize(&tp->t_outq) * 9) / 10; } static int Modified: head/sys/sys/ttyqueue.h ============================================================================== --- head/sys/sys/ttyqueue.h Sun Oct 18 23:38:59 2009 (r198222) +++ head/sys/sys/ttyqueue.h Mon Oct 19 07:17:37 2009 (r198223) @@ -93,6 +93,13 @@ ttyinq_getsize(struct ttyinq *ti) } static __inline size_t +ttyinq_getallocatedsize(struct ttyinq *ti) +{ + + return (ti->ti_quota * TTYINQ_DATASIZE); +} + +static __inline size_t ttyinq_bytesleft(struct ttyinq *ti) { size_t len; @@ -143,6 +150,13 @@ ttyoutq_getsize(struct ttyoutq *to) } static __inline size_t +ttyoutq_getallocatedsize(struct ttyoutq *to) +{ + + return (to->to_quota * TTYOUTQ_DATASIZE); +} + +static __inline size_t ttyoutq_bytesleft(struct ttyoutq *to) { size_t len; From des at FreeBSD.org Mon Oct 19 07:55:13 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 19 07:55:24 2009 Subject: svn commit: r198224 - head/tools/regression/lib/libutil Message-ID: <200910190755.n9J7tDxd095199@svn.freebsd.org> Author: des Date: Mon Oct 19 07:55:13 2009 New Revision: 198224 URL: http://svn.freebsd.org/changeset/base/198224 Log: Remove redundant $FreeBSD$. Modified: head/tools/regression/lib/libutil/test-flopen.c Modified: head/tools/regression/lib/libutil/test-flopen.c ============================================================================== --- head/tools/regression/lib/libutil/test-flopen.c Mon Oct 19 07:17:37 2009 (r198223) +++ head/tools/regression/lib/libutil/test-flopen.c Mon Oct 19 07:55:13 2009 (r198224) @@ -23,8 +23,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #include From des at FreeBSD.org Mon Oct 19 07:56:04 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 19 07:56:22 2009 Subject: svn commit: r198225 - head/tools/regression/lib/libutil Message-ID: <200910190756.n9J7u4kP095254@svn.freebsd.org> Author: des Date: Mon Oct 19 07:56:03 2009 New Revision: 198225 URL: http://svn.freebsd.org/changeset/base/198225 Log: Update copyright. Modified: head/tools/regression/lib/libutil/test-flopen.c Modified: head/tools/regression/lib/libutil/test-flopen.c ============================================================================== --- head/tools/regression/lib/libutil/test-flopen.c Mon Oct 19 07:55:13 2009 (r198224) +++ head/tools/regression/lib/libutil/test-flopen.c Mon Oct 19 07:56:03 2009 (r198225) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2007-2009 Dag-Erling Coïdan Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without From ed at FreeBSD.org Mon Oct 19 11:10:45 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Mon Oct 19 11:11:23 2009 Subject: svn commit: r198229 - head/etc Message-ID: <200910191110.n9JBAiZ0000214@svn.freebsd.org> Author: ed Date: Mon Oct 19 11:10:44 2009 New Revision: 198229 URL: http://svn.freebsd.org/changeset/base/198229 Log: Partially revert the change to the gettytab made in r198214. By misinterpreting some data, I thought that getty wouldn't apply any baud rate to the syscons devices, but it uses the default entry instead. This means that the baud rate is set to 1200. This isn't too bad, except when using canonical mode. Make it use 9600 baud by default. MFC after: 1 week Modified: head/etc/gettytab Modified: head/etc/gettytab ============================================================================== --- head/etc/gettytab Mon Oct 19 08:52:57 2009 (r198228) +++ head/etc/gettytab Mon Oct 19 11:10:44 2009 (r198229) @@ -162,7 +162,7 @@ X|Xwindow|X window system:\ :fd@:nd@:cd@:rw:sp#9600: P|Pc|Pc console:\ - :ht:np: + :ht:np:sp#9600: # # Wierdo special case for fast crt's with hardcopy devices From rpaulo at FreeBSD.org Mon Oct 19 11:17:46 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Oct 19 11:17:59 2009 Subject: svn commit: r198230 - head/sys/net80211 Message-ID: <200910191117.n9JBHkxd000377@svn.freebsd.org> Author: rpaulo Date: Mon Oct 19 11:17:46 2009 New Revision: 198230 URL: http://svn.freebsd.org/changeset/base/198230 Log: HWMP fixes, namely: * fix the processing of RANN frames * the originator and target addresses were swapped and while it worked fine, it was not spec compliant. MFC after: 3 days Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Mon Oct 19 11:10:44 2009 (r198229) +++ head/sys/net80211/ieee80211_hwmp.c Mon Oct 19 11:17:46 2009 (r198230) @@ -148,7 +148,7 @@ typedef uint32_t ieee80211_hwmp_seq; struct ieee80211_hwmp_route { ieee80211_hwmp_seq hr_seq; /* last HWMP seq seen from dst*/ ieee80211_hwmp_seq hr_preqid; /* last PREQ ID seen from dst */ - ieee80211_hwmp_seq hr_targetseq; /* seq. no. on our latest PREQ*/ + ieee80211_hwmp_seq hr_origseq; /* seq. no. on our latest PREQ*/ int hr_preqretries; }; struct ieee80211_hwmp_state { @@ -733,12 +733,12 @@ hwmp_recv_preq(struct ieee80211vap *vap, prep.prep_flags = 0; prep.prep_hopcount = 0; prep.prep_ttl = ms->ms_ttl; - IEEE80211_ADDR_COPY(prep.prep_targetaddr, preq->preq_